diff options
Diffstat (limited to 'drivers')
329 files changed, 4993 insertions, 3469 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 087a7028ae84..b9f923ef173d 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -50,7 +50,6 @@ config ACPI_SLEEP | |||
50 | config ACPI_PROCFS | 50 | config ACPI_PROCFS |
51 | bool "Deprecated /proc/acpi files" | 51 | bool "Deprecated /proc/acpi files" |
52 | depends on PROC_FS | 52 | depends on PROC_FS |
53 | default y | ||
54 | ---help--- | 53 | ---help--- |
55 | For backwards compatibility, this option allows | 54 | For backwards compatibility, this option allows |
56 | deprecated /proc/acpi/ files to exist, even when | 55 | deprecated /proc/acpi/ files to exist, even when |
@@ -61,7 +60,6 @@ config ACPI_PROCFS | |||
61 | /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) | 60 | /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) |
62 | /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) | 61 | /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) |
63 | /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) | 62 | /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) |
64 | /proc/acpi/battery (/sys/class/power_supply) | ||
65 | /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) | 63 | /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) |
66 | /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) | 64 | /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) |
67 | 65 | ||
@@ -69,7 +67,21 @@ config ACPI_PROCFS | |||
69 | and functions which do not yet exist in /sys. | 67 | and functions which do not yet exist in /sys. |
70 | 68 | ||
71 | Say N to delete /proc/acpi/ files that have moved to /sys/ | 69 | Say N to delete /proc/acpi/ files that have moved to /sys/ |
72 | 70 | config ACPI_PROCFS_POWER | |
71 | bool "Deprecated power /proc/acpi folders" | ||
72 | depends on PROC_FS | ||
73 | default y | ||
74 | ---help--- | ||
75 | For backwards compatibility, this option allows | ||
76 | deprecated power /proc/acpi/ folders to exist, even when | ||
77 | they have been replaced by functions in /sys. | ||
78 | The deprecated folders (and their replacements) include: | ||
79 | /proc/acpi/battery/* (/sys/class/power_supply/*) | ||
80 | /proc/acpi/ac_adapter/* (sys/class/power_supply/*) | ||
81 | This option has no effect on /proc/acpi/ folders | ||
82 | and functions, which do not yet exist in /sys | ||
83 | |||
84 | Say N to delete power /proc/acpi/ folders that have moved to /sys/ | ||
73 | config ACPI_PROC_EVENT | 85 | config ACPI_PROC_EVENT |
74 | bool "Deprecated /proc/acpi/event support" | 86 | bool "Deprecated /proc/acpi/event support" |
75 | depends on PROC_FS | 87 | depends on PROC_FS |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 54e3ab0e5fc0..456446f90077 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -58,6 +58,6 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o | |||
58 | obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o | 58 | obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o |
59 | obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o | 59 | obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o |
60 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o | 60 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o |
61 | obj-y += cm_sbs.o | 61 | obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o |
62 | obj-$(CONFIG_ACPI_SBS) += sbs.o | 62 | obj-$(CONFIG_ACPI_SBS) += sbs.o |
63 | obj-$(CONFIG_ACPI_SBS) += sbshc.o | 63 | obj-$(CONFIG_ACPI_SBS) += sbshc.o |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 30238f6ff232..76ed4f52bebd 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -27,7 +27,7 @@ | |||
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 | #ifdef CONFIG_ACPI_PROCFS | 30 | #ifdef CONFIG_ACPI_PROCFS_POWER |
31 | #include <linux/proc_fs.h> | 31 | #include <linux/proc_fs.h> |
32 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
33 | #endif | 33 | #endif |
@@ -51,7 +51,7 @@ MODULE_AUTHOR("Paul Diefenbaugh"); | |||
51 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); | 51 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); |
52 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
53 | 53 | ||
54 | #ifdef CONFIG_ACPI_PROCFS | 54 | #ifdef CONFIG_ACPI_PROCFS_POWER |
55 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); | 55 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); |
56 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); | 56 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); |
57 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); | 57 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); |
@@ -86,7 +86,7 @@ struct acpi_ac { | |||
86 | 86 | ||
87 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); | 87 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); |
88 | 88 | ||
89 | #ifdef CONFIG_ACPI_PROCFS | 89 | #ifdef CONFIG_ACPI_PROCFS_POWER |
90 | static const struct file_operations acpi_ac_fops = { | 90 | static const struct file_operations acpi_ac_fops = { |
91 | .open = acpi_ac_open_fs, | 91 | .open = acpi_ac_open_fs, |
92 | .read = seq_read, | 92 | .read = seq_read, |
@@ -136,7 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) | |||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
139 | #ifdef CONFIG_ACPI_PROCFS | 139 | #ifdef CONFIG_ACPI_PROCFS_POWER |
140 | /* -------------------------------------------------------------------------- | 140 | /* -------------------------------------------------------------------------- |
141 | FS Interface (/proc) | 141 | FS Interface (/proc) |
142 | -------------------------------------------------------------------------- */ | 142 | -------------------------------------------------------------------------- */ |
@@ -275,7 +275,7 @@ static int acpi_ac_add(struct acpi_device *device) | |||
275 | if (result) | 275 | if (result) |
276 | goto end; | 276 | goto end; |
277 | 277 | ||
278 | #ifdef CONFIG_ACPI_PROCFS | 278 | #ifdef CONFIG_ACPI_PROCFS_POWER |
279 | result = acpi_ac_add_fs(device); | 279 | result = acpi_ac_add_fs(device); |
280 | #endif | 280 | #endif |
281 | if (result) | 281 | if (result) |
@@ -300,7 +300,7 @@ static int acpi_ac_add(struct acpi_device *device) | |||
300 | 300 | ||
301 | end: | 301 | end: |
302 | if (result) { | 302 | if (result) { |
303 | #ifdef CONFIG_ACPI_PROCFS | 303 | #ifdef CONFIG_ACPI_PROCFS_POWER |
304 | acpi_ac_remove_fs(device); | 304 | acpi_ac_remove_fs(device); |
305 | #endif | 305 | #endif |
306 | kfree(ac); | 306 | kfree(ac); |
@@ -339,7 +339,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type) | |||
339 | ACPI_ALL_NOTIFY, acpi_ac_notify); | 339 | ACPI_ALL_NOTIFY, acpi_ac_notify); |
340 | if (ac->charger.dev) | 340 | if (ac->charger.dev) |
341 | power_supply_unregister(&ac->charger); | 341 | power_supply_unregister(&ac->charger); |
342 | #ifdef CONFIG_ACPI_PROCFS | 342 | #ifdef CONFIG_ACPI_PROCFS_POWER |
343 | acpi_ac_remove_fs(device); | 343 | acpi_ac_remove_fs(device); |
344 | #endif | 344 | #endif |
345 | 345 | ||
@@ -355,7 +355,7 @@ static int __init acpi_ac_init(void) | |||
355 | if (acpi_disabled) | 355 | if (acpi_disabled) |
356 | return -ENODEV; | 356 | return -ENODEV; |
357 | 357 | ||
358 | #ifdef CONFIG_ACPI_PROCFS | 358 | #ifdef CONFIG_ACPI_PROCFS_POWER |
359 | acpi_ac_dir = acpi_lock_ac_dir(); | 359 | acpi_ac_dir = acpi_lock_ac_dir(); |
360 | if (!acpi_ac_dir) | 360 | if (!acpi_ac_dir) |
361 | return -ENODEV; | 361 | return -ENODEV; |
@@ -363,7 +363,7 @@ static int __init acpi_ac_init(void) | |||
363 | 363 | ||
364 | result = acpi_bus_register_driver(&acpi_ac_driver); | 364 | result = acpi_bus_register_driver(&acpi_ac_driver); |
365 | if (result < 0) { | 365 | if (result < 0) { |
366 | #ifdef CONFIG_ACPI_PROCFS | 366 | #ifdef CONFIG_ACPI_PROCFS_POWER |
367 | acpi_unlock_ac_dir(acpi_ac_dir); | 367 | acpi_unlock_ac_dir(acpi_ac_dir); |
368 | #endif | 368 | #endif |
369 | return -ENODEV; | 369 | return -ENODEV; |
@@ -377,7 +377,7 @@ static void __exit acpi_ac_exit(void) | |||
377 | 377 | ||
378 | acpi_bus_unregister_driver(&acpi_ac_driver); | 378 | acpi_bus_unregister_driver(&acpi_ac_driver); |
379 | 379 | ||
380 | #ifdef CONFIG_ACPI_PROCFS | 380 | #ifdef CONFIG_ACPI_PROCFS_POWER |
381 | acpi_unlock_ac_dir(acpi_ac_dir); | 381 | acpi_unlock_ac_dir(acpi_ac_dir); |
382 | #endif | 382 | #endif |
383 | 383 | ||
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 192c244f6190..8f7505d304b5 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
32 | #include <linux/jiffies.h> | 32 | #include <linux/jiffies.h> |
33 | 33 | ||
34 | #ifdef CONFIG_ACPI_PROCFS | 34 | #ifdef CONFIG_ACPI_PROCFS_POWER |
35 | #include <linux/proc_fs.h> | 35 | #include <linux/proc_fs.h> |
36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
37 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
@@ -63,7 +63,7 @@ static unsigned int cache_time = 1000; | |||
63 | module_param(cache_time, uint, 0644); | 63 | module_param(cache_time, uint, 0644); |
64 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); | 64 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); |
65 | 65 | ||
66 | #ifdef CONFIG_ACPI_PROCFS | 66 | #ifdef CONFIG_ACPI_PROCFS_POWER |
67 | extern struct proc_dir_entry *acpi_lock_battery_dir(void); | 67 | extern struct proc_dir_entry *acpi_lock_battery_dir(void); |
68 | extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); | 68 | extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); |
69 | 69 | ||
@@ -125,7 +125,7 @@ static int acpi_battery_technology(struct acpi_battery *battery) | |||
125 | return POWER_SUPPLY_TECHNOLOGY_NiMH; | 125 | return POWER_SUPPLY_TECHNOLOGY_NiMH; |
126 | if (!strcasecmp("LION", battery->type)) | 126 | if (!strcasecmp("LION", battery->type)) |
127 | return POWER_SUPPLY_TECHNOLOGY_LION; | 127 | return POWER_SUPPLY_TECHNOLOGY_LION; |
128 | if (!strcasecmp("LI-ION", battery->type)) | 128 | if (!strncasecmp("LI-ION", battery->type, 6)) |
129 | return POWER_SUPPLY_TECHNOLOGY_LION; | 129 | return POWER_SUPPLY_TECHNOLOGY_LION; |
130 | if (!strcasecmp("LiP", battery->type)) | 130 | if (!strcasecmp("LiP", battery->type)) |
131 | return POWER_SUPPLY_TECHNOLOGY_LIPO; | 131 | return POWER_SUPPLY_TECHNOLOGY_LIPO; |
@@ -153,6 +153,8 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
153 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | 153 | val->intval = POWER_SUPPLY_STATUS_CHARGING; |
154 | else if (battery->state == 0) | 154 | else if (battery->state == 0) |
155 | val->intval = POWER_SUPPLY_STATUS_FULL; | 155 | val->intval = POWER_SUPPLY_STATUS_FULL; |
156 | else | ||
157 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | ||
156 | break; | 158 | break; |
157 | case POWER_SUPPLY_PROP_PRESENT: | 159 | case POWER_SUPPLY_PROP_PRESENT: |
158 | val->intval = acpi_battery_present(battery); | 160 | val->intval = acpi_battery_present(battery); |
@@ -221,7 +223,7 @@ static enum power_supply_property energy_battery_props[] = { | |||
221 | POWER_SUPPLY_PROP_MANUFACTURER, | 223 | POWER_SUPPLY_PROP_MANUFACTURER, |
222 | }; | 224 | }; |
223 | 225 | ||
224 | #ifdef CONFIG_ACPI_PROCFS | 226 | #ifdef CONFIG_ACPI_PROCFS_POWER |
225 | inline char *acpi_battery_units(struct acpi_battery *battery) | 227 | inline char *acpi_battery_units(struct acpi_battery *battery) |
226 | { | 228 | { |
227 | return (battery->power_unit)?"mA":"mW"; | 229 | return (battery->power_unit)?"mA":"mW"; |
@@ -479,7 +481,7 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
479 | FS Interface (/proc) | 481 | FS Interface (/proc) |
480 | -------------------------------------------------------------------------- */ | 482 | -------------------------------------------------------------------------- */ |
481 | 483 | ||
482 | #ifdef CONFIG_ACPI_PROCFS | 484 | #ifdef CONFIG_ACPI_PROCFS_POWER |
483 | static struct proc_dir_entry *acpi_battery_dir; | 485 | static struct proc_dir_entry *acpi_battery_dir; |
484 | 486 | ||
485 | static int acpi_battery_print_info(struct seq_file *seq, int result) | 487 | static int acpi_battery_print_info(struct seq_file *seq, int result) |
@@ -786,7 +788,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
786 | acpi_driver_data(device) = battery; | 788 | acpi_driver_data(device) = battery; |
787 | mutex_init(&battery->lock); | 789 | mutex_init(&battery->lock); |
788 | acpi_battery_update(battery); | 790 | acpi_battery_update(battery); |
789 | #ifdef CONFIG_ACPI_PROCFS | 791 | #ifdef CONFIG_ACPI_PROCFS_POWER |
790 | result = acpi_battery_add_fs(device); | 792 | result = acpi_battery_add_fs(device); |
791 | if (result) | 793 | if (result) |
792 | goto end; | 794 | goto end; |
@@ -804,7 +806,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
804 | device->status.battery_present ? "present" : "absent"); | 806 | device->status.battery_present ? "present" : "absent"); |
805 | end: | 807 | end: |
806 | if (result) { | 808 | if (result) { |
807 | #ifdef CONFIG_ACPI_PROCFS | 809 | #ifdef CONFIG_ACPI_PROCFS_POWER |
808 | acpi_battery_remove_fs(device); | 810 | acpi_battery_remove_fs(device); |
809 | #endif | 811 | #endif |
810 | kfree(battery); | 812 | kfree(battery); |
@@ -823,7 +825,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
823 | status = acpi_remove_notify_handler(device->handle, | 825 | status = acpi_remove_notify_handler(device->handle, |
824 | ACPI_ALL_NOTIFY, | 826 | ACPI_ALL_NOTIFY, |
825 | acpi_battery_notify); | 827 | acpi_battery_notify); |
826 | #ifdef CONFIG_ACPI_PROCFS | 828 | #ifdef CONFIG_ACPI_PROCFS_POWER |
827 | acpi_battery_remove_fs(device); | 829 | acpi_battery_remove_fs(device); |
828 | #endif | 830 | #endif |
829 | sysfs_remove_battery(battery); | 831 | sysfs_remove_battery(battery); |
@@ -859,13 +861,13 @@ static int __init acpi_battery_init(void) | |||
859 | { | 861 | { |
860 | if (acpi_disabled) | 862 | if (acpi_disabled) |
861 | return -ENODEV; | 863 | return -ENODEV; |
862 | #ifdef CONFIG_ACPI_PROCFS | 864 | #ifdef CONFIG_ACPI_PROCFS_POWER |
863 | acpi_battery_dir = acpi_lock_battery_dir(); | 865 | acpi_battery_dir = acpi_lock_battery_dir(); |
864 | if (!acpi_battery_dir) | 866 | if (!acpi_battery_dir) |
865 | return -ENODEV; | 867 | return -ENODEV; |
866 | #endif | 868 | #endif |
867 | if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { | 869 | if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { |
868 | #ifdef CONFIG_ACPI_PROCFS | 870 | #ifdef CONFIG_ACPI_PROCFS_POWER |
869 | acpi_unlock_battery_dir(acpi_battery_dir); | 871 | acpi_unlock_battery_dir(acpi_battery_dir); |
870 | #endif | 872 | #endif |
871 | return -ENODEV; | 873 | return -ENODEV; |
@@ -876,7 +878,7 @@ static int __init acpi_battery_init(void) | |||
876 | static void __exit acpi_battery_exit(void) | 878 | static void __exit acpi_battery_exit(void) |
877 | { | 879 | { |
878 | acpi_bus_unregister_driver(&acpi_battery_driver); | 880 | acpi_bus_unregister_driver(&acpi_battery_driver); |
879 | #ifdef CONFIG_ACPI_PROCFS | 881 | #ifdef CONFIG_ACPI_PROCFS_POWER |
880 | acpi_unlock_battery_dir(acpi_battery_dir); | 882 | acpi_unlock_battery_dir(acpi_battery_dir); |
881 | #endif | 883 | #endif |
882 | } | 884 | } |
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index a474ca2334d5..954ac8ce958a 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
@@ -137,6 +137,71 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
137 | return_ACPI_STATUS(status); | 137 | return_ACPI_STATUS(status); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | |||
141 | /* Special object resolution for elements of a package */ | ||
142 | |||
143 | if ((op->common.parent->common.aml_opcode == AML_PACKAGE_OP) || | ||
144 | (op->common.parent->common.aml_opcode == | ||
145 | AML_VAR_PACKAGE_OP)) { | ||
146 | /* | ||
147 | * Attempt to resolve the node to a value before we insert it into | ||
148 | * the package. If this is a reference to a common data type, | ||
149 | * resolve it immediately. According to the ACPI spec, package | ||
150 | * elements can only be "data objects" or method references. | ||
151 | * Attempt to resolve to an Integer, Buffer, String or Package. | ||
152 | * If cannot, return the named reference (for things like Devices, | ||
153 | * Methods, etc.) Buffer Fields and Fields will resolve to simple | ||
154 | * objects (int/buf/str/pkg). | ||
155 | * | ||
156 | * NOTE: References to things like Devices, Methods, Mutexes, etc. | ||
157 | * will remain as named references. This behavior is not described | ||
158 | * in the ACPI spec, but it appears to be an oversight. | ||
159 | */ | ||
160 | obj_desc = (union acpi_operand_object *)op->common.node; | ||
161 | |||
162 | status = | ||
163 | acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR | ||
164 | (struct | ||
165 | acpi_namespace_node, | ||
166 | &obj_desc), | ||
167 | walk_state); | ||
168 | if (ACPI_FAILURE(status)) { | ||
169 | return_ACPI_STATUS(status); | ||
170 | } | ||
171 | |||
172 | switch (op->common.node->type) { | ||
173 | /* | ||
174 | * For these types, we need the actual node, not the subobject. | ||
175 | * However, the subobject got an extra reference count above. | ||
176 | */ | ||
177 | case ACPI_TYPE_MUTEX: | ||
178 | case ACPI_TYPE_METHOD: | ||
179 | case ACPI_TYPE_POWER: | ||
180 | case ACPI_TYPE_PROCESSOR: | ||
181 | case ACPI_TYPE_EVENT: | ||
182 | case ACPI_TYPE_REGION: | ||
183 | case ACPI_TYPE_DEVICE: | ||
184 | case ACPI_TYPE_THERMAL: | ||
185 | |||
186 | obj_desc = | ||
187 | (union acpi_operand_object *)op->common. | ||
188 | node; | ||
189 | break; | ||
190 | |||
191 | default: | ||
192 | break; | ||
193 | } | ||
194 | |||
195 | /* | ||
196 | * If above resolved to an operand object, we are done. Otherwise, | ||
197 | * we have a NS node, we must create the package entry as a named | ||
198 | * reference. | ||
199 | */ | ||
200 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != | ||
201 | ACPI_DESC_TYPE_NAMED) { | ||
202 | goto exit; | ||
203 | } | ||
204 | } | ||
140 | } | 205 | } |
141 | 206 | ||
142 | /* Create and init a new internal ACPI object */ | 207 | /* Create and init a new internal ACPI object */ |
@@ -156,6 +221,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
156 | return_ACPI_STATUS(status); | 221 | return_ACPI_STATUS(status); |
157 | } | 222 | } |
158 | 223 | ||
224 | exit: | ||
159 | *obj_desc_ptr = obj_desc; | 225 | *obj_desc_ptr = obj_desc; |
160 | return_ACPI_STATUS(AE_OK); | 226 | return_ACPI_STATUS(AE_OK); |
161 | } | 227 | } |
@@ -356,12 +422,25 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
356 | arg = arg->common.next; | 422 | arg = arg->common.next; |
357 | for (i = 0; arg && (i < element_count); i++) { | 423 | for (i = 0; arg && (i < element_count); i++) { |
358 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 424 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
359 | 425 | if (arg->common.node->type == ACPI_TYPE_METHOD) { | |
360 | /* This package element is already built, just get it */ | 426 | /* |
361 | 427 | * A method reference "looks" to the parser to be a method | |
362 | obj_desc->package.elements[i] = | 428 | * invocation, so we special case it here |
363 | ACPI_CAST_PTR(union acpi_operand_object, | 429 | */ |
364 | arg->common.node); | 430 | arg->common.aml_opcode = AML_INT_NAMEPATH_OP; |
431 | status = | ||
432 | acpi_ds_build_internal_object(walk_state, | ||
433 | arg, | ||
434 | &obj_desc-> | ||
435 | package. | ||
436 | elements[i]); | ||
437 | } else { | ||
438 | /* This package element is already built, just get it */ | ||
439 | |||
440 | obj_desc->package.elements[i] = | ||
441 | ACPI_CAST_PTR(union acpi_operand_object, | ||
442 | arg->common.node); | ||
443 | } | ||
365 | } else { | 444 | } else { |
366 | status = acpi_ds_build_internal_object(walk_state, arg, | 445 | status = acpi_ds_build_internal_object(walk_state, arg, |
367 | &obj_desc-> | 446 | &obj_desc-> |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 06b78e5e33a1..d411017f8c06 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -47,6 +47,9 @@ | |||
47 | #undef PREFIX | 47 | #undef PREFIX |
48 | #define PREFIX "ACPI: EC: " | 48 | #define PREFIX "ACPI: EC: " |
49 | 49 | ||
50 | /* Uncomment next line to get verbose print outs*/ | ||
51 | /* #define DEBUG */ | ||
52 | |||
50 | /* EC status register */ | 53 | /* EC status register */ |
51 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ | 54 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ |
52 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ | 55 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ |
@@ -75,7 +78,10 @@ enum { | |||
75 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ | 78 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ |
76 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ | 79 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
77 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ | 80 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ |
78 | EC_FLAGS_ONLY_IBF_GPE, /* Expect GPE only for IBF = 0 event */ | 81 | EC_FLAGS_NO_ADDRESS_GPE, /* Expect GPE only for non-address event */ |
82 | EC_FLAGS_ADDRESS, /* Address is being written */ | ||
83 | EC_FLAGS_NO_WDATA_GPE, /* Don't expect WDATA GPE event */ | ||
84 | EC_FLAGS_WDATA, /* Data is being written */ | ||
79 | }; | 85 | }; |
80 | 86 | ||
81 | static int acpi_ec_remove(struct acpi_device *device, int type); | 87 | static int acpi_ec_remove(struct acpi_device *device, int type); |
@@ -131,21 +137,27 @@ static struct acpi_ec { | |||
131 | 137 | ||
132 | static inline u8 acpi_ec_read_status(struct acpi_ec *ec) | 138 | static inline u8 acpi_ec_read_status(struct acpi_ec *ec) |
133 | { | 139 | { |
134 | return inb(ec->command_addr); | 140 | u8 x = inb(ec->command_addr); |
141 | pr_debug(PREFIX "---> status = 0x%2x\n", x); | ||
142 | return x; | ||
135 | } | 143 | } |
136 | 144 | ||
137 | static inline u8 acpi_ec_read_data(struct acpi_ec *ec) | 145 | static inline u8 acpi_ec_read_data(struct acpi_ec *ec) |
138 | { | 146 | { |
147 | u8 x = inb(ec->data_addr); | ||
148 | pr_debug(PREFIX "---> data = 0x%2x\n", x); | ||
139 | return inb(ec->data_addr); | 149 | return inb(ec->data_addr); |
140 | } | 150 | } |
141 | 151 | ||
142 | static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) | 152 | static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) |
143 | { | 153 | { |
154 | pr_debug(PREFIX "<--- command = 0x%2x\n", command); | ||
144 | outb(command, ec->command_addr); | 155 | outb(command, ec->command_addr); |
145 | } | 156 | } |
146 | 157 | ||
147 | static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) | 158 | static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) |
148 | { | 159 | { |
160 | pr_debug(PREFIX "<--- data = 0x%2x\n", data); | ||
149 | outb(data, ec->data_addr); | 161 | outb(data, ec->data_addr); |
150 | } | 162 | } |
151 | 163 | ||
@@ -166,38 +178,54 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) | |||
166 | 178 | ||
167 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) | 179 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) |
168 | { | 180 | { |
181 | int ret = 0; | ||
182 | if (unlikely(test_bit(EC_FLAGS_ADDRESS, &ec->flags) && | ||
183 | test_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags))) | ||
184 | force_poll = 1; | ||
185 | if (unlikely(test_bit(EC_FLAGS_WDATA, &ec->flags) && | ||
186 | test_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags))) | ||
187 | force_poll = 1; | ||
169 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && | 188 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && |
170 | likely(!force_poll)) { | 189 | likely(!force_poll)) { |
171 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), | 190 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), |
172 | msecs_to_jiffies(ACPI_EC_DELAY))) | 191 | msecs_to_jiffies(ACPI_EC_DELAY))) |
173 | return 0; | 192 | goto end; |
174 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 193 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
175 | if (acpi_ec_check_status(ec, event)) { | 194 | if (acpi_ec_check_status(ec, event)) { |
176 | if (event == ACPI_EC_EVENT_OBF_1) { | 195 | if (test_bit(EC_FLAGS_ADDRESS, &ec->flags)) { |
177 | /* miss OBF = 1 GPE, don't expect it anymore */ | 196 | /* miss address GPE, don't expect it anymore */ |
178 | printk(KERN_INFO PREFIX "missing OBF_1 confirmation," | 197 | pr_info(PREFIX "missing address confirmation, " |
179 | "switching to degraded mode.\n"); | 198 | "don't expect it any longer.\n"); |
180 | set_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags); | 199 | set_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags); |
200 | } else if (test_bit(EC_FLAGS_WDATA, &ec->flags)) { | ||
201 | /* miss write data GPE, don't expect it */ | ||
202 | pr_info(PREFIX "missing write data confirmation, " | ||
203 | "don't expect it any longer.\n"); | ||
204 | set_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags); | ||
181 | } else { | 205 | } else { |
182 | /* missing GPEs, switch back to poll mode */ | 206 | /* missing GPEs, switch back to poll mode */ |
183 | printk(KERN_INFO PREFIX "missing IBF_1 confirmations," | 207 | if (printk_ratelimit()) |
184 | "switch off interrupt mode.\n"); | 208 | pr_info(PREFIX "missing confirmations, " |
209 | "switch off interrupt mode.\n"); | ||
185 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 210 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
186 | } | 211 | } |
187 | return 0; | 212 | goto end; |
188 | } | 213 | } |
189 | } else { | 214 | } else { |
190 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 215 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
191 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 216 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
192 | while (time_before(jiffies, delay)) { | 217 | while (time_before(jiffies, delay)) { |
193 | if (acpi_ec_check_status(ec, event)) | 218 | if (acpi_ec_check_status(ec, event)) |
194 | return 0; | 219 | goto end; |
195 | } | 220 | } |
196 | } | 221 | } |
197 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," | 222 | pr_err(PREFIX "acpi_ec_wait timeout," |
198 | " status = %d, expect_event = %d\n", | 223 | " status = %d, expect_event = %d\n", |
199 | acpi_ec_read_status(ec), event); | 224 | acpi_ec_read_status(ec), event); |
200 | return -ETIME; | 225 | ret = -ETIME; |
226 | end: | ||
227 | clear_bit(EC_FLAGS_ADDRESS, &ec->flags); | ||
228 | return ret; | ||
201 | } | 229 | } |
202 | 230 | ||
203 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | 231 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, |
@@ -208,22 +236,26 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
208 | int result = 0; | 236 | int result = 0; |
209 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 237 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
210 | acpi_ec_write_cmd(ec, command); | 238 | acpi_ec_write_cmd(ec, command); |
211 | 239 | pr_debug(PREFIX "transaction start\n"); | |
212 | for (; wdata_len > 0; --wdata_len) { | 240 | for (; wdata_len > 0; --wdata_len) { |
213 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); | 241 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); |
214 | if (result) { | 242 | if (result) { |
215 | printk(KERN_ERR PREFIX | 243 | pr_err(PREFIX |
216 | "write_cmd timeout, command = %d\n", command); | 244 | "write_cmd timeout, command = %d\n", command); |
217 | goto end; | 245 | goto end; |
218 | } | 246 | } |
247 | /* mark the address byte written to EC */ | ||
248 | if (rdata_len + wdata_len > 1) | ||
249 | set_bit(EC_FLAGS_ADDRESS, &ec->flags); | ||
219 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 250 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
220 | acpi_ec_write_data(ec, *(wdata++)); | 251 | acpi_ec_write_data(ec, *(wdata++)); |
221 | } | 252 | } |
222 | 253 | ||
223 | if (!rdata_len) { | 254 | if (!rdata_len) { |
255 | set_bit(EC_FLAGS_WDATA, &ec->flags); | ||
224 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); | 256 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); |
225 | if (result) { | 257 | if (result) { |
226 | printk(KERN_ERR PREFIX | 258 | pr_err(PREFIX |
227 | "finish-write timeout, command = %d\n", command); | 259 | "finish-write timeout, command = %d\n", command); |
228 | goto end; | 260 | goto end; |
229 | } | 261 | } |
@@ -231,12 +263,9 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
231 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 263 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
232 | 264 | ||
233 | for (; rdata_len > 0; --rdata_len) { | 265 | for (; rdata_len > 0; --rdata_len) { |
234 | if (test_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags)) | ||
235 | force_poll = 1; | ||
236 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll); | 266 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll); |
237 | if (result) { | 267 | if (result) { |
238 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", | 268 | pr_err(PREFIX "read timeout, command = %d\n", command); |
239 | command); | ||
240 | goto end; | 269 | goto end; |
241 | } | 270 | } |
242 | /* Don't expect GPE after last read */ | 271 | /* Don't expect GPE after last read */ |
@@ -245,6 +274,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
245 | *(rdata++) = acpi_ec_read_data(ec); | 274 | *(rdata++) = acpi_ec_read_data(ec); |
246 | } | 275 | } |
247 | end: | 276 | end: |
277 | pr_debug(PREFIX "transaction end\n"); | ||
248 | return result; | 278 | return result; |
249 | } | 279 | } |
250 | 280 | ||
@@ -273,8 +303,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | |||
273 | 303 | ||
274 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0); | 304 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0); |
275 | if (status) { | 305 | if (status) { |
276 | printk(KERN_ERR PREFIX | 306 | pr_err(PREFIX "input buffer is not empty, " |
277 | "input buffer is not empty, aborting transaction\n"); | 307 | "aborting transaction\n"); |
278 | goto end; | 308 | goto end; |
279 | } | 309 | } |
280 | 310 | ||
@@ -488,6 +518,7 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
488 | acpi_status status = AE_OK; | 518 | acpi_status status = AE_OK; |
489 | struct acpi_ec *ec = data; | 519 | struct acpi_ec *ec = data; |
490 | 520 | ||
521 | pr_debug(PREFIX "~~~> interrupt\n"); | ||
491 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 522 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
492 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) | 523 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) |
493 | wake_up(&ec->wait); | 524 | wake_up(&ec->wait); |
@@ -498,8 +529,9 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
498 | acpi_ec_gpe_query, ec); | 529 | acpi_ec_gpe_query, ec); |
499 | } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) { | 530 | } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) { |
500 | /* this is non-query, must be confirmation */ | 531 | /* this is non-query, must be confirmation */ |
501 | printk(KERN_INFO PREFIX "non-query interrupt received," | 532 | if (printk_ratelimit()) |
502 | " switching to interrupt mode\n"); | 533 | pr_info(PREFIX "non-query interrupt received," |
534 | " switching to interrupt mode\n"); | ||
503 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 535 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
504 | } | 536 | } |
505 | 537 | ||
@@ -701,10 +733,10 @@ static void ec_remove_handlers(struct acpi_ec *ec) | |||
701 | { | 733 | { |
702 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, | 734 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, |
703 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) | 735 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) |
704 | printk(KERN_ERR PREFIX "failed to remove space handler\n"); | 736 | pr_err(PREFIX "failed to remove space handler\n"); |
705 | if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, | 737 | if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, |
706 | &acpi_ec_gpe_handler))) | 738 | &acpi_ec_gpe_handler))) |
707 | printk(KERN_ERR PREFIX "failed to remove gpe handler\n"); | 739 | pr_err(PREFIX "failed to remove gpe handler\n"); |
708 | ec->handlers_installed = 0; | 740 | ec->handlers_installed = 0; |
709 | } | 741 | } |
710 | 742 | ||
@@ -747,9 +779,9 @@ static int acpi_ec_add(struct acpi_device *device) | |||
747 | first_ec = ec; | 779 | first_ec = ec; |
748 | acpi_driver_data(device) = ec; | 780 | acpi_driver_data(device) = ec; |
749 | acpi_ec_add_fs(device); | 781 | acpi_ec_add_fs(device); |
750 | printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", | 782 | pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", |
751 | ec->gpe, ec->command_addr, ec->data_addr); | 783 | ec->gpe, ec->command_addr, ec->data_addr); |
752 | printk(KERN_INFO PREFIX "driver started in %s mode\n", | 784 | pr_info(PREFIX "driver started in %s mode\n", |
753 | (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll"); | 785 | (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll"); |
754 | return 0; | 786 | return 0; |
755 | } | 787 | } |
@@ -875,18 +907,26 @@ int __init acpi_ec_ecdt_probe(void) | |||
875 | status = acpi_get_table(ACPI_SIG_ECDT, 1, | 907 | status = acpi_get_table(ACPI_SIG_ECDT, 1, |
876 | (struct acpi_table_header **)&ecdt_ptr); | 908 | (struct acpi_table_header **)&ecdt_ptr); |
877 | if (ACPI_SUCCESS(status)) { | 909 | if (ACPI_SUCCESS(status)) { |
878 | printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n"); | 910 | pr_info(PREFIX "EC description table is found, configuring boot EC\n"); |
879 | boot_ec->command_addr = ecdt_ptr->control.address; | 911 | boot_ec->command_addr = ecdt_ptr->control.address; |
880 | boot_ec->data_addr = ecdt_ptr->data.address; | 912 | boot_ec->data_addr = ecdt_ptr->data.address; |
881 | boot_ec->gpe = ecdt_ptr->gpe; | 913 | boot_ec->gpe = ecdt_ptr->gpe; |
882 | boot_ec->handle = ACPI_ROOT_OBJECT; | 914 | boot_ec->handle = ACPI_ROOT_OBJECT; |
883 | } else { | 915 | } else { |
916 | /* This workaround is needed only on some broken machines, | ||
917 | * which require early EC, but fail to provide ECDT */ | ||
918 | acpi_handle x; | ||
884 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); | 919 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); |
885 | status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, | 920 | status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, |
886 | boot_ec, NULL); | 921 | boot_ec, NULL); |
887 | /* Check that acpi_get_devices actually find something */ | 922 | /* Check that acpi_get_devices actually find something */ |
888 | if (ACPI_FAILURE(status) || !boot_ec->handle) | 923 | if (ACPI_FAILURE(status) || !boot_ec->handle) |
889 | goto error; | 924 | goto error; |
925 | /* We really need to limit this workaround, the only ASUS, | ||
926 | * which needs it, has fake EC._INI method, so use it as flag. | ||
927 | */ | ||
928 | if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) | ||
929 | goto error; | ||
890 | } | 930 | } |
891 | 931 | ||
892 | ret = ec_install_handlers(boot_ec); | 932 | ret = ec_install_handlers(boot_ec); |
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index ab04d848b19d..0822d9fc1cb4 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
@@ -38,9 +38,9 @@ ACPI_MODULE_NAME("numa"); | |||
38 | static nodemask_t nodes_found_map = NODE_MASK_NONE; | 38 | static nodemask_t nodes_found_map = NODE_MASK_NONE; |
39 | 39 | ||
40 | /* maps to convert between proximity domain and logical node ID */ | 40 | /* maps to convert between proximity domain and logical node ID */ |
41 | static int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS] | 41 | static int pxm_to_node_map[MAX_PXM_DOMAINS] |
42 | = { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL }; | 42 | = { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL }; |
43 | static int __cpuinitdata node_to_pxm_map[MAX_NUMNODES] | 43 | static int node_to_pxm_map[MAX_NUMNODES] |
44 | = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; | 44 | = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; |
45 | 45 | ||
46 | int pxm_to_node(int pxm) | 46 | int pxm_to_node(int pxm) |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index aabc6ca4a81c..e3a673a00845 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -387,17 +387,14 @@ acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width) | |||
387 | if (!value) | 387 | if (!value) |
388 | value = &dummy; | 388 | value = &dummy; |
389 | 389 | ||
390 | switch (width) { | 390 | *value = 0; |
391 | case 8: | 391 | if (width <= 8) { |
392 | *(u8 *) value = inb(port); | 392 | *(u8 *) value = inb(port); |
393 | break; | 393 | } else if (width <= 16) { |
394 | case 16: | ||
395 | *(u16 *) value = inw(port); | 394 | *(u16 *) value = inw(port); |
396 | break; | 395 | } else if (width <= 32) { |
397 | case 32: | ||
398 | *(u32 *) value = inl(port); | 396 | *(u32 *) value = inl(port); |
399 | break; | 397 | } else { |
400 | default: | ||
401 | BUG(); | 398 | BUG(); |
402 | } | 399 | } |
403 | 400 | ||
@@ -408,17 +405,13 @@ EXPORT_SYMBOL(acpi_os_read_port); | |||
408 | 405 | ||
409 | acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) | 406 | acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) |
410 | { | 407 | { |
411 | switch (width) { | 408 | if (width <= 8) { |
412 | case 8: | ||
413 | outb(value, port); | 409 | outb(value, port); |
414 | break; | 410 | } else if (width <= 16) { |
415 | case 16: | ||
416 | outw(value, port); | 411 | outw(value, port); |
417 | break; | 412 | } else if (width <= 32) { |
418 | case 32: | ||
419 | outl(value, port); | 413 | outl(value, port); |
420 | break; | 414 | } else { |
421 | default: | ||
422 | BUG(); | 415 | BUG(); |
423 | } | 416 | } |
424 | 417 | ||
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 028969370bbf..388300de005d 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c | |||
@@ -294,9 +294,6 @@ int acpi_pci_unbind(struct acpi_device *device) | |||
294 | acpi_get_data(device->handle, acpi_pci_data_handler, | 294 | acpi_get_data(device->handle, acpi_pci_data_handler, |
295 | (void **)&data); | 295 | (void **)&data); |
296 | if (ACPI_FAILURE(status)) { | 296 | if (ACPI_FAILURE(status)) { |
297 | ACPI_EXCEPTION((AE_INFO, status, | ||
298 | "Unable to get data from device %s", | ||
299 | acpi_device_bid(device))); | ||
300 | result = -ENODEV; | 297 | result = -ENODEV; |
301 | goto end; | 298 | goto end; |
302 | } | 299 | } |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 235a51e328c3..e48ee4f8749f 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -494,7 +494,7 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id) | |||
494 | if (apic_id == -1) | 494 | if (apic_id == -1) |
495 | return apic_id; | 495 | return apic_id; |
496 | 496 | ||
497 | for (i = 0; i < NR_CPUS; ++i) { | 497 | for_each_possible_cpu(i) { |
498 | if (cpu_physical_id(i) == apic_id) | 498 | if (cpu_physical_id(i) == apic_id) |
499 | return i; | 499 | return i; |
500 | } | 500 | } |
@@ -612,12 +612,6 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) | |||
612 | request_region(pr->throttling.address, 6, "ACPI CPU throttle"); | 612 | request_region(pr->throttling.address, 6, "ACPI CPU throttle"); |
613 | } | 613 | } |
614 | 614 | ||
615 | #ifdef CONFIG_CPU_FREQ | ||
616 | acpi_processor_ppc_has_changed(pr); | ||
617 | #endif | ||
618 | acpi_processor_get_throttling_info(pr); | ||
619 | acpi_processor_get_limit_info(pr); | ||
620 | |||
621 | return 0; | 615 | return 0; |
622 | } | 616 | } |
623 | 617 | ||
@@ -638,7 +632,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
638 | return 0; | 632 | return 0; |
639 | } | 633 | } |
640 | 634 | ||
641 | BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); | 635 | BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); |
642 | 636 | ||
643 | /* | 637 | /* |
644 | * Buggy BIOS check | 638 | * Buggy BIOS check |
@@ -647,7 +641,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
647 | */ | 641 | */ |
648 | if (processor_device_array[pr->id] != NULL && | 642 | if (processor_device_array[pr->id] != NULL && |
649 | processor_device_array[pr->id] != device) { | 643 | processor_device_array[pr->id] != device) { |
650 | printk(KERN_WARNING "BIOS reported wrong ACPI id" | 644 | printk(KERN_WARNING "BIOS reported wrong ACPI id " |
651 | "for the processor\n"); | 645 | "for the processor\n"); |
652 | return -ENODEV; | 646 | return -ENODEV; |
653 | } | 647 | } |
@@ -665,6 +659,12 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
665 | /* _PDC call should be done before doing anything else (if reqd.). */ | 659 | /* _PDC call should be done before doing anything else (if reqd.). */ |
666 | arch_acpi_processor_init_pdc(pr); | 660 | arch_acpi_processor_init_pdc(pr); |
667 | acpi_processor_set_pdc(pr); | 661 | acpi_processor_set_pdc(pr); |
662 | #ifdef CONFIG_CPU_FREQ | ||
663 | acpi_processor_ppc_has_changed(pr); | ||
664 | #endif | ||
665 | acpi_processor_get_throttling_info(pr); | ||
666 | acpi_processor_get_limit_info(pr); | ||
667 | |||
668 | 668 | ||
669 | acpi_processor_power_init(pr, device); | 669 | acpi_processor_power_init(pr, device); |
670 | 670 | ||
@@ -684,7 +684,7 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) | |||
684 | { | 684 | { |
685 | struct acpi_processor *pr = data; | 685 | struct acpi_processor *pr = data; |
686 | struct acpi_device *device = NULL; | 686 | struct acpi_device *device = NULL; |
687 | 687 | int saved; | |
688 | 688 | ||
689 | if (!pr) | 689 | if (!pr) |
690 | return; | 690 | return; |
@@ -694,7 +694,10 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) | |||
694 | 694 | ||
695 | switch (event) { | 695 | switch (event) { |
696 | case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: | 696 | case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: |
697 | saved = pr->performance_platform_limit; | ||
697 | acpi_processor_ppc_has_changed(pr); | 698 | acpi_processor_ppc_has_changed(pr); |
699 | if (saved == pr->performance_platform_limit) | ||
700 | break; | ||
698 | acpi_bus_generate_proc_event(device, event, | 701 | acpi_bus_generate_proc_event(device, event, |
699 | pr->performance_platform_limit); | 702 | pr->performance_platform_limit); |
700 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 703 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
@@ -771,7 +774,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type) | |||
771 | 774 | ||
772 | pr = acpi_driver_data(device); | 775 | pr = acpi_driver_data(device); |
773 | 776 | ||
774 | if (pr->id >= NR_CPUS) { | 777 | if (pr->id >= nr_cpu_ids) { |
775 | kfree(pr); | 778 | kfree(pr); |
776 | return 0; | 779 | return 0; |
777 | } | 780 | } |
@@ -842,7 +845,7 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) | |||
842 | if (!pr) | 845 | if (!pr) |
843 | return -ENODEV; | 846 | return -ENODEV; |
844 | 847 | ||
845 | if ((pr->id >= 0) && (pr->id < NR_CPUS)) { | 848 | if ((pr->id >= 0) && (pr->id < nr_cpu_ids)) { |
846 | kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE); | 849 | kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE); |
847 | } | 850 | } |
848 | return 0; | 851 | return 0; |
@@ -880,13 +883,13 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) | |||
880 | break; | 883 | break; |
881 | } | 884 | } |
882 | 885 | ||
883 | if (pr->id >= 0 && (pr->id < NR_CPUS)) { | 886 | if (pr->id >= 0 && (pr->id < nr_cpu_ids)) { |
884 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); | 887 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); |
885 | break; | 888 | break; |
886 | } | 889 | } |
887 | 890 | ||
888 | result = acpi_processor_start(device); | 891 | result = acpi_processor_start(device); |
889 | if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) { | 892 | if ((!result) && ((pr->id >= 0) && (pr->id < nr_cpu_ids))) { |
890 | kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); | 893 | kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); |
891 | } else { | 894 | } else { |
892 | printk(KERN_ERR PREFIX "Device [%s] failed to start\n", | 895 | printk(KERN_ERR PREFIX "Device [%s] failed to start\n", |
@@ -909,7 +912,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) | |||
909 | return; | 912 | return; |
910 | } | 913 | } |
911 | 914 | ||
912 | if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) | 915 | if ((pr->id < nr_cpu_ids) && (cpu_present(pr->id))) |
913 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); | 916 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); |
914 | break; | 917 | break; |
915 | default: | 918 | default: |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f996d0e37689..2fe34cc73c13 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -197,6 +197,19 @@ static inline u32 ticks_elapsed_in_us(u32 t1, u32 t2) | |||
197 | return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2); | 197 | return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2); |
198 | } | 198 | } |
199 | 199 | ||
200 | static void acpi_safe_halt(void) | ||
201 | { | ||
202 | current_thread_info()->status &= ~TS_POLLING; | ||
203 | /* | ||
204 | * TS_POLLING-cleared state must be visible before we | ||
205 | * test NEED_RESCHED: | ||
206 | */ | ||
207 | smp_mb(); | ||
208 | if (!need_resched()) | ||
209 | safe_halt(); | ||
210 | current_thread_info()->status |= TS_POLLING; | ||
211 | } | ||
212 | |||
200 | #ifndef CONFIG_CPU_IDLE | 213 | #ifndef CONFIG_CPU_IDLE |
201 | 214 | ||
202 | static void | 215 | static void |
@@ -239,19 +252,6 @@ acpi_processor_power_activate(struct acpi_processor *pr, | |||
239 | return; | 252 | return; |
240 | } | 253 | } |
241 | 254 | ||
242 | static void acpi_safe_halt(void) | ||
243 | { | ||
244 | current_thread_info()->status &= ~TS_POLLING; | ||
245 | /* | ||
246 | * TS_POLLING-cleared state must be visible before we | ||
247 | * test NEED_RESCHED: | ||
248 | */ | ||
249 | smp_mb(); | ||
250 | if (!need_resched()) | ||
251 | safe_halt(); | ||
252 | current_thread_info()->status |= TS_POLLING; | ||
253 | } | ||
254 | |||
255 | static atomic_t c3_cpu_count; | 255 | static atomic_t c3_cpu_count; |
256 | 256 | ||
257 | /* Common C-state entry for C2, C3, .. */ | 257 | /* Common C-state entry for C2, C3, .. */ |
@@ -531,6 +531,11 @@ static void acpi_processor_idle(void) | |||
531 | 531 | ||
532 | case ACPI_STATE_C3: | 532 | case ACPI_STATE_C3: |
533 | /* | 533 | /* |
534 | * Must be done before busmaster disable as we might | ||
535 | * need to access HPET ! | ||
536 | */ | ||
537 | acpi_state_timer_broadcast(pr, cx, 1); | ||
538 | /* | ||
534 | * disable bus master | 539 | * disable bus master |
535 | * bm_check implies we need ARB_DIS | 540 | * bm_check implies we need ARB_DIS |
536 | * !bm_check implies we need cache flush | 541 | * !bm_check implies we need cache flush |
@@ -557,7 +562,6 @@ static void acpi_processor_idle(void) | |||
557 | /* Get start time (ticks) */ | 562 | /* Get start time (ticks) */ |
558 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 563 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
559 | /* Invoke C3 */ | 564 | /* Invoke C3 */ |
560 | acpi_state_timer_broadcast(pr, cx, 1); | ||
561 | /* Tell the scheduler that we are going deep-idle: */ | 565 | /* Tell the scheduler that we are going deep-idle: */ |
562 | sched_clock_idle_sleep_event(); | 566 | sched_clock_idle_sleep_event(); |
563 | acpi_cstate_enter(cx); | 567 | acpi_cstate_enter(cx); |
@@ -1373,15 +1377,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
1373 | if (pr->flags.bm_check) | 1377 | if (pr->flags.bm_check) |
1374 | acpi_idle_update_bm_rld(pr, cx); | 1378 | acpi_idle_update_bm_rld(pr, cx); |
1375 | 1379 | ||
1376 | current_thread_info()->status &= ~TS_POLLING; | 1380 | acpi_safe_halt(); |
1377 | /* | ||
1378 | * TS_POLLING-cleared state must be visible before we test | ||
1379 | * NEED_RESCHED: | ||
1380 | */ | ||
1381 | smp_mb(); | ||
1382 | if (!need_resched()) | ||
1383 | safe_halt(); | ||
1384 | current_thread_info()->status |= TS_POLLING; | ||
1385 | 1381 | ||
1386 | cx->usage++; | 1382 | cx->usage++; |
1387 | 1383 | ||
@@ -1399,6 +1395,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1399 | struct acpi_processor *pr; | 1395 | struct acpi_processor *pr; |
1400 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); | 1396 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); |
1401 | u32 t1, t2; | 1397 | u32 t1, t2; |
1398 | int sleep_ticks = 0; | ||
1399 | |||
1402 | pr = processors[smp_processor_id()]; | 1400 | pr = processors[smp_processor_id()]; |
1403 | 1401 | ||
1404 | if (unlikely(!pr)) | 1402 | if (unlikely(!pr)) |
@@ -1407,9 +1405,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1407 | if (acpi_idle_suspend) | 1405 | if (acpi_idle_suspend) |
1408 | return(acpi_idle_enter_c1(dev, state)); | 1406 | return(acpi_idle_enter_c1(dev, state)); |
1409 | 1407 | ||
1410 | if (pr->flags.bm_check) | ||
1411 | acpi_idle_update_bm_rld(pr, cx); | ||
1412 | |||
1413 | local_irq_disable(); | 1408 | local_irq_disable(); |
1414 | current_thread_info()->status &= ~TS_POLLING; | 1409 | current_thread_info()->status &= ~TS_POLLING; |
1415 | /* | 1410 | /* |
@@ -1424,11 +1419,21 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1424 | return 0; | 1419 | return 0; |
1425 | } | 1420 | } |
1426 | 1421 | ||
1422 | /* | ||
1423 | * Must be done before busmaster disable as we might need to | ||
1424 | * access HPET ! | ||
1425 | */ | ||
1426 | acpi_state_timer_broadcast(pr, cx, 1); | ||
1427 | |||
1428 | if (pr->flags.bm_check) | ||
1429 | acpi_idle_update_bm_rld(pr, cx); | ||
1430 | |||
1427 | if (cx->type == ACPI_STATE_C3) | 1431 | if (cx->type == ACPI_STATE_C3) |
1428 | ACPI_FLUSH_CPU_CACHE(); | 1432 | ACPI_FLUSH_CPU_CACHE(); |
1429 | 1433 | ||
1430 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1434 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
1431 | acpi_state_timer_broadcast(pr, cx, 1); | 1435 | /* Tell the scheduler that we are going deep-idle: */ |
1436 | sched_clock_idle_sleep_event(); | ||
1432 | acpi_idle_do_entry(cx); | 1437 | acpi_idle_do_entry(cx); |
1433 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1438 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
1434 | 1439 | ||
@@ -1436,6 +1441,10 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1436 | /* TSC could halt in idle, so notify users */ | 1441 | /* TSC could halt in idle, so notify users */ |
1437 | mark_tsc_unstable("TSC halts in idle");; | 1442 | mark_tsc_unstable("TSC halts in idle");; |
1438 | #endif | 1443 | #endif |
1444 | sleep_ticks = ticks_elapsed(t1, t2); | ||
1445 | |||
1446 | /* Tell the scheduler how much we idled: */ | ||
1447 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
1439 | 1448 | ||
1440 | local_irq_enable(); | 1449 | local_irq_enable(); |
1441 | current_thread_info()->status |= TS_POLLING; | 1450 | current_thread_info()->status |= TS_POLLING; |
@@ -1443,7 +1452,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1443 | cx->usage++; | 1452 | cx->usage++; |
1444 | 1453 | ||
1445 | acpi_state_timer_broadcast(pr, cx, 0); | 1454 | acpi_state_timer_broadcast(pr, cx, 0); |
1446 | cx->time += ticks_elapsed(t1, t2); | 1455 | cx->time += sleep_ticks; |
1447 | return ticks_elapsed_in_us(t1, t2); | 1456 | return ticks_elapsed_in_us(t1, t2); |
1448 | } | 1457 | } |
1449 | 1458 | ||
@@ -1463,6 +1472,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1463 | struct acpi_processor *pr; | 1472 | struct acpi_processor *pr; |
1464 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); | 1473 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); |
1465 | u32 t1, t2; | 1474 | u32 t1, t2; |
1475 | int sleep_ticks = 0; | ||
1476 | |||
1466 | pr = processors[smp_processor_id()]; | 1477 | pr = processors[smp_processor_id()]; |
1467 | 1478 | ||
1468 | if (unlikely(!pr)) | 1479 | if (unlikely(!pr)) |
@@ -1471,6 +1482,15 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1471 | if (acpi_idle_suspend) | 1482 | if (acpi_idle_suspend) |
1472 | return(acpi_idle_enter_c1(dev, state)); | 1483 | return(acpi_idle_enter_c1(dev, state)); |
1473 | 1484 | ||
1485 | if (acpi_idle_bm_check()) { | ||
1486 | if (dev->safe_state) { | ||
1487 | return dev->safe_state->enter(dev, dev->safe_state); | ||
1488 | } else { | ||
1489 | acpi_safe_halt(); | ||
1490 | return 0; | ||
1491 | } | ||
1492 | } | ||
1493 | |||
1474 | local_irq_disable(); | 1494 | local_irq_disable(); |
1475 | current_thread_info()->status &= ~TS_POLLING; | 1495 | current_thread_info()->status &= ~TS_POLLING; |
1476 | /* | 1496 | /* |
@@ -1485,38 +1505,45 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1485 | return 0; | 1505 | return 0; |
1486 | } | 1506 | } |
1487 | 1507 | ||
1508 | /* Tell the scheduler that we are going deep-idle: */ | ||
1509 | sched_clock_idle_sleep_event(); | ||
1488 | /* | 1510 | /* |
1489 | * Must be done before busmaster disable as we might need to | 1511 | * Must be done before busmaster disable as we might need to |
1490 | * access HPET ! | 1512 | * access HPET ! |
1491 | */ | 1513 | */ |
1492 | acpi_state_timer_broadcast(pr, cx, 1); | 1514 | acpi_state_timer_broadcast(pr, cx, 1); |
1493 | 1515 | ||
1494 | if (acpi_idle_bm_check()) { | 1516 | acpi_idle_update_bm_rld(pr, cx); |
1495 | cx = pr->power.bm_state; | ||
1496 | |||
1497 | acpi_idle_update_bm_rld(pr, cx); | ||
1498 | |||
1499 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | ||
1500 | acpi_idle_do_entry(cx); | ||
1501 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | ||
1502 | } else { | ||
1503 | acpi_idle_update_bm_rld(pr, cx); | ||
1504 | 1517 | ||
1518 | /* | ||
1519 | * disable bus master | ||
1520 | * bm_check implies we need ARB_DIS | ||
1521 | * !bm_check implies we need cache flush | ||
1522 | * bm_control implies whether we can do ARB_DIS | ||
1523 | * | ||
1524 | * That leaves a case where bm_check is set and bm_control is | ||
1525 | * not set. In that case we cannot do much, we enter C3 | ||
1526 | * without doing anything. | ||
1527 | */ | ||
1528 | if (pr->flags.bm_check && pr->flags.bm_control) { | ||
1505 | spin_lock(&c3_lock); | 1529 | spin_lock(&c3_lock); |
1506 | c3_cpu_count++; | 1530 | c3_cpu_count++; |
1507 | /* Disable bus master arbitration when all CPUs are in C3 */ | 1531 | /* Disable bus master arbitration when all CPUs are in C3 */ |
1508 | if (c3_cpu_count == num_online_cpus()) | 1532 | if (c3_cpu_count == num_online_cpus()) |
1509 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); | 1533 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); |
1510 | spin_unlock(&c3_lock); | 1534 | spin_unlock(&c3_lock); |
1535 | } else if (!pr->flags.bm_check) { | ||
1536 | ACPI_FLUSH_CPU_CACHE(); | ||
1537 | } | ||
1511 | 1538 | ||
1512 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1539 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
1513 | acpi_idle_do_entry(cx); | 1540 | acpi_idle_do_entry(cx); |
1514 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1541 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
1515 | 1542 | ||
1543 | /* Re-enable bus master arbitration */ | ||
1544 | if (pr->flags.bm_check && pr->flags.bm_control) { | ||
1516 | spin_lock(&c3_lock); | 1545 | spin_lock(&c3_lock); |
1517 | /* Re-enable bus master arbitration */ | 1546 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); |
1518 | if (c3_cpu_count == num_online_cpus()) | ||
1519 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); | ||
1520 | c3_cpu_count--; | 1547 | c3_cpu_count--; |
1521 | spin_unlock(&c3_lock); | 1548 | spin_unlock(&c3_lock); |
1522 | } | 1549 | } |
@@ -1525,6 +1552,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1525 | /* TSC could halt in idle, so notify users */ | 1552 | /* TSC could halt in idle, so notify users */ |
1526 | mark_tsc_unstable("TSC halts in idle"); | 1553 | mark_tsc_unstable("TSC halts in idle"); |
1527 | #endif | 1554 | #endif |
1555 | sleep_ticks = ticks_elapsed(t1, t2); | ||
1556 | /* Tell the scheduler how much we idled: */ | ||
1557 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
1528 | 1558 | ||
1529 | local_irq_enable(); | 1559 | local_irq_enable(); |
1530 | current_thread_info()->status |= TS_POLLING; | 1560 | current_thread_info()->status |= TS_POLLING; |
@@ -1532,7 +1562,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1532 | cx->usage++; | 1562 | cx->usage++; |
1533 | 1563 | ||
1534 | acpi_state_timer_broadcast(pr, cx, 0); | 1564 | acpi_state_timer_broadcast(pr, cx, 0); |
1535 | cx->time += ticks_elapsed(t1, t2); | 1565 | cx->time += sleep_ticks; |
1536 | return ticks_elapsed_in_us(t1, t2); | 1566 | return ticks_elapsed_in_us(t1, t2); |
1537 | } | 1567 | } |
1538 | 1568 | ||
@@ -1584,12 +1614,14 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | |||
1584 | case ACPI_STATE_C1: | 1614 | case ACPI_STATE_C1: |
1585 | state->flags |= CPUIDLE_FLAG_SHALLOW; | 1615 | state->flags |= CPUIDLE_FLAG_SHALLOW; |
1586 | state->enter = acpi_idle_enter_c1; | 1616 | state->enter = acpi_idle_enter_c1; |
1617 | dev->safe_state = state; | ||
1587 | break; | 1618 | break; |
1588 | 1619 | ||
1589 | case ACPI_STATE_C2: | 1620 | case ACPI_STATE_C2: |
1590 | state->flags |= CPUIDLE_FLAG_BALANCED; | 1621 | state->flags |= CPUIDLE_FLAG_BALANCED; |
1591 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | 1622 | state->flags |= CPUIDLE_FLAG_TIME_VALID; |
1592 | state->enter = acpi_idle_enter_simple; | 1623 | state->enter = acpi_idle_enter_simple; |
1624 | dev->safe_state = state; | ||
1593 | break; | 1625 | break; |
1594 | 1626 | ||
1595 | case ACPI_STATE_C3: | 1627 | case ACPI_STATE_C3: |
@@ -1610,14 +1642,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | |||
1610 | if (!count) | 1642 | if (!count) |
1611 | return -EINVAL; | 1643 | return -EINVAL; |
1612 | 1644 | ||
1613 | /* find the deepest state that can handle active BM */ | ||
1614 | if (pr->flags.bm_check) { | ||
1615 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) | ||
1616 | if (pr->power.states[i].type == ACPI_STATE_C3) | ||
1617 | break; | ||
1618 | pr->power.bm_state = &pr->power.states[i-1]; | ||
1619 | } | ||
1620 | |||
1621 | return 0; | 1645 | return 0; |
1622 | } | 1646 | } |
1623 | 1647 | ||
@@ -1658,6 +1682,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
1658 | 1682 | ||
1659 | if (!first_run) { | 1683 | if (!first_run) { |
1660 | dmi_check_system(processor_power_dmi_table); | 1684 | dmi_check_system(processor_power_dmi_table); |
1685 | max_cstate = acpi_processor_cstate_check(max_cstate); | ||
1661 | if (max_cstate < ACPI_C_STATES_MAX) | 1686 | if (max_cstate < ACPI_C_STATES_MAX) |
1662 | printk(KERN_NOTICE | 1687 | printk(KERN_NOTICE |
1663 | "ACPI: processor limited to max C-state %d\n", | 1688 | "ACPI: processor limited to max C-state %d\n", |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 0b8204e7082a..6742d7bc4777 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/sched.h> | ||
32 | #include <linux/cpufreq.h> | 33 | #include <linux/cpufreq.h> |
33 | #include <linux/proc_fs.h> | 34 | #include <linux/proc_fs.h> |
34 | #include <linux/seq_file.h> | 35 | #include <linux/seq_file.h> |
@@ -70,7 +71,55 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | |||
70 | 71 | ||
71 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr) | 72 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr) |
72 | { | 73 | { |
73 | return acpi_processor_get_platform_limit(pr); | 74 | int result = 0; |
75 | int throttling_limit; | ||
76 | int current_state; | ||
77 | struct acpi_processor_limit *limit; | ||
78 | int target_state; | ||
79 | |||
80 | result = acpi_processor_get_platform_limit(pr); | ||
81 | if (result) { | ||
82 | /* Throttling Limit is unsupported */ | ||
83 | return result; | ||
84 | } | ||
85 | |||
86 | throttling_limit = pr->throttling_platform_limit; | ||
87 | if (throttling_limit >= pr->throttling.state_count) { | ||
88 | /* Uncorrect Throttling Limit */ | ||
89 | return -EINVAL; | ||
90 | } | ||
91 | |||
92 | current_state = pr->throttling.state; | ||
93 | if (current_state > throttling_limit) { | ||
94 | /* | ||
95 | * The current state can meet the requirement of | ||
96 | * _TPC limit. But it is reasonable that OSPM changes | ||
97 | * t-states from high to low for better performance. | ||
98 | * Of course the limit condition of thermal | ||
99 | * and user should be considered. | ||
100 | */ | ||
101 | limit = &pr->limit; | ||
102 | target_state = throttling_limit; | ||
103 | if (limit->thermal.tx > target_state) | ||
104 | target_state = limit->thermal.tx; | ||
105 | if (limit->user.tx > target_state) | ||
106 | target_state = limit->user.tx; | ||
107 | } else if (current_state == throttling_limit) { | ||
108 | /* | ||
109 | * Unnecessary to change the throttling state | ||
110 | */ | ||
111 | return 0; | ||
112 | } else { | ||
113 | /* | ||
114 | * If the current state is lower than the limit of _TPC, it | ||
115 | * will be forced to switch to the throttling state defined | ||
116 | * by throttling_platfor_limit. | ||
117 | * Because the previous state meets with the limit condition | ||
118 | * of thermal and user, it is unnecessary to check it again. | ||
119 | */ | ||
120 | target_state = throttling_limit; | ||
121 | } | ||
122 | return acpi_processor_set_throttling(pr, target_state); | ||
74 | } | 123 | } |
75 | 124 | ||
76 | /* | 125 | /* |
@@ -83,6 +132,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | |||
83 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 132 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
84 | union acpi_object *ptc = NULL; | 133 | union acpi_object *ptc = NULL; |
85 | union acpi_object obj = { 0 }; | 134 | union acpi_object obj = { 0 }; |
135 | struct acpi_processor_throttling *throttling; | ||
86 | 136 | ||
87 | status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); | 137 | status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); |
88 | if (ACPI_FAILURE(status)) { | 138 | if (ACPI_FAILURE(status)) { |
@@ -134,6 +184,22 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | |||
134 | memcpy(&pr->throttling.status_register, obj.buffer.pointer, | 184 | memcpy(&pr->throttling.status_register, obj.buffer.pointer, |
135 | sizeof(struct acpi_ptc_register)); | 185 | sizeof(struct acpi_ptc_register)); |
136 | 186 | ||
187 | throttling = &pr->throttling; | ||
188 | |||
189 | if ((throttling->control_register.bit_width + | ||
190 | throttling->control_register.bit_offset) > 32) { | ||
191 | printk(KERN_ERR PREFIX "Invalid _PTC control register\n"); | ||
192 | result = -EFAULT; | ||
193 | goto end; | ||
194 | } | ||
195 | |||
196 | if ((throttling->status_register.bit_width + | ||
197 | throttling->status_register.bit_offset) > 32) { | ||
198 | printk(KERN_ERR PREFIX "Invalid _PTC status register\n"); | ||
199 | result = -EFAULT; | ||
200 | goto end; | ||
201 | } | ||
202 | |||
137 | end: | 203 | end: |
138 | kfree(buffer.pointer); | 204 | kfree(buffer.pointer); |
139 | 205 | ||
@@ -328,44 +394,132 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr) | |||
328 | return 0; | 394 | return 0; |
329 | } | 395 | } |
330 | 396 | ||
331 | static int acpi_read_throttling_status(struct acpi_processor_throttling | 397 | #ifdef CONFIG_X86 |
332 | *throttling) | 398 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, |
399 | acpi_integer * value) | ||
400 | { | ||
401 | struct cpuinfo_x86 *c; | ||
402 | u64 msr_high, msr_low; | ||
403 | unsigned int cpu; | ||
404 | u64 msr = 0; | ||
405 | int ret = -1; | ||
406 | |||
407 | cpu = pr->id; | ||
408 | c = &cpu_data(cpu); | ||
409 | |||
410 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
411 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
412 | printk(KERN_ERR PREFIX | ||
413 | "HARDWARE addr space,NOT supported yet\n"); | ||
414 | } else { | ||
415 | msr_low = 0; | ||
416 | msr_high = 0; | ||
417 | rdmsr_safe(MSR_IA32_THERM_CONTROL, | ||
418 | (u32 *)&msr_low , (u32 *) &msr_high); | ||
419 | msr = (msr_high << 32) | msr_low; | ||
420 | *value = (acpi_integer) msr; | ||
421 | ret = 0; | ||
422 | } | ||
423 | return ret; | ||
424 | } | ||
425 | |||
426 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | ||
333 | { | 427 | { |
334 | int value = -1; | 428 | struct cpuinfo_x86 *c; |
429 | unsigned int cpu; | ||
430 | int ret = -1; | ||
431 | u64 msr; | ||
432 | |||
433 | cpu = pr->id; | ||
434 | c = &cpu_data(cpu); | ||
435 | |||
436 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
437 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
438 | printk(KERN_ERR PREFIX | ||
439 | "HARDWARE addr space,NOT supported yet\n"); | ||
440 | } else { | ||
441 | msr = value; | ||
442 | wrmsr_safe(MSR_IA32_THERM_CONTROL, | ||
443 | msr & 0xffffffff, msr >> 32); | ||
444 | ret = 0; | ||
445 | } | ||
446 | return ret; | ||
447 | } | ||
448 | #else | ||
449 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | ||
450 | acpi_integer * value) | ||
451 | { | ||
452 | printk(KERN_ERR PREFIX | ||
453 | "HARDWARE addr space,NOT supported yet\n"); | ||
454 | return -1; | ||
455 | } | ||
456 | |||
457 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | ||
458 | { | ||
459 | printk(KERN_ERR PREFIX | ||
460 | "HARDWARE addr space,NOT supported yet\n"); | ||
461 | return -1; | ||
462 | } | ||
463 | #endif | ||
464 | |||
465 | static int acpi_read_throttling_status(struct acpi_processor *pr, | ||
466 | acpi_integer *value) | ||
467 | { | ||
468 | u32 bit_width, bit_offset; | ||
469 | u64 ptc_value; | ||
470 | u64 ptc_mask; | ||
471 | struct acpi_processor_throttling *throttling; | ||
472 | int ret = -1; | ||
473 | |||
474 | throttling = &pr->throttling; | ||
335 | switch (throttling->status_register.space_id) { | 475 | switch (throttling->status_register.space_id) { |
336 | case ACPI_ADR_SPACE_SYSTEM_IO: | 476 | case ACPI_ADR_SPACE_SYSTEM_IO: |
477 | ptc_value = 0; | ||
478 | bit_width = throttling->status_register.bit_width; | ||
479 | bit_offset = throttling->status_register.bit_offset; | ||
480 | |||
337 | acpi_os_read_port((acpi_io_address) throttling->status_register. | 481 | acpi_os_read_port((acpi_io_address) throttling->status_register. |
338 | address, &value, | 482 | address, (u32 *) &ptc_value, |
339 | (u32) throttling->status_register.bit_width * | 483 | (u32) (bit_width + bit_offset)); |
340 | 8); | 484 | ptc_mask = (1 << bit_width) - 1; |
485 | *value = (acpi_integer) ((ptc_value >> bit_offset) & ptc_mask); | ||
486 | ret = 0; | ||
341 | break; | 487 | break; |
342 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 488 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
343 | printk(KERN_ERR PREFIX | 489 | ret = acpi_throttling_rdmsr(pr, value); |
344 | "HARDWARE addr space,NOT supported yet\n"); | ||
345 | break; | 490 | break; |
346 | default: | 491 | default: |
347 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 492 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |
348 | (u32) (throttling->status_register.space_id)); | 493 | (u32) (throttling->status_register.space_id)); |
349 | } | 494 | } |
350 | return value; | 495 | return ret; |
351 | } | 496 | } |
352 | 497 | ||
353 | static int acpi_write_throttling_state(struct acpi_processor_throttling | 498 | static int acpi_write_throttling_state(struct acpi_processor *pr, |
354 | *throttling, int value) | 499 | acpi_integer value) |
355 | { | 500 | { |
501 | u32 bit_width, bit_offset; | ||
502 | u64 ptc_value; | ||
503 | u64 ptc_mask; | ||
504 | struct acpi_processor_throttling *throttling; | ||
356 | int ret = -1; | 505 | int ret = -1; |
357 | 506 | ||
507 | throttling = &pr->throttling; | ||
358 | switch (throttling->control_register.space_id) { | 508 | switch (throttling->control_register.space_id) { |
359 | case ACPI_ADR_SPACE_SYSTEM_IO: | 509 | case ACPI_ADR_SPACE_SYSTEM_IO: |
510 | bit_width = throttling->control_register.bit_width; | ||
511 | bit_offset = throttling->control_register.bit_offset; | ||
512 | ptc_mask = (1 << bit_width) - 1; | ||
513 | ptc_value = value & ptc_mask; | ||
514 | |||
360 | acpi_os_write_port((acpi_io_address) throttling-> | 515 | acpi_os_write_port((acpi_io_address) throttling-> |
361 | control_register.address, value, | 516 | control_register.address, |
362 | (u32) throttling->control_register. | 517 | (u32) (ptc_value << bit_offset), |
363 | bit_width * 8); | 518 | (u32) (bit_width + bit_offset)); |
364 | ret = 0; | 519 | ret = 0; |
365 | break; | 520 | break; |
366 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 521 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
367 | printk(KERN_ERR PREFIX | 522 | ret = acpi_throttling_wrmsr(pr, value); |
368 | "HARDWARE addr space,NOT supported yet\n"); | ||
369 | break; | 523 | break; |
370 | default: | 524 | default: |
371 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 525 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |
@@ -374,7 +528,8 @@ static int acpi_write_throttling_state(struct acpi_processor_throttling | |||
374 | return ret; | 528 | return ret; |
375 | } | 529 | } |
376 | 530 | ||
377 | static int acpi_get_throttling_state(struct acpi_processor *pr, int value) | 531 | static int acpi_get_throttling_state(struct acpi_processor *pr, |
532 | acpi_integer value) | ||
378 | { | 533 | { |
379 | int i; | 534 | int i; |
380 | 535 | ||
@@ -390,22 +545,26 @@ static int acpi_get_throttling_state(struct acpi_processor *pr, int value) | |||
390 | return i; | 545 | return i; |
391 | } | 546 | } |
392 | 547 | ||
393 | static int acpi_get_throttling_value(struct acpi_processor *pr, int state) | 548 | static int acpi_get_throttling_value(struct acpi_processor *pr, |
549 | int state, acpi_integer *value) | ||
394 | { | 550 | { |
395 | int value = -1; | 551 | int ret = -1; |
552 | |||
396 | if (state >= 0 && state <= pr->throttling.state_count) { | 553 | if (state >= 0 && state <= pr->throttling.state_count) { |
397 | struct acpi_processor_tx_tss *tx = | 554 | struct acpi_processor_tx_tss *tx = |
398 | (struct acpi_processor_tx_tss *)&(pr->throttling. | 555 | (struct acpi_processor_tx_tss *)&(pr->throttling. |
399 | states_tss[state]); | 556 | states_tss[state]); |
400 | value = tx->control; | 557 | *value = tx->control; |
558 | ret = 0; | ||
401 | } | 559 | } |
402 | return value; | 560 | return ret; |
403 | } | 561 | } |
404 | 562 | ||
405 | static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | 563 | static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) |
406 | { | 564 | { |
407 | int state = 0; | 565 | int state = 0; |
408 | u32 value = 0; | 566 | int ret; |
567 | acpi_integer value; | ||
409 | 568 | ||
410 | if (!pr) | 569 | if (!pr) |
411 | return -EINVAL; | 570 | return -EINVAL; |
@@ -414,20 +573,66 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | |||
414 | return -ENODEV; | 573 | return -ENODEV; |
415 | 574 | ||
416 | pr->throttling.state = 0; | 575 | pr->throttling.state = 0; |
417 | local_irq_disable(); | 576 | |
418 | value = acpi_read_throttling_status(&pr->throttling); | 577 | value = 0; |
419 | if (value >= 0) { | 578 | ret = acpi_read_throttling_status(pr, &value); |
579 | if (ret >= 0) { | ||
420 | state = acpi_get_throttling_state(pr, value); | 580 | state = acpi_get_throttling_state(pr, value); |
421 | pr->throttling.state = state; | 581 | pr->throttling.state = state; |
422 | } | 582 | } |
423 | local_irq_enable(); | ||
424 | 583 | ||
425 | return 0; | 584 | return 0; |
426 | } | 585 | } |
427 | 586 | ||
428 | static int acpi_processor_get_throttling(struct acpi_processor *pr) | 587 | static int acpi_processor_get_throttling(struct acpi_processor *pr) |
429 | { | 588 | { |
430 | return pr->throttling.acpi_processor_get_throttling(pr); | 589 | cpumask_t saved_mask; |
590 | int ret; | ||
591 | |||
592 | /* | ||
593 | * Migrate task to the cpu pointed by pr. | ||
594 | */ | ||
595 | saved_mask = current->cpus_allowed; | ||
596 | set_cpus_allowed(current, cpumask_of_cpu(pr->id)); | ||
597 | ret = pr->throttling.acpi_processor_get_throttling(pr); | ||
598 | /* restore the previous state */ | ||
599 | set_cpus_allowed(current, saved_mask); | ||
600 | |||
601 | return ret; | ||
602 | } | ||
603 | |||
604 | static int acpi_processor_get_fadt_info(struct acpi_processor *pr) | ||
605 | { | ||
606 | int i, step; | ||
607 | |||
608 | if (!pr->throttling.address) { | ||
609 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); | ||
610 | return -EINVAL; | ||
611 | } else if (!pr->throttling.duty_width) { | ||
612 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); | ||
613 | return -EINVAL; | ||
614 | } | ||
615 | /* TBD: Support duty_cycle values that span bit 4. */ | ||
616 | else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { | ||
617 | printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n"); | ||
618 | return -EINVAL; | ||
619 | } | ||
620 | |||
621 | pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width; | ||
622 | |||
623 | /* | ||
624 | * Compute state values. Note that throttling displays a linear power | ||
625 | * performance relationship (at 50% performance the CPU will consume | ||
626 | * 50% power). Values are in 1/10th of a percent to preserve accuracy. | ||
627 | */ | ||
628 | |||
629 | step = (1000 / pr->throttling.state_count); | ||
630 | |||
631 | for (i = 0; i < pr->throttling.state_count; i++) { | ||
632 | pr->throttling.states[i].performance = 1000 - step * i; | ||
633 | pr->throttling.states[i].power = 1000 - step * i; | ||
634 | } | ||
635 | return 0; | ||
431 | } | 636 | } |
432 | 637 | ||
433 | static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | 638 | static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, |
@@ -506,7 +711,8 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | |||
506 | static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | 711 | static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, |
507 | int state) | 712 | int state) |
508 | { | 713 | { |
509 | u32 value = 0; | 714 | int ret; |
715 | acpi_integer value; | ||
510 | 716 | ||
511 | if (!pr) | 717 | if (!pr) |
512 | return -EINVAL; | 718 | return -EINVAL; |
@@ -523,28 +729,34 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
523 | if (state < pr->throttling_platform_limit) | 729 | if (state < pr->throttling_platform_limit) |
524 | return -EPERM; | 730 | return -EPERM; |
525 | 731 | ||
526 | local_irq_disable(); | 732 | value = 0; |
527 | 733 | ret = acpi_get_throttling_value(pr, state, &value); | |
528 | value = acpi_get_throttling_value(pr, state); | 734 | if (ret >= 0) { |
529 | if (value >= 0) { | 735 | acpi_write_throttling_state(pr, value); |
530 | acpi_write_throttling_state(&pr->throttling, value); | ||
531 | pr->throttling.state = state; | 736 | pr->throttling.state = state; |
532 | } | 737 | } |
533 | local_irq_enable(); | ||
534 | 738 | ||
535 | return 0; | 739 | return 0; |
536 | } | 740 | } |
537 | 741 | ||
538 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | 742 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state) |
539 | { | 743 | { |
540 | return pr->throttling.acpi_processor_set_throttling(pr, state); | 744 | cpumask_t saved_mask; |
745 | int ret; | ||
746 | /* | ||
747 | * Migrate task to the cpu pointed by pr. | ||
748 | */ | ||
749 | saved_mask = current->cpus_allowed; | ||
750 | set_cpus_allowed(current, cpumask_of_cpu(pr->id)); | ||
751 | ret = pr->throttling.acpi_processor_set_throttling(pr, state); | ||
752 | /* restore the previous state */ | ||
753 | set_cpus_allowed(current, saved_mask); | ||
754 | return ret; | ||
541 | } | 755 | } |
542 | 756 | ||
543 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) | 757 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) |
544 | { | 758 | { |
545 | int result = 0; | 759 | int result = 0; |
546 | int step = 0; | ||
547 | int i = 0; | ||
548 | 760 | ||
549 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 761 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
550 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", | 762 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", |
@@ -563,6 +775,8 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
563 | acpi_processor_get_throttling_states(pr) || | 775 | acpi_processor_get_throttling_states(pr) || |
564 | acpi_processor_get_platform_limit(pr)) | 776 | acpi_processor_get_platform_limit(pr)) |
565 | { | 777 | { |
778 | if (acpi_processor_get_fadt_info(pr)) | ||
779 | return 0; | ||
566 | pr->throttling.acpi_processor_get_throttling = | 780 | pr->throttling.acpi_processor_get_throttling = |
567 | &acpi_processor_get_throttling_fadt; | 781 | &acpi_processor_get_throttling_fadt; |
568 | pr->throttling.acpi_processor_set_throttling = | 782 | pr->throttling.acpi_processor_set_throttling = |
@@ -576,19 +790,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
576 | 790 | ||
577 | acpi_processor_get_tsd(pr); | 791 | acpi_processor_get_tsd(pr); |
578 | 792 | ||
579 | if (!pr->throttling.address) { | ||
580 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); | ||
581 | return 0; | ||
582 | } else if (!pr->throttling.duty_width) { | ||
583 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); | ||
584 | return 0; | ||
585 | } | ||
586 | /* TBD: Support duty_cycle values that span bit 4. */ | ||
587 | else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { | ||
588 | printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n"); | ||
589 | return 0; | ||
590 | } | ||
591 | |||
592 | /* | 793 | /* |
593 | * PIIX4 Errata: We don't support throttling on the original PIIX4. | 794 | * PIIX4 Errata: We don't support throttling on the original PIIX4. |
594 | * This shouldn't be an issue as few (if any) mobile systems ever | 795 | * This shouldn't be an issue as few (if any) mobile systems ever |
@@ -600,21 +801,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
600 | return 0; | 801 | return 0; |
601 | } | 802 | } |
602 | 803 | ||
603 | pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width; | ||
604 | |||
605 | /* | ||
606 | * Compute state values. Note that throttling displays a linear power/ | ||
607 | * performance relationship (at 50% performance the CPU will consume | ||
608 | * 50% power). Values are in 1/10th of a percent to preserve accuracy. | ||
609 | */ | ||
610 | |||
611 | step = (1000 / pr->throttling.state_count); | ||
612 | |||
613 | for (i = 0; i < pr->throttling.state_count; i++) { | ||
614 | pr->throttling.states[i].performance = step * i; | ||
615 | pr->throttling.states[i].power = step * i; | ||
616 | } | ||
617 | |||
618 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", | 804 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", |
619 | pr->throttling.state_count)); | 805 | pr->throttling.state_count)); |
620 | 806 | ||
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 90fd09c65f95..22cb95b349e4 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
31 | 31 | ||
32 | #ifdef CONFIG_ACPI_PROCFS | 32 | #ifdef CONFIG_ACPI_PROCFS_POWER |
33 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
34 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
35 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
@@ -54,12 +54,6 @@ | |||
54 | #define ACPI_BATTERY_DIR_NAME "BAT%i" | 54 | #define ACPI_BATTERY_DIR_NAME "BAT%i" |
55 | #define ACPI_AC_DIR_NAME "AC0" | 55 | #define ACPI_AC_DIR_NAME "AC0" |
56 | 56 | ||
57 | enum acpi_sbs_device_addr { | ||
58 | ACPI_SBS_CHARGER = 0x9, | ||
59 | ACPI_SBS_MANAGER = 0xa, | ||
60 | ACPI_SBS_BATTERY = 0xb, | ||
61 | }; | ||
62 | |||
63 | #define ACPI_SBS_NOTIFY_STATUS 0x80 | 57 | #define ACPI_SBS_NOTIFY_STATUS 0x80 |
64 | #define ACPI_SBS_NOTIFY_INFO 0x81 | 58 | #define ACPI_SBS_NOTIFY_INFO 0x81 |
65 | 59 | ||
@@ -88,7 +82,7 @@ MODULE_DEVICE_TABLE(acpi, sbs_device_ids); | |||
88 | struct acpi_battery { | 82 | struct acpi_battery { |
89 | struct power_supply bat; | 83 | struct power_supply bat; |
90 | struct acpi_sbs *sbs; | 84 | struct acpi_sbs *sbs; |
91 | #ifdef CONFIG_ACPI_PROCFS | 85 | #ifdef CONFIG_ACPI_PROCFS_POWER |
92 | struct proc_dir_entry *proc_entry; | 86 | struct proc_dir_entry *proc_entry; |
93 | #endif | 87 | #endif |
94 | unsigned long update_time; | 88 | unsigned long update_time; |
@@ -113,6 +107,7 @@ struct acpi_battery { | |||
113 | u16 spec; | 107 | u16 spec; |
114 | u8 id; | 108 | u8 id; |
115 | u8 present:1; | 109 | u8 present:1; |
110 | u8 have_sysfs_alarm:1; | ||
116 | }; | 111 | }; |
117 | 112 | ||
118 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); | 113 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); |
@@ -122,7 +117,7 @@ struct acpi_sbs { | |||
122 | struct acpi_device *device; | 117 | struct acpi_device *device; |
123 | struct acpi_smb_hc *hc; | 118 | struct acpi_smb_hc *hc; |
124 | struct mutex lock; | 119 | struct mutex lock; |
125 | #ifdef CONFIG_ACPI_PROCFS | 120 | #ifdef CONFIG_ACPI_PROCFS_POWER |
126 | struct proc_dir_entry *charger_entry; | 121 | struct proc_dir_entry *charger_entry; |
127 | #endif | 122 | #endif |
128 | struct acpi_battery battery[MAX_SBS_BAT]; | 123 | struct acpi_battery battery[MAX_SBS_BAT]; |
@@ -468,7 +463,7 @@ static struct device_attribute alarm_attr = { | |||
468 | FS Interface (/proc/acpi) | 463 | FS Interface (/proc/acpi) |
469 | -------------------------------------------------------------------------- */ | 464 | -------------------------------------------------------------------------- */ |
470 | 465 | ||
471 | #ifdef CONFIG_ACPI_PROCFS | 466 | #ifdef CONFIG_ACPI_PROCFS_POWER |
472 | /* Generic Routines */ | 467 | /* Generic Routines */ |
473 | static int | 468 | static int |
474 | acpi_sbs_add_fs(struct proc_dir_entry **dir, | 469 | acpi_sbs_add_fs(struct proc_dir_entry **dir, |
@@ -538,7 +533,7 @@ static struct proc_dir_entry *acpi_battery_dir = NULL; | |||
538 | 533 | ||
539 | static inline char *acpi_battery_units(struct acpi_battery *battery) | 534 | static inline char *acpi_battery_units(struct acpi_battery *battery) |
540 | { | 535 | { |
541 | return acpi_battery_mode(battery) ? " mWh" : " mAh"; | 536 | return acpi_battery_mode(battery) ? " mW" : " mA"; |
542 | } | 537 | } |
543 | 538 | ||
544 | 539 | ||
@@ -555,10 +550,10 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) | |||
555 | if (!battery->present) | 550 | if (!battery->present) |
556 | goto end; | 551 | goto end; |
557 | 552 | ||
558 | seq_printf(seq, "design capacity: %i%s\n", | 553 | seq_printf(seq, "design capacity: %i%sh\n", |
559 | battery->design_capacity * acpi_battery_scale(battery), | 554 | battery->design_capacity * acpi_battery_scale(battery), |
560 | acpi_battery_units(battery)); | 555 | acpi_battery_units(battery)); |
561 | seq_printf(seq, "last full capacity: %i%s\n", | 556 | seq_printf(seq, "last full capacity: %i%sh\n", |
562 | battery->full_charge_capacity * acpi_battery_scale(battery), | 557 | battery->full_charge_capacity * acpi_battery_scale(battery), |
563 | acpi_battery_units(battery)); | 558 | acpi_battery_units(battery)); |
564 | seq_printf(seq, "battery technology: rechargeable\n"); | 559 | seq_printf(seq, "battery technology: rechargeable\n"); |
@@ -589,7 +584,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
589 | { | 584 | { |
590 | struct acpi_battery *battery = seq->private; | 585 | struct acpi_battery *battery = seq->private; |
591 | struct acpi_sbs *sbs = battery->sbs; | 586 | struct acpi_sbs *sbs = battery->sbs; |
592 | int result = 0; | 587 | int rate; |
593 | 588 | ||
594 | mutex_lock(&sbs->lock); | 589 | mutex_lock(&sbs->lock); |
595 | seq_printf(seq, "present: %s\n", | 590 | seq_printf(seq, "present: %s\n", |
@@ -603,9 +598,12 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
603 | seq_printf(seq, "charging state: %s\n", | 598 | seq_printf(seq, "charging state: %s\n", |
604 | (battery->current_now < 0) ? "discharging" : | 599 | (battery->current_now < 0) ? "discharging" : |
605 | ((battery->current_now > 0) ? "charging" : "charged")); | 600 | ((battery->current_now > 0) ? "charging" : "charged")); |
606 | seq_printf(seq, "present rate: %d mA\n", | 601 | rate = abs(battery->current_now) * acpi_battery_ipscale(battery); |
607 | abs(battery->current_now) * acpi_battery_ipscale(battery)); | 602 | rate *= (acpi_battery_mode(battery))?(battery->voltage_now * |
608 | seq_printf(seq, "remaining capacity: %i%s\n", | 603 | acpi_battery_vscale(battery)/1000):1; |
604 | seq_printf(seq, "present rate: %d%s\n", rate, | ||
605 | acpi_battery_units(battery)); | ||
606 | seq_printf(seq, "remaining capacity: %i%sh\n", | ||
609 | battery->capacity_now * acpi_battery_scale(battery), | 607 | battery->capacity_now * acpi_battery_scale(battery), |
610 | acpi_battery_units(battery)); | 608 | acpi_battery_units(battery)); |
611 | seq_printf(seq, "present voltage: %i mV\n", | 609 | seq_printf(seq, "present voltage: %i mV\n", |
@@ -613,7 +611,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
613 | 611 | ||
614 | end: | 612 | end: |
615 | mutex_unlock(&sbs->lock); | 613 | mutex_unlock(&sbs->lock); |
616 | return result; | 614 | return 0; |
617 | } | 615 | } |
618 | 616 | ||
619 | static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) | 617 | static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) |
@@ -637,7 +635,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) | |||
637 | acpi_battery_get_alarm(battery); | 635 | acpi_battery_get_alarm(battery); |
638 | seq_printf(seq, "alarm: "); | 636 | seq_printf(seq, "alarm: "); |
639 | if (battery->alarm_capacity) | 637 | if (battery->alarm_capacity) |
640 | seq_printf(seq, "%i%s\n", | 638 | seq_printf(seq, "%i%sh\n", |
641 | battery->alarm_capacity * | 639 | battery->alarm_capacity * |
642 | acpi_battery_scale(battery), | 640 | acpi_battery_scale(battery), |
643 | acpi_battery_units(battery)); | 641 | acpi_battery_units(battery)); |
@@ -789,7 +787,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
789 | return result; | 787 | return result; |
790 | 788 | ||
791 | sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); | 789 | sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); |
792 | #ifdef CONFIG_ACPI_PROCFS | 790 | #ifdef CONFIG_ACPI_PROCFS_POWER |
793 | acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir, | 791 | acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir, |
794 | battery->name, &acpi_battery_info_fops, | 792 | battery->name, &acpi_battery_info_fops, |
795 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, | 793 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, |
@@ -808,7 +806,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
808 | } | 806 | } |
809 | battery->bat.get_property = acpi_sbs_battery_get_property; | 807 | battery->bat.get_property = acpi_sbs_battery_get_property; |
810 | result = power_supply_register(&sbs->device->dev, &battery->bat); | 808 | result = power_supply_register(&sbs->device->dev, &battery->bat); |
811 | device_create_file(battery->bat.dev, &alarm_attr); | 809 | if (result) |
810 | goto end; | ||
811 | result = device_create_file(battery->bat.dev, &alarm_attr); | ||
812 | if (result) | ||
813 | goto end; | ||
814 | battery->have_sysfs_alarm = 1; | ||
815 | end: | ||
812 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", | 816 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", |
813 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), | 817 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), |
814 | battery->name, sbs->battery->present ? "present" : "absent"); | 818 | battery->name, sbs->battery->present ? "present" : "absent"); |
@@ -817,14 +821,16 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
817 | 821 | ||
818 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 822 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
819 | { | 823 | { |
820 | if (sbs->battery[id].bat.dev) | 824 | struct acpi_battery *battery = &sbs->battery[id]; |
821 | device_remove_file(sbs->battery[id].bat.dev, &alarm_attr); | 825 | |
822 | power_supply_unregister(&sbs->battery[id].bat); | 826 | if (battery->bat.dev) { |
823 | #ifdef CONFIG_ACPI_PROCFS | 827 | if (battery->have_sysfs_alarm) |
824 | if (sbs->battery[id].proc_entry) { | 828 | device_remove_file(battery->bat.dev, &alarm_attr); |
825 | acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry), | 829 | power_supply_unregister(&battery->bat); |
826 | acpi_battery_dir); | ||
827 | } | 830 | } |
831 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
832 | if (battery->proc_entry) | ||
833 | acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); | ||
828 | #endif | 834 | #endif |
829 | } | 835 | } |
830 | 836 | ||
@@ -835,7 +841,7 @@ static int acpi_charger_add(struct acpi_sbs *sbs) | |||
835 | result = acpi_ac_get_present(sbs); | 841 | result = acpi_ac_get_present(sbs); |
836 | if (result) | 842 | if (result) |
837 | goto end; | 843 | goto end; |
838 | #ifdef CONFIG_ACPI_PROCFS | 844 | #ifdef CONFIG_ACPI_PROCFS_POWER |
839 | result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir, | 845 | result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir, |
840 | ACPI_AC_DIR_NAME, NULL, | 846 | ACPI_AC_DIR_NAME, NULL, |
841 | &acpi_ac_state_fops, NULL, sbs); | 847 | &acpi_ac_state_fops, NULL, sbs); |
@@ -859,7 +865,7 @@ static void acpi_charger_remove(struct acpi_sbs *sbs) | |||
859 | { | 865 | { |
860 | if (sbs->charger.dev) | 866 | if (sbs->charger.dev) |
861 | power_supply_unregister(&sbs->charger); | 867 | power_supply_unregister(&sbs->charger); |
862 | #ifdef CONFIG_ACPI_PROCFS | 868 | #ifdef CONFIG_ACPI_PROCFS_POWER |
863 | if (sbs->charger_entry) | 869 | if (sbs->charger_entry) |
864 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); | 870 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); |
865 | #endif | 871 | #endif |
@@ -965,7 +971,7 @@ static int acpi_sbs_remove(struct acpi_device *device, int type) | |||
965 | 971 | ||
966 | static void acpi_sbs_rmdirs(void) | 972 | static void acpi_sbs_rmdirs(void) |
967 | { | 973 | { |
968 | #ifdef CONFIG_ACPI_PROCFS | 974 | #ifdef CONFIG_ACPI_PROCFS_POWER |
969 | if (acpi_ac_dir) { | 975 | if (acpi_ac_dir) { |
970 | acpi_unlock_ac_dir(acpi_ac_dir); | 976 | acpi_unlock_ac_dir(acpi_ac_dir); |
971 | acpi_ac_dir = NULL; | 977 | acpi_ac_dir = NULL; |
@@ -1004,7 +1010,7 @@ static int __init acpi_sbs_init(void) | |||
1004 | 1010 | ||
1005 | if (acpi_disabled) | 1011 | if (acpi_disabled) |
1006 | return -ENODEV; | 1012 | return -ENODEV; |
1007 | #ifdef CONFIG_ACPI_PROCFS | 1013 | #ifdef CONFIG_ACPI_PROCFS_POWER |
1008 | acpi_ac_dir = acpi_lock_ac_dir(); | 1014 | acpi_ac_dir = acpi_lock_ac_dir(); |
1009 | if (!acpi_ac_dir) | 1015 | if (!acpi_ac_dir) |
1010 | return -ENODEV; | 1016 | return -ENODEV; |
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index 046d7c3ed356..fd40b6a1d639 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
@@ -202,10 +202,9 @@ int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc) | |||
202 | 202 | ||
203 | EXPORT_SYMBOL_GPL(acpi_smbus_unregister_callback); | 203 | EXPORT_SYMBOL_GPL(acpi_smbus_unregister_callback); |
204 | 204 | ||
205 | static void acpi_smbus_callback(void *context) | 205 | static inline void acpi_smbus_callback(void *context) |
206 | { | 206 | { |
207 | struct acpi_smb_hc *hc = context; | 207 | struct acpi_smb_hc *hc = context; |
208 | |||
209 | if (hc->callback) | 208 | if (hc->callback) |
210 | hc->callback(hc->context); | 209 | hc->callback(hc->context); |
211 | } | 210 | } |
@@ -214,6 +213,7 @@ static int smbus_alarm(void *context) | |||
214 | { | 213 | { |
215 | struct acpi_smb_hc *hc = context; | 214 | struct acpi_smb_hc *hc = context; |
216 | union acpi_smb_status status; | 215 | union acpi_smb_status status; |
216 | u8 address; | ||
217 | if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw)) | 217 | if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw)) |
218 | return 0; | 218 | return 0; |
219 | /* Check if it is only a completion notify */ | 219 | /* Check if it is only a completion notify */ |
@@ -222,9 +222,18 @@ static int smbus_alarm(void *context) | |||
222 | if (!status.fields.alarm) | 222 | if (!status.fields.alarm) |
223 | return 0; | 223 | return 0; |
224 | mutex_lock(&hc->lock); | 224 | mutex_lock(&hc->lock); |
225 | smb_hc_read(hc, ACPI_SMB_ALARM_ADDRESS, &address); | ||
226 | status.fields.alarm = 0; | ||
225 | smb_hc_write(hc, ACPI_SMB_STATUS, status.raw); | 227 | smb_hc_write(hc, ACPI_SMB_STATUS, status.raw); |
226 | if (hc->callback) | 228 | /* We are only interested in events coming from known devices */ |
227 | acpi_os_execute(OSL_GPE_HANDLER, acpi_smbus_callback, hc); | 229 | switch (address >> 1) { |
230 | case ACPI_SBS_CHARGER: | ||
231 | case ACPI_SBS_MANAGER: | ||
232 | case ACPI_SBS_BATTERY: | ||
233 | acpi_os_execute(OSL_GPE_HANDLER, | ||
234 | acpi_smbus_callback, hc); | ||
235 | default:; | ||
236 | } | ||
228 | mutex_unlock(&hc->lock); | 237 | mutex_unlock(&hc->lock); |
229 | return 0; | 238 | return 0; |
230 | } | 239 | } |
diff --git a/drivers/acpi/sbshc.h b/drivers/acpi/sbshc.h index 3bda3491a97b..a57b0762dd7f 100644 --- a/drivers/acpi/sbshc.h +++ b/drivers/acpi/sbshc.h | |||
@@ -16,6 +16,12 @@ enum acpi_smb_protocol { | |||
16 | 16 | ||
17 | static const u8 SMBUS_PEC = 0x80; | 17 | static const u8 SMBUS_PEC = 0x80; |
18 | 18 | ||
19 | enum acpi_sbs_device_addr { | ||
20 | ACPI_SBS_CHARGER = 0x9, | ||
21 | ACPI_SBS_MANAGER = 0xa, | ||
22 | ACPI_SBS_BATTERY = 0xb, | ||
23 | }; | ||
24 | |||
19 | typedef void (*smbus_alarm_callback)(void *context); | 25 | typedef void (*smbus_alarm_callback)(void *context); |
20 | 26 | ||
21 | extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address, | 27 | extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address, |
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 5f1d85f2ffe4..010f19652f80 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -449,7 +449,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) | |||
449 | /* XSDT has NULL entry, RSDT is used */ | 449 | /* XSDT has NULL entry, RSDT is used */ |
450 | address = rsdt_address; | 450 | address = rsdt_address; |
451 | table_entry_size = sizeof(u32); | 451 | table_entry_size = sizeof(u32); |
452 | ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry," | 452 | ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry, " |
453 | "using RSDT")); | 453 | "using RSDT")); |
454 | } | 454 | } |
455 | } | 455 | } |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index bac956b30c57..bd77e81e81c1 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
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/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
34 | #include <linux/input.h> | 35 | #include <linux/input.h> |
@@ -135,8 +136,8 @@ struct acpi_video_bus { | |||
135 | u8 attached_count; | 136 | u8 attached_count; |
136 | struct acpi_video_bus_cap cap; | 137 | struct acpi_video_bus_cap cap; |
137 | struct acpi_video_bus_flags flags; | 138 | struct acpi_video_bus_flags flags; |
138 | struct semaphore sem; | ||
139 | struct list_head video_device_list; | 139 | struct list_head video_device_list; |
140 | struct mutex device_list_lock; /* protects video_device_list */ | ||
140 | struct proc_dir_entry *dir; | 141 | struct proc_dir_entry *dir; |
141 | struct input_dev *input; | 142 | struct input_dev *input; |
142 | char phys[32]; /* for input device */ | 143 | char phys[32]; /* for input device */ |
@@ -576,7 +577,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
576 | struct acpi_video_device_brightness *br = NULL; | 577 | struct acpi_video_device_brightness *br = NULL; |
577 | 578 | ||
578 | 579 | ||
579 | memset(&device->cap, 0, 4); | 580 | memset(&device->cap, 0, sizeof(device->cap)); |
580 | 581 | ||
581 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { | 582 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { |
582 | device->cap._ADR = 1; | 583 | device->cap._ADR = 1; |
@@ -696,7 +697,7 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | |||
696 | { | 697 | { |
697 | acpi_handle h_dummy1; | 698 | acpi_handle h_dummy1; |
698 | 699 | ||
699 | memset(&video->cap, 0, 4); | 700 | memset(&video->cap, 0, sizeof(video->cap)); |
700 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { | 701 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { |
701 | video->cap._DOS = 1; | 702 | video->cap._DOS = 1; |
702 | } | 703 | } |
@@ -896,7 +897,7 @@ acpi_video_device_write_brightness(struct file *file, | |||
896 | { | 897 | { |
897 | struct seq_file *m = file->private_data; | 898 | struct seq_file *m = file->private_data; |
898 | struct acpi_video_device *dev = m->private; | 899 | struct acpi_video_device *dev = m->private; |
899 | char str[4] = { 0 }; | 900 | char str[5] = { 0 }; |
900 | unsigned int level = 0; | 901 | unsigned int level = 0; |
901 | int i; | 902 | int i; |
902 | 903 | ||
@@ -1436,9 +1437,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1436 | return -ENODEV; | 1437 | return -ENODEV; |
1437 | } | 1438 | } |
1438 | 1439 | ||
1439 | down(&video->sem); | 1440 | mutex_lock(&video->device_list_lock); |
1440 | list_add_tail(&data->entry, &video->video_device_list); | 1441 | list_add_tail(&data->entry, &video->video_device_list); |
1441 | up(&video->sem); | 1442 | mutex_unlock(&video->device_list_lock); |
1442 | 1443 | ||
1443 | acpi_video_device_add_fs(device); | 1444 | acpi_video_device_add_fs(device); |
1444 | 1445 | ||
@@ -1462,12 +1463,14 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1462 | 1463 | ||
1463 | static void acpi_video_device_rebind(struct acpi_video_bus *video) | 1464 | static void acpi_video_device_rebind(struct acpi_video_bus *video) |
1464 | { | 1465 | { |
1465 | struct list_head *node, *next; | 1466 | struct acpi_video_device *dev; |
1466 | list_for_each_safe(node, next, &video->video_device_list) { | 1467 | |
1467 | struct acpi_video_device *dev = | 1468 | mutex_lock(&video->device_list_lock); |
1468 | container_of(node, struct acpi_video_device, entry); | 1469 | |
1470 | list_for_each_entry(dev, &video->video_device_list, entry) | ||
1469 | acpi_video_device_bind(video, dev); | 1471 | acpi_video_device_bind(video, dev); |
1470 | } | 1472 | |
1473 | mutex_unlock(&video->device_list_lock); | ||
1471 | } | 1474 | } |
1472 | 1475 | ||
1473 | /* | 1476 | /* |
@@ -1592,30 +1595,33 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
1592 | 1595 | ||
1593 | static int acpi_video_switch_output(struct acpi_video_bus *video, int event) | 1596 | static int acpi_video_switch_output(struct acpi_video_bus *video, int event) |
1594 | { | 1597 | { |
1595 | struct list_head *node, *next; | 1598 | struct list_head *node; |
1596 | struct acpi_video_device *dev = NULL; | 1599 | struct acpi_video_device *dev = NULL; |
1597 | struct acpi_video_device *dev_next = NULL; | 1600 | struct acpi_video_device *dev_next = NULL; |
1598 | struct acpi_video_device *dev_prev = NULL; | 1601 | struct acpi_video_device *dev_prev = NULL; |
1599 | unsigned long state; | 1602 | unsigned long state; |
1600 | int status = 0; | 1603 | int status = 0; |
1601 | 1604 | ||
1605 | mutex_lock(&video->device_list_lock); | ||
1602 | 1606 | ||
1603 | list_for_each_safe(node, next, &video->video_device_list) { | 1607 | list_for_each(node, &video->video_device_list) { |
1604 | dev = container_of(node, struct acpi_video_device, entry); | 1608 | dev = container_of(node, struct acpi_video_device, entry); |
1605 | status = acpi_video_device_get_state(dev, &state); | 1609 | status = acpi_video_device_get_state(dev, &state); |
1606 | if (state & 0x2) { | 1610 | if (state & 0x2) { |
1607 | dev_next = | 1611 | dev_next = container_of(node->next, |
1608 | container_of(node->next, struct acpi_video_device, | 1612 | struct acpi_video_device, entry); |
1609 | entry); | 1613 | dev_prev = container_of(node->prev, |
1610 | dev_prev = | 1614 | struct acpi_video_device, entry); |
1611 | container_of(node->prev, struct acpi_video_device, | ||
1612 | entry); | ||
1613 | goto out; | 1615 | goto out; |
1614 | } | 1616 | } |
1615 | } | 1617 | } |
1618 | |||
1616 | dev_next = container_of(node->next, struct acpi_video_device, entry); | 1619 | dev_next = container_of(node->next, struct acpi_video_device, entry); |
1617 | dev_prev = container_of(node->prev, struct acpi_video_device, entry); | 1620 | dev_prev = container_of(node->prev, struct acpi_video_device, entry); |
1618 | out: | 1621 | |
1622 | out: | ||
1623 | mutex_unlock(&video->device_list_lock); | ||
1624 | |||
1619 | switch (event) { | 1625 | switch (event) { |
1620 | case ACPI_VIDEO_NOTIFY_CYCLE: | 1626 | case ACPI_VIDEO_NOTIFY_CYCLE: |
1621 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: | 1627 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: |
@@ -1691,24 +1697,17 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, | |||
1691 | struct acpi_device *device) | 1697 | struct acpi_device *device) |
1692 | { | 1698 | { |
1693 | int status = 0; | 1699 | int status = 0; |
1694 | struct list_head *node, *next; | 1700 | struct acpi_device *dev; |
1695 | |||
1696 | 1701 | ||
1697 | acpi_video_device_enumerate(video); | 1702 | acpi_video_device_enumerate(video); |
1698 | 1703 | ||
1699 | list_for_each_safe(node, next, &device->children) { | 1704 | list_for_each_entry(dev, &device->children, node) { |
1700 | struct acpi_device *dev = | ||
1701 | list_entry(node, struct acpi_device, node); | ||
1702 | |||
1703 | if (!dev) | ||
1704 | continue; | ||
1705 | 1705 | ||
1706 | status = acpi_video_bus_get_one_device(dev, video); | 1706 | status = acpi_video_bus_get_one_device(dev, video); |
1707 | if (ACPI_FAILURE(status)) { | 1707 | if (ACPI_FAILURE(status)) { |
1708 | ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); | 1708 | ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); |
1709 | continue; | 1709 | continue; |
1710 | } | 1710 | } |
1711 | |||
1712 | } | 1711 | } |
1713 | return status; | 1712 | return status; |
1714 | } | 1713 | } |
@@ -1724,9 +1723,6 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
1724 | 1723 | ||
1725 | video = device->video; | 1724 | video = device->video; |
1726 | 1725 | ||
1727 | down(&video->sem); | ||
1728 | list_del(&device->entry); | ||
1729 | up(&video->sem); | ||
1730 | acpi_video_device_remove_fs(device->dev); | 1726 | acpi_video_device_remove_fs(device->dev); |
1731 | 1727 | ||
1732 | status = acpi_remove_notify_handler(device->dev->handle, | 1728 | status = acpi_remove_notify_handler(device->dev->handle, |
@@ -1734,32 +1730,34 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
1734 | acpi_video_device_notify); | 1730 | acpi_video_device_notify); |
1735 | backlight_device_unregister(device->backlight); | 1731 | backlight_device_unregister(device->backlight); |
1736 | video_output_unregister(device->output_dev); | 1732 | video_output_unregister(device->output_dev); |
1733 | |||
1737 | return 0; | 1734 | return 0; |
1738 | } | 1735 | } |
1739 | 1736 | ||
1740 | static int acpi_video_bus_put_devices(struct acpi_video_bus *video) | 1737 | static int acpi_video_bus_put_devices(struct acpi_video_bus *video) |
1741 | { | 1738 | { |
1742 | int status; | 1739 | int status; |
1743 | struct list_head *node, *next; | 1740 | struct acpi_video_device *dev, *next; |
1744 | 1741 | ||
1742 | mutex_lock(&video->device_list_lock); | ||
1745 | 1743 | ||
1746 | list_for_each_safe(node, next, &video->video_device_list) { | 1744 | list_for_each_entry_safe(dev, next, &video->video_device_list, entry) { |
1747 | struct acpi_video_device *data = | ||
1748 | list_entry(node, struct acpi_video_device, entry); | ||
1749 | if (!data) | ||
1750 | continue; | ||
1751 | 1745 | ||
1752 | status = acpi_video_bus_put_one_device(data); | 1746 | status = acpi_video_bus_put_one_device(dev); |
1753 | if (ACPI_FAILURE(status)) | 1747 | if (ACPI_FAILURE(status)) |
1754 | printk(KERN_WARNING PREFIX | 1748 | printk(KERN_WARNING PREFIX |
1755 | "hhuuhhuu bug in acpi video driver.\n"); | 1749 | "hhuuhhuu bug in acpi video driver.\n"); |
1756 | 1750 | ||
1757 | if (data->brightness) | 1751 | if (dev->brightness) { |
1758 | kfree(data->brightness->levels); | 1752 | kfree(dev->brightness->levels); |
1759 | kfree(data->brightness); | 1753 | kfree(dev->brightness); |
1760 | kfree(data); | 1754 | } |
1755 | list_del(&dev->entry); | ||
1756 | kfree(dev); | ||
1761 | } | 1757 | } |
1762 | 1758 | ||
1759 | mutex_unlock(&video->device_list_lock); | ||
1760 | |||
1763 | return 0; | 1761 | return 0; |
1764 | } | 1762 | } |
1765 | 1763 | ||
@@ -1782,9 +1780,6 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) | |||
1782 | struct input_dev *input; | 1780 | struct input_dev *input; |
1783 | int keycode; | 1781 | int keycode; |
1784 | 1782 | ||
1785 | |||
1786 | printk("video bus notify\n"); | ||
1787 | |||
1788 | if (!video) | 1783 | if (!video) |
1789 | return; | 1784 | return; |
1790 | 1785 | ||
@@ -1897,14 +1892,10 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
1897 | static int instance; | 1892 | static int instance; |
1898 | static int acpi_video_bus_add(struct acpi_device *device) | 1893 | static int acpi_video_bus_add(struct acpi_device *device) |
1899 | { | 1894 | { |
1900 | int result = 0; | 1895 | acpi_status status; |
1901 | acpi_status status = 0; | 1896 | struct acpi_video_bus *video; |
1902 | struct acpi_video_bus *video = NULL; | ||
1903 | struct input_dev *input; | 1897 | struct input_dev *input; |
1904 | 1898 | int error; | |
1905 | |||
1906 | if (!device) | ||
1907 | return -EINVAL; | ||
1908 | 1899 | ||
1909 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); | 1900 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); |
1910 | if (!video) | 1901 | if (!video) |
@@ -1923,15 +1914,15 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1923 | acpi_driver_data(device) = video; | 1914 | acpi_driver_data(device) = video; |
1924 | 1915 | ||
1925 | acpi_video_bus_find_cap(video); | 1916 | acpi_video_bus_find_cap(video); |
1926 | result = acpi_video_bus_check(video); | 1917 | error = acpi_video_bus_check(video); |
1927 | if (result) | 1918 | if (error) |
1928 | goto end; | 1919 | goto err_free_video; |
1929 | 1920 | ||
1930 | result = acpi_video_bus_add_fs(device); | 1921 | error = acpi_video_bus_add_fs(device); |
1931 | if (result) | 1922 | if (error) |
1932 | goto end; | 1923 | goto err_free_video; |
1933 | 1924 | ||
1934 | init_MUTEX(&video->sem); | 1925 | mutex_init(&video->device_list_lock); |
1935 | INIT_LIST_HEAD(&video->video_device_list); | 1926 | INIT_LIST_HEAD(&video->video_device_list); |
1936 | 1927 | ||
1937 | acpi_video_bus_get_devices(video, device); | 1928 | acpi_video_bus_get_devices(video, device); |
@@ -1943,16 +1934,15 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1943 | if (ACPI_FAILURE(status)) { | 1934 | if (ACPI_FAILURE(status)) { |
1944 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1935 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1945 | "Error installing notify handler\n")); | 1936 | "Error installing notify handler\n")); |
1946 | acpi_video_bus_stop_devices(video); | 1937 | error = -ENODEV; |
1947 | acpi_video_bus_put_devices(video); | 1938 | goto err_stop_video; |
1948 | kfree(video->attached_array); | ||
1949 | acpi_video_bus_remove_fs(device); | ||
1950 | result = -ENODEV; | ||
1951 | goto end; | ||
1952 | } | 1939 | } |
1953 | 1940 | ||
1954 | |||
1955 | video->input = input = input_allocate_device(); | 1941 | video->input = input = input_allocate_device(); |
1942 | if (!input) { | ||
1943 | error = -ENOMEM; | ||
1944 | goto err_uninstall_notify; | ||
1945 | } | ||
1956 | 1946 | ||
1957 | snprintf(video->phys, sizeof(video->phys), | 1947 | snprintf(video->phys, sizeof(video->phys), |
1958 | "%s/video/input0", acpi_device_hid(video->device)); | 1948 | "%s/video/input0", acpi_device_hid(video->device)); |
@@ -1961,6 +1951,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1961 | input->phys = video->phys; | 1951 | input->phys = video->phys; |
1962 | input->id.bustype = BUS_HOST; | 1952 | input->id.bustype = BUS_HOST; |
1963 | input->id.product = 0x06; | 1953 | input->id.product = 0x06; |
1954 | input->dev.parent = &device->dev; | ||
1964 | input->evbit[0] = BIT(EV_KEY); | 1955 | input->evbit[0] = BIT(EV_KEY); |
1965 | set_bit(KEY_SWITCHVIDEOMODE, input->keybit); | 1956 | set_bit(KEY_SWITCHVIDEOMODE, input->keybit); |
1966 | set_bit(KEY_VIDEO_NEXT, input->keybit); | 1957 | set_bit(KEY_VIDEO_NEXT, input->keybit); |
@@ -1971,18 +1962,10 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1971 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); | 1962 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); |
1972 | set_bit(KEY_DISPLAY_OFF, input->keybit); | 1963 | set_bit(KEY_DISPLAY_OFF, input->keybit); |
1973 | set_bit(KEY_UNKNOWN, input->keybit); | 1964 | set_bit(KEY_UNKNOWN, input->keybit); |
1974 | result = input_register_device(input); | ||
1975 | if (result) { | ||
1976 | acpi_remove_notify_handler(video->device->handle, | ||
1977 | ACPI_DEVICE_NOTIFY, | ||
1978 | acpi_video_bus_notify); | ||
1979 | acpi_video_bus_stop_devices(video); | ||
1980 | acpi_video_bus_put_devices(video); | ||
1981 | kfree(video->attached_array); | ||
1982 | acpi_video_bus_remove_fs(device); | ||
1983 | goto end; | ||
1984 | } | ||
1985 | 1965 | ||
1966 | error = input_register_device(input); | ||
1967 | if (error) | ||
1968 | goto err_free_input_dev; | ||
1986 | 1969 | ||
1987 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", | 1970 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", |
1988 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), | 1971 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), |
@@ -1990,11 +1973,23 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1990 | video->flags.rom ? "yes" : "no", | 1973 | video->flags.rom ? "yes" : "no", |
1991 | video->flags.post ? "yes" : "no"); | 1974 | video->flags.post ? "yes" : "no"); |
1992 | 1975 | ||
1993 | end: | 1976 | return 0; |
1994 | if (result) | 1977 | |
1995 | kfree(video); | 1978 | err_free_input_dev: |
1979 | input_free_device(input); | ||
1980 | err_uninstall_notify: | ||
1981 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | ||
1982 | acpi_video_bus_notify); | ||
1983 | err_stop_video: | ||
1984 | acpi_video_bus_stop_devices(video); | ||
1985 | acpi_video_bus_put_devices(video); | ||
1986 | kfree(video->attached_array); | ||
1987 | acpi_video_bus_remove_fs(device); | ||
1988 | err_free_video: | ||
1989 | kfree(video); | ||
1990 | acpi_driver_data(device) = NULL; | ||
1996 | 1991 | ||
1997 | return result; | 1992 | return error; |
1998 | } | 1993 | } |
1999 | 1994 | ||
2000 | static int acpi_video_bus_remove(struct acpi_device *device, int type) | 1995 | static int acpi_video_bus_remove(struct acpi_device *device, int type) |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index ed9b407e42d4..54f38c21dd95 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -193,6 +193,8 @@ enum { | |||
193 | ATA_FLAG_ACPI_SATA | ATA_FLAG_AN | | 193 | ATA_FLAG_ACPI_SATA | ATA_FLAG_AN | |
194 | ATA_FLAG_IPM, | 194 | ATA_FLAG_IPM, |
195 | AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY, | 195 | AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY, |
196 | |||
197 | ICH_MAP = 0x90, /* ICH MAP register */ | ||
196 | }; | 198 | }; |
197 | 199 | ||
198 | struct ahci_cmd_hdr { | 200 | struct ahci_cmd_hdr { |
@@ -536,6 +538,10 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
536 | { PCI_VDEVICE(NVIDIA, 0x0ad9), board_ahci }, /* MCP77 */ | 538 | { PCI_VDEVICE(NVIDIA, 0x0ad9), board_ahci }, /* MCP77 */ |
537 | { PCI_VDEVICE(NVIDIA, 0x0ada), board_ahci }, /* MCP77 */ | 539 | { PCI_VDEVICE(NVIDIA, 0x0ada), board_ahci }, /* MCP77 */ |
538 | { PCI_VDEVICE(NVIDIA, 0x0adb), board_ahci }, /* MCP77 */ | 540 | { PCI_VDEVICE(NVIDIA, 0x0adb), board_ahci }, /* MCP77 */ |
541 | { PCI_VDEVICE(NVIDIA, 0x0ab4), board_ahci }, /* MCP79 */ | ||
542 | { PCI_VDEVICE(NVIDIA, 0x0ab5), board_ahci }, /* MCP79 */ | ||
543 | { PCI_VDEVICE(NVIDIA, 0x0ab6), board_ahci }, /* MCP79 */ | ||
544 | { PCI_VDEVICE(NVIDIA, 0x0ab7), board_ahci }, /* MCP79 */ | ||
539 | { PCI_VDEVICE(NVIDIA, 0x0ab8), board_ahci }, /* MCP79 */ | 545 | { PCI_VDEVICE(NVIDIA, 0x0ab8), board_ahci }, /* MCP79 */ |
540 | { PCI_VDEVICE(NVIDIA, 0x0ab9), board_ahci }, /* MCP79 */ | 546 | { PCI_VDEVICE(NVIDIA, 0x0ab9), board_ahci }, /* MCP79 */ |
541 | { PCI_VDEVICE(NVIDIA, 0x0aba), board_ahci }, /* MCP79 */ | 547 | { PCI_VDEVICE(NVIDIA, 0x0aba), board_ahci }, /* MCP79 */ |
@@ -1267,9 +1273,9 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
1267 | 1273 | ||
1268 | /* prepare for SRST (AHCI-1.1 10.4.1) */ | 1274 | /* prepare for SRST (AHCI-1.1 10.4.1) */ |
1269 | rc = ahci_kick_engine(ap, 1); | 1275 | rc = ahci_kick_engine(ap, 1); |
1270 | if (rc) | 1276 | if (rc && rc != -EOPNOTSUPP) |
1271 | ata_link_printk(link, KERN_WARNING, | 1277 | ata_link_printk(link, KERN_WARNING, |
1272 | "failed to reset engine (errno=%d)", rc); | 1278 | "failed to reset engine (errno=%d)\n", rc); |
1273 | 1279 | ||
1274 | ata_tf_init(link->device, &tf); | 1280 | ata_tf_init(link->device, &tf); |
1275 | 1281 | ||
@@ -1634,7 +1640,7 @@ static void ahci_port_intr(struct ata_port *ap) | |||
1634 | struct ahci_host_priv *hpriv = ap->host->private_data; | 1640 | struct ahci_host_priv *hpriv = ap->host->private_data; |
1635 | int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING); | 1641 | int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING); |
1636 | u32 status, qc_active; | 1642 | u32 status, qc_active; |
1637 | int rc, known_irq = 0; | 1643 | int rc; |
1638 | 1644 | ||
1639 | status = readl(port_mmio + PORT_IRQ_STAT); | 1645 | status = readl(port_mmio + PORT_IRQ_STAT); |
1640 | writel(status, port_mmio + PORT_IRQ_STAT); | 1646 | writel(status, port_mmio + PORT_IRQ_STAT); |
@@ -1692,80 +1698,12 @@ static void ahci_port_intr(struct ata_port *ap) | |||
1692 | 1698 | ||
1693 | rc = ata_qc_complete_multiple(ap, qc_active, NULL); | 1699 | rc = ata_qc_complete_multiple(ap, qc_active, NULL); |
1694 | 1700 | ||
1695 | /* If resetting, spurious or invalid completions are expected, | 1701 | /* while resetting, invalid completions are expected */ |
1696 | * return unconditionally. | 1702 | if (unlikely(rc < 0 && !resetting)) { |
1697 | */ | ||
1698 | if (resetting) | ||
1699 | return; | ||
1700 | |||
1701 | if (rc > 0) | ||
1702 | return; | ||
1703 | if (rc < 0) { | ||
1704 | ehi->err_mask |= AC_ERR_HSM; | 1703 | ehi->err_mask |= AC_ERR_HSM; |
1705 | ehi->action |= ATA_EH_SOFTRESET; | 1704 | ehi->action |= ATA_EH_SOFTRESET; |
1706 | ata_port_freeze(ap); | 1705 | ata_port_freeze(ap); |
1707 | return; | ||
1708 | } | 1706 | } |
1709 | |||
1710 | /* hmmm... a spurious interrupt */ | ||
1711 | |||
1712 | /* if !NCQ, ignore. No modern ATA device has broken HSM | ||
1713 | * implementation for non-NCQ commands. | ||
1714 | */ | ||
1715 | if (!ap->link.sactive) | ||
1716 | return; | ||
1717 | |||
1718 | if (status & PORT_IRQ_D2H_REG_FIS) { | ||
1719 | if (!pp->ncq_saw_d2h) | ||
1720 | ata_port_printk(ap, KERN_INFO, | ||
1721 | "D2H reg with I during NCQ, " | ||
1722 | "this message won't be printed again\n"); | ||
1723 | pp->ncq_saw_d2h = 1; | ||
1724 | known_irq = 1; | ||
1725 | } | ||
1726 | |||
1727 | if (status & PORT_IRQ_DMAS_FIS) { | ||
1728 | if (!pp->ncq_saw_dmas) | ||
1729 | ata_port_printk(ap, KERN_INFO, | ||
1730 | "DMAS FIS during NCQ, " | ||
1731 | "this message won't be printed again\n"); | ||
1732 | pp->ncq_saw_dmas = 1; | ||
1733 | known_irq = 1; | ||
1734 | } | ||
1735 | |||
1736 | if (status & PORT_IRQ_SDB_FIS) { | ||
1737 | const __le32 *f = pp->rx_fis + RX_FIS_SDB; | ||
1738 | |||
1739 | if (le32_to_cpu(f[1])) { | ||
1740 | /* SDB FIS containing spurious completions | ||
1741 | * might be dangerous, whine and fail commands | ||
1742 | * with HSM violation. EH will turn off NCQ | ||
1743 | * after several such failures. | ||
1744 | */ | ||
1745 | ata_ehi_push_desc(ehi, | ||
1746 | "spurious completions during NCQ " | ||
1747 | "issue=0x%x SAct=0x%x FIS=%08x:%08x", | ||
1748 | readl(port_mmio + PORT_CMD_ISSUE), | ||
1749 | readl(port_mmio + PORT_SCR_ACT), | ||
1750 | le32_to_cpu(f[0]), le32_to_cpu(f[1])); | ||
1751 | ehi->err_mask |= AC_ERR_HSM; | ||
1752 | ehi->action |= ATA_EH_SOFTRESET; | ||
1753 | ata_port_freeze(ap); | ||
1754 | } else { | ||
1755 | if (!pp->ncq_saw_sdb) | ||
1756 | ata_port_printk(ap, KERN_INFO, | ||
1757 | "spurious SDB FIS %08x:%08x during NCQ, " | ||
1758 | "this message won't be printed again\n", | ||
1759 | le32_to_cpu(f[0]), le32_to_cpu(f[1])); | ||
1760 | pp->ncq_saw_sdb = 1; | ||
1761 | } | ||
1762 | known_irq = 1; | ||
1763 | } | ||
1764 | |||
1765 | if (!known_irq) | ||
1766 | ata_port_printk(ap, KERN_INFO, "spurious interrupt " | ||
1767 | "(irq_stat 0x%x active_tag 0x%x sactive 0x%x)\n", | ||
1768 | status, ap->link.active_tag, ap->link.sactive); | ||
1769 | } | 1707 | } |
1770 | 1708 | ||
1771 | static void ahci_irq_clear(struct ata_port *ap) | 1709 | static void ahci_irq_clear(struct ata_port *ap) |
@@ -2269,6 +2207,22 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2269 | if (rc) | 2207 | if (rc) |
2270 | return rc; | 2208 | return rc; |
2271 | 2209 | ||
2210 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
2211 | (pdev->device == 0x2652 || pdev->device == 0x2653)) { | ||
2212 | u8 map; | ||
2213 | |||
2214 | /* ICH6s share the same PCI ID for both piix and ahci | ||
2215 | * modes. Enabling ahci mode while MAP indicates | ||
2216 | * combined mode is a bad idea. Yield to ata_piix. | ||
2217 | */ | ||
2218 | pci_read_config_byte(pdev, ICH_MAP, &map); | ||
2219 | if (map & 0x3) { | ||
2220 | dev_printk(KERN_INFO, &pdev->dev, "controller is in " | ||
2221 | "combined mode, can't enable AHCI mode\n"); | ||
2222 | return -ENODEV; | ||
2223 | } | ||
2224 | } | ||
2225 | |||
2272 | hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); | 2226 | hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); |
2273 | if (!hpriv) | 2227 | if (!hpriv) |
2274 | return -ENOMEM; | 2228 | return -ENOMEM; |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 328ce8a08426..bb62a588f489 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -119,18 +119,19 @@ enum { | |||
119 | PIIX_80C_SEC = (1 << 7) | (1 << 6), | 119 | PIIX_80C_SEC = (1 << 7) | (1 << 6), |
120 | 120 | ||
121 | /* controller IDs */ | 121 | /* controller IDs */ |
122 | piix_pata_33 = 0, /* PIIX4 at 33Mhz */ | 122 | piix_pata_mwdma = 0, /* PIIX3 MWDMA only */ |
123 | ich_pata_33 = 1, /* ICH up to UDMA 33 only */ | 123 | piix_pata_33, /* PIIX4 at 33Mhz */ |
124 | ich_pata_66 = 2, /* ICH up to 66 Mhz */ | 124 | ich_pata_33, /* ICH up to UDMA 33 only */ |
125 | ich_pata_100 = 3, /* ICH up to UDMA 100 */ | 125 | ich_pata_66, /* ICH up to 66 Mhz */ |
126 | ich5_sata = 5, | 126 | ich_pata_100, /* ICH up to UDMA 100 */ |
127 | ich6_sata = 6, | 127 | ich5_sata, |
128 | ich6_sata_ahci = 7, | 128 | ich6_sata, |
129 | ich6m_sata_ahci = 8, | 129 | ich6_sata_ahci, |
130 | ich8_sata_ahci = 9, | 130 | ich6m_sata_ahci, |
131 | piix_pata_mwdma = 10, /* PIIX3 MWDMA only */ | 131 | ich8_sata_ahci, |
132 | tolapai_sata_ahci = 11, | 132 | ich8_2port_sata, |
133 | ich9_2port_sata = 12, | 133 | ich8m_apple_sata_ahci, /* locks up on second port enable */ |
134 | tolapai_sata_ahci, | ||
134 | 135 | ||
135 | /* constants for mapping table */ | 136 | /* constants for mapping table */ |
136 | P0 = 0, /* port 0 */ | 137 | P0 = 0, /* port 0 */ |
@@ -239,19 +240,21 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
239 | /* SATA Controller 1 IDE (ICH8) */ | 240 | /* SATA Controller 1 IDE (ICH8) */ |
240 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, | 241 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
241 | /* SATA Controller 2 IDE (ICH8) */ | 242 | /* SATA Controller 2 IDE (ICH8) */ |
242 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, | 243 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
243 | /* Mobile SATA Controller IDE (ICH8M) */ | 244 | /* Mobile SATA Controller IDE (ICH8M) */ |
244 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, | 245 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
246 | /* Mobile SATA Controller IDE (ICH8M), Apple */ | ||
247 | { 0x8086, 0x2828, 0x106b, 0x00a0, 0, 0, ich8m_apple_sata_ahci }, | ||
245 | /* SATA Controller IDE (ICH9) */ | 248 | /* SATA Controller IDE (ICH9) */ |
246 | { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, | 249 | { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
247 | /* SATA Controller IDE (ICH9) */ | 250 | /* SATA Controller IDE (ICH9) */ |
248 | { 0x8086, 0x2921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, | 251 | { 0x8086, 0x2921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
249 | /* SATA Controller IDE (ICH9) */ | 252 | /* SATA Controller IDE (ICH9) */ |
250 | { 0x8086, 0x2926, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, | 253 | { 0x8086, 0x2926, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
251 | /* SATA Controller IDE (ICH9M) */ | 254 | /* SATA Controller IDE (ICH9M) */ |
252 | { 0x8086, 0x2928, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, | 255 | { 0x8086, 0x2928, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
253 | /* SATA Controller IDE (ICH9M) */ | 256 | /* SATA Controller IDE (ICH9M) */ |
254 | { 0x8086, 0x292d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, | 257 | { 0x8086, 0x292d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
255 | /* SATA Controller IDE (ICH9M) */ | 258 | /* SATA Controller IDE (ICH9M) */ |
256 | { 0x8086, 0x292e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, | 259 | { 0x8086, 0x292e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
257 | /* SATA Controller IDE (Tolapai) */ | 260 | /* SATA Controller IDE (Tolapai) */ |
@@ -427,7 +430,7 @@ static const struct piix_map_db ich6m_map_db = { | |||
427 | 430 | ||
428 | static const struct piix_map_db ich8_map_db = { | 431 | static const struct piix_map_db ich8_map_db = { |
429 | .mask = 0x3, | 432 | .mask = 0x3, |
430 | .port_enable = 0x3, | 433 | .port_enable = 0xf, |
431 | .map = { | 434 | .map = { |
432 | /* PM PS SM SS MAP */ | 435 | /* PM PS SM SS MAP */ |
433 | { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */ | 436 | { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */ |
@@ -437,7 +440,7 @@ static const struct piix_map_db ich8_map_db = { | |||
437 | }, | 440 | }, |
438 | }; | 441 | }; |
439 | 442 | ||
440 | static const struct piix_map_db tolapai_map_db = { | 443 | static const struct piix_map_db ich8_2port_map_db = { |
441 | .mask = 0x3, | 444 | .mask = 0x3, |
442 | .port_enable = 0x3, | 445 | .port_enable = 0x3, |
443 | .map = { | 446 | .map = { |
@@ -449,7 +452,19 @@ static const struct piix_map_db tolapai_map_db = { | |||
449 | }, | 452 | }, |
450 | }; | 453 | }; |
451 | 454 | ||
452 | static const struct piix_map_db ich9_2port_map_db = { | 455 | static const struct piix_map_db ich8m_apple_map_db = { |
456 | .mask = 0x3, | ||
457 | .port_enable = 0x1, | ||
458 | .map = { | ||
459 | /* PM PS SM SS MAP */ | ||
460 | { P0, NA, NA, NA }, /* 00b */ | ||
461 | { RV, RV, RV, RV }, | ||
462 | { P0, P2, IDE, IDE }, /* 10b */ | ||
463 | { RV, RV, RV, RV }, | ||
464 | }, | ||
465 | }; | ||
466 | |||
467 | static const struct piix_map_db tolapai_map_db = { | ||
453 | .mask = 0x3, | 468 | .mask = 0x3, |
454 | .port_enable = 0x3, | 469 | .port_enable = 0x3, |
455 | .map = { | 470 | .map = { |
@@ -467,11 +482,21 @@ static const struct piix_map_db *piix_map_db_table[] = { | |||
467 | [ich6_sata_ahci] = &ich6_map_db, | 482 | [ich6_sata_ahci] = &ich6_map_db, |
468 | [ich6m_sata_ahci] = &ich6m_map_db, | 483 | [ich6m_sata_ahci] = &ich6m_map_db, |
469 | [ich8_sata_ahci] = &ich8_map_db, | 484 | [ich8_sata_ahci] = &ich8_map_db, |
485 | [ich8_2port_sata] = &ich8_2port_map_db, | ||
486 | [ich8m_apple_sata_ahci] = &ich8m_apple_map_db, | ||
470 | [tolapai_sata_ahci] = &tolapai_map_db, | 487 | [tolapai_sata_ahci] = &tolapai_map_db, |
471 | [ich9_2port_sata] = &ich9_2port_map_db, | ||
472 | }; | 488 | }; |
473 | 489 | ||
474 | static struct ata_port_info piix_port_info[] = { | 490 | static struct ata_port_info piix_port_info[] = { |
491 | [piix_pata_mwdma] = /* PIIX3 MWDMA only */ | ||
492 | { | ||
493 | .sht = &piix_sht, | ||
494 | .flags = PIIX_PATA_FLAGS, | ||
495 | .pio_mask = 0x1f, /* pio0-4 */ | ||
496 | .mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */ | ||
497 | .port_ops = &piix_pata_ops, | ||
498 | }, | ||
499 | |||
475 | [piix_pata_33] = /* PIIX4 at 33MHz */ | 500 | [piix_pata_33] = /* PIIX4 at 33MHz */ |
476 | { | 501 | { |
477 | .sht = &piix_sht, | 502 | .sht = &piix_sht, |
@@ -565,13 +590,15 @@ static struct ata_port_info piix_port_info[] = { | |||
565 | .port_ops = &piix_sata_ops, | 590 | .port_ops = &piix_sata_ops, |
566 | }, | 591 | }, |
567 | 592 | ||
568 | [piix_pata_mwdma] = /* PIIX3 MWDMA only */ | 593 | [ich8_2port_sata] = |
569 | { | 594 | { |
570 | .sht = &piix_sht, | 595 | .sht = &piix_sht, |
571 | .flags = PIIX_PATA_FLAGS, | 596 | .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR | |
597 | PIIX_FLAG_AHCI, | ||
572 | .pio_mask = 0x1f, /* pio0-4 */ | 598 | .pio_mask = 0x1f, /* pio0-4 */ |
573 | .mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */ | 599 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
574 | .port_ops = &piix_pata_ops, | 600 | .udma_mask = ATA_UDMA6, |
601 | .port_ops = &piix_sata_ops, | ||
575 | }, | 602 | }, |
576 | 603 | ||
577 | [tolapai_sata_ahci] = | 604 | [tolapai_sata_ahci] = |
@@ -585,7 +612,7 @@ static struct ata_port_info piix_port_info[] = { | |||
585 | .port_ops = &piix_sata_ops, | 612 | .port_ops = &piix_sata_ops, |
586 | }, | 613 | }, |
587 | 614 | ||
588 | [ich9_2port_sata] = | 615 | [ich8m_apple_sata_ahci] = |
589 | { | 616 | { |
590 | .sht = &piix_sht, | 617 | .sht = &piix_sht, |
591 | .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR | | 618 | .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR | |
@@ -595,6 +622,7 @@ static struct ata_port_info piix_port_info[] = { | |||
595 | .udma_mask = ATA_UDMA6, | 622 | .udma_mask = ATA_UDMA6, |
596 | .port_ops = &piix_sata_ops, | 623 | .port_ops = &piix_sata_ops, |
597 | }, | 624 | }, |
625 | |||
598 | }; | 626 | }; |
599 | 627 | ||
600 | static struct pci_bits piix_enable_bits[] = { | 628 | static struct pci_bits piix_enable_bits[] = { |
@@ -939,6 +967,20 @@ static int piix_broken_suspend(void) | |||
939 | }, | 967 | }, |
940 | }, | 968 | }, |
941 | { | 969 | { |
970 | .ident = "TECRA M3", | ||
971 | .matches = { | ||
972 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
973 | DMI_MATCH(DMI_PRODUCT_NAME, "Tecra M3"), | ||
974 | }, | ||
975 | }, | ||
976 | { | ||
977 | .ident = "TECRA M4", | ||
978 | .matches = { | ||
979 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
980 | DMI_MATCH(DMI_PRODUCT_NAME, "Tecra M4"), | ||
981 | }, | ||
982 | }, | ||
983 | { | ||
942 | .ident = "TECRA M5", | 984 | .ident = "TECRA M5", |
943 | .matches = { | 985 | .matches = { |
944 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 986 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
@@ -953,6 +995,20 @@ static int piix_broken_suspend(void) | |||
953 | }, | 995 | }, |
954 | }, | 996 | }, |
955 | { | 997 | { |
998 | .ident = "TECRA A8", | ||
999 | .matches = { | ||
1000 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
1001 | DMI_MATCH(DMI_PRODUCT_NAME, "TECRA A8"), | ||
1002 | }, | ||
1003 | }, | ||
1004 | { | ||
1005 | .ident = "Satellite R25", | ||
1006 | .matches = { | ||
1007 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
1008 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite R25"), | ||
1009 | }, | ||
1010 | }, | ||
1011 | { | ||
956 | .ident = "Satellite U200", | 1012 | .ident = "Satellite U200", |
957 | .matches = { | 1013 | .matches = { |
958 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 1014 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
@@ -960,6 +1016,13 @@ static int piix_broken_suspend(void) | |||
960 | }, | 1016 | }, |
961 | }, | 1017 | }, |
962 | { | 1018 | { |
1019 | .ident = "Satellite U200", | ||
1020 | .matches = { | ||
1021 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
1022 | DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE U200"), | ||
1023 | }, | ||
1024 | }, | ||
1025 | { | ||
963 | .ident = "Satellite Pro U200", | 1026 | .ident = "Satellite Pro U200", |
964 | .matches = { | 1027 | .matches = { |
965 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 1028 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
@@ -974,6 +1037,13 @@ static int piix_broken_suspend(void) | |||
974 | }, | 1037 | }, |
975 | }, | 1038 | }, |
976 | { | 1039 | { |
1040 | .ident = "SATELLITE U205", | ||
1041 | .matches = { | ||
1042 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
1043 | DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE U205"), | ||
1044 | }, | ||
1045 | }, | ||
1046 | { | ||
977 | .ident = "Portege M500", | 1047 | .ident = "Portege M500", |
978 | .matches = { | 1048 | .matches = { |
979 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 1049 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
@@ -1086,12 +1156,12 @@ static int piix_disable_ahci(struct pci_dev *pdev) | |||
1086 | if (!mmio) | 1156 | if (!mmio) |
1087 | return -ENOMEM; | 1157 | return -ENOMEM; |
1088 | 1158 | ||
1089 | tmp = readl(mmio + AHCI_GLOBAL_CTL); | 1159 | tmp = ioread32(mmio + AHCI_GLOBAL_CTL); |
1090 | if (tmp & AHCI_ENABLE) { | 1160 | if (tmp & AHCI_ENABLE) { |
1091 | tmp &= ~AHCI_ENABLE; | 1161 | tmp &= ~AHCI_ENABLE; |
1092 | writel(tmp, mmio + AHCI_GLOBAL_CTL); | 1162 | iowrite32(tmp, mmio + AHCI_GLOBAL_CTL); |
1093 | 1163 | ||
1094 | tmp = readl(mmio + AHCI_GLOBAL_CTL); | 1164 | tmp = ioread32(mmio + AHCI_GLOBAL_CTL); |
1095 | if (tmp & AHCI_ENABLE) | 1165 | if (tmp & AHCI_ENABLE) |
1096 | rc = -EIO; | 1166 | rc = -EIO; |
1097 | } | 1167 | } |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 81898036dbca..e4dea8623a71 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -30,6 +30,14 @@ | |||
30 | * Hardware documentation available from http://www.t13.org/ and | 30 | * Hardware documentation available from http://www.t13.org/ and |
31 | * http://www.sata-io.org/ | 31 | * http://www.sata-io.org/ |
32 | * | 32 | * |
33 | * Standards documents from: | ||
34 | * http://www.t13.org (ATA standards, PCI DMA IDE spec) | ||
35 | * http://www.t10.org (SCSI MMC - for ATAPI MMC) | ||
36 | * http://www.sata-io.org (SATA) | ||
37 | * http://www.compactflash.org (CF) | ||
38 | * http://www.qic.org (QIC157 - Tape and DSC) | ||
39 | * http://www.ce-ata.org (CE-ATA: not supported) | ||
40 | * | ||
33 | */ | 41 | */ |
34 | 42 | ||
35 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
@@ -2307,8 +2315,10 @@ int ata_dev_configure(struct ata_device *dev) | |||
2307 | } | 2315 | } |
2308 | 2316 | ||
2309 | if ((dev->class == ATA_DEV_ATAPI) && | 2317 | if ((dev->class == ATA_DEV_ATAPI) && |
2310 | (atapi_command_packet_set(id) == TYPE_TAPE)) | 2318 | (atapi_command_packet_set(id) == TYPE_TAPE)) { |
2311 | dev->max_sectors = ATA_MAX_SECTORS_TAPE; | 2319 | dev->max_sectors = ATA_MAX_SECTORS_TAPE; |
2320 | dev->horkage |= ATA_HORKAGE_STUCK_ERR; | ||
2321 | } | ||
2312 | 2322 | ||
2313 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) | 2323 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) |
2314 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, | 2324 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, |
@@ -2581,81 +2591,6 @@ void sata_print_link_status(struct ata_link *link) | |||
2581 | } | 2591 | } |
2582 | 2592 | ||
2583 | /** | 2593 | /** |
2584 | * __sata_phy_reset - Wake/reset a low-level SATA PHY | ||
2585 | * @ap: SATA port associated with target SATA PHY. | ||
2586 | * | ||
2587 | * This function issues commands to standard SATA Sxxx | ||
2588 | * PHY registers, to wake up the phy (and device), and | ||
2589 | * clear any reset condition. | ||
2590 | * | ||
2591 | * LOCKING: | ||
2592 | * PCI/etc. bus probe sem. | ||
2593 | * | ||
2594 | */ | ||
2595 | void __sata_phy_reset(struct ata_port *ap) | ||
2596 | { | ||
2597 | struct ata_link *link = &ap->link; | ||
2598 | unsigned long timeout = jiffies + (HZ * 5); | ||
2599 | u32 sstatus; | ||
2600 | |||
2601 | if (ap->flags & ATA_FLAG_SATA_RESET) { | ||
2602 | /* issue phy wake/reset */ | ||
2603 | sata_scr_write_flush(link, SCR_CONTROL, 0x301); | ||
2604 | /* Couldn't find anything in SATA I/II specs, but | ||
2605 | * AHCI-1.1 10.4.2 says at least 1 ms. */ | ||
2606 | mdelay(1); | ||
2607 | } | ||
2608 | /* phy wake/clear reset */ | ||
2609 | sata_scr_write_flush(link, SCR_CONTROL, 0x300); | ||
2610 | |||
2611 | /* wait for phy to become ready, if necessary */ | ||
2612 | do { | ||
2613 | msleep(200); | ||
2614 | sata_scr_read(link, SCR_STATUS, &sstatus); | ||
2615 | if ((sstatus & 0xf) != 1) | ||
2616 | break; | ||
2617 | } while (time_before(jiffies, timeout)); | ||
2618 | |||
2619 | /* print link status */ | ||
2620 | sata_print_link_status(link); | ||
2621 | |||
2622 | /* TODO: phy layer with polling, timeouts, etc. */ | ||
2623 | if (!ata_link_offline(link)) | ||
2624 | ata_port_probe(ap); | ||
2625 | else | ||
2626 | ata_port_disable(ap); | ||
2627 | |||
2628 | if (ap->flags & ATA_FLAG_DISABLED) | ||
2629 | return; | ||
2630 | |||
2631 | if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) { | ||
2632 | ata_port_disable(ap); | ||
2633 | return; | ||
2634 | } | ||
2635 | |||
2636 | ap->cbl = ATA_CBL_SATA; | ||
2637 | } | ||
2638 | |||
2639 | /** | ||
2640 | * sata_phy_reset - Reset SATA bus. | ||
2641 | * @ap: SATA port associated with target SATA PHY. | ||
2642 | * | ||
2643 | * This function resets the SATA bus, and then probes | ||
2644 | * the bus for devices. | ||
2645 | * | ||
2646 | * LOCKING: | ||
2647 | * PCI/etc. bus probe sem. | ||
2648 | * | ||
2649 | */ | ||
2650 | void sata_phy_reset(struct ata_port *ap) | ||
2651 | { | ||
2652 | __sata_phy_reset(ap); | ||
2653 | if (ap->flags & ATA_FLAG_DISABLED) | ||
2654 | return; | ||
2655 | ata_bus_reset(ap); | ||
2656 | } | ||
2657 | |||
2658 | /** | ||
2659 | * ata_dev_pair - return other device on cable | 2594 | * ata_dev_pair - return other device on cable |
2660 | * @adev: device | 2595 | * @adev: device |
2661 | * | 2596 | * |
@@ -4205,6 +4140,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4205 | /* Devices where NCQ should be avoided */ | 4140 | /* Devices where NCQ should be avoided */ |
4206 | /* NCQ is slow */ | 4141 | /* NCQ is slow */ |
4207 | { "WDC WD740ADFD-00", NULL, ATA_HORKAGE_NONCQ }, | 4142 | { "WDC WD740ADFD-00", NULL, ATA_HORKAGE_NONCQ }, |
4143 | { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, }, | ||
4208 | /* http://thread.gmane.org/gmane.linux.ide/14907 */ | 4144 | /* http://thread.gmane.org/gmane.linux.ide/14907 */ |
4209 | { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, | 4145 | { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, |
4210 | /* NCQ is broken */ | 4146 | /* NCQ is broken */ |
@@ -4219,23 +4155,6 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4219 | { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, }, | 4155 | { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, }, |
4220 | { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, }, | 4156 | { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, }, |
4221 | { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, }, | 4157 | { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, }, |
4222 | /* Drives which do spurious command completion */ | ||
4223 | { "HTS541680J9SA00", "SB2IC7EP", ATA_HORKAGE_NONCQ, }, | ||
4224 | { "HTS541612J9SA00", "SBDIC7JP", ATA_HORKAGE_NONCQ, }, | ||
4225 | { "HDT722516DLA380", "V43OA96A", ATA_HORKAGE_NONCQ, }, | ||
4226 | { "Hitachi HTS541616J9SA00", "SB4OC70P", ATA_HORKAGE_NONCQ, }, | ||
4227 | { "Hitachi HTS542525K9SA00", "BBFOC31P", ATA_HORKAGE_NONCQ, }, | ||
4228 | { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, }, | ||
4229 | { "WDC WD3200AAJS-00RYA0", "12.01B01", ATA_HORKAGE_NONCQ, }, | ||
4230 | { "FUJITSU MHV2080BH", "00840028", ATA_HORKAGE_NONCQ, }, | ||
4231 | { "ST9120822AS", "3.CLF", ATA_HORKAGE_NONCQ, }, | ||
4232 | { "ST9160821AS", "3.CLF", ATA_HORKAGE_NONCQ, }, | ||
4233 | { "ST9160821AS", "3.ALD", ATA_HORKAGE_NONCQ, }, | ||
4234 | { "ST9160821AS", "3.CCD", ATA_HORKAGE_NONCQ, }, | ||
4235 | { "ST3160812AS", "3.ADJ", ATA_HORKAGE_NONCQ, }, | ||
4236 | { "ST980813AS", "3.ADB", ATA_HORKAGE_NONCQ, }, | ||
4237 | { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, }, | ||
4238 | { "Maxtor 7V300F0", "VA111900", ATA_HORKAGE_NONCQ, }, | ||
4239 | 4158 | ||
4240 | /* devices which puke on READ_NATIVE_MAX */ | 4159 | /* devices which puke on READ_NATIVE_MAX */ |
4241 | { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, | 4160 | { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, |
@@ -4250,6 +4169,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4250 | /* Devices which get the IVB wrong */ | 4169 | /* Devices which get the IVB wrong */ |
4251 | { "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB, }, | 4170 | { "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB, }, |
4252 | { "TSSTcorp CDDVDW SH-S202J", "SB00", ATA_HORKAGE_IVB, }, | 4171 | { "TSSTcorp CDDVDW SH-S202J", "SB00", ATA_HORKAGE_IVB, }, |
4172 | { "TSSTcorp CDDVDW SH-S202J", "SB01", ATA_HORKAGE_IVB, }, | ||
4173 | { "TSSTcorp CDDVDW SH-S202N", "SB00", ATA_HORKAGE_IVB, }, | ||
4174 | { "TSSTcorp CDDVDW SH-S202N", "SB01", ATA_HORKAGE_IVB, }, | ||
4253 | 4175 | ||
4254 | /* End Marker */ | 4176 | /* End Marker */ |
4255 | { } | 4177 | { } |
@@ -5490,11 +5412,19 @@ fsm_start: | |||
5490 | * let the EH abort the command or reset the device. | 5412 | * let the EH abort the command or reset the device. |
5491 | */ | 5413 | */ |
5492 | if (unlikely(status & (ATA_ERR | ATA_DF))) { | 5414 | if (unlikely(status & (ATA_ERR | ATA_DF))) { |
5493 | ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device " | 5415 | /* Some ATAPI tape drives forget to clear the ERR bit |
5494 | "error, dev_stat 0x%X\n", status); | 5416 | * when doing the next command (mostly request sense). |
5495 | qc->err_mask |= AC_ERR_HSM; | 5417 | * We ignore ERR here to workaround and proceed sending |
5496 | ap->hsm_task_state = HSM_ST_ERR; | 5418 | * the CDB. |
5497 | goto fsm_start; | 5419 | */ |
5420 | if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) { | ||
5421 | ata_port_printk(ap, KERN_WARNING, | ||
5422 | "DRQ=1 with device error, " | ||
5423 | "dev_stat 0x%X\n", status); | ||
5424 | qc->err_mask |= AC_ERR_HSM; | ||
5425 | ap->hsm_task_state = HSM_ST_ERR; | ||
5426 | goto fsm_start; | ||
5427 | } | ||
5498 | } | 5428 | } |
5499 | 5429 | ||
5500 | /* Send the CDB (atapi) or the first data block (ata pio out). | 5430 | /* Send the CDB (atapi) or the first data block (ata pio out). |
@@ -7021,12 +6951,11 @@ int ata_host_start(struct ata_host *host) | |||
7021 | if (ap->ops->port_start) { | 6951 | if (ap->ops->port_start) { |
7022 | rc = ap->ops->port_start(ap); | 6952 | rc = ap->ops->port_start(ap); |
7023 | if (rc) { | 6953 | if (rc) { |
7024 | ata_port_printk(ap, KERN_ERR, "failed to " | 6954 | if (rc != -ENODEV) |
7025 | "start port (errno=%d)\n", rc); | 6955 | dev_printk(KERN_ERR, host->dev, "failed to start port %d (errno=%d)\n", i, rc); |
7026 | goto err_out; | 6956 | goto err_out; |
7027 | } | 6957 | } |
7028 | } | 6958 | } |
7029 | |||
7030 | ata_eh_freeze_port(ap); | 6959 | ata_eh_freeze_port(ap); |
7031 | } | 6960 | } |
7032 | 6961 | ||
@@ -7653,8 +7582,6 @@ EXPORT_SYMBOL_GPL(ata_dev_disable); | |||
7653 | EXPORT_SYMBOL_GPL(sata_set_spd); | 7582 | EXPORT_SYMBOL_GPL(sata_set_spd); |
7654 | EXPORT_SYMBOL_GPL(sata_link_debounce); | 7583 | EXPORT_SYMBOL_GPL(sata_link_debounce); |
7655 | EXPORT_SYMBOL_GPL(sata_link_resume); | 7584 | EXPORT_SYMBOL_GPL(sata_link_resume); |
7656 | EXPORT_SYMBOL_GPL(sata_phy_reset); | ||
7657 | EXPORT_SYMBOL_GPL(__sata_phy_reset); | ||
7658 | EXPORT_SYMBOL_GPL(ata_bus_reset); | 7585 | EXPORT_SYMBOL_GPL(ata_bus_reset); |
7659 | EXPORT_SYMBOL_GPL(ata_std_prereset); | 7586 | EXPORT_SYMBOL_GPL(ata_std_prereset); |
7660 | EXPORT_SYMBOL_GPL(ata_std_softreset); | 7587 | EXPORT_SYMBOL_GPL(ata_std_softreset); |
@@ -7725,7 +7652,6 @@ EXPORT_SYMBOL_GPL(ata_port_desc); | |||
7725 | #ifdef CONFIG_PCI | 7652 | #ifdef CONFIG_PCI |
7726 | EXPORT_SYMBOL_GPL(ata_port_pbar_desc); | 7653 | EXPORT_SYMBOL_GPL(ata_port_pbar_desc); |
7727 | #endif /* CONFIG_PCI */ | 7654 | #endif /* CONFIG_PCI */ |
7728 | EXPORT_SYMBOL_GPL(ata_eng_timeout); | ||
7729 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); | 7655 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); |
7730 | EXPORT_SYMBOL_GPL(ata_link_abort); | 7656 | EXPORT_SYMBOL_GPL(ata_link_abort); |
7731 | EXPORT_SYMBOL_GPL(ata_port_abort); | 7657 | EXPORT_SYMBOL_GPL(ata_port_abort); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index ed8813b222a0..e6605f038647 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -559,101 +559,6 @@ void ata_port_wait_eh(struct ata_port *ap) | |||
559 | } | 559 | } |
560 | } | 560 | } |
561 | 561 | ||
562 | /** | ||
563 | * ata_qc_timeout - Handle timeout of queued command | ||
564 | * @qc: Command that timed out | ||
565 | * | ||
566 | * Some part of the kernel (currently, only the SCSI layer) | ||
567 | * has noticed that the active command on port @ap has not | ||
568 | * completed after a specified length of time. Handle this | ||
569 | * condition by disabling DMA (if necessary) and completing | ||
570 | * transactions, with error if necessary. | ||
571 | * | ||
572 | * This also handles the case of the "lost interrupt", where | ||
573 | * for some reason (possibly hardware bug, possibly driver bug) | ||
574 | * an interrupt was not delivered to the driver, even though the | ||
575 | * transaction completed successfully. | ||
576 | * | ||
577 | * TODO: kill this function once old EH is gone. | ||
578 | * | ||
579 | * LOCKING: | ||
580 | * Inherited from SCSI layer (none, can sleep) | ||
581 | */ | ||
582 | static void ata_qc_timeout(struct ata_queued_cmd *qc) | ||
583 | { | ||
584 | struct ata_port *ap = qc->ap; | ||
585 | u8 host_stat = 0, drv_stat; | ||
586 | unsigned long flags; | ||
587 | |||
588 | DPRINTK("ENTER\n"); | ||
589 | |||
590 | ap->hsm_task_state = HSM_ST_IDLE; | ||
591 | |||
592 | spin_lock_irqsave(ap->lock, flags); | ||
593 | |||
594 | switch (qc->tf.protocol) { | ||
595 | |||
596 | case ATA_PROT_DMA: | ||
597 | case ATA_PROT_ATAPI_DMA: | ||
598 | host_stat = ap->ops->bmdma_status(ap); | ||
599 | |||
600 | /* before we do anything else, clear DMA-Start bit */ | ||
601 | ap->ops->bmdma_stop(qc); | ||
602 | |||
603 | /* fall through */ | ||
604 | |||
605 | default: | ||
606 | ata_altstatus(ap); | ||
607 | drv_stat = ata_chk_status(ap); | ||
608 | |||
609 | /* ack bmdma irq events */ | ||
610 | ap->ops->irq_clear(ap); | ||
611 | |||
612 | ata_dev_printk(qc->dev, KERN_ERR, "command 0x%x timeout, " | ||
613 | "stat 0x%x host_stat 0x%x\n", | ||
614 | qc->tf.command, drv_stat, host_stat); | ||
615 | |||
616 | /* complete taskfile transaction */ | ||
617 | qc->err_mask |= AC_ERR_TIMEOUT; | ||
618 | break; | ||
619 | } | ||
620 | |||
621 | spin_unlock_irqrestore(ap->lock, flags); | ||
622 | |||
623 | ata_eh_qc_complete(qc); | ||
624 | |||
625 | DPRINTK("EXIT\n"); | ||
626 | } | ||
627 | |||
628 | /** | ||
629 | * ata_eng_timeout - Handle timeout of queued command | ||
630 | * @ap: Port on which timed-out command is active | ||
631 | * | ||
632 | * Some part of the kernel (currently, only the SCSI layer) | ||
633 | * has noticed that the active command on port @ap has not | ||
634 | * completed after a specified length of time. Handle this | ||
635 | * condition by disabling DMA (if necessary) and completing | ||
636 | * transactions, with error if necessary. | ||
637 | * | ||
638 | * This also handles the case of the "lost interrupt", where | ||
639 | * for some reason (possibly hardware bug, possibly driver bug) | ||
640 | * an interrupt was not delivered to the driver, even though the | ||
641 | * transaction completed successfully. | ||
642 | * | ||
643 | * TODO: kill this function once old EH is gone. | ||
644 | * | ||
645 | * LOCKING: | ||
646 | * Inherited from SCSI layer (none, can sleep) | ||
647 | */ | ||
648 | void ata_eng_timeout(struct ata_port *ap) | ||
649 | { | ||
650 | DPRINTK("ENTER\n"); | ||
651 | |||
652 | ata_qc_timeout(ata_qc_from_tag(ap, ap->link.active_tag)); | ||
653 | |||
654 | DPRINTK("EXIT\n"); | ||
655 | } | ||
656 | |||
657 | static int ata_eh_nr_in_flight(struct ata_port *ap) | 562 | static int ata_eh_nr_in_flight(struct ata_port *ap) |
658 | { | 563 | { |
659 | unsigned int tag; | 564 | unsigned int tag; |
@@ -1945,30 +1850,54 @@ static void ata_eh_link_report(struct ata_link *link) | |||
1945 | ehc->i.serror & SERR_DEV_XCHG ? "DevExch " : ""); | 1850 | ehc->i.serror & SERR_DEV_XCHG ? "DevExch " : ""); |
1946 | 1851 | ||
1947 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { | 1852 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { |
1948 | static const char *dma_str[] = { | ||
1949 | [DMA_BIDIRECTIONAL] = "bidi", | ||
1950 | [DMA_TO_DEVICE] = "out", | ||
1951 | [DMA_FROM_DEVICE] = "in", | ||
1952 | [DMA_NONE] = "", | ||
1953 | }; | ||
1954 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); | 1853 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); |
1955 | struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; | 1854 | struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; |
1855 | const u8 *cdb = qc->cdb; | ||
1856 | char data_buf[20] = ""; | ||
1857 | char cdb_buf[70] = ""; | ||
1956 | 1858 | ||
1957 | if (!(qc->flags & ATA_QCFLAG_FAILED) || | 1859 | if (!(qc->flags & ATA_QCFLAG_FAILED) || |
1958 | qc->dev->link != link || !qc->err_mask) | 1860 | qc->dev->link != link || !qc->err_mask) |
1959 | continue; | 1861 | continue; |
1960 | 1862 | ||
1863 | if (qc->dma_dir != DMA_NONE) { | ||
1864 | static const char *dma_str[] = { | ||
1865 | [DMA_BIDIRECTIONAL] = "bidi", | ||
1866 | [DMA_TO_DEVICE] = "out", | ||
1867 | [DMA_FROM_DEVICE] = "in", | ||
1868 | }; | ||
1869 | static const char *prot_str[] = { | ||
1870 | [ATA_PROT_PIO] = "pio", | ||
1871 | [ATA_PROT_DMA] = "dma", | ||
1872 | [ATA_PROT_NCQ] = "ncq", | ||
1873 | [ATA_PROT_ATAPI] = "pio", | ||
1874 | [ATA_PROT_ATAPI_DMA] = "dma", | ||
1875 | }; | ||
1876 | |||
1877 | snprintf(data_buf, sizeof(data_buf), " %s %u %s", | ||
1878 | prot_str[qc->tf.protocol], qc->nbytes, | ||
1879 | dma_str[qc->dma_dir]); | ||
1880 | } | ||
1881 | |||
1882 | if (is_atapi_taskfile(&qc->tf)) | ||
1883 | snprintf(cdb_buf, sizeof(cdb_buf), | ||
1884 | "cdb %02x %02x %02x %02x %02x %02x %02x %02x " | ||
1885 | "%02x %02x %02x %02x %02x %02x %02x %02x\n ", | ||
1886 | cdb[0], cdb[1], cdb[2], cdb[3], | ||
1887 | cdb[4], cdb[5], cdb[6], cdb[7], | ||
1888 | cdb[8], cdb[9], cdb[10], cdb[11], | ||
1889 | cdb[12], cdb[13], cdb[14], cdb[15]); | ||
1890 | |||
1961 | ata_dev_printk(qc->dev, KERN_ERR, | 1891 | ata_dev_printk(qc->dev, KERN_ERR, |
1962 | "cmd %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x " | 1892 | "cmd %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x " |
1963 | "tag %d cdb 0x%x data %u %s\n " | 1893 | "tag %d%s\n %s" |
1964 | "res %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x " | 1894 | "res %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x " |
1965 | "Emask 0x%x (%s)%s\n", | 1895 | "Emask 0x%x (%s)%s\n", |
1966 | cmd->command, cmd->feature, cmd->nsect, | 1896 | cmd->command, cmd->feature, cmd->nsect, |
1967 | cmd->lbal, cmd->lbam, cmd->lbah, | 1897 | cmd->lbal, cmd->lbam, cmd->lbah, |
1968 | cmd->hob_feature, cmd->hob_nsect, | 1898 | cmd->hob_feature, cmd->hob_nsect, |
1969 | cmd->hob_lbal, cmd->hob_lbam, cmd->hob_lbah, | 1899 | cmd->hob_lbal, cmd->hob_lbam, cmd->hob_lbah, |
1970 | cmd->device, qc->tag, qc->cdb[0], qc->nbytes, | 1900 | cmd->device, qc->tag, data_buf, cdb_buf, |
1971 | dma_str[qc->dma_dir], | ||
1972 | res->command, res->feature, res->nsect, | 1901 | res->command, res->feature, res->nsect, |
1973 | res->lbal, res->lbam, res->lbah, | 1902 | res->lbal, res->lbam, res->lbah, |
1974 | res->hob_feature, res->hob_nsect, | 1903 | res->hob_feature, res->hob_nsect, |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 94144ed50a6b..a883bb03d4c7 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -2485,11 +2485,40 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
2485 | if (!using_pio && ata_check_atapi_dma(qc)) | 2485 | if (!using_pio && ata_check_atapi_dma(qc)) |
2486 | using_pio = 1; | 2486 | using_pio = 1; |
2487 | 2487 | ||
2488 | /* Some controller variants snoop this value for Packet transfers | 2488 | /* Some controller variants snoop this value for Packet |
2489 | to do state machine and FIFO management. Thus we want to set it | 2489 | * transfers to do state machine and FIFO management. Thus we |
2490 | properly, and for DMA where it is effectively meaningless */ | 2490 | * want to set it properly, and for DMA where it is |
2491 | * effectively meaningless. | ||
2492 | */ | ||
2491 | nbytes = min(qc->nbytes, (unsigned int)63 * 1024); | 2493 | nbytes = min(qc->nbytes, (unsigned int)63 * 1024); |
2492 | 2494 | ||
2495 | /* Most ATAPI devices which honor transfer chunk size don't | ||
2496 | * behave according to the spec when odd chunk size which | ||
2497 | * matches the transfer length is specified. If the number of | ||
2498 | * bytes to transfer is 2n+1. According to the spec, what | ||
2499 | * should happen is to indicate that 2n+1 is going to be | ||
2500 | * transferred and transfer 2n+2 bytes where the last byte is | ||
2501 | * padding. | ||
2502 | * | ||
2503 | * In practice, this doesn't happen. ATAPI devices first | ||
2504 | * indicate and transfer 2n bytes and then indicate and | ||
2505 | * transfer 2 bytes where the last byte is padding. | ||
2506 | * | ||
2507 | * This inconsistency confuses several controllers which | ||
2508 | * perform PIO using DMA such as Intel AHCIs and sil3124/32. | ||
2509 | * These controllers use actual number of transferred bytes to | ||
2510 | * update DMA poitner and transfer of 4n+2 bytes make those | ||
2511 | * controller push DMA pointer by 4n+4 bytes because SATA data | ||
2512 | * FISes are aligned to 4 bytes. This causes data corruption | ||
2513 | * and buffer overrun. | ||
2514 | * | ||
2515 | * Always setting nbytes to even number solves this problem | ||
2516 | * because then ATAPI devices don't have to split data at 2n | ||
2517 | * boundaries. | ||
2518 | */ | ||
2519 | if (nbytes & 0x1) | ||
2520 | nbytes++; | ||
2521 | |||
2493 | qc->tf.lbam = (nbytes & 0xFF); | 2522 | qc->tf.lbam = (nbytes & 0xFF); |
2494 | qc->tf.lbah = (nbytes >> 8); | 2523 | qc->tf.lbah = (nbytes >> 8); |
2495 | 2524 | ||
@@ -2869,7 +2898,8 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, | |||
2869 | xlat_func = NULL; | 2898 | xlat_func = NULL; |
2870 | if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { | 2899 | if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { |
2871 | /* relay SCSI command to ATAPI device */ | 2900 | /* relay SCSI command to ATAPI device */ |
2872 | if (unlikely(scmd->cmd_len > dev->cdb_len)) | 2901 | int len = COMMAND_SIZE(scsi_op); |
2902 | if (unlikely(len > scmd->cmd_len || len > dev->cdb_len)) | ||
2873 | goto bad_cdb_len; | 2903 | goto bad_cdb_len; |
2874 | 2904 | ||
2875 | xlat_func = atapi_xlat; | 2905 | xlat_func = atapi_xlat; |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index 364534e7aff4..8caf9afc8b90 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -63,6 +63,9 @@ static int ali_cable_override(struct pci_dev *pdev) | |||
63 | /* Fujitsu P2000 */ | 63 | /* Fujitsu P2000 */ |
64 | if (pdev->subsystem_vendor == 0x10CF && pdev->subsystem_device == 0x10AF) | 64 | if (pdev->subsystem_vendor == 0x10CF && pdev->subsystem_device == 0x10AF) |
65 | return 1; | 65 | return 1; |
66 | /* Mitac 8317 (Winbook-A) and relatives */ | ||
67 | if (pdev->subsystem_vendor == 0x1071 && pdev->subsystem_device == 0x8317) | ||
68 | return 1; | ||
66 | /* Systems by DMI */ | 69 | /* Systems by DMI */ |
67 | if (dmi_check_system(cable_dmi_table)) | 70 | if (dmi_check_system(cable_dmi_table)) |
68 | return 1; | 71 | return 1; |
@@ -282,6 +285,21 @@ static void ali_lock_sectors(struct ata_device *adev) | |||
282 | adev->max_sectors = 255; | 285 | adev->max_sectors = 255; |
283 | } | 286 | } |
284 | 287 | ||
288 | /** | ||
289 | * ali_check_atapi_dma - DMA check for most ALi controllers | ||
290 | * @adev: Device | ||
291 | * | ||
292 | * Called to decide whether commands should be sent by DMA or PIO | ||
293 | */ | ||
294 | |||
295 | static int ali_check_atapi_dma(struct ata_queued_cmd *qc) | ||
296 | { | ||
297 | /* If its not a media command, its not worth it */ | ||
298 | if (qc->nbytes < 2048) | ||
299 | return -EOPNOTSUPP; | ||
300 | return 0; | ||
301 | } | ||
302 | |||
285 | static struct scsi_host_template ali_sht = { | 303 | static struct scsi_host_template ali_sht = { |
286 | .module = THIS_MODULE, | 304 | .module = THIS_MODULE, |
287 | .name = DRV_NAME, | 305 | .name = DRV_NAME, |
@@ -378,6 +396,7 @@ static struct ata_port_operations ali_c2_port_ops = { | |||
378 | .mode_filter = ata_pci_default_filter, | 396 | .mode_filter = ata_pci_default_filter, |
379 | .tf_load = ata_tf_load, | 397 | .tf_load = ata_tf_load, |
380 | .tf_read = ata_tf_read, | 398 | .tf_read = ata_tf_read, |
399 | .check_atapi_dma = ali_check_atapi_dma, | ||
381 | .check_status = ata_check_status, | 400 | .check_status = ata_check_status, |
382 | .exec_command = ata_exec_command, | 401 | .exec_command = ata_exec_command, |
383 | .dev_select = ata_std_dev_select, | 402 | .dev_select = ata_std_dev_select, |
@@ -415,6 +434,7 @@ static struct ata_port_operations ali_c5_port_ops = { | |||
415 | .mode_filter = ata_pci_default_filter, | 434 | .mode_filter = ata_pci_default_filter, |
416 | .tf_load = ata_tf_load, | 435 | .tf_load = ata_tf_load, |
417 | .tf_read = ata_tf_read, | 436 | .tf_read = ata_tf_read, |
437 | .check_atapi_dma = ali_check_atapi_dma, | ||
418 | .check_status = ata_check_status, | 438 | .check_status = ata_check_status, |
419 | .exec_command = ata_exec_command, | 439 | .exec_command = ata_exec_command, |
420 | .dev_select = ata_std_dev_select, | 440 | .dev_select = ata_std_dev_select, |
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index c5779ad4abca..3cc27b514654 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/libata.h> | 25 | #include <linux/libata.h> |
26 | 26 | ||
27 | #define DRV_NAME "pata_amd" | 27 | #define DRV_NAME "pata_amd" |
28 | #define DRV_VERSION "0.3.9" | 28 | #define DRV_VERSION "0.3.10" |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * timing_setup - shared timing computation and load | 31 | * timing_setup - shared timing computation and load |
@@ -115,7 +115,8 @@ static void timing_setup(struct ata_port *ap, struct ata_device *adev, int offse | |||
115 | } | 115 | } |
116 | 116 | ||
117 | /* UDMA timing */ | 117 | /* UDMA timing */ |
118 | pci_write_config_byte(pdev, offset + 0x10 + (3 - dn), t); | 118 | if (at.udma) |
119 | pci_write_config_byte(pdev, offset + 0x10 + (3 - dn), t); | ||
119 | } | 120 | } |
120 | 121 | ||
121 | /** | 122 | /** |
diff --git a/drivers/ata/pata_at32.c b/drivers/ata/pata_at32.c index bb250a48e27c..67e574de31e8 100644 --- a/drivers/ata/pata_at32.c +++ b/drivers/ata/pata_at32.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <asm/arch/smc.h> | 28 | #include <asm/arch/smc.h> |
29 | 29 | ||
30 | #define DRV_NAME "pata_at32" | 30 | #define DRV_NAME "pata_at32" |
31 | #define DRV_VERSION "0.0.2" | 31 | #define DRV_VERSION "0.0.3" |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * CompactFlash controller memory layout relative to the base address: | 34 | * CompactFlash controller memory layout relative to the base address: |
@@ -64,6 +64,8 @@ | |||
64 | * Mode 2 | 8.3 | 240 ns | 0x07 | 64 | * Mode 2 | 8.3 | 240 ns | 0x07 |
65 | * Mode 3 | 11.1 | 180 ns | 0x0f | 65 | * Mode 3 | 11.1 | 180 ns | 0x0f |
66 | * Mode 4 | 16.7 | 120 ns | 0x1f | 66 | * Mode 4 | 16.7 | 120 ns | 0x1f |
67 | * | ||
68 | * Alter PIO_MASK below according to table to set maximal PIO mode. | ||
67 | */ | 69 | */ |
68 | #define PIO_MASK (0x1f) | 70 | #define PIO_MASK (0x1f) |
69 | 71 | ||
@@ -85,36 +87,40 @@ struct at32_ide_info { | |||
85 | */ | 87 | */ |
86 | static int pata_at32_setup_timing(struct device *dev, | 88 | static int pata_at32_setup_timing(struct device *dev, |
87 | struct at32_ide_info *info, | 89 | struct at32_ide_info *info, |
88 | const struct ata_timing *timing) | 90 | const struct ata_timing *ata) |
89 | { | 91 | { |
90 | /* These two values are found through testing */ | ||
91 | const int min_recover = 25; | ||
92 | const int ncs_hold = 15; | ||
93 | |||
94 | struct smc_config *smc = &info->smc; | 92 | struct smc_config *smc = &info->smc; |
93 | struct smc_timing timing; | ||
95 | 94 | ||
96 | int active; | 95 | int active; |
97 | int recover; | 96 | int recover; |
98 | 97 | ||
98 | memset(&timing, 0, sizeof(struct smc_timing)); | ||
99 | |||
99 | /* Total cycle time */ | 100 | /* Total cycle time */ |
100 | smc->read_cycle = timing->cyc8b; | 101 | timing.read_cycle = ata->cyc8b; |
101 | 102 | ||
102 | /* DIOR <= CFIOR timings */ | 103 | /* DIOR <= CFIOR timings */ |
103 | smc->nrd_setup = timing->setup; | 104 | timing.nrd_setup = ata->setup; |
104 | smc->nrd_pulse = timing->act8b; | 105 | timing.nrd_pulse = ata->act8b; |
106 | timing.nrd_recover = ata->rec8b; | ||
107 | |||
108 | /* Convert nanosecond timing to clock cycles */ | ||
109 | smc_set_timing(smc, &timing); | ||
105 | 110 | ||
106 | /* Compute recover, extend total cycle if needed */ | 111 | /* Add one extra cycle setup due to signal ring */ |
107 | active = smc->nrd_setup + smc->nrd_pulse; | 112 | smc->nrd_setup = smc->nrd_setup + 1; |
113 | |||
114 | active = smc->nrd_setup + smc->nrd_pulse; | ||
108 | recover = smc->read_cycle - active; | 115 | recover = smc->read_cycle - active; |
109 | 116 | ||
110 | if (recover < min_recover) { | 117 | /* Need at least two cycles recovery */ |
111 | smc->read_cycle = active + min_recover; | 118 | if (recover < 2) |
112 | recover = min_recover; | 119 | smc->read_cycle = active + 2; |
113 | } | ||
114 | 120 | ||
115 | /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */ | 121 | /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */ |
116 | smc->ncs_read_setup = 0; | 122 | smc->ncs_read_setup = 1; |
117 | smc->ncs_read_pulse = active + ncs_hold; | 123 | smc->ncs_read_pulse = smc->read_cycle - 2; |
118 | 124 | ||
119 | /* Write timings same as read timings */ | 125 | /* Write timings same as read timings */ |
120 | smc->write_cycle = smc->read_cycle; | 126 | smc->write_cycle = smc->read_cycle; |
@@ -123,11 +129,13 @@ static int pata_at32_setup_timing(struct device *dev, | |||
123 | smc->ncs_write_setup = smc->ncs_read_setup; | 129 | smc->ncs_write_setup = smc->ncs_read_setup; |
124 | smc->ncs_write_pulse = smc->ncs_read_pulse; | 130 | smc->ncs_write_pulse = smc->ncs_read_pulse; |
125 | 131 | ||
126 | /* Do some debugging output */ | 132 | /* Do some debugging output of ATA and SMC timings */ |
127 | dev_dbg(dev, "SMC: C=%d S=%d P=%d R=%d NCSS=%d NCSP=%d NCSR=%d\n", | 133 | dev_dbg(dev, "ATA: C=%d S=%d P=%d R=%d\n", |
134 | ata->cyc8b, ata->setup, ata->act8b, ata->rec8b); | ||
135 | |||
136 | dev_dbg(dev, "SMC: C=%d S=%d P=%d NS=%d NP=%d\n", | ||
128 | smc->read_cycle, smc->nrd_setup, smc->nrd_pulse, | 137 | smc->read_cycle, smc->nrd_setup, smc->nrd_pulse, |
129 | recover, smc->ncs_read_setup, smc->ncs_read_pulse, | 138 | smc->ncs_read_setup, smc->ncs_read_pulse); |
130 | smc->read_cycle - smc->ncs_read_pulse); | ||
131 | 139 | ||
132 | /* Finally, configure the SMC */ | 140 | /* Finally, configure the SMC */ |
133 | return smc_set_configuration(info->cs, smc); | 141 | return smc_set_configuration(info->cs, smc); |
@@ -182,7 +190,6 @@ static struct scsi_host_template at32_sht = { | |||
182 | }; | 190 | }; |
183 | 191 | ||
184 | static struct ata_port_operations at32_port_ops = { | 192 | static struct ata_port_operations at32_port_ops = { |
185 | .port_disable = ata_port_disable, | ||
186 | .set_piomode = pata_at32_set_piomode, | 193 | .set_piomode = pata_at32_set_piomode, |
187 | .tf_load = ata_tf_load, | 194 | .tf_load = ata_tf_load, |
188 | .tf_read = ata_tf_read, | 195 | .tf_read = ata_tf_read, |
@@ -203,7 +210,6 @@ static struct ata_port_operations at32_port_ops = { | |||
203 | 210 | ||
204 | .irq_clear = pata_at32_irq_clear, | 211 | .irq_clear = pata_at32_irq_clear, |
205 | .irq_on = ata_irq_on, | 212 | .irq_on = ata_irq_on, |
206 | .irq_ack = ata_irq_ack, | ||
207 | 213 | ||
208 | .port_start = ata_sff_port_start, | 214 | .port_start = ata_sff_port_start, |
209 | }; | 215 | }; |
@@ -223,8 +229,7 @@ static int __init pata_at32_init_one(struct device *dev, | |||
223 | /* Setup ATA bindings */ | 229 | /* Setup ATA bindings */ |
224 | ap->ops = &at32_port_ops; | 230 | ap->ops = &at32_port_ops; |
225 | ap->pio_mask = PIO_MASK; | 231 | ap->pio_mask = PIO_MASK; |
226 | ap->flags = ATA_FLAG_MMIO | ATA_FLAG_SLAVE_POSS | 232 | ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_SLAVE_POSS; |
227 | | ATA_FLAG_PIO_POLLING; | ||
228 | 233 | ||
229 | /* | 234 | /* |
230 | * Since all 8-bit taskfile transfers has to go on the lower | 235 | * Since all 8-bit taskfile transfers has to go on the lower |
@@ -357,12 +362,12 @@ static int __init pata_at32_probe(struct platform_device *pdev) | |||
357 | info->smc.tdf_mode = 0; /* TDF optimization disabled */ | 362 | info->smc.tdf_mode = 0; /* TDF optimization disabled */ |
358 | info->smc.tdf_cycles = 0; /* No TDF wait cycles */ | 363 | info->smc.tdf_cycles = 0; /* No TDF wait cycles */ |
359 | 364 | ||
360 | /* Setup ATA timing */ | 365 | /* Setup SMC to ATA timing */ |
361 | ret = pata_at32_setup_timing(dev, info, &initial_timing); | 366 | ret = pata_at32_setup_timing(dev, info, &initial_timing); |
362 | if (ret) | 367 | if (ret) |
363 | goto err_setup_timing; | 368 | goto err_setup_timing; |
364 | 369 | ||
365 | /* Setup ATA addresses */ | 370 | /* Map ATA address space */ |
366 | ret = -ENOMEM; | 371 | ret = -ENOMEM; |
367 | info->ide_addr = devm_ioremap(dev, info->res_ide.start, 16); | 372 | info->ide_addr = devm_ioremap(dev, info->res_ide.start, 16); |
368 | info->alt_addr = devm_ioremap(dev, info->res_alt.start, 16); | 373 | info->alt_addr = devm_ioremap(dev, info->res_alt.start, 16); |
@@ -373,7 +378,7 @@ static int __init pata_at32_probe(struct platform_device *pdev) | |||
373 | pata_at32_debug_bus(dev, info); | 378 | pata_at32_debug_bus(dev, info); |
374 | #endif | 379 | #endif |
375 | 380 | ||
376 | /* Register ATA device */ | 381 | /* Setup and register ATA device */ |
377 | ret = pata_at32_init_one(dev, info); | 382 | ret = pata_at32_init_one(dev, info); |
378 | if (ret) | 383 | if (ret) |
379 | goto err_ata_device; | 384 | goto err_ata_device; |
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index b5e38426b815..088a41f4e656 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -1145,13 +1145,13 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap) | |||
1145 | unsigned short int_status = ATAPI_GET_INT_STATUS(base); | 1145 | unsigned short int_status = ATAPI_GET_INT_STATUS(base); |
1146 | 1146 | ||
1147 | if (ATAPI_GET_STATUS(base) & (MULTI_XFER_ON|ULTRA_XFER_ON)) { | 1147 | if (ATAPI_GET_STATUS(base) & (MULTI_XFER_ON|ULTRA_XFER_ON)) { |
1148 | host_stat = ATA_DMA_ACTIVE; | 1148 | host_stat |= ATA_DMA_ACTIVE; |
1149 | } | 1149 | } |
1150 | if (int_status & (MULTI_DONE_INT|UDMAIN_DONE_INT|UDMAOUT_DONE_INT)) { | 1150 | if (int_status & (MULTI_DONE_INT|UDMAIN_DONE_INT|UDMAOUT_DONE_INT)) { |
1151 | host_stat = ATA_DMA_INTR; | 1151 | host_stat |= ATA_DMA_INTR; |
1152 | } | 1152 | } |
1153 | if (int_status & (MULTI_TERM_INT|UDMAIN_TERM_INT|UDMAOUT_TERM_INT)) { | 1153 | if (int_status & (MULTI_TERM_INT|UDMAIN_TERM_INT|UDMAOUT_TERM_INT)) { |
1154 | host_stat = ATA_DMA_ERR; | 1154 | host_stat |= ATA_DMA_ERR; |
1155 | } | 1155 | } |
1156 | 1156 | ||
1157 | return host_stat; | 1157 | return host_stat; |
@@ -1489,6 +1489,8 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev) | |||
1489 | int board_idx = 0; | 1489 | int board_idx = 0; |
1490 | struct resource *res; | 1490 | struct resource *res; |
1491 | struct ata_host *host; | 1491 | struct ata_host *host; |
1492 | unsigned int fsclk = get_sclk(); | ||
1493 | int udma_mode = 5; | ||
1492 | const struct ata_port_info *ppi[] = | 1494 | const struct ata_port_info *ppi[] = |
1493 | { &bfin_port_info[board_idx], NULL }; | 1495 | { &bfin_port_info[board_idx], NULL }; |
1494 | 1496 | ||
@@ -1507,6 +1509,11 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev) | |||
1507 | if (res == NULL) | 1509 | if (res == NULL) |
1508 | return -EINVAL; | 1510 | return -EINVAL; |
1509 | 1511 | ||
1512 | while (bfin_port_info[board_idx].udma_mask>0 && udma_fsclk[udma_mode] > fsclk) { | ||
1513 | udma_mode--; | ||
1514 | bfin_port_info[board_idx].udma_mask >>= 1; | ||
1515 | } | ||
1516 | |||
1510 | /* | 1517 | /* |
1511 | * Now that that's out of the way, wire up the port.. | 1518 | * Now that that's out of the way, wire up the port.. |
1512 | */ | 1519 | */ |
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 3816b8605e0d..46dc70e0dee7 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -329,7 +329,7 @@ static int hpt37x_pre_reset(struct ata_link *link, unsigned long deadline) | |||
329 | /* Restore state */ | 329 | /* Restore state */ |
330 | pci_write_config_byte(pdev, 0x5B, scr2); | 330 | pci_write_config_byte(pdev, 0x5B, scr2); |
331 | 331 | ||
332 | if (ata66 & (1 << ap->port_no)) | 332 | if (ata66 & (2 >> ap->port_no)) |
333 | ap->cbl = ATA_CBL_PATA40; | 333 | ap->cbl = ATA_CBL_PATA40; |
334 | else | 334 | else |
335 | ap->cbl = ATA_CBL_PATA80; | 335 | ap->cbl = ATA_CBL_PATA80; |
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c index 88ab0e1d353f..4320e7986321 100644 --- a/drivers/ata/pata_isapnp.c +++ b/drivers/ata/pata_isapnp.c | |||
@@ -75,13 +75,16 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev | |||
75 | struct ata_host *host; | 75 | struct ata_host *host; |
76 | struct ata_port *ap; | 76 | struct ata_port *ap; |
77 | void __iomem *cmd_addr, *ctl_addr; | 77 | void __iomem *cmd_addr, *ctl_addr; |
78 | int irq = 0; | ||
79 | irq_handler_t handler = NULL; | ||
78 | 80 | ||
79 | if (pnp_port_valid(idev, 0) == 0) | 81 | if (pnp_port_valid(idev, 0) == 0) |
80 | return -ENODEV; | 82 | return -ENODEV; |
81 | 83 | ||
82 | /* FIXME: Should selected polled PIO here not fail */ | 84 | if (pnp_irq_valid(idev, 0)) { |
83 | if (pnp_irq_valid(idev, 0) == 0) | 85 | irq = pnp_irq(idev, 0); |
84 | return -ENODEV; | 86 | handler = ata_interrupt; |
87 | } | ||
85 | 88 | ||
86 | /* allocate host */ | 89 | /* allocate host */ |
87 | host = ata_host_alloc(&idev->dev, 1); | 90 | host = ata_host_alloc(&idev->dev, 1); |
@@ -115,7 +118,7 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev | |||
115 | (unsigned long long)pnp_port_start(idev, 1)); | 118 | (unsigned long long)pnp_port_start(idev, 1)); |
116 | 119 | ||
117 | /* activate */ | 120 | /* activate */ |
118 | return ata_host_activate(host, pnp_irq(idev, 0), ata_interrupt, 0, | 121 | return ata_host_activate(host, irq, handler, 0, |
119 | &isapnp_sht); | 122 | &isapnp_sht); |
120 | } | 123 | } |
121 | 124 | ||
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 225a7223a726..5b8174d94067 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -80,11 +80,10 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline) | |||
80 | * actually do our cable checking etc. Thankfully we don't need | 80 | * actually do our cable checking etc. Thankfully we don't need |
81 | * to do the plumbing for other cases. | 81 | * to do the plumbing for other cases. |
82 | */ | 82 | */ |
83 | switch (port_map[port]) | 83 | switch (port_map[port]) { |
84 | { | ||
85 | case PORT_PATA0: | 84 | case PORT_PATA0: |
86 | if (control & (1 << 5)) | 85 | if ((control & (1 << 5)) == 0) |
87 | return 0; | 86 | return -ENOENT; |
88 | if (control & (1 << 3)) /* 40/80 pin primary */ | 87 | if (control & (1 << 3)) /* 40/80 pin primary */ |
89 | ap->cbl = ATA_CBL_PATA40; | 88 | ap->cbl = ATA_CBL_PATA40; |
90 | else | 89 | else |
@@ -93,7 +92,7 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline) | |||
93 | case PORT_PATA1: | 92 | case PORT_PATA1: |
94 | /* Bit 21 is set if the port is enabled */ | 93 | /* Bit 21 is set if the port is enabled */ |
95 | if ((control5 & (1 << 21)) == 0) | 94 | if ((control5 & (1 << 21)) == 0) |
96 | return 0; | 95 | return -ENOENT; |
97 | if (control5 & (1 << 19)) /* 40/80 pin secondary */ | 96 | if (control5 & (1 << 19)) /* 40/80 pin secondary */ |
98 | ap->cbl = ATA_CBL_PATA40; | 97 | ap->cbl = ATA_CBL_PATA40; |
99 | else | 98 | else |
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index 5c1e9cb59ecb..503245a1eafa 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/libata.h> | 33 | #include <linux/libata.h> |
34 | 34 | ||
35 | #define DRV_NAME "pata_sil680" | 35 | #define DRV_NAME "pata_sil680" |
36 | #define DRV_VERSION "0.4.7" | 36 | #define DRV_VERSION "0.4.8" |
37 | 37 | ||
38 | #define SIL680_MMIO_BAR 5 | 38 | #define SIL680_MMIO_BAR 5 |
39 | 39 | ||
@@ -94,34 +94,6 @@ static int sil680_cable_detect(struct ata_port *ap) { | |||
94 | } | 94 | } |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * sil680_bus_reset - reset the SIL680 bus | ||
98 | * @link: ATA link to reset | ||
99 | * @deadline: deadline jiffies for the operation | ||
100 | * | ||
101 | * Perform the SIL680 housekeeping when doing an ATA bus reset | ||
102 | */ | ||
103 | |||
104 | static int sil680_bus_reset(struct ata_link *link, unsigned int *classes, | ||
105 | unsigned long deadline) | ||
106 | { | ||
107 | struct ata_port *ap = link->ap; | ||
108 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
109 | unsigned long addr = sil680_selreg(ap, 0); | ||
110 | u8 reset; | ||
111 | |||
112 | pci_read_config_byte(pdev, addr, &reset); | ||
113 | pci_write_config_byte(pdev, addr, reset | 0x03); | ||
114 | udelay(25); | ||
115 | pci_write_config_byte(pdev, addr, reset); | ||
116 | return ata_std_softreset(link, classes, deadline); | ||
117 | } | ||
118 | |||
119 | static void sil680_error_handler(struct ata_port *ap) | ||
120 | { | ||
121 | ata_bmdma_drive_eh(ap, ata_std_prereset, sil680_bus_reset, NULL, ata_std_postreset); | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * sil680_set_piomode - set initial PIO mode data | 97 | * sil680_set_piomode - set initial PIO mode data |
126 | * @ap: ATA interface | 98 | * @ap: ATA interface |
127 | * @adev: ATA device | 99 | * @adev: ATA device |
@@ -249,7 +221,7 @@ static struct ata_port_operations sil680_port_ops = { | |||
249 | 221 | ||
250 | .freeze = ata_bmdma_freeze, | 222 | .freeze = ata_bmdma_freeze, |
251 | .thaw = ata_bmdma_thaw, | 223 | .thaw = ata_bmdma_thaw, |
252 | .error_handler = sil680_error_handler, | 224 | .error_handler = ata_bmdma_error_handler, |
253 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 225 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
254 | .cable_detect = sil680_cable_detect, | 226 | .cable_detect = sil680_cable_detect, |
255 | 227 | ||
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index 3b5be77e861c..87546d9f1ca0 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -55,6 +55,7 @@ static const struct sis_laptop sis_laptop[] = { | |||
55 | /* devid, subvendor, subdev */ | 55 | /* devid, subvendor, subdev */ |
56 | { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ | 56 | { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ |
57 | { 0x5513, 0x1734, 0x105F }, /* FSC Amilo A1630 */ | 57 | { 0x5513, 0x1734, 0x105F }, /* FSC Amilo A1630 */ |
58 | { 0x5513, 0x1071, 0x8640 }, /* EasyNote K5305 */ | ||
58 | /* end marker */ | 59 | /* end marker */ |
59 | { 0, } | 60 | { 0, } |
60 | }; | 61 | }; |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index a4175fbdd170..453d72bf2598 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -63,7 +63,7 @@ | |||
63 | #include <linux/dmi.h> | 63 | #include <linux/dmi.h> |
64 | 64 | ||
65 | #define DRV_NAME "pata_via" | 65 | #define DRV_NAME "pata_via" |
66 | #define DRV_VERSION "0.3.2" | 66 | #define DRV_VERSION "0.3.3" |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx | 69 | * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx |
@@ -296,7 +296,7 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo | |||
296 | } | 296 | } |
297 | 297 | ||
298 | /* Set UDMA unless device is not UDMA capable */ | 298 | /* Set UDMA unless device is not UDMA capable */ |
299 | if (udma_type) { | 299 | if (udma_type && t.udma) { |
300 | u8 cable80_status; | 300 | u8 cable80_status; |
301 | 301 | ||
302 | /* Get 80-wire cable detection bit */ | 302 | /* Get 80-wire cable detection bit */ |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index a43f64d2775b..fe0105d35bae 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -164,10 +164,14 @@ enum { | |||
164 | MV_PCI_ERR_ATTRIBUTE = 0x1d48, | 164 | MV_PCI_ERR_ATTRIBUTE = 0x1d48, |
165 | MV_PCI_ERR_COMMAND = 0x1d50, | 165 | MV_PCI_ERR_COMMAND = 0x1d50, |
166 | 166 | ||
167 | PCI_IRQ_CAUSE_OFS = 0x1d58, | 167 | PCI_IRQ_CAUSE_OFS = 0x1d58, |
168 | PCI_IRQ_MASK_OFS = 0x1d5c, | 168 | PCI_IRQ_MASK_OFS = 0x1d5c, |
169 | PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */ | 169 | PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */ |
170 | 170 | ||
171 | PCIE_IRQ_CAUSE_OFS = 0x1900, | ||
172 | PCIE_IRQ_MASK_OFS = 0x1910, | ||
173 | PCIE_UNMASK_ALL_IRQS = 0x70a, /* assorted bits */ | ||
174 | |||
171 | HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, | 175 | HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, |
172 | HC_MAIN_IRQ_MASK_OFS = 0x1d64, | 176 | HC_MAIN_IRQ_MASK_OFS = 0x1d64, |
173 | PORT0_ERR = (1 << 0), /* shift by port # */ | 177 | PORT0_ERR = (1 << 0), /* shift by port # */ |
@@ -303,6 +307,7 @@ enum { | |||
303 | MV_HP_GEN_I = (1 << 6), /* Generation I: 50xx */ | 307 | MV_HP_GEN_I = (1 << 6), /* Generation I: 50xx */ |
304 | MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */ | 308 | MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */ |
305 | MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */ | 309 | MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */ |
310 | MV_HP_PCIE = (1 << 9), /* PCIe bus/regs: 7042 */ | ||
306 | 311 | ||
307 | /* Port private flags (pp_flags) */ | 312 | /* Port private flags (pp_flags) */ |
308 | MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ | 313 | MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ |
@@ -388,7 +393,15 @@ struct mv_port_signal { | |||
388 | u32 pre; | 393 | u32 pre; |
389 | }; | 394 | }; |
390 | 395 | ||
391 | struct mv_host_priv; | 396 | struct mv_host_priv { |
397 | u32 hp_flags; | ||
398 | struct mv_port_signal signal[8]; | ||
399 | const struct mv_hw_ops *ops; | ||
400 | u32 irq_cause_ofs; | ||
401 | u32 irq_mask_ofs; | ||
402 | u32 unmask_all_irqs; | ||
403 | }; | ||
404 | |||
392 | struct mv_hw_ops { | 405 | struct mv_hw_ops { |
393 | void (*phy_errata)(struct mv_host_priv *hpriv, void __iomem *mmio, | 406 | void (*phy_errata)(struct mv_host_priv *hpriv, void __iomem *mmio, |
394 | unsigned int port); | 407 | unsigned int port); |
@@ -401,12 +414,6 @@ struct mv_hw_ops { | |||
401 | void (*reset_bus)(struct pci_dev *pdev, void __iomem *mmio); | 414 | void (*reset_bus)(struct pci_dev *pdev, void __iomem *mmio); |
402 | }; | 415 | }; |
403 | 416 | ||
404 | struct mv_host_priv { | ||
405 | u32 hp_flags; | ||
406 | struct mv_port_signal signal[8]; | ||
407 | const struct mv_hw_ops *ops; | ||
408 | }; | ||
409 | |||
410 | static void mv_irq_clear(struct ata_port *ap); | 417 | static void mv_irq_clear(struct ata_port *ap); |
411 | static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val); | 418 | static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val); |
412 | static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); | 419 | static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); |
@@ -631,11 +638,13 @@ static const struct pci_device_id mv_pci_tbl[] = { | |||
631 | /* Adaptec 1430SA */ | 638 | /* Adaptec 1430SA */ |
632 | { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 }, | 639 | { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 }, |
633 | 640 | ||
634 | { PCI_VDEVICE(TTI, 0x2310), chip_7042 }, | 641 | /* Marvell 7042 support */ |
635 | |||
636 | /* add Marvell 7042 support */ | ||
637 | { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 }, | 642 | { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 }, |
638 | 643 | ||
644 | /* Highpoint RocketRAID PCIe series */ | ||
645 | { PCI_VDEVICE(TTI, 0x2300), chip_7042 }, | ||
646 | { PCI_VDEVICE(TTI, 0x2310), chip_7042 }, | ||
647 | |||
639 | { } /* terminate list */ | 648 | { } /* terminate list */ |
640 | }; | 649 | }; |
641 | 650 | ||
@@ -1648,13 +1657,14 @@ static void mv_host_intr(struct ata_host *host, u32 relevant, unsigned int hc) | |||
1648 | 1657 | ||
1649 | static void mv_pci_error(struct ata_host *host, void __iomem *mmio) | 1658 | static void mv_pci_error(struct ata_host *host, void __iomem *mmio) |
1650 | { | 1659 | { |
1660 | struct mv_host_priv *hpriv = host->private_data; | ||
1651 | struct ata_port *ap; | 1661 | struct ata_port *ap; |
1652 | struct ata_queued_cmd *qc; | 1662 | struct ata_queued_cmd *qc; |
1653 | struct ata_eh_info *ehi; | 1663 | struct ata_eh_info *ehi; |
1654 | unsigned int i, err_mask, printed = 0; | 1664 | unsigned int i, err_mask, printed = 0; |
1655 | u32 err_cause; | 1665 | u32 err_cause; |
1656 | 1666 | ||
1657 | err_cause = readl(mmio + PCI_IRQ_CAUSE_OFS); | 1667 | err_cause = readl(mmio + hpriv->irq_cause_ofs); |
1658 | 1668 | ||
1659 | dev_printk(KERN_ERR, host->dev, "PCI ERROR; PCI IRQ cause=0x%08x\n", | 1669 | dev_printk(KERN_ERR, host->dev, "PCI ERROR; PCI IRQ cause=0x%08x\n", |
1660 | err_cause); | 1670 | err_cause); |
@@ -1662,7 +1672,7 @@ static void mv_pci_error(struct ata_host *host, void __iomem *mmio) | |||
1662 | DPRINTK("All regs @ PCI error\n"); | 1672 | DPRINTK("All regs @ PCI error\n"); |
1663 | mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev)); | 1673 | mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev)); |
1664 | 1674 | ||
1665 | writelfl(0, mmio + PCI_IRQ_CAUSE_OFS); | 1675 | writelfl(0, mmio + hpriv->irq_cause_ofs); |
1666 | 1676 | ||
1667 | for (i = 0; i < host->n_ports; i++) { | 1677 | for (i = 0; i < host->n_ports; i++) { |
1668 | ap = host->ports[i]; | 1678 | ap = host->ports[i]; |
@@ -1926,6 +1936,8 @@ static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, | |||
1926 | #define ZERO(reg) writel(0, mmio + (reg)) | 1936 | #define ZERO(reg) writel(0, mmio + (reg)) |
1927 | static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio) | 1937 | static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio) |
1928 | { | 1938 | { |
1939 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
1940 | struct mv_host_priv *hpriv = host->private_data; | ||
1929 | u32 tmp; | 1941 | u32 tmp; |
1930 | 1942 | ||
1931 | tmp = readl(mmio + MV_PCI_MODE); | 1943 | tmp = readl(mmio + MV_PCI_MODE); |
@@ -1937,8 +1949,8 @@ static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio) | |||
1937 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); | 1949 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); |
1938 | ZERO(HC_MAIN_IRQ_MASK_OFS); | 1950 | ZERO(HC_MAIN_IRQ_MASK_OFS); |
1939 | ZERO(MV_PCI_SERR_MASK); | 1951 | ZERO(MV_PCI_SERR_MASK); |
1940 | ZERO(PCI_IRQ_CAUSE_OFS); | 1952 | ZERO(hpriv->irq_cause_ofs); |
1941 | ZERO(PCI_IRQ_MASK_OFS); | 1953 | ZERO(hpriv->irq_mask_ofs); |
1942 | ZERO(MV_PCI_ERR_LOW_ADDRESS); | 1954 | ZERO(MV_PCI_ERR_LOW_ADDRESS); |
1943 | ZERO(MV_PCI_ERR_HIGH_ADDRESS); | 1955 | ZERO(MV_PCI_ERR_HIGH_ADDRESS); |
1944 | ZERO(MV_PCI_ERR_ATTRIBUTE); | 1956 | ZERO(MV_PCI_ERR_ATTRIBUTE); |
@@ -2170,7 +2182,7 @@ static void mv_phy_reset(struct ata_port *ap, unsigned int *class, | |||
2170 | mv_scr_read(ap, SCR_ERROR, &serror); | 2182 | mv_scr_read(ap, SCR_ERROR, &serror); |
2171 | mv_scr_read(ap, SCR_CONTROL, &scontrol); | 2183 | mv_scr_read(ap, SCR_CONTROL, &scontrol); |
2172 | DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " | 2184 | DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " |
2173 | "SCtrl 0x%08x\n", status, serror, scontrol); | 2185 | "SCtrl 0x%08x\n", sstatus, serror, scontrol); |
2174 | } | 2186 | } |
2175 | #endif | 2187 | #endif |
2176 | 2188 | ||
@@ -2490,6 +2502,16 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
2490 | break; | 2502 | break; |
2491 | 2503 | ||
2492 | case chip_7042: | 2504 | case chip_7042: |
2505 | hp_flags |= MV_HP_PCIE; | ||
2506 | if (pdev->vendor == PCI_VENDOR_ID_TTI && | ||
2507 | (pdev->device == 0x2300 || pdev->device == 0x2310)) | ||
2508 | { | ||
2509 | printk(KERN_WARNING "sata_mv: Highpoint RocketRAID BIOS" | ||
2510 | " will CORRUPT DATA on attached drives when" | ||
2511 | " configured as \"Legacy\". BEWARE!\n"); | ||
2512 | printk(KERN_WARNING "sata_mv: Use BIOS \"JBOD\" volumes" | ||
2513 | " instead for safety.\n"); | ||
2514 | } | ||
2493 | case chip_6042: | 2515 | case chip_6042: |
2494 | hpriv->ops = &mv6xxx_ops; | 2516 | hpriv->ops = &mv6xxx_ops; |
2495 | hp_flags |= MV_HP_GEN_IIE; | 2517 | hp_flags |= MV_HP_GEN_IIE; |
@@ -2516,6 +2538,15 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
2516 | } | 2538 | } |
2517 | 2539 | ||
2518 | hpriv->hp_flags = hp_flags; | 2540 | hpriv->hp_flags = hp_flags; |
2541 | if (hp_flags & MV_HP_PCIE) { | ||
2542 | hpriv->irq_cause_ofs = PCIE_IRQ_CAUSE_OFS; | ||
2543 | hpriv->irq_mask_ofs = PCIE_IRQ_MASK_OFS; | ||
2544 | hpriv->unmask_all_irqs = PCIE_UNMASK_ALL_IRQS; | ||
2545 | } else { | ||
2546 | hpriv->irq_cause_ofs = PCI_IRQ_CAUSE_OFS; | ||
2547 | hpriv->irq_mask_ofs = PCI_IRQ_MASK_OFS; | ||
2548 | hpriv->unmask_all_irqs = PCI_UNMASK_ALL_IRQS; | ||
2549 | } | ||
2519 | 2550 | ||
2520 | return 0; | 2551 | return 0; |
2521 | } | 2552 | } |
@@ -2595,10 +2626,10 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
2595 | } | 2626 | } |
2596 | 2627 | ||
2597 | /* Clear any currently outstanding host interrupt conditions */ | 2628 | /* Clear any currently outstanding host interrupt conditions */ |
2598 | writelfl(0, mmio + PCI_IRQ_CAUSE_OFS); | 2629 | writelfl(0, mmio + hpriv->irq_cause_ofs); |
2599 | 2630 | ||
2600 | /* and unmask interrupt generation for host regs */ | 2631 | /* and unmask interrupt generation for host regs */ |
2601 | writelfl(PCI_UNMASK_ALL_IRQS, mmio + PCI_IRQ_MASK_OFS); | 2632 | writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); |
2602 | 2633 | ||
2603 | if (IS_GEN_I(hpriv)) | 2634 | if (IS_GEN_I(hpriv)) |
2604 | writelfl(~HC_MAIN_MASKED_IRQS_5, mmio + HC_MAIN_IRQ_MASK_OFS); | 2635 | writelfl(~HC_MAIN_MASKED_IRQS_5, mmio + HC_MAIN_IRQ_MASK_OFS); |
@@ -2609,8 +2640,8 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
2609 | "PCI int cause/mask=0x%08x/0x%08x\n", | 2640 | "PCI int cause/mask=0x%08x/0x%08x\n", |
2610 | readl(mmio + HC_MAIN_IRQ_CAUSE_OFS), | 2641 | readl(mmio + HC_MAIN_IRQ_CAUSE_OFS), |
2611 | readl(mmio + HC_MAIN_IRQ_MASK_OFS), | 2642 | readl(mmio + HC_MAIN_IRQ_MASK_OFS), |
2612 | readl(mmio + PCI_IRQ_CAUSE_OFS), | 2643 | readl(mmio + hpriv->irq_cause_ofs), |
2613 | readl(mmio + PCI_IRQ_MASK_OFS)); | 2644 | readl(mmio + hpriv->irq_mask_ofs)); |
2614 | 2645 | ||
2615 | done: | 2646 | done: |
2616 | return rc; | 2647 | return rc; |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 44f9e5d9e362..ed5dc7cb50cd 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -791,11 +791,13 @@ static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc) | |||
791 | 791 | ||
792 | static void nv_adma_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | 792 | static void nv_adma_tf_read(struct ata_port *ap, struct ata_taskfile *tf) |
793 | { | 793 | { |
794 | /* Since commands where a result TF is requested are not | 794 | /* Other than when internal or pass-through commands are executed, |
795 | executed in ADMA mode, the only time this function will be called | 795 | the only time this function will be called in ADMA mode will be |
796 | in ADMA mode will be if a command fails. In this case we | 796 | if a command fails. In the failure case we don't care about going |
797 | don't care about going into register mode with ADMA commands | 797 | into register mode with ADMA commands pending, as the commands will |
798 | pending, as the commands will all shortly be aborted anyway. */ | 798 | all shortly be aborted anyway. We assume that NCQ commands are not |
799 | issued via passthrough, which is the only way that switching into | ||
800 | ADMA mode could abort outstanding commands. */ | ||
799 | nv_adma_register_mode(ap); | 801 | nv_adma_register_mode(ap); |
800 | 802 | ||
801 | ata_tf_read(ap, tf); | 803 | ata_tf_read(ap, tf); |
@@ -1359,11 +1361,9 @@ static int nv_adma_use_reg_mode(struct ata_queued_cmd *qc) | |||
1359 | struct nv_adma_port_priv *pp = qc->ap->private_data; | 1361 | struct nv_adma_port_priv *pp = qc->ap->private_data; |
1360 | 1362 | ||
1361 | /* ADMA engine can only be used for non-ATAPI DMA commands, | 1363 | /* ADMA engine can only be used for non-ATAPI DMA commands, |
1362 | or interrupt-driven no-data commands, where a result taskfile | 1364 | or interrupt-driven no-data commands. */ |
1363 | is not required. */ | ||
1364 | if ((pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) || | 1365 | if ((pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) || |
1365 | (qc->tf.flags & ATA_TFLAG_POLLING) || | 1366 | (qc->tf.flags & ATA_TFLAG_POLLING)) |
1366 | (qc->flags & ATA_QCFLAG_RESULT_TF)) | ||
1367 | return 1; | 1367 | return 1; |
1368 | 1368 | ||
1369 | if ((qc->flags & ATA_QCFLAG_DMAMAP) || | 1369 | if ((qc->flags & ATA_QCFLAG_DMAMAP) || |
@@ -1381,6 +1381,8 @@ static void nv_adma_qc_prep(struct ata_queued_cmd *qc) | |||
1381 | NV_CPB_CTL_IEN; | 1381 | NV_CPB_CTL_IEN; |
1382 | 1382 | ||
1383 | if (nv_adma_use_reg_mode(qc)) { | 1383 | if (nv_adma_use_reg_mode(qc)) { |
1384 | BUG_ON(!(pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) && | ||
1385 | (qc->flags & ATA_QCFLAG_DMAMAP)); | ||
1384 | nv_adma_register_mode(qc->ap); | 1386 | nv_adma_register_mode(qc->ap); |
1385 | ata_qc_prep(qc); | 1387 | ata_qc_prep(qc); |
1386 | return; | 1388 | return; |
@@ -1425,9 +1427,21 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc) | |||
1425 | 1427 | ||
1426 | VPRINTK("ENTER\n"); | 1428 | VPRINTK("ENTER\n"); |
1427 | 1429 | ||
1430 | /* We can't handle result taskfile with NCQ commands, since | ||
1431 | retrieving the taskfile switches us out of ADMA mode and would abort | ||
1432 | existing commands. */ | ||
1433 | if (unlikely(qc->tf.protocol == ATA_PROT_NCQ && | ||
1434 | (qc->flags & ATA_QCFLAG_RESULT_TF))) { | ||
1435 | ata_dev_printk(qc->dev, KERN_ERR, | ||
1436 | "NCQ w/ RESULT_TF not allowed\n"); | ||
1437 | return AC_ERR_SYSTEM; | ||
1438 | } | ||
1439 | |||
1428 | if (nv_adma_use_reg_mode(qc)) { | 1440 | if (nv_adma_use_reg_mode(qc)) { |
1429 | /* use ATA register mode */ | 1441 | /* use ATA register mode */ |
1430 | VPRINTK("using ATA register mode: 0x%lx\n", qc->flags); | 1442 | VPRINTK("using ATA register mode: 0x%lx\n", qc->flags); |
1443 | BUG_ON(!(pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) && | ||
1444 | (qc->flags & ATA_QCFLAG_DMAMAP)); | ||
1431 | nv_adma_register_mode(qc->ap); | 1445 | nv_adma_register_mode(qc->ap); |
1432 | return ata_qc_issue_prot(qc); | 1446 | return ata_qc_issue_prot(qc); |
1433 | } else | 1447 | } else |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 187dcb02c681..96fd5260446d 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -63,6 +63,21 @@ enum { | |||
63 | SIL24_HOST_BAR = 0, | 63 | SIL24_HOST_BAR = 0, |
64 | SIL24_PORT_BAR = 2, | 64 | SIL24_PORT_BAR = 2, |
65 | 65 | ||
66 | /* sil24 fetches in chunks of 64bytes. The first block | ||
67 | * contains the PRB and two SGEs. From the second block, it's | ||
68 | * consisted of four SGEs and called SGT. Calculate the | ||
69 | * number of SGTs that fit into one page. | ||
70 | */ | ||
71 | SIL24_PRB_SZ = sizeof(struct sil24_prb) | ||
72 | + 2 * sizeof(struct sil24_sge), | ||
73 | SIL24_MAX_SGT = (PAGE_SIZE - SIL24_PRB_SZ) | ||
74 | / (4 * sizeof(struct sil24_sge)), | ||
75 | |||
76 | /* This will give us one unused SGEs for ATA. This extra SGE | ||
77 | * will be used to store CDB for ATAPI devices. | ||
78 | */ | ||
79 | SIL24_MAX_SGE = 4 * SIL24_MAX_SGT + 1, | ||
80 | |||
66 | /* | 81 | /* |
67 | * Global controller registers (128 bytes @ BAR0) | 82 | * Global controller registers (128 bytes @ BAR0) |
68 | */ | 83 | */ |
@@ -247,13 +262,13 @@ enum { | |||
247 | 262 | ||
248 | struct sil24_ata_block { | 263 | struct sil24_ata_block { |
249 | struct sil24_prb prb; | 264 | struct sil24_prb prb; |
250 | struct sil24_sge sge[LIBATA_MAX_PRD]; | 265 | struct sil24_sge sge[SIL24_MAX_SGE]; |
251 | }; | 266 | }; |
252 | 267 | ||
253 | struct sil24_atapi_block { | 268 | struct sil24_atapi_block { |
254 | struct sil24_prb prb; | 269 | struct sil24_prb prb; |
255 | u8 cdb[16]; | 270 | u8 cdb[16]; |
256 | struct sil24_sge sge[LIBATA_MAX_PRD - 1]; | 271 | struct sil24_sge sge[SIL24_MAX_SGE]; |
257 | }; | 272 | }; |
258 | 273 | ||
259 | union sil24_cmd_block { | 274 | union sil24_cmd_block { |
@@ -378,7 +393,7 @@ static struct scsi_host_template sil24_sht = { | |||
378 | .change_queue_depth = ata_scsi_change_queue_depth, | 393 | .change_queue_depth = ata_scsi_change_queue_depth, |
379 | .can_queue = SIL24_MAX_CMDS, | 394 | .can_queue = SIL24_MAX_CMDS, |
380 | .this_id = ATA_SHT_THIS_ID, | 395 | .this_id = ATA_SHT_THIS_ID, |
381 | .sg_tablesize = LIBATA_MAX_PRD, | 396 | .sg_tablesize = SIL24_MAX_SGE, |
382 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | 397 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, |
383 | .emulated = ATA_SHT_EMULATED, | 398 | .emulated = ATA_SHT_EMULATED, |
384 | .use_clustering = ATA_SHT_USE_CLUSTERING, | 399 | .use_clustering = ATA_SHT_USE_CLUSTERING, |
@@ -1284,6 +1299,7 @@ static void sil24_init_controller(struct ata_host *host) | |||
1284 | 1299 | ||
1285 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 1300 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1286 | { | 1301 | { |
1302 | extern int __MARKER__sil24_cmd_block_is_sized_wrongly; | ||
1287 | static int printed_version; | 1303 | static int printed_version; |
1288 | struct ata_port_info pi = sil24_port_info[ent->driver_data]; | 1304 | struct ata_port_info pi = sil24_port_info[ent->driver_data]; |
1289 | const struct ata_port_info *ppi[] = { &pi, NULL }; | 1305 | const struct ata_port_info *ppi[] = { &pi, NULL }; |
@@ -1292,6 +1308,10 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1292 | int i, rc; | 1308 | int i, rc; |
1293 | u32 tmp; | 1309 | u32 tmp; |
1294 | 1310 | ||
1311 | /* cause link error if sil24_cmd_block is sized wrongly */ | ||
1312 | if (sizeof(union sil24_cmd_block) != PAGE_SIZE) | ||
1313 | __MARKER__sil24_cmd_block_is_sized_wrongly = 1; | ||
1314 | |||
1295 | if (!printed_version++) | 1315 | if (!printed_version++) |
1296 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); | 1316 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
1297 | 1317 | ||
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 8b12925fe7a4..f97e050338f0 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
@@ -2689,7 +2689,7 @@ fore200e_init(struct fore200e* fore200e) | |||
2689 | return 0; | 2689 | return 0; |
2690 | } | 2690 | } |
2691 | 2691 | ||
2692 | 2692 | #ifdef CONFIG_ATM_FORE200E_PCA | |
2693 | static int __devinit | 2693 | static int __devinit |
2694 | fore200e_pca_detect(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) | 2694 | fore200e_pca_detect(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) |
2695 | { | 2695 | { |
@@ -2756,7 +2756,6 @@ static void __devexit fore200e_pca_remove_one(struct pci_dev *pci_dev) | |||
2756 | } | 2756 | } |
2757 | 2757 | ||
2758 | 2758 | ||
2759 | #ifdef CONFIG_ATM_FORE200E_PCA | ||
2760 | static struct pci_device_id fore200e_pca_tbl[] = { | 2759 | static struct pci_device_id fore200e_pca_tbl[] = { |
2761 | { PCI_VENDOR_ID_FORE, PCI_DEVICE_ID_FORE_PCA200E, PCI_ANY_ID, PCI_ANY_ID, | 2760 | { PCI_VENDOR_ID_FORE, PCI_DEVICE_ID_FORE_PCA200E, PCI_ANY_ID, PCI_ANY_ID, |
2762 | 0, 0, (unsigned long) &fore200e_bus[0] }, | 2761 | 0, 0, (unsigned long) &fore200e_bus[0] }, |
diff --git a/drivers/atm/he.c b/drivers/atm/he.c index d33aba6864c2..3b64a99772ea 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c | |||
@@ -394,6 +394,11 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) | |||
394 | he_dev->atm_dev->dev_data = he_dev; | 394 | he_dev->atm_dev->dev_data = he_dev; |
395 | atm_dev->dev_data = he_dev; | 395 | atm_dev->dev_data = he_dev; |
396 | he_dev->number = atm_dev->number; | 396 | he_dev->number = atm_dev->number; |
397 | #ifdef USE_TASKLET | ||
398 | tasklet_init(&he_dev->tasklet, he_tasklet, (unsigned long) he_dev); | ||
399 | #endif | ||
400 | spin_lock_init(&he_dev->global_lock); | ||
401 | |||
397 | if (he_start(atm_dev)) { | 402 | if (he_start(atm_dev)) { |
398 | he_stop(he_dev); | 403 | he_stop(he_dev); |
399 | err = -ENODEV; | 404 | err = -ENODEV; |
@@ -1173,11 +1178,6 @@ he_start(struct atm_dev *dev) | |||
1173 | if ((err = he_init_irq(he_dev)) != 0) | 1178 | if ((err = he_init_irq(he_dev)) != 0) |
1174 | return err; | 1179 | return err; |
1175 | 1180 | ||
1176 | #ifdef USE_TASKLET | ||
1177 | tasklet_init(&he_dev->tasklet, he_tasklet, (unsigned long) he_dev); | ||
1178 | #endif | ||
1179 | spin_lock_init(&he_dev->global_lock); | ||
1180 | |||
1181 | /* 4.11 enable pci bus controller state machines */ | 1181 | /* 4.11 enable pci bus controller state machines */ |
1182 | host_cntl |= (OUTFF_ENB | CMDFF_ENB | | 1182 | host_cntl |= (OUTFF_ENB | CMDFF_ENB | |
1183 | QUICK_RD_RETRY | QUICK_WR_RETRY | PERR_INT_ENB); | 1183 | QUICK_RD_RETRY | QUICK_WR_RETRY | PERR_INT_ENB); |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 3f4d6aa13990..2683eac30c68 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -770,9 +770,10 @@ int device_add(struct device *dev) | |||
770 | error = device_add_attrs(dev); | 770 | error = device_add_attrs(dev); |
771 | if (error) | 771 | if (error) |
772 | goto AttrsError; | 772 | goto AttrsError; |
773 | error = device_pm_add(dev); | 773 | error = dpm_sysfs_add(dev); |
774 | if (error) | 774 | if (error) |
775 | goto PMError; | 775 | goto PMError; |
776 | device_pm_add(dev); | ||
776 | error = bus_add_device(dev); | 777 | error = bus_add_device(dev); |
777 | if (error) | 778 | if (error) |
778 | goto BusError; | 779 | goto BusError; |
@@ -797,6 +798,7 @@ int device_add(struct device *dev) | |||
797 | return error; | 798 | return error; |
798 | BusError: | 799 | BusError: |
799 | device_pm_remove(dev); | 800 | device_pm_remove(dev); |
801 | dpm_sysfs_remove(dev); | ||
800 | PMError: | 802 | PMError: |
801 | if (dev->bus) | 803 | if (dev->bus) |
802 | blocking_notifier_call_chain(&dev->bus->bus_notifier, | 804 | blocking_notifier_call_chain(&dev->bus->bus_notifier, |
diff --git a/drivers/base/power/Makefile b/drivers/base/power/Makefile index a803733c839e..44504e6618fb 100644 --- a/drivers/base/power/Makefile +++ b/drivers/base/power/Makefile | |||
@@ -1,5 +1,6 @@ | |||
1 | obj-y := shutdown.o | 1 | obj-y := shutdown.o |
2 | obj-$(CONFIG_PM_SLEEP) += main.o sysfs.o | 2 | obj-$(CONFIG_PM) += sysfs.o |
3 | obj-$(CONFIG_PM_SLEEP) += main.o | ||
3 | obj-$(CONFIG_PM_TRACE) += trace.o | 4 | obj-$(CONFIG_PM_TRACE) += trace.o |
4 | 5 | ||
5 | ifeq ($(CONFIG_DEBUG_DRIVER),y) | 6 | ifeq ($(CONFIG_DEBUG_DRIVER),y) |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 0ab4ab21f564..691ffb64cc37 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -38,20 +38,14 @@ static DEFINE_MUTEX(dpm_list_mtx); | |||
38 | int (*platform_enable_wakeup)(struct device *dev, int is_on); | 38 | int (*platform_enable_wakeup)(struct device *dev, int is_on); |
39 | 39 | ||
40 | 40 | ||
41 | int device_pm_add(struct device *dev) | 41 | void device_pm_add(struct device *dev) |
42 | { | 42 | { |
43 | int error; | ||
44 | |||
45 | pr_debug("PM: Adding info for %s:%s\n", | 43 | pr_debug("PM: Adding info for %s:%s\n", |
46 | dev->bus ? dev->bus->name : "No Bus", | 44 | dev->bus ? dev->bus->name : "No Bus", |
47 | kobject_name(&dev->kobj)); | 45 | kobject_name(&dev->kobj)); |
48 | mutex_lock(&dpm_list_mtx); | 46 | mutex_lock(&dpm_list_mtx); |
49 | list_add_tail(&dev->power.entry, &dpm_active); | 47 | list_add_tail(&dev->power.entry, &dpm_active); |
50 | error = dpm_sysfs_add(dev); | ||
51 | if (error) | ||
52 | list_del(&dev->power.entry); | ||
53 | mutex_unlock(&dpm_list_mtx); | 48 | mutex_unlock(&dpm_list_mtx); |
54 | return error; | ||
55 | } | 49 | } |
56 | 50 | ||
57 | void device_pm_remove(struct device *dev) | 51 | void device_pm_remove(struct device *dev) |
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h index 5c4efd493fa5..379da4e958e0 100644 --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h | |||
@@ -13,14 +13,29 @@ extern void device_shutdown(void); | |||
13 | 13 | ||
14 | extern struct list_head dpm_active; /* The active device list */ | 14 | extern struct list_head dpm_active; /* The active device list */ |
15 | 15 | ||
16 | static inline struct device * to_device(struct list_head * entry) | 16 | static inline struct device *to_device(struct list_head *entry) |
17 | { | 17 | { |
18 | return container_of(entry, struct device, power.entry); | 18 | return container_of(entry, struct device, power.entry); |
19 | } | 19 | } |
20 | 20 | ||
21 | extern int device_pm_add(struct device *); | 21 | extern void device_pm_add(struct device *); |
22 | extern void device_pm_remove(struct device *); | 22 | extern void device_pm_remove(struct device *); |
23 | 23 | ||
24 | #else /* CONFIG_PM_SLEEP */ | ||
25 | |||
26 | |||
27 | static inline void device_pm_add(struct device *dev) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | static inline void device_pm_remove(struct device *dev) | ||
32 | { | ||
33 | } | ||
34 | |||
35 | #endif | ||
36 | |||
37 | #ifdef CONFIG_PM | ||
38 | |||
24 | /* | 39 | /* |
25 | * sysfs.c | 40 | * sysfs.c |
26 | */ | 41 | */ |
@@ -28,16 +43,15 @@ extern void device_pm_remove(struct device *); | |||
28 | extern int dpm_sysfs_add(struct device *); | 43 | extern int dpm_sysfs_add(struct device *); |
29 | extern void dpm_sysfs_remove(struct device *); | 44 | extern void dpm_sysfs_remove(struct device *); |
30 | 45 | ||
31 | #else /* CONFIG_PM_SLEEP */ | 46 | #else /* CONFIG_PM */ |
32 | |||
33 | 47 | ||
34 | static inline int device_pm_add(struct device * dev) | 48 | static inline int dpm_sysfs_add(struct device *dev) |
35 | { | 49 | { |
36 | return 0; | 50 | return 0; |
37 | } | 51 | } |
38 | static inline void device_pm_remove(struct device * dev) | ||
39 | { | ||
40 | 52 | ||
53 | static inline void dpm_sysfs_remove(struct device *dev) | ||
54 | { | ||
41 | } | 55 | } |
42 | 56 | ||
43 | #endif | 57 | #endif |
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c index b1d00ef6659c..ad00b3d94711 100644 --- a/drivers/block/aoe/aoeblk.c +++ b/drivers/block/aoe/aoeblk.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/hdreg.h> | 7 | #include <linux/hdreg.h> |
8 | #include <linux/blkdev.h> | 8 | #include <linux/blkdev.h> |
9 | #include <linux/backing-dev.h> | ||
9 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
10 | #include <linux/ioctl.h> | 11 | #include <linux/ioctl.h> |
11 | #include <linux/genhd.h> | 12 | #include <linux/genhd.h> |
@@ -210,25 +211,20 @@ aoeblk_gdalloc(void *vp) | |||
210 | if (gd == NULL) { | 211 | if (gd == NULL) { |
211 | printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n", | 212 | printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n", |
212 | d->aoemajor, d->aoeminor); | 213 | d->aoemajor, d->aoeminor); |
213 | spin_lock_irqsave(&d->lock, flags); | 214 | goto err; |
214 | d->flags &= ~DEVFL_GDALLOC; | ||
215 | spin_unlock_irqrestore(&d->lock, flags); | ||
216 | return; | ||
217 | } | 215 | } |
218 | 216 | ||
219 | d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); | 217 | d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); |
220 | if (d->bufpool == NULL) { | 218 | if (d->bufpool == NULL) { |
221 | printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n", | 219 | printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n", |
222 | d->aoemajor, d->aoeminor); | 220 | d->aoemajor, d->aoeminor); |
223 | put_disk(gd); | 221 | goto err_disk; |
224 | spin_lock_irqsave(&d->lock, flags); | ||
225 | d->flags &= ~DEVFL_GDALLOC; | ||
226 | spin_unlock_irqrestore(&d->lock, flags); | ||
227 | return; | ||
228 | } | 222 | } |
229 | 223 | ||
230 | spin_lock_irqsave(&d->lock, flags); | ||
231 | blk_queue_make_request(&d->blkq, aoeblk_make_request); | 224 | blk_queue_make_request(&d->blkq, aoeblk_make_request); |
225 | if (bdi_init(&d->blkq.backing_dev_info)) | ||
226 | goto err_mempool; | ||
227 | spin_lock_irqsave(&d->lock, flags); | ||
232 | gd->major = AOE_MAJOR; | 228 | gd->major = AOE_MAJOR; |
233 | gd->first_minor = d->sysminor * AOE_PARTITIONS; | 229 | gd->first_minor = d->sysminor * AOE_PARTITIONS; |
234 | gd->fops = &aoe_bdops; | 230 | gd->fops = &aoe_bdops; |
@@ -246,6 +242,16 @@ aoeblk_gdalloc(void *vp) | |||
246 | 242 | ||
247 | add_disk(gd); | 243 | add_disk(gd); |
248 | aoedisk_add_sysfs(d); | 244 | aoedisk_add_sysfs(d); |
245 | return; | ||
246 | |||
247 | err_mempool: | ||
248 | mempool_destroy(d->bufpool); | ||
249 | err_disk: | ||
250 | put_disk(gd); | ||
251 | err: | ||
252 | spin_lock_irqsave(&d->lock, flags); | ||
253 | d->flags &= ~DEVFL_GDALLOC; | ||
254 | spin_unlock_irqrestore(&d->lock, flags); | ||
249 | } | 255 | } |
250 | 256 | ||
251 | void | 257 | void |
diff --git a/drivers/block/umem.c b/drivers/block/umem.c index 99806f9ee4ce..5f5095afb06b 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c | |||
@@ -484,7 +484,8 @@ static void process_page(unsigned long data) | |||
484 | page->idx++; | 484 | page->idx++; |
485 | if (page->idx >= bio->bi_vcnt) { | 485 | if (page->idx >= bio->bi_vcnt) { |
486 | page->bio = bio->bi_next; | 486 | page->bio = bio->bi_next; |
487 | page->idx = page->bio->bi_idx; | 487 | if (page->bio) |
488 | page->idx = page->bio->bi_idx; | ||
488 | } | 489 | } |
489 | 490 | ||
490 | pci_unmap_page(card->dev, desc->data_dma_handle, | 491 | pci_unmap_page(card->dev, desc->data_dma_handle, |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 3cf7129d83e6..924ddd8bccd2 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -223,7 +223,7 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
223 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap); | 223 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap); |
224 | if (err) { | 224 | if (err) { |
225 | dev_err(&vdev->dev, "Bad/missing capacity in config\n"); | 225 | dev_err(&vdev->dev, "Bad/missing capacity in config\n"); |
226 | goto out_put_disk; | 226 | goto out_cleanup_queue; |
227 | } | 227 | } |
228 | 228 | ||
229 | /* If capacity is too big, truncate with warning. */ | 229 | /* If capacity is too big, truncate with warning. */ |
@@ -239,7 +239,7 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
239 | blk_queue_max_segment_size(vblk->disk->queue, v); | 239 | blk_queue_max_segment_size(vblk->disk->queue, v); |
240 | else if (err != -ENOENT) { | 240 | else if (err != -ENOENT) { |
241 | dev_err(&vdev->dev, "Bad SIZE_MAX in config\n"); | 241 | dev_err(&vdev->dev, "Bad SIZE_MAX in config\n"); |
242 | goto out_put_disk; | 242 | goto out_cleanup_queue; |
243 | } | 243 | } |
244 | 244 | ||
245 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v); | 245 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v); |
@@ -247,12 +247,14 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
247 | blk_queue_max_hw_segments(vblk->disk->queue, v); | 247 | blk_queue_max_hw_segments(vblk->disk->queue, v); |
248 | else if (err != -ENOENT) { | 248 | else if (err != -ENOENT) { |
249 | dev_err(&vdev->dev, "Bad SEG_MAX in config\n"); | 249 | dev_err(&vdev->dev, "Bad SEG_MAX in config\n"); |
250 | goto out_put_disk; | 250 | goto out_cleanup_queue; |
251 | } | 251 | } |
252 | 252 | ||
253 | add_disk(vblk->disk); | 253 | add_disk(vblk->disk); |
254 | return 0; | 254 | return 0; |
255 | 255 | ||
256 | out_cleanup_queue: | ||
257 | blk_cleanup_queue(vblk->disk->queue); | ||
256 | out_put_disk: | 258 | out_put_disk: |
257 | put_disk(vblk->disk); | 259 | put_disk(vblk->disk); |
258 | out_unregister_blkdev: | 260 | out_unregister_blkdev: |
@@ -277,6 +279,8 @@ static void virtblk_remove(struct virtio_device *vdev) | |||
277 | put_disk(vblk->disk); | 279 | put_disk(vblk->disk); |
278 | unregister_blkdev(major, "virtblk"); | 280 | unregister_blkdev(major, "virtblk"); |
279 | mempool_destroy(vblk->pool); | 281 | mempool_destroy(vblk->pool); |
282 | /* There should be nothing in the queue now, so no need to shutdown */ | ||
283 | vdev->config->del_vq(vblk->vq); | ||
280 | kfree(vblk); | 284 | kfree(vblk); |
281 | } | 285 | } |
282 | 286 | ||
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index bf18d757b876..a509b8d79781 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -457,7 +457,7 @@ config LEGACY_PTYS | |||
457 | config LEGACY_PTY_COUNT | 457 | config LEGACY_PTY_COUNT |
458 | int "Maximum number of legacy PTY in use" | 458 | int "Maximum number of legacy PTY in use" |
459 | depends on LEGACY_PTYS | 459 | depends on LEGACY_PTYS |
460 | range 1 256 | 460 | range 0 256 |
461 | default "256" | 461 | default "256" |
462 | ---help--- | 462 | ---help--- |
463 | The maximum number of legacy PTYs that can be used at any one time. | 463 | The maximum number of legacy PTYs that can be used at any one time. |
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c index c99e43b837f5..17d54315e146 100644 --- a/drivers/char/apm-emulation.c +++ b/drivers/char/apm-emulation.c | |||
@@ -295,7 +295,6 @@ static int | |||
295 | apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) | 295 | apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) |
296 | { | 296 | { |
297 | struct apm_user *as = filp->private_data; | 297 | struct apm_user *as = filp->private_data; |
298 | unsigned long flags; | ||
299 | int err = -EINVAL; | 298 | int err = -EINVAL; |
300 | 299 | ||
301 | if (!as->suser || !as->writer) | 300 | if (!as->suser || !as->writer) |
@@ -331,10 +330,16 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) | |||
331 | * Wait for the suspend/resume to complete. If there | 330 | * Wait for the suspend/resume to complete. If there |
332 | * are pending acknowledges, we wait here for them. | 331 | * are pending acknowledges, we wait here for them. |
333 | */ | 332 | */ |
334 | flags = current->flags; | 333 | freezer_do_not_count(); |
335 | 334 | ||
336 | wait_event(apm_suspend_waitqueue, | 335 | wait_event(apm_suspend_waitqueue, |
337 | as->suspend_state == SUSPEND_DONE); | 336 | as->suspend_state == SUSPEND_DONE); |
337 | |||
338 | /* | ||
339 | * Since we are waiting until the suspend is done, the | ||
340 | * try_to_freeze() in freezer_count() will not trigger | ||
341 | */ | ||
342 | freezer_count(); | ||
338 | } else { | 343 | } else { |
339 | as->suspend_state = SUSPEND_WAIT; | 344 | as->suspend_state = SUSPEND_WAIT; |
340 | mutex_unlock(&state_lock); | 345 | mutex_unlock(&state_lock); |
@@ -362,14 +367,10 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) | |||
362 | * Wait for the suspend/resume to complete. If there | 367 | * Wait for the suspend/resume to complete. If there |
363 | * are pending acknowledges, we wait here for them. | 368 | * are pending acknowledges, we wait here for them. |
364 | */ | 369 | */ |
365 | flags = current->flags; | 370 | wait_event_freezable(apm_suspend_waitqueue, |
366 | |||
367 | wait_event_interruptible(apm_suspend_waitqueue, | ||
368 | as->suspend_state == SUSPEND_DONE); | 371 | as->suspend_state == SUSPEND_DONE); |
369 | } | 372 | } |
370 | 373 | ||
371 | current->flags = flags; | ||
372 | |||
373 | mutex_lock(&state_lock); | 374 | mutex_lock(&state_lock); |
374 | err = as->suspend_result; | 375 | err = as->suspend_result; |
375 | as->suspend_state = SUSPEND_NONE; | 376 | as->suspend_state = SUSPEND_NONE; |
diff --git a/drivers/char/cs5535_gpio.c b/drivers/char/cs5535_gpio.c index fe6d2407baed..c2d23cae9515 100644 --- a/drivers/char/cs5535_gpio.c +++ b/drivers/char/cs5535_gpio.c | |||
@@ -104,6 +104,11 @@ static ssize_t cs5535_gpio_write(struct file *file, const char __user *data, | |||
104 | for (j = 0; j < ARRAY_SIZE(rm); j++) { | 104 | for (j = 0; j < ARRAY_SIZE(rm); j++) { |
105 | if (c == rm[j].on) { | 105 | if (c == rm[j].on) { |
106 | outl(m1, base + rm[j].wr_offset); | 106 | outl(m1, base + rm[j].wr_offset); |
107 | /* If enabling output, turn off AUX 1 and AUX 2 */ | ||
108 | if (c == 'O') { | ||
109 | outl(m0, base + 0x10); | ||
110 | outl(m0, base + 0x14); | ||
111 | } | ||
107 | break; | 112 | break; |
108 | } else if (c == rm[j].off) { | 113 | } else if (c == rm[j].off) { |
109 | outl(m0, base + rm[j].wr_offset); | 114 | outl(m0, base + rm[j].wr_offset); |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 877e53dcb996..921c6d2bc8fc 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -1163,7 +1163,7 @@ static struct acpi_driver sonypi_acpi_driver = { | |||
1163 | }; | 1163 | }; |
1164 | #endif | 1164 | #endif |
1165 | 1165 | ||
1166 | static int __devinit sonypi_create_input_devices(void) | 1166 | static int __devinit sonypi_create_input_devices(struct platform_device *pdev) |
1167 | { | 1167 | { |
1168 | struct input_dev *jog_dev; | 1168 | struct input_dev *jog_dev; |
1169 | struct input_dev *key_dev; | 1169 | struct input_dev *key_dev; |
@@ -1177,6 +1177,7 @@ static int __devinit sonypi_create_input_devices(void) | |||
1177 | jog_dev->name = "Sony Vaio Jogdial"; | 1177 | jog_dev->name = "Sony Vaio Jogdial"; |
1178 | jog_dev->id.bustype = BUS_ISA; | 1178 | jog_dev->id.bustype = BUS_ISA; |
1179 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; | 1179 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; |
1180 | jog_dev->dev.parent = &pdev->dev; | ||
1180 | 1181 | ||
1181 | jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 1182 | jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
1182 | jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); | 1183 | jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); |
@@ -1191,6 +1192,7 @@ static int __devinit sonypi_create_input_devices(void) | |||
1191 | key_dev->name = "Sony Vaio Keys"; | 1192 | key_dev->name = "Sony Vaio Keys"; |
1192 | key_dev->id.bustype = BUS_ISA; | 1193 | key_dev->id.bustype = BUS_ISA; |
1193 | key_dev->id.vendor = PCI_VENDOR_ID_SONY; | 1194 | key_dev->id.vendor = PCI_VENDOR_ID_SONY; |
1195 | key_dev->dev.parent = &pdev->dev; | ||
1194 | 1196 | ||
1195 | /* Initialize the Input Drivers: special keys */ | 1197 | /* Initialize the Input Drivers: special keys */ |
1196 | key_dev->evbit[0] = BIT_MASK(EV_KEY); | 1198 | key_dev->evbit[0] = BIT_MASK(EV_KEY); |
@@ -1385,7 +1387,7 @@ static int __devinit sonypi_probe(struct platform_device *dev) | |||
1385 | 1387 | ||
1386 | if (useinput) { | 1388 | if (useinput) { |
1387 | 1389 | ||
1388 | error = sonypi_create_input_devices(); | 1390 | error = sonypi_create_input_devices(dev); |
1389 | if (error) { | 1391 | if (error) { |
1390 | printk(KERN_ERR | 1392 | printk(KERN_ERR |
1391 | "sonypi: failed to create input devices\n"); | 1393 | "sonypi: failed to create input devices\n"); |
@@ -1432,7 +1434,7 @@ static int __devexit sonypi_remove(struct platform_device *dev) | |||
1432 | { | 1434 | { |
1433 | sonypi_disable(); | 1435 | sonypi_disable(); |
1434 | 1436 | ||
1435 | synchronize_sched(); /* Allow sonypi interrupt to complete. */ | 1437 | synchronize_irq(sonypi_device.irq); |
1436 | flush_scheduled_work(); | 1438 | flush_scheduled_work(); |
1437 | 1439 | ||
1438 | if (useinput) { | 1440 | if (useinput) { |
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index fd771a4d6d18..81503d94fecc 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -450,6 +450,11 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, | |||
450 | goto out_err; | 450 | goto out_err; |
451 | } | 451 | } |
452 | 452 | ||
453 | if (request_locality(chip, 0) != 0) { | ||
454 | rc = -ENODEV; | ||
455 | goto out_err; | ||
456 | } | ||
457 | |||
453 | vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); | 458 | vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); |
454 | 459 | ||
455 | /* Default timeouts */ | 460 | /* Default timeouts */ |
@@ -487,11 +492,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, | |||
487 | if (intfcaps & TPM_INTF_DATA_AVAIL_INT) | 492 | if (intfcaps & TPM_INTF_DATA_AVAIL_INT) |
488 | dev_dbg(dev, "\tData Avail Int Support\n"); | 493 | dev_dbg(dev, "\tData Avail Int Support\n"); |
489 | 494 | ||
490 | if (request_locality(chip, 0) != 0) { | ||
491 | rc = -ENODEV; | ||
492 | goto out_err; | ||
493 | } | ||
494 | |||
495 | /* INTERRUPT Setup */ | 495 | /* INTERRUPT Setup */ |
496 | init_waitqueue_head(&chip->vendor.read_queue); | 496 | init_waitqueue_head(&chip->vendor.read_queue); |
497 | init_waitqueue_head(&chip->vendor.int_queue); | 497 | init_waitqueue_head(&chip->vendor.int_queue); |
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 5fd6688a444a..ddd3a259cea1 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig | |||
@@ -12,7 +12,7 @@ if CRYPTO_HW | |||
12 | 12 | ||
13 | config CRYPTO_DEV_PADLOCK | 13 | config CRYPTO_DEV_PADLOCK |
14 | tristate "Support for VIA PadLock ACE" | 14 | tristate "Support for VIA PadLock ACE" |
15 | depends on X86_32 | 15 | depends on X86_32 && !UML |
16 | select CRYPTO_ALGAPI | 16 | select CRYPTO_ALGAPI |
17 | help | 17 | help |
18 | Some VIA processors come with an integrated crypto engine | 18 | Some VIA processors come with an integrated crypto engine |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 6a7d25fc2470..c46b7c219ee9 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -3,11 +3,13 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig DMADEVICES | 5 | menuconfig DMADEVICES |
6 | bool "DMA Offload Engine support" | 6 | bool "DMA Engine support" |
7 | depends on (PCI && X86) || ARCH_IOP32X || ARCH_IOP33X || ARCH_IOP13XX | 7 | depends on (PCI && X86) || ARCH_IOP32X || ARCH_IOP33X || ARCH_IOP13XX |
8 | help | 8 | help |
9 | Intel(R) offload engines enable offloading memory copies in the | 9 | DMA engines can do asynchronous data transfers without |
10 | network stack and RAID operations in the MD driver. | 10 | involving the host CPU. Currently, this framework can be |
11 | used to offload memory copies in the network stack and | ||
12 | RAID operations in the MD driver. | ||
11 | 13 | ||
12 | if DMADEVICES | 14 | if DMADEVICES |
13 | 15 | ||
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index c9b9081831da..436a855a4c60 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c | |||
@@ -437,6 +437,21 @@ static void ar_context_run(struct ar_context *ctx) | |||
437 | flush_writes(ctx->ohci); | 437 | flush_writes(ctx->ohci); |
438 | } | 438 | } |
439 | 439 | ||
440 | static struct descriptor * | ||
441 | find_branch_descriptor(struct descriptor *d, int z) | ||
442 | { | ||
443 | int b, key; | ||
444 | |||
445 | b = (le16_to_cpu(d->control) & DESCRIPTOR_BRANCH_ALWAYS) >> 2; | ||
446 | key = (le16_to_cpu(d->control) & DESCRIPTOR_KEY_IMMEDIATE) >> 8; | ||
447 | |||
448 | /* figure out which descriptor the branch address goes in */ | ||
449 | if (z == 2 && (b == 3 || key == 2)) | ||
450 | return d; | ||
451 | else | ||
452 | return d + z - 1; | ||
453 | } | ||
454 | |||
440 | static void context_tasklet(unsigned long data) | 455 | static void context_tasklet(unsigned long data) |
441 | { | 456 | { |
442 | struct context *ctx = (struct context *) data; | 457 | struct context *ctx = (struct context *) data; |
@@ -455,7 +470,7 @@ static void context_tasklet(unsigned long data) | |||
455 | address = le32_to_cpu(last->branch_address); | 470 | address = le32_to_cpu(last->branch_address); |
456 | z = address & 0xf; | 471 | z = address & 0xf; |
457 | d = ctx->buffer + (address - ctx->buffer_bus) / sizeof(*d); | 472 | d = ctx->buffer + (address - ctx->buffer_bus) / sizeof(*d); |
458 | last = (z == 2) ? d : d + z - 1; | 473 | last = find_branch_descriptor(d, z); |
459 | 474 | ||
460 | if (!ctx->callback(ctx, d, last)) | 475 | if (!ctx->callback(ctx, d, last)) |
461 | break; | 476 | break; |
@@ -566,7 +581,7 @@ static void context_append(struct context *ctx, | |||
566 | 581 | ||
567 | ctx->head_descriptor = d + z + extra; | 582 | ctx->head_descriptor = d + z + extra; |
568 | ctx->prev_descriptor->branch_address = cpu_to_le32(d_bus | z); | 583 | ctx->prev_descriptor->branch_address = cpu_to_le32(d_bus | z); |
569 | ctx->prev_descriptor = z == 2 ? d : d + z - 1; | 584 | ctx->prev_descriptor = find_branch_descriptor(d, z); |
570 | 585 | ||
571 | dma_sync_single_for_device(ctx->ohci->card.device, ctx->buffer_bus, | 586 | dma_sync_single_for_device(ctx->ohci->card.device, ctx->buffer_bus, |
572 | ctx->buffer_size, DMA_TO_DEVICE); | 587 | ctx->buffer_size, DMA_TO_DEVICE); |
@@ -655,7 +670,7 @@ at_context_queue_packet(struct context *ctx, struct fw_packet *packet) | |||
655 | driver_data = (struct driver_data *) &d[3]; | 670 | driver_data = (struct driver_data *) &d[3]; |
656 | driver_data->packet = packet; | 671 | driver_data->packet = packet; |
657 | packet->driver_data = driver_data; | 672 | packet->driver_data = driver_data; |
658 | 673 | ||
659 | if (packet->payload_length > 0) { | 674 | if (packet->payload_length > 0) { |
660 | payload_bus = | 675 | payload_bus = |
661 | dma_map_single(ohci->card.device, packet->payload, | 676 | dma_map_single(ohci->card.device, packet->payload, |
@@ -903,7 +918,7 @@ at_context_transmit(struct context *ctx, struct fw_packet *packet) | |||
903 | 918 | ||
904 | if (retval < 0) | 919 | if (retval < 0) |
905 | packet->callback(packet, &ctx->ohci->card, packet->ack); | 920 | packet->callback(packet, &ctx->ohci->card, packet->ack); |
906 | 921 | ||
907 | } | 922 | } |
908 | 923 | ||
909 | static void bus_reset_tasklet(unsigned long data) | 924 | static void bus_reset_tasklet(unsigned long data) |
@@ -1431,6 +1446,57 @@ static int handle_ir_dualbuffer_packet(struct context *context, | |||
1431 | return 1; | 1446 | return 1; |
1432 | } | 1447 | } |
1433 | 1448 | ||
1449 | static int handle_ir_packet_per_buffer(struct context *context, | ||
1450 | struct descriptor *d, | ||
1451 | struct descriptor *last) | ||
1452 | { | ||
1453 | struct iso_context *ctx = | ||
1454 | container_of(context, struct iso_context, context); | ||
1455 | struct descriptor *pd = d + 1; | ||
1456 | __le32 *ir_header; | ||
1457 | size_t header_length; | ||
1458 | void *p, *end; | ||
1459 | int i, z; | ||
1460 | |||
1461 | if (pd->res_count == pd->req_count) | ||
1462 | /* Descriptor(s) not done yet, stop iteration */ | ||
1463 | return 0; | ||
1464 | |||
1465 | header_length = le16_to_cpu(d->req_count); | ||
1466 | |||
1467 | i = ctx->header_length; | ||
1468 | z = le32_to_cpu(pd->branch_address) & 0xf; | ||
1469 | p = d + z; | ||
1470 | end = p + header_length; | ||
1471 | |||
1472 | while (p < end && i + ctx->base.header_size <= PAGE_SIZE) { | ||
1473 | /* | ||
1474 | * The iso header is byteswapped to little endian by | ||
1475 | * the controller, but the remaining header quadlets | ||
1476 | * are big endian. We want to present all the headers | ||
1477 | * as big endian, so we have to swap the first quadlet. | ||
1478 | */ | ||
1479 | *(u32 *) (ctx->header + i) = __swab32(*(u32 *) (p + 4)); | ||
1480 | memcpy(ctx->header + i + 4, p + 8, ctx->base.header_size - 4); | ||
1481 | i += ctx->base.header_size; | ||
1482 | p += ctx->base.header_size + 4; | ||
1483 | } | ||
1484 | |||
1485 | ctx->header_length = i; | ||
1486 | |||
1487 | if (le16_to_cpu(pd->control) & DESCRIPTOR_IRQ_ALWAYS) { | ||
1488 | ir_header = (__le32 *) (d + z); | ||
1489 | ctx->base.callback(&ctx->base, | ||
1490 | le32_to_cpu(ir_header[0]) & 0xffff, | ||
1491 | ctx->header_length, ctx->header, | ||
1492 | ctx->base.callback_data); | ||
1493 | ctx->header_length = 0; | ||
1494 | } | ||
1495 | |||
1496 | |||
1497 | return 1; | ||
1498 | } | ||
1499 | |||
1434 | static int handle_it_packet(struct context *context, | 1500 | static int handle_it_packet(struct context *context, |
1435 | struct descriptor *d, | 1501 | struct descriptor *d, |
1436 | struct descriptor *last) | 1502 | struct descriptor *last) |
@@ -1466,14 +1532,12 @@ ohci_allocate_iso_context(struct fw_card *card, int type, size_t header_size) | |||
1466 | } else { | 1532 | } else { |
1467 | mask = &ohci->ir_context_mask; | 1533 | mask = &ohci->ir_context_mask; |
1468 | list = ohci->ir_context_list; | 1534 | list = ohci->ir_context_list; |
1469 | callback = handle_ir_dualbuffer_packet; | 1535 | if (ohci->version >= OHCI_VERSION_1_1) |
1536 | callback = handle_ir_dualbuffer_packet; | ||
1537 | else | ||
1538 | callback = handle_ir_packet_per_buffer; | ||
1470 | } | 1539 | } |
1471 | 1540 | ||
1472 | /* FIXME: We need a fallback for pre 1.1 OHCI. */ | ||
1473 | if (callback == handle_ir_dualbuffer_packet && | ||
1474 | ohci->version < OHCI_VERSION_1_1) | ||
1475 | return ERR_PTR(-ENOSYS); | ||
1476 | |||
1477 | spin_lock_irqsave(&ohci->lock, flags); | 1541 | spin_lock_irqsave(&ohci->lock, flags); |
1478 | index = ffs(*mask) - 1; | 1542 | index = ffs(*mask) - 1; |
1479 | if (index >= 0) | 1543 | if (index >= 0) |
@@ -1532,7 +1596,9 @@ static int ohci_start_iso(struct fw_iso_context *base, | |||
1532 | context_run(&ctx->context, match); | 1596 | context_run(&ctx->context, match); |
1533 | } else { | 1597 | } else { |
1534 | index = ctx - ohci->ir_context_list; | 1598 | index = ctx - ohci->ir_context_list; |
1535 | control = IR_CONTEXT_DUAL_BUFFER_MODE | IR_CONTEXT_ISOCH_HEADER; | 1599 | control = IR_CONTEXT_ISOCH_HEADER; |
1600 | if (ohci->version >= OHCI_VERSION_1_1) | ||
1601 | control |= IR_CONTEXT_DUAL_BUFFER_MODE; | ||
1536 | match = (tags << 28) | (sync << 8) | ctx->base.channel; | 1602 | match = (tags << 28) | (sync << 8) | ctx->base.channel; |
1537 | if (cycle >= 0) { | 1603 | if (cycle >= 0) { |
1538 | match |= (cycle & 0x07fff) << 12; | 1604 | match |= (cycle & 0x07fff) << 12; |
@@ -1738,7 +1804,6 @@ ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base, | |||
1738 | offset = payload & ~PAGE_MASK; | 1804 | offset = payload & ~PAGE_MASK; |
1739 | rest = p->payload_length; | 1805 | rest = p->payload_length; |
1740 | 1806 | ||
1741 | /* FIXME: OHCI 1.0 doesn't support dual buffer receive */ | ||
1742 | /* FIXME: make packet-per-buffer/dual-buffer a context option */ | 1807 | /* FIXME: make packet-per-buffer/dual-buffer a context option */ |
1743 | while (rest > 0) { | 1808 | while (rest > 0) { |
1744 | d = context_get_descriptors(&ctx->context, | 1809 | d = context_get_descriptors(&ctx->context, |
@@ -1777,6 +1842,81 @@ ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base, | |||
1777 | } | 1842 | } |
1778 | 1843 | ||
1779 | static int | 1844 | static int |
1845 | ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base, | ||
1846 | struct fw_iso_packet *packet, | ||
1847 | struct fw_iso_buffer *buffer, | ||
1848 | unsigned long payload) | ||
1849 | { | ||
1850 | struct iso_context *ctx = container_of(base, struct iso_context, base); | ||
1851 | struct descriptor *d = NULL, *pd = NULL; | ||
1852 | struct fw_iso_packet *p; | ||
1853 | dma_addr_t d_bus, page_bus; | ||
1854 | u32 z, header_z, rest; | ||
1855 | int i, page, offset, packet_count, header_size; | ||
1856 | |||
1857 | if (packet->skip) { | ||
1858 | d = context_get_descriptors(&ctx->context, 1, &d_bus); | ||
1859 | if (d == NULL) | ||
1860 | return -ENOMEM; | ||
1861 | |||
1862 | d->control = cpu_to_le16(DESCRIPTOR_STATUS | | ||
1863 | DESCRIPTOR_INPUT_LAST | | ||
1864 | DESCRIPTOR_BRANCH_ALWAYS | | ||
1865 | DESCRIPTOR_WAIT); | ||
1866 | context_append(&ctx->context, d, 1, 0); | ||
1867 | } | ||
1868 | |||
1869 | /* one descriptor for header, one for payload */ | ||
1870 | /* FIXME: handle cases where we need multiple desc. for payload */ | ||
1871 | z = 2; | ||
1872 | p = packet; | ||
1873 | |||
1874 | /* | ||
1875 | * The OHCI controller puts the status word in the | ||
1876 | * buffer too, so we need 4 extra bytes per packet. | ||
1877 | */ | ||
1878 | packet_count = p->header_length / ctx->base.header_size; | ||
1879 | header_size = packet_count * (ctx->base.header_size + 4); | ||
1880 | |||
1881 | /* Get header size in number of descriptors. */ | ||
1882 | header_z = DIV_ROUND_UP(header_size, sizeof(*d)); | ||
1883 | page = payload >> PAGE_SHIFT; | ||
1884 | offset = payload & ~PAGE_MASK; | ||
1885 | rest = p->payload_length; | ||
1886 | |||
1887 | for (i = 0; i < packet_count; i++) { | ||
1888 | /* d points to the header descriptor */ | ||
1889 | d = context_get_descriptors(&ctx->context, | ||
1890 | z + header_z, &d_bus); | ||
1891 | if (d == NULL) | ||
1892 | return -ENOMEM; | ||
1893 | |||
1894 | d->control = cpu_to_le16(DESCRIPTOR_INPUT_MORE); | ||
1895 | d->req_count = cpu_to_le16(header_size); | ||
1896 | d->res_count = d->req_count; | ||
1897 | d->data_address = cpu_to_le32(d_bus + (z * sizeof(*d))); | ||
1898 | |||
1899 | /* pd points to the payload descriptor */ | ||
1900 | pd = d + 1; | ||
1901 | pd->control = cpu_to_le16(DESCRIPTOR_STATUS | | ||
1902 | DESCRIPTOR_INPUT_LAST | | ||
1903 | DESCRIPTOR_BRANCH_ALWAYS); | ||
1904 | if (p->interrupt) | ||
1905 | pd->control |= cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS); | ||
1906 | |||
1907 | pd->req_count = cpu_to_le16(rest); | ||
1908 | pd->res_count = pd->req_count; | ||
1909 | |||
1910 | page_bus = page_private(buffer->pages[page]); | ||
1911 | pd->data_address = cpu_to_le32(page_bus + offset); | ||
1912 | |||
1913 | context_append(&ctx->context, d, z, header_z); | ||
1914 | } | ||
1915 | |||
1916 | return 0; | ||
1917 | } | ||
1918 | |||
1919 | static int | ||
1780 | ohci_queue_iso(struct fw_iso_context *base, | 1920 | ohci_queue_iso(struct fw_iso_context *base, |
1781 | struct fw_iso_packet *packet, | 1921 | struct fw_iso_packet *packet, |
1782 | struct fw_iso_buffer *buffer, | 1922 | struct fw_iso_buffer *buffer, |
@@ -1790,8 +1930,9 @@ ohci_queue_iso(struct fw_iso_context *base, | |||
1790 | return ohci_queue_iso_receive_dualbuffer(base, packet, | 1930 | return ohci_queue_iso_receive_dualbuffer(base, packet, |
1791 | buffer, payload); | 1931 | buffer, payload); |
1792 | else | 1932 | else |
1793 | /* FIXME: Implement fallback for OHCI 1.0 controllers. */ | 1933 | return ohci_queue_iso_receive_packet_per_buffer(base, packet, |
1794 | return -ENOSYS; | 1934 | buffer, |
1935 | payload); | ||
1795 | } | 1936 | } |
1796 | 1937 | ||
1797 | static const struct fw_card_driver ohci_driver = { | 1938 | static const struct fw_card_driver ohci_driver = { |
@@ -1911,12 +2052,6 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
1911 | ohci->version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; | 2052 | ohci->version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; |
1912 | fw_notify("Added fw-ohci device %s, OHCI version %x.%x\n", | 2053 | fw_notify("Added fw-ohci device %s, OHCI version %x.%x\n", |
1913 | dev->dev.bus_id, ohci->version >> 16, ohci->version & 0xff); | 2054 | dev->dev.bus_id, ohci->version >> 16, ohci->version & 0xff); |
1914 | if (ohci->version < OHCI_VERSION_1_1) { | ||
1915 | fw_notify(" Isochronous I/O is not yet implemented for " | ||
1916 | "OHCI 1.0 chips.\n"); | ||
1917 | fw_notify(" Cameras, audio devices etc. won't work on " | ||
1918 | "this controller with this driver version.\n"); | ||
1919 | } | ||
1920 | return 0; | 2055 | return 0; |
1921 | 2056 | ||
1922 | fail_self_id: | 2057 | fail_self_id: |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 5c82ec7f8bbd..3ee60d26e3a2 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -337,11 +337,10 @@ static int coretemp_cpu_callback(struct notifier_block *nfb, | |||
337 | 337 | ||
338 | switch (action) { | 338 | switch (action) { |
339 | case CPU_ONLINE: | 339 | case CPU_ONLINE: |
340 | case CPU_ONLINE_FROZEN: | 340 | case CPU_DOWN_FAILED: |
341 | coretemp_device_add(cpu); | 341 | coretemp_device_add(cpu); |
342 | break; | 342 | break; |
343 | case CPU_DEAD: | 343 | case CPU_DOWN_PREPARE: |
344 | case CPU_DEAD_FROZEN: | ||
345 | coretemp_device_remove(cpu); | 344 | coretemp_device_remove(cpu); |
346 | break; | 345 | break; |
347 | } | 346 | } |
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index bd7aaff35240..67679882ebef 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -404,7 +404,7 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id) | |||
404 | DAVINCI_I2C_STR_REG, | 404 | DAVINCI_I2C_STR_REG, |
405 | w); | 405 | w); |
406 | } else | 406 | } else |
407 | dev_err(dev->dev, "RDR IRQ while no" | 407 | dev_err(dev->dev, "RDR IRQ while no " |
408 | "data requested\n"); | 408 | "data requested\n"); |
409 | break; | 409 | break; |
410 | 410 | ||
@@ -423,7 +423,7 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id) | |||
423 | DAVINCI_I2C_IMR_REG, | 423 | DAVINCI_I2C_IMR_REG, |
424 | w); | 424 | w); |
425 | } else | 425 | } else |
426 | dev_err(dev->dev, "TDR IRQ while no data to" | 426 | dev_err(dev->dev, "TDR IRQ while no data to " |
427 | "send\n"); | 427 | "send\n"); |
428 | break; | 428 | break; |
429 | 429 | ||
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index 44e1cd21bb01..3ca19fc234fb 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c | |||
@@ -140,6 +140,7 @@ static int __init i2c_gpio_probe(struct platform_device *pdev) | |||
140 | adap->owner = THIS_MODULE; | 140 | adap->owner = THIS_MODULE; |
141 | snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id); | 141 | snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id); |
142 | adap->algo_data = bit_data; | 142 | adap->algo_data = bit_data; |
143 | adap->class = I2C_CLASS_HWMON; | ||
143 | adap->dev.parent = &pdev->dev; | 144 | adap->dev.parent = &pdev->dev; |
144 | 145 | ||
145 | /* | 146 | /* |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 89a30028ddb6..cb55cf2ba1e9 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -203,7 +203,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) | |||
203 | while (!(omap_i2c_read_reg(dev, OMAP_I2C_SYSS_REG) & | 203 | while (!(omap_i2c_read_reg(dev, OMAP_I2C_SYSS_REG) & |
204 | OMAP_I2C_SYSS_RDONE)) { | 204 | OMAP_I2C_SYSS_RDONE)) { |
205 | if (time_after(jiffies, timeout)) { | 205 | if (time_after(jiffies, timeout)) { |
206 | dev_warn(dev->dev, "timeout waiting" | 206 | dev_warn(dev->dev, "timeout waiting " |
207 | "for controller reset\n"); | 207 | "for controller reset\n"); |
208 | return -ETIMEDOUT; | 208 | return -ETIMEDOUT; |
209 | } | 209 | } |
@@ -483,7 +483,7 @@ omap_i2c_isr(int this_irq, void *dev_id) | |||
483 | dev->buf_len--; | 483 | dev->buf_len--; |
484 | } | 484 | } |
485 | } else | 485 | } else |
486 | dev_err(dev->dev, "RRDY IRQ while no data" | 486 | dev_err(dev->dev, "RRDY IRQ while no data " |
487 | "requested\n"); | 487 | "requested\n"); |
488 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RRDY); | 488 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RRDY); |
489 | continue; | 489 | continue; |
@@ -498,7 +498,7 @@ omap_i2c_isr(int this_irq, void *dev_id) | |||
498 | dev->buf_len--; | 498 | dev->buf_len--; |
499 | } | 499 | } |
500 | } else | 500 | } else |
501 | dev_err(dev->dev, "XRDY IRQ while no" | 501 | dev_err(dev->dev, "XRDY IRQ while no " |
502 | "data to send\n"); | 502 | "data to send\n"); |
503 | omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w); | 503 | omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w); |
504 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XRDY); | 504 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XRDY); |
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c index fe04e46991aa..b767603a07ba 100644 --- a/drivers/i2c/chips/isp1301_omap.c +++ b/drivers/i2c/chips/isp1301_omap.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/usb/ch9.h> | 28 | #include <linux/usb/ch9.h> |
29 | #include <linux/usb_gadget.h> | 29 | #include <linux/usb/gadget.h> |
30 | #include <linux/usb.h> | 30 | #include <linux/usb.h> |
31 | #include <linux/usb/otg.h> | 31 | #include <linux/usb/otg.h> |
32 | #include <linux/i2c.h> | 32 | #include <linux/i2c.h> |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index e445fe6e4ba9..45b22282f149 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -313,7 +313,6 @@ comment "IDE chipset support/bugfixes" | |||
313 | 313 | ||
314 | config IDE_GENERIC | 314 | config IDE_GENERIC |
315 | tristate "generic/default IDE chipset support" | 315 | tristate "generic/default IDE chipset support" |
316 | default H8300 | ||
317 | help | 316 | help |
318 | If unsure, say N. | 317 | If unsure, say N. |
319 | 318 | ||
@@ -484,6 +483,7 @@ config WDC_ALI15X3 | |||
484 | 483 | ||
485 | config BLK_DEV_AMD74XX | 484 | config BLK_DEV_AMD74XX |
486 | tristate "AMD and nVidia IDE support" | 485 | tristate "AMD and nVidia IDE support" |
486 | depends on !ARM | ||
487 | select BLK_DEV_IDEDMA_PCI | 487 | select BLK_DEV_IDEDMA_PCI |
488 | help | 488 | help |
489 | This driver adds explicit support for AMD-7xx and AMD-8111 chips | 489 | This driver adds explicit support for AMD-7xx and AMD-8111 chips |
@@ -883,6 +883,49 @@ config BLK_DEV_IDE_BAST | |||
883 | Say Y here if you want to support the onboard IDE channels on the | 883 | Say Y here if you want to support the onboard IDE channels on the |
884 | Simtec BAST or the Thorcom VR1000 | 884 | Simtec BAST or the Thorcom VR1000 |
885 | 885 | ||
886 | config ETRAX_IDE | ||
887 | bool "ETRAX IDE support" | ||
888 | depends on CRIS && BROKEN | ||
889 | select BLK_DEV_IDEDMA | ||
890 | select IDE_GENERIC | ||
891 | help | ||
892 | Enables the ETRAX IDE driver. | ||
893 | |||
894 | You can't use parallel ports or SCSI ports at the same time. | ||
895 | |||
896 | config ETRAX_IDE_DELAY | ||
897 | int "Delay for drives to regain consciousness" | ||
898 | depends on ETRAX_IDE && ETRAX_ARCH_V10 | ||
899 | default 15 | ||
900 | help | ||
901 | Number of seconds to wait for IDE drives to spin up after an IDE | ||
902 | reset. | ||
903 | |||
904 | choice | ||
905 | prompt "IDE reset pin" | ||
906 | depends on ETRAX_IDE && ETRAX_ARCH_V10 | ||
907 | default ETRAX_IDE_PB7_RESET | ||
908 | |||
909 | config ETRAX_IDE_PB7_RESET | ||
910 | bool "Port_PB_Bit_7" | ||
911 | help | ||
912 | IDE reset on pin 7 on port B | ||
913 | |||
914 | config ETRAX_IDE_G27_RESET | ||
915 | bool "Port_G_Bit_27" | ||
916 | help | ||
917 | IDE reset on pin 27 on port G | ||
918 | |||
919 | endchoice | ||
920 | |||
921 | config IDE_H8300 | ||
922 | bool "H8300 IDE support" | ||
923 | depends on H8300 | ||
924 | select IDE_GENERIC | ||
925 | default y | ||
926 | help | ||
927 | Enables the H8300 IDE driver. | ||
928 | |||
886 | config BLK_DEV_GAYLE | 929 | config BLK_DEV_GAYLE |
887 | bool "Amiga Gayle IDE interface support" | 930 | bool "Amiga Gayle IDE interface support" |
888 | depends on AMIGA | 931 | depends on AMIGA |
@@ -963,7 +1006,7 @@ config BLK_DEV_Q40IDE | |||
963 | 1006 | ||
964 | config BLK_DEV_MPC8xx_IDE | 1007 | config BLK_DEV_MPC8xx_IDE |
965 | bool "MPC8xx IDE support" | 1008 | bool "MPC8xx IDE support" |
966 | depends on 8xx && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE | 1009 | depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE |
967 | select IDE_GENERIC | 1010 | select IDE_GENERIC |
968 | help | 1011 | help |
969 | This option provides support for IDE on Motorola MPC8xx Systems. | 1012 | This option provides support for IDE on Motorola MPC8xx Systems. |
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index 75dc6969e0a7..b181fc672057 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile | |||
@@ -39,7 +39,7 @@ ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o | |||
39 | ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o | 39 | ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o |
40 | 40 | ||
41 | # built-in only drivers from h8300/ | 41 | # built-in only drivers from h8300/ |
42 | ide-core-$(CONFIG_H8300) += h8300/ide-h8300.o | 42 | ide-core-$(CONFIG_IDE_H8300) += h8300/ide-h8300.o |
43 | 43 | ||
44 | obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o | 44 | obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o |
45 | obj-$(CONFIG_IDE_GENERIC) += ide-generic.o | 45 | obj-$(CONFIG_IDE_GENERIC) += ide-generic.o |
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 7f5bc2ee6c7e..476e0d65ed43 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
@@ -773,15 +773,16 @@ init_e100_ide (void) | |||
773 | /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */ | 773 | /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */ |
774 | ide_offsets[IDE_CONTROL_OFFSET] = cris_ide_reg_addr(6, 1, 0); | 774 | ide_offsets[IDE_CONTROL_OFFSET] = cris_ide_reg_addr(6, 1, 0); |
775 | 775 | ||
776 | /* first fill in some stuff in the ide_hwifs fields */ | 776 | for (h = 0; h < 4; h++) { |
777 | ide_hwif_t *hwif = NULL; | ||
777 | 778 | ||
778 | for(h = 0; h < MAX_HWIFS; h++) { | ||
779 | ide_hwif_t *hwif = &ide_hwifs[h]; | ||
780 | ide_setup_ports(&hw, cris_ide_base_address(h), | 779 | ide_setup_ports(&hw, cris_ide_base_address(h), |
781 | ide_offsets, | 780 | ide_offsets, |
782 | 0, 0, cris_ide_ack_intr, | 781 | 0, 0, cris_ide_ack_intr, |
783 | ide_default_irq(0)); | 782 | ide_default_irq(0)); |
784 | ide_register_hw(&hw, NULL, 1, &hwif); | 783 | ide_register_hw(&hw, NULL, 1, &hwif); |
784 | if (hwif == NULL) | ||
785 | continue; | ||
785 | hwif->mmio = 1; | 786 | hwif->mmio = 1; |
786 | hwif->chipset = ide_etrax100; | 787 | hwif->chipset = ide_etrax100; |
787 | hwif->set_pio_mode = &cris_set_pio_mode; | 788 | hwif->set_pio_mode = &cris_set_pio_mode; |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index e3add70b9cd8..0d795a1678c7 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -130,6 +130,7 @@ static const struct drive_list_entry drive_blacklist [] = { | |||
130 | { "_NEC DV5800A", NULL }, | 130 | { "_NEC DV5800A", NULL }, |
131 | { "SAMSUNG CD-ROM SN-124", "N001" }, | 131 | { "SAMSUNG CD-ROM SN-124", "N001" }, |
132 | { "Seagate STT20000A", NULL }, | 132 | { "Seagate STT20000A", NULL }, |
133 | { "CD-ROM CDR_U200", "1.09" }, | ||
133 | { NULL , NULL } | 134 | { NULL , NULL } |
134 | 135 | ||
135 | }; | 136 | }; |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index e17a9ee120ea..5c3256180ae5 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -303,9 +303,6 @@ void default_hwif_transport(ide_hwif_t *hwif) | |||
303 | hwif->atapi_output_bytes = atapi_output_bytes; | 303 | hwif->atapi_output_bytes = atapi_output_bytes; |
304 | } | 304 | } |
305 | 305 | ||
306 | /* | ||
307 | * Beginning of Taskfile OPCODE Library and feature sets. | ||
308 | */ | ||
309 | void ide_fix_driveid (struct hd_driveid *id) | 306 | void ide_fix_driveid (struct hd_driveid *id) |
310 | { | 307 | { |
311 | #ifndef __LITTLE_ENDIAN | 308 | #ifndef __LITTLE_ENDIAN |
@@ -592,6 +589,9 @@ EXPORT_SYMBOL_GPL(ide_in_drive_list); | |||
592 | static const struct drive_list_entry ivb_list[] = { | 589 | static const struct drive_list_entry ivb_list[] = { |
593 | { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, | 590 | { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, |
594 | { "TSSTcorp CDDVDW SH-S202J" , "SB00" }, | 591 | { "TSSTcorp CDDVDW SH-S202J" , "SB00" }, |
592 | { "TSSTcorp CDDVDW SH-S202J" , "SB01" }, | ||
593 | { "TSSTcorp CDDVDW SH-S202N" , "SB00" }, | ||
594 | { "TSSTcorp CDDVDW SH-S202N" , "SB01" }, | ||
595 | { NULL , NULL } | 595 | { NULL , NULL } |
596 | }; | 596 | }; |
597 | 597 | ||
@@ -756,7 +756,7 @@ int ide_driveid_update(ide_drive_t *drive) | |||
756 | int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | 756 | int ide_config_drive_speed(ide_drive_t *drive, u8 speed) |
757 | { | 757 | { |
758 | ide_hwif_t *hwif = drive->hwif; | 758 | ide_hwif_t *hwif = drive->hwif; |
759 | int error; | 759 | int error = 0; |
760 | u8 stat; | 760 | u8 stat; |
761 | 761 | ||
762 | // while (HWGROUP(drive)->busy) | 762 | // while (HWGROUP(drive)->busy) |
@@ -767,6 +767,10 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
767 | hwif->dma_host_off(drive); | 767 | hwif->dma_host_off(drive); |
768 | #endif | 768 | #endif |
769 | 769 | ||
770 | /* Skip setting PIO flow-control modes on pre-EIDE drives */ | ||
771 | if ((speed & 0xf8) == XFER_PIO_0 && !(drive->id->capability & 0x08)) | ||
772 | goto skip; | ||
773 | |||
770 | /* | 774 | /* |
771 | * Don't use ide_wait_cmd here - it will | 775 | * Don't use ide_wait_cmd here - it will |
772 | * attempt to set_geometry and recalibrate, | 776 | * attempt to set_geometry and recalibrate, |
@@ -814,6 +818,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
814 | drive->id->dma_mword &= ~0x0F00; | 818 | drive->id->dma_mword &= ~0x0F00; |
815 | drive->id->dma_1word &= ~0x0F00; | 819 | drive->id->dma_1word &= ~0x0F00; |
816 | 820 | ||
821 | skip: | ||
817 | #ifdef CONFIG_BLK_DEV_IDEDMA | 822 | #ifdef CONFIG_BLK_DEV_IDEDMA |
818 | if (speed >= XFER_SW_DMA_0) | 823 | if (speed >= XFER_SW_DMA_0) |
819 | hwif->dma_host_on(drive); | 824 | hwif->dma_host_on(drive); |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 56fb0b843429..ee848c705995 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -644,7 +644,7 @@ static void hwif_register (ide_hwif_t *hwif) | |||
644 | 644 | ||
645 | static int wait_hwif_ready(ide_hwif_t *hwif) | 645 | static int wait_hwif_ready(ide_hwif_t *hwif) |
646 | { | 646 | { |
647 | int rc; | 647 | int unit, rc; |
648 | 648 | ||
649 | printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name); | 649 | printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name); |
650 | 650 | ||
@@ -661,20 +661,26 @@ static int wait_hwif_ready(ide_hwif_t *hwif) | |||
661 | return rc; | 661 | return rc; |
662 | 662 | ||
663 | /* Now make sure both master & slave are ready */ | 663 | /* Now make sure both master & slave are ready */ |
664 | SELECT_DRIVE(&hwif->drives[0]); | 664 | for (unit = 0; unit < MAX_DRIVES; unit++) { |
665 | hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]); | 665 | ide_drive_t *drive = &hwif->drives[unit]; |
666 | mdelay(2); | ||
667 | rc = ide_wait_not_busy(hwif, 35000); | ||
668 | if (rc) | ||
669 | return rc; | ||
670 | SELECT_DRIVE(&hwif->drives[1]); | ||
671 | hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]); | ||
672 | mdelay(2); | ||
673 | rc = ide_wait_not_busy(hwif, 35000); | ||
674 | 666 | ||
667 | /* Ignore disks that we will not probe for later. */ | ||
668 | if (!drive->noprobe || drive->present) { | ||
669 | SELECT_DRIVE(drive); | ||
670 | hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]); | ||
671 | mdelay(2); | ||
672 | rc = ide_wait_not_busy(hwif, 35000); | ||
673 | if (rc) | ||
674 | goto out; | ||
675 | } else | ||
676 | printk(KERN_DEBUG "%s: ide_wait_not_busy() skipped\n", | ||
677 | drive->name); | ||
678 | } | ||
679 | out: | ||
675 | /* Exit function with master reselected (let's be sane) */ | 680 | /* Exit function with master reselected (let's be sane) */ |
676 | SELECT_DRIVE(&hwif->drives[0]); | 681 | if (unit) |
677 | 682 | SELECT_DRIVE(&hwif->drives[0]); | |
683 | |||
678 | return rc; | 684 | return rc; |
679 | } | 685 | } |
680 | 686 | ||
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index 10311ecc674a..38c3a6d63f30 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c | |||
@@ -53,12 +53,13 @@ | |||
53 | 53 | ||
54 | /* port addresses for auto-detection */ | 54 | /* port addresses for auto-detection */ |
55 | #define ALI_NUM_PORTS 4 | 55 | #define ALI_NUM_PORTS 4 |
56 | static int ports[ALI_NUM_PORTS] __initdata = {0x074, 0x0f4, 0x034, 0x0e4}; | 56 | static const int ports[ALI_NUM_PORTS] __initdata = |
57 | { 0x074, 0x0f4, 0x034, 0x0e4 }; | ||
57 | 58 | ||
58 | /* register initialization data */ | 59 | /* register initialization data */ |
59 | typedef struct { u8 reg, data; } RegInitializer; | 60 | typedef struct { u8 reg, data; } RegInitializer; |
60 | 61 | ||
61 | static RegInitializer initData[] __initdata = { | 62 | static const RegInitializer initData[] __initdata = { |
62 | {0x01, 0x0f}, {0x02, 0x00}, {0x03, 0x00}, {0x04, 0x00}, | 63 | {0x01, 0x0f}, {0x02, 0x00}, {0x03, 0x00}, {0x04, 0x00}, |
63 | {0x05, 0x00}, {0x06, 0x00}, {0x07, 0x2b}, {0x0a, 0x0f}, | 64 | {0x05, 0x00}, {0x06, 0x00}, {0x07, 0x2b}, {0x0a, 0x0f}, |
64 | {0x25, 0x00}, {0x26, 0x00}, {0x27, 0x00}, {0x28, 0x00}, | 65 | {0x25, 0x00}, {0x26, 0x00}, {0x27, 0x00}, {0x28, 0x00}, |
@@ -177,7 +178,7 @@ static int __init findPort (void) | |||
177 | * Initialize controller registers with default values. | 178 | * Initialize controller registers with default values. |
178 | */ | 179 | */ |
179 | static int __init initRegisters (void) { | 180 | static int __init initRegisters (void) { |
180 | RegInitializer *p; | 181 | const RegInitializer *p; |
181 | u8 t; | 182 | u8 t; |
182 | unsigned long flags; | 183 | unsigned long flags; |
183 | 184 | ||
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index e87cd2f16430..5c6aa77c2370 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c | |||
@@ -81,7 +81,7 @@ int macide_ack_intr(ide_hwif_t* hwif) | |||
81 | * Probe for a Macintosh IDE interface | 81 | * Probe for a Macintosh IDE interface |
82 | */ | 82 | */ |
83 | 83 | ||
84 | void macide_init(void) | 84 | void __init macide_init(void) |
85 | { | 85 | { |
86 | hw_regs_t hw; | 86 | hw_regs_t hw; |
87 | ide_hwif_t *hwif; | 87 | ide_hwif_t *hwif; |
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index a73db1bd482d..6ea46a6723e2 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c | |||
@@ -111,7 +111,7 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={ | |||
111 | * Probe for Q40 IDE interfaces | 111 | * Probe for Q40 IDE interfaces |
112 | */ | 112 | */ |
113 | 113 | ||
114 | void q40ide_init(void) | 114 | void __init q40ide_init(void) |
115 | { | 115 | { |
116 | int i; | 116 | int i; |
117 | ide_hwif_t *hwif; | 117 | ide_hwif_t *hwif; |
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 19ec421f7b9f..44268504ae43 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -260,6 +260,11 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi | |||
260 | { | 260 | { |
261 | struct ide_port_info d; | 261 | struct ide_port_info d; |
262 | u8 idx = id->driver_data; | 262 | u8 idx = id->driver_data; |
263 | int err; | ||
264 | |||
265 | err = pci_enable_device(dev); | ||
266 | if (err) | ||
267 | return err; | ||
263 | 268 | ||
264 | d = aec62xx_chipsets[idx]; | 269 | d = aec62xx_chipsets[idx]; |
265 | 270 | ||
@@ -272,7 +277,11 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi | |||
272 | } | 277 | } |
273 | } | 278 | } |
274 | 279 | ||
275 | return ide_setup_pci_device(dev, &d); | 280 | err = ide_setup_pci_device(dev, &d); |
281 | if (err) | ||
282 | pci_disable_device(dev); | ||
283 | |||
284 | return err; | ||
276 | } | 285 | } |
277 | 286 | ||
278 | static const struct pci_device_id aec62xx_pci_tbl[] = { | 287 | static const struct pci_device_id aec62xx_pci_tbl[] = { |
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index a607dd31a64c..ce293936af4b 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -603,6 +603,11 @@ static int ali_cable_override(struct pci_dev *pdev) | |||
603 | pdev->subsystem_device == 0x10AF) | 603 | pdev->subsystem_device == 0x10AF) |
604 | return 1; | 604 | return 1; |
605 | 605 | ||
606 | /* Mitac 8317 (Winbook-A) and relatives */ | ||
607 | if (pdev->subsystem_vendor == 0x1071 && | ||
608 | pdev->subsystem_device == 0x8317) | ||
609 | return 1; | ||
610 | |||
606 | /* Systems by DMI */ | 611 | /* Systems by DMI */ |
607 | if (dmi_check_system(cable_dmi_table)) | 612 | if (dmi_check_system(cable_dmi_table)) |
608 | return 1; | 613 | return 1; |
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 63625a0be712..27781d294cea 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
@@ -306,6 +306,7 @@ static const struct ich_laptop ich_laptop[] = { | |||
306 | { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ | 306 | { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ |
307 | { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ | 307 | { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ |
308 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ | 308 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ |
309 | { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ | ||
309 | { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on Acer Aspire 2023WLMi */ | 310 | { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on Acer Aspire 2023WLMi */ |
310 | /* end marker */ | 311 | /* end marker */ |
311 | { 0, } | 312 | { 0, } |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 6d99441c605b..5709c252543b 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/siimage.c Version 1.18 Oct 18 2007 | 2 | * linux/drivers/ide/pci/siimage.c Version 1.19 Nov 16 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2003 Red Hat <alan@redhat.com> | 5 | * Copyright (C) 2003 Red Hat <alan@redhat.com> |
@@ -460,48 +460,6 @@ static void sil_sata_pre_reset(ide_drive_t *drive) | |||
460 | } | 460 | } |
461 | 461 | ||
462 | /** | 462 | /** |
463 | * siimage_reset - reset a device on an siimage controller | ||
464 | * @drive: drive to reset | ||
465 | * | ||
466 | * Perform a controller level reset fo the device. For | ||
467 | * SATA we must also check the PHY. | ||
468 | */ | ||
469 | |||
470 | static void siimage_reset (ide_drive_t *drive) | ||
471 | { | ||
472 | ide_hwif_t *hwif = HWIF(drive); | ||
473 | u8 reset = 0; | ||
474 | unsigned long addr = siimage_selreg(hwif, 0); | ||
475 | |||
476 | if (hwif->mmio) { | ||
477 | reset = hwif->INB(addr); | ||
478 | hwif->OUTB((reset|0x03), addr); | ||
479 | /* FIXME:posting */ | ||
480 | udelay(25); | ||
481 | hwif->OUTB(reset, addr); | ||
482 | (void) hwif->INB(addr); | ||
483 | } else { | ||
484 | pci_read_config_byte(hwif->pci_dev, addr, &reset); | ||
485 | pci_write_config_byte(hwif->pci_dev, addr, reset|0x03); | ||
486 | udelay(25); | ||
487 | pci_write_config_byte(hwif->pci_dev, addr, reset); | ||
488 | pci_read_config_byte(hwif->pci_dev, addr, &reset); | ||
489 | } | ||
490 | |||
491 | if (SATA_STATUS_REG) { | ||
492 | /* SATA_STATUS_REG is valid only when in MMIO mode */ | ||
493 | u32 sata_stat = readl((void __iomem *)SATA_STATUS_REG); | ||
494 | printk(KERN_WARNING "%s: reset phy, status=0x%08x, %s\n", | ||
495 | hwif->name, sata_stat, __FUNCTION__); | ||
496 | if (!(sata_stat)) { | ||
497 | printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n", | ||
498 | hwif->name, sata_stat); | ||
499 | drive->failures++; | ||
500 | } | ||
501 | } | ||
502 | } | ||
503 | |||
504 | /** | ||
505 | * proc_reports_siimage - add siimage controller to proc | 463 | * proc_reports_siimage - add siimage controller to proc |
506 | * @dev: PCI device | 464 | * @dev: PCI device |
507 | * @clocking: SCSC value | 465 | * @clocking: SCSC value |
@@ -857,7 +815,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | |||
857 | { | 815 | { |
858 | u8 sata = is_sata(hwif); | 816 | u8 sata = is_sata(hwif); |
859 | 817 | ||
860 | hwif->resetproc = &siimage_reset; | ||
861 | hwif->set_pio_mode = &sil_set_pio_mode; | 818 | hwif->set_pio_mode = &sil_set_pio_mode; |
862 | hwif->set_dma_mode = &sil_set_dma_mode; | 819 | hwif->set_dma_mode = &sil_set_dma_mode; |
863 | 820 | ||
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index f6e2ab3dd166..d90b42917775 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -526,6 +526,7 @@ static const struct sis_laptop sis_laptop[] = { | |||
526 | /* devid, subvendor, subdev */ | 526 | /* devid, subvendor, subdev */ |
527 | { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ | 527 | { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ |
528 | { 0x5513, 0x1734, 0x105f }, /* FSC Amilo A1630 */ | 528 | { 0x5513, 0x1734, 0x105f }, /* FSC Amilo A1630 */ |
529 | { 0x5513, 0x1071, 0x8640 }, /* EasyNote K5305 */ | ||
529 | /* end marker */ | 530 | /* end marker */ |
530 | { 0, } | 531 | { 0, } |
531 | }; | 532 | }; |
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index 5011ba22e36c..0895e753a35d 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c | |||
@@ -240,9 +240,6 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive) | |||
240 | return (status == 0x00ff); | 240 | return (status == 0x00ff); |
241 | } | 241 | } |
242 | 242 | ||
243 | /* | ||
244 | * Invoked from ide-dma.c at boot time. | ||
245 | */ | ||
246 | static void __devinit init_hwif_trm290(ide_hwif_t *hwif) | 243 | static void __devinit init_hwif_trm290(ide_hwif_t *hwif) |
247 | { | 244 | { |
248 | unsigned int cfgbase = 0; | 245 | unsigned int cfgbase = 0; |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 5afdfef7264c..7f7a59885777 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1513,7 +1513,7 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) | |||
1513 | 1513 | ||
1514 | if (pmif->broken_dma && cur_addr & (L1_CACHE_BYTES - 1)) { | 1514 | if (pmif->broken_dma && cur_addr & (L1_CACHE_BYTES - 1)) { |
1515 | if (pmif->broken_dma_warn == 0) { | 1515 | if (pmif->broken_dma_warn == 0) { |
1516 | printk(KERN_WARNING "%s: DMA on non aligned address," | 1516 | printk(KERN_WARNING "%s: DMA on non aligned address, " |
1517 | "switching to PIO on Ohare chipset\n", drive->name); | 1517 | "switching to PIO on Ohare chipset\n", drive->name); |
1518 | pmif->broken_dma_warn = 1; | 1518 | pmif->broken_dma_warn = 1; |
1519 | } | 1519 | } |
diff --git a/drivers/infiniband/hw/ehca/ehca_av.c b/drivers/infiniband/hw/ehca/ehca_av.c index 453eb995c1d4..f7782c882ab4 100644 --- a/drivers/infiniband/hw/ehca/ehca_av.c +++ b/drivers/infiniband/hw/ehca/ehca_av.c | |||
@@ -76,8 +76,12 @@ int ehca_calc_ipd(struct ehca_shca *shca, int port, | |||
76 | 76 | ||
77 | link = ib_width_enum_to_int(pa.active_width) * pa.active_speed; | 77 | link = ib_width_enum_to_int(pa.active_width) * pa.active_speed; |
78 | 78 | ||
79 | /* IPD = round((link / path) - 1) */ | 79 | if (path >= link) |
80 | *ipd = ((link + (path >> 1)) / path) - 1; | 80 | /* no need to throttle if path faster than link */ |
81 | *ipd = 0; | ||
82 | else | ||
83 | /* IPD = round((link / path) - 1) */ | ||
84 | *ipd = ((link + (path >> 1)) / path) - 1; | ||
81 | 85 | ||
82 | return 0; | 86 | return 0; |
83 | } | 87 | } |
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 87f12d4312a7..74d2b72a11d8 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
@@ -322,6 +322,7 @@ extern int ehca_static_rate; | |||
322 | extern int ehca_port_act_time; | 322 | extern int ehca_port_act_time; |
323 | extern int ehca_use_hp_mr; | 323 | extern int ehca_use_hp_mr; |
324 | extern int ehca_scaling_code; | 324 | extern int ehca_scaling_code; |
325 | extern int ehca_lock_hcalls; | ||
325 | 326 | ||
326 | struct ipzu_queue_resp { | 327 | struct ipzu_queue_resp { |
327 | u32 qe_size; /* queue entry size */ | 328 | u32 qe_size; /* queue entry size */ |
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index 90d4334179bf..6a56d86a2951 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
@@ -43,13 +43,14 @@ | |||
43 | #ifdef CONFIG_PPC_64K_PAGES | 43 | #ifdef CONFIG_PPC_64K_PAGES |
44 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
45 | #endif | 45 | #endif |
46 | |||
46 | #include "ehca_classes.h" | 47 | #include "ehca_classes.h" |
47 | #include "ehca_iverbs.h" | 48 | #include "ehca_iverbs.h" |
48 | #include "ehca_mrmw.h" | 49 | #include "ehca_mrmw.h" |
49 | #include "ehca_tools.h" | 50 | #include "ehca_tools.h" |
50 | #include "hcp_if.h" | 51 | #include "hcp_if.h" |
51 | 52 | ||
52 | #define HCAD_VERSION "0024" | 53 | #define HCAD_VERSION "0025" |
53 | 54 | ||
54 | MODULE_LICENSE("Dual BSD/GPL"); | 55 | MODULE_LICENSE("Dual BSD/GPL"); |
55 | MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>"); | 56 | MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>"); |
@@ -66,6 +67,7 @@ int ehca_poll_all_eqs = 1; | |||
66 | int ehca_static_rate = -1; | 67 | int ehca_static_rate = -1; |
67 | int ehca_scaling_code = 0; | 68 | int ehca_scaling_code = 0; |
68 | int ehca_mr_largepage = 1; | 69 | int ehca_mr_largepage = 1; |
70 | int ehca_lock_hcalls = -1; | ||
69 | 71 | ||
70 | module_param_named(open_aqp1, ehca_open_aqp1, int, S_IRUGO); | 72 | module_param_named(open_aqp1, ehca_open_aqp1, int, S_IRUGO); |
71 | module_param_named(debug_level, ehca_debug_level, int, S_IRUGO); | 73 | module_param_named(debug_level, ehca_debug_level, int, S_IRUGO); |
@@ -77,6 +79,7 @@ module_param_named(poll_all_eqs, ehca_poll_all_eqs, int, S_IRUGO); | |||
77 | module_param_named(static_rate, ehca_static_rate, int, S_IRUGO); | 79 | module_param_named(static_rate, ehca_static_rate, int, S_IRUGO); |
78 | module_param_named(scaling_code, ehca_scaling_code, int, S_IRUGO); | 80 | module_param_named(scaling_code, ehca_scaling_code, int, S_IRUGO); |
79 | module_param_named(mr_largepage, ehca_mr_largepage, int, S_IRUGO); | 81 | module_param_named(mr_largepage, ehca_mr_largepage, int, S_IRUGO); |
82 | module_param_named(lock_hcalls, ehca_lock_hcalls, bool, S_IRUGO); | ||
80 | 83 | ||
81 | MODULE_PARM_DESC(open_aqp1, | 84 | MODULE_PARM_DESC(open_aqp1, |
82 | "AQP1 on startup (0: no (default), 1: yes)"); | 85 | "AQP1 on startup (0: no (default), 1: yes)"); |
@@ -102,6 +105,9 @@ MODULE_PARM_DESC(scaling_code, | |||
102 | MODULE_PARM_DESC(mr_largepage, | 105 | MODULE_PARM_DESC(mr_largepage, |
103 | "use large page for MR (0: use PAGE_SIZE (default), " | 106 | "use large page for MR (0: use PAGE_SIZE (default), " |
104 | "1: use large page depending on MR size"); | 107 | "1: use large page depending on MR size"); |
108 | MODULE_PARM_DESC(lock_hcalls, | ||
109 | "serialize all hCalls made by the driver " | ||
110 | "(default: autodetect)"); | ||
105 | 111 | ||
106 | DEFINE_RWLOCK(ehca_qp_idr_lock); | 112 | DEFINE_RWLOCK(ehca_qp_idr_lock); |
107 | DEFINE_RWLOCK(ehca_cq_idr_lock); | 113 | DEFINE_RWLOCK(ehca_cq_idr_lock); |
@@ -258,6 +264,7 @@ static struct cap_descr { | |||
258 | { HCA_CAP_UD_LL_QP, "HCA_CAP_UD_LL_QP" }, | 264 | { HCA_CAP_UD_LL_QP, "HCA_CAP_UD_LL_QP" }, |
259 | { HCA_CAP_RESIZE_MR, "HCA_CAP_RESIZE_MR" }, | 265 | { HCA_CAP_RESIZE_MR, "HCA_CAP_RESIZE_MR" }, |
260 | { HCA_CAP_MINI_QP, "HCA_CAP_MINI_QP" }, | 266 | { HCA_CAP_MINI_QP, "HCA_CAP_MINI_QP" }, |
267 | { HCA_CAP_H_ALLOC_RES_SYNC, "HCA_CAP_H_ALLOC_RES_SYNC" }, | ||
261 | }; | 268 | }; |
262 | 269 | ||
263 | static int ehca_sense_attributes(struct ehca_shca *shca) | 270 | static int ehca_sense_attributes(struct ehca_shca *shca) |
@@ -333,6 +340,12 @@ static int ehca_sense_attributes(struct ehca_shca *shca) | |||
333 | if (EHCA_BMASK_GET(hca_cap_descr[i].mask, shca->hca_cap)) | 340 | if (EHCA_BMASK_GET(hca_cap_descr[i].mask, shca->hca_cap)) |
334 | ehca_gen_dbg(" %s", hca_cap_descr[i].descr); | 341 | ehca_gen_dbg(" %s", hca_cap_descr[i].descr); |
335 | 342 | ||
343 | /* Autodetect hCall locking -- the "H_ALLOC_RESOURCE synced" flag is | ||
344 | * a firmware property, so it's valid across all adapters | ||
345 | */ | ||
346 | if (ehca_lock_hcalls == -1) | ||
347 | ehca_lock_hcalls = !(shca->hca_cap & HCA_CAP_H_ALLOC_RES_SYNC); | ||
348 | |||
336 | /* translate supported MR page sizes; always support 4K */ | 349 | /* translate supported MR page sizes; always support 4K */ |
337 | shca->hca_cap_mr_pgsize = EHCA_PAGESIZE; | 350 | shca->hca_cap_mr_pgsize = EHCA_PAGESIZE; |
338 | if (ehca_mr_largepage) { /* support extra sizes only if enabled */ | 351 | if (ehca_mr_largepage) { /* support extra sizes only if enabled */ |
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c index 2e3e6547cb78..eff5fb55604b 100644 --- a/drivers/infiniband/hw/ehca/ehca_qp.c +++ b/drivers/infiniband/hw/ehca/ehca_qp.c | |||
@@ -838,7 +838,7 @@ struct ib_srq *ehca_create_srq(struct ib_pd *pd, | |||
838 | 838 | ||
839 | /* copy back return values */ | 839 | /* copy back return values */ |
840 | srq_init_attr->attr.max_wr = qp_init_attr.cap.max_recv_wr; | 840 | srq_init_attr->attr.max_wr = qp_init_attr.cap.max_recv_wr; |
841 | srq_init_attr->attr.max_sge = qp_init_attr.cap.max_recv_sge; | 841 | srq_init_attr->attr.max_sge = 3; |
842 | 842 | ||
843 | /* drive SRQ into RTR state */ | 843 | /* drive SRQ into RTR state */ |
844 | mqpcb = ehca_alloc_fw_ctrlblock(GFP_KERNEL); | 844 | mqpcb = ehca_alloc_fw_ctrlblock(GFP_KERNEL); |
@@ -1203,7 +1203,7 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1203 | mqpcb->service_level = attr->ah_attr.sl; | 1203 | mqpcb->service_level = attr->ah_attr.sl; |
1204 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1); | 1204 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1); |
1205 | 1205 | ||
1206 | if (ehca_calc_ipd(shca, my_qp->init_attr.port_num, | 1206 | if (ehca_calc_ipd(shca, mqpcb->prim_phys_port, |
1207 | attr->ah_attr.static_rate, | 1207 | attr->ah_attr.static_rate, |
1208 | &mqpcb->max_static_rate)) { | 1208 | &mqpcb->max_static_rate)) { |
1209 | ret = -EINVAL; | 1209 | ret = -EINVAL; |
@@ -1302,7 +1302,7 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1302 | mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits; | 1302 | mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits; |
1303 | mqpcb->service_level_al = attr->alt_ah_attr.sl; | 1303 | mqpcb->service_level_al = attr->alt_ah_attr.sl; |
1304 | 1304 | ||
1305 | if (ehca_calc_ipd(shca, my_qp->init_attr.port_num, | 1305 | if (ehca_calc_ipd(shca, mqpcb->alt_phys_port, |
1306 | attr->alt_ah_attr.static_rate, | 1306 | attr->alt_ah_attr.static_rate, |
1307 | &mqpcb->max_static_rate_al)) { | 1307 | &mqpcb->max_static_rate_al)) { |
1308 | ret = -EINVAL; | 1308 | ret = -EINVAL; |
@@ -1750,7 +1750,7 @@ int ehca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr) | |||
1750 | } | 1750 | } |
1751 | 1751 | ||
1752 | srq_attr->max_wr = qpcb->max_nr_outst_recv_wr - 1; | 1752 | srq_attr->max_wr = qpcb->max_nr_outst_recv_wr - 1; |
1753 | srq_attr->max_sge = qpcb->actual_nr_sges_in_rq_wqe; | 1753 | srq_attr->max_sge = 3; |
1754 | srq_attr->srq_limit = EHCA_BMASK_GET( | 1754 | srq_attr->srq_limit = EHCA_BMASK_GET( |
1755 | MQPCB_CURR_SRQ_LIMIT, qpcb->curr_srq_limit); | 1755 | MQPCB_CURR_SRQ_LIMIT, qpcb->curr_srq_limit); |
1756 | 1756 | ||
diff --git a/drivers/infiniband/hw/ehca/hcp_if.c b/drivers/infiniband/hw/ehca/hcp_if.c index c16a21374bb5..7029aa653751 100644 --- a/drivers/infiniband/hw/ehca/hcp_if.c +++ b/drivers/infiniband/hw/ehca/hcp_if.c | |||
@@ -120,26 +120,21 @@ static long ehca_plpar_hcall_norets(unsigned long opcode, | |||
120 | unsigned long arg7) | 120 | unsigned long arg7) |
121 | { | 121 | { |
122 | long ret; | 122 | long ret; |
123 | int i, sleep_msecs, do_lock; | 123 | int i, sleep_msecs; |
124 | unsigned long flags; | 124 | unsigned long flags = 0; |
125 | 125 | ||
126 | ehca_gen_dbg("opcode=%lx " HCALL7_REGS_FORMAT, | 126 | ehca_gen_dbg("opcode=%lx " HCALL7_REGS_FORMAT, |
127 | opcode, arg1, arg2, arg3, arg4, arg5, arg6, arg7); | 127 | opcode, arg1, arg2, arg3, arg4, arg5, arg6, arg7); |
128 | 128 | ||
129 | /* lock H_FREE_RESOURCE(MR) against itself and H_ALLOC_RESOURCE(MR) */ | ||
130 | if ((opcode == H_FREE_RESOURCE) && (arg7 == 5)) { | ||
131 | arg7 = 0; /* better not upset firmware */ | ||
132 | do_lock = 1; | ||
133 | } | ||
134 | |||
135 | for (i = 0; i < 5; i++) { | 129 | for (i = 0; i < 5; i++) { |
136 | if (do_lock) | 130 | /* serialize hCalls to work around firmware issue */ |
131 | if (ehca_lock_hcalls) | ||
137 | spin_lock_irqsave(&hcall_lock, flags); | 132 | spin_lock_irqsave(&hcall_lock, flags); |
138 | 133 | ||
139 | ret = plpar_hcall_norets(opcode, arg1, arg2, arg3, arg4, | 134 | ret = plpar_hcall_norets(opcode, arg1, arg2, arg3, arg4, |
140 | arg5, arg6, arg7); | 135 | arg5, arg6, arg7); |
141 | 136 | ||
142 | if (do_lock) | 137 | if (ehca_lock_hcalls) |
143 | spin_unlock_irqrestore(&hcall_lock, flags); | 138 | spin_unlock_irqrestore(&hcall_lock, flags); |
144 | 139 | ||
145 | if (H_IS_LONG_BUSY(ret)) { | 140 | if (H_IS_LONG_BUSY(ret)) { |
@@ -174,24 +169,22 @@ static long ehca_plpar_hcall9(unsigned long opcode, | |||
174 | unsigned long arg9) | 169 | unsigned long arg9) |
175 | { | 170 | { |
176 | long ret; | 171 | long ret; |
177 | int i, sleep_msecs, do_lock; | 172 | int i, sleep_msecs; |
178 | unsigned long flags = 0; | 173 | unsigned long flags = 0; |
179 | 174 | ||
180 | ehca_gen_dbg("INPUT -- opcode=%lx " HCALL9_REGS_FORMAT, opcode, | 175 | ehca_gen_dbg("INPUT -- opcode=%lx " HCALL9_REGS_FORMAT, opcode, |
181 | arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); | 176 | arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); |
182 | 177 | ||
183 | /* lock H_ALLOC_RESOURCE(MR) against itself and H_FREE_RESOURCE(MR) */ | ||
184 | do_lock = ((opcode == H_ALLOC_RESOURCE) && (arg2 == 5)); | ||
185 | |||
186 | for (i = 0; i < 5; i++) { | 178 | for (i = 0; i < 5; i++) { |
187 | if (do_lock) | 179 | /* serialize hCalls to work around firmware issue */ |
180 | if (ehca_lock_hcalls) | ||
188 | spin_lock_irqsave(&hcall_lock, flags); | 181 | spin_lock_irqsave(&hcall_lock, flags); |
189 | 182 | ||
190 | ret = plpar_hcall9(opcode, outs, | 183 | ret = plpar_hcall9(opcode, outs, |
191 | arg1, arg2, arg3, arg4, arg5, | 184 | arg1, arg2, arg3, arg4, arg5, |
192 | arg6, arg7, arg8, arg9); | 185 | arg6, arg7, arg8, arg9); |
193 | 186 | ||
194 | if (do_lock) | 187 | if (ehca_lock_hcalls) |
195 | spin_unlock_irqrestore(&hcall_lock, flags); | 188 | spin_unlock_irqrestore(&hcall_lock, flags); |
196 | 189 | ||
197 | if (H_IS_LONG_BUSY(ret)) { | 190 | if (H_IS_LONG_BUSY(ret)) { |
@@ -821,7 +814,7 @@ u64 hipz_h_free_resource_mr(const struct ipz_adapter_handle adapter_handle, | |||
821 | return ehca_plpar_hcall_norets(H_FREE_RESOURCE, | 814 | return ehca_plpar_hcall_norets(H_FREE_RESOURCE, |
822 | adapter_handle.handle, /* r4 */ | 815 | adapter_handle.handle, /* r4 */ |
823 | mr->ipz_mr_handle.handle, /* r5 */ | 816 | mr->ipz_mr_handle.handle, /* r5 */ |
824 | 0, 0, 0, 0, 5); | 817 | 0, 0, 0, 0, 0); |
825 | } | 818 | } |
826 | 819 | ||
827 | u64 hipz_h_reregister_pmr(const struct ipz_adapter_handle adapter_handle, | 820 | u64 hipz_h_reregister_pmr(const struct ipz_adapter_handle adapter_handle, |
diff --git a/drivers/infiniband/hw/ehca/hipz_hw.h b/drivers/infiniband/hw/ehca/hipz_hw.h index 485b8400359e..bf996c7acc42 100644 --- a/drivers/infiniband/hw/ehca/hipz_hw.h +++ b/drivers/infiniband/hw/ehca/hipz_hw.h | |||
@@ -378,6 +378,7 @@ struct hipz_query_hca { | |||
378 | #define HCA_CAP_UD_LL_QP EHCA_BMASK_IBM(16, 16) | 378 | #define HCA_CAP_UD_LL_QP EHCA_BMASK_IBM(16, 16) |
379 | #define HCA_CAP_RESIZE_MR EHCA_BMASK_IBM(17, 17) | 379 | #define HCA_CAP_RESIZE_MR EHCA_BMASK_IBM(17, 17) |
380 | #define HCA_CAP_MINI_QP EHCA_BMASK_IBM(18, 18) | 380 | #define HCA_CAP_MINI_QP EHCA_BMASK_IBM(18, 18) |
381 | #define HCA_CAP_H_ALLOC_RES_SYNC EHCA_BMASK_IBM(19, 19) | ||
381 | 382 | ||
382 | /* query port response block */ | 383 | /* query port response block */ |
383 | struct hipz_query_port { | 384 | struct hipz_query_port { |
diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c b/drivers/infiniband/hw/ipath/ipath_cq.c index 08d8ae148cd0..d1380c7a1703 100644 --- a/drivers/infiniband/hw/ipath/ipath_cq.c +++ b/drivers/infiniband/hw/ipath/ipath_cq.c | |||
@@ -395,12 +395,9 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) | |||
395 | goto bail; | 395 | goto bail; |
396 | } | 396 | } |
397 | 397 | ||
398 | /* | 398 | /* Check that we can write the offset to mmap. */ |
399 | * Return the address of the WC as the offset to mmap. | ||
400 | * See ipath_mmap() for details. | ||
401 | */ | ||
402 | if (udata && udata->outlen >= sizeof(__u64)) { | 399 | if (udata && udata->outlen >= sizeof(__u64)) { |
403 | __u64 offset = (__u64) wc; | 400 | __u64 offset = 0; |
404 | 401 | ||
405 | ret = ib_copy_to_udata(udata, &offset, sizeof(offset)); | 402 | ret = ib_copy_to_udata(udata, &offset, sizeof(offset)); |
406 | if (ret) | 403 | if (ret) |
@@ -450,6 +447,18 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) | |||
450 | struct ipath_mmap_info *ip = cq->ip; | 447 | struct ipath_mmap_info *ip = cq->ip; |
451 | 448 | ||
452 | ipath_update_mmap_info(dev, ip, sz, wc); | 449 | ipath_update_mmap_info(dev, ip, sz, wc); |
450 | |||
451 | /* | ||
452 | * Return the offset to mmap. | ||
453 | * See ipath_mmap() for details. | ||
454 | */ | ||
455 | if (udata && udata->outlen >= sizeof(__u64)) { | ||
456 | ret = ib_copy_to_udata(udata, &ip->offset, | ||
457 | sizeof(ip->offset)); | ||
458 | if (ret) | ||
459 | goto bail; | ||
460 | } | ||
461 | |||
453 | spin_lock_irq(&dev->pending_lock); | 462 | spin_lock_irq(&dev->pending_lock); |
454 | if (list_empty(&ip->pending_mmaps)) | 463 | if (list_empty(&ip->pending_mmaps)) |
455 | list_add(&ip->pending_mmaps, &dev->pending_mmaps); | 464 | list_add(&ip->pending_mmaps, &dev->pending_mmaps); |
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c index 6a41fdbc8e57..b997ff88401b 100644 --- a/drivers/infiniband/hw/ipath/ipath_qp.c +++ b/drivers/infiniband/hw/ipath/ipath_qp.c | |||
@@ -835,7 +835,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
835 | init_attr->qp_type); | 835 | init_attr->qp_type); |
836 | if (err) { | 836 | if (err) { |
837 | ret = ERR_PTR(err); | 837 | ret = ERR_PTR(err); |
838 | goto bail_rwq; | 838 | vfree(qp->r_rq.wq); |
839 | goto bail_qp; | ||
839 | } | 840 | } |
840 | qp->ip = NULL; | 841 | qp->ip = NULL; |
841 | ipath_reset_qp(qp); | 842 | ipath_reset_qp(qp); |
@@ -863,7 +864,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
863 | sizeof(offset)); | 864 | sizeof(offset)); |
864 | if (err) { | 865 | if (err) { |
865 | ret = ERR_PTR(err); | 866 | ret = ERR_PTR(err); |
866 | goto bail_rwq; | 867 | goto bail_ip; |
867 | } | 868 | } |
868 | } else { | 869 | } else { |
869 | u32 s = sizeof(struct ipath_rwq) + | 870 | u32 s = sizeof(struct ipath_rwq) + |
@@ -875,7 +876,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
875 | qp->r_rq.wq); | 876 | qp->r_rq.wq); |
876 | if (!qp->ip) { | 877 | if (!qp->ip) { |
877 | ret = ERR_PTR(-ENOMEM); | 878 | ret = ERR_PTR(-ENOMEM); |
878 | goto bail_rwq; | 879 | goto bail_ip; |
879 | } | 880 | } |
880 | 881 | ||
881 | err = ib_copy_to_udata(udata, &(qp->ip->offset), | 882 | err = ib_copy_to_udata(udata, &(qp->ip->offset), |
@@ -907,9 +908,11 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
907 | goto bail; | 908 | goto bail; |
908 | 909 | ||
909 | bail_ip: | 910 | bail_ip: |
910 | kfree(qp->ip); | 911 | if (qp->ip) |
911 | bail_rwq: | 912 | kref_put(&qp->ip->ref, ipath_release_mmap_info); |
912 | vfree(qp->r_rq.wq); | 913 | else |
914 | vfree(qp->r_rq.wq); | ||
915 | ipath_free_qp(&dev->qp_table, qp); | ||
913 | bail_qp: | 916 | bail_qp: |
914 | kfree(qp); | 917 | kfree(qp); |
915 | bail_swq: | 918 | bail_swq: |
diff --git a/drivers/infiniband/hw/ipath/ipath_srq.c b/drivers/infiniband/hw/ipath/ipath_srq.c index 40c36ec19016..2fef36f4b675 100644 --- a/drivers/infiniband/hw/ipath/ipath_srq.c +++ b/drivers/infiniband/hw/ipath/ipath_srq.c | |||
@@ -59,7 +59,7 @@ int ipath_post_srq_receive(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
59 | 59 | ||
60 | if ((unsigned) wr->num_sge > srq->rq.max_sge) { | 60 | if ((unsigned) wr->num_sge > srq->rq.max_sge) { |
61 | *bad_wr = wr; | 61 | *bad_wr = wr; |
62 | ret = -ENOMEM; | 62 | ret = -EINVAL; |
63 | goto bail; | 63 | goto bail; |
64 | } | 64 | } |
65 | 65 | ||
@@ -211,11 +211,11 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | |||
211 | struct ib_udata *udata) | 211 | struct ib_udata *udata) |
212 | { | 212 | { |
213 | struct ipath_srq *srq = to_isrq(ibsrq); | 213 | struct ipath_srq *srq = to_isrq(ibsrq); |
214 | struct ipath_rwq *wq; | ||
214 | int ret = 0; | 215 | int ret = 0; |
215 | 216 | ||
216 | if (attr_mask & IB_SRQ_MAX_WR) { | 217 | if (attr_mask & IB_SRQ_MAX_WR) { |
217 | struct ipath_rwq *owq; | 218 | struct ipath_rwq *owq; |
218 | struct ipath_rwq *wq; | ||
219 | struct ipath_rwqe *p; | 219 | struct ipath_rwqe *p; |
220 | u32 sz, size, n, head, tail; | 220 | u32 sz, size, n, head, tail; |
221 | 221 | ||
@@ -236,27 +236,20 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | |||
236 | goto bail; | 236 | goto bail; |
237 | } | 237 | } |
238 | 238 | ||
239 | /* | 239 | /* Check that we can write the offset to mmap. */ |
240 | * Return the address of the RWQ as the offset to mmap. | ||
241 | * See ipath_mmap() for details. | ||
242 | */ | ||
243 | if (udata && udata->inlen >= sizeof(__u64)) { | 240 | if (udata && udata->inlen >= sizeof(__u64)) { |
244 | __u64 offset_addr; | 241 | __u64 offset_addr; |
245 | __u64 offset = (__u64) wq; | 242 | __u64 offset = 0; |
246 | 243 | ||
247 | ret = ib_copy_from_udata(&offset_addr, udata, | 244 | ret = ib_copy_from_udata(&offset_addr, udata, |
248 | sizeof(offset_addr)); | 245 | sizeof(offset_addr)); |
249 | if (ret) { | 246 | if (ret) |
250 | vfree(wq); | 247 | goto bail_free; |
251 | goto bail; | ||
252 | } | ||
253 | udata->outbuf = (void __user *) offset_addr; | 248 | udata->outbuf = (void __user *) offset_addr; |
254 | ret = ib_copy_to_udata(udata, &offset, | 249 | ret = ib_copy_to_udata(udata, &offset, |
255 | sizeof(offset)); | 250 | sizeof(offset)); |
256 | if (ret) { | 251 | if (ret) |
257 | vfree(wq); | 252 | goto bail_free; |
258 | goto bail; | ||
259 | } | ||
260 | } | 253 | } |
261 | 254 | ||
262 | spin_lock_irq(&srq->rq.lock); | 255 | spin_lock_irq(&srq->rq.lock); |
@@ -277,10 +270,8 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | |||
277 | else | 270 | else |
278 | n -= tail; | 271 | n -= tail; |
279 | if (size <= n) { | 272 | if (size <= n) { |
280 | spin_unlock_irq(&srq->rq.lock); | ||
281 | vfree(wq); | ||
282 | ret = -EINVAL; | 273 | ret = -EINVAL; |
283 | goto bail; | 274 | goto bail_unlock; |
284 | } | 275 | } |
285 | n = 0; | 276 | n = 0; |
286 | p = wq->wq; | 277 | p = wq->wq; |
@@ -314,6 +305,18 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | |||
314 | u32 s = sizeof(struct ipath_rwq) + size * sz; | 305 | u32 s = sizeof(struct ipath_rwq) + size * sz; |
315 | 306 | ||
316 | ipath_update_mmap_info(dev, ip, s, wq); | 307 | ipath_update_mmap_info(dev, ip, s, wq); |
308 | |||
309 | /* | ||
310 | * Return the offset to mmap. | ||
311 | * See ipath_mmap() for details. | ||
312 | */ | ||
313 | if (udata && udata->inlen >= sizeof(__u64)) { | ||
314 | ret = ib_copy_to_udata(udata, &ip->offset, | ||
315 | sizeof(ip->offset)); | ||
316 | if (ret) | ||
317 | goto bail; | ||
318 | } | ||
319 | |||
317 | spin_lock_irq(&dev->pending_lock); | 320 | spin_lock_irq(&dev->pending_lock); |
318 | if (list_empty(&ip->pending_mmaps)) | 321 | if (list_empty(&ip->pending_mmaps)) |
319 | list_add(&ip->pending_mmaps, | 322 | list_add(&ip->pending_mmaps, |
@@ -328,7 +331,12 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | |||
328 | srq->limit = attr->srq_limit; | 331 | srq->limit = attr->srq_limit; |
329 | spin_unlock_irq(&srq->rq.lock); | 332 | spin_unlock_irq(&srq->rq.lock); |
330 | } | 333 | } |
334 | goto bail; | ||
331 | 335 | ||
336 | bail_unlock: | ||
337 | spin_unlock_irq(&srq->rq.lock); | ||
338 | bail_free: | ||
339 | vfree(wq); | ||
332 | bail: | 340 | bail: |
333 | return ret; | 341 | return ret; |
334 | } | 342 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 74f77e7c2c1b..c4c998446c7b 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -302,8 +302,10 @@ static int ipath_post_one_send(struct ipath_qp *qp, struct ib_send_wr *wr) | |||
302 | next = qp->s_head + 1; | 302 | next = qp->s_head + 1; |
303 | if (next >= qp->s_size) | 303 | if (next >= qp->s_size) |
304 | next = 0; | 304 | next = 0; |
305 | if (next == qp->s_last) | 305 | if (next == qp->s_last) { |
306 | goto bail_inval; | 306 | ret = -ENOMEM; |
307 | goto bail; | ||
308 | } | ||
307 | 309 | ||
308 | wqe = get_swqe_ptr(qp, qp->s_head); | 310 | wqe = get_swqe_ptr(qp, qp->s_head); |
309 | wqe->wr = *wr; | 311 | wqe->wr = *wr; |
@@ -404,7 +406,7 @@ static int ipath_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
404 | 406 | ||
405 | if ((unsigned) wr->num_sge > qp->r_rq.max_sge) { | 407 | if ((unsigned) wr->num_sge > qp->r_rq.max_sge) { |
406 | *bad_wr = wr; | 408 | *bad_wr = wr; |
407 | ret = -ENOMEM; | 409 | ret = -EINVAL; |
408 | goto bail; | 410 | goto bail; |
409 | } | 411 | } |
410 | 412 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index a03a65ebcf0c..c9f6077b615e 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -460,6 +460,9 @@ static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid) | |||
460 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 460 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
461 | struct ipoib_path *path; | 461 | struct ipoib_path *path; |
462 | 462 | ||
463 | if (!priv->broadcast) | ||
464 | return NULL; | ||
465 | |||
463 | path = kzalloc(sizeof *path, GFP_ATOMIC); | 466 | path = kzalloc(sizeof *path, GFP_ATOMIC); |
464 | if (!path) | 467 | if (!path) |
465 | return NULL; | 468 | return NULL; |
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c index d68798061795..4a17743a639f 100644 --- a/drivers/infiniband/ulp/iser/iser_memory.c +++ b/drivers/infiniband/ulp/iser/iser_memory.c | |||
@@ -310,13 +310,15 @@ static unsigned int iser_data_buf_aligned_len(struct iser_data_buf *data, | |||
310 | if (i + 1 < data->dma_nents) { | 310 | if (i + 1 < data->dma_nents) { |
311 | next_addr = ib_sg_dma_address(ibdev, sg_next(sg)); | 311 | next_addr = ib_sg_dma_address(ibdev, sg_next(sg)); |
312 | /* are i, i+1 fragments of the same page? */ | 312 | /* are i, i+1 fragments of the same page? */ |
313 | if (end_addr == next_addr) | 313 | if (end_addr == next_addr) { |
314 | cnt++; | ||
314 | continue; | 315 | continue; |
315 | else if (!IS_4K_ALIGNED(end_addr)) { | 316 | } else if (!IS_4K_ALIGNED(end_addr)) { |
316 | ret_len = cnt + 1; | 317 | ret_len = cnt + 1; |
317 | break; | 318 | break; |
318 | } | 319 | } |
319 | } | 320 | } |
321 | cnt++; | ||
320 | } | 322 | } |
321 | if (i == data->dma_nents) | 323 | if (i == data->dma_nents) |
322 | ret_len = cnt; /* loop ended */ | 324 | ret_len = cnt; /* loop ended */ |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 2316a018fae6..dfa6592c10f6 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -286,7 +286,7 @@ config KEYBOARD_MAPLE | |||
286 | 286 | ||
287 | config KEYBOARD_BFIN | 287 | config KEYBOARD_BFIN |
288 | tristate "Blackfin BF54x keypad support" | 288 | tristate "Blackfin BF54x keypad support" |
289 | depends on BF54x | 289 | depends on (BF54x && !BF544) |
290 | help | 290 | help |
291 | Say Y here if you want to use the BF54x keypad. | 291 | Say Y here if you want to use the BF54x keypad. |
292 | 292 | ||
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 3eddf52a0bba..6a9ca4bdcb74 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -75,16 +75,32 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
75 | 75 | ||
76 | for (i = 0; i < pdata->nbuttons; i++) { | 76 | for (i = 0; i < pdata->nbuttons; i++) { |
77 | struct gpio_keys_button *button = &pdata->buttons[i]; | 77 | struct gpio_keys_button *button = &pdata->buttons[i]; |
78 | int irq = gpio_to_irq(button->gpio); | 78 | int irq; |
79 | unsigned int type = button->type ?: EV_KEY; | 79 | unsigned int type = button->type ?: EV_KEY; |
80 | 80 | ||
81 | error = gpio_request(button->gpio, button->desc ?: "gpio_keys"); | ||
82 | if (error < 0) { | ||
83 | pr_err("gpio-keys: failed to request GPIO %d," | ||
84 | " error %d\n", button->gpio, error); | ||
85 | goto fail; | ||
86 | } | ||
87 | |||
88 | error = gpio_direction_input(button->gpio); | ||
89 | if (error < 0) { | ||
90 | pr_err("gpio-keys: failed to configure input" | ||
91 | " direction for GPIO %d, error %d\n", | ||
92 | button->gpio, error); | ||
93 | gpio_free(button->gpio); | ||
94 | goto fail; | ||
95 | } | ||
96 | |||
97 | irq = gpio_to_irq(button->gpio); | ||
81 | if (irq < 0) { | 98 | if (irq < 0) { |
82 | error = irq; | 99 | error = irq; |
83 | printk(KERN_ERR | 100 | pr_err("gpio-keys: Unable to get irq number" |
84 | "gpio-keys: " | 101 | " for GPIO %d, error %d\n", |
85 | "Unable to get irq number for GPIO %d," | ||
86 | "error %d\n", | ||
87 | button->gpio, error); | 102 | button->gpio, error); |
103 | gpio_free(button->gpio); | ||
88 | goto fail; | 104 | goto fail; |
89 | } | 105 | } |
90 | 106 | ||
@@ -94,9 +110,9 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
94 | button->desc ? button->desc : "gpio_keys", | 110 | button->desc ? button->desc : "gpio_keys", |
95 | pdev); | 111 | pdev); |
96 | if (error) { | 112 | if (error) { |
97 | printk(KERN_ERR | 113 | pr_err("gpio-keys: Unable to claim irq %d; error %d\n", |
98 | "gpio-keys: Unable to claim irq %d; error %d\n", | ||
99 | irq, error); | 114 | irq, error); |
115 | gpio_free(button->gpio); | ||
100 | goto fail; | 116 | goto fail; |
101 | } | 117 | } |
102 | 118 | ||
@@ -108,8 +124,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
108 | 124 | ||
109 | error = input_register_device(input); | 125 | error = input_register_device(input); |
110 | if (error) { | 126 | if (error) { |
111 | printk(KERN_ERR | 127 | pr_err("gpio-keys: Unable to register input device, " |
112 | "gpio-keys: Unable to register input device, " | ||
113 | "error: %d\n", error); | 128 | "error: %d\n", error); |
114 | goto fail; | 129 | goto fail; |
115 | } | 130 | } |
@@ -119,8 +134,10 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
119 | return 0; | 134 | return 0; |
120 | 135 | ||
121 | fail: | 136 | fail: |
122 | while (--i >= 0) | 137 | while (--i >= 0) { |
123 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev); | 138 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev); |
139 | gpio_free(pdata->buttons[i].gpio); | ||
140 | } | ||
124 | 141 | ||
125 | platform_set_drvdata(pdev, NULL); | 142 | platform_set_drvdata(pdev, NULL); |
126 | input_free_device(input); | 143 | input_free_device(input); |
@@ -139,6 +156,7 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev) | |||
139 | for (i = 0; i < pdata->nbuttons; i++) { | 156 | for (i = 0; i < pdata->nbuttons; i++) { |
140 | int irq = gpio_to_irq(pdata->buttons[i].gpio); | 157 | int irq = gpio_to_irq(pdata->buttons[i].gpio); |
141 | free_irq(irq, pdev); | 158 | free_irq(irq, pdev); |
159 | gpio_free(pdata->buttons[i].gpio); | ||
142 | } | 160 | } |
143 | 161 | ||
144 | input_unregister_device(input); | 162 | input_unregister_device(input); |
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig index 5ce632ca6815..b88569e21d60 100644 --- a/drivers/input/serio/Kconfig +++ b/drivers/input/serio/Kconfig | |||
@@ -21,7 +21,7 @@ if SERIO | |||
21 | config SERIO_I8042 | 21 | config SERIO_I8042 |
22 | tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 | 22 | tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 |
23 | default y | 23 | default y |
24 | depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && !M68K && !BFIN | 24 | depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && !M68K && !BLACKFIN |
25 | ---help--- | 25 | ---help--- |
26 | i8042 is the chip over which the standard AT keyboard and PS/2 | 26 | i8042 is the chip over which the standard AT keyboard and PS/2 |
27 | mouse are connected to the computer. If you use these devices, | 27 | mouse are connected to the computer. If you use these devices, |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index f8fe42148093..c5e68dcd88ac 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -110,6 +110,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { | |||
110 | DMI_MATCH(DMI_PRODUCT_VERSION, "5a"), | 110 | DMI_MATCH(DMI_PRODUCT_VERSION, "5a"), |
111 | }, | 111 | }, |
112 | }, | 112 | }, |
113 | { | ||
114 | .ident = "Microsoft Virtual Machine", | ||
115 | .matches = { | ||
116 | DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), | ||
117 | DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"), | ||
118 | DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"), | ||
119 | }, | ||
120 | }, | ||
113 | { } | 121 | { } |
114 | }; | 122 | }; |
115 | 123 | ||
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index f59aecf5ec15..fd9c5d51870a 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -267,13 +267,12 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) | |||
267 | ts->irq_disabled = 0; | 267 | ts->irq_disabled = 0; |
268 | enable_irq(spi->irq); | 268 | enable_irq(spi->irq); |
269 | 269 | ||
270 | if (req->msg.status) | 270 | if (status == 0) { |
271 | status = req->msg.status; | 271 | /* on-wire is a must-ignore bit, a BE12 value, then padding */ |
272 | 272 | sample = be16_to_cpu(req->sample); | |
273 | /* on-wire is a must-ignore bit, a BE12 value, then padding */ | 273 | sample = sample >> 3; |
274 | sample = be16_to_cpu(req->sample); | 274 | sample &= 0x0fff; |
275 | sample = sample >> 3; | 275 | } |
276 | sample &= 0x0fff; | ||
277 | 276 | ||
278 | kfree(req); | 277 | kfree(req); |
279 | return status ? status : sample; | 278 | return status ? status : sample; |
diff --git a/drivers/isdn/hisax/hfcscard.c b/drivers/isdn/hisax/hfcscard.c index 57670dc5034d..909d6709ec16 100644 --- a/drivers/isdn/hisax/hfcscard.c +++ b/drivers/isdn/hisax/hfcscard.c | |||
@@ -118,8 +118,7 @@ hfcs_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
118 | return(0); | 118 | return(0); |
119 | case CARD_INIT: | 119 | case CARD_INIT: |
120 | delay = (75*HZ)/100 +1; | 120 | delay = (75*HZ)/100 +1; |
121 | cs->hw.hfcD.timer.expires = jiffies + delay; | 121 | mod_timer(&cs->hw.hfcD.timer, jiffies + delay); |
122 | add_timer(&cs->hw.hfcD.timer); | ||
123 | spin_lock_irqsave(&cs->lock, flags); | 122 | spin_lock_irqsave(&cs->lock, flags); |
124 | reset_hfcs(cs); | 123 | reset_hfcs(cs); |
125 | init2bds0(cs); | 124 | init2bds0(cs); |
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index c6df2925ebd0..d6952959d72a 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -1515,6 +1515,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) | |||
1515 | if (copy_from_user(&iocts, argp, | 1515 | if (copy_from_user(&iocts, argp, |
1516 | sizeof(isdn_ioctl_struct))) | 1516 | sizeof(isdn_ioctl_struct))) |
1517 | return -EFAULT; | 1517 | return -EFAULT; |
1518 | iocts.drvid[sizeof(iocts.drvid)-1] = 0; | ||
1518 | if (strlen(iocts.drvid)) { | 1519 | if (strlen(iocts.drvid)) { |
1519 | if ((p = strchr(iocts.drvid, ','))) | 1520 | if ((p = strchr(iocts.drvid, ','))) |
1520 | *p = 0; | 1521 | *p = 0; |
@@ -1599,6 +1600,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) | |||
1599 | if (copy_from_user(&iocts, argp, | 1600 | if (copy_from_user(&iocts, argp, |
1600 | sizeof(isdn_ioctl_struct))) | 1601 | sizeof(isdn_ioctl_struct))) |
1601 | return -EFAULT; | 1602 | return -EFAULT; |
1603 | iocts.drvid[sizeof(iocts.drvid)-1] = 0; | ||
1602 | if (strlen(iocts.drvid)) { | 1604 | if (strlen(iocts.drvid)) { |
1603 | drvidx = -1; | 1605 | drvidx = -1; |
1604 | for (i = 0; i < ISDN_MAX_DRIVERS; i++) | 1606 | for (i = 0; i < ISDN_MAX_DRIVERS; i++) |
@@ -1643,7 +1645,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) | |||
1643 | } else { | 1645 | } else { |
1644 | p = (char __user *) iocts.arg; | 1646 | p = (char __user *) iocts.arg; |
1645 | for (i = 0; i < 10; i++) { | 1647 | for (i = 0; i < 10; i++) { |
1646 | sprintf(bname, "%s%s", | 1648 | snprintf(bname, sizeof(bname), "%s%s", |
1647 | strlen(dev->drv[drvidx]->msn2eaz[i]) ? | 1649 | strlen(dev->drv[drvidx]->msn2eaz[i]) ? |
1648 | dev->drv[drvidx]->msn2eaz[i] : "_", | 1650 | dev->drv[drvidx]->msn2eaz[i] : "_", |
1649 | (i < 9) ? "," : "\0"); | 1651 | (i < 9) ? "," : "\0"); |
@@ -1673,6 +1675,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) | |||
1673 | char *p; | 1675 | char *p; |
1674 | if (copy_from_user(&iocts, argp, sizeof(isdn_ioctl_struct))) | 1676 | if (copy_from_user(&iocts, argp, sizeof(isdn_ioctl_struct))) |
1675 | return -EFAULT; | 1677 | return -EFAULT; |
1678 | iocts.drvid[sizeof(iocts.drvid)-1] = 0; | ||
1676 | if (strlen(iocts.drvid)) { | 1679 | if (strlen(iocts.drvid)) { |
1677 | if ((p = strchr(iocts.drvid, ','))) | 1680 | if ((p = strchr(iocts.drvid, ','))) |
1678 | *p = 0; | 1681 | *p = 0; |
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index b39d1f5b378e..ced83c202cac 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -2104,7 +2104,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) | |||
2104 | u_long flags; | 2104 | u_long flags; |
2105 | isdn_net_dev *p; | 2105 | isdn_net_dev *p; |
2106 | isdn_net_phone *n; | 2106 | isdn_net_phone *n; |
2107 | char nr[32]; | 2107 | char nr[ISDN_MSNLEN]; |
2108 | char *my_eaz; | 2108 | char *my_eaz; |
2109 | 2109 | ||
2110 | /* Search name in netdev-chain */ | 2110 | /* Search name in netdev-chain */ |
@@ -2113,7 +2113,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) | |||
2113 | nr[1] = '\0'; | 2113 | nr[1] = '\0'; |
2114 | printk(KERN_INFO "isdn_net: Incoming call without OAD, assuming '0'\n"); | 2114 | printk(KERN_INFO "isdn_net: Incoming call without OAD, assuming '0'\n"); |
2115 | } else | 2115 | } else |
2116 | strcpy(nr, setup->phone); | 2116 | strlcpy(nr, setup->phone, ISDN_MSNLEN); |
2117 | si1 = (int) setup->si1; | 2117 | si1 = (int) setup->si1; |
2118 | si2 = (int) setup->si2; | 2118 | si2 = (int) setup->si2; |
2119 | if (!setup->eazmsn[0]) { | 2119 | if (!setup->eazmsn[0]) { |
@@ -2789,7 +2789,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg) | |||
2789 | chidx = -1; | 2789 | chidx = -1; |
2790 | } | 2790 | } |
2791 | } | 2791 | } |
2792 | strcpy(lp->msn, cfg->eaz); | 2792 | strlcpy(lp->msn, cfg->eaz, sizeof(lp->msn)); |
2793 | lp->pre_device = drvidx; | 2793 | lp->pre_device = drvidx; |
2794 | lp->pre_channel = chidx; | 2794 | lp->pre_channel = chidx; |
2795 | lp->onhtime = cfg->onhtime; | 2795 | lp->onhtime = cfg->onhtime; |
@@ -2936,7 +2936,7 @@ isdn_net_addphone(isdn_net_ioctl_phone * phone) | |||
2936 | if (p) { | 2936 | if (p) { |
2937 | if (!(n = kmalloc(sizeof(isdn_net_phone), GFP_KERNEL))) | 2937 | if (!(n = kmalloc(sizeof(isdn_net_phone), GFP_KERNEL))) |
2938 | return -ENOMEM; | 2938 | return -ENOMEM; |
2939 | strcpy(n->num, phone->phone); | 2939 | strlcpy(n->num, phone->phone, sizeof(n->num)); |
2940 | n->next = p->local->phone[phone->outgoing & 1]; | 2940 | n->next = p->local->phone[phone->outgoing & 1]; |
2941 | p->local->phone[phone->outgoing & 1] = n; | 2941 | p->local->phone[phone->outgoing & 1] = n; |
2942 | return 0; | 2942 | return 0; |
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 07ae280e8fe5..47c10b8f89b3 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -1188,8 +1188,7 @@ int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address) | |||
1188 | 1188 | ||
1189 | int emulate_clts(struct kvm_vcpu *vcpu) | 1189 | int emulate_clts(struct kvm_vcpu *vcpu) |
1190 | { | 1190 | { |
1191 | vcpu->cr0 &= ~X86_CR0_TS; | 1191 | kvm_x86_ops->set_cr0(vcpu, vcpu->cr0 & ~X86_CR0_TS); |
1192 | kvm_x86_ops->set_cr0(vcpu, vcpu->cr0); | ||
1193 | return X86EMUL_CONTINUE; | 1192 | return X86EMUL_CONTINUE; |
1194 | } | 1193 | } |
1195 | 1194 | ||
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 7a6eead63a6b..4e04e49a2f1c 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -663,6 +663,7 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu) | |||
663 | wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]); | 663 | wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]); |
664 | 664 | ||
665 | rdtscll(vcpu->host_tsc); | 665 | rdtscll(vcpu->host_tsc); |
666 | kvm_put_guest_fpu(vcpu); | ||
666 | } | 667 | } |
667 | 668 | ||
668 | static void svm_vcpu_decache(struct kvm_vcpu *vcpu) | 669 | static void svm_vcpu_decache(struct kvm_vcpu *vcpu) |
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index 33b181451557..bd46de6bf891 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c | |||
@@ -448,8 +448,7 @@ struct operand { | |||
448 | 448 | ||
449 | #define JMP_REL(rel) \ | 449 | #define JMP_REL(rel) \ |
450 | do { \ | 450 | do { \ |
451 | _eip += (int)(rel); \ | 451 | register_address_increment(_eip, rel); \ |
452 | _eip = ((op_bytes == 2) ? (uint16_t)_eip : (uint32_t)_eip); \ | ||
453 | } while (0) | 452 | } while (0) |
454 | 453 | ||
455 | /* | 454 | /* |
@@ -1147,7 +1146,7 @@ done_prefixes: | |||
1147 | } | 1146 | } |
1148 | register_address_increment(_regs[VCPU_REGS_RSP], | 1147 | register_address_increment(_regs[VCPU_REGS_RSP], |
1149 | -dst.bytes); | 1148 | -dst.bytes); |
1150 | if ((rc = ops->write_std( | 1149 | if ((rc = ops->write_emulated( |
1151 | register_address(ctxt->ss_base, | 1150 | register_address(ctxt->ss_base, |
1152 | _regs[VCPU_REGS_RSP]), | 1151 | _regs[VCPU_REGS_RSP]), |
1153 | &dst.val, dst.bytes, ctxt->vcpu)) != 0) | 1152 | &dst.val, dst.bytes, ctxt->vcpu)) != 0) |
@@ -1359,6 +1358,7 @@ special_insn: | |||
1359 | } | 1358 | } |
1360 | src.val = (unsigned long) _eip; | 1359 | src.val = (unsigned long) _eip; |
1361 | JMP_REL(rel); | 1360 | JMP_REL(rel); |
1361 | op_bytes = ad_bytes; | ||
1362 | goto push; | 1362 | goto push; |
1363 | } | 1363 | } |
1364 | case 0xe9: /* jmp rel */ | 1364 | case 0xe9: /* jmp rel */ |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 4211293ce862..ba8b04b03b9f 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -111,7 +111,7 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) | |||
111 | write_unlock(&leds_list_lock); | 111 | write_unlock(&leds_list_lock); |
112 | 112 | ||
113 | #ifdef CONFIG_LEDS_TRIGGERS | 113 | #ifdef CONFIG_LEDS_TRIGGERS |
114 | rwlock_init(&led_cdev->trigger_lock); | 114 | init_rwsem(&led_cdev->trigger_lock); |
115 | 115 | ||
116 | rc = device_create_file(led_cdev->dev, &dev_attr_trigger); | 116 | rc = device_create_file(led_cdev->dev, &dev_attr_trigger); |
117 | if (rc) | 117 | if (rc) |
@@ -147,10 +147,10 @@ void led_classdev_unregister(struct led_classdev *led_cdev) | |||
147 | device_remove_file(led_cdev->dev, &dev_attr_brightness); | 147 | device_remove_file(led_cdev->dev, &dev_attr_brightness); |
148 | #ifdef CONFIG_LEDS_TRIGGERS | 148 | #ifdef CONFIG_LEDS_TRIGGERS |
149 | device_remove_file(led_cdev->dev, &dev_attr_trigger); | 149 | device_remove_file(led_cdev->dev, &dev_attr_trigger); |
150 | write_lock(&led_cdev->trigger_lock); | 150 | down_write(&led_cdev->trigger_lock); |
151 | if (led_cdev->trigger) | 151 | if (led_cdev->trigger) |
152 | led_trigger_set(led_cdev, NULL); | 152 | led_trigger_set(led_cdev, NULL); |
153 | write_unlock(&led_cdev->trigger_lock); | 153 | up_write(&led_cdev->trigger_lock); |
154 | #endif | 154 | #endif |
155 | 155 | ||
156 | device_unregister(led_cdev->dev); | 156 | device_unregister(led_cdev->dev); |
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 575368c2b100..0bdb786210b1 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c | |||
@@ -19,13 +19,14 @@ | |||
19 | #include <linux/device.h> | 19 | #include <linux/device.h> |
20 | #include <linux/sysdev.h> | 20 | #include <linux/sysdev.h> |
21 | #include <linux/timer.h> | 21 | #include <linux/timer.h> |
22 | #include <linux/rwsem.h> | ||
22 | #include <linux/leds.h> | 23 | #include <linux/leds.h> |
23 | #include "leds.h" | 24 | #include "leds.h" |
24 | 25 | ||
25 | /* | 26 | /* |
26 | * Nests outside led_cdev->trigger_lock | 27 | * Nests outside led_cdev->trigger_lock |
27 | */ | 28 | */ |
28 | static DEFINE_RWLOCK(triggers_list_lock); | 29 | static DECLARE_RWSEM(triggers_list_lock); |
29 | static LIST_HEAD(trigger_list); | 30 | static LIST_HEAD(trigger_list); |
30 | 31 | ||
31 | ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, | 32 | ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, |
@@ -44,24 +45,24 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, | |||
44 | trigger_name[len - 1] = '\0'; | 45 | trigger_name[len - 1] = '\0'; |
45 | 46 | ||
46 | if (!strcmp(trigger_name, "none")) { | 47 | if (!strcmp(trigger_name, "none")) { |
47 | write_lock(&led_cdev->trigger_lock); | 48 | down_write(&led_cdev->trigger_lock); |
48 | led_trigger_set(led_cdev, NULL); | 49 | led_trigger_set(led_cdev, NULL); |
49 | write_unlock(&led_cdev->trigger_lock); | 50 | up_write(&led_cdev->trigger_lock); |
50 | return count; | 51 | return count; |
51 | } | 52 | } |
52 | 53 | ||
53 | read_lock(&triggers_list_lock); | 54 | down_read(&triggers_list_lock); |
54 | list_for_each_entry(trig, &trigger_list, next_trig) { | 55 | list_for_each_entry(trig, &trigger_list, next_trig) { |
55 | if (!strcmp(trigger_name, trig->name)) { | 56 | if (!strcmp(trigger_name, trig->name)) { |
56 | write_lock(&led_cdev->trigger_lock); | 57 | down_write(&led_cdev->trigger_lock); |
57 | led_trigger_set(led_cdev, trig); | 58 | led_trigger_set(led_cdev, trig); |
58 | write_unlock(&led_cdev->trigger_lock); | 59 | up_write(&led_cdev->trigger_lock); |
59 | 60 | ||
60 | read_unlock(&triggers_list_lock); | 61 | up_read(&triggers_list_lock); |
61 | return count; | 62 | return count; |
62 | } | 63 | } |
63 | } | 64 | } |
64 | read_unlock(&triggers_list_lock); | 65 | up_read(&triggers_list_lock); |
65 | 66 | ||
66 | return -EINVAL; | 67 | return -EINVAL; |
67 | } | 68 | } |
@@ -74,8 +75,8 @@ ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr, | |||
74 | struct led_trigger *trig; | 75 | struct led_trigger *trig; |
75 | int len = 0; | 76 | int len = 0; |
76 | 77 | ||
77 | read_lock(&triggers_list_lock); | 78 | down_read(&triggers_list_lock); |
78 | read_lock(&led_cdev->trigger_lock); | 79 | down_read(&led_cdev->trigger_lock); |
79 | 80 | ||
80 | if (!led_cdev->trigger) | 81 | if (!led_cdev->trigger) |
81 | len += sprintf(buf+len, "[none] "); | 82 | len += sprintf(buf+len, "[none] "); |
@@ -89,8 +90,8 @@ ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr, | |||
89 | else | 90 | else |
90 | len += sprintf(buf+len, "%s ", trig->name); | 91 | len += sprintf(buf+len, "%s ", trig->name); |
91 | } | 92 | } |
92 | read_unlock(&led_cdev->trigger_lock); | 93 | up_read(&led_cdev->trigger_lock); |
93 | read_unlock(&triggers_list_lock); | 94 | up_read(&triggers_list_lock); |
94 | 95 | ||
95 | len += sprintf(len+buf, "\n"); | 96 | len += sprintf(len+buf, "\n"); |
96 | return len; | 97 | return len; |
@@ -145,14 +146,14 @@ void led_trigger_set_default(struct led_classdev *led_cdev) | |||
145 | if (!led_cdev->default_trigger) | 146 | if (!led_cdev->default_trigger) |
146 | return; | 147 | return; |
147 | 148 | ||
148 | read_lock(&triggers_list_lock); | 149 | down_read(&triggers_list_lock); |
149 | write_lock(&led_cdev->trigger_lock); | 150 | down_write(&led_cdev->trigger_lock); |
150 | list_for_each_entry(trig, &trigger_list, next_trig) { | 151 | list_for_each_entry(trig, &trigger_list, next_trig) { |
151 | if (!strcmp(led_cdev->default_trigger, trig->name)) | 152 | if (!strcmp(led_cdev->default_trigger, trig->name)) |
152 | led_trigger_set(led_cdev, trig); | 153 | led_trigger_set(led_cdev, trig); |
153 | } | 154 | } |
154 | write_unlock(&led_cdev->trigger_lock); | 155 | up_write(&led_cdev->trigger_lock); |
155 | read_unlock(&triggers_list_lock); | 156 | up_read(&triggers_list_lock); |
156 | } | 157 | } |
157 | 158 | ||
158 | int led_trigger_register(struct led_trigger *trigger) | 159 | int led_trigger_register(struct led_trigger *trigger) |
@@ -163,18 +164,18 @@ int led_trigger_register(struct led_trigger *trigger) | |||
163 | INIT_LIST_HEAD(&trigger->led_cdevs); | 164 | INIT_LIST_HEAD(&trigger->led_cdevs); |
164 | 165 | ||
165 | /* Add to the list of led triggers */ | 166 | /* Add to the list of led triggers */ |
166 | write_lock(&triggers_list_lock); | 167 | down_write(&triggers_list_lock); |
167 | list_add_tail(&trigger->next_trig, &trigger_list); | 168 | list_add_tail(&trigger->next_trig, &trigger_list); |
168 | write_unlock(&triggers_list_lock); | 169 | up_write(&triggers_list_lock); |
169 | 170 | ||
170 | /* Register with any LEDs that have this as a default trigger */ | 171 | /* Register with any LEDs that have this as a default trigger */ |
171 | read_lock(&leds_list_lock); | 172 | read_lock(&leds_list_lock); |
172 | list_for_each_entry(led_cdev, &leds_list, node) { | 173 | list_for_each_entry(led_cdev, &leds_list, node) { |
173 | write_lock(&led_cdev->trigger_lock); | 174 | down_write(&led_cdev->trigger_lock); |
174 | if (!led_cdev->trigger && led_cdev->default_trigger && | 175 | if (!led_cdev->trigger && led_cdev->default_trigger && |
175 | !strcmp(led_cdev->default_trigger, trigger->name)) | 176 | !strcmp(led_cdev->default_trigger, trigger->name)) |
176 | led_trigger_set(led_cdev, trigger); | 177 | led_trigger_set(led_cdev, trigger); |
177 | write_unlock(&led_cdev->trigger_lock); | 178 | up_write(&led_cdev->trigger_lock); |
178 | } | 179 | } |
179 | read_unlock(&leds_list_lock); | 180 | read_unlock(&leds_list_lock); |
180 | 181 | ||
@@ -206,17 +207,17 @@ void led_trigger_unregister(struct led_trigger *trigger) | |||
206 | struct led_classdev *led_cdev; | 207 | struct led_classdev *led_cdev; |
207 | 208 | ||
208 | /* Remove from the list of led triggers */ | 209 | /* Remove from the list of led triggers */ |
209 | write_lock(&triggers_list_lock); | 210 | down_write(&triggers_list_lock); |
210 | list_del(&trigger->next_trig); | 211 | list_del(&trigger->next_trig); |
211 | write_unlock(&triggers_list_lock); | 212 | up_write(&triggers_list_lock); |
212 | 213 | ||
213 | /* Remove anyone actively using this trigger */ | 214 | /* Remove anyone actively using this trigger */ |
214 | read_lock(&leds_list_lock); | 215 | read_lock(&leds_list_lock); |
215 | list_for_each_entry(led_cdev, &leds_list, node) { | 216 | list_for_each_entry(led_cdev, &leds_list, node) { |
216 | write_lock(&led_cdev->trigger_lock); | 217 | down_write(&led_cdev->trigger_lock); |
217 | if (led_cdev->trigger == trigger) | 218 | if (led_cdev->trigger == trigger) |
218 | led_trigger_set(led_cdev, NULL); | 219 | led_trigger_set(led_cdev, NULL); |
219 | write_unlock(&led_cdev->trigger_lock); | 220 | up_write(&led_cdev->trigger_lock); |
220 | } | 221 | } |
221 | read_unlock(&leds_list_lock); | 222 | read_unlock(&leds_list_lock); |
222 | } | 223 | } |
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 66f38722253a..e2eec38c83c2 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
@@ -247,6 +247,8 @@ static void lg_del_vq(struct virtqueue *vq) | |||
247 | { | 247 | { |
248 | struct lguest_vq_info *lvq = vq->priv; | 248 | struct lguest_vq_info *lvq = vq->priv; |
249 | 249 | ||
250 | /* Release the interrupt */ | ||
251 | free_irq(lvq->config.irq, vq); | ||
250 | /* Tell virtio_ring.c to free the virtqueue. */ | 252 | /* Tell virtio_ring.c to free the virtqueue. */ |
251 | vring_del_virtqueue(vq); | 253 | vring_del_virtqueue(vq); |
252 | /* Unmap the pages containing the ring. */ | 254 | /* Unmap the pages containing the ring. */ |
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index f245a3b2ef47..ae36d101006b 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -1205,13 +1205,10 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int | |||
1205 | DEB_D(("VIDIOCGMBUF \n")); | 1205 | DEB_D(("VIDIOCGMBUF \n")); |
1206 | 1206 | ||
1207 | q = &fh->video_q; | 1207 | q = &fh->video_q; |
1208 | mutex_lock(&q->lock); | ||
1209 | err = videobuf_mmap_setup(q,gbuffers,gbufsize, | 1208 | err = videobuf_mmap_setup(q,gbuffers,gbufsize, |
1210 | V4L2_MEMORY_MMAP); | 1209 | V4L2_MEMORY_MMAP); |
1211 | if (err < 0) { | 1210 | if (err < 0) |
1212 | mutex_unlock(&q->lock); | ||
1213 | return err; | 1211 | return err; |
1214 | } | ||
1215 | 1212 | ||
1216 | gbuffers = err; | 1213 | gbuffers = err; |
1217 | memset(mbuf,0,sizeof(*mbuf)); | 1214 | memset(mbuf,0,sizeof(*mbuf)); |
@@ -1219,7 +1216,6 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int | |||
1219 | mbuf->size = gbuffers * gbufsize; | 1216 | mbuf->size = gbuffers * gbufsize; |
1220 | for (i = 0; i < gbuffers; i++) | 1217 | for (i = 0; i < gbuffers; i++) |
1221 | mbuf->offsets[i] = i * gbufsize; | 1218 | mbuf->offsets[i] = i * gbufsize; |
1222 | mutex_unlock(&q->lock); | ||
1223 | return 0; | 1219 | return 0; |
1224 | } | 1220 | } |
1225 | #endif | 1221 | #endif |
@@ -1440,10 +1436,7 @@ static void video_close(struct saa7146_dev *dev, struct file *file) | |||
1440 | err = saa7146_stop_preview(fh); | 1436 | err = saa7146_stop_preview(fh); |
1441 | } | 1437 | } |
1442 | 1438 | ||
1443 | // release all capture buffers | 1439 | videobuf_stop(q); |
1444 | mutex_lock(&q->lock); | ||
1445 | videobuf_read_stop(q); | ||
1446 | mutex_unlock(&q->lock); | ||
1447 | 1440 | ||
1448 | /* hmm, why is this function declared void? */ | 1441 | /* hmm, why is this function declared void? */ |
1449 | /* return err */ | 1442 | /* return err */ |
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile index 73ac0a93fdeb..60a910052c16 100644 --- a/drivers/media/dvb/dvb-usb/Makefile +++ b/drivers/media/dvb/dvb-usb/Makefile | |||
@@ -62,3 +62,6 @@ dvb-usb-af9005-remote-objs = af9005-remote.o | |||
62 | obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o | 62 | obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o |
63 | 63 | ||
64 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | 64 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ |
65 | # due to tuner-xc3028 | ||
66 | EXTRA_CFLAGS += -Idrivers/media/video | ||
67 | |||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c index 9a184da01c47..8ee6cd4da9e7 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c | |||
@@ -223,6 +223,9 @@ static struct dibx000_agc_config dib3000p_panasonic_agc_config = { | |||
223 | .agc2_slope2 = 0x1e, | 223 | .agc2_slope2 = 0x1e, |
224 | }; | 224 | }; |
225 | 225 | ||
226 | #if defined(CONFIG_DVB_DIB3000MC) || \ | ||
227 | (defined(CONFIG_DVB_DIB3000MC_MODULE) && defined(MODULE)) | ||
228 | |||
226 | static struct dib3000mc_config mod3000p_dib3000p_config = { | 229 | static struct dib3000mc_config mod3000p_dib3000p_config = { |
227 | &dib3000p_panasonic_agc_config, | 230 | &dib3000p_panasonic_agc_config, |
228 | 231 | ||
@@ -305,6 +308,7 @@ int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap) | |||
305 | return 0; | 308 | return 0; |
306 | } | 309 | } |
307 | EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); | 310 | EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); |
311 | #endif | ||
308 | 312 | ||
309 | /* | 313 | /* |
310 | * common remote control stuff | 314 | * common remote control stuff |
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c index 9a8ddc537f8f..9d26ace65151 100644 --- a/drivers/media/dvb/frontends/tda10086.c +++ b/drivers/media/dvb/frontends/tda10086.c | |||
@@ -158,7 +158,7 @@ static int tda10086_init(struct dvb_frontend* fe) | |||
158 | tda10086_write_byte(state, 0x3d, 0x80); | 158 | tda10086_write_byte(state, 0x3d, 0x80); |
159 | 159 | ||
160 | // setup SEC | 160 | // setup SEC |
161 | tda10086_write_byte(state, 0x36, 0x00); // all SEC off | 161 | tda10086_write_byte(state, 0x36, 0x80); // all SEC off, no 22k tone |
162 | tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency | 162 | tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency |
163 | tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // } | 163 | tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // } |
164 | 164 | ||
@@ -183,13 +183,13 @@ static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
183 | 183 | ||
184 | dprintk ("%s\n", __FUNCTION__); | 184 | dprintk ("%s\n", __FUNCTION__); |
185 | 185 | ||
186 | switch(tone) { | 186 | switch (tone) { |
187 | case SEC_TONE_OFF: | 187 | case SEC_TONE_OFF: |
188 | tda10086_write_byte(state, 0x36, 0x00); | 188 | tda10086_write_byte(state, 0x36, 0x80); |
189 | break; | 189 | break; |
190 | 190 | ||
191 | case SEC_TONE_ON: | 191 | case SEC_TONE_ON: |
192 | tda10086_write_byte(state, 0x36, 0x01); | 192 | tda10086_write_byte(state, 0x36, 0x81); |
193 | break; | 193 | break; |
194 | } | 194 | } |
195 | 195 | ||
@@ -212,7 +212,7 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe, | |||
212 | for(i=0; i< cmd->msg_len; i++) { | 212 | for(i=0; i< cmd->msg_len; i++) { |
213 | tda10086_write_byte(state, 0x48+i, cmd->msg[i]); | 213 | tda10086_write_byte(state, 0x48+i, cmd->msg[i]); |
214 | } | 214 | } |
215 | tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len - 1) << 4)); | 215 | tda10086_write_byte(state, 0x36, 0x88 | ((cmd->msg_len - 1) << 4)); |
216 | 216 | ||
217 | tda10086_diseqc_wait(state); | 217 | tda10086_diseqc_wait(state); |
218 | 218 | ||
@@ -230,11 +230,11 @@ static int tda10086_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minic | |||
230 | 230 | ||
231 | switch(minicmd) { | 231 | switch(minicmd) { |
232 | case SEC_MINI_A: | 232 | case SEC_MINI_A: |
233 | tda10086_write_byte(state, 0x36, 0x04); | 233 | tda10086_write_byte(state, 0x36, 0x84); |
234 | break; | 234 | break; |
235 | 235 | ||
236 | case SEC_MINI_B: | 236 | case SEC_MINI_B: |
237 | tda10086_write_byte(state, 0x36, 0x06); | 237 | tda10086_write_byte(state, 0x36, 0x86); |
238 | break; | 238 | break; |
239 | } | 239 | } |
240 | 240 | ||
diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c index a97a7fd2c891..0106df4c55e8 100644 --- a/drivers/media/dvb/frontends/zl10353.c +++ b/drivers/media/dvb/frontends/zl10353.c | |||
@@ -122,7 +122,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe, | |||
122 | enum fe_bandwidth bandwidth, | 122 | enum fe_bandwidth bandwidth, |
123 | u16 *nominal_rate) | 123 | u16 *nominal_rate) |
124 | { | 124 | { |
125 | u32 adc_clock = 22528; /* 20.480 MHz on the board(!?) */ | 125 | u32 adc_clock = 45056; /* 45.056 MHz */ |
126 | u8 bw; | 126 | u8 bw; |
127 | struct zl10353_state *state = fe->demodulator_priv; | 127 | struct zl10353_state *state = fe->demodulator_priv; |
128 | 128 | ||
@@ -142,7 +142,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe, | |||
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | 144 | ||
145 | *nominal_rate = (64 * bw * (1<<16) / (7 * 8) * 4000 / adc_clock + 2) / 4; | 145 | *nominal_rate = (bw * (1 << 23) / 7 * 125 + adc_clock / 2) / adc_clock; |
146 | 146 | ||
147 | dprintk("%s: bw %d, adc_clock %d => 0x%x\n", | 147 | dprintk("%s: bw %d, adc_clock %d => 0x%x\n", |
148 | __FUNCTION__, bw, adc_clock, *nominal_rate); | 148 | __FUNCTION__, bw, adc_clock, *nominal_rate); |
diff --git a/drivers/media/dvb/frontends/zl10353.h b/drivers/media/dvb/frontends/zl10353.h index cb274dc12b82..1c3d494a6da9 100644 --- a/drivers/media/dvb/frontends/zl10353.h +++ b/drivers/media/dvb/frontends/zl10353.h | |||
@@ -30,7 +30,7 @@ struct zl10353_config | |||
30 | u8 demod_address; | 30 | u8 demod_address; |
31 | 31 | ||
32 | /* frequencies in kHz */ | 32 | /* frequencies in kHz */ |
33 | int adc_clock; // default: 22528 | 33 | int adc_clock; /* default: 45056 */ |
34 | 34 | ||
35 | /* set if no pll is connected to the secondary i2c bus */ | 35 | /* set if no pll is connected to the secondary i2c bus */ |
36 | int no_tuner; | 36 | int no_tuner; |
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 3abd9fa54d2c..585d1ef95afd 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -5080,7 +5080,7 @@ static void PXC200_muxsel(struct bttv *btv, unsigned int input) | |||
5080 | /* ----------------------------------------------------------------------- */ | 5080 | /* ----------------------------------------------------------------------- */ |
5081 | /* motherboard chipset specific stuff */ | 5081 | /* motherboard chipset specific stuff */ |
5082 | 5082 | ||
5083 | void __devinit bttv_check_chipset(void) | 5083 | void __init bttv_check_chipset(void) |
5084 | { | 5084 | { |
5085 | int pcipci_fail = 0; | 5085 | int pcipci_fail = 0; |
5086 | struct pci_dev *dev = NULL; | 5086 | struct pci_dev *dev = NULL; |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index a88b56e6ca05..c02d92deacd2 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -3827,10 +3827,7 @@ static int bttv_release(struct inode *inode, struct file *file) | |||
3827 | 3827 | ||
3828 | /* stop vbi capture */ | 3828 | /* stop vbi capture */ |
3829 | if (check_btres(fh, RESOURCE_VBI)) { | 3829 | if (check_btres(fh, RESOURCE_VBI)) { |
3830 | if (fh->vbi.streaming) | 3830 | videobuf_stop(&fh->vbi); |
3831 | videobuf_streamoff(&fh->vbi); | ||
3832 | if (fh->vbi.reading) | ||
3833 | videobuf_read_stop(&fh->vbi); | ||
3834 | free_btres(btv,fh,RESOURCE_VBI); | 3831 | free_btres(btv,fh,RESOURCE_VBI); |
3835 | } | 3832 | } |
3836 | 3833 | ||
@@ -4988,7 +4985,7 @@ static struct pci_driver bttv_pci_driver = { | |||
4988 | #endif | 4985 | #endif |
4989 | }; | 4986 | }; |
4990 | 4987 | ||
4991 | static int bttv_init_module(void) | 4988 | static int __init bttv_init_module(void) |
4992 | { | 4989 | { |
4993 | int ret; | 4990 | int ret; |
4994 | 4991 | ||
@@ -5021,7 +5018,7 @@ static int bttv_init_module(void) | |||
5021 | return pci_register_driver(&bttv_pci_driver); | 5018 | return pci_register_driver(&bttv_pci_driver); |
5022 | } | 5019 | } |
5023 | 5020 | ||
5024 | static void bttv_cleanup_module(void) | 5021 | static void __exit bttv_cleanup_module(void) |
5025 | { | 5022 | { |
5026 | pci_unregister_driver(&bttv_pci_driver); | 5023 | pci_unregister_driver(&bttv_pci_driver); |
5027 | bus_unregister(&bttv_sub_bus_type); | 5024 | bus_unregister(&bttv_sub_bus_type); |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index f33f0b47142c..f802b5653569 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -1085,10 +1085,7 @@ static int mpeg_release(struct inode *inode, struct file *file) | |||
1085 | 1085 | ||
1086 | cx8802_cancel_buffers(fh->dev); | 1086 | cx8802_cancel_buffers(fh->dev); |
1087 | /* stop mpeg capture */ | 1087 | /* stop mpeg capture */ |
1088 | if (fh->mpegq.streaming) | 1088 | videobuf_stop(&fh->mpegq); |
1089 | videobuf_streamoff(&fh->mpegq); | ||
1090 | if (fh->mpegq.reading) | ||
1091 | videobuf_read_stop(&fh->mpegq); | ||
1092 | 1089 | ||
1093 | videobuf_mmap_free(&fh->mpegq); | 1090 | videobuf_mmap_free(&fh->mpegq); |
1094 | file->private_data = NULL; | 1091 | file->private_data = NULL; |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 5ee05f8f3fad..c84dafbdb991 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -851,10 +851,7 @@ static int video_release(struct inode *inode, struct file *file) | |||
851 | 851 | ||
852 | /* stop vbi capture */ | 852 | /* stop vbi capture */ |
853 | if (res_check(fh, RESOURCE_VBI)) { | 853 | if (res_check(fh, RESOURCE_VBI)) { |
854 | if (fh->vbiq.streaming) | 854 | videobuf_stop(&fh->vbiq); |
855 | videobuf_streamoff(&fh->vbiq); | ||
856 | if (fh->vbiq.reading) | ||
857 | videobuf_read_stop(&fh->vbiq); | ||
858 | res_free(dev,fh,RESOURCE_VBI); | 855 | res_free(dev,fh,RESOURCE_VBI); |
859 | } | 856 | } |
860 | 857 | ||
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 2529c298b862..0906bc5766cc 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -144,7 +144,8 @@ static int em28xx_config(struct em28xx *dev) | |||
144 | { | 144 | { |
145 | 145 | ||
146 | /* Sets I2C speed to 100 KHz */ | 146 | /* Sets I2C speed to 100 KHz */ |
147 | em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1); | 147 | if (!dev->is_em2800) |
148 | em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1); | ||
148 | 149 | ||
149 | /* enable vbi capturing */ | 150 | /* enable vbi capturing */ |
150 | 151 | ||
@@ -570,7 +571,9 @@ static void em28xx_vm_close(struct vm_area_struct *vma) | |||
570 | { | 571 | { |
571 | /* NOTE: buffers are not freed here */ | 572 | /* NOTE: buffers are not freed here */ |
572 | struct em28xx_frame_t *f = vma->vm_private_data; | 573 | struct em28xx_frame_t *f = vma->vm_private_data; |
573 | f->vma_use_count--; | 574 | |
575 | if (f->vma_use_count) | ||
576 | f->vma_use_count--; | ||
574 | } | 577 | } |
575 | 578 | ||
576 | static struct vm_operations_struct em28xx_vm_ops = { | 579 | static struct vm_operations_struct em28xx_vm_ops = { |
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 623eea2652ca..77b27dc750b1 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -706,7 +706,7 @@ void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg) | |||
706 | } | 706 | } |
707 | 707 | ||
708 | /* init + register i2c algo-bit adapter */ | 708 | /* init + register i2c algo-bit adapter */ |
709 | int __devinit init_ivtv_i2c(struct ivtv *itv) | 709 | int init_ivtv_i2c(struct ivtv *itv) |
710 | { | 710 | { |
711 | IVTV_DEBUG_I2C("i2c init\n"); | 711 | IVTV_DEBUG_I2C("i2c init\n"); |
712 | 712 | ||
diff --git a/drivers/media/video/ivtv/ivtv-i2c.h b/drivers/media/video/ivtv/ivtv-i2c.h index de6a07442298..987042c09b64 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.h +++ b/drivers/media/video/ivtv/ivtv-i2c.h | |||
@@ -35,7 +35,7 @@ int ivtv_call_i2c_client(struct ivtv *itv, int addr, unsigned int cmd, void *arg | |||
35 | void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg); | 35 | void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg); |
36 | 36 | ||
37 | /* init + register i2c algo-bit adapter */ | 37 | /* init + register i2c algo-bit adapter */ |
38 | int __devinit init_ivtv_i2c(struct ivtv *itv); | 38 | int init_ivtv_i2c(struct ivtv *itv); |
39 | void exit_ivtv_i2c(struct ivtv *itv); | 39 | void exit_ivtv_i2c(struct ivtv *itv); |
40 | 40 | ||
41 | #endif | 41 | #endif |
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index aa03e61ef310..74fb0e021979 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -76,7 +76,7 @@ static struct { | |||
76 | int minor_offset; | 76 | int minor_offset; |
77 | int dma, pio; | 77 | int dma, pio; |
78 | enum v4l2_buf_type buf_type; | 78 | enum v4l2_buf_type buf_type; |
79 | struct file_operations *fops; | 79 | const struct file_operations *fops; |
80 | } ivtv_stream_info[] = { | 80 | } ivtv_stream_info[] = { |
81 | { /* IVTV_ENC_STREAM_TYPE_MPG */ | 81 | { /* IVTV_ENC_STREAM_TYPE_MPG */ |
82 | "encoder MPG", | 82 | "encoder MPG", |
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index ad0232935df6..996b49491f5a 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c | |||
@@ -187,12 +187,14 @@ static int i2c_senddata(struct saa5246a_device *t, ...) | |||
187 | { | 187 | { |
188 | unsigned char buf[64]; | 188 | unsigned char buf[64]; |
189 | int v; | 189 | int v; |
190 | int ct=0; | 190 | int ct = 0; |
191 | va_list argp; | 191 | va_list argp; |
192 | va_start(argp,t); | 192 | va_start(argp, t); |
193 | 193 | ||
194 | while((v=va_arg(argp,int))!=-1) | 194 | while ((v = va_arg(argp, int)) != -1) |
195 | buf[ct++]=v; | 195 | buf[ct++] = v; |
196 | |||
197 | va_end(argp); | ||
196 | return i2c_sendbuf(t, buf[0], ct-1, buf+1); | 198 | return i2c_sendbuf(t, buf[0], ct-1, buf+1); |
197 | } | 199 | } |
198 | 200 | ||
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 94bb59a32b17..f55d6e85f20f 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c | |||
@@ -282,12 +282,14 @@ static int i2c_senddata(struct saa5249_device *t, ...) | |||
282 | { | 282 | { |
283 | unsigned char buf[64]; | 283 | unsigned char buf[64]; |
284 | int v; | 284 | int v; |
285 | int ct=0; | 285 | int ct = 0; |
286 | va_list argp; | 286 | va_list argp; |
287 | va_start(argp,t); | 287 | va_start(argp,t); |
288 | 288 | ||
289 | while((v=va_arg(argp,int))!=-1) | 289 | while ((v = va_arg(argp, int)) != -1) |
290 | buf[ct++]=v; | 290 | buf[ct++] = v; |
291 | |||
292 | va_end(argp); | ||
291 | return i2c_sendbuf(t, buf[0], ct-1, buf+1); | 293 | return i2c_sendbuf(t, buf[0], ct-1, buf+1); |
292 | } | 294 | } |
293 | 295 | ||
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index b9c5cf7dc849..4878f3067787 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c | |||
@@ -222,7 +222,8 @@ static irqreturn_t saa7134_alsa_irq(int irq, void *dev_id) | |||
222 | 222 | ||
223 | if (report & SAA7134_IRQ_REPORT_DONE_RA3) { | 223 | if (report & SAA7134_IRQ_REPORT_DONE_RA3) { |
224 | handled = 1; | 224 | handled = 1; |
225 | saa_writel(SAA7134_IRQ_REPORT,report); | 225 | saa_writel(SAA7134_IRQ_REPORT, |
226 | SAA7134_IRQ_REPORT_DONE_RA3); | ||
226 | saa7134_irq_alsa_done(dev, status); | 227 | saa7134_irq_alsa_done(dev, status); |
227 | } else { | 228 | } else { |
228 | goto out; | 229 | goto out; |
@@ -457,7 +458,7 @@ static struct snd_pcm_hardware snd_card_saa7134_capture = | |||
457 | .buffer_bytes_max = (256*1024), | 458 | .buffer_bytes_max = (256*1024), |
458 | .period_bytes_min = 64, | 459 | .period_bytes_min = 64, |
459 | .period_bytes_max = (256*1024), | 460 | .period_bytes_max = (256*1024), |
460 | .periods_min = 2, | 461 | .periods_min = 4, |
461 | .periods_max = 1024, | 462 | .periods_max = 1024, |
462 | }; | 463 | }; |
463 | 464 | ||
@@ -491,7 +492,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, | |||
491 | 492 | ||
492 | snd_assert(period_size >= 0x100 && period_size <= 0x10000, | 493 | snd_assert(period_size >= 0x100 && period_size <= 0x10000, |
493 | return -EINVAL); | 494 | return -EINVAL); |
494 | snd_assert(periods >= 2, return -EINVAL); | 495 | snd_assert(periods >= 4, return -EINVAL); |
495 | snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL); | 496 | snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL); |
496 | 497 | ||
497 | dev = saa7134->dev; | 498 | dev = saa7134->dev; |
@@ -647,7 +648,14 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream) | |||
647 | saa7134_tvaudio_setmute(dev); | 648 | saa7134_tvaudio_setmute(dev); |
648 | } | 649 | } |
649 | 650 | ||
650 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) | 651 | err = snd_pcm_hw_constraint_integer(runtime, |
652 | SNDRV_PCM_HW_PARAM_PERIODS); | ||
653 | if (err < 0) | ||
654 | return err; | ||
655 | |||
656 | err = snd_pcm_hw_constraint_step(runtime, 0, | ||
657 | SNDRV_PCM_HW_PARAM_PERIODS, 2); | ||
658 | if (err < 0) | ||
651 | return err; | 659 | return err; |
652 | 660 | ||
653 | return 0; | 661 | return 0; |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 4f3dad9ae6d6..c6eb1e37a46e 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -334,7 +334,7 @@ struct saa7134_board saa7134_boards[] = { | |||
334 | .tv = 1, | 334 | .tv = 1, |
335 | },{ | 335 | },{ |
336 | .name = name_comp1, | 336 | .name = name_comp1, |
337 | .vmux = 2, | 337 | .vmux = 0, |
338 | .amux = LINE1, | 338 | .amux = LINE1, |
339 | },{ | 339 | },{ |
340 | .name = name_comp2, | 340 | .name = name_comp2, |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index a499eea379e6..4fd187ac9d70 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -569,21 +569,22 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id) | |||
569 | for (loop = 0; loop < 10; loop++) { | 569 | for (loop = 0; loop < 10; loop++) { |
570 | report = saa_readl(SAA7134_IRQ_REPORT); | 570 | report = saa_readl(SAA7134_IRQ_REPORT); |
571 | status = saa_readl(SAA7134_IRQ_STATUS); | 571 | status = saa_readl(SAA7134_IRQ_STATUS); |
572 | if (0 == report) { | ||
573 | if (irq_debug > 1) | ||
574 | printk(KERN_DEBUG "%s/irq: no (more) work\n", | ||
575 | dev->name); | ||
576 | goto out; | ||
577 | } | ||
578 | |||
579 | /* If dmasound support is active and we get a sound report, exit | ||
580 | and let the saa7134-alsa/oss module deal with it */ | ||
581 | 572 | ||
573 | /* If dmasound support is active and we get a sound report, | ||
574 | * mask out the report and let the saa7134-alsa module deal | ||
575 | * with it */ | ||
582 | if ((report & SAA7134_IRQ_REPORT_DONE_RA3) && | 576 | if ((report & SAA7134_IRQ_REPORT_DONE_RA3) && |
583 | (dev->dmasound.priv_data != NULL) ) | 577 | (dev->dmasound.priv_data != NULL) ) |
584 | { | 578 | { |
585 | if (irq_debug > 1) | 579 | if (irq_debug > 1) |
586 | printk(KERN_DEBUG "%s/irq: ignoring interrupt for DMA sound\n", | 580 | printk(KERN_DEBUG "%s/irq: preserving DMA sound interrupt\n", |
581 | dev->name); | ||
582 | report &= ~SAA7134_IRQ_REPORT_DONE_RA3; | ||
583 | } | ||
584 | |||
585 | if (0 == report) { | ||
586 | if (irq_debug > 1) | ||
587 | printk(KERN_DEBUG "%s/irq: no (more) work\n", | ||
587 | dev->name); | 588 | dev->name); |
588 | goto out; | 589 | goto out; |
589 | } | 590 | } |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 38d87332cc5d..e1ab099ec4c6 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -662,6 +662,7 @@ static struct tda1004x_config hauppauge_hvr_1110_config = { | |||
662 | .if_freq = TDA10046_FREQ_045, | 662 | .if_freq = TDA10046_FREQ_045, |
663 | .i2c_gate = 0x4b, | 663 | .i2c_gate = 0x4b, |
664 | .tuner_address = 0x61, | 664 | .tuner_address = 0x61, |
665 | .tuner_config = 1, | ||
665 | .request_firmware = philips_tda1004x_request_firmware | 666 | .request_firmware = philips_tda1004x_request_firmware |
666 | }; | 667 | }; |
667 | 668 | ||
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 75d0c5bf46d2..9322f44865b8 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -110,11 +110,8 @@ static int ts_release(struct inode *inode, struct file *file) | |||
110 | { | 110 | { |
111 | struct saa7134_dev *dev = file->private_data; | 111 | struct saa7134_dev *dev = file->private_data; |
112 | 112 | ||
113 | if (dev->empress_tsq.streaming) | ||
114 | videobuf_streamoff(&dev->empress_tsq); | ||
115 | mutex_lock(&dev->empress_tsq.lock); | 113 | mutex_lock(&dev->empress_tsq.lock); |
116 | if (dev->empress_tsq.reading) | 114 | videobuf_stop(&dev->empress_tsq); |
117 | videobuf_read_stop(&dev->empress_tsq); | ||
118 | videobuf_mmap_free(&dev->empress_tsq); | 115 | videobuf_mmap_free(&dev->empress_tsq); |
119 | dev->empress_users--; | 116 | dev->empress_users--; |
120 | 117 | ||
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 3b9ffb4b648a..6396d9b5c063 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1445,10 +1445,7 @@ static int video_release(struct inode *inode, struct file *file) | |||
1445 | 1445 | ||
1446 | /* stop vbi capture */ | 1446 | /* stop vbi capture */ |
1447 | if (res_check(fh, RESOURCE_VBI)) { | 1447 | if (res_check(fh, RESOURCE_VBI)) { |
1448 | if (fh->vbi.streaming) | 1448 | videobuf_stop(&fh->vbi); |
1449 | videobuf_streamoff(&fh->vbi); | ||
1450 | if (fh->vbi.reading) | ||
1451 | videobuf_read_stop(&fh->vbi); | ||
1452 | res_free(dev,fh,RESOURCE_VBI); | 1449 | res_free(dev,fh,RESOURCE_VBI); |
1453 | } | 1450 | } |
1454 | 1451 | ||
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 25d0aef88ef5..445eba4174d7 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
@@ -290,6 +290,7 @@ static inline void tvp5150_selmux(struct i2c_client *c) | |||
290 | int opmode=0; | 290 | int opmode=0; |
291 | struct tvp5150 *decoder = i2c_get_clientdata(c); | 291 | struct tvp5150 *decoder = i2c_get_clientdata(c); |
292 | int input = 0; | 292 | int input = 0; |
293 | unsigned char val; | ||
293 | 294 | ||
294 | if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable) | 295 | if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable) |
295 | input = 8; | 296 | input = 8; |
@@ -315,6 +316,16 @@ static inline void tvp5150_selmux(struct i2c_client *c) | |||
315 | 316 | ||
316 | tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode); | 317 | tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode); |
317 | tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input); | 318 | tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input); |
319 | |||
320 | /* Svideo should enable YCrCb output and disable GPCL output | ||
321 | * For Composite and TV, it should be the reverse | ||
322 | */ | ||
323 | val = tvp5150_read(c, TVP5150_MISC_CTL); | ||
324 | if (decoder->route.input == TVP5150_SVIDEO) | ||
325 | val = (val & ~0x40) | 0x10; | ||
326 | else | ||
327 | val = (val & ~0x10) | 0x40; | ||
328 | tvp5150_write(c, TVP5150_MISC_CTL, val); | ||
318 | }; | 329 | }; |
319 | 330 | ||
320 | struct i2c_reg_value { | 331 | struct i2c_reg_value { |
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 89a44f16f0ba..81f77d2b4bd3 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c | |||
@@ -141,6 +141,7 @@ void videobuf_queue_core_init(struct videobuf_queue* q, | |||
141 | INIT_LIST_HEAD(&q->stream); | 141 | INIT_LIST_HEAD(&q->stream); |
142 | } | 142 | } |
143 | 143 | ||
144 | /* Locking: Only usage in bttv unsafe find way to remove */ | ||
144 | int videobuf_queue_is_busy(struct videobuf_queue *q) | 145 | int videobuf_queue_is_busy(struct videobuf_queue *q) |
145 | { | 146 | { |
146 | int i; | 147 | int i; |
@@ -178,6 +179,7 @@ int videobuf_queue_is_busy(struct videobuf_queue *q) | |||
178 | return 0; | 179 | return 0; |
179 | } | 180 | } |
180 | 181 | ||
182 | /* Locking: Caller holds q->lock */ | ||
181 | void videobuf_queue_cancel(struct videobuf_queue *q) | 183 | void videobuf_queue_cancel(struct videobuf_queue *q) |
182 | { | 184 | { |
183 | unsigned long flags=0; | 185 | unsigned long flags=0; |
@@ -208,6 +210,7 @@ void videobuf_queue_cancel(struct videobuf_queue *q) | |||
208 | 210 | ||
209 | /* --------------------------------------------------------------------- */ | 211 | /* --------------------------------------------------------------------- */ |
210 | 212 | ||
213 | /* Locking: Caller holds q->lock */ | ||
211 | enum v4l2_field videobuf_next_field(struct videobuf_queue *q) | 214 | enum v4l2_field videobuf_next_field(struct videobuf_queue *q) |
212 | { | 215 | { |
213 | enum v4l2_field field = q->field; | 216 | enum v4l2_field field = q->field; |
@@ -226,6 +229,7 @@ enum v4l2_field videobuf_next_field(struct videobuf_queue *q) | |||
226 | return field; | 229 | return field; |
227 | } | 230 | } |
228 | 231 | ||
232 | /* Locking: Caller holds q->lock */ | ||
229 | static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, | 233 | static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, |
230 | struct videobuf_buffer *vb, enum v4l2_buf_type type) | 234 | struct videobuf_buffer *vb, enum v4l2_buf_type type) |
231 | { | 235 | { |
@@ -281,20 +285,108 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, | |||
281 | b->sequence = vb->field_count >> 1; | 285 | b->sequence = vb->field_count >> 1; |
282 | } | 286 | } |
283 | 287 | ||
288 | /* Locking: Caller holds q->lock */ | ||
289 | static int __videobuf_mmap_free(struct videobuf_queue *q) | ||
290 | { | ||
291 | int i; | ||
292 | int rc; | ||
293 | |||
294 | if (!q) | ||
295 | return 0; | ||
296 | |||
297 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | ||
298 | |||
299 | rc = CALL(q,mmap_free,q); | ||
300 | if (rc<0) | ||
301 | return rc; | ||
302 | |||
303 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | ||
304 | if (NULL == q->bufs[i]) | ||
305 | continue; | ||
306 | q->ops->buf_release(q,q->bufs[i]); | ||
307 | kfree(q->bufs[i]); | ||
308 | q->bufs[i] = NULL; | ||
309 | } | ||
310 | |||
311 | return rc; | ||
312 | } | ||
313 | |||
314 | int videobuf_mmap_free(struct videobuf_queue *q) | ||
315 | { | ||
316 | int ret; | ||
317 | mutex_lock(&q->lock); | ||
318 | ret = __videobuf_mmap_free(q); | ||
319 | mutex_unlock(&q->lock); | ||
320 | return ret; | ||
321 | } | ||
322 | |||
323 | /* Locking: Caller holds q->lock */ | ||
324 | static int __videobuf_mmap_setup(struct videobuf_queue *q, | ||
325 | unsigned int bcount, unsigned int bsize, | ||
326 | enum v4l2_memory memory) | ||
327 | { | ||
328 | unsigned int i; | ||
329 | int err; | ||
330 | |||
331 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | ||
332 | |||
333 | err = __videobuf_mmap_free(q); | ||
334 | if (0 != err) | ||
335 | return err; | ||
336 | |||
337 | /* Allocate and initialize buffers */ | ||
338 | for (i = 0; i < bcount; i++) { | ||
339 | q->bufs[i] = videobuf_alloc(q); | ||
340 | |||
341 | if (q->bufs[i] == NULL) | ||
342 | break; | ||
343 | |||
344 | q->bufs[i]->i = i; | ||
345 | q->bufs[i]->input = UNSET; | ||
346 | q->bufs[i]->memory = memory; | ||
347 | q->bufs[i]->bsize = bsize; | ||
348 | switch (memory) { | ||
349 | case V4L2_MEMORY_MMAP: | ||
350 | q->bufs[i]->boff = bsize * i; | ||
351 | break; | ||
352 | case V4L2_MEMORY_USERPTR: | ||
353 | case V4L2_MEMORY_OVERLAY: | ||
354 | /* nothing */ | ||
355 | break; | ||
356 | } | ||
357 | } | ||
358 | |||
359 | if (!i) | ||
360 | return -ENOMEM; | ||
361 | |||
362 | dprintk(1,"mmap setup: %d buffers, %d bytes each\n", | ||
363 | i, bsize); | ||
364 | |||
365 | return i; | ||
366 | } | ||
367 | |||
368 | int videobuf_mmap_setup(struct videobuf_queue *q, | ||
369 | unsigned int bcount, unsigned int bsize, | ||
370 | enum v4l2_memory memory) | ||
371 | { | ||
372 | int ret; | ||
373 | mutex_lock(&q->lock); | ||
374 | ret = __videobuf_mmap_setup(q, bcount, bsize, memory); | ||
375 | mutex_unlock(&q->lock); | ||
376 | return ret; | ||
377 | } | ||
378 | |||
284 | int videobuf_reqbufs(struct videobuf_queue *q, | 379 | int videobuf_reqbufs(struct videobuf_queue *q, |
285 | struct v4l2_requestbuffers *req) | 380 | struct v4l2_requestbuffers *req) |
286 | { | 381 | { |
287 | unsigned int size,count; | 382 | unsigned int size,count; |
288 | int retval; | 383 | int retval; |
289 | 384 | ||
290 | if (req->type != q->type) { | ||
291 | dprintk(1,"reqbufs: queue type invalid\n"); | ||
292 | return -EINVAL; | ||
293 | } | ||
294 | if (req->count < 1) { | 385 | if (req->count < 1) { |
295 | dprintk(1,"reqbufs: count invalid (%d)\n",req->count); | 386 | dprintk(1,"reqbufs: count invalid (%d)\n",req->count); |
296 | return -EINVAL; | 387 | return -EINVAL; |
297 | } | 388 | } |
389 | |||
298 | if (req->memory != V4L2_MEMORY_MMAP && | 390 | if (req->memory != V4L2_MEMORY_MMAP && |
299 | req->memory != V4L2_MEMORY_USERPTR && | 391 | req->memory != V4L2_MEMORY_USERPTR && |
300 | req->memory != V4L2_MEMORY_OVERLAY) { | 392 | req->memory != V4L2_MEMORY_OVERLAY) { |
@@ -303,6 +395,12 @@ int videobuf_reqbufs(struct videobuf_queue *q, | |||
303 | } | 395 | } |
304 | 396 | ||
305 | mutex_lock(&q->lock); | 397 | mutex_lock(&q->lock); |
398 | if (req->type != q->type) { | ||
399 | dprintk(1,"reqbufs: queue type invalid\n"); | ||
400 | retval = -EINVAL; | ||
401 | goto done; | ||
402 | } | ||
403 | |||
306 | if (q->streaming) { | 404 | if (q->streaming) { |
307 | dprintk(1,"reqbufs: streaming already exists\n"); | 405 | dprintk(1,"reqbufs: streaming already exists\n"); |
308 | retval = -EBUSY; | 406 | retval = -EBUSY; |
@@ -323,7 +421,7 @@ int videobuf_reqbufs(struct videobuf_queue *q, | |||
323 | dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n", | 421 | dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n", |
324 | count, size, (count*size)>>PAGE_SHIFT); | 422 | count, size, (count*size)>>PAGE_SHIFT); |
325 | 423 | ||
326 | retval = videobuf_mmap_setup(q,count,size,req->memory); | 424 | retval = __videobuf_mmap_setup(q,count,size,req->memory); |
327 | if (retval < 0) { | 425 | if (retval < 0) { |
328 | dprintk(1,"reqbufs: mmap setup returned %d\n",retval); | 426 | dprintk(1,"reqbufs: mmap setup returned %d\n",retval); |
329 | goto done; | 427 | goto done; |
@@ -338,20 +436,28 @@ int videobuf_reqbufs(struct videobuf_queue *q, | |||
338 | 436 | ||
339 | int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) | 437 | int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) |
340 | { | 438 | { |
439 | int ret = -EINVAL; | ||
440 | |||
441 | mutex_lock(&q->lock); | ||
341 | if (unlikely(b->type != q->type)) { | 442 | if (unlikely(b->type != q->type)) { |
342 | dprintk(1,"querybuf: Wrong type.\n"); | 443 | dprintk(1,"querybuf: Wrong type.\n"); |
343 | return -EINVAL; | 444 | goto done; |
344 | } | 445 | } |
345 | if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) { | 446 | if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) { |
346 | dprintk(1,"querybuf: index out of range.\n"); | 447 | dprintk(1,"querybuf: index out of range.\n"); |
347 | return -EINVAL; | 448 | goto done; |
348 | } | 449 | } |
349 | if (unlikely(NULL == q->bufs[b->index])) { | 450 | if (unlikely(NULL == q->bufs[b->index])) { |
350 | dprintk(1,"querybuf: buffer is null.\n"); | 451 | dprintk(1,"querybuf: buffer is null.\n"); |
351 | return -EINVAL; | 452 | goto done; |
352 | } | 453 | } |
454 | |||
353 | videobuf_status(q,b,q->bufs[b->index],q->type); | 455 | videobuf_status(q,b,q->bufs[b->index],q->type); |
354 | return 0; | 456 | |
457 | ret = 0; | ||
458 | done: | ||
459 | mutex_unlock(&q->lock); | ||
460 | return ret; | ||
355 | } | 461 | } |
356 | 462 | ||
357 | int videobuf_qbuf(struct videobuf_queue *q, | 463 | int videobuf_qbuf(struct videobuf_queue *q, |
@@ -541,22 +647,30 @@ int videobuf_streamon(struct videobuf_queue *q) | |||
541 | return retval; | 647 | return retval; |
542 | } | 648 | } |
543 | 649 | ||
544 | int videobuf_streamoff(struct videobuf_queue *q) | 650 | /* Locking: Caller holds q->lock */ |
651 | static int __videobuf_streamoff(struct videobuf_queue *q) | ||
545 | { | 652 | { |
546 | int retval = -EINVAL; | ||
547 | |||
548 | mutex_lock(&q->lock); | ||
549 | if (!q->streaming) | 653 | if (!q->streaming) |
550 | goto done; | 654 | return -EINVAL; |
655 | |||
551 | videobuf_queue_cancel(q); | 656 | videobuf_queue_cancel(q); |
552 | q->streaming = 0; | 657 | q->streaming = 0; |
553 | retval = 0; | ||
554 | 658 | ||
555 | done: | 659 | return 0; |
660 | } | ||
661 | |||
662 | int videobuf_streamoff(struct videobuf_queue *q) | ||
663 | { | ||
664 | int retval; | ||
665 | |||
666 | mutex_lock(&q->lock); | ||
667 | retval = __videobuf_streamoff(q); | ||
556 | mutex_unlock(&q->lock); | 668 | mutex_unlock(&q->lock); |
669 | |||
557 | return retval; | 670 | return retval; |
558 | } | 671 | } |
559 | 672 | ||
673 | /* Locking: Caller holds q->lock */ | ||
560 | static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, | 674 | static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, |
561 | char __user *data, | 675 | char __user *data, |
562 | size_t count, loff_t *ppos) | 676 | size_t count, loff_t *ppos) |
@@ -691,7 +805,8 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
691 | return retval; | 805 | return retval; |
692 | } | 806 | } |
693 | 807 | ||
694 | int videobuf_read_start(struct videobuf_queue *q) | 808 | /* Locking: Caller holds q->lock */ |
809 | int __videobuf_read_start(struct videobuf_queue *q) | ||
695 | { | 810 | { |
696 | enum v4l2_field field; | 811 | enum v4l2_field field; |
697 | unsigned long flags=0; | 812 | unsigned long flags=0; |
@@ -705,7 +820,7 @@ int videobuf_read_start(struct videobuf_queue *q) | |||
705 | count = VIDEO_MAX_FRAME; | 820 | count = VIDEO_MAX_FRAME; |
706 | size = PAGE_ALIGN(size); | 821 | size = PAGE_ALIGN(size); |
707 | 822 | ||
708 | err = videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR); | 823 | err = __videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR); |
709 | if (err < 0) | 824 | if (err < 0) |
710 | return err; | 825 | return err; |
711 | 826 | ||
@@ -728,12 +843,13 @@ int videobuf_read_start(struct videobuf_queue *q) | |||
728 | return 0; | 843 | return 0; |
729 | } | 844 | } |
730 | 845 | ||
731 | void videobuf_read_stop(struct videobuf_queue *q) | 846 | static void __videobuf_read_stop(struct videobuf_queue *q) |
732 | { | 847 | { |
733 | int i; | 848 | int i; |
734 | 849 | ||
850 | |||
735 | videobuf_queue_cancel(q); | 851 | videobuf_queue_cancel(q); |
736 | videobuf_mmap_free(q); | 852 | __videobuf_mmap_free(q); |
737 | INIT_LIST_HEAD(&q->stream); | 853 | INIT_LIST_HEAD(&q->stream); |
738 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | 854 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { |
739 | if (NULL == q->bufs[i]) | 855 | if (NULL == q->bufs[i]) |
@@ -743,8 +859,41 @@ void videobuf_read_stop(struct videobuf_queue *q) | |||
743 | } | 859 | } |
744 | q->read_buf = NULL; | 860 | q->read_buf = NULL; |
745 | q->reading = 0; | 861 | q->reading = 0; |
862 | |||
746 | } | 863 | } |
747 | 864 | ||
865 | int videobuf_read_start(struct videobuf_queue *q) | ||
866 | { | ||
867 | int rc; | ||
868 | |||
869 | mutex_lock(&q->lock); | ||
870 | rc = __videobuf_read_start(q); | ||
871 | mutex_unlock(&q->lock); | ||
872 | |||
873 | return rc; | ||
874 | } | ||
875 | |||
876 | void videobuf_read_stop(struct videobuf_queue *q) | ||
877 | { | ||
878 | mutex_lock(&q->lock); | ||
879 | __videobuf_read_stop(q); | ||
880 | mutex_unlock(&q->lock); | ||
881 | } | ||
882 | |||
883 | void videobuf_stop(struct videobuf_queue *q) | ||
884 | { | ||
885 | mutex_lock(&q->lock); | ||
886 | |||
887 | if (q->streaming) | ||
888 | __videobuf_streamoff(q); | ||
889 | |||
890 | if (q->reading) | ||
891 | __videobuf_read_stop(q); | ||
892 | |||
893 | mutex_unlock(&q->lock); | ||
894 | } | ||
895 | |||
896 | |||
748 | ssize_t videobuf_read_stream(struct videobuf_queue *q, | 897 | ssize_t videobuf_read_stream(struct videobuf_queue *q, |
749 | char __user *data, size_t count, loff_t *ppos, | 898 | char __user *data, size_t count, loff_t *ppos, |
750 | int vbihack, int nonblocking) | 899 | int vbihack, int nonblocking) |
@@ -858,75 +1007,6 @@ unsigned int videobuf_poll_stream(struct file *file, | |||
858 | return rc; | 1007 | return rc; |
859 | } | 1008 | } |
860 | 1009 | ||
861 | int videobuf_mmap_setup(struct videobuf_queue *q, | ||
862 | unsigned int bcount, unsigned int bsize, | ||
863 | enum v4l2_memory memory) | ||
864 | { | ||
865 | unsigned int i; | ||
866 | int err; | ||
867 | |||
868 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | ||
869 | |||
870 | err = videobuf_mmap_free(q); | ||
871 | if (0 != err) | ||
872 | return err; | ||
873 | |||
874 | /* Allocate and initialize buffers */ | ||
875 | for (i = 0; i < bcount; i++) { | ||
876 | q->bufs[i] = videobuf_alloc(q); | ||
877 | |||
878 | if (q->bufs[i] == NULL) | ||
879 | break; | ||
880 | |||
881 | q->bufs[i]->i = i; | ||
882 | q->bufs[i]->input = UNSET; | ||
883 | q->bufs[i]->memory = memory; | ||
884 | q->bufs[i]->bsize = bsize; | ||
885 | switch (memory) { | ||
886 | case V4L2_MEMORY_MMAP: | ||
887 | q->bufs[i]->boff = bsize * i; | ||
888 | break; | ||
889 | case V4L2_MEMORY_USERPTR: | ||
890 | case V4L2_MEMORY_OVERLAY: | ||
891 | /* nothing */ | ||
892 | break; | ||
893 | } | ||
894 | } | ||
895 | |||
896 | if (!i) | ||
897 | return -ENOMEM; | ||
898 | |||
899 | dprintk(1,"mmap setup: %d buffers, %d bytes each\n", | ||
900 | i, bsize); | ||
901 | |||
902 | return i; | ||
903 | } | ||
904 | |||
905 | int videobuf_mmap_free(struct videobuf_queue *q) | ||
906 | { | ||
907 | int i; | ||
908 | int rc; | ||
909 | |||
910 | if (!q) | ||
911 | return 0; | ||
912 | |||
913 | MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); | ||
914 | |||
915 | rc = CALL(q,mmap_free,q); | ||
916 | if (rc<0) | ||
917 | return rc; | ||
918 | |||
919 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | ||
920 | if (NULL == q->bufs[i]) | ||
921 | continue; | ||
922 | q->ops->buf_release(q,q->bufs[i]); | ||
923 | kfree(q->bufs[i]); | ||
924 | q->bufs[i] = NULL; | ||
925 | } | ||
926 | |||
927 | return rc; | ||
928 | } | ||
929 | |||
930 | int videobuf_mmap_mapper(struct videobuf_queue *q, | 1010 | int videobuf_mmap_mapper(struct videobuf_queue *q, |
931 | struct vm_area_struct *vma) | 1011 | struct vm_area_struct *vma) |
932 | { | 1012 | { |
@@ -991,6 +1071,7 @@ EXPORT_SYMBOL_GPL(videobuf_streamoff); | |||
991 | 1071 | ||
992 | EXPORT_SYMBOL_GPL(videobuf_read_start); | 1072 | EXPORT_SYMBOL_GPL(videobuf_read_start); |
993 | EXPORT_SYMBOL_GPL(videobuf_read_stop); | 1073 | EXPORT_SYMBOL_GPL(videobuf_read_stop); |
1074 | EXPORT_SYMBOL_GPL(videobuf_stop); | ||
994 | EXPORT_SYMBOL_GPL(videobuf_read_stream); | 1075 | EXPORT_SYMBOL_GPL(videobuf_read_stream); |
995 | EXPORT_SYMBOL_GPL(videobuf_read_one); | 1076 | EXPORT_SYMBOL_GPL(videobuf_read_one); |
996 | EXPORT_SYMBOL_GPL(videobuf_poll_stream); | 1077 | EXPORT_SYMBOL_GPL(videobuf_poll_stream); |
diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c index cd74341c984f..e01259438bb2 100644 --- a/drivers/media/video/videobuf-vmalloc.c +++ b/drivers/media/video/videobuf-vmalloc.c | |||
@@ -51,7 +51,7 @@ videobuf_vm_open(struct vm_area_struct *vma) | |||
51 | { | 51 | { |
52 | struct videobuf_mapping *map = vma->vm_private_data; | 52 | struct videobuf_mapping *map = vma->vm_private_data; |
53 | 53 | ||
54 | dprintk(2,"vm_open %p [count=%d,vma=%08lx-%08lx]\n",map, | 54 | dprintk(2,"vm_open %p [count=%u,vma=%08lx-%08lx]\n",map, |
55 | map->count,vma->vm_start,vma->vm_end); | 55 | map->count,vma->vm_start,vma->vm_end); |
56 | 56 | ||
57 | map->count++; | 57 | map->count++; |
@@ -64,7 +64,7 @@ videobuf_vm_close(struct vm_area_struct *vma) | |||
64 | struct videobuf_queue *q = map->q; | 64 | struct videobuf_queue *q = map->q; |
65 | int i; | 65 | int i; |
66 | 66 | ||
67 | dprintk(2,"vm_close %p [count=%d,vma=%08lx-%08lx]\n",map, | 67 | dprintk(2,"vm_close %p [count=%u,vma=%08lx-%08lx]\n",map, |
68 | map->count,vma->vm_start,vma->vm_end); | 68 | map->count,vma->vm_start,vma->vm_end); |
69 | 69 | ||
70 | map->count--; | 70 | map->count--; |
@@ -221,7 +221,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
221 | } | 221 | } |
222 | 222 | ||
223 | /* create mapping + update buffer list */ | 223 | /* create mapping + update buffer list */ |
224 | map = q->bufs[first]->map = kmalloc(sizeof(struct videobuf_mapping),GFP_KERNEL); | 224 | map = q->bufs[first]->map = kzalloc(sizeof(struct videobuf_mapping),GFP_KERNEL); |
225 | if (NULL == map) | 225 | if (NULL == map) |
226 | return -ENOMEM; | 226 | return -ENOMEM; |
227 | 227 | ||
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index ee73dc75131c..9b54ff9d2e36 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -1076,6 +1076,7 @@ static int vivi_release(struct inode *inode, struct file *file) | |||
1076 | int minor = iminor(inode); | 1076 | int minor = iminor(inode); |
1077 | 1077 | ||
1078 | vivi_stop_thread(vidq); | 1078 | vivi_stop_thread(vidq); |
1079 | videobuf_stop(&fh->vb_vidq); | ||
1079 | videobuf_mmap_free(&fh->vb_vidq); | 1080 | videobuf_mmap_free(&fh->vb_vidq); |
1080 | 1081 | ||
1081 | kfree (fh); | 1082 | kfree (fh); |
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 8135e4c3bf47..afd82966f9a0 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c | |||
@@ -156,7 +156,7 @@ static void sm501_dump_clk(struct sm501_devdata *sm) | |||
156 | 156 | ||
157 | dev_dbg(sm->dev, "PM0[%c]: " | 157 | dev_dbg(sm->dev, "PM0[%c]: " |
158 | "P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), " | 158 | "P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), " |
159 | x "M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n", | 159 | "M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n", |
160 | (pmc & 3 ) == 0 ? '*' : '-', | 160 | (pmc & 3 ) == 0 ? '*' : '-', |
161 | fmt_freq(decode_div(pll2, pm0, 24, 1<<29, 31, px_div)), | 161 | fmt_freq(decode_div(pll2, pm0, 24, 1<<29, 31, px_div)), |
162 | fmt_freq(decode_div(pll2, pm0, 16, 1<<20, 15, misc_div)), | 162 | fmt_freq(decode_div(pll2, pm0, 16, 1<<20, 15, misc_div)), |
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index bb13858f60a1..b0f68031b49d 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c | |||
@@ -338,7 +338,7 @@ static void sony_laptop_report_input_event(u8 event) | |||
338 | dprintk("unknown input event %.2x\n", event); | 338 | dprintk("unknown input event %.2x\n", event); |
339 | } | 339 | } |
340 | 340 | ||
341 | static int sony_laptop_setup_input(void) | 341 | static int sony_laptop_setup_input(struct acpi_device *acpi_device) |
342 | { | 342 | { |
343 | struct input_dev *jog_dev; | 343 | struct input_dev *jog_dev; |
344 | struct input_dev *key_dev; | 344 | struct input_dev *key_dev; |
@@ -379,6 +379,7 @@ static int sony_laptop_setup_input(void) | |||
379 | key_dev->name = "Sony Vaio Keys"; | 379 | key_dev->name = "Sony Vaio Keys"; |
380 | key_dev->id.bustype = BUS_ISA; | 380 | key_dev->id.bustype = BUS_ISA; |
381 | key_dev->id.vendor = PCI_VENDOR_ID_SONY; | 381 | key_dev->id.vendor = PCI_VENDOR_ID_SONY; |
382 | key_dev->dev.parent = &acpi_device->dev; | ||
382 | 383 | ||
383 | /* Initialize the Input Drivers: special keys */ | 384 | /* Initialize the Input Drivers: special keys */ |
384 | set_bit(EV_KEY, key_dev->evbit); | 385 | set_bit(EV_KEY, key_dev->evbit); |
@@ -410,6 +411,7 @@ static int sony_laptop_setup_input(void) | |||
410 | jog_dev->name = "Sony Vaio Jogdial"; | 411 | jog_dev->name = "Sony Vaio Jogdial"; |
411 | jog_dev->id.bustype = BUS_ISA; | 412 | jog_dev->id.bustype = BUS_ISA; |
412 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; | 413 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; |
414 | key_dev->dev.parent = &acpi_device->dev; | ||
413 | 415 | ||
414 | jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 416 | jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
415 | jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); | 417 | jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); |
@@ -1006,7 +1008,7 @@ static int sony_nc_add(struct acpi_device *device) | |||
1006 | } | 1008 | } |
1007 | 1009 | ||
1008 | /* setup input devices and helper fifo */ | 1010 | /* setup input devices and helper fifo */ |
1009 | result = sony_laptop_setup_input(); | 1011 | result = sony_laptop_setup_input(device); |
1010 | if (result) { | 1012 | if (result) { |
1011 | printk(KERN_ERR DRV_PFX | 1013 | printk(KERN_ERR DRV_PFX |
1012 | "Unabe to create input devices.\n"); | 1014 | "Unabe to create input devices.\n"); |
@@ -1034,7 +1036,7 @@ static int sony_nc_add(struct acpi_device *device) | |||
1034 | sony_backlight_device->props.brightness = | 1036 | sony_backlight_device->props.brightness = |
1035 | sony_backlight_get_brightness | 1037 | sony_backlight_get_brightness |
1036 | (sony_backlight_device); | 1038 | (sony_backlight_device); |
1037 | sony_backlight_device->props.max_brightness = | 1039 | sony_backlight_device->props.max_brightness = |
1038 | SONY_MAX_BRIGHTNESS - 1; | 1040 | SONY_MAX_BRIGHTNESS - 1; |
1039 | } | 1041 | } |
1040 | 1042 | ||
@@ -2453,7 +2455,7 @@ static int sony_pic_add(struct acpi_device *device) | |||
2453 | } | 2455 | } |
2454 | 2456 | ||
2455 | /* setup input devices and helper fifo */ | 2457 | /* setup input devices and helper fifo */ |
2456 | result = sony_laptop_setup_input(); | 2458 | result = sony_laptop_setup_input(device); |
2457 | if (result) { | 2459 | if (result) { |
2458 | printk(KERN_ERR DRV_PFX | 2460 | printk(KERN_ERR DRV_PFX |
2459 | "Unabe to create input devices.\n"); | 2461 | "Unabe to create input devices.\n"); |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index e953276664a0..cf56647a6ca4 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * 02110-1301, USA. | 21 | * 02110-1301, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define IBM_VERSION "0.16" | 24 | #define IBM_VERSION "0.17" |
25 | #define TPACPI_SYSFS_VERSION 0x020000 | 25 | #define TPACPI_SYSFS_VERSION 0x020000 |
26 | 26 | ||
27 | /* | 27 | /* |
@@ -964,15 +964,15 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
964 | KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ | 964 | KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ |
965 | KEY_UNKNOWN, /* 0x0D: FN+INSERT */ | 965 | KEY_UNKNOWN, /* 0x0D: FN+INSERT */ |
966 | KEY_UNKNOWN, /* 0x0E: FN+DELETE */ | 966 | KEY_UNKNOWN, /* 0x0E: FN+DELETE */ |
967 | KEY_BRIGHTNESSUP, /* 0x0F: FN+HOME (brightness up) */ | 967 | KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */ |
968 | /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ | 968 | /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ |
969 | KEY_BRIGHTNESSDOWN, /* 0x10: FN+END (brightness down) */ | 969 | KEY_RESERVED, /* 0x10: FN+END (brightness down) */ |
970 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ | 970 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ |
971 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ | 971 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ |
972 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ | 972 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ |
973 | KEY_VOLUMEUP, /* 0x14: VOLUME UP */ | 973 | KEY_RESERVED, /* 0x14: VOLUME UP */ |
974 | KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */ | 974 | KEY_RESERVED, /* 0x15: VOLUME DOWN */ |
975 | KEY_MUTE, /* 0x16: MUTE */ | 975 | KEY_RESERVED, /* 0x16: MUTE */ |
976 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ | 976 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ |
977 | /* (assignments unknown, please report if found) */ | 977 | /* (assignments unknown, please report if found) */ |
978 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, | 978 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, |
@@ -987,15 +987,15 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
987 | KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ | 987 | KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ |
988 | KEY_UNKNOWN, /* 0x0D: FN+INSERT */ | 988 | KEY_UNKNOWN, /* 0x0D: FN+INSERT */ |
989 | KEY_UNKNOWN, /* 0x0E: FN+DELETE */ | 989 | KEY_UNKNOWN, /* 0x0E: FN+DELETE */ |
990 | KEY_BRIGHTNESSUP, /* 0x0F: FN+HOME (brightness up) */ | 990 | KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */ |
991 | /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ | 991 | /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ |
992 | KEY_BRIGHTNESSDOWN, /* 0x10: FN+END (brightness down) */ | 992 | KEY_RESERVED, /* 0x10: FN+END (brightness down) */ |
993 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ | 993 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ |
994 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ | 994 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ |
995 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ | 995 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ |
996 | KEY_VOLUMEUP, /* 0x14: VOLUME UP */ | 996 | KEY_RESERVED, /* 0x14: VOLUME UP */ |
997 | KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */ | 997 | KEY_RESERVED, /* 0x15: VOLUME DOWN */ |
998 | KEY_MUTE, /* 0x16: MUTE */ | 998 | KEY_RESERVED, /* 0x16: MUTE */ |
999 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ | 999 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ |
1000 | /* (assignments unknown, please report if found) */ | 1000 | /* (assignments unknown, please report if found) */ |
1001 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, | 1001 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, |
@@ -1342,9 +1342,8 @@ static int hotkey_read(char *p) | |||
1342 | return len; | 1342 | return len; |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | res = mutex_lock_interruptible(&hotkey_mutex); | 1345 | if (mutex_lock_interruptible(&hotkey_mutex)) |
1346 | if (res < 0) | 1346 | return -ERESTARTSYS; |
1347 | return res; | ||
1348 | res = hotkey_get(&status, &mask); | 1347 | res = hotkey_get(&status, &mask); |
1349 | mutex_unlock(&hotkey_mutex); | 1348 | mutex_unlock(&hotkey_mutex); |
1350 | if (res) | 1349 | if (res) |
@@ -1373,9 +1372,8 @@ static int hotkey_write(char *buf) | |||
1373 | if (!tp_features.hotkey) | 1372 | if (!tp_features.hotkey) |
1374 | return -ENODEV; | 1373 | return -ENODEV; |
1375 | 1374 | ||
1376 | res = mutex_lock_interruptible(&hotkey_mutex); | 1375 | if (mutex_lock_interruptible(&hotkey_mutex)) |
1377 | if (res < 0) | 1376 | return -ERESTARTSYS; |
1378 | return res; | ||
1379 | 1377 | ||
1380 | res = hotkey_get(&status, &mask); | 1378 | res = hotkey_get(&status, &mask); |
1381 | if (res) | 1379 | if (res) |
@@ -3114,6 +3112,99 @@ static struct backlight_ops ibm_backlight_data = { | |||
3114 | 3112 | ||
3115 | static struct mutex brightness_mutex; | 3113 | static struct mutex brightness_mutex; |
3116 | 3114 | ||
3115 | static int __init tpacpi_query_bcll_levels(acpi_handle handle) | ||
3116 | { | ||
3117 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
3118 | union acpi_object *obj; | ||
3119 | int rc; | ||
3120 | |||
3121 | if (ACPI_SUCCESS(acpi_evaluate_object(handle, NULL, NULL, &buffer))) { | ||
3122 | obj = (union acpi_object *)buffer.pointer; | ||
3123 | if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { | ||
3124 | printk(IBM_ERR "Unknown BCLL data, " | ||
3125 | "please report this to %s\n", IBM_MAIL); | ||
3126 | rc = 0; | ||
3127 | } else { | ||
3128 | rc = obj->package.count; | ||
3129 | } | ||
3130 | } else { | ||
3131 | return 0; | ||
3132 | } | ||
3133 | |||
3134 | kfree(buffer.pointer); | ||
3135 | return rc; | ||
3136 | } | ||
3137 | |||
3138 | static acpi_status __init brightness_find_bcll(acpi_handle handle, u32 lvl, | ||
3139 | void *context, void **rv) | ||
3140 | { | ||
3141 | char name[ACPI_PATH_SEGMENT_LENGTH]; | ||
3142 | struct acpi_buffer buffer = { sizeof(name), &name }; | ||
3143 | |||
3144 | if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) && | ||
3145 | !strncmp("BCLL", name, sizeof(name) - 1)) { | ||
3146 | if (tpacpi_query_bcll_levels(handle) == 16) { | ||
3147 | *rv = handle; | ||
3148 | return AE_CTRL_TERMINATE; | ||
3149 | } else { | ||
3150 | return AE_OK; | ||
3151 | } | ||
3152 | } else { | ||
3153 | return AE_OK; | ||
3154 | } | ||
3155 | } | ||
3156 | |||
3157 | static int __init brightness_check_levels(void) | ||
3158 | { | ||
3159 | int status; | ||
3160 | void *found_node = NULL; | ||
3161 | |||
3162 | if (!vid_handle) { | ||
3163 | IBM_ACPIHANDLE_INIT(vid); | ||
3164 | } | ||
3165 | if (!vid_handle) | ||
3166 | return 0; | ||
3167 | |||
3168 | /* Search for a BCLL package with 16 levels */ | ||
3169 | status = acpi_walk_namespace(ACPI_TYPE_PACKAGE, vid_handle, 3, | ||
3170 | brightness_find_bcll, NULL, &found_node); | ||
3171 | |||
3172 | return (ACPI_SUCCESS(status) && found_node != NULL); | ||
3173 | } | ||
3174 | |||
3175 | static acpi_status __init brightness_find_bcl(acpi_handle handle, u32 lvl, | ||
3176 | void *context, void **rv) | ||
3177 | { | ||
3178 | char name[ACPI_PATH_SEGMENT_LENGTH]; | ||
3179 | struct acpi_buffer buffer = { sizeof(name), &name }; | ||
3180 | |||
3181 | if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) && | ||
3182 | !strncmp("_BCL", name, sizeof(name) - 1)) { | ||
3183 | *rv = handle; | ||
3184 | return AE_CTRL_TERMINATE; | ||
3185 | } else { | ||
3186 | return AE_OK; | ||
3187 | } | ||
3188 | } | ||
3189 | |||
3190 | static int __init brightness_check_std_acpi_support(void) | ||
3191 | { | ||
3192 | int status; | ||
3193 | void *found_node = NULL; | ||
3194 | |||
3195 | if (!vid_handle) { | ||
3196 | IBM_ACPIHANDLE_INIT(vid); | ||
3197 | } | ||
3198 | if (!vid_handle) | ||
3199 | return 0; | ||
3200 | |||
3201 | /* Search for a _BCL method, but don't execute it */ | ||
3202 | status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3, | ||
3203 | brightness_find_bcl, NULL, &found_node); | ||
3204 | |||
3205 | return (ACPI_SUCCESS(status) && found_node != NULL); | ||
3206 | } | ||
3207 | |||
3117 | static int __init brightness_init(struct ibm_init_struct *iibm) | 3208 | static int __init brightness_init(struct ibm_init_struct *iibm) |
3118 | { | 3209 | { |
3119 | int b; | 3210 | int b; |
@@ -3122,6 +3213,18 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
3122 | 3213 | ||
3123 | mutex_init(&brightness_mutex); | 3214 | mutex_init(&brightness_mutex); |
3124 | 3215 | ||
3216 | if (!brightness_enable) { | ||
3217 | dbg_printk(TPACPI_DBG_INIT, | ||
3218 | "brightness support disabled by module parameter\n"); | ||
3219 | return 1; | ||
3220 | } else if (brightness_enable > 1) { | ||
3221 | if (brightness_check_std_acpi_support()) { | ||
3222 | printk(IBM_NOTICE | ||
3223 | "standard ACPI backlight interface available, not loading native one...\n"); | ||
3224 | return 1; | ||
3225 | } | ||
3226 | } | ||
3227 | |||
3125 | if (!brightness_mode) { | 3228 | if (!brightness_mode) { |
3126 | if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) | 3229 | if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) |
3127 | brightness_mode = 2; | 3230 | brightness_mode = 2; |
@@ -3135,10 +3238,17 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
3135 | if (brightness_mode > 3) | 3238 | if (brightness_mode > 3) |
3136 | return -EINVAL; | 3239 | return -EINVAL; |
3137 | 3240 | ||
3241 | tp_features.bright_16levels = | ||
3242 | thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO && | ||
3243 | brightness_check_levels(); | ||
3244 | |||
3138 | b = brightness_get(NULL); | 3245 | b = brightness_get(NULL); |
3139 | if (b < 0) | 3246 | if (b < 0) |
3140 | return 1; | 3247 | return 1; |
3141 | 3248 | ||
3249 | if (tp_features.bright_16levels) | ||
3250 | printk(IBM_INFO "detected a 16-level brightness capable ThinkPad\n"); | ||
3251 | |||
3142 | ibm_backlight_device = backlight_device_register( | 3252 | ibm_backlight_device = backlight_device_register( |
3143 | TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, | 3253 | TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, |
3144 | &ibm_backlight_data); | 3254 | &ibm_backlight_data); |
@@ -3148,7 +3258,8 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
3148 | } | 3258 | } |
3149 | vdbg_printk(TPACPI_DBG_INIT, "brightness is supported\n"); | 3259 | vdbg_printk(TPACPI_DBG_INIT, "brightness is supported\n"); |
3150 | 3260 | ||
3151 | ibm_backlight_device->props.max_brightness = 7; | 3261 | ibm_backlight_device->props.max_brightness = |
3262 | (tp_features.bright_16levels)? 15 : 7; | ||
3152 | ibm_backlight_device->props.brightness = b; | 3263 | ibm_backlight_device->props.brightness = b; |
3153 | backlight_update_status(ibm_backlight_device); | 3264 | backlight_update_status(ibm_backlight_device); |
3154 | 3265 | ||
@@ -3167,6 +3278,8 @@ static void brightness_exit(void) | |||
3167 | 3278 | ||
3168 | static int brightness_update_status(struct backlight_device *bd) | 3279 | static int brightness_update_status(struct backlight_device *bd) |
3169 | { | 3280 | { |
3281 | /* it is the backlight class's job (caller) to handle | ||
3282 | * EINTR and other errors properly */ | ||
3170 | return brightness_set( | 3283 | return brightness_set( |
3171 | (bd->props.fb_blank == FB_BLANK_UNBLANK && | 3284 | (bd->props.fb_blank == FB_BLANK_UNBLANK && |
3172 | bd->props.power == FB_BLANK_UNBLANK) ? | 3285 | bd->props.power == FB_BLANK_UNBLANK) ? |
@@ -3184,13 +3297,14 @@ static int brightness_get(struct backlight_device *bd) | |||
3184 | if (brightness_mode & 1) { | 3297 | if (brightness_mode & 1) { |
3185 | if (!acpi_ec_read(brightness_offset, &lec)) | 3298 | if (!acpi_ec_read(brightness_offset, &lec)) |
3186 | return -EIO; | 3299 | return -EIO; |
3187 | lec &= 7; | 3300 | lec &= (tp_features.bright_16levels)? 0x0f : 0x07; |
3188 | level = lec; | 3301 | level = lec; |
3189 | }; | 3302 | }; |
3190 | if (brightness_mode & 2) { | 3303 | if (brightness_mode & 2) { |
3191 | lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS) | 3304 | lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS) |
3192 | & TP_NVRAM_MASK_LEVEL_BRIGHTNESS) | 3305 | & TP_NVRAM_MASK_LEVEL_BRIGHTNESS) |
3193 | >> TP_NVRAM_POS_LEVEL_BRIGHTNESS; | 3306 | >> TP_NVRAM_POS_LEVEL_BRIGHTNESS; |
3307 | lcmos &= (tp_features.bright_16levels)? 0x0f : 0x07; | ||
3194 | level = lcmos; | 3308 | level = lcmos; |
3195 | } | 3309 | } |
3196 | 3310 | ||
@@ -3206,12 +3320,13 @@ static int brightness_get(struct backlight_device *bd) | |||
3206 | return level; | 3320 | return level; |
3207 | } | 3321 | } |
3208 | 3322 | ||
3323 | /* May return EINTR which can always be mapped to ERESTARTSYS */ | ||
3209 | static int brightness_set(int value) | 3324 | static int brightness_set(int value) |
3210 | { | 3325 | { |
3211 | int cmos_cmd, inc, i, res; | 3326 | int cmos_cmd, inc, i, res; |
3212 | int current_value; | 3327 | int current_value; |
3213 | 3328 | ||
3214 | if (value > 7) | 3329 | if (value > ((tp_features.bright_16levels)? 15 : 7)) |
3215 | return -EINVAL; | 3330 | return -EINVAL; |
3216 | 3331 | ||
3217 | res = mutex_lock_interruptible(&brightness_mutex); | 3332 | res = mutex_lock_interruptible(&brightness_mutex); |
@@ -3227,7 +3342,7 @@ static int brightness_set(int value) | |||
3227 | cmos_cmd = value > current_value ? | 3342 | cmos_cmd = value > current_value ? |
3228 | TP_CMOS_BRIGHTNESS_UP : | 3343 | TP_CMOS_BRIGHTNESS_UP : |
3229 | TP_CMOS_BRIGHTNESS_DOWN; | 3344 | TP_CMOS_BRIGHTNESS_DOWN; |
3230 | inc = value > current_value ? 1 : -1; | 3345 | inc = (value > current_value)? 1 : -1; |
3231 | 3346 | ||
3232 | res = 0; | 3347 | res = 0; |
3233 | for (i = current_value; i != value; i += inc) { | 3348 | for (i = current_value; i != value; i += inc) { |
@@ -3256,10 +3371,11 @@ static int brightness_read(char *p) | |||
3256 | if ((level = brightness_get(NULL)) < 0) { | 3371 | if ((level = brightness_get(NULL)) < 0) { |
3257 | len += sprintf(p + len, "level:\t\tunreadable\n"); | 3372 | len += sprintf(p + len, "level:\t\tunreadable\n"); |
3258 | } else { | 3373 | } else { |
3259 | len += sprintf(p + len, "level:\t\t%d\n", level & 0x7); | 3374 | len += sprintf(p + len, "level:\t\t%d\n", level); |
3260 | len += sprintf(p + len, "commands:\tup, down\n"); | 3375 | len += sprintf(p + len, "commands:\tup, down\n"); |
3261 | len += sprintf(p + len, "commands:\tlevel <level>" | 3376 | len += sprintf(p + len, "commands:\tlevel <level>" |
3262 | " (<level> is 0-7)\n"); | 3377 | " (<level> is 0-%d)\n", |
3378 | (tp_features.bright_16levels) ? 15 : 7); | ||
3263 | } | 3379 | } |
3264 | 3380 | ||
3265 | return len; | 3381 | return len; |
@@ -3268,28 +3384,34 @@ static int brightness_read(char *p) | |||
3268 | static int brightness_write(char *buf) | 3384 | static int brightness_write(char *buf) |
3269 | { | 3385 | { |
3270 | int level; | 3386 | int level; |
3271 | int new_level; | 3387 | int rc; |
3272 | char *cmd; | 3388 | char *cmd; |
3389 | int max_level = (tp_features.bright_16levels) ? 15 : 7; | ||
3273 | 3390 | ||
3274 | while ((cmd = next_cmd(&buf))) { | 3391 | level = brightness_get(NULL); |
3275 | if ((level = brightness_get(NULL)) < 0) | 3392 | if (level < 0) |
3276 | return level; | 3393 | return level; |
3277 | level &= 7; | ||
3278 | 3394 | ||
3395 | while ((cmd = next_cmd(&buf))) { | ||
3279 | if (strlencmp(cmd, "up") == 0) { | 3396 | if (strlencmp(cmd, "up") == 0) { |
3280 | new_level = level == 7 ? 7 : level + 1; | 3397 | if (level < max_level) |
3398 | level++; | ||
3281 | } else if (strlencmp(cmd, "down") == 0) { | 3399 | } else if (strlencmp(cmd, "down") == 0) { |
3282 | new_level = level == 0 ? 0 : level - 1; | 3400 | if (level > 0) |
3283 | } else if (sscanf(cmd, "level %d", &new_level) == 1 && | 3401 | level--; |
3284 | new_level >= 0 && new_level <= 7) { | 3402 | } else if (sscanf(cmd, "level %d", &level) == 1 && |
3285 | /* new_level set */ | 3403 | level >= 0 && level <= max_level) { |
3404 | /* new level set */ | ||
3286 | } else | 3405 | } else |
3287 | return -EINVAL; | 3406 | return -EINVAL; |
3288 | |||
3289 | brightness_set(new_level); | ||
3290 | } | 3407 | } |
3291 | 3408 | ||
3292 | return 0; | 3409 | /* |
3410 | * Now we know what the final level should be, so we try to set it. | ||
3411 | * Doing it this way makes the syscall restartable in case of EINTR | ||
3412 | */ | ||
3413 | rc = brightness_set(level); | ||
3414 | return (rc == -EINTR)? ERESTARTSYS : rc; | ||
3293 | } | 3415 | } |
3294 | 3416 | ||
3295 | static struct ibm_struct brightness_driver_data = { | 3417 | static struct ibm_struct brightness_driver_data = { |
@@ -3652,9 +3774,8 @@ static ssize_t fan_pwm1_store(struct device *dev, | |||
3652 | /* scale down from 0-255 to 0-7 */ | 3774 | /* scale down from 0-255 to 0-7 */ |
3653 | newlevel = (s >> 5) & 0x07; | 3775 | newlevel = (s >> 5) & 0x07; |
3654 | 3776 | ||
3655 | rc = mutex_lock_interruptible(&fan_mutex); | 3777 | if (mutex_lock_interruptible(&fan_mutex)) |
3656 | if (rc < 0) | 3778 | return -ERESTARTSYS; |
3657 | return rc; | ||
3658 | 3779 | ||
3659 | rc = fan_get_status(&status); | 3780 | rc = fan_get_status(&status); |
3660 | if (!rc && (status & | 3781 | if (!rc && (status & |
@@ -3904,9 +4025,8 @@ static int fan_get_status_safe(u8 *status) | |||
3904 | int rc; | 4025 | int rc; |
3905 | u8 s; | 4026 | u8 s; |
3906 | 4027 | ||
3907 | rc = mutex_lock_interruptible(&fan_mutex); | 4028 | if (mutex_lock_interruptible(&fan_mutex)) |
3908 | if (rc < 0) | 4029 | return -ERESTARTSYS; |
3909 | return rc; | ||
3910 | rc = fan_get_status(&s); | 4030 | rc = fan_get_status(&s); |
3911 | if (!rc) | 4031 | if (!rc) |
3912 | fan_update_desired_level(s); | 4032 | fan_update_desired_level(s); |
@@ -4040,9 +4160,8 @@ static int fan_set_level_safe(int level) | |||
4040 | if (!fan_control_allowed) | 4160 | if (!fan_control_allowed) |
4041 | return -EPERM; | 4161 | return -EPERM; |
4042 | 4162 | ||
4043 | rc = mutex_lock_interruptible(&fan_mutex); | 4163 | if (mutex_lock_interruptible(&fan_mutex)) |
4044 | if (rc < 0) | 4164 | return -ERESTARTSYS; |
4045 | return rc; | ||
4046 | 4165 | ||
4047 | if (level == TPACPI_FAN_LAST_LEVEL) | 4166 | if (level == TPACPI_FAN_LAST_LEVEL) |
4048 | level = fan_control_desired_level; | 4167 | level = fan_control_desired_level; |
@@ -4063,9 +4182,8 @@ static int fan_set_enable(void) | |||
4063 | if (!fan_control_allowed) | 4182 | if (!fan_control_allowed) |
4064 | return -EPERM; | 4183 | return -EPERM; |
4065 | 4184 | ||
4066 | rc = mutex_lock_interruptible(&fan_mutex); | 4185 | if (mutex_lock_interruptible(&fan_mutex)) |
4067 | if (rc < 0) | 4186 | return -ERESTARTSYS; |
4068 | return rc; | ||
4069 | 4187 | ||
4070 | switch (fan_control_access_mode) { | 4188 | switch (fan_control_access_mode) { |
4071 | case TPACPI_FAN_WR_ACPI_FANS: | 4189 | case TPACPI_FAN_WR_ACPI_FANS: |
@@ -4119,9 +4237,8 @@ static int fan_set_disable(void) | |||
4119 | if (!fan_control_allowed) | 4237 | if (!fan_control_allowed) |
4120 | return -EPERM; | 4238 | return -EPERM; |
4121 | 4239 | ||
4122 | rc = mutex_lock_interruptible(&fan_mutex); | 4240 | if (mutex_lock_interruptible(&fan_mutex)) |
4123 | if (rc < 0) | 4241 | return -ERESTARTSYS; |
4124 | return rc; | ||
4125 | 4242 | ||
4126 | rc = 0; | 4243 | rc = 0; |
4127 | switch (fan_control_access_mode) { | 4244 | switch (fan_control_access_mode) { |
@@ -4158,9 +4275,8 @@ static int fan_set_speed(int speed) | |||
4158 | if (!fan_control_allowed) | 4275 | if (!fan_control_allowed) |
4159 | return -EPERM; | 4276 | return -EPERM; |
4160 | 4277 | ||
4161 | rc = mutex_lock_interruptible(&fan_mutex); | 4278 | if (mutex_lock_interruptible(&fan_mutex)) |
4162 | if (rc < 0) | 4279 | return -ERESTARTSYS; |
4163 | return rc; | ||
4164 | 4280 | ||
4165 | rc = 0; | 4281 | rc = 0; |
4166 | switch (fan_control_access_mode) { | 4282 | switch (fan_control_access_mode) { |
@@ -4701,9 +4817,15 @@ static int __init set_ibm_param(const char *val, struct kernel_param *kp) | |||
4701 | unsigned int i; | 4817 | unsigned int i; |
4702 | struct ibm_struct *ibm; | 4818 | struct ibm_struct *ibm; |
4703 | 4819 | ||
4820 | if (!kp || !kp->name || !val) | ||
4821 | return -EINVAL; | ||
4822 | |||
4704 | for (i = 0; i < ARRAY_SIZE(ibms_init); i++) { | 4823 | for (i = 0; i < ARRAY_SIZE(ibms_init); i++) { |
4705 | ibm = ibms_init[i].data; | 4824 | ibm = ibms_init[i].data; |
4706 | BUG_ON(ibm == NULL); | 4825 | WARN_ON(ibm == NULL); |
4826 | |||
4827 | if (!ibm || !ibm->name) | ||
4828 | continue; | ||
4707 | 4829 | ||
4708 | if (strcmp(ibm->name, kp->name) == 0 && ibm->write) { | 4830 | if (strcmp(ibm->name, kp->name) == 0 && ibm->write) { |
4709 | if (strlen(val) > sizeof(ibms_init[i].param) - 2) | 4831 | if (strlen(val) > sizeof(ibms_init[i].param) - 2) |
@@ -4732,6 +4854,9 @@ module_param_named(fan_control, fan_control_allowed, bool, 0); | |||
4732 | static int brightness_mode; | 4854 | static int brightness_mode; |
4733 | module_param_named(brightness_mode, brightness_mode, int, 0); | 4855 | module_param_named(brightness_mode, brightness_mode, int, 0); |
4734 | 4856 | ||
4857 | static unsigned int brightness_enable = 2; /* 2 = auto, 0 = no, 1 = yes */ | ||
4858 | module_param(brightness_enable, uint, 0); | ||
4859 | |||
4735 | static unsigned int hotkey_report_mode; | 4860 | static unsigned int hotkey_report_mode; |
4736 | module_param(hotkey_report_mode, uint, 0); | 4861 | module_param(hotkey_report_mode, uint, 0); |
4737 | 4862 | ||
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h index 3abcc8120634..8fba2bbe345e 100644 --- a/drivers/misc/thinkpad_acpi.h +++ b/drivers/misc/thinkpad_acpi.h | |||
@@ -84,7 +84,7 @@ | |||
84 | 84 | ||
85 | /* ThinkPad CMOS NVRAM constants */ | 85 | /* ThinkPad CMOS NVRAM constants */ |
86 | #define TP_NVRAM_ADDR_BRIGHTNESS 0x5e | 86 | #define TP_NVRAM_ADDR_BRIGHTNESS 0x5e |
87 | #define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x07 | 87 | #define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x0f |
88 | #define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0 | 88 | #define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0 |
89 | 89 | ||
90 | #define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") | 90 | #define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") |
@@ -246,6 +246,7 @@ static struct { | |||
246 | u32 hotkey_wlsw:1; | 246 | u32 hotkey_wlsw:1; |
247 | u32 light:1; | 247 | u32 light:1; |
248 | u32 light_status:1; | 248 | u32 light_status:1; |
249 | u32 bright_16levels:1; | ||
249 | u32 wan:1; | 250 | u32 wan:1; |
250 | u32 fan_ctrl_status_undef:1; | 251 | u32 fan_ctrl_status_undef:1; |
251 | u32 input_device_registered:1; | 252 | u32 input_device_registered:1; |
@@ -338,6 +339,7 @@ static int bluetooth_write(char *buf); | |||
338 | static struct backlight_device *ibm_backlight_device; | 339 | static struct backlight_device *ibm_backlight_device; |
339 | static int brightness_offset = 0x31; | 340 | static int brightness_offset = 0x31; |
340 | static int brightness_mode; | 341 | static int brightness_mode; |
342 | static unsigned int brightness_enable; /* 0 = no, 1 = yes, 2 = auto */ | ||
341 | 343 | ||
342 | static int brightness_init(struct ibm_init_struct *iibm); | 344 | static int brightness_init(struct ibm_init_struct *iibm); |
343 | static void brightness_exit(void); | 345 | static void brightness_exit(void); |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index e38d5a3b2a89..aeb32a93f6a0 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -44,6 +44,9 @@ | |||
44 | * max 8 partitions per card | 44 | * max 8 partitions per card |
45 | */ | 45 | */ |
46 | #define MMC_SHIFT 3 | 46 | #define MMC_SHIFT 3 |
47 | #define MMC_NUM_MINORS (256 >> MMC_SHIFT) | ||
48 | |||
49 | static unsigned long dev_use[MMC_NUM_MINORS/(8*sizeof(unsigned long))]; | ||
47 | 50 | ||
48 | /* | 51 | /* |
49 | * There is one mmc_blk_data per slot. | 52 | * There is one mmc_blk_data per slot. |
@@ -80,6 +83,9 @@ static void mmc_blk_put(struct mmc_blk_data *md) | |||
80 | mutex_lock(&open_lock); | 83 | mutex_lock(&open_lock); |
81 | md->usage--; | 84 | md->usage--; |
82 | if (md->usage == 0) { | 85 | if (md->usage == 0) { |
86 | int devidx = md->disk->first_minor >> MMC_SHIFT; | ||
87 | __clear_bit(devidx, dev_use); | ||
88 | |||
83 | put_disk(md->disk); | 89 | put_disk(md->disk); |
84 | kfree(md); | 90 | kfree(md); |
85 | } | 91 | } |
@@ -321,7 +327,13 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
321 | req->rq_disk->disk_name, err); | 327 | req->rq_disk->disk_name, err); |
322 | goto cmd_err; | 328 | goto cmd_err; |
323 | } | 329 | } |
324 | } while (!(cmd.resp[0] & R1_READY_FOR_DATA)); | 330 | /* |
331 | * Some cards mishandle the status bits, | ||
332 | * so make sure to check both the busy | ||
333 | * indication and the card state. | ||
334 | */ | ||
335 | } while (!(cmd.resp[0] & R1_READY_FOR_DATA) || | ||
336 | (R1_CURRENT_STATE(cmd.resp[0]) == 7)); | ||
325 | 337 | ||
326 | #if 0 | 338 | #if 0 |
327 | if (cmd.resp[0] & ~0x00000900) | 339 | if (cmd.resp[0] & ~0x00000900) |
@@ -400,9 +412,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
400 | return 0; | 412 | return 0; |
401 | } | 413 | } |
402 | 414 | ||
403 | #define MMC_NUM_MINORS (256 >> MMC_SHIFT) | ||
404 | |||
405 | static unsigned long dev_use[MMC_NUM_MINORS/(8*sizeof(unsigned long))]; | ||
406 | 415 | ||
407 | static inline int mmc_blk_readonly(struct mmc_card *card) | 416 | static inline int mmc_blk_readonly(struct mmc_card *card) |
408 | { | 417 | { |
@@ -568,17 +577,12 @@ static void mmc_blk_remove(struct mmc_card *card) | |||
568 | struct mmc_blk_data *md = mmc_get_drvdata(card); | 577 | struct mmc_blk_data *md = mmc_get_drvdata(card); |
569 | 578 | ||
570 | if (md) { | 579 | if (md) { |
571 | int devidx; | ||
572 | |||
573 | /* Stop new requests from getting into the queue */ | 580 | /* Stop new requests from getting into the queue */ |
574 | del_gendisk(md->disk); | 581 | del_gendisk(md->disk); |
575 | 582 | ||
576 | /* Then flush out any already in there */ | 583 | /* Then flush out any already in there */ |
577 | mmc_cleanup_queue(&md->queue); | 584 | mmc_cleanup_queue(&md->queue); |
578 | 585 | ||
579 | devidx = md->disk->first_minor >> MMC_SHIFT; | ||
580 | __clear_bit(devidx, dev_use); | ||
581 | |||
582 | mmc_blk_put(md); | 586 | mmc_blk_put(md); |
583 | } | 587 | } |
584 | mmc_set_drvdata(card, NULL); | 588 | mmc_set_drvdata(card, NULL); |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 1b9c9b6da5b7..30cd13b13ac3 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -180,12 +180,13 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
180 | blk_queue_max_hw_segments(mq->queue, host->max_hw_segs); | 180 | blk_queue_max_hw_segments(mq->queue, host->max_hw_segs); |
181 | blk_queue_max_segment_size(mq->queue, host->max_seg_size); | 181 | blk_queue_max_segment_size(mq->queue, host->max_seg_size); |
182 | 182 | ||
183 | mq->sg = kzalloc(sizeof(struct scatterlist) * | 183 | mq->sg = kmalloc(sizeof(struct scatterlist) * |
184 | host->max_phys_segs, GFP_KERNEL); | 184 | host->max_phys_segs, GFP_KERNEL); |
185 | if (!mq->sg) { | 185 | if (!mq->sg) { |
186 | ret = -ENOMEM; | 186 | ret = -ENOMEM; |
187 | goto cleanup_queue; | 187 | goto cleanup_queue; |
188 | } | 188 | } |
189 | sg_init_table(mq->sg, host->max_phys_segs); | ||
189 | } | 190 | } |
190 | 191 | ||
191 | init_MUTEX(&mq->thread_sem); | 192 | init_MUTEX(&mq->thread_sem); |
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c index d552de683110..eeea84c309e6 100644 --- a/drivers/mmc/card/sdio_uart.c +++ b/drivers/mmc/card/sdio_uart.c | |||
@@ -386,7 +386,7 @@ static void sdio_uart_stop_rx(struct sdio_uart_port *port) | |||
386 | sdio_out(port, UART_IER, port->ier); | 386 | sdio_out(port, UART_IER, port->ier); |
387 | } | 387 | } |
388 | 388 | ||
389 | static void sdio_uart_receive_chars(struct sdio_uart_port *port, int *status) | 389 | static void sdio_uart_receive_chars(struct sdio_uart_port *port, unsigned int *status) |
390 | { | 390 | { |
391 | struct tty_struct *tty = port->tty; | 391 | struct tty_struct *tty = port->tty; |
392 | unsigned int ch, flag; | 392 | unsigned int ch, flag; |
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index a6469218f194..365024b83d3d 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c | |||
@@ -176,8 +176,6 @@ mmc_spi_readbytes(struct mmc_spi_host *host, unsigned len) | |||
176 | DMA_FROM_DEVICE); | 176 | DMA_FROM_DEVICE); |
177 | 177 | ||
178 | status = spi_sync(host->spi, &host->readback); | 178 | status = spi_sync(host->spi, &host->readback); |
179 | if (status == 0) | ||
180 | status = host->readback.status; | ||
181 | 179 | ||
182 | if (host->dma_dev) | 180 | if (host->dma_dev) |
183 | dma_sync_single_for_cpu(host->dma_dev, | 181 | dma_sync_single_for_cpu(host->dma_dev, |
@@ -480,8 +478,6 @@ mmc_spi_command_send(struct mmc_spi_host *host, | |||
480 | DMA_BIDIRECTIONAL); | 478 | DMA_BIDIRECTIONAL); |
481 | } | 479 | } |
482 | status = spi_sync(host->spi, &host->m); | 480 | status = spi_sync(host->spi, &host->m); |
483 | if (status == 0) | ||
484 | status = host->m.status; | ||
485 | 481 | ||
486 | if (host->dma_dev) | 482 | if (host->dma_dev) |
487 | dma_sync_single_for_cpu(host->dma_dev, | 483 | dma_sync_single_for_cpu(host->dma_dev, |
@@ -624,8 +620,6 @@ mmc_spi_writeblock(struct mmc_spi_host *host, struct spi_transfer *t) | |||
624 | DMA_BIDIRECTIONAL); | 620 | DMA_BIDIRECTIONAL); |
625 | 621 | ||
626 | status = spi_sync(spi, &host->m); | 622 | status = spi_sync(spi, &host->m); |
627 | if (status == 0) | ||
628 | status = host->m.status; | ||
629 | 623 | ||
630 | if (status != 0) { | 624 | if (status != 0) { |
631 | dev_dbg(&spi->dev, "write error (%d)\n", status); | 625 | dev_dbg(&spi->dev, "write error (%d)\n", status); |
@@ -726,8 +720,6 @@ mmc_spi_readblock(struct mmc_spi_host *host, struct spi_transfer *t) | |||
726 | } | 720 | } |
727 | 721 | ||
728 | status = spi_sync(spi, &host->m); | 722 | status = spi_sync(spi, &host->m); |
729 | if (status == 0) | ||
730 | status = host->m.status; | ||
731 | 723 | ||
732 | if (host->dma_dev) { | 724 | if (host->dma_dev) { |
733 | dma_sync_single_for_cpu(host->dma_dev, | 725 | dma_sync_single_for_cpu(host->dma_dev, |
@@ -905,8 +897,6 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd, | |||
905 | DMA_BIDIRECTIONAL); | 897 | DMA_BIDIRECTIONAL); |
906 | 898 | ||
907 | tmp = spi_sync(spi, &host->m); | 899 | tmp = spi_sync(spi, &host->m); |
908 | if (tmp == 0) | ||
909 | tmp = host->m.status; | ||
910 | 900 | ||
911 | if (host->dma_dev) | 901 | if (host->dma_dev) |
912 | dma_sync_single_for_cpu(host->dma_dev, | 902 | dma_sync_single_for_cpu(host->dma_dev, |
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index c11a3d256051..20d5c7bd940a 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/mmc/host.h> | 16 | #include <linux/mmc/host.h> |
17 | #include <linux/highmem.h> | 17 | #include <linux/highmem.h> |
18 | #include <linux/scatterlist.h> | 18 | #include <linux/scatterlist.h> |
19 | #include <linux/log2.h> | ||
20 | #include <asm/io.h> | 19 | #include <asm/io.h> |
21 | 20 | ||
22 | #define DRIVER_NAME "tifm_sd" | 21 | #define DRIVER_NAME "tifm_sd" |
@@ -638,17 +637,15 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
638 | goto err_out; | 637 | goto err_out; |
639 | } | 638 | } |
640 | 639 | ||
641 | if (mrq->data && !is_power_of_2(mrq->data->blksz)) { | ||
642 | printk(KERN_ERR "%s: Unsupported block size (%d bytes)\n", | ||
643 | sock->dev.bus_id, mrq->data->blksz); | ||
644 | mrq->cmd->error = -EINVAL; | ||
645 | goto err_out; | ||
646 | } | ||
647 | |||
648 | host->cmd_flags = 0; | 640 | host->cmd_flags = 0; |
649 | host->block_pos = 0; | 641 | host->block_pos = 0; |
650 | host->sg_pos = 0; | 642 | host->sg_pos = 0; |
651 | 643 | ||
644 | if (mrq->data && !is_power_of_2(mrq->data->blksz)) | ||
645 | host->no_dma = 1; | ||
646 | else | ||
647 | host->no_dma = no_dma ? 1 : 0; | ||
648 | |||
652 | if (r_data) { | 649 | if (r_data) { |
653 | tifm_sd_set_data_timeout(host, r_data); | 650 | tifm_sd_set_data_timeout(host, r_data); |
654 | 651 | ||
@@ -676,7 +673,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
676 | : PCI_DMA_FROMDEVICE)) { | 673 | : PCI_DMA_FROMDEVICE)) { |
677 | printk(KERN_ERR "%s : scatterlist map failed\n", | 674 | printk(KERN_ERR "%s : scatterlist map failed\n", |
678 | sock->dev.bus_id); | 675 | sock->dev.bus_id); |
679 | spin_unlock_irqrestore(&sock->lock, flags); | 676 | mrq->cmd->error = -ENOMEM; |
680 | goto err_out; | 677 | goto err_out; |
681 | } | 678 | } |
682 | host->sg_len = tifm_map_sg(sock, r_data->sg, | 679 | host->sg_len = tifm_map_sg(sock, r_data->sg, |
@@ -692,7 +689,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
692 | r_data->flags & MMC_DATA_WRITE | 689 | r_data->flags & MMC_DATA_WRITE |
693 | ? PCI_DMA_TODEVICE | 690 | ? PCI_DMA_TODEVICE |
694 | : PCI_DMA_FROMDEVICE); | 691 | : PCI_DMA_FROMDEVICE); |
695 | spin_unlock_irqrestore(&sock->lock, flags); | 692 | mrq->cmd->error = -ENOMEM; |
696 | goto err_out; | 693 | goto err_out; |
697 | } | 694 | } |
698 | 695 | ||
@@ -966,7 +963,6 @@ static int tifm_sd_probe(struct tifm_dev *sock) | |||
966 | return -ENOMEM; | 963 | return -ENOMEM; |
967 | 964 | ||
968 | host = mmc_priv(mmc); | 965 | host = mmc_priv(mmc); |
969 | host->no_dma = no_dma; | ||
970 | tifm_set_drvdata(sock, mmc); | 966 | tifm_set_drvdata(sock, mmc); |
971 | host->dev = sock; | 967 | host->dev = sock; |
972 | host->timeout_jiffies = msecs_to_jiffies(1000); | 968 | host->timeout_jiffies = msecs_to_jiffies(1000); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index e8d69b0adf90..d9107e542dfa 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -888,7 +888,7 @@ config SMC91X | |||
888 | tristate "SMC 91C9x/91C1xxx support" | 888 | tristate "SMC 91C9x/91C1xxx support" |
889 | select CRC32 | 889 | select CRC32 |
890 | select MII | 890 | select MII |
891 | depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00 || BFIN | 891 | depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00 || BLACKFIN |
892 | help | 892 | help |
893 | This is a driver for SMC's 91x series of Ethernet chipsets, | 893 | This is a driver for SMC's 91x series of Ethernet chipsets, |
894 | including the SMC91C94 and the SMC91C111. Say Y if you want it | 894 | including the SMC91C94 and the SMC91C111. Say Y if you want it |
@@ -926,7 +926,7 @@ config SMC911X | |||
926 | tristate "SMSC LAN911[5678] support" | 926 | tristate "SMSC LAN911[5678] support" |
927 | select CRC32 | 927 | select CRC32 |
928 | select MII | 928 | select MII |
929 | depends on ARCH_PXA || SUPERH | 929 | depends on ARCH_PXA || SH_MAGIC_PANEL_R2 |
930 | help | 930 | help |
931 | This is a driver for SMSC's LAN911x series of Ethernet chipsets | 931 | This is a driver for SMSC's LAN911x series of Ethernet chipsets |
932 | including the new LAN9115, LAN9116, LAN9117, and LAN9118. | 932 | including the new LAN9115, LAN9116, LAN9117, and LAN9118. |
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index eebf5bb2b03a..e7fdd81919bd 100644 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c | |||
@@ -1340,7 +1340,9 @@ static int amd8111e_close(struct net_device * dev) | |||
1340 | struct amd8111e_priv *lp = netdev_priv(dev); | 1340 | struct amd8111e_priv *lp = netdev_priv(dev); |
1341 | netif_stop_queue(dev); | 1341 | netif_stop_queue(dev); |
1342 | 1342 | ||
1343 | #ifdef CONFIG_AMD8111E_NAPI | ||
1343 | napi_disable(&lp->napi); | 1344 | napi_disable(&lp->napi); |
1345 | #endif | ||
1344 | 1346 | ||
1345 | spin_lock_irq(&lp->lock); | 1347 | spin_lock_irq(&lp->lock); |
1346 | 1348 | ||
@@ -1372,7 +1374,9 @@ static int amd8111e_open(struct net_device * dev ) | |||
1372 | dev->name, dev)) | 1374 | dev->name, dev)) |
1373 | return -EAGAIN; | 1375 | return -EAGAIN; |
1374 | 1376 | ||
1377 | #ifdef CONFIG_AMD8111E_NAPI | ||
1375 | napi_enable(&lp->napi); | 1378 | napi_enable(&lp->napi); |
1379 | #endif | ||
1376 | 1380 | ||
1377 | spin_lock_irq(&lp->lock); | 1381 | spin_lock_irq(&lp->lock); |
1378 | 1382 | ||
@@ -1380,7 +1384,9 @@ static int amd8111e_open(struct net_device * dev ) | |||
1380 | 1384 | ||
1381 | if(amd8111e_restart(dev)){ | 1385 | if(amd8111e_restart(dev)){ |
1382 | spin_unlock_irq(&lp->lock); | 1386 | spin_unlock_irq(&lp->lock); |
1387 | #ifdef CONFIG_AMD8111E_NAPI | ||
1383 | napi_disable(&lp->napi); | 1388 | napi_disable(&lp->napi); |
1389 | #endif | ||
1384 | if (dev->irq) | 1390 | if (dev->irq) |
1385 | free_irq(dev->irq, dev); | 1391 | free_irq(dev->irq, dev); |
1386 | return -ENOMEM; | 1392 | return -ENOMEM; |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 084acfd6fc5f..eb971755a3ff 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -676,7 +676,7 @@ static void bf537mac_rx(struct net_device *dev) | |||
676 | skb->protocol = eth_type_trans(skb, dev); | 676 | skb->protocol = eth_type_trans(skb, dev); |
677 | #if defined(BFIN_MAC_CSUM_OFFLOAD) | 677 | #if defined(BFIN_MAC_CSUM_OFFLOAD) |
678 | skb->csum = current_rx_ptr->status.ip_payload_csum; | 678 | skb->csum = current_rx_ptr->status.ip_payload_csum; |
679 | skb->ip_summed = CHECKSUM_PARTIAL; | 679 | skb->ip_summed = CHECKSUM_COMPLETE; |
680 | #endif | 680 | #endif |
681 | 681 | ||
682 | netif_rx(skb); | 682 | netif_rx(skb); |
@@ -924,7 +924,7 @@ static int __init bf537mac_probe(struct net_device *dev) | |||
924 | if (!is_valid_ether_addr(dev->dev_addr)) { | 924 | if (!is_valid_ether_addr(dev->dev_addr)) { |
925 | /* Grab the MAC from the board somehow - this is done in the | 925 | /* Grab the MAC from the board somehow - this is done in the |
926 | arch/blackfin/mach-bf537/boards/eth_mac.c */ | 926 | arch/blackfin/mach-bf537/boards/eth_mac.c */ |
927 | get_bf537_ether_addr(dev->dev_addr); | 927 | bfin_get_ether_addr(dev->dev_addr); |
928 | } | 928 | } |
929 | 929 | ||
930 | /* If still not valid, get a random one */ | 930 | /* If still not valid, get a random one */ |
diff --git a/drivers/net/bfin_mac.h b/drivers/net/bfin_mac.h index 3a107ad75381..5970ea7142cd 100644 --- a/drivers/net/bfin_mac.h +++ b/drivers/net/bfin_mac.h | |||
@@ -92,4 +92,4 @@ struct bf537mac_local { | |||
92 | struct mii_bus mii_bus; | 92 | struct mii_bus mii_bus; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | extern void get_bf537_ether_addr(char *addr); | 95 | extern void bfin_get_ether_addr(char *addr); |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index da767d3d5af5..4e7b46e44874 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -56,8 +56,8 @@ | |||
56 | 56 | ||
57 | #define DRV_MODULE_NAME "bnx2" | 57 | #define DRV_MODULE_NAME "bnx2" |
58 | #define PFX DRV_MODULE_NAME ": " | 58 | #define PFX DRV_MODULE_NAME ": " |
59 | #define DRV_MODULE_VERSION "1.6.8" | 59 | #define DRV_MODULE_VERSION "1.6.9" |
60 | #define DRV_MODULE_RELDATE "October 17, 2007" | 60 | #define DRV_MODULE_RELDATE "December 8, 2007" |
61 | 61 | ||
62 | #define RUN_AT(x) (jiffies + (x)) | 62 | #define RUN_AT(x) (jiffies + (x)) |
63 | 63 | ||
@@ -2387,18 +2387,24 @@ bnx2_reuse_rx_skb(struct bnx2 *bp, struct sk_buff *skb, | |||
2387 | prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo; | 2387 | prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo; |
2388 | } | 2388 | } |
2389 | 2389 | ||
2390 | static inline u16 | ||
2391 | bnx2_get_hw_rx_cons(struct bnx2 *bp) | ||
2392 | { | ||
2393 | u16 cons = bp->status_blk->status_rx_quick_consumer_index0; | ||
2394 | |||
2395 | if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT)) | ||
2396 | cons++; | ||
2397 | return cons; | ||
2398 | } | ||
2399 | |||
2390 | static int | 2400 | static int |
2391 | bnx2_rx_int(struct bnx2 *bp, int budget) | 2401 | bnx2_rx_int(struct bnx2 *bp, int budget) |
2392 | { | 2402 | { |
2393 | struct status_block *sblk = bp->status_blk; | ||
2394 | u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod; | 2403 | u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod; |
2395 | struct l2_fhdr *rx_hdr; | 2404 | struct l2_fhdr *rx_hdr; |
2396 | int rx_pkt = 0; | 2405 | int rx_pkt = 0; |
2397 | 2406 | ||
2398 | hw_cons = bp->hw_rx_cons = sblk->status_rx_quick_consumer_index0; | 2407 | hw_cons = bnx2_get_hw_rx_cons(bp); |
2399 | if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT) { | ||
2400 | hw_cons++; | ||
2401 | } | ||
2402 | sw_cons = bp->rx_cons; | 2408 | sw_cons = bp->rx_cons; |
2403 | sw_prod = bp->rx_prod; | 2409 | sw_prod = bp->rx_prod; |
2404 | 2410 | ||
@@ -2515,10 +2521,7 @@ next_rx: | |||
2515 | 2521 | ||
2516 | /* Refresh hw_cons to see if there is new work */ | 2522 | /* Refresh hw_cons to see if there is new work */ |
2517 | if (sw_cons == hw_cons) { | 2523 | if (sw_cons == hw_cons) { |
2518 | hw_cons = bp->hw_rx_cons = | 2524 | hw_cons = bnx2_get_hw_rx_cons(bp); |
2519 | sblk->status_rx_quick_consumer_index0; | ||
2520 | if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT) | ||
2521 | hw_cons++; | ||
2522 | rmb(); | 2525 | rmb(); |
2523 | } | 2526 | } |
2524 | } | 2527 | } |
@@ -2622,7 +2625,7 @@ bnx2_has_work(struct bnx2 *bp) | |||
2622 | { | 2625 | { |
2623 | struct status_block *sblk = bp->status_blk; | 2626 | struct status_block *sblk = bp->status_blk; |
2624 | 2627 | ||
2625 | if ((sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) || | 2628 | if ((bnx2_get_hw_rx_cons(bp) != bp->rx_cons) || |
2626 | (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)) | 2629 | (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)) |
2627 | return 1; | 2630 | return 1; |
2628 | 2631 | ||
@@ -2655,7 +2658,7 @@ static int bnx2_poll_work(struct bnx2 *bp, int work_done, int budget) | |||
2655 | if (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons) | 2658 | if (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons) |
2656 | bnx2_tx_int(bp); | 2659 | bnx2_tx_int(bp); |
2657 | 2660 | ||
2658 | if (sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) | 2661 | if (bnx2_get_hw_rx_cons(bp) != bp->rx_cons) |
2659 | work_done += bnx2_rx_int(bp, budget - work_done); | 2662 | work_done += bnx2_rx_int(bp, budget - work_done); |
2660 | 2663 | ||
2661 | return work_done; | 2664 | return work_done; |
@@ -4177,7 +4180,6 @@ bnx2_init_rx_ring(struct bnx2 *bp) | |||
4177 | 4180 | ||
4178 | ring_prod = prod = bp->rx_prod = 0; | 4181 | ring_prod = prod = bp->rx_prod = 0; |
4179 | bp->rx_cons = 0; | 4182 | bp->rx_cons = 0; |
4180 | bp->hw_rx_cons = 0; | ||
4181 | bp->rx_prod_bseq = 0; | 4183 | bp->rx_prod_bseq = 0; |
4182 | 4184 | ||
4183 | for (i = 0; i < bp->rx_max_ring; i++) { | 4185 | for (i = 0; i < bp->rx_max_ring; i++) { |
@@ -6685,8 +6687,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
6685 | } else if (CHIP_NUM(bp) == CHIP_NUM_5706 || | 6687 | } else if (CHIP_NUM(bp) == CHIP_NUM_5706 || |
6686 | CHIP_NUM(bp) == CHIP_NUM_5708) | 6688 | CHIP_NUM(bp) == CHIP_NUM_5708) |
6687 | bp->phy_flags |= PHY_CRC_FIX_FLAG; | 6689 | bp->phy_flags |= PHY_CRC_FIX_FLAG; |
6688 | else if (CHIP_ID(bp) == CHIP_ID_5709_A0 || | 6690 | else if (CHIP_NUM(bp) == CHIP_NUM_5709 && |
6689 | CHIP_ID(bp) == CHIP_ID_5709_A1) | 6691 | (CHIP_REV(bp) == CHIP_REV_Ax || |
6692 | CHIP_REV(bp) == CHIP_REV_Bx)) | ||
6690 | bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG; | 6693 | bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG; |
6691 | 6694 | ||
6692 | if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || | 6695 | if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 1dce0d1a2581..30ba366608b0 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -6513,7 +6513,6 @@ struct bnx2 { | |||
6513 | u32 rx_prod_bseq; | 6513 | u32 rx_prod_bseq; |
6514 | u16 rx_prod; | 6514 | u16 rx_prod; |
6515 | u16 rx_cons; | 6515 | u16 rx_cons; |
6516 | u16 hw_rx_cons; | ||
6517 | 6516 | ||
6518 | u32 rx_csum; | 6517 | u32 rx_csum; |
6519 | 6518 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 423298c84a1d..b0b26036266b 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -74,6 +74,7 @@ | |||
74 | #include <linux/ethtool.h> | 74 | #include <linux/ethtool.h> |
75 | #include <linux/if_vlan.h> | 75 | #include <linux/if_vlan.h> |
76 | #include <linux/if_bonding.h> | 76 | #include <linux/if_bonding.h> |
77 | #include <linux/jiffies.h> | ||
77 | #include <net/route.h> | 78 | #include <net/route.h> |
78 | #include <net/net_namespace.h> | 79 | #include <net/net_namespace.h> |
79 | #include "bonding.h" | 80 | #include "bonding.h" |
@@ -174,6 +175,7 @@ struct bond_parm_tbl bond_mode_tbl[] = { | |||
174 | struct bond_parm_tbl xmit_hashtype_tbl[] = { | 175 | struct bond_parm_tbl xmit_hashtype_tbl[] = { |
175 | { "layer2", BOND_XMIT_POLICY_LAYER2}, | 176 | { "layer2", BOND_XMIT_POLICY_LAYER2}, |
176 | { "layer3+4", BOND_XMIT_POLICY_LAYER34}, | 177 | { "layer3+4", BOND_XMIT_POLICY_LAYER34}, |
178 | { "layer2+3", BOND_XMIT_POLICY_LAYER23}, | ||
177 | { NULL, -1}, | 179 | { NULL, -1}, |
178 | }; | 180 | }; |
179 | 181 | ||
@@ -2722,8 +2724,8 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2722 | */ | 2724 | */ |
2723 | bond_for_each_slave(bond, slave, i) { | 2725 | bond_for_each_slave(bond, slave, i) { |
2724 | if (slave->link != BOND_LINK_UP) { | 2726 | if (slave->link != BOND_LINK_UP) { |
2725 | if (((jiffies - slave->dev->trans_start) <= delta_in_ticks) && | 2727 | if (time_before_eq(jiffies, slave->dev->trans_start + delta_in_ticks) && |
2726 | ((jiffies - slave->dev->last_rx) <= delta_in_ticks)) { | 2728 | time_before_eq(jiffies, slave->dev->last_rx + delta_in_ticks)) { |
2727 | 2729 | ||
2728 | slave->link = BOND_LINK_UP; | 2730 | slave->link = BOND_LINK_UP; |
2729 | slave->state = BOND_STATE_ACTIVE; | 2731 | slave->state = BOND_STATE_ACTIVE; |
@@ -2754,8 +2756,8 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2754 | * when the source ip is 0, so don't take the link down | 2756 | * when the source ip is 0, so don't take the link down |
2755 | * if we don't know our ip yet | 2757 | * if we don't know our ip yet |
2756 | */ | 2758 | */ |
2757 | if (((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) || | 2759 | if (time_after_eq(jiffies, slave->dev->trans_start + 2*delta_in_ticks) || |
2758 | (((jiffies - slave->dev->last_rx) >= (2*delta_in_ticks)) && | 2760 | (time_after_eq(jiffies, slave->dev->last_rx + 2*delta_in_ticks) && |
2759 | bond_has_ip(bond))) { | 2761 | bond_has_ip(bond))) { |
2760 | 2762 | ||
2761 | slave->link = BOND_LINK_DOWN; | 2763 | slave->link = BOND_LINK_DOWN; |
@@ -2848,8 +2850,8 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2848 | */ | 2850 | */ |
2849 | bond_for_each_slave(bond, slave, i) { | 2851 | bond_for_each_slave(bond, slave, i) { |
2850 | if (slave->link != BOND_LINK_UP) { | 2852 | if (slave->link != BOND_LINK_UP) { |
2851 | if ((jiffies - slave_last_rx(bond, slave)) <= | 2853 | if (time_before_eq(jiffies, |
2852 | delta_in_ticks) { | 2854 | slave_last_rx(bond, slave) + delta_in_ticks)) { |
2853 | 2855 | ||
2854 | slave->link = BOND_LINK_UP; | 2856 | slave->link = BOND_LINK_UP; |
2855 | 2857 | ||
@@ -2858,7 +2860,7 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2858 | write_lock_bh(&bond->curr_slave_lock); | 2860 | write_lock_bh(&bond->curr_slave_lock); |
2859 | 2861 | ||
2860 | if ((!bond->curr_active_slave) && | 2862 | if ((!bond->curr_active_slave) && |
2861 | ((jiffies - slave->dev->trans_start) <= delta_in_ticks)) { | 2863 | time_before_eq(jiffies, slave->dev->trans_start + delta_in_ticks)) { |
2862 | bond_change_active_slave(bond, slave); | 2864 | bond_change_active_slave(bond, slave); |
2863 | bond->current_arp_slave = NULL; | 2865 | bond->current_arp_slave = NULL; |
2864 | } else if (bond->curr_active_slave != slave) { | 2866 | } else if (bond->curr_active_slave != slave) { |
@@ -2897,7 +2899,7 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2897 | 2899 | ||
2898 | if ((slave != bond->curr_active_slave) && | 2900 | if ((slave != bond->curr_active_slave) && |
2899 | (!bond->current_arp_slave) && | 2901 | (!bond->current_arp_slave) && |
2900 | (((jiffies - slave_last_rx(bond, slave)) >= 3*delta_in_ticks) && | 2902 | (time_after_eq(jiffies, slave_last_rx(bond, slave) + 3*delta_in_ticks) && |
2901 | bond_has_ip(bond))) { | 2903 | bond_has_ip(bond))) { |
2902 | /* a backup slave has gone down; three times | 2904 | /* a backup slave has gone down; three times |
2903 | * the delta allows the current slave to be | 2905 | * the delta allows the current slave to be |
@@ -2943,10 +2945,10 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2943 | * before being taken out. if a primary is being used, check | 2945 | * before being taken out. if a primary is being used, check |
2944 | * if it is up and needs to take over as the curr_active_slave | 2946 | * if it is up and needs to take over as the curr_active_slave |
2945 | */ | 2947 | */ |
2946 | if ((((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) || | 2948 | if ((time_after_eq(jiffies, slave->dev->trans_start + 2*delta_in_ticks) || |
2947 | (((jiffies - slave_last_rx(bond, slave)) >= (2*delta_in_ticks)) && | 2949 | (time_after_eq(jiffies, slave_last_rx(bond, slave) + 2*delta_in_ticks) && |
2948 | bond_has_ip(bond))) && | 2950 | bond_has_ip(bond))) && |
2949 | ((jiffies - slave->jiffies) >= 2*delta_in_ticks)) { | 2951 | time_after_eq(jiffies, slave->jiffies + 2*delta_in_ticks)) { |
2950 | 2952 | ||
2951 | slave->link = BOND_LINK_DOWN; | 2953 | slave->link = BOND_LINK_DOWN; |
2952 | 2954 | ||
@@ -3604,6 +3606,24 @@ void bond_unregister_arp(struct bonding *bond) | |||
3604 | /*---------------------------- Hashing Policies -----------------------------*/ | 3606 | /*---------------------------- Hashing Policies -----------------------------*/ |
3605 | 3607 | ||
3606 | /* | 3608 | /* |
3609 | * Hash for the output device based upon layer 2 and layer 3 data. If | ||
3610 | * the packet is not IP mimic bond_xmit_hash_policy_l2() | ||
3611 | */ | ||
3612 | static int bond_xmit_hash_policy_l23(struct sk_buff *skb, | ||
3613 | struct net_device *bond_dev, int count) | ||
3614 | { | ||
3615 | struct ethhdr *data = (struct ethhdr *)skb->data; | ||
3616 | struct iphdr *iph = ip_hdr(skb); | ||
3617 | |||
3618 | if (skb->protocol == __constant_htons(ETH_P_IP)) { | ||
3619 | return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ | ||
3620 | (data->h_dest[5] ^ bond_dev->dev_addr[5])) % count; | ||
3621 | } | ||
3622 | |||
3623 | return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; | ||
3624 | } | ||
3625 | |||
3626 | /* | ||
3607 | * Hash for the output device based upon layer 3 and layer 4 data. If | 3627 | * Hash for the output device based upon layer 3 and layer 4 data. If |
3608 | * the packet is a frag or not TCP or UDP, just use layer 3 data. If it is | 3628 | * the packet is a frag or not TCP or UDP, just use layer 3 data. If it is |
3609 | * altogether not IP, mimic bond_xmit_hash_policy_l2() | 3629 | * altogether not IP, mimic bond_xmit_hash_policy_l2() |
@@ -4305,6 +4325,22 @@ out: | |||
4305 | 4325 | ||
4306 | /*------------------------- Device initialization ---------------------------*/ | 4326 | /*------------------------- Device initialization ---------------------------*/ |
4307 | 4327 | ||
4328 | static void bond_set_xmit_hash_policy(struct bonding *bond) | ||
4329 | { | ||
4330 | switch (bond->params.xmit_policy) { | ||
4331 | case BOND_XMIT_POLICY_LAYER23: | ||
4332 | bond->xmit_hash_policy = bond_xmit_hash_policy_l23; | ||
4333 | break; | ||
4334 | case BOND_XMIT_POLICY_LAYER34: | ||
4335 | bond->xmit_hash_policy = bond_xmit_hash_policy_l34; | ||
4336 | break; | ||
4337 | case BOND_XMIT_POLICY_LAYER2: | ||
4338 | default: | ||
4339 | bond->xmit_hash_policy = bond_xmit_hash_policy_l2; | ||
4340 | break; | ||
4341 | } | ||
4342 | } | ||
4343 | |||
4308 | /* | 4344 | /* |
4309 | * set bond mode specific net device operations | 4345 | * set bond mode specific net device operations |
4310 | */ | 4346 | */ |
@@ -4321,10 +4357,7 @@ void bond_set_mode_ops(struct bonding *bond, int mode) | |||
4321 | break; | 4357 | break; |
4322 | case BOND_MODE_XOR: | 4358 | case BOND_MODE_XOR: |
4323 | bond_dev->hard_start_xmit = bond_xmit_xor; | 4359 | bond_dev->hard_start_xmit = bond_xmit_xor; |
4324 | if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34) | 4360 | bond_set_xmit_hash_policy(bond); |
4325 | bond->xmit_hash_policy = bond_xmit_hash_policy_l34; | ||
4326 | else | ||
4327 | bond->xmit_hash_policy = bond_xmit_hash_policy_l2; | ||
4328 | break; | 4361 | break; |
4329 | case BOND_MODE_BROADCAST: | 4362 | case BOND_MODE_BROADCAST: |
4330 | bond_dev->hard_start_xmit = bond_xmit_broadcast; | 4363 | bond_dev->hard_start_xmit = bond_xmit_broadcast; |
@@ -4332,10 +4365,7 @@ void bond_set_mode_ops(struct bonding *bond, int mode) | |||
4332 | case BOND_MODE_8023AD: | 4365 | case BOND_MODE_8023AD: |
4333 | bond_set_master_3ad_flags(bond); | 4366 | bond_set_master_3ad_flags(bond); |
4334 | bond_dev->hard_start_xmit = bond_3ad_xmit_xor; | 4367 | bond_dev->hard_start_xmit = bond_3ad_xmit_xor; |
4335 | if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34) | 4368 | bond_set_xmit_hash_policy(bond); |
4336 | bond->xmit_hash_policy = bond_xmit_hash_policy_l34; | ||
4337 | else | ||
4338 | bond->xmit_hash_policy = bond_xmit_hash_policy_l2; | ||
4339 | break; | 4369 | break; |
4340 | case BOND_MODE_ALB: | 4370 | case BOND_MODE_ALB: |
4341 | bond_set_master_alb_flags(bond); | 4371 | bond_set_master_alb_flags(bond); |
@@ -4462,6 +4492,27 @@ static void bond_deinit(struct net_device *bond_dev) | |||
4462 | #endif | 4492 | #endif |
4463 | } | 4493 | } |
4464 | 4494 | ||
4495 | static void bond_work_cancel_all(struct bonding *bond) | ||
4496 | { | ||
4497 | write_lock_bh(&bond->lock); | ||
4498 | bond->kill_timers = 1; | ||
4499 | write_unlock_bh(&bond->lock); | ||
4500 | |||
4501 | if (bond->params.miimon && delayed_work_pending(&bond->mii_work)) | ||
4502 | cancel_delayed_work(&bond->mii_work); | ||
4503 | |||
4504 | if (bond->params.arp_interval && delayed_work_pending(&bond->arp_work)) | ||
4505 | cancel_delayed_work(&bond->arp_work); | ||
4506 | |||
4507 | if (bond->params.mode == BOND_MODE_ALB && | ||
4508 | delayed_work_pending(&bond->alb_work)) | ||
4509 | cancel_delayed_work(&bond->alb_work); | ||
4510 | |||
4511 | if (bond->params.mode == BOND_MODE_8023AD && | ||
4512 | delayed_work_pending(&bond->ad_work)) | ||
4513 | cancel_delayed_work(&bond->ad_work); | ||
4514 | } | ||
4515 | |||
4465 | /* Unregister and free all bond devices. | 4516 | /* Unregister and free all bond devices. |
4466 | * Caller must hold rtnl_lock. | 4517 | * Caller must hold rtnl_lock. |
4467 | */ | 4518 | */ |
@@ -4472,6 +4523,7 @@ static void bond_free_all(void) | |||
4472 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) { | 4523 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) { |
4473 | struct net_device *bond_dev = bond->dev; | 4524 | struct net_device *bond_dev = bond->dev; |
4474 | 4525 | ||
4526 | bond_work_cancel_all(bond); | ||
4475 | bond_mc_list_destroy(bond); | 4527 | bond_mc_list_destroy(bond); |
4476 | /* Release the bonded slaves */ | 4528 | /* Release the bonded slaves */ |
4477 | bond_release_all(bond_dev); | 4529 | bond_release_all(bond_dev); |
@@ -4497,8 +4549,7 @@ int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl) | |||
4497 | for (i = 0; tbl[i].modename; i++) { | 4549 | for (i = 0; tbl[i].modename; i++) { |
4498 | if ((isdigit(*mode_arg) && | 4550 | if ((isdigit(*mode_arg) && |
4499 | tbl[i].mode == simple_strtol(mode_arg, NULL, 0)) || | 4551 | tbl[i].mode == simple_strtol(mode_arg, NULL, 0)) || |
4500 | (strncmp(mode_arg, tbl[i].modename, | 4552 | (strcmp(mode_arg, tbl[i].modename) == 0)) { |
4501 | strlen(tbl[i].modename)) == 0)) { | ||
4502 | return tbl[i].mode; | 4553 | return tbl[i].mode; |
4503 | } | 4554 | } |
4504 | } | 4555 | } |
@@ -4873,27 +4924,6 @@ out_rtnl: | |||
4873 | return res; | 4924 | return res; |
4874 | } | 4925 | } |
4875 | 4926 | ||
4876 | static void bond_work_cancel_all(struct bonding *bond) | ||
4877 | { | ||
4878 | write_lock_bh(&bond->lock); | ||
4879 | bond->kill_timers = 1; | ||
4880 | write_unlock_bh(&bond->lock); | ||
4881 | |||
4882 | if (bond->params.miimon && delayed_work_pending(&bond->mii_work)) | ||
4883 | cancel_delayed_work(&bond->mii_work); | ||
4884 | |||
4885 | if (bond->params.arp_interval && delayed_work_pending(&bond->arp_work)) | ||
4886 | cancel_delayed_work(&bond->arp_work); | ||
4887 | |||
4888 | if (bond->params.mode == BOND_MODE_ALB && | ||
4889 | delayed_work_pending(&bond->alb_work)) | ||
4890 | cancel_delayed_work(&bond->alb_work); | ||
4891 | |||
4892 | if (bond->params.mode == BOND_MODE_8023AD && | ||
4893 | delayed_work_pending(&bond->ad_work)) | ||
4894 | cancel_delayed_work(&bond->ad_work); | ||
4895 | } | ||
4896 | |||
4897 | static int __init bonding_init(void) | 4927 | static int __init bonding_init(void) |
4898 | { | 4928 | { |
4899 | int i; | 4929 | int i; |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index b29330d8e309..11b76b352415 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -74,7 +74,7 @@ struct rw_semaphore bonding_rwsem; | |||
74 | * "show" function for the bond_masters attribute. | 74 | * "show" function for the bond_masters attribute. |
75 | * The class parameter is ignored. | 75 | * The class parameter is ignored. |
76 | */ | 76 | */ |
77 | static ssize_t bonding_show_bonds(struct class *cls, char *buffer) | 77 | static ssize_t bonding_show_bonds(struct class *cls, char *buf) |
78 | { | 78 | { |
79 | int res = 0; | 79 | int res = 0; |
80 | struct bonding *bond; | 80 | struct bonding *bond; |
@@ -86,14 +86,13 @@ static ssize_t bonding_show_bonds(struct class *cls, char *buffer) | |||
86 | /* not enough space for another interface name */ | 86 | /* not enough space for another interface name */ |
87 | if ((PAGE_SIZE - res) > 10) | 87 | if ((PAGE_SIZE - res) > 10) |
88 | res = PAGE_SIZE - 10; | 88 | res = PAGE_SIZE - 10; |
89 | res += sprintf(buffer + res, "++more++"); | 89 | res += sprintf(buf + res, "++more++ "); |
90 | break; | 90 | break; |
91 | } | 91 | } |
92 | res += sprintf(buffer + res, "%s ", | 92 | res += sprintf(buf + res, "%s ", bond->dev->name); |
93 | bond->dev->name); | ||
94 | } | 93 | } |
95 | res += sprintf(buffer + res, "\n"); | 94 | if (res) |
96 | res++; | 95 | buf[res-1] = '\n'; /* eat the leftover space */ |
97 | up_read(&(bonding_rwsem)); | 96 | up_read(&(bonding_rwsem)); |
98 | return res; | 97 | return res; |
99 | } | 98 | } |
@@ -235,14 +234,14 @@ static ssize_t bonding_show_slaves(struct device *d, | |||
235 | /* not enough space for another interface name */ | 234 | /* not enough space for another interface name */ |
236 | if ((PAGE_SIZE - res) > 10) | 235 | if ((PAGE_SIZE - res) > 10) |
237 | res = PAGE_SIZE - 10; | 236 | res = PAGE_SIZE - 10; |
238 | res += sprintf(buf + res, "++more++"); | 237 | res += sprintf(buf + res, "++more++ "); |
239 | break; | 238 | break; |
240 | } | 239 | } |
241 | res += sprintf(buf + res, "%s ", slave->dev->name); | 240 | res += sprintf(buf + res, "%s ", slave->dev->name); |
242 | } | 241 | } |
243 | read_unlock(&bond->lock); | 242 | read_unlock(&bond->lock); |
244 | res += sprintf(buf + res, "\n"); | 243 | if (res) |
245 | res++; | 244 | buf[res-1] = '\n'; /* eat the leftover space */ |
246 | return res; | 245 | return res; |
247 | } | 246 | } |
248 | 247 | ||
@@ -406,7 +405,7 @@ static ssize_t bonding_show_mode(struct device *d, | |||
406 | 405 | ||
407 | return sprintf(buf, "%s %d\n", | 406 | return sprintf(buf, "%s %d\n", |
408 | bond_mode_tbl[bond->params.mode].modename, | 407 | bond_mode_tbl[bond->params.mode].modename, |
409 | bond->params.mode) + 1; | 408 | bond->params.mode); |
410 | } | 409 | } |
411 | 410 | ||
412 | static ssize_t bonding_store_mode(struct device *d, | 411 | static ssize_t bonding_store_mode(struct device *d, |
@@ -457,20 +456,11 @@ static ssize_t bonding_show_xmit_hash(struct device *d, | |||
457 | struct device_attribute *attr, | 456 | struct device_attribute *attr, |
458 | char *buf) | 457 | char *buf) |
459 | { | 458 | { |
460 | int count; | ||
461 | struct bonding *bond = to_bond(d); | 459 | struct bonding *bond = to_bond(d); |
462 | 460 | ||
463 | if ((bond->params.mode != BOND_MODE_XOR) && | 461 | return sprintf(buf, "%s %d\n", |
464 | (bond->params.mode != BOND_MODE_8023AD)) { | 462 | xmit_hashtype_tbl[bond->params.xmit_policy].modename, |
465 | // Not Applicable | 463 | bond->params.xmit_policy); |
466 | count = sprintf(buf, "NA\n") + 1; | ||
467 | } else { | ||
468 | count = sprintf(buf, "%s %d\n", | ||
469 | xmit_hashtype_tbl[bond->params.xmit_policy].modename, | ||
470 | bond->params.xmit_policy) + 1; | ||
471 | } | ||
472 | |||
473 | return count; | ||
474 | } | 464 | } |
475 | 465 | ||
476 | static ssize_t bonding_store_xmit_hash(struct device *d, | 466 | static ssize_t bonding_store_xmit_hash(struct device *d, |
@@ -488,15 +478,6 @@ static ssize_t bonding_store_xmit_hash(struct device *d, | |||
488 | goto out; | 478 | goto out; |
489 | } | 479 | } |
490 | 480 | ||
491 | if ((bond->params.mode != BOND_MODE_XOR) && | ||
492 | (bond->params.mode != BOND_MODE_8023AD)) { | ||
493 | printk(KERN_ERR DRV_NAME | ||
494 | "%s: Transmit hash policy is irrelevant in this mode.\n", | ||
495 | bond->dev->name); | ||
496 | ret = -EPERM; | ||
497 | goto out; | ||
498 | } | ||
499 | |||
500 | new_value = bond_parse_parm((char *)buf, xmit_hashtype_tbl); | 481 | new_value = bond_parse_parm((char *)buf, xmit_hashtype_tbl); |
501 | if (new_value < 0) { | 482 | if (new_value < 0) { |
502 | printk(KERN_ERR DRV_NAME | 483 | printk(KERN_ERR DRV_NAME |
@@ -527,7 +508,7 @@ static ssize_t bonding_show_arp_validate(struct device *d, | |||
527 | 508 | ||
528 | return sprintf(buf, "%s %d\n", | 509 | return sprintf(buf, "%s %d\n", |
529 | arp_validate_tbl[bond->params.arp_validate].modename, | 510 | arp_validate_tbl[bond->params.arp_validate].modename, |
530 | bond->params.arp_validate) + 1; | 511 | bond->params.arp_validate); |
531 | } | 512 | } |
532 | 513 | ||
533 | static ssize_t bonding_store_arp_validate(struct device *d, | 514 | static ssize_t bonding_store_arp_validate(struct device *d, |
@@ -627,7 +608,7 @@ static ssize_t bonding_show_arp_interval(struct device *d, | |||
627 | { | 608 | { |
628 | struct bonding *bond = to_bond(d); | 609 | struct bonding *bond = to_bond(d); |
629 | 610 | ||
630 | return sprintf(buf, "%d\n", bond->params.arp_interval) + 1; | 611 | return sprintf(buf, "%d\n", bond->params.arp_interval); |
631 | } | 612 | } |
632 | 613 | ||
633 | static ssize_t bonding_store_arp_interval(struct device *d, | 614 | static ssize_t bonding_store_arp_interval(struct device *d, |
@@ -712,9 +693,7 @@ static ssize_t bonding_show_arp_targets(struct device *d, | |||
712 | NIPQUAD(bond->params.arp_targets[i])); | 693 | NIPQUAD(bond->params.arp_targets[i])); |
713 | } | 694 | } |
714 | if (res) | 695 | if (res) |
715 | res--; /* eat the leftover space */ | 696 | buf[res-1] = '\n'; /* eat the leftover space */ |
716 | res += sprintf(buf + res, "\n"); | ||
717 | res++; | ||
718 | return res; | 697 | return res; |
719 | } | 698 | } |
720 | 699 | ||
@@ -815,7 +794,7 @@ static ssize_t bonding_show_downdelay(struct device *d, | |||
815 | { | 794 | { |
816 | struct bonding *bond = to_bond(d); | 795 | struct bonding *bond = to_bond(d); |
817 | 796 | ||
818 | return sprintf(buf, "%d\n", bond->params.downdelay * bond->params.miimon) + 1; | 797 | return sprintf(buf, "%d\n", bond->params.downdelay * bond->params.miimon); |
819 | } | 798 | } |
820 | 799 | ||
821 | static ssize_t bonding_store_downdelay(struct device *d, | 800 | static ssize_t bonding_store_downdelay(struct device *d, |
@@ -872,7 +851,7 @@ static ssize_t bonding_show_updelay(struct device *d, | |||
872 | { | 851 | { |
873 | struct bonding *bond = to_bond(d); | 852 | struct bonding *bond = to_bond(d); |
874 | 853 | ||
875 | return sprintf(buf, "%d\n", bond->params.updelay * bond->params.miimon) + 1; | 854 | return sprintf(buf, "%d\n", bond->params.updelay * bond->params.miimon); |
876 | 855 | ||
877 | } | 856 | } |
878 | 857 | ||
@@ -936,7 +915,7 @@ static ssize_t bonding_show_lacp(struct device *d, | |||
936 | 915 | ||
937 | return sprintf(buf, "%s %d\n", | 916 | return sprintf(buf, "%s %d\n", |
938 | bond_lacp_tbl[bond->params.lacp_fast].modename, | 917 | bond_lacp_tbl[bond->params.lacp_fast].modename, |
939 | bond->params.lacp_fast) + 1; | 918 | bond->params.lacp_fast); |
940 | } | 919 | } |
941 | 920 | ||
942 | static ssize_t bonding_store_lacp(struct device *d, | 921 | static ssize_t bonding_store_lacp(struct device *d, |
@@ -992,7 +971,7 @@ static ssize_t bonding_show_miimon(struct device *d, | |||
992 | { | 971 | { |
993 | struct bonding *bond = to_bond(d); | 972 | struct bonding *bond = to_bond(d); |
994 | 973 | ||
995 | return sprintf(buf, "%d\n", bond->params.miimon) + 1; | 974 | return sprintf(buf, "%d\n", bond->params.miimon); |
996 | } | 975 | } |
997 | 976 | ||
998 | static ssize_t bonding_store_miimon(struct device *d, | 977 | static ssize_t bonding_store_miimon(struct device *d, |
@@ -1083,9 +1062,7 @@ static ssize_t bonding_show_primary(struct device *d, | |||
1083 | struct bonding *bond = to_bond(d); | 1062 | struct bonding *bond = to_bond(d); |
1084 | 1063 | ||
1085 | if (bond->primary_slave) | 1064 | if (bond->primary_slave) |
1086 | count = sprintf(buf, "%s\n", bond->primary_slave->dev->name) + 1; | 1065 | count = sprintf(buf, "%s\n", bond->primary_slave->dev->name); |
1087 | else | ||
1088 | count = sprintf(buf, "\n") + 1; | ||
1089 | 1066 | ||
1090 | return count; | 1067 | return count; |
1091 | } | 1068 | } |
@@ -1149,7 +1126,7 @@ static ssize_t bonding_show_carrier(struct device *d, | |||
1149 | { | 1126 | { |
1150 | struct bonding *bond = to_bond(d); | 1127 | struct bonding *bond = to_bond(d); |
1151 | 1128 | ||
1152 | return sprintf(buf, "%d\n", bond->params.use_carrier) + 1; | 1129 | return sprintf(buf, "%d\n", bond->params.use_carrier); |
1153 | } | 1130 | } |
1154 | 1131 | ||
1155 | static ssize_t bonding_store_carrier(struct device *d, | 1132 | static ssize_t bonding_store_carrier(struct device *d, |
@@ -1191,16 +1168,14 @@ static ssize_t bonding_show_active_slave(struct device *d, | |||
1191 | { | 1168 | { |
1192 | struct slave *curr; | 1169 | struct slave *curr; |
1193 | struct bonding *bond = to_bond(d); | 1170 | struct bonding *bond = to_bond(d); |
1194 | int count; | 1171 | int count = 0; |
1195 | 1172 | ||
1196 | read_lock(&bond->curr_slave_lock); | 1173 | read_lock(&bond->curr_slave_lock); |
1197 | curr = bond->curr_active_slave; | 1174 | curr = bond->curr_active_slave; |
1198 | read_unlock(&bond->curr_slave_lock); | 1175 | read_unlock(&bond->curr_slave_lock); |
1199 | 1176 | ||
1200 | if (USES_PRIMARY(bond->params.mode) && curr) | 1177 | if (USES_PRIMARY(bond->params.mode) && curr) |
1201 | count = sprintf(buf, "%s\n", curr->dev->name) + 1; | 1178 | count = sprintf(buf, "%s\n", curr->dev->name); |
1202 | else | ||
1203 | count = sprintf(buf, "\n") + 1; | ||
1204 | return count; | 1179 | return count; |
1205 | } | 1180 | } |
1206 | 1181 | ||
@@ -1295,7 +1270,7 @@ static ssize_t bonding_show_mii_status(struct device *d, | |||
1295 | curr = bond->curr_active_slave; | 1270 | curr = bond->curr_active_slave; |
1296 | read_unlock(&bond->curr_slave_lock); | 1271 | read_unlock(&bond->curr_slave_lock); |
1297 | 1272 | ||
1298 | return sprintf(buf, "%s\n", (curr) ? "up" : "down") + 1; | 1273 | return sprintf(buf, "%s\n", (curr) ? "up" : "down"); |
1299 | } | 1274 | } |
1300 | static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); | 1275 | static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); |
1301 | 1276 | ||
@@ -1312,10 +1287,8 @@ static ssize_t bonding_show_ad_aggregator(struct device *d, | |||
1312 | 1287 | ||
1313 | if (bond->params.mode == BOND_MODE_8023AD) { | 1288 | if (bond->params.mode == BOND_MODE_8023AD) { |
1314 | struct ad_info ad_info; | 1289 | struct ad_info ad_info; |
1315 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.aggregator_id) + 1; | 1290 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.aggregator_id); |
1316 | } | 1291 | } |
1317 | else | ||
1318 | count = sprintf(buf, "\n") + 1; | ||
1319 | 1292 | ||
1320 | return count; | 1293 | return count; |
1321 | } | 1294 | } |
@@ -1334,10 +1307,8 @@ static ssize_t bonding_show_ad_num_ports(struct device *d, | |||
1334 | 1307 | ||
1335 | if (bond->params.mode == BOND_MODE_8023AD) { | 1308 | if (bond->params.mode == BOND_MODE_8023AD) { |
1336 | struct ad_info ad_info; | 1309 | struct ad_info ad_info; |
1337 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0: ad_info.ports) + 1; | 1310 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0: ad_info.ports); |
1338 | } | 1311 | } |
1339 | else | ||
1340 | count = sprintf(buf, "\n") + 1; | ||
1341 | 1312 | ||
1342 | return count; | 1313 | return count; |
1343 | } | 1314 | } |
@@ -1356,10 +1327,8 @@ static ssize_t bonding_show_ad_actor_key(struct device *d, | |||
1356 | 1327 | ||
1357 | if (bond->params.mode == BOND_MODE_8023AD) { | 1328 | if (bond->params.mode == BOND_MODE_8023AD) { |
1358 | struct ad_info ad_info; | 1329 | struct ad_info ad_info; |
1359 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.actor_key) + 1; | 1330 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.actor_key); |
1360 | } | 1331 | } |
1361 | else | ||
1362 | count = sprintf(buf, "\n") + 1; | ||
1363 | 1332 | ||
1364 | return count; | 1333 | return count; |
1365 | } | 1334 | } |
@@ -1378,10 +1347,8 @@ static ssize_t bonding_show_ad_partner_key(struct device *d, | |||
1378 | 1347 | ||
1379 | if (bond->params.mode == BOND_MODE_8023AD) { | 1348 | if (bond->params.mode == BOND_MODE_8023AD) { |
1380 | struct ad_info ad_info; | 1349 | struct ad_info ad_info; |
1381 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.partner_key) + 1; | 1350 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.partner_key); |
1382 | } | 1351 | } |
1383 | else | ||
1384 | count = sprintf(buf, "\n") + 1; | ||
1385 | 1352 | ||
1386 | return count; | 1353 | return count; |
1387 | } | 1354 | } |
@@ -1403,12 +1370,9 @@ static ssize_t bonding_show_ad_partner_mac(struct device *d, | |||
1403 | struct ad_info ad_info; | 1370 | struct ad_info ad_info; |
1404 | if (!bond_3ad_get_active_agg_info(bond, &ad_info)) { | 1371 | if (!bond_3ad_get_active_agg_info(bond, &ad_info)) { |
1405 | count = sprintf(buf,"%s\n", | 1372 | count = sprintf(buf,"%s\n", |
1406 | print_mac(mac, ad_info.partner_system)) | 1373 | print_mac(mac, ad_info.partner_system)); |
1407 | + 1; | ||
1408 | } | 1374 | } |
1409 | } | 1375 | } |
1410 | else | ||
1411 | count = sprintf(buf, "\n") + 1; | ||
1412 | 1376 | ||
1413 | return count; | 1377 | return count; |
1414 | } | 1378 | } |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 61c1b4536d34..e1e4734e23ce 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -22,8 +22,8 @@ | |||
22 | #include "bond_3ad.h" | 22 | #include "bond_3ad.h" |
23 | #include "bond_alb.h" | 23 | #include "bond_alb.h" |
24 | 24 | ||
25 | #define DRV_VERSION "3.2.1" | 25 | #define DRV_VERSION "3.2.3" |
26 | #define DRV_RELDATE "October 15, 2007" | 26 | #define DRV_RELDATE "December 6, 2007" |
27 | #define DRV_NAME "bonding" | 27 | #define DRV_NAME "bonding" |
28 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" | 28 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" |
29 | 29 | ||
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index 2dbf8dc116c6..c5975047c89b 100644 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c | |||
@@ -374,7 +374,9 @@ static char stats_strings[][ETH_GSTRING_LEN] = { | |||
374 | "TxInternalMACXmitError", | 374 | "TxInternalMACXmitError", |
375 | "TxFramesWithExcessiveDeferral", | 375 | "TxFramesWithExcessiveDeferral", |
376 | "TxFCSErrors", | 376 | "TxFCSErrors", |
377 | 377 | "TxJumboFramesOk", | |
378 | "TxJumboOctetsOk", | ||
379 | |||
378 | "RxOctetsOK", | 380 | "RxOctetsOK", |
379 | "RxOctetsBad", | 381 | "RxOctetsBad", |
380 | "RxUnicastFramesOK", | 382 | "RxUnicastFramesOK", |
@@ -392,16 +394,17 @@ static char stats_strings[][ETH_GSTRING_LEN] = { | |||
392 | "RxInRangeLengthErrors", | 394 | "RxInRangeLengthErrors", |
393 | "RxOutOfRangeLengthField", | 395 | "RxOutOfRangeLengthField", |
394 | "RxFrameTooLongErrors", | 396 | "RxFrameTooLongErrors", |
397 | "RxJumboFramesOk", | ||
398 | "RxJumboOctetsOk", | ||
395 | 399 | ||
396 | /* Port stats */ | 400 | /* Port stats */ |
397 | "RxPackets", | ||
398 | "RxCsumGood", | 401 | "RxCsumGood", |
399 | "TxPackets", | ||
400 | "TxCsumOffload", | 402 | "TxCsumOffload", |
401 | "TxTso", | 403 | "TxTso", |
402 | "RxVlan", | 404 | "RxVlan", |
403 | "TxVlan", | 405 | "TxVlan", |
404 | 406 | "TxNeedHeadroom", | |
407 | |||
405 | /* Interrupt stats */ | 408 | /* Interrupt stats */ |
406 | "rx drops", | 409 | "rx drops", |
407 | "pure_rsps", | 410 | "pure_rsps", |
@@ -463,23 +466,56 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats, | |||
463 | const struct cmac_statistics *s; | 466 | const struct cmac_statistics *s; |
464 | const struct sge_intr_counts *t; | 467 | const struct sge_intr_counts *t; |
465 | struct sge_port_stats ss; | 468 | struct sge_port_stats ss; |
466 | unsigned int len; | ||
467 | 469 | ||
468 | s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL); | 470 | s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL); |
469 | 471 | t = t1_sge_get_intr_counts(adapter->sge); | |
470 | len = sizeof(u64)*(&s->TxFCSErrors + 1 - &s->TxOctetsOK); | ||
471 | memcpy(data, &s->TxOctetsOK, len); | ||
472 | data += len; | ||
473 | |||
474 | len = sizeof(u64)*(&s->RxFrameTooLongErrors + 1 - &s->RxOctetsOK); | ||
475 | memcpy(data, &s->RxOctetsOK, len); | ||
476 | data += len; | ||
477 | |||
478 | t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss); | 472 | t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss); |
479 | memcpy(data, &ss, sizeof(ss)); | ||
480 | data += sizeof(ss); | ||
481 | 473 | ||
482 | t = t1_sge_get_intr_counts(adapter->sge); | 474 | *data++ = s->TxOctetsOK; |
475 | *data++ = s->TxOctetsBad; | ||
476 | *data++ = s->TxUnicastFramesOK; | ||
477 | *data++ = s->TxMulticastFramesOK; | ||
478 | *data++ = s->TxBroadcastFramesOK; | ||
479 | *data++ = s->TxPauseFrames; | ||
480 | *data++ = s->TxFramesWithDeferredXmissions; | ||
481 | *data++ = s->TxLateCollisions; | ||
482 | *data++ = s->TxTotalCollisions; | ||
483 | *data++ = s->TxFramesAbortedDueToXSCollisions; | ||
484 | *data++ = s->TxUnderrun; | ||
485 | *data++ = s->TxLengthErrors; | ||
486 | *data++ = s->TxInternalMACXmitError; | ||
487 | *data++ = s->TxFramesWithExcessiveDeferral; | ||
488 | *data++ = s->TxFCSErrors; | ||
489 | *data++ = s->TxJumboFramesOK; | ||
490 | *data++ = s->TxJumboOctetsOK; | ||
491 | |||
492 | *data++ = s->RxOctetsOK; | ||
493 | *data++ = s->RxOctetsBad; | ||
494 | *data++ = s->RxUnicastFramesOK; | ||
495 | *data++ = s->RxMulticastFramesOK; | ||
496 | *data++ = s->RxBroadcastFramesOK; | ||
497 | *data++ = s->RxPauseFrames; | ||
498 | *data++ = s->RxFCSErrors; | ||
499 | *data++ = s->RxAlignErrors; | ||
500 | *data++ = s->RxSymbolErrors; | ||
501 | *data++ = s->RxDataErrors; | ||
502 | *data++ = s->RxSequenceErrors; | ||
503 | *data++ = s->RxRuntErrors; | ||
504 | *data++ = s->RxJabberErrors; | ||
505 | *data++ = s->RxInternalMACRcvError; | ||
506 | *data++ = s->RxInRangeLengthErrors; | ||
507 | *data++ = s->RxOutOfRangeLengthField; | ||
508 | *data++ = s->RxFrameTooLongErrors; | ||
509 | *data++ = s->RxJumboFramesOK; | ||
510 | *data++ = s->RxJumboOctetsOK; | ||
511 | |||
512 | *data++ = ss.rx_cso_good; | ||
513 | *data++ = ss.tx_cso; | ||
514 | *data++ = ss.tx_tso; | ||
515 | *data++ = ss.vlan_xtract; | ||
516 | *data++ = ss.vlan_insert; | ||
517 | *data++ = ss.tx_need_hdrroom; | ||
518 | |||
483 | *data++ = t->rx_drops; | 519 | *data++ = t->rx_drops; |
484 | *data++ = t->pure_rsps; | 520 | *data++ = t->pure_rsps; |
485 | *data++ = t->unhandled_irqs; | 521 | *data++ = t->unhandled_irqs; |
diff --git a/drivers/net/chelsio/pm3393.c b/drivers/net/chelsio/pm3393.c index 678778a8d133..2117c4fbb107 100644 --- a/drivers/net/chelsio/pm3393.c +++ b/drivers/net/chelsio/pm3393.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | #include <linux/crc32.h> | 46 | #include <linux/crc32.h> |
47 | 47 | ||
48 | #define OFFSET(REG_ADDR) (REG_ADDR << 2) | 48 | #define OFFSET(REG_ADDR) ((REG_ADDR) << 2) |
49 | 49 | ||
50 | /* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */ | 50 | /* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */ |
51 | #define MAX_FRAME_SIZE 9600 | 51 | #define MAX_FRAME_SIZE 9600 |
@@ -428,69 +428,26 @@ static int pm3393_set_speed_duplex_fc(struct cmac *cmac, int speed, int duplex, | |||
428 | return 0; | 428 | return 0; |
429 | } | 429 | } |
430 | 430 | ||
431 | static void pm3393_rmon_update(struct adapter *adapter, u32 offs, u64 *val, | 431 | #define RMON_UPDATE(mac, name, stat_name) \ |
432 | int over) | 432 | { \ |
433 | { | 433 | t1_tpi_read((mac)->adapter, OFFSET(name), &val0); \ |
434 | u32 val0, val1, val2; | 434 | t1_tpi_read((mac)->adapter, OFFSET((name)+1), &val1); \ |
435 | 435 | t1_tpi_read((mac)->adapter, OFFSET((name)+2), &val2); \ | |
436 | t1_tpi_read(adapter, offs, &val0); | 436 | (mac)->stats.stat_name = (u64)(val0 & 0xffff) | \ |
437 | t1_tpi_read(adapter, offs + 4, &val1); | 437 | ((u64)(val1 & 0xffff) << 16) | \ |
438 | t1_tpi_read(adapter, offs + 8, &val2); | 438 | ((u64)(val2 & 0xff) << 32) | \ |
439 | 439 | ((mac)->stats.stat_name & \ | |
440 | *val &= ~0ull << 40; | 440 | 0xffffff0000000000ULL); \ |
441 | *val |= val0 & 0xffff; | 441 | if (ro & \ |
442 | *val |= (val1 & 0xffff) << 16; | 442 | (1ULL << ((name - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW) >> 2))) \ |
443 | *val |= (u64)(val2 & 0xff) << 32; | 443 | (mac)->stats.stat_name += 1ULL << 40; \ |
444 | |||
445 | if (over) | ||
446 | *val += 1ull << 40; | ||
447 | } | 444 | } |
448 | 445 | ||
449 | static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac, | 446 | static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac, |
450 | int flag) | 447 | int flag) |
451 | { | 448 | { |
452 | static struct { | 449 | u64 ro; |
453 | unsigned int reg; | 450 | u32 val0, val1, val2, val3; |
454 | unsigned int offset; | ||
455 | } hw_stats [] = { | ||
456 | |||
457 | #define HW_STAT(name, stat_name) \ | ||
458 | { name, (&((struct cmac_statistics *)NULL)->stat_name) - (u64 *)NULL } | ||
459 | |||
460 | /* Rx stats */ | ||
461 | HW_STAT(RxOctetsReceivedOK, RxOctetsOK), | ||
462 | HW_STAT(RxUnicastFramesReceivedOK, RxUnicastFramesOK), | ||
463 | HW_STAT(RxMulticastFramesReceivedOK, RxMulticastFramesOK), | ||
464 | HW_STAT(RxBroadcastFramesReceivedOK, RxBroadcastFramesOK), | ||
465 | HW_STAT(RxPAUSEMACCtrlFramesReceived, RxPauseFrames), | ||
466 | HW_STAT(RxFrameCheckSequenceErrors, RxFCSErrors), | ||
467 | HW_STAT(RxFramesLostDueToInternalMACErrors, | ||
468 | RxInternalMACRcvError), | ||
469 | HW_STAT(RxSymbolErrors, RxSymbolErrors), | ||
470 | HW_STAT(RxInRangeLengthErrors, RxInRangeLengthErrors), | ||
471 | HW_STAT(RxFramesTooLongErrors , RxFrameTooLongErrors), | ||
472 | HW_STAT(RxJabbers, RxJabberErrors), | ||
473 | HW_STAT(RxFragments, RxRuntErrors), | ||
474 | HW_STAT(RxUndersizedFrames, RxRuntErrors), | ||
475 | HW_STAT(RxJumboFramesReceivedOK, RxJumboFramesOK), | ||
476 | HW_STAT(RxJumboOctetsReceivedOK, RxJumboOctetsOK), | ||
477 | |||
478 | /* Tx stats */ | ||
479 | HW_STAT(TxOctetsTransmittedOK, TxOctetsOK), | ||
480 | HW_STAT(TxFramesLostDueToInternalMACTransmissionError, | ||
481 | TxInternalMACXmitError), | ||
482 | HW_STAT(TxTransmitSystemError, TxFCSErrors), | ||
483 | HW_STAT(TxUnicastFramesTransmittedOK, TxUnicastFramesOK), | ||
484 | HW_STAT(TxMulticastFramesTransmittedOK, TxMulticastFramesOK), | ||
485 | HW_STAT(TxBroadcastFramesTransmittedOK, TxBroadcastFramesOK), | ||
486 | HW_STAT(TxPAUSEMACCtrlFramesTransmitted, TxPauseFrames), | ||
487 | HW_STAT(TxJumboFramesReceivedOK, TxJumboFramesOK), | ||
488 | HW_STAT(TxJumboOctetsReceivedOK, TxJumboOctetsOK) | ||
489 | }, *p = hw_stats; | ||
490 | u64 ro; | ||
491 | u32 val0, val1, val2, val3; | ||
492 | u64 *stats = (u64 *) &mac->stats; | ||
493 | unsigned int i; | ||
494 | 451 | ||
495 | /* Snap the counters */ | 452 | /* Snap the counters */ |
496 | pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL, | 453 | pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL, |
@@ -504,14 +461,35 @@ static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac, | |||
504 | ro = ((u64)val0 & 0xffff) | (((u64)val1 & 0xffff) << 16) | | 461 | ro = ((u64)val0 & 0xffff) | (((u64)val1 & 0xffff) << 16) | |
505 | (((u64)val2 & 0xffff) << 32) | (((u64)val3 & 0xffff) << 48); | 462 | (((u64)val2 & 0xffff) << 32) | (((u64)val3 & 0xffff) << 48); |
506 | 463 | ||
507 | for (i = 0; i < ARRAY_SIZE(hw_stats); i++) { | 464 | /* Rx stats */ |
508 | unsigned reg = p->reg - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW; | 465 | RMON_UPDATE(mac, RxOctetsReceivedOK, RxOctetsOK); |
509 | 466 | RMON_UPDATE(mac, RxUnicastFramesReceivedOK, RxUnicastFramesOK); | |
510 | pm3393_rmon_update((mac)->adapter, OFFSET(p->reg), | 467 | RMON_UPDATE(mac, RxMulticastFramesReceivedOK, RxMulticastFramesOK); |
511 | stats + p->offset, ro & (reg >> 2)); | 468 | RMON_UPDATE(mac, RxBroadcastFramesReceivedOK, RxBroadcastFramesOK); |
512 | } | 469 | RMON_UPDATE(mac, RxPAUSEMACCtrlFramesReceived, RxPauseFrames); |
513 | 470 | RMON_UPDATE(mac, RxFrameCheckSequenceErrors, RxFCSErrors); | |
514 | 471 | RMON_UPDATE(mac, RxFramesLostDueToInternalMACErrors, | |
472 | RxInternalMACRcvError); | ||
473 | RMON_UPDATE(mac, RxSymbolErrors, RxSymbolErrors); | ||
474 | RMON_UPDATE(mac, RxInRangeLengthErrors, RxInRangeLengthErrors); | ||
475 | RMON_UPDATE(mac, RxFramesTooLongErrors , RxFrameTooLongErrors); | ||
476 | RMON_UPDATE(mac, RxJabbers, RxJabberErrors); | ||
477 | RMON_UPDATE(mac, RxFragments, RxRuntErrors); | ||
478 | RMON_UPDATE(mac, RxUndersizedFrames, RxRuntErrors); | ||
479 | RMON_UPDATE(mac, RxJumboFramesReceivedOK, RxJumboFramesOK); | ||
480 | RMON_UPDATE(mac, RxJumboOctetsReceivedOK, RxJumboOctetsOK); | ||
481 | |||
482 | /* Tx stats */ | ||
483 | RMON_UPDATE(mac, TxOctetsTransmittedOK, TxOctetsOK); | ||
484 | RMON_UPDATE(mac, TxFramesLostDueToInternalMACTransmissionError, | ||
485 | TxInternalMACXmitError); | ||
486 | RMON_UPDATE(mac, TxTransmitSystemError, TxFCSErrors); | ||
487 | RMON_UPDATE(mac, TxUnicastFramesTransmittedOK, TxUnicastFramesOK); | ||
488 | RMON_UPDATE(mac, TxMulticastFramesTransmittedOK, TxMulticastFramesOK); | ||
489 | RMON_UPDATE(mac, TxBroadcastFramesTransmittedOK, TxBroadcastFramesOK); | ||
490 | RMON_UPDATE(mac, TxPAUSEMACCtrlFramesTransmitted, TxPauseFrames); | ||
491 | RMON_UPDATE(mac, TxJumboFramesReceivedOK, TxJumboFramesOK); | ||
492 | RMON_UPDATE(mac, TxJumboOctetsReceivedOK, TxJumboOctetsOK); | ||
515 | 493 | ||
516 | return &mac->stats; | 494 | return &mac->stats; |
517 | } | 495 | } |
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 443666292a5c..b301c0428ae0 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -986,11 +986,10 @@ void t1_sge_get_port_stats(const struct sge *sge, int port, | |||
986 | for_each_possible_cpu(cpu) { | 986 | for_each_possible_cpu(cpu) { |
987 | struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[port], cpu); | 987 | struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[port], cpu); |
988 | 988 | ||
989 | ss->rx_packets += st->rx_packets; | ||
990 | ss->rx_cso_good += st->rx_cso_good; | 989 | ss->rx_cso_good += st->rx_cso_good; |
991 | ss->tx_packets += st->tx_packets; | ||
992 | ss->tx_cso += st->tx_cso; | 990 | ss->tx_cso += st->tx_cso; |
993 | ss->tx_tso += st->tx_tso; | 991 | ss->tx_tso += st->tx_tso; |
992 | ss->tx_need_hdrroom += st->tx_need_hdrroom; | ||
994 | ss->vlan_xtract += st->vlan_xtract; | 993 | ss->vlan_xtract += st->vlan_xtract; |
995 | ss->vlan_insert += st->vlan_insert; | 994 | ss->vlan_insert += st->vlan_insert; |
996 | } | 995 | } |
@@ -1380,7 +1379,6 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len) | |||
1380 | __skb_pull(skb, sizeof(*p)); | 1379 | __skb_pull(skb, sizeof(*p)); |
1381 | 1380 | ||
1382 | st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); | 1381 | st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); |
1383 | st->rx_packets++; | ||
1384 | 1382 | ||
1385 | skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); | 1383 | skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); |
1386 | skb->dev->last_rx = jiffies; | 1384 | skb->dev->last_rx = jiffies; |
@@ -1624,11 +1622,9 @@ int t1_poll(struct napi_struct *napi, int budget) | |||
1624 | { | 1622 | { |
1625 | struct adapter *adapter = container_of(napi, struct adapter, napi); | 1623 | struct adapter *adapter = container_of(napi, struct adapter, napi); |
1626 | struct net_device *dev = adapter->port[0].dev; | 1624 | struct net_device *dev = adapter->port[0].dev; |
1627 | int work_done; | 1625 | int work_done = process_responses(adapter, budget); |
1628 | |||
1629 | work_done = process_responses(adapter, budget); | ||
1630 | 1626 | ||
1631 | if (likely(!responses_pending(adapter))) { | 1627 | if (likely(work_done < budget)) { |
1632 | netif_rx_complete(dev, napi); | 1628 | netif_rx_complete(dev, napi); |
1633 | writel(adapter->sge->respQ.cidx, | 1629 | writel(adapter->sge->respQ.cidx, |
1634 | adapter->regs + A_SG_SLEEPING); | 1630 | adapter->regs + A_SG_SLEEPING); |
@@ -1848,7 +1844,8 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1848 | { | 1844 | { |
1849 | struct adapter *adapter = dev->priv; | 1845 | struct adapter *adapter = dev->priv; |
1850 | struct sge *sge = adapter->sge; | 1846 | struct sge *sge = adapter->sge; |
1851 | struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port], smp_processor_id()); | 1847 | struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port], |
1848 | smp_processor_id()); | ||
1852 | struct cpl_tx_pkt *cpl; | 1849 | struct cpl_tx_pkt *cpl; |
1853 | struct sk_buff *orig_skb = skb; | 1850 | struct sk_buff *orig_skb = skb; |
1854 | int ret; | 1851 | int ret; |
@@ -1856,6 +1853,18 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1856 | if (skb->protocol == htons(ETH_P_CPL5)) | 1853 | if (skb->protocol == htons(ETH_P_CPL5)) |
1857 | goto send; | 1854 | goto send; |
1858 | 1855 | ||
1856 | /* | ||
1857 | * We are using a non-standard hard_header_len. | ||
1858 | * Allocate more header room in the rare cases it is not big enough. | ||
1859 | */ | ||
1860 | if (unlikely(skb_headroom(skb) < dev->hard_header_len - ETH_HLEN)) { | ||
1861 | skb = skb_realloc_headroom(skb, sizeof(struct cpl_tx_pkt_lso)); | ||
1862 | ++st->tx_need_hdrroom; | ||
1863 | dev_kfree_skb_any(orig_skb); | ||
1864 | if (!skb) | ||
1865 | return NETDEV_TX_OK; | ||
1866 | } | ||
1867 | |||
1859 | if (skb_shinfo(skb)->gso_size) { | 1868 | if (skb_shinfo(skb)->gso_size) { |
1860 | int eth_type; | 1869 | int eth_type; |
1861 | struct cpl_tx_pkt_lso *hdr; | 1870 | struct cpl_tx_pkt_lso *hdr; |
@@ -1889,24 +1898,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1889 | return NETDEV_TX_OK; | 1898 | return NETDEV_TX_OK; |
1890 | } | 1899 | } |
1891 | 1900 | ||
1892 | /* | ||
1893 | * We are using a non-standard hard_header_len and some kernel | ||
1894 | * components, such as pktgen, do not handle it right. | ||
1895 | * Complain when this happens but try to fix things up. | ||
1896 | */ | ||
1897 | if (unlikely(skb_headroom(skb) < dev->hard_header_len - ETH_HLEN)) { | ||
1898 | pr_debug("%s: headroom %d header_len %d\n", dev->name, | ||
1899 | skb_headroom(skb), dev->hard_header_len); | ||
1900 | |||
1901 | if (net_ratelimit()) | ||
1902 | printk(KERN_ERR "%s: inadequate headroom in " | ||
1903 | "Tx packet\n", dev->name); | ||
1904 | skb = skb_realloc_headroom(skb, sizeof(*cpl)); | ||
1905 | dev_kfree_skb_any(orig_skb); | ||
1906 | if (!skb) | ||
1907 | return NETDEV_TX_OK; | ||
1908 | } | ||
1909 | |||
1910 | if (!(adapter->flags & UDP_CSUM_CAPABLE) && | 1901 | if (!(adapter->flags & UDP_CSUM_CAPABLE) && |
1911 | skb->ip_summed == CHECKSUM_PARTIAL && | 1902 | skb->ip_summed == CHECKSUM_PARTIAL && |
1912 | ip_hdr(skb)->protocol == IPPROTO_UDP) { | 1903 | ip_hdr(skb)->protocol == IPPROTO_UDP) { |
@@ -1952,7 +1943,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1952 | cpl->vlan_valid = 0; | 1943 | cpl->vlan_valid = 0; |
1953 | 1944 | ||
1954 | send: | 1945 | send: |
1955 | st->tx_packets++; | ||
1956 | dev->trans_start = jiffies; | 1946 | dev->trans_start = jiffies; |
1957 | ret = t1_sge_tx(skb, adapter, 0, dev); | 1947 | ret = t1_sge_tx(skb, adapter, 0, dev); |
1958 | 1948 | ||
diff --git a/drivers/net/chelsio/sge.h b/drivers/net/chelsio/sge.h index 713d9c55f24d..cced9dff91c5 100644 --- a/drivers/net/chelsio/sge.h +++ b/drivers/net/chelsio/sge.h | |||
@@ -57,13 +57,12 @@ struct sge_intr_counts { | |||
57 | }; | 57 | }; |
58 | 58 | ||
59 | struct sge_port_stats { | 59 | struct sge_port_stats { |
60 | u64 rx_packets; /* # of Ethernet packets received */ | ||
61 | u64 rx_cso_good; /* # of successful RX csum offloads */ | 60 | u64 rx_cso_good; /* # of successful RX csum offloads */ |
62 | u64 tx_packets; /* # of TX packets */ | ||
63 | u64 tx_cso; /* # of TX checksum offloads */ | 61 | u64 tx_cso; /* # of TX checksum offloads */ |
64 | u64 tx_tso; /* # of TSO requests */ | 62 | u64 tx_tso; /* # of TSO requests */ |
65 | u64 vlan_xtract; /* # of VLAN tag extractions */ | 63 | u64 vlan_xtract; /* # of VLAN tag extractions */ |
66 | u64 vlan_insert; /* # of VLAN tag insertions */ | 64 | u64 vlan_insert; /* # of VLAN tag insertions */ |
65 | u64 tx_need_hdrroom; /* # of TX skbs in need of more header room */ | ||
67 | }; | 66 | }; |
68 | 67 | ||
69 | struct sk_buff; | 68 | struct sk_buff; |
diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h index 5e1bc0dec5f1..6e12bf4bc6cf 100644 --- a/drivers/net/cxgb3/regs.h +++ b/drivers/net/cxgb3/regs.h | |||
@@ -1937,6 +1937,10 @@ | |||
1937 | 1937 | ||
1938 | #define A_XGM_RXFIFO_CFG 0x884 | 1938 | #define A_XGM_RXFIFO_CFG 0x884 |
1939 | 1939 | ||
1940 | #define S_RXFIFO_EMPTY 31 | ||
1941 | #define V_RXFIFO_EMPTY(x) ((x) << S_RXFIFO_EMPTY) | ||
1942 | #define F_RXFIFO_EMPTY V_RXFIFO_EMPTY(1U) | ||
1943 | |||
1940 | #define S_RXFIFOPAUSEHWM 17 | 1944 | #define S_RXFIFOPAUSEHWM 17 |
1941 | #define M_RXFIFOPAUSEHWM 0xfff | 1945 | #define M_RXFIFOPAUSEHWM 0xfff |
1942 | 1946 | ||
@@ -1961,6 +1965,10 @@ | |||
1961 | 1965 | ||
1962 | #define A_XGM_TXFIFO_CFG 0x888 | 1966 | #define A_XGM_TXFIFO_CFG 0x888 |
1963 | 1967 | ||
1968 | #define S_UNDERUNFIX 22 | ||
1969 | #define V_UNDERUNFIX(x) ((x) << S_UNDERUNFIX) | ||
1970 | #define F_UNDERUNFIX V_UNDERUNFIX(1U) | ||
1971 | |||
1964 | #define S_TXIPG 13 | 1972 | #define S_TXIPG 13 |
1965 | #define M_TXIPG 0xff | 1973 | #define M_TXIPG 0xff |
1966 | #define V_TXIPG(x) ((x) << S_TXIPG) | 1974 | #define V_TXIPG(x) ((x) << S_TXIPG) |
@@ -2034,10 +2042,27 @@ | |||
2034 | #define V_XAUIIMP(x) ((x) << S_XAUIIMP) | 2042 | #define V_XAUIIMP(x) ((x) << S_XAUIIMP) |
2035 | 2043 | ||
2036 | #define A_XGM_RX_MAX_PKT_SIZE 0x8a8 | 2044 | #define A_XGM_RX_MAX_PKT_SIZE 0x8a8 |
2037 | #define A_XGM_RX_MAX_PKT_SIZE_ERR_CNT 0x9a4 | 2045 | |
2046 | #define S_RXMAXFRAMERSIZE 17 | ||
2047 | #define M_RXMAXFRAMERSIZE 0x3fff | ||
2048 | #define V_RXMAXFRAMERSIZE(x) ((x) << S_RXMAXFRAMERSIZE) | ||
2049 | #define G_RXMAXFRAMERSIZE(x) (((x) >> S_RXMAXFRAMERSIZE) & M_RXMAXFRAMERSIZE) | ||
2050 | |||
2051 | #define S_RXENFRAMER 14 | ||
2052 | #define V_RXENFRAMER(x) ((x) << S_RXENFRAMER) | ||
2053 | #define F_RXENFRAMER V_RXENFRAMER(1U) | ||
2054 | |||
2055 | #define S_RXMAXPKTSIZE 0 | ||
2056 | #define M_RXMAXPKTSIZE 0x3fff | ||
2057 | #define V_RXMAXPKTSIZE(x) ((x) << S_RXMAXPKTSIZE) | ||
2058 | #define G_RXMAXPKTSIZE(x) (((x) >> S_RXMAXPKTSIZE) & M_RXMAXPKTSIZE) | ||
2038 | 2059 | ||
2039 | #define A_XGM_RESET_CTRL 0x8ac | 2060 | #define A_XGM_RESET_CTRL 0x8ac |
2040 | 2061 | ||
2062 | #define S_XGMAC_STOP_EN 4 | ||
2063 | #define V_XGMAC_STOP_EN(x) ((x) << S_XGMAC_STOP_EN) | ||
2064 | #define F_XGMAC_STOP_EN V_XGMAC_STOP_EN(1U) | ||
2065 | |||
2041 | #define S_XG2G_RESET_ 3 | 2066 | #define S_XG2G_RESET_ 3 |
2042 | #define V_XG2G_RESET_(x) ((x) << S_XG2G_RESET_) | 2067 | #define V_XG2G_RESET_(x) ((x) << S_XG2G_RESET_) |
2043 | #define F_XG2G_RESET_ V_XG2G_RESET_(1U) | 2068 | #define F_XG2G_RESET_ V_XG2G_RESET_(1U) |
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index d4ee00d32219..522834c42ae7 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -447,8 +447,8 @@ static const struct adapter_info t3_adap_info[] = { | |||
447 | &mi1_mdio_ops, "Chelsio T302"}, | 447 | &mi1_mdio_ops, "Chelsio T302"}, |
448 | {1, 0, 0, 0, | 448 | {1, 0, 0, 0, |
449 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | | 449 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | |
450 | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, | 450 | F_GPIO11_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, |
451 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI, | 451 | 0, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, |
452 | &mi1_mdio_ext_ops, "Chelsio T310"}, | 452 | &mi1_mdio_ext_ops, "Chelsio T310"}, |
453 | {2, 0, 0, 0, | 453 | {2, 0, 0, 0, |
454 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | | 454 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | |
@@ -2613,7 +2613,7 @@ static void __devinit init_mtus(unsigned short mtus[]) | |||
2613 | * it can accomodate max size TCP/IP headers when SACK and timestamps | 2613 | * it can accomodate max size TCP/IP headers when SACK and timestamps |
2614 | * are enabled and still have at least 8 bytes of payload. | 2614 | * are enabled and still have at least 8 bytes of payload. |
2615 | */ | 2615 | */ |
2616 | mtus[1] = 88; | 2616 | mtus[0] = 88; |
2617 | mtus[1] = 88; | 2617 | mtus[1] = 88; |
2618 | mtus[2] = 256; | 2618 | mtus[2] = 256; |
2619 | mtus[3] = 512; | 2619 | mtus[3] = 512; |
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c index eeb766aeced9..efcf09a709cf 100644 --- a/drivers/net/cxgb3/xgmac.c +++ b/drivers/net/cxgb3/xgmac.c | |||
@@ -106,6 +106,7 @@ int t3_mac_reset(struct cmac *mac) | |||
106 | t3_set_reg_field(adap, A_XGM_RXFIFO_CFG + oft, | 106 | t3_set_reg_field(adap, A_XGM_RXFIFO_CFG + oft, |
107 | F_RXSTRFRWRD | F_DISERRFRAMES, | 107 | F_RXSTRFRWRD | F_DISERRFRAMES, |
108 | uses_xaui(adap) ? 0 : F_RXSTRFRWRD); | 108 | uses_xaui(adap) ? 0 : F_RXSTRFRWRD); |
109 | t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + oft, 0, F_UNDERUNFIX); | ||
109 | 110 | ||
110 | if (uses_xaui(adap)) { | 111 | if (uses_xaui(adap)) { |
111 | if (adap->params.rev == 0) { | 112 | if (adap->params.rev == 0) { |
@@ -124,7 +125,11 @@ int t3_mac_reset(struct cmac *mac) | |||
124 | xaui_serdes_reset(mac); | 125 | xaui_serdes_reset(mac); |
125 | } | 126 | } |
126 | 127 | ||
127 | val = F_MAC_RESET_; | 128 | t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + oft, |
129 | V_RXMAXFRAMERSIZE(M_RXMAXFRAMERSIZE), | ||
130 | V_RXMAXFRAMERSIZE(MAX_FRAME_SIZE) | F_RXENFRAMER); | ||
131 | val = F_MAC_RESET_ | F_XGMAC_STOP_EN; | ||
132 | |||
128 | if (is_10G(adap)) | 133 | if (is_10G(adap)) |
129 | val |= F_PCS_RESET_; | 134 | val |= F_PCS_RESET_; |
130 | else if (uses_xaui(adap)) | 135 | else if (uses_xaui(adap)) |
@@ -313,8 +318,9 @@ static int rx_fifo_hwm(int mtu) | |||
313 | 318 | ||
314 | int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) | 319 | int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) |
315 | { | 320 | { |
316 | int hwm, lwm; | 321 | int hwm, lwm, divisor; |
317 | unsigned int thres, v; | 322 | int ipg; |
323 | unsigned int thres, v, reg; | ||
318 | struct adapter *adap = mac->adapter; | 324 | struct adapter *adap = mac->adapter; |
319 | 325 | ||
320 | /* | 326 | /* |
@@ -335,27 +341,32 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) | |||
335 | hwm = min(hwm, MAC_RXFIFO_SIZE - 8192); | 341 | hwm = min(hwm, MAC_RXFIFO_SIZE - 8192); |
336 | lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4); | 342 | lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4); |
337 | 343 | ||
338 | if (adap->params.rev == T3_REV_B2 && | 344 | if (adap->params.rev >= T3_REV_B2 && |
339 | (t3_read_reg(adap, A_XGM_RX_CTRL + mac->offset) & F_RXEN)) { | 345 | (t3_read_reg(adap, A_XGM_RX_CTRL + mac->offset) & F_RXEN)) { |
340 | disable_exact_filters(mac); | 346 | disable_exact_filters(mac); |
341 | v = t3_read_reg(adap, A_XGM_RX_CFG + mac->offset); | 347 | v = t3_read_reg(adap, A_XGM_RX_CFG + mac->offset); |
342 | t3_set_reg_field(adap, A_XGM_RX_CFG + mac->offset, | 348 | t3_set_reg_field(adap, A_XGM_RX_CFG + mac->offset, |
343 | F_ENHASHMCAST | F_COPYALLFRAMES, F_DISBCAST); | 349 | F_ENHASHMCAST | F_COPYALLFRAMES, F_DISBCAST); |
344 | 350 | ||
345 | /* drain rx FIFO */ | 351 | reg = adap->params.rev == T3_REV_B2 ? |
346 | if (t3_wait_op_done(adap, | 352 | A_XGM_RX_MAX_PKT_SIZE_ERR_CNT : A_XGM_RXFIFO_CFG; |
347 | A_XGM_RX_MAX_PKT_SIZE_ERR_CNT + | 353 | |
348 | mac->offset, | 354 | /* drain RX FIFO */ |
349 | 1 << 31, 1, 20, 5)) { | 355 | if (t3_wait_op_done(adap, reg + mac->offset, |
356 | F_RXFIFO_EMPTY, 1, 20, 5)) { | ||
350 | t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); | 357 | t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); |
351 | enable_exact_filters(mac); | 358 | enable_exact_filters(mac); |
352 | return -EIO; | 359 | return -EIO; |
353 | } | 360 | } |
354 | t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, mtu); | 361 | t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, |
362 | V_RXMAXPKTSIZE(M_RXMAXPKTSIZE), | ||
363 | V_RXMAXPKTSIZE(mtu)); | ||
355 | t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); | 364 | t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); |
356 | enable_exact_filters(mac); | 365 | enable_exact_filters(mac); |
357 | } else | 366 | } else |
358 | t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, mtu); | 367 | t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, |
368 | V_RXMAXPKTSIZE(M_RXMAXPKTSIZE), | ||
369 | V_RXMAXPKTSIZE(mtu)); | ||
359 | 370 | ||
360 | /* | 371 | /* |
361 | * Adjust the PAUSE frame watermarks. We always set the LWM, and the | 372 | * Adjust the PAUSE frame watermarks. We always set the LWM, and the |
@@ -379,13 +390,16 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) | |||
379 | thres /= 10; | 390 | thres /= 10; |
380 | thres = mtu > thres ? (mtu - thres + 7) / 8 : 0; | 391 | thres = mtu > thres ? (mtu - thres + 7) / 8 : 0; |
381 | thres = max(thres, 8U); /* need at least 8 */ | 392 | thres = max(thres, 8U); /* need at least 8 */ |
393 | ipg = (adap->params.rev == T3_REV_C) ? 0 : 1; | ||
382 | t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, | 394 | t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, |
383 | V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG), | 395 | V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG), |
384 | V_TXFIFOTHRESH(thres) | V_TXIPG(1)); | 396 | V_TXFIFOTHRESH(thres) | V_TXIPG(ipg)); |
385 | 397 | ||
386 | if (adap->params.rev > 0) | 398 | if (adap->params.rev > 0) { |
399 | divisor = (adap->params.rev == T3_REV_C) ? 64 : 8; | ||
387 | t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset, | 400 | t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset, |
388 | (hwm - lwm) * 4 / 8); | 401 | (hwm - lwm) * 4 / divisor); |
402 | } | ||
389 | t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset, | 403 | t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset, |
390 | MAC_RXFIFO_SIZE * 4 * 8 / 512); | 404 | MAC_RXFIFO_SIZE * 4 * 8 / 512); |
391 | return 0; | 405 | return 0; |
@@ -522,7 +536,7 @@ int t3b2_mac_watchdog_task(struct cmac *mac) | |||
522 | goto rxcheck; | 536 | goto rxcheck; |
523 | } | 537 | } |
524 | 538 | ||
525 | if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0)) { | 539 | if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0)) { |
526 | if (mac->toggle_cnt > 4) { | 540 | if (mac->toggle_cnt > 4) { |
527 | status = 2; | 541 | status = 2; |
528 | goto out; | 542 | goto out; |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 3dbaec680b46..e1c8a0d023ea 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -2214,13 +2214,11 @@ static void e100_get_drvinfo(struct net_device *netdev, | |||
2214 | strcpy(info->bus_info, pci_name(nic->pdev)); | 2214 | strcpy(info->bus_info, pci_name(nic->pdev)); |
2215 | } | 2215 | } |
2216 | 2216 | ||
2217 | #define E100_PHY_REGS 0x1C | ||
2217 | static int e100_get_regs_len(struct net_device *netdev) | 2218 | static int e100_get_regs_len(struct net_device *netdev) |
2218 | { | 2219 | { |
2219 | struct nic *nic = netdev_priv(netdev); | 2220 | struct nic *nic = netdev_priv(netdev); |
2220 | #define E100_PHY_REGS 0x1C | 2221 | return 1 + E100_PHY_REGS + sizeof(nic->mem->dump_buf); |
2221 | #define E100_REGS_LEN 1 + E100_PHY_REGS + \ | ||
2222 | sizeof(nic->mem->dump_buf) / sizeof(u32) | ||
2223 | return E100_REGS_LEN * sizeof(u32); | ||
2224 | } | 2222 | } |
2225 | 2223 | ||
2226 | static void e100_get_regs(struct net_device *netdev, | 2224 | static void e100_get_regs(struct net_device *netdev, |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 667f18bcc172..b83ccce8a9b7 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -1923,7 +1923,7 @@ e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) | |||
1923 | switch (stringset) { | 1923 | switch (stringset) { |
1924 | case ETH_SS_TEST: | 1924 | case ETH_SS_TEST: |
1925 | memcpy(data, *e1000_gstrings_test, | 1925 | memcpy(data, *e1000_gstrings_test, |
1926 | E1000_TEST_LEN*ETH_GSTRING_LEN); | 1926 | sizeof(e1000_gstrings_test)); |
1927 | break; | 1927 | break; |
1928 | case ETH_SS_STATS: | 1928 | case ETH_SS_STATS: |
1929 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { | 1929 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index cf39473ef90a..4f37506ad374 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -3942,7 +3942,7 @@ e1000_clean(struct napi_struct *napi, int budget) | |||
3942 | &work_done, budget); | 3942 | &work_done, budget); |
3943 | 3943 | ||
3944 | /* If no Tx and not enough Rx work done, exit the polling mode */ | 3944 | /* If no Tx and not enough Rx work done, exit the polling mode */ |
3945 | if ((!tx_cleaned && (work_done < budget)) || | 3945 | if ((!tx_cleaned && (work_done == 0)) || |
3946 | !netif_running(poll_dev)) { | 3946 | !netif_running(poll_dev)) { |
3947 | quit_polling: | 3947 | quit_polling: |
3948 | if (likely(adapter->itr_setting & 3)) | 3948 | if (likely(adapter->itr_setting & 3)) |
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 6a39784e7ee2..87f9da1b6b4e 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -1739,7 +1739,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset, | |||
1739 | switch (stringset) { | 1739 | switch (stringset) { |
1740 | case ETH_SS_TEST: | 1740 | case ETH_SS_TEST: |
1741 | memcpy(data, *e1000_gstrings_test, | 1741 | memcpy(data, *e1000_gstrings_test, |
1742 | E1000_TEST_LEN*ETH_GSTRING_LEN); | 1742 | sizeof(e1000_gstrings_test)); |
1743 | break; | 1743 | break; |
1744 | case ETH_SS_STATS: | 1744 | case ETH_SS_STATS: |
1745 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { | 1745 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index f78e5bf7cb33..5f82a4647eee 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | 41 | ||
42 | #define DRV_NAME "ehea" | 42 | #define DRV_NAME "ehea" |
43 | #define DRV_VERSION "EHEA_0080" | 43 | #define DRV_VERSION "EHEA_0083" |
44 | 44 | ||
45 | /* eHEA capability flags */ | 45 | /* eHEA capability flags */ |
46 | #define DLPAR_PORT_ADD_REM 1 | 46 | #define DLPAR_PORT_ADD_REM 1 |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index f0319f1e8e05..869e1604b16e 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -136,7 +136,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev) | |||
136 | struct ehea_port *port = netdev_priv(dev); | 136 | struct ehea_port *port = netdev_priv(dev); |
137 | struct net_device_stats *stats = &port->stats; | 137 | struct net_device_stats *stats = &port->stats; |
138 | struct hcp_ehea_port_cb2 *cb2; | 138 | struct hcp_ehea_port_cb2 *cb2; |
139 | u64 hret, rx_packets; | 139 | u64 hret, rx_packets, tx_packets; |
140 | int i; | 140 | int i; |
141 | 141 | ||
142 | memset(stats, 0, sizeof(*stats)); | 142 | memset(stats, 0, sizeof(*stats)); |
@@ -162,7 +162,11 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev) | |||
162 | for (i = 0; i < port->num_def_qps; i++) | 162 | for (i = 0; i < port->num_def_qps; i++) |
163 | rx_packets += port->port_res[i].rx_packets; | 163 | rx_packets += port->port_res[i].rx_packets; |
164 | 164 | ||
165 | stats->tx_packets = cb2->txucp + cb2->txmcp + cb2->txbcp; | 165 | tx_packets = 0; |
166 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) | ||
167 | tx_packets += port->port_res[i].tx_packets; | ||
168 | |||
169 | stats->tx_packets = tx_packets; | ||
166 | stats->multicast = cb2->rxmcp; | 170 | stats->multicast = cb2->rxmcp; |
167 | stats->rx_errors = cb2->rxuerr; | 171 | stats->rx_errors = cb2->rxuerr; |
168 | stats->rx_bytes = cb2->rxo; | 172 | stats->rx_bytes = cb2->rxo; |
@@ -406,11 +410,6 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq, | |||
406 | if (cqe->status & EHEA_CQE_STAT_ERR_CRC) | 410 | if (cqe->status & EHEA_CQE_STAT_ERR_CRC) |
407 | pr->p_stats.err_frame_crc++; | 411 | pr->p_stats.err_frame_crc++; |
408 | 412 | ||
409 | if (netif_msg_rx_err(pr->port)) { | ||
410 | ehea_error("CQE Error for QP %d", pr->qp->init_attr.qp_nr); | ||
411 | ehea_dump(cqe, sizeof(*cqe), "CQE"); | ||
412 | } | ||
413 | |||
414 | if (rq == 2) { | 413 | if (rq == 2) { |
415 | *processed_rq2 += 1; | 414 | *processed_rq2 += 1; |
416 | skb = get_skb_by_index(pr->rq2_skba.arr, pr->rq2_skba.len, cqe); | 415 | skb = get_skb_by_index(pr->rq2_skba.arr, pr->rq2_skba.len, cqe); |
@@ -422,7 +421,11 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq, | |||
422 | } | 421 | } |
423 | 422 | ||
424 | if (cqe->status & EHEA_CQE_STAT_FAT_ERR_MASK) { | 423 | if (cqe->status & EHEA_CQE_STAT_FAT_ERR_MASK) { |
425 | ehea_error("Critical receive error. Resetting port."); | 424 | if (netif_msg_rx_err(pr->port)) { |
425 | ehea_error("Critical receive error for QP %d. " | ||
426 | "Resetting port.", pr->qp->init_attr.qp_nr); | ||
427 | ehea_dump(cqe, sizeof(*cqe), "CQE"); | ||
428 | } | ||
426 | schedule_work(&pr->port->reset_task); | 429 | schedule_work(&pr->port->reset_task); |
427 | return 1; | 430 | return 1; |
428 | } | 431 | } |
@@ -2000,6 +2003,7 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2000 | } | 2003 | } |
2001 | 2004 | ||
2002 | ehea_post_swqe(pr->qp, swqe); | 2005 | ehea_post_swqe(pr->qp, swqe); |
2006 | pr->tx_packets++; | ||
2003 | 2007 | ||
2004 | if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) { | 2008 | if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) { |
2005 | spin_lock_irqsave(&pr->netif_queue, flags); | 2009 | spin_lock_irqsave(&pr->netif_queue, flags); |
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h index 562de0ebdd85..bc62d389c166 100644 --- a/drivers/net/ehea/ehea_qmr.h +++ b/drivers/net/ehea/ehea_qmr.h | |||
@@ -145,8 +145,8 @@ struct ehea_rwqe { | |||
145 | #define EHEA_CQE_VLAN_TAG_XTRACT 0x0400 | 145 | #define EHEA_CQE_VLAN_TAG_XTRACT 0x0400 |
146 | 146 | ||
147 | #define EHEA_CQE_TYPE_RQ 0x60 | 147 | #define EHEA_CQE_TYPE_RQ 0x60 |
148 | #define EHEA_CQE_STAT_ERR_MASK 0x720F | 148 | #define EHEA_CQE_STAT_ERR_MASK 0x700F |
149 | #define EHEA_CQE_STAT_FAT_ERR_MASK 0x1F | 149 | #define EHEA_CQE_STAT_FAT_ERR_MASK 0xF |
150 | #define EHEA_CQE_STAT_ERR_TCP 0x4000 | 150 | #define EHEA_CQE_STAT_ERR_TCP 0x4000 |
151 | #define EHEA_CQE_STAT_ERR_IP 0x2000 | 151 | #define EHEA_CQE_STAT_ERR_IP 0x2000 |
152 | #define EHEA_CQE_STAT_ERR_CRC 0x1000 | 152 | #define EHEA_CQE_STAT_ERR_CRC 0x1000 |
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index a8a0ee220da6..79f7eade4773 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c | |||
@@ -422,7 +422,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) | |||
422 | 422 | ||
423 | rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status, | 423 | rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status, |
424 | (struct bcom_bd **)&bd); | 424 | (struct bcom_bd **)&bd); |
425 | dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_FROM_DEVICE); | 425 | dma_unmap_single(&dev->dev, bd->skb_pa, rskb->len, DMA_FROM_DEVICE); |
426 | 426 | ||
427 | /* Test for errors in received frame */ | 427 | /* Test for errors in received frame */ |
428 | if (status & BCOM_FEC_RX_BD_ERRORS) { | 428 | if (status & BCOM_FEC_RX_BD_ERRORS) { |
@@ -467,7 +467,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) | |||
467 | bcom_prepare_next_buffer(priv->rx_dmatsk); | 467 | bcom_prepare_next_buffer(priv->rx_dmatsk); |
468 | 468 | ||
469 | bd->status = FEC_RX_BUFFER_SIZE; | 469 | bd->status = FEC_RX_BUFFER_SIZE; |
470 | bd->skb_pa = dma_map_single(&dev->dev, rskb->data, | 470 | bd->skb_pa = dma_map_single(&dev->dev, skb->data, |
471 | FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); | 471 | FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); |
472 | 472 | ||
473 | bcom_submit_next_buffer(priv->rx_dmatsk, skb); | 473 | bcom_submit_next_buffer(priv->rx_dmatsk, skb); |
@@ -971,6 +971,8 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) | |||
971 | 971 | ||
972 | mpc52xx_fec_reset_stats(ndev); | 972 | mpc52xx_fec_reset_stats(ndev); |
973 | 973 | ||
974 | SET_NETDEV_DEV(ndev, &op->dev); | ||
975 | |||
974 | /* Register the new network device */ | 976 | /* Register the new network device */ |
975 | rv = register_netdev(ndev); | 977 | rv = register_netdev(ndev); |
976 | if (rv < 0) | 978 | if (rv < 0) |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 92ce2e38f0d5..a96583cceb5e 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -5286,19 +5286,15 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
5286 | if (readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_PHY_INIT) { | 5286 | if (readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_PHY_INIT) { |
5287 | np->mac_in_use = readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_MGMT_ST; | 5287 | np->mac_in_use = readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_MGMT_ST; |
5288 | dprintk(KERN_INFO "%s: mgmt unit is running. mac in use %x.\n", pci_name(pci_dev), np->mac_in_use); | 5288 | dprintk(KERN_INFO "%s: mgmt unit is running. mac in use %x.\n", pci_name(pci_dev), np->mac_in_use); |
5289 | for (i = 0; i < 5000; i++) { | 5289 | if (nv_mgmt_acquire_sema(dev)) { |
5290 | msleep(1); | 5290 | /* management unit setup the phy already? */ |
5291 | if (nv_mgmt_acquire_sema(dev)) { | 5291 | if ((readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_MASK) == |
5292 | /* management unit setup the phy already? */ | 5292 | NVREG_XMITCTL_SYNC_PHY_INIT) { |
5293 | if ((readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_MASK) == | 5293 | /* phy is inited by mgmt unit */ |
5294 | NVREG_XMITCTL_SYNC_PHY_INIT) { | 5294 | phyinitialized = 1; |
5295 | /* phy is inited by mgmt unit */ | 5295 | dprintk(KERN_INFO "%s: Phy already initialized by mgmt unit.\n", pci_name(pci_dev)); |
5296 | phyinitialized = 1; | 5296 | } else { |
5297 | dprintk(KERN_INFO "%s: Phy already initialized by mgmt unit.\n", pci_name(pci_dev)); | 5297 | /* we need to init the phy */ |
5298 | } else { | ||
5299 | /* we need to init the phy */ | ||
5300 | } | ||
5301 | break; | ||
5302 | } | 5298 | } |
5303 | } | 5299 | } |
5304 | } | 5300 | } |
@@ -5613,6 +5609,22 @@ static struct pci_device_id pci_tbl[] = { | |||
5613 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), | 5609 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), |
5614 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5610 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, |
5615 | }, | 5611 | }, |
5612 | { /* MCP79 Ethernet Controller */ | ||
5613 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), | ||
5614 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5615 | }, | ||
5616 | { /* MCP79 Ethernet Controller */ | ||
5617 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), | ||
5618 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5619 | }, | ||
5620 | { /* MCP79 Ethernet Controller */ | ||
5621 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), | ||
5622 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5623 | }, | ||
5624 | { /* MCP79 Ethernet Controller */ | ||
5625 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), | ||
5626 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | ||
5627 | }, | ||
5616 | {0,}, | 5628 | {0,}, |
5617 | }; | 5629 | }; |
5618 | 5630 | ||
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index 03134f47a4eb..48f2f3005935 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c | |||
@@ -158,7 +158,7 @@ static int setup_data(struct net_device *dev) | |||
158 | { | 158 | { |
159 | struct fs_enet_private *fep = netdev_priv(dev); | 159 | struct fs_enet_private *fep = netdev_priv(dev); |
160 | 160 | ||
161 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | 161 | #ifndef CONFIG_PPC_CPM_NEW_BINDING |
162 | struct fs_platform_info *fpi = fep->fpi; | 162 | struct fs_platform_info *fpi = fep->fpi; |
163 | 163 | ||
164 | fep->scc.idx = fs_get_scc_index(fpi->fs_no); | 164 | fep->scc.idx = fs_get_scc_index(fpi->fs_no); |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 38268d7335a8..0431e9ed0fac 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -696,7 +696,7 @@ int startup_gfar(struct net_device *dev) | |||
696 | { | 696 | { |
697 | struct txbd8 *txbdp; | 697 | struct txbd8 *txbdp; |
698 | struct rxbd8 *rxbdp; | 698 | struct rxbd8 *rxbdp; |
699 | dma_addr_t addr; | 699 | dma_addr_t addr = 0; |
700 | unsigned long vaddr; | 700 | unsigned long vaddr; |
701 | int i; | 701 | int i; |
702 | struct gfar_private *priv = netdev_priv(dev); | 702 | struct gfar_private *priv = netdev_priv(dev); |
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index 0de3aa2a2e44..cb06280dced5 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
@@ -402,7 +407,7 @@ static u32 __emac_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_s | |||
402 | static u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_size) | 407 | static u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_size) |
403 | { | 408 | { |
404 | u32 ret = EMAC_MR1_VLE | EMAC_MR1_IST | EMAC4_MR1_TR | | 409 | u32 ret = EMAC_MR1_VLE | EMAC_MR1_IST | EMAC4_MR1_TR | |
405 | EMAC4_MR1_OBCI(dev->opb_bus_freq); | 410 | EMAC4_MR1_OBCI(dev->opb_bus_freq / 1000000); |
406 | 411 | ||
407 | DBG2(dev, "__emac4_calc_base_mr1" NL); | 412 | DBG2(dev, "__emac4_calc_base_mr1" NL); |
408 | 413 | ||
@@ -464,26 +469,34 @@ static int emac_configure(struct emac_instance *dev) | |||
464 | { | 469 | { |
465 | struct emac_regs __iomem *p = dev->emacp; | 470 | struct emac_regs __iomem *p = dev->emacp; |
466 | struct net_device *ndev = dev->ndev; | 471 | struct net_device *ndev = dev->ndev; |
467 | int tx_size, rx_size; | 472 | int tx_size, rx_size, link = netif_carrier_ok(dev->ndev); |
468 | u32 r, mr1 = 0; | 473 | u32 r, mr1 = 0; |
469 | 474 | ||
470 | DBG(dev, "configure" NL); | 475 | DBG(dev, "configure" NL); |
471 | 476 | ||
472 | if (emac_reset(dev) < 0) | 477 | if (!link) { |
478 | out_be32(&p->mr1, in_be32(&p->mr1) | ||
479 | | EMAC_MR1_FDE | EMAC_MR1_ILE); | ||
480 | udelay(100); | ||
481 | } else if (emac_reset(dev) < 0) | ||
473 | return -ETIMEDOUT; | 482 | return -ETIMEDOUT; |
474 | 483 | ||
475 | if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) | 484 | if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) |
476 | tah_reset(dev->tah_dev); | 485 | tah_reset(dev->tah_dev); |
477 | 486 | ||
478 | DBG(dev, " duplex = %d, pause = %d, asym_pause = %d\n", | 487 | DBG(dev, " link = %d duplex = %d, pause = %d, asym_pause = %d\n", |
479 | dev->phy.duplex, dev->phy.pause, dev->phy.asym_pause); | 488 | link, dev->phy.duplex, dev->phy.pause, dev->phy.asym_pause); |
480 | 489 | ||
481 | /* Default fifo sizes */ | 490 | /* Default fifo sizes */ |
482 | tx_size = dev->tx_fifo_size; | 491 | tx_size = dev->tx_fifo_size; |
483 | rx_size = dev->rx_fifo_size; | 492 | rx_size = dev->rx_fifo_size; |
484 | 493 | ||
494 | /* No link, force loopback */ | ||
495 | if (!link) | ||
496 | mr1 = EMAC_MR1_FDE | EMAC_MR1_ILE; | ||
497 | |||
485 | /* Check for full duplex */ | 498 | /* Check for full duplex */ |
486 | if (dev->phy.duplex == DUPLEX_FULL) | 499 | else if (dev->phy.duplex == DUPLEX_FULL) |
487 | mr1 |= EMAC_MR1_FDE | EMAC_MR1_MWSW_001; | 500 | mr1 |= EMAC_MR1_FDE | EMAC_MR1_MWSW_001; |
488 | 501 | ||
489 | /* Adjust fifo sizes, mr1 and timeouts based on link speed */ | 502 | /* Adjust fifo sizes, mr1 and timeouts based on link speed */ |
@@ -642,9 +655,11 @@ static void emac_reset_work(struct work_struct *work) | |||
642 | DBG(dev, "reset_work" NL); | 655 | DBG(dev, "reset_work" NL); |
643 | 656 | ||
644 | mutex_lock(&dev->link_lock); | 657 | mutex_lock(&dev->link_lock); |
645 | emac_netif_stop(dev); | 658 | if (dev->opened) { |
646 | emac_full_tx_reset(dev); | 659 | emac_netif_stop(dev); |
647 | emac_netif_start(dev); | 660 | emac_full_tx_reset(dev); |
661 | emac_netif_start(dev); | ||
662 | } | ||
648 | mutex_unlock(&dev->link_lock); | 663 | mutex_unlock(&dev->link_lock); |
649 | } | 664 | } |
650 | 665 | ||
@@ -701,7 +716,7 @@ static int __emac_mdio_read(struct emac_instance *dev, u8 id, u8 reg) | |||
701 | r = EMAC_STACR_BASE(dev->opb_bus_freq); | 716 | r = EMAC_STACR_BASE(dev->opb_bus_freq); |
702 | if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) | 717 | if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) |
703 | r |= EMAC_STACR_OC; | 718 | r |= EMAC_STACR_OC; |
704 | if (emac_has_feature(dev, EMAC_FTR_HAS_AXON_STACR)) | 719 | if (emac_has_feature(dev, EMAC_FTR_HAS_NEW_STACR)) |
705 | r |= EMACX_STACR_STAC_READ; | 720 | r |= EMACX_STACR_STAC_READ; |
706 | else | 721 | else |
707 | r |= EMAC_STACR_STAC_READ; | 722 | r |= EMAC_STACR_STAC_READ; |
@@ -773,7 +788,7 @@ static void __emac_mdio_write(struct emac_instance *dev, u8 id, u8 reg, | |||
773 | r = EMAC_STACR_BASE(dev->opb_bus_freq); | 788 | r = EMAC_STACR_BASE(dev->opb_bus_freq); |
774 | if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) | 789 | if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT)) |
775 | r |= EMAC_STACR_OC; | 790 | r |= EMAC_STACR_OC; |
776 | if (emac_has_feature(dev, EMAC_FTR_HAS_AXON_STACR)) | 791 | if (emac_has_feature(dev, EMAC_FTR_HAS_NEW_STACR)) |
777 | r |= EMACX_STACR_STAC_WRITE; | 792 | r |= EMACX_STACR_STAC_WRITE; |
778 | else | 793 | else |
779 | r |= EMAC_STACR_STAC_WRITE; | 794 | r |= EMAC_STACR_STAC_WRITE; |
@@ -1063,10 +1078,9 @@ static int emac_open(struct net_device *ndev) | |||
1063 | dev->rx_sg_skb = NULL; | 1078 | dev->rx_sg_skb = NULL; |
1064 | 1079 | ||
1065 | mutex_lock(&dev->link_lock); | 1080 | mutex_lock(&dev->link_lock); |
1081 | dev->opened = 1; | ||
1066 | 1082 | ||
1067 | /* XXX Start PHY polling now. Shouldn't wr do like sungem instead and | 1083 | /* Start PHY polling now. |
1068 | * always poll the PHY even when the iface is down ? That would allow | ||
1069 | * things like laptop-net to work. --BenH | ||
1070 | */ | 1084 | */ |
1071 | if (dev->phy.address >= 0) { | 1085 | if (dev->phy.address >= 0) { |
1072 | int link_poll_interval; | 1086 | int link_poll_interval; |
@@ -1145,9 +1159,11 @@ static void emac_link_timer(struct work_struct *work) | |||
1145 | int link_poll_interval; | 1159 | int link_poll_interval; |
1146 | 1160 | ||
1147 | mutex_lock(&dev->link_lock); | 1161 | mutex_lock(&dev->link_lock); |
1148 | |||
1149 | DBG2(dev, "link timer" NL); | 1162 | DBG2(dev, "link timer" NL); |
1150 | 1163 | ||
1164 | if (!dev->opened) | ||
1165 | goto bail; | ||
1166 | |||
1151 | if (dev->phy.def->ops->poll_link(&dev->phy)) { | 1167 | if (dev->phy.def->ops->poll_link(&dev->phy)) { |
1152 | if (!netif_carrier_ok(dev->ndev)) { | 1168 | if (!netif_carrier_ok(dev->ndev)) { |
1153 | /* Get new link parameters */ | 1169 | /* Get new link parameters */ |
@@ -1162,21 +1178,22 @@ static void emac_link_timer(struct work_struct *work) | |||
1162 | link_poll_interval = PHY_POLL_LINK_ON; | 1178 | link_poll_interval = PHY_POLL_LINK_ON; |
1163 | } else { | 1179 | } else { |
1164 | if (netif_carrier_ok(dev->ndev)) { | 1180 | if (netif_carrier_ok(dev->ndev)) { |
1165 | emac_reinitialize(dev); | ||
1166 | netif_carrier_off(dev->ndev); | 1181 | netif_carrier_off(dev->ndev); |
1167 | netif_tx_disable(dev->ndev); | 1182 | netif_tx_disable(dev->ndev); |
1183 | emac_reinitialize(dev); | ||
1168 | emac_print_link_status(dev); | 1184 | emac_print_link_status(dev); |
1169 | } | 1185 | } |
1170 | link_poll_interval = PHY_POLL_LINK_OFF; | 1186 | link_poll_interval = PHY_POLL_LINK_OFF; |
1171 | } | 1187 | } |
1172 | schedule_delayed_work(&dev->link_work, link_poll_interval); | 1188 | schedule_delayed_work(&dev->link_work, link_poll_interval); |
1173 | 1189 | bail: | |
1174 | mutex_unlock(&dev->link_lock); | 1190 | mutex_unlock(&dev->link_lock); |
1175 | } | 1191 | } |
1176 | 1192 | ||
1177 | static void emac_force_link_update(struct emac_instance *dev) | 1193 | static void emac_force_link_update(struct emac_instance *dev) |
1178 | { | 1194 | { |
1179 | netif_carrier_off(dev->ndev); | 1195 | netif_carrier_off(dev->ndev); |
1196 | smp_rmb(); | ||
1180 | if (dev->link_polling) { | 1197 | if (dev->link_polling) { |
1181 | cancel_rearming_delayed_work(&dev->link_work); | 1198 | cancel_rearming_delayed_work(&dev->link_work); |
1182 | if (dev->link_polling) | 1199 | if (dev->link_polling) |
@@ -1191,11 +1208,14 @@ static int emac_close(struct net_device *ndev) | |||
1191 | 1208 | ||
1192 | DBG(dev, "close" NL); | 1209 | DBG(dev, "close" NL); |
1193 | 1210 | ||
1194 | if (dev->phy.address >= 0) | 1211 | if (dev->phy.address >= 0) { |
1212 | dev->link_polling = 0; | ||
1195 | cancel_rearming_delayed_work(&dev->link_work); | 1213 | cancel_rearming_delayed_work(&dev->link_work); |
1196 | 1214 | } | |
1215 | mutex_lock(&dev->link_lock); | ||
1197 | emac_netif_stop(dev); | 1216 | emac_netif_stop(dev); |
1198 | flush_scheduled_work(); | 1217 | dev->opened = 0; |
1218 | mutex_unlock(&dev->link_lock); | ||
1199 | 1219 | ||
1200 | emac_rx_disable(dev); | 1220 | emac_rx_disable(dev); |
1201 | emac_tx_disable(dev); | 1221 | emac_tx_disable(dev); |
@@ -2427,7 +2447,7 @@ static int __devinit emac_init_config(struct emac_instance *dev) | |||
2427 | if (emac_read_uint_prop(np, "tah-device", &dev->tah_ph, 0)) | 2447 | if (emac_read_uint_prop(np, "tah-device", &dev->tah_ph, 0)) |
2428 | dev->tah_ph = 0; | 2448 | dev->tah_ph = 0; |
2429 | if (emac_read_uint_prop(np, "tah-channel", &dev->tah_port, 0)) | 2449 | if (emac_read_uint_prop(np, "tah-channel", &dev->tah_port, 0)) |
2430 | dev->tah_ph = 0; | 2450 | dev->tah_port = 0; |
2431 | if (emac_read_uint_prop(np, "mdio-device", &dev->mdio_ph, 0)) | 2451 | if (emac_read_uint_prop(np, "mdio-device", &dev->mdio_ph, 0)) |
2432 | dev->mdio_ph = 0; | 2452 | dev->mdio_ph = 0; |
2433 | if (emac_read_uint_prop(np, "zmii-device", &dev->zmii_ph, 0)) | 2453 | if (emac_read_uint_prop(np, "zmii-device", &dev->zmii_ph, 0)) |
@@ -2465,16 +2485,19 @@ static int __devinit emac_init_config(struct emac_instance *dev) | |||
2465 | /* Check EMAC version */ | 2485 | /* Check EMAC version */ |
2466 | if (of_device_is_compatible(np, "ibm,emac4")) | 2486 | if (of_device_is_compatible(np, "ibm,emac4")) |
2467 | dev->features |= EMAC_FTR_EMAC4; | 2487 | dev->features |= EMAC_FTR_EMAC4; |
2468 | if (of_device_is_compatible(np, "ibm,emac-axon") | 2488 | |
2469 | || of_device_is_compatible(np, "ibm,emac-440epx")) | 2489 | /* Fixup some feature bits based on the device tree */ |
2470 | dev->features |= EMAC_FTR_HAS_AXON_STACR | 2490 | if (of_get_property(np, "has-inverted-stacr-oc", NULL)) |
2471 | | EMAC_FTR_STACR_OC_INVERT; | ||
2472 | if (of_device_is_compatible(np, "ibm,emac-440spe")) | ||
2473 | dev->features |= EMAC_FTR_STACR_OC_INVERT; | 2491 | dev->features |= EMAC_FTR_STACR_OC_INVERT; |
2492 | if (of_get_property(np, "has-new-stacr-staopc", NULL)) | ||
2493 | dev->features |= EMAC_FTR_HAS_NEW_STACR; | ||
2474 | 2494 | ||
2475 | /* Fixup some feature bits based on the device tree and verify | 2495 | /* CAB lacks the appropriate properties */ |
2476 | * we have support for them compiled in | 2496 | if (of_device_is_compatible(np, "ibm,emac-axon")) |
2477 | */ | 2497 | dev->features |= EMAC_FTR_HAS_NEW_STACR | |
2498 | EMAC_FTR_STACR_OC_INVERT; | ||
2499 | |||
2500 | /* Enable TAH/ZMII/RGMII features as found */ | ||
2478 | if (dev->tah_ph != 0) { | 2501 | if (dev->tah_ph != 0) { |
2479 | #ifdef CONFIG_IBM_NEW_EMAC_TAH | 2502 | #ifdef CONFIG_IBM_NEW_EMAC_TAH |
2480 | dev->features |= EMAC_FTR_HAS_TAH; | 2503 | dev->features |= EMAC_FTR_HAS_TAH; |
@@ -2532,6 +2555,10 @@ static int __devinit emac_probe(struct of_device *ofdev, | |||
2532 | struct device_node **blist = NULL; | 2555 | struct device_node **blist = NULL; |
2533 | int err, i; | 2556 | int err, i; |
2534 | 2557 | ||
2558 | /* Skip unused/unwired EMACS */ | ||
2559 | if (of_get_property(np, "unused", NULL)) | ||
2560 | return -ENODEV; | ||
2561 | |||
2535 | /* Find ourselves in the bootlist if we are there */ | 2562 | /* Find ourselves in the bootlist if we are there */ |
2536 | for (i = 0; i < EMAC_BOOT_LIST_SIZE; i++) | 2563 | for (i = 0; i < EMAC_BOOT_LIST_SIZE; i++) |
2537 | if (emac_boot_list[i] == np) | 2564 | if (emac_boot_list[i] == np) |
@@ -2756,6 +2783,8 @@ static int __devexit emac_remove(struct of_device *ofdev) | |||
2756 | 2783 | ||
2757 | unregister_netdev(dev->ndev); | 2784 | unregister_netdev(dev->ndev); |
2758 | 2785 | ||
2786 | flush_scheduled_work(); | ||
2787 | |||
2759 | if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) | 2788 | if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) |
2760 | tah_detach(dev->tah_dev, dev->tah_port); | 2789 | tah_detach(dev->tah_dev, dev->tah_port); |
2761 | if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII)) | 2790 | if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII)) |
diff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h index 4011803117ca..4e74d8287c65 100644 --- a/drivers/net/ibm_newemac/core.h +++ b/drivers/net/ibm_newemac/core.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
@@ -258,6 +263,7 @@ struct emac_instance { | |||
258 | int stop_timeout; /* in us */ | 263 | int stop_timeout; /* in us */ |
259 | int no_mcast; | 264 | int no_mcast; |
260 | int mcast_pending; | 265 | int mcast_pending; |
266 | int opened; | ||
261 | struct work_struct reset_work; | 267 | struct work_struct reset_work; |
262 | spinlock_t lock; | 268 | spinlock_t lock; |
263 | }; | 269 | }; |
@@ -292,9 +298,9 @@ struct emac_instance { | |||
292 | */ | 298 | */ |
293 | #define EMAC_FTR_HAS_RGMII 0x00000020 | 299 | #define EMAC_FTR_HAS_RGMII 0x00000020 |
294 | /* | 300 | /* |
295 | * Set if we have axon-type STACR | 301 | * Set if we have new type STACR with STAOPC |
296 | */ | 302 | */ |
297 | #define EMAC_FTR_HAS_AXON_STACR 0x00000040 | 303 | #define EMAC_FTR_HAS_NEW_STACR 0x00000040 |
298 | 304 | ||
299 | 305 | ||
300 | /* Right now, we don't quite handle the always/possible masks on the | 306 | /* Right now, we don't quite handle the always/possible masks on the |
@@ -306,7 +312,7 @@ enum { | |||
306 | 312 | ||
307 | EMAC_FTRS_POSSIBLE = | 313 | EMAC_FTRS_POSSIBLE = |
308 | #ifdef CONFIG_IBM_NEW_EMAC_EMAC4 | 314 | #ifdef CONFIG_IBM_NEW_EMAC_EMAC4 |
309 | EMAC_FTR_EMAC4 | EMAC_FTR_HAS_AXON_STACR | | 315 | EMAC_FTR_EMAC4 | EMAC_FTR_HAS_NEW_STACR | |
310 | EMAC_FTR_STACR_OC_INVERT | | 316 | EMAC_FTR_STACR_OC_INVERT | |
311 | #endif | 317 | #endif |
312 | #ifdef CONFIG_IBM_NEW_EMAC_TAH | 318 | #ifdef CONFIG_IBM_NEW_EMAC_TAH |
diff --git a/drivers/net/ibm_newemac/debug.c b/drivers/net/ibm_newemac/debug.c index 170524ee0f19..a2fc660ca5d4 100644 --- a/drivers/net/ibm_newemac/debug.c +++ b/drivers/net/ibm_newemac/debug.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies | 11 | * Copyright (c) 2004, 2005 Zultys Technologies |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/debug.h b/drivers/net/ibm_newemac/debug.h index 1dd2dcbc157f..b631842ec8d0 100644 --- a/drivers/net/ibm_newemac/debug.h +++ b/drivers/net/ibm_newemac/debug.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, debug print routines. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies | 11 | * Copyright (c) 2004, 2005 Zultys Technologies |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h index bef92efeeadc..91cb096ab405 100644 --- a/drivers/net/ibm_newemac/emac.h +++ b/drivers/net/ibm_newemac/emac.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Register definitions for PowerPC 4xx on-chip ethernet contoller | 4 | * Register definitions for PowerPC 4xx on-chip ethernet contoller |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c index 9a88f71db004..6869f08c9dcb 100644 --- a/drivers/net/ibm_newemac/mal.c +++ b/drivers/net/ibm_newemac/mal.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Memory Access Layer (MAL) support | 4 | * Memory Access Layer (MAL) support |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/mal.h b/drivers/net/ibm_newemac/mal.h index 784edb8ea822..eaa7262dc079 100644 --- a/drivers/net/ibm_newemac/mal.h +++ b/drivers/net/ibm_newemac/mal.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Memory Access Layer (MAL) support | 4 | * Memory Access Layer (MAL) support |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/phy.c b/drivers/net/ibm_newemac/phy.c index aa1f0ddf1e3e..37bfeea8788a 100644 --- a/drivers/net/ibm_newemac/phy.c +++ b/drivers/net/ibm_newemac/phy.c | |||
@@ -8,6 +8,11 @@ | |||
8 | * This file should be shared with other drivers or eventually | 8 | * This file should be shared with other drivers or eventually |
9 | * merged as the "low level" part of miilib | 9 | * merged as the "low level" part of miilib |
10 | * | 10 | * |
11 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
12 | * <benh@kernel.crashing.org> | ||
13 | * | ||
14 | * Based on the arch/ppc version of the driver: | ||
15 | * | ||
11 | * (c) 2003, Benjamin Herrenscmidt (benh@kernel.crashing.org) | 16 | * (c) 2003, Benjamin Herrenscmidt (benh@kernel.crashing.org) |
12 | * (c) 2004-2005, Eugene Surovegin <ebs@ebshome.net> | 17 | * (c) 2004-2005, Eugene Surovegin <ebs@ebshome.net> |
13 | * | 18 | * |
@@ -306,8 +311,84 @@ static struct mii_phy_def cis8201_phy_def = { | |||
306 | .ops = &cis8201_phy_ops | 311 | .ops = &cis8201_phy_ops |
307 | }; | 312 | }; |
308 | 313 | ||
314 | static struct mii_phy_def bcm5248_phy_def = { | ||
315 | |||
316 | .phy_id = 0x0143bc00, | ||
317 | .phy_id_mask = 0x0ffffff0, | ||
318 | .name = "BCM5248 10/100 SMII Ethernet", | ||
319 | .ops = &generic_phy_ops | ||
320 | }; | ||
321 | |||
322 | static int m88e1111_init(struct mii_phy *phy) | ||
323 | { | ||
324 | pr_debug("%s: Marvell 88E1111 Ethernet\n", __FUNCTION__); | ||
325 | phy_write(phy, 0x14, 0x0ce3); | ||
326 | phy_write(phy, 0x18, 0x4101); | ||
327 | phy_write(phy, 0x09, 0x0e00); | ||
328 | phy_write(phy, 0x04, 0x01e1); | ||
329 | phy_write(phy, 0x00, 0x9140); | ||
330 | phy_write(phy, 0x00, 0x1140); | ||
331 | |||
332 | return 0; | ||
333 | } | ||
334 | |||
335 | static int et1011c_init(struct mii_phy *phy) | ||
336 | { | ||
337 | u16 reg_short; | ||
338 | |||
339 | reg_short = (u16)(phy_read(phy, 0x16)); | ||
340 | reg_short &= ~(0x7); | ||
341 | reg_short |= 0x6; /* RGMII Trace Delay*/ | ||
342 | phy_write(phy, 0x16, reg_short); | ||
343 | |||
344 | reg_short = (u16)(phy_read(phy, 0x17)); | ||
345 | reg_short &= ~(0x40); | ||
346 | phy_write(phy, 0x17, reg_short); | ||
347 | |||
348 | phy_write(phy, 0x1c, 0x74f0); | ||
349 | return 0; | ||
350 | } | ||
351 | |||
352 | static struct mii_phy_ops et1011c_phy_ops = { | ||
353 | .init = et1011c_init, | ||
354 | .setup_aneg = genmii_setup_aneg, | ||
355 | .setup_forced = genmii_setup_forced, | ||
356 | .poll_link = genmii_poll_link, | ||
357 | .read_link = genmii_read_link | ||
358 | }; | ||
359 | |||
360 | static struct mii_phy_def et1011c_phy_def = { | ||
361 | .phy_id = 0x0282f000, | ||
362 | .phy_id_mask = 0x0fffff00, | ||
363 | .name = "ET1011C Gigabit Ethernet", | ||
364 | .ops = &et1011c_phy_ops | ||
365 | }; | ||
366 | |||
367 | |||
368 | |||
369 | |||
370 | |||
371 | static struct mii_phy_ops m88e1111_phy_ops = { | ||
372 | .init = m88e1111_init, | ||
373 | .setup_aneg = genmii_setup_aneg, | ||
374 | .setup_forced = genmii_setup_forced, | ||
375 | .poll_link = genmii_poll_link, | ||
376 | .read_link = genmii_read_link | ||
377 | }; | ||
378 | |||
379 | static struct mii_phy_def m88e1111_phy_def = { | ||
380 | |||
381 | .phy_id = 0x01410CC0, | ||
382 | .phy_id_mask = 0x0ffffff0, | ||
383 | .name = "Marvell 88E1111 Ethernet", | ||
384 | .ops = &m88e1111_phy_ops, | ||
385 | }; | ||
386 | |||
309 | static struct mii_phy_def *mii_phy_table[] = { | 387 | static struct mii_phy_def *mii_phy_table[] = { |
388 | &et1011c_phy_def, | ||
310 | &cis8201_phy_def, | 389 | &cis8201_phy_def, |
390 | &bcm5248_phy_def, | ||
391 | &m88e1111_phy_def, | ||
311 | &genmii_phy_def, | 392 | &genmii_phy_def, |
312 | NULL | 393 | NULL |
313 | }; | 394 | }; |
diff --git a/drivers/net/ibm_newemac/phy.h b/drivers/net/ibm_newemac/phy.h index 6feca26afedb..1b65c81f6557 100644 --- a/drivers/net/ibm_newemac/phy.h +++ b/drivers/net/ibm_newemac/phy.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, PHY support | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, PHY support |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Benjamin Herrenschmidt <benh@kernel.crashing.org> | 11 | * Benjamin Herrenschmidt <benh@kernel.crashing.org> |
7 | * February 2003 | 12 | * February 2003 |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c index de416951a435..9bc1132fa788 100644 --- a/drivers/net/ibm_newemac/rgmii.c +++ b/drivers/net/ibm_newemac/rgmii.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
@@ -140,7 +145,7 @@ void rgmii_get_mdio(struct of_device *ofdev, int input) | |||
140 | 145 | ||
141 | RGMII_DBG2(dev, "get_mdio(%d)" NL, input); | 146 | RGMII_DBG2(dev, "get_mdio(%d)" NL, input); |
142 | 147 | ||
143 | if (dev->type != RGMII_AXON) | 148 | if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO)) |
144 | return; | 149 | return; |
145 | 150 | ||
146 | mutex_lock(&dev->lock); | 151 | mutex_lock(&dev->lock); |
@@ -161,7 +166,7 @@ void rgmii_put_mdio(struct of_device *ofdev, int input) | |||
161 | 166 | ||
162 | RGMII_DBG2(dev, "put_mdio(%d)" NL, input); | 167 | RGMII_DBG2(dev, "put_mdio(%d)" NL, input); |
163 | 168 | ||
164 | if (dev->type != RGMII_AXON) | 169 | if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO)) |
165 | return; | 170 | return; |
166 | 171 | ||
167 | fer = in_be32(&p->fer); | 172 | fer = in_be32(&p->fer); |
@@ -250,11 +255,13 @@ static int __devinit rgmii_probe(struct of_device *ofdev, | |||
250 | goto err_free; | 255 | goto err_free; |
251 | } | 256 | } |
252 | 257 | ||
253 | /* Check for RGMII type */ | 258 | /* Check for RGMII flags */ |
259 | if (of_get_property(ofdev->node, "has-mdio", NULL)) | ||
260 | dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; | ||
261 | |||
262 | /* CAB lacks the right properties, fix this up */ | ||
254 | if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon")) | 263 | if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon")) |
255 | dev->type = RGMII_AXON; | 264 | dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; |
256 | else | ||
257 | dev->type = RGMII_STANDARD; | ||
258 | 265 | ||
259 | DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n", | 266 | DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n", |
260 | in_be32(&dev->base->fer), in_be32(&dev->base->ssr)); | 267 | in_be32(&dev->base->fer), in_be32(&dev->base->ssr)); |
@@ -263,9 +270,9 @@ static int __devinit rgmii_probe(struct of_device *ofdev, | |||
263 | out_be32(&dev->base->fer, 0); | 270 | out_be32(&dev->base->fer, 0); |
264 | 271 | ||
265 | printk(KERN_INFO | 272 | printk(KERN_INFO |
266 | "RGMII %s %s initialized\n", | 273 | "RGMII %s initialized with%s MDIO support\n", |
267 | dev->type == RGMII_STANDARD ? "standard" : "axon", | 274 | ofdev->node->full_name, |
268 | ofdev->node->full_name); | 275 | (dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out"); |
269 | 276 | ||
270 | wmb(); | 277 | wmb(); |
271 | dev_set_drvdata(&ofdev->dev, dev); | 278 | dev_set_drvdata(&ofdev->dev, dev); |
diff --git a/drivers/net/ibm_newemac/rgmii.h b/drivers/net/ibm_newemac/rgmii.h index 57806833121e..c4a4b358a270 100644 --- a/drivers/net/ibm_newemac/rgmii.h +++ b/drivers/net/ibm_newemac/rgmii.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Based on ocp_zmii.h/ibm_emac_zmii.h | 11 | * Based on ocp_zmii.h/ibm_emac_zmii.h |
7 | * Armin Kuster akuster@mvista.com | 12 | * Armin Kuster akuster@mvista.com |
8 | * | 13 | * |
@@ -35,8 +40,9 @@ struct rgmii_regs { | |||
35 | struct rgmii_instance { | 40 | struct rgmii_instance { |
36 | struct rgmii_regs __iomem *base; | 41 | struct rgmii_regs __iomem *base; |
37 | 42 | ||
38 | /* Type of RGMII bridge */ | 43 | /* RGMII bridge flags */ |
39 | int type; | 44 | int flags; |
45 | #define EMAC_RGMII_FLAG_HAS_MDIO 0x00000001 | ||
40 | 46 | ||
41 | /* Only one EMAC whacks us at a time */ | 47 | /* Only one EMAC whacks us at a time */ |
42 | struct mutex lock; | 48 | struct mutex lock; |
diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c index f161fb100e8e..96417adec326 100644 --- a/drivers/net/ibm_newemac/tah.c +++ b/drivers/net/ibm_newemac/tah.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, TAH support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, TAH support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright 2004 MontaVista Software, Inc. | 11 | * Copyright 2004 MontaVista Software, Inc. |
7 | * Matt Porter <mporter@kernel.crashing.org> | 12 | * Matt Porter <mporter@kernel.crashing.org> |
8 | * | 13 | * |
@@ -116,13 +121,14 @@ static int __devinit tah_probe(struct of_device *ofdev, | |||
116 | goto err_free; | 121 | goto err_free; |
117 | } | 122 | } |
118 | 123 | ||
124 | dev_set_drvdata(&ofdev->dev, dev); | ||
125 | |||
119 | /* Initialize TAH and enable IPv4 checksum verification, no TSO yet */ | 126 | /* Initialize TAH and enable IPv4 checksum verification, no TSO yet */ |
120 | tah_reset(ofdev); | 127 | tah_reset(ofdev); |
121 | 128 | ||
122 | printk(KERN_INFO | 129 | printk(KERN_INFO |
123 | "TAH %s initialized\n", ofdev->node->full_name); | 130 | "TAH %s initialized\n", ofdev->node->full_name); |
124 | wmb(); | 131 | wmb(); |
125 | dev_set_drvdata(&ofdev->dev, dev); | ||
126 | 132 | ||
127 | return 0; | 133 | return 0; |
128 | 134 | ||
diff --git a/drivers/net/ibm_newemac/tah.h b/drivers/net/ibm_newemac/tah.h index bc41853b6e26..a068b5658dad 100644 --- a/drivers/net/ibm_newemac/tah.h +++ b/drivers/net/ibm_newemac/tah.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, TAH support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, TAH support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright 2004 MontaVista Software, Inc. | 11 | * Copyright 2004 MontaVista Software, Inc. |
7 | * Matt Porter <mporter@kernel.crashing.org> | 12 | * Matt Porter <mporter@kernel.crashing.org> |
8 | * | 13 | * |
diff --git a/drivers/net/ibm_newemac/zmii.c b/drivers/net/ibm_newemac/zmii.c index 2219ec2740e0..2ea472aeab06 100644 --- a/drivers/net/ibm_newemac/zmii.c +++ b/drivers/net/ibm_newemac/zmii.c | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
@@ -83,12 +88,14 @@ int __devinit zmii_attach(struct of_device *ofdev, int input, int *mode) | |||
83 | 88 | ||
84 | ZMII_DBG(dev, "init(%d, %d)" NL, input, *mode); | 89 | ZMII_DBG(dev, "init(%d, %d)" NL, input, *mode); |
85 | 90 | ||
86 | if (!zmii_valid_mode(*mode)) | 91 | if (!zmii_valid_mode(*mode)) { |
87 | /* Probably an EMAC connected to RGMII, | 92 | /* Probably an EMAC connected to RGMII, |
88 | * but it still may need ZMII for MDIO so | 93 | * but it still may need ZMII for MDIO so |
89 | * we don't fail here. | 94 | * we don't fail here. |
90 | */ | 95 | */ |
96 | dev->users++; | ||
91 | return 0; | 97 | return 0; |
98 | } | ||
92 | 99 | ||
93 | mutex_lock(&dev->lock); | 100 | mutex_lock(&dev->lock); |
94 | 101 | ||
diff --git a/drivers/net/ibm_newemac/zmii.h b/drivers/net/ibm_newemac/zmii.h index 82a9968b1f74..6c9beba0c4b6 100644 --- a/drivers/net/ibm_newemac/zmii.h +++ b/drivers/net/ibm_newemac/zmii.h | |||
@@ -3,6 +3,11 @@ | |||
3 | * | 3 | * |
4 | * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support. | 4 | * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support. |
5 | * | 5 | * |
6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. | ||
7 | * <benh@kernel.crashing.org> | ||
8 | * | ||
9 | * Based on the arch/ppc version of the driver: | ||
10 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | 11 | * Copyright (c) 2004, 2005 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 12 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 13 | * |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index c6355c00fd7a..9081234ab458 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -1168,6 +1168,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self) | |||
1168 | static int irda_usb_net_open(struct net_device *netdev) | 1168 | static int irda_usb_net_open(struct net_device *netdev) |
1169 | { | 1169 | { |
1170 | struct irda_usb_cb *self; | 1170 | struct irda_usb_cb *self; |
1171 | unsigned long flags; | ||
1171 | char hwname[16]; | 1172 | char hwname[16]; |
1172 | int i; | 1173 | int i; |
1173 | 1174 | ||
@@ -1177,13 +1178,16 @@ static int irda_usb_net_open(struct net_device *netdev) | |||
1177 | self = (struct irda_usb_cb *) netdev->priv; | 1178 | self = (struct irda_usb_cb *) netdev->priv; |
1178 | IRDA_ASSERT(self != NULL, return -1;); | 1179 | IRDA_ASSERT(self != NULL, return -1;); |
1179 | 1180 | ||
1181 | spin_lock_irqsave(&self->lock, flags); | ||
1180 | /* Can only open the device if it's there */ | 1182 | /* Can only open the device if it's there */ |
1181 | if(!self->present) { | 1183 | if(!self->present) { |
1184 | spin_unlock_irqrestore(&self->lock, flags); | ||
1182 | IRDA_WARNING("%s(), device not present!\n", __FUNCTION__); | 1185 | IRDA_WARNING("%s(), device not present!\n", __FUNCTION__); |
1183 | return -1; | 1186 | return -1; |
1184 | } | 1187 | } |
1185 | 1188 | ||
1186 | if(self->needspatch) { | 1189 | if(self->needspatch) { |
1190 | spin_unlock_irqrestore(&self->lock, flags); | ||
1187 | IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ; | 1191 | IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ; |
1188 | return -EIO ; | 1192 | return -EIO ; |
1189 | } | 1193 | } |
@@ -1198,6 +1202,7 @@ static int irda_usb_net_open(struct net_device *netdev) | |||
1198 | /* To do *before* submitting Rx urbs and starting net Tx queue | 1202 | /* To do *before* submitting Rx urbs and starting net Tx queue |
1199 | * Jean II */ | 1203 | * Jean II */ |
1200 | self->netopen = 1; | 1204 | self->netopen = 1; |
1205 | spin_unlock_irqrestore(&self->lock, flags); | ||
1201 | 1206 | ||
1202 | /* | 1207 | /* |
1203 | * Now that everything should be initialized properly, | 1208 | * Now that everything should be initialized properly, |
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index 0b769192d4ce..93916cf33f29 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c | |||
@@ -677,6 +677,8 @@ static int mcs_net_close(struct net_device *netdev) | |||
677 | /* Stop transmit processing */ | 677 | /* Stop transmit processing */ |
678 | netif_stop_queue(netdev); | 678 | netif_stop_queue(netdev); |
679 | 679 | ||
680 | kfree_skb(mcs->rx_buff.skb); | ||
681 | |||
680 | /* kill and free the receive and transmit URBs */ | 682 | /* kill and free the receive and transmit URBs */ |
681 | usb_kill_urb(mcs->rx_urb); | 683 | usb_kill_urb(mcs->rx_urb); |
682 | usb_free_urb(mcs->rx_urb); | 684 | usb_free_urb(mcs->rx_urb); |
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index 042bc2f0417d..e59c485bc497 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c | |||
@@ -142,9 +142,6 @@ enum StirCtrl2Mask { | |||
142 | }; | 142 | }; |
143 | 143 | ||
144 | enum StirFifoCtlMask { | 144 | enum StirFifoCtlMask { |
145 | FIFOCTL_EOF = 0x80, | ||
146 | FIFOCTL_UNDER = 0x40, | ||
147 | FIFOCTL_OVER = 0x20, | ||
148 | FIFOCTL_DIR = 0x10, | 145 | FIFOCTL_DIR = 0x10, |
149 | FIFOCTL_CLR = 0x08, | 146 | FIFOCTL_CLR = 0x08, |
150 | FIFOCTL_EMPTY = 0x04, | 147 | FIFOCTL_EMPTY = 0x04, |
@@ -594,9 +591,10 @@ static int fifo_txwait(struct stir_cb *stir, int space) | |||
594 | { | 591 | { |
595 | int err; | 592 | int err; |
596 | unsigned long count, status; | 593 | unsigned long count, status; |
594 | unsigned long prev_count = 0x1fff; | ||
597 | 595 | ||
598 | /* Read FIFO status and count */ | 596 | /* Read FIFO status and count */ |
599 | for(;;) { | 597 | for (;; prev_count = count) { |
600 | err = read_reg(stir, REG_FIFOCTL, stir->fifo_status, | 598 | err = read_reg(stir, REG_FIFOCTL, stir->fifo_status, |
601 | FIFO_REGS_SIZE); | 599 | FIFO_REGS_SIZE); |
602 | if (unlikely(err != FIFO_REGS_SIZE)) { | 600 | if (unlikely(err != FIFO_REGS_SIZE)) { |
@@ -629,6 +627,10 @@ static int fifo_txwait(struct stir_cb *stir, int space) | |||
629 | if (space >= 0 && STIR_FIFO_SIZE - 4 > space + count) | 627 | if (space >= 0 && STIR_FIFO_SIZE - 4 > space + count) |
630 | return 0; | 628 | return 0; |
631 | 629 | ||
630 | /* queue confused */ | ||
631 | if (prev_count < count) | ||
632 | break; | ||
633 | |||
632 | /* estimate transfer time for remaining chars */ | 634 | /* estimate transfer time for remaining chars */ |
633 | msleep((count * 8000) / stir->speed); | 635 | msleep((count * 8000) / stir->speed); |
634 | } | 636 | } |
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c index 9a855e512147..b59f442bbf36 100644 --- a/drivers/net/lib82596.c +++ b/drivers/net/lib82596.c | |||
@@ -176,8 +176,8 @@ struct i596_reg { | |||
176 | struct i596_tbd { | 176 | struct i596_tbd { |
177 | unsigned short size; | 177 | unsigned short size; |
178 | unsigned short pad; | 178 | unsigned short pad; |
179 | dma_addr_t next; | 179 | u32 next; |
180 | dma_addr_t data; | 180 | u32 data; |
181 | u32 cache_pad[5]; /* Total 32 bytes... */ | 181 | u32 cache_pad[5]; /* Total 32 bytes... */ |
182 | }; | 182 | }; |
183 | 183 | ||
@@ -195,12 +195,12 @@ struct i596_cmd { | |||
195 | struct i596_cmd *v_next; /* Address from CPUs viewpoint */ | 195 | struct i596_cmd *v_next; /* Address from CPUs viewpoint */ |
196 | unsigned short status; | 196 | unsigned short status; |
197 | unsigned short command; | 197 | unsigned short command; |
198 | dma_addr_t b_next; /* Address from i596 viewpoint */ | 198 | u32 b_next; /* Address from i596 viewpoint */ |
199 | }; | 199 | }; |
200 | 200 | ||
201 | struct tx_cmd { | 201 | struct tx_cmd { |
202 | struct i596_cmd cmd; | 202 | struct i596_cmd cmd; |
203 | dma_addr_t tbd; | 203 | u32 tbd; |
204 | unsigned short size; | 204 | unsigned short size; |
205 | unsigned short pad; | 205 | unsigned short pad; |
206 | struct sk_buff *skb; /* So we can free it after tx */ | 206 | struct sk_buff *skb; /* So we can free it after tx */ |
@@ -237,8 +237,8 @@ struct cf_cmd { | |||
237 | struct i596_rfd { | 237 | struct i596_rfd { |
238 | unsigned short stat; | 238 | unsigned short stat; |
239 | unsigned short cmd; | 239 | unsigned short cmd; |
240 | dma_addr_t b_next; /* Address from i596 viewpoint */ | 240 | u32 b_next; /* Address from i596 viewpoint */ |
241 | dma_addr_t rbd; | 241 | u32 rbd; |
242 | unsigned short count; | 242 | unsigned short count; |
243 | unsigned short size; | 243 | unsigned short size; |
244 | struct i596_rfd *v_next; /* Address from CPUs viewpoint */ | 244 | struct i596_rfd *v_next; /* Address from CPUs viewpoint */ |
@@ -249,18 +249,18 @@ struct i596_rfd { | |||
249 | }; | 249 | }; |
250 | 250 | ||
251 | struct i596_rbd { | 251 | struct i596_rbd { |
252 | /* hardware data */ | 252 | /* hardware data */ |
253 | unsigned short count; | 253 | unsigned short count; |
254 | unsigned short zero1; | 254 | unsigned short zero1; |
255 | dma_addr_t b_next; | 255 | u32 b_next; |
256 | dma_addr_t b_data; /* Address from i596 viewpoint */ | 256 | u32 b_data; /* Address from i596 viewpoint */ |
257 | unsigned short size; | 257 | unsigned short size; |
258 | unsigned short zero2; | 258 | unsigned short zero2; |
259 | /* driver data */ | 259 | /* driver data */ |
260 | struct sk_buff *skb; | 260 | struct sk_buff *skb; |
261 | struct i596_rbd *v_next; | 261 | struct i596_rbd *v_next; |
262 | dma_addr_t b_addr; /* This rbd addr from i596 view */ | 262 | u32 b_addr; /* This rbd addr from i596 view */ |
263 | unsigned char *v_data; /* Address from CPUs viewpoint */ | 263 | unsigned char *v_data; /* Address from CPUs viewpoint */ |
264 | /* Total 32 bytes... */ | 264 | /* Total 32 bytes... */ |
265 | #ifdef __LP64__ | 265 | #ifdef __LP64__ |
266 | u32 cache_pad[4]; | 266 | u32 cache_pad[4]; |
@@ -275,8 +275,8 @@ struct i596_rbd { | |||
275 | struct i596_scb { | 275 | struct i596_scb { |
276 | unsigned short status; | 276 | unsigned short status; |
277 | unsigned short command; | 277 | unsigned short command; |
278 | dma_addr_t cmd; | 278 | u32 cmd; |
279 | dma_addr_t rfd; | 279 | u32 rfd; |
280 | u32 crc_err; | 280 | u32 crc_err; |
281 | u32 align_err; | 281 | u32 align_err; |
282 | u32 resource_err; | 282 | u32 resource_err; |
@@ -288,14 +288,14 @@ struct i596_scb { | |||
288 | }; | 288 | }; |
289 | 289 | ||
290 | struct i596_iscp { | 290 | struct i596_iscp { |
291 | u32 stat; | 291 | u32 stat; |
292 | dma_addr_t scb; | 292 | u32 scb; |
293 | }; | 293 | }; |
294 | 294 | ||
295 | struct i596_scp { | 295 | struct i596_scp { |
296 | u32 sysbus; | 296 | u32 sysbus; |
297 | u32 pad; | 297 | u32 pad; |
298 | dma_addr_t iscp; | 298 | u32 iscp; |
299 | }; | 299 | }; |
300 | 300 | ||
301 | struct i596_dma { | 301 | struct i596_dma { |
diff --git a/drivers/net/mlx4/qp.c b/drivers/net/mlx4/qp.c index 42b47639c81c..fa24e6597591 100644 --- a/drivers/net/mlx4/qp.c +++ b/drivers/net/mlx4/qp.c | |||
@@ -113,7 +113,7 @@ int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | |||
113 | struct mlx4_cmd_mailbox *mailbox; | 113 | struct mlx4_cmd_mailbox *mailbox; |
114 | int ret = 0; | 114 | int ret = 0; |
115 | 115 | ||
116 | if (cur_state >= MLX4_QP_NUM_STATE || cur_state >= MLX4_QP_NUM_STATE || | 116 | if (cur_state >= MLX4_QP_NUM_STATE || new_state >= MLX4_QP_NUM_STATE || |
117 | !op[cur_state][new_state]) | 117 | !op[cur_state][new_state]) |
118 | return -EINVAL; | 118 | return -EINVAL; |
119 | 119 | ||
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 0f306ddb5630..8def8657251f 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -1979,6 +1979,7 @@ static int myri10ge_open(struct net_device *dev) | |||
1979 | lro_mgr->lro_arr = mgp->rx_done.lro_desc; | 1979 | lro_mgr->lro_arr = mgp->rx_done.lro_desc; |
1980 | lro_mgr->get_frag_header = myri10ge_get_frag_header; | 1980 | lro_mgr->get_frag_header = myri10ge_get_frag_header; |
1981 | lro_mgr->max_aggr = myri10ge_lro_max_pkts; | 1981 | lro_mgr->max_aggr = myri10ge_lro_max_pkts; |
1982 | lro_mgr->frag_align_pad = 2; | ||
1982 | if (lro_mgr->max_aggr > MAX_SKB_FRAGS) | 1983 | if (lro_mgr->max_aggr > MAX_SKB_FRAGS) |
1983 | lro_mgr->max_aggr = MAX_SKB_FRAGS; | 1984 | lro_mgr->max_aggr = MAX_SKB_FRAGS; |
1984 | 1985 | ||
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 112ab079ce7d..abfc61c3a38c 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -1045,6 +1045,7 @@ static int niu_serdes_init(struct niu *np) | |||
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | static void niu_init_xif(struct niu *); | 1047 | static void niu_init_xif(struct niu *); |
1048 | static void niu_handle_led(struct niu *, int status); | ||
1048 | 1049 | ||
1049 | static int niu_link_status_common(struct niu *np, int link_up) | 1050 | static int niu_link_status_common(struct niu *np, int link_up) |
1050 | { | 1051 | { |
@@ -1066,11 +1067,15 @@ static int niu_link_status_common(struct niu *np, int link_up) | |||
1066 | 1067 | ||
1067 | spin_lock_irqsave(&np->lock, flags); | 1068 | spin_lock_irqsave(&np->lock, flags); |
1068 | niu_init_xif(np); | 1069 | niu_init_xif(np); |
1070 | niu_handle_led(np, 1); | ||
1069 | spin_unlock_irqrestore(&np->lock, flags); | 1071 | spin_unlock_irqrestore(&np->lock, flags); |
1070 | 1072 | ||
1071 | netif_carrier_on(dev); | 1073 | netif_carrier_on(dev); |
1072 | } else if (netif_carrier_ok(dev) && !link_up) { | 1074 | } else if (netif_carrier_ok(dev) && !link_up) { |
1073 | niuwarn(LINK, "%s: Link is down\n", dev->name); | 1075 | niuwarn(LINK, "%s: Link is down\n", dev->name); |
1076 | spin_lock_irqsave(&np->lock, flags); | ||
1077 | niu_handle_led(np, 0); | ||
1078 | spin_unlock_irqrestore(&np->lock, flags); | ||
1074 | netif_carrier_off(dev); | 1079 | netif_carrier_off(dev); |
1075 | } | 1080 | } |
1076 | 1081 | ||
@@ -3915,16 +3920,14 @@ static int niu_init_ipp(struct niu *np) | |||
3915 | return 0; | 3920 | return 0; |
3916 | } | 3921 | } |
3917 | 3922 | ||
3918 | static void niu_init_xif_xmac(struct niu *np) | 3923 | static void niu_handle_led(struct niu *np, int status) |
3919 | { | 3924 | { |
3920 | struct niu_link_config *lp = &np->link_config; | ||
3921 | u64 val; | 3925 | u64 val; |
3922 | |||
3923 | val = nr64_mac(XMAC_CONFIG); | 3926 | val = nr64_mac(XMAC_CONFIG); |
3924 | 3927 | ||
3925 | if ((np->flags & NIU_FLAGS_10G) != 0 && | 3928 | if ((np->flags & NIU_FLAGS_10G) != 0 && |
3926 | (np->flags & NIU_FLAGS_FIBER) != 0) { | 3929 | (np->flags & NIU_FLAGS_FIBER) != 0) { |
3927 | if (netif_carrier_ok(np->dev)) { | 3930 | if (status) { |
3928 | val |= XMAC_CONFIG_LED_POLARITY; | 3931 | val |= XMAC_CONFIG_LED_POLARITY; |
3929 | val &= ~XMAC_CONFIG_FORCE_LED_ON; | 3932 | val &= ~XMAC_CONFIG_FORCE_LED_ON; |
3930 | } else { | 3933 | } else { |
@@ -3933,6 +3936,15 @@ static void niu_init_xif_xmac(struct niu *np) | |||
3933 | } | 3936 | } |
3934 | } | 3937 | } |
3935 | 3938 | ||
3939 | nw64_mac(XMAC_CONFIG, val); | ||
3940 | } | ||
3941 | |||
3942 | static void niu_init_xif_xmac(struct niu *np) | ||
3943 | { | ||
3944 | struct niu_link_config *lp = &np->link_config; | ||
3945 | u64 val; | ||
3946 | |||
3947 | val = nr64_mac(XMAC_CONFIG); | ||
3936 | val &= ~XMAC_CONFIG_SEL_POR_CLK_SRC; | 3948 | val &= ~XMAC_CONFIG_SEL_POR_CLK_SRC; |
3937 | 3949 | ||
3938 | val |= XMAC_CONFIG_TX_OUTPUT_EN; | 3950 | val |= XMAC_CONFIG_TX_OUTPUT_EN; |
@@ -4776,6 +4788,8 @@ static int niu_close(struct net_device *dev) | |||
4776 | 4788 | ||
4777 | niu_free_channels(np); | 4789 | niu_free_channels(np); |
4778 | 4790 | ||
4791 | niu_handle_led(np, 0); | ||
4792 | |||
4779 | return 0; | 4793 | return 0; |
4780 | } | 4794 | } |
4781 | 4795 | ||
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 09b4fde8d924..816a59e801b2 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -586,7 +586,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) | |||
586 | /* CRC error flagged */ | 586 | /* CRC error flagged */ |
587 | mac->netdev->stats.rx_errors++; | 587 | mac->netdev->stats.rx_errors++; |
588 | mac->netdev->stats.rx_crc_errors++; | 588 | mac->netdev->stats.rx_crc_errors++; |
589 | dev_kfree_skb_irq(skb); | 589 | /* No need to free skb, it'll be reused */ |
590 | goto next; | 590 | goto next; |
591 | } | 591 | } |
592 | 592 | ||
@@ -1362,7 +1362,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1362 | 1362 | ||
1363 | netif_napi_add(dev, &mac->napi, pasemi_mac_poll, 64); | 1363 | netif_napi_add(dev, &mac->napi, pasemi_mac_poll, 64); |
1364 | 1364 | ||
1365 | dev->features = NETIF_F_HW_CSUM | NETIF_F_LLTX | NETIF_F_SG; | 1365 | dev->features = NETIF_F_IP_CSUM | NETIF_F_LLTX | NETIF_F_SG; |
1366 | 1366 | ||
1367 | /* These should come out of the device tree eventually */ | 1367 | /* These should come out of the device tree eventually */ |
1368 | mac->dma_txch = index; | 1368 | mac->dma_txch = index; |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 035fd41fb61f..f0574073a2a3 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -143,21 +143,29 @@ static int m88e1111_config_init(struct phy_device *phydev) | |||
143 | int err; | 143 | int err; |
144 | 144 | ||
145 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || | 145 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || |
146 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) { | 146 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || |
147 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || | ||
148 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) { | ||
147 | int temp; | 149 | int temp; |
148 | 150 | ||
149 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { | 151 | temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); |
150 | temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); | 152 | if (temp < 0) |
151 | if (temp < 0) | 153 | return temp; |
152 | return temp; | ||
153 | 154 | ||
155 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { | ||
154 | temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY); | 156 | temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY); |
155 | 157 | } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { | |
156 | err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp); | 158 | temp &= ~MII_M1111_TX_DELAY; |
157 | if (err < 0) | 159 | temp |= MII_M1111_RX_DELAY; |
158 | return err; | 160 | } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { |
161 | temp &= ~MII_M1111_RX_DELAY; | ||
162 | temp |= MII_M1111_TX_DELAY; | ||
159 | } | 163 | } |
160 | 164 | ||
165 | err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp); | ||
166 | if (err < 0) | ||
167 | return err; | ||
168 | |||
161 | temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); | 169 | temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); |
162 | if (temp < 0) | 170 | if (temp < 0) |
163 | return temp; | 171 | return temp; |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index fc2f0e695a13..c30196d0ad16 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -91,9 +91,12 @@ int mdiobus_register(struct mii_bus *bus) | |||
91 | 91 | ||
92 | err = device_register(&phydev->dev); | 92 | err = device_register(&phydev->dev); |
93 | 93 | ||
94 | if (err) | 94 | if (err) { |
95 | printk(KERN_ERR "phy %d failed to register\n", | 95 | printk(KERN_ERR "phy %d failed to register\n", |
96 | i); | 96 | i); |
97 | phy_device_free(phydev); | ||
98 | phydev = NULL; | ||
99 | } | ||
97 | } | 100 | } |
98 | 101 | ||
99 | bus->phy_map[i] = phydev; | 102 | bus->phy_map[i] = phydev; |
@@ -110,10 +113,8 @@ void mdiobus_unregister(struct mii_bus *bus) | |||
110 | int i; | 113 | int i; |
111 | 114 | ||
112 | for (i = 0; i < PHY_MAX_ADDR; i++) { | 115 | for (i = 0; i < PHY_MAX_ADDR; i++) { |
113 | if (bus->phy_map[i]) { | 116 | if (bus->phy_map[i]) |
114 | device_unregister(&bus->phy_map[i]->dev); | 117 | device_unregister(&bus->phy_map[i]->dev); |
115 | kfree(bus->phy_map[i]); | ||
116 | } | ||
117 | } | 118 | } |
118 | } | 119 | } |
119 | EXPORT_SYMBOL(mdiobus_unregister); | 120 | EXPORT_SYMBOL(mdiobus_unregister); |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 9bc11773705b..7c9e6e349503 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -406,6 +406,9 @@ int phy_mii_ioctl(struct phy_device *phydev, | |||
406 | && phydev->drv->config_init) | 406 | && phydev->drv->config_init) |
407 | phydev->drv->config_init(phydev); | 407 | phydev->drv->config_init(phydev); |
408 | break; | 408 | break; |
409 | |||
410 | default: | ||
411 | return -ENOTTY; | ||
409 | } | 412 | } |
410 | 413 | ||
411 | return 0; | 414 | return 0; |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index f6e484812a98..5b9e1751e1b4 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -44,6 +44,16 @@ static struct phy_driver genphy_driver; | |||
44 | extern int mdio_bus_init(void); | 44 | extern int mdio_bus_init(void); |
45 | extern void mdio_bus_exit(void); | 45 | extern void mdio_bus_exit(void); |
46 | 46 | ||
47 | void phy_device_free(struct phy_device *phydev) | ||
48 | { | ||
49 | kfree(phydev); | ||
50 | } | ||
51 | |||
52 | static void phy_device_release(struct device *dev) | ||
53 | { | ||
54 | phy_device_free(to_phy_device(dev)); | ||
55 | } | ||
56 | |||
47 | struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) | 57 | struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) |
48 | { | 58 | { |
49 | struct phy_device *dev; | 59 | struct phy_device *dev; |
@@ -54,6 +64,8 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) | |||
54 | if (NULL == dev) | 64 | if (NULL == dev) |
55 | return (struct phy_device*) PTR_ERR((void*)-ENOMEM); | 65 | return (struct phy_device*) PTR_ERR((void*)-ENOMEM); |
56 | 66 | ||
67 | dev->dev.release = phy_device_release; | ||
68 | |||
57 | dev->speed = 0; | 69 | dev->speed = 0; |
58 | dev->duplex = -1; | 70 | dev->duplex = -1; |
59 | dev->pause = dev->asym_pause = 0; | 71 | dev->pause = dev->asym_pause = 0; |
diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 5071fcd8a0bd..57c98669984d 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c | |||
@@ -663,7 +663,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl, | |||
663 | case PLIP_PK_DONE: | 663 | case PLIP_PK_DONE: |
664 | /* Inform the upper layer for the arrival of a packet. */ | 664 | /* Inform the upper layer for the arrival of a packet. */ |
665 | rcv->skb->protocol=plip_type_trans(rcv->skb, dev); | 665 | rcv->skb->protocol=plip_type_trans(rcv->skb, dev); |
666 | netif_rx(rcv->skb); | 666 | netif_rx_ni(rcv->skb); |
667 | dev->last_rx = jiffies; | 667 | dev->last_rx = jiffies; |
668 | dev->stats.rx_bytes += rcv->length.h; | 668 | dev->stats.rx_bytes += rcv->length.h; |
669 | dev->stats.rx_packets++; | 669 | dev->stats.rx_packets++; |
@@ -1269,7 +1269,7 @@ static void plip_attach (struct parport *port) | |||
1269 | 1269 | ||
1270 | nl = netdev_priv(dev); | 1270 | nl = netdev_priv(dev); |
1271 | nl->dev = dev; | 1271 | nl->dev = dev; |
1272 | nl->pardev = parport_register_device(port, name, plip_preempt, | 1272 | nl->pardev = parport_register_device(port, dev->name, plip_preempt, |
1273 | plip_wakeup, plip_interrupt, | 1273 | plip_wakeup, plip_interrupt, |
1274 | 0, dev); | 1274 | 0, dev); |
1275 | 1275 | ||
diff --git a/drivers/net/s2io-regs.h b/drivers/net/s2io-regs.h index 01f08d726ace..f25264f2638e 100644 --- a/drivers/net/s2io-regs.h +++ b/drivers/net/s2io-regs.h | |||
@@ -66,6 +66,7 @@ struct XENA_dev_config { | |||
66 | #define ADAPTER_STATUS_RC_PRC_QUIESCENT vBIT(0xFF,16,8) | 66 | #define ADAPTER_STATUS_RC_PRC_QUIESCENT vBIT(0xFF,16,8) |
67 | #define ADAPTER_STATUS_MC_DRAM_READY s2BIT(24) | 67 | #define ADAPTER_STATUS_MC_DRAM_READY s2BIT(24) |
68 | #define ADAPTER_STATUS_MC_QUEUES_READY s2BIT(25) | 68 | #define ADAPTER_STATUS_MC_QUEUES_READY s2BIT(25) |
69 | #define ADAPTER_STATUS_RIC_RUNNING s2BIT(26) | ||
69 | #define ADAPTER_STATUS_M_PLL_LOCK s2BIT(30) | 70 | #define ADAPTER_STATUS_M_PLL_LOCK s2BIT(30) |
70 | #define ADAPTER_STATUS_P_PLL_LOCK s2BIT(31) | 71 | #define ADAPTER_STATUS_P_PLL_LOCK s2BIT(31) |
71 | 72 | ||
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 632666706247..121cb100f93a 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -84,7 +84,7 @@ | |||
84 | #include "s2io.h" | 84 | #include "s2io.h" |
85 | #include "s2io-regs.h" | 85 | #include "s2io-regs.h" |
86 | 86 | ||
87 | #define DRV_VERSION "2.0.26.6" | 87 | #define DRV_VERSION "2.0.26.10" |
88 | 88 | ||
89 | /* S2io Driver name & version. */ | 89 | /* S2io Driver name & version. */ |
90 | static char s2io_driver_name[] = "Neterion"; | 90 | static char s2io_driver_name[] = "Neterion"; |
@@ -1081,7 +1081,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1081 | /* to set the swapper controle on the card */ | 1081 | /* to set the swapper controle on the card */ |
1082 | if(s2io_set_swapper(nic)) { | 1082 | if(s2io_set_swapper(nic)) { |
1083 | DBG_PRINT(ERR_DBG,"ERROR: Setting Swapper failed\n"); | 1083 | DBG_PRINT(ERR_DBG,"ERROR: Setting Swapper failed\n"); |
1084 | return -1; | 1084 | return -EIO; |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | /* | 1087 | /* |
@@ -1100,6 +1100,20 @@ static int init_nic(struct s2io_nic *nic) | |||
1100 | msleep(500); | 1100 | msleep(500); |
1101 | val64 = readq(&bar0->sw_reset); | 1101 | val64 = readq(&bar0->sw_reset); |
1102 | 1102 | ||
1103 | /* Ensure that it's safe to access registers by checking | ||
1104 | * RIC_RUNNING bit is reset. Check is valid only for XframeII. | ||
1105 | */ | ||
1106 | if (nic->device_type == XFRAME_II_DEVICE) { | ||
1107 | for (i = 0; i < 50; i++) { | ||
1108 | val64 = readq(&bar0->adapter_status); | ||
1109 | if (!(val64 & ADAPTER_STATUS_RIC_RUNNING)) | ||
1110 | break; | ||
1111 | msleep(10); | ||
1112 | } | ||
1113 | if (i == 50) | ||
1114 | return -ENODEV; | ||
1115 | } | ||
1116 | |||
1103 | /* Enable Receiving broadcasts */ | 1117 | /* Enable Receiving broadcasts */ |
1104 | add = &bar0->mac_cfg; | 1118 | add = &bar0->mac_cfg; |
1105 | val64 = readq(&bar0->mac_cfg); | 1119 | val64 = readq(&bar0->mac_cfg); |
@@ -1503,7 +1517,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1503 | DBG_PRINT(ERR_DBG, "%s: failed rts ds steering", | 1517 | DBG_PRINT(ERR_DBG, "%s: failed rts ds steering", |
1504 | dev->name); | 1518 | dev->name); |
1505 | DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i); | 1519 | DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i); |
1506 | return FAILURE; | 1520 | return -ENODEV; |
1507 | } | 1521 | } |
1508 | } | 1522 | } |
1509 | 1523 | ||
@@ -1570,7 +1584,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1570 | if (time > 10) { | 1584 | if (time > 10) { |
1571 | DBG_PRINT(ERR_DBG, "%s: TTI init Failed\n", | 1585 | DBG_PRINT(ERR_DBG, "%s: TTI init Failed\n", |
1572 | dev->name); | 1586 | dev->name); |
1573 | return -1; | 1587 | return -ENODEV; |
1574 | } | 1588 | } |
1575 | msleep(50); | 1589 | msleep(50); |
1576 | time++; | 1590 | time++; |
@@ -1623,7 +1637,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1623 | if (time > 10) { | 1637 | if (time > 10) { |
1624 | DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n", | 1638 | DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n", |
1625 | dev->name); | 1639 | dev->name); |
1626 | return -1; | 1640 | return -ENODEV; |
1627 | } | 1641 | } |
1628 | time++; | 1642 | time++; |
1629 | msleep(50); | 1643 | msleep(50); |
@@ -3914,6 +3928,12 @@ static int s2io_close(struct net_device *dev) | |||
3914 | { | 3928 | { |
3915 | struct s2io_nic *sp = dev->priv; | 3929 | struct s2io_nic *sp = dev->priv; |
3916 | 3930 | ||
3931 | /* Return if the device is already closed * | ||
3932 | * Can happen when s2io_card_up failed in change_mtu * | ||
3933 | */ | ||
3934 | if (!is_s2io_card_up(sp)) | ||
3935 | return 0; | ||
3936 | |||
3917 | netif_stop_queue(dev); | 3937 | netif_stop_queue(dev); |
3918 | napi_disable(&sp->napi); | 3938 | napi_disable(&sp->napi); |
3919 | /* Reset card, kill tasklet and free Tx and Rx buffers. */ | 3939 | /* Reset card, kill tasklet and free Tx and Rx buffers. */ |
@@ -6355,6 +6375,7 @@ static int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
6355 | static int s2io_change_mtu(struct net_device *dev, int new_mtu) | 6375 | static int s2io_change_mtu(struct net_device *dev, int new_mtu) |
6356 | { | 6376 | { |
6357 | struct s2io_nic *sp = dev->priv; | 6377 | struct s2io_nic *sp = dev->priv; |
6378 | int ret = 0; | ||
6358 | 6379 | ||
6359 | if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { | 6380 | if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { |
6360 | DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n", | 6381 | DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n", |
@@ -6366,9 +6387,11 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu) | |||
6366 | if (netif_running(dev)) { | 6387 | if (netif_running(dev)) { |
6367 | s2io_card_down(sp); | 6388 | s2io_card_down(sp); |
6368 | netif_stop_queue(dev); | 6389 | netif_stop_queue(dev); |
6369 | if (s2io_card_up(sp)) { | 6390 | ret = s2io_card_up(sp); |
6391 | if (ret) { | ||
6370 | DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", | 6392 | DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", |
6371 | __FUNCTION__); | 6393 | __FUNCTION__); |
6394 | return ret; | ||
6372 | } | 6395 | } |
6373 | if (netif_queue_stopped(dev)) | 6396 | if (netif_queue_stopped(dev)) |
6374 | netif_wake_queue(dev); | 6397 | netif_wake_queue(dev); |
@@ -6379,7 +6402,7 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu) | |||
6379 | writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len); | 6402 | writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len); |
6380 | } | 6403 | } |
6381 | 6404 | ||
6382 | return 0; | 6405 | return ret; |
6383 | } | 6406 | } |
6384 | 6407 | ||
6385 | /** | 6408 | /** |
@@ -6777,6 +6800,9 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io) | |||
6777 | unsigned long flags; | 6800 | unsigned long flags; |
6778 | register u64 val64 = 0; | 6801 | register u64 val64 = 0; |
6779 | 6802 | ||
6803 | if (!is_s2io_card_up(sp)) | ||
6804 | return; | ||
6805 | |||
6780 | del_timer_sync(&sp->alarm_timer); | 6806 | del_timer_sync(&sp->alarm_timer); |
6781 | /* If s2io_set_link task is executing, wait till it completes. */ | 6807 | /* If s2io_set_link task is executing, wait till it completes. */ |
6782 | while (test_and_set_bit(__S2IO_STATE_LINK_TASK, &(sp->state))) { | 6808 | while (test_and_set_bit(__S2IO_STATE_LINK_TASK, &(sp->state))) { |
@@ -6850,11 +6876,13 @@ static int s2io_card_up(struct s2io_nic * sp) | |||
6850 | u16 interruptible; | 6876 | u16 interruptible; |
6851 | 6877 | ||
6852 | /* Initialize the H/W I/O registers */ | 6878 | /* Initialize the H/W I/O registers */ |
6853 | if (init_nic(sp) != 0) { | 6879 | ret = init_nic(sp); |
6880 | if (ret != 0) { | ||
6854 | DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", | 6881 | DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", |
6855 | dev->name); | 6882 | dev->name); |
6856 | s2io_reset(sp); | 6883 | if (ret != -EIO) |
6857 | return -ENODEV; | 6884 | s2io_reset(sp); |
6885 | return ret; | ||
6858 | } | 6886 | } |
6859 | 6887 | ||
6860 | /* | 6888 | /* |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 6d62250fba07..186eb8ebfda6 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include "skge.h" | 44 | #include "skge.h" |
45 | 45 | ||
46 | #define DRV_NAME "skge" | 46 | #define DRV_NAME "skge" |
47 | #define DRV_VERSION "1.12" | 47 | #define DRV_VERSION "1.13" |
48 | #define PFX DRV_NAME " " | 48 | #define PFX DRV_NAME " " |
49 | 49 | ||
50 | #define DEFAULT_TX_RING_SIZE 128 | 50 | #define DEFAULT_TX_RING_SIZE 128 |
@@ -1095,16 +1095,9 @@ static void xm_link_down(struct skge_hw *hw, int port) | |||
1095 | { | 1095 | { |
1096 | struct net_device *dev = hw->dev[port]; | 1096 | struct net_device *dev = hw->dev[port]; |
1097 | struct skge_port *skge = netdev_priv(dev); | 1097 | struct skge_port *skge = netdev_priv(dev); |
1098 | u16 cmd = xm_read16(hw, port, XM_MMU_CMD); | ||
1099 | 1098 | ||
1100 | xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE); | 1099 | xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE); |
1101 | 1100 | ||
1102 | cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX); | ||
1103 | xm_write16(hw, port, XM_MMU_CMD, cmd); | ||
1104 | |||
1105 | /* dummy read to ensure writing */ | ||
1106 | xm_read16(hw, port, XM_MMU_CMD); | ||
1107 | |||
1108 | if (netif_carrier_ok(dev)) | 1101 | if (netif_carrier_ok(dev)) |
1109 | skge_link_down(skge); | 1102 | skge_link_down(skge); |
1110 | } | 1103 | } |
@@ -1194,6 +1187,7 @@ static void genesis_init(struct skge_hw *hw) | |||
1194 | static void genesis_reset(struct skge_hw *hw, int port) | 1187 | static void genesis_reset(struct skge_hw *hw, int port) |
1195 | { | 1188 | { |
1196 | const u8 zero[8] = { 0 }; | 1189 | const u8 zero[8] = { 0 }; |
1190 | u32 reg; | ||
1197 | 1191 | ||
1198 | skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0); | 1192 | skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0); |
1199 | 1193 | ||
@@ -1209,6 +1203,11 @@ static void genesis_reset(struct skge_hw *hw, int port) | |||
1209 | xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff); | 1203 | xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff); |
1210 | 1204 | ||
1211 | xm_outhash(hw, port, XM_HSM, zero); | 1205 | xm_outhash(hw, port, XM_HSM, zero); |
1206 | |||
1207 | /* Flush TX and RX fifo */ | ||
1208 | reg = xm_read32(hw, port, XM_MODE); | ||
1209 | xm_write32(hw, port, XM_MODE, reg | XM_MD_FTF); | ||
1210 | xm_write32(hw, port, XM_MODE, reg | XM_MD_FRF); | ||
1212 | } | 1211 | } |
1213 | 1212 | ||
1214 | 1213 | ||
@@ -1634,15 +1633,14 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1634 | } | 1633 | } |
1635 | xm_write16(hw, port, XM_RX_CMD, r); | 1634 | xm_write16(hw, port, XM_RX_CMD, r); |
1636 | 1635 | ||
1637 | |||
1638 | /* We want short frames padded to 60 bytes. */ | 1636 | /* We want short frames padded to 60 bytes. */ |
1639 | xm_write16(hw, port, XM_TX_CMD, XM_TX_AUTO_PAD); | 1637 | xm_write16(hw, port, XM_TX_CMD, XM_TX_AUTO_PAD); |
1640 | 1638 | ||
1641 | /* | 1639 | /* Increase threshold for jumbo frames on dual port */ |
1642 | * Bump up the transmit threshold. This helps hold off transmit | 1640 | if (hw->ports > 1 && jumbo) |
1643 | * underruns when we're blasting traffic from both ports at once. | 1641 | xm_write16(hw, port, XM_TX_THR, 1020); |
1644 | */ | 1642 | else |
1645 | xm_write16(hw, port, XM_TX_THR, 512); | 1643 | xm_write16(hw, port, XM_TX_THR, 512); |
1646 | 1644 | ||
1647 | /* | 1645 | /* |
1648 | * Enable the reception of all error frames. This is is | 1646 | * Enable the reception of all error frames. This is is |
@@ -1713,7 +1711,13 @@ static void genesis_stop(struct skge_port *skge) | |||
1713 | { | 1711 | { |
1714 | struct skge_hw *hw = skge->hw; | 1712 | struct skge_hw *hw = skge->hw; |
1715 | int port = skge->port; | 1713 | int port = skge->port; |
1716 | u32 reg; | 1714 | unsigned retries = 1000; |
1715 | u16 cmd; | ||
1716 | |||
1717 | /* Disable Tx and Rx */ | ||
1718 | cmd = xm_read16(hw, port, XM_MMU_CMD); | ||
1719 | cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX); | ||
1720 | xm_write16(hw, port, XM_MMU_CMD, cmd); | ||
1717 | 1721 | ||
1718 | genesis_reset(hw, port); | 1722 | genesis_reset(hw, port); |
1719 | 1723 | ||
@@ -1721,20 +1725,17 @@ static void genesis_stop(struct skge_port *skge) | |||
1721 | skge_write16(hw, B3_PA_CTRL, | 1725 | skge_write16(hw, B3_PA_CTRL, |
1722 | port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); | 1726 | port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); |
1723 | 1727 | ||
1724 | /* | ||
1725 | * If the transfer sticks at the MAC the STOP command will not | ||
1726 | * terminate if we don't flush the XMAC's transmit FIFO ! | ||
1727 | */ | ||
1728 | xm_write32(hw, port, XM_MODE, | ||
1729 | xm_read32(hw, port, XM_MODE)|XM_MD_FTF); | ||
1730 | |||
1731 | |||
1732 | /* Reset the MAC */ | 1728 | /* Reset the MAC */ |
1733 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); | 1729 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST); |
1730 | do { | ||
1731 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); | ||
1732 | if (!(skge_read16(hw, SK_REG(port, TX_MFF_CTRL1)) & MFF_SET_MAC_RST)) | ||
1733 | break; | ||
1734 | } while (--retries > 0); | ||
1734 | 1735 | ||
1735 | /* For external PHYs there must be special handling */ | 1736 | /* For external PHYs there must be special handling */ |
1736 | if (hw->phy_type != SK_PHY_XMAC) { | 1737 | if (hw->phy_type != SK_PHY_XMAC) { |
1737 | reg = skge_read32(hw, B2_GP_IO); | 1738 | u32 reg = skge_read32(hw, B2_GP_IO); |
1738 | if (port == 0) { | 1739 | if (port == 0) { |
1739 | reg |= GP_DIR_0; | 1740 | reg |= GP_DIR_0; |
1740 | reg &= ~GP_IO_0; | 1741 | reg &= ~GP_IO_0; |
@@ -1801,11 +1802,6 @@ static void genesis_mac_intr(struct skge_hw *hw, int port) | |||
1801 | xm_write32(hw, port, XM_MODE, XM_MD_FTF); | 1802 | xm_write32(hw, port, XM_MODE, XM_MD_FTF); |
1802 | ++dev->stats.tx_fifo_errors; | 1803 | ++dev->stats.tx_fifo_errors; |
1803 | } | 1804 | } |
1804 | |||
1805 | if (status & XM_IS_RXF_OV) { | ||
1806 | xm_write32(hw, port, XM_MODE, XM_MD_FRF); | ||
1807 | ++dev->stats.rx_fifo_errors; | ||
1808 | } | ||
1809 | } | 1805 | } |
1810 | 1806 | ||
1811 | static void genesis_link_up(struct skge_port *skge) | 1807 | static void genesis_link_up(struct skge_port *skge) |
@@ -1862,9 +1858,9 @@ static void genesis_link_up(struct skge_port *skge) | |||
1862 | 1858 | ||
1863 | xm_write32(hw, port, XM_MODE, mode); | 1859 | xm_write32(hw, port, XM_MODE, mode); |
1864 | 1860 | ||
1865 | /* Turn on detection of Tx underrun, Rx overrun */ | 1861 | /* Turn on detection of Tx underrun */ |
1866 | msk = xm_read16(hw, port, XM_IMSK); | 1862 | msk = xm_read16(hw, port, XM_IMSK); |
1867 | msk &= ~(XM_IS_RXF_OV | XM_IS_TXF_UR); | 1863 | msk &= ~XM_IS_TXF_UR; |
1868 | xm_write16(hw, port, XM_IMSK, msk); | 1864 | xm_write16(hw, port, XM_IMSK, msk); |
1869 | 1865 | ||
1870 | xm_read16(hw, port, XM_ISRC); | 1866 | xm_read16(hw, port, XM_ISRC); |
@@ -2194,9 +2190,12 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
2194 | TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) | | 2190 | TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) | |
2195 | TX_IPG_JAM_DATA(TX_IPG_JAM_DEF)); | 2191 | TX_IPG_JAM_DATA(TX_IPG_JAM_DEF)); |
2196 | 2192 | ||
2197 | /* serial mode register */ | 2193 | /* configure the Serial Mode Register */ |
2198 | reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); | 2194 | reg = DATA_BLIND_VAL(DATA_BLIND_DEF) |
2199 | if (hw->dev[port]->mtu > 1500) | 2195 | | GM_SMOD_VLAN_ENA |
2196 | | IPG_DATA_VAL(IPG_DATA_DEF); | ||
2197 | |||
2198 | if (hw->dev[port]->mtu > ETH_DATA_LEN) | ||
2200 | reg |= GM_SMOD_JUMBO_ENA; | 2199 | reg |= GM_SMOD_JUMBO_ENA; |
2201 | 2200 | ||
2202 | gma_write16(hw, port, GM_SERIAL_MODE, reg); | 2201 | gma_write16(hw, port, GM_SERIAL_MODE, reg); |
@@ -2619,8 +2618,8 @@ static int skge_up(struct net_device *dev) | |||
2619 | yukon_mac_init(hw, port); | 2618 | yukon_mac_init(hw, port); |
2620 | spin_unlock_bh(&hw->phy_lock); | 2619 | spin_unlock_bh(&hw->phy_lock); |
2621 | 2620 | ||
2622 | /* Configure RAMbuffers */ | 2621 | /* Configure RAMbuffers - equally between ports and tx/rx */ |
2623 | chunk = hw->ram_size / ((hw->ports + 1)*2); | 2622 | chunk = (hw->ram_size - hw->ram_offset) / (hw->ports * 2); |
2624 | ram_addr = hw->ram_offset + 2 * chunk * port; | 2623 | ram_addr = hw->ram_offset + 2 * chunk * port; |
2625 | 2624 | ||
2626 | skge_ramset(hw, rxqaddr[port], ram_addr, chunk); | 2625 | skge_ramset(hw, rxqaddr[port], ram_addr, chunk); |
@@ -2897,11 +2896,7 @@ static void skge_tx_timeout(struct net_device *dev) | |||
2897 | 2896 | ||
2898 | static int skge_change_mtu(struct net_device *dev, int new_mtu) | 2897 | static int skge_change_mtu(struct net_device *dev, int new_mtu) |
2899 | { | 2898 | { |
2900 | struct skge_port *skge = netdev_priv(dev); | ||
2901 | struct skge_hw *hw = skge->hw; | ||
2902 | int port = skge->port; | ||
2903 | int err; | 2899 | int err; |
2904 | u16 ctl, reg; | ||
2905 | 2900 | ||
2906 | if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) | 2901 | if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) |
2907 | return -EINVAL; | 2902 | return -EINVAL; |
@@ -2911,40 +2906,13 @@ static int skge_change_mtu(struct net_device *dev, int new_mtu) | |||
2911 | return 0; | 2906 | return 0; |
2912 | } | 2907 | } |
2913 | 2908 | ||
2914 | skge_write32(hw, B0_IMSK, 0); | 2909 | skge_down(dev); |
2915 | dev->trans_start = jiffies; /* prevent tx timeout */ | ||
2916 | netif_stop_queue(dev); | ||
2917 | napi_disable(&skge->napi); | ||
2918 | |||
2919 | ctl = gma_read16(hw, port, GM_GP_CTRL); | ||
2920 | gma_write16(hw, port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA); | ||
2921 | |||
2922 | skge_rx_clean(skge); | ||
2923 | skge_rx_stop(hw, port); | ||
2924 | 2910 | ||
2925 | dev->mtu = new_mtu; | 2911 | dev->mtu = new_mtu; |
2926 | 2912 | ||
2927 | reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); | 2913 | err = skge_up(dev); |
2928 | if (new_mtu > 1500) | ||
2929 | reg |= GM_SMOD_JUMBO_ENA; | ||
2930 | gma_write16(hw, port, GM_SERIAL_MODE, reg); | ||
2931 | |||
2932 | skge_write8(hw, RB_ADDR(rxqaddr[port], RB_CTRL), RB_ENA_OP_MD); | ||
2933 | |||
2934 | err = skge_rx_fill(dev); | ||
2935 | wmb(); | ||
2936 | if (!err) | ||
2937 | skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); | ||
2938 | skge_write32(hw, B0_IMSK, hw->intr_mask); | ||
2939 | |||
2940 | if (err) | 2914 | if (err) |
2941 | dev_close(dev); | 2915 | dev_close(dev); |
2942 | else { | ||
2943 | gma_write16(hw, port, GM_GP_CTRL, ctl); | ||
2944 | |||
2945 | napi_enable(&skge->napi); | ||
2946 | netif_wake_queue(dev); | ||
2947 | } | ||
2948 | 2916 | ||
2949 | return err; | 2917 | return err; |
2950 | } | 2918 | } |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index a2070db725c9..6197afb3ed83 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/etherdevice.h> | 31 | #include <linux/etherdevice.h> |
32 | #include <linux/ethtool.h> | 32 | #include <linux/ethtool.h> |
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/aer.h> | ||
35 | #include <linux/ip.h> | 34 | #include <linux/ip.h> |
36 | #include <net/ip.h> | 35 | #include <net/ip.h> |
37 | #include <linux/tcp.h> | 36 | #include <linux/tcp.h> |
@@ -240,22 +239,21 @@ static void sky2_power_on(struct sky2_hw *hw) | |||
240 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); | 239 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); |
241 | 240 | ||
242 | if (hw->flags & SKY2_HW_ADV_POWER_CTL) { | 241 | if (hw->flags & SKY2_HW_ADV_POWER_CTL) { |
243 | struct pci_dev *pdev = hw->pdev; | ||
244 | u32 reg; | 242 | u32 reg; |
245 | 243 | ||
246 | pci_write_config_dword(pdev, PCI_DEV_REG3, 0); | 244 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); |
247 | 245 | ||
248 | pci_read_config_dword(pdev, PCI_DEV_REG4, ®); | 246 | reg = sky2_pci_read32(hw, PCI_DEV_REG4); |
249 | /* set all bits to 0 except bits 15..12 and 8 */ | 247 | /* set all bits to 0 except bits 15..12 and 8 */ |
250 | reg &= P_ASPM_CONTROL_MSK; | 248 | reg &= P_ASPM_CONTROL_MSK; |
251 | pci_write_config_dword(pdev, PCI_DEV_REG4, reg); | 249 | sky2_pci_write32(hw, PCI_DEV_REG4, reg); |
252 | 250 | ||
253 | pci_read_config_dword(pdev, PCI_DEV_REG5, ®); | 251 | reg = sky2_pci_read32(hw, PCI_DEV_REG5); |
254 | /* set all bits to 0 except bits 28 & 27 */ | 252 | /* set all bits to 0 except bits 28 & 27 */ |
255 | reg &= P_CTL_TIM_VMAIN_AV_MSK; | 253 | reg &= P_CTL_TIM_VMAIN_AV_MSK; |
256 | pci_write_config_dword(pdev, PCI_DEV_REG5, reg); | 254 | sky2_pci_write32(hw, PCI_DEV_REG5, reg); |
257 | 255 | ||
258 | pci_write_config_dword(pdev, PCI_CFG_REG_1, 0); | 256 | sky2_pci_write32(hw, PCI_CFG_REG_1, 0); |
259 | 257 | ||
260 | /* Enable workaround for dev 4.107 on Yukon-Ultra & Extreme */ | 258 | /* Enable workaround for dev 4.107 on Yukon-Ultra & Extreme */ |
261 | reg = sky2_read32(hw, B2_GP_IO); | 259 | reg = sky2_read32(hw, B2_GP_IO); |
@@ -619,12 +617,11 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
619 | 617 | ||
620 | static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) | 618 | static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) |
621 | { | 619 | { |
622 | struct pci_dev *pdev = hw->pdev; | ||
623 | u32 reg1; | 620 | u32 reg1; |
624 | static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD }; | 621 | static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD }; |
625 | static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA }; | 622 | static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA }; |
626 | 623 | ||
627 | pci_read_config_dword(pdev, PCI_DEV_REG1, ®1); | 624 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
628 | /* Turn on/off phy power saving */ | 625 | /* Turn on/off phy power saving */ |
629 | if (onoff) | 626 | if (onoff) |
630 | reg1 &= ~phy_power[port]; | 627 | reg1 &= ~phy_power[port]; |
@@ -634,8 +631,8 @@ static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) | |||
634 | if (onoff && hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) | 631 | if (onoff && hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) |
635 | reg1 |= coma_mode[port]; | 632 | reg1 |= coma_mode[port]; |
636 | 633 | ||
637 | pci_write_config_dword(pdev, PCI_DEV_REG1, reg1); | 634 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
638 | pci_read_config_dword(pdev, PCI_DEV_REG1, ®1); | 635 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
639 | 636 | ||
640 | udelay(100); | 637 | udelay(100); |
641 | } | 638 | } |
@@ -704,9 +701,9 @@ static void sky2_wol_init(struct sky2_port *sky2) | |||
704 | sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl); | 701 | sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl); |
705 | 702 | ||
706 | /* Turn on legacy PCI-Express PME mode */ | 703 | /* Turn on legacy PCI-Express PME mode */ |
707 | pci_read_config_dword(hw->pdev, PCI_DEV_REG1, ®1); | 704 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
708 | reg1 |= PCI_Y2_PME_LEGACY; | 705 | reg1 |= PCI_Y2_PME_LEGACY; |
709 | pci_write_config_dword(hw->pdev, PCI_DEV_REG1, reg1); | 706 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
710 | 707 | ||
711 | /* block receiver */ | 708 | /* block receiver */ |
712 | sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); | 709 | sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); |
@@ -848,6 +845,13 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) | |||
848 | sky2_set_tx_stfwd(hw, port); | 845 | sky2_set_tx_stfwd(hw, port); |
849 | } | 846 | } |
850 | 847 | ||
848 | if (hw->chip_id == CHIP_ID_YUKON_FE_P && | ||
849 | hw->chip_rev == CHIP_REV_YU_FE2_A0) { | ||
850 | /* disable dynamic watermark */ | ||
851 | reg = sky2_read16(hw, SK_REG(port, TX_GMF_EA)); | ||
852 | reg &= ~TX_DYN_WM_ENA; | ||
853 | sky2_write16(hw, SK_REG(port, TX_GMF_EA), reg); | ||
854 | } | ||
851 | } | 855 | } |
852 | 856 | ||
853 | /* Assign Ram Buffer allocation to queue */ | 857 | /* Assign Ram Buffer allocation to queue */ |
@@ -1320,15 +1324,12 @@ static int sky2_up(struct net_device *dev) | |||
1320 | */ | 1324 | */ |
1321 | if (otherdev && netif_running(otherdev) && | 1325 | if (otherdev && netif_running(otherdev) && |
1322 | (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) { | 1326 | (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) { |
1323 | struct sky2_port *osky2 = netdev_priv(otherdev); | ||
1324 | u16 cmd; | 1327 | u16 cmd; |
1325 | 1328 | ||
1326 | pci_read_config_word(hw->pdev, cap + PCI_X_CMD, &cmd); | 1329 | cmd = sky2_pci_read16(hw, cap + PCI_X_CMD); |
1327 | cmd &= ~PCI_X_CMD_MAX_SPLIT; | 1330 | cmd &= ~PCI_X_CMD_MAX_SPLIT; |
1328 | pci_write_config_word(hw->pdev, cap + PCI_X_CMD, cmd); | 1331 | sky2_pci_write16(hw, cap + PCI_X_CMD, cmd); |
1329 | 1332 | ||
1330 | sky2->rx_csum = 0; | ||
1331 | osky2->rx_csum = 0; | ||
1332 | } | 1333 | } |
1333 | 1334 | ||
1334 | if (netif_msg_ifup(sky2)) | 1335 | if (netif_msg_ifup(sky2)) |
@@ -2426,37 +2427,26 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2426 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { | 2427 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { |
2427 | u16 pci_err; | 2428 | u16 pci_err; |
2428 | 2429 | ||
2429 | pci_read_config_word(pdev, PCI_STATUS, &pci_err); | 2430 | pci_err = sky2_pci_read16(hw, PCI_STATUS); |
2430 | if (net_ratelimit()) | 2431 | if (net_ratelimit()) |
2431 | dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", | 2432 | dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", |
2432 | pci_err); | 2433 | pci_err); |
2433 | 2434 | ||
2434 | pci_write_config_word(pdev, PCI_STATUS, | 2435 | sky2_pci_write16(hw, PCI_STATUS, |
2435 | pci_err | PCI_STATUS_ERROR_BITS); | 2436 | pci_err | PCI_STATUS_ERROR_BITS); |
2436 | } | 2437 | } |
2437 | 2438 | ||
2438 | if (status & Y2_IS_PCI_EXP) { | 2439 | if (status & Y2_IS_PCI_EXP) { |
2439 | /* PCI-Express uncorrectable Error occurred */ | 2440 | /* PCI-Express uncorrectable Error occurred */ |
2440 | int aer = pci_find_aer_capability(hw->pdev); | ||
2441 | u32 err; | 2441 | u32 err; |
2442 | 2442 | ||
2443 | if (aer) { | 2443 | err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); |
2444 | pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_STATUS, | 2444 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, |
2445 | &err); | 2445 | 0xfffffffful); |
2446 | pci_cleanup_aer_uncorrect_error_status(pdev); | ||
2447 | } else { | ||
2448 | /* Either AER not configured, or not working | ||
2449 | * because of bad MMCONFIG, so just do recover | ||
2450 | * manually. | ||
2451 | */ | ||
2452 | err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); | ||
2453 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, | ||
2454 | 0xfffffffful); | ||
2455 | } | ||
2456 | |||
2457 | if (net_ratelimit()) | 2446 | if (net_ratelimit()) |
2458 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); | 2447 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); |
2459 | 2448 | ||
2449 | sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); | ||
2460 | } | 2450 | } |
2461 | 2451 | ||
2462 | if (status & Y2_HWE_L1_MASK) | 2452 | if (status & Y2_HWE_L1_MASK) |
@@ -2703,13 +2693,10 @@ static inline u32 sky2_clk2us(const struct sky2_hw *hw, u32 clk) | |||
2703 | 2693 | ||
2704 | static int __devinit sky2_init(struct sky2_hw *hw) | 2694 | static int __devinit sky2_init(struct sky2_hw *hw) |
2705 | { | 2695 | { |
2706 | int rc; | ||
2707 | u8 t8; | 2696 | u8 t8; |
2708 | 2697 | ||
2709 | /* Enable all clocks and check for bad PCI access */ | 2698 | /* Enable all clocks and check for bad PCI access */ |
2710 | rc = pci_write_config_dword(hw->pdev, PCI_DEV_REG3, 0); | 2699 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); |
2711 | if (rc) | ||
2712 | return rc; | ||
2713 | 2700 | ||
2714 | sky2_write8(hw, B0_CTST, CS_RST_CLR); | 2701 | sky2_write8(hw, B0_CTST, CS_RST_CLR); |
2715 | 2702 | ||
@@ -2806,32 +2793,21 @@ static void sky2_reset(struct sky2_hw *hw) | |||
2806 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 2793 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
2807 | 2794 | ||
2808 | /* clear PCI errors, if any */ | 2795 | /* clear PCI errors, if any */ |
2809 | pci_read_config_word(pdev, PCI_STATUS, &status); | 2796 | status = sky2_pci_read16(hw, PCI_STATUS); |
2810 | status |= PCI_STATUS_ERROR_BITS; | 2797 | status |= PCI_STATUS_ERROR_BITS; |
2811 | pci_write_config_word(pdev, PCI_STATUS, status); | 2798 | sky2_pci_write16(hw, PCI_STATUS, status); |
2812 | 2799 | ||
2813 | sky2_write8(hw, B0_CTST, CS_MRST_CLR); | 2800 | sky2_write8(hw, B0_CTST, CS_MRST_CLR); |
2814 | 2801 | ||
2815 | cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 2802 | cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); |
2816 | if (cap) { | 2803 | if (cap) { |
2817 | if (pci_find_aer_capability(pdev)) { | 2804 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, |
2818 | /* Check for advanced error reporting */ | 2805 | 0xfffffffful); |
2819 | pci_cleanup_aer_uncorrect_error_status(pdev); | ||
2820 | pci_cleanup_aer_correct_error_status(pdev); | ||
2821 | } else { | ||
2822 | dev_warn(&pdev->dev, | ||
2823 | "PCI Express Advanced Error Reporting" | ||
2824 | " not configured or MMCONFIG problem?\n"); | ||
2825 | |||
2826 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, | ||
2827 | 0xfffffffful); | ||
2828 | } | ||
2829 | 2806 | ||
2830 | /* If error bit is stuck on ignore it */ | 2807 | /* If error bit is stuck on ignore it */ |
2831 | if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP) | 2808 | if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP) |
2832 | dev_info(&pdev->dev, "ignoring stuck error report bit\n"); | 2809 | dev_info(&pdev->dev, "ignoring stuck error report bit\n"); |
2833 | 2810 | else | |
2834 | else if (pci_enable_pcie_error_reporting(pdev)) | ||
2835 | hwe_mask |= Y2_IS_PCI_EXP; | 2811 | hwe_mask |= Y2_IS_PCI_EXP; |
2836 | } | 2812 | } |
2837 | 2813 | ||
@@ -2930,16 +2906,14 @@ static void sky2_restart(struct work_struct *work) | |||
2930 | int i, err; | 2906 | int i, err; |
2931 | 2907 | ||
2932 | rtnl_lock(); | 2908 | rtnl_lock(); |
2933 | sky2_write32(hw, B0_IMSK, 0); | ||
2934 | sky2_read32(hw, B0_IMSK); | ||
2935 | napi_disable(&hw->napi); | ||
2936 | |||
2937 | for (i = 0; i < hw->ports; i++) { | 2909 | for (i = 0; i < hw->ports; i++) { |
2938 | dev = hw->dev[i]; | 2910 | dev = hw->dev[i]; |
2939 | if (netif_running(dev)) | 2911 | if (netif_running(dev)) |
2940 | sky2_down(dev); | 2912 | sky2_down(dev); |
2941 | } | 2913 | } |
2942 | 2914 | ||
2915 | napi_disable(&hw->napi); | ||
2916 | sky2_write32(hw, B0_IMSK, 0); | ||
2943 | sky2_reset(hw); | 2917 | sky2_reset(hw); |
2944 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); | 2918 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); |
2945 | napi_enable(&hw->napi); | 2919 | napi_enable(&hw->napi); |
@@ -3672,32 +3646,33 @@ static int sky2_set_tso(struct net_device *dev, u32 data) | |||
3672 | static int sky2_get_eeprom_len(struct net_device *dev) | 3646 | static int sky2_get_eeprom_len(struct net_device *dev) |
3673 | { | 3647 | { |
3674 | struct sky2_port *sky2 = netdev_priv(dev); | 3648 | struct sky2_port *sky2 = netdev_priv(dev); |
3649 | struct sky2_hw *hw = sky2->hw; | ||
3675 | u16 reg2; | 3650 | u16 reg2; |
3676 | 3651 | ||
3677 | pci_read_config_word(sky2->hw->pdev, PCI_DEV_REG2, ®2); | 3652 | reg2 = sky2_pci_read16(hw, PCI_DEV_REG2); |
3678 | return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8); | 3653 | return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8); |
3679 | } | 3654 | } |
3680 | 3655 | ||
3681 | static u32 sky2_vpd_read(struct pci_dev *pdev, int cap, u16 offset) | 3656 | static u32 sky2_vpd_read(struct sky2_hw *hw, int cap, u16 offset) |
3682 | { | 3657 | { |
3683 | u32 val; | 3658 | u32 val; |
3684 | 3659 | ||
3685 | pci_write_config_word(pdev, cap + PCI_VPD_ADDR, offset); | 3660 | sky2_pci_write16(hw, cap + PCI_VPD_ADDR, offset); |
3686 | 3661 | ||
3687 | do { | 3662 | do { |
3688 | pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset); | 3663 | offset = sky2_pci_read16(hw, cap + PCI_VPD_ADDR); |
3689 | } while (!(offset & PCI_VPD_ADDR_F)); | 3664 | } while (!(offset & PCI_VPD_ADDR_F)); |
3690 | 3665 | ||
3691 | pci_read_config_dword(pdev, cap + PCI_VPD_DATA, &val); | 3666 | val = sky2_pci_read32(hw, cap + PCI_VPD_DATA); |
3692 | return val; | 3667 | return val; |
3693 | } | 3668 | } |
3694 | 3669 | ||
3695 | static void sky2_vpd_write(struct pci_dev *pdev, int cap, u16 offset, u32 val) | 3670 | static void sky2_vpd_write(struct sky2_hw *hw, int cap, u16 offset, u32 val) |
3696 | { | 3671 | { |
3697 | pci_write_config_word(pdev, cap + PCI_VPD_DATA, val); | 3672 | sky2_pci_write16(hw, cap + PCI_VPD_DATA, val); |
3698 | pci_write_config_dword(pdev, cap + PCI_VPD_ADDR, offset | PCI_VPD_ADDR_F); | 3673 | sky2_pci_write32(hw, cap + PCI_VPD_ADDR, offset | PCI_VPD_ADDR_F); |
3699 | do { | 3674 | do { |
3700 | pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset); | 3675 | offset = sky2_pci_read16(hw, cap + PCI_VPD_ADDR); |
3701 | } while (offset & PCI_VPD_ADDR_F); | 3676 | } while (offset & PCI_VPD_ADDR_F); |
3702 | } | 3677 | } |
3703 | 3678 | ||
@@ -3715,7 +3690,7 @@ static int sky2_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom | |||
3715 | eeprom->magic = SKY2_EEPROM_MAGIC; | 3690 | eeprom->magic = SKY2_EEPROM_MAGIC; |
3716 | 3691 | ||
3717 | while (length > 0) { | 3692 | while (length > 0) { |
3718 | u32 val = sky2_vpd_read(sky2->hw->pdev, cap, offset); | 3693 | u32 val = sky2_vpd_read(sky2->hw, cap, offset); |
3719 | int n = min_t(int, length, sizeof(val)); | 3694 | int n = min_t(int, length, sizeof(val)); |
3720 | 3695 | ||
3721 | memcpy(data, &val, n); | 3696 | memcpy(data, &val, n); |
@@ -3745,10 +3720,10 @@ static int sky2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom | |||
3745 | int n = min_t(int, length, sizeof(val)); | 3720 | int n = min_t(int, length, sizeof(val)); |
3746 | 3721 | ||
3747 | if (n < sizeof(val)) | 3722 | if (n < sizeof(val)) |
3748 | val = sky2_vpd_read(sky2->hw->pdev, cap, offset); | 3723 | val = sky2_vpd_read(sky2->hw, cap, offset); |
3749 | memcpy(&val, data, n); | 3724 | memcpy(&val, data, n); |
3750 | 3725 | ||
3751 | sky2_vpd_write(sky2->hw->pdev, cap, offset, val); | 3726 | sky2_vpd_write(sky2->hw, cap, offset, val); |
3752 | 3727 | ||
3753 | length -= n; | 3728 | length -= n; |
3754 | data += n; | 3729 | data += n; |
@@ -4013,7 +3988,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | |||
4013 | sky2->duplex = -1; | 3988 | sky2->duplex = -1; |
4014 | sky2->speed = -1; | 3989 | sky2->speed = -1; |
4015 | sky2->advertising = sky2_supported_modes(hw); | 3990 | sky2->advertising = sky2_supported_modes(hw); |
4016 | sky2->rx_csum = 1; | 3991 | sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL); |
4017 | sky2->wol = wol; | 3992 | sky2->wol = wol; |
4018 | 3993 | ||
4019 | spin_lock_init(&sky2->phy_lock); | 3994 | spin_lock_init(&sky2->phy_lock); |
@@ -4184,9 +4159,9 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4184 | */ | 4159 | */ |
4185 | { | 4160 | { |
4186 | u32 reg; | 4161 | u32 reg; |
4187 | pci_read_config_dword(pdev,PCI_DEV_REG2, ®); | 4162 | reg = sky2_pci_read32(hw, PCI_DEV_REG2); |
4188 | reg &= ~PCI_REV_DESC; | 4163 | reg &= ~PCI_REV_DESC; |
4189 | pci_write_config_dword(pdev, PCI_DEV_REG2, reg); | 4164 | sky2_pci_write32(hw, PCI_DEV_REG2, reg); |
4190 | } | 4165 | } |
4191 | #endif | 4166 | #endif |
4192 | 4167 | ||
@@ -4377,7 +4352,7 @@ static int sky2_resume(struct pci_dev *pdev) | |||
4377 | if (hw->chip_id == CHIP_ID_YUKON_EX || | 4352 | if (hw->chip_id == CHIP_ID_YUKON_EX || |
4378 | hw->chip_id == CHIP_ID_YUKON_EC_U || | 4353 | hw->chip_id == CHIP_ID_YUKON_EC_U || |
4379 | hw->chip_id == CHIP_ID_YUKON_FE_P) | 4354 | hw->chip_id == CHIP_ID_YUKON_FE_P) |
4380 | pci_write_config_dword(pdev, PCI_DEV_REG3, 0); | 4355 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); |
4381 | 4356 | ||
4382 | sky2_reset(hw); | 4357 | sky2_reset(hw); |
4383 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); | 4358 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 69525fd7908d..bc646a47edd2 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -2128,4 +2128,25 @@ static inline void gma_set_addr(struct sky2_hw *hw, unsigned port, unsigned reg, | |||
2128 | gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8)); | 2128 | gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8)); |
2129 | gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8)); | 2129 | gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8)); |
2130 | } | 2130 | } |
2131 | |||
2132 | /* PCI config space access */ | ||
2133 | static inline u32 sky2_pci_read32(const struct sky2_hw *hw, unsigned reg) | ||
2134 | { | ||
2135 | return sky2_read32(hw, Y2_CFG_SPC + reg); | ||
2136 | } | ||
2137 | |||
2138 | static inline u16 sky2_pci_read16(const struct sky2_hw *hw, unsigned reg) | ||
2139 | { | ||
2140 | return sky2_read16(hw, Y2_CFG_SPC + reg); | ||
2141 | } | ||
2142 | |||
2143 | static inline void sky2_pci_write32(struct sky2_hw *hw, unsigned reg, u32 val) | ||
2144 | { | ||
2145 | sky2_write32(hw, Y2_CFG_SPC + reg, val); | ||
2146 | } | ||
2147 | |||
2148 | static inline void sky2_pci_write16(struct sky2_hw *hw, unsigned reg, u16 val) | ||
2149 | { | ||
2150 | sky2_write16(hw, Y2_CFG_SPC + reg, val); | ||
2151 | } | ||
2131 | #endif | 2152 | #endif |
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index dd18af0ce676..76cc1d3adf71 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c | |||
@@ -428,7 +428,6 @@ static inline void smc911x_drop_pkt(struct net_device *dev) | |||
428 | */ | 428 | */ |
429 | static inline void smc911x_rcv(struct net_device *dev) | 429 | static inline void smc911x_rcv(struct net_device *dev) |
430 | { | 430 | { |
431 | struct smc911x_local *lp = netdev_priv(dev); | ||
432 | unsigned long ioaddr = dev->base_addr; | 431 | unsigned long ioaddr = dev->base_addr; |
433 | unsigned int pkt_len, status; | 432 | unsigned int pkt_len, status; |
434 | struct sk_buff *skb; | 433 | struct sk_buff *skb; |
@@ -473,6 +472,7 @@ static inline void smc911x_rcv(struct net_device *dev) | |||
473 | skb_put(skb,pkt_len-4); | 472 | skb_put(skb,pkt_len-4); |
474 | #ifdef SMC_USE_DMA | 473 | #ifdef SMC_USE_DMA |
475 | { | 474 | { |
475 | struct smc911x_local *lp = netdev_priv(dev); | ||
476 | unsigned int fifo; | 476 | unsigned int fifo; |
477 | /* Lower the FIFO threshold if possible */ | 477 | /* Lower the FIFO threshold if possible */ |
478 | fifo = SMC_GET_FIFO_INT(); | 478 | fifo = SMC_GET_FIFO_INT(); |
@@ -1299,9 +1299,9 @@ smc911x_rx_dma_irq(int dma, void *data) | |||
1299 | PRINT_PKT(skb->data, skb->len); | 1299 | PRINT_PKT(skb->data, skb->len); |
1300 | dev->last_rx = jiffies; | 1300 | dev->last_rx = jiffies; |
1301 | skb->protocol = eth_type_trans(skb, dev); | 1301 | skb->protocol = eth_type_trans(skb, dev); |
1302 | netif_rx(skb); | ||
1303 | dev->stats.rx_packets++; | 1302 | dev->stats.rx_packets++; |
1304 | dev->stats.rx_bytes += skb->len; | 1303 | dev->stats.rx_bytes += skb->len; |
1304 | netif_rx(skb); | ||
1305 | 1305 | ||
1306 | spin_lock_irqsave(&lp->lock, flags); | 1306 | spin_lock_irqsave(&lp->lock, flags); |
1307 | pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16; | 1307 | pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16; |
@@ -1379,13 +1379,6 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
1379 | unsigned int multicast_table[2]; | 1379 | unsigned int multicast_table[2]; |
1380 | unsigned int mcr, update_multicast = 0; | 1380 | unsigned int mcr, update_multicast = 0; |
1381 | unsigned long flags; | 1381 | unsigned long flags; |
1382 | /* table for flipping the order of 5 bits */ | ||
1383 | static const unsigned char invert5[] = | ||
1384 | {0x00, 0x10, 0x08, 0x18, 0x04, 0x14, 0x0C, 0x1C, | ||
1385 | 0x02, 0x12, 0x0A, 0x1A, 0x06, 0x16, 0x0E, 0x1E, | ||
1386 | 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0D, 0x1D, | ||
1387 | 0x03, 0x13, 0x0B, 0x1B, 0x07, 0x17, 0x0F, 0x1F}; | ||
1388 | |||
1389 | 1382 | ||
1390 | DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__); | 1383 | DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__); |
1391 | 1384 | ||
@@ -1432,7 +1425,7 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
1432 | 1425 | ||
1433 | cur_addr = dev->mc_list; | 1426 | cur_addr = dev->mc_list; |
1434 | for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) { | 1427 | for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) { |
1435 | int position; | 1428 | u32 position; |
1436 | 1429 | ||
1437 | /* do we have a pointer here? */ | 1430 | /* do we have a pointer here? */ |
1438 | if (!cur_addr) | 1431 | if (!cur_addr) |
@@ -1442,12 +1435,10 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
1442 | if (!(*cur_addr->dmi_addr & 1)) | 1435 | if (!(*cur_addr->dmi_addr & 1)) |
1443 | continue; | 1436 | continue; |
1444 | 1437 | ||
1445 | /* only use the low order bits */ | 1438 | /* upper 6 bits are used as hash index */ |
1446 | position = crc32_le(~0, cur_addr->dmi_addr, 6) & 0x3f; | 1439 | position = ether_crc(ETH_ALEN, cur_addr->dmi_addr)>>26; |
1447 | 1440 | ||
1448 | /* do some messy swapping to put the bit in the right spot */ | 1441 | multicast_table[position>>5] |= 1 << (position&0x1f); |
1449 | multicast_table[invert5[position&0x1F]&0x1] |= | ||
1450 | (1<<invert5[(position>>1)&0x1F]); | ||
1451 | } | 1442 | } |
1452 | 1443 | ||
1453 | /* be sure I get rid of flags I might have set */ | 1444 | /* be sure I get rid of flags I might have set */ |
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h index 16a0edc078fd..d04e4fa35206 100644 --- a/drivers/net/smc911x.h +++ b/drivers/net/smc911x.h | |||
@@ -37,7 +37,7 @@ | |||
37 | #define SMC_USE_16BIT 0 | 37 | #define SMC_USE_16BIT 0 |
38 | #define SMC_USE_32BIT 1 | 38 | #define SMC_USE_32BIT 1 |
39 | #define SMC_IRQ_SENSE IRQF_TRIGGER_FALLING | 39 | #define SMC_IRQ_SENSE IRQF_TRIGGER_FALLING |
40 | #elif CONFIG_SH_MAGIC_PANEL_R2 | 40 | #elif defined(CONFIG_SH_MAGIC_PANEL_R2) |
41 | #define SMC_USE_SH_DMA 0 | 41 | #define SMC_USE_SH_DMA 0 |
42 | #define SMC_USE_16BIT 0 | 42 | #define SMC_USE_16BIT 0 |
43 | #define SMC_USE_32BIT 1 | 43 | #define SMC_USE_32BIT 1 |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index db34e1eb67e9..07b7f7120e37 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -55,7 +55,7 @@ | |||
55 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | 55 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) |
56 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | 56 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) |
57 | 57 | ||
58 | #elif defined(CONFIG_BFIN) | 58 | #elif defined(CONFIG_BLACKFIN) |
59 | 59 | ||
60 | #define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH | 60 | #define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH |
61 | #define RPC_LSA_DEFAULT RPC_LED_100_10 | 61 | #define RPC_LSA_DEFAULT RPC_LED_100_10 |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index f6fedcc32de1..68872142530b 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -2281,14 +2281,12 @@ static void gem_reset_task(struct work_struct *work) | |||
2281 | 2281 | ||
2282 | mutex_lock(&gp->pm_mutex); | 2282 | mutex_lock(&gp->pm_mutex); |
2283 | 2283 | ||
2284 | napi_disable(&gp->napi); | 2284 | if (gp->opened) |
2285 | napi_disable(&gp->napi); | ||
2285 | 2286 | ||
2286 | spin_lock_irq(&gp->lock); | 2287 | spin_lock_irq(&gp->lock); |
2287 | spin_lock(&gp->tx_lock); | 2288 | spin_lock(&gp->tx_lock); |
2288 | 2289 | ||
2289 | if (gp->running == 0) | ||
2290 | goto not_running; | ||
2291 | |||
2292 | if (gp->running) { | 2290 | if (gp->running) { |
2293 | netif_stop_queue(gp->dev); | 2291 | netif_stop_queue(gp->dev); |
2294 | 2292 | ||
@@ -2298,13 +2296,14 @@ static void gem_reset_task(struct work_struct *work) | |||
2298 | gem_set_link_modes(gp); | 2296 | gem_set_link_modes(gp); |
2299 | netif_wake_queue(gp->dev); | 2297 | netif_wake_queue(gp->dev); |
2300 | } | 2298 | } |
2301 | not_running: | 2299 | |
2302 | gp->reset_task_pending = 0; | 2300 | gp->reset_task_pending = 0; |
2303 | 2301 | ||
2304 | spin_unlock(&gp->tx_lock); | 2302 | spin_unlock(&gp->tx_lock); |
2305 | spin_unlock_irq(&gp->lock); | 2303 | spin_unlock_irq(&gp->lock); |
2306 | 2304 | ||
2307 | napi_enable(&gp->napi); | 2305 | if (gp->opened) |
2306 | napi_enable(&gp->napi); | ||
2308 | 2307 | ||
2309 | mutex_unlock(&gp->pm_mutex); | 2308 | mutex_unlock(&gp->pm_mutex); |
2310 | } | 2309 | } |
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index ca90566d5bcd..b4891caeae5a 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -2118,8 +2118,8 @@ static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
2118 | pci_enable_wake(pci_dev, PCI_D3cold, 1); | 2118 | pci_enable_wake(pci_dev, PCI_D3cold, 1); |
2119 | 2119 | ||
2120 | /* Power down device*/ | 2120 | /* Power down device*/ |
2121 | pci_set_power_state(pci_dev, pci_choose_state (pci_dev,state)); | ||
2122 | pci_save_state(pci_dev); | 2121 | pci_save_state(pci_dev); |
2122 | pci_set_power_state(pci_dev, pci_choose_state (pci_dev, state)); | ||
2123 | 2123 | ||
2124 | return 0; | 2124 | return 0; |
2125 | } | 2125 | } |
@@ -2129,8 +2129,8 @@ static int dmfe_resume(struct pci_dev *pci_dev) | |||
2129 | struct net_device *dev = pci_get_drvdata(pci_dev); | 2129 | struct net_device *dev = pci_get_drvdata(pci_dev); |
2130 | u32 tmp; | 2130 | u32 tmp; |
2131 | 2131 | ||
2132 | pci_restore_state(pci_dev); | ||
2133 | pci_set_power_state(pci_dev, PCI_D0); | 2132 | pci_set_power_state(pci_dev, PCI_D0); |
2133 | pci_restore_state(pci_dev); | ||
2134 | 2134 | ||
2135 | /* Re-initilize DM910X board */ | 2135 | /* Re-initilize DM910X board */ |
2136 | dmfe_init_dm910x(dev); | 2136 | dmfe_init_dm910x(dev); |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index a3ff270593f1..7f689907ac28 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -1460,6 +1460,8 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth) | |||
1460 | if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || | 1460 | if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || |
1461 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || | 1461 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || |
1462 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || | 1462 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || |
1463 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) || | ||
1464 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) || | ||
1463 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { | 1465 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { |
1464 | upsmr |= UPSMR_RPM; | 1466 | upsmr |= UPSMR_RPM; |
1465 | switch (ugeth->max_speed) { | 1467 | switch (ugeth->max_speed) { |
@@ -1557,6 +1559,8 @@ static void adjust_link(struct net_device *dev) | |||
1557 | if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || | 1559 | if ((ugeth->phy_interface == PHY_INTERFACE_MODE_RMII) || |
1558 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || | 1560 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII) || |
1559 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || | 1561 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) || |
1562 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) || | ||
1563 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) || | ||
1560 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { | 1564 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { |
1561 | if (phydev->speed == SPEED_10) | 1565 | if (phydev->speed == SPEED_10) |
1562 | upsmr |= UPSMR_R10M; | 1566 | upsmr |= UPSMR_R10M; |
@@ -3795,6 +3799,10 @@ static phy_interface_t to_phy_interface(const char *phy_connection_type) | |||
3795 | return PHY_INTERFACE_MODE_RGMII; | 3799 | return PHY_INTERFACE_MODE_RGMII; |
3796 | if (strcasecmp(phy_connection_type, "rgmii-id") == 0) | 3800 | if (strcasecmp(phy_connection_type, "rgmii-id") == 0) |
3797 | return PHY_INTERFACE_MODE_RGMII_ID; | 3801 | return PHY_INTERFACE_MODE_RGMII_ID; |
3802 | if (strcasecmp(phy_connection_type, "rgmii-txid") == 0) | ||
3803 | return PHY_INTERFACE_MODE_RGMII_TXID; | ||
3804 | if (strcasecmp(phy_connection_type, "rgmii-rxid") == 0) | ||
3805 | return PHY_INTERFACE_MODE_RGMII_RXID; | ||
3798 | if (strcasecmp(phy_connection_type, "rtbi") == 0) | 3806 | if (strcasecmp(phy_connection_type, "rtbi") == 0) |
3799 | return PHY_INTERFACE_MODE_RTBI; | 3807 | return PHY_INTERFACE_MODE_RTBI; |
3800 | 3808 | ||
@@ -3889,6 +3897,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3889 | case PHY_INTERFACE_MODE_GMII: | 3897 | case PHY_INTERFACE_MODE_GMII: |
3890 | case PHY_INTERFACE_MODE_RGMII: | 3898 | case PHY_INTERFACE_MODE_RGMII: |
3891 | case PHY_INTERFACE_MODE_RGMII_ID: | 3899 | case PHY_INTERFACE_MODE_RGMII_ID: |
3900 | case PHY_INTERFACE_MODE_RGMII_RXID: | ||
3901 | case PHY_INTERFACE_MODE_RGMII_TXID: | ||
3892 | case PHY_INTERFACE_MODE_TBI: | 3902 | case PHY_INTERFACE_MODE_TBI: |
3893 | case PHY_INTERFACE_MODE_RTBI: | 3903 | case PHY_INTERFACE_MODE_RTBI: |
3894 | max_speed = SPEED_1000; | 3904 | max_speed = SPEED_1000; |
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 2c685734b7a4..1ffdd106f4c4 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
@@ -94,7 +94,7 @@ static void dm_write_async_callback(struct urb *urb) | |||
94 | struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; | 94 | struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; |
95 | 95 | ||
96 | if (urb->status < 0) | 96 | if (urb->status < 0) |
97 | printk(KERN_DEBUG "dm_write_async_callback() failed with %d", | 97 | printk(KERN_DEBUG "dm_write_async_callback() failed with %d\n", |
98 | urb->status); | 98 | urb->status); |
99 | 99 | ||
100 | kfree(req); | 100 | kfree(req); |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 450e29d7a9f3..35cd65d6b9ed 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -1242,6 +1242,9 @@ static int velocity_rx_refill(struct velocity_info *vptr) | |||
1242 | static int velocity_init_rd_ring(struct velocity_info *vptr) | 1242 | static int velocity_init_rd_ring(struct velocity_info *vptr) |
1243 | { | 1243 | { |
1244 | int ret; | 1244 | int ret; |
1245 | int mtu = vptr->dev->mtu; | ||
1246 | |||
1247 | vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32; | ||
1245 | 1248 | ||
1246 | vptr->rd_info = kcalloc(vptr->options.numrx, | 1249 | vptr->rd_info = kcalloc(vptr->options.numrx, |
1247 | sizeof(struct velocity_rd_info), GFP_KERNEL); | 1250 | sizeof(struct velocity_rd_info), GFP_KERNEL); |
@@ -1898,8 +1901,6 @@ static int velocity_open(struct net_device *dev) | |||
1898 | struct velocity_info *vptr = netdev_priv(dev); | 1901 | struct velocity_info *vptr = netdev_priv(dev); |
1899 | int ret; | 1902 | int ret; |
1900 | 1903 | ||
1901 | vptr->rx_buf_sz = (dev->mtu <= 1504 ? PKT_BUF_SZ : dev->mtu + 32); | ||
1902 | |||
1903 | ret = velocity_init_rings(vptr); | 1904 | ret = velocity_init_rings(vptr); |
1904 | if (ret < 0) | 1905 | if (ret < 0) |
1905 | goto out; | 1906 | goto out; |
@@ -1978,12 +1979,6 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu) | |||
1978 | velocity_free_rd_ring(vptr); | 1979 | velocity_free_rd_ring(vptr); |
1979 | 1980 | ||
1980 | dev->mtu = new_mtu; | 1981 | dev->mtu = new_mtu; |
1981 | if (new_mtu > 8192) | ||
1982 | vptr->rx_buf_sz = 9 * 1024; | ||
1983 | else if (new_mtu > 4096) | ||
1984 | vptr->rx_buf_sz = 8192; | ||
1985 | else | ||
1986 | vptr->rx_buf_sz = 4 * 1024; | ||
1987 | 1982 | ||
1988 | ret = velocity_init_rd_ring(vptr); | 1983 | ret = velocity_init_rd_ring(vptr); |
1989 | if (ret < 0) | 1984 | if (ret < 0) |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a75be57fb209..5413dbf3d4ac 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -198,8 +198,8 @@ again: | |||
198 | if (vi->num < vi->max / 2) | 198 | if (vi->num < vi->max / 2) |
199 | try_fill_recv(vi); | 199 | try_fill_recv(vi); |
200 | 200 | ||
201 | /* All done? */ | 201 | /* Out of packets? */ |
202 | if (!skb) { | 202 | if (received < budget) { |
203 | netif_rx_complete(vi->dev, napi); | 203 | netif_rx_complete(vi->dev, napi); |
204 | if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) | 204 | if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) |
205 | && netif_rx_reschedule(vi->dev, napi)) | 205 | && netif_rx_reschedule(vi->dev, napi)) |
@@ -404,8 +404,12 @@ free: | |||
404 | 404 | ||
405 | static void virtnet_remove(struct virtio_device *vdev) | 405 | static void virtnet_remove(struct virtio_device *vdev) |
406 | { | 406 | { |
407 | unregister_netdev(vdev->priv); | 407 | struct virtnet_info *vi = vdev->priv; |
408 | free_netdev(vdev->priv); | 408 | |
409 | vdev->config->del_vq(vi->svq); | ||
410 | vdev->config->del_vq(vi->rvq); | ||
411 | unregister_netdev(vi->dev); | ||
412 | free_netdev(vi->dev); | ||
409 | } | 413 | } |
410 | 414 | ||
411 | static struct virtio_device_id id_table[] = { | 415 | static struct virtio_device_id id_table[] = { |
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index 232ecba5340f..61e24b7a45a3 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c | |||
@@ -107,24 +107,24 @@ | |||
107 | struct ppp_header { | 107 | struct ppp_header { |
108 | u8 address; | 108 | u8 address; |
109 | u8 control; | 109 | u8 control; |
110 | u16 protocol; | 110 | __be16 protocol; |
111 | }; | 111 | }; |
112 | #define PPP_HEADER_LEN sizeof (struct ppp_header) | 112 | #define PPP_HEADER_LEN sizeof (struct ppp_header) |
113 | 113 | ||
114 | struct lcp_header { | 114 | struct lcp_header { |
115 | u8 type; | 115 | u8 type; |
116 | u8 ident; | 116 | u8 ident; |
117 | u16 len; | 117 | __be16 len; |
118 | }; | 118 | }; |
119 | #define LCP_HEADER_LEN sizeof (struct lcp_header) | 119 | #define LCP_HEADER_LEN sizeof (struct lcp_header) |
120 | 120 | ||
121 | struct cisco_packet { | 121 | struct cisco_packet { |
122 | u32 type; | 122 | __be32 type; |
123 | u32 par1; | 123 | __be32 par1; |
124 | u32 par2; | 124 | __be32 par2; |
125 | u16 rel; | 125 | __be16 rel; |
126 | u16 time0; | 126 | __be16 time0; |
127 | u16 time1; | 127 | __be16 time1; |
128 | }; | 128 | }; |
129 | #define CISCO_PACKET_LEN 18 | 129 | #define CISCO_PACKET_LEN 18 |
130 | #define CISCO_BIG_PACKET_LEN 20 | 130 | #define CISCO_BIG_PACKET_LEN 20 |
@@ -139,7 +139,7 @@ static struct sk_buff_head tx_queue; | |||
139 | static void sppp_keepalive (unsigned long dummy); | 139 | static void sppp_keepalive (unsigned long dummy); |
140 | static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, | 140 | static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, |
141 | u8 ident, u16 len, void *data); | 141 | u8 ident, u16 len, void *data); |
142 | static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2); | 142 | static void sppp_cisco_send (struct sppp *sp, int type, u32 par1, u32 par2); |
143 | static void sppp_lcp_input (struct sppp *sp, struct sk_buff *m); | 143 | static void sppp_lcp_input (struct sppp *sp, struct sk_buff *m); |
144 | static void sppp_cisco_input (struct sppp *sp, struct sk_buff *m); | 144 | static void sppp_cisco_input (struct sppp *sp, struct sk_buff *m); |
145 | static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *m); | 145 | static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *m); |
@@ -447,7 +447,7 @@ static void sppp_keepalive (unsigned long dummy) | |||
447 | sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ, ++sp->pp_seq, | 447 | sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ, ++sp->pp_seq, |
448 | sp->pp_rseq); | 448 | sp->pp_rseq); |
449 | else if (sp->lcp.state == LCP_STATE_OPENED) { | 449 | else if (sp->lcp.state == LCP_STATE_OPENED) { |
450 | long nmagic = htonl (sp->lcp.magic); | 450 | __be32 nmagic = htonl (sp->lcp.magic); |
451 | sp->lcp.echoid = ++sp->pp_seq; | 451 | sp->lcp.echoid = ++sp->pp_seq; |
452 | sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REQ, | 452 | sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REQ, |
453 | sp->lcp.echoid, 4, &nmagic); | 453 | sp->lcp.echoid, 4, &nmagic); |
@@ -667,7 +667,7 @@ badreq: | |||
667 | dev->name, len); | 667 | dev->name, len); |
668 | break; | 668 | break; |
669 | } | 669 | } |
670 | if (ntohl (*(long*)(h+1)) == sp->lcp.magic) { | 670 | if (ntohl (*(__be32*)(h+1)) == sp->lcp.magic) { |
671 | /* Line loopback mode detected. */ | 671 | /* Line loopback mode detected. */ |
672 | printk (KERN_WARNING "%s: loopback\n", dev->name); | 672 | printk (KERN_WARNING "%s: loopback\n", dev->name); |
673 | if_down (dev); | 673 | if_down (dev); |
@@ -680,7 +680,7 @@ badreq: | |||
680 | sppp_lcp_open (sp); | 680 | sppp_lcp_open (sp); |
681 | break; | 681 | break; |
682 | } | 682 | } |
683 | *(long*)(h+1) = htonl (sp->lcp.magic); | 683 | *(__be32 *)(h+1) = htonl (sp->lcp.magic); |
684 | sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REPLY, h->ident, len-4, h+1); | 684 | sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REPLY, h->ident, len-4, h+1); |
685 | break; | 685 | break; |
686 | case LCP_ECHO_REPLY: | 686 | case LCP_ECHO_REPLY: |
@@ -692,7 +692,7 @@ badreq: | |||
692 | dev->name, len); | 692 | dev->name, len); |
693 | break; | 693 | break; |
694 | } | 694 | } |
695 | if (ntohl (*(long*)(h+1)) != sp->lcp.magic) | 695 | if (ntohl(*(__be32 *)(h+1)) != sp->lcp.magic) |
696 | sp->pp_alivecnt = 0; | 696 | sp->pp_alivecnt = 0; |
697 | break; | 697 | break; |
698 | } | 698 | } |
@@ -765,7 +765,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb) | |||
765 | { | 765 | { |
766 | struct in_device *in_dev; | 766 | struct in_device *in_dev; |
767 | struct in_ifaddr *ifa; | 767 | struct in_ifaddr *ifa; |
768 | __be32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */ | 768 | __be32 addr = 0, mask = htonl(~0U); /* FIXME: is the mask correct? */ |
769 | #ifdef CONFIG_INET | 769 | #ifdef CONFIG_INET |
770 | rcu_read_lock(); | 770 | rcu_read_lock(); |
771 | if ((in_dev = __in_dev_get_rcu(dev)) != NULL) | 771 | if ((in_dev = __in_dev_get_rcu(dev)) != NULL) |
@@ -782,8 +782,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb) | |||
782 | } | 782 | } |
783 | rcu_read_unlock(); | 783 | rcu_read_unlock(); |
784 | #endif | 784 | #endif |
785 | /* I hope both addr and mask are in the net order */ | 785 | sppp_cisco_send (sp, CISCO_ADDR_REPLY, ntohl(addr), ntohl(mask)); |
786 | sppp_cisco_send (sp, CISCO_ADDR_REPLY, addr, mask); | ||
787 | break; | 786 | break; |
788 | } | 787 | } |
789 | } | 788 | } |
@@ -844,7 +843,7 @@ static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, | |||
844 | * Send Cisco keepalive packet. | 843 | * Send Cisco keepalive packet. |
845 | */ | 844 | */ |
846 | 845 | ||
847 | static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2) | 846 | static void sppp_cisco_send (struct sppp *sp, int type, u32 par1, u32 par2) |
848 | { | 847 | { |
849 | struct ppp_header *h; | 848 | struct ppp_header *h; |
850 | struct cisco_packet *ch; | 849 | struct cisco_packet *ch; |
@@ -868,7 +867,7 @@ static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2) | |||
868 | ch->type = htonl (type); | 867 | ch->type = htonl (type); |
869 | ch->par1 = htonl (par1); | 868 | ch->par1 = htonl (par1); |
870 | ch->par2 = htonl (par2); | 869 | ch->par2 = htonl (par2); |
871 | ch->rel = -1; | 870 | ch->rel = htons(0xffff); |
872 | ch->time0 = htons ((u16) (t >> 16)); | 871 | ch->time0 = htons ((u16) (t >> 16)); |
873 | ch->time1 = htons ((u16) t); | 872 | ch->time1 = htons ((u16) t); |
874 | 873 | ||
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 2b17c1dc46f1..b45eecc53c4a 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -1566,7 +1566,7 @@ static void b43_release_firmware(struct b43_wldev *dev) | |||
1566 | static void b43_print_fw_helptext(struct b43_wl *wl) | 1566 | static void b43_print_fw_helptext(struct b43_wl *wl) |
1567 | { | 1567 | { |
1568 | b43err(wl, "You must go to " | 1568 | b43err(wl, "You must go to " |
1569 | "http://linuxwireless.org/en/users/Drivers/bcm43xx#devicefirmware " | 1569 | "http://linuxwireless.org/en/users/Drivers/b43#devicefirmware " |
1570 | "and download the correct firmware (version 4).\n"); | 1570 | "and download the correct firmware (version 4).\n"); |
1571 | } | 1571 | } |
1572 | 1572 | ||
diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c index 3d4ed647c311..7ff091e69f05 100644 --- a/drivers/net/wireless/b43/phy.c +++ b/drivers/net/wireless/b43/phy.c | |||
@@ -2214,7 +2214,7 @@ int b43_phy_init_tssi2dbm_table(struct b43_wldev *dev) | |||
2214 | } | 2214 | } |
2215 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); | 2215 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); |
2216 | if (dyn_tssi2dbm == NULL) { | 2216 | if (dyn_tssi2dbm == NULL) { |
2217 | b43err(dev->wl, "Could not allocate memory" | 2217 | b43err(dev->wl, "Could not allocate memory " |
2218 | "for tssi2dbm table\n"); | 2218 | "for tssi2dbm table\n"); |
2219 | return -ENOMEM; | 2219 | return -ENOMEM; |
2220 | } | 2220 | } |
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c index 8cb3dc4c4745..83161d9af813 100644 --- a/drivers/net/wireless/b43legacy/dma.c +++ b/drivers/net/wireless/b43legacy/dma.c | |||
@@ -996,7 +996,7 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev) | |||
996 | 996 | ||
997 | err = ssb_dma_set_mask(dev->dev, dmamask); | 997 | err = ssb_dma_set_mask(dev->dev, dmamask); |
998 | if (err) { | 998 | if (err) { |
999 | #ifdef BCM43XX_PIO | 999 | #ifdef CONFIG_B43LEGACY_PIO |
1000 | b43legacywarn(dev->wl, "DMA for this device not supported. " | 1000 | b43legacywarn(dev->wl, "DMA for this device not supported. " |
1001 | "Falling back to PIO\n"); | 1001 | "Falling back to PIO\n"); |
1002 | dev->__using_pio = 1; | 1002 | dev->__using_pio = 1; |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 3bde1e9ab428..32d5e1785bda 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -1419,7 +1419,7 @@ static void b43legacy_release_firmware(struct b43legacy_wldev *dev) | |||
1419 | static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl) | 1419 | static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl) |
1420 | { | 1420 | { |
1421 | b43legacyerr(wl, "You must go to http://linuxwireless.org/en/users/" | 1421 | b43legacyerr(wl, "You must go to http://linuxwireless.org/en/users/" |
1422 | "Drivers/bcm43xx#devicefirmware " | 1422 | "Drivers/b43#devicefirmware " |
1423 | "and download the correct firmware (version 3).\n"); | 1423 | "and download the correct firmware (version 3).\n"); |
1424 | } | 1424 | } |
1425 | 1425 | ||
diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c index 22a4b3d0186d..491e518e4aeb 100644 --- a/drivers/net/wireless/b43legacy/phy.c +++ b/drivers/net/wireless/b43legacy/phy.c | |||
@@ -2020,7 +2020,7 @@ int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev) | |||
2020 | phy->idle_tssi = 62; | 2020 | phy->idle_tssi = 62; |
2021 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); | 2021 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); |
2022 | if (dyn_tssi2dbm == NULL) { | 2022 | if (dyn_tssi2dbm == NULL) { |
2023 | b43legacyerr(dev->wl, "Could not allocate memory" | 2023 | b43legacyerr(dev->wl, "Could not allocate memory " |
2024 | "for tssi2dbm table\n"); | 2024 | "for tssi2dbm table\n"); |
2025 | return -ENOMEM; | 2025 | return -ENOMEM; |
2026 | } | 2026 | } |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index b37f1e348700..af3de3343650 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c | |||
@@ -2149,7 +2149,7 @@ int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm) | |||
2149 | } | 2149 | } |
2150 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); | 2150 | dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); |
2151 | if (dyn_tssi2dbm == NULL) { | 2151 | if (dyn_tssi2dbm == NULL) { |
2152 | printk(KERN_ERR PFX "Could not allocate memory" | 2152 | printk(KERN_ERR PFX "Could not allocate memory " |
2153 | "for tssi2dbm table\n"); | 2153 | "for tssi2dbm table\n"); |
2154 | return -ENOMEM; | 2154 | return -ENOMEM; |
2155 | } | 2155 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 465da4f67ce7..4bdf237f6adc 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -2915,6 +2915,10 @@ static void iwl_set_rate(struct iwl_priv *priv) | |||
2915 | int i; | 2915 | int i; |
2916 | 2916 | ||
2917 | hw = iwl_get_hw_mode(priv, priv->phymode); | 2917 | hw = iwl_get_hw_mode(priv, priv->phymode); |
2918 | if (!hw) { | ||
2919 | IWL_ERROR("Failed to set rate: unable to get hw mode\n"); | ||
2920 | return; | ||
2921 | } | ||
2918 | 2922 | ||
2919 | priv->active_rate = 0; | 2923 | priv->active_rate = 0; |
2920 | priv->active_rate_basic = 0; | 2924 | priv->active_rate_basic = 0; |
@@ -6936,13 +6940,10 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, | |||
6936 | DECLARE_MAC_BUF(mac); | 6940 | DECLARE_MAC_BUF(mac); |
6937 | 6941 | ||
6938 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); | 6942 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); |
6939 | if (conf->mac_addr) | ||
6940 | IWL_DEBUG_MAC80211("enter: MAC %s\n", | ||
6941 | print_mac(mac, conf->mac_addr)); | ||
6942 | 6943 | ||
6943 | if (priv->interface_id) { | 6944 | if (priv->interface_id) { |
6944 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); | 6945 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); |
6945 | return 0; | 6946 | return -EOPNOTSUPP; |
6946 | } | 6947 | } |
6947 | 6948 | ||
6948 | spin_lock_irqsave(&priv->lock, flags); | 6949 | spin_lock_irqsave(&priv->lock, flags); |
@@ -6951,6 +6952,12 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, | |||
6951 | spin_unlock_irqrestore(&priv->lock, flags); | 6952 | spin_unlock_irqrestore(&priv->lock, flags); |
6952 | 6953 | ||
6953 | mutex_lock(&priv->mutex); | 6954 | mutex_lock(&priv->mutex); |
6955 | |||
6956 | if (conf->mac_addr) { | ||
6957 | IWL_DEBUG_MAC80211("Set: %s\n", print_mac(mac, conf->mac_addr)); | ||
6958 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | ||
6959 | } | ||
6960 | |||
6954 | iwl_set_mode(priv, conf->type); | 6961 | iwl_set_mode(priv, conf->type); |
6955 | 6962 | ||
6956 | IWL_DEBUG_MAC80211("leave\n"); | 6963 | IWL_DEBUG_MAC80211("leave\n"); |
@@ -8270,6 +8277,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv) | |||
8270 | { | 8277 | { |
8271 | iwl_hw_cancel_deferred_work(priv); | 8278 | iwl_hw_cancel_deferred_work(priv); |
8272 | 8279 | ||
8280 | cancel_delayed_work_sync(&priv->init_alive_start); | ||
8273 | cancel_delayed_work(&priv->scan_check); | 8281 | cancel_delayed_work(&priv->scan_check); |
8274 | cancel_delayed_work(&priv->alive_start); | 8282 | cancel_delayed_work(&priv->alive_start); |
8275 | cancel_delayed_work(&priv->post_associate); | 8283 | cancel_delayed_work(&priv->post_associate); |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 9918780f5e86..8f85564ec6fa 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -3003,6 +3003,10 @@ static void iwl_set_rate(struct iwl_priv *priv) | |||
3003 | int i; | 3003 | int i; |
3004 | 3004 | ||
3005 | hw = iwl_get_hw_mode(priv, priv->phymode); | 3005 | hw = iwl_get_hw_mode(priv, priv->phymode); |
3006 | if (!hw) { | ||
3007 | IWL_ERROR("Failed to set rate: unable to get hw mode\n"); | ||
3008 | return; | ||
3009 | } | ||
3006 | 3010 | ||
3007 | priv->active_rate = 0; | 3011 | priv->active_rate = 0; |
3008 | priv->active_rate_basic = 0; | 3012 | priv->active_rate_basic = 0; |
@@ -7326,9 +7330,6 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, | |||
7326 | DECLARE_MAC_BUF(mac); | 7330 | DECLARE_MAC_BUF(mac); |
7327 | 7331 | ||
7328 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); | 7332 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); |
7329 | if (conf->mac_addr) | ||
7330 | IWL_DEBUG_MAC80211("enter: MAC %s\n", | ||
7331 | print_mac(mac, conf->mac_addr)); | ||
7332 | 7333 | ||
7333 | if (priv->interface_id) { | 7334 | if (priv->interface_id) { |
7334 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); | 7335 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); |
@@ -7341,6 +7342,11 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, | |||
7341 | spin_unlock_irqrestore(&priv->lock, flags); | 7342 | spin_unlock_irqrestore(&priv->lock, flags); |
7342 | 7343 | ||
7343 | mutex_lock(&priv->mutex); | 7344 | mutex_lock(&priv->mutex); |
7345 | |||
7346 | if (conf->mac_addr) { | ||
7347 | IWL_DEBUG_MAC80211("Set %s\n", print_mac(mac, conf->mac_addr)); | ||
7348 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | ||
7349 | } | ||
7344 | iwl_set_mode(priv, conf->type); | 7350 | iwl_set_mode(priv, conf->type); |
7345 | 7351 | ||
7346 | IWL_DEBUG_MAC80211("leave\n"); | 7352 | IWL_DEBUG_MAC80211("leave\n"); |
@@ -8864,6 +8870,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv) | |||
8864 | { | 8870 | { |
8865 | iwl_hw_cancel_deferred_work(priv); | 8871 | iwl_hw_cancel_deferred_work(priv); |
8866 | 8872 | ||
8873 | cancel_delayed_work_sync(&priv->init_alive_start); | ||
8867 | cancel_delayed_work(&priv->scan_check); | 8874 | cancel_delayed_work(&priv->scan_check); |
8868 | cancel_delayed_work(&priv->alive_start); | 8875 | cancel_delayed_work(&priv->alive_start); |
8869 | cancel_delayed_work(&priv->post_associate); | 8876 | cancel_delayed_work(&priv->post_associate); |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index ec89dabc412c..ba4fc2b3bf0a 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
@@ -170,7 +170,8 @@ static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 r | |||
170 | #define IF_CS_H_IC_TX_OVER 0x0001 | 170 | #define IF_CS_H_IC_TX_OVER 0x0001 |
171 | #define IF_CS_H_IC_RX_OVER 0x0002 | 171 | #define IF_CS_H_IC_RX_OVER 0x0002 |
172 | #define IF_CS_H_IC_DNLD_OVER 0x0004 | 172 | #define IF_CS_H_IC_DNLD_OVER 0x0004 |
173 | #define IF_CS_H_IC_HOST_EVENT 0x0008 | 173 | #define IF_CS_H_IC_POWER_DOWN 0x0008 |
174 | #define IF_CS_H_IC_HOST_EVENT 0x0010 | ||
174 | #define IF_CS_H_IC_MASK 0x001f | 175 | #define IF_CS_H_IC_MASK 0x001f |
175 | 176 | ||
176 | #define IF_CS_H_INT_MASK 0x00000004 | 177 | #define IF_CS_H_INT_MASK 0x00000004 |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 5ead08312e1e..1823b48a8ba7 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -1165,8 +1165,6 @@ wlan_private *libertas_add_card(void *card, struct device *dmdev) | |||
1165 | #ifdef WIRELESS_EXT | 1165 | #ifdef WIRELESS_EXT |
1166 | dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; | 1166 | dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; |
1167 | #endif | 1167 | #endif |
1168 | #define NETIF_F_DYNALLOC 16 | ||
1169 | dev->features |= NETIF_F_DYNALLOC; | ||
1170 | dev->flags |= IFF_BROADCAST | IFF_MULTICAST; | 1168 | dev->flags |= IFF_BROADCAST | IFF_MULTICAST; |
1171 | dev->set_multicast_list = libertas_set_multicast_list; | 1169 | dev->set_multicast_list = libertas_set_multicast_list; |
1172 | 1170 | ||
@@ -1348,8 +1346,6 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev) | |||
1348 | #ifdef WIRELESS_EXT | 1346 | #ifdef WIRELESS_EXT |
1349 | mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def; | 1347 | mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def; |
1350 | #endif | 1348 | #endif |
1351 | #define NETIF_F_DYNALLOC 16 | ||
1352 | |||
1353 | /* Register virtual mesh interface */ | 1349 | /* Register virtual mesh interface */ |
1354 | ret = register_netdev(mesh_dev); | 1350 | ret = register_netdev(mesh_dev); |
1355 | if (ret) { | 1351 | if (ret) { |
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index c6f5aa3cb465..395b7882d4d6 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -1528,7 +1528,7 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1528 | && (ext->key_len != KEY_LEN_WPA_TKIP)) | 1528 | && (ext->key_len != KEY_LEN_WPA_TKIP)) |
1529 | || ((alg == IW_ENCODE_ALG_CCMP) | 1529 | || ((alg == IW_ENCODE_ALG_CCMP) |
1530 | && (ext->key_len != KEY_LEN_WPA_AES))) { | 1530 | && (ext->key_len != KEY_LEN_WPA_AES))) { |
1531 | lbs_deb_wext("invalid size %d for key of alg" | 1531 | lbs_deb_wext("invalid size %d for key of alg " |
1532 | "type %d\n", | 1532 | "type %d\n", |
1533 | ext->key_len, | 1533 | ext->key_len, |
1534 | alg); | 1534 | alg); |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 2402cb8dd328..d2fa079fbc4c 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -806,7 +806,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
806 | for (i = 0; i < 6; i++) | 806 | for (i = 0; i < 6; i++) |
807 | dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i); | 807 | dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i); |
808 | 808 | ||
809 | printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx" | 809 | printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx, " |
810 | "id %c%c, hw_addr %s\n", | 810 | "id %c%c, hw_addr %s\n", |
811 | dev->name, dev->base_addr, dev->irq, | 811 | dev->name, dev->base_addr, dev->irq, |
812 | (u_long) ramBase, | 812 | (u_long) ramBase, |
diff --git a/drivers/net/wireless/p54usb.c b/drivers/net/wireless/p54usb.c index 755482a5a938..60d286eb0b8b 100644 --- a/drivers/net/wireless/p54usb.c +++ b/drivers/net/wireless/p54usb.c | |||
@@ -308,7 +308,7 @@ static int p54u_read_eeprom(struct ieee80211_hw *dev) | |||
308 | 308 | ||
309 | buf = kmalloc(0x2020, GFP_KERNEL); | 309 | buf = kmalloc(0x2020, GFP_KERNEL); |
310 | if (!buf) { | 310 | if (!buf) { |
311 | printk(KERN_ERR "prism54usb: cannot allocate memory for" | 311 | printk(KERN_ERR "prism54usb: cannot allocate memory for " |
312 | "eeprom readback!\n"); | 312 | "eeprom readback!\n"); |
313 | return -ENOMEM; | 313 | return -ENOMEM; |
314 | } | 314 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 277a020b35e9..50775f9234cc 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1032,7 +1032,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | 1034 | static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, |
1035 | int maxpacket, struct sk_buff *skb) | 1035 | struct sk_buff *skb) |
1036 | { | 1036 | { |
1037 | int length; | 1037 | int length; |
1038 | 1038 | ||
@@ -1041,7 +1041,7 @@ static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | |||
1041 | * but it must _not_ be a multiple of the USB packet size. | 1041 | * but it must _not_ be a multiple of the USB packet size. |
1042 | */ | 1042 | */ |
1043 | length = roundup(skb->len, 2); | 1043 | length = roundup(skb->len, 2); |
1044 | length += (2 * !(length % maxpacket)); | 1044 | length += (2 * !(length % rt2x00dev->usb_maxpacket)); |
1045 | 1045 | ||
1046 | return length; | 1046 | return length; |
1047 | } | 1047 | } |
@@ -1643,7 +1643,6 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1643 | struct data_entry *beacon; | 1643 | struct data_entry *beacon; |
1644 | struct data_entry *guardian; | 1644 | struct data_entry *guardian; |
1645 | int pipe = usb_sndbulkpipe(usb_dev, 1); | 1645 | int pipe = usb_sndbulkpipe(usb_dev, 1); |
1646 | int max_packet = usb_maxpacket(usb_dev, pipe, 1); | ||
1647 | int length; | 1646 | int length; |
1648 | 1647 | ||
1649 | /* | 1648 | /* |
@@ -1672,7 +1671,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1672 | ring->desc_size), | 1671 | ring->desc_size), |
1673 | skb->len - ring->desc_size, control); | 1672 | skb->len - ring->desc_size, control); |
1674 | 1673 | ||
1675 | length = rt2500usb_get_tx_data_len(rt2x00dev, max_packet, skb); | 1674 | length = rt2500usb_get_tx_data_len(rt2x00dev, skb); |
1676 | 1675 | ||
1677 | usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, | 1676 | usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, |
1678 | skb->data, length, rt2500usb_beacondone, beacon); | 1677 | skb->data, length, rt2500usb_beacondone, beacon); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index d1ad5251a77a..c8f16f161c28 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -418,7 +418,7 @@ struct rt2x00lib_ops { | |||
418 | int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, | 418 | int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, |
419 | struct data_ring *ring, struct sk_buff *skb, | 419 | struct data_ring *ring, struct sk_buff *skb, |
420 | struct ieee80211_tx_control *control); | 420 | struct ieee80211_tx_control *control); |
421 | int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, int maxpacket, | 421 | int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, |
422 | struct sk_buff *skb); | 422 | struct sk_buff *skb); |
423 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, | 423 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, |
424 | unsigned int queue); | 424 | unsigned int queue); |
@@ -599,6 +599,11 @@ struct rt2x00_dev { | |||
599 | u32 *rf; | 599 | u32 *rf; |
600 | 600 | ||
601 | /* | 601 | /* |
602 | * USB Max frame size (for rt2500usb & rt73usb). | ||
603 | */ | ||
604 | u16 usb_maxpacket; | ||
605 | |||
606 | /* | ||
602 | * Current TX power value. | 607 | * Current TX power value. |
603 | */ | 608 | */ |
604 | u16 tx_power; | 609 | u16 tx_power; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 73cc726c4046..1f5675dd329f 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -159,7 +159,6 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
159 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); | 159 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); |
160 | struct data_entry *entry = rt2x00_get_data_entry(ring); | 160 | struct data_entry *entry = rt2x00_get_data_entry(ring); |
161 | int pipe = usb_sndbulkpipe(usb_dev, 1); | 161 | int pipe = usb_sndbulkpipe(usb_dev, 1); |
162 | int max_packet = usb_maxpacket(usb_dev, pipe, 1); | ||
163 | u32 length; | 162 | u32 length; |
164 | 163 | ||
165 | if (rt2x00_ring_full(ring)) { | 164 | if (rt2x00_ring_full(ring)) { |
@@ -194,8 +193,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
194 | * length of the data to usb_fill_bulk_urb. Pass the skb | 193 | * length of the data to usb_fill_bulk_urb. Pass the skb |
195 | * to the driver to determine what the length should be. | 194 | * to the driver to determine what the length should be. |
196 | */ | 195 | */ |
197 | length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, | 196 | length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, skb); |
198 | max_packet, skb); | ||
199 | 197 | ||
200 | /* | 198 | /* |
201 | * Initialize URB and send the frame to the device. | 199 | * Initialize URB and send the frame to the device. |
@@ -490,6 +488,11 @@ int rt2x00usb_probe(struct usb_interface *usb_intf, | |||
490 | rt2x00dev->ops = ops; | 488 | rt2x00dev->ops = ops; |
491 | rt2x00dev->hw = hw; | 489 | rt2x00dev->hw = hw; |
492 | 490 | ||
491 | rt2x00dev->usb_maxpacket = | ||
492 | usb_maxpacket(usb_dev, usb_sndbulkpipe(usb_dev, 1), 1); | ||
493 | if (!rt2x00dev->usb_maxpacket) | ||
494 | rt2x00dev->usb_maxpacket = 1; | ||
495 | |||
493 | retval = rt2x00usb_alloc_reg(rt2x00dev); | 496 | retval = rt2x00usb_alloc_reg(rt2x00dev); |
494 | if (retval) | 497 | if (retval) |
495 | goto exit_free_device; | 498 | goto exit_free_device; |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index dc640bf6b5eb..c0671c2e6e73 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1251,7 +1251,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | 1253 | static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, |
1254 | int maxpacket, struct sk_buff *skb) | 1254 | struct sk_buff *skb) |
1255 | { | 1255 | { |
1256 | int length; | 1256 | int length; |
1257 | 1257 | ||
@@ -1260,7 +1260,7 @@ static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | |||
1260 | * but it must _not_ be a multiple of the USB packet size. | 1260 | * but it must _not_ be a multiple of the USB packet size. |
1261 | */ | 1261 | */ |
1262 | length = roundup(skb->len, 4); | 1262 | length = roundup(skb->len, 4); |
1263 | length += (4 * !(length % maxpacket)); | 1263 | length += (4 * !(length % rt2x00dev->usb_maxpacket)); |
1264 | 1264 | ||
1265 | return length; | 1265 | return length; |
1266 | } | 1266 | } |
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 5eace9e66e14..66ce61048361 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
@@ -768,9 +768,13 @@ lba_fixup_bus(struct pci_bus *bus) | |||
768 | DBG("lba_fixup_bus() WTF? 0x%lx [%lx/%lx] XXX", | 768 | DBG("lba_fixup_bus() WTF? 0x%lx [%lx/%lx] XXX", |
769 | res->flags, res->start, res->end); | 769 | res->flags, res->start, res->end); |
770 | } | 770 | } |
771 | if ((i != PCI_ROM_RESOURCE) || | 771 | |
772 | (res->flags & IORESOURCE_ROM_ENABLE)) | 772 | /* |
773 | pci_claim_resource(dev, i); | 773 | ** FIXME: this will result in whinging for devices |
774 | ** that share expansion ROMs (think quad tulip), but | ||
775 | ** isn't harmful. | ||
776 | */ | ||
777 | pci_claim_resource(dev, i); | ||
774 | } | 778 | } |
775 | 779 | ||
776 | #ifdef FBB_SUPPORT | 780 | #ifdef FBB_SUPPORT |
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index f6cc0c5b5657..1ef417cca2db 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
@@ -66,7 +66,7 @@ struct slot { | |||
66 | char name[SLOT_NAME_SIZE]; | 66 | char name[SLOT_NAME_SIZE]; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | /** | 69 | /* |
70 | * struct acpiphp_bridge - PCI bridge information | 70 | * struct acpiphp_bridge - PCI bridge information |
71 | * | 71 | * |
72 | * for each bridge device in ACPI namespace | 72 | * for each bridge device in ACPI namespace |
@@ -97,7 +97,7 @@ struct acpiphp_bridge { | |||
97 | }; | 97 | }; |
98 | 98 | ||
99 | 99 | ||
100 | /** | 100 | /* |
101 | * struct acpiphp_slot - PCI slot information | 101 | * struct acpiphp_slot - PCI slot information |
102 | * | 102 | * |
103 | * PCI slot information for each *physical* PCI slot | 103 | * PCI slot information for each *physical* PCI slot |
@@ -118,7 +118,7 @@ struct acpiphp_slot { | |||
118 | }; | 118 | }; |
119 | 119 | ||
120 | 120 | ||
121 | /** | 121 | /* |
122 | * struct acpiphp_func - PCI function information | 122 | * struct acpiphp_func - PCI function information |
123 | * | 123 | * |
124 | * PCI function information for each object in ACPI namespace | 124 | * PCI function information for each object in ACPI namespace |
@@ -137,7 +137,7 @@ struct acpiphp_func { | |||
137 | u32 flags; /* see below */ | 137 | u32 flags; /* see below */ |
138 | }; | 138 | }; |
139 | 139 | ||
140 | /** | 140 | /* |
141 | * struct acpiphp_attention_info - device specific attention registration | 141 | * struct acpiphp_attention_info - device specific attention registration |
142 | * | 142 | * |
143 | * ACPI has no generic method of setting/getting attention status | 143 | * ACPI has no generic method of setting/getting attention status |
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index a0ca63adad5a..c8c263875c21 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
@@ -91,10 +91,10 @@ static struct hotplug_slot_ops acpi_hotplug_slot_ops = { | |||
91 | * acpiphp_register_attention - set attention LED callback | 91 | * acpiphp_register_attention - set attention LED callback |
92 | * @info: must be completely filled with LED callbacks | 92 | * @info: must be completely filled with LED callbacks |
93 | * | 93 | * |
94 | * Description: this is used to register a hardware specific ACPI | 94 | * Description: This is used to register a hardware specific ACPI |
95 | * driver that manipulates the attention LED. All the fields in | 95 | * driver that manipulates the attention LED. All the fields in |
96 | * info must be set. | 96 | * info must be set. |
97 | **/ | 97 | */ |
98 | int acpiphp_register_attention(struct acpiphp_attention_info *info) | 98 | int acpiphp_register_attention(struct acpiphp_attention_info *info) |
99 | { | 99 | { |
100 | int retval = -EINVAL; | 100 | int retval = -EINVAL; |
@@ -112,10 +112,10 @@ int acpiphp_register_attention(struct acpiphp_attention_info *info) | |||
112 | * acpiphp_unregister_attention - unset attention LED callback | 112 | * acpiphp_unregister_attention - unset attention LED callback |
113 | * @info: must match the pointer used to register | 113 | * @info: must match the pointer used to register |
114 | * | 114 | * |
115 | * Description: this is used to un-register a hardware specific acpi | 115 | * Description: This is used to un-register a hardware specific acpi |
116 | * driver that manipulates the attention LED. The pointer to the | 116 | * driver that manipulates the attention LED. The pointer to the |
117 | * info struct must be the same as the one used to set it. | 117 | * info struct must be the same as the one used to set it. |
118 | **/ | 118 | */ |
119 | int acpiphp_unregister_attention(struct acpiphp_attention_info *info) | 119 | int acpiphp_unregister_attention(struct acpiphp_attention_info *info) |
120 | { | 120 | { |
121 | int retval = -EINVAL; | 121 | int retval = -EINVAL; |
@@ -133,7 +133,6 @@ int acpiphp_unregister_attention(struct acpiphp_attention_info *info) | |||
133 | * @hotplug_slot: slot to enable | 133 | * @hotplug_slot: slot to enable |
134 | * | 134 | * |
135 | * Actual tasks are done in acpiphp_enable_slot() | 135 | * Actual tasks are done in acpiphp_enable_slot() |
136 | * | ||
137 | */ | 136 | */ |
138 | static int enable_slot(struct hotplug_slot *hotplug_slot) | 137 | static int enable_slot(struct hotplug_slot *hotplug_slot) |
139 | { | 138 | { |
@@ -151,7 +150,6 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) | |||
151 | * @hotplug_slot: slot to disable | 150 | * @hotplug_slot: slot to disable |
152 | * | 151 | * |
153 | * Actual tasks are done in acpiphp_disable_slot() | 152 | * Actual tasks are done in acpiphp_disable_slot() |
154 | * | ||
155 | */ | 153 | */ |
156 | static int disable_slot(struct hotplug_slot *hotplug_slot) | 154 | static int disable_slot(struct hotplug_slot *hotplug_slot) |
157 | { | 155 | { |
@@ -168,15 +166,15 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
168 | } | 166 | } |
169 | 167 | ||
170 | 168 | ||
171 | /** | 169 | /** |
172 | * set_attention_status - set attention LED | 170 | * set_attention_status - set attention LED |
173 | * @hotplug_slot: slot to set attention LED on | 171 | * @hotplug_slot: slot to set attention LED on |
174 | * @status: value to set attention LED to (0 or 1) | 172 | * @status: value to set attention LED to (0 or 1) |
175 | * | 173 | * |
176 | * attention status LED, so we use a callback that | 174 | * attention status LED, so we use a callback that |
177 | * was registered with us. This allows hardware specific | 175 | * was registered with us. This allows hardware specific |
178 | * ACPI implementations to blink the light for us. | 176 | * ACPI implementations to blink the light for us. |
179 | **/ | 177 | */ |
180 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) | 178 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) |
181 | { | 179 | { |
182 | int retval = -ENODEV; | 180 | int retval = -ENODEV; |
@@ -199,7 +197,6 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
199 | * | 197 | * |
200 | * Some platforms may not implement _STA method properly. | 198 | * Some platforms may not implement _STA method properly. |
201 | * In that case, the value returned may not be reliable. | 199 | * In that case, the value returned may not be reliable. |
202 | * | ||
203 | */ | 200 | */ |
204 | static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | 201 | static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) |
205 | { | 202 | { |
@@ -213,7 +210,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
213 | } | 210 | } |
214 | 211 | ||
215 | 212 | ||
216 | /** | 213 | /** |
217 | * get_attention_status - get attention LED status | 214 | * get_attention_status - get attention LED status |
218 | * @hotplug_slot: slot to get status from | 215 | * @hotplug_slot: slot to get status from |
219 | * @value: returns with value of attention LED | 216 | * @value: returns with value of attention LED |
@@ -221,8 +218,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
221 | * ACPI doesn't have known method to determine the state | 218 | * ACPI doesn't have known method to determine the state |
222 | * of the attention status LED, so we use a callback that | 219 | * of the attention status LED, so we use a callback that |
223 | * was registered with us. This allows hardware specific | 220 | * was registered with us. This allows hardware specific |
224 | * ACPI implementations to determine its state | 221 | * ACPI implementations to determine its state. |
225 | **/ | 222 | */ |
226 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | 223 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) |
227 | { | 224 | { |
228 | int retval = -EINVAL; | 225 | int retval = -EINVAL; |
@@ -244,8 +241,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
244 | * @value: pointer to store status | 241 | * @value: pointer to store status |
245 | * | 242 | * |
246 | * ACPI doesn't provide any formal means to access latch status. | 243 | * ACPI doesn't provide any formal means to access latch status. |
247 | * Instead, we fake latch status from _STA | 244 | * Instead, we fake latch status from _STA. |
248 | * | ||
249 | */ | 245 | */ |
250 | static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | 246 | static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) |
251 | { | 247 | { |
@@ -265,8 +261,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
265 | * @value: pointer to store status | 261 | * @value: pointer to store status |
266 | * | 262 | * |
267 | * ACPI doesn't provide any formal means to access adapter status. | 263 | * ACPI doesn't provide any formal means to access adapter status. |
268 | * Instead, we fake adapter status from _STA | 264 | * Instead, we fake adapter status from _STA. |
269 | * | ||
270 | */ | 265 | */ |
271 | static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | 266 | static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) |
272 | { | 267 | { |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 1e125b56c9a9..ff1b1c71291a 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -82,7 +82,6 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *contex | |||
82 | * 2. has _PS0 method | 82 | * 2. has _PS0 method |
83 | * 3. has _PS3 method | 83 | * 3. has _PS3 method |
84 | * 4. .. | 84 | * 4. .. |
85 | * | ||
86 | */ | 85 | */ |
87 | static int is_ejectable(acpi_handle handle) | 86 | static int is_ejectable(acpi_handle handle) |
88 | { | 87 | { |
@@ -986,10 +985,8 @@ static int power_off_slot(struct acpiphp_slot *slot) | |||
986 | 985 | ||
987 | 986 | ||
988 | /** | 987 | /** |
989 | * acpiphp_max_busnr - return the highest reserved bus number under | 988 | * acpiphp_max_busnr - return the highest reserved bus number under the given bus. |
990 | * the given bus. | ||
991 | * @bus: bus to start search with | 989 | * @bus: bus to start search with |
992 | * | ||
993 | */ | 990 | */ |
994 | static unsigned char acpiphp_max_busnr(struct pci_bus *bus) | 991 | static unsigned char acpiphp_max_busnr(struct pci_bus *bus) |
995 | { | 992 | { |
@@ -1018,7 +1015,6 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus) | |||
1018 | /** | 1015 | /** |
1019 | * acpiphp_bus_add - add a new bus to acpi subsystem | 1016 | * acpiphp_bus_add - add a new bus to acpi subsystem |
1020 | * @func: acpiphp_func of the bridge | 1017 | * @func: acpiphp_func of the bridge |
1021 | * | ||
1022 | */ | 1018 | */ |
1023 | static int acpiphp_bus_add(struct acpiphp_func *func) | 1019 | static int acpiphp_bus_add(struct acpiphp_func *func) |
1024 | { | 1020 | { |
@@ -1063,7 +1059,6 @@ acpiphp_bus_add_out: | |||
1063 | /** | 1059 | /** |
1064 | * acpiphp_bus_trim - trim a bus from acpi subsystem | 1060 | * acpiphp_bus_trim - trim a bus from acpi subsystem |
1065 | * @handle: handle to acpi namespace | 1061 | * @handle: handle to acpi namespace |
1066 | * | ||
1067 | */ | 1062 | */ |
1068 | static int acpiphp_bus_trim(acpi_handle handle) | 1063 | static int acpiphp_bus_trim(acpi_handle handle) |
1069 | { | 1064 | { |
@@ -1089,7 +1084,6 @@ static int acpiphp_bus_trim(acpi_handle handle) | |||
1089 | * | 1084 | * |
1090 | * This function should be called per *physical slot*, | 1085 | * This function should be called per *physical slot*, |
1091 | * not per each slot object in ACPI namespace. | 1086 | * not per each slot object in ACPI namespace. |
1092 | * | ||
1093 | */ | 1087 | */ |
1094 | static int enable_device(struct acpiphp_slot *slot) | 1088 | static int enable_device(struct acpiphp_slot *slot) |
1095 | { | 1089 | { |
@@ -1185,6 +1179,7 @@ static void disable_bridges(struct pci_bus *bus) | |||
1185 | 1179 | ||
1186 | /** | 1180 | /** |
1187 | * disable_device - disable a slot | 1181 | * disable_device - disable a slot |
1182 | * @slot: ACPI PHP slot | ||
1188 | */ | 1183 | */ |
1189 | static int disable_device(struct acpiphp_slot *slot) | 1184 | static int disable_device(struct acpiphp_slot *slot) |
1190 | { | 1185 | { |
@@ -1240,14 +1235,15 @@ static int disable_device(struct acpiphp_slot *slot) | |||
1240 | 1235 | ||
1241 | /** | 1236 | /** |
1242 | * get_slot_status - get ACPI slot status | 1237 | * get_slot_status - get ACPI slot status |
1238 | * @slot: ACPI PHP slot | ||
1243 | * | 1239 | * |
1244 | * if a slot has _STA for each function and if any one of them | 1240 | * If a slot has _STA for each function and if any one of them |
1245 | * returned non-zero status, return it | 1241 | * returned non-zero status, return it. |
1246 | * | 1242 | * |
1247 | * if a slot doesn't have _STA and if any one of its functions' | 1243 | * If a slot doesn't have _STA and if any one of its functions' |
1248 | * configuration space is configured, return 0x0f as a _STA | 1244 | * configuration space is configured, return 0x0f as a _STA. |
1249 | * | 1245 | * |
1250 | * otherwise return 0 | 1246 | * Otherwise return 0. |
1251 | */ | 1247 | */ |
1252 | static unsigned int get_slot_status(struct acpiphp_slot *slot) | 1248 | static unsigned int get_slot_status(struct acpiphp_slot *slot) |
1253 | { | 1249 | { |
@@ -1281,6 +1277,7 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot) | |||
1281 | 1277 | ||
1282 | /** | 1278 | /** |
1283 | * acpiphp_eject_slot - physically eject the slot | 1279 | * acpiphp_eject_slot - physically eject the slot |
1280 | * @slot: ACPI PHP slot | ||
1284 | */ | 1281 | */ |
1285 | int acpiphp_eject_slot(struct acpiphp_slot *slot) | 1282 | int acpiphp_eject_slot(struct acpiphp_slot *slot) |
1286 | { | 1283 | { |
@@ -1314,6 +1311,7 @@ int acpiphp_eject_slot(struct acpiphp_slot *slot) | |||
1314 | 1311 | ||
1315 | /** | 1312 | /** |
1316 | * acpiphp_check_bridge - re-enumerate devices | 1313 | * acpiphp_check_bridge - re-enumerate devices |
1314 | * @bridge: where to begin re-enumeration | ||
1317 | * | 1315 | * |
1318 | * Iterate over all slots under this bridge and make sure that if a | 1316 | * Iterate over all slots under this bridge and make sure that if a |
1319 | * card is present they are enabled, and if not they are disabled. | 1317 | * card is present they are enabled, and if not they are disabled. |
@@ -1538,13 +1536,11 @@ check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
1538 | 1536 | ||
1539 | /** | 1537 | /** |
1540 | * handle_hotplug_event_bridge - handle ACPI event on bridges | 1538 | * handle_hotplug_event_bridge - handle ACPI event on bridges |
1541 | * | ||
1542 | * @handle: Notify()'ed acpi_handle | 1539 | * @handle: Notify()'ed acpi_handle |
1543 | * @type: Notify code | 1540 | * @type: Notify code |
1544 | * @context: pointer to acpiphp_bridge structure | 1541 | * @context: pointer to acpiphp_bridge structure |
1545 | * | 1542 | * |
1546 | * handles ACPI event notification on {host,p2p} bridges | 1543 | * Handles ACPI event notification on {host,p2p} bridges. |
1547 | * | ||
1548 | */ | 1544 | */ |
1549 | static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *context) | 1545 | static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *context) |
1550 | { | 1546 | { |
@@ -1634,13 +1630,11 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont | |||
1634 | 1630 | ||
1635 | /** | 1631 | /** |
1636 | * handle_hotplug_event_func - handle ACPI event on functions (i.e. slots) | 1632 | * handle_hotplug_event_func - handle ACPI event on functions (i.e. slots) |
1637 | * | ||
1638 | * @handle: Notify()'ed acpi_handle | 1633 | * @handle: Notify()'ed acpi_handle |
1639 | * @type: Notify code | 1634 | * @type: Notify code |
1640 | * @context: pointer to acpiphp_func structure | 1635 | * @context: pointer to acpiphp_func structure |
1641 | * | 1636 | * |
1642 | * handles ACPI event notification on slots | 1637 | * Handles ACPI event notification on slots. |
1643 | * | ||
1644 | */ | 1638 | */ |
1645 | static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context) | 1639 | static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context) |
1646 | { | 1640 | { |
@@ -1705,7 +1699,6 @@ static struct acpi_pci_driver acpi_pci_hp_driver = { | |||
1705 | 1699 | ||
1706 | /** | 1700 | /** |
1707 | * acpiphp_glue_init - initializes all PCI hotplug - ACPI glue data structures | 1701 | * acpiphp_glue_init - initializes all PCI hotplug - ACPI glue data structures |
1708 | * | ||
1709 | */ | 1702 | */ |
1710 | int __init acpiphp_glue_init(void) | 1703 | int __init acpiphp_glue_init(void) |
1711 | { | 1704 | { |
@@ -1726,7 +1719,7 @@ int __init acpiphp_glue_init(void) | |||
1726 | /** | 1719 | /** |
1727 | * acpiphp_glue_exit - terminates all PCI hotplug - ACPI glue data structures | 1720 | * acpiphp_glue_exit - terminates all PCI hotplug - ACPI glue data structures |
1728 | * | 1721 | * |
1729 | * This function frees all data allocated in acpiphp_glue_init() | 1722 | * This function frees all data allocated in acpiphp_glue_init(). |
1730 | */ | 1723 | */ |
1731 | void acpiphp_glue_exit(void) | 1724 | void acpiphp_glue_exit(void) |
1732 | { | 1725 | { |
@@ -1760,7 +1753,6 @@ int __init acpiphp_get_num_slots(void) | |||
1760 | * acpiphp_for_each_slot - call function for each slot | 1753 | * acpiphp_for_each_slot - call function for each slot |
1761 | * @fn: callback function | 1754 | * @fn: callback function |
1762 | * @data: context to be passed to callback function | 1755 | * @data: context to be passed to callback function |
1763 | * | ||
1764 | */ | 1756 | */ |
1765 | static int acpiphp_for_each_slot(acpiphp_callback fn, void *data) | 1757 | static int acpiphp_for_each_slot(acpiphp_callback fn, void *data) |
1766 | { | 1758 | { |
@@ -1786,6 +1778,7 @@ static int acpiphp_for_each_slot(acpiphp_callback fn, void *data) | |||
1786 | 1778 | ||
1787 | /** | 1779 | /** |
1788 | * acpiphp_enable_slot - power on slot | 1780 | * acpiphp_enable_slot - power on slot |
1781 | * @slot: ACPI PHP slot | ||
1789 | */ | 1782 | */ |
1790 | int acpiphp_enable_slot(struct acpiphp_slot *slot) | 1783 | int acpiphp_enable_slot(struct acpiphp_slot *slot) |
1791 | { | 1784 | { |
@@ -1815,6 +1808,7 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot) | |||
1815 | 1808 | ||
1816 | /** | 1809 | /** |
1817 | * acpiphp_disable_slot - power off slot | 1810 | * acpiphp_disable_slot - power off slot |
1811 | * @slot: ACPI PHP slot | ||
1818 | */ | 1812 | */ |
1819 | int acpiphp_disable_slot(struct acpiphp_slot *slot) | 1813 | int acpiphp_disable_slot(struct acpiphp_slot *slot) |
1820 | { | 1814 | { |
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index 56829f82be4a..47d26b65e99a 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c | |||
@@ -134,11 +134,11 @@ static struct acpiphp_attention_info ibm_attention_info = | |||
134 | * ibm_slot_from_id - workaround for bad ibm hardware | 134 | * ibm_slot_from_id - workaround for bad ibm hardware |
135 | * @id: the slot number that linux refers to the slot by | 135 | * @id: the slot number that linux refers to the slot by |
136 | * | 136 | * |
137 | * Description: this method returns the aCPI slot descriptor | 137 | * Description: This method returns the aCPI slot descriptor |
138 | * corresponding to the Linux slot number. This descriptor | 138 | * corresponding to the Linux slot number. This descriptor |
139 | * has info about the aPCI slot id and attention status. | 139 | * has info about the aPCI slot id and attention status. |
140 | * This descriptor must be freed using kfree when done. | 140 | * This descriptor must be freed using kfree when done. |
141 | **/ | 141 | */ |
142 | static union apci_descriptor *ibm_slot_from_id(int id) | 142 | static union apci_descriptor *ibm_slot_from_id(int id) |
143 | { | 143 | { |
144 | int ind = 0, size; | 144 | int ind = 0, size; |
@@ -173,9 +173,9 @@ ibm_slot_done: | |||
173 | * @slot: the hotplug_slot to work with | 173 | * @slot: the hotplug_slot to work with |
174 | * @status: what to set the LED to (0 or 1) | 174 | * @status: what to set the LED to (0 or 1) |
175 | * | 175 | * |
176 | * Description: this method is registered with the acpiphp module as a | 176 | * Description: This method is registered with the acpiphp module as a |
177 | * callback to do the device specific task of setting the LED status | 177 | * callback to do the device specific task of setting the LED status. |
178 | **/ | 178 | */ |
179 | static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status) | 179 | static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status) |
180 | { | 180 | { |
181 | union acpi_object args[2]; | 181 | union acpi_object args[2]; |
@@ -213,13 +213,13 @@ static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status) | |||
213 | * @slot: the hotplug_slot to work with | 213 | * @slot: the hotplug_slot to work with |
214 | * @status: returns what the LED is set to (0 or 1) | 214 | * @status: returns what the LED is set to (0 or 1) |
215 | * | 215 | * |
216 | * Description: this method is registered with the acpiphp module as a | 216 | * Description: This method is registered with the acpiphp module as a |
217 | * callback to do the device specific task of getting the LED status | 217 | * callback to do the device specific task of getting the LED status. |
218 | * | 218 | * |
219 | * Because there is no direct method of getting the LED status directly | 219 | * Because there is no direct method of getting the LED status directly |
220 | * from an ACPI call, we read the aPCI table and parse out our | 220 | * from an ACPI call, we read the aPCI table and parse out our |
221 | * slot descriptor to read the status from that. | 221 | * slot descriptor to read the status from that. |
222 | **/ | 222 | */ |
223 | static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status) | 223 | static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status) |
224 | { | 224 | { |
225 | union apci_descriptor *ibm_slot; | 225 | union apci_descriptor *ibm_slot; |
@@ -245,8 +245,8 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status) | |||
245 | * @event: the event info (device specific) | 245 | * @event: the event info (device specific) |
246 | * @context: passed context (our notification struct) | 246 | * @context: passed context (our notification struct) |
247 | * | 247 | * |
248 | * Description: this method is registered as a callback with the ACPI | 248 | * Description: This method is registered as a callback with the ACPI |
249 | * subsystem it is called when this device has an event to notify the OS of | 249 | * subsystem it is called when this device has an event to notify the OS of. |
250 | * | 250 | * |
251 | * The events actually come from the device as two events that get | 251 | * The events actually come from the device as two events that get |
252 | * synthesized into one event with data by this function. The event | 252 | * synthesized into one event with data by this function. The event |
@@ -256,7 +256,7 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status) | |||
256 | * From section 5.6.2.2 of the ACPI 2.0 spec, I understand that the OSPM will | 256 | * From section 5.6.2.2 of the ACPI 2.0 spec, I understand that the OSPM will |
257 | * only re-enable the interrupt that causes this event AFTER this method | 257 | * only re-enable the interrupt that causes this event AFTER this method |
258 | * has returned, thereby enforcing serial access for the notification struct. | 258 | * has returned, thereby enforcing serial access for the notification struct. |
259 | **/ | 259 | */ |
260 | static void ibm_handle_events(acpi_handle handle, u32 event, void *context) | 260 | static void ibm_handle_events(acpi_handle handle, u32 event, void *context) |
261 | { | 261 | { |
262 | u8 detail = event & 0x0f; | 262 | u8 detail = event & 0x0f; |
@@ -279,16 +279,16 @@ static void ibm_handle_events(acpi_handle handle, u32 event, void *context) | |||
279 | * ibm_get_table_from_acpi - reads the APLS buffer from ACPI | 279 | * ibm_get_table_from_acpi - reads the APLS buffer from ACPI |
280 | * @bufp: address to pointer to allocate for the table | 280 | * @bufp: address to pointer to allocate for the table |
281 | * | 281 | * |
282 | * Description: this method reads the APLS buffer in from ACPI and | 282 | * Description: This method reads the APLS buffer in from ACPI and |
283 | * stores the "stripped" table into a single buffer | 283 | * stores the "stripped" table into a single buffer |
284 | * it allocates and passes the address back in bufp | 284 | * it allocates and passes the address back in bufp. |
285 | * | 285 | * |
286 | * If NULL is passed in as buffer, this method only calculates | 286 | * If NULL is passed in as buffer, this method only calculates |
287 | * the size of the table and returns that without filling | 287 | * the size of the table and returns that without filling |
288 | * in the buffer | 288 | * in the buffer. |
289 | * | 289 | * |
290 | * returns < 0 on error or the size of the table on success | 290 | * Returns < 0 on error or the size of the table on success. |
291 | **/ | 291 | */ |
292 | static int ibm_get_table_from_acpi(char **bufp) | 292 | static int ibm_get_table_from_acpi(char **bufp) |
293 | { | 293 | { |
294 | union acpi_object *package; | 294 | union acpi_object *package; |
@@ -349,17 +349,18 @@ read_table_done: | |||
349 | /** | 349 | /** |
350 | * ibm_read_apci_table - callback for the sysfs apci_table file | 350 | * ibm_read_apci_table - callback for the sysfs apci_table file |
351 | * @kobj: the kobject this binary attribute is a part of | 351 | * @kobj: the kobject this binary attribute is a part of |
352 | * @bin_attr: struct bin_attribute for this file | ||
352 | * @buffer: the kernel space buffer to fill | 353 | * @buffer: the kernel space buffer to fill |
353 | * @pos: the offset into the file | 354 | * @pos: the offset into the file |
354 | * @size: the number of bytes requested | 355 | * @size: the number of bytes requested |
355 | * | 356 | * |
356 | * Description: gets registered with sysfs as the reader callback | 357 | * Description: Gets registered with sysfs as the reader callback |
357 | * to be executed when /sys/bus/pci/slots/apci_table gets read | 358 | * to be executed when /sys/bus/pci/slots/apci_table gets read. |
358 | * | 359 | * |
359 | * Since we don't get notified on open and close for this file, | 360 | * Since we don't get notified on open and close for this file, |
360 | * things get really tricky here... | 361 | * things get really tricky here... |
361 | * our solution is to only allow reading the table in all at once | 362 | * our solution is to only allow reading the table in all at once. |
362 | **/ | 363 | */ |
363 | static ssize_t ibm_read_apci_table(struct kobject *kobj, | 364 | static ssize_t ibm_read_apci_table(struct kobject *kobj, |
364 | struct bin_attribute *bin_attr, | 365 | struct bin_attribute *bin_attr, |
365 | char *buffer, loff_t pos, size_t size) | 366 | char *buffer, loff_t pos, size_t size) |
@@ -385,10 +386,10 @@ static ssize_t ibm_read_apci_table(struct kobject *kobj, | |||
385 | * @context: a pointer to our handle to fill when we find the device | 386 | * @context: a pointer to our handle to fill when we find the device |
386 | * @rv: a return value to fill if desired | 387 | * @rv: a return value to fill if desired |
387 | * | 388 | * |
388 | * Description: used as a callback when calling acpi_walk_namespace | 389 | * Description: Used as a callback when calling acpi_walk_namespace |
389 | * to find our device. When this method returns non-zero | 390 | * to find our device. When this method returns non-zero |
390 | * acpi_walk_namespace quits its search and returns our value | 391 | * acpi_walk_namespace quits its search and returns our value. |
391 | **/ | 392 | */ |
392 | static acpi_status __init ibm_find_acpi_device(acpi_handle handle, | 393 | static acpi_status __init ibm_find_acpi_device(acpi_handle handle, |
393 | u32 lvl, void *context, void **rv) | 394 | u32 lvl, void *context, void **rv) |
394 | { | 395 | { |
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index a96b739b2d35..74178875b949 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
@@ -117,12 +117,10 @@ static inline int is_slot66mhz(struct slot *slot) | |||
117 | 117 | ||
118 | /** | 118 | /** |
119 | * detect_SMBIOS_pointer - find the System Management BIOS Table in mem region. | 119 | * detect_SMBIOS_pointer - find the System Management BIOS Table in mem region. |
120 | * | ||
121 | * @begin: begin pointer for region to be scanned. | 120 | * @begin: begin pointer for region to be scanned. |
122 | * @end: end pointer for region to be scanned. | 121 | * @end: end pointer for region to be scanned. |
123 | * | 122 | * |
124 | * Returns pointer to the head of the SMBIOS tables (or NULL) | 123 | * Returns pointer to the head of the SMBIOS tables (or %NULL). |
125 | * | ||
126 | */ | 124 | */ |
127 | static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end) | 125 | static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end) |
128 | { | 126 | { |
@@ -157,9 +155,9 @@ static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *e | |||
157 | 155 | ||
158 | /** | 156 | /** |
159 | * init_SERR - Initializes the per slot SERR generation. | 157 | * init_SERR - Initializes the per slot SERR generation. |
158 | * @ctrl: controller to use | ||
160 | * | 159 | * |
161 | * For unexpected switch opens | 160 | * For unexpected switch opens |
162 | * | ||
163 | */ | 161 | */ |
164 | static int init_SERR(struct controller * ctrl) | 162 | static int init_SERR(struct controller * ctrl) |
165 | { | 163 | { |
@@ -224,14 +222,15 @@ static int pci_print_IRQ_route (void) | |||
224 | 222 | ||
225 | /** | 223 | /** |
226 | * get_subsequent_smbios_entry: get the next entry from bios table. | 224 | * get_subsequent_smbios_entry: get the next entry from bios table. |
227 | * | 225 | * @smbios_start: where to start in the SMBIOS table |
228 | * Gets the first entry if previous == NULL | 226 | * @smbios_table: location of the SMBIOS table |
229 | * Otherwise, returns the next entry | ||
230 | * Uses global SMBIOS Table pointer | ||
231 | * | ||
232 | * @curr: %NULL or pointer to previously returned structure | 227 | * @curr: %NULL or pointer to previously returned structure |
233 | * | 228 | * |
234 | * returns a pointer to an SMBIOS structure or NULL if none found | 229 | * Gets the first entry if previous == NULL; |
230 | * otherwise, returns the next entry. | ||
231 | * Uses global SMBIOS Table pointer. | ||
232 | * | ||
233 | * Returns a pointer to an SMBIOS structure or NULL if none found. | ||
235 | */ | 234 | */ |
236 | static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start, | 235 | static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start, |
237 | void __iomem *smbios_table, | 236 | void __iomem *smbios_table, |
@@ -272,17 +271,18 @@ static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start, | |||
272 | 271 | ||
273 | 272 | ||
274 | /** | 273 | /** |
275 | * get_SMBIOS_entry | 274 | * get_SMBIOS_entry - return the requested SMBIOS entry or %NULL |
276 | * | 275 | * @smbios_start: where to start in the SMBIOS table |
277 | * @type:SMBIOS structure type to be returned | 276 | * @smbios_table: location of the SMBIOS table |
277 | * @type: SMBIOS structure type to be returned | ||
278 | * @previous: %NULL or pointer to previously returned structure | 278 | * @previous: %NULL or pointer to previously returned structure |
279 | * | 279 | * |
280 | * Gets the first entry of the specified type if previous == NULL | 280 | * Gets the first entry of the specified type if previous == %NULL; |
281 | * Otherwise, returns the next entry of the given type. | 281 | * Otherwise, returns the next entry of the given type. |
282 | * Uses global SMBIOS Table pointer | 282 | * Uses global SMBIOS Table pointer. |
283 | * Uses get_subsequent_smbios_entry | 283 | * Uses get_subsequent_smbios_entry. |
284 | * | 284 | * |
285 | * returns a pointer to an SMBIOS structure or %NULL if none found | 285 | * Returns a pointer to an SMBIOS structure or %NULL if none found. |
286 | */ | 286 | */ |
287 | static void __iomem *get_SMBIOS_entry(void __iomem *smbios_start, | 287 | static void __iomem *get_SMBIOS_entry(void __iomem *smbios_start, |
288 | void __iomem *smbios_table, | 288 | void __iomem *smbios_table, |
@@ -581,7 +581,9 @@ get_slot_mapping(struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot) | |||
581 | 581 | ||
582 | /** | 582 | /** |
583 | * cpqhp_set_attention_status - Turns the Amber LED for a slot on or off | 583 | * cpqhp_set_attention_status - Turns the Amber LED for a slot on or off |
584 | * | 584 | * @ctrl: struct controller to use |
585 | * @func: PCI device/function info | ||
586 | * @status: LED control flag: 1 = LED on, 0 = LED off | ||
585 | */ | 587 | */ |
586 | static int | 588 | static int |
587 | cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | 589 | cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, |
@@ -621,7 +623,8 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | |||
621 | 623 | ||
622 | /** | 624 | /** |
623 | * set_attention_status - Turns the Amber LED for a slot on or off | 625 | * set_attention_status - Turns the Amber LED for a slot on or off |
624 | * | 626 | * @hotplug_slot: slot to change LED on |
627 | * @status: LED control flag | ||
625 | */ | 628 | */ |
626 | static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) | 629 | static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) |
627 | { | 630 | { |
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 856d57b4d604..4018420c6f95 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c | |||
@@ -123,7 +123,7 @@ static u8 handle_switch_change(u8 change, struct controller * ctrl) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | /** | 125 | /** |
126 | * cpqhp_find_slot: find the struct slot of given device | 126 | * cpqhp_find_slot - find the struct slot of given device |
127 | * @ctrl: scan lots of this controller | 127 | * @ctrl: scan lots of this controller |
128 | * @device: the device id to find | 128 | * @device: the device id to find |
129 | */ | 129 | */ |
@@ -305,9 +305,8 @@ static u8 handle_power_fault(u8 change, struct controller * ctrl) | |||
305 | 305 | ||
306 | 306 | ||
307 | /** | 307 | /** |
308 | * sort_by_size: sort nodes on the list by their length, smallest first. | 308 | * sort_by_size - sort nodes on the list by their length, smallest first. |
309 | * @head: list to sort | 309 | * @head: list to sort |
310 | * | ||
311 | */ | 310 | */ |
312 | static int sort_by_size(struct pci_resource **head) | 311 | static int sort_by_size(struct pci_resource **head) |
313 | { | 312 | { |
@@ -354,9 +353,8 @@ static int sort_by_size(struct pci_resource **head) | |||
354 | 353 | ||
355 | 354 | ||
356 | /** | 355 | /** |
357 | * sort_by_max_size: sort nodes on the list by their length, largest first. | 356 | * sort_by_max_size - sort nodes on the list by their length, largest first. |
358 | * @head: list to sort | 357 | * @head: list to sort |
359 | * | ||
360 | */ | 358 | */ |
361 | static int sort_by_max_size(struct pci_resource **head) | 359 | static int sort_by_max_size(struct pci_resource **head) |
362 | { | 360 | { |
@@ -403,8 +401,10 @@ static int sort_by_max_size(struct pci_resource **head) | |||
403 | 401 | ||
404 | 402 | ||
405 | /** | 403 | /** |
406 | * do_pre_bridge_resource_split: find node of resources that are unused | 404 | * do_pre_bridge_resource_split - find node of resources that are unused |
407 | * | 405 | * @head: new list head |
406 | * @orig_head: original list head | ||
407 | * @alignment: max node size (?) | ||
408 | */ | 408 | */ |
409 | static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head, | 409 | static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head, |
410 | struct pci_resource **orig_head, u32 alignment) | 410 | struct pci_resource **orig_head, u32 alignment) |
@@ -477,8 +477,9 @@ static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **h | |||
477 | 477 | ||
478 | 478 | ||
479 | /** | 479 | /** |
480 | * do_bridge_resource_split: find one node of resources that aren't in use | 480 | * do_bridge_resource_split - find one node of resources that aren't in use |
481 | * | 481 | * @head: list head |
482 | * @alignment: max node size (?) | ||
482 | */ | 483 | */ |
483 | static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment) | 484 | static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment) |
484 | { | 485 | { |
@@ -525,14 +526,13 @@ error: | |||
525 | 526 | ||
526 | 527 | ||
527 | /** | 528 | /** |
528 | * get_io_resource: find first node of given size not in ISA aliasing window. | 529 | * get_io_resource - find first node of given size not in ISA aliasing window. |
529 | * @head: list to search | 530 | * @head: list to search |
530 | * @size: size of node to find, must be a power of two. | 531 | * @size: size of node to find, must be a power of two. |
531 | * | 532 | * |
532 | * Description: this function sorts the resource list by size and then returns | 533 | * Description: This function sorts the resource list by size and then returns |
533 | * returns the first node of "size" length that is not in the ISA aliasing | 534 | * returns the first node of "size" length that is not in the ISA aliasing |
534 | * window. If it finds a node larger than "size" it will split it up. | 535 | * window. If it finds a node larger than "size" it will split it up. |
535 | * | ||
536 | */ | 536 | */ |
537 | static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size) | 537 | static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size) |
538 | { | 538 | { |
@@ -620,7 +620,7 @@ static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size | |||
620 | 620 | ||
621 | 621 | ||
622 | /** | 622 | /** |
623 | * get_max_resource: get largest node which has at least the given size. | 623 | * get_max_resource - get largest node which has at least the given size. |
624 | * @head: the list to search the node in | 624 | * @head: the list to search the node in |
625 | * @size: the minimum size of the node to find | 625 | * @size: the minimum size of the node to find |
626 | * | 626 | * |
@@ -712,7 +712,7 @@ static struct pci_resource *get_max_resource(struct pci_resource **head, u32 siz | |||
712 | 712 | ||
713 | 713 | ||
714 | /** | 714 | /** |
715 | * get_resource: find resource of given size and split up larger ones. | 715 | * get_resource - find resource of given size and split up larger ones. |
716 | * @head: the list to search for resources | 716 | * @head: the list to search for resources |
717 | * @size: the size limit to use | 717 | * @size: the size limit to use |
718 | * | 718 | * |
@@ -804,14 +804,14 @@ static struct pci_resource *get_resource(struct pci_resource **head, u32 size) | |||
804 | 804 | ||
805 | 805 | ||
806 | /** | 806 | /** |
807 | * cpqhp_resource_sort_and_combine: sort nodes by base addresses and clean up. | 807 | * cpqhp_resource_sort_and_combine - sort nodes by base addresses and clean up |
808 | * @head: the list to sort and clean up | 808 | * @head: the list to sort and clean up |
809 | * | 809 | * |
810 | * Description: Sorts all of the nodes in the list in ascending order by | 810 | * Description: Sorts all of the nodes in the list in ascending order by |
811 | * their base addresses. Also does garbage collection by | 811 | * their base addresses. Also does garbage collection by |
812 | * combining adjacent nodes. | 812 | * combining adjacent nodes. |
813 | * | 813 | * |
814 | * returns 0 if success | 814 | * Returns %0 if success. |
815 | */ | 815 | */ |
816 | int cpqhp_resource_sort_and_combine(struct pci_resource **head) | 816 | int cpqhp_resource_sort_and_combine(struct pci_resource **head) |
817 | { | 817 | { |
@@ -951,9 +951,9 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data) | |||
951 | 951 | ||
952 | /** | 952 | /** |
953 | * cpqhp_slot_create - Creates a node and adds it to the proper bus. | 953 | * cpqhp_slot_create - Creates a node and adds it to the proper bus. |
954 | * @busnumber - bus where new node is to be located | 954 | * @busnumber: bus where new node is to be located |
955 | * | 955 | * |
956 | * Returns pointer to the new node or NULL if unsuccessful | 956 | * Returns pointer to the new node or %NULL if unsuccessful. |
957 | */ | 957 | */ |
958 | struct pci_func *cpqhp_slot_create(u8 busnumber) | 958 | struct pci_func *cpqhp_slot_create(u8 busnumber) |
959 | { | 959 | { |
@@ -986,7 +986,7 @@ struct pci_func *cpqhp_slot_create(u8 busnumber) | |||
986 | * slot_remove - Removes a node from the linked list of slots. | 986 | * slot_remove - Removes a node from the linked list of slots. |
987 | * @old_slot: slot to remove | 987 | * @old_slot: slot to remove |
988 | * | 988 | * |
989 | * Returns 0 if successful, !0 otherwise. | 989 | * Returns %0 if successful, !0 otherwise. |
990 | */ | 990 | */ |
991 | static int slot_remove(struct pci_func * old_slot) | 991 | static int slot_remove(struct pci_func * old_slot) |
992 | { | 992 | { |
@@ -1026,7 +1026,7 @@ static int slot_remove(struct pci_func * old_slot) | |||
1026 | * bridge_slot_remove - Removes a node from the linked list of slots. | 1026 | * bridge_slot_remove - Removes a node from the linked list of slots. |
1027 | * @bridge: bridge to remove | 1027 | * @bridge: bridge to remove |
1028 | * | 1028 | * |
1029 | * Returns 0 if successful, !0 otherwise. | 1029 | * Returns %0 if successful, !0 otherwise. |
1030 | */ | 1030 | */ |
1031 | static int bridge_slot_remove(struct pci_func *bridge) | 1031 | static int bridge_slot_remove(struct pci_func *bridge) |
1032 | { | 1032 | { |
@@ -1071,7 +1071,7 @@ out: | |||
1071 | * cpqhp_slot_find - Looks for a node by bus, and device, multiple functions accessed | 1071 | * cpqhp_slot_find - Looks for a node by bus, and device, multiple functions accessed |
1072 | * @bus: bus to find | 1072 | * @bus: bus to find |
1073 | * @device: device to find | 1073 | * @device: device to find |
1074 | * @index: is 0 for first function found, 1 for the second... | 1074 | * @index: is %0 for first function found, %1 for the second... |
1075 | * | 1075 | * |
1076 | * Returns pointer to the node if successful, %NULL otherwise. | 1076 | * Returns pointer to the node if successful, %NULL otherwise. |
1077 | */ | 1077 | */ |
@@ -1115,16 +1115,13 @@ static int is_bridge(struct pci_func * func) | |||
1115 | 1115 | ||
1116 | 1116 | ||
1117 | /** | 1117 | /** |
1118 | * set_controller_speed - set the frequency and/or mode of a specific | 1118 | * set_controller_speed - set the frequency and/or mode of a specific controller segment. |
1119 | * controller segment. | ||
1120 | * | ||
1121 | * @ctrl: controller to change frequency/mode for. | 1119 | * @ctrl: controller to change frequency/mode for. |
1122 | * @adapter_speed: the speed of the adapter we want to match. | 1120 | * @adapter_speed: the speed of the adapter we want to match. |
1123 | * @hp_slot: the slot number where the adapter is installed. | 1121 | * @hp_slot: the slot number where the adapter is installed. |
1124 | * | 1122 | * |
1125 | * Returns 0 if we successfully change frequency and/or mode to match the | 1123 | * Returns %0 if we successfully change frequency and/or mode to match the |
1126 | * adapter speed. | 1124 | * adapter speed. |
1127 | * | ||
1128 | */ | 1125 | */ |
1129 | static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot) | 1126 | static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot) |
1130 | { | 1127 | { |
@@ -1253,13 +1250,14 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_ | |||
1253 | 1250 | ||
1254 | /** | 1251 | /** |
1255 | * board_replaced - Called after a board has been replaced in the system. | 1252 | * board_replaced - Called after a board has been replaced in the system. |
1253 | * @func: PCI device/function information | ||
1254 | * @ctrl: hotplug controller | ||
1256 | * | 1255 | * |
1257 | * This is only used if we don't have resources for hot add | 1256 | * This is only used if we don't have resources for hot add. |
1258 | * Turns power on for the board | 1257 | * Turns power on for the board. |
1259 | * Checks to see if board is the same | 1258 | * Checks to see if board is the same. |
1260 | * If board is same, reconfigures it | 1259 | * If board is same, reconfigures it. |
1261 | * If board isn't same, turns it back off. | 1260 | * If board isn't same, turns it back off. |
1262 | * | ||
1263 | */ | 1261 | */ |
1264 | static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | 1262 | static u32 board_replaced(struct pci_func *func, struct controller *ctrl) |
1265 | { | 1263 | { |
@@ -1403,10 +1401,11 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1403 | 1401 | ||
1404 | /** | 1402 | /** |
1405 | * board_added - Called after a board has been added to the system. | 1403 | * board_added - Called after a board has been added to the system. |
1404 | * @func: PCI device/function info | ||
1405 | * @ctrl: hotplug controller | ||
1406 | * | 1406 | * |
1407 | * Turns power on for the board | 1407 | * Turns power on for the board. |
1408 | * Configures board | 1408 | * Configures board. |
1409 | * | ||
1410 | */ | 1409 | */ |
1411 | static u32 board_added(struct pci_func *func, struct controller *ctrl) | 1410 | static u32 board_added(struct pci_func *func, struct controller *ctrl) |
1412 | { | 1411 | { |
@@ -1607,8 +1606,10 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1607 | 1606 | ||
1608 | 1607 | ||
1609 | /** | 1608 | /** |
1610 | * remove_board - Turns off slot and LED's | 1609 | * remove_board - Turns off slot and LEDs |
1611 | * | 1610 | * @func: PCI device/function info |
1611 | * @replace_flag: whether replacing or adding a new device | ||
1612 | * @ctrl: target controller | ||
1612 | */ | 1613 | */ |
1613 | static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl) | 1614 | static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl) |
1614 | { | 1615 | { |
@@ -1902,11 +1903,11 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1902 | 1903 | ||
1903 | 1904 | ||
1904 | /** | 1905 | /** |
1905 | * cpqhp_pushbutton_thread | 1906 | * cpqhp_pushbutton_thread - handle pushbutton events |
1907 | * @slot: target slot (struct) | ||
1906 | * | 1908 | * |
1907 | * Scheduled procedure to handle blocking stuff for the pushbuttons | 1909 | * Scheduled procedure to handle blocking stuff for the pushbuttons. |
1908 | * Handles all pending events and exits. | 1910 | * Handles all pending events and exits. |
1909 | * | ||
1910 | */ | 1911 | */ |
1911 | void cpqhp_pushbutton_thread(unsigned long slot) | 1912 | void cpqhp_pushbutton_thread(unsigned long slot) |
1912 | { | 1913 | { |
@@ -2137,9 +2138,10 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func) | |||
2137 | } | 2138 | } |
2138 | 2139 | ||
2139 | /** | 2140 | /** |
2140 | * switch_leds: switch the leds, go from one site to the other. | 2141 | * switch_leds - switch the leds, go from one site to the other. |
2141 | * @ctrl: controller to use | 2142 | * @ctrl: controller to use |
2142 | * @num_of_slots: number of slots to use | 2143 | * @num_of_slots: number of slots to use |
2144 | * @work_LED: LED control value | ||
2143 | * @direction: 1 to start from the left side, 0 to start right. | 2145 | * @direction: 1 to start from the left side, 0 to start right. |
2144 | */ | 2146 | */ |
2145 | static void switch_leds(struct controller *ctrl, const int num_of_slots, | 2147 | static void switch_leds(struct controller *ctrl, const int num_of_slots, |
@@ -2165,11 +2167,11 @@ static void switch_leds(struct controller *ctrl, const int num_of_slots, | |||
2165 | } | 2167 | } |
2166 | 2168 | ||
2167 | /** | 2169 | /** |
2168 | * hardware_test - runs hardware tests | 2170 | * cpqhp_hardware_test - runs hardware tests |
2171 | * @ctrl: target controller | ||
2172 | * @test_num: the number written to the "test" file in sysfs. | ||
2169 | * | 2173 | * |
2170 | * For hot plug ctrl folks to play with. | 2174 | * For hot plug ctrl folks to play with. |
2171 | * test_num is the number written to the "test" file in sysfs | ||
2172 | * | ||
2173 | */ | 2175 | */ |
2174 | int cpqhp_hardware_test(struct controller *ctrl, int test_num) | 2176 | int cpqhp_hardware_test(struct controller *ctrl, int test_num) |
2175 | { | 2177 | { |
@@ -2249,14 +2251,12 @@ int cpqhp_hardware_test(struct controller *ctrl, int test_num) | |||
2249 | 2251 | ||
2250 | /** | 2252 | /** |
2251 | * configure_new_device - Configures the PCI header information of one board. | 2253 | * configure_new_device - Configures the PCI header information of one board. |
2252 | * | ||
2253 | * @ctrl: pointer to controller structure | 2254 | * @ctrl: pointer to controller structure |
2254 | * @func: pointer to function structure | 2255 | * @func: pointer to function structure |
2255 | * @behind_bridge: 1 if this is a recursive call, 0 if not | 2256 | * @behind_bridge: 1 if this is a recursive call, 0 if not |
2256 | * @resources: pointer to set of resource lists | 2257 | * @resources: pointer to set of resource lists |
2257 | * | 2258 | * |
2258 | * Returns 0 if success | 2259 | * Returns 0 if success. |
2259 | * | ||
2260 | */ | 2260 | */ |
2261 | static u32 configure_new_device(struct controller * ctrl, struct pci_func * func, | 2261 | static u32 configure_new_device(struct controller * ctrl, struct pci_func * func, |
2262 | u8 behind_bridge, struct resource_lists * resources) | 2262 | u8 behind_bridge, struct resource_lists * resources) |
@@ -2346,15 +2346,13 @@ static u32 configure_new_device(struct controller * ctrl, struct pci_func * func | |||
2346 | 2346 | ||
2347 | /** | 2347 | /** |
2348 | * configure_new_function - Configures the PCI header information of one device | 2348 | * configure_new_function - Configures the PCI header information of one device |
2349 | * | ||
2350 | * @ctrl: pointer to controller structure | 2349 | * @ctrl: pointer to controller structure |
2351 | * @func: pointer to function structure | 2350 | * @func: pointer to function structure |
2352 | * @behind_bridge: 1 if this is a recursive call, 0 if not | 2351 | * @behind_bridge: 1 if this is a recursive call, 0 if not |
2353 | * @resources: pointer to set of resource lists | 2352 | * @resources: pointer to set of resource lists |
2354 | * | 2353 | * |
2355 | * Calls itself recursively for bridged devices. | 2354 | * Calls itself recursively for bridged devices. |
2356 | * Returns 0 if success | 2355 | * Returns 0 if success. |
2357 | * | ||
2358 | */ | 2356 | */ |
2359 | static int configure_new_function(struct controller *ctrl, struct pci_func *func, | 2357 | static int configure_new_function(struct controller *ctrl, struct pci_func *func, |
2360 | u8 behind_bridge, | 2358 | u8 behind_bridge, |
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c index 027f6865d7e3..d7a293e3faf5 100644 --- a/drivers/pci/hotplug/fakephp.c +++ b/drivers/pci/hotplug/fakephp.c | |||
@@ -165,11 +165,11 @@ static void remove_slot(struct dummy_slot *dslot) | |||
165 | } | 165 | } |
166 | 166 | ||
167 | /** | 167 | /** |
168 | * Rescan slot. | 168 | * pci_rescan_slot - Rescan slot |
169 | * Tries hard not to re-enable already existing devices | 169 | * @temp: Device template. Should be set: bus and devfn. |
170 | * also handles scanning of subfunctions | ||
171 | * | 170 | * |
172 | * @param temp Device template. Should be set: bus and devfn. | 171 | * Tries hard not to re-enable already existing devices; |
172 | * also handles scanning of subfunctions. | ||
173 | */ | 173 | */ |
174 | static void pci_rescan_slot(struct pci_dev *temp) | 174 | static void pci_rescan_slot(struct pci_dev *temp) |
175 | { | 175 | { |
@@ -229,10 +229,10 @@ static void pci_rescan_slot(struct pci_dev *temp) | |||
229 | 229 | ||
230 | 230 | ||
231 | /** | 231 | /** |
232 | * Rescan PCI bus. | 232 | * pci_rescan_bus - Rescan PCI bus |
233 | * call pci_rescan_slot for each possible function of the bus | 233 | * @bus: the PCI bus to rescan |
234 | * | 234 | * |
235 | * @param bus | 235 | * Call pci_rescan_slot for each possible function of the bus. |
236 | */ | 236 | */ |
237 | static void pci_rescan_bus(const struct pci_bus *bus) | 237 | static void pci_rescan_bus(const struct pci_bus *bus) |
238 | { | 238 | { |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index c8cb49c5a752..f1e0966cee95 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -208,10 +208,10 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
208 | 208 | ||
209 | /** | 209 | /** |
210 | * board_added - Called after a board has been added to the system. | 210 | * board_added - Called after a board has been added to the system. |
211 | * @p_slot: &slot where board is added | ||
211 | * | 212 | * |
212 | * Turns power on for the board | 213 | * Turns power on for the board. |
213 | * Configures board | 214 | * Configures board. |
214 | * | ||
215 | */ | 215 | */ |
216 | static int board_added(struct slot *p_slot) | 216 | static int board_added(struct slot *p_slot) |
217 | { | 217 | { |
@@ -276,8 +276,8 @@ err_exit: | |||
276 | } | 276 | } |
277 | 277 | ||
278 | /** | 278 | /** |
279 | * remove_board - Turns off slot and LED's | 279 | * remove_board - Turns off slot and LEDs |
280 | * | 280 | * @p_slot: slot where board is being removed |
281 | */ | 281 | */ |
282 | static int remove_board(struct slot *p_slot) | 282 | static int remove_board(struct slot *p_slot) |
283 | { | 283 | { |
@@ -319,11 +319,11 @@ struct power_work_info { | |||
319 | }; | 319 | }; |
320 | 320 | ||
321 | /** | 321 | /** |
322 | * pciehp_pushbutton_thread | 322 | * pciehp_power_thread - handle pushbutton events |
323 | * @work: &struct work_struct describing work to be done | ||
323 | * | 324 | * |
324 | * Scheduled procedure to handle blocking stuff for the pushbuttons | 325 | * Scheduled procedure to handle blocking stuff for the pushbuttons. |
325 | * Handles all pending events and exits. | 326 | * Handles all pending events and exits. |
326 | * | ||
327 | */ | 327 | */ |
328 | static void pciehp_power_thread(struct work_struct *work) | 328 | static void pciehp_power_thread(struct work_struct *work) |
329 | { | 329 | { |
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index deb6b5e35feb..b169b0e2647f 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c | |||
@@ -100,6 +100,7 @@ static struct device_node *find_dlpar_node(char *drc_name, int *node_type) | |||
100 | 100 | ||
101 | /** | 101 | /** |
102 | * find_php_slot - return hotplug slot structure for device node | 102 | * find_php_slot - return hotplug slot structure for device node |
103 | * @dn: target &device_node | ||
103 | * | 104 | * |
104 | * This routine will return the hotplug slot structure | 105 | * This routine will return the hotplug slot structure |
105 | * for a given device node. Note that built-in PCI slots | 106 | * for a given device node. Note that built-in PCI slots |
@@ -293,9 +294,8 @@ static int dlpar_add_vio_slot(char *drc_name, struct device_node *dn) | |||
293 | * dlpar_add_slot - DLPAR add an I/O Slot | 294 | * dlpar_add_slot - DLPAR add an I/O Slot |
294 | * @drc_name: drc-name of newly added slot | 295 | * @drc_name: drc-name of newly added slot |
295 | * | 296 | * |
296 | * Make the hotplug module and the kernel aware | 297 | * Make the hotplug module and the kernel aware of a newly added I/O Slot. |
297 | * of a newly added I/O Slot. | 298 | * Return Codes: |
298 | * Return Codes - | ||
299 | * 0 Success | 299 | * 0 Success |
300 | * -ENODEV Not a valid drc_name | 300 | * -ENODEV Not a valid drc_name |
301 | * -EINVAL Slot already added | 301 | * -EINVAL Slot already added |
@@ -339,9 +339,9 @@ exit: | |||
339 | /** | 339 | /** |
340 | * dlpar_remove_vio_slot - DLPAR remove a virtual I/O Slot | 340 | * dlpar_remove_vio_slot - DLPAR remove a virtual I/O Slot |
341 | * @drc_name: drc-name of newly added slot | 341 | * @drc_name: drc-name of newly added slot |
342 | * @dn: &device_node | ||
342 | * | 343 | * |
343 | * Remove the kernel and hotplug representations | 344 | * Remove the kernel and hotplug representations of an I/O Slot. |
344 | * of an I/O Slot. | ||
345 | * Return Codes: | 345 | * Return Codes: |
346 | * 0 Success | 346 | * 0 Success |
347 | * -EINVAL Vio dev doesn't exist | 347 | * -EINVAL Vio dev doesn't exist |
@@ -359,11 +359,11 @@ static int dlpar_remove_vio_slot(char *drc_name, struct device_node *dn) | |||
359 | } | 359 | } |
360 | 360 | ||
361 | /** | 361 | /** |
362 | * dlpar_remove_slot - DLPAR remove a PCI I/O Slot | 362 | * dlpar_remove_pci_slot - DLPAR remove a PCI I/O Slot |
363 | * @drc_name: drc-name of newly added slot | 363 | * @drc_name: drc-name of newly added slot |
364 | * @dn: &device_node | ||
364 | * | 365 | * |
365 | * Remove the kernel and hotplug representations | 366 | * Remove the kernel and hotplug representations of a PCI I/O Slot. |
366 | * of a PCI I/O Slot. | ||
367 | * Return Codes: | 367 | * Return Codes: |
368 | * 0 Success | 368 | * 0 Success |
369 | * -ENODEV Not a valid drc_name | 369 | * -ENODEV Not a valid drc_name |
@@ -405,8 +405,7 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn) | |||
405 | * dlpar_remove_slot - DLPAR remove an I/O Slot | 405 | * dlpar_remove_slot - DLPAR remove an I/O Slot |
406 | * @drc_name: drc-name of newly added slot | 406 | * @drc_name: drc-name of newly added slot |
407 | * | 407 | * |
408 | * Remove the kernel and hotplug representations | 408 | * Remove the kernel and hotplug representations of an I/O Slot. |
409 | * of an I/O Slot. | ||
410 | * Return Codes: | 409 | * Return Codes: |
411 | * 0 Success | 410 | * 0 Success |
412 | * -ENODEV Not a valid drc_name | 411 | * -ENODEV Not a valid drc_name |
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index 458c08ef2654..58f1a9927709 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
@@ -54,10 +54,12 @@ module_param(debug, bool, 0644); | |||
54 | 54 | ||
55 | /** | 55 | /** |
56 | * set_attention_status - set attention LED | 56 | * set_attention_status - set attention LED |
57 | * @hotplug_slot: target &hotplug_slot | ||
58 | * @value: LED control value | ||
59 | * | ||
57 | * echo 0 > attention -- set LED OFF | 60 | * echo 0 > attention -- set LED OFF |
58 | * echo 1 > attention -- set LED ON | 61 | * echo 1 > attention -- set LED ON |
59 | * echo 2 > attention -- set LED ID(identify, light is blinking) | 62 | * echo 2 > attention -- set LED ID(identify, light is blinking) |
60 | * | ||
61 | */ | 63 | */ |
62 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) | 64 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) |
63 | { | 65 | { |
@@ -99,6 +101,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) | |||
99 | 101 | ||
100 | /** | 102 | /** |
101 | * get_attention_status - get attention LED status | 103 | * get_attention_status - get attention LED status |
104 | * @hotplug_slot: slot to get status | ||
105 | * @value: pointer to store status | ||
102 | */ | 106 | */ |
103 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) | 107 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) |
104 | { | 108 | { |
@@ -254,6 +258,11 @@ static int is_php_type(char *drc_type) | |||
254 | 258 | ||
255 | /** | 259 | /** |
256 | * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0 | 260 | * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0 |
261 | * @dn: target &device_node | ||
262 | * @indexes: passed to get_children_props() | ||
263 | * @names: passed to get_children_props() | ||
264 | * @types: returned from get_children_props() | ||
265 | * @power_domains: | ||
257 | * | 266 | * |
258 | * This routine will return true only if the device node is | 267 | * This routine will return true only if the device node is |
259 | * a hotpluggable slot. This routine will return false | 268 | * a hotpluggable slot. This routine will return false |
@@ -279,7 +288,7 @@ static int is_php_dn(struct device_node *dn, const int **indexes, | |||
279 | 288 | ||
280 | /** | 289 | /** |
281 | * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem. | 290 | * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem. |
282 | * @dn device node of slot | 291 | * @dn: device node of slot |
283 | * | 292 | * |
284 | * This subroutine will register a hotplugable slot with the | 293 | * This subroutine will register a hotplugable slot with the |
285 | * PCI hotplug infrastructure. This routine is typicaly called | 294 | * PCI hotplug infrastructure. This routine is typicaly called |
@@ -291,7 +300,7 @@ static int is_php_dn(struct device_node *dn, const int **indexes, | |||
291 | * routine will just return without doing anything, since embedded | 300 | * routine will just return without doing anything, since embedded |
292 | * slots cannot be hotplugged. | 301 | * slots cannot be hotplugged. |
293 | * | 302 | * |
294 | * To remove a slot, it suffices to call rpaphp_deregister_slot() | 303 | * To remove a slot, it suffices to call rpaphp_deregister_slot(). |
295 | */ | 304 | */ |
296 | int rpaphp_add_slot(struct device_node *dn) | 305 | int rpaphp_add_slot(struct device_node *dn) |
297 | { | 306 | { |
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index 54ca8650d511..0de84533cd80 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c | |||
@@ -79,6 +79,7 @@ static void set_slot_name(struct slot *slot) | |||
79 | 79 | ||
80 | /** | 80 | /** |
81 | * rpaphp_enable_slot - record slot state, config pci device | 81 | * rpaphp_enable_slot - record slot state, config pci device |
82 | * @slot: target &slot | ||
82 | * | 83 | * |
83 | * Initialize values in the slot, and the hotplug_slot info | 84 | * Initialize values in the slot, and the hotplug_slot info |
84 | * structures to indicate if there is a pci card plugged into | 85 | * structures to indicate if there is a pci card plugged into |
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c index d2fc35598cdd..eb5cac6f08ae 100644 --- a/drivers/pci/hotplug/shpchp_ctrl.c +++ b/drivers/pci/hotplug/shpchp_ctrl.c | |||
@@ -231,10 +231,10 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot, | |||
231 | 231 | ||
232 | /** | 232 | /** |
233 | * board_added - Called after a board has been added to the system. | 233 | * board_added - Called after a board has been added to the system. |
234 | * @p_slot: target &slot | ||
234 | * | 235 | * |
235 | * Turns power on for the board | 236 | * Turns power on for the board. |
236 | * Configures board | 237 | * Configures board. |
237 | * | ||
238 | */ | 238 | */ |
239 | static int board_added(struct slot *p_slot) | 239 | static int board_added(struct slot *p_slot) |
240 | { | 240 | { |
@@ -350,8 +350,8 @@ err_exit: | |||
350 | 350 | ||
351 | 351 | ||
352 | /** | 352 | /** |
353 | * remove_board - Turns off slot and LED's | 353 | * remove_board - Turns off slot and LEDs |
354 | * | 354 | * @p_slot: target &slot |
355 | */ | 355 | */ |
356 | static int remove_board(struct slot *p_slot) | 356 | static int remove_board(struct slot *p_slot) |
357 | { | 357 | { |
@@ -397,11 +397,11 @@ struct pushbutton_work_info { | |||
397 | }; | 397 | }; |
398 | 398 | ||
399 | /** | 399 | /** |
400 | * shpchp_pushbutton_thread | 400 | * shpchp_pushbutton_thread - handle pushbutton events |
401 | * @work: &struct work_struct to be handled | ||
401 | * | 402 | * |
402 | * Scheduled procedure to handle blocking stuff for the pushbuttons | 403 | * Scheduled procedure to handle blocking stuff for the pushbuttons. |
403 | * Handles all pending events and exits. | 404 | * Handles all pending events and exits. |
404 | * | ||
405 | */ | 405 | */ |
406 | static void shpchp_pushbutton_thread(struct work_struct *work) | 406 | static void shpchp_pushbutton_thread(struct work_struct *work) |
407 | { | 407 | { |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 1b7b2812bf2d..7d1877341aad 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -702,8 +702,10 @@ static int __init pci_sysfs_init(void) | |||
702 | sysfs_initialized = 1; | 702 | sysfs_initialized = 1; |
703 | for_each_pci_dev(pdev) { | 703 | for_each_pci_dev(pdev) { |
704 | retval = pci_create_sysfs_dev_files(pdev); | 704 | retval = pci_create_sysfs_dev_files(pdev); |
705 | if (retval) | 705 | if (retval) { |
706 | pci_dev_put(pdev); | ||
706 | return retval; | 707 | return retval; |
708 | } | ||
707 | } | 709 | } |
708 | 710 | ||
709 | return 0; | 711 | return 0; |
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 92a8469b21ba..3c0d8d138f5a 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c | |||
@@ -168,11 +168,11 @@ static int find_device_iter(struct device *device, void *data) | |||
168 | 168 | ||
169 | /** | 169 | /** |
170 | * find_source_device - search through device hierarchy for source device | 170 | * find_source_device - search through device hierarchy for source device |
171 | * @p_dev: pointer to Root Port pci_dev data structure | 171 | * @parent: pointer to Root Port pci_dev data structure |
172 | * @id: device ID of agent who sends an error message to this Root Port | 172 | * @id: device ID of agent who sends an error message to this Root Port |
173 | * | 173 | * |
174 | * Invoked when error is detected at the Root Port. | 174 | * Invoked when error is detected at the Root Port. |
175 | **/ | 175 | */ |
176 | static struct device* find_source_device(struct pci_dev *parent, u16 id) | 176 | static struct device* find_source_device(struct pci_dev *parent, u16 id) |
177 | { | 177 | { |
178 | struct pci_dev *dev = parent; | 178 | struct pci_dev *dev = parent; |
@@ -286,14 +286,15 @@ static void report_resume(struct pci_dev *dev, void *data) | |||
286 | 286 | ||
287 | /** | 287 | /** |
288 | * broadcast_error_message - handle message broadcast to downstream drivers | 288 | * broadcast_error_message - handle message broadcast to downstream drivers |
289 | * @device: pointer to from where in a hierarchy message is broadcasted down | 289 | * @dev: pointer to from where in a hierarchy message is broadcasted down |
290 | * @api: callback to be broadcasted | ||
291 | * @state: error state | 290 | * @state: error state |
291 | * @error_mesg: message to print | ||
292 | * @cb: callback to be broadcasted | ||
292 | * | 293 | * |
293 | * Invoked during error recovery process. Once being invoked, the content | 294 | * Invoked during error recovery process. Once being invoked, the content |
294 | * of error severity will be broadcasted to all downstream drivers in a | 295 | * of error severity will be broadcasted to all downstream drivers in a |
295 | * hierarchy in question. | 296 | * hierarchy in question. |
296 | **/ | 297 | */ |
297 | static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, | 298 | static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, |
298 | enum pci_channel_state state, | 299 | enum pci_channel_state state, |
299 | char *error_mesg, | 300 | char *error_mesg, |
@@ -428,7 +429,7 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev, | |||
428 | * Invoked when an error is nonfatal/fatal. Once being invoked, broadcast | 429 | * Invoked when an error is nonfatal/fatal. Once being invoked, broadcast |
429 | * error detected message to all downstream drivers within a hierarchy in | 430 | * error detected message to all downstream drivers within a hierarchy in |
430 | * question and return the returned code. | 431 | * question and return the returned code. |
431 | **/ | 432 | */ |
432 | static pci_ers_result_t do_recovery(struct pcie_device *aerdev, | 433 | static pci_ers_result_t do_recovery(struct pcie_device *aerdev, |
433 | struct pci_dev *dev, | 434 | struct pci_dev *dev, |
434 | int severity) | 435 | int severity) |
@@ -488,7 +489,7 @@ static pci_ers_result_t do_recovery(struct pcie_device *aerdev, | |||
488 | * @info: comprehensive error information | 489 | * @info: comprehensive error information |
489 | * | 490 | * |
490 | * Invoked when an error being detected by Root Port. | 491 | * Invoked when an error being detected by Root Port. |
491 | **/ | 492 | */ |
492 | static void handle_error_source(struct pcie_device * aerdev, | 493 | static void handle_error_source(struct pcie_device * aerdev, |
493 | struct pci_dev *dev, | 494 | struct pci_dev *dev, |
494 | struct aer_err_info info) | 495 | struct aer_err_info info) |
@@ -521,7 +522,7 @@ static void handle_error_source(struct pcie_device * aerdev, | |||
521 | * @rpc: pointer to a Root Port data structure | 522 | * @rpc: pointer to a Root Port data structure |
522 | * | 523 | * |
523 | * Invoked when PCIE bus loads AER service driver. | 524 | * Invoked when PCIE bus loads AER service driver. |
524 | **/ | 525 | */ |
525 | void aer_enable_rootport(struct aer_rpc *rpc) | 526 | void aer_enable_rootport(struct aer_rpc *rpc) |
526 | { | 527 | { |
527 | struct pci_dev *pdev = rpc->rpd->port; | 528 | struct pci_dev *pdev = rpc->rpd->port; |
@@ -569,7 +570,7 @@ void aer_enable_rootport(struct aer_rpc *rpc) | |||
569 | * @rpc: pointer to a Root Port data structure | 570 | * @rpc: pointer to a Root Port data structure |
570 | * | 571 | * |
571 | * Invoked when PCIE bus unloads AER service driver. | 572 | * Invoked when PCIE bus unloads AER service driver. |
572 | **/ | 573 | */ |
573 | static void disable_root_aer(struct aer_rpc *rpc) | 574 | static void disable_root_aer(struct aer_rpc *rpc) |
574 | { | 575 | { |
575 | struct pci_dev *pdev = rpc->rpd->port; | 576 | struct pci_dev *pdev = rpc->rpd->port; |
@@ -590,7 +591,7 @@ static void disable_root_aer(struct aer_rpc *rpc) | |||
590 | * @rpc: pointer to the root port which holds an error | 591 | * @rpc: pointer to the root port which holds an error |
591 | * | 592 | * |
592 | * Invoked by DPC handler to consume an error. | 593 | * Invoked by DPC handler to consume an error. |
593 | **/ | 594 | */ |
594 | static struct aer_err_source* get_e_source(struct aer_rpc *rpc) | 595 | static struct aer_err_source* get_e_source(struct aer_rpc *rpc) |
595 | { | 596 | { |
596 | struct aer_err_source *e_source; | 597 | struct aer_err_source *e_source; |
@@ -655,7 +656,7 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) | |||
655 | * aer_isr_one_error - consume an error detected by root port | 656 | * aer_isr_one_error - consume an error detected by root port |
656 | * @p_device: pointer to error root port service device | 657 | * @p_device: pointer to error root port service device |
657 | * @e_src: pointer to an error source | 658 | * @e_src: pointer to an error source |
658 | **/ | 659 | */ |
659 | static void aer_isr_one_error(struct pcie_device *p_device, | 660 | static void aer_isr_one_error(struct pcie_device *p_device, |
660 | struct aer_err_source *e_src) | 661 | struct aer_err_source *e_src) |
661 | { | 662 | { |
@@ -706,7 +707,7 @@ static void aer_isr_one_error(struct pcie_device *p_device, | |||
706 | * @work: definition of this work item | 707 | * @work: definition of this work item |
707 | * | 708 | * |
708 | * Invoked, as DPC, when root port records new detected error | 709 | * Invoked, as DPC, when root port records new detected error |
709 | **/ | 710 | */ |
710 | void aer_isr(struct work_struct *work) | 711 | void aer_isr(struct work_struct *work) |
711 | { | 712 | { |
712 | struct aer_rpc *rpc = container_of(work, struct aer_rpc, dpc_handler); | 713 | struct aer_rpc *rpc = container_of(work, struct aer_rpc, dpc_handler); |
@@ -729,7 +730,7 @@ void aer_isr(struct work_struct *work) | |||
729 | * @rpc: pointer to a root port device being deleted | 730 | * @rpc: pointer to a root port device being deleted |
730 | * | 731 | * |
731 | * Invoked when AER service unloaded on a specific Root Port | 732 | * Invoked when AER service unloaded on a specific Root Port |
732 | **/ | 733 | */ |
733 | void aer_delete_rootport(struct aer_rpc *rpc) | 734 | void aer_delete_rootport(struct aer_rpc *rpc) |
734 | { | 735 | { |
735 | /* Disable root port AER itself */ | 736 | /* Disable root port AER itself */ |
@@ -743,7 +744,7 @@ void aer_delete_rootport(struct aer_rpc *rpc) | |||
743 | * @dev: pointer to AER pcie device | 744 | * @dev: pointer to AER pcie device |
744 | * | 745 | * |
745 | * Invoked when AER service driver is loaded. | 746 | * Invoked when AER service driver is loaded. |
746 | **/ | 747 | */ |
747 | int aer_init(struct pcie_device *dev) | 748 | int aer_init(struct pcie_device *dev) |
748 | { | 749 | { |
749 | if (aer_osc_setup(dev) && !forceload) | 750 | if (aer_osc_setup(dev) && !forceload) |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index df383645e366..26057f98f72e 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -217,7 +217,7 @@ static int slot_reset_iter(struct device *device, void *data) | |||
217 | 217 | ||
218 | static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev) | 218 | static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev) |
219 | { | 219 | { |
220 | pci_ers_result_t status; | 220 | pci_ers_result_t status = PCI_ERS_RESULT_NONE; |
221 | int retval; | 221 | int retval; |
222 | 222 | ||
223 | /* If fatal, restore cfg space for possible link reset at upstream */ | 223 | /* If fatal, restore cfg space for possible link reset at upstream */ |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 463a5a9d583d..c2f8a78c894c 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -743,46 +743,22 @@ static int pci_setup_device(struct pci_dev * dev) | |||
743 | */ | 743 | */ |
744 | if (class == PCI_CLASS_STORAGE_IDE) { | 744 | if (class == PCI_CLASS_STORAGE_IDE) { |
745 | u8 progif; | 745 | u8 progif; |
746 | struct pci_bus_region region; | ||
747 | |||
748 | pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); | 746 | pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); |
749 | if ((progif & 1) == 0) { | 747 | if ((progif & 1) == 0) { |
750 | struct resource resource = { | 748 | dev->resource[0].start = 0x1F0; |
751 | .start = 0x1F0, | 749 | dev->resource[0].end = 0x1F7; |
752 | .end = 0x1F7, | 750 | dev->resource[0].flags = LEGACY_IO_RESOURCE; |
753 | .flags = LEGACY_IO_RESOURCE, | 751 | dev->resource[1].start = 0x3F6; |
754 | }; | 752 | dev->resource[1].end = 0x3F6; |
755 | 753 | dev->resource[1].flags = LEGACY_IO_RESOURCE; | |
756 | pcibios_resource_to_bus(dev, ®ion, &resource); | ||
757 | dev->resource[0].start = region.start; | ||
758 | dev->resource[0].end = region.end; | ||
759 | dev->resource[0].flags = resource.flags; | ||
760 | resource.start = 0x3F6; | ||
761 | resource.end = 0x3F6; | ||
762 | resource.flags = LEGACY_IO_RESOURCE; | ||
763 | pcibios_resource_to_bus(dev, ®ion, &resource); | ||
764 | dev->resource[1].start = region.start; | ||
765 | dev->resource[1].end = region.end; | ||
766 | dev->resource[1].flags = resource.flags; | ||
767 | } | 754 | } |
768 | if ((progif & 4) == 0) { | 755 | if ((progif & 4) == 0) { |
769 | struct resource resource = { | 756 | dev->resource[2].start = 0x170; |
770 | .start = 0x170, | 757 | dev->resource[2].end = 0x177; |
771 | .end = 0x177, | 758 | dev->resource[2].flags = LEGACY_IO_RESOURCE; |
772 | .flags = LEGACY_IO_RESOURCE, | 759 | dev->resource[3].start = 0x376; |
773 | }; | 760 | dev->resource[3].end = 0x376; |
774 | 761 | dev->resource[3].flags = LEGACY_IO_RESOURCE; | |
775 | pcibios_resource_to_bus(dev, ®ion, &resource); | ||
776 | dev->resource[2].start = region.start; | ||
777 | dev->resource[2].end = region.end; | ||
778 | dev->resource[2].flags = resource.flags; | ||
779 | resource.start = 0x376; | ||
780 | resource.end = 0x376; | ||
781 | resource.flags = LEGACY_IO_RESOURCE; | ||
782 | pcibios_resource_to_bus(dev, ®ion, &resource); | ||
783 | dev->resource[3].start = region.start; | ||
784 | dev->resource[3].end = region.end; | ||
785 | dev->resource[3].flags = resource.flags; | ||
786 | } | 762 | } |
787 | } | 763 | } |
788 | break; | 764 | break; |
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index a0aca46ce877..56230dbd347a 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c | |||
@@ -89,7 +89,7 @@ DECLARE_RWSEM(pcmcia_socket_list_rwsem); | |||
89 | EXPORT_SYMBOL(pcmcia_socket_list_rwsem); | 89 | EXPORT_SYMBOL(pcmcia_socket_list_rwsem); |
90 | 90 | ||
91 | 91 | ||
92 | /** | 92 | /* |
93 | * Low-level PCMCIA socket drivers need to register with the PCCard | 93 | * Low-level PCMCIA socket drivers need to register with the PCCard |
94 | * core using pcmcia_register_socket. | 94 | * core using pcmcia_register_socket. |
95 | * | 95 | * |
@@ -174,6 +174,7 @@ static int pccardd(void *__skt); | |||
174 | 174 | ||
175 | /** | 175 | /** |
176 | * pcmcia_register_socket - add a new pcmcia socket device | 176 | * pcmcia_register_socket - add a new pcmcia socket device |
177 | * @socket: the &socket to register | ||
177 | */ | 178 | */ |
178 | int pcmcia_register_socket(struct pcmcia_socket *socket) | 179 | int pcmcia_register_socket(struct pcmcia_socket *socket) |
179 | { | 180 | { |
@@ -268,6 +269,7 @@ EXPORT_SYMBOL(pcmcia_register_socket); | |||
268 | 269 | ||
269 | /** | 270 | /** |
270 | * pcmcia_unregister_socket - remove a pcmcia socket device | 271 | * pcmcia_unregister_socket - remove a pcmcia socket device |
272 | * @socket: the &socket to unregister | ||
271 | */ | 273 | */ |
272 | void pcmcia_unregister_socket(struct pcmcia_socket *socket) | 274 | void pcmcia_unregister_socket(struct pcmcia_socket *socket) |
273 | { | 275 | { |
@@ -311,7 +313,7 @@ struct pcmcia_socket * pcmcia_get_socket_by_nr(unsigned int nr) | |||
311 | } | 313 | } |
312 | EXPORT_SYMBOL(pcmcia_get_socket_by_nr); | 314 | EXPORT_SYMBOL(pcmcia_get_socket_by_nr); |
313 | 315 | ||
314 | /** | 316 | /* |
315 | * The central event handler. Send_event() sends an event to the | 317 | * The central event handler. Send_event() sends an event to the |
316 | * 16-bit subsystem, which then calls the relevant device drivers. | 318 | * 16-bit subsystem, which then calls the relevant device drivers. |
317 | * Parse_events() interprets the event bits from | 319 | * Parse_events() interprets the event bits from |
@@ -380,7 +382,7 @@ static int socket_reset(struct pcmcia_socket *skt) | |||
380 | return CS_GENERAL_FAILURE; | 382 | return CS_GENERAL_FAILURE; |
381 | } | 383 | } |
382 | 384 | ||
383 | /** | 385 | /* |
384 | * socket_setup() and socket_shutdown() are called by the main event handler | 386 | * socket_setup() and socket_shutdown() are called by the main event handler |
385 | * when card insertion and removal events are received. | 387 | * when card insertion and removal events are received. |
386 | * socket_setup() turns on socket power and resets the socket, in two stages. | 388 | * socket_setup() turns on socket power and resets the socket, in two stages. |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 7bf78c127898..5cf89a91da1e 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -320,6 +320,7 @@ pcmcia_create_newid_file(struct pcmcia_driver *drv) | |||
320 | 320 | ||
321 | /** | 321 | /** |
322 | * pcmcia_register_driver - register a PCMCIA driver with the bus core | 322 | * pcmcia_register_driver - register a PCMCIA driver with the bus core |
323 | * @driver: the &driver being registered | ||
323 | * | 324 | * |
324 | * Registers a PCMCIA driver with the PCMCIA bus core. | 325 | * Registers a PCMCIA driver with the PCMCIA bus core. |
325 | */ | 326 | */ |
@@ -354,6 +355,7 @@ EXPORT_SYMBOL(pcmcia_register_driver); | |||
354 | 355 | ||
355 | /** | 356 | /** |
356 | * pcmcia_unregister_driver - unregister a PCMCIA driver with the bus core | 357 | * pcmcia_unregister_driver - unregister a PCMCIA driver with the bus core |
358 | * @driver: the &driver being unregistered | ||
357 | */ | 359 | */ |
358 | void pcmcia_unregister_driver(struct pcmcia_driver *driver) | 360 | void pcmcia_unregister_driver(struct pcmcia_driver *driver) |
359 | { | 361 | { |
@@ -840,8 +842,8 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis) | |||
840 | 842 | ||
841 | /** | 843 | /** |
842 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken | 844 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken |
843 | * @dev - the pcmcia device which needs a CIS override | 845 | * @dev: the pcmcia device which needs a CIS override |
844 | * @filename - requested filename in /lib/firmware/ | 846 | * @filename: requested filename in /lib/firmware/ |
845 | * | 847 | * |
846 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if | 848 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if |
847 | * the one provided by the card is broken. The firmware files reside in | 849 | * the one provided by the card is broken. The firmware files reside in |
diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h index 62e9ebf967f9..d29657bf1b40 100644 --- a/drivers/pcmcia/ti113x.h +++ b/drivers/pcmcia/ti113x.h | |||
@@ -874,7 +874,7 @@ static int ti1250_override(struct yenta_socket *socket) | |||
874 | */ | 874 | */ |
875 | 875 | ||
876 | #ifdef CONFIG_YENTA_ENE_TUNE | 876 | #ifdef CONFIG_YENTA_ENE_TUNE |
877 | /** | 877 | /* |
878 | * set/clear various test bits: | 878 | * set/clear various test bits: |
879 | * Defaults to clear the bit. | 879 | * Defaults to clear the bit. |
880 | * - mask (u8) defines what bits to change | 880 | * - mask (u8) defines what bits to change |
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 20853a03202d..0ab1fb65cdc3 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c | |||
@@ -48,7 +48,7 @@ MODULE_PARM_DESC(pwr_irqs_off, "Force IRQs off during power-on of slot. Use only | |||
48 | #define to_cycles(ns) ((ns)/120) | 48 | #define to_cycles(ns) ((ns)/120) |
49 | #define to_ns(cycles) ((cycles)*120) | 49 | #define to_ns(cycles) ((cycles)*120) |
50 | 50 | ||
51 | /** | 51 | /* |
52 | * yenta PCI irq probing. | 52 | * yenta PCI irq probing. |
53 | * currently only used in the TI/EnE initialization code | 53 | * currently only used in the TI/EnE initialization code |
54 | */ | 54 | */ |
@@ -888,7 +888,7 @@ static unsigned int yenta_probe_irq(struct yenta_socket *socket, u32 isa_irq_mas | |||
888 | } | 888 | } |
889 | 889 | ||
890 | 890 | ||
891 | /** | 891 | /* |
892 | * yenta PCI irq probing. | 892 | * yenta PCI irq probing. |
893 | * currently only used in the TI/EnE initialization code | 893 | * currently only used in the TI/EnE initialization code |
894 | */ | 894 | */ |
@@ -1012,7 +1012,7 @@ static void yenta_config_init(struct yenta_socket *socket) | |||
1012 | * invisible during PCI scans because of a misconfigured subordinate number | 1012 | * invisible during PCI scans because of a misconfigured subordinate number |
1013 | * of the parent brige - some BIOSes seem to be too lazy to set it right. | 1013 | * of the parent brige - some BIOSes seem to be too lazy to set it right. |
1014 | * Does the fixup carefully by checking how far it can go without conflicts. | 1014 | * Does the fixup carefully by checking how far it can go without conflicts. |
1015 | * See http://bugzilla.kernel.org/show_bug.cgi?id=2944 for more information. | 1015 | * See http\://bugzilla.kernel.org/show_bug.cgi?id=2944 for more information. |
1016 | */ | 1016 | */ |
1017 | static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) | 1017 | static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) |
1018 | { | 1018 | { |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index cd0a204d96d1..3c5eb374adf8 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -75,6 +75,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
75 | { | 75 | { |
76 | int i = 0; | 76 | int i = 0; |
77 | int irq; | 77 | int irq; |
78 | int p, t; | ||
78 | 79 | ||
79 | if (!valid_IRQ(gsi)) | 80 | if (!valid_IRQ(gsi)) |
80 | return; | 81 | return; |
@@ -82,18 +83,27 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
82 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && | 83 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && |
83 | i < PNP_MAX_IRQ) | 84 | i < PNP_MAX_IRQ) |
84 | i++; | 85 | i++; |
85 | if (i >= PNP_MAX_IRQ) | 86 | if (i >= PNP_MAX_IRQ) { |
87 | printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ " | ||
88 | "resources: %d \n", PNP_MAX_IRQ); | ||
86 | return; | 89 | return; |
87 | |||
88 | #ifdef CONFIG_X86 | ||
89 | if (gsi < 16 && (triggering != ACPI_EDGE_SENSITIVE || | ||
90 | polarity != ACPI_ACTIVE_HIGH)) { | ||
91 | pnp_warn("BIOS BUG: legacy PNP IRQ %d should be edge trigger, " | ||
92 | "active high", gsi); | ||
93 | triggering = ACPI_EDGE_SENSITIVE; | ||
94 | polarity = ACPI_ACTIVE_HIGH; | ||
95 | } | 90 | } |
96 | #endif | 91 | /* |
92 | * in IO-APIC mode, use overrided attribute. Two reasons: | ||
93 | * 1. BIOS bug in DSDT | ||
94 | * 2. BIOS uses IO-APIC mode Interrupt Source Override | ||
95 | */ | ||
96 | if (!acpi_get_override_irq(gsi, &t, &p)) { | ||
97 | t = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; | ||
98 | p = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; | ||
99 | |||
100 | if (triggering != t || polarity != p) { | ||
101 | pnp_warn("IRQ %d override to %s, %s", | ||
102 | gsi, t ? "edge":"level", p ? "low":"high"); | ||
103 | triggering = t; | ||
104 | polarity = p; | ||
105 | } | ||
106 | } | ||
97 | 107 | ||
98 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 108 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
99 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); | 109 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); |
@@ -173,6 +183,9 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, | |||
173 | } | 183 | } |
174 | res->dma_resource[i].start = dma; | 184 | res->dma_resource[i].start = dma; |
175 | res->dma_resource[i].end = dma; | 185 | res->dma_resource[i].end = dma; |
186 | } else { | ||
187 | printk(KERN_ERR "pnpacpi: exceeded the max number of DMA " | ||
188 | "resources: %d \n", PNP_MAX_DMA); | ||
176 | } | 189 | } |
177 | } | 190 | } |
178 | 191 | ||
@@ -194,6 +207,9 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, | |||
194 | } | 207 | } |
195 | res->port_resource[i].start = io; | 208 | res->port_resource[i].start = io; |
196 | res->port_resource[i].end = io + len - 1; | 209 | res->port_resource[i].end = io + len - 1; |
210 | } else { | ||
211 | printk(KERN_ERR "pnpacpi: exceeded the max number of IO " | ||
212 | "resources: %d \n", PNP_MAX_PORT); | ||
197 | } | 213 | } |
198 | } | 214 | } |
199 | 215 | ||
@@ -217,6 +233,9 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, | |||
217 | 233 | ||
218 | res->mem_resource[i].start = mem; | 234 | res->mem_resource[i].start = mem; |
219 | res->mem_resource[i].end = mem + len - 1; | 235 | res->mem_resource[i].end = mem + len - 1; |
236 | } else { | ||
237 | printk(KERN_ERR "pnpacpi: exceeded the max number of mem " | ||
238 | "resources: %d\n", PNP_MAX_MEM); | ||
220 | } | 239 | } |
221 | } | 240 | } |
222 | 241 | ||
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index 41d73a5e9312..e50ebcffb962 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -367,8 +367,10 @@ int pnp_check_irq(struct pnp_dev *dev, int idx) | |||
367 | { | 367 | { |
368 | struct pci_dev *pci = NULL; | 368 | struct pci_dev *pci = NULL; |
369 | for_each_pci_dev(pci) { | 369 | for_each_pci_dev(pci) { |
370 | if (pci->irq == *irq) | 370 | if (pci->irq == *irq) { |
371 | pci_dev_put(pci); | ||
371 | return 0; | 372 | return 0; |
373 | } | ||
372 | } | 374 | } |
373 | } | 375 | } |
374 | #endif | 376 | #endif |
diff --git a/drivers/ps3/Makefile b/drivers/ps3/Makefile index 746031de2195..1f5a2d33bf5b 100644 --- a/drivers/ps3/Makefile +++ b/drivers/ps3/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | obj-$(CONFIG_PS3_VUART) += vuart.o | 1 | obj-$(CONFIG_PS3_VUART) += ps3-vuart.o |
2 | obj-$(CONFIG_PS3_PS3AV) += ps3av_mod.o | 2 | obj-$(CONFIG_PS3_PS3AV) += ps3av_mod.o |
3 | ps3av_mod-objs += ps3av.o ps3av_cmd.o | 3 | ps3av_mod-objs += ps3av.o ps3av_cmd.o |
4 | obj-$(CONFIG_PPC_PS3) += sys-manager-core.o | 4 | obj-$(CONFIG_PPC_PS3) += sys-manager-core.o |
5 | obj-$(CONFIG_PS3_SYS_MANAGER) += sys-manager.o | 5 | obj-$(CONFIG_PS3_SYS_MANAGER) += ps3-sys-manager.o |
6 | obj-$(CONFIG_PS3_STORAGE) += ps3stor_lib.o | 6 | obj-$(CONFIG_PS3_STORAGE) += ps3stor_lib.o |
diff --git a/drivers/ps3/sys-manager.c b/drivers/ps3/ps3-sys-manager.c index 8461b08ab9fb..8461b08ab9fb 100644 --- a/drivers/ps3/sys-manager.c +++ b/drivers/ps3/ps3-sys-manager.c | |||
diff --git a/drivers/ps3/vuart.c b/drivers/ps3/ps3-vuart.c index 9dea585ef806..9dea585ef806 100644 --- a/drivers/ps3/vuart.c +++ b/drivers/ps3/ps3-vuart.c | |||
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index e5cdc0294aaa..1e6715ec51ef 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -447,7 +447,7 @@ config RTC_DRV_AT91RM9200 | |||
447 | 447 | ||
448 | config RTC_DRV_BFIN | 448 | config RTC_DRV_BFIN |
449 | tristate "Blackfin On-Chip RTC" | 449 | tristate "Blackfin On-Chip RTC" |
450 | depends on BFIN | 450 | depends on BLACKFIN |
451 | help | 451 | help |
452 | If you say yes here you will get support for the | 452 | If you say yes here you will get support for the |
453 | Blackfin On-Chip Real Time Clock. | 453 | Blackfin On-Chip Real Time Clock. |
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index de0da545c7a1..f1e00ff54ce8 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -293,7 +293,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task) | |||
293 | return -EINVAL; | 293 | return -EINVAL; |
294 | 294 | ||
295 | /* Cannot register while the char dev is in use */ | 295 | /* Cannot register while the char dev is in use */ |
296 | if (!(mutex_trylock(&rtc->char_lock))) | 296 | if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) |
297 | return -EBUSY; | 297 | return -EBUSY; |
298 | 298 | ||
299 | spin_lock_irq(&rtc->irq_task_lock); | 299 | spin_lock_irq(&rtc->irq_task_lock); |
@@ -303,7 +303,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task) | |||
303 | } | 303 | } |
304 | spin_unlock_irq(&rtc->irq_task_lock); | 304 | spin_unlock_irq(&rtc->irq_task_lock); |
305 | 305 | ||
306 | mutex_unlock(&rtc->char_lock); | 306 | clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); |
307 | 307 | ||
308 | return retval; | 308 | return retval; |
309 | } | 309 | } |
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 814583bd2fe7..025c60a17a4a 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -26,10 +26,7 @@ static int rtc_dev_open(struct inode *inode, struct file *file) | |||
26 | struct rtc_device, char_dev); | 26 | struct rtc_device, char_dev); |
27 | const struct rtc_class_ops *ops = rtc->ops; | 27 | const struct rtc_class_ops *ops = rtc->ops; |
28 | 28 | ||
29 | /* We keep the lock as long as the device is in use | 29 | if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) |
30 | * and return immediately if busy | ||
31 | */ | ||
32 | if (!(mutex_trylock(&rtc->char_lock))) | ||
33 | return -EBUSY; | 30 | return -EBUSY; |
34 | 31 | ||
35 | file->private_data = rtc; | 32 | file->private_data = rtc; |
@@ -43,8 +40,8 @@ static int rtc_dev_open(struct inode *inode, struct file *file) | |||
43 | return 0; | 40 | return 0; |
44 | } | 41 | } |
45 | 42 | ||
46 | /* something has gone wrong, release the lock */ | 43 | /* something has gone wrong */ |
47 | mutex_unlock(&rtc->char_lock); | 44 | clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); |
48 | return err; | 45 | return err; |
49 | } | 46 | } |
50 | 47 | ||
@@ -405,7 +402,7 @@ static int rtc_dev_release(struct inode *inode, struct file *file) | |||
405 | if (rtc->ops->release) | 402 | if (rtc->ops->release) |
406 | rtc->ops->release(rtc->dev.parent); | 403 | rtc->ops->release(rtc->dev.parent); |
407 | 404 | ||
408 | mutex_unlock(&rtc->char_lock); | 405 | clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); |
409 | return 0; | 406 | return 0; |
410 | } | 407 | } |
411 | 408 | ||
@@ -440,7 +437,6 @@ void rtc_dev_prepare(struct rtc_device *rtc) | |||
440 | 437 | ||
441 | rtc->dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id); | 438 | rtc->dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id); |
442 | 439 | ||
443 | mutex_init(&rtc->char_lock); | ||
444 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | 440 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL |
445 | INIT_WORK(&rtc->uie_task, rtc_uie_task); | 441 | INIT_WORK(&rtc->uie_task, rtc_uie_task); |
446 | setup_timer(&rtc->uie_timer, rtc_uie_timer, (unsigned long)rtc); | 442 | setup_timer(&rtc->uie_timer, rtc_uie_timer, (unsigned long)rtc); |
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index 3e183cfee10f..1f956dc5d56e 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c | |||
@@ -89,13 +89,9 @@ static int max6902_get_reg(struct device *dev, unsigned char address, | |||
89 | 89 | ||
90 | /* do the i/o */ | 90 | /* do the i/o */ |
91 | status = spi_sync(spi, &message); | 91 | status = spi_sync(spi, &message); |
92 | if (status == 0) | ||
93 | status = message.status; | ||
94 | else | ||
95 | return status; | ||
96 | |||
97 | *data = chip->rx_buf[1]; | ||
98 | 92 | ||
93 | if (status == 0) | ||
94 | *data = chip->rx_buf[1]; | ||
99 | return status; | 95 | return status; |
100 | } | 96 | } |
101 | 97 | ||
@@ -125,9 +121,7 @@ static int max6902_get_datetime(struct device *dev, struct rtc_time *dt) | |||
125 | 121 | ||
126 | /* do the i/o */ | 122 | /* do the i/o */ |
127 | status = spi_sync(spi, &message); | 123 | status = spi_sync(spi, &message); |
128 | if (status == 0) | 124 | if (status) |
129 | status = message.status; | ||
130 | else | ||
131 | return status; | 125 | return status; |
132 | 126 | ||
133 | /* The chip sends data in this order: | 127 | /* The chip sends data in this order: |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 5e083d1f57e7..15a5789b7734 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -472,11 +472,11 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char | |||
472 | if (rc) | 472 | if (rc) |
473 | goto unregister_dev; | 473 | goto unregister_dev; |
474 | 474 | ||
475 | add_disk(dev_info->gd); | ||
476 | |||
477 | blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request); | 475 | blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request); |
478 | blk_queue_hardsect_size(dev_info->dcssblk_queue, 4096); | 476 | blk_queue_hardsect_size(dev_info->dcssblk_queue, 4096); |
479 | 477 | ||
478 | add_disk(dev_info->gd); | ||
479 | |||
480 | switch (dev_info->segment_type) { | 480 | switch (dev_info->segment_type) { |
481 | case SEG_TYPE_SR: | 481 | case SEG_TYPE_SR: |
482 | case SEG_TYPE_ER: | 482 | case SEG_TYPE_ER: |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 838f7ac0dc32..c3df2cd009a4 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -451,6 +451,7 @@ static int reprobe_subchannel(struct subchannel_id schid, void *data) | |||
451 | break; | 451 | break; |
452 | case -ENXIO: | 452 | case -ENXIO: |
453 | case -ENOMEM: | 453 | case -ENOMEM: |
454 | case -EIO: | ||
454 | /* These should abort looping */ | 455 | /* These should abort looping */ |
455 | break; | 456 | break; |
456 | default: | 457 | default: |
@@ -483,7 +484,7 @@ static DECLARE_WORK(css_reprobe_work, reprobe_all); | |||
483 | void css_schedule_reprobe(void) | 484 | void css_schedule_reprobe(void) |
484 | { | 485 | { |
485 | need_reprobe = 1; | 486 | need_reprobe = 1; |
486 | queue_work(ccw_device_work, &css_reprobe_work); | 487 | queue_work(slow_path_wq, &css_reprobe_work); |
487 | } | 488 | } |
488 | 489 | ||
489 | EXPORT_SYMBOL_GPL(css_schedule_reprobe); | 490 | EXPORT_SYMBOL_GPL(css_schedule_reprobe); |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 8867443b8060..bfad421cda66 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -1034,7 +1034,7 @@ device_trigger_reprobe(struct subchannel *sch) | |||
1034 | if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) { | 1034 | if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) { |
1035 | PREPARE_WORK(&cdev->private->kick_work, | 1035 | PREPARE_WORK(&cdev->private->kick_work, |
1036 | ccw_device_move_to_orphanage); | 1036 | ccw_device_move_to_orphanage); |
1037 | queue_work(ccw_device_work, &cdev->private->kick_work); | 1037 | queue_work(slow_path_wq, &cdev->private->kick_work); |
1038 | } else | 1038 | } else |
1039 | ccw_device_start_id(cdev, 0); | 1039 | ccw_device_start_id(cdev, 0); |
1040 | } | 1040 | } |
diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c index f232832f2b22..156f3f9786b5 100644 --- a/drivers/s390/cio/device_id.c +++ b/drivers/s390/cio/device_id.c | |||
@@ -118,14 +118,6 @@ __ccw_device_sense_id_start(struct ccw_device *cdev) | |||
118 | sch = to_subchannel(cdev->dev.parent); | 118 | sch = to_subchannel(cdev->dev.parent); |
119 | /* Setup sense channel program. */ | 119 | /* Setup sense channel program. */ |
120 | ccw = cdev->private->iccws; | 120 | ccw = cdev->private->iccws; |
121 | if (sch->schib.pmcw.pim != 0x80) { | ||
122 | /* more than one path installed. */ | ||
123 | ccw->cmd_code = CCW_CMD_SUSPEND_RECONN; | ||
124 | ccw->cda = 0; | ||
125 | ccw->count = 0; | ||
126 | ccw->flags = CCW_FLAG_SLI | CCW_FLAG_CC; | ||
127 | ccw++; | ||
128 | } | ||
129 | ccw->cmd_code = CCW_CMD_SENSE_ID; | 121 | ccw->cmd_code = CCW_CMD_SENSE_ID; |
130 | ccw->cda = (__u32) __pa (&cdev->private->senseid); | 122 | ccw->cda = (__u32) __pa (&cdev->private->senseid); |
131 | ccw->count = sizeof (struct senseid); | 123 | ccw->count = sizeof (struct senseid); |
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c index 6bf3ebbe985a..77a503139e32 100644 --- a/drivers/s390/net/ctcmain.c +++ b/drivers/s390/net/ctcmain.c | |||
@@ -478,14 +478,14 @@ ctc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
478 | skb->dev = pskb->dev; | 478 | skb->dev = pskb->dev; |
479 | skb->protocol = pskb->protocol; | 479 | skb->protocol = pskb->protocol; |
480 | pskb->ip_summed = CHECKSUM_UNNECESSARY; | 480 | pskb->ip_summed = CHECKSUM_UNNECESSARY; |
481 | netif_rx_ni(skb); | ||
482 | /** | 481 | /** |
483 | * Successful rx; reset logflags | 482 | * reset logflags |
484 | */ | 483 | */ |
485 | ch->logflags = 0; | 484 | ch->logflags = 0; |
486 | dev->last_rx = jiffies; | ||
487 | privptr->stats.rx_packets++; | 485 | privptr->stats.rx_packets++; |
488 | privptr->stats.rx_bytes += skb->len; | 486 | privptr->stats.rx_bytes += skb->len; |
487 | netif_rx_ni(skb); | ||
488 | dev->last_rx = jiffies; | ||
489 | if (len > 0) { | 489 | if (len > 0) { |
490 | skb_pull(pskb, header->length); | 490 | skb_pull(pskb, header->length); |
491 | if (skb_tailroom(pskb) < LL_HEADER_LENGTH) { | 491 | if (skb_tailroom(pskb) < LL_HEADER_LENGTH) { |
@@ -2782,35 +2782,14 @@ ctc_probe_device(struct ccwgroup_device *cgdev) | |||
2782 | } | 2782 | } |
2783 | 2783 | ||
2784 | /** | 2784 | /** |
2785 | * Initialize everything of the net device except the name and the | 2785 | * Device setup function called by alloc_netdev(). |
2786 | * channel structs. | 2786 | * |
2787 | * @param dev Device to be setup. | ||
2787 | */ | 2788 | */ |
2788 | static struct net_device * | 2789 | void ctc_init_netdevice(struct net_device * dev) |
2789 | ctc_init_netdevice(struct net_device * dev, int alloc_device, | ||
2790 | struct ctc_priv *privptr) | ||
2791 | { | 2790 | { |
2792 | if (!privptr) | ||
2793 | return NULL; | ||
2794 | |||
2795 | DBF_TEXT(setup, 3, __FUNCTION__); | 2791 | DBF_TEXT(setup, 3, __FUNCTION__); |
2796 | 2792 | ||
2797 | if (alloc_device) { | ||
2798 | dev = kzalloc(sizeof(struct net_device), GFP_KERNEL); | ||
2799 | if (!dev) | ||
2800 | return NULL; | ||
2801 | } | ||
2802 | |||
2803 | dev->priv = privptr; | ||
2804 | privptr->fsm = init_fsm("ctcdev", dev_state_names, | ||
2805 | dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS, | ||
2806 | dev_fsm, DEV_FSM_LEN, GFP_KERNEL); | ||
2807 | if (privptr->fsm == NULL) { | ||
2808 | if (alloc_device) | ||
2809 | kfree(dev); | ||
2810 | return NULL; | ||
2811 | } | ||
2812 | fsm_newstate(privptr->fsm, DEV_STATE_STOPPED); | ||
2813 | fsm_settimer(privptr->fsm, &privptr->restart_timer); | ||
2814 | if (dev->mtu == 0) | 2793 | if (dev->mtu == 0) |
2815 | dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2; | 2794 | dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2; |
2816 | dev->hard_start_xmit = ctc_tx; | 2795 | dev->hard_start_xmit = ctc_tx; |
@@ -2823,7 +2802,6 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device, | |||
2823 | dev->type = ARPHRD_SLIP; | 2802 | dev->type = ARPHRD_SLIP; |
2824 | dev->tx_queue_len = 100; | 2803 | dev->tx_queue_len = 100; |
2825 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | 2804 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; |
2826 | return dev; | ||
2827 | } | 2805 | } |
2828 | 2806 | ||
2829 | 2807 | ||
@@ -2879,14 +2857,22 @@ ctc_new_device(struct ccwgroup_device *cgdev) | |||
2879 | "ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret); | 2857 | "ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret); |
2880 | } | 2858 | } |
2881 | 2859 | ||
2882 | dev = ctc_init_netdevice(NULL, 1, privptr); | 2860 | dev = alloc_netdev(0, "ctc%d", ctc_init_netdevice); |
2883 | |||
2884 | if (!dev) { | 2861 | if (!dev) { |
2885 | ctc_pr_warn("ctc_init_netdevice failed\n"); | 2862 | ctc_pr_warn("ctc_init_netdevice failed\n"); |
2886 | goto out; | 2863 | goto out; |
2887 | } | 2864 | } |
2865 | dev->priv = privptr; | ||
2888 | 2866 | ||
2889 | strlcpy(dev->name, "ctc%d", IFNAMSIZ); | 2867 | privptr->fsm = init_fsm("ctcdev", dev_state_names, |
2868 | dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS, | ||
2869 | dev_fsm, DEV_FSM_LEN, GFP_KERNEL); | ||
2870 | if (privptr->fsm == NULL) { | ||
2871 | free_netdev(dev); | ||
2872 | goto out; | ||
2873 | } | ||
2874 | fsm_newstate(privptr->fsm, DEV_STATE_STOPPED); | ||
2875 | fsm_settimer(privptr->fsm, &privptr->restart_timer); | ||
2890 | 2876 | ||
2891 | for (direction = READ; direction <= WRITE; direction++) { | 2877 | for (direction = READ; direction <= WRITE; direction++) { |
2892 | privptr->channel[direction] = | 2878 | privptr->channel[direction] = |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 4d18d6419ddc..c7ea9381db9f 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -639,14 +639,14 @@ static void netiucv_unpack_skb(struct iucv_connection *conn, | |||
639 | skb->dev = pskb->dev; | 639 | skb->dev = pskb->dev; |
640 | skb->protocol = pskb->protocol; | 640 | skb->protocol = pskb->protocol; |
641 | pskb->ip_summed = CHECKSUM_UNNECESSARY; | 641 | pskb->ip_summed = CHECKSUM_UNNECESSARY; |
642 | privptr->stats.rx_packets++; | ||
643 | privptr->stats.rx_bytes += skb->len; | ||
642 | /* | 644 | /* |
643 | * Since receiving is always initiated from a tasklet (in iucv.c), | 645 | * Since receiving is always initiated from a tasklet (in iucv.c), |
644 | * we must use netif_rx_ni() instead of netif_rx() | 646 | * we must use netif_rx_ni() instead of netif_rx() |
645 | */ | 647 | */ |
646 | netif_rx_ni(skb); | 648 | netif_rx_ni(skb); |
647 | dev->last_rx = jiffies; | 649 | dev->last_rx = jiffies; |
648 | privptr->stats.rx_packets++; | ||
649 | privptr->stats.rx_bytes += skb->len; | ||
650 | skb_pull(pskb, header->next); | 650 | skb_pull(pskb, header->next); |
651 | skb_put(pskb, NETIUCV_HDRLEN); | 651 | skb_put(pskb, NETIUCV_HDRLEN); |
652 | } | 652 | } |
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 5552b755c08a..07fa824d179f 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -977,7 +977,9 @@ static void zfcp_erp_action_dismiss(struct zfcp_erp_action *erp_action) | |||
977 | debug_text_event(adapter->erp_dbf, 2, "a_adis"); | 977 | debug_text_event(adapter->erp_dbf, 2, "a_adis"); |
978 | debug_event(adapter->erp_dbf, 2, &erp_action->action, sizeof (int)); | 978 | debug_event(adapter->erp_dbf, 2, &erp_action->action, sizeof (int)); |
979 | 979 | ||
980 | zfcp_erp_async_handler_nolock(erp_action, ZFCP_STATUS_ERP_DISMISSED); | 980 | erp_action->status |= ZFCP_STATUS_ERP_DISMISSED; |
981 | if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) | ||
982 | zfcp_erp_action_ready(erp_action); | ||
981 | } | 983 | } |
982 | 984 | ||
983 | int | 985 | int |
@@ -1063,7 +1065,7 @@ zfcp_erp_thread(void *data) | |||
1063 | &adapter->status)) { | 1065 | &adapter->status)) { |
1064 | 1066 | ||
1065 | write_lock_irqsave(&adapter->erp_lock, flags); | 1067 | write_lock_irqsave(&adapter->erp_lock, flags); |
1066 | next = adapter->erp_ready_head.prev; | 1068 | next = adapter->erp_ready_head.next; |
1067 | write_unlock_irqrestore(&adapter->erp_lock, flags); | 1069 | write_unlock_irqrestore(&adapter->erp_lock, flags); |
1068 | 1070 | ||
1069 | if (next != &adapter->erp_ready_head) { | 1071 | if (next != &adapter->erp_ready_head) { |
@@ -1153,15 +1155,13 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action) | |||
1153 | 1155 | ||
1154 | /* | 1156 | /* |
1155 | * check for dismissed status again to avoid follow-up actions, | 1157 | * check for dismissed status again to avoid follow-up actions, |
1156 | * failing of targets and so on for dismissed actions | 1158 | * failing of targets and so on for dismissed actions, |
1159 | * we go through down() here because there has been an up() | ||
1157 | */ | 1160 | */ |
1158 | retval = zfcp_erp_strategy_check_action(erp_action, retval); | 1161 | if (erp_action->status & ZFCP_STATUS_ERP_DISMISSED) |
1162 | retval = ZFCP_ERP_CONTINUES; | ||
1159 | 1163 | ||
1160 | switch (retval) { | 1164 | switch (retval) { |
1161 | case ZFCP_ERP_DISMISSED: | ||
1162 | /* leave since this action has ridden to its ancestors */ | ||
1163 | debug_text_event(adapter->erp_dbf, 6, "a_st_dis2"); | ||
1164 | goto unlock; | ||
1165 | case ZFCP_ERP_NOMEM: | 1165 | case ZFCP_ERP_NOMEM: |
1166 | /* no memory to continue immediately, let it sleep */ | 1166 | /* no memory to continue immediately, let it sleep */ |
1167 | if (!(erp_action->status & ZFCP_STATUS_ERP_LOWMEM)) { | 1167 | if (!(erp_action->status & ZFCP_STATUS_ERP_LOWMEM)) { |
@@ -3089,7 +3089,7 @@ zfcp_erp_action_enqueue(int action, | |||
3089 | ++adapter->erp_total_count; | 3089 | ++adapter->erp_total_count; |
3090 | 3090 | ||
3091 | /* finally put it into 'ready' queue and kick erp thread */ | 3091 | /* finally put it into 'ready' queue and kick erp thread */ |
3092 | list_add(&erp_action->list, &adapter->erp_ready_head); | 3092 | list_add_tail(&erp_action->list, &adapter->erp_ready_head); |
3093 | up(&adapter->erp_ready_sem); | 3093 | up(&adapter->erp_ready_sem); |
3094 | retval = 0; | 3094 | retval = 0; |
3095 | out: | 3095 | out: |
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 240a0bb8986f..abce48ccc85b 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c | |||
@@ -1339,10 +1339,10 @@ int aac_check_health(struct aac_dev * aac) | |||
1339 | aif = (struct aac_aifcmd *)hw_fib->data; | 1339 | aif = (struct aac_aifcmd *)hw_fib->data; |
1340 | aif->command = cpu_to_le32(AifCmdEventNotify); | 1340 | aif->command = cpu_to_le32(AifCmdEventNotify); |
1341 | aif->seqnum = cpu_to_le32(0xFFFFFFFF); | 1341 | aif->seqnum = cpu_to_le32(0xFFFFFFFF); |
1342 | aif->data[0] = cpu_to_le32(AifEnExpEvent); | 1342 | aif->data[0] = AifEnExpEvent; |
1343 | aif->data[1] = cpu_to_le32(AifExeFirmwarePanic); | 1343 | aif->data[1] = AifExeFirmwarePanic; |
1344 | aif->data[2] = cpu_to_le32(AifHighPriority); | 1344 | aif->data[2] = AifHighPriority; |
1345 | aif->data[3] = cpu_to_le32(BlinkLED); | 1345 | aif->data[3] = BlinkLED; |
1346 | 1346 | ||
1347 | /* | 1347 | /* |
1348 | * Put the FIB onto the | 1348 | * Put the FIB onto the |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 038980be763d..9dd331bc29b0 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -636,7 +636,7 @@ static int aac_cfg_open(struct inode *inode, struct file *file) | |||
636 | static int aac_cfg_ioctl(struct inode *inode, struct file *file, | 636 | static int aac_cfg_ioctl(struct inode *inode, struct file *file, |
637 | unsigned int cmd, unsigned long arg) | 637 | unsigned int cmd, unsigned long arg) |
638 | { | 638 | { |
639 | if (!capable(CAP_SYS_ADMIN)) | 639 | if (!capable(CAP_SYS_RAWIO)) |
640 | return -EPERM; | 640 | return -EPERM; |
641 | return aac_do_ioctl(file->private_data, cmd, (void __user *)arg); | 641 | return aac_do_ioctl(file->private_data, cmd, (void __user *)arg); |
642 | } | 642 | } |
@@ -691,7 +691,7 @@ static int aac_compat_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) | |||
691 | 691 | ||
692 | static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned long arg) | 692 | static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
693 | { | 693 | { |
694 | if (!capable(CAP_SYS_ADMIN)) | 694 | if (!capable(CAP_SYS_RAWIO)) |
695 | return -EPERM; | 695 | return -EPERM; |
696 | return aac_compat_do_ioctl((struct aac_dev *)file->private_data, cmd, arg); | 696 | return aac_compat_do_ioctl((struct aac_dev *)file->private_data, cmd, arg); |
697 | } | 697 | } |
@@ -950,7 +950,8 @@ static struct scsi_host_template aac_driver_template = { | |||
950 | 950 | ||
951 | static void __aac_shutdown(struct aac_dev * aac) | 951 | static void __aac_shutdown(struct aac_dev * aac) |
952 | { | 952 | { |
953 | kthread_stop(aac->thread); | 953 | if (aac->aif_thread) |
954 | kthread_stop(aac->thread); | ||
954 | aac_send_shutdown(aac); | 955 | aac_send_shutdown(aac); |
955 | aac_adapter_disable_int(aac); | 956 | aac_adapter_disable_int(aac); |
956 | free_irq(aac->pdev->irq, aac); | 957 | free_irq(aac->pdev->irq, aac); |
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index 6f8403b82ba1..f5732d8f67fe 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c | |||
@@ -393,7 +393,7 @@ static irqreturn_t scsi_tt_intr(int irq, void *dummy) | |||
393 | 393 | ||
394 | #endif /* REAL_DMA */ | 394 | #endif /* REAL_DMA */ |
395 | 395 | ||
396 | NCR5380_intr(0, 0); | 396 | NCR5380_intr(irq, dummy); |
397 | 397 | ||
398 | #if 0 | 398 | #if 0 |
399 | /* To be sure the int is not masked */ | 399 | /* To be sure the int is not masked */ |
@@ -458,7 +458,7 @@ static irqreturn_t scsi_falcon_intr(int irq, void *dummy) | |||
458 | 458 | ||
459 | #endif /* REAL_DMA */ | 459 | #endif /* REAL_DMA */ |
460 | 460 | ||
461 | NCR5380_intr(0, 0); | 461 | NCR5380_intr(irq, dummy); |
462 | return IRQ_HANDLED; | 462 | return IRQ_HANDLED; |
463 | } | 463 | } |
464 | 464 | ||
@@ -684,7 +684,7 @@ int atari_scsi_detect(struct scsi_host_template *host) | |||
684 | * interrupt after having cleared the pending flag for the DMA | 684 | * interrupt after having cleared the pending flag for the DMA |
685 | * interrupt. */ | 685 | * interrupt. */ |
686 | if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW, | 686 | if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW, |
687 | "SCSI NCR5380", scsi_tt_intr)) { | 687 | "SCSI NCR5380", instance)) { |
688 | printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI); | 688 | printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI); |
689 | scsi_unregister(atari_scsi_host); | 689 | scsi_unregister(atari_scsi_host); |
690 | atari_stram_free(atari_dma_buffer); | 690 | atari_stram_free(atari_dma_buffer); |
@@ -701,7 +701,7 @@ int atari_scsi_detect(struct scsi_host_template *host) | |||
701 | IRQ_TYPE_PRIO, "Hades DMA emulator", | 701 | IRQ_TYPE_PRIO, "Hades DMA emulator", |
702 | hades_dma_emulator)) { | 702 | hades_dma_emulator)) { |
703 | printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting (MACH_IS_HADES)",IRQ_AUTO_2); | 703 | printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting (MACH_IS_HADES)",IRQ_AUTO_2); |
704 | free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); | 704 | free_irq(IRQ_TT_MFP_SCSI, instance); |
705 | scsi_unregister(atari_scsi_host); | 705 | scsi_unregister(atari_scsi_host); |
706 | atari_stram_free(atari_dma_buffer); | 706 | atari_stram_free(atari_dma_buffer); |
707 | atari_dma_buffer = 0; | 707 | atari_dma_buffer = 0; |
@@ -761,7 +761,7 @@ int atari_scsi_detect(struct scsi_host_template *host) | |||
761 | int atari_scsi_release(struct Scsi_Host *sh) | 761 | int atari_scsi_release(struct Scsi_Host *sh) |
762 | { | 762 | { |
763 | if (IS_A_TT()) | 763 | if (IS_A_TT()) |
764 | free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); | 764 | free_irq(IRQ_TT_MFP_SCSI, sh); |
765 | if (atari_dma_buffer) | 765 | if (atari_dma_buffer) |
766 | atari_stram_free(atari_dma_buffer); | 766 | atari_stram_free(atari_dma_buffer); |
767 | return 1; | 767 | return 1; |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 8258506ba7d7..70f48a1a6d58 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -173,20 +173,20 @@ static struct pci_device_id dptids[] = { | |||
173 | }; | 173 | }; |
174 | MODULE_DEVICE_TABLE(pci,dptids); | 174 | MODULE_DEVICE_TABLE(pci,dptids); |
175 | 175 | ||
176 | static void adpt_exit(void); | 176 | static int adpt_detect(struct scsi_host_template* sht) |
177 | |||
178 | static int adpt_detect(void) | ||
179 | { | 177 | { |
180 | struct pci_dev *pDev = NULL; | 178 | struct pci_dev *pDev = NULL; |
181 | adpt_hba* pHba; | 179 | adpt_hba* pHba; |
182 | 180 | ||
181 | adpt_init(); | ||
182 | |||
183 | PINFO("Detecting Adaptec I2O RAID controllers...\n"); | 183 | PINFO("Detecting Adaptec I2O RAID controllers...\n"); |
184 | 184 | ||
185 | /* search for all Adatpec I2O RAID cards */ | 185 | /* search for all Adatpec I2O RAID cards */ |
186 | while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) { | 186 | while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) { |
187 | if(pDev->device == PCI_DPT_DEVICE_ID || | 187 | if(pDev->device == PCI_DPT_DEVICE_ID || |
188 | pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){ | 188 | pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){ |
189 | if(adpt_install_hba(pDev) ){ | 189 | if(adpt_install_hba(sht, pDev) ){ |
190 | PERROR("Could not Init an I2O RAID device\n"); | 190 | PERROR("Could not Init an I2O RAID device\n"); |
191 | PERROR("Will not try to detect others.\n"); | 191 | PERROR("Will not try to detect others.\n"); |
192 | return hba_count-1; | 192 | return hba_count-1; |
@@ -248,33 +248,34 @@ rebuild_sys_tab: | |||
248 | } | 248 | } |
249 | 249 | ||
250 | for (pHba = hba_chain; pHba; pHba = pHba->next) { | 250 | for (pHba = hba_chain; pHba; pHba = pHba->next) { |
251 | if (adpt_scsi_register(pHba) < 0) { | 251 | if( adpt_scsi_register(pHba,sht) < 0){ |
252 | adpt_i2o_delete_hba(pHba); | 252 | adpt_i2o_delete_hba(pHba); |
253 | continue; | 253 | continue; |
254 | } | 254 | } |
255 | pHba->initialized = TRUE; | 255 | pHba->initialized = TRUE; |
256 | pHba->state &= ~DPTI_STATE_RESET; | 256 | pHba->state &= ~DPTI_STATE_RESET; |
257 | scsi_scan_host(pHba->host); | ||
258 | } | 257 | } |
259 | 258 | ||
260 | // Register our control device node | 259 | // Register our control device node |
261 | // nodes will need to be created in /dev to access this | 260 | // nodes will need to be created in /dev to access this |
262 | // the nodes can not be created from within the driver | 261 | // the nodes can not be created from within the driver |
263 | if (hba_count && register_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER, &adpt_fops)) { | 262 | if (hba_count && register_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER, &adpt_fops)) { |
264 | adpt_exit(); | 263 | adpt_i2o_sys_shutdown(); |
265 | return 0; | 264 | return 0; |
266 | } | 265 | } |
267 | return hba_count; | 266 | return hba_count; |
268 | } | 267 | } |
269 | 268 | ||
270 | 269 | ||
271 | static int adpt_release(adpt_hba *pHba) | 270 | /* |
271 | * scsi_unregister will be called AFTER we return. | ||
272 | */ | ||
273 | static int adpt_release(struct Scsi_Host *host) | ||
272 | { | 274 | { |
273 | struct Scsi_Host *shost = pHba->host; | 275 | adpt_hba* pHba = (adpt_hba*) host->hostdata[0]; |
274 | scsi_remove_host(shost); | ||
275 | // adpt_i2o_quiesce_hba(pHba); | 276 | // adpt_i2o_quiesce_hba(pHba); |
276 | adpt_i2o_delete_hba(pHba); | 277 | adpt_i2o_delete_hba(pHba); |
277 | scsi_host_put(shost); | 278 | scsi_unregister(host); |
278 | return 0; | 279 | return 0; |
279 | } | 280 | } |
280 | 281 | ||
@@ -881,7 +882,7 @@ static int adpt_reboot_event(struct notifier_block *n, ulong code, void *p) | |||
881 | #endif | 882 | #endif |
882 | 883 | ||
883 | 884 | ||
884 | static int adpt_install_hba(struct pci_dev* pDev) | 885 | static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) |
885 | { | 886 | { |
886 | 887 | ||
887 | adpt_hba* pHba = NULL; | 888 | adpt_hba* pHba = NULL; |
@@ -1028,6 +1029,8 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba) | |||
1028 | 1029 | ||
1029 | 1030 | ||
1030 | mutex_lock(&adpt_configuration_lock); | 1031 | mutex_lock(&adpt_configuration_lock); |
1032 | // scsi_unregister calls our adpt_release which | ||
1033 | // does a quiese | ||
1031 | if(pHba->host){ | 1034 | if(pHba->host){ |
1032 | free_irq(pHba->host->irq, pHba); | 1035 | free_irq(pHba->host->irq, pHba); |
1033 | } | 1036 | } |
@@ -1079,6 +1082,17 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba) | |||
1079 | } | 1082 | } |
1080 | 1083 | ||
1081 | 1084 | ||
1085 | static int adpt_init(void) | ||
1086 | { | ||
1087 | printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n"); | ||
1088 | #ifdef REBOOT_NOTIFIER | ||
1089 | register_reboot_notifier(&adpt_reboot_notifier); | ||
1090 | #endif | ||
1091 | |||
1092 | return 0; | ||
1093 | } | ||
1094 | |||
1095 | |||
1082 | static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun) | 1096 | static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun) |
1083 | { | 1097 | { |
1084 | struct adpt_device* d; | 1098 | struct adpt_device* d; |
@@ -2164,6 +2178,37 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d | |||
2164 | } | 2178 | } |
2165 | 2179 | ||
2166 | 2180 | ||
2181 | static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht) | ||
2182 | { | ||
2183 | struct Scsi_Host *host = NULL; | ||
2184 | |||
2185 | host = scsi_register(sht, sizeof(adpt_hba*)); | ||
2186 | if (host == NULL) { | ||
2187 | printk ("%s: scsi_register returned NULL\n",pHba->name); | ||
2188 | return -1; | ||
2189 | } | ||
2190 | host->hostdata[0] = (unsigned long)pHba; | ||
2191 | pHba->host = host; | ||
2192 | |||
2193 | host->irq = pHba->pDev->irq; | ||
2194 | /* no IO ports, so don't have to set host->io_port and | ||
2195 | * host->n_io_port | ||
2196 | */ | ||
2197 | host->io_port = 0; | ||
2198 | host->n_io_port = 0; | ||
2199 | /* see comments in scsi_host.h */ | ||
2200 | host->max_id = 16; | ||
2201 | host->max_lun = 256; | ||
2202 | host->max_channel = pHba->top_scsi_channel + 1; | ||
2203 | host->cmd_per_lun = 1; | ||
2204 | host->unique_id = (uint) pHba; | ||
2205 | host->sg_tablesize = pHba->sg_tablesize; | ||
2206 | host->can_queue = pHba->post_fifo_size; | ||
2207 | |||
2208 | return 0; | ||
2209 | } | ||
2210 | |||
2211 | |||
2167 | static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd) | 2212 | static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd) |
2168 | { | 2213 | { |
2169 | adpt_hba* pHba; | 2214 | adpt_hba* pHba; |
@@ -3279,10 +3324,12 @@ static static void adpt_delay(int millisec) | |||
3279 | 3324 | ||
3280 | #endif | 3325 | #endif |
3281 | 3326 | ||
3282 | static struct scsi_host_template adpt_template = { | 3327 | static struct scsi_host_template driver_template = { |
3283 | .name = "dpt_i2o", | 3328 | .name = "dpt_i2o", |
3284 | .proc_name = "dpt_i2o", | 3329 | .proc_name = "dpt_i2o", |
3285 | .proc_info = adpt_proc_info, | 3330 | .proc_info = adpt_proc_info, |
3331 | .detect = adpt_detect, | ||
3332 | .release = adpt_release, | ||
3286 | .info = adpt_info, | 3333 | .info = adpt_info, |
3287 | .queuecommand = adpt_queue, | 3334 | .queuecommand = adpt_queue, |
3288 | .eh_abort_handler = adpt_abort, | 3335 | .eh_abort_handler = adpt_abort, |
@@ -3297,62 +3344,5 @@ static struct scsi_host_template adpt_template = { | |||
3297 | .use_clustering = ENABLE_CLUSTERING, | 3344 | .use_clustering = ENABLE_CLUSTERING, |
3298 | .use_sg_chaining = ENABLE_SG_CHAINING, | 3345 | .use_sg_chaining = ENABLE_SG_CHAINING, |
3299 | }; | 3346 | }; |
3300 | 3347 | #include "scsi_module.c" | |
3301 | static s32 adpt_scsi_register(adpt_hba* pHba) | ||
3302 | { | ||
3303 | struct Scsi_Host *host; | ||
3304 | |||
3305 | host = scsi_host_alloc(&adpt_template, sizeof(adpt_hba*)); | ||
3306 | if (host == NULL) { | ||
3307 | printk ("%s: scsi_host_alloc returned NULL\n",pHba->name); | ||
3308 | return -1; | ||
3309 | } | ||
3310 | host->hostdata[0] = (unsigned long)pHba; | ||
3311 | pHba->host = host; | ||
3312 | |||
3313 | host->irq = pHba->pDev->irq; | ||
3314 | /* no IO ports, so don't have to set host->io_port and | ||
3315 | * host->n_io_port | ||
3316 | */ | ||
3317 | host->io_port = 0; | ||
3318 | host->n_io_port = 0; | ||
3319 | /* see comments in scsi_host.h */ | ||
3320 | host->max_id = 16; | ||
3321 | host->max_lun = 256; | ||
3322 | host->max_channel = pHba->top_scsi_channel + 1; | ||
3323 | host->cmd_per_lun = 1; | ||
3324 | host->unique_id = (uint) pHba; | ||
3325 | host->sg_tablesize = pHba->sg_tablesize; | ||
3326 | host->can_queue = pHba->post_fifo_size; | ||
3327 | |||
3328 | if (scsi_add_host(host, &pHba->pDev->dev)) { | ||
3329 | scsi_host_put(host); | ||
3330 | return -1; | ||
3331 | } | ||
3332 | |||
3333 | return 0; | ||
3334 | } | ||
3335 | |||
3336 | static int __init adpt_init(void) | ||
3337 | { | ||
3338 | int count; | ||
3339 | |||
3340 | printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n"); | ||
3341 | #ifdef REBOOT_NOTIFIER | ||
3342 | register_reboot_notifier(&adpt_reboot_notifier); | ||
3343 | #endif | ||
3344 | |||
3345 | count = adpt_detect(); | ||
3346 | |||
3347 | return count > 0 ? 0 : -ENODEV; | ||
3348 | } | ||
3349 | |||
3350 | static void adpt_exit(void) | ||
3351 | { | ||
3352 | while (hba_chain) | ||
3353 | adpt_release(hba_chain); | ||
3354 | } | ||
3355 | |||
3356 | module_init(adpt_init); | ||
3357 | module_exit(adpt_exit); | ||
3358 | MODULE_LICENSE("GPL"); | 3348 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h index 0892f6c70319..fd79068c5869 100644 --- a/drivers/scsi/dpti.h +++ b/drivers/scsi/dpti.h | |||
@@ -28,9 +28,11 @@ | |||
28 | * SCSI interface function Prototypes | 28 | * SCSI interface function Prototypes |
29 | */ | 29 | */ |
30 | 30 | ||
31 | static int adpt_detect(struct scsi_host_template * sht); | ||
31 | static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *)); | 32 | static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *)); |
32 | static int adpt_abort(struct scsi_cmnd * cmd); | 33 | static int adpt_abort(struct scsi_cmnd * cmd); |
33 | static int adpt_reset(struct scsi_cmnd* cmd); | 34 | static int adpt_reset(struct scsi_cmnd* cmd); |
35 | static int adpt_release(struct Scsi_Host *host); | ||
34 | static int adpt_slave_configure(struct scsi_device *); | 36 | static int adpt_slave_configure(struct scsi_device *); |
35 | 37 | ||
36 | static const char *adpt_info(struct Scsi_Host *pSHost); | 38 | static const char *adpt_info(struct Scsi_Host *pSHost); |
@@ -47,6 +49,8 @@ static int adpt_device_reset(struct scsi_cmnd* cmd); | |||
47 | 49 | ||
48 | #define DPT_DRIVER_NAME "Adaptec I2O RAID" | 50 | #define DPT_DRIVER_NAME "Adaptec I2O RAID" |
49 | 51 | ||
52 | #ifndef HOSTS_C | ||
53 | |||
50 | #include "dpt/sys_info.h" | 54 | #include "dpt/sys_info.h" |
51 | #include <linux/wait.h> | 55 | #include <linux/wait.h> |
52 | #include "dpt/dpti_i2o.h" | 56 | #include "dpt/dpti_i2o.h" |
@@ -285,7 +289,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba); | |||
285 | static s32 adpt_i2o_hrt_get(adpt_hba* pHba); | 289 | static s32 adpt_i2o_hrt_get(adpt_hba* pHba); |
286 | static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice); | 290 | static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice); |
287 | static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd); | 291 | static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd); |
288 | static s32 adpt_scsi_register(adpt_hba* pHba); | 292 | static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht); |
289 | static s32 adpt_hba_reset(adpt_hba* pHba); | 293 | static s32 adpt_hba_reset(adpt_hba* pHba); |
290 | static s32 adpt_i2o_reset_hba(adpt_hba* pHba); | 294 | static s32 adpt_i2o_reset_hba(adpt_hba* pHba); |
291 | static s32 adpt_rescan(adpt_hba* pHba); | 295 | static s32 adpt_rescan(adpt_hba* pHba); |
@@ -295,7 +299,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba); | |||
295 | static void adpt_inquiry(adpt_hba* pHba); | 299 | static void adpt_inquiry(adpt_hba* pHba); |
296 | static void adpt_fail_posted_scbs(adpt_hba* pHba); | 300 | static void adpt_fail_posted_scbs(adpt_hba* pHba); |
297 | static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun); | 301 | static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun); |
298 | static int adpt_install_hba(struct pci_dev* pDev) ; | 302 | static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) ; |
299 | static int adpt_i2o_online_hba(adpt_hba* pHba); | 303 | static int adpt_i2o_online_hba(adpt_hba* pHba); |
300 | static void adpt_i2o_post_wait_complete(u32, int); | 304 | static void adpt_i2o_post_wait_complete(u32, int); |
301 | static int adpt_i2o_systab_send(adpt_hba* pHba); | 305 | static int adpt_i2o_systab_send(adpt_hba* pHba); |
@@ -339,4 +343,5 @@ static void adpt_i386_info(sysInfo_S* si); | |||
339 | #define FW_DEBUG_BLED_OFFSET 8 | 343 | #define FW_DEBUG_BLED_OFFSET 8 |
340 | 344 | ||
341 | #define FW_DEBUG_FLAGS_NO_HEADERS_B 0x01 | 345 | #define FW_DEBUG_FLAGS_NO_HEADERS_B 0x01 |
346 | #endif /* !HOSTS_C */ | ||
342 | #endif /* _DPT_H */ | 347 | #endif /* _DPT_H */ |
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index 2596165096d3..c2677ba29c74 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c | |||
@@ -277,7 +277,8 @@ found: | |||
277 | /* With interrupts enabled, it will sometimes hang when doing heavy | 277 | /* With interrupts enabled, it will sometimes hang when doing heavy |
278 | * reads. So better not enable them until I finger it out. */ | 278 | * reads. So better not enable them until I finger it out. */ |
279 | if (instance->irq != SCSI_IRQ_NONE) | 279 | if (instance->irq != SCSI_IRQ_NONE) |
280 | if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED, "dtc", instance)) { | 280 | if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED, |
281 | "dtc", instance)) { | ||
281 | printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); | 282 | printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); |
282 | instance->irq = SCSI_IRQ_NONE; | 283 | instance->irq = SCSI_IRQ_NONE; |
283 | } | 284 | } |
@@ -459,7 +460,7 @@ static int dtc_release(struct Scsi_Host *shost) | |||
459 | NCR5380_local_declare(); | 460 | NCR5380_local_declare(); |
460 | NCR5380_setup(shost); | 461 | NCR5380_setup(shost); |
461 | if (shost->irq) | 462 | if (shost->irq) |
462 | free_irq(shost->irq, NULL); | 463 | free_irq(shost->irq, shost); |
463 | NCR5380_exit(shost); | 464 | NCR5380_exit(shost); |
464 | if (shost->io_port && shost->n_io_port) | 465 | if (shost->io_port && shost->n_io_port) |
465 | release_region(shost->io_port, shost->n_io_port); | 466 | release_region(shost->io_port, shost->n_io_port); |
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index 4ed3a5297066..bfdee5968892 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c | |||
@@ -2026,8 +2026,8 @@ static void esp_reset_cleanup(struct esp *esp) | |||
2026 | tp->flags |= ESP_TGT_CHECK_NEGO; | 2026 | tp->flags |= ESP_TGT_CHECK_NEGO; |
2027 | 2027 | ||
2028 | if (tp->starget) | 2028 | if (tp->starget) |
2029 | starget_for_each_device(tp->starget, NULL, | 2029 | __starget_for_each_device(tp->starget, NULL, |
2030 | esp_clear_hold); | 2030 | esp_clear_hold); |
2031 | } | 2031 | } |
2032 | esp->flags &= ~ESP_FLAG_RESETTING; | 2032 | esp->flags &= ~ESP_FLAG_RESETTING; |
2033 | } | 2033 | } |
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index 607336f56d55..75585a52c88b 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c | |||
@@ -460,7 +460,8 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt) | |||
460 | instance->irq = NCR5380_probe_irq(instance, 0xffff); | 460 | instance->irq = NCR5380_probe_irq(instance, 0xffff); |
461 | 461 | ||
462 | if (instance->irq != SCSI_IRQ_NONE) | 462 | if (instance->irq != SCSI_IRQ_NONE) |
463 | if (request_irq(instance->irq, generic_NCR5380_intr, IRQF_DISABLED, "NCR5380", instance)) { | 463 | if (request_irq(instance->irq, generic_NCR5380_intr, |
464 | IRQF_DISABLED, "NCR5380", instance)) { | ||
464 | printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); | 465 | printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); |
465 | instance->irq = SCSI_IRQ_NONE; | 466 | instance->irq = SCSI_IRQ_NONE; |
466 | } | 467 | } |
@@ -513,7 +514,7 @@ int generic_NCR5380_release_resources(struct Scsi_Host *instance) | |||
513 | NCR5380_setup(instance); | 514 | NCR5380_setup(instance); |
514 | 515 | ||
515 | if (instance->irq != SCSI_IRQ_NONE) | 516 | if (instance->irq != SCSI_IRQ_NONE) |
516 | free_irq(instance->irq, NULL); | 517 | free_irq(instance->irq, instance); |
517 | NCR5380_exit(instance); | 518 | NCR5380_exit(instance); |
518 | 519 | ||
519 | #ifndef CONFIG_SCSI_G_NCR5380_MEM | 520 | #ifndef CONFIG_SCSI_G_NCR5380_MEM |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 8d0244c2e7d4..7a835a35f21d 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -242,16 +242,6 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign | |||
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | static void hexdump(u8 *x, int len) | ||
246 | { | ||
247 | int i; | ||
248 | |||
249 | printk("[ "); | ||
250 | for (i = 0; i < len; i++) | ||
251 | printk("%x ", x[i]); | ||
252 | printk("]\n"); | ||
253 | } | ||
254 | |||
255 | static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command) | 245 | static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command) |
256 | { | 246 | { |
257 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 247 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
@@ -282,7 +272,8 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co | |||
282 | pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd; | 272 | pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd; |
283 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { | 273 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { |
284 | printk ("ide-scsi: %s: queue cmd = ", drive->name); | 274 | printk ("ide-scsi: %s: queue cmd = ", drive->name); |
285 | hexdump(pc->c, 6); | 275 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, pc->c, |
276 | 6, 0); | ||
286 | } | 277 | } |
287 | rq->rq_disk = scsi->disk; | 278 | rq->rq_disk = scsi->disk; |
288 | return ide_do_drive_cmd(drive, rq, ide_preempt); | 279 | return ide_do_drive_cmd(drive, rq, ide_preempt); |
@@ -337,7 +328,8 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) | |||
337 | idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer; | 328 | idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer; |
338 | if (log) { | 329 | if (log) { |
339 | printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); | 330 | printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); |
340 | hexdump(pc->buffer,16); | 331 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, |
332 | pc->buffer, 16, 0); | ||
341 | } | 333 | } |
342 | memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE); | 334 | memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE); |
343 | kfree(pc->buffer); | 335 | kfree(pc->buffer); |
@@ -816,10 +808,12 @@ static int idescsi_queue (struct scsi_cmnd *cmd, | |||
816 | 808 | ||
817 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { | 809 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { |
818 | printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number); | 810 | printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number); |
819 | hexdump(cmd->cmnd, cmd->cmd_len); | 811 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, |
812 | cmd->cmnd, cmd->cmd_len, 0); | ||
820 | if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) { | 813 | if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) { |
821 | printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number); | 814 | printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number); |
822 | hexdump(pc->c, 12); | 815 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, |
816 | pc->c, 12, 0); | ||
823 | } | 817 | } |
824 | } | 818 | } |
825 | 819 | ||
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 4bcf916c21a7..57ce2251abc8 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -197,7 +197,7 @@ iscsi_tcp_cleanup_ctask(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
197 | if (unlikely(!sc)) | 197 | if (unlikely(!sc)) |
198 | return; | 198 | return; |
199 | 199 | ||
200 | tcp_ctask->xmstate = XMSTATE_IDLE; | 200 | tcp_ctask->xmstate = XMSTATE_VALUE_IDLE; |
201 | tcp_ctask->r2t = NULL; | 201 | tcp_ctask->r2t = NULL; |
202 | } | 202 | } |
203 | 203 | ||
@@ -409,7 +409,7 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
409 | 409 | ||
410 | tcp_ctask->exp_datasn = r2tsn + 1; | 410 | tcp_ctask->exp_datasn = r2tsn + 1; |
411 | __kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*)); | 411 | __kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*)); |
412 | tcp_ctask->xmstate |= XMSTATE_SOL_HDR_INIT; | 412 | set_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate); |
413 | list_move_tail(&ctask->running, &conn->xmitqueue); | 413 | list_move_tail(&ctask->running, &conn->xmitqueue); |
414 | 414 | ||
415 | scsi_queue_work(session->host, &conn->xmitwork); | 415 | scsi_queue_work(session->host, &conn->xmitwork); |
@@ -1254,7 +1254,7 @@ static void iscsi_set_padding(struct iscsi_tcp_cmd_task *tcp_ctask, | |||
1254 | 1254 | ||
1255 | tcp_ctask->pad_count = ISCSI_PAD_LEN - tcp_ctask->pad_count; | 1255 | tcp_ctask->pad_count = ISCSI_PAD_LEN - tcp_ctask->pad_count; |
1256 | debug_scsi("write padding %d bytes\n", tcp_ctask->pad_count); | 1256 | debug_scsi("write padding %d bytes\n", tcp_ctask->pad_count); |
1257 | tcp_ctask->xmstate |= XMSTATE_W_PAD; | 1257 | set_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate); |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | /** | 1260 | /** |
@@ -1269,7 +1269,7 @@ iscsi_tcp_cmd_init(struct iscsi_cmd_task *ctask) | |||
1269 | struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; | 1269 | struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; |
1270 | 1270 | ||
1271 | BUG_ON(__kfifo_len(tcp_ctask->r2tqueue)); | 1271 | BUG_ON(__kfifo_len(tcp_ctask->r2tqueue)); |
1272 | tcp_ctask->xmstate = XMSTATE_CMD_HDR_INIT; | 1272 | tcp_ctask->xmstate = 1 << XMSTATE_BIT_CMD_HDR_INIT; |
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | /** | 1275 | /** |
@@ -1283,10 +1283,10 @@ iscsi_tcp_cmd_init(struct iscsi_cmd_task *ctask) | |||
1283 | * xmit. | 1283 | * xmit. |
1284 | * | 1284 | * |
1285 | * Management xmit state machine consists of these states: | 1285 | * Management xmit state machine consists of these states: |
1286 | * XMSTATE_IMM_HDR_INIT - calculate digest of PDU Header | 1286 | * XMSTATE_BIT_IMM_HDR_INIT - calculate digest of PDU Header |
1287 | * XMSTATE_IMM_HDR - PDU Header xmit in progress | 1287 | * XMSTATE_BIT_IMM_HDR - PDU Header xmit in progress |
1288 | * XMSTATE_IMM_DATA - PDU Data xmit in progress | 1288 | * XMSTATE_BIT_IMM_DATA - PDU Data xmit in progress |
1289 | * XMSTATE_IDLE - management PDU is done | 1289 | * XMSTATE_VALUE_IDLE - management PDU is done |
1290 | **/ | 1290 | **/ |
1291 | static int | 1291 | static int |
1292 | iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) | 1292 | iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) |
@@ -1297,12 +1297,12 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) | |||
1297 | debug_scsi("mtask deq [cid %d state %x itt 0x%x]\n", | 1297 | debug_scsi("mtask deq [cid %d state %x itt 0x%x]\n", |
1298 | conn->id, tcp_mtask->xmstate, mtask->itt); | 1298 | conn->id, tcp_mtask->xmstate, mtask->itt); |
1299 | 1299 | ||
1300 | if (tcp_mtask->xmstate & XMSTATE_IMM_HDR_INIT) { | 1300 | if (test_bit(XMSTATE_BIT_IMM_HDR_INIT, &tcp_mtask->xmstate)) { |
1301 | iscsi_buf_init_iov(&tcp_mtask->headbuf, (char*)mtask->hdr, | 1301 | iscsi_buf_init_iov(&tcp_mtask->headbuf, (char*)mtask->hdr, |
1302 | sizeof(struct iscsi_hdr)); | 1302 | sizeof(struct iscsi_hdr)); |
1303 | 1303 | ||
1304 | if (mtask->data_count) { | 1304 | if (mtask->data_count) { |
1305 | tcp_mtask->xmstate |= XMSTATE_IMM_DATA; | 1305 | set_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate); |
1306 | iscsi_buf_init_iov(&tcp_mtask->sendbuf, | 1306 | iscsi_buf_init_iov(&tcp_mtask->sendbuf, |
1307 | (char*)mtask->data, | 1307 | (char*)mtask->data, |
1308 | mtask->data_count); | 1308 | mtask->data_count); |
@@ -1315,21 +1315,20 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) | |||
1315 | (u8*)tcp_mtask->hdrext); | 1315 | (u8*)tcp_mtask->hdrext); |
1316 | 1316 | ||
1317 | tcp_mtask->sent = 0; | 1317 | tcp_mtask->sent = 0; |
1318 | tcp_mtask->xmstate &= ~XMSTATE_IMM_HDR_INIT; | 1318 | clear_bit(XMSTATE_BIT_IMM_HDR_INIT, &tcp_mtask->xmstate); |
1319 | tcp_mtask->xmstate |= XMSTATE_IMM_HDR; | 1319 | set_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate); |
1320 | } | 1320 | } |
1321 | 1321 | ||
1322 | if (tcp_mtask->xmstate & XMSTATE_IMM_HDR) { | 1322 | if (test_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate)) { |
1323 | rc = iscsi_sendhdr(conn, &tcp_mtask->headbuf, | 1323 | rc = iscsi_sendhdr(conn, &tcp_mtask->headbuf, |
1324 | mtask->data_count); | 1324 | mtask->data_count); |
1325 | if (rc) | 1325 | if (rc) |
1326 | return rc; | 1326 | return rc; |
1327 | tcp_mtask->xmstate &= ~XMSTATE_IMM_HDR; | 1327 | clear_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate); |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | if (tcp_mtask->xmstate & XMSTATE_IMM_DATA) { | 1330 | if (test_and_clear_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate)) { |
1331 | BUG_ON(!mtask->data_count); | 1331 | BUG_ON(!mtask->data_count); |
1332 | tcp_mtask->xmstate &= ~XMSTATE_IMM_DATA; | ||
1333 | /* FIXME: implement. | 1332 | /* FIXME: implement. |
1334 | * Virtual buffer could be spreaded across multiple pages... | 1333 | * Virtual buffer could be spreaded across multiple pages... |
1335 | */ | 1334 | */ |
@@ -1339,13 +1338,13 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) | |||
1339 | rc = iscsi_sendpage(conn, &tcp_mtask->sendbuf, | 1338 | rc = iscsi_sendpage(conn, &tcp_mtask->sendbuf, |
1340 | &mtask->data_count, &tcp_mtask->sent); | 1339 | &mtask->data_count, &tcp_mtask->sent); |
1341 | if (rc) { | 1340 | if (rc) { |
1342 | tcp_mtask->xmstate |= XMSTATE_IMM_DATA; | 1341 | set_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate); |
1343 | return rc; | 1342 | return rc; |
1344 | } | 1343 | } |
1345 | } while (mtask->data_count); | 1344 | } while (mtask->data_count); |
1346 | } | 1345 | } |
1347 | 1346 | ||
1348 | BUG_ON(tcp_mtask->xmstate != XMSTATE_IDLE); | 1347 | BUG_ON(tcp_mtask->xmstate != XMSTATE_VALUE_IDLE); |
1349 | if (mtask->hdr->itt == RESERVED_ITT) { | 1348 | if (mtask->hdr->itt == RESERVED_ITT) { |
1350 | struct iscsi_session *session = conn->session; | 1349 | struct iscsi_session *session = conn->session; |
1351 | 1350 | ||
@@ -1365,7 +1364,7 @@ iscsi_send_cmd_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
1365 | struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; | 1364 | struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; |
1366 | int rc = 0; | 1365 | int rc = 0; |
1367 | 1366 | ||
1368 | if (tcp_ctask->xmstate & XMSTATE_CMD_HDR_INIT) { | 1367 | if (test_bit(XMSTATE_BIT_CMD_HDR_INIT, &tcp_ctask->xmstate)) { |
1369 | tcp_ctask->sent = 0; | 1368 | tcp_ctask->sent = 0; |
1370 | tcp_ctask->sg_count = 0; | 1369 | tcp_ctask->sg_count = 0; |
1371 | tcp_ctask->exp_datasn = 0; | 1370 | tcp_ctask->exp_datasn = 0; |
@@ -1390,21 +1389,21 @@ iscsi_send_cmd_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
1390 | if (conn->hdrdgst_en) | 1389 | if (conn->hdrdgst_en) |
1391 | iscsi_hdr_digest(conn, &tcp_ctask->headbuf, | 1390 | iscsi_hdr_digest(conn, &tcp_ctask->headbuf, |
1392 | (u8*)tcp_ctask->hdrext); | 1391 | (u8*)tcp_ctask->hdrext); |
1393 | tcp_ctask->xmstate &= ~XMSTATE_CMD_HDR_INIT; | 1392 | clear_bit(XMSTATE_BIT_CMD_HDR_INIT, &tcp_ctask->xmstate); |
1394 | tcp_ctask->xmstate |= XMSTATE_CMD_HDR_XMIT; | 1393 | set_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate); |
1395 | } | 1394 | } |
1396 | 1395 | ||
1397 | if (tcp_ctask->xmstate & XMSTATE_CMD_HDR_XMIT) { | 1396 | if (test_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate)) { |
1398 | rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->imm_count); | 1397 | rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->imm_count); |
1399 | if (rc) | 1398 | if (rc) |
1400 | return rc; | 1399 | return rc; |
1401 | tcp_ctask->xmstate &= ~XMSTATE_CMD_HDR_XMIT; | 1400 | clear_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate); |
1402 | 1401 | ||
1403 | if (sc->sc_data_direction != DMA_TO_DEVICE) | 1402 | if (sc->sc_data_direction != DMA_TO_DEVICE) |
1404 | return 0; | 1403 | return 0; |
1405 | 1404 | ||
1406 | if (ctask->imm_count) { | 1405 | if (ctask->imm_count) { |
1407 | tcp_ctask->xmstate |= XMSTATE_IMM_DATA; | 1406 | set_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate); |
1408 | iscsi_set_padding(tcp_ctask, ctask->imm_count); | 1407 | iscsi_set_padding(tcp_ctask, ctask->imm_count); |
1409 | 1408 | ||
1410 | if (ctask->conn->datadgst_en) { | 1409 | if (ctask->conn->datadgst_en) { |
@@ -1414,9 +1413,10 @@ iscsi_send_cmd_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
1414 | } | 1413 | } |
1415 | } | 1414 | } |
1416 | 1415 | ||
1417 | if (ctask->unsol_count) | 1416 | if (ctask->unsol_count) { |
1418 | tcp_ctask->xmstate |= | 1417 | set_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate); |
1419 | XMSTATE_UNS_HDR | XMSTATE_UNS_INIT; | 1418 | set_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate); |
1419 | } | ||
1420 | } | 1420 | } |
1421 | return rc; | 1421 | return rc; |
1422 | } | 1422 | } |
@@ -1428,25 +1428,25 @@ iscsi_send_padding(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
1428 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; | 1428 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; |
1429 | int sent = 0, rc; | 1429 | int sent = 0, rc; |
1430 | 1430 | ||
1431 | if (tcp_ctask->xmstate & XMSTATE_W_PAD) { | 1431 | if (test_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate)) { |
1432 | iscsi_buf_init_iov(&tcp_ctask->sendbuf, (char*)&tcp_ctask->pad, | 1432 | iscsi_buf_init_iov(&tcp_ctask->sendbuf, (char*)&tcp_ctask->pad, |
1433 | tcp_ctask->pad_count); | 1433 | tcp_ctask->pad_count); |
1434 | if (conn->datadgst_en) | 1434 | if (conn->datadgst_en) |
1435 | crypto_hash_update(&tcp_conn->tx_hash, | 1435 | crypto_hash_update(&tcp_conn->tx_hash, |
1436 | &tcp_ctask->sendbuf.sg, | 1436 | &tcp_ctask->sendbuf.sg, |
1437 | tcp_ctask->sendbuf.sg.length); | 1437 | tcp_ctask->sendbuf.sg.length); |
1438 | } else if (!(tcp_ctask->xmstate & XMSTATE_W_RESEND_PAD)) | 1438 | } else if (!test_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate)) |
1439 | return 0; | 1439 | return 0; |
1440 | 1440 | ||
1441 | tcp_ctask->xmstate &= ~XMSTATE_W_PAD; | 1441 | clear_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate); |
1442 | tcp_ctask->xmstate &= ~XMSTATE_W_RESEND_PAD; | 1442 | clear_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate); |
1443 | debug_scsi("sending %d pad bytes for itt 0x%x\n", | 1443 | debug_scsi("sending %d pad bytes for itt 0x%x\n", |
1444 | tcp_ctask->pad_count, ctask->itt); | 1444 | tcp_ctask->pad_count, ctask->itt); |
1445 | rc = iscsi_sendpage(conn, &tcp_ctask->sendbuf, &tcp_ctask->pad_count, | 1445 | rc = iscsi_sendpage(conn, &tcp_ctask->sendbuf, &tcp_ctask->pad_count, |
1446 | &sent); | 1446 | &sent); |
1447 | if (rc) { | 1447 | if (rc) { |
1448 | debug_scsi("padding send failed %d\n", rc); | 1448 | debug_scsi("padding send failed %d\n", rc); |
1449 | tcp_ctask->xmstate |= XMSTATE_W_RESEND_PAD; | 1449 | set_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate); |
1450 | } | 1450 | } |
1451 | return rc; | 1451 | return rc; |
1452 | } | 1452 | } |
@@ -1465,11 +1465,11 @@ iscsi_send_digest(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask, | |||
1465 | tcp_ctask = ctask->dd_data; | 1465 | tcp_ctask = ctask->dd_data; |
1466 | tcp_conn = conn->dd_data; | 1466 | tcp_conn = conn->dd_data; |
1467 | 1467 | ||
1468 | if (!(tcp_ctask->xmstate & XMSTATE_W_RESEND_DATA_DIGEST)) { | 1468 | if (!test_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate)) { |
1469 | crypto_hash_final(&tcp_conn->tx_hash, (u8*)digest); | 1469 | crypto_hash_final(&tcp_conn->tx_hash, (u8*)digest); |
1470 | iscsi_buf_init_iov(buf, (char*)digest, 4); | 1470 | iscsi_buf_init_iov(buf, (char*)digest, 4); |
1471 | } | 1471 | } |
1472 | tcp_ctask->xmstate &= ~XMSTATE_W_RESEND_DATA_DIGEST; | 1472 | clear_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate); |
1473 | 1473 | ||
1474 | rc = iscsi_sendpage(conn, buf, &tcp_ctask->digest_count, &sent); | 1474 | rc = iscsi_sendpage(conn, buf, &tcp_ctask->digest_count, &sent); |
1475 | if (!rc) | 1475 | if (!rc) |
@@ -1478,7 +1478,7 @@ iscsi_send_digest(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask, | |||
1478 | else { | 1478 | else { |
1479 | debug_scsi("sending digest 0x%x failed for itt 0x%x!\n", | 1479 | debug_scsi("sending digest 0x%x failed for itt 0x%x!\n", |
1480 | *digest, ctask->itt); | 1480 | *digest, ctask->itt); |
1481 | tcp_ctask->xmstate |= XMSTATE_W_RESEND_DATA_DIGEST; | 1481 | set_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate); |
1482 | } | 1482 | } |
1483 | return rc; | 1483 | return rc; |
1484 | } | 1484 | } |
@@ -1526,8 +1526,8 @@ iscsi_send_unsol_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
1526 | struct iscsi_data_task *dtask; | 1526 | struct iscsi_data_task *dtask; |
1527 | int rc; | 1527 | int rc; |
1528 | 1528 | ||
1529 | tcp_ctask->xmstate |= XMSTATE_UNS_DATA; | 1529 | set_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate); |
1530 | if (tcp_ctask->xmstate & XMSTATE_UNS_INIT) { | 1530 | if (test_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate)) { |
1531 | dtask = &tcp_ctask->unsol_dtask; | 1531 | dtask = &tcp_ctask->unsol_dtask; |
1532 | 1532 | ||
1533 | iscsi_prep_unsolicit_data_pdu(ctask, &dtask->hdr); | 1533 | iscsi_prep_unsolicit_data_pdu(ctask, &dtask->hdr); |
@@ -1537,14 +1537,14 @@ iscsi_send_unsol_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
1537 | iscsi_hdr_digest(conn, &tcp_ctask->headbuf, | 1537 | iscsi_hdr_digest(conn, &tcp_ctask->headbuf, |
1538 | (u8*)dtask->hdrext); | 1538 | (u8*)dtask->hdrext); |
1539 | 1539 | ||
1540 | tcp_ctask->xmstate &= ~XMSTATE_UNS_INIT; | 1540 | clear_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate); |
1541 | iscsi_set_padding(tcp_ctask, ctask->data_count); | 1541 | iscsi_set_padding(tcp_ctask, ctask->data_count); |
1542 | } | 1542 | } |
1543 | 1543 | ||
1544 | rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->data_count); | 1544 | rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->data_count); |
1545 | if (rc) { | 1545 | if (rc) { |
1546 | tcp_ctask->xmstate &= ~XMSTATE_UNS_DATA; | 1546 | clear_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate); |
1547 | tcp_ctask->xmstate |= XMSTATE_UNS_HDR; | 1547 | set_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate); |
1548 | return rc; | 1548 | return rc; |
1549 | } | 1549 | } |
1550 | 1550 | ||
@@ -1565,16 +1565,15 @@ iscsi_send_unsol_pdu(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
1565 | struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; | 1565 | struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; |
1566 | int rc; | 1566 | int rc; |
1567 | 1567 | ||
1568 | if (tcp_ctask->xmstate & XMSTATE_UNS_HDR) { | 1568 | if (test_and_clear_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate)) { |
1569 | BUG_ON(!ctask->unsol_count); | 1569 | BUG_ON(!ctask->unsol_count); |
1570 | tcp_ctask->xmstate &= ~XMSTATE_UNS_HDR; | ||
1571 | send_hdr: | 1570 | send_hdr: |
1572 | rc = iscsi_send_unsol_hdr(conn, ctask); | 1571 | rc = iscsi_send_unsol_hdr(conn, ctask); |
1573 | if (rc) | 1572 | if (rc) |
1574 | return rc; | 1573 | return rc; |
1575 | } | 1574 | } |
1576 | 1575 | ||
1577 | if (tcp_ctask->xmstate & XMSTATE_UNS_DATA) { | 1576 | if (test_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate)) { |
1578 | struct iscsi_data_task *dtask = &tcp_ctask->unsol_dtask; | 1577 | struct iscsi_data_task *dtask = &tcp_ctask->unsol_dtask; |
1579 | int start = tcp_ctask->sent; | 1578 | int start = tcp_ctask->sent; |
1580 | 1579 | ||
@@ -1584,14 +1583,14 @@ send_hdr: | |||
1584 | ctask->unsol_count -= tcp_ctask->sent - start; | 1583 | ctask->unsol_count -= tcp_ctask->sent - start; |
1585 | if (rc) | 1584 | if (rc) |
1586 | return rc; | 1585 | return rc; |
1587 | tcp_ctask->xmstate &= ~XMSTATE_UNS_DATA; | 1586 | clear_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate); |
1588 | /* | 1587 | /* |
1589 | * Done with the Data-Out. Next, check if we need | 1588 | * Done with the Data-Out. Next, check if we need |
1590 | * to send another unsolicited Data-Out. | 1589 | * to send another unsolicited Data-Out. |
1591 | */ | 1590 | */ |
1592 | if (ctask->unsol_count) { | 1591 | if (ctask->unsol_count) { |
1593 | debug_scsi("sending more uns\n"); | 1592 | debug_scsi("sending more uns\n"); |
1594 | tcp_ctask->xmstate |= XMSTATE_UNS_INIT; | 1593 | set_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate); |
1595 | goto send_hdr; | 1594 | goto send_hdr; |
1596 | } | 1595 | } |
1597 | } | 1596 | } |
@@ -1607,7 +1606,7 @@ static int iscsi_send_sol_pdu(struct iscsi_conn *conn, | |||
1607 | struct iscsi_data_task *dtask; | 1606 | struct iscsi_data_task *dtask; |
1608 | int left, rc; | 1607 | int left, rc; |
1609 | 1608 | ||
1610 | if (tcp_ctask->xmstate & XMSTATE_SOL_HDR_INIT) { | 1609 | if (test_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate)) { |
1611 | if (!tcp_ctask->r2t) { | 1610 | if (!tcp_ctask->r2t) { |
1612 | spin_lock_bh(&session->lock); | 1611 | spin_lock_bh(&session->lock); |
1613 | __kfifo_get(tcp_ctask->r2tqueue, (void*)&tcp_ctask->r2t, | 1612 | __kfifo_get(tcp_ctask->r2tqueue, (void*)&tcp_ctask->r2t, |
@@ -1621,19 +1620,19 @@ send_hdr: | |||
1621 | if (conn->hdrdgst_en) | 1620 | if (conn->hdrdgst_en) |
1622 | iscsi_hdr_digest(conn, &r2t->headbuf, | 1621 | iscsi_hdr_digest(conn, &r2t->headbuf, |
1623 | (u8*)dtask->hdrext); | 1622 | (u8*)dtask->hdrext); |
1624 | tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR_INIT; | 1623 | clear_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate); |
1625 | tcp_ctask->xmstate |= XMSTATE_SOL_HDR; | 1624 | set_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate); |
1626 | } | 1625 | } |
1627 | 1626 | ||
1628 | if (tcp_ctask->xmstate & XMSTATE_SOL_HDR) { | 1627 | if (test_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate)) { |
1629 | r2t = tcp_ctask->r2t; | 1628 | r2t = tcp_ctask->r2t; |
1630 | dtask = &r2t->dtask; | 1629 | dtask = &r2t->dtask; |
1631 | 1630 | ||
1632 | rc = iscsi_sendhdr(conn, &r2t->headbuf, r2t->data_count); | 1631 | rc = iscsi_sendhdr(conn, &r2t->headbuf, r2t->data_count); |
1633 | if (rc) | 1632 | if (rc) |
1634 | return rc; | 1633 | return rc; |
1635 | tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR; | 1634 | clear_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate); |
1636 | tcp_ctask->xmstate |= XMSTATE_SOL_DATA; | 1635 | set_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate); |
1637 | 1636 | ||
1638 | if (conn->datadgst_en) { | 1637 | if (conn->datadgst_en) { |
1639 | iscsi_data_digest_init(conn->dd_data, tcp_ctask); | 1638 | iscsi_data_digest_init(conn->dd_data, tcp_ctask); |
@@ -1646,7 +1645,7 @@ send_hdr: | |||
1646 | r2t->sent); | 1645 | r2t->sent); |
1647 | } | 1646 | } |
1648 | 1647 | ||
1649 | if (tcp_ctask->xmstate & XMSTATE_SOL_DATA) { | 1648 | if (test_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate)) { |
1650 | r2t = tcp_ctask->r2t; | 1649 | r2t = tcp_ctask->r2t; |
1651 | dtask = &r2t->dtask; | 1650 | dtask = &r2t->dtask; |
1652 | 1651 | ||
@@ -1655,7 +1654,7 @@ send_hdr: | |||
1655 | &dtask->digestbuf, &dtask->digest); | 1654 | &dtask->digestbuf, &dtask->digest); |
1656 | if (rc) | 1655 | if (rc) |
1657 | return rc; | 1656 | return rc; |
1658 | tcp_ctask->xmstate &= ~XMSTATE_SOL_DATA; | 1657 | clear_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate); |
1659 | 1658 | ||
1660 | /* | 1659 | /* |
1661 | * Done with this Data-Out. Next, check if we have | 1660 | * Done with this Data-Out. Next, check if we have |
@@ -1700,32 +1699,32 @@ send_hdr: | |||
1700 | * xmit stages. | 1699 | * xmit stages. |
1701 | * | 1700 | * |
1702 | *iscsi_send_cmd_hdr() | 1701 | *iscsi_send_cmd_hdr() |
1703 | * XMSTATE_CMD_HDR_INIT - prepare Header and Data buffers Calculate | 1702 | * XMSTATE_BIT_CMD_HDR_INIT - prepare Header and Data buffers Calculate |
1704 | * Header Digest | 1703 | * Header Digest |
1705 | * XMSTATE_CMD_HDR_XMIT - Transmit header in progress | 1704 | * XMSTATE_BIT_CMD_HDR_XMIT - Transmit header in progress |
1706 | * | 1705 | * |
1707 | *iscsi_send_padding | 1706 | *iscsi_send_padding |
1708 | * XMSTATE_W_PAD - Prepare and send pading | 1707 | * XMSTATE_BIT_W_PAD - Prepare and send pading |
1709 | * XMSTATE_W_RESEND_PAD - retry send pading | 1708 | * XMSTATE_BIT_W_RESEND_PAD - retry send pading |
1710 | * | 1709 | * |
1711 | *iscsi_send_digest | 1710 | *iscsi_send_digest |
1712 | * XMSTATE_W_RESEND_DATA_DIGEST - Finalize and send Data Digest | 1711 | * XMSTATE_BIT_W_RESEND_DATA_DIGEST - Finalize and send Data Digest |
1713 | * XMSTATE_W_RESEND_DATA_DIGEST - retry sending digest | 1712 | * XMSTATE_BIT_W_RESEND_DATA_DIGEST - retry sending digest |
1714 | * | 1713 | * |
1715 | *iscsi_send_unsol_hdr | 1714 | *iscsi_send_unsol_hdr |
1716 | * XMSTATE_UNS_INIT - prepare un-solicit data header and digest | 1715 | * XMSTATE_BIT_UNS_INIT - prepare un-solicit data header and digest |
1717 | * XMSTATE_UNS_HDR - send un-solicit header | 1716 | * XMSTATE_BIT_UNS_HDR - send un-solicit header |
1718 | * | 1717 | * |
1719 | *iscsi_send_unsol_pdu | 1718 | *iscsi_send_unsol_pdu |
1720 | * XMSTATE_UNS_DATA - send un-solicit data in progress | 1719 | * XMSTATE_BIT_UNS_DATA - send un-solicit data in progress |
1721 | * | 1720 | * |
1722 | *iscsi_send_sol_pdu | 1721 | *iscsi_send_sol_pdu |
1723 | * XMSTATE_SOL_HDR_INIT - solicit data header and digest initialize | 1722 | * XMSTATE_BIT_SOL_HDR_INIT - solicit data header and digest initialize |
1724 | * XMSTATE_SOL_HDR - send solicit header | 1723 | * XMSTATE_BIT_SOL_HDR - send solicit header |
1725 | * XMSTATE_SOL_DATA - send solicit data | 1724 | * XMSTATE_BIT_SOL_DATA - send solicit data |
1726 | * | 1725 | * |
1727 | *iscsi_tcp_ctask_xmit | 1726 | *iscsi_tcp_ctask_xmit |
1728 | * XMSTATE_IMM_DATA - xmit managment data (??) | 1727 | * XMSTATE_BIT_IMM_DATA - xmit managment data (??) |
1729 | **/ | 1728 | **/ |
1730 | static int | 1729 | static int |
1731 | iscsi_tcp_ctask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | 1730 | iscsi_tcp_ctask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) |
@@ -1742,13 +1741,13 @@ iscsi_tcp_ctask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
1742 | if (ctask->sc->sc_data_direction != DMA_TO_DEVICE) | 1741 | if (ctask->sc->sc_data_direction != DMA_TO_DEVICE) |
1743 | return 0; | 1742 | return 0; |
1744 | 1743 | ||
1745 | if (tcp_ctask->xmstate & XMSTATE_IMM_DATA) { | 1744 | if (test_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate)) { |
1746 | rc = iscsi_send_data(ctask, &tcp_ctask->sendbuf, &tcp_ctask->sg, | 1745 | rc = iscsi_send_data(ctask, &tcp_ctask->sendbuf, &tcp_ctask->sg, |
1747 | &tcp_ctask->sent, &ctask->imm_count, | 1746 | &tcp_ctask->sent, &ctask->imm_count, |
1748 | &tcp_ctask->immbuf, &tcp_ctask->immdigest); | 1747 | &tcp_ctask->immbuf, &tcp_ctask->immdigest); |
1749 | if (rc) | 1748 | if (rc) |
1750 | return rc; | 1749 | return rc; |
1751 | tcp_ctask->xmstate &= ~XMSTATE_IMM_DATA; | 1750 | clear_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate); |
1752 | } | 1751 | } |
1753 | 1752 | ||
1754 | rc = iscsi_send_unsol_pdu(conn, ctask); | 1753 | rc = iscsi_send_unsol_pdu(conn, ctask); |
@@ -1981,7 +1980,7 @@ static void | |||
1981 | iscsi_tcp_mgmt_init(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) | 1980 | iscsi_tcp_mgmt_init(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) |
1982 | { | 1981 | { |
1983 | struct iscsi_tcp_mgmt_task *tcp_mtask = mtask->dd_data; | 1982 | struct iscsi_tcp_mgmt_task *tcp_mtask = mtask->dd_data; |
1984 | tcp_mtask->xmstate = XMSTATE_IMM_HDR_INIT; | 1983 | tcp_mtask->xmstate = 1 << XMSTATE_BIT_IMM_HDR_INIT; |
1985 | } | 1984 | } |
1986 | 1985 | ||
1987 | static int | 1986 | static int |
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index 7eba44df0a7f..68c36cc8997e 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h | |||
@@ -32,21 +32,21 @@ | |||
32 | #define IN_PROGRESS_PAD_RECV 0x4 | 32 | #define IN_PROGRESS_PAD_RECV 0x4 |
33 | 33 | ||
34 | /* xmit state machine */ | 34 | /* xmit state machine */ |
35 | #define XMSTATE_IDLE 0x0 | 35 | #define XMSTATE_VALUE_IDLE 0 |
36 | #define XMSTATE_CMD_HDR_INIT 0x1 | 36 | #define XMSTATE_BIT_CMD_HDR_INIT 0 |
37 | #define XMSTATE_CMD_HDR_XMIT 0x2 | 37 | #define XMSTATE_BIT_CMD_HDR_XMIT 1 |
38 | #define XMSTATE_IMM_HDR 0x4 | 38 | #define XMSTATE_BIT_IMM_HDR 2 |
39 | #define XMSTATE_IMM_DATA 0x8 | 39 | #define XMSTATE_BIT_IMM_DATA 3 |
40 | #define XMSTATE_UNS_INIT 0x10 | 40 | #define XMSTATE_BIT_UNS_INIT 4 |
41 | #define XMSTATE_UNS_HDR 0x20 | 41 | #define XMSTATE_BIT_UNS_HDR 5 |
42 | #define XMSTATE_UNS_DATA 0x40 | 42 | #define XMSTATE_BIT_UNS_DATA 6 |
43 | #define XMSTATE_SOL_HDR 0x80 | 43 | #define XMSTATE_BIT_SOL_HDR 7 |
44 | #define XMSTATE_SOL_DATA 0x100 | 44 | #define XMSTATE_BIT_SOL_DATA 8 |
45 | #define XMSTATE_W_PAD 0x200 | 45 | #define XMSTATE_BIT_W_PAD 9 |
46 | #define XMSTATE_W_RESEND_PAD 0x400 | 46 | #define XMSTATE_BIT_W_RESEND_PAD 10 |
47 | #define XMSTATE_W_RESEND_DATA_DIGEST 0x800 | 47 | #define XMSTATE_BIT_W_RESEND_DATA_DIGEST 11 |
48 | #define XMSTATE_IMM_HDR_INIT 0x1000 | 48 | #define XMSTATE_BIT_IMM_HDR_INIT 12 |
49 | #define XMSTATE_SOL_HDR_INIT 0x2000 | 49 | #define XMSTATE_BIT_SOL_HDR_INIT 13 |
50 | 50 | ||
51 | #define ISCSI_PAD_LEN 4 | 51 | #define ISCSI_PAD_LEN 4 |
52 | #define ISCSI_SG_TABLESIZE SG_ALL | 52 | #define ISCSI_SG_TABLESIZE SG_ALL |
@@ -122,7 +122,7 @@ struct iscsi_data_task { | |||
122 | struct iscsi_tcp_mgmt_task { | 122 | struct iscsi_tcp_mgmt_task { |
123 | struct iscsi_hdr hdr; | 123 | struct iscsi_hdr hdr; |
124 | char hdrext[sizeof(__u32)]; /* Header-Digest */ | 124 | char hdrext[sizeof(__u32)]; /* Header-Digest */ |
125 | int xmstate; /* mgmt xmit progress */ | 125 | unsigned long xmstate; /* mgmt xmit progress */ |
126 | struct iscsi_buf headbuf; /* header buffer */ | 126 | struct iscsi_buf headbuf; /* header buffer */ |
127 | struct iscsi_buf sendbuf; /* in progress buffer */ | 127 | struct iscsi_buf sendbuf; /* in progress buffer */ |
128 | int sent; | 128 | int sent; |
@@ -150,7 +150,7 @@ struct iscsi_tcp_cmd_task { | |||
150 | int pad_count; /* padded bytes */ | 150 | int pad_count; /* padded bytes */ |
151 | struct iscsi_buf headbuf; /* header buf (xmit) */ | 151 | struct iscsi_buf headbuf; /* header buf (xmit) */ |
152 | struct iscsi_buf sendbuf; /* in progress buffer*/ | 152 | struct iscsi_buf sendbuf; /* in progress buffer*/ |
153 | int xmstate; /* xmit xtate machine */ | 153 | unsigned long xmstate; /* xmit xtate machine */ |
154 | int sent; | 154 | int sent; |
155 | struct scatterlist *sg; /* per-cmd SG list */ | 155 | struct scatterlist *sg; /* per-cmd SG list */ |
156 | struct scatterlist *bad_sg; /* assert statement */ | 156 | struct scatterlist *bad_sg; /* assert statement */ |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index efceed451b46..8b57af5baaec 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -291,9 +291,6 @@ invalid_datalen: | |||
291 | min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); | 291 | min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); |
292 | } | 292 | } |
293 | 293 | ||
294 | if (sc->sc_data_direction == DMA_TO_DEVICE) | ||
295 | goto out; | ||
296 | |||
297 | if (rhdr->flags & ISCSI_FLAG_CMD_UNDERFLOW) { | 294 | if (rhdr->flags & ISCSI_FLAG_CMD_UNDERFLOW) { |
298 | int res_count = be32_to_cpu(rhdr->residual_count); | 295 | int res_count = be32_to_cpu(rhdr->residual_count); |
299 | 296 | ||
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c index abe2bda6ac37..3b09ab21d701 100644 --- a/drivers/scsi/mac_scsi.c +++ b/drivers/scsi/mac_scsi.c | |||
@@ -303,7 +303,7 @@ int macscsi_detect(struct scsi_host_template * tpnt) | |||
303 | 303 | ||
304 | if (instance->irq != SCSI_IRQ_NONE) | 304 | if (instance->irq != SCSI_IRQ_NONE) |
305 | if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW, | 305 | if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW, |
306 | "ncr5380", instance)) { | 306 | "ncr5380", instance)) { |
307 | printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n", | 307 | printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n", |
308 | instance->host_no, instance->irq); | 308 | instance->host_no, instance->irq); |
309 | instance->irq = SCSI_IRQ_NONE; | 309 | instance->irq = SCSI_IRQ_NONE; |
@@ -326,7 +326,7 @@ int macscsi_detect(struct scsi_host_template * tpnt) | |||
326 | int macscsi_release (struct Scsi_Host *shpnt) | 326 | int macscsi_release (struct Scsi_Host *shpnt) |
327 | { | 327 | { |
328 | if (shpnt->irq != SCSI_IRQ_NONE) | 328 | if (shpnt->irq != SCSI_IRQ_NONE) |
329 | free_irq (shpnt->irq, NCR5380_intr); | 329 | free_irq(shpnt->irq, shpnt); |
330 | NCR5380_exit(shpnt); | 330 | NCR5380_exit(shpnt); |
331 | 331 | ||
332 | return 0; | 332 | return 0; |
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c index ee5965659971..f2018b46f494 100644 --- a/drivers/scsi/pas16.c +++ b/drivers/scsi/pas16.c | |||
@@ -453,7 +453,8 @@ int __init pas16_detect(struct scsi_host_template * tpnt) | |||
453 | instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS); | 453 | instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS); |
454 | 454 | ||
455 | if (instance->irq != SCSI_IRQ_NONE) | 455 | if (instance->irq != SCSI_IRQ_NONE) |
456 | if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED, "pas16", instance)) { | 456 | if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED, |
457 | "pas16", instance)) { | ||
457 | printk("scsi%d : IRQ%d not free, interrupts disabled\n", | 458 | printk("scsi%d : IRQ%d not free, interrupts disabled\n", |
458 | instance->host_no, instance->irq); | 459 | instance->host_no, instance->irq); |
459 | instance->irq = SCSI_IRQ_NONE; | 460 | instance->irq = SCSI_IRQ_NONE; |
@@ -604,7 +605,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src | |||
604 | static int pas16_release(struct Scsi_Host *shost) | 605 | static int pas16_release(struct Scsi_Host *shost) |
605 | { | 606 | { |
606 | if (shost->irq) | 607 | if (shost->irq) |
607 | free_irq(shost->irq, NULL); | 608 | free_irq(shost->irq, shost); |
608 | NCR5380_exit(shost); | 609 | NCR5380_exit(shost); |
609 | if (shost->dma_channel != 0xff) | 610 | if (shost->dma_channel != 0xff) |
610 | free_dma(shost->dma_channel); | 611 | free_dma(shost->dma_channel); |
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 3aeb68bcb7ac..146d540f6281 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -1310,14 +1310,7 @@ qla1280_done(struct scsi_qla_host *ha) | |||
1310 | } | 1310 | } |
1311 | 1311 | ||
1312 | /* Release memory used for this I/O */ | 1312 | /* Release memory used for this I/O */ |
1313 | if (cmd->use_sg) { | 1313 | scsi_dma_unmap(cmd); |
1314 | pci_unmap_sg(ha->pdev, cmd->request_buffer, | ||
1315 | cmd->use_sg, cmd->sc_data_direction); | ||
1316 | } else if (cmd->request_bufflen) { | ||
1317 | pci_unmap_single(ha->pdev, sp->saved_dma_handle, | ||
1318 | cmd->request_bufflen, | ||
1319 | cmd->sc_data_direction); | ||
1320 | } | ||
1321 | 1314 | ||
1322 | /* Call the mid-level driver interrupt handler */ | 1315 | /* Call the mid-level driver interrupt handler */ |
1323 | CMD_HANDLE(sp->cmd) = (unsigned char *)INVALID_HANDLE; | 1316 | CMD_HANDLE(sp->cmd) = (unsigned char *)INVALID_HANDLE; |
@@ -1406,14 +1399,14 @@ qla1280_return_status(struct response * sts, struct scsi_cmnd *cp) | |||
1406 | break; | 1399 | break; |
1407 | 1400 | ||
1408 | case CS_DATA_UNDERRUN: | 1401 | case CS_DATA_UNDERRUN: |
1409 | if ((cp->request_bufflen - residual_length) < | 1402 | if ((scsi_bufflen(cp) - residual_length) < |
1410 | cp->underflow) { | 1403 | cp->underflow) { |
1411 | printk(KERN_WARNING | 1404 | printk(KERN_WARNING |
1412 | "scsi: Underflow detected - retrying " | 1405 | "scsi: Underflow detected - retrying " |
1413 | "command.\n"); | 1406 | "command.\n"); |
1414 | host_status = DID_ERROR; | 1407 | host_status = DID_ERROR; |
1415 | } else { | 1408 | } else { |
1416 | cp->resid = residual_length; | 1409 | scsi_set_resid(cp, residual_length); |
1417 | host_status = DID_OK; | 1410 | host_status = DID_OK; |
1418 | } | 1411 | } |
1419 | break; | 1412 | break; |
@@ -2775,33 +2768,28 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
2775 | struct device_reg __iomem *reg = ha->iobase; | 2768 | struct device_reg __iomem *reg = ha->iobase; |
2776 | struct scsi_cmnd *cmd = sp->cmd; | 2769 | struct scsi_cmnd *cmd = sp->cmd; |
2777 | cmd_a64_entry_t *pkt; | 2770 | cmd_a64_entry_t *pkt; |
2778 | struct scatterlist *sg = NULL, *s; | ||
2779 | __le32 *dword_ptr; | 2771 | __le32 *dword_ptr; |
2780 | dma_addr_t dma_handle; | 2772 | dma_addr_t dma_handle; |
2781 | int status = 0; | 2773 | int status = 0; |
2782 | int cnt; | 2774 | int cnt; |
2783 | int req_cnt; | 2775 | int req_cnt; |
2784 | u16 seg_cnt; | 2776 | int seg_cnt; |
2785 | u8 dir; | 2777 | u8 dir; |
2786 | 2778 | ||
2787 | ENTER("qla1280_64bit_start_scsi:"); | 2779 | ENTER("qla1280_64bit_start_scsi:"); |
2788 | 2780 | ||
2789 | /* Calculate number of entries and segments required. */ | 2781 | /* Calculate number of entries and segments required. */ |
2790 | req_cnt = 1; | 2782 | req_cnt = 1; |
2791 | if (cmd->use_sg) { | 2783 | seg_cnt = scsi_dma_map(cmd); |
2792 | sg = (struct scatterlist *) cmd->request_buffer; | 2784 | if (seg_cnt > 0) { |
2793 | seg_cnt = pci_map_sg(ha->pdev, sg, cmd->use_sg, | ||
2794 | cmd->sc_data_direction); | ||
2795 | |||
2796 | if (seg_cnt > 2) { | 2785 | if (seg_cnt > 2) { |
2797 | req_cnt += (seg_cnt - 2) / 5; | 2786 | req_cnt += (seg_cnt - 2) / 5; |
2798 | if ((seg_cnt - 2) % 5) | 2787 | if ((seg_cnt - 2) % 5) |
2799 | req_cnt++; | 2788 | req_cnt++; |
2800 | } | 2789 | } |
2801 | } else if (cmd->request_bufflen) { /* If data transfer. */ | 2790 | } else if (seg_cnt < 0) { |
2802 | seg_cnt = 1; | 2791 | status = 1; |
2803 | } else { | 2792 | goto out; |
2804 | seg_cnt = 0; | ||
2805 | } | 2793 | } |
2806 | 2794 | ||
2807 | if ((req_cnt + 2) >= ha->req_q_cnt) { | 2795 | if ((req_cnt + 2) >= ha->req_q_cnt) { |
@@ -2889,124 +2877,104 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
2889 | * Load data segments. | 2877 | * Load data segments. |
2890 | */ | 2878 | */ |
2891 | if (seg_cnt) { /* If data transfer. */ | 2879 | if (seg_cnt) { /* If data transfer. */ |
2880 | struct scatterlist *sg, *s; | ||
2892 | int remseg = seg_cnt; | 2881 | int remseg = seg_cnt; |
2882 | |||
2883 | sg = scsi_sglist(cmd); | ||
2884 | |||
2893 | /* Setup packet address segment pointer. */ | 2885 | /* Setup packet address segment pointer. */ |
2894 | dword_ptr = (u32 *)&pkt->dseg_0_address; | 2886 | dword_ptr = (u32 *)&pkt->dseg_0_address; |
2895 | 2887 | ||
2896 | if (cmd->use_sg) { /* If scatter gather */ | 2888 | /* Load command entry data segments. */ |
2897 | /* Load command entry data segments. */ | 2889 | for_each_sg(sg, s, seg_cnt, cnt) { |
2898 | for_each_sg(sg, s, seg_cnt, cnt) { | 2890 | if (cnt == 2) |
2899 | if (cnt == 2) | 2891 | break; |
2892 | |||
2893 | dma_handle = sg_dma_address(s); | ||
2894 | #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) | ||
2895 | if (ha->flags.use_pci_vchannel) | ||
2896 | sn_pci_set_vchan(ha->pdev, | ||
2897 | (unsigned long *)&dma_handle, | ||
2898 | SCSI_BUS_32(cmd)); | ||
2899 | #endif | ||
2900 | *dword_ptr++ = | ||
2901 | cpu_to_le32(pci_dma_lo32(dma_handle)); | ||
2902 | *dword_ptr++ = | ||
2903 | cpu_to_le32(pci_dma_hi32(dma_handle)); | ||
2904 | *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); | ||
2905 | dprintk(3, "S/G Segment phys_addr=%x %x, len=0x%x\n", | ||
2906 | cpu_to_le32(pci_dma_hi32(dma_handle)), | ||
2907 | cpu_to_le32(pci_dma_lo32(dma_handle)), | ||
2908 | cpu_to_le32(sg_dma_len(sg_next(s)))); | ||
2909 | remseg--; | ||
2910 | } | ||
2911 | dprintk(5, "qla1280_64bit_start_scsi: Scatter/gather " | ||
2912 | "command packet data - b %i, t %i, l %i \n", | ||
2913 | SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), | ||
2914 | SCSI_LUN_32(cmd)); | ||
2915 | qla1280_dump_buffer(5, (char *)pkt, | ||
2916 | REQUEST_ENTRY_SIZE); | ||
2917 | |||
2918 | /* | ||
2919 | * Build continuation packets. | ||
2920 | */ | ||
2921 | dprintk(3, "S/G Building Continuation...seg_cnt=0x%x " | ||
2922 | "remains\n", seg_cnt); | ||
2923 | |||
2924 | while (remseg > 0) { | ||
2925 | /* Update sg start */ | ||
2926 | sg = s; | ||
2927 | /* Adjust ring index. */ | ||
2928 | ha->req_ring_index++; | ||
2929 | if (ha->req_ring_index == REQUEST_ENTRY_CNT) { | ||
2930 | ha->req_ring_index = 0; | ||
2931 | ha->request_ring_ptr = | ||
2932 | ha->request_ring; | ||
2933 | } else | ||
2934 | ha->request_ring_ptr++; | ||
2935 | |||
2936 | pkt = (cmd_a64_entry_t *)ha->request_ring_ptr; | ||
2937 | |||
2938 | /* Zero out packet. */ | ||
2939 | memset(pkt, 0, REQUEST_ENTRY_SIZE); | ||
2940 | |||
2941 | /* Load packet defaults. */ | ||
2942 | ((struct cont_a64_entry *) pkt)->entry_type = | ||
2943 | CONTINUE_A64_TYPE; | ||
2944 | ((struct cont_a64_entry *) pkt)->entry_count = 1; | ||
2945 | ((struct cont_a64_entry *) pkt)->sys_define = | ||
2946 | (uint8_t)ha->req_ring_index; | ||
2947 | /* Setup packet address segment pointer. */ | ||
2948 | dword_ptr = | ||
2949 | (u32 *)&((struct cont_a64_entry *) pkt)->dseg_0_address; | ||
2950 | |||
2951 | /* Load continuation entry data segments. */ | ||
2952 | for_each_sg(sg, s, remseg, cnt) { | ||
2953 | if (cnt == 5) | ||
2900 | break; | 2954 | break; |
2901 | dma_handle = sg_dma_address(s); | 2955 | dma_handle = sg_dma_address(s); |
2902 | #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) | 2956 | #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) |
2903 | if (ha->flags.use_pci_vchannel) | 2957 | if (ha->flags.use_pci_vchannel) |
2904 | sn_pci_set_vchan(ha->pdev, | 2958 | sn_pci_set_vchan(ha->pdev, |
2905 | (unsigned long *)&dma_handle, | 2959 | (unsigned long *)&dma_handle, |
2906 | SCSI_BUS_32(cmd)); | 2960 | SCSI_BUS_32(cmd)); |
2907 | #endif | 2961 | #endif |
2908 | *dword_ptr++ = | 2962 | *dword_ptr++ = |
2909 | cpu_to_le32(pci_dma_lo32(dma_handle)); | 2963 | cpu_to_le32(pci_dma_lo32(dma_handle)); |
2910 | *dword_ptr++ = | 2964 | *dword_ptr++ = |
2911 | cpu_to_le32(pci_dma_hi32(dma_handle)); | 2965 | cpu_to_le32(pci_dma_hi32(dma_handle)); |
2912 | *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); | 2966 | *dword_ptr++ = |
2913 | dprintk(3, "S/G Segment phys_addr=%x %x, len=0x%x\n", | 2967 | cpu_to_le32(sg_dma_len(s)); |
2968 | dprintk(3, "S/G Segment Cont. phys_addr=%x %x, len=0x%x\n", | ||
2914 | cpu_to_le32(pci_dma_hi32(dma_handle)), | 2969 | cpu_to_le32(pci_dma_hi32(dma_handle)), |
2915 | cpu_to_le32(pci_dma_lo32(dma_handle)), | 2970 | cpu_to_le32(pci_dma_lo32(dma_handle)), |
2916 | cpu_to_le32(sg_dma_len(sg_next(s)))); | 2971 | cpu_to_le32(sg_dma_len(s))); |
2917 | remseg--; | ||
2918 | } | 2972 | } |
2919 | dprintk(5, "qla1280_64bit_start_scsi: Scatter/gather " | 2973 | remseg -= cnt; |
2920 | "command packet data - b %i, t %i, l %i \n", | 2974 | dprintk(5, "qla1280_64bit_start_scsi: " |
2921 | SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), | 2975 | "continuation packet data - b %i, t " |
2922 | SCSI_LUN_32(cmd)); | 2976 | "%i, l %i \n", SCSI_BUS_32(cmd), |
2923 | qla1280_dump_buffer(5, (char *)pkt, | 2977 | SCSI_TCN_32(cmd), SCSI_LUN_32(cmd)); |
2924 | REQUEST_ENTRY_SIZE); | ||
2925 | |||
2926 | /* | ||
2927 | * Build continuation packets. | ||
2928 | */ | ||
2929 | dprintk(3, "S/G Building Continuation...seg_cnt=0x%x " | ||
2930 | "remains\n", seg_cnt); | ||
2931 | |||
2932 | while (remseg > 0) { | ||
2933 | /* Update sg start */ | ||
2934 | sg = s; | ||
2935 | /* Adjust ring index. */ | ||
2936 | ha->req_ring_index++; | ||
2937 | if (ha->req_ring_index == REQUEST_ENTRY_CNT) { | ||
2938 | ha->req_ring_index = 0; | ||
2939 | ha->request_ring_ptr = | ||
2940 | ha->request_ring; | ||
2941 | } else | ||
2942 | ha->request_ring_ptr++; | ||
2943 | |||
2944 | pkt = (cmd_a64_entry_t *)ha->request_ring_ptr; | ||
2945 | |||
2946 | /* Zero out packet. */ | ||
2947 | memset(pkt, 0, REQUEST_ENTRY_SIZE); | ||
2948 | |||
2949 | /* Load packet defaults. */ | ||
2950 | ((struct cont_a64_entry *) pkt)->entry_type = | ||
2951 | CONTINUE_A64_TYPE; | ||
2952 | ((struct cont_a64_entry *) pkt)->entry_count = 1; | ||
2953 | ((struct cont_a64_entry *) pkt)->sys_define = | ||
2954 | (uint8_t)ha->req_ring_index; | ||
2955 | /* Setup packet address segment pointer. */ | ||
2956 | dword_ptr = | ||
2957 | (u32 *)&((struct cont_a64_entry *) pkt)->dseg_0_address; | ||
2958 | |||
2959 | /* Load continuation entry data segments. */ | ||
2960 | for_each_sg(sg, s, remseg, cnt) { | ||
2961 | if (cnt == 5) | ||
2962 | break; | ||
2963 | dma_handle = sg_dma_address(s); | ||
2964 | #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) | ||
2965 | if (ha->flags.use_pci_vchannel) | ||
2966 | sn_pci_set_vchan(ha->pdev, | ||
2967 | (unsigned long *)&dma_handle, | ||
2968 | SCSI_BUS_32(cmd)); | ||
2969 | #endif | ||
2970 | *dword_ptr++ = | ||
2971 | cpu_to_le32(pci_dma_lo32(dma_handle)); | ||
2972 | *dword_ptr++ = | ||
2973 | cpu_to_le32(pci_dma_hi32(dma_handle)); | ||
2974 | *dword_ptr++ = | ||
2975 | cpu_to_le32(sg_dma_len(s)); | ||
2976 | dprintk(3, "S/G Segment Cont. phys_addr=%x %x, len=0x%x\n", | ||
2977 | cpu_to_le32(pci_dma_hi32(dma_handle)), | ||
2978 | cpu_to_le32(pci_dma_lo32(dma_handle)), | ||
2979 | cpu_to_le32(sg_dma_len(s))); | ||
2980 | } | ||
2981 | remseg -= cnt; | ||
2982 | dprintk(5, "qla1280_64bit_start_scsi: " | ||
2983 | "continuation packet data - b %i, t " | ||
2984 | "%i, l %i \n", SCSI_BUS_32(cmd), | ||
2985 | SCSI_TCN_32(cmd), SCSI_LUN_32(cmd)); | ||
2986 | qla1280_dump_buffer(5, (char *)pkt, | ||
2987 | REQUEST_ENTRY_SIZE); | ||
2988 | } | ||
2989 | } else { /* No scatter gather data transfer */ | ||
2990 | dma_handle = pci_map_single(ha->pdev, | ||
2991 | cmd->request_buffer, | ||
2992 | cmd->request_bufflen, | ||
2993 | cmd->sc_data_direction); | ||
2994 | |||
2995 | sp->saved_dma_handle = dma_handle; | ||
2996 | #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) | ||
2997 | if (ha->flags.use_pci_vchannel) | ||
2998 | sn_pci_set_vchan(ha->pdev, | ||
2999 | (unsigned long *)&dma_handle, | ||
3000 | SCSI_BUS_32(cmd)); | ||
3001 | #endif | ||
3002 | *dword_ptr++ = cpu_to_le32(pci_dma_lo32(dma_handle)); | ||
3003 | *dword_ptr++ = cpu_to_le32(pci_dma_hi32(dma_handle)); | ||
3004 | *dword_ptr = cpu_to_le32(cmd->request_bufflen); | ||
3005 | |||
3006 | dprintk(5, "qla1280_64bit_start_scsi: No scatter/" | ||
3007 | "gather command packet data - b %i, t %i, " | ||
3008 | "l %i \n", SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), | ||
3009 | SCSI_LUN_32(cmd)); | ||
3010 | qla1280_dump_buffer(5, (char *)pkt, | 2978 | qla1280_dump_buffer(5, (char *)pkt, |
3011 | REQUEST_ENTRY_SIZE); | 2979 | REQUEST_ENTRY_SIZE); |
3012 | } | 2980 | } |
@@ -3068,12 +3036,11 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
3068 | struct device_reg __iomem *reg = ha->iobase; | 3036 | struct device_reg __iomem *reg = ha->iobase; |
3069 | struct scsi_cmnd *cmd = sp->cmd; | 3037 | struct scsi_cmnd *cmd = sp->cmd; |
3070 | struct cmd_entry *pkt; | 3038 | struct cmd_entry *pkt; |
3071 | struct scatterlist *sg = NULL, *s; | ||
3072 | __le32 *dword_ptr; | 3039 | __le32 *dword_ptr; |
3073 | int status = 0; | 3040 | int status = 0; |
3074 | int cnt; | 3041 | int cnt; |
3075 | int req_cnt; | 3042 | int req_cnt; |
3076 | uint16_t seg_cnt; | 3043 | int seg_cnt; |
3077 | dma_addr_t dma_handle; | 3044 | dma_addr_t dma_handle; |
3078 | u8 dir; | 3045 | u8 dir; |
3079 | 3046 | ||
@@ -3083,18 +3050,8 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
3083 | cmd->cmnd[0]); | 3050 | cmd->cmnd[0]); |
3084 | 3051 | ||
3085 | /* Calculate number of entries and segments required. */ | 3052 | /* Calculate number of entries and segments required. */ |
3086 | req_cnt = 1; | 3053 | seg_cnt = scsi_dma_map(cmd); |
3087 | if (cmd->use_sg) { | 3054 | if (seg_cnt) { |
3088 | /* | ||
3089 | * We must build an SG list in adapter format, as the kernel's | ||
3090 | * SG list cannot be used directly because of data field size | ||
3091 | * (__alpha__) differences and the kernel SG list uses virtual | ||
3092 | * addresses where we need physical addresses. | ||
3093 | */ | ||
3094 | sg = (struct scatterlist *) cmd->request_buffer; | ||
3095 | seg_cnt = pci_map_sg(ha->pdev, sg, cmd->use_sg, | ||
3096 | cmd->sc_data_direction); | ||
3097 | |||
3098 | /* | 3055 | /* |
3099 | * if greater than four sg entries then we need to allocate | 3056 | * if greater than four sg entries then we need to allocate |
3100 | * continuation entries | 3057 | * continuation entries |
@@ -3106,14 +3063,9 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
3106 | } | 3063 | } |
3107 | dprintk(3, "S/G Transfer cmd=%p seg_cnt=0x%x, req_cnt=%x\n", | 3064 | dprintk(3, "S/G Transfer cmd=%p seg_cnt=0x%x, req_cnt=%x\n", |
3108 | cmd, seg_cnt, req_cnt); | 3065 | cmd, seg_cnt, req_cnt); |
3109 | } else if (cmd->request_bufflen) { /* If data transfer. */ | 3066 | } else if (seg_cnt < 0) { |
3110 | dprintk(3, "No S/G transfer t=%x cmd=%p len=%x CDB=%x\n", | 3067 | status = 1; |
3111 | SCSI_TCN_32(cmd), cmd, cmd->request_bufflen, | 3068 | goto out; |
3112 | cmd->cmnd[0]); | ||
3113 | seg_cnt = 1; | ||
3114 | } else { | ||
3115 | /* dprintk(1, "No data transfer \n"); */ | ||
3116 | seg_cnt = 0; | ||
3117 | } | 3069 | } |
3118 | 3070 | ||
3119 | if ((req_cnt + 2) >= ha->req_q_cnt) { | 3071 | if ((req_cnt + 2) >= ha->req_q_cnt) { |
@@ -3194,91 +3146,84 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
3194 | * Load data segments. | 3146 | * Load data segments. |
3195 | */ | 3147 | */ |
3196 | if (seg_cnt) { | 3148 | if (seg_cnt) { |
3149 | struct scatterlist *sg, *s; | ||
3197 | int remseg = seg_cnt; | 3150 | int remseg = seg_cnt; |
3151 | |||
3152 | sg = scsi_sglist(cmd); | ||
3153 | |||
3198 | /* Setup packet address segment pointer. */ | 3154 | /* Setup packet address segment pointer. */ |
3199 | dword_ptr = &pkt->dseg_0_address; | 3155 | dword_ptr = &pkt->dseg_0_address; |
3200 | 3156 | ||
3201 | if (cmd->use_sg) { /* If scatter gather */ | 3157 | dprintk(3, "Building S/G data segments..\n"); |
3202 | dprintk(3, "Building S/G data segments..\n"); | 3158 | qla1280_dump_buffer(1, (char *)sg, 4 * 16); |
3203 | qla1280_dump_buffer(1, (char *)sg, 4 * 16); | 3159 | |
3160 | /* Load command entry data segments. */ | ||
3161 | for_each_sg(sg, s, seg_cnt, cnt) { | ||
3162 | if (cnt == 4) | ||
3163 | break; | ||
3164 | *dword_ptr++ = | ||
3165 | cpu_to_le32(pci_dma_lo32(sg_dma_address(s))); | ||
3166 | *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); | ||
3167 | dprintk(3, "S/G Segment phys_addr=0x%lx, len=0x%x\n", | ||
3168 | (pci_dma_lo32(sg_dma_address(s))), | ||
3169 | (sg_dma_len(s))); | ||
3170 | remseg--; | ||
3171 | } | ||
3172 | /* | ||
3173 | * Build continuation packets. | ||
3174 | */ | ||
3175 | dprintk(3, "S/G Building Continuation" | ||
3176 | "...seg_cnt=0x%x remains\n", seg_cnt); | ||
3177 | while (remseg > 0) { | ||
3178 | /* Continue from end point */ | ||
3179 | sg = s; | ||
3180 | /* Adjust ring index. */ | ||
3181 | ha->req_ring_index++; | ||
3182 | if (ha->req_ring_index == REQUEST_ENTRY_CNT) { | ||
3183 | ha->req_ring_index = 0; | ||
3184 | ha->request_ring_ptr = | ||
3185 | ha->request_ring; | ||
3186 | } else | ||
3187 | ha->request_ring_ptr++; | ||
3188 | |||
3189 | pkt = (struct cmd_entry *)ha->request_ring_ptr; | ||
3190 | |||
3191 | /* Zero out packet. */ | ||
3192 | memset(pkt, 0, REQUEST_ENTRY_SIZE); | ||
3193 | |||
3194 | /* Load packet defaults. */ | ||
3195 | ((struct cont_entry *) pkt)-> | ||
3196 | entry_type = CONTINUE_TYPE; | ||
3197 | ((struct cont_entry *) pkt)->entry_count = 1; | ||
3204 | 3198 | ||
3205 | /* Load command entry data segments. */ | 3199 | ((struct cont_entry *) pkt)->sys_define = |
3206 | for_each_sg(sg, s, seg_cnt, cnt) { | 3200 | (uint8_t) ha->req_ring_index; |
3207 | if (cnt == 4) | 3201 | |
3202 | /* Setup packet address segment pointer. */ | ||
3203 | dword_ptr = | ||
3204 | &((struct cont_entry *) pkt)->dseg_0_address; | ||
3205 | |||
3206 | /* Load continuation entry data segments. */ | ||
3207 | for_each_sg(sg, s, remseg, cnt) { | ||
3208 | if (cnt == 7) | ||
3208 | break; | 3209 | break; |
3209 | *dword_ptr++ = | 3210 | *dword_ptr++ = |
3210 | cpu_to_le32(pci_dma_lo32(sg_dma_address(s))); | 3211 | cpu_to_le32(pci_dma_lo32(sg_dma_address(s))); |
3211 | *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); | 3212 | *dword_ptr++ = |
3212 | dprintk(3, "S/G Segment phys_addr=0x%lx, len=0x%x\n", | 3213 | cpu_to_le32(sg_dma_len(s)); |
3213 | (pci_dma_lo32(sg_dma_address(s))), | 3214 | dprintk(1, |
3214 | (sg_dma_len(s))); | 3215 | "S/G Segment Cont. phys_addr=0x%x, " |
3215 | remseg--; | 3216 | "len=0x%x\n", |
3216 | } | 3217 | cpu_to_le32(pci_dma_lo32(sg_dma_address(s))), |
3217 | /* | 3218 | cpu_to_le32(sg_dma_len(s))); |
3218 | * Build continuation packets. | ||
3219 | */ | ||
3220 | dprintk(3, "S/G Building Continuation" | ||
3221 | "...seg_cnt=0x%x remains\n", seg_cnt); | ||
3222 | while (remseg > 0) { | ||
3223 | /* Continue from end point */ | ||
3224 | sg = s; | ||
3225 | /* Adjust ring index. */ | ||
3226 | ha->req_ring_index++; | ||
3227 | if (ha->req_ring_index == REQUEST_ENTRY_CNT) { | ||
3228 | ha->req_ring_index = 0; | ||
3229 | ha->request_ring_ptr = | ||
3230 | ha->request_ring; | ||
3231 | } else | ||
3232 | ha->request_ring_ptr++; | ||
3233 | |||
3234 | pkt = (struct cmd_entry *)ha->request_ring_ptr; | ||
3235 | |||
3236 | /* Zero out packet. */ | ||
3237 | memset(pkt, 0, REQUEST_ENTRY_SIZE); | ||
3238 | |||
3239 | /* Load packet defaults. */ | ||
3240 | ((struct cont_entry *) pkt)-> | ||
3241 | entry_type = CONTINUE_TYPE; | ||
3242 | ((struct cont_entry *) pkt)->entry_count = 1; | ||
3243 | |||
3244 | ((struct cont_entry *) pkt)->sys_define = | ||
3245 | (uint8_t) ha->req_ring_index; | ||
3246 | |||
3247 | /* Setup packet address segment pointer. */ | ||
3248 | dword_ptr = | ||
3249 | &((struct cont_entry *) pkt)->dseg_0_address; | ||
3250 | |||
3251 | /* Load continuation entry data segments. */ | ||
3252 | for_each_sg(sg, s, remseg, cnt) { | ||
3253 | if (cnt == 7) | ||
3254 | break; | ||
3255 | *dword_ptr++ = | ||
3256 | cpu_to_le32(pci_dma_lo32(sg_dma_address(s))); | ||
3257 | *dword_ptr++ = | ||
3258 | cpu_to_le32(sg_dma_len(s)); | ||
3259 | dprintk(1, | ||
3260 | "S/G Segment Cont. phys_addr=0x%x, " | ||
3261 | "len=0x%x\n", | ||
3262 | cpu_to_le32(pci_dma_lo32(sg_dma_address(s))), | ||
3263 | cpu_to_le32(sg_dma_len(s))); | ||
3264 | } | ||
3265 | remseg -= cnt; | ||
3266 | dprintk(5, "qla1280_32bit_start_scsi: " | ||
3267 | "continuation packet data - " | ||
3268 | "scsi(%i:%i:%i)\n", SCSI_BUS_32(cmd), | ||
3269 | SCSI_TCN_32(cmd), SCSI_LUN_32(cmd)); | ||
3270 | qla1280_dump_buffer(5, (char *)pkt, | ||
3271 | REQUEST_ENTRY_SIZE); | ||
3272 | } | 3219 | } |
3273 | } else { /* No S/G data transfer */ | 3220 | remseg -= cnt; |
3274 | dma_handle = pci_map_single(ha->pdev, | 3221 | dprintk(5, "qla1280_32bit_start_scsi: " |
3275 | cmd->request_buffer, | 3222 | "continuation packet data - " |
3276 | cmd->request_bufflen, | 3223 | "scsi(%i:%i:%i)\n", SCSI_BUS_32(cmd), |
3277 | cmd->sc_data_direction); | 3224 | SCSI_TCN_32(cmd), SCSI_LUN_32(cmd)); |
3278 | sp->saved_dma_handle = dma_handle; | 3225 | qla1280_dump_buffer(5, (char *)pkt, |
3279 | 3226 | REQUEST_ENTRY_SIZE); | |
3280 | *dword_ptr++ = cpu_to_le32(pci_dma_lo32(dma_handle)); | ||
3281 | *dword_ptr = cpu_to_le32(cmd->request_bufflen); | ||
3282 | } | 3227 | } |
3283 | } else { /* No data transfer at all */ | 3228 | } else { /* No data transfer at all */ |
3284 | dprintk(5, "qla1280_32bit_start_scsi: No data, command " | 3229 | dprintk(5, "qla1280_32bit_start_scsi: No data, command " |
@@ -4086,9 +4031,9 @@ __qla1280_print_scsi_cmd(struct scsi_cmnd *cmd) | |||
4086 | for (i = 0; i < cmd->cmd_len; i++) { | 4031 | for (i = 0; i < cmd->cmd_len; i++) { |
4087 | printk("0x%02x ", cmd->cmnd[i]); | 4032 | printk("0x%02x ", cmd->cmnd[i]); |
4088 | } | 4033 | } |
4089 | printk(" seg_cnt =%d\n", cmd->use_sg); | 4034 | printk(" seg_cnt =%d\n", scsi_sg_count(cmd)); |
4090 | printk(" request buffer=0x%p, request buffer len=0x%x\n", | 4035 | printk(" request buffer=0x%p, request buffer len=0x%x\n", |
4091 | cmd->request_buffer, cmd->request_bufflen); | 4036 | scsi_sglist(cmd), scsi_bufflen(cmd)); |
4092 | /* if (cmd->use_sg) | 4037 | /* if (cmd->use_sg) |
4093 | { | 4038 | { |
4094 | sg = (struct scatterlist *) cmd->request_buffer; | 4039 | sg = (struct scatterlist *) cmd->request_buffer; |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 192948822455..0fb1709ce5e3 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -896,11 +896,11 @@ EXPORT_SYMBOL(__scsi_iterate_devices); | |||
896 | * starget_for_each_device - helper to walk all devices of a target | 896 | * starget_for_each_device - helper to walk all devices of a target |
897 | * @starget: target whose devices we want to iterate over. | 897 | * @starget: target whose devices we want to iterate over. |
898 | * | 898 | * |
899 | * This traverses over each devices of @shost. The devices have | 899 | * This traverses over each device of @starget. The devices have |
900 | * a reference that must be released by scsi_host_put when breaking | 900 | * a reference that must be released by scsi_host_put when breaking |
901 | * out of the loop. | 901 | * out of the loop. |
902 | */ | 902 | */ |
903 | void starget_for_each_device(struct scsi_target *starget, void * data, | 903 | void starget_for_each_device(struct scsi_target *starget, void *data, |
904 | void (*fn)(struct scsi_device *, void *)) | 904 | void (*fn)(struct scsi_device *, void *)) |
905 | { | 905 | { |
906 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 906 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
@@ -915,6 +915,33 @@ void starget_for_each_device(struct scsi_target *starget, void * data, | |||
915 | EXPORT_SYMBOL(starget_for_each_device); | 915 | EXPORT_SYMBOL(starget_for_each_device); |
916 | 916 | ||
917 | /** | 917 | /** |
918 | * __starget_for_each_device - helper to walk all devices of a target | ||
919 | * (UNLOCKED) | ||
920 | * @starget: target whose devices we want to iterate over. | ||
921 | * | ||
922 | * This traverses over each device of @starget. It does _not_ | ||
923 | * take a reference on the scsi_device, so the whole loop must be | ||
924 | * protected by shost->host_lock. | ||
925 | * | ||
926 | * Note: The only reason why drivers would want to use this is because | ||
927 | * they need to access the device list in irq context. Otherwise you | ||
928 | * really want to use starget_for_each_device instead. | ||
929 | **/ | ||
930 | void __starget_for_each_device(struct scsi_target *starget, void *data, | ||
931 | void (*fn)(struct scsi_device *, void *)) | ||
932 | { | ||
933 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | ||
934 | struct scsi_device *sdev; | ||
935 | |||
936 | __shost_for_each_device(sdev, shost) { | ||
937 | if ((sdev->channel == starget->channel) && | ||
938 | (sdev->id == starget->id)) | ||
939 | fn(sdev, data); | ||
940 | } | ||
941 | } | ||
942 | EXPORT_SYMBOL(__starget_for_each_device); | ||
943 | |||
944 | /** | ||
918 | * __scsi_device_lookup_by_target - find a device given the target (UNLOCKED) | 945 | * __scsi_device_lookup_by_target - find a device given the target (UNLOCKED) |
919 | * @starget: SCSI target pointer | 946 | * @starget: SCSI target pointer |
920 | * @lun: SCSI Logical Unit Number | 947 | * @lun: SCSI Logical Unit Number |
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c index 5e46d842c6f9..e606cf0a2eb7 100644 --- a/drivers/scsi/sun3_scsi.c +++ b/drivers/scsi/sun3_scsi.c | |||
@@ -268,7 +268,7 @@ int sun3scsi_detect(struct scsi_host_template * tpnt) | |||
268 | ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; | 268 | ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; |
269 | 269 | ||
270 | if (request_irq(instance->irq, scsi_sun3_intr, | 270 | if (request_irq(instance->irq, scsi_sun3_intr, |
271 | 0, "Sun3SCSI-5380", NULL)) { | 271 | 0, "Sun3SCSI-5380", instance)) { |
272 | #ifndef REAL_DMA | 272 | #ifndef REAL_DMA |
273 | printk("scsi%d: IRQ%d not free, interrupts disabled\n", | 273 | printk("scsi%d: IRQ%d not free, interrupts disabled\n", |
274 | instance->host_no, instance->irq); | 274 | instance->host_no, instance->irq); |
@@ -310,7 +310,7 @@ int sun3scsi_detect(struct scsi_host_template * tpnt) | |||
310 | int sun3scsi_release (struct Scsi_Host *shpnt) | 310 | int sun3scsi_release (struct Scsi_Host *shpnt) |
311 | { | 311 | { |
312 | if (shpnt->irq != SCSI_IRQ_NONE) | 312 | if (shpnt->irq != SCSI_IRQ_NONE) |
313 | free_irq (shpnt->irq, NULL); | 313 | free_irq(shpnt->irq, shpnt); |
314 | 314 | ||
315 | iounmap((void *)sun3_scsi_regp); | 315 | iounmap((void *)sun3_scsi_regp); |
316 | 316 | ||
diff --git a/drivers/scsi/sun3_scsi_vme.c b/drivers/scsi/sun3_scsi_vme.c index 7cb4a31453e6..02d9727f017a 100644 --- a/drivers/scsi/sun3_scsi_vme.c +++ b/drivers/scsi/sun3_scsi_vme.c | |||
@@ -230,7 +230,7 @@ static int sun3scsi_detect(struct scsi_host_template * tpnt) | |||
230 | ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; | 230 | ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; |
231 | 231 | ||
232 | if (request_irq(instance->irq, scsi_sun3_intr, | 232 | if (request_irq(instance->irq, scsi_sun3_intr, |
233 | 0, "Sun3SCSI-5380VME", NULL)) { | 233 | 0, "Sun3SCSI-5380VME", instance)) { |
234 | #ifndef REAL_DMA | 234 | #ifndef REAL_DMA |
235 | printk("scsi%d: IRQ%d not free, interrupts disabled\n", | 235 | printk("scsi%d: IRQ%d not free, interrupts disabled\n", |
236 | instance->host_no, instance->irq); | 236 | instance->host_no, instance->irq); |
@@ -279,7 +279,7 @@ static int sun3scsi_detect(struct scsi_host_template * tpnt) | |||
279 | int sun3scsi_release (struct Scsi_Host *shpnt) | 279 | int sun3scsi_release (struct Scsi_Host *shpnt) |
280 | { | 280 | { |
281 | if (shpnt->irq != SCSI_IRQ_NONE) | 281 | if (shpnt->irq != SCSI_IRQ_NONE) |
282 | free_irq (shpnt->irq, NULL); | 282 | free_irq(shpnt->irq, shpnt); |
283 | 283 | ||
284 | iounmap((void *)sun3_scsi_regp); | 284 | iounmap((void *)sun3_scsi_regp); |
285 | 285 | ||
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index 248d60b8d899..041eaaace2c3 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c | |||
@@ -259,7 +259,8 @@ found: | |||
259 | instance->irq = NCR5380_probe_irq(instance, T128_IRQS); | 259 | instance->irq = NCR5380_probe_irq(instance, T128_IRQS); |
260 | 260 | ||
261 | if (instance->irq != SCSI_IRQ_NONE) | 261 | if (instance->irq != SCSI_IRQ_NONE) |
262 | if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128", instance)) { | 262 | if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128", |
263 | instance)) { | ||
263 | printk("scsi%d : IRQ%d not free, interrupts disabled\n", | 264 | printk("scsi%d : IRQ%d not free, interrupts disabled\n", |
264 | instance->host_no, instance->irq); | 265 | instance->host_no, instance->irq); |
265 | instance->irq = SCSI_IRQ_NONE; | 266 | instance->irq = SCSI_IRQ_NONE; |
@@ -295,7 +296,7 @@ static int t128_release(struct Scsi_Host *shost) | |||
295 | NCR5380_local_declare(); | 296 | NCR5380_local_declare(); |
296 | NCR5380_setup(shost); | 297 | NCR5380_setup(shost); |
297 | if (shost->irq) | 298 | if (shost->irq) |
298 | free_irq(shost->irq, NULL); | 299 | free_irq(shost->irq, shost); |
299 | NCR5380_exit(shost); | 300 | NCR5380_exit(shost); |
300 | if (shost->io_port && shost->n_io_port) | 301 | if (shost->io_port && shost->n_io_port) |
301 | release_region(shost->io_port, shost->n_io_port); | 302 | release_region(shost->io_port, shost->n_io_port); |
diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c index ac67394c7373..64d40a2d4d4d 100644 --- a/drivers/scsi/zorro7xx.c +++ b/drivers/scsi/zorro7xx.c | |||
@@ -13,7 +13,10 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/zorro.h> | 15 | #include <linux/zorro.h> |
16 | |||
17 | #include <asm/amigahw.h> | ||
16 | #include <asm/amigaints.h> | 18 | #include <asm/amigaints.h> |
19 | |||
17 | #include <scsi/scsi_host.h> | 20 | #include <scsi/scsi_host.h> |
18 | #include <scsi/scsi_transport_spi.h> | 21 | #include <scsi/scsi_transport_spi.h> |
19 | 22 | ||
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index ed438bc7e98d..d7e1996e2fec 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -600,7 +600,7 @@ config SERIAL_SA1100_CONSOLE | |||
600 | 600 | ||
601 | config SERIAL_BFIN | 601 | config SERIAL_BFIN |
602 | tristate "Blackfin serial port support" | 602 | tristate "Blackfin serial port support" |
603 | depends on BFIN | 603 | depends on BLACKFIN |
604 | select SERIAL_CORE | 604 | select SERIAL_CORE |
605 | select SERIAL_BFIN_UART0 if (BF531 || BF532 || BF533 || BF561) | 605 | select SERIAL_BFIN_UART0 if (BF531 || BF532 || BF533 || BF561) |
606 | help | 606 | help |
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c index f3257f708ef9..9c95bc0398ad 100644 --- a/drivers/serial/ip22zilog.c +++ b/drivers/serial/ip22zilog.c | |||
@@ -45,8 +45,6 @@ | |||
45 | 45 | ||
46 | #include "ip22zilog.h" | 46 | #include "ip22zilog.h" |
47 | 47 | ||
48 | void ip22_do_break(void); | ||
49 | |||
50 | /* | 48 | /* |
51 | * On IP22 we need to delay after register accesses but we do not need to | 49 | * On IP22 we need to delay after register accesses but we do not need to |
52 | * flush writes. | 50 | * flush writes. |
@@ -81,12 +79,9 @@ struct uart_ip22zilog_port { | |||
81 | #define IP22ZILOG_FLAG_REGS_HELD 0x00000040 | 79 | #define IP22ZILOG_FLAG_REGS_HELD 0x00000040 |
82 | #define IP22ZILOG_FLAG_TX_STOPPED 0x00000080 | 80 | #define IP22ZILOG_FLAG_TX_STOPPED 0x00000080 |
83 | #define IP22ZILOG_FLAG_TX_ACTIVE 0x00000100 | 81 | #define IP22ZILOG_FLAG_TX_ACTIVE 0x00000100 |
82 | #define IP22ZILOG_FLAG_RESET_DONE 0x00000200 | ||
84 | 83 | ||
85 | unsigned int cflag; | 84 | unsigned int tty_break; |
86 | |||
87 | /* L1-A keyboard break state. */ | ||
88 | int kbd_id; | ||
89 | int l1_down; | ||
90 | 85 | ||
91 | unsigned char parity_mask; | 86 | unsigned char parity_mask; |
92 | unsigned char prev_status; | 87 | unsigned char prev_status; |
@@ -250,13 +245,26 @@ static void ip22zilog_maybe_update_regs(struct uart_ip22zilog_port *up, | |||
250 | } | 245 | } |
251 | } | 246 | } |
252 | 247 | ||
253 | static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up, | 248 | #define Rx_BRK 0x0100 /* BREAK event software flag. */ |
254 | struct zilog_channel *channel) | 249 | #define Rx_SYS 0x0200 /* SysRq event software flag. */ |
250 | |||
251 | static struct tty_struct *ip22zilog_receive_chars(struct uart_ip22zilog_port *up, | ||
252 | struct zilog_channel *channel) | ||
255 | { | 253 | { |
256 | struct tty_struct *tty = up->port.info->tty; /* XXX info==NULL? */ | 254 | struct tty_struct *tty; |
255 | unsigned char ch, flag; | ||
256 | unsigned int r1; | ||
257 | |||
258 | tty = NULL; | ||
259 | if (up->port.info != NULL && | ||
260 | up->port.info->tty != NULL) | ||
261 | tty = up->port.info->tty; | ||
257 | 262 | ||
258 | while (1) { | 263 | for (;;) { |
259 | unsigned char ch, r1, flag; | 264 | ch = readb(&channel->control); |
265 | ZSDELAY(); | ||
266 | if (!(ch & Rx_CH_AV)) | ||
267 | break; | ||
260 | 268 | ||
261 | r1 = read_zsreg(channel, R1); | 269 | r1 = read_zsreg(channel, R1); |
262 | if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) { | 270 | if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) { |
@@ -265,43 +273,26 @@ static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up, | |||
265 | ZS_WSYNC(channel); | 273 | ZS_WSYNC(channel); |
266 | } | 274 | } |
267 | 275 | ||
268 | ch = readb(&channel->control); | ||
269 | ZSDELAY(); | ||
270 | |||
271 | /* This funny hack depends upon BRK_ABRT not interfering | ||
272 | * with the other bits we care about in R1. | ||
273 | */ | ||
274 | if (ch & BRK_ABRT) | ||
275 | r1 |= BRK_ABRT; | ||
276 | |||
277 | ch = readb(&channel->data); | 276 | ch = readb(&channel->data); |
278 | ZSDELAY(); | 277 | ZSDELAY(); |
279 | 278 | ||
280 | ch &= up->parity_mask; | 279 | ch &= up->parity_mask; |
281 | 280 | ||
282 | if (ZS_IS_CONS(up) && (r1 & BRK_ABRT)) { | 281 | /* Handle the null char got when BREAK is removed. */ |
283 | /* Wait for BREAK to deassert to avoid potentially | 282 | if (!ch) |
284 | * confusing the PROM. | 283 | r1 |= up->tty_break; |
285 | */ | ||
286 | while (1) { | ||
287 | ch = readb(&channel->control); | ||
288 | ZSDELAY(); | ||
289 | if (!(ch & BRK_ABRT)) | ||
290 | break; | ||
291 | } | ||
292 | ip22_do_break(); | ||
293 | return; | ||
294 | } | ||
295 | 284 | ||
296 | /* A real serial line, record the character and status. */ | 285 | /* A real serial line, record the character and status. */ |
297 | flag = TTY_NORMAL; | 286 | flag = TTY_NORMAL; |
298 | up->port.icount.rx++; | 287 | up->port.icount.rx++; |
299 | if (r1 & (BRK_ABRT | PAR_ERR | Rx_OVR | CRC_ERR)) { | 288 | if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR | Rx_SYS | Rx_BRK)) { |
300 | if (r1 & BRK_ABRT) { | 289 | up->tty_break = 0; |
301 | r1 &= ~(PAR_ERR | CRC_ERR); | 290 | |
291 | if (r1 & (Rx_SYS | Rx_BRK)) { | ||
302 | up->port.icount.brk++; | 292 | up->port.icount.brk++; |
303 | if (uart_handle_break(&up->port)) | 293 | if (r1 & Rx_SYS) |
304 | goto next_char; | 294 | continue; |
295 | r1 &= ~(PAR_ERR | CRC_ERR); | ||
305 | } | 296 | } |
306 | else if (r1 & PAR_ERR) | 297 | else if (r1 & PAR_ERR) |
307 | up->port.icount.parity++; | 298 | up->port.icount.parity++; |
@@ -310,30 +301,21 @@ static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up, | |||
310 | if (r1 & Rx_OVR) | 301 | if (r1 & Rx_OVR) |
311 | up->port.icount.overrun++; | 302 | up->port.icount.overrun++; |
312 | r1 &= up->port.read_status_mask; | 303 | r1 &= up->port.read_status_mask; |
313 | if (r1 & BRK_ABRT) | 304 | if (r1 & Rx_BRK) |
314 | flag = TTY_BREAK; | 305 | flag = TTY_BREAK; |
315 | else if (r1 & PAR_ERR) | 306 | else if (r1 & PAR_ERR) |
316 | flag = TTY_PARITY; | 307 | flag = TTY_PARITY; |
317 | else if (r1 & CRC_ERR) | 308 | else if (r1 & CRC_ERR) |
318 | flag = TTY_FRAME; | 309 | flag = TTY_FRAME; |
319 | } | 310 | } |
320 | if (uart_handle_sysrq_char(&up->port, ch)) | ||
321 | goto next_char; | ||
322 | 311 | ||
323 | if (up->port.ignore_status_mask == 0xff || | 312 | if (uart_handle_sysrq_char(&up->port, ch)) |
324 | (r1 & up->port.ignore_status_mask) == 0) | 313 | continue; |
325 | tty_insert_flip_char(tty, ch, flag); | ||
326 | 314 | ||
327 | if (r1 & Rx_OVR) | 315 | if (tty) |
328 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 316 | uart_insert_char(&up->port, r1, Rx_OVR, ch, flag); |
329 | next_char: | ||
330 | ch = readb(&channel->control); | ||
331 | ZSDELAY(); | ||
332 | if (!(ch & Rx_CH_AV)) | ||
333 | break; | ||
334 | } | 317 | } |
335 | 318 | return tty; | |
336 | tty_flip_buffer_push(tty); | ||
337 | } | 319 | } |
338 | 320 | ||
339 | static void ip22zilog_status_handle(struct uart_ip22zilog_port *up, | 321 | static void ip22zilog_status_handle(struct uart_ip22zilog_port *up, |
@@ -348,6 +330,15 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up, | |||
348 | ZSDELAY(); | 330 | ZSDELAY(); |
349 | ZS_WSYNC(channel); | 331 | ZS_WSYNC(channel); |
350 | 332 | ||
333 | if (up->curregs[R15] & BRKIE) { | ||
334 | if ((status & BRK_ABRT) && !(up->prev_status & BRK_ABRT)) { | ||
335 | if (uart_handle_break(&up->port)) | ||
336 | up->tty_break = Rx_SYS; | ||
337 | else | ||
338 | up->tty_break = Rx_BRK; | ||
339 | } | ||
340 | } | ||
341 | |||
351 | if (ZS_WANTS_MODEM_STATUS(up)) { | 342 | if (ZS_WANTS_MODEM_STATUS(up)) { |
352 | if (status & SYNC) | 343 | if (status & SYNC) |
353 | up->port.icount.dsr++; | 344 | up->port.icount.dsr++; |
@@ -356,10 +347,10 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up, | |||
356 | * But it does not tell us which bit has changed, we have to keep | 347 | * But it does not tell us which bit has changed, we have to keep |
357 | * track of this ourselves. | 348 | * track of this ourselves. |
358 | */ | 349 | */ |
359 | if ((status & DCD) ^ up->prev_status) | 350 | if ((status ^ up->prev_status) ^ DCD) |
360 | uart_handle_dcd_change(&up->port, | 351 | uart_handle_dcd_change(&up->port, |
361 | (status & DCD)); | 352 | (status & DCD)); |
362 | if ((status & CTS) ^ up->prev_status) | 353 | if ((status ^ up->prev_status) ^ CTS) |
363 | uart_handle_cts_change(&up->port, | 354 | uart_handle_cts_change(&up->port, |
364 | (status & CTS)); | 355 | (status & CTS)); |
365 | 356 | ||
@@ -447,19 +438,21 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id) | |||
447 | while (up) { | 438 | while (up) { |
448 | struct zilog_channel *channel | 439 | struct zilog_channel *channel |
449 | = ZILOG_CHANNEL_FROM_PORT(&up->port); | 440 | = ZILOG_CHANNEL_FROM_PORT(&up->port); |
441 | struct tty_struct *tty; | ||
450 | unsigned char r3; | 442 | unsigned char r3; |
451 | 443 | ||
452 | spin_lock(&up->port.lock); | 444 | spin_lock(&up->port.lock); |
453 | r3 = read_zsreg(channel, R3); | 445 | r3 = read_zsreg(channel, R3); |
454 | 446 | ||
455 | /* Channel A */ | 447 | /* Channel A */ |
448 | tty = NULL; | ||
456 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { | 449 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { |
457 | writeb(RES_H_IUS, &channel->control); | 450 | writeb(RES_H_IUS, &channel->control); |
458 | ZSDELAY(); | 451 | ZSDELAY(); |
459 | ZS_WSYNC(channel); | 452 | ZS_WSYNC(channel); |
460 | 453 | ||
461 | if (r3 & CHARxIP) | 454 | if (r3 & CHARxIP) |
462 | ip22zilog_receive_chars(up, channel); | 455 | tty = ip22zilog_receive_chars(up, channel); |
463 | if (r3 & CHAEXT) | 456 | if (r3 & CHAEXT) |
464 | ip22zilog_status_handle(up, channel); | 457 | ip22zilog_status_handle(up, channel); |
465 | if (r3 & CHATxIP) | 458 | if (r3 & CHATxIP) |
@@ -467,18 +460,22 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id) | |||
467 | } | 460 | } |
468 | spin_unlock(&up->port.lock); | 461 | spin_unlock(&up->port.lock); |
469 | 462 | ||
463 | if (tty) | ||
464 | tty_flip_buffer_push(tty); | ||
465 | |||
470 | /* Channel B */ | 466 | /* Channel B */ |
471 | up = up->next; | 467 | up = up->next; |
472 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | 468 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); |
473 | 469 | ||
474 | spin_lock(&up->port.lock); | 470 | spin_lock(&up->port.lock); |
471 | tty = NULL; | ||
475 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { | 472 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { |
476 | writeb(RES_H_IUS, &channel->control); | 473 | writeb(RES_H_IUS, &channel->control); |
477 | ZSDELAY(); | 474 | ZSDELAY(); |
478 | ZS_WSYNC(channel); | 475 | ZS_WSYNC(channel); |
479 | 476 | ||
480 | if (r3 & CHBRxIP) | 477 | if (r3 & CHBRxIP) |
481 | ip22zilog_receive_chars(up, channel); | 478 | tty = ip22zilog_receive_chars(up, channel); |
482 | if (r3 & CHBEXT) | 479 | if (r3 & CHBEXT) |
483 | ip22zilog_status_handle(up, channel); | 480 | ip22zilog_status_handle(up, channel); |
484 | if (r3 & CHBTxIP) | 481 | if (r3 & CHBTxIP) |
@@ -486,6 +483,9 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id) | |||
486 | } | 483 | } |
487 | spin_unlock(&up->port.lock); | 484 | spin_unlock(&up->port.lock); |
488 | 485 | ||
486 | if (tty) | ||
487 | tty_flip_buffer_push(tty); | ||
488 | |||
489 | up = up->next; | 489 | up = up->next; |
490 | } | 490 | } |
491 | 491 | ||
@@ -681,11 +681,46 @@ static void ip22zilog_break_ctl(struct uart_port *port, int break_state) | |||
681 | spin_unlock_irqrestore(&port->lock, flags); | 681 | spin_unlock_irqrestore(&port->lock, flags); |
682 | } | 682 | } |
683 | 683 | ||
684 | static void __ip22zilog_reset(struct uart_ip22zilog_port *up) | ||
685 | { | ||
686 | struct zilog_channel *channel; | ||
687 | int i; | ||
688 | |||
689 | if (up->flags & IP22ZILOG_FLAG_RESET_DONE) | ||
690 | return; | ||
691 | |||
692 | /* Let pending transmits finish. */ | ||
693 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | ||
694 | for (i = 0; i < 1000; i++) { | ||
695 | unsigned char stat = read_zsreg(channel, R1); | ||
696 | if (stat & ALL_SNT) | ||
697 | break; | ||
698 | udelay(100); | ||
699 | } | ||
700 | |||
701 | if (!ZS_IS_CHANNEL_A(up)) { | ||
702 | up++; | ||
703 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | ||
704 | } | ||
705 | write_zsreg(channel, R9, FHWRES); | ||
706 | ZSDELAY_LONG(); | ||
707 | (void) read_zsreg(channel, R0); | ||
708 | |||
709 | up->flags |= IP22ZILOG_FLAG_RESET_DONE; | ||
710 | up->next->flags |= IP22ZILOG_FLAG_RESET_DONE; | ||
711 | } | ||
712 | |||
684 | static void __ip22zilog_startup(struct uart_ip22zilog_port *up) | 713 | static void __ip22zilog_startup(struct uart_ip22zilog_port *up) |
685 | { | 714 | { |
686 | struct zilog_channel *channel; | 715 | struct zilog_channel *channel; |
687 | 716 | ||
688 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | 717 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); |
718 | |||
719 | __ip22zilog_reset(up); | ||
720 | |||
721 | __load_zsregs(channel, up->curregs); | ||
722 | /* set master interrupt enable */ | ||
723 | write_zsreg(channel, R9, up->curregs[R9]); | ||
689 | up->prev_status = readb(&channel->control); | 724 | up->prev_status = readb(&channel->control); |
690 | 725 | ||
691 | /* Enable receiver and transmitter. */ | 726 | /* Enable receiver and transmitter. */ |
@@ -859,8 +894,6 @@ ip22zilog_set_termios(struct uart_port *port, struct ktermios *termios, | |||
859 | else | 894 | else |
860 | up->flags &= ~IP22ZILOG_FLAG_MODEM_STATUS; | 895 | up->flags &= ~IP22ZILOG_FLAG_MODEM_STATUS; |
861 | 896 | ||
862 | up->cflag = termios->c_cflag; | ||
863 | |||
864 | ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port)); | 897 | ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port)); |
865 | uart_update_timeout(port, termios->c_cflag, baud); | 898 | uart_update_timeout(port, termios->c_cflag, baud); |
866 | 899 | ||
@@ -992,74 +1025,29 @@ ip22zilog_console_write(struct console *con, const char *s, unsigned int count) | |||
992 | spin_unlock_irqrestore(&up->port.lock, flags); | 1025 | spin_unlock_irqrestore(&up->port.lock, flags); |
993 | } | 1026 | } |
994 | 1027 | ||
995 | void | ||
996 | ip22serial_console_termios(struct console *con, char *options) | ||
997 | { | ||
998 | int baud = 9600, bits = 8, cflag; | ||
999 | int parity = 'n'; | ||
1000 | int flow = 'n'; | ||
1001 | |||
1002 | if (options) | ||
1003 | uart_parse_options(options, &baud, &parity, &bits, &flow); | ||
1004 | |||
1005 | cflag = CREAD | HUPCL | CLOCAL; | ||
1006 | |||
1007 | switch (baud) { | ||
1008 | case 150: cflag |= B150; break; | ||
1009 | case 300: cflag |= B300; break; | ||
1010 | case 600: cflag |= B600; break; | ||
1011 | case 1200: cflag |= B1200; break; | ||
1012 | case 2400: cflag |= B2400; break; | ||
1013 | case 4800: cflag |= B4800; break; | ||
1014 | case 9600: cflag |= B9600; break; | ||
1015 | case 19200: cflag |= B19200; break; | ||
1016 | case 38400: cflag |= B38400; break; | ||
1017 | default: baud = 9600; cflag |= B9600; break; | ||
1018 | } | ||
1019 | |||
1020 | con->cflag = cflag | CS8; /* 8N1 */ | ||
1021 | |||
1022 | uart_update_timeout(&ip22zilog_port_table[con->index].port, cflag, baud); | ||
1023 | } | ||
1024 | |||
1025 | static int __init ip22zilog_console_setup(struct console *con, char *options) | 1028 | static int __init ip22zilog_console_setup(struct console *con, char *options) |
1026 | { | 1029 | { |
1027 | struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index]; | 1030 | struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index]; |
1028 | unsigned long flags; | 1031 | unsigned long flags; |
1029 | int baud, brg; | 1032 | int baud = 9600, bits = 8; |
1030 | 1033 | int parity = 'n'; | |
1031 | printk("Console: ttyS%d (IP22-Zilog)\n", con->index); | 1034 | int flow = 'n'; |
1032 | 1035 | ||
1033 | /* Get firmware console settings. */ | 1036 | up->flags |= IP22ZILOG_FLAG_IS_CONS; |
1034 | ip22serial_console_termios(con, options); | ||
1035 | 1037 | ||
1036 | /* Firmware console speed is limited to 150-->38400 baud so | 1038 | printk(KERN_INFO "Console: ttyS%d (IP22-Zilog)\n", con->index); |
1037 | * this hackish cflag thing is OK. | ||
1038 | */ | ||
1039 | switch (con->cflag & CBAUD) { | ||
1040 | case B150: baud = 150; break; | ||
1041 | case B300: baud = 300; break; | ||
1042 | case B600: baud = 600; break; | ||
1043 | case B1200: baud = 1200; break; | ||
1044 | case B2400: baud = 2400; break; | ||
1045 | case B4800: baud = 4800; break; | ||
1046 | default: case B9600: baud = 9600; break; | ||
1047 | case B19200: baud = 19200; break; | ||
1048 | case B38400: baud = 38400; break; | ||
1049 | }; | ||
1050 | |||
1051 | brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR); | ||
1052 | 1039 | ||
1053 | spin_lock_irqsave(&up->port.lock, flags); | 1040 | spin_lock_irqsave(&up->port.lock, flags); |
1054 | 1041 | ||
1055 | up->curregs[R15] = BRKIE; | 1042 | up->curregs[R15] |= BRKIE; |
1056 | ip22zilog_convert_to_zs(up, con->cflag, 0, brg); | ||
1057 | 1043 | ||
1058 | __ip22zilog_startup(up); | 1044 | __ip22zilog_startup(up); |
1059 | 1045 | ||
1060 | spin_unlock_irqrestore(&up->port.lock, flags); | 1046 | spin_unlock_irqrestore(&up->port.lock, flags); |
1061 | 1047 | ||
1062 | return 0; | 1048 | if (options) |
1049 | uart_parse_options(options, &baud, &parity, &bits, &flow); | ||
1050 | return uart_set_options(&up->port, con, baud, parity, bits, flow); | ||
1063 | } | 1051 | } |
1064 | 1052 | ||
1065 | static struct uart_driver ip22zilog_reg; | 1053 | static struct uart_driver ip22zilog_reg; |
@@ -1140,25 +1128,10 @@ static void __init ip22zilog_prepare(void) | |||
1140 | up[(chip * 2) + 1].port.line = (chip * 2) + 1; | 1128 | up[(chip * 2) + 1].port.line = (chip * 2) + 1; |
1141 | up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A; | 1129 | up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A; |
1142 | } | 1130 | } |
1143 | } | ||
1144 | |||
1145 | static void __init ip22zilog_init_hw(void) | ||
1146 | { | ||
1147 | int i; | ||
1148 | |||
1149 | for (i = 0; i < NUM_CHANNELS; i++) { | ||
1150 | struct uart_ip22zilog_port *up = &ip22zilog_port_table[i]; | ||
1151 | struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | ||
1152 | unsigned long flags; | ||
1153 | int baud, brg; | ||
1154 | 1131 | ||
1155 | spin_lock_irqsave(&up->port.lock, flags); | 1132 | for (channel = 0; channel < NUM_CHANNELS; channel++) { |
1156 | 1133 | struct uart_ip22zilog_port *up = &ip22zilog_port_table[channel]; | |
1157 | if (ZS_IS_CHANNEL_A(up)) { | 1134 | int brg; |
1158 | write_zsreg(channel, R9, FHWRES); | ||
1159 | ZSDELAY_LONG(); | ||
1160 | (void) read_zsreg(channel, R0); | ||
1161 | } | ||
1162 | 1135 | ||
1163 | /* Normal serial TTY. */ | 1136 | /* Normal serial TTY. */ |
1164 | up->parity_mask = 0xff; | 1137 | up->parity_mask = 0xff; |
@@ -1169,16 +1142,10 @@ static void __init ip22zilog_init_hw(void) | |||
1169 | up->curregs[R9] = NV | MIE; | 1142 | up->curregs[R9] = NV | MIE; |
1170 | up->curregs[R10] = NRZ; | 1143 | up->curregs[R10] = NRZ; |
1171 | up->curregs[R11] = TCBR | RCBR; | 1144 | up->curregs[R11] = TCBR | RCBR; |
1172 | baud = 9600; | 1145 | brg = BPS_TO_BRG(9600, ZS_CLOCK / ZS_CLOCK_DIVISOR); |
1173 | brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR); | ||
1174 | up->curregs[R12] = (brg & 0xff); | 1146 | up->curregs[R12] = (brg & 0xff); |
1175 | up->curregs[R13] = (brg >> 8) & 0xff; | 1147 | up->curregs[R13] = (brg >> 8) & 0xff; |
1176 | up->curregs[R14] = BRENAB; | 1148 | up->curregs[R14] = BRENAB; |
1177 | __load_zsregs(channel, up->curregs); | ||
1178 | /* set master interrupt enable */ | ||
1179 | write_zsreg(channel, R9, up->curregs[R9]); | ||
1180 | |||
1181 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
1182 | } | 1149 | } |
1183 | } | 1150 | } |
1184 | 1151 | ||
@@ -1195,8 +1162,6 @@ static int __init ip22zilog_ports_init(void) | |||
1195 | panic("IP22-Zilog: Unable to register zs interrupt handler.\n"); | 1162 | panic("IP22-Zilog: Unable to register zs interrupt handler.\n"); |
1196 | } | 1163 | } |
1197 | 1164 | ||
1198 | ip22zilog_init_hw(); | ||
1199 | |||
1200 | ret = uart_register_driver(&ip22zilog_reg); | 1165 | ret = uart_register_driver(&ip22zilog_reg); |
1201 | if (ret == 0) { | 1166 | if (ret == 0) { |
1202 | int i; | 1167 | int i; |
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index af3a011b2b24..352fcb8926a6 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
@@ -585,11 +585,11 @@ serial_pxa_type(struct uart_port *port) | |||
585 | return up->name; | 585 | return up->name; |
586 | } | 586 | } |
587 | 587 | ||
588 | #ifdef CONFIG_SERIAL_PXA_CONSOLE | ||
589 | |||
590 | static struct uart_pxa_port *serial_pxa_ports[4]; | 588 | static struct uart_pxa_port *serial_pxa_ports[4]; |
591 | static struct uart_driver serial_pxa_reg; | 589 | static struct uart_driver serial_pxa_reg; |
592 | 590 | ||
591 | #ifdef CONFIG_SERIAL_PXA_CONSOLE | ||
592 | |||
593 | #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) | 593 | #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) |
594 | 594 | ||
595 | /* | 595 | /* |
diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c index 70a09a3d5af0..707c5b03bce9 100644 --- a/drivers/serial/suncore.c +++ b/drivers/serial/suncore.c | |||
@@ -23,11 +23,36 @@ | |||
23 | 23 | ||
24 | #include "suncore.h" | 24 | #include "suncore.h" |
25 | 25 | ||
26 | int sunserial_current_minor = 64; | 26 | static int sunserial_current_minor = 64; |
27 | 27 | ||
28 | EXPORT_SYMBOL(sunserial_current_minor); | 28 | int sunserial_register_minors(struct uart_driver *drv, int count) |
29 | { | ||
30 | int err = 0; | ||
31 | |||
32 | drv->minor = sunserial_current_minor; | ||
33 | drv->nr += count; | ||
34 | /* Register the driver on the first call */ | ||
35 | if (drv->nr == count) | ||
36 | err = uart_register_driver(drv); | ||
37 | if (err == 0) { | ||
38 | sunserial_current_minor += count; | ||
39 | drv->tty_driver->name_base = drv->minor - 64; | ||
40 | } | ||
41 | return err; | ||
42 | } | ||
43 | EXPORT_SYMBOL(sunserial_register_minors); | ||
44 | |||
45 | void sunserial_unregister_minors(struct uart_driver *drv, int count) | ||
46 | { | ||
47 | drv->nr -= count; | ||
48 | sunserial_current_minor -= count; | ||
49 | |||
50 | if (drv->nr == 0) | ||
51 | uart_unregister_driver(drv); | ||
52 | } | ||
53 | EXPORT_SYMBOL(sunserial_unregister_minors); | ||
29 | 54 | ||
30 | int sunserial_console_match(struct console *con, struct device_node *dp, | 55 | int __init sunserial_console_match(struct console *con, struct device_node *dp, |
31 | struct uart_driver *drv, int line) | 56 | struct uart_driver *drv, int line) |
32 | { | 57 | { |
33 | int off; | 58 | int off; |
@@ -133,8 +158,6 @@ sunserial_console_termios(struct console *con) | |||
133 | con->cflag = cflag; | 158 | con->cflag = cflag; |
134 | } | 159 | } |
135 | 160 | ||
136 | EXPORT_SYMBOL(sunserial_console_termios); | ||
137 | |||
138 | /* Sun serial MOUSE auto baud rate detection. */ | 161 | /* Sun serial MOUSE auto baud rate detection. */ |
139 | static struct mouse_baud_cflag { | 162 | static struct mouse_baud_cflag { |
140 | int baud; | 163 | int baud; |
diff --git a/drivers/serial/suncore.h b/drivers/serial/suncore.h index 829d7d65d6db..042668aa602e 100644 --- a/drivers/serial/suncore.h +++ b/drivers/serial/suncore.h | |||
@@ -22,7 +22,8 @@ | |||
22 | extern unsigned int suncore_mouse_baud_cflag_next(unsigned int, int *); | 22 | extern unsigned int suncore_mouse_baud_cflag_next(unsigned int, int *); |
23 | extern int suncore_mouse_baud_detection(unsigned char, int); | 23 | extern int suncore_mouse_baud_detection(unsigned char, int); |
24 | 24 | ||
25 | extern int sunserial_current_minor; | 25 | extern int sunserial_register_minors(struct uart_driver *, int); |
26 | extern void sunserial_unregister_minors(struct uart_driver *, int); | ||
26 | 27 | ||
27 | extern int sunserial_console_match(struct console *, struct device_node *, | 28 | extern int sunserial_console_match(struct console *, struct device_node *, |
28 | struct uart_driver *, int); | 29 | struct uart_driver *, int); |
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c index 8ff900b09811..be0fe152891b 100644 --- a/drivers/serial/sunhv.c +++ b/drivers/serial/sunhv.c | |||
@@ -562,16 +562,10 @@ static int __devinit hv_probe(struct of_device *op, const struct of_device_id *m | |||
562 | 562 | ||
563 | port->dev = &op->dev; | 563 | port->dev = &op->dev; |
564 | 564 | ||
565 | sunhv_reg.minor = sunserial_current_minor; | 565 | err = sunserial_register_minors(&sunhv_reg, 1); |
566 | sunhv_reg.nr = 1; | ||
567 | |||
568 | err = uart_register_driver(&sunhv_reg); | ||
569 | if (err) | 566 | if (err) |
570 | goto out_free_con_read_page; | 567 | goto out_free_con_read_page; |
571 | 568 | ||
572 | sunhv_reg.tty_driver->name_base = sunhv_reg.minor - 64; | ||
573 | sunserial_current_minor += 1; | ||
574 | |||
575 | sunserial_console_match(&sunhv_console, op->node, | 569 | sunserial_console_match(&sunhv_console, op->node, |
576 | &sunhv_reg, port->line); | 570 | &sunhv_reg, port->line); |
577 | 571 | ||
@@ -591,8 +585,7 @@ out_remove_port: | |||
591 | uart_remove_one_port(&sunhv_reg, port); | 585 | uart_remove_one_port(&sunhv_reg, port); |
592 | 586 | ||
593 | out_unregister_driver: | 587 | out_unregister_driver: |
594 | sunserial_current_minor -= 1; | 588 | sunserial_unregister_minors(&sunhv_reg, 1); |
595 | uart_unregister_driver(&sunhv_reg); | ||
596 | 589 | ||
597 | out_free_con_read_page: | 590 | out_free_con_read_page: |
598 | kfree(con_read_page); | 591 | kfree(con_read_page); |
@@ -614,8 +607,7 @@ static int __devexit hv_remove(struct of_device *dev) | |||
614 | 607 | ||
615 | uart_remove_one_port(&sunhv_reg, port); | 608 | uart_remove_one_port(&sunhv_reg, port); |
616 | 609 | ||
617 | sunserial_current_minor -= 1; | 610 | sunserial_unregister_minors(&sunhv_reg, 1); |
618 | uart_unregister_driver(&sunhv_reg); | ||
619 | 611 | ||
620 | kfree(port); | 612 | kfree(port); |
621 | sunhv_port = NULL; | 613 | sunhv_port = NULL; |
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index ff610c23314b..543f93741e6f 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
@@ -832,7 +832,6 @@ static struct uart_driver sunsab_reg = { | |||
832 | }; | 832 | }; |
833 | 833 | ||
834 | static struct uart_sunsab_port *sunsab_ports; | 834 | static struct uart_sunsab_port *sunsab_ports; |
835 | static int num_channels; | ||
836 | 835 | ||
837 | #ifdef CONFIG_SERIAL_SUNSAB_CONSOLE | 836 | #ifdef CONFIG_SERIAL_SUNSAB_CONSOLE |
838 | 837 | ||
@@ -1102,8 +1101,8 @@ static int __init sunsab_init(void) | |||
1102 | { | 1101 | { |
1103 | struct device_node *dp; | 1102 | struct device_node *dp; |
1104 | int err; | 1103 | int err; |
1104 | int num_channels = 0; | ||
1105 | 1105 | ||
1106 | num_channels = 0; | ||
1107 | for_each_node_by_name(dp, "se") | 1106 | for_each_node_by_name(dp, "se") |
1108 | num_channels += 2; | 1107 | num_channels += 2; |
1109 | for_each_node_by_name(dp, "serial") { | 1108 | for_each_node_by_name(dp, "serial") { |
@@ -1117,20 +1116,14 @@ static int __init sunsab_init(void) | |||
1117 | if (!sunsab_ports) | 1116 | if (!sunsab_ports) |
1118 | return -ENOMEM; | 1117 | return -ENOMEM; |
1119 | 1118 | ||
1120 | sunsab_reg.minor = sunserial_current_minor; | ||
1121 | sunsab_reg.nr = num_channels; | ||
1122 | sunsab_reg.cons = SUNSAB_CONSOLE(); | 1119 | sunsab_reg.cons = SUNSAB_CONSOLE(); |
1123 | 1120 | err = sunserial_register_minors(&sunsab_reg, num_channels); | |
1124 | err = uart_register_driver(&sunsab_reg); | ||
1125 | if (err) { | 1121 | if (err) { |
1126 | kfree(sunsab_ports); | 1122 | kfree(sunsab_ports); |
1127 | sunsab_ports = NULL; | 1123 | sunsab_ports = NULL; |
1128 | 1124 | ||
1129 | return err; | 1125 | return err; |
1130 | } | 1126 | } |
1131 | |||
1132 | sunsab_reg.tty_driver->name_base = sunsab_reg.minor - 64; | ||
1133 | sunserial_current_minor += num_channels; | ||
1134 | } | 1127 | } |
1135 | 1128 | ||
1136 | return of_register_driver(&sab_driver, &of_bus_type); | 1129 | return of_register_driver(&sab_driver, &of_bus_type); |
@@ -1139,9 +1132,8 @@ static int __init sunsab_init(void) | |||
1139 | static void __exit sunsab_exit(void) | 1132 | static void __exit sunsab_exit(void) |
1140 | { | 1133 | { |
1141 | of_unregister_driver(&sab_driver); | 1134 | of_unregister_driver(&sab_driver); |
1142 | if (num_channels) { | 1135 | if (sunsab_reg.nr) { |
1143 | sunserial_current_minor -= num_channels; | 1136 | sunserial_unregister_minors(&sunsab_reg, sunsab_reg.nr); |
1144 | uart_unregister_driver(&sunsab_reg); | ||
1145 | } | 1137 | } |
1146 | 1138 | ||
1147 | kfree(sunsab_ports); | 1139 | kfree(sunsab_ports); |
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index e074943feff5..4e2302d43ab1 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -1528,14 +1528,12 @@ static struct of_platform_driver su_driver = { | |||
1528 | .remove = __devexit_p(su_remove), | 1528 | .remove = __devexit_p(su_remove), |
1529 | }; | 1529 | }; |
1530 | 1530 | ||
1531 | static int num_uart; | ||
1532 | |||
1533 | static int __init sunsu_init(void) | 1531 | static int __init sunsu_init(void) |
1534 | { | 1532 | { |
1535 | struct device_node *dp; | 1533 | struct device_node *dp; |
1536 | int err; | 1534 | int err; |
1535 | int num_uart = 0; | ||
1537 | 1536 | ||
1538 | num_uart = 0; | ||
1539 | for_each_node_by_name(dp, "su") { | 1537 | for_each_node_by_name(dp, "su") { |
1540 | if (su_get_type(dp) == SU_PORT_PORT) | 1538 | if (su_get_type(dp) == SU_PORT_PORT) |
1541 | num_uart++; | 1539 | num_uart++; |
@@ -1552,26 +1550,22 @@ static int __init sunsu_init(void) | |||
1552 | } | 1550 | } |
1553 | 1551 | ||
1554 | if (num_uart) { | 1552 | if (num_uart) { |
1555 | sunsu_reg.minor = sunserial_current_minor; | 1553 | err = sunserial_register_minors(&sunsu_reg, num_uart); |
1556 | sunsu_reg.nr = num_uart; | ||
1557 | err = uart_register_driver(&sunsu_reg); | ||
1558 | if (err) | 1554 | if (err) |
1559 | return err; | 1555 | return err; |
1560 | sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64; | ||
1561 | sunserial_current_minor += num_uart; | ||
1562 | } | 1556 | } |
1563 | 1557 | ||
1564 | err = of_register_driver(&su_driver, &of_bus_type); | 1558 | err = of_register_driver(&su_driver, &of_bus_type); |
1565 | if (err && num_uart) | 1559 | if (err && num_uart) |
1566 | uart_unregister_driver(&sunsu_reg); | 1560 | sunserial_unregister_minors(&sunsu_reg, num_uart); |
1567 | 1561 | ||
1568 | return err; | 1562 | return err; |
1569 | } | 1563 | } |
1570 | 1564 | ||
1571 | static void __exit sunsu_exit(void) | 1565 | static void __exit sunsu_exit(void) |
1572 | { | 1566 | { |
1573 | if (num_uart) | 1567 | if (sunsu_reg.nr) |
1574 | uart_unregister_driver(&sunsu_reg); | 1568 | sunserial_unregister_minors(&sunsu_reg, sunsu_reg.nr); |
1575 | } | 1569 | } |
1576 | 1570 | ||
1577 | module_init(sunsu_init); | 1571 | module_init(sunsu_init); |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 283bef0d24cb..cb2e40506379 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
@@ -63,10 +63,6 @@ | |||
63 | readb(&((__channel)->control)) | 63 | readb(&((__channel)->control)) |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | static int num_sunzilog; | ||
67 | #define NUM_SUNZILOG num_sunzilog | ||
68 | #define NUM_CHANNELS (NUM_SUNZILOG * 2) | ||
69 | |||
70 | #define ZS_CLOCK 4915200 /* Zilog input clock rate. */ | 66 | #define ZS_CLOCK 4915200 /* Zilog input clock rate. */ |
71 | #define ZS_CLOCK_DIVISOR 16 /* Divisor this driver uses. */ | 67 | #define ZS_CLOCK_DIVISOR 16 /* Divisor this driver uses. */ |
72 | 68 | ||
@@ -1031,18 +1027,19 @@ static struct uart_driver sunzilog_reg = { | |||
1031 | .major = TTY_MAJOR, | 1027 | .major = TTY_MAJOR, |
1032 | }; | 1028 | }; |
1033 | 1029 | ||
1034 | static int __init sunzilog_alloc_tables(void) | 1030 | static int __init sunzilog_alloc_tables(int num_sunzilog) |
1035 | { | 1031 | { |
1036 | struct uart_sunzilog_port *up; | 1032 | struct uart_sunzilog_port *up; |
1037 | unsigned long size; | 1033 | unsigned long size; |
1034 | int num_channels = num_sunzilog * 2; | ||
1038 | int i; | 1035 | int i; |
1039 | 1036 | ||
1040 | size = NUM_CHANNELS * sizeof(struct uart_sunzilog_port); | 1037 | size = num_channels * sizeof(struct uart_sunzilog_port); |
1041 | sunzilog_port_table = kzalloc(size, GFP_KERNEL); | 1038 | sunzilog_port_table = kzalloc(size, GFP_KERNEL); |
1042 | if (!sunzilog_port_table) | 1039 | if (!sunzilog_port_table) |
1043 | return -ENOMEM; | 1040 | return -ENOMEM; |
1044 | 1041 | ||
1045 | for (i = 0; i < NUM_CHANNELS; i++) { | 1042 | for (i = 0; i < num_channels; i++) { |
1046 | up = &sunzilog_port_table[i]; | 1043 | up = &sunzilog_port_table[i]; |
1047 | 1044 | ||
1048 | spin_lock_init(&up->port.lock); | 1045 | spin_lock_init(&up->port.lock); |
@@ -1050,13 +1047,13 @@ static int __init sunzilog_alloc_tables(void) | |||
1050 | if (i == 0) | 1047 | if (i == 0) |
1051 | sunzilog_irq_chain = up; | 1048 | sunzilog_irq_chain = up; |
1052 | 1049 | ||
1053 | if (i < NUM_CHANNELS - 1) | 1050 | if (i < num_channels - 1) |
1054 | up->next = up + 1; | 1051 | up->next = up + 1; |
1055 | else | 1052 | else |
1056 | up->next = NULL; | 1053 | up->next = NULL; |
1057 | } | 1054 | } |
1058 | 1055 | ||
1059 | size = NUM_SUNZILOG * sizeof(struct zilog_layout __iomem *); | 1056 | size = num_sunzilog * sizeof(struct zilog_layout __iomem *); |
1060 | sunzilog_chip_regs = kzalloc(size, GFP_KERNEL); | 1057 | sunzilog_chip_regs = kzalloc(size, GFP_KERNEL); |
1061 | if (!sunzilog_chip_regs) { | 1058 | if (!sunzilog_chip_regs) { |
1062 | kfree(sunzilog_port_table); | 1059 | kfree(sunzilog_port_table); |
@@ -1496,34 +1493,28 @@ static int __init sunzilog_init(void) | |||
1496 | struct device_node *dp; | 1493 | struct device_node *dp; |
1497 | int err, uart_count; | 1494 | int err, uart_count; |
1498 | int num_keybms; | 1495 | int num_keybms; |
1496 | int num_sunzilog = 0; | ||
1499 | 1497 | ||
1500 | NUM_SUNZILOG = 0; | ||
1501 | num_keybms = 0; | 1498 | num_keybms = 0; |
1502 | for_each_node_by_name(dp, "zs") { | 1499 | for_each_node_by_name(dp, "zs") { |
1503 | NUM_SUNZILOG++; | 1500 | num_sunzilog++; |
1504 | if (of_find_property(dp, "keyboard", NULL)) | 1501 | if (of_find_property(dp, "keyboard", NULL)) |
1505 | num_keybms++; | 1502 | num_keybms++; |
1506 | } | 1503 | } |
1507 | 1504 | ||
1508 | uart_count = 0; | 1505 | uart_count = 0; |
1509 | if (NUM_SUNZILOG) { | 1506 | if (num_sunzilog) { |
1510 | int uart_count; | 1507 | int uart_count; |
1511 | 1508 | ||
1512 | err = sunzilog_alloc_tables(); | 1509 | err = sunzilog_alloc_tables(num_sunzilog); |
1513 | if (err) | 1510 | if (err) |
1514 | goto out; | 1511 | goto out; |
1515 | 1512 | ||
1516 | uart_count = (NUM_SUNZILOG * 2) - (2 * num_keybms); | 1513 | uart_count = (num_sunzilog * 2) - (2 * num_keybms); |
1517 | 1514 | ||
1518 | sunzilog_reg.nr = uart_count; | 1515 | err = sunserial_register_minors(&sunzilog_reg, uart_count); |
1519 | sunzilog_reg.minor = sunserial_current_minor; | ||
1520 | err = uart_register_driver(&sunzilog_reg); | ||
1521 | if (err) | 1516 | if (err) |
1522 | goto out_free_tables; | 1517 | goto out_free_tables; |
1523 | |||
1524 | sunzilog_reg.tty_driver->name_base = sunzilog_reg.minor - 64; | ||
1525 | |||
1526 | sunserial_current_minor += uart_count; | ||
1527 | } | 1518 | } |
1528 | 1519 | ||
1529 | err = of_register_driver(&zs_driver, &of_bus_type); | 1520 | err = of_register_driver(&zs_driver, &of_bus_type); |
@@ -1557,8 +1548,8 @@ out_unregister_driver: | |||
1557 | of_unregister_driver(&zs_driver); | 1548 | of_unregister_driver(&zs_driver); |
1558 | 1549 | ||
1559 | out_unregister_uart: | 1550 | out_unregister_uart: |
1560 | if (NUM_SUNZILOG) { | 1551 | if (num_sunzilog) { |
1561 | uart_unregister_driver(&sunzilog_reg); | 1552 | sunserial_unregister_minors(&sunzilog_reg, num_sunzilog); |
1562 | sunzilog_reg.cons = NULL; | 1553 | sunzilog_reg.cons = NULL; |
1563 | } | 1554 | } |
1564 | 1555 | ||
@@ -1590,8 +1581,8 @@ static void __exit sunzilog_exit(void) | |||
1590 | zilog_irq = -1; | 1581 | zilog_irq = -1; |
1591 | } | 1582 | } |
1592 | 1583 | ||
1593 | if (NUM_SUNZILOG) { | 1584 | if (sunzilog_reg.nr) { |
1594 | uart_unregister_driver(&sunzilog_reg); | 1585 | sunserial_unregister_minors(&sunzilog_reg, sunzilog_reg.nr); |
1595 | sunzilog_free_tables(); | 1586 | sunzilog_free_tables(); |
1596 | } | 1587 | } |
1597 | } | 1588 | } |
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c index a85f2d31a686..3f593247c41e 100644 --- a/drivers/serial/uartlite.c +++ b/drivers/serial/uartlite.c | |||
@@ -393,6 +393,7 @@ static inline void __init ulite_console_of_find_device(int id) | |||
393 | continue; | 393 | continue; |
394 | 394 | ||
395 | ulite_ports[id].mapbase = res.start; | 395 | ulite_ports[id].mapbase = res.start; |
396 | of_node_put(np); | ||
396 | return; | 397 | return; |
397 | } | 398 | } |
398 | } | 399 | } |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index a77ede598d34..abf05048c638 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -61,7 +61,7 @@ config SPI_ATMEL | |||
61 | 61 | ||
62 | config SPI_BFIN | 62 | config SPI_BFIN |
63 | tristate "SPI controller driver for ADI Blackfin5xx" | 63 | tristate "SPI controller driver for ADI Blackfin5xx" |
64 | depends on SPI_MASTER && BFIN | 64 | depends on SPI_MASTER && BLACKFIN |
65 | help | 65 | help |
66 | This is the SPI controller master driver for Blackfin 5xx processor. | 66 | This is the SPI controller master driver for Blackfin 5xx processor. |
67 | 67 | ||
diff --git a/drivers/spi/at25.c b/drivers/spi/at25.c index e007833cca59..290dbe99647a 100644 --- a/drivers/spi/at25.c +++ b/drivers/spi/at25.c | |||
@@ -21,6 +21,13 @@ | |||
21 | #include <linux/spi/eeprom.h> | 21 | #include <linux/spi/eeprom.h> |
22 | 22 | ||
23 | 23 | ||
24 | /* | ||
25 | * NOTE: this is an *EEPROM* driver. The vagaries of product naming | ||
26 | * mean that some AT25 products are EEPROMs, and others are FLASH. | ||
27 | * Handle FLASH chips with the drivers/mtd/devices/m25p80.c driver, | ||
28 | * not this one! | ||
29 | */ | ||
30 | |||
24 | struct at25_data { | 31 | struct at25_data { |
25 | struct spi_device *spi; | 32 | struct spi_device *spi; |
26 | struct mutex lock; | 33 | struct mutex lock; |
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 0d342dcdd302..ff10808183a3 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
@@ -195,8 +195,8 @@ static void atmel_spi_next_xfer(struct spi_master *master, | |||
195 | xfer, xfer->len, xfer->tx_buf, xfer->tx_dma, | 195 | xfer, xfer->len, xfer->tx_buf, xfer->tx_dma, |
196 | xfer->rx_buf, xfer->rx_dma, spi_readl(as, IMR)); | 196 | xfer->rx_buf, xfer->rx_dma, spi_readl(as, IMR)); |
197 | 197 | ||
198 | spi_writel(as, TCR, len); | ||
199 | spi_writel(as, RCR, len); | 198 | spi_writel(as, RCR, len); |
199 | spi_writel(as, TCR, len); | ||
200 | spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN)); | 200 | spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN)); |
201 | } | 201 | } |
202 | 202 | ||
@@ -497,7 +497,7 @@ static int atmel_spi_setup(struct spi_device *spi) | |||
497 | /* chipselect must have been muxed as GPIO (e.g. in board setup) */ | 497 | /* chipselect must have been muxed as GPIO (e.g. in board setup) */ |
498 | npcs_pin = (unsigned int)spi->controller_data; | 498 | npcs_pin = (unsigned int)spi->controller_data; |
499 | if (!spi->controller_state) { | 499 | if (!spi->controller_state) { |
500 | ret = gpio_request(npcs_pin, "spi_npcs"); | 500 | ret = gpio_request(npcs_pin, spi->dev.bus_id); |
501 | if (ret) | 501 | if (ret) |
502 | return ret; | 502 | return ret; |
503 | spi->controller_state = (void *)npcs_pin; | 503 | spi->controller_state = (void *)npcs_pin; |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 5f3d808cbc29..1c2ab541d37d 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <asm/arch/pxa2xx_spi.h> | 39 | #include <asm/arch/pxa2xx_spi.h> |
40 | 40 | ||
41 | MODULE_AUTHOR("Stephen Street"); | 41 | MODULE_AUTHOR("Stephen Street"); |
42 | MODULE_DESCRIPTION("PXA2xx SSP SPI Contoller"); | 42 | MODULE_DESCRIPTION("PXA2xx SSP SPI Controller"); |
43 | MODULE_LICENSE("GPL"); | 43 | MODULE_LICENSE("GPL"); |
44 | 44 | ||
45 | #define MAX_BUSES 3 | 45 | #define MAX_BUSES 3 |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index b31f4431849b..93e9de46977a 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -541,10 +541,7 @@ static void spi_complete(void *arg) | |||
541 | * Also, the caller is guaranteeing that the memory associated with the | 541 | * Also, the caller is guaranteeing that the memory associated with the |
542 | * message will not be freed before this call returns. | 542 | * message will not be freed before this call returns. |
543 | * | 543 | * |
544 | * The return value is a negative error code if the message could not be | 544 | * It returns zero on success, else a negative error code. |
545 | * submitted, else zero. When the value is zero, then message->status is | ||
546 | * also defined; it's the completion code for the transfer, either zero | ||
547 | * or a negative error code from the controller driver. | ||
548 | */ | 545 | */ |
549 | int spi_sync(struct spi_device *spi, struct spi_message *message) | 546 | int spi_sync(struct spi_device *spi, struct spi_message *message) |
550 | { | 547 | { |
@@ -554,8 +551,10 @@ int spi_sync(struct spi_device *spi, struct spi_message *message) | |||
554 | message->complete = spi_complete; | 551 | message->complete = spi_complete; |
555 | message->context = &done; | 552 | message->context = &done; |
556 | status = spi_async(spi, message); | 553 | status = spi_async(spi, message); |
557 | if (status == 0) | 554 | if (status == 0) { |
558 | wait_for_completion(&done); | 555 | wait_for_completion(&done); |
556 | status = message->status; | ||
557 | } | ||
559 | message->context = NULL; | 558 | message->context = NULL; |
560 | return status; | 559 | return status; |
561 | } | 560 | } |
@@ -589,7 +588,7 @@ int spi_write_then_read(struct spi_device *spi, | |||
589 | const u8 *txbuf, unsigned n_tx, | 588 | const u8 *txbuf, unsigned n_tx, |
590 | u8 *rxbuf, unsigned n_rx) | 589 | u8 *rxbuf, unsigned n_rx) |
591 | { | 590 | { |
592 | static DECLARE_MUTEX(lock); | 591 | static DEFINE_MUTEX(lock); |
593 | 592 | ||
594 | int status; | 593 | int status; |
595 | struct spi_message message; | 594 | struct spi_message message; |
@@ -615,7 +614,7 @@ int spi_write_then_read(struct spi_device *spi, | |||
615 | } | 614 | } |
616 | 615 | ||
617 | /* ... unless someone else is using the pre-allocated buffer */ | 616 | /* ... unless someone else is using the pre-allocated buffer */ |
618 | if (down_trylock(&lock)) { | 617 | if (!mutex_trylock(&lock)) { |
619 | local_buf = kmalloc(SPI_BUFSIZ, GFP_KERNEL); | 618 | local_buf = kmalloc(SPI_BUFSIZ, GFP_KERNEL); |
620 | if (!local_buf) | 619 | if (!local_buf) |
621 | return -ENOMEM; | 620 | return -ENOMEM; |
@@ -628,13 +627,11 @@ int spi_write_then_read(struct spi_device *spi, | |||
628 | 627 | ||
629 | /* do the i/o */ | 628 | /* do the i/o */ |
630 | status = spi_sync(spi, &message); | 629 | status = spi_sync(spi, &message); |
631 | if (status == 0) { | 630 | if (status == 0) |
632 | memcpy(rxbuf, x[1].rx_buf, n_rx); | 631 | memcpy(rxbuf, x[1].rx_buf, n_rx); |
633 | status = message.status; | ||
634 | } | ||
635 | 632 | ||
636 | if (x[0].tx_buf == buf) | 633 | if (x[0].tx_buf == buf) |
637 | up(&lock); | 634 | mutex_unlock(&lock); |
638 | else | 635 | else |
639 | kfree(local_buf); | 636 | kfree(local_buf); |
640 | 637 | ||
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 2ef11bb70b2e..7ef39a6e8c06 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -1,17 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | * File: drivers/spi/bfin5xx_spi.c | 2 | * File: drivers/spi/bfin5xx_spi.c |
3 | * Based on: N/A | 3 | * Maintainer: |
4 | * Author: Luke Yang (Analog Devices Inc.) | 4 | * Bryan Wu <bryan.wu@analog.com> |
5 | * Original Author: | ||
6 | * Luke Yang (Analog Devices Inc.) | ||
5 | * | 7 | * |
6 | * Created: March. 10th 2006 | 8 | * Created: March. 10th 2006 |
7 | * Description: SPI controller driver for Blackfin 5xx | 9 | * Description: SPI controller driver for Blackfin BF5xx |
8 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | 10 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
9 | * | 11 | * |
10 | * Modified: | 12 | * Modified: |
11 | * March 10, 2006 bfin5xx_spi.c Created. (Luke Yang) | 13 | * March 10, 2006 bfin5xx_spi.c Created. (Luke Yang) |
12 | * August 7, 2006 added full duplex mode (Axel Weiss & Luke Yang) | 14 | * August 7, 2006 added full duplex mode (Axel Weiss & Luke Yang) |
15 | * July 17, 2007 add support for BF54x SPI0 controller (Bryan Wu) | ||
16 | * July 30, 2007 add platfrom_resource interface to support multi-port | ||
17 | * SPI controller (Bryan Wu) | ||
13 | * | 18 | * |
14 | * Copyright 2004-2006 Analog Devices Inc. | 19 | * Copyright 2004-2007 Analog Devices Inc. |
15 | * | 20 | * |
16 | * This program is free software ; you can redistribute it and/or modify | 21 | * This program is free software ; you can redistribute it and/or modify |
17 | * it under the terms of the GNU General Public License as published by | 22 | * it under the terms of the GNU General Public License as published by |
@@ -31,50 +36,39 @@ | |||
31 | 36 | ||
32 | #include <linux/init.h> | 37 | #include <linux/init.h> |
33 | #include <linux/module.h> | 38 | #include <linux/module.h> |
39 | #include <linux/delay.h> | ||
34 | #include <linux/device.h> | 40 | #include <linux/device.h> |
41 | #include <linux/io.h> | ||
35 | #include <linux/ioport.h> | 42 | #include <linux/ioport.h> |
43 | #include <linux/irq.h> | ||
36 | #include <linux/errno.h> | 44 | #include <linux/errno.h> |
37 | #include <linux/interrupt.h> | 45 | #include <linux/interrupt.h> |
38 | #include <linux/platform_device.h> | 46 | #include <linux/platform_device.h> |
39 | #include <linux/dma-mapping.h> | 47 | #include <linux/dma-mapping.h> |
40 | #include <linux/spi/spi.h> | 48 | #include <linux/spi/spi.h> |
41 | #include <linux/workqueue.h> | 49 | #include <linux/workqueue.h> |
42 | #include <linux/delay.h> | ||
43 | 50 | ||
44 | #include <asm/io.h> | ||
45 | #include <asm/irq.h> | ||
46 | #include <asm/delay.h> | ||
47 | #include <asm/dma.h> | 51 | #include <asm/dma.h> |
48 | 52 | #include <asm/portmux.h> | |
49 | #include <asm/bfin5xx_spi.h> | 53 | #include <asm/bfin5xx_spi.h> |
50 | 54 | ||
51 | MODULE_AUTHOR("Luke Yang"); | 55 | #define DRV_NAME "bfin-spi" |
52 | MODULE_DESCRIPTION("Blackfin 5xx SPI Contoller"); | 56 | #define DRV_AUTHOR "Bryan Wu, Luke Yang" |
53 | MODULE_LICENSE("GPL"); | 57 | #define DRV_DESC "Blackfin BF5xx on-chip SPI Controller Driver" |
58 | #define DRV_VERSION "1.0" | ||
54 | 59 | ||
55 | #define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0) | 60 | MODULE_AUTHOR(DRV_AUTHOR); |
61 | MODULE_DESCRIPTION(DRV_DESC); | ||
62 | MODULE_LICENSE("GPL"); | ||
56 | 63 | ||
57 | #define DEFINE_SPI_REG(reg, off) \ | 64 | #define IS_DMA_ALIGNED(x) (((u32)(x)&0x07) == 0) |
58 | static inline u16 read_##reg(void) \ | ||
59 | { return *(volatile unsigned short*)(SPI0_REGBASE + off); } \ | ||
60 | static inline void write_##reg(u16 v) \ | ||
61 | {*(volatile unsigned short*)(SPI0_REGBASE + off) = v;\ | ||
62 | SSYNC();} | ||
63 | 65 | ||
64 | DEFINE_SPI_REG(CTRL, 0x00) | 66 | #define START_STATE ((void *)0) |
65 | DEFINE_SPI_REG(FLAG, 0x04) | 67 | #define RUNNING_STATE ((void *)1) |
66 | DEFINE_SPI_REG(STAT, 0x08) | 68 | #define DONE_STATE ((void *)2) |
67 | DEFINE_SPI_REG(TDBR, 0x0C) | 69 | #define ERROR_STATE ((void *)-1) |
68 | DEFINE_SPI_REG(RDBR, 0x10) | 70 | #define QUEUE_RUNNING 0 |
69 | DEFINE_SPI_REG(BAUD, 0x14) | 71 | #define QUEUE_STOPPED 1 |
70 | DEFINE_SPI_REG(SHAW, 0x18) | ||
71 | #define START_STATE ((void*)0) | ||
72 | #define RUNNING_STATE ((void*)1) | ||
73 | #define DONE_STATE ((void*)2) | ||
74 | #define ERROR_STATE ((void*)-1) | ||
75 | #define QUEUE_RUNNING 0 | ||
76 | #define QUEUE_STOPPED 1 | ||
77 | int dma_requested; | ||
78 | 72 | ||
79 | struct driver_data { | 73 | struct driver_data { |
80 | /* Driver model hookup */ | 74 | /* Driver model hookup */ |
@@ -83,6 +77,12 @@ struct driver_data { | |||
83 | /* SPI framework hookup */ | 77 | /* SPI framework hookup */ |
84 | struct spi_master *master; | 78 | struct spi_master *master; |
85 | 79 | ||
80 | /* Regs base of SPI controller */ | ||
81 | void __iomem *regs_base; | ||
82 | |||
83 | /* Pin request list */ | ||
84 | u16 *pin_req; | ||
85 | |||
86 | /* BFIN hookup */ | 86 | /* BFIN hookup */ |
87 | struct bfin5xx_spi_master *master_info; | 87 | struct bfin5xx_spi_master *master_info; |
88 | 88 | ||
@@ -107,12 +107,18 @@ struct driver_data { | |||
107 | void *tx_end; | 107 | void *tx_end; |
108 | void *rx; | 108 | void *rx; |
109 | void *rx_end; | 109 | void *rx_end; |
110 | |||
111 | /* DMA stuffs */ | ||
112 | int dma_channel; | ||
110 | int dma_mapped; | 113 | int dma_mapped; |
114 | int dma_requested; | ||
111 | dma_addr_t rx_dma; | 115 | dma_addr_t rx_dma; |
112 | dma_addr_t tx_dma; | 116 | dma_addr_t tx_dma; |
117 | |||
113 | size_t rx_map_len; | 118 | size_t rx_map_len; |
114 | size_t tx_map_len; | 119 | size_t tx_map_len; |
115 | u8 n_bytes; | 120 | u8 n_bytes; |
121 | int cs_change; | ||
116 | void (*write) (struct driver_data *); | 122 | void (*write) (struct driver_data *); |
117 | void (*read) (struct driver_data *); | 123 | void (*read) (struct driver_data *); |
118 | void (*duplex) (struct driver_data *); | 124 | void (*duplex) (struct driver_data *); |
@@ -129,28 +135,40 @@ struct chip_data { | |||
129 | u8 enable_dma; | 135 | u8 enable_dma; |
130 | u8 bits_per_word; /* 8 or 16 */ | 136 | u8 bits_per_word; /* 8 or 16 */ |
131 | u8 cs_change_per_word; | 137 | u8 cs_change_per_word; |
132 | u8 cs_chg_udelay; | 138 | u16 cs_chg_udelay; /* Some devices require > 255usec delay */ |
133 | void (*write) (struct driver_data *); | 139 | void (*write) (struct driver_data *); |
134 | void (*read) (struct driver_data *); | 140 | void (*read) (struct driver_data *); |
135 | void (*duplex) (struct driver_data *); | 141 | void (*duplex) (struct driver_data *); |
136 | }; | 142 | }; |
137 | 143 | ||
144 | #define DEFINE_SPI_REG(reg, off) \ | ||
145 | static inline u16 read_##reg(struct driver_data *drv_data) \ | ||
146 | { return bfin_read16(drv_data->regs_base + off); } \ | ||
147 | static inline void write_##reg(struct driver_data *drv_data, u16 v) \ | ||
148 | { bfin_write16(drv_data->regs_base + off, v); } | ||
149 | |||
150 | DEFINE_SPI_REG(CTRL, 0x00) | ||
151 | DEFINE_SPI_REG(FLAG, 0x04) | ||
152 | DEFINE_SPI_REG(STAT, 0x08) | ||
153 | DEFINE_SPI_REG(TDBR, 0x0C) | ||
154 | DEFINE_SPI_REG(RDBR, 0x10) | ||
155 | DEFINE_SPI_REG(BAUD, 0x14) | ||
156 | DEFINE_SPI_REG(SHAW, 0x18) | ||
157 | |||
138 | static void bfin_spi_enable(struct driver_data *drv_data) | 158 | static void bfin_spi_enable(struct driver_data *drv_data) |
139 | { | 159 | { |
140 | u16 cr; | 160 | u16 cr; |
141 | 161 | ||
142 | cr = read_CTRL(); | 162 | cr = read_CTRL(drv_data); |
143 | write_CTRL(cr | BIT_CTL_ENABLE); | 163 | write_CTRL(drv_data, (cr | BIT_CTL_ENABLE)); |
144 | SSYNC(); | ||
145 | } | 164 | } |
146 | 165 | ||
147 | static void bfin_spi_disable(struct driver_data *drv_data) | 166 | static void bfin_spi_disable(struct driver_data *drv_data) |
148 | { | 167 | { |
149 | u16 cr; | 168 | u16 cr; |
150 | 169 | ||
151 | cr = read_CTRL(); | 170 | cr = read_CTRL(drv_data); |
152 | write_CTRL(cr & (~BIT_CTL_ENABLE)); | 171 | write_CTRL(drv_data, (cr & (~BIT_CTL_ENABLE))); |
153 | SSYNC(); | ||
154 | } | 172 | } |
155 | 173 | ||
156 | /* Caculate the SPI_BAUD register value based on input HZ */ | 174 | /* Caculate the SPI_BAUD register value based on input HZ */ |
@@ -170,83 +188,71 @@ static int flush(struct driver_data *drv_data) | |||
170 | unsigned long limit = loops_per_jiffy << 1; | 188 | unsigned long limit = loops_per_jiffy << 1; |
171 | 189 | ||
172 | /* wait for stop and clear stat */ | 190 | /* wait for stop and clear stat */ |
173 | while (!(read_STAT() & BIT_STAT_SPIF) && limit--) | 191 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && limit--) |
174 | continue; | 192 | cpu_relax(); |
175 | 193 | ||
176 | write_STAT(BIT_STAT_CLR); | 194 | write_STAT(drv_data, BIT_STAT_CLR); |
177 | 195 | ||
178 | return limit; | 196 | return limit; |
179 | } | 197 | } |
180 | 198 | ||
199 | /* Chip select operation functions for cs_change flag */ | ||
200 | static void cs_active(struct driver_data *drv_data, struct chip_data *chip) | ||
201 | { | ||
202 | u16 flag = read_FLAG(drv_data); | ||
203 | |||
204 | flag |= chip->flag; | ||
205 | flag &= ~(chip->flag << 8); | ||
206 | |||
207 | write_FLAG(drv_data, flag); | ||
208 | } | ||
209 | |||
210 | static void cs_deactive(struct driver_data *drv_data, struct chip_data *chip) | ||
211 | { | ||
212 | u16 flag = read_FLAG(drv_data); | ||
213 | |||
214 | flag |= (chip->flag << 8); | ||
215 | |||
216 | write_FLAG(drv_data, flag); | ||
217 | |||
218 | /* Move delay here for consistency */ | ||
219 | if (chip->cs_chg_udelay) | ||
220 | udelay(chip->cs_chg_udelay); | ||
221 | } | ||
222 | |||
223 | #define MAX_SPI_SSEL 7 | ||
224 | |||
181 | /* stop controller and re-config current chip*/ | 225 | /* stop controller and re-config current chip*/ |
182 | static void restore_state(struct driver_data *drv_data) | 226 | static int restore_state(struct driver_data *drv_data) |
183 | { | 227 | { |
184 | struct chip_data *chip = drv_data->cur_chip; | 228 | struct chip_data *chip = drv_data->cur_chip; |
229 | int ret = 0; | ||
185 | 230 | ||
186 | /* Clear status and disable clock */ | 231 | /* Clear status and disable clock */ |
187 | write_STAT(BIT_STAT_CLR); | 232 | write_STAT(drv_data, BIT_STAT_CLR); |
188 | bfin_spi_disable(drv_data); | 233 | bfin_spi_disable(drv_data); |
189 | dev_dbg(&drv_data->pdev->dev, "restoring spi ctl state\n"); | 234 | dev_dbg(&drv_data->pdev->dev, "restoring spi ctl state\n"); |
190 | 235 | ||
191 | #if defined(CONFIG_BF534) || defined(CONFIG_BF536) || defined(CONFIG_BF537) | 236 | /* Load the registers */ |
192 | dev_dbg(&drv_data->pdev->dev, | 237 | write_CTRL(drv_data, chip->ctl_reg); |
193 | "chip select number is %d\n", chip->chip_select_num); | 238 | write_BAUD(drv_data, chip->baud); |
194 | |||
195 | switch (chip->chip_select_num) { | ||
196 | case 1: | ||
197 | bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3c00); | ||
198 | SSYNC(); | ||
199 | break; | ||
200 | |||
201 | case 2: | ||
202 | case 3: | ||
203 | bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PJSE_SPI); | ||
204 | SSYNC(); | ||
205 | bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3800); | ||
206 | SSYNC(); | ||
207 | break; | ||
208 | |||
209 | case 4: | ||
210 | bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PFS4E_SPI); | ||
211 | SSYNC(); | ||
212 | bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3840); | ||
213 | SSYNC(); | ||
214 | break; | ||
215 | 239 | ||
216 | case 5: | 240 | bfin_spi_enable(drv_data); |
217 | bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PFS5E_SPI); | 241 | cs_active(drv_data, chip); |
218 | SSYNC(); | ||
219 | bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3820); | ||
220 | SSYNC(); | ||
221 | break; | ||
222 | 242 | ||
223 | case 6: | 243 | if (ret) |
224 | bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PFS6E_SPI); | 244 | dev_dbg(&drv_data->pdev->dev, |
225 | SSYNC(); | 245 | ": request chip select number %d failed\n", |
226 | bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3810); | 246 | chip->chip_select_num); |
227 | SSYNC(); | ||
228 | break; | ||
229 | 247 | ||
230 | case 7: | 248 | return ret; |
231 | bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PJCE_SPI); | ||
232 | SSYNC(); | ||
233 | bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3800); | ||
234 | SSYNC(); | ||
235 | break; | ||
236 | } | ||
237 | #endif | ||
238 | |||
239 | /* Load the registers */ | ||
240 | write_CTRL(chip->ctl_reg); | ||
241 | write_BAUD(chip->baud); | ||
242 | write_FLAG(chip->flag); | ||
243 | } | 249 | } |
244 | 250 | ||
245 | /* used to kick off transfer in rx mode */ | 251 | /* used to kick off transfer in rx mode */ |
246 | static unsigned short dummy_read(void) | 252 | static unsigned short dummy_read(struct driver_data *drv_data) |
247 | { | 253 | { |
248 | unsigned short tmp; | 254 | unsigned short tmp; |
249 | tmp = read_RDBR(); | 255 | tmp = read_RDBR(drv_data); |
250 | return tmp; | 256 | return tmp; |
251 | } | 257 | } |
252 | 258 | ||
@@ -255,9 +261,9 @@ static void null_writer(struct driver_data *drv_data) | |||
255 | u8 n_bytes = drv_data->n_bytes; | 261 | u8 n_bytes = drv_data->n_bytes; |
256 | 262 | ||
257 | while (drv_data->tx < drv_data->tx_end) { | 263 | while (drv_data->tx < drv_data->tx_end) { |
258 | write_TDBR(0); | 264 | write_TDBR(drv_data, 0); |
259 | while ((read_STAT() & BIT_STAT_TXS)) | 265 | while ((read_STAT(drv_data) & BIT_STAT_TXS)) |
260 | continue; | 266 | cpu_relax(); |
261 | drv_data->tx += n_bytes; | 267 | drv_data->tx += n_bytes; |
262 | } | 268 | } |
263 | } | 269 | } |
@@ -265,75 +271,78 @@ static void null_writer(struct driver_data *drv_data) | |||
265 | static void null_reader(struct driver_data *drv_data) | 271 | static void null_reader(struct driver_data *drv_data) |
266 | { | 272 | { |
267 | u8 n_bytes = drv_data->n_bytes; | 273 | u8 n_bytes = drv_data->n_bytes; |
268 | dummy_read(); | 274 | dummy_read(drv_data); |
269 | 275 | ||
270 | while (drv_data->rx < drv_data->rx_end) { | 276 | while (drv_data->rx < drv_data->rx_end) { |
271 | while (!(read_STAT() & BIT_STAT_RXS)) | 277 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
272 | continue; | 278 | cpu_relax(); |
273 | dummy_read(); | 279 | dummy_read(drv_data); |
274 | drv_data->rx += n_bytes; | 280 | drv_data->rx += n_bytes; |
275 | } | 281 | } |
276 | } | 282 | } |
277 | 283 | ||
278 | static void u8_writer(struct driver_data *drv_data) | 284 | static void u8_writer(struct driver_data *drv_data) |
279 | { | 285 | { |
280 | dev_dbg(&drv_data->pdev->dev, | 286 | dev_dbg(&drv_data->pdev->dev, |
281 | "cr8-s is 0x%x\n", read_STAT()); | 287 | "cr8-s is 0x%x\n", read_STAT(drv_data)); |
288 | |||
289 | /* poll for SPI completion before start */ | ||
290 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | ||
291 | cpu_relax(); | ||
292 | |||
282 | while (drv_data->tx < drv_data->tx_end) { | 293 | while (drv_data->tx < drv_data->tx_end) { |
283 | write_TDBR(*(u8 *) (drv_data->tx)); | 294 | write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); |
284 | while (read_STAT() & BIT_STAT_TXS) | 295 | while (read_STAT(drv_data) & BIT_STAT_TXS) |
285 | continue; | 296 | cpu_relax(); |
286 | ++drv_data->tx; | 297 | ++drv_data->tx; |
287 | } | 298 | } |
288 | |||
289 | /* poll for SPI completion before returning */ | ||
290 | while (!(read_STAT() & BIT_STAT_SPIF)) | ||
291 | continue; | ||
292 | } | 299 | } |
293 | 300 | ||
294 | static void u8_cs_chg_writer(struct driver_data *drv_data) | 301 | static void u8_cs_chg_writer(struct driver_data *drv_data) |
295 | { | 302 | { |
296 | struct chip_data *chip = drv_data->cur_chip; | 303 | struct chip_data *chip = drv_data->cur_chip; |
297 | 304 | ||
305 | /* poll for SPI completion before start */ | ||
306 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | ||
307 | cpu_relax(); | ||
308 | |||
298 | while (drv_data->tx < drv_data->tx_end) { | 309 | while (drv_data->tx < drv_data->tx_end) { |
299 | write_FLAG(chip->flag); | 310 | cs_active(drv_data, chip); |
300 | SSYNC(); | 311 | |
301 | 312 | write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); | |
302 | write_TDBR(*(u8 *) (drv_data->tx)); | 313 | while (read_STAT(drv_data) & BIT_STAT_TXS) |
303 | while (read_STAT() & BIT_STAT_TXS) | 314 | cpu_relax(); |
304 | continue; | 315 | |
305 | while (!(read_STAT() & BIT_STAT_SPIF)) | 316 | cs_deactive(drv_data, chip); |
306 | continue; | 317 | |
307 | write_FLAG(0xFF00 | chip->flag); | ||
308 | SSYNC(); | ||
309 | if (chip->cs_chg_udelay) | ||
310 | udelay(chip->cs_chg_udelay); | ||
311 | ++drv_data->tx; | 318 | ++drv_data->tx; |
312 | } | 319 | } |
313 | write_FLAG(0xFF00); | ||
314 | SSYNC(); | ||
315 | } | 320 | } |
316 | 321 | ||
317 | static void u8_reader(struct driver_data *drv_data) | 322 | static void u8_reader(struct driver_data *drv_data) |
318 | { | 323 | { |
319 | dev_dbg(&drv_data->pdev->dev, | 324 | dev_dbg(&drv_data->pdev->dev, |
320 | "cr-8 is 0x%x\n", read_STAT()); | 325 | "cr-8 is 0x%x\n", read_STAT(drv_data)); |
326 | |||
327 | /* poll for SPI completion before start */ | ||
328 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | ||
329 | cpu_relax(); | ||
321 | 330 | ||
322 | /* clear TDBR buffer before read(else it will be shifted out) */ | 331 | /* clear TDBR buffer before read(else it will be shifted out) */ |
323 | write_TDBR(0xFFFF); | 332 | write_TDBR(drv_data, 0xFFFF); |
324 | 333 | ||
325 | dummy_read(); | 334 | dummy_read(drv_data); |
326 | 335 | ||
327 | while (drv_data->rx < drv_data->rx_end - 1) { | 336 | while (drv_data->rx < drv_data->rx_end - 1) { |
328 | while (!(read_STAT() & BIT_STAT_RXS)) | 337 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
329 | continue; | 338 | cpu_relax(); |
330 | *(u8 *) (drv_data->rx) = read_RDBR(); | 339 | *(u8 *) (drv_data->rx) = read_RDBR(drv_data); |
331 | ++drv_data->rx; | 340 | ++drv_data->rx; |
332 | } | 341 | } |
333 | 342 | ||
334 | while (!(read_STAT() & BIT_STAT_RXS)) | 343 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
335 | continue; | 344 | cpu_relax(); |
336 | *(u8 *) (drv_data->rx) = read_SHAW(); | 345 | *(u8 *) (drv_data->rx) = read_SHAW(drv_data); |
337 | ++drv_data->rx; | 346 | ++drv_data->rx; |
338 | } | 347 | } |
339 | 348 | ||
@@ -341,36 +350,47 @@ static void u8_cs_chg_reader(struct driver_data *drv_data) | |||
341 | { | 350 | { |
342 | struct chip_data *chip = drv_data->cur_chip; | 351 | struct chip_data *chip = drv_data->cur_chip; |
343 | 352 | ||
344 | while (drv_data->rx < drv_data->rx_end) { | 353 | /* poll for SPI completion before start */ |
345 | write_FLAG(chip->flag); | 354 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) |
346 | SSYNC(); | 355 | cpu_relax(); |
347 | 356 | ||
348 | read_RDBR(); /* kick off */ | 357 | /* clear TDBR buffer before read(else it will be shifted out) */ |
349 | while (!(read_STAT() & BIT_STAT_RXS)) | 358 | write_TDBR(drv_data, 0xFFFF); |
350 | continue; | 359 | |
351 | while (!(read_STAT() & BIT_STAT_SPIF)) | 360 | cs_active(drv_data, chip); |
352 | continue; | 361 | dummy_read(drv_data); |
353 | *(u8 *) (drv_data->rx) = read_SHAW(); | 362 | |
354 | write_FLAG(0xFF00 | chip->flag); | 363 | while (drv_data->rx < drv_data->rx_end - 1) { |
355 | SSYNC(); | 364 | cs_deactive(drv_data, chip); |
356 | if (chip->cs_chg_udelay) | 365 | |
357 | udelay(chip->cs_chg_udelay); | 366 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
367 | cpu_relax(); | ||
368 | cs_active(drv_data, chip); | ||
369 | *(u8 *) (drv_data->rx) = read_RDBR(drv_data); | ||
358 | ++drv_data->rx; | 370 | ++drv_data->rx; |
359 | } | 371 | } |
360 | write_FLAG(0xFF00); | 372 | cs_deactive(drv_data, chip); |
361 | SSYNC(); | 373 | |
374 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) | ||
375 | cpu_relax(); | ||
376 | *(u8 *) (drv_data->rx) = read_SHAW(drv_data); | ||
377 | ++drv_data->rx; | ||
362 | } | 378 | } |
363 | 379 | ||
364 | static void u8_duplex(struct driver_data *drv_data) | 380 | static void u8_duplex(struct driver_data *drv_data) |
365 | { | 381 | { |
382 | /* poll for SPI completion before start */ | ||
383 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | ||
384 | cpu_relax(); | ||
385 | |||
366 | /* in duplex mode, clk is triggered by writing of TDBR */ | 386 | /* in duplex mode, clk is triggered by writing of TDBR */ |
367 | while (drv_data->rx < drv_data->rx_end) { | 387 | while (drv_data->rx < drv_data->rx_end) { |
368 | write_TDBR(*(u8 *) (drv_data->tx)); | 388 | write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); |
369 | while (!(read_STAT() & BIT_STAT_SPIF)) | 389 | while (read_STAT(drv_data) & BIT_STAT_TXS) |
370 | continue; | 390 | cpu_relax(); |
371 | while (!(read_STAT() & BIT_STAT_RXS)) | 391 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
372 | continue; | 392 | cpu_relax(); |
373 | *(u8 *) (drv_data->rx) = read_RDBR(); | 393 | *(u8 *) (drv_data->rx) = read_RDBR(drv_data); |
374 | ++drv_data->rx; | 394 | ++drv_data->rx; |
375 | ++drv_data->tx; | 395 | ++drv_data->tx; |
376 | } | 396 | } |
@@ -380,83 +400,89 @@ static void u8_cs_chg_duplex(struct driver_data *drv_data) | |||
380 | { | 400 | { |
381 | struct chip_data *chip = drv_data->cur_chip; | 401 | struct chip_data *chip = drv_data->cur_chip; |
382 | 402 | ||
403 | /* poll for SPI completion before start */ | ||
404 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | ||
405 | cpu_relax(); | ||
406 | |||
383 | while (drv_data->rx < drv_data->rx_end) { | 407 | while (drv_data->rx < drv_data->rx_end) { |
384 | write_FLAG(chip->flag); | 408 | cs_active(drv_data, chip); |
385 | SSYNC(); | 409 | |
386 | 410 | write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); | |
387 | write_TDBR(*(u8 *) (drv_data->tx)); | 411 | while (read_STAT(drv_data) & BIT_STAT_TXS) |
388 | while (!(read_STAT() & BIT_STAT_SPIF)) | 412 | cpu_relax(); |
389 | continue; | 413 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
390 | while (!(read_STAT() & BIT_STAT_RXS)) | 414 | cpu_relax(); |
391 | continue; | 415 | *(u8 *) (drv_data->rx) = read_RDBR(drv_data); |
392 | *(u8 *) (drv_data->rx) = read_RDBR(); | 416 | |
393 | write_FLAG(0xFF00 | chip->flag); | 417 | cs_deactive(drv_data, chip); |
394 | SSYNC(); | 418 | |
395 | if (chip->cs_chg_udelay) | ||
396 | udelay(chip->cs_chg_udelay); | ||
397 | ++drv_data->rx; | 419 | ++drv_data->rx; |
398 | ++drv_data->tx; | 420 | ++drv_data->tx; |
399 | } | 421 | } |
400 | write_FLAG(0xFF00); | ||
401 | SSYNC(); | ||
402 | } | 422 | } |
403 | 423 | ||
404 | static void u16_writer(struct driver_data *drv_data) | 424 | static void u16_writer(struct driver_data *drv_data) |
405 | { | 425 | { |
406 | dev_dbg(&drv_data->pdev->dev, | 426 | dev_dbg(&drv_data->pdev->dev, |
407 | "cr16 is 0x%x\n", read_STAT()); | 427 | "cr16 is 0x%x\n", read_STAT(drv_data)); |
428 | |||
429 | /* poll for SPI completion before start */ | ||
430 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | ||
431 | cpu_relax(); | ||
408 | 432 | ||
409 | while (drv_data->tx < drv_data->tx_end) { | 433 | while (drv_data->tx < drv_data->tx_end) { |
410 | write_TDBR(*(u16 *) (drv_data->tx)); | 434 | write_TDBR(drv_data, (*(u16 *) (drv_data->tx))); |
411 | while ((read_STAT() & BIT_STAT_TXS)) | 435 | while ((read_STAT(drv_data) & BIT_STAT_TXS)) |
412 | continue; | 436 | cpu_relax(); |
413 | drv_data->tx += 2; | 437 | drv_data->tx += 2; |
414 | } | 438 | } |
415 | |||
416 | /* poll for SPI completion before returning */ | ||
417 | while (!(read_STAT() & BIT_STAT_SPIF)) | ||
418 | continue; | ||
419 | } | 439 | } |
420 | 440 | ||
421 | static void u16_cs_chg_writer(struct driver_data *drv_data) | 441 | static void u16_cs_chg_writer(struct driver_data *drv_data) |
422 | { | 442 | { |
423 | struct chip_data *chip = drv_data->cur_chip; | 443 | struct chip_data *chip = drv_data->cur_chip; |
424 | 444 | ||
445 | /* poll for SPI completion before start */ | ||
446 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | ||
447 | cpu_relax(); | ||
448 | |||
425 | while (drv_data->tx < drv_data->tx_end) { | 449 | while (drv_data->tx < drv_data->tx_end) { |
426 | write_FLAG(chip->flag); | 450 | cs_active(drv_data, chip); |
427 | SSYNC(); | 451 | |
428 | 452 | write_TDBR(drv_data, (*(u16 *) (drv_data->tx))); | |
429 | write_TDBR(*(u16 *) (drv_data->tx)); | 453 | while ((read_STAT(drv_data) & BIT_STAT_TXS)) |
430 | while ((read_STAT() & BIT_STAT_TXS)) | 454 | cpu_relax(); |
431 | continue; | 455 | |
432 | while (!(read_STAT() & BIT_STAT_SPIF)) | 456 | cs_deactive(drv_data, chip); |
433 | continue; | 457 | |
434 | write_FLAG(0xFF00 | chip->flag); | ||
435 | SSYNC(); | ||
436 | if (chip->cs_chg_udelay) | ||
437 | udelay(chip->cs_chg_udelay); | ||
438 | drv_data->tx += 2; | 458 | drv_data->tx += 2; |
439 | } | 459 | } |
440 | write_FLAG(0xFF00); | ||
441 | SSYNC(); | ||
442 | } | 460 | } |
443 | 461 | ||
444 | static void u16_reader(struct driver_data *drv_data) | 462 | static void u16_reader(struct driver_data *drv_data) |
445 | { | 463 | { |
446 | dev_dbg(&drv_data->pdev->dev, | 464 | dev_dbg(&drv_data->pdev->dev, |
447 | "cr-16 is 0x%x\n", read_STAT()); | 465 | "cr-16 is 0x%x\n", read_STAT(drv_data)); |
448 | dummy_read(); | 466 | |
467 | /* poll for SPI completion before start */ | ||
468 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | ||
469 | cpu_relax(); | ||
470 | |||
471 | /* clear TDBR buffer before read(else it will be shifted out) */ | ||
472 | write_TDBR(drv_data, 0xFFFF); | ||
473 | |||
474 | dummy_read(drv_data); | ||
449 | 475 | ||
450 | while (drv_data->rx < (drv_data->rx_end - 2)) { | 476 | while (drv_data->rx < (drv_data->rx_end - 2)) { |
451 | while (!(read_STAT() & BIT_STAT_RXS)) | 477 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
452 | continue; | 478 | cpu_relax(); |
453 | *(u16 *) (drv_data->rx) = read_RDBR(); | 479 | *(u16 *) (drv_data->rx) = read_RDBR(drv_data); |
454 | drv_data->rx += 2; | 480 | drv_data->rx += 2; |
455 | } | 481 | } |
456 | 482 | ||
457 | while (!(read_STAT() & BIT_STAT_RXS)) | 483 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
458 | continue; | 484 | cpu_relax(); |
459 | *(u16 *) (drv_data->rx) = read_SHAW(); | 485 | *(u16 *) (drv_data->rx) = read_SHAW(drv_data); |
460 | drv_data->rx += 2; | 486 | drv_data->rx += 2; |
461 | } | 487 | } |
462 | 488 | ||
@@ -464,36 +490,47 @@ static void u16_cs_chg_reader(struct driver_data *drv_data) | |||
464 | { | 490 | { |
465 | struct chip_data *chip = drv_data->cur_chip; | 491 | struct chip_data *chip = drv_data->cur_chip; |
466 | 492 | ||
467 | while (drv_data->rx < drv_data->rx_end) { | 493 | /* poll for SPI completion before start */ |
468 | write_FLAG(chip->flag); | 494 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) |
469 | SSYNC(); | 495 | cpu_relax(); |
470 | 496 | ||
471 | read_RDBR(); /* kick off */ | 497 | /* clear TDBR buffer before read(else it will be shifted out) */ |
472 | while (!(read_STAT() & BIT_STAT_RXS)) | 498 | write_TDBR(drv_data, 0xFFFF); |
473 | continue; | 499 | |
474 | while (!(read_STAT() & BIT_STAT_SPIF)) | 500 | cs_active(drv_data, chip); |
475 | continue; | 501 | dummy_read(drv_data); |
476 | *(u16 *) (drv_data->rx) = read_SHAW(); | 502 | |
477 | write_FLAG(0xFF00 | chip->flag); | 503 | while (drv_data->rx < drv_data->rx_end - 2) { |
478 | SSYNC(); | 504 | cs_deactive(drv_data, chip); |
479 | if (chip->cs_chg_udelay) | 505 | |
480 | udelay(chip->cs_chg_udelay); | 506 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
507 | cpu_relax(); | ||
508 | cs_active(drv_data, chip); | ||
509 | *(u16 *) (drv_data->rx) = read_RDBR(drv_data); | ||
481 | drv_data->rx += 2; | 510 | drv_data->rx += 2; |
482 | } | 511 | } |
483 | write_FLAG(0xFF00); | 512 | cs_deactive(drv_data, chip); |
484 | SSYNC(); | 513 | |
514 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) | ||
515 | cpu_relax(); | ||
516 | *(u16 *) (drv_data->rx) = read_SHAW(drv_data); | ||
517 | drv_data->rx += 2; | ||
485 | } | 518 | } |
486 | 519 | ||
487 | static void u16_duplex(struct driver_data *drv_data) | 520 | static void u16_duplex(struct driver_data *drv_data) |
488 | { | 521 | { |
522 | /* poll for SPI completion before start */ | ||
523 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | ||
524 | cpu_relax(); | ||
525 | |||
489 | /* in duplex mode, clk is triggered by writing of TDBR */ | 526 | /* in duplex mode, clk is triggered by writing of TDBR */ |
490 | while (drv_data->tx < drv_data->tx_end) { | 527 | while (drv_data->tx < drv_data->tx_end) { |
491 | write_TDBR(*(u16 *) (drv_data->tx)); | 528 | write_TDBR(drv_data, (*(u16 *) (drv_data->tx))); |
492 | while (!(read_STAT() & BIT_STAT_SPIF)) | 529 | while (read_STAT(drv_data) & BIT_STAT_TXS) |
493 | continue; | 530 | cpu_relax(); |
494 | while (!(read_STAT() & BIT_STAT_RXS)) | 531 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
495 | continue; | 532 | cpu_relax(); |
496 | *(u16 *) (drv_data->rx) = read_RDBR(); | 533 | *(u16 *) (drv_data->rx) = read_RDBR(drv_data); |
497 | drv_data->rx += 2; | 534 | drv_data->rx += 2; |
498 | drv_data->tx += 2; | 535 | drv_data->tx += 2; |
499 | } | 536 | } |
@@ -503,25 +540,25 @@ static void u16_cs_chg_duplex(struct driver_data *drv_data) | |||
503 | { | 540 | { |
504 | struct chip_data *chip = drv_data->cur_chip; | 541 | struct chip_data *chip = drv_data->cur_chip; |
505 | 542 | ||
543 | /* poll for SPI completion before start */ | ||
544 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | ||
545 | cpu_relax(); | ||
546 | |||
506 | while (drv_data->tx < drv_data->tx_end) { | 547 | while (drv_data->tx < drv_data->tx_end) { |
507 | write_FLAG(chip->flag); | 548 | cs_active(drv_data, chip); |
508 | SSYNC(); | 549 | |
509 | 550 | write_TDBR(drv_data, (*(u16 *) (drv_data->tx))); | |
510 | write_TDBR(*(u16 *) (drv_data->tx)); | 551 | while (read_STAT(drv_data) & BIT_STAT_TXS) |
511 | while (!(read_STAT() & BIT_STAT_SPIF)) | 552 | cpu_relax(); |
512 | continue; | 553 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
513 | while (!(read_STAT() & BIT_STAT_RXS)) | 554 | cpu_relax(); |
514 | continue; | 555 | *(u16 *) (drv_data->rx) = read_RDBR(drv_data); |
515 | *(u16 *) (drv_data->rx) = read_RDBR(); | 556 | |
516 | write_FLAG(0xFF00 | chip->flag); | 557 | cs_deactive(drv_data, chip); |
517 | SSYNC(); | 558 | |
518 | if (chip->cs_chg_udelay) | ||
519 | udelay(chip->cs_chg_udelay); | ||
520 | drv_data->rx += 2; | 559 | drv_data->rx += 2; |
521 | drv_data->tx += 2; | 560 | drv_data->tx += 2; |
522 | } | 561 | } |
523 | write_FLAG(0xFF00); | ||
524 | SSYNC(); | ||
525 | } | 562 | } |
526 | 563 | ||
527 | /* test if ther is more transfer to be done */ | 564 | /* test if ther is more transfer to be done */ |
@@ -546,6 +583,7 @@ static void *next_transfer(struct driver_data *drv_data) | |||
546 | */ | 583 | */ |
547 | static void giveback(struct driver_data *drv_data) | 584 | static void giveback(struct driver_data *drv_data) |
548 | { | 585 | { |
586 | struct chip_data *chip = drv_data->cur_chip; | ||
549 | struct spi_transfer *last_transfer; | 587 | struct spi_transfer *last_transfer; |
550 | unsigned long flags; | 588 | unsigned long flags; |
551 | struct spi_message *msg; | 589 | struct spi_message *msg; |
@@ -565,10 +603,13 @@ static void giveback(struct driver_data *drv_data) | |||
565 | 603 | ||
566 | /* disable chip select signal. And not stop spi in autobuffer mode */ | 604 | /* disable chip select signal. And not stop spi in autobuffer mode */ |
567 | if (drv_data->tx_dma != 0xFFFF) { | 605 | if (drv_data->tx_dma != 0xFFFF) { |
568 | write_FLAG(0xFF00); | 606 | cs_deactive(drv_data, chip); |
569 | bfin_spi_disable(drv_data); | 607 | bfin_spi_disable(drv_data); |
570 | } | 608 | } |
571 | 609 | ||
610 | if (!drv_data->cs_change) | ||
611 | cs_deactive(drv_data, chip); | ||
612 | |||
572 | if (msg->complete) | 613 | if (msg->complete) |
573 | msg->complete(msg->context); | 614 | msg->complete(msg->context); |
574 | } | 615 | } |
@@ -576,14 +617,15 @@ static void giveback(struct driver_data *drv_data) | |||
576 | static irqreturn_t dma_irq_handler(int irq, void *dev_id) | 617 | static irqreturn_t dma_irq_handler(int irq, void *dev_id) |
577 | { | 618 | { |
578 | struct driver_data *drv_data = (struct driver_data *)dev_id; | 619 | struct driver_data *drv_data = (struct driver_data *)dev_id; |
620 | struct chip_data *chip = drv_data->cur_chip; | ||
579 | struct spi_message *msg = drv_data->cur_msg; | 621 | struct spi_message *msg = drv_data->cur_msg; |
580 | 622 | ||
581 | dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n"); | 623 | dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n"); |
582 | clear_dma_irqstat(CH_SPI); | 624 | clear_dma_irqstat(drv_data->dma_channel); |
583 | 625 | ||
584 | /* Wait for DMA to complete */ | 626 | /* Wait for DMA to complete */ |
585 | while (get_dma_curr_irqstat(CH_SPI) & DMA_RUN) | 627 | while (get_dma_curr_irqstat(drv_data->dma_channel) & DMA_RUN) |
586 | continue; | 628 | cpu_relax(); |
587 | 629 | ||
588 | /* | 630 | /* |
589 | * wait for the last transaction shifted out. HRM states: | 631 | * wait for the last transaction shifted out. HRM states: |
@@ -592,18 +634,19 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id) | |||
592 | * register until it goes low for 2 successive reads | 634 | * register until it goes low for 2 successive reads |
593 | */ | 635 | */ |
594 | if (drv_data->tx != NULL) { | 636 | if (drv_data->tx != NULL) { |
595 | while ((bfin_read_SPI_STAT() & TXS) || | 637 | while ((read_STAT(drv_data) & TXS) || |
596 | (bfin_read_SPI_STAT() & TXS)) | 638 | (read_STAT(drv_data) & TXS)) |
597 | continue; | 639 | cpu_relax(); |
598 | } | 640 | } |
599 | 641 | ||
600 | while (!(bfin_read_SPI_STAT() & SPIF)) | 642 | while (!(read_STAT(drv_data) & SPIF)) |
601 | continue; | 643 | cpu_relax(); |
602 | |||
603 | bfin_spi_disable(drv_data); | ||
604 | 644 | ||
605 | msg->actual_length += drv_data->len_in_bytes; | 645 | msg->actual_length += drv_data->len_in_bytes; |
606 | 646 | ||
647 | if (drv_data->cs_change) | ||
648 | cs_deactive(drv_data, chip); | ||
649 | |||
607 | /* Move to next transfer */ | 650 | /* Move to next transfer */ |
608 | msg->state = next_transfer(drv_data); | 651 | msg->state = next_transfer(drv_data); |
609 | 652 | ||
@@ -613,8 +656,8 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id) | |||
613 | /* free the irq handler before next transfer */ | 656 | /* free the irq handler before next transfer */ |
614 | dev_dbg(&drv_data->pdev->dev, | 657 | dev_dbg(&drv_data->pdev->dev, |
615 | "disable dma channel irq%d\n", | 658 | "disable dma channel irq%d\n", |
616 | CH_SPI); | 659 | drv_data->dma_channel); |
617 | dma_disable_irq(CH_SPI); | 660 | dma_disable_irq(drv_data->dma_channel); |
618 | 661 | ||
619 | return IRQ_HANDLED; | 662 | return IRQ_HANDLED; |
620 | } | 663 | } |
@@ -690,31 +733,67 @@ static void pump_transfers(unsigned long data) | |||
690 | drv_data->rx_dma = transfer->rx_dma; | 733 | drv_data->rx_dma = transfer->rx_dma; |
691 | drv_data->tx_dma = transfer->tx_dma; | 734 | drv_data->tx_dma = transfer->tx_dma; |
692 | drv_data->len_in_bytes = transfer->len; | 735 | drv_data->len_in_bytes = transfer->len; |
736 | drv_data->cs_change = transfer->cs_change; | ||
737 | |||
738 | /* Bits per word setup */ | ||
739 | switch (transfer->bits_per_word) { | ||
740 | case 8: | ||
741 | drv_data->n_bytes = 1; | ||
742 | width = CFG_SPI_WORDSIZE8; | ||
743 | drv_data->read = chip->cs_change_per_word ? | ||
744 | u8_cs_chg_reader : u8_reader; | ||
745 | drv_data->write = chip->cs_change_per_word ? | ||
746 | u8_cs_chg_writer : u8_writer; | ||
747 | drv_data->duplex = chip->cs_change_per_word ? | ||
748 | u8_cs_chg_duplex : u8_duplex; | ||
749 | break; | ||
750 | |||
751 | case 16: | ||
752 | drv_data->n_bytes = 2; | ||
753 | width = CFG_SPI_WORDSIZE16; | ||
754 | drv_data->read = chip->cs_change_per_word ? | ||
755 | u16_cs_chg_reader : u16_reader; | ||
756 | drv_data->write = chip->cs_change_per_word ? | ||
757 | u16_cs_chg_writer : u16_writer; | ||
758 | drv_data->duplex = chip->cs_change_per_word ? | ||
759 | u16_cs_chg_duplex : u16_duplex; | ||
760 | break; | ||
761 | |||
762 | default: | ||
763 | /* No change, the same as default setting */ | ||
764 | drv_data->n_bytes = chip->n_bytes; | ||
765 | width = chip->width; | ||
766 | drv_data->write = drv_data->tx ? chip->write : null_writer; | ||
767 | drv_data->read = drv_data->rx ? chip->read : null_reader; | ||
768 | drv_data->duplex = chip->duplex ? chip->duplex : null_writer; | ||
769 | break; | ||
770 | } | ||
771 | cr = (read_CTRL(drv_data) & (~BIT_CTL_TIMOD)); | ||
772 | cr |= (width << 8); | ||
773 | write_CTRL(drv_data, cr); | ||
693 | 774 | ||
694 | width = chip->width; | ||
695 | if (width == CFG_SPI_WORDSIZE16) { | 775 | if (width == CFG_SPI_WORDSIZE16) { |
696 | drv_data->len = (transfer->len) >> 1; | 776 | drv_data->len = (transfer->len) >> 1; |
697 | } else { | 777 | } else { |
698 | drv_data->len = transfer->len; | 778 | drv_data->len = transfer->len; |
699 | } | 779 | } |
700 | drv_data->write = drv_data->tx ? chip->write : null_writer; | 780 | dev_dbg(&drv_data->pdev->dev, "transfer: ", |
701 | drv_data->read = drv_data->rx ? chip->read : null_reader; | 781 | "drv_data->write is %p, chip->write is %p, null_wr is %p\n", |
702 | drv_data->duplex = chip->duplex ? chip->duplex : null_writer; | 782 | drv_data->write, chip->write, null_writer); |
703 | dev_dbg(&drv_data->pdev->dev, | ||
704 | "transfer: drv_data->write is %p, chip->write is %p, null_wr is %p\n", | ||
705 | drv_data->write, chip->write, null_writer); | ||
706 | 783 | ||
707 | /* speed and width has been set on per message */ | 784 | /* speed and width has been set on per message */ |
708 | message->state = RUNNING_STATE; | 785 | message->state = RUNNING_STATE; |
709 | dma_config = 0; | 786 | dma_config = 0; |
710 | 787 | ||
711 | /* restore spi status for each spi transfer */ | 788 | /* Speed setup (surely valid because already checked) */ |
712 | if (transfer->speed_hz) { | 789 | if (transfer->speed_hz) |
713 | write_BAUD(hz_to_spi_baud(transfer->speed_hz)); | 790 | write_BAUD(drv_data, hz_to_spi_baud(transfer->speed_hz)); |
714 | } else { | 791 | else |
715 | write_BAUD(chip->baud); | 792 | write_BAUD(drv_data, chip->baud); |
716 | } | 793 | |
717 | write_FLAG(chip->flag); | 794 | write_STAT(drv_data, BIT_STAT_CLR); |
795 | cr = (read_CTRL(drv_data) & (~BIT_CTL_TIMOD)); | ||
796 | cs_active(drv_data, chip); | ||
718 | 797 | ||
719 | dev_dbg(&drv_data->pdev->dev, | 798 | dev_dbg(&drv_data->pdev->dev, |
720 | "now pumping a transfer: width is %d, len is %d\n", | 799 | "now pumping a transfer: width is %d, len is %d\n", |
@@ -727,25 +806,25 @@ static void pump_transfers(unsigned long data) | |||
727 | */ | 806 | */ |
728 | if (drv_data->cur_chip->enable_dma && drv_data->len > 6) { | 807 | if (drv_data->cur_chip->enable_dma && drv_data->len > 6) { |
729 | 808 | ||
730 | write_STAT(BIT_STAT_CLR); | 809 | disable_dma(drv_data->dma_channel); |
731 | disable_dma(CH_SPI); | 810 | clear_dma_irqstat(drv_data->dma_channel); |
732 | clear_dma_irqstat(CH_SPI); | ||
733 | bfin_spi_disable(drv_data); | 811 | bfin_spi_disable(drv_data); |
734 | 812 | ||
735 | /* config dma channel */ | 813 | /* config dma channel */ |
736 | dev_dbg(&drv_data->pdev->dev, "doing dma transfer\n"); | 814 | dev_dbg(&drv_data->pdev->dev, "doing dma transfer\n"); |
737 | if (width == CFG_SPI_WORDSIZE16) { | 815 | if (width == CFG_SPI_WORDSIZE16) { |
738 | set_dma_x_count(CH_SPI, drv_data->len); | 816 | set_dma_x_count(drv_data->dma_channel, drv_data->len); |
739 | set_dma_x_modify(CH_SPI, 2); | 817 | set_dma_x_modify(drv_data->dma_channel, 2); |
740 | dma_width = WDSIZE_16; | 818 | dma_width = WDSIZE_16; |
741 | } else { | 819 | } else { |
742 | set_dma_x_count(CH_SPI, drv_data->len); | 820 | set_dma_x_count(drv_data->dma_channel, drv_data->len); |
743 | set_dma_x_modify(CH_SPI, 1); | 821 | set_dma_x_modify(drv_data->dma_channel, 1); |
744 | dma_width = WDSIZE_8; | 822 | dma_width = WDSIZE_8; |
745 | } | 823 | } |
746 | 824 | ||
747 | /* set transfer width,direction. And enable spi */ | 825 | /* poll for SPI completion before start */ |
748 | cr = (read_CTRL() & (~BIT_CTL_TIMOD)); | 826 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) |
827 | cpu_relax(); | ||
749 | 828 | ||
750 | /* dirty hack for autobuffer DMA mode */ | 829 | /* dirty hack for autobuffer DMA mode */ |
751 | if (drv_data->tx_dma == 0xFFFF) { | 830 | if (drv_data->tx_dma == 0xFFFF) { |
@@ -755,13 +834,18 @@ static void pump_transfers(unsigned long data) | |||
755 | /* no irq in autobuffer mode */ | 834 | /* no irq in autobuffer mode */ |
756 | dma_config = | 835 | dma_config = |
757 | (DMAFLOW_AUTO | RESTART | dma_width | DI_EN); | 836 | (DMAFLOW_AUTO | RESTART | dma_width | DI_EN); |
758 | set_dma_config(CH_SPI, dma_config); | 837 | set_dma_config(drv_data->dma_channel, dma_config); |
759 | set_dma_start_addr(CH_SPI, (unsigned long)drv_data->tx); | 838 | set_dma_start_addr(drv_data->dma_channel, |
760 | enable_dma(CH_SPI); | 839 | (unsigned long)drv_data->tx); |
761 | write_CTRL(cr | CFG_SPI_DMAWRITE | (width << 8) | | 840 | enable_dma(drv_data->dma_channel); |
762 | (CFG_SPI_ENABLE << 14)); | 841 | |
763 | 842 | /* start SPI transfer */ | |
764 | /* just return here, there can only be one transfer in this mode */ | 843 | write_CTRL(drv_data, |
844 | (cr | CFG_SPI_DMAWRITE | BIT_CTL_ENABLE)); | ||
845 | |||
846 | /* just return here, there can only be one transfer | ||
847 | * in this mode | ||
848 | */ | ||
765 | message->status = 0; | 849 | message->status = 0; |
766 | giveback(drv_data); | 850 | giveback(drv_data); |
767 | return; | 851 | return; |
@@ -772,58 +856,51 @@ static void pump_transfers(unsigned long data) | |||
772 | /* set transfer mode, and enable SPI */ | 856 | /* set transfer mode, and enable SPI */ |
773 | dev_dbg(&drv_data->pdev->dev, "doing DMA in.\n"); | 857 | dev_dbg(&drv_data->pdev->dev, "doing DMA in.\n"); |
774 | 858 | ||
775 | /* disable SPI before write to TDBR */ | ||
776 | write_CTRL(cr & ~BIT_CTL_ENABLE); | ||
777 | |||
778 | /* clear tx reg soformer data is not shifted out */ | 859 | /* clear tx reg soformer data is not shifted out */ |
779 | write_TDBR(0xFF); | 860 | write_TDBR(drv_data, 0xFFFF); |
780 | 861 | ||
781 | set_dma_x_count(CH_SPI, drv_data->len); | 862 | set_dma_x_count(drv_data->dma_channel, drv_data->len); |
782 | 863 | ||
783 | /* start dma */ | 864 | /* start dma */ |
784 | dma_enable_irq(CH_SPI); | 865 | dma_enable_irq(drv_data->dma_channel); |
785 | dma_config = (WNR | RESTART | dma_width | DI_EN); | 866 | dma_config = (WNR | RESTART | dma_width | DI_EN); |
786 | set_dma_config(CH_SPI, dma_config); | 867 | set_dma_config(drv_data->dma_channel, dma_config); |
787 | set_dma_start_addr(CH_SPI, (unsigned long)drv_data->rx); | 868 | set_dma_start_addr(drv_data->dma_channel, |
788 | enable_dma(CH_SPI); | 869 | (unsigned long)drv_data->rx); |
870 | enable_dma(drv_data->dma_channel); | ||
871 | |||
872 | /* start SPI transfer */ | ||
873 | write_CTRL(drv_data, | ||
874 | (cr | CFG_SPI_DMAREAD | BIT_CTL_ENABLE)); | ||
789 | 875 | ||
790 | cr |= | ||
791 | CFG_SPI_DMAREAD | (width << 8) | (CFG_SPI_ENABLE << | ||
792 | 14); | ||
793 | /* set transfer mode, and enable SPI */ | ||
794 | write_CTRL(cr); | ||
795 | } else if (drv_data->tx != NULL) { | 876 | } else if (drv_data->tx != NULL) { |
796 | dev_dbg(&drv_data->pdev->dev, "doing DMA out.\n"); | 877 | dev_dbg(&drv_data->pdev->dev, "doing DMA out.\n"); |
797 | 878 | ||
798 | /* start dma */ | 879 | /* start dma */ |
799 | dma_enable_irq(CH_SPI); | 880 | dma_enable_irq(drv_data->dma_channel); |
800 | dma_config = (RESTART | dma_width | DI_EN); | 881 | dma_config = (RESTART | dma_width | DI_EN); |
801 | set_dma_config(CH_SPI, dma_config); | 882 | set_dma_config(drv_data->dma_channel, dma_config); |
802 | set_dma_start_addr(CH_SPI, (unsigned long)drv_data->tx); | 883 | set_dma_start_addr(drv_data->dma_channel, |
803 | enable_dma(CH_SPI); | 884 | (unsigned long)drv_data->tx); |
804 | 885 | enable_dma(drv_data->dma_channel); | |
805 | write_CTRL(cr | CFG_SPI_DMAWRITE | (width << 8) | | 886 | |
806 | (CFG_SPI_ENABLE << 14)); | 887 | /* start SPI transfer */ |
807 | 888 | write_CTRL(drv_data, | |
889 | (cr | CFG_SPI_DMAWRITE | BIT_CTL_ENABLE)); | ||
808 | } | 890 | } |
809 | } else { | 891 | } else { |
810 | /* IO mode write then read */ | 892 | /* IO mode write then read */ |
811 | dev_dbg(&drv_data->pdev->dev, "doing IO transfer\n"); | 893 | dev_dbg(&drv_data->pdev->dev, "doing IO transfer\n"); |
812 | 894 | ||
813 | write_STAT(BIT_STAT_CLR); | ||
814 | |||
815 | if (drv_data->tx != NULL && drv_data->rx != NULL) { | 895 | if (drv_data->tx != NULL && drv_data->rx != NULL) { |
816 | /* full duplex mode */ | 896 | /* full duplex mode */ |
817 | BUG_ON((drv_data->tx_end - drv_data->tx) != | 897 | BUG_ON((drv_data->tx_end - drv_data->tx) != |
818 | (drv_data->rx_end - drv_data->rx)); | 898 | (drv_data->rx_end - drv_data->rx)); |
819 | cr = (read_CTRL() & (~BIT_CTL_TIMOD)); | ||
820 | cr |= CFG_SPI_WRITE | (width << 8) | | ||
821 | (CFG_SPI_ENABLE << 14); | ||
822 | dev_dbg(&drv_data->pdev->dev, | 899 | dev_dbg(&drv_data->pdev->dev, |
823 | "IO duplex: cr is 0x%x\n", cr); | 900 | "IO duplex: cr is 0x%x\n", cr); |
824 | 901 | ||
825 | write_CTRL(cr); | 902 | /* set SPI transfer mode */ |
826 | SSYNC(); | 903 | write_CTRL(drv_data, (cr | CFG_SPI_WRITE)); |
827 | 904 | ||
828 | drv_data->duplex(drv_data); | 905 | drv_data->duplex(drv_data); |
829 | 906 | ||
@@ -831,14 +908,11 @@ static void pump_transfers(unsigned long data) | |||
831 | tranf_success = 0; | 908 | tranf_success = 0; |
832 | } else if (drv_data->tx != NULL) { | 909 | } else if (drv_data->tx != NULL) { |
833 | /* write only half duplex */ | 910 | /* write only half duplex */ |
834 | cr = (read_CTRL() & (~BIT_CTL_TIMOD)); | 911 | dev_dbg(&drv_data->pdev->dev, |
835 | cr |= CFG_SPI_WRITE | (width << 8) | | ||
836 | (CFG_SPI_ENABLE << 14); | ||
837 | dev_dbg(&drv_data->pdev->dev, | ||
838 | "IO write: cr is 0x%x\n", cr); | 912 | "IO write: cr is 0x%x\n", cr); |
839 | 913 | ||
840 | write_CTRL(cr); | 914 | /* set SPI transfer mode */ |
841 | SSYNC(); | 915 | write_CTRL(drv_data, (cr | CFG_SPI_WRITE)); |
842 | 916 | ||
843 | drv_data->write(drv_data); | 917 | drv_data->write(drv_data); |
844 | 918 | ||
@@ -846,14 +920,11 @@ static void pump_transfers(unsigned long data) | |||
846 | tranf_success = 0; | 920 | tranf_success = 0; |
847 | } else if (drv_data->rx != NULL) { | 921 | } else if (drv_data->rx != NULL) { |
848 | /* read only half duplex */ | 922 | /* read only half duplex */ |
849 | cr = (read_CTRL() & (~BIT_CTL_TIMOD)); | 923 | dev_dbg(&drv_data->pdev->dev, |
850 | cr |= CFG_SPI_READ | (width << 8) | | ||
851 | (CFG_SPI_ENABLE << 14); | ||
852 | dev_dbg(&drv_data->pdev->dev, | ||
853 | "IO read: cr is 0x%x\n", cr); | 924 | "IO read: cr is 0x%x\n", cr); |
854 | 925 | ||
855 | write_CTRL(cr); | 926 | /* set SPI transfer mode */ |
856 | SSYNC(); | 927 | write_CTRL(drv_data, (cr | CFG_SPI_READ)); |
857 | 928 | ||
858 | drv_data->read(drv_data); | 929 | drv_data->read(drv_data); |
859 | if (drv_data->rx != drv_data->rx_end) | 930 | if (drv_data->rx != drv_data->rx_end) |
@@ -861,7 +932,7 @@ static void pump_transfers(unsigned long data) | |||
861 | } | 932 | } |
862 | 933 | ||
863 | if (!tranf_success) { | 934 | if (!tranf_success) { |
864 | dev_dbg(&drv_data->pdev->dev, | 935 | dev_dbg(&drv_data->pdev->dev, |
865 | "IO write error!\n"); | 936 | "IO write error!\n"); |
866 | message->state = ERROR_STATE; | 937 | message->state = ERROR_STATE; |
867 | } else { | 938 | } else { |
@@ -881,9 +952,11 @@ static void pump_transfers(unsigned long data) | |||
881 | /* pop a msg from queue and kick off real transfer */ | 952 | /* pop a msg from queue and kick off real transfer */ |
882 | static void pump_messages(struct work_struct *work) | 953 | static void pump_messages(struct work_struct *work) |
883 | { | 954 | { |
884 | struct driver_data *drv_data = container_of(work, struct driver_data, pump_messages); | 955 | struct driver_data *drv_data; |
885 | unsigned long flags; | 956 | unsigned long flags; |
886 | 957 | ||
958 | drv_data = container_of(work, struct driver_data, pump_messages); | ||
959 | |||
887 | /* Lock queue and check for queue work */ | 960 | /* Lock queue and check for queue work */ |
888 | spin_lock_irqsave(&drv_data->lock, flags); | 961 | spin_lock_irqsave(&drv_data->lock, flags); |
889 | if (list_empty(&drv_data->queue) || drv_data->run == QUEUE_STOPPED) { | 962 | if (list_empty(&drv_data->queue) || drv_data->run == QUEUE_STOPPED) { |
@@ -902,6 +975,14 @@ static void pump_messages(struct work_struct *work) | |||
902 | /* Extract head of queue */ | 975 | /* Extract head of queue */ |
903 | drv_data->cur_msg = list_entry(drv_data->queue.next, | 976 | drv_data->cur_msg = list_entry(drv_data->queue.next, |
904 | struct spi_message, queue); | 977 | struct spi_message, queue); |
978 | |||
979 | /* Setup the SSP using the per chip configuration */ | ||
980 | drv_data->cur_chip = spi_get_ctldata(drv_data->cur_msg->spi); | ||
981 | if (restore_state(drv_data)) { | ||
982 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
983 | return; | ||
984 | }; | ||
985 | |||
905 | list_del_init(&drv_data->cur_msg->queue); | 986 | list_del_init(&drv_data->cur_msg->queue); |
906 | 987 | ||
907 | /* Initial message state */ | 988 | /* Initial message state */ |
@@ -909,15 +990,12 @@ static void pump_messages(struct work_struct *work) | |||
909 | drv_data->cur_transfer = list_entry(drv_data->cur_msg->transfers.next, | 990 | drv_data->cur_transfer = list_entry(drv_data->cur_msg->transfers.next, |
910 | struct spi_transfer, transfer_list); | 991 | struct spi_transfer, transfer_list); |
911 | 992 | ||
912 | /* Setup the SSP using the per chip configuration */ | 993 | dev_dbg(&drv_data->pdev->dev, "got a message to pump, " |
913 | drv_data->cur_chip = spi_get_ctldata(drv_data->cur_msg->spi); | 994 | "state is set to: baud %d, flag 0x%x, ctl 0x%x\n", |
914 | restore_state(drv_data); | 995 | drv_data->cur_chip->baud, drv_data->cur_chip->flag, |
996 | drv_data->cur_chip->ctl_reg); | ||
997 | |||
915 | dev_dbg(&drv_data->pdev->dev, | 998 | dev_dbg(&drv_data->pdev->dev, |
916 | "got a message to pump, state is set to: baud %d, flag 0x%x, ctl 0x%x\n", | ||
917 | drv_data->cur_chip->baud, drv_data->cur_chip->flag, | ||
918 | drv_data->cur_chip->ctl_reg); | ||
919 | |||
920 | dev_dbg(&drv_data->pdev->dev, | ||
921 | "the first transfer len is %d\n", | 999 | "the first transfer len is %d\n", |
922 | drv_data->cur_transfer->len); | 1000 | drv_data->cur_transfer->len); |
923 | 1001 | ||
@@ -959,6 +1037,22 @@ static int transfer(struct spi_device *spi, struct spi_message *msg) | |||
959 | return 0; | 1037 | return 0; |
960 | } | 1038 | } |
961 | 1039 | ||
1040 | #define MAX_SPI_SSEL 7 | ||
1041 | |||
1042 | static u16 ssel[3][MAX_SPI_SSEL] = { | ||
1043 | {P_SPI0_SSEL1, P_SPI0_SSEL2, P_SPI0_SSEL3, | ||
1044 | P_SPI0_SSEL4, P_SPI0_SSEL5, | ||
1045 | P_SPI0_SSEL6, P_SPI0_SSEL7}, | ||
1046 | |||
1047 | {P_SPI1_SSEL1, P_SPI1_SSEL2, P_SPI1_SSEL3, | ||
1048 | P_SPI1_SSEL4, P_SPI1_SSEL5, | ||
1049 | P_SPI1_SSEL6, P_SPI1_SSEL7}, | ||
1050 | |||
1051 | {P_SPI2_SSEL1, P_SPI2_SSEL2, P_SPI2_SSEL3, | ||
1052 | P_SPI2_SSEL4, P_SPI2_SSEL5, | ||
1053 | P_SPI2_SSEL6, P_SPI2_SSEL7}, | ||
1054 | }; | ||
1055 | |||
962 | /* first setup for new devices */ | 1056 | /* first setup for new devices */ |
963 | static int setup(struct spi_device *spi) | 1057 | static int setup(struct spi_device *spi) |
964 | { | 1058 | { |
@@ -993,6 +1087,18 @@ static int setup(struct spi_device *spi) | |||
993 | 1087 | ||
994 | /* chip_info isn't always needed */ | 1088 | /* chip_info isn't always needed */ |
995 | if (chip_info) { | 1089 | if (chip_info) { |
1090 | /* Make sure people stop trying to set fields via ctl_reg | ||
1091 | * when they should actually be using common SPI framework. | ||
1092 | * Currently we let through: WOM EMISO PSSE GM SZ TIMOD. | ||
1093 | * Not sure if a user actually needs/uses any of these, | ||
1094 | * but let's assume (for now) they do. | ||
1095 | */ | ||
1096 | if (chip_info->ctl_reg & (SPE|MSTR|CPOL|CPHA|LSBF|SIZE)) { | ||
1097 | dev_err(&spi->dev, "do not set bits in ctl_reg " | ||
1098 | "that the SPI framework manages\n"); | ||
1099 | return -EINVAL; | ||
1100 | } | ||
1101 | |||
996 | chip->enable_dma = chip_info->enable_dma != 0 | 1102 | chip->enable_dma = chip_info->enable_dma != 0 |
997 | && drv_data->master_info->enable_dma; | 1103 | && drv_data->master_info->enable_dma; |
998 | chip->ctl_reg = chip_info->ctl_reg; | 1104 | chip->ctl_reg = chip_info->ctl_reg; |
@@ -1015,20 +1121,20 @@ static int setup(struct spi_device *spi) | |||
1015 | * if any one SPI chip is registered and wants DMA, request the | 1121 | * if any one SPI chip is registered and wants DMA, request the |
1016 | * DMA channel for it | 1122 | * DMA channel for it |
1017 | */ | 1123 | */ |
1018 | if (chip->enable_dma && !dma_requested) { | 1124 | if (chip->enable_dma && !drv_data->dma_requested) { |
1019 | /* register dma irq handler */ | 1125 | /* register dma irq handler */ |
1020 | if (request_dma(CH_SPI, "BF53x_SPI_DMA") < 0) { | 1126 | if (request_dma(drv_data->dma_channel, "BF53x_SPI_DMA") < 0) { |
1021 | dev_dbg(&spi->dev, | 1127 | dev_dbg(&spi->dev, |
1022 | "Unable to request BlackFin SPI DMA channel\n"); | 1128 | "Unable to request BlackFin SPI DMA channel\n"); |
1023 | return -ENODEV; | 1129 | return -ENODEV; |
1024 | } | 1130 | } |
1025 | if (set_dma_callback(CH_SPI, (void *)dma_irq_handler, drv_data) | 1131 | if (set_dma_callback(drv_data->dma_channel, |
1026 | < 0) { | 1132 | (void *)dma_irq_handler, drv_data) < 0) { |
1027 | dev_dbg(&spi->dev, "Unable to set dma callback\n"); | 1133 | dev_dbg(&spi->dev, "Unable to set dma callback\n"); |
1028 | return -EPERM; | 1134 | return -EPERM; |
1029 | } | 1135 | } |
1030 | dma_disable_irq(CH_SPI); | 1136 | dma_disable_irq(drv_data->dma_channel); |
1031 | dma_requested = 1; | 1137 | drv_data->dma_requested = 1; |
1032 | } | 1138 | } |
1033 | 1139 | ||
1034 | /* | 1140 | /* |
@@ -1077,6 +1183,14 @@ static int setup(struct spi_device *spi) | |||
1077 | 1183 | ||
1078 | spi_set_ctldata(spi, chip); | 1184 | spi_set_ctldata(spi, chip); |
1079 | 1185 | ||
1186 | dev_dbg(&spi->dev, "chip select number is %d\n", chip->chip_select_num); | ||
1187 | if ((chip->chip_select_num > 0) | ||
1188 | && (chip->chip_select_num <= spi->master->num_chipselect)) | ||
1189 | peripheral_request(ssel[spi->master->bus_num] | ||
1190 | [chip->chip_select_num-1], DRV_NAME); | ||
1191 | |||
1192 | cs_deactive(drv_data, chip); | ||
1193 | |||
1080 | return 0; | 1194 | return 0; |
1081 | } | 1195 | } |
1082 | 1196 | ||
@@ -1088,6 +1202,11 @@ static void cleanup(struct spi_device *spi) | |||
1088 | { | 1202 | { |
1089 | struct chip_data *chip = spi_get_ctldata(spi); | 1203 | struct chip_data *chip = spi_get_ctldata(spi); |
1090 | 1204 | ||
1205 | if ((chip->chip_select_num > 0) | ||
1206 | && (chip->chip_select_num <= spi->master->num_chipselect)) | ||
1207 | peripheral_free(ssel[spi->master->bus_num] | ||
1208 | [chip->chip_select_num-1]); | ||
1209 | |||
1091 | kfree(chip); | 1210 | kfree(chip); |
1092 | } | 1211 | } |
1093 | 1212 | ||
@@ -1183,6 +1302,7 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) | |||
1183 | struct bfin5xx_spi_master *platform_info; | 1302 | struct bfin5xx_spi_master *platform_info; |
1184 | struct spi_master *master; | 1303 | struct spi_master *master; |
1185 | struct driver_data *drv_data = 0; | 1304 | struct driver_data *drv_data = 0; |
1305 | struct resource *res; | ||
1186 | int status = 0; | 1306 | int status = 0; |
1187 | 1307 | ||
1188 | platform_info = dev->platform_data; | 1308 | platform_info = dev->platform_data; |
@@ -1193,10 +1313,12 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) | |||
1193 | dev_err(&pdev->dev, "can not alloc spi_master\n"); | 1313 | dev_err(&pdev->dev, "can not alloc spi_master\n"); |
1194 | return -ENOMEM; | 1314 | return -ENOMEM; |
1195 | } | 1315 | } |
1316 | |||
1196 | drv_data = spi_master_get_devdata(master); | 1317 | drv_data = spi_master_get_devdata(master); |
1197 | drv_data->master = master; | 1318 | drv_data->master = master; |
1198 | drv_data->master_info = platform_info; | 1319 | drv_data->master_info = platform_info; |
1199 | drv_data->pdev = pdev; | 1320 | drv_data->pdev = pdev; |
1321 | drv_data->pin_req = platform_info->pin_req; | ||
1200 | 1322 | ||
1201 | master->bus_num = pdev->id; | 1323 | master->bus_num = pdev->id; |
1202 | master->num_chipselect = platform_info->num_chipselect; | 1324 | master->num_chipselect = platform_info->num_chipselect; |
@@ -1204,15 +1326,38 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) | |||
1204 | master->setup = setup; | 1326 | master->setup = setup; |
1205 | master->transfer = transfer; | 1327 | master->transfer = transfer; |
1206 | 1328 | ||
1329 | /* Find and map our resources */ | ||
1330 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1331 | if (res == NULL) { | ||
1332 | dev_err(dev, "Cannot get IORESOURCE_MEM\n"); | ||
1333 | status = -ENOENT; | ||
1334 | goto out_error_get_res; | ||
1335 | } | ||
1336 | |||
1337 | drv_data->regs_base = ioremap(res->start, (res->end - res->start + 1)); | ||
1338 | if (drv_data->regs_base == NULL) { | ||
1339 | dev_err(dev, "Cannot map IO\n"); | ||
1340 | status = -ENXIO; | ||
1341 | goto out_error_ioremap; | ||
1342 | } | ||
1343 | |||
1344 | drv_data->dma_channel = platform_get_irq(pdev, 0); | ||
1345 | if (drv_data->dma_channel < 0) { | ||
1346 | dev_err(dev, "No DMA channel specified\n"); | ||
1347 | status = -ENOENT; | ||
1348 | goto out_error_no_dma_ch; | ||
1349 | } | ||
1350 | |||
1207 | /* Initial and start queue */ | 1351 | /* Initial and start queue */ |
1208 | status = init_queue(drv_data); | 1352 | status = init_queue(drv_data); |
1209 | if (status != 0) { | 1353 | if (status != 0) { |
1210 | dev_err(&pdev->dev, "problem initializing queue\n"); | 1354 | dev_err(dev, "problem initializing queue\n"); |
1211 | goto out_error_queue_alloc; | 1355 | goto out_error_queue_alloc; |
1212 | } | 1356 | } |
1357 | |||
1213 | status = start_queue(drv_data); | 1358 | status = start_queue(drv_data); |
1214 | if (status != 0) { | 1359 | if (status != 0) { |
1215 | dev_err(&pdev->dev, "problem starting queue\n"); | 1360 | dev_err(dev, "problem starting queue\n"); |
1216 | goto out_error_queue_alloc; | 1361 | goto out_error_queue_alloc; |
1217 | } | 1362 | } |
1218 | 1363 | ||
@@ -1220,15 +1365,30 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) | |||
1220 | platform_set_drvdata(pdev, drv_data); | 1365 | platform_set_drvdata(pdev, drv_data); |
1221 | status = spi_register_master(master); | 1366 | status = spi_register_master(master); |
1222 | if (status != 0) { | 1367 | if (status != 0) { |
1223 | dev_err(&pdev->dev, "problem registering spi master\n"); | 1368 | dev_err(dev, "problem registering spi master\n"); |
1224 | goto out_error_queue_alloc; | 1369 | goto out_error_queue_alloc; |
1225 | } | 1370 | } |
1226 | dev_dbg(&pdev->dev, "controller probe successfully\n"); | 1371 | |
1372 | status = peripheral_request_list(drv_data->pin_req, DRV_NAME); | ||
1373 | if (status != 0) { | ||
1374 | dev_err(&pdev->dev, ": Requesting Peripherals failed\n"); | ||
1375 | goto out_error; | ||
1376 | } | ||
1377 | |||
1378 | dev_info(dev, "%s, Version %s, regs_base@%p, dma channel@%d\n", | ||
1379 | DRV_DESC, DRV_VERSION, drv_data->regs_base, | ||
1380 | drv_data->dma_channel); | ||
1227 | return status; | 1381 | return status; |
1228 | 1382 | ||
1229 | out_error_queue_alloc: | 1383 | out_error_queue_alloc: |
1230 | destroy_queue(drv_data); | 1384 | destroy_queue(drv_data); |
1385 | out_error_no_dma_ch: | ||
1386 | iounmap((void *) drv_data->regs_base); | ||
1387 | out_error_ioremap: | ||
1388 | out_error_get_res: | ||
1389 | out_error: | ||
1231 | spi_master_put(master); | 1390 | spi_master_put(master); |
1391 | |||
1232 | return status; | 1392 | return status; |
1233 | } | 1393 | } |
1234 | 1394 | ||
@@ -1251,13 +1411,15 @@ static int __devexit bfin5xx_spi_remove(struct platform_device *pdev) | |||
1251 | 1411 | ||
1252 | /* Release DMA */ | 1412 | /* Release DMA */ |
1253 | if (drv_data->master_info->enable_dma) { | 1413 | if (drv_data->master_info->enable_dma) { |
1254 | if (dma_channel_active(CH_SPI)) | 1414 | if (dma_channel_active(drv_data->dma_channel)) |
1255 | free_dma(CH_SPI); | 1415 | free_dma(drv_data->dma_channel); |
1256 | } | 1416 | } |
1257 | 1417 | ||
1258 | /* Disconnect from the SPI framework */ | 1418 | /* Disconnect from the SPI framework */ |
1259 | spi_unregister_master(drv_data->master); | 1419 | spi_unregister_master(drv_data->master); |
1260 | 1420 | ||
1421 | peripheral_free_list(drv_data->pin_req); | ||
1422 | |||
1261 | /* Prevent double remove */ | 1423 | /* Prevent double remove */ |
1262 | platform_set_drvdata(pdev, NULL); | 1424 | platform_set_drvdata(pdev, NULL); |
1263 | 1425 | ||
@@ -1305,7 +1467,7 @@ static int bfin5xx_spi_resume(struct platform_device *pdev) | |||
1305 | MODULE_ALIAS("bfin-spi-master"); /* for platform bus hotplug */ | 1467 | MODULE_ALIAS("bfin-spi-master"); /* for platform bus hotplug */ |
1306 | static struct platform_driver bfin5xx_spi_driver = { | 1468 | static struct platform_driver bfin5xx_spi_driver = { |
1307 | .driver = { | 1469 | .driver = { |
1308 | .name = "bfin-spi-master", | 1470 | .name = DRV_NAME, |
1309 | .owner = THIS_MODULE, | 1471 | .owner = THIS_MODULE, |
1310 | }, | 1472 | }, |
1311 | .suspend = bfin5xx_spi_suspend, | 1473 | .suspend = bfin5xx_spi_suspend, |
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index 7686ba34430f..2cd8573fb09c 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c | |||
@@ -1758,5 +1758,5 @@ static void __exit spi_imx_exit(void) | |||
1758 | module_exit(spi_imx_exit); | 1758 | module_exit(spi_imx_exit); |
1759 | 1759 | ||
1760 | MODULE_AUTHOR("Andrea Paterniani, <a.paterniani@swapp-eng.it>"); | 1760 | MODULE_AUTHOR("Andrea Paterniani, <a.paterniani@swapp-eng.it>"); |
1761 | MODULE_DESCRIPTION("iMX SPI Contoller Driver"); | 1761 | MODULE_DESCRIPTION("iMX SPI Controller Driver"); |
1762 | MODULE_LICENSE("GPL"); | 1762 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c index 0fa25e2e80fe..109d82c1abc0 100644 --- a/drivers/spi/spi_s3c24xx_gpio.c +++ b/drivers/spi/spi_s3c24xx_gpio.c | |||
@@ -96,6 +96,7 @@ static void s3c2410_spigpio_chipselect(struct spi_device *dev, int value) | |||
96 | 96 | ||
97 | static int s3c2410_spigpio_probe(struct platform_device *dev) | 97 | static int s3c2410_spigpio_probe(struct platform_device *dev) |
98 | { | 98 | { |
99 | struct s3c2410_spigpio_info *info; | ||
99 | struct spi_master *master; | 100 | struct spi_master *master; |
100 | struct s3c2410_spigpio *sp; | 101 | struct s3c2410_spigpio *sp; |
101 | int ret; | 102 | int ret; |
@@ -113,10 +114,11 @@ static int s3c2410_spigpio_probe(struct platform_device *dev) | |||
113 | platform_set_drvdata(dev, sp); | 114 | platform_set_drvdata(dev, sp); |
114 | 115 | ||
115 | /* copy in the plkatform data */ | 116 | /* copy in the plkatform data */ |
116 | sp->info = dev->dev.platform_data; | 117 | info = sp->info = dev->dev.platform_data; |
117 | 118 | ||
118 | /* setup spi bitbang adaptor */ | 119 | /* setup spi bitbang adaptor */ |
119 | sp->bitbang.master = spi_master_get(master); | 120 | sp->bitbang.master = spi_master_get(master); |
121 | sp->bitbang.master->bus_num = info->bus_num; | ||
120 | sp->bitbang.chipselect = s3c2410_spigpio_chipselect; | 122 | sp->bitbang.chipselect = s3c2410_spigpio_chipselect; |
121 | 123 | ||
122 | sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0; | 124 | sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0; |
@@ -124,13 +126,18 @@ static int s3c2410_spigpio_probe(struct platform_device *dev) | |||
124 | sp->bitbang.txrx_word[SPI_MODE_2] = s3c2410_spigpio_txrx_mode2; | 126 | sp->bitbang.txrx_word[SPI_MODE_2] = s3c2410_spigpio_txrx_mode2; |
125 | sp->bitbang.txrx_word[SPI_MODE_3] = s3c2410_spigpio_txrx_mode3; | 127 | sp->bitbang.txrx_word[SPI_MODE_3] = s3c2410_spigpio_txrx_mode3; |
126 | 128 | ||
127 | /* set state of spi pins */ | 129 | /* set state of spi pins, always assume that the clock is |
128 | s3c2410_gpio_setpin(sp->info->pin_clk, 0); | 130 | * available, but do check the MOSI and MISO. */ |
129 | s3c2410_gpio_setpin(sp->info->pin_mosi, 0); | 131 | s3c2410_gpio_setpin(info->pin_clk, 0); |
132 | s3c2410_gpio_cfgpin(info->pin_clk, S3C2410_GPIO_OUTPUT); | ||
130 | 133 | ||
131 | s3c2410_gpio_cfgpin(sp->info->pin_clk, S3C2410_GPIO_OUTPUT); | 134 | if (info->pin_mosi < S3C2410_GPH10) { |
132 | s3c2410_gpio_cfgpin(sp->info->pin_mosi, S3C2410_GPIO_OUTPUT); | 135 | s3c2410_gpio_setpin(info->pin_mosi, 0); |
133 | s3c2410_gpio_cfgpin(sp->info->pin_miso, S3C2410_GPIO_INPUT); | 136 | s3c2410_gpio_cfgpin(info->pin_mosi, S3C2410_GPIO_OUTPUT); |
137 | } | ||
138 | |||
139 | if (info->pin_miso != S3C2410_GPA0 && info->pin_miso < S3C2410_GPH10) | ||
140 | s3c2410_gpio_cfgpin(info->pin_miso, S3C2410_GPIO_INPUT); | ||
134 | 141 | ||
135 | ret = spi_bitbang_start(&sp->bitbang); | 142 | ret = spi_bitbang_start(&sp->bitbang); |
136 | if (ret) | 143 | if (ret) |
diff --git a/drivers/usb/README b/drivers/usb/README index 3c8434128554..284f46b3e1cc 100644 --- a/drivers/usb/README +++ b/drivers/usb/README | |||
@@ -39,12 +39,12 @@ first subdirectory in the list below that it fits into. | |||
39 | 39 | ||
40 | image/ - This is for still image drivers, like scanners or | 40 | image/ - This is for still image drivers, like scanners or |
41 | digital cameras. | 41 | digital cameras. |
42 | input/ - This is for any driver that uses the input subsystem, | 42 | ../input/ - This is for any driver that uses the input subsystem, |
43 | like keyboard, mice, touchscreens, tablets, etc. | 43 | like keyboard, mice, touchscreens, tablets, etc. |
44 | media/ - This is for multimedia drivers, like video cameras, | 44 | ../media/ - This is for multimedia drivers, like video cameras, |
45 | radios, and any other drivers that talk to the v4l | 45 | radios, and any other drivers that talk to the v4l |
46 | subsystem. | 46 | subsystem. |
47 | net/ - This is for network drivers. | 47 | ../net/ - This is for network drivers. |
48 | serial/ - This is for USB to serial drivers. | 48 | serial/ - This is for USB to serial drivers. |
49 | storage/ - This is for USB mass-storage drivers. | 49 | storage/ - This is for USB mass-storage drivers. |
50 | class/ - This is for all USB device drivers that do not fit | 50 | class/ - This is for all USB device drivers that do not fit |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 8586817698ad..c51f8e9312e0 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -585,9 +585,6 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
585 | { | 585 | { |
586 | struct usb_device *usb_dev; | 586 | struct usb_device *usb_dev; |
587 | 587 | ||
588 | if (!dev) | ||
589 | return -ENODEV; | ||
590 | |||
591 | /* driver is often null here; dev_dbg() would oops */ | 588 | /* driver is often null here; dev_dbg() would oops */ |
592 | pr_debug ("usb %s: uevent\n", dev->bus_id); | 589 | pr_debug ("usb %s: uevent\n", dev->bus_id); |
593 | 590 | ||
@@ -631,14 +628,6 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
631 | usb_dev->descriptor.bDeviceProtocol)) | 628 | usb_dev->descriptor.bDeviceProtocol)) |
632 | return -ENOMEM; | 629 | return -ENOMEM; |
633 | 630 | ||
634 | if (add_uevent_var(env, "BUSNUM=%03d", | ||
635 | usb_dev->bus->busnum)) | ||
636 | return -ENOMEM; | ||
637 | |||
638 | if (add_uevent_var(env, "DEVNUM=%03d", | ||
639 | usb_dev->devnum)) | ||
640 | return -ENOMEM; | ||
641 | |||
642 | return 0; | 631 | return 0; |
643 | } | 632 | } |
644 | 633 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index fea8256a18d6..d5ed3fa9e304 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1311,8 +1311,8 @@ void usb_hcd_flush_endpoint(struct usb_device *udev, | |||
1311 | hcd = bus_to_hcd(udev->bus); | 1311 | hcd = bus_to_hcd(udev->bus); |
1312 | 1312 | ||
1313 | /* No more submits can occur */ | 1313 | /* No more submits can occur */ |
1314 | rescan: | ||
1315 | spin_lock_irq(&hcd_urb_list_lock); | 1314 | spin_lock_irq(&hcd_urb_list_lock); |
1315 | rescan: | ||
1316 | list_for_each_entry (urb, &ep->urb_list, urb_list) { | 1316 | list_for_each_entry (urb, &ep->urb_list, urb_list) { |
1317 | int is_in; | 1317 | int is_in; |
1318 | 1318 | ||
@@ -1345,6 +1345,7 @@ rescan: | |||
1345 | usb_put_urb (urb); | 1345 | usb_put_urb (urb); |
1346 | 1346 | ||
1347 | /* list contents may have changed */ | 1347 | /* list contents may have changed */ |
1348 | spin_lock(&hcd_urb_list_lock); | ||
1348 | goto rescan; | 1349 | goto rescan; |
1349 | } | 1350 | } |
1350 | spin_unlock_irq(&hcd_urb_list_lock); | 1351 | spin_unlock_irq(&hcd_urb_list_lock); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 036c3dea855e..13b326a13377 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -335,7 +335,7 @@ static void kick_khubd(struct usb_hub *hub) | |||
335 | to_usb_interface(hub->intfdev)->pm_usage_cnt = 1; | 335 | to_usb_interface(hub->intfdev)->pm_usage_cnt = 1; |
336 | 336 | ||
337 | spin_lock_irqsave(&hub_event_lock, flags); | 337 | spin_lock_irqsave(&hub_event_lock, flags); |
338 | if (!hub->disconnected & list_empty(&hub->event_list)) { | 338 | if (!hub->disconnected && list_empty(&hub->event_list)) { |
339 | list_add_tail(&hub->event_list, &hub_event_list); | 339 | list_add_tail(&hub->event_list, &hub_event_list); |
340 | wake_up(&khubd_wait); | 340 | wake_up(&khubd_wait); |
341 | } | 341 | } |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 316a746e0080..fcd40ecbeecc 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1172,7 +1172,6 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1172 | struct usb_host_interface *alt; | 1172 | struct usb_host_interface *alt; |
1173 | int ret; | 1173 | int ret; |
1174 | int manual = 0; | 1174 | int manual = 0; |
1175 | int changed; | ||
1176 | 1175 | ||
1177 | if (dev->state == USB_STATE_SUSPENDED) | 1176 | if (dev->state == USB_STATE_SUSPENDED) |
1178 | return -EHOSTUNREACH; | 1177 | return -EHOSTUNREACH; |
@@ -1212,8 +1211,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1212 | */ | 1211 | */ |
1213 | 1212 | ||
1214 | /* prevent submissions using previous endpoint settings */ | 1213 | /* prevent submissions using previous endpoint settings */ |
1215 | changed = (iface->cur_altsetting != alt); | 1214 | if (iface->cur_altsetting != alt && device_is_registered(&iface->dev)) |
1216 | if (changed && device_is_registered(&iface->dev)) | ||
1217 | usb_remove_sysfs_intf_files(iface); | 1215 | usb_remove_sysfs_intf_files(iface); |
1218 | usb_disable_interface(dev, iface); | 1216 | usb_disable_interface(dev, iface); |
1219 | 1217 | ||
@@ -1250,7 +1248,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1250 | * (Likewise, EP0 never "halts" on well designed devices.) | 1248 | * (Likewise, EP0 never "halts" on well designed devices.) |
1251 | */ | 1249 | */ |
1252 | usb_enable_interface(dev, iface); | 1250 | usb_enable_interface(dev, iface); |
1253 | if (changed && device_is_registered(&iface->dev)) | 1251 | if (device_is_registered(&iface->dev)) |
1254 | usb_create_sysfs_intf_files(iface); | 1252 | usb_create_sysfs_intf_files(iface); |
1255 | 1253 | ||
1256 | return 0; | 1254 | return 0; |
@@ -1348,34 +1346,10 @@ static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
1348 | struct usb_interface *intf; | 1346 | struct usb_interface *intf; |
1349 | struct usb_host_interface *alt; | 1347 | struct usb_host_interface *alt; |
1350 | 1348 | ||
1351 | if (!dev) | ||
1352 | return -ENODEV; | ||
1353 | |||
1354 | /* driver is often null here; dev_dbg() would oops */ | ||
1355 | pr_debug ("usb %s: uevent\n", dev->bus_id); | ||
1356 | |||
1357 | intf = to_usb_interface(dev); | 1349 | intf = to_usb_interface(dev); |
1358 | usb_dev = interface_to_usbdev(intf); | 1350 | usb_dev = interface_to_usbdev(intf); |
1359 | alt = intf->cur_altsetting; | 1351 | alt = intf->cur_altsetting; |
1360 | 1352 | ||
1361 | #ifdef CONFIG_USB_DEVICEFS | ||
1362 | if (add_uevent_var(env, "DEVICE=/proc/bus/usb/%03d/%03d", | ||
1363 | usb_dev->bus->busnum, usb_dev->devnum)) | ||
1364 | return -ENOMEM; | ||
1365 | #endif | ||
1366 | |||
1367 | if (add_uevent_var(env, "PRODUCT=%x/%x/%x", | ||
1368 | le16_to_cpu(usb_dev->descriptor.idVendor), | ||
1369 | le16_to_cpu(usb_dev->descriptor.idProduct), | ||
1370 | le16_to_cpu(usb_dev->descriptor.bcdDevice))) | ||
1371 | return -ENOMEM; | ||
1372 | |||
1373 | if (add_uevent_var(env, "TYPE=%d/%d/%d", | ||
1374 | usb_dev->descriptor.bDeviceClass, | ||
1375 | usb_dev->descriptor.bDeviceSubClass, | ||
1376 | usb_dev->descriptor.bDeviceProtocol)) | ||
1377 | return -ENOMEM; | ||
1378 | |||
1379 | if (add_uevent_var(env, "INTERFACE=%d/%d/%d", | 1353 | if (add_uevent_var(env, "INTERFACE=%d/%d/%d", |
1380 | alt->desc.bInterfaceClass, | 1354 | alt->desc.bInterfaceClass, |
1381 | alt->desc.bInterfaceSubClass, | 1355 | alt->desc.bInterfaceSubClass, |
@@ -1641,12 +1615,6 @@ free_interfaces: | |||
1641 | intf->dev.bus_id, ret); | 1615 | intf->dev.bus_id, ret); |
1642 | continue; | 1616 | continue; |
1643 | } | 1617 | } |
1644 | |||
1645 | /* The driver's probe method can call usb_set_interface(), | ||
1646 | * which would mean the interface's sysfs files are already | ||
1647 | * created. Just in case, we'll remove them first. | ||
1648 | */ | ||
1649 | usb_remove_sysfs_intf_files(intf); | ||
1650 | usb_create_sysfs_intf_files(intf); | 1618 | usb_create_sysfs_intf_files(intf); |
1651 | } | 1619 | } |
1652 | 1620 | ||
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index b04afd06e502..32bd130b1eed 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -735,6 +735,8 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf) | |||
735 | struct usb_host_interface *alt = intf->cur_altsetting; | 735 | struct usb_host_interface *alt = intf->cur_altsetting; |
736 | int retval; | 736 | int retval; |
737 | 737 | ||
738 | if (intf->sysfs_files_created) | ||
739 | return 0; | ||
738 | retval = sysfs_create_group(&dev->kobj, &intf_attr_grp); | 740 | retval = sysfs_create_group(&dev->kobj, &intf_attr_grp); |
739 | if (retval) | 741 | if (retval) |
740 | return retval; | 742 | return retval; |
@@ -746,6 +748,7 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf) | |||
746 | if (intf->intf_assoc) | 748 | if (intf->intf_assoc) |
747 | retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp); | 749 | retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp); |
748 | usb_create_intf_ep_files(intf, udev); | 750 | usb_create_intf_ep_files(intf, udev); |
751 | intf->sysfs_files_created = 1; | ||
749 | return 0; | 752 | return 0; |
750 | } | 753 | } |
751 | 754 | ||
@@ -753,8 +756,11 @@ void usb_remove_sysfs_intf_files(struct usb_interface *intf) | |||
753 | { | 756 | { |
754 | struct device *dev = &intf->dev; | 757 | struct device *dev = &intf->dev; |
755 | 758 | ||
759 | if (!intf->sysfs_files_created) | ||
760 | return; | ||
756 | usb_remove_intf_ep_files(intf); | 761 | usb_remove_intf_ep_files(intf); |
757 | device_remove_file(dev, &dev_attr_interface); | 762 | device_remove_file(dev, &dev_attr_interface); |
758 | sysfs_remove_group(&dev->kobj, &intf_attr_grp); | 763 | sysfs_remove_group(&dev->kobj, &intf_attr_grp); |
759 | sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp); | 764 | sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp); |
765 | intf->sysfs_files_created = 0; | ||
760 | } | 766 | } |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index c4a6f1095b8b..8f142370103d 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -192,9 +192,34 @@ static void usb_release_dev(struct device *dev) | |||
192 | kfree(udev); | 192 | kfree(udev); |
193 | } | 193 | } |
194 | 194 | ||
195 | #ifdef CONFIG_HOTPLUG | ||
196 | static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
197 | { | ||
198 | struct usb_device *usb_dev; | ||
199 | |||
200 | usb_dev = to_usb_device(dev); | ||
201 | |||
202 | if (add_uevent_var(env, "BUSNUM=%03d", usb_dev->bus->busnum)) | ||
203 | return -ENOMEM; | ||
204 | |||
205 | if (add_uevent_var(env, "DEVNUM=%03d", usb_dev->devnum)) | ||
206 | return -ENOMEM; | ||
207 | |||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | #else | ||
212 | |||
213 | static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
214 | { | ||
215 | return -ENODEV; | ||
216 | } | ||
217 | #endif /* CONFIG_HOTPLUG */ | ||
218 | |||
195 | struct device_type usb_device_type = { | 219 | struct device_type usb_device_type = { |
196 | .name = "usb_device", | 220 | .name = "usb_device", |
197 | .release = usb_release_dev, | 221 | .release = usb_release_dev, |
222 | .uevent = usb_dev_uevent, | ||
198 | }; | 223 | }; |
199 | 224 | ||
200 | #ifdef CONFIG_PM | 225 | #ifdef CONFIG_PM |
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 87c4f50dfb61..d377154658b5 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -1241,14 +1241,14 @@ static void pullup_enable(struct omap_udc *udc) | |||
1241 | udc->gadget.dev.parent->power.power_state = PMSG_ON; | 1241 | udc->gadget.dev.parent->power.power_state = PMSG_ON; |
1242 | udc->gadget.dev.power.power_state = PMSG_ON; | 1242 | udc->gadget.dev.power.power_state = PMSG_ON; |
1243 | UDC_SYSCON1_REG |= UDC_PULLUP_EN; | 1243 | UDC_SYSCON1_REG |= UDC_PULLUP_EN; |
1244 | if (!gadget_is_otg(udc->gadget) && !cpu_is_omap15xx()) | 1244 | if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) |
1245 | OTG_CTRL_REG |= OTG_BSESSVLD; | 1245 | OTG_CTRL_REG |= OTG_BSESSVLD; |
1246 | UDC_IRQ_EN_REG = UDC_DS_CHG_IE; | 1246 | UDC_IRQ_EN_REG = UDC_DS_CHG_IE; |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | static void pullup_disable(struct omap_udc *udc) | 1249 | static void pullup_disable(struct omap_udc *udc) |
1250 | { | 1250 | { |
1251 | if (!gadget_is_otg(udc->gadget) && !cpu_is_omap15xx()) | 1251 | if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) |
1252 | OTG_CTRL_REG &= ~OTG_BSESSVLD; | 1252 | OTG_CTRL_REG &= ~OTG_BSESSVLD; |
1253 | UDC_IRQ_EN_REG = UDC_DS_CHG_IE; | 1253 | UDC_IRQ_EN_REG = UDC_DS_CHG_IE; |
1254 | UDC_SYSCON1_REG &= ~UDC_PULLUP_EN; | 1254 | UDC_SYSCON1_REG &= ~UDC_PULLUP_EN; |
@@ -1386,7 +1386,7 @@ static void update_otg(struct omap_udc *udc) | |||
1386 | { | 1386 | { |
1387 | u16 devstat; | 1387 | u16 devstat; |
1388 | 1388 | ||
1389 | if (!gadget_is_otg(udc->gadget)) | 1389 | if (!gadget_is_otg(&udc->gadget)) |
1390 | return; | 1390 | return; |
1391 | 1391 | ||
1392 | if (OTG_CTRL_REG & OTG_ID) | 1392 | if (OTG_CTRL_REG & OTG_ID) |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index e3e90f8a75e7..4ce050c3d13f 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -52,10 +52,10 @@ | |||
52 | #include <asm/arch/irqs.h> | 52 | #include <asm/arch/irqs.h> |
53 | 53 | ||
54 | #include <asm/arch/hardware.h> | 54 | #include <asm/arch/hardware.h> |
55 | #include <asm/arch/regs-clock.h> | ||
56 | #include <asm/arch/regs-gpio.h> | 55 | #include <asm/arch/regs-gpio.h> |
57 | #include <asm/arch/regs-udc.h> | 56 | |
58 | #include <asm/arch/udc.h> | 57 | #include <asm/plat-s3c24xx/regs-udc.h> |
58 | #include <asm/plat-s3c24xx/udc.h> | ||
59 | 59 | ||
60 | #include <asm/mach-types.h> | 60 | #include <asm/mach-types.h> |
61 | 61 | ||
@@ -1511,7 +1511,11 @@ static irqreturn_t s3c2410_udc_vbus_irq(int irq, void *_dev) | |||
1511 | unsigned int value; | 1511 | unsigned int value; |
1512 | 1512 | ||
1513 | dprintk(DEBUG_NORMAL, "%s()\n", __func__); | 1513 | dprintk(DEBUG_NORMAL, "%s()\n", __func__); |
1514 | |||
1515 | /* some cpus cannot read from an line configured to IRQ! */ | ||
1516 | s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_INPUT); | ||
1514 | value = s3c2410_gpio_getpin(udc_info->vbus_pin); | 1517 | value = s3c2410_gpio_getpin(udc_info->vbus_pin); |
1518 | s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_SFN2); | ||
1515 | 1519 | ||
1516 | if (udc_info->vbus_pin_inverted) | 1520 | if (udc_info->vbus_pin_inverted) |
1517 | value = !value; | 1521 | value = !value; |
@@ -1872,9 +1876,9 @@ static int s3c2410_udc_probe(struct platform_device *pdev) | |||
1872 | if (udc_info && udc_info->vbus_pin > 0) { | 1876 | if (udc_info && udc_info->vbus_pin > 0) { |
1873 | irq = s3c2410_gpio_getirq(udc_info->vbus_pin); | 1877 | irq = s3c2410_gpio_getirq(udc_info->vbus_pin); |
1874 | retval = request_irq(irq, s3c2410_udc_vbus_irq, | 1878 | retval = request_irq(irq, s3c2410_udc_vbus_irq, |
1875 | IRQF_DISABLED | IRQF_TRIGGER_RISING | 1879 | IRQF_DISABLED | IRQF_TRIGGER_RISING |
1876 | | IRQF_TRIGGER_FALLING, | 1880 | | IRQF_TRIGGER_FALLING | IRQF_SHARED, |
1877 | gadget_name, udc); | 1881 | gadget_name, udc); |
1878 | 1882 | ||
1879 | if (retval != 0) { | 1883 | if (retval != 0) { |
1880 | dev_err(dev, "can't get vbus irq %i, err %d\n", | 1884 | dev_err(dev, "can't get vbus irq %i, err %d\n", |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 177e78ed241b..49a91c5ee51b 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -156,7 +156,7 @@ config USB_OHCI_HCD_PCI | |||
156 | 156 | ||
157 | config USB_OHCI_HCD_SSB | 157 | config USB_OHCI_HCD_SSB |
158 | bool "OHCI support for Broadcom SSB OHCI core" | 158 | bool "OHCI support for Broadcom SSB OHCI core" |
159 | depends on USB_OHCI_HCD && (SSB = y || SSB = CONFIG_USB_OHCI_HCD) && EXPERIMENTAL | 159 | depends on USB_OHCI_HCD && (SSB = y || SSB = USB_OHCI_HCD) && EXPERIMENTAL |
160 | default n | 160 | default n |
161 | ---help--- | 161 | ---help--- |
162 | Support for the Sonics Silicon Backplane (SSB) attached | 162 | Support for the Sonics Silicon Backplane (SSB) attached |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index c1514442883e..5f2d74ed5ad7 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -575,12 +575,15 @@ static int ehci_run (struct usb_hcd *hcd) | |||
575 | * from the companions to the EHCI controller. If any of the | 575 | * from the companions to the EHCI controller. If any of the |
576 | * companions are in the middle of a port reset at the time, it | 576 | * companions are in the middle of a port reset at the time, it |
577 | * could cause trouble. Write-locking ehci_cf_port_reset_rwsem | 577 | * could cause trouble. Write-locking ehci_cf_port_reset_rwsem |
578 | * guarantees that no resets are in progress. | 578 | * guarantees that no resets are in progress. After we set CF, |
579 | * a short delay lets the hardware catch up; new resets shouldn't | ||
580 | * be started before the port switching actions could complete. | ||
579 | */ | 581 | */ |
580 | down_write(&ehci_cf_port_reset_rwsem); | 582 | down_write(&ehci_cf_port_reset_rwsem); |
581 | hcd->state = HC_STATE_RUNNING; | 583 | hcd->state = HC_STATE_RUNNING; |
582 | ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); | 584 | ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); |
583 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ | 585 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ |
586 | msleep(5); | ||
584 | up_write(&ehci_cf_port_reset_rwsem); | 587 | up_write(&ehci_cf_port_reset_rwsem); |
585 | 588 | ||
586 | temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 589 | temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); |
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 91e999c9f680..bc207e3c21f5 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c | |||
@@ -819,7 +819,7 @@ static int mts_usb_probe(struct usb_interface *intf, | |||
819 | goto out_kfree2; | 819 | goto out_kfree2; |
820 | 820 | ||
821 | new_desc->host->hostdata[0] = (unsigned long)new_desc; | 821 | new_desc->host->hostdata[0] = (unsigned long)new_desc; |
822 | if (scsi_add_host(new_desc->host, NULL)) { | 822 | if (scsi_add_host(new_desc->host, &dev->dev)) { |
823 | err_retval = -EIO; | 823 | err_retval = -EIO; |
824 | goto out_host_put; | 824 | goto out_host_put; |
825 | } | 825 | } |
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index c567aa7a41ea..5a2c44e4c1f7 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c | |||
@@ -79,12 +79,22 @@ MODULE_DEVICE_TABLE(usb, device_table); | |||
79 | 79 | ||
80 | #define COMMAND_TIMEOUT (2*HZ) /* 60 second timeout for a command */ | 80 | #define COMMAND_TIMEOUT (2*HZ) /* 60 second timeout for a command */ |
81 | 81 | ||
82 | /* | ||
83 | * The locking scheme is a vanilla 3-lock: | ||
84 | * adu_device.buflock: A spinlock, covers what IRQs touch. | ||
85 | * adutux_mutex: A Static lock to cover open_count. It would also cover | ||
86 | * any globals, but we don't have them in 2.6. | ||
87 | * adu_device.mtx: A mutex to hold across sleepers like copy_from_user. | ||
88 | * It covers all of adu_device, except the open_count | ||
89 | * and what .buflock covers. | ||
90 | */ | ||
91 | |||
82 | /* Structure to hold all of our device specific stuff */ | 92 | /* Structure to hold all of our device specific stuff */ |
83 | struct adu_device { | 93 | struct adu_device { |
84 | struct mutex mtx; /* locks this structure */ | 94 | struct mutex mtx; |
85 | struct usb_device* udev; /* save off the usb device pointer */ | 95 | struct usb_device* udev; /* save off the usb device pointer */ |
86 | struct usb_interface* interface; | 96 | struct usb_interface* interface; |
87 | unsigned char minor; /* the starting minor number for this device */ | 97 | unsigned int minor; /* the starting minor number for this device */ |
88 | char serial_number[8]; | 98 | char serial_number[8]; |
89 | 99 | ||
90 | int open_count; /* number of times this port has been opened */ | 100 | int open_count; /* number of times this port has been opened */ |
@@ -107,8 +117,11 @@ struct adu_device { | |||
107 | char* interrupt_out_buffer; | 117 | char* interrupt_out_buffer; |
108 | struct usb_endpoint_descriptor* interrupt_out_endpoint; | 118 | struct usb_endpoint_descriptor* interrupt_out_endpoint; |
109 | struct urb* interrupt_out_urb; | 119 | struct urb* interrupt_out_urb; |
120 | int out_urb_finished; | ||
110 | }; | 121 | }; |
111 | 122 | ||
123 | static DEFINE_MUTEX(adutux_mutex); | ||
124 | |||
112 | static struct usb_driver adu_driver; | 125 | static struct usb_driver adu_driver; |
113 | 126 | ||
114 | static void adu_debug_data(int level, const char *function, int size, | 127 | static void adu_debug_data(int level, const char *function, int size, |
@@ -132,27 +145,31 @@ static void adu_debug_data(int level, const char *function, int size, | |||
132 | */ | 145 | */ |
133 | static void adu_abort_transfers(struct adu_device *dev) | 146 | static void adu_abort_transfers(struct adu_device *dev) |
134 | { | 147 | { |
135 | dbg(2," %s : enter", __FUNCTION__); | 148 | unsigned long flags; |
136 | 149 | ||
137 | if (dev == NULL) { | 150 | dbg(2," %s : enter", __FUNCTION__); |
138 | dbg(1," %s : dev is null", __FUNCTION__); | ||
139 | goto exit; | ||
140 | } | ||
141 | 151 | ||
142 | if (dev->udev == NULL) { | 152 | if (dev->udev == NULL) { |
143 | dbg(1," %s : udev is null", __FUNCTION__); | 153 | dbg(1," %s : udev is null", __FUNCTION__); |
144 | goto exit; | 154 | goto exit; |
145 | } | 155 | } |
146 | 156 | ||
147 | dbg(2," %s : udev state %d", __FUNCTION__, dev->udev->state); | ||
148 | if (dev->udev->state == USB_STATE_NOTATTACHED) { | ||
149 | dbg(1," %s : udev is not attached", __FUNCTION__); | ||
150 | goto exit; | ||
151 | } | ||
152 | |||
153 | /* shutdown transfer */ | 157 | /* shutdown transfer */ |
154 | usb_unlink_urb(dev->interrupt_in_urb); | 158 | |
155 | usb_unlink_urb(dev->interrupt_out_urb); | 159 | /* XXX Anchor these instead */ |
160 | spin_lock_irqsave(&dev->buflock, flags); | ||
161 | if (!dev->read_urb_finished) { | ||
162 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
163 | usb_kill_urb(dev->interrupt_in_urb); | ||
164 | } else | ||
165 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
166 | |||
167 | spin_lock_irqsave(&dev->buflock, flags); | ||
168 | if (!dev->out_urb_finished) { | ||
169 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
170 | usb_kill_urb(dev->interrupt_out_urb); | ||
171 | } else | ||
172 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
156 | 173 | ||
157 | exit: | 174 | exit: |
158 | dbg(2," %s : leave", __FUNCTION__); | 175 | dbg(2," %s : leave", __FUNCTION__); |
@@ -162,8 +179,6 @@ static void adu_delete(struct adu_device *dev) | |||
162 | { | 179 | { |
163 | dbg(2, "%s enter", __FUNCTION__); | 180 | dbg(2, "%s enter", __FUNCTION__); |
164 | 181 | ||
165 | adu_abort_transfers(dev); | ||
166 | |||
167 | /* free data structures */ | 182 | /* free data structures */ |
168 | usb_free_urb(dev->interrupt_in_urb); | 183 | usb_free_urb(dev->interrupt_in_urb); |
169 | usb_free_urb(dev->interrupt_out_urb); | 184 | usb_free_urb(dev->interrupt_out_urb); |
@@ -239,7 +254,10 @@ static void adu_interrupt_out_callback(struct urb *urb) | |||
239 | goto exit; | 254 | goto exit; |
240 | } | 255 | } |
241 | 256 | ||
242 | wake_up_interruptible(&dev->write_wait); | 257 | spin_lock(&dev->buflock); |
258 | dev->out_urb_finished = 1; | ||
259 | wake_up(&dev->write_wait); | ||
260 | spin_unlock(&dev->buflock); | ||
243 | exit: | 261 | exit: |
244 | 262 | ||
245 | adu_debug_data(5, __FUNCTION__, urb->actual_length, | 263 | adu_debug_data(5, __FUNCTION__, urb->actual_length, |
@@ -252,12 +270,17 @@ static int adu_open(struct inode *inode, struct file *file) | |||
252 | struct adu_device *dev = NULL; | 270 | struct adu_device *dev = NULL; |
253 | struct usb_interface *interface; | 271 | struct usb_interface *interface; |
254 | int subminor; | 272 | int subminor; |
255 | int retval = 0; | 273 | int retval; |
256 | 274 | ||
257 | dbg(2,"%s : enter", __FUNCTION__); | 275 | dbg(2,"%s : enter", __FUNCTION__); |
258 | 276 | ||
259 | subminor = iminor(inode); | 277 | subminor = iminor(inode); |
260 | 278 | ||
279 | if ((retval = mutex_lock_interruptible(&adutux_mutex))) { | ||
280 | dbg(2, "%s : mutex lock failed", __FUNCTION__); | ||
281 | goto exit_no_lock; | ||
282 | } | ||
283 | |||
261 | interface = usb_find_interface(&adu_driver, subminor); | 284 | interface = usb_find_interface(&adu_driver, subminor); |
262 | if (!interface) { | 285 | if (!interface) { |
263 | err("%s - error, can't find device for minor %d", | 286 | err("%s - error, can't find device for minor %d", |
@@ -267,54 +290,54 @@ static int adu_open(struct inode *inode, struct file *file) | |||
267 | } | 290 | } |
268 | 291 | ||
269 | dev = usb_get_intfdata(interface); | 292 | dev = usb_get_intfdata(interface); |
270 | if (!dev) { | 293 | if (!dev || !dev->udev) { |
271 | retval = -ENODEV; | 294 | retval = -ENODEV; |
272 | goto exit_no_device; | 295 | goto exit_no_device; |
273 | } | 296 | } |
274 | 297 | ||
275 | /* lock this device */ | 298 | /* check that nobody else is using the device */ |
276 | if ((retval = mutex_lock_interruptible(&dev->mtx))) { | 299 | if (dev->open_count) { |
277 | dbg(2, "%s : mutex lock failed", __FUNCTION__); | 300 | retval = -EBUSY; |
278 | goto exit_no_device; | 301 | goto exit_no_device; |
279 | } | 302 | } |
280 | 303 | ||
281 | /* increment our usage count for the device */ | ||
282 | ++dev->open_count; | 304 | ++dev->open_count; |
283 | dbg(2,"%s : open count %d", __FUNCTION__, dev->open_count); | 305 | dbg(2,"%s : open count %d", __FUNCTION__, dev->open_count); |
284 | 306 | ||
285 | /* save device in the file's private structure */ | 307 | /* save device in the file's private structure */ |
286 | file->private_data = dev; | 308 | file->private_data = dev; |
287 | 309 | ||
288 | if (dev->open_count == 1) { | 310 | /* initialize in direction */ |
289 | /* initialize in direction */ | 311 | dev->read_buffer_length = 0; |
290 | dev->read_buffer_length = 0; | ||
291 | 312 | ||
292 | /* fixup first read by having urb waiting for it */ | 313 | /* fixup first read by having urb waiting for it */ |
293 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, | 314 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, |
294 | usb_rcvintpipe(dev->udev, | 315 | usb_rcvintpipe(dev->udev, |
295 | dev->interrupt_in_endpoint->bEndpointAddress), | 316 | dev->interrupt_in_endpoint->bEndpointAddress), |
296 | dev->interrupt_in_buffer, | 317 | dev->interrupt_in_buffer, |
297 | le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), | 318 | le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), |
298 | adu_interrupt_in_callback, dev, | 319 | adu_interrupt_in_callback, dev, |
299 | dev->interrupt_in_endpoint->bInterval); | 320 | dev->interrupt_in_endpoint->bInterval); |
300 | /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */ | 321 | dev->read_urb_finished = 0; |
301 | dev->read_urb_finished = 0; | 322 | if (usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL)) |
302 | retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL); | 323 | dev->read_urb_finished = 1; |
303 | if (retval) | 324 | /* we ignore failure */ |
304 | --dev->open_count; | 325 | /* end of fixup for first read */ |
305 | } | 326 | |
306 | mutex_unlock(&dev->mtx); | 327 | /* initialize out direction */ |
328 | dev->out_urb_finished = 1; | ||
329 | |||
330 | retval = 0; | ||
307 | 331 | ||
308 | exit_no_device: | 332 | exit_no_device: |
333 | mutex_unlock(&adutux_mutex); | ||
334 | exit_no_lock: | ||
309 | dbg(2,"%s : leave, return value %d ", __FUNCTION__, retval); | 335 | dbg(2,"%s : leave, return value %d ", __FUNCTION__, retval); |
310 | |||
311 | return retval; | 336 | return retval; |
312 | } | 337 | } |
313 | 338 | ||
314 | static int adu_release_internal(struct adu_device *dev) | 339 | static void adu_release_internal(struct adu_device *dev) |
315 | { | 340 | { |
316 | int retval = 0; | ||
317 | |||
318 | dbg(2," %s : enter", __FUNCTION__); | 341 | dbg(2," %s : enter", __FUNCTION__); |
319 | 342 | ||
320 | /* decrement our usage count for the device */ | 343 | /* decrement our usage count for the device */ |
@@ -326,12 +349,11 @@ static int adu_release_internal(struct adu_device *dev) | |||
326 | } | 349 | } |
327 | 350 | ||
328 | dbg(2," %s : leave", __FUNCTION__); | 351 | dbg(2," %s : leave", __FUNCTION__); |
329 | return retval; | ||
330 | } | 352 | } |
331 | 353 | ||
332 | static int adu_release(struct inode *inode, struct file *file) | 354 | static int adu_release(struct inode *inode, struct file *file) |
333 | { | 355 | { |
334 | struct adu_device *dev = NULL; | 356 | struct adu_device *dev; |
335 | int retval = 0; | 357 | int retval = 0; |
336 | 358 | ||
337 | dbg(2," %s : enter", __FUNCTION__); | 359 | dbg(2," %s : enter", __FUNCTION__); |
@@ -343,15 +365,13 @@ static int adu_release(struct inode *inode, struct file *file) | |||
343 | } | 365 | } |
344 | 366 | ||
345 | dev = file->private_data; | 367 | dev = file->private_data; |
346 | |||
347 | if (dev == NULL) { | 368 | if (dev == NULL) { |
348 | dbg(1," %s : object is NULL", __FUNCTION__); | 369 | dbg(1," %s : object is NULL", __FUNCTION__); |
349 | retval = -ENODEV; | 370 | retval = -ENODEV; |
350 | goto exit; | 371 | goto exit; |
351 | } | 372 | } |
352 | 373 | ||
353 | /* lock our device */ | 374 | mutex_lock(&adutux_mutex); /* not interruptible */ |
354 | mutex_lock(&dev->mtx); /* not interruptible */ | ||
355 | 375 | ||
356 | if (dev->open_count <= 0) { | 376 | if (dev->open_count <= 0) { |
357 | dbg(1," %s : device not opened", __FUNCTION__); | 377 | dbg(1," %s : device not opened", __FUNCTION__); |
@@ -359,19 +379,15 @@ static int adu_release(struct inode *inode, struct file *file) | |||
359 | goto exit; | 379 | goto exit; |
360 | } | 380 | } |
361 | 381 | ||
382 | adu_release_internal(dev); | ||
362 | if (dev->udev == NULL) { | 383 | if (dev->udev == NULL) { |
363 | /* the device was unplugged before the file was released */ | 384 | /* the device was unplugged before the file was released */ |
364 | mutex_unlock(&dev->mtx); | 385 | if (!dev->open_count) /* ... and we're the last user */ |
365 | adu_delete(dev); | 386 | adu_delete(dev); |
366 | dev = NULL; | ||
367 | } else { | ||
368 | /* do the work */ | ||
369 | retval = adu_release_internal(dev); | ||
370 | } | 387 | } |
371 | 388 | ||
372 | exit: | 389 | exit: |
373 | if (dev) | 390 | mutex_unlock(&adutux_mutex); |
374 | mutex_unlock(&dev->mtx); | ||
375 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); | 391 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); |
376 | return retval; | 392 | return retval; |
377 | } | 393 | } |
@@ -393,12 +409,12 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
393 | 409 | ||
394 | dev = file->private_data; | 410 | dev = file->private_data; |
395 | dbg(2," %s : dev=%p", __FUNCTION__, dev); | 411 | dbg(2," %s : dev=%p", __FUNCTION__, dev); |
396 | /* lock this object */ | 412 | |
397 | if (mutex_lock_interruptible(&dev->mtx)) | 413 | if (mutex_lock_interruptible(&dev->mtx)) |
398 | return -ERESTARTSYS; | 414 | return -ERESTARTSYS; |
399 | 415 | ||
400 | /* verify that the device wasn't unplugged */ | 416 | /* verify that the device wasn't unplugged */ |
401 | if (dev->udev == NULL || dev->minor == 0) { | 417 | if (dev->udev == NULL) { |
402 | retval = -ENODEV; | 418 | retval = -ENODEV; |
403 | err("No device or device unplugged %d", retval); | 419 | err("No device or device unplugged %d", retval); |
404 | goto exit; | 420 | goto exit; |
@@ -452,7 +468,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
452 | should_submit = 1; | 468 | should_submit = 1; |
453 | } else { | 469 | } else { |
454 | /* even the primary was empty - we may need to do IO */ | 470 | /* even the primary was empty - we may need to do IO */ |
455 | if (dev->interrupt_in_urb->status == -EINPROGRESS) { | 471 | if (!dev->read_urb_finished) { |
456 | /* somebody is doing IO */ | 472 | /* somebody is doing IO */ |
457 | spin_unlock_irqrestore(&dev->buflock, flags); | 473 | spin_unlock_irqrestore(&dev->buflock, flags); |
458 | dbg(2," %s : submitted already", __FUNCTION__); | 474 | dbg(2," %s : submitted already", __FUNCTION__); |
@@ -460,6 +476,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
460 | /* we must initiate input */ | 476 | /* we must initiate input */ |
461 | dbg(2," %s : initiate input", __FUNCTION__); | 477 | dbg(2," %s : initiate input", __FUNCTION__); |
462 | dev->read_urb_finished = 0; | 478 | dev->read_urb_finished = 0; |
479 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
463 | 480 | ||
464 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, | 481 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, |
465 | usb_rcvintpipe(dev->udev, | 482 | usb_rcvintpipe(dev->udev, |
@@ -469,15 +486,12 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
469 | adu_interrupt_in_callback, | 486 | adu_interrupt_in_callback, |
470 | dev, | 487 | dev, |
471 | dev->interrupt_in_endpoint->bInterval); | 488 | dev->interrupt_in_endpoint->bInterval); |
472 | retval = usb_submit_urb(dev->interrupt_in_urb, GFP_ATOMIC); | 489 | retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL); |
473 | if (!retval) { | 490 | if (retval) { |
474 | spin_unlock_irqrestore(&dev->buflock, flags); | 491 | dev->read_urb_finished = 1; |
475 | dbg(2," %s : submitted OK", __FUNCTION__); | ||
476 | } else { | ||
477 | if (retval == -ENOMEM) { | 492 | if (retval == -ENOMEM) { |
478 | retval = bytes_read ? bytes_read : -ENOMEM; | 493 | retval = bytes_read ? bytes_read : -ENOMEM; |
479 | } | 494 | } |
480 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
481 | dbg(2," %s : submit failed", __FUNCTION__); | 495 | dbg(2," %s : submit failed", __FUNCTION__); |
482 | goto exit; | 496 | goto exit; |
483 | } | 497 | } |
@@ -486,10 +500,14 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
486 | /* we wait for I/O to complete */ | 500 | /* we wait for I/O to complete */ |
487 | set_current_state(TASK_INTERRUPTIBLE); | 501 | set_current_state(TASK_INTERRUPTIBLE); |
488 | add_wait_queue(&dev->read_wait, &wait); | 502 | add_wait_queue(&dev->read_wait, &wait); |
489 | if (!dev->read_urb_finished) | 503 | spin_lock_irqsave(&dev->buflock, flags); |
504 | if (!dev->read_urb_finished) { | ||
505 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
490 | timeout = schedule_timeout(COMMAND_TIMEOUT); | 506 | timeout = schedule_timeout(COMMAND_TIMEOUT); |
491 | else | 507 | } else { |
508 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
492 | set_current_state(TASK_RUNNING); | 509 | set_current_state(TASK_RUNNING); |
510 | } | ||
493 | remove_wait_queue(&dev->read_wait, &wait); | 511 | remove_wait_queue(&dev->read_wait, &wait); |
494 | 512 | ||
495 | if (timeout <= 0) { | 513 | if (timeout <= 0) { |
@@ -509,19 +527,23 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
509 | 527 | ||
510 | retval = bytes_read; | 528 | retval = bytes_read; |
511 | /* if the primary buffer is empty then use it */ | 529 | /* if the primary buffer is empty then use it */ |
512 | if (should_submit && !dev->interrupt_in_urb->status==-EINPROGRESS) { | 530 | spin_lock_irqsave(&dev->buflock, flags); |
531 | if (should_submit && dev->read_urb_finished) { | ||
532 | dev->read_urb_finished = 0; | ||
533 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
513 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, | 534 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, |
514 | usb_rcvintpipe(dev->udev, | 535 | usb_rcvintpipe(dev->udev, |
515 | dev->interrupt_in_endpoint->bEndpointAddress), | 536 | dev->interrupt_in_endpoint->bEndpointAddress), |
516 | dev->interrupt_in_buffer, | 537 | dev->interrupt_in_buffer, |
517 | le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), | 538 | le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), |
518 | adu_interrupt_in_callback, | 539 | adu_interrupt_in_callback, |
519 | dev, | 540 | dev, |
520 | dev->interrupt_in_endpoint->bInterval); | 541 | dev->interrupt_in_endpoint->bInterval); |
521 | /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */ | 542 | if (usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL) != 0) |
522 | dev->read_urb_finished = 0; | 543 | dev->read_urb_finished = 1; |
523 | usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL); | ||
524 | /* we ignore failure */ | 544 | /* we ignore failure */ |
545 | } else { | ||
546 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
525 | } | 547 | } |
526 | 548 | ||
527 | exit: | 549 | exit: |
@@ -535,24 +557,24 @@ exit: | |||
535 | static ssize_t adu_write(struct file *file, const __user char *buffer, | 557 | static ssize_t adu_write(struct file *file, const __user char *buffer, |
536 | size_t count, loff_t *ppos) | 558 | size_t count, loff_t *ppos) |
537 | { | 559 | { |
560 | DECLARE_WAITQUEUE(waita, current); | ||
538 | struct adu_device *dev; | 561 | struct adu_device *dev; |
539 | size_t bytes_written = 0; | 562 | size_t bytes_written = 0; |
540 | size_t bytes_to_write; | 563 | size_t bytes_to_write; |
541 | size_t buffer_size; | 564 | size_t buffer_size; |
565 | unsigned long flags; | ||
542 | int retval; | 566 | int retval; |
543 | int timeout = 0; | ||
544 | 567 | ||
545 | dbg(2," %s : enter, count = %Zd", __FUNCTION__, count); | 568 | dbg(2," %s : enter, count = %Zd", __FUNCTION__, count); |
546 | 569 | ||
547 | dev = file->private_data; | 570 | dev = file->private_data; |
548 | 571 | ||
549 | /* lock this object */ | ||
550 | retval = mutex_lock_interruptible(&dev->mtx); | 572 | retval = mutex_lock_interruptible(&dev->mtx); |
551 | if (retval) | 573 | if (retval) |
552 | goto exit_nolock; | 574 | goto exit_nolock; |
553 | 575 | ||
554 | /* verify that the device wasn't unplugged */ | 576 | /* verify that the device wasn't unplugged */ |
555 | if (dev->udev == NULL || dev->minor == 0) { | 577 | if (dev->udev == NULL) { |
556 | retval = -ENODEV; | 578 | retval = -ENODEV; |
557 | err("No device or device unplugged %d", retval); | 579 | err("No device or device unplugged %d", retval); |
558 | goto exit; | 580 | goto exit; |
@@ -564,42 +586,37 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, | |||
564 | goto exit; | 586 | goto exit; |
565 | } | 587 | } |
566 | 588 | ||
567 | |||
568 | while (count > 0) { | 589 | while (count > 0) { |
569 | if (dev->interrupt_out_urb->status == -EINPROGRESS) { | 590 | add_wait_queue(&dev->write_wait, &waita); |
570 | timeout = COMMAND_TIMEOUT; | 591 | set_current_state(TASK_INTERRUPTIBLE); |
592 | spin_lock_irqsave(&dev->buflock, flags); | ||
593 | if (!dev->out_urb_finished) { | ||
594 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
571 | 595 | ||
572 | while (timeout > 0) { | 596 | mutex_unlock(&dev->mtx); |
573 | if (signal_pending(current)) { | 597 | if (signal_pending(current)) { |
574 | dbg(1," %s : interrupted", __FUNCTION__); | 598 | dbg(1," %s : interrupted", __FUNCTION__); |
599 | set_current_state(TASK_RUNNING); | ||
575 | retval = -EINTR; | 600 | retval = -EINTR; |
576 | goto exit; | 601 | goto exit_onqueue; |
577 | } | 602 | } |
578 | mutex_unlock(&dev->mtx); | 603 | if (schedule_timeout(COMMAND_TIMEOUT) == 0) { |
579 | timeout = interruptible_sleep_on_timeout(&dev->write_wait, timeout); | 604 | dbg(1, "%s - command timed out.", __FUNCTION__); |
605 | retval = -ETIMEDOUT; | ||
606 | goto exit_onqueue; | ||
607 | } | ||
608 | remove_wait_queue(&dev->write_wait, &waita); | ||
580 | retval = mutex_lock_interruptible(&dev->mtx); | 609 | retval = mutex_lock_interruptible(&dev->mtx); |
581 | if (retval) { | 610 | if (retval) { |
582 | retval = bytes_written ? bytes_written : retval; | 611 | retval = bytes_written ? bytes_written : retval; |
583 | goto exit_nolock; | 612 | goto exit_nolock; |
584 | } | 613 | } |
585 | if (timeout > 0) { | ||
586 | break; | ||
587 | } | ||
588 | dbg(1," %s : interrupted timeout: %d", __FUNCTION__, timeout); | ||
589 | } | ||
590 | |||
591 | |||
592 | dbg(1," %s : final timeout: %d", __FUNCTION__, timeout); | ||
593 | |||
594 | if (timeout == 0) { | ||
595 | dbg(1, "%s - command timed out.", __FUNCTION__); | ||
596 | retval = -ETIMEDOUT; | ||
597 | goto exit; | ||
598 | } | ||
599 | |||
600 | dbg(4," %s : in progress, count = %Zd", __FUNCTION__, count); | ||
601 | 614 | ||
615 | dbg(4," %s : in progress, count = %Zd", __FUNCTION__, count); | ||
602 | } else { | 616 | } else { |
617 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
618 | set_current_state(TASK_RUNNING); | ||
619 | remove_wait_queue(&dev->write_wait, &waita); | ||
603 | dbg(4," %s : sending, count = %Zd", __FUNCTION__, count); | 620 | dbg(4," %s : sending, count = %Zd", __FUNCTION__, count); |
604 | 621 | ||
605 | /* write the data into interrupt_out_buffer from userspace */ | 622 | /* write the data into interrupt_out_buffer from userspace */ |
@@ -622,11 +639,12 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, | |||
622 | bytes_to_write, | 639 | bytes_to_write, |
623 | adu_interrupt_out_callback, | 640 | adu_interrupt_out_callback, |
624 | dev, | 641 | dev, |
625 | dev->interrupt_in_endpoint->bInterval); | 642 | dev->interrupt_out_endpoint->bInterval); |
626 | /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */ | ||
627 | dev->interrupt_out_urb->actual_length = bytes_to_write; | 643 | dev->interrupt_out_urb->actual_length = bytes_to_write; |
644 | dev->out_urb_finished = 0; | ||
628 | retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); | 645 | retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); |
629 | if (retval < 0) { | 646 | if (retval < 0) { |
647 | dev->out_urb_finished = 1; | ||
630 | err("Couldn't submit interrupt_out_urb %d", retval); | 648 | err("Couldn't submit interrupt_out_urb %d", retval); |
631 | goto exit; | 649 | goto exit; |
632 | } | 650 | } |
@@ -637,16 +655,17 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, | |||
637 | bytes_written += bytes_to_write; | 655 | bytes_written += bytes_to_write; |
638 | } | 656 | } |
639 | } | 657 | } |
640 | 658 | mutex_unlock(&dev->mtx); | |
641 | retval = bytes_written; | 659 | return bytes_written; |
642 | 660 | ||
643 | exit: | 661 | exit: |
644 | /* unlock the device */ | ||
645 | mutex_unlock(&dev->mtx); | 662 | mutex_unlock(&dev->mtx); |
646 | exit_nolock: | 663 | exit_nolock: |
647 | |||
648 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); | 664 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); |
665 | return retval; | ||
649 | 666 | ||
667 | exit_onqueue: | ||
668 | remove_wait_queue(&dev->write_wait, &waita); | ||
650 | return retval; | 669 | return retval; |
651 | } | 670 | } |
652 | 671 | ||
@@ -831,25 +850,22 @@ static void adu_disconnect(struct usb_interface *interface) | |||
831 | dbg(2," %s : enter", __FUNCTION__); | 850 | dbg(2," %s : enter", __FUNCTION__); |
832 | 851 | ||
833 | dev = usb_get_intfdata(interface); | 852 | dev = usb_get_intfdata(interface); |
834 | usb_set_intfdata(interface, NULL); | ||
835 | 853 | ||
854 | mutex_lock(&dev->mtx); /* not interruptible */ | ||
855 | dev->udev = NULL; /* poison */ | ||
836 | minor = dev->minor; | 856 | minor = dev->minor; |
837 | |||
838 | /* give back our minor */ | ||
839 | usb_deregister_dev(interface, &adu_class); | 857 | usb_deregister_dev(interface, &adu_class); |
840 | dev->minor = 0; | 858 | mutex_unlock(&dev->mtx); |
841 | 859 | ||
842 | mutex_lock(&dev->mtx); /* not interruptible */ | 860 | mutex_lock(&adutux_mutex); |
861 | usb_set_intfdata(interface, NULL); | ||
843 | 862 | ||
844 | /* if the device is not opened, then we clean up right now */ | 863 | /* if the device is not opened, then we clean up right now */ |
845 | dbg(2," %s : open count %d", __FUNCTION__, dev->open_count); | 864 | dbg(2," %s : open count %d", __FUNCTION__, dev->open_count); |
846 | if (!dev->open_count) { | 865 | if (!dev->open_count) |
847 | mutex_unlock(&dev->mtx); | ||
848 | adu_delete(dev); | 866 | adu_delete(dev); |
849 | } else { | 867 | |
850 | dev->udev = NULL; | 868 | mutex_unlock(&adutux_mutex); |
851 | mutex_unlock(&dev->mtx); | ||
852 | } | ||
853 | 869 | ||
854 | dev_info(&interface->dev, "ADU device adutux%d now disconnected\n", | 870 | dev_info(&interface->dev, "ADU device adutux%d now disconnected\n", |
855 | (minor - ADU_MINOR_BASE)); | 871 | (minor - ADU_MINOR_BASE)); |
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 49c5c5c4c431..06cb71942dc7 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
@@ -144,12 +144,14 @@ static void led_disconnect(struct usb_interface *interface) | |||
144 | struct usb_led *dev; | 144 | struct usb_led *dev; |
145 | 145 | ||
146 | dev = usb_get_intfdata (interface); | 146 | dev = usb_get_intfdata (interface); |
147 | usb_set_intfdata (interface, NULL); | ||
148 | 147 | ||
149 | device_remove_file(&interface->dev, &dev_attr_blue); | 148 | device_remove_file(&interface->dev, &dev_attr_blue); |
150 | device_remove_file(&interface->dev, &dev_attr_red); | 149 | device_remove_file(&interface->dev, &dev_attr_red); |
151 | device_remove_file(&interface->dev, &dev_attr_green); | 150 | device_remove_file(&interface->dev, &dev_attr_green); |
152 | 151 | ||
152 | /* first remove the files, then set the pointer to NULL */ | ||
153 | usb_set_intfdata (interface, NULL); | ||
154 | |||
153 | usb_put_dev(dev->udev); | 155 | usb_put_dev(dev->udev); |
154 | 156 | ||
155 | kfree(dev); | 157 | kfree(dev); |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 9eb4a65ee4d9..d41531139c55 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -327,6 +327,7 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb) | |||
327 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 327 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
328 | unsigned char *data = urb->transfer_buffer; | 328 | unsigned char *data = urb->transfer_buffer; |
329 | int status = urb->status; | 329 | int status = urb->status; |
330 | unsigned long flags; | ||
330 | 331 | ||
331 | dbg("%s - port %d", __FUNCTION__, port->number); | 332 | dbg("%s - port %d", __FUNCTION__, port->number); |
332 | 333 | ||
@@ -339,11 +340,11 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb) | |||
339 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); | 340 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); |
340 | 341 | ||
341 | /* Throttle the device if requested by tty */ | 342 | /* Throttle the device if requested by tty */ |
342 | spin_lock(&port->lock); | 343 | spin_lock_irqsave(&port->lock, flags); |
343 | if (!(port->throttled = port->throttle_req)) | 344 | if (!(port->throttled = port->throttle_req)) |
344 | /* Handle data and continue reading from device */ | 345 | /* Handle data and continue reading from device */ |
345 | flush_and_resubmit_read_urb(port); | 346 | flush_and_resubmit_read_urb(port); |
346 | spin_unlock(&port->lock); | 347 | spin_unlock_irqrestore(&port->lock, flags); |
347 | } | 348 | } |
348 | EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); | 349 | EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); |
349 | 350 | ||
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 1f7ab15df36d..feba9679ace8 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -1215,12 +1215,14 @@ static int keyspan_chars_in_buffer (struct usb_serial_port *port) | |||
1215 | 1215 | ||
1216 | static int keyspan_open (struct usb_serial_port *port, struct file *filp) | 1216 | static int keyspan_open (struct usb_serial_port *port, struct file *filp) |
1217 | { | 1217 | { |
1218 | struct keyspan_port_private *p_priv; | 1218 | struct keyspan_port_private *p_priv; |
1219 | struct keyspan_serial_private *s_priv; | 1219 | struct keyspan_serial_private *s_priv; |
1220 | struct usb_serial *serial = port->serial; | 1220 | struct usb_serial *serial = port->serial; |
1221 | const struct keyspan_device_details *d_details; | 1221 | const struct keyspan_device_details *d_details; |
1222 | int i, err; | 1222 | int i, err; |
1223 | int baud_rate, device_port; | ||
1223 | struct urb *urb; | 1224 | struct urb *urb; |
1225 | unsigned int cflag; | ||
1224 | 1226 | ||
1225 | s_priv = usb_get_serial_data(serial); | 1227 | s_priv = usb_get_serial_data(serial); |
1226 | p_priv = usb_get_serial_port_data(port); | 1228 | p_priv = usb_get_serial_port_data(port); |
@@ -1263,6 +1265,30 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) | |||
1263 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ | 1265 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ |
1264 | } | 1266 | } |
1265 | 1267 | ||
1268 | /* get the terminal config for the setup message now so we don't | ||
1269 | * need to send 2 of them */ | ||
1270 | |||
1271 | cflag = port->tty->termios->c_cflag; | ||
1272 | device_port = port->number - port->serial->minor; | ||
1273 | |||
1274 | /* Baud rate calculation takes baud rate as an integer | ||
1275 | so other rates can be generated if desired. */ | ||
1276 | baud_rate = tty_get_baud_rate(port->tty); | ||
1277 | /* If no match or invalid, leave as default */ | ||
1278 | if (baud_rate >= 0 | ||
1279 | && d_details->calculate_baud_rate(baud_rate, d_details->baudclk, | ||
1280 | NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { | ||
1281 | p_priv->baud = baud_rate; | ||
1282 | } | ||
1283 | |||
1284 | /* set CTS/RTS handshake etc. */ | ||
1285 | p_priv->cflag = cflag; | ||
1286 | p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none; | ||
1287 | |||
1288 | keyspan_send_setup(port, 1); | ||
1289 | //mdelay(100); | ||
1290 | //keyspan_set_termios(port, NULL); | ||
1291 | |||
1266 | return (0); | 1292 | return (0); |
1267 | } | 1293 | } |
1268 | 1294 | ||
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index a5ced7e08cbf..c29c91271133 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -2711,7 +2711,7 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2711 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); | 2711 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); |
2712 | if (status < 0) { | 2712 | if (status < 0) { |
2713 | dbg("Writing ZLP_REG5 failed status-0x%x\n", status); | 2713 | dbg("Writing ZLP_REG5 failed status-0x%x\n", status); |
2714 | return -1; | 2714 | goto error; |
2715 | } else | 2715 | } else |
2716 | dbg("ZLP_REG5 Writing success status%d\n", status); | 2716 | dbg("ZLP_REG5 Writing success status%d\n", status); |
2717 | 2717 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 2cd3f1d4b687..cf8add91de05 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -86,6 +86,7 @@ static struct usb_device_id id_table [] = { | |||
86 | { USB_DEVICE(ALCOR_VENDOR_ID, ALCOR_PRODUCT_ID) }, | 86 | { USB_DEVICE(ALCOR_VENDOR_ID, ALCOR_PRODUCT_ID) }, |
87 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ID) }, | 87 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ID) }, |
88 | { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) }, | 88 | { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) }, |
89 | { USB_DEVICE(COREGA_VENDOR_ID, COREGA_PRODUCT_ID) }, | ||
89 | { } /* Terminating entry */ | 90 | { } /* Terminating entry */ |
90 | }; | 91 | }; |
91 | 92 | ||
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index ed603e3decd6..d31f5d299989 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -104,3 +104,6 @@ | |||
104 | #define WS002IN_VENDOR_ID 0x11f6 | 104 | #define WS002IN_VENDOR_ID 0x11f6 |
105 | #define WS002IN_PRODUCT_ID 0x2001 | 105 | #define WS002IN_PRODUCT_ID 0x2001 |
106 | 106 | ||
107 | /* Corega CG-USBRS232R Serial Adapter */ | ||
108 | #define COREGA_VENDOR_ID 0x07aa | ||
109 | #define COREGA_PRODUCT_ID 0x002a | ||
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 833f6e1e3721..605ebccdcd51 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -136,6 +136,8 @@ static struct usb_device_id id_table_3port [] = { | |||
136 | { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */ | 136 | { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */ |
137 | { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ | 137 | { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ |
138 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ | 138 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ |
139 | { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ | ||
140 | { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ | ||
139 | { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ | 141 | { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ |
140 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ | 142 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ |
141 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U*/ | 143 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U*/ |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 1ba19eaa1970..836a34ae6ec6 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -177,6 +177,10 @@ static int slave_configure(struct scsi_device *sdev) | |||
177 | * is an occasional series of retries that will all fail. */ | 177 | * is an occasional series of retries that will all fail. */ |
178 | sdev->retry_hwerror = 1; | 178 | sdev->retry_hwerror = 1; |
179 | 179 | ||
180 | /* USB disks should allow restart. Some drives spin down | ||
181 | * automatically, requiring a START-STOP UNIT command. */ | ||
182 | sdev->allow_restart = 1; | ||
183 | |||
180 | } else { | 184 | } else { |
181 | 185 | ||
182 | /* Non-disk-type devices don't need to blacklist any pages | 186 | /* Non-disk-type devices don't need to blacklist any pages |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 22ab2380367d..2c27721bd259 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -342,11 +342,11 @@ UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100, | |||
342 | US_FL_FIX_CAPACITY), | 342 | US_FL_FIX_CAPACITY), |
343 | 343 | ||
344 | /* Reported by Graber and Mike Pagano <mpagano-kernel@mpagano.com> */ | 344 | /* Reported by Graber and Mike Pagano <mpagano-kernel@mpagano.com> */ |
345 | UNUSUAL_DEV( 0x04b0, 0x040f, 0x0200, 0x0200, | 345 | UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200, |
346 | "NIKON", | 346 | "NIKON", |
347 | "NIKON DSC D200", | 347 | "NIKON DSC D200", |
348 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 348 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
349 | US_FL_FIX_CAPACITY), | 349 | US_FL_FIX_CAPACITY), |
350 | 350 | ||
351 | /* Reported by Emil Larsson <emil@swip.net> */ | 351 | /* Reported by Emil Larsson <emil@swip.net> */ |
352 | UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101, | 352 | UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101, |
@@ -731,6 +731,13 @@ UNUSUAL_DEV( 0x0584, 0x0008, 0x0102, 0x0102, | |||
731 | US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ), | 731 | US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ), |
732 | #endif | 732 | #endif |
733 | 733 | ||
734 | /* Reported by RTE <raszilki@yandex.ru> */ | ||
735 | UNUSUAL_DEV( 0x058f, 0x6387, 0x0141, 0x0141, | ||
736 | "JetFlash", | ||
737 | "TS1GJF2A/120", | ||
738 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
739 | US_FL_MAX_SECTORS_64 ), | ||
740 | |||
734 | /* Fabrizio Fellini <fello@libero.it> */ | 741 | /* Fabrizio Fellini <fello@libero.it> */ |
735 | UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210, | 742 | UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210, |
736 | "Fujifilm", | 743 | "Fujifilm", |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 7d86e9eae915..5b3dbcfcda48 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -641,6 +641,17 @@ config FB_VESA | |||
641 | You will get a boot time penguin logo at no additional cost. Please | 641 | You will get a boot time penguin logo at no additional cost. Please |
642 | read <file:Documentation/fb/vesafb.txt>. If unsure, say Y. | 642 | read <file:Documentation/fb/vesafb.txt>. If unsure, say Y. |
643 | 643 | ||
644 | config FB_EFI | ||
645 | bool "EFI-based Framebuffer Support" | ||
646 | depends on (FB = y) && X86 | ||
647 | select FB_CFB_FILLRECT | ||
648 | select FB_CFB_COPYAREA | ||
649 | select FB_CFB_IMAGEBLIT | ||
650 | help | ||
651 | This is the EFI frame buffer device driver. If the firmware on | ||
652 | your platform is UEFI2.0, select Y to add support for | ||
653 | Graphics Output Protocol for early console messages to appear. | ||
654 | |||
644 | config FB_IMAC | 655 | config FB_IMAC |
645 | bool "Intel-based Macintosh Framebuffer Support" | 656 | bool "Intel-based Macintosh Framebuffer Support" |
646 | depends on (FB = y) && X86 && EFI | 657 | depends on (FB = y) && X86 && EFI |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 59d6c45a910d..83e02b3429b6 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -118,6 +118,7 @@ obj-$(CONFIG_FB_OMAP) += omap/ | |||
118 | obj-$(CONFIG_FB_UVESA) += uvesafb.o | 118 | obj-$(CONFIG_FB_UVESA) += uvesafb.o |
119 | obj-$(CONFIG_FB_VESA) += vesafb.o | 119 | obj-$(CONFIG_FB_VESA) += vesafb.o |
120 | obj-$(CONFIG_FB_IMAC) += imacfb.o | 120 | obj-$(CONFIG_FB_IMAC) += imacfb.o |
121 | obj-$(CONFIG_FB_EFI) += efifb.o | ||
121 | obj-$(CONFIG_FB_VGA16) += vga16fb.o | 122 | obj-$(CONFIG_FB_VGA16) += vga16fb.o |
122 | obj-$(CONFIG_FB_OF) += offb.o | 123 | obj-$(CONFIG_FB_OF) += offb.o |
123 | obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o | 124 | obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 235b618b4117..11a3a222dfc3 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -268,6 +268,10 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
268 | /* Turn off the LCD controller and the DMA controller */ | 268 | /* Turn off the LCD controller and the DMA controller */ |
269 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); | 269 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); |
270 | 270 | ||
271 | /* Wait for the LCDC core to become idle */ | ||
272 | while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY) | ||
273 | msleep(10); | ||
274 | |||
271 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); | 275 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); |
272 | 276 | ||
273 | if (info->var.bits_per_pixel == 1) | 277 | if (info->var.bits_per_pixel == 1) |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 1e32b3d13f2e..62867cb63fef 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -202,6 +202,7 @@ static struct pci_device_id radeonfb_pci_table[] = { | |||
202 | CHIP_DEF(PCI_CHIP_RV380_3154, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), | 202 | CHIP_DEF(PCI_CHIP_RV380_3154, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), |
203 | CHIP_DEF(PCI_CHIP_RV370_5B60, RV380, CHIP_HAS_CRTC2), | 203 | CHIP_DEF(PCI_CHIP_RV370_5B60, RV380, CHIP_HAS_CRTC2), |
204 | CHIP_DEF(PCI_CHIP_RV370_5B62, RV380, CHIP_HAS_CRTC2), | 204 | CHIP_DEF(PCI_CHIP_RV370_5B62, RV380, CHIP_HAS_CRTC2), |
205 | CHIP_DEF(PCI_CHIP_RV370_5B63, RV380, CHIP_HAS_CRTC2), | ||
205 | CHIP_DEF(PCI_CHIP_RV370_5B64, RV380, CHIP_HAS_CRTC2), | 206 | CHIP_DEF(PCI_CHIP_RV370_5B64, RV380, CHIP_HAS_CRTC2), |
206 | CHIP_DEF(PCI_CHIP_RV370_5B65, RV380, CHIP_HAS_CRTC2), | 207 | CHIP_DEF(PCI_CHIP_RV370_5B65, RV380, CHIP_HAS_CRTC2), |
207 | CHIP_DEF(PCI_CHIP_RV370_5460, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), | 208 | CHIP_DEF(PCI_CHIP_RV370_5460, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), |
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 267422f66255..b87ed37ac0c1 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig | |||
@@ -6,7 +6,7 @@ menu "Console display driver support" | |||
6 | 6 | ||
7 | config VGA_CONSOLE | 7 | config VGA_CONSOLE |
8 | bool "VGA text console" if EMBEDDED || !X86 | 8 | bool "VGA text console" if EMBEDDED || !X86 |
9 | depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE && !SUPERH && !BFIN | 9 | depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE && !SUPERH && !BLACKFIN |
10 | default y | 10 | default y |
11 | help | 11 | help |
12 | Saying Y here will allow you to use Linux in text mode through a | 12 | Saying Y here will allow you to use Linux in text mode through a |
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c new file mode 100644 index 000000000000..bd779ae44b1e --- /dev/null +++ b/drivers/video/efifb.c | |||
@@ -0,0 +1,232 @@ | |||
1 | /* | ||
2 | * Framebuffer driver for EFI/UEFI based system | ||
3 | * | ||
4 | * (c) 2006 Edgar Hucek <gimli@dark-green.com> | ||
5 | * Original efi driver written by Gerd Knorr <kraxel@goldbach.in-berlin.de> | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/errno.h> | ||
12 | #include <linux/fb.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/screen_info.h> | ||
15 | |||
16 | #include <video/vga.h> | ||
17 | |||
18 | static struct fb_var_screeninfo efifb_defined __initdata = { | ||
19 | .activate = FB_ACTIVATE_NOW, | ||
20 | .height = -1, | ||
21 | .width = -1, | ||
22 | .right_margin = 32, | ||
23 | .upper_margin = 16, | ||
24 | .lower_margin = 4, | ||
25 | .vsync_len = 4, | ||
26 | .vmode = FB_VMODE_NONINTERLACED, | ||
27 | }; | ||
28 | |||
29 | static struct fb_fix_screeninfo efifb_fix __initdata = { | ||
30 | .id = "EFI VGA", | ||
31 | .type = FB_TYPE_PACKED_PIXELS, | ||
32 | .accel = FB_ACCEL_NONE, | ||
33 | .visual = FB_VISUAL_TRUECOLOR, | ||
34 | }; | ||
35 | |||
36 | static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green, | ||
37 | unsigned blue, unsigned transp, | ||
38 | struct fb_info *info) | ||
39 | { | ||
40 | /* | ||
41 | * Set a single color register. The values supplied are | ||
42 | * already rounded down to the hardware's capabilities | ||
43 | * (according to the entries in the `var' structure). Return | ||
44 | * != 0 for invalid regno. | ||
45 | */ | ||
46 | |||
47 | if (regno >= info->cmap.len) | ||
48 | return 1; | ||
49 | |||
50 | if (regno < 16) { | ||
51 | red >>= 8; | ||
52 | green >>= 8; | ||
53 | blue >>= 8; | ||
54 | ((u32 *)(info->pseudo_palette))[regno] = | ||
55 | (red << info->var.red.offset) | | ||
56 | (green << info->var.green.offset) | | ||
57 | (blue << info->var.blue.offset); | ||
58 | } | ||
59 | return 0; | ||
60 | } | ||
61 | |||
62 | static struct fb_ops efifb_ops = { | ||
63 | .owner = THIS_MODULE, | ||
64 | .fb_setcolreg = efifb_setcolreg, | ||
65 | .fb_fillrect = cfb_fillrect, | ||
66 | .fb_copyarea = cfb_copyarea, | ||
67 | .fb_imageblit = cfb_imageblit, | ||
68 | }; | ||
69 | |||
70 | static int __init efifb_probe(struct platform_device *dev) | ||
71 | { | ||
72 | struct fb_info *info; | ||
73 | int err; | ||
74 | unsigned int size_vmode; | ||
75 | unsigned int size_remap; | ||
76 | unsigned int size_total; | ||
77 | |||
78 | efifb_fix.smem_start = screen_info.lfb_base; | ||
79 | efifb_defined.bits_per_pixel = screen_info.lfb_depth; | ||
80 | efifb_defined.xres = screen_info.lfb_width; | ||
81 | efifb_defined.yres = screen_info.lfb_height; | ||
82 | efifb_fix.line_length = screen_info.lfb_linelength; | ||
83 | |||
84 | /* size_vmode -- that is the amount of memory needed for the | ||
85 | * used video mode, i.e. the minimum amount of | ||
86 | * memory we need. */ | ||
87 | size_vmode = efifb_defined.yres * efifb_fix.line_length; | ||
88 | |||
89 | /* size_total -- all video memory we have. Used for | ||
90 | * entries, ressource allocation and bounds | ||
91 | * checking. */ | ||
92 | size_total = screen_info.lfb_size; | ||
93 | if (size_total < size_vmode) | ||
94 | size_total = size_vmode; | ||
95 | |||
96 | /* size_remap -- the amount of video memory we are going to | ||
97 | * use for efifb. With modern cards it is no | ||
98 | * option to simply use size_total as that | ||
99 | * wastes plenty of kernel address space. */ | ||
100 | size_remap = size_vmode * 2; | ||
101 | if (size_remap < size_vmode) | ||
102 | size_remap = size_vmode; | ||
103 | if (size_remap > size_total) | ||
104 | size_remap = size_total; | ||
105 | efifb_fix.smem_len = size_remap; | ||
106 | |||
107 | if (!request_mem_region(efifb_fix.smem_start, size_total, "efifb")) | ||
108 | /* We cannot make this fatal. Sometimes this comes from magic | ||
109 | spaces our resource handlers simply don't know about */ | ||
110 | printk(KERN_WARNING | ||
111 | "efifb: cannot reserve video memory at 0x%lx\n", | ||
112 | efifb_fix.smem_start); | ||
113 | |||
114 | info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev); | ||
115 | if (!info) { | ||
116 | err = -ENOMEM; | ||
117 | goto err_release_mem; | ||
118 | } | ||
119 | info->pseudo_palette = info->par; | ||
120 | info->par = NULL; | ||
121 | |||
122 | info->screen_base = ioremap(efifb_fix.smem_start, efifb_fix.smem_len); | ||
123 | if (!info->screen_base) { | ||
124 | printk(KERN_ERR "efifb: abort, cannot ioremap video memory " | ||
125 | "0x%x @ 0x%lx\n", | ||
126 | efifb_fix.smem_len, efifb_fix.smem_start); | ||
127 | err = -EIO; | ||
128 | goto err_unmap; | ||
129 | } | ||
130 | |||
131 | printk(KERN_INFO "efifb: framebuffer at 0x%lx, mapped to 0x%p, " | ||
132 | "using %dk, total %dk\n", | ||
133 | efifb_fix.smem_start, info->screen_base, | ||
134 | size_remap/1024, size_total/1024); | ||
135 | printk(KERN_INFO "efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n", | ||
136 | efifb_defined.xres, efifb_defined.yres, | ||
137 | efifb_defined.bits_per_pixel, efifb_fix.line_length, | ||
138 | screen_info.pages); | ||
139 | |||
140 | efifb_defined.xres_virtual = efifb_defined.xres; | ||
141 | efifb_defined.yres_virtual = efifb_fix.smem_len / | ||
142 | efifb_fix.line_length; | ||
143 | printk(KERN_INFO "efifb: scrolling: redraw\n"); | ||
144 | efifb_defined.yres_virtual = efifb_defined.yres; | ||
145 | |||
146 | /* some dummy values for timing to make fbset happy */ | ||
147 | efifb_defined.pixclock = 10000000 / efifb_defined.xres * | ||
148 | 1000 / efifb_defined.yres; | ||
149 | efifb_defined.left_margin = (efifb_defined.xres / 8) & 0xf8; | ||
150 | efifb_defined.hsync_len = (efifb_defined.xres / 8) & 0xf8; | ||
151 | |||
152 | efifb_defined.red.offset = screen_info.red_pos; | ||
153 | efifb_defined.red.length = screen_info.red_size; | ||
154 | efifb_defined.green.offset = screen_info.green_pos; | ||
155 | efifb_defined.green.length = screen_info.green_size; | ||
156 | efifb_defined.blue.offset = screen_info.blue_pos; | ||
157 | efifb_defined.blue.length = screen_info.blue_size; | ||
158 | efifb_defined.transp.offset = screen_info.rsvd_pos; | ||
159 | efifb_defined.transp.length = screen_info.rsvd_size; | ||
160 | |||
161 | printk(KERN_INFO "efifb: %s: " | ||
162 | "size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n", | ||
163 | "Truecolor", | ||
164 | screen_info.rsvd_size, | ||
165 | screen_info.red_size, | ||
166 | screen_info.green_size, | ||
167 | screen_info.blue_size, | ||
168 | screen_info.rsvd_pos, | ||
169 | screen_info.red_pos, | ||
170 | screen_info.green_pos, | ||
171 | screen_info.blue_pos); | ||
172 | |||
173 | efifb_fix.ypanstep = 0; | ||
174 | efifb_fix.ywrapstep = 0; | ||
175 | |||
176 | info->fbops = &efifb_ops; | ||
177 | info->var = efifb_defined; | ||
178 | info->fix = efifb_fix; | ||
179 | info->flags = FBINFO_FLAG_DEFAULT; | ||
180 | |||
181 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { | ||
182 | err = -ENOMEM; | ||
183 | goto err_unmap; | ||
184 | } | ||
185 | if (register_framebuffer(info) < 0) { | ||
186 | err = -EINVAL; | ||
187 | goto err_fb_dealoc; | ||
188 | } | ||
189 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | ||
190 | info->node, info->fix.id); | ||
191 | return 0; | ||
192 | |||
193 | err_fb_dealoc: | ||
194 | fb_dealloc_cmap(&info->cmap); | ||
195 | err_unmap: | ||
196 | iounmap(info->screen_base); | ||
197 | framebuffer_release(info); | ||
198 | err_release_mem: | ||
199 | release_mem_region(efifb_fix.smem_start, size_total); | ||
200 | return err; | ||
201 | } | ||
202 | |||
203 | static struct platform_driver efifb_driver = { | ||
204 | .probe = efifb_probe, | ||
205 | .driver = { | ||
206 | .name = "efifb", | ||
207 | }, | ||
208 | }; | ||
209 | |||
210 | static struct platform_device efifb_device = { | ||
211 | .name = "efifb", | ||
212 | }; | ||
213 | |||
214 | static int __init efifb_init(void) | ||
215 | { | ||
216 | int ret; | ||
217 | |||
218 | if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) | ||
219 | return -ENODEV; | ||
220 | |||
221 | ret = platform_driver_register(&efifb_driver); | ||
222 | |||
223 | if (!ret) { | ||
224 | ret = platform_device_register(&efifb_device); | ||
225 | if (ret) | ||
226 | platform_driver_unregister(&efifb_driver); | ||
227 | } | ||
228 | return ret; | ||
229 | } | ||
230 | module_init(efifb_init); | ||
231 | |||
232 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/fb_ddc.c b/drivers/video/fb_ddc.c index f836137a0eda..a0df63289b5f 100644 --- a/drivers/video/fb_ddc.c +++ b/drivers/video/fb_ddc.c | |||
@@ -56,13 +56,12 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter) | |||
56 | int i, j; | 56 | int i, j; |
57 | 57 | ||
58 | algo_data->setscl(algo_data->data, 1); | 58 | algo_data->setscl(algo_data->data, 1); |
59 | algo_data->setscl(algo_data->data, 0); | ||
60 | 59 | ||
61 | for (i = 0; i < 3; i++) { | 60 | for (i = 0; i < 3; i++) { |
62 | /* For some old monitors we need the | 61 | /* For some old monitors we need the |
63 | * following process to initialize/stop DDC | 62 | * following process to initialize/stop DDC |
64 | */ | 63 | */ |
65 | algo_data->setsda(algo_data->data, 0); | 64 | algo_data->setsda(algo_data->data, 1); |
66 | msleep(13); | 65 | msleep(13); |
67 | 66 | ||
68 | algo_data->setscl(algo_data->data, 1); | 67 | algo_data->setscl(algo_data->data, 1); |
@@ -97,14 +96,15 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter) | |||
97 | algo_data->setsda(algo_data->data, 1); | 96 | algo_data->setsda(algo_data->data, 1); |
98 | msleep(15); | 97 | msleep(15); |
99 | algo_data->setscl(algo_data->data, 0); | 98 | algo_data->setscl(algo_data->data, 0); |
99 | algo_data->setsda(algo_data->data, 0); | ||
100 | if (edid) | 100 | if (edid) |
101 | break; | 101 | break; |
102 | } | 102 | } |
103 | /* Release the DDC lines when done or the Apple Cinema HD display | 103 | /* Release the DDC lines when done or the Apple Cinema HD display |
104 | * will switch off | 104 | * will switch off |
105 | */ | 105 | */ |
106 | algo_data->setsda(algo_data->data, 0); | 106 | algo_data->setsda(algo_data->data, 1); |
107 | algo_data->setscl(algo_data->data, 0); | 107 | algo_data->setscl(algo_data->data, 1); |
108 | 108 | ||
109 | return edid; | 109 | return edid; |
110 | } | 110 | } |
diff --git a/drivers/video/imacfb.c b/drivers/video/imacfb.c index 6455fd2a39f2..9366ef2bb5f7 100644 --- a/drivers/video/imacfb.c +++ b/drivers/video/imacfb.c | |||
@@ -234,10 +234,6 @@ static int __init imacfb_probe(struct platform_device *dev) | |||
234 | size_remap = size_total; | 234 | size_remap = size_total; |
235 | imacfb_fix.smem_len = size_remap; | 235 | imacfb_fix.smem_len = size_remap; |
236 | 236 | ||
237 | #ifndef __i386__ | ||
238 | screen_info.imacpm_seg = 0; | ||
239 | #endif | ||
240 | |||
241 | if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) { | 237 | if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) { |
242 | printk(KERN_WARNING | 238 | printk(KERN_WARNING |
243 | "imacfb: cannot reserve video memory at 0x%lx\n", | 239 | "imacfb: cannot reserve video memory at 0x%lx\n", |
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index 75836aa83191..9c56c492a693 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -51,7 +51,6 @@ | |||
51 | #define L1GPU_DISPLAY_SYNC_HSYNC 1 | 51 | #define L1GPU_DISPLAY_SYNC_HSYNC 1 |
52 | #define L1GPU_DISPLAY_SYNC_VSYNC 2 | 52 | #define L1GPU_DISPLAY_SYNC_VSYNC 2 |
53 | 53 | ||
54 | #define DDR_SIZE (0) /* used no ddr */ | ||
55 | #define GPU_CMD_BUF_SIZE (64 * 1024) | 54 | #define GPU_CMD_BUF_SIZE (64 * 1024) |
56 | #define GPU_IOIF (0x0d000000UL) | 55 | #define GPU_IOIF (0x0d000000UL) |
57 | #define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64) | 56 | #define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64) |
@@ -1060,6 +1059,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1060 | u64 xdr_lpar; | 1059 | u64 xdr_lpar; |
1061 | int status, res_index; | 1060 | int status, res_index; |
1062 | struct task_struct *task; | 1061 | struct task_struct *task; |
1062 | unsigned long max_ps3fb_size; | ||
1063 | 1063 | ||
1064 | status = ps3_open_hv_device(dev); | 1064 | status = ps3_open_hv_device(dev); |
1065 | if (status) { | 1065 | if (status) { |
@@ -1085,8 +1085,15 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1085 | 1085 | ||
1086 | ps3fb_set_sync(&dev->core); | 1086 | ps3fb_set_sync(&dev->core); |
1087 | 1087 | ||
1088 | max_ps3fb_size = _ALIGN_UP(GPU_IOIF, 256*1024*1024) - GPU_IOIF; | ||
1089 | if (ps3fb_videomemory.size > max_ps3fb_size) { | ||
1090 | dev_info(&dev->core, "Limiting ps3fb mem size to %lu bytes\n", | ||
1091 | max_ps3fb_size); | ||
1092 | ps3fb_videomemory.size = max_ps3fb_size; | ||
1093 | } | ||
1094 | |||
1088 | /* get gpu context handle */ | 1095 | /* get gpu context handle */ |
1089 | status = lv1_gpu_memory_allocate(DDR_SIZE, 0, 0, 0, 0, | 1096 | status = lv1_gpu_memory_allocate(ps3fb_videomemory.size, 0, 0, 0, 0, |
1090 | &ps3fb.memory_handle, &ddr_lpar); | 1097 | &ps3fb.memory_handle, &ddr_lpar); |
1091 | if (status) { | 1098 | if (status) { |
1092 | dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n", | 1099 | dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n", |
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 15d7787dea87..69d7ea02cd48 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
@@ -96,10 +96,23 @@ static int virtio_dev_probe(struct device *_d) | |||
96 | return err; | 96 | return err; |
97 | } | 97 | } |
98 | 98 | ||
99 | static int virtio_dev_remove(struct device *_d) | ||
100 | { | ||
101 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | ||
102 | struct virtio_driver *drv = container_of(dev->dev.driver, | ||
103 | struct virtio_driver, driver); | ||
104 | |||
105 | dev->config->set_status(dev, dev->config->get_status(dev) | ||
106 | & ~VIRTIO_CONFIG_S_DRIVER); | ||
107 | drv->remove(dev); | ||
108 | return 0; | ||
109 | } | ||
110 | |||
99 | int register_virtio_driver(struct virtio_driver *driver) | 111 | int register_virtio_driver(struct virtio_driver *driver) |
100 | { | 112 | { |
101 | driver->driver.bus = &virtio_bus; | 113 | driver->driver.bus = &virtio_bus; |
102 | driver->driver.probe = virtio_dev_probe; | 114 | driver->driver.probe = virtio_dev_probe; |
115 | driver->driver.remove = virtio_dev_remove; | ||
103 | return driver_register(&driver->driver); | 116 | return driver_register(&driver->driver); |
104 | } | 117 | } |
105 | EXPORT_SYMBOL_GPL(register_virtio_driver); | 118 | EXPORT_SYMBOL_GPL(register_virtio_driver); |
diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c index 067c07be928c..e6c4390d8bd6 100644 --- a/drivers/zorro/zorro-driver.c +++ b/drivers/zorro/zorro-driver.c | |||
@@ -60,6 +60,20 @@ static int zorro_device_probe(struct device *dev) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | 62 | ||
63 | static int zorro_device_remove(struct device *dev) | ||
64 | { | ||
65 | struct zorro_dev *z = to_zorro_dev(dev); | ||
66 | struct zorro_driver *drv = to_zorro_driver(dev->driver); | ||
67 | |||
68 | if (drv) { | ||
69 | if (drv->remove) | ||
70 | drv->remove(z); | ||
71 | z->driver = NULL; | ||
72 | } | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | |||
63 | /** | 77 | /** |
64 | * zorro_register_driver - register a new Zorro driver | 78 | * zorro_register_driver - register a new Zorro driver |
65 | * @drv: the driver structure to register | 79 | * @drv: the driver structure to register |
@@ -128,6 +142,7 @@ struct bus_type zorro_bus_type = { | |||
128 | .name = "zorro", | 142 | .name = "zorro", |
129 | .match = zorro_bus_match, | 143 | .match = zorro_bus_match, |
130 | .probe = zorro_device_probe, | 144 | .probe = zorro_device_probe, |
145 | .remove = zorro_device_remove, | ||
131 | }; | 146 | }; |
132 | 147 | ||
133 | 148 | ||