diff options
Diffstat (limited to 'drivers')
468 files changed, 10206 insertions, 5436 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 5d0e26a5c34c..b9f923ef173d 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig ACPI | 5 | menuconfig ACPI |
6 | bool "ACPI Support (Advanced Configuration and Power Interface) Support" | 6 | bool "ACPI (Advanced Configuration and Power Interface) Support" |
7 | depends on !X86_NUMAQ | 7 | depends on !X86_NUMAQ |
8 | depends on !X86_VISWS | 8 | depends on !X86_VISWS |
9 | depends on !IA64_HP_SIM | 9 | depends on !IA64_HP_SIM |
@@ -67,7 +67,21 @@ config ACPI_PROCFS | |||
67 | and functions which do not yet exist in /sys. | 67 | and functions which do not yet exist in /sys. |
68 | 68 | ||
69 | 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/ |
70 | 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/ | ||
71 | config ACPI_PROC_EVENT | 85 | config ACPI_PROC_EVENT |
72 | bool "Deprecated /proc/acpi/event support" | 86 | bool "Deprecated /proc/acpi/event support" |
73 | depends on PROC_FS | 87 | depends on PROC_FS |
@@ -88,7 +102,8 @@ config ACPI_PROC_EVENT | |||
88 | 102 | ||
89 | config ACPI_AC | 103 | config ACPI_AC |
90 | tristate "AC Adapter" | 104 | tristate "AC Adapter" |
91 | depends on X86 && POWER_SUPPLY | 105 | depends on X86 |
106 | select POWER_SUPPLY | ||
92 | default y | 107 | default y |
93 | help | 108 | help |
94 | This driver adds support for the AC Adapter object, which indicates | 109 | This driver adds support for the AC Adapter object, which indicates |
@@ -97,7 +112,8 @@ config ACPI_AC | |||
97 | 112 | ||
98 | config ACPI_BATTERY | 113 | config ACPI_BATTERY |
99 | tristate "Battery" | 114 | tristate "Battery" |
100 | depends on X86 && POWER_SUPPLY | 115 | depends on X86 |
116 | select POWER_SUPPLY | ||
101 | default y | 117 | default y |
102 | help | 118 | help |
103 | This driver adds support for battery information through | 119 | This driver adds support for battery information through |
@@ -352,7 +368,7 @@ config ACPI_HOTPLUG_MEMORY | |||
352 | config ACPI_SBS | 368 | config ACPI_SBS |
353 | tristate "Smart Battery System" | 369 | tristate "Smart Battery System" |
354 | depends on X86 | 370 | depends on X86 |
355 | depends on POWER_SUPPLY | 371 | select POWER_SUPPLY |
356 | help | 372 | help |
357 | This driver adds support for the Smart Battery System, another | 373 | This driver adds support for the Smart Battery System, another |
358 | type of access to battery information, found on some laptops. | 374 | type of access to battery information, found on some laptops. |
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 e03de37a750d..76ed4f52bebd 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -27,8 +27,10 @@ | |||
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_POWER | ||
30 | #include <linux/proc_fs.h> | 31 | #include <linux/proc_fs.h> |
31 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
33 | #endif | ||
32 | #include <linux/power_supply.h> | 34 | #include <linux/power_supply.h> |
33 | #include <acpi/acpi_bus.h> | 35 | #include <acpi/acpi_bus.h> |
34 | #include <acpi/acpi_drivers.h> | 36 | #include <acpi/acpi_drivers.h> |
@@ -49,12 +51,15 @@ MODULE_AUTHOR("Paul Diefenbaugh"); | |||
49 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); | 51 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); |
50 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
51 | 53 | ||
54 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
52 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); | 55 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); |
53 | 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); | ||
58 | #endif | ||
54 | 59 | ||
55 | static int acpi_ac_add(struct acpi_device *device); | 60 | static int acpi_ac_add(struct acpi_device *device); |
56 | static int acpi_ac_remove(struct acpi_device *device, int type); | 61 | static int acpi_ac_remove(struct acpi_device *device, int type); |
57 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); | 62 | static int acpi_ac_resume(struct acpi_device *device); |
58 | 63 | ||
59 | const static struct acpi_device_id ac_device_ids[] = { | 64 | const static struct acpi_device_id ac_device_ids[] = { |
60 | {"ACPI0003", 0}, | 65 | {"ACPI0003", 0}, |
@@ -69,6 +74,7 @@ static struct acpi_driver acpi_ac_driver = { | |||
69 | .ops = { | 74 | .ops = { |
70 | .add = acpi_ac_add, | 75 | .add = acpi_ac_add, |
71 | .remove = acpi_ac_remove, | 76 | .remove = acpi_ac_remove, |
77 | .resume = acpi_ac_resume, | ||
72 | }, | 78 | }, |
73 | }; | 79 | }; |
74 | 80 | ||
@@ -80,12 +86,15 @@ struct acpi_ac { | |||
80 | 86 | ||
81 | #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); |
82 | 88 | ||
89 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
83 | static const struct file_operations acpi_ac_fops = { | 90 | static const struct file_operations acpi_ac_fops = { |
84 | .open = acpi_ac_open_fs, | 91 | .open = acpi_ac_open_fs, |
85 | .read = seq_read, | 92 | .read = seq_read, |
86 | .llseek = seq_lseek, | 93 | .llseek = seq_lseek, |
87 | .release = single_release, | 94 | .release = single_release, |
88 | }; | 95 | }; |
96 | #endif | ||
97 | |||
89 | static int get_ac_property(struct power_supply *psy, | 98 | static int get_ac_property(struct power_supply *psy, |
90 | enum power_supply_property psp, | 99 | enum power_supply_property psp, |
91 | union power_supply_propval *val) | 100 | union power_supply_propval *val) |
@@ -127,6 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) | |||
127 | return 0; | 136 | return 0; |
128 | } | 137 | } |
129 | 138 | ||
139 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
130 | /* -------------------------------------------------------------------------- | 140 | /* -------------------------------------------------------------------------- |
131 | FS Interface (/proc) | 141 | FS Interface (/proc) |
132 | -------------------------------------------------------------------------- */ | 142 | -------------------------------------------------------------------------- */ |
@@ -206,6 +216,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device) | |||
206 | 216 | ||
207 | return 0; | 217 | return 0; |
208 | } | 218 | } |
219 | #endif | ||
209 | 220 | ||
210 | /* -------------------------------------------------------------------------- | 221 | /* -------------------------------------------------------------------------- |
211 | Driver Model | 222 | Driver Model |
@@ -264,7 +275,9 @@ static int acpi_ac_add(struct acpi_device *device) | |||
264 | if (result) | 275 | if (result) |
265 | goto end; | 276 | goto end; |
266 | 277 | ||
278 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
267 | result = acpi_ac_add_fs(device); | 279 | result = acpi_ac_add_fs(device); |
280 | #endif | ||
268 | if (result) | 281 | if (result) |
269 | goto end; | 282 | goto end; |
270 | ac->charger.name = acpi_device_bid(device); | 283 | ac->charger.name = acpi_device_bid(device); |
@@ -287,13 +300,30 @@ static int acpi_ac_add(struct acpi_device *device) | |||
287 | 300 | ||
288 | end: | 301 | end: |
289 | if (result) { | 302 | if (result) { |
303 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
290 | acpi_ac_remove_fs(device); | 304 | acpi_ac_remove_fs(device); |
305 | #endif | ||
291 | kfree(ac); | 306 | kfree(ac); |
292 | } | 307 | } |
293 | 308 | ||
294 | return result; | 309 | return result; |
295 | } | 310 | } |
296 | 311 | ||
312 | static int acpi_ac_resume(struct acpi_device *device) | ||
313 | { | ||
314 | struct acpi_ac *ac; | ||
315 | unsigned old_state; | ||
316 | if (!device || !acpi_driver_data(device)) | ||
317 | return -EINVAL; | ||
318 | ac = acpi_driver_data(device); | ||
319 | old_state = ac->state; | ||
320 | if (acpi_ac_get_state(ac)) | ||
321 | return 0; | ||
322 | if (old_state != ac->state) | ||
323 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); | ||
324 | return 0; | ||
325 | } | ||
326 | |||
297 | static int acpi_ac_remove(struct acpi_device *device, int type) | 327 | static int acpi_ac_remove(struct acpi_device *device, int type) |
298 | { | 328 | { |
299 | acpi_status status = AE_OK; | 329 | acpi_status status = AE_OK; |
@@ -309,7 +339,9 @@ static int acpi_ac_remove(struct acpi_device *device, int type) | |||
309 | ACPI_ALL_NOTIFY, acpi_ac_notify); | 339 | ACPI_ALL_NOTIFY, acpi_ac_notify); |
310 | if (ac->charger.dev) | 340 | if (ac->charger.dev) |
311 | power_supply_unregister(&ac->charger); | 341 | power_supply_unregister(&ac->charger); |
342 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
312 | acpi_ac_remove_fs(device); | 343 | acpi_ac_remove_fs(device); |
344 | #endif | ||
313 | 345 | ||
314 | kfree(ac); | 346 | kfree(ac); |
315 | 347 | ||
@@ -323,13 +355,17 @@ static int __init acpi_ac_init(void) | |||
323 | if (acpi_disabled) | 355 | if (acpi_disabled) |
324 | return -ENODEV; | 356 | return -ENODEV; |
325 | 357 | ||
358 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
326 | acpi_ac_dir = acpi_lock_ac_dir(); | 359 | acpi_ac_dir = acpi_lock_ac_dir(); |
327 | if (!acpi_ac_dir) | 360 | if (!acpi_ac_dir) |
328 | return -ENODEV; | 361 | return -ENODEV; |
362 | #endif | ||
329 | 363 | ||
330 | result = acpi_bus_register_driver(&acpi_ac_driver); | 364 | result = acpi_bus_register_driver(&acpi_ac_driver); |
331 | if (result < 0) { | 365 | if (result < 0) { |
366 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
332 | acpi_unlock_ac_dir(acpi_ac_dir); | 367 | acpi_unlock_ac_dir(acpi_ac_dir); |
368 | #endif | ||
333 | return -ENODEV; | 369 | return -ENODEV; |
334 | } | 370 | } |
335 | 371 | ||
@@ -341,7 +377,9 @@ static void __exit acpi_ac_exit(void) | |||
341 | 377 | ||
342 | acpi_bus_unregister_driver(&acpi_ac_driver); | 378 | acpi_bus_unregister_driver(&acpi_ac_driver); |
343 | 379 | ||
380 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
344 | acpi_unlock_ac_dir(acpi_ac_dir); | 381 | acpi_unlock_ac_dir(acpi_ac_dir); |
382 | #endif | ||
345 | 383 | ||
346 | return; | 384 | return; |
347 | } | 385 | } |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 681e26b56b11..7d6be23eff89 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,19 +125,25 @@ 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)) | ||
129 | return POWER_SUPPLY_TECHNOLOGY_LION; | ||
128 | if (!strcasecmp("LiP", battery->type)) | 130 | if (!strcasecmp("LiP", battery->type)) |
129 | return POWER_SUPPLY_TECHNOLOGY_LIPO; | 131 | return POWER_SUPPLY_TECHNOLOGY_LIPO; |
130 | return POWER_SUPPLY_TECHNOLOGY_UNKNOWN; | 132 | return POWER_SUPPLY_TECHNOLOGY_UNKNOWN; |
131 | } | 133 | } |
132 | 134 | ||
135 | static int acpi_battery_get_state(struct acpi_battery *battery); | ||
136 | |||
133 | static int acpi_battery_get_property(struct power_supply *psy, | 137 | static int acpi_battery_get_property(struct power_supply *psy, |
134 | enum power_supply_property psp, | 138 | enum power_supply_property psp, |
135 | union power_supply_propval *val) | 139 | union power_supply_propval *val) |
136 | { | 140 | { |
137 | struct acpi_battery *battery = to_acpi_battery(psy); | 141 | struct acpi_battery *battery = to_acpi_battery(psy); |
138 | 142 | ||
139 | if ((!acpi_battery_present(battery)) && | 143 | if (acpi_battery_present(battery)) { |
140 | psp != POWER_SUPPLY_PROP_PRESENT) | 144 | /* run battery update only if it is present */ |
145 | acpi_battery_get_state(battery); | ||
146 | } else if (psp != POWER_SUPPLY_PROP_PRESENT) | ||
141 | return -ENODEV; | 147 | return -ENODEV; |
142 | switch (psp) { | 148 | switch (psp) { |
143 | case POWER_SUPPLY_PROP_STATUS: | 149 | case POWER_SUPPLY_PROP_STATUS: |
@@ -147,6 +153,8 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
147 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | 153 | val->intval = POWER_SUPPLY_STATUS_CHARGING; |
148 | else if (battery->state == 0) | 154 | else if (battery->state == 0) |
149 | val->intval = POWER_SUPPLY_STATUS_FULL; | 155 | val->intval = POWER_SUPPLY_STATUS_FULL; |
156 | else | ||
157 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | ||
150 | break; | 158 | break; |
151 | case POWER_SUPPLY_PROP_PRESENT: | 159 | case POWER_SUPPLY_PROP_PRESENT: |
152 | val->intval = acpi_battery_present(battery); | 160 | val->intval = acpi_battery_present(battery); |
@@ -215,7 +223,7 @@ static enum power_supply_property energy_battery_props[] = { | |||
215 | POWER_SUPPLY_PROP_MANUFACTURER, | 223 | POWER_SUPPLY_PROP_MANUFACTURER, |
216 | }; | 224 | }; |
217 | 225 | ||
218 | #ifdef CONFIG_ACPI_PROCFS | 226 | #ifdef CONFIG_ACPI_PROCFS_POWER |
219 | inline char *acpi_battery_units(struct acpi_battery *battery) | 227 | inline char *acpi_battery_units(struct acpi_battery *battery) |
220 | { | 228 | { |
221 | return (battery->power_unit)?"mA":"mW"; | 229 | return (battery->power_unit)?"mA":"mW"; |
@@ -257,7 +265,7 @@ static int extract_package(struct acpi_battery *battery, | |||
257 | union acpi_object *package, | 265 | union acpi_object *package, |
258 | struct acpi_offsets *offsets, int num) | 266 | struct acpi_offsets *offsets, int num) |
259 | { | 267 | { |
260 | int i, *x; | 268 | int i; |
261 | union acpi_object *element; | 269 | union acpi_object *element; |
262 | if (package->type != ACPI_TYPE_PACKAGE) | 270 | if (package->type != ACPI_TYPE_PACKAGE) |
263 | return -EFAULT; | 271 | return -EFAULT; |
@@ -266,16 +274,21 @@ static int extract_package(struct acpi_battery *battery, | |||
266 | return -EFAULT; | 274 | return -EFAULT; |
267 | element = &package->package.elements[i]; | 275 | element = &package->package.elements[i]; |
268 | if (offsets[i].mode) { | 276 | if (offsets[i].mode) { |
269 | if (element->type != ACPI_TYPE_STRING && | 277 | u8 *ptr = (u8 *)battery + offsets[i].offset; |
270 | element->type != ACPI_TYPE_BUFFER) | 278 | if (element->type == ACPI_TYPE_STRING || |
271 | return -EFAULT; | 279 | element->type == ACPI_TYPE_BUFFER) |
272 | strncpy((u8 *)battery + offsets[i].offset, | 280 | strncpy(ptr, element->string.pointer, 32); |
273 | element->string.pointer, 32); | 281 | else if (element->type == ACPI_TYPE_INTEGER) { |
282 | strncpy(ptr, (u8 *)&element->integer.value, | ||
283 | sizeof(acpi_integer)); | ||
284 | ptr[sizeof(acpi_integer)] = 0; | ||
285 | } else return -EFAULT; | ||
274 | } else { | 286 | } else { |
275 | if (element->type != ACPI_TYPE_INTEGER) | 287 | if (element->type == ACPI_TYPE_INTEGER) { |
276 | return -EFAULT; | 288 | int *x = (int *)((u8 *)battery + |
277 | x = (int *)((u8 *)battery + offsets[i].offset); | 289 | offsets[i].offset); |
278 | *x = element->integer.value; | 290 | *x = element->integer.value; |
291 | } else return -EFAULT; | ||
279 | } | 292 | } |
280 | } | 293 | } |
281 | return 0; | 294 | return 0; |
@@ -385,29 +398,82 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery) | |||
385 | return acpi_battery_set_alarm(battery); | 398 | return acpi_battery_set_alarm(battery); |
386 | } | 399 | } |
387 | 400 | ||
401 | static ssize_t acpi_battery_alarm_show(struct device *dev, | ||
402 | struct device_attribute *attr, | ||
403 | char *buf) | ||
404 | { | ||
405 | struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); | ||
406 | return sprintf(buf, "%d\n", battery->alarm * 1000); | ||
407 | } | ||
408 | |||
409 | static ssize_t acpi_battery_alarm_store(struct device *dev, | ||
410 | struct device_attribute *attr, | ||
411 | const char *buf, size_t count) | ||
412 | { | ||
413 | unsigned long x; | ||
414 | struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); | ||
415 | if (sscanf(buf, "%ld\n", &x) == 1) | ||
416 | battery->alarm = x/1000; | ||
417 | if (acpi_battery_present(battery)) | ||
418 | acpi_battery_set_alarm(battery); | ||
419 | return count; | ||
420 | } | ||
421 | |||
422 | static struct device_attribute alarm_attr = { | ||
423 | .attr = {.name = "alarm", .mode = 0644, .owner = THIS_MODULE}, | ||
424 | .show = acpi_battery_alarm_show, | ||
425 | .store = acpi_battery_alarm_store, | ||
426 | }; | ||
427 | |||
428 | static int sysfs_add_battery(struct acpi_battery *battery) | ||
429 | { | ||
430 | int result; | ||
431 | |||
432 | battery->update_time = 0; | ||
433 | result = acpi_battery_get_info(battery); | ||
434 | acpi_battery_init_alarm(battery); | ||
435 | if (result) | ||
436 | return result; | ||
437 | if (battery->power_unit) { | ||
438 | battery->bat.properties = charge_battery_props; | ||
439 | battery->bat.num_properties = | ||
440 | ARRAY_SIZE(charge_battery_props); | ||
441 | } else { | ||
442 | battery->bat.properties = energy_battery_props; | ||
443 | battery->bat.num_properties = | ||
444 | ARRAY_SIZE(energy_battery_props); | ||
445 | } | ||
446 | |||
447 | battery->bat.name = acpi_device_bid(battery->device); | ||
448 | battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; | ||
449 | battery->bat.get_property = acpi_battery_get_property; | ||
450 | |||
451 | result = power_supply_register(&battery->device->dev, &battery->bat); | ||
452 | if (result) | ||
453 | return result; | ||
454 | return device_create_file(battery->bat.dev, &alarm_attr); | ||
455 | } | ||
456 | |||
457 | static void sysfs_remove_battery(struct acpi_battery *battery) | ||
458 | { | ||
459 | if (!battery->bat.dev) | ||
460 | return; | ||
461 | device_remove_file(battery->bat.dev, &alarm_attr); | ||
462 | power_supply_unregister(&battery->bat); | ||
463 | battery->bat.dev = NULL; | ||
464 | } | ||
465 | |||
388 | static int acpi_battery_update(struct acpi_battery *battery) | 466 | static int acpi_battery_update(struct acpi_battery *battery) |
389 | { | 467 | { |
390 | int saved_present = acpi_battery_present(battery); | ||
391 | int result = acpi_battery_get_status(battery); | 468 | int result = acpi_battery_get_status(battery); |
392 | if (result || !acpi_battery_present(battery)) | 469 | if (result) |
393 | return result; | 470 | return result; |
394 | if (saved_present != acpi_battery_present(battery) || | 471 | if (!acpi_battery_present(battery)) { |
395 | !battery->update_time) { | 472 | sysfs_remove_battery(battery); |
396 | battery->update_time = 0; | 473 | return 0; |
397 | result = acpi_battery_get_info(battery); | ||
398 | if (result) | ||
399 | return result; | ||
400 | if (battery->power_unit) { | ||
401 | battery->bat.properties = charge_battery_props; | ||
402 | battery->bat.num_properties = | ||
403 | ARRAY_SIZE(charge_battery_props); | ||
404 | } else { | ||
405 | battery->bat.properties = energy_battery_props; | ||
406 | battery->bat.num_properties = | ||
407 | ARRAY_SIZE(energy_battery_props); | ||
408 | } | ||
409 | acpi_battery_init_alarm(battery); | ||
410 | } | 474 | } |
475 | if (!battery->bat.dev) | ||
476 | sysfs_add_battery(battery); | ||
411 | return acpi_battery_get_state(battery); | 477 | return acpi_battery_get_state(battery); |
412 | } | 478 | } |
413 | 479 | ||
@@ -415,7 +481,7 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
415 | FS Interface (/proc) | 481 | FS Interface (/proc) |
416 | -------------------------------------------------------------------------- */ | 482 | -------------------------------------------------------------------------- */ |
417 | 483 | ||
418 | #ifdef CONFIG_ACPI_PROCFS | 484 | #ifdef CONFIG_ACPI_PROCFS_POWER |
419 | static struct proc_dir_entry *acpi_battery_dir; | 485 | static struct proc_dir_entry *acpi_battery_dir; |
420 | 486 | ||
421 | 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) |
@@ -554,10 +620,6 @@ static ssize_t acpi_battery_write_alarm(struct file *file, | |||
554 | 620 | ||
555 | if (!battery || (count > sizeof(alarm_string) - 1)) | 621 | if (!battery || (count > sizeof(alarm_string) - 1)) |
556 | return -EINVAL; | 622 | return -EINVAL; |
557 | if (result) { | ||
558 | result = -ENODEV; | ||
559 | goto end; | ||
560 | } | ||
561 | if (!acpi_battery_present(battery)) { | 623 | if (!acpi_battery_present(battery)) { |
562 | result = -ENODEV; | 624 | result = -ENODEV; |
563 | goto end; | 625 | goto end; |
@@ -688,33 +750,6 @@ static void acpi_battery_remove_fs(struct acpi_device *device) | |||
688 | 750 | ||
689 | #endif | 751 | #endif |
690 | 752 | ||
691 | static ssize_t acpi_battery_alarm_show(struct device *dev, | ||
692 | struct device_attribute *attr, | ||
693 | char *buf) | ||
694 | { | ||
695 | struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); | ||
696 | return sprintf(buf, "%d\n", battery->alarm * 1000); | ||
697 | } | ||
698 | |||
699 | static ssize_t acpi_battery_alarm_store(struct device *dev, | ||
700 | struct device_attribute *attr, | ||
701 | const char *buf, size_t count) | ||
702 | { | ||
703 | unsigned long x; | ||
704 | struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); | ||
705 | if (sscanf(buf, "%ld\n", &x) == 1) | ||
706 | battery->alarm = x/1000; | ||
707 | if (acpi_battery_present(battery)) | ||
708 | acpi_battery_set_alarm(battery); | ||
709 | return count; | ||
710 | } | ||
711 | |||
712 | static struct device_attribute alarm_attr = { | ||
713 | .attr = {.name = "alarm", .mode = 0644, .owner = THIS_MODULE}, | ||
714 | .show = acpi_battery_alarm_show, | ||
715 | .store = acpi_battery_alarm_store, | ||
716 | }; | ||
717 | |||
718 | /* -------------------------------------------------------------------------- | 753 | /* -------------------------------------------------------------------------- |
719 | Driver Interface | 754 | Driver Interface |
720 | -------------------------------------------------------------------------- */ | 755 | -------------------------------------------------------------------------- */ |
@@ -732,7 +767,9 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) | |||
732 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 767 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
733 | device->dev.bus_id, event, | 768 | device->dev.bus_id, event, |
734 | acpi_battery_present(battery)); | 769 | acpi_battery_present(battery)); |
735 | kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); | 770 | /* acpi_batter_update could remove power_supply object */ |
771 | if (battery->bat.dev) | ||
772 | kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); | ||
736 | } | 773 | } |
737 | 774 | ||
738 | static int acpi_battery_add(struct acpi_device *device) | 775 | static int acpi_battery_add(struct acpi_device *device) |
@@ -751,16 +788,11 @@ static int acpi_battery_add(struct acpi_device *device) | |||
751 | acpi_driver_data(device) = battery; | 788 | acpi_driver_data(device) = battery; |
752 | mutex_init(&battery->lock); | 789 | mutex_init(&battery->lock); |
753 | acpi_battery_update(battery); | 790 | acpi_battery_update(battery); |
754 | #ifdef CONFIG_ACPI_PROCFS | 791 | #ifdef CONFIG_ACPI_PROCFS_POWER |
755 | result = acpi_battery_add_fs(device); | 792 | result = acpi_battery_add_fs(device); |
756 | if (result) | 793 | if (result) |
757 | goto end; | 794 | goto end; |
758 | #endif | 795 | #endif |
759 | battery->bat.name = acpi_device_bid(device); | ||
760 | battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; | ||
761 | battery->bat.get_property = acpi_battery_get_property; | ||
762 | result = power_supply_register(&battery->device->dev, &battery->bat); | ||
763 | result = device_create_file(battery->bat.dev, &alarm_attr); | ||
764 | status = acpi_install_notify_handler(device->handle, | 796 | status = acpi_install_notify_handler(device->handle, |
765 | ACPI_ALL_NOTIFY, | 797 | ACPI_ALL_NOTIFY, |
766 | acpi_battery_notify, battery); | 798 | acpi_battery_notify, battery); |
@@ -774,7 +806,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
774 | device->status.battery_present ? "present" : "absent"); | 806 | device->status.battery_present ? "present" : "absent"); |
775 | end: | 807 | end: |
776 | if (result) { | 808 | if (result) { |
777 | #ifdef CONFIG_ACPI_PROCFS | 809 | #ifdef CONFIG_ACPI_PROCFS_POWER |
778 | acpi_battery_remove_fs(device); | 810 | acpi_battery_remove_fs(device); |
779 | #endif | 811 | #endif |
780 | kfree(battery); | 812 | kfree(battery); |
@@ -793,13 +825,10 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
793 | status = acpi_remove_notify_handler(device->handle, | 825 | status = acpi_remove_notify_handler(device->handle, |
794 | ACPI_ALL_NOTIFY, | 826 | ACPI_ALL_NOTIFY, |
795 | acpi_battery_notify); | 827 | acpi_battery_notify); |
796 | #ifdef CONFIG_ACPI_PROCFS | 828 | #ifdef CONFIG_ACPI_PROCFS_POWER |
797 | acpi_battery_remove_fs(device); | 829 | acpi_battery_remove_fs(device); |
798 | #endif | 830 | #endif |
799 | if (battery->bat.dev) { | 831 | sysfs_remove_battery(battery); |
800 | device_remove_file(battery->bat.dev, &alarm_attr); | ||
801 | power_supply_unregister(&battery->bat); | ||
802 | } | ||
803 | mutex_destroy(&battery->lock); | 832 | mutex_destroy(&battery->lock); |
804 | kfree(battery); | 833 | kfree(battery); |
805 | return 0; | 834 | return 0; |
@@ -813,6 +842,7 @@ static int acpi_battery_resume(struct acpi_device *device) | |||
813 | return -EINVAL; | 842 | return -EINVAL; |
814 | battery = acpi_driver_data(device); | 843 | battery = acpi_driver_data(device); |
815 | battery->update_time = 0; | 844 | battery->update_time = 0; |
845 | acpi_battery_update(battery); | ||
816 | return 0; | 846 | return 0; |
817 | } | 847 | } |
818 | 848 | ||
@@ -831,13 +861,13 @@ static int __init acpi_battery_init(void) | |||
831 | { | 861 | { |
832 | if (acpi_disabled) | 862 | if (acpi_disabled) |
833 | return -ENODEV; | 863 | return -ENODEV; |
834 | #ifdef CONFIG_ACPI_PROCFS | 864 | #ifdef CONFIG_ACPI_PROCFS_POWER |
835 | acpi_battery_dir = acpi_lock_battery_dir(); | 865 | acpi_battery_dir = acpi_lock_battery_dir(); |
836 | if (!acpi_battery_dir) | 866 | if (!acpi_battery_dir) |
837 | return -ENODEV; | 867 | return -ENODEV; |
838 | #endif | 868 | #endif |
839 | if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { | 869 | if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { |
840 | #ifdef CONFIG_ACPI_PROCFS | 870 | #ifdef CONFIG_ACPI_PROCFS_POWER |
841 | acpi_unlock_battery_dir(acpi_battery_dir); | 871 | acpi_unlock_battery_dir(acpi_battery_dir); |
842 | #endif | 872 | #endif |
843 | return -ENODEV; | 873 | return -ENODEV; |
@@ -848,7 +878,7 @@ static int __init acpi_battery_init(void) | |||
848 | static void __exit acpi_battery_exit(void) | 878 | static void __exit acpi_battery_exit(void) |
849 | { | 879 | { |
850 | acpi_bus_unregister_driver(&acpi_battery_driver); | 880 | acpi_bus_unregister_driver(&acpi_battery_driver); |
851 | #ifdef CONFIG_ACPI_PROCFS | 881 | #ifdef CONFIG_ACPI_PROCFS_POWER |
852 | acpi_unlock_battery_dir(acpi_battery_dir); | 882 | acpi_unlock_battery_dir(acpi_battery_dir); |
853 | #endif | 883 | #endif |
854 | } | 884 | } |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index fb2cff9a2d24..49d432d0a12c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -198,12 +198,10 @@ int acpi_bus_set_power(acpi_handle handle, int state) | |||
198 | return -ENODEV; | 198 | return -ENODEV; |
199 | } | 199 | } |
200 | /* | 200 | /* |
201 | * Get device's current power state if it's unknown | 201 | * Get device's current power state |
202 | * This means device power state isn't initialized or previous setting failed | ||
203 | */ | 202 | */ |
204 | if ((device->power.state == ACPI_STATE_UNKNOWN) || device->flags.force_power_state) | 203 | acpi_bus_get_power(device->handle, &device->power.state); |
205 | acpi_bus_get_power(device->handle, &device->power.state); | 204 | if (state == device->power.state) { |
206 | if ((state == device->power.state) && !device->flags.force_power_state) { | ||
207 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", | 205 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", |
208 | state)); | 206 | state)); |
209 | return 0; | 207 | return 0; |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 301e832e6961..24a7865a57cb 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -78,6 +78,7 @@ MODULE_DEVICE_TABLE(acpi, button_device_ids); | |||
78 | 78 | ||
79 | static int acpi_button_add(struct acpi_device *device); | 79 | static int acpi_button_add(struct acpi_device *device); |
80 | static int acpi_button_remove(struct acpi_device *device, int type); | 80 | static int acpi_button_remove(struct acpi_device *device, int type); |
81 | static int acpi_button_resume(struct acpi_device *device); | ||
81 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file); | 82 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file); |
82 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file); | 83 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file); |
83 | 84 | ||
@@ -87,6 +88,7 @@ static struct acpi_driver acpi_button_driver = { | |||
87 | .ids = button_device_ids, | 88 | .ids = button_device_ids, |
88 | .ops = { | 89 | .ops = { |
89 | .add = acpi_button_add, | 90 | .add = acpi_button_add, |
91 | .resume = acpi_button_resume, | ||
90 | .remove = acpi_button_remove, | 92 | .remove = acpi_button_remove, |
91 | }, | 93 | }, |
92 | }; | 94 | }; |
@@ -253,6 +255,19 @@ static int acpi_button_remove_fs(struct acpi_device *device) | |||
253 | /* -------------------------------------------------------------------------- | 255 | /* -------------------------------------------------------------------------- |
254 | Driver Interface | 256 | Driver Interface |
255 | -------------------------------------------------------------------------- */ | 257 | -------------------------------------------------------------------------- */ |
258 | static int acpi_lid_send_state(struct acpi_button *button) | ||
259 | { | ||
260 | unsigned long state; | ||
261 | acpi_status status; | ||
262 | |||
263 | status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, | ||
264 | &state); | ||
265 | if (ACPI_FAILURE(status)) | ||
266 | return -ENODEV; | ||
267 | /* input layer checks if event is redundant */ | ||
268 | input_report_switch(button->input, SW_LID, !state); | ||
269 | return 0; | ||
270 | } | ||
256 | 271 | ||
257 | static void acpi_button_notify(acpi_handle handle, u32 event, void *data) | 272 | static void acpi_button_notify(acpi_handle handle, u32 event, void *data) |
258 | { | 273 | { |
@@ -265,15 +280,8 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) | |||
265 | switch (event) { | 280 | switch (event) { |
266 | case ACPI_BUTTON_NOTIFY_STATUS: | 281 | case ACPI_BUTTON_NOTIFY_STATUS: |
267 | input = button->input; | 282 | input = button->input; |
268 | |||
269 | if (button->type == ACPI_BUTTON_TYPE_LID) { | 283 | if (button->type == ACPI_BUTTON_TYPE_LID) { |
270 | struct acpi_handle *handle = button->device->handle; | 284 | acpi_lid_send_state(button); |
271 | unsigned long state; | ||
272 | |||
273 | if (!ACPI_FAILURE(acpi_evaluate_integer(handle, "_LID", | ||
274 | NULL, &state))) | ||
275 | input_report_switch(input, SW_LID, !state); | ||
276 | |||
277 | } else { | 285 | } else { |
278 | int keycode = test_bit(KEY_SLEEP, input->keybit) ? | 286 | int keycode = test_bit(KEY_SLEEP, input->keybit) ? |
279 | KEY_SLEEP : KEY_POWER; | 287 | KEY_SLEEP : KEY_POWER; |
@@ -336,6 +344,17 @@ static int acpi_button_install_notify_handlers(struct acpi_button *button) | |||
336 | return ACPI_FAILURE(status) ? -ENODEV : 0; | 344 | return ACPI_FAILURE(status) ? -ENODEV : 0; |
337 | } | 345 | } |
338 | 346 | ||
347 | static int acpi_button_resume(struct acpi_device *device) | ||
348 | { | ||
349 | struct acpi_button *button; | ||
350 | if (!device) | ||
351 | return -EINVAL; | ||
352 | button = acpi_driver_data(device); | ||
353 | if (button && button->type == ACPI_BUTTON_TYPE_LID) | ||
354 | return acpi_lid_send_state(button); | ||
355 | return 0; | ||
356 | } | ||
357 | |||
339 | static void acpi_button_remove_notify_handlers(struct acpi_button *button) | 358 | static void acpi_button_remove_notify_handlers(struct acpi_button *button) |
340 | { | 359 | { |
341 | switch (button->type) { | 360 | switch (button->type) { |
@@ -453,6 +472,8 @@ static int acpi_button_add(struct acpi_device *device) | |||
453 | error = input_register_device(input); | 472 | error = input_register_device(input); |
454 | if (error) | 473 | if (error) |
455 | goto err_remove_handlers; | 474 | goto err_remove_handlers; |
475 | if (button->type == ACPI_BUTTON_TYPE_LID) | ||
476 | acpi_lid_send_state(button); | ||
456 | 477 | ||
457 | if (device->wakeup.flags.valid) { | 478 | if (device->wakeup.flags.valid) { |
458 | /* Button's GPE is run-wake GPE */ | 479 | /* Button's GPE is run-wake GPE */ |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 7b4178393e34..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 */ |
@@ -65,16 +68,21 @@ enum ec_command { | |||
65 | /* EC events */ | 68 | /* EC events */ |
66 | enum ec_event { | 69 | enum ec_event { |
67 | ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ | 70 | ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ |
68 | ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ | 71 | ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ |
69 | }; | 72 | }; |
70 | 73 | ||
71 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ | 74 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ |
72 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 75 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
73 | 76 | ||
74 | static enum ec_mode { | 77 | enum { |
75 | EC_INTR = 1, /* Output buffer full */ | 78 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ |
76 | EC_POLL, /* Input buffer empty */ | 79 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
77 | } acpi_ec_mode = EC_INTR; | 80 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ |
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 */ | ||
85 | }; | ||
78 | 86 | ||
79 | static int acpi_ec_remove(struct acpi_device *device, int type); | 87 | static int acpi_ec_remove(struct acpi_device *device, int type); |
80 | static int acpi_ec_start(struct acpi_device *device); | 88 | static int acpi_ec_start(struct acpi_device *device); |
@@ -116,9 +124,8 @@ static struct acpi_ec { | |||
116 | unsigned long command_addr; | 124 | unsigned long command_addr; |
117 | unsigned long data_addr; | 125 | unsigned long data_addr; |
118 | unsigned long global_lock; | 126 | unsigned long global_lock; |
127 | unsigned long flags; | ||
119 | struct mutex lock; | 128 | struct mutex lock; |
120 | atomic_t query_pending; | ||
121 | atomic_t event_count; | ||
122 | wait_queue_head_t wait; | 129 | wait_queue_head_t wait; |
123 | struct list_head list; | 130 | struct list_head list; |
124 | u8 handlers_installed; | 131 | u8 handlers_installed; |
@@ -130,64 +137,95 @@ static struct acpi_ec { | |||
130 | 137 | ||
131 | static inline u8 acpi_ec_read_status(struct acpi_ec *ec) | 138 | static inline u8 acpi_ec_read_status(struct acpi_ec *ec) |
132 | { | 139 | { |
133 | return inb(ec->command_addr); | 140 | u8 x = inb(ec->command_addr); |
141 | pr_debug(PREFIX "---> status = 0x%2x\n", x); | ||
142 | return x; | ||
134 | } | 143 | } |
135 | 144 | ||
136 | static inline u8 acpi_ec_read_data(struct acpi_ec *ec) | 145 | static inline u8 acpi_ec_read_data(struct acpi_ec *ec) |
137 | { | 146 | { |
147 | u8 x = inb(ec->data_addr); | ||
148 | pr_debug(PREFIX "---> data = 0x%2x\n", x); | ||
138 | return inb(ec->data_addr); | 149 | return inb(ec->data_addr); |
139 | } | 150 | } |
140 | 151 | ||
141 | 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) |
142 | { | 153 | { |
154 | pr_debug(PREFIX "<--- command = 0x%2x\n", command); | ||
143 | outb(command, ec->command_addr); | 155 | outb(command, ec->command_addr); |
144 | } | 156 | } |
145 | 157 | ||
146 | 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) |
147 | { | 159 | { |
160 | pr_debug(PREFIX "<--- data = 0x%2x\n", data); | ||
148 | outb(data, ec->data_addr); | 161 | outb(data, ec->data_addr); |
149 | } | 162 | } |
150 | 163 | ||
151 | static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event, | 164 | static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) |
152 | unsigned old_count) | ||
153 | { | 165 | { |
154 | u8 status = acpi_ec_read_status(ec); | 166 | if (test_bit(EC_FLAGS_WAIT_GPE, &ec->flags)) |
155 | if (old_count == atomic_read(&ec->event_count)) | ||
156 | return 0; | 167 | return 0; |
157 | if (event == ACPI_EC_EVENT_OBF_1) { | 168 | if (event == ACPI_EC_EVENT_OBF_1) { |
158 | if (status & ACPI_EC_FLAG_OBF) | 169 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF) |
159 | return 1; | 170 | return 1; |
160 | } else if (event == ACPI_EC_EVENT_IBF_0) { | 171 | } else if (event == ACPI_EC_EVENT_IBF_0) { |
161 | if (!(status & ACPI_EC_FLAG_IBF)) | 172 | if (!(acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF)) |
162 | return 1; | 173 | return 1; |
163 | } | 174 | } |
164 | 175 | ||
165 | return 0; | 176 | return 0; |
166 | } | 177 | } |
167 | 178 | ||
168 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, | 179 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) |
169 | unsigned count, int force_poll) | ||
170 | { | 180 | { |
171 | if (unlikely(force_poll) || acpi_ec_mode == EC_POLL) { | 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; | ||
188 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && | ||
189 | likely(!force_poll)) { | ||
190 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), | ||
191 | msecs_to_jiffies(ACPI_EC_DELAY))) | ||
192 | goto end; | ||
193 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | ||
194 | if (acpi_ec_check_status(ec, event)) { | ||
195 | if (test_bit(EC_FLAGS_ADDRESS, &ec->flags)) { | ||
196 | /* miss address GPE, don't expect it anymore */ | ||
197 | pr_info(PREFIX "missing address confirmation, " | ||
198 | "don't expect it any longer.\n"); | ||
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); | ||
205 | } else { | ||
206 | /* missing GPEs, switch back to poll mode */ | ||
207 | if (printk_ratelimit()) | ||
208 | pr_info(PREFIX "missing confirmations, " | ||
209 | "switch off interrupt mode.\n"); | ||
210 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
211 | } | ||
212 | goto end; | ||
213 | } | ||
214 | } else { | ||
172 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 215 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
216 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | ||
173 | while (time_before(jiffies, delay)) { | 217 | while (time_before(jiffies, delay)) { |
174 | if (acpi_ec_check_status(ec, event, 0)) | 218 | if (acpi_ec_check_status(ec, event)) |
175 | return 0; | 219 | goto end; |
176 | } | 220 | } |
177 | } else { | 221 | } |
178 | if (wait_event_timeout(ec->wait, | 222 | pr_err(PREFIX "acpi_ec_wait timeout," |
179 | acpi_ec_check_status(ec, event, count), | ||
180 | msecs_to_jiffies(ACPI_EC_DELAY)) || | ||
181 | acpi_ec_check_status(ec, event, 0)) { | ||
182 | return 0; | ||
183 | } else { | ||
184 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," | ||
185 | " status = %d, expect_event = %d\n", | 223 | " status = %d, expect_event = %d\n", |
186 | acpi_ec_read_status(ec), event); | 224 | acpi_ec_read_status(ec), event); |
187 | } | 225 | ret = -ETIME; |
188 | } | 226 | end: |
189 | 227 | clear_bit(EC_FLAGS_ADDRESS, &ec->flags); | |
190 | return -ETIME; | 228 | return ret; |
191 | } | 229 | } |
192 | 230 | ||
193 | 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, |
@@ -196,42 +234,47 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
196 | int force_poll) | 234 | int force_poll) |
197 | { | 235 | { |
198 | int result = 0; | 236 | int result = 0; |
199 | unsigned count = atomic_read(&ec->event_count); | 237 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
200 | acpi_ec_write_cmd(ec, command); | 238 | acpi_ec_write_cmd(ec, command); |
201 | 239 | pr_debug(PREFIX "transaction start\n"); | |
202 | for (; wdata_len > 0; --wdata_len) { | 240 | for (; wdata_len > 0; --wdata_len) { |
203 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll); | 241 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); |
204 | if (result) { | 242 | if (result) { |
205 | printk(KERN_ERR PREFIX | 243 | pr_err(PREFIX |
206 | "write_cmd timeout, command = %d\n", command); | 244 | "write_cmd timeout, command = %d\n", command); |
207 | goto end; | 245 | goto end; |
208 | } | 246 | } |
209 | count = atomic_read(&ec->event_count); | 247 | /* mark the address byte written to EC */ |
248 | if (rdata_len + wdata_len > 1) | ||
249 | set_bit(EC_FLAGS_ADDRESS, &ec->flags); | ||
250 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | ||
210 | acpi_ec_write_data(ec, *(wdata++)); | 251 | acpi_ec_write_data(ec, *(wdata++)); |
211 | } | 252 | } |
212 | 253 | ||
213 | if (!rdata_len) { | 254 | if (!rdata_len) { |
214 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll); | 255 | set_bit(EC_FLAGS_WDATA, &ec->flags); |
256 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); | ||
215 | if (result) { | 257 | if (result) { |
216 | printk(KERN_ERR PREFIX | 258 | pr_err(PREFIX |
217 | "finish-write timeout, command = %d\n", command); | 259 | "finish-write timeout, command = %d\n", command); |
218 | goto end; | 260 | goto end; |
219 | } | 261 | } |
220 | } else if (command == ACPI_EC_COMMAND_QUERY) { | 262 | } else if (command == ACPI_EC_COMMAND_QUERY) |
221 | atomic_set(&ec->query_pending, 0); | 263 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
222 | } | ||
223 | 264 | ||
224 | for (; rdata_len > 0; --rdata_len) { | 265 | for (; rdata_len > 0; --rdata_len) { |
225 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count, force_poll); | 266 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll); |
226 | if (result) { | 267 | if (result) { |
227 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", | 268 | pr_err(PREFIX "read timeout, command = %d\n", command); |
228 | command); | ||
229 | goto end; | 269 | goto end; |
230 | } | 270 | } |
231 | count = atomic_read(&ec->event_count); | 271 | /* Don't expect GPE after last read */ |
272 | if (rdata_len > 1) | ||
273 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | ||
232 | *(rdata++) = acpi_ec_read_data(ec); | 274 | *(rdata++) = acpi_ec_read_data(ec); |
233 | } | 275 | } |
234 | end: | 276 | end: |
277 | pr_debug(PREFIX "transaction end\n"); | ||
235 | return result; | 278 | return result; |
236 | } | 279 | } |
237 | 280 | ||
@@ -258,13 +301,10 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | |||
258 | } | 301 | } |
259 | } | 302 | } |
260 | 303 | ||
261 | /* Make sure GPE is enabled before doing transaction */ | 304 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0); |
262 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | ||
263 | |||
264 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0, 0); | ||
265 | if (status) { | 305 | if (status) { |
266 | printk(KERN_ERR PREFIX | 306 | pr_err(PREFIX "input buffer is not empty, " |
267 | "input buffer is not empty, aborting transaction\n"); | 307 | "aborting transaction\n"); |
268 | goto end; | 308 | goto end; |
269 | } | 309 | } |
270 | 310 | ||
@@ -435,9 +475,9 @@ EXPORT_SYMBOL_GPL(acpi_ec_add_query_handler); | |||
435 | 475 | ||
436 | void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) | 476 | void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) |
437 | { | 477 | { |
438 | struct acpi_ec_query_handler *handler; | 478 | struct acpi_ec_query_handler *handler, *tmp; |
439 | mutex_lock(&ec->lock); | 479 | mutex_lock(&ec->lock); |
440 | list_for_each_entry(handler, &ec->list, node) { | 480 | list_for_each_entry_safe(handler, tmp, &ec->list, node) { |
441 | if (query_bit == handler->query_bit) { | 481 | if (query_bit == handler->query_bit) { |
442 | list_del(&handler->node); | 482 | list_del(&handler->node); |
443 | kfree(handler); | 483 | kfree(handler); |
@@ -476,23 +516,26 @@ static void acpi_ec_gpe_query(void *ec_cxt) | |||
476 | static u32 acpi_ec_gpe_handler(void *data) | 516 | static u32 acpi_ec_gpe_handler(void *data) |
477 | { | 517 | { |
478 | acpi_status status = AE_OK; | 518 | acpi_status status = AE_OK; |
479 | u8 value; | ||
480 | struct acpi_ec *ec = data; | 519 | struct acpi_ec *ec = data; |
481 | 520 | ||
482 | atomic_inc(&ec->event_count); | 521 | pr_debug(PREFIX "~~~> interrupt\n"); |
483 | 522 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | |
484 | if (acpi_ec_mode == EC_INTR) { | 523 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) |
485 | wake_up(&ec->wait); | 524 | wake_up(&ec->wait); |
486 | } | ||
487 | 525 | ||
488 | value = acpi_ec_read_status(ec); | 526 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) { |
489 | if ((value & ACPI_EC_FLAG_SCI) && !atomic_read(&ec->query_pending)) { | 527 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) |
490 | atomic_set(&ec->query_pending, 1); | 528 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, |
491 | status = | 529 | acpi_ec_gpe_query, ec); |
492 | acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec); | 530 | } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) { |
531 | /* this is non-query, must be confirmation */ | ||
532 | if (printk_ratelimit()) | ||
533 | pr_info(PREFIX "non-query interrupt received," | ||
534 | " switching to interrupt mode\n"); | ||
535 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
493 | } | 536 | } |
494 | 537 | ||
495 | return status == AE_OK ? | 538 | return ACPI_SUCCESS(status) ? |
496 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | 539 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; |
497 | } | 540 | } |
498 | 541 | ||
@@ -641,13 +684,10 @@ static struct acpi_ec *make_acpi_ec(void) | |||
641 | struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL); | 684 | struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL); |
642 | if (!ec) | 685 | if (!ec) |
643 | return NULL; | 686 | return NULL; |
644 | 687 | ec->flags = 1 << EC_FLAGS_QUERY_PENDING; | |
645 | atomic_set(&ec->query_pending, 1); | ||
646 | atomic_set(&ec->event_count, 1); | ||
647 | mutex_init(&ec->lock); | 688 | mutex_init(&ec->lock); |
648 | init_waitqueue_head(&ec->wait); | 689 | init_waitqueue_head(&ec->wait); |
649 | INIT_LIST_HEAD(&ec->list); | 690 | INIT_LIST_HEAD(&ec->list); |
650 | |||
651 | return ec; | 691 | return ec; |
652 | } | 692 | } |
653 | 693 | ||
@@ -693,10 +733,10 @@ static void ec_remove_handlers(struct acpi_ec *ec) | |||
693 | { | 733 | { |
694 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, | 734 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, |
695 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) | 735 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) |
696 | printk(KERN_ERR PREFIX "failed to remove space handler\n"); | 736 | pr_err(PREFIX "failed to remove space handler\n"); |
697 | if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, | 737 | if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, |
698 | &acpi_ec_gpe_handler))) | 738 | &acpi_ec_gpe_handler))) |
699 | printk(KERN_ERR PREFIX "failed to remove gpe handler\n"); | 739 | pr_err(PREFIX "failed to remove gpe handler\n"); |
700 | ec->handlers_installed = 0; | 740 | ec->handlers_installed = 0; |
701 | } | 741 | } |
702 | 742 | ||
@@ -739,8 +779,10 @@ static int acpi_ec_add(struct acpi_device *device) | |||
739 | first_ec = ec; | 779 | first_ec = ec; |
740 | acpi_driver_data(device) = ec; | 780 | acpi_driver_data(device) = ec; |
741 | acpi_ec_add_fs(device); | 781 | acpi_ec_add_fs(device); |
742 | 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", |
743 | ec->gpe, ec->command_addr, ec->data_addr); | 783 | ec->gpe, ec->command_addr, ec->data_addr); |
784 | pr_info(PREFIX "driver started in %s mode\n", | ||
785 | (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll"); | ||
744 | return 0; | 786 | return 0; |
745 | } | 787 | } |
746 | 788 | ||
@@ -833,7 +875,7 @@ static int acpi_ec_start(struct acpi_device *device) | |||
833 | ret = ec_install_handlers(ec); | 875 | ret = ec_install_handlers(ec); |
834 | 876 | ||
835 | /* EC is fully operational, allow queries */ | 877 | /* EC is fully operational, allow queries */ |
836 | atomic_set(&ec->query_pending, 0); | 878 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
837 | return ret; | 879 | return ret; |
838 | } | 880 | } |
839 | 881 | ||
@@ -865,18 +907,26 @@ int __init acpi_ec_ecdt_probe(void) | |||
865 | status = acpi_get_table(ACPI_SIG_ECDT, 1, | 907 | status = acpi_get_table(ACPI_SIG_ECDT, 1, |
866 | (struct acpi_table_header **)&ecdt_ptr); | 908 | (struct acpi_table_header **)&ecdt_ptr); |
867 | if (ACPI_SUCCESS(status)) { | 909 | if (ACPI_SUCCESS(status)) { |
868 | 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"); |
869 | boot_ec->command_addr = ecdt_ptr->control.address; | 911 | boot_ec->command_addr = ecdt_ptr->control.address; |
870 | boot_ec->data_addr = ecdt_ptr->data.address; | 912 | boot_ec->data_addr = ecdt_ptr->data.address; |
871 | boot_ec->gpe = ecdt_ptr->gpe; | 913 | boot_ec->gpe = ecdt_ptr->gpe; |
872 | boot_ec->handle = ACPI_ROOT_OBJECT; | 914 | boot_ec->handle = ACPI_ROOT_OBJECT; |
873 | } 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; | ||
874 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); | 919 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); |
875 | 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, |
876 | boot_ec, NULL); | 921 | boot_ec, NULL); |
877 | /* Check that acpi_get_devices actually find something */ | 922 | /* Check that acpi_get_devices actually find something */ |
878 | if (ACPI_FAILURE(status) || !boot_ec->handle) | 923 | if (ACPI_FAILURE(status) || !boot_ec->handle) |
879 | 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; | ||
880 | } | 930 | } |
881 | 931 | ||
882 | ret = ec_install_handlers(boot_ec); | 932 | ret = ec_install_handlers(boot_ec); |
@@ -924,20 +974,4 @@ static void __exit acpi_ec_exit(void) | |||
924 | 974 | ||
925 | return; | 975 | return; |
926 | } | 976 | } |
927 | #endif /* 0 */ | 977 | #endif /* 0 */ |
928 | |||
929 | static int __init acpi_ec_set_intr_mode(char *str) | ||
930 | { | ||
931 | int intr; | ||
932 | |||
933 | if (!get_option(&str, &intr)) | ||
934 | return 0; | ||
935 | |||
936 | acpi_ec_mode = (intr) ? EC_INTR : EC_POLL; | ||
937 | |||
938 | printk(KERN_NOTICE PREFIX "%s mode.\n", intr ? "interrupt" : "polling"); | ||
939 | |||
940 | return 1; | ||
941 | } | ||
942 | |||
943 | __setup("ec_intr=", acpi_ec_set_intr_mode); | ||
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index c81f6bdb68b8..a5a5532db268 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -47,8 +47,6 @@ MODULE_LICENSE("GPL"); | |||
47 | 47 | ||
48 | static int acpi_fan_add(struct acpi_device *device); | 48 | static int acpi_fan_add(struct acpi_device *device); |
49 | static int acpi_fan_remove(struct acpi_device *device, int type); | 49 | static int acpi_fan_remove(struct acpi_device *device, int type); |
50 | static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state); | ||
51 | static int acpi_fan_resume(struct acpi_device *device); | ||
52 | 50 | ||
53 | static const struct acpi_device_id fan_device_ids[] = { | 51 | static const struct acpi_device_id fan_device_ids[] = { |
54 | {"PNP0C0B", 0}, | 52 | {"PNP0C0B", 0}, |
@@ -63,15 +61,9 @@ static struct acpi_driver acpi_fan_driver = { | |||
63 | .ops = { | 61 | .ops = { |
64 | .add = acpi_fan_add, | 62 | .add = acpi_fan_add, |
65 | .remove = acpi_fan_remove, | 63 | .remove = acpi_fan_remove, |
66 | .suspend = acpi_fan_suspend, | ||
67 | .resume = acpi_fan_resume, | ||
68 | }, | 64 | }, |
69 | }; | 65 | }; |
70 | 66 | ||
71 | struct acpi_fan { | ||
72 | struct acpi_device * device; | ||
73 | }; | ||
74 | |||
75 | /* -------------------------------------------------------------------------- | 67 | /* -------------------------------------------------------------------------- |
76 | FS Interface (/proc) | 68 | FS Interface (/proc) |
77 | -------------------------------------------------------------------------- */ | 69 | -------------------------------------------------------------------------- */ |
@@ -80,12 +72,12 @@ static struct proc_dir_entry *acpi_fan_dir; | |||
80 | 72 | ||
81 | static int acpi_fan_read_state(struct seq_file *seq, void *offset) | 73 | static int acpi_fan_read_state(struct seq_file *seq, void *offset) |
82 | { | 74 | { |
83 | struct acpi_fan *fan = seq->private; | 75 | struct acpi_device *device = seq->private; |
84 | int state = 0; | 76 | int state = 0; |
85 | 77 | ||
86 | 78 | ||
87 | if (fan) { | 79 | if (device) { |
88 | if (acpi_bus_get_power(fan->device->handle, &state)) | 80 | if (acpi_bus_get_power(device->handle, &state)) |
89 | seq_printf(seq, "status: ERROR\n"); | 81 | seq_printf(seq, "status: ERROR\n"); |
90 | else | 82 | else |
91 | seq_printf(seq, "status: %s\n", | 83 | seq_printf(seq, "status: %s\n", |
@@ -105,11 +97,10 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, | |||
105 | { | 97 | { |
106 | int result = 0; | 98 | int result = 0; |
107 | struct seq_file *m = file->private_data; | 99 | struct seq_file *m = file->private_data; |
108 | struct acpi_fan *fan = m->private; | 100 | struct acpi_device *device = m->private; |
109 | char state_string[12] = { '\0' }; | 101 | char state_string[12] = { '\0' }; |
110 | 102 | ||
111 | 103 | if (count > sizeof(state_string) - 1) | |
112 | if (!fan || (count > sizeof(state_string) - 1)) | ||
113 | return -EINVAL; | 104 | return -EINVAL; |
114 | 105 | ||
115 | if (copy_from_user(state_string, buffer, count)) | 106 | if (copy_from_user(state_string, buffer, count)) |
@@ -117,7 +108,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, | |||
117 | 108 | ||
118 | state_string[count] = '\0'; | 109 | state_string[count] = '\0'; |
119 | 110 | ||
120 | result = acpi_bus_set_power(fan->device->handle, | 111 | result = acpi_bus_set_power(device->handle, |
121 | simple_strtoul(state_string, NULL, 0)); | 112 | simple_strtoul(state_string, NULL, 0)); |
122 | if (result) | 113 | if (result) |
123 | return result; | 114 | return result; |
@@ -158,7 +149,7 @@ static int acpi_fan_add_fs(struct acpi_device *device) | |||
158 | return -ENODEV; | 149 | return -ENODEV; |
159 | else { | 150 | else { |
160 | entry->proc_fops = &acpi_fan_state_ops; | 151 | entry->proc_fops = &acpi_fan_state_ops; |
161 | entry->data = acpi_driver_data(device); | 152 | entry->data = device; |
162 | entry->owner = THIS_MODULE; | 153 | entry->owner = THIS_MODULE; |
163 | } | 154 | } |
164 | 155 | ||
@@ -191,14 +182,8 @@ static int acpi_fan_add(struct acpi_device *device) | |||
191 | if (!device) | 182 | if (!device) |
192 | return -EINVAL; | 183 | return -EINVAL; |
193 | 184 | ||
194 | fan = kzalloc(sizeof(struct acpi_fan), GFP_KERNEL); | ||
195 | if (!fan) | ||
196 | return -ENOMEM; | ||
197 | |||
198 | fan->device = device; | ||
199 | strcpy(acpi_device_name(device), "Fan"); | 185 | strcpy(acpi_device_name(device), "Fan"); |
200 | strcpy(acpi_device_class(device), ACPI_FAN_CLASS); | 186 | strcpy(acpi_device_class(device), ACPI_FAN_CLASS); |
201 | acpi_driver_data(device) = fan; | ||
202 | 187 | ||
203 | result = acpi_bus_get_power(device->handle, &state); | 188 | result = acpi_bus_get_power(device->handle, &state); |
204 | if (result) { | 189 | if (result) { |
@@ -206,10 +191,6 @@ static int acpi_fan_add(struct acpi_device *device) | |||
206 | goto end; | 191 | goto end; |
207 | } | 192 | } |
208 | 193 | ||
209 | device->flags.force_power_state = 1; | ||
210 | acpi_bus_set_power(device->handle, state); | ||
211 | device->flags.force_power_state = 0; | ||
212 | |||
213 | result = acpi_fan_add_fs(device); | 194 | result = acpi_fan_add_fs(device); |
214 | if (result) | 195 | if (result) |
215 | goto end; | 196 | goto end; |
@@ -227,53 +208,14 @@ static int acpi_fan_add(struct acpi_device *device) | |||
227 | 208 | ||
228 | static int acpi_fan_remove(struct acpi_device *device, int type) | 209 | static int acpi_fan_remove(struct acpi_device *device, int type) |
229 | { | 210 | { |
230 | struct acpi_fan *fan = NULL; | ||
231 | |||
232 | |||
233 | if (!device || !acpi_driver_data(device)) | 211 | if (!device || !acpi_driver_data(device)) |
234 | return -EINVAL; | 212 | return -EINVAL; |
235 | 213 | ||
236 | fan = acpi_driver_data(device); | ||
237 | |||
238 | acpi_fan_remove_fs(device); | 214 | acpi_fan_remove_fs(device); |
239 | 215 | ||
240 | kfree(fan); | ||
241 | |||
242 | return 0; | 216 | return 0; |
243 | } | 217 | } |
244 | 218 | ||
245 | static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state) | ||
246 | { | ||
247 | if (!device) | ||
248 | return -EINVAL; | ||
249 | |||
250 | acpi_bus_set_power(device->handle, ACPI_STATE_D0); | ||
251 | |||
252 | return AE_OK; | ||
253 | } | ||
254 | |||
255 | static int acpi_fan_resume(struct acpi_device *device) | ||
256 | { | ||
257 | int result = 0; | ||
258 | int power_state = 0; | ||
259 | |||
260 | if (!device) | ||
261 | return -EINVAL; | ||
262 | |||
263 | result = acpi_bus_get_power(device->handle, &power_state); | ||
264 | if (result) { | ||
265 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
266 | "Error reading fan power state\n")); | ||
267 | return result; | ||
268 | } | ||
269 | |||
270 | device->flags.force_power_state = 1; | ||
271 | acpi_bus_set_power(device->handle, power_state); | ||
272 | device->flags.force_power_state = 0; | ||
273 | |||
274 | return result; | ||
275 | } | ||
276 | |||
277 | static int __init acpi_fan_init(void) | 219 | static int __init acpi_fan_init(void) |
278 | { | 220 | { |
279 | int result = 0; | 221 | int result = 0; |
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/power.c b/drivers/acpi/power.c index 57b9a2998fd0..af1769a20c7a 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -86,7 +86,6 @@ struct acpi_power_resource { | |||
86 | acpi_bus_id name; | 86 | acpi_bus_id name; |
87 | u32 system_level; | 87 | u32 system_level; |
88 | u32 order; | 88 | u32 order; |
89 | int state; | ||
90 | struct mutex resource_lock; | 89 | struct mutex resource_lock; |
91 | struct list_head reference; | 90 | struct list_head reference; |
92 | }; | 91 | }; |
@@ -128,33 +127,31 @@ acpi_power_get_context(acpi_handle handle, | |||
128 | return 0; | 127 | return 0; |
129 | } | 128 | } |
130 | 129 | ||
131 | static int acpi_power_get_state(struct acpi_power_resource *resource) | 130 | static int acpi_power_get_state(struct acpi_power_resource *resource, int *state) |
132 | { | 131 | { |
133 | acpi_status status = AE_OK; | 132 | acpi_status status = AE_OK; |
134 | unsigned long sta = 0; | 133 | unsigned long sta = 0; |
135 | 134 | ||
136 | 135 | ||
137 | if (!resource) | 136 | if (!resource || !state) |
138 | return -EINVAL; | 137 | return -EINVAL; |
139 | 138 | ||
140 | status = acpi_evaluate_integer(resource->device->handle, "_STA", NULL, &sta); | 139 | status = acpi_evaluate_integer(resource->device->handle, "_STA", NULL, &sta); |
141 | if (ACPI_FAILURE(status)) | 140 | if (ACPI_FAILURE(status)) |
142 | return -ENODEV; | 141 | return -ENODEV; |
143 | 142 | ||
144 | if (sta & 0x01) | 143 | *state = (sta & 0x01)?ACPI_POWER_RESOURCE_STATE_ON: |
145 | resource->state = ACPI_POWER_RESOURCE_STATE_ON; | 144 | ACPI_POWER_RESOURCE_STATE_OFF; |
146 | else | ||
147 | resource->state = ACPI_POWER_RESOURCE_STATE_OFF; | ||
148 | 145 | ||
149 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", | 146 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", |
150 | resource->name, resource->state ? "on" : "off")); | 147 | resource->name, state ? "on" : "off")); |
151 | 148 | ||
152 | return 0; | 149 | return 0; |
153 | } | 150 | } |
154 | 151 | ||
155 | static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) | 152 | static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) |
156 | { | 153 | { |
157 | int result = 0; | 154 | int result = 0, state1; |
158 | struct acpi_power_resource *resource = NULL; | 155 | struct acpi_power_resource *resource = NULL; |
159 | u32 i = 0; | 156 | u32 i = 0; |
160 | 157 | ||
@@ -168,11 +165,11 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) | |||
168 | result = acpi_power_get_context(list->handles[i], &resource); | 165 | result = acpi_power_get_context(list->handles[i], &resource); |
169 | if (result) | 166 | if (result) |
170 | return result; | 167 | return result; |
171 | result = acpi_power_get_state(resource); | 168 | result = acpi_power_get_state(resource, &state1); |
172 | if (result) | 169 | if (result) |
173 | return result; | 170 | return result; |
174 | 171 | ||
175 | *state = resource->state; | 172 | *state = state1; |
176 | 173 | ||
177 | if (*state != ACPI_POWER_RESOURCE_STATE_ON) | 174 | if (*state != ACPI_POWER_RESOURCE_STATE_ON) |
178 | break; | 175 | break; |
@@ -186,7 +183,7 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) | |||
186 | 183 | ||
187 | static int acpi_power_on(acpi_handle handle, struct acpi_device *dev) | 184 | static int acpi_power_on(acpi_handle handle, struct acpi_device *dev) |
188 | { | 185 | { |
189 | int result = 0; | 186 | int result = 0, state; |
190 | int found = 0; | 187 | int found = 0; |
191 | acpi_status status = AE_OK; | 188 | acpi_status status = AE_OK; |
192 | struct acpi_power_resource *resource = NULL; | 189 | struct acpi_power_resource *resource = NULL; |
@@ -224,20 +221,14 @@ static int acpi_power_on(acpi_handle handle, struct acpi_device *dev) | |||
224 | } | 221 | } |
225 | mutex_unlock(&resource->resource_lock); | 222 | mutex_unlock(&resource->resource_lock); |
226 | 223 | ||
227 | if (resource->state == ACPI_POWER_RESOURCE_STATE_ON) { | ||
228 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n", | ||
229 | resource->name)); | ||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | status = acpi_evaluate_object(resource->device->handle, "_ON", NULL, NULL); | 224 | status = acpi_evaluate_object(resource->device->handle, "_ON", NULL, NULL); |
234 | if (ACPI_FAILURE(status)) | 225 | if (ACPI_FAILURE(status)) |
235 | return -ENODEV; | 226 | return -ENODEV; |
236 | 227 | ||
237 | result = acpi_power_get_state(resource); | 228 | result = acpi_power_get_state(resource, &state); |
238 | if (result) | 229 | if (result) |
239 | return result; | 230 | return result; |
240 | if (resource->state != ACPI_POWER_RESOURCE_STATE_ON) | 231 | if (state != ACPI_POWER_RESOURCE_STATE_ON) |
241 | return -ENOEXEC; | 232 | return -ENOEXEC; |
242 | 233 | ||
243 | /* Update the power resource's _device_ power state */ | 234 | /* Update the power resource's _device_ power state */ |
@@ -250,7 +241,7 @@ static int acpi_power_on(acpi_handle handle, struct acpi_device *dev) | |||
250 | 241 | ||
251 | static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev) | 242 | static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev) |
252 | { | 243 | { |
253 | int result = 0; | 244 | int result = 0, state; |
254 | acpi_status status = AE_OK; | 245 | acpi_status status = AE_OK; |
255 | struct acpi_power_resource *resource = NULL; | 246 | struct acpi_power_resource *resource = NULL; |
256 | struct list_head *node, *next; | 247 | struct list_head *node, *next; |
@@ -281,20 +272,14 @@ static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev) | |||
281 | } | 272 | } |
282 | mutex_unlock(&resource->resource_lock); | 273 | mutex_unlock(&resource->resource_lock); |
283 | 274 | ||
284 | if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) { | ||
285 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n", | ||
286 | resource->name)); | ||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | status = acpi_evaluate_object(resource->device->handle, "_OFF", NULL, NULL); | 275 | status = acpi_evaluate_object(resource->device->handle, "_OFF", NULL, NULL); |
291 | if (ACPI_FAILURE(status)) | 276 | if (ACPI_FAILURE(status)) |
292 | return -ENODEV; | 277 | return -ENODEV; |
293 | 278 | ||
294 | result = acpi_power_get_state(resource); | 279 | result = acpi_power_get_state(resource, &state); |
295 | if (result) | 280 | if (result) |
296 | return result; | 281 | return result; |
297 | if (resource->state != ACPI_POWER_RESOURCE_STATE_OFF) | 282 | if (state != ACPI_POWER_RESOURCE_STATE_OFF) |
298 | return -ENOEXEC; | 283 | return -ENOEXEC; |
299 | 284 | ||
300 | /* Update the power resource's _device_ power state */ | 285 | /* Update the power resource's _device_ power state */ |
@@ -494,7 +479,7 @@ static struct proc_dir_entry *acpi_power_dir; | |||
494 | static int acpi_power_seq_show(struct seq_file *seq, void *offset) | 479 | static int acpi_power_seq_show(struct seq_file *seq, void *offset) |
495 | { | 480 | { |
496 | int count = 0; | 481 | int count = 0; |
497 | int result = 0; | 482 | int result = 0, state; |
498 | struct acpi_power_resource *resource = NULL; | 483 | struct acpi_power_resource *resource = NULL; |
499 | struct list_head *node, *next; | 484 | struct list_head *node, *next; |
500 | struct acpi_power_reference *ref; | 485 | struct acpi_power_reference *ref; |
@@ -505,12 +490,12 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset) | |||
505 | if (!resource) | 490 | if (!resource) |
506 | goto end; | 491 | goto end; |
507 | 492 | ||
508 | result = acpi_power_get_state(resource); | 493 | result = acpi_power_get_state(resource, &state); |
509 | if (result) | 494 | if (result) |
510 | goto end; | 495 | goto end; |
511 | 496 | ||
512 | seq_puts(seq, "state: "); | 497 | seq_puts(seq, "state: "); |
513 | switch (resource->state) { | 498 | switch (state) { |
514 | case ACPI_POWER_RESOURCE_STATE_ON: | 499 | case ACPI_POWER_RESOURCE_STATE_ON: |
515 | seq_puts(seq, "on\n"); | 500 | seq_puts(seq, "on\n"); |
516 | break; | 501 | break; |
@@ -591,7 +576,7 @@ static int acpi_power_remove_fs(struct acpi_device *device) | |||
591 | 576 | ||
592 | static int acpi_power_add(struct acpi_device *device) | 577 | static int acpi_power_add(struct acpi_device *device) |
593 | { | 578 | { |
594 | int result = 0; | 579 | int result = 0, state; |
595 | acpi_status status = AE_OK; | 580 | acpi_status status = AE_OK; |
596 | struct acpi_power_resource *resource = NULL; | 581 | struct acpi_power_resource *resource = NULL; |
597 | union acpi_object acpi_object; | 582 | union acpi_object acpi_object; |
@@ -622,11 +607,11 @@ static int acpi_power_add(struct acpi_device *device) | |||
622 | resource->system_level = acpi_object.power_resource.system_level; | 607 | resource->system_level = acpi_object.power_resource.system_level; |
623 | resource->order = acpi_object.power_resource.resource_order; | 608 | resource->order = acpi_object.power_resource.resource_order; |
624 | 609 | ||
625 | result = acpi_power_get_state(resource); | 610 | result = acpi_power_get_state(resource, &state); |
626 | if (result) | 611 | if (result) |
627 | goto end; | 612 | goto end; |
628 | 613 | ||
629 | switch (resource->state) { | 614 | switch (state) { |
630 | case ACPI_POWER_RESOURCE_STATE_ON: | 615 | case ACPI_POWER_RESOURCE_STATE_ON: |
631 | device->power.state = ACPI_STATE_D0; | 616 | device->power.state = ACPI_STATE_D0; |
632 | break; | 617 | break; |
@@ -643,7 +628,7 @@ static int acpi_power_add(struct acpi_device *device) | |||
643 | goto end; | 628 | goto end; |
644 | 629 | ||
645 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), | 630 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), |
646 | acpi_device_bid(device), resource->state ? "on" : "off"); | 631 | acpi_device_bid(device), state ? "on" : "off"); |
647 | 632 | ||
648 | end: | 633 | end: |
649 | if (result) | 634 | if (result) |
@@ -680,7 +665,7 @@ static int acpi_power_remove(struct acpi_device *device, int type) | |||
680 | 665 | ||
681 | static int acpi_power_resume(struct acpi_device *device) | 666 | static int acpi_power_resume(struct acpi_device *device) |
682 | { | 667 | { |
683 | int result = 0; | 668 | int result = 0, state; |
684 | struct acpi_power_resource *resource = NULL; | 669 | struct acpi_power_resource *resource = NULL; |
685 | struct acpi_power_reference *ref; | 670 | struct acpi_power_reference *ref; |
686 | 671 | ||
@@ -689,12 +674,12 @@ static int acpi_power_resume(struct acpi_device *device) | |||
689 | 674 | ||
690 | resource = (struct acpi_power_resource *)acpi_driver_data(device); | 675 | resource = (struct acpi_power_resource *)acpi_driver_data(device); |
691 | 676 | ||
692 | result = acpi_power_get_state(resource); | 677 | result = acpi_power_get_state(resource, &state); |
693 | if (result) | 678 | if (result) |
694 | return result; | 679 | return result; |
695 | 680 | ||
696 | mutex_lock(&resource->resource_lock); | 681 | mutex_lock(&resource->resource_lock); |
697 | if ((resource->state == ACPI_POWER_RESOURCE_STATE_OFF) && | 682 | if (state == ACPI_POWER_RESOURCE_STATE_OFF && |
698 | !list_empty(&resource->reference)) { | 683 | !list_empty(&resource->reference)) { |
699 | ref = container_of(resource->reference.next, struct acpi_power_reference, node); | 684 | ref = container_of(resource->reference.next, struct acpi_power_reference, node); |
700 | mutex_unlock(&resource->resource_lock); | 685 | mutex_unlock(&resource->resource_lock); |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 235a51e328c3..015689d295c7 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -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 | ||
@@ -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, |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f996d0e37689..b1fbee3f7fe1 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, .. */ |
@@ -1373,15 +1373,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
1373 | if (pr->flags.bm_check) | 1373 | if (pr->flags.bm_check) |
1374 | acpi_idle_update_bm_rld(pr, cx); | 1374 | acpi_idle_update_bm_rld(pr, cx); |
1375 | 1375 | ||
1376 | current_thread_info()->status &= ~TS_POLLING; | 1376 | 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 | 1377 | ||
1386 | cx->usage++; | 1378 | cx->usage++; |
1387 | 1379 | ||
@@ -1399,6 +1391,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1399 | struct acpi_processor *pr; | 1391 | struct acpi_processor *pr; |
1400 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); | 1392 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); |
1401 | u32 t1, t2; | 1393 | u32 t1, t2; |
1394 | int sleep_ticks = 0; | ||
1395 | |||
1402 | pr = processors[smp_processor_id()]; | 1396 | pr = processors[smp_processor_id()]; |
1403 | 1397 | ||
1404 | if (unlikely(!pr)) | 1398 | if (unlikely(!pr)) |
@@ -1428,6 +1422,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1428 | ACPI_FLUSH_CPU_CACHE(); | 1422 | ACPI_FLUSH_CPU_CACHE(); |
1429 | 1423 | ||
1430 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1424 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
1425 | /* Tell the scheduler that we are going deep-idle: */ | ||
1426 | sched_clock_idle_sleep_event(); | ||
1431 | acpi_state_timer_broadcast(pr, cx, 1); | 1427 | acpi_state_timer_broadcast(pr, cx, 1); |
1432 | acpi_idle_do_entry(cx); | 1428 | acpi_idle_do_entry(cx); |
1433 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1429 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
@@ -1436,6 +1432,10 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1436 | /* TSC could halt in idle, so notify users */ | 1432 | /* TSC could halt in idle, so notify users */ |
1437 | mark_tsc_unstable("TSC halts in idle");; | 1433 | mark_tsc_unstable("TSC halts in idle");; |
1438 | #endif | 1434 | #endif |
1435 | sleep_ticks = ticks_elapsed(t1, t2); | ||
1436 | |||
1437 | /* Tell the scheduler how much we idled: */ | ||
1438 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
1439 | 1439 | ||
1440 | local_irq_enable(); | 1440 | local_irq_enable(); |
1441 | current_thread_info()->status |= TS_POLLING; | 1441 | current_thread_info()->status |= TS_POLLING; |
@@ -1443,7 +1443,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1443 | cx->usage++; | 1443 | cx->usage++; |
1444 | 1444 | ||
1445 | acpi_state_timer_broadcast(pr, cx, 0); | 1445 | acpi_state_timer_broadcast(pr, cx, 0); |
1446 | cx->time += ticks_elapsed(t1, t2); | 1446 | cx->time += sleep_ticks; |
1447 | return ticks_elapsed_in_us(t1, t2); | 1447 | return ticks_elapsed_in_us(t1, t2); |
1448 | } | 1448 | } |
1449 | 1449 | ||
@@ -1463,6 +1463,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1463 | struct acpi_processor *pr; | 1463 | struct acpi_processor *pr; |
1464 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); | 1464 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); |
1465 | u32 t1, t2; | 1465 | u32 t1, t2; |
1466 | int sleep_ticks = 0; | ||
1467 | |||
1466 | pr = processors[smp_processor_id()]; | 1468 | pr = processors[smp_processor_id()]; |
1467 | 1469 | ||
1468 | if (unlikely(!pr)) | 1470 | if (unlikely(!pr)) |
@@ -1471,6 +1473,15 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1471 | if (acpi_idle_suspend) | 1473 | if (acpi_idle_suspend) |
1472 | return(acpi_idle_enter_c1(dev, state)); | 1474 | return(acpi_idle_enter_c1(dev, state)); |
1473 | 1475 | ||
1476 | if (acpi_idle_bm_check()) { | ||
1477 | if (dev->safe_state) { | ||
1478 | return dev->safe_state->enter(dev, dev->safe_state); | ||
1479 | } else { | ||
1480 | acpi_safe_halt(); | ||
1481 | return 0; | ||
1482 | } | ||
1483 | } | ||
1484 | |||
1474 | local_irq_disable(); | 1485 | local_irq_disable(); |
1475 | current_thread_info()->status &= ~TS_POLLING; | 1486 | current_thread_info()->status &= ~TS_POLLING; |
1476 | /* | 1487 | /* |
@@ -1485,38 +1496,45 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1485 | return 0; | 1496 | return 0; |
1486 | } | 1497 | } |
1487 | 1498 | ||
1499 | /* Tell the scheduler that we are going deep-idle: */ | ||
1500 | sched_clock_idle_sleep_event(); | ||
1488 | /* | 1501 | /* |
1489 | * Must be done before busmaster disable as we might need to | 1502 | * Must be done before busmaster disable as we might need to |
1490 | * access HPET ! | 1503 | * access HPET ! |
1491 | */ | 1504 | */ |
1492 | acpi_state_timer_broadcast(pr, cx, 1); | 1505 | acpi_state_timer_broadcast(pr, cx, 1); |
1493 | 1506 | ||
1494 | if (acpi_idle_bm_check()) { | 1507 | 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 | 1508 | ||
1509 | /* | ||
1510 | * disable bus master | ||
1511 | * bm_check implies we need ARB_DIS | ||
1512 | * !bm_check implies we need cache flush | ||
1513 | * bm_control implies whether we can do ARB_DIS | ||
1514 | * | ||
1515 | * That leaves a case where bm_check is set and bm_control is | ||
1516 | * not set. In that case we cannot do much, we enter C3 | ||
1517 | * without doing anything. | ||
1518 | */ | ||
1519 | if (pr->flags.bm_check && pr->flags.bm_control) { | ||
1505 | spin_lock(&c3_lock); | 1520 | spin_lock(&c3_lock); |
1506 | c3_cpu_count++; | 1521 | c3_cpu_count++; |
1507 | /* Disable bus master arbitration when all CPUs are in C3 */ | 1522 | /* Disable bus master arbitration when all CPUs are in C3 */ |
1508 | if (c3_cpu_count == num_online_cpus()) | 1523 | if (c3_cpu_count == num_online_cpus()) |
1509 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); | 1524 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); |
1510 | spin_unlock(&c3_lock); | 1525 | spin_unlock(&c3_lock); |
1526 | } else if (!pr->flags.bm_check) { | ||
1527 | ACPI_FLUSH_CPU_CACHE(); | ||
1528 | } | ||
1511 | 1529 | ||
1512 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1530 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
1513 | acpi_idle_do_entry(cx); | 1531 | acpi_idle_do_entry(cx); |
1514 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1532 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
1515 | 1533 | ||
1534 | /* Re-enable bus master arbitration */ | ||
1535 | if (pr->flags.bm_check && pr->flags.bm_control) { | ||
1516 | spin_lock(&c3_lock); | 1536 | spin_lock(&c3_lock); |
1517 | /* Re-enable bus master arbitration */ | 1537 | 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--; | 1538 | c3_cpu_count--; |
1521 | spin_unlock(&c3_lock); | 1539 | spin_unlock(&c3_lock); |
1522 | } | 1540 | } |
@@ -1525,6 +1543,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1525 | /* TSC could halt in idle, so notify users */ | 1543 | /* TSC could halt in idle, so notify users */ |
1526 | mark_tsc_unstable("TSC halts in idle"); | 1544 | mark_tsc_unstable("TSC halts in idle"); |
1527 | #endif | 1545 | #endif |
1546 | sleep_ticks = ticks_elapsed(t1, t2); | ||
1547 | /* Tell the scheduler how much we idled: */ | ||
1548 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
1528 | 1549 | ||
1529 | local_irq_enable(); | 1550 | local_irq_enable(); |
1530 | current_thread_info()->status |= TS_POLLING; | 1551 | current_thread_info()->status |= TS_POLLING; |
@@ -1532,7 +1553,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1532 | cx->usage++; | 1553 | cx->usage++; |
1533 | 1554 | ||
1534 | acpi_state_timer_broadcast(pr, cx, 0); | 1555 | acpi_state_timer_broadcast(pr, cx, 0); |
1535 | cx->time += ticks_elapsed(t1, t2); | 1556 | cx->time += sleep_ticks; |
1536 | return ticks_elapsed_in_us(t1, t2); | 1557 | return ticks_elapsed_in_us(t1, t2); |
1537 | } | 1558 | } |
1538 | 1559 | ||
@@ -1584,12 +1605,14 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | |||
1584 | case ACPI_STATE_C1: | 1605 | case ACPI_STATE_C1: |
1585 | state->flags |= CPUIDLE_FLAG_SHALLOW; | 1606 | state->flags |= CPUIDLE_FLAG_SHALLOW; |
1586 | state->enter = acpi_idle_enter_c1; | 1607 | state->enter = acpi_idle_enter_c1; |
1608 | dev->safe_state = state; | ||
1587 | break; | 1609 | break; |
1588 | 1610 | ||
1589 | case ACPI_STATE_C2: | 1611 | case ACPI_STATE_C2: |
1590 | state->flags |= CPUIDLE_FLAG_BALANCED; | 1612 | state->flags |= CPUIDLE_FLAG_BALANCED; |
1591 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | 1613 | state->flags |= CPUIDLE_FLAG_TIME_VALID; |
1592 | state->enter = acpi_idle_enter_simple; | 1614 | state->enter = acpi_idle_enter_simple; |
1615 | dev->safe_state = state; | ||
1593 | break; | 1616 | break; |
1594 | 1617 | ||
1595 | case ACPI_STATE_C3: | 1618 | case ACPI_STATE_C3: |
@@ -1610,14 +1633,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | |||
1610 | if (!count) | 1633 | if (!count) |
1611 | return -EINVAL; | 1634 | return -EINVAL; |
1612 | 1635 | ||
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; | 1636 | return 0; |
1622 | } | 1637 | } |
1623 | 1638 | ||
@@ -1658,6 +1673,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
1658 | 1673 | ||
1659 | if (!first_run) { | 1674 | if (!first_run) { |
1660 | dmi_check_system(processor_power_dmi_table); | 1675 | dmi_check_system(processor_power_dmi_table); |
1676 | max_cstate = acpi_processor_cstate_check(max_cstate); | ||
1661 | if (max_cstate < ACPI_C_STATES_MAX) | 1677 | if (max_cstate < ACPI_C_STATES_MAX) |
1662 | printk(KERN_NOTICE | 1678 | printk(KERN_NOTICE |
1663 | "ACPI: processor limited to max C-state %d\n", | 1679 | "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..c26c61fb36c3 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -70,7 +70,55 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | |||
70 | 70 | ||
71 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr) | 71 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr) |
72 | { | 72 | { |
73 | return acpi_processor_get_platform_limit(pr); | 73 | int result = 0; |
74 | int throttling_limit; | ||
75 | int current_state; | ||
76 | struct acpi_processor_limit *limit; | ||
77 | int target_state; | ||
78 | |||
79 | result = acpi_processor_get_platform_limit(pr); | ||
80 | if (result) { | ||
81 | /* Throttling Limit is unsupported */ | ||
82 | return result; | ||
83 | } | ||
84 | |||
85 | throttling_limit = pr->throttling_platform_limit; | ||
86 | if (throttling_limit >= pr->throttling.state_count) { | ||
87 | /* Uncorrect Throttling Limit */ | ||
88 | return -EINVAL; | ||
89 | } | ||
90 | |||
91 | current_state = pr->throttling.state; | ||
92 | if (current_state > throttling_limit) { | ||
93 | /* | ||
94 | * The current state can meet the requirement of | ||
95 | * _TPC limit. But it is reasonable that OSPM changes | ||
96 | * t-states from high to low for better performance. | ||
97 | * Of course the limit condition of thermal | ||
98 | * and user should be considered. | ||
99 | */ | ||
100 | limit = &pr->limit; | ||
101 | target_state = throttling_limit; | ||
102 | if (limit->thermal.tx > target_state) | ||
103 | target_state = limit->thermal.tx; | ||
104 | if (limit->user.tx > target_state) | ||
105 | target_state = limit->user.tx; | ||
106 | } else if (current_state == throttling_limit) { | ||
107 | /* | ||
108 | * Unnecessary to change the throttling state | ||
109 | */ | ||
110 | return 0; | ||
111 | } else { | ||
112 | /* | ||
113 | * If the current state is lower than the limit of _TPC, it | ||
114 | * will be forced to switch to the throttling state defined | ||
115 | * by throttling_platfor_limit. | ||
116 | * Because the previous state meets with the limit condition | ||
117 | * of thermal and user, it is unnecessary to check it again. | ||
118 | */ | ||
119 | target_state = throttling_limit; | ||
120 | } | ||
121 | return acpi_processor_set_throttling(pr, target_state); | ||
74 | } | 122 | } |
75 | 123 | ||
76 | /* | 124 | /* |
@@ -83,6 +131,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | |||
83 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 131 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
84 | union acpi_object *ptc = NULL; | 132 | union acpi_object *ptc = NULL; |
85 | union acpi_object obj = { 0 }; | 133 | union acpi_object obj = { 0 }; |
134 | struct acpi_processor_throttling *throttling; | ||
86 | 135 | ||
87 | status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); | 136 | status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); |
88 | if (ACPI_FAILURE(status)) { | 137 | if (ACPI_FAILURE(status)) { |
@@ -134,6 +183,22 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | |||
134 | memcpy(&pr->throttling.status_register, obj.buffer.pointer, | 183 | memcpy(&pr->throttling.status_register, obj.buffer.pointer, |
135 | sizeof(struct acpi_ptc_register)); | 184 | sizeof(struct acpi_ptc_register)); |
136 | 185 | ||
186 | throttling = &pr->throttling; | ||
187 | |||
188 | if ((throttling->control_register.bit_width + | ||
189 | throttling->control_register.bit_offset) > 32) { | ||
190 | printk(KERN_ERR PREFIX "Invalid _PTC control register\n"); | ||
191 | result = -EFAULT; | ||
192 | goto end; | ||
193 | } | ||
194 | |||
195 | if ((throttling->status_register.bit_width + | ||
196 | throttling->status_register.bit_offset) > 32) { | ||
197 | printk(KERN_ERR PREFIX "Invalid _PTC status register\n"); | ||
198 | result = -EFAULT; | ||
199 | goto end; | ||
200 | } | ||
201 | |||
137 | end: | 202 | end: |
138 | kfree(buffer.pointer); | 203 | kfree(buffer.pointer); |
139 | 204 | ||
@@ -328,44 +393,132 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr) | |||
328 | return 0; | 393 | return 0; |
329 | } | 394 | } |
330 | 395 | ||
331 | static int acpi_read_throttling_status(struct acpi_processor_throttling | 396 | #ifdef CONFIG_X86 |
332 | *throttling) | 397 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, |
398 | acpi_integer * value) | ||
333 | { | 399 | { |
334 | int value = -1; | 400 | struct cpuinfo_x86 *c; |
401 | u64 msr_high, msr_low; | ||
402 | unsigned int cpu; | ||
403 | u64 msr = 0; | ||
404 | int ret = -1; | ||
405 | |||
406 | cpu = pr->id; | ||
407 | c = &cpu_data(cpu); | ||
408 | |||
409 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
410 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
411 | printk(KERN_ERR PREFIX | ||
412 | "HARDWARE addr space,NOT supported yet\n"); | ||
413 | } else { | ||
414 | msr_low = 0; | ||
415 | msr_high = 0; | ||
416 | rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, | ||
417 | (u32 *)&msr_low , (u32 *) &msr_high); | ||
418 | msr = (msr_high << 32) | msr_low; | ||
419 | *value = (acpi_integer) msr; | ||
420 | ret = 0; | ||
421 | } | ||
422 | return ret; | ||
423 | } | ||
424 | |||
425 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | ||
426 | { | ||
427 | struct cpuinfo_x86 *c; | ||
428 | unsigned int cpu; | ||
429 | int ret = -1; | ||
430 | u64 msr; | ||
431 | |||
432 | cpu = pr->id; | ||
433 | c = &cpu_data(cpu); | ||
434 | |||
435 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
436 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
437 | printk(KERN_ERR PREFIX | ||
438 | "HARDWARE addr space,NOT supported yet\n"); | ||
439 | } else { | ||
440 | msr = value; | ||
441 | wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, | ||
442 | msr & 0xffffffff, msr >> 32); | ||
443 | ret = 0; | ||
444 | } | ||
445 | return ret; | ||
446 | } | ||
447 | #else | ||
448 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | ||
449 | acpi_integer * value) | ||
450 | { | ||
451 | printk(KERN_ERR PREFIX | ||
452 | "HARDWARE addr space,NOT supported yet\n"); | ||
453 | return -1; | ||
454 | } | ||
455 | |||
456 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | ||
457 | { | ||
458 | printk(KERN_ERR PREFIX | ||
459 | "HARDWARE addr space,NOT supported yet\n"); | ||
460 | return -1; | ||
461 | } | ||
462 | #endif | ||
463 | |||
464 | static int acpi_read_throttling_status(struct acpi_processor *pr, | ||
465 | acpi_integer *value) | ||
466 | { | ||
467 | u32 bit_width, bit_offset; | ||
468 | u64 ptc_value; | ||
469 | u64 ptc_mask; | ||
470 | struct acpi_processor_throttling *throttling; | ||
471 | int ret = -1; | ||
472 | |||
473 | throttling = &pr->throttling; | ||
335 | switch (throttling->status_register.space_id) { | 474 | switch (throttling->status_register.space_id) { |
336 | case ACPI_ADR_SPACE_SYSTEM_IO: | 475 | case ACPI_ADR_SPACE_SYSTEM_IO: |
476 | ptc_value = 0; | ||
477 | bit_width = throttling->status_register.bit_width; | ||
478 | bit_offset = throttling->status_register.bit_offset; | ||
479 | |||
337 | acpi_os_read_port((acpi_io_address) throttling->status_register. | 480 | acpi_os_read_port((acpi_io_address) throttling->status_register. |
338 | address, &value, | 481 | address, (u32 *) &ptc_value, |
339 | (u32) throttling->status_register.bit_width * | 482 | (u32) (bit_width + bit_offset)); |
340 | 8); | 483 | ptc_mask = (1 << bit_width) - 1; |
484 | *value = (acpi_integer) ((ptc_value >> bit_offset) & ptc_mask); | ||
485 | ret = 0; | ||
341 | break; | 486 | break; |
342 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 487 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
343 | printk(KERN_ERR PREFIX | 488 | ret = acpi_throttling_rdmsr(pr, value); |
344 | "HARDWARE addr space,NOT supported yet\n"); | ||
345 | break; | 489 | break; |
346 | default: | 490 | default: |
347 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 491 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |
348 | (u32) (throttling->status_register.space_id)); | 492 | (u32) (throttling->status_register.space_id)); |
349 | } | 493 | } |
350 | return value; | 494 | return ret; |
351 | } | 495 | } |
352 | 496 | ||
353 | static int acpi_write_throttling_state(struct acpi_processor_throttling | 497 | static int acpi_write_throttling_state(struct acpi_processor *pr, |
354 | *throttling, int value) | 498 | acpi_integer value) |
355 | { | 499 | { |
500 | u32 bit_width, bit_offset; | ||
501 | u64 ptc_value; | ||
502 | u64 ptc_mask; | ||
503 | struct acpi_processor_throttling *throttling; | ||
356 | int ret = -1; | 504 | int ret = -1; |
357 | 505 | ||
506 | throttling = &pr->throttling; | ||
358 | switch (throttling->control_register.space_id) { | 507 | switch (throttling->control_register.space_id) { |
359 | case ACPI_ADR_SPACE_SYSTEM_IO: | 508 | case ACPI_ADR_SPACE_SYSTEM_IO: |
509 | bit_width = throttling->control_register.bit_width; | ||
510 | bit_offset = throttling->control_register.bit_offset; | ||
511 | ptc_mask = (1 << bit_width) - 1; | ||
512 | ptc_value = value & ptc_mask; | ||
513 | |||
360 | acpi_os_write_port((acpi_io_address) throttling-> | 514 | acpi_os_write_port((acpi_io_address) throttling-> |
361 | control_register.address, value, | 515 | control_register.address, |
362 | (u32) throttling->control_register. | 516 | (u32) (ptc_value << bit_offset), |
363 | bit_width * 8); | 517 | (u32) (bit_width + bit_offset)); |
364 | ret = 0; | 518 | ret = 0; |
365 | break; | 519 | break; |
366 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 520 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
367 | printk(KERN_ERR PREFIX | 521 | ret = acpi_throttling_wrmsr(pr, value); |
368 | "HARDWARE addr space,NOT supported yet\n"); | ||
369 | break; | 522 | break; |
370 | default: | 523 | default: |
371 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 524 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |
@@ -374,7 +527,8 @@ static int acpi_write_throttling_state(struct acpi_processor_throttling | |||
374 | return ret; | 527 | return ret; |
375 | } | 528 | } |
376 | 529 | ||
377 | static int acpi_get_throttling_state(struct acpi_processor *pr, int value) | 530 | static int acpi_get_throttling_state(struct acpi_processor *pr, |
531 | acpi_integer value) | ||
378 | { | 532 | { |
379 | int i; | 533 | int i; |
380 | 534 | ||
@@ -390,22 +544,26 @@ static int acpi_get_throttling_state(struct acpi_processor *pr, int value) | |||
390 | return i; | 544 | return i; |
391 | } | 545 | } |
392 | 546 | ||
393 | static int acpi_get_throttling_value(struct acpi_processor *pr, int state) | 547 | static int acpi_get_throttling_value(struct acpi_processor *pr, |
548 | int state, acpi_integer *value) | ||
394 | { | 549 | { |
395 | int value = -1; | 550 | int ret = -1; |
551 | |||
396 | if (state >= 0 && state <= pr->throttling.state_count) { | 552 | if (state >= 0 && state <= pr->throttling.state_count) { |
397 | struct acpi_processor_tx_tss *tx = | 553 | struct acpi_processor_tx_tss *tx = |
398 | (struct acpi_processor_tx_tss *)&(pr->throttling. | 554 | (struct acpi_processor_tx_tss *)&(pr->throttling. |
399 | states_tss[state]); | 555 | states_tss[state]); |
400 | value = tx->control; | 556 | *value = tx->control; |
557 | ret = 0; | ||
401 | } | 558 | } |
402 | return value; | 559 | return ret; |
403 | } | 560 | } |
404 | 561 | ||
405 | static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | 562 | static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) |
406 | { | 563 | { |
407 | int state = 0; | 564 | int state = 0; |
408 | u32 value = 0; | 565 | int ret; |
566 | acpi_integer value; | ||
409 | 567 | ||
410 | if (!pr) | 568 | if (!pr) |
411 | return -EINVAL; | 569 | return -EINVAL; |
@@ -415,8 +573,9 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | |||
415 | 573 | ||
416 | pr->throttling.state = 0; | 574 | pr->throttling.state = 0; |
417 | local_irq_disable(); | 575 | local_irq_disable(); |
418 | value = acpi_read_throttling_status(&pr->throttling); | 576 | value = 0; |
419 | if (value >= 0) { | 577 | ret = acpi_read_throttling_status(pr, &value); |
578 | if (ret >= 0) { | ||
420 | state = acpi_get_throttling_state(pr, value); | 579 | state = acpi_get_throttling_state(pr, value); |
421 | pr->throttling.state = state; | 580 | pr->throttling.state = state; |
422 | } | 581 | } |
@@ -430,6 +589,40 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) | |||
430 | return pr->throttling.acpi_processor_get_throttling(pr); | 589 | return pr->throttling.acpi_processor_get_throttling(pr); |
431 | } | 590 | } |
432 | 591 | ||
592 | static int acpi_processor_get_fadt_info(struct acpi_processor *pr) | ||
593 | { | ||
594 | int i, step; | ||
595 | |||
596 | if (!pr->throttling.address) { | ||
597 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); | ||
598 | return -EINVAL; | ||
599 | } else if (!pr->throttling.duty_width) { | ||
600 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); | ||
601 | return -EINVAL; | ||
602 | } | ||
603 | /* TBD: Support duty_cycle values that span bit 4. */ | ||
604 | else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { | ||
605 | printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n"); | ||
606 | return -EINVAL; | ||
607 | } | ||
608 | |||
609 | pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width; | ||
610 | |||
611 | /* | ||
612 | * Compute state values. Note that throttling displays a linear power | ||
613 | * performance relationship (at 50% performance the CPU will consume | ||
614 | * 50% power). Values are in 1/10th of a percent to preserve accuracy. | ||
615 | */ | ||
616 | |||
617 | step = (1000 / pr->throttling.state_count); | ||
618 | |||
619 | for (i = 0; i < pr->throttling.state_count; i++) { | ||
620 | pr->throttling.states[i].performance = 1000 - step * i; | ||
621 | pr->throttling.states[i].power = 1000 - step * i; | ||
622 | } | ||
623 | return 0; | ||
624 | } | ||
625 | |||
433 | static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | 626 | static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, |
434 | int state) | 627 | int state) |
435 | { | 628 | { |
@@ -506,7 +699,8 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | |||
506 | static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | 699 | static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, |
507 | int state) | 700 | int state) |
508 | { | 701 | { |
509 | u32 value = 0; | 702 | int ret; |
703 | acpi_integer value; | ||
510 | 704 | ||
511 | if (!pr) | 705 | if (!pr) |
512 | return -EINVAL; | 706 | return -EINVAL; |
@@ -524,10 +718,10 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
524 | return -EPERM; | 718 | return -EPERM; |
525 | 719 | ||
526 | local_irq_disable(); | 720 | local_irq_disable(); |
527 | 721 | value = 0; | |
528 | value = acpi_get_throttling_value(pr, state); | 722 | ret = acpi_get_throttling_value(pr, state, &value); |
529 | if (value >= 0) { | 723 | if (ret >= 0) { |
530 | acpi_write_throttling_state(&pr->throttling, value); | 724 | acpi_write_throttling_state(pr, value); |
531 | pr->throttling.state = state; | 725 | pr->throttling.state = state; |
532 | } | 726 | } |
533 | local_irq_enable(); | 727 | local_irq_enable(); |
@@ -543,8 +737,6 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
543 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) | 737 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) |
544 | { | 738 | { |
545 | int result = 0; | 739 | int result = 0; |
546 | int step = 0; | ||
547 | int i = 0; | ||
548 | 740 | ||
549 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 741 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
550 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", | 742 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", |
@@ -563,6 +755,8 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
563 | acpi_processor_get_throttling_states(pr) || | 755 | acpi_processor_get_throttling_states(pr) || |
564 | acpi_processor_get_platform_limit(pr)) | 756 | acpi_processor_get_platform_limit(pr)) |
565 | { | 757 | { |
758 | if (acpi_processor_get_fadt_info(pr)) | ||
759 | return 0; | ||
566 | pr->throttling.acpi_processor_get_throttling = | 760 | pr->throttling.acpi_processor_get_throttling = |
567 | &acpi_processor_get_throttling_fadt; | 761 | &acpi_processor_get_throttling_fadt; |
568 | pr->throttling.acpi_processor_set_throttling = | 762 | pr->throttling.acpi_processor_set_throttling = |
@@ -576,19 +770,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
576 | 770 | ||
577 | acpi_processor_get_tsd(pr); | 771 | acpi_processor_get_tsd(pr); |
578 | 772 | ||
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 | /* | 773 | /* |
593 | * PIIX4 Errata: We don't support throttling on the original PIIX4. | 774 | * 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 | 775 | * This shouldn't be an issue as few (if any) mobile systems ever |
@@ -600,21 +781,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
600 | return 0; | 781 | return 0; |
601 | } | 782 | } |
602 | 783 | ||
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", | 784 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", |
619 | pr->throttling.state_count)); | 785 | pr->throttling.state_count)); |
620 | 786 | ||
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 90fd09c65f95..6045cdbe176b 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> |
@@ -88,7 +88,7 @@ MODULE_DEVICE_TABLE(acpi, sbs_device_ids); | |||
88 | struct acpi_battery { | 88 | struct acpi_battery { |
89 | struct power_supply bat; | 89 | struct power_supply bat; |
90 | struct acpi_sbs *sbs; | 90 | struct acpi_sbs *sbs; |
91 | #ifdef CONFIG_ACPI_PROCFS | 91 | #ifdef CONFIG_ACPI_PROCFS_POWER |
92 | struct proc_dir_entry *proc_entry; | 92 | struct proc_dir_entry *proc_entry; |
93 | #endif | 93 | #endif |
94 | unsigned long update_time; | 94 | unsigned long update_time; |
@@ -113,6 +113,7 @@ struct acpi_battery { | |||
113 | u16 spec; | 113 | u16 spec; |
114 | u8 id; | 114 | u8 id; |
115 | u8 present:1; | 115 | u8 present:1; |
116 | u8 have_sysfs_alarm:1; | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); | 119 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); |
@@ -122,7 +123,7 @@ struct acpi_sbs { | |||
122 | struct acpi_device *device; | 123 | struct acpi_device *device; |
123 | struct acpi_smb_hc *hc; | 124 | struct acpi_smb_hc *hc; |
124 | struct mutex lock; | 125 | struct mutex lock; |
125 | #ifdef CONFIG_ACPI_PROCFS | 126 | #ifdef CONFIG_ACPI_PROCFS_POWER |
126 | struct proc_dir_entry *charger_entry; | 127 | struct proc_dir_entry *charger_entry; |
127 | #endif | 128 | #endif |
128 | struct acpi_battery battery[MAX_SBS_BAT]; | 129 | struct acpi_battery battery[MAX_SBS_BAT]; |
@@ -468,7 +469,7 @@ static struct device_attribute alarm_attr = { | |||
468 | FS Interface (/proc/acpi) | 469 | FS Interface (/proc/acpi) |
469 | -------------------------------------------------------------------------- */ | 470 | -------------------------------------------------------------------------- */ |
470 | 471 | ||
471 | #ifdef CONFIG_ACPI_PROCFS | 472 | #ifdef CONFIG_ACPI_PROCFS_POWER |
472 | /* Generic Routines */ | 473 | /* Generic Routines */ |
473 | static int | 474 | static int |
474 | acpi_sbs_add_fs(struct proc_dir_entry **dir, | 475 | acpi_sbs_add_fs(struct proc_dir_entry **dir, |
@@ -789,7 +790,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
789 | return result; | 790 | return result; |
790 | 791 | ||
791 | sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); | 792 | sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); |
792 | #ifdef CONFIG_ACPI_PROCFS | 793 | #ifdef CONFIG_ACPI_PROCFS_POWER |
793 | acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir, | 794 | acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir, |
794 | battery->name, &acpi_battery_info_fops, | 795 | battery->name, &acpi_battery_info_fops, |
795 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, | 796 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, |
@@ -808,7 +809,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
808 | } | 809 | } |
809 | battery->bat.get_property = acpi_sbs_battery_get_property; | 810 | battery->bat.get_property = acpi_sbs_battery_get_property; |
810 | result = power_supply_register(&sbs->device->dev, &battery->bat); | 811 | result = power_supply_register(&sbs->device->dev, &battery->bat); |
811 | device_create_file(battery->bat.dev, &alarm_attr); | 812 | if (result) |
813 | goto end; | ||
814 | result = device_create_file(battery->bat.dev, &alarm_attr); | ||
815 | if (result) | ||
816 | goto end; | ||
817 | battery->have_sysfs_alarm = 1; | ||
818 | end: | ||
812 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", | 819 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", |
813 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), | 820 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), |
814 | battery->name, sbs->battery->present ? "present" : "absent"); | 821 | battery->name, sbs->battery->present ? "present" : "absent"); |
@@ -817,14 +824,16 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
817 | 824 | ||
818 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 825 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
819 | { | 826 | { |
820 | if (sbs->battery[id].bat.dev) | 827 | struct acpi_battery *battery = &sbs->battery[id]; |
821 | device_remove_file(sbs->battery[id].bat.dev, &alarm_attr); | 828 | |
822 | power_supply_unregister(&sbs->battery[id].bat); | 829 | if (battery->bat.dev) { |
823 | #ifdef CONFIG_ACPI_PROCFS | 830 | if (battery->have_sysfs_alarm) |
824 | if (sbs->battery[id].proc_entry) { | 831 | device_remove_file(battery->bat.dev, &alarm_attr); |
825 | acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry), | 832 | power_supply_unregister(&battery->bat); |
826 | acpi_battery_dir); | ||
827 | } | 833 | } |
834 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
835 | if (battery->proc_entry) | ||
836 | acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); | ||
828 | #endif | 837 | #endif |
829 | } | 838 | } |
830 | 839 | ||
@@ -835,7 +844,7 @@ static int acpi_charger_add(struct acpi_sbs *sbs) | |||
835 | result = acpi_ac_get_present(sbs); | 844 | result = acpi_ac_get_present(sbs); |
836 | if (result) | 845 | if (result) |
837 | goto end; | 846 | goto end; |
838 | #ifdef CONFIG_ACPI_PROCFS | 847 | #ifdef CONFIG_ACPI_PROCFS_POWER |
839 | result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir, | 848 | result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir, |
840 | ACPI_AC_DIR_NAME, NULL, | 849 | ACPI_AC_DIR_NAME, NULL, |
841 | &acpi_ac_state_fops, NULL, sbs); | 850 | &acpi_ac_state_fops, NULL, sbs); |
@@ -859,7 +868,7 @@ static void acpi_charger_remove(struct acpi_sbs *sbs) | |||
859 | { | 868 | { |
860 | if (sbs->charger.dev) | 869 | if (sbs->charger.dev) |
861 | power_supply_unregister(&sbs->charger); | 870 | power_supply_unregister(&sbs->charger); |
862 | #ifdef CONFIG_ACPI_PROCFS | 871 | #ifdef CONFIG_ACPI_PROCFS_POWER |
863 | if (sbs->charger_entry) | 872 | if (sbs->charger_entry) |
864 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); | 873 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); |
865 | #endif | 874 | #endif |
@@ -965,7 +974,7 @@ static int acpi_sbs_remove(struct acpi_device *device, int type) | |||
965 | 974 | ||
966 | static void acpi_sbs_rmdirs(void) | 975 | static void acpi_sbs_rmdirs(void) |
967 | { | 976 | { |
968 | #ifdef CONFIG_ACPI_PROCFS | 977 | #ifdef CONFIG_ACPI_PROCFS_POWER |
969 | if (acpi_ac_dir) { | 978 | if (acpi_ac_dir) { |
970 | acpi_unlock_ac_dir(acpi_ac_dir); | 979 | acpi_unlock_ac_dir(acpi_ac_dir); |
971 | acpi_ac_dir = NULL; | 980 | acpi_ac_dir = NULL; |
@@ -1004,7 +1013,7 @@ static int __init acpi_sbs_init(void) | |||
1004 | 1013 | ||
1005 | if (acpi_disabled) | 1014 | if (acpi_disabled) |
1006 | return -ENODEV; | 1015 | return -ENODEV; |
1007 | #ifdef CONFIG_ACPI_PROCFS | 1016 | #ifdef CONFIG_ACPI_PROCFS_POWER |
1008 | acpi_ac_dir = acpi_lock_ac_dir(); | 1017 | acpi_ac_dir = acpi_lock_ac_dir(); |
1009 | if (!acpi_ac_dir) | 1018 | if (!acpi_ac_dir) |
1010 | return -ENODEV; | 1019 | return -ENODEV; |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index f3d3867303ec..2c0b6630f8ba 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -167,8 +167,8 @@ static void acpi_pm_finish(void) | |||
167 | { | 167 | { |
168 | u32 acpi_state = acpi_target_sleep_state; | 168 | u32 acpi_state = acpi_target_sleep_state; |
169 | 169 | ||
170 | acpi_leave_sleep_state(acpi_state); | ||
171 | acpi_disable_wakeup_device(acpi_state); | 170 | acpi_disable_wakeup_device(acpi_state); |
171 | acpi_leave_sleep_state(acpi_state); | ||
172 | 172 | ||
173 | /* reset firmware waking vector */ | 173 | /* reset firmware waking vector */ |
174 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); | 174 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); |
@@ -272,8 +272,8 @@ static void acpi_hibernation_finish(void) | |||
272 | * enable it here. | 272 | * enable it here. |
273 | */ | 273 | */ |
274 | acpi_enable(); | 274 | acpi_enable(); |
275 | acpi_leave_sleep_state(ACPI_STATE_S4); | ||
276 | acpi_disable_wakeup_device(ACPI_STATE_S4); | 275 | acpi_disable_wakeup_device(ACPI_STATE_S4); |
276 | acpi_leave_sleep_state(ACPI_STATE_S4); | ||
277 | 277 | ||
278 | /* reset firmware waking vector */ | 278 | /* reset firmware waking vector */ |
279 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); | 279 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); |
@@ -410,6 +410,7 @@ static void acpi_power_off(void) | |||
410 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ | 410 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ |
411 | printk("%s called\n", __FUNCTION__); | 411 | printk("%s called\n", __FUNCTION__); |
412 | local_irq_disable(); | 412 | local_irq_disable(); |
413 | acpi_enable_wakeup_device(ACPI_STATE_S5); | ||
413 | acpi_enter_sleep_state(ACPI_STATE_S5); | 414 | acpi_enter_sleep_state(ACPI_STATE_S5); |
414 | } | 415 | } |
415 | 416 | ||
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/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index a736ef7bdee4..9e8c20c6a0b7 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c | |||
@@ -591,9 +591,12 @@ static int __init toshiba_acpi_init(void) | |||
591 | NULL, | 591 | NULL, |
592 | &toshiba_backlight_data); | 592 | &toshiba_backlight_data); |
593 | if (IS_ERR(toshiba_backlight_device)) { | 593 | if (IS_ERR(toshiba_backlight_device)) { |
594 | int ret = PTR_ERR(toshiba_backlight_device); | ||
595 | |||
594 | printk(KERN_ERR "Could not register toshiba backlight device\n"); | 596 | printk(KERN_ERR "Could not register toshiba backlight device\n"); |
595 | toshiba_backlight_device = NULL; | 597 | toshiba_backlight_device = NULL; |
596 | toshiba_acpi_exit(); | 598 | toshiba_acpi_exit(); |
599 | return ret; | ||
597 | } | 600 | } |
598 | toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; | 601 | toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; |
599 | 602 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index bac956b30c57..44a0d9ba9bd6 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 */ |
@@ -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 49cf4cf1a5a2..ed9b407e42d4 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -49,6 +49,9 @@ | |||
49 | #define DRV_NAME "ahci" | 49 | #define DRV_NAME "ahci" |
50 | #define DRV_VERSION "3.0" | 50 | #define DRV_VERSION "3.0" |
51 | 51 | ||
52 | static int ahci_enable_alpm(struct ata_port *ap, | ||
53 | enum link_pm policy); | ||
54 | static void ahci_disable_alpm(struct ata_port *ap); | ||
52 | 55 | ||
53 | enum { | 56 | enum { |
54 | AHCI_PCI_BAR = 5, | 57 | AHCI_PCI_BAR = 5, |
@@ -99,6 +102,7 @@ enum { | |||
99 | HOST_CAP_SSC = (1 << 14), /* Slumber capable */ | 102 | HOST_CAP_SSC = (1 << 14), /* Slumber capable */ |
100 | HOST_CAP_PMP = (1 << 17), /* Port Multiplier support */ | 103 | HOST_CAP_PMP = (1 << 17), /* Port Multiplier support */ |
101 | HOST_CAP_CLO = (1 << 24), /* Command List Override support */ | 104 | HOST_CAP_CLO = (1 << 24), /* Command List Override support */ |
105 | HOST_CAP_ALPM = (1 << 26), /* Aggressive Link PM support */ | ||
102 | HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */ | 106 | HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */ |
103 | HOST_CAP_SNTF = (1 << 29), /* SNotification register */ | 107 | HOST_CAP_SNTF = (1 << 29), /* SNotification register */ |
104 | HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */ | 108 | HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */ |
@@ -155,6 +159,8 @@ enum { | |||
155 | PORT_IRQ_PIOS_FIS | PORT_IRQ_D2H_REG_FIS, | 159 | PORT_IRQ_PIOS_FIS | PORT_IRQ_D2H_REG_FIS, |
156 | 160 | ||
157 | /* PORT_CMD bits */ | 161 | /* PORT_CMD bits */ |
162 | PORT_CMD_ASP = (1 << 27), /* Aggressive Slumber/Partial */ | ||
163 | PORT_CMD_ALPE = (1 << 26), /* Aggressive Link PM enable */ | ||
158 | PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ | 164 | PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ |
159 | PORT_CMD_PMP = (1 << 17), /* PMP attached */ | 165 | PORT_CMD_PMP = (1 << 17), /* PMP attached */ |
160 | PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ | 166 | PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ |
@@ -178,13 +184,14 @@ enum { | |||
178 | AHCI_HFLAG_MV_PATA = (1 << 4), /* PATA port */ | 184 | AHCI_HFLAG_MV_PATA = (1 << 4), /* PATA port */ |
179 | AHCI_HFLAG_NO_MSI = (1 << 5), /* no PCI MSI */ | 185 | AHCI_HFLAG_NO_MSI = (1 << 5), /* no PCI MSI */ |
180 | AHCI_HFLAG_NO_PMP = (1 << 6), /* no PMP */ | 186 | AHCI_HFLAG_NO_PMP = (1 << 6), /* no PMP */ |
187 | AHCI_HFLAG_NO_HOTPLUG = (1 << 7), /* ignore PxSERR.DIAG.N */ | ||
181 | 188 | ||
182 | /* ap->flags bits */ | 189 | /* ap->flags bits */ |
183 | AHCI_FLAG_NO_HOTPLUG = (1 << 24), /* ignore PxSERR.DIAG.N */ | ||
184 | 190 | ||
185 | AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 191 | AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
186 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | | 192 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | |
187 | ATA_FLAG_ACPI_SATA | ATA_FLAG_AN, | 193 | ATA_FLAG_ACPI_SATA | ATA_FLAG_AN | |
194 | ATA_FLAG_IPM, | ||
188 | AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY, | 195 | AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY, |
189 | }; | 196 | }; |
190 | 197 | ||
@@ -254,6 +261,11 @@ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | |||
254 | static int ahci_pci_device_resume(struct pci_dev *pdev); | 261 | static int ahci_pci_device_resume(struct pci_dev *pdev); |
255 | #endif | 262 | #endif |
256 | 263 | ||
264 | static struct class_device_attribute *ahci_shost_attrs[] = { | ||
265 | &class_device_attr_link_power_management_policy, | ||
266 | NULL | ||
267 | }; | ||
268 | |||
257 | static struct scsi_host_template ahci_sht = { | 269 | static struct scsi_host_template ahci_sht = { |
258 | .module = THIS_MODULE, | 270 | .module = THIS_MODULE, |
259 | .name = DRV_NAME, | 271 | .name = DRV_NAME, |
@@ -271,6 +283,7 @@ static struct scsi_host_template ahci_sht = { | |||
271 | .slave_configure = ata_scsi_slave_config, | 283 | .slave_configure = ata_scsi_slave_config, |
272 | .slave_destroy = ata_scsi_slave_destroy, | 284 | .slave_destroy = ata_scsi_slave_destroy, |
273 | .bios_param = ata_std_bios_param, | 285 | .bios_param = ata_std_bios_param, |
286 | .shost_attrs = ahci_shost_attrs, | ||
274 | }; | 287 | }; |
275 | 288 | ||
276 | static const struct ata_port_operations ahci_ops = { | 289 | static const struct ata_port_operations ahci_ops = { |
@@ -302,6 +315,8 @@ static const struct ata_port_operations ahci_ops = { | |||
302 | .port_suspend = ahci_port_suspend, | 315 | .port_suspend = ahci_port_suspend, |
303 | .port_resume = ahci_port_resume, | 316 | .port_resume = ahci_port_resume, |
304 | #endif | 317 | #endif |
318 | .enable_pm = ahci_enable_alpm, | ||
319 | .disable_pm = ahci_disable_alpm, | ||
305 | 320 | ||
306 | .port_start = ahci_port_start, | 321 | .port_start = ahci_port_start, |
307 | .port_stop = ahci_port_stop, | 322 | .port_stop = ahci_port_stop, |
@@ -836,6 +851,130 @@ static void ahci_power_up(struct ata_port *ap) | |||
836 | writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD); | 851 | writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD); |
837 | } | 852 | } |
838 | 853 | ||
854 | static void ahci_disable_alpm(struct ata_port *ap) | ||
855 | { | ||
856 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
857 | void __iomem *port_mmio = ahci_port_base(ap); | ||
858 | u32 cmd; | ||
859 | struct ahci_port_priv *pp = ap->private_data; | ||
860 | |||
861 | /* IPM bits should be disabled by libata-core */ | ||
862 | /* get the existing command bits */ | ||
863 | cmd = readl(port_mmio + PORT_CMD); | ||
864 | |||
865 | /* disable ALPM and ASP */ | ||
866 | cmd &= ~PORT_CMD_ASP; | ||
867 | cmd &= ~PORT_CMD_ALPE; | ||
868 | |||
869 | /* force the interface back to active */ | ||
870 | cmd |= PORT_CMD_ICC_ACTIVE; | ||
871 | |||
872 | /* write out new cmd value */ | ||
873 | writel(cmd, port_mmio + PORT_CMD); | ||
874 | cmd = readl(port_mmio + PORT_CMD); | ||
875 | |||
876 | /* wait 10ms to be sure we've come out of any low power state */ | ||
877 | msleep(10); | ||
878 | |||
879 | /* clear out any PhyRdy stuff from interrupt status */ | ||
880 | writel(PORT_IRQ_PHYRDY, port_mmio + PORT_IRQ_STAT); | ||
881 | |||
882 | /* go ahead and clean out PhyRdy Change from Serror too */ | ||
883 | ahci_scr_write(ap, SCR_ERROR, ((1 << 16) | (1 << 18))); | ||
884 | |||
885 | /* | ||
886 | * Clear flag to indicate that we should ignore all PhyRdy | ||
887 | * state changes | ||
888 | */ | ||
889 | hpriv->flags &= ~AHCI_HFLAG_NO_HOTPLUG; | ||
890 | |||
891 | /* | ||
892 | * Enable interrupts on Phy Ready. | ||
893 | */ | ||
894 | pp->intr_mask |= PORT_IRQ_PHYRDY; | ||
895 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); | ||
896 | |||
897 | /* | ||
898 | * don't change the link pm policy - we can be called | ||
899 | * just to turn of link pm temporarily | ||
900 | */ | ||
901 | } | ||
902 | |||
903 | static int ahci_enable_alpm(struct ata_port *ap, | ||
904 | enum link_pm policy) | ||
905 | { | ||
906 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
907 | void __iomem *port_mmio = ahci_port_base(ap); | ||
908 | u32 cmd; | ||
909 | struct ahci_port_priv *pp = ap->private_data; | ||
910 | u32 asp; | ||
911 | |||
912 | /* Make sure the host is capable of link power management */ | ||
913 | if (!(hpriv->cap & HOST_CAP_ALPM)) | ||
914 | return -EINVAL; | ||
915 | |||
916 | switch (policy) { | ||
917 | case MAX_PERFORMANCE: | ||
918 | case NOT_AVAILABLE: | ||
919 | /* | ||
920 | * if we came here with NOT_AVAILABLE, | ||
921 | * it just means this is the first time we | ||
922 | * have tried to enable - default to max performance, | ||
923 | * and let the user go to lower power modes on request. | ||
924 | */ | ||
925 | ahci_disable_alpm(ap); | ||
926 | return 0; | ||
927 | case MIN_POWER: | ||
928 | /* configure HBA to enter SLUMBER */ | ||
929 | asp = PORT_CMD_ASP; | ||
930 | break; | ||
931 | case MEDIUM_POWER: | ||
932 | /* configure HBA to enter PARTIAL */ | ||
933 | asp = 0; | ||
934 | break; | ||
935 | default: | ||
936 | return -EINVAL; | ||
937 | } | ||
938 | |||
939 | /* | ||
940 | * Disable interrupts on Phy Ready. This keeps us from | ||
941 | * getting woken up due to spurious phy ready interrupts | ||
942 | * TBD - Hot plug should be done via polling now, is | ||
943 | * that even supported? | ||
944 | */ | ||
945 | pp->intr_mask &= ~PORT_IRQ_PHYRDY; | ||
946 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); | ||
947 | |||
948 | /* | ||
949 | * Set a flag to indicate that we should ignore all PhyRdy | ||
950 | * state changes since these can happen now whenever we | ||
951 | * change link state | ||
952 | */ | ||
953 | hpriv->flags |= AHCI_HFLAG_NO_HOTPLUG; | ||
954 | |||
955 | /* get the existing command bits */ | ||
956 | cmd = readl(port_mmio + PORT_CMD); | ||
957 | |||
958 | /* | ||
959 | * Set ASP based on Policy | ||
960 | */ | ||
961 | cmd |= asp; | ||
962 | |||
963 | /* | ||
964 | * Setting this bit will instruct the HBA to aggressively | ||
965 | * enter a lower power link state when it's appropriate and | ||
966 | * based on the value set above for ASP | ||
967 | */ | ||
968 | cmd |= PORT_CMD_ALPE; | ||
969 | |||
970 | /* write out new cmd value */ | ||
971 | writel(cmd, port_mmio + PORT_CMD); | ||
972 | cmd = readl(port_mmio + PORT_CMD); | ||
973 | |||
974 | /* IPM bits should be set by libata-core */ | ||
975 | return 0; | ||
976 | } | ||
977 | |||
839 | #ifdef CONFIG_PM | 978 | #ifdef CONFIG_PM |
840 | static void ahci_power_down(struct ata_port *ap) | 979 | static void ahci_power_down(struct ata_port *ap) |
841 | { | 980 | { |
@@ -898,8 +1037,10 @@ static int ahci_reset_controller(struct ata_host *host) | |||
898 | * AHCI-specific, such as HOST_RESET. | 1037 | * AHCI-specific, such as HOST_RESET. |
899 | */ | 1038 | */ |
900 | tmp = readl(mmio + HOST_CTL); | 1039 | tmp = readl(mmio + HOST_CTL); |
901 | if (!(tmp & HOST_AHCI_EN)) | 1040 | if (!(tmp & HOST_AHCI_EN)) { |
902 | writel(tmp | HOST_AHCI_EN, mmio + HOST_CTL); | 1041 | tmp |= HOST_AHCI_EN; |
1042 | writel(tmp, mmio + HOST_CTL); | ||
1043 | } | ||
903 | 1044 | ||
904 | /* global controller reset */ | 1045 | /* global controller reset */ |
905 | if ((tmp & HOST_RESET) == 0) { | 1046 | if ((tmp & HOST_RESET) == 0) { |
@@ -1153,15 +1294,8 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
1153 | tf.ctl &= ~ATA_SRST; | 1294 | tf.ctl &= ~ATA_SRST; |
1154 | ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); | 1295 | ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); |
1155 | 1296 | ||
1156 | /* spec mandates ">= 2ms" before checking status. | 1297 | /* wait a while before checking status */ |
1157 | * We wait 150ms, because that was the magic delay used for | 1298 | ata_wait_after_reset(ap, deadline); |
1158 | * ATAPI devices in Hale Landis's ATADRVR, for the period of time | ||
1159 | * between when the ATA command register is written, and then | ||
1160 | * status is checked. Because waiting for "a while" before | ||
1161 | * checking status is fine, post SRST, we perform this magic | ||
1162 | * delay here as well. | ||
1163 | */ | ||
1164 | msleep(150); | ||
1165 | 1299 | ||
1166 | rc = ata_wait_ready(ap, deadline); | 1300 | rc = ata_wait_ready(ap, deadline); |
1167 | /* link occupied, -ENODEV too is an error */ | 1301 | /* link occupied, -ENODEV too is an error */ |
@@ -1509,6 +1643,17 @@ static void ahci_port_intr(struct ata_port *ap) | |||
1509 | if (unlikely(resetting)) | 1643 | if (unlikely(resetting)) |
1510 | status &= ~PORT_IRQ_BAD_PMP; | 1644 | status &= ~PORT_IRQ_BAD_PMP; |
1511 | 1645 | ||
1646 | /* If we are getting PhyRdy, this is | ||
1647 | * just a power state change, we should | ||
1648 | * clear out this, plus the PhyRdy/Comm | ||
1649 | * Wake bits from Serror | ||
1650 | */ | ||
1651 | if ((hpriv->flags & AHCI_HFLAG_NO_HOTPLUG) && | ||
1652 | (status & PORT_IRQ_PHYRDY)) { | ||
1653 | status &= ~PORT_IRQ_PHYRDY; | ||
1654 | ahci_scr_write(ap, SCR_ERROR, ((1 << 16) | (1 << 18))); | ||
1655 | } | ||
1656 | |||
1512 | if (unlikely(status & PORT_IRQ_ERROR)) { | 1657 | if (unlikely(status & PORT_IRQ_ERROR)) { |
1513 | ahci_error_intr(ap, status); | 1658 | ahci_error_intr(ap, status); |
1514 | return; | 1659 | return; |
@@ -2156,6 +2301,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2156 | ata_port_pbar_desc(ap, AHCI_PCI_BAR, | 2301 | ata_port_pbar_desc(ap, AHCI_PCI_BAR, |
2157 | 0x100 + ap->port_no * 0x80, "port"); | 2302 | 0x100 + ap->port_no * 0x80, "port"); |
2158 | 2303 | ||
2304 | /* set initial link pm policy */ | ||
2305 | ap->pm_policy = NOT_AVAILABLE; | ||
2306 | |||
2159 | /* standard SATA port setup */ | 2307 | /* standard SATA port setup */ |
2160 | if (hpriv->port_map & (1 << i)) | 2308 | if (hpriv->port_map & (1 << i)) |
2161 | ap->ioaddr.cmd_addr = port_mmio; | 2309 | ap->ioaddr.cmd_addr = port_mmio; |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index a4b2cb29f46c..483269db2c7d 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[] = { |
@@ -621,6 +649,7 @@ struct ich_laptop { | |||
621 | static const struct ich_laptop ich_laptop[] = { | 649 | static const struct ich_laptop ich_laptop[] = { |
622 | /* devid, subvendor, subdev */ | 650 | /* devid, subvendor, subdev */ |
623 | { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ | 651 | { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ |
652 | { 0x27DF, 0x1025, 0x0102 }, /* ICH7 on Acer 5602aWLMi */ | ||
624 | { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ | 653 | { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ |
625 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ | 654 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ |
626 | { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ | 655 | { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ |
@@ -959,6 +988,13 @@ static int piix_broken_suspend(void) | |||
959 | }, | 988 | }, |
960 | }, | 989 | }, |
961 | { | 990 | { |
991 | .ident = "Satellite Pro U200", | ||
992 | .matches = { | ||
993 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
994 | DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE PRO U200"), | ||
995 | }, | ||
996 | }, | ||
997 | { | ||
962 | .ident = "Satellite U205", | 998 | .ident = "Satellite U205", |
963 | .matches = { | 999 | .matches = { |
964 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 1000 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
@@ -966,6 +1002,13 @@ static int piix_broken_suspend(void) | |||
966 | }, | 1002 | }, |
967 | }, | 1003 | }, |
968 | { | 1004 | { |
1005 | .ident = "SATELLITE U205", | ||
1006 | .matches = { | ||
1007 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
1008 | DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE U205"), | ||
1009 | }, | ||
1010 | }, | ||
1011 | { | ||
969 | .ident = "Portege M500", | 1012 | .ident = "Portege M500", |
970 | .matches = { | 1013 | .matches = { |
971 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 1014 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
@@ -1078,12 +1121,12 @@ static int piix_disable_ahci(struct pci_dev *pdev) | |||
1078 | if (!mmio) | 1121 | if (!mmio) |
1079 | return -ENOMEM; | 1122 | return -ENOMEM; |
1080 | 1123 | ||
1081 | tmp = readl(mmio + AHCI_GLOBAL_CTL); | 1124 | tmp = ioread32(mmio + AHCI_GLOBAL_CTL); |
1082 | if (tmp & AHCI_ENABLE) { | 1125 | if (tmp & AHCI_ENABLE) { |
1083 | tmp &= ~AHCI_ENABLE; | 1126 | tmp &= ~AHCI_ENABLE; |
1084 | writel(tmp, mmio + AHCI_GLOBAL_CTL); | 1127 | iowrite32(tmp, mmio + AHCI_GLOBAL_CTL); |
1085 | 1128 | ||
1086 | tmp = readl(mmio + AHCI_GLOBAL_CTL); | 1129 | tmp = ioread32(mmio + AHCI_GLOBAL_CTL); |
1087 | if (tmp & AHCI_ENABLE) | 1130 | if (tmp & AHCI_ENABLE) |
1088 | rc = -EIO; | 1131 | rc = -EIO; |
1089 | } | 1132 | } |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 08a52dd45fb6..545ea865ceb5 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -312,7 +312,7 @@ EXPORT_SYMBOL_GPL(ata_acpi_stm); | |||
312 | * | 312 | * |
313 | * RETURNS: | 313 | * RETURNS: |
314 | * Number of taskfiles on success, 0 if _GTF doesn't exist or doesn't | 314 | * Number of taskfiles on success, 0 if _GTF doesn't exist or doesn't |
315 | * contain valid data. -errno on other errors. | 315 | * contain valid data. |
316 | */ | 316 | */ |
317 | static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, | 317 | static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, |
318 | void **ptr_to_free) | 318 | void **ptr_to_free) |
@@ -339,7 +339,6 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, | |||
339 | ata_dev_printk(dev, KERN_WARNING, | 339 | ata_dev_printk(dev, KERN_WARNING, |
340 | "_GTF evaluation failed (AE 0x%x)\n", | 340 | "_GTF evaluation failed (AE 0x%x)\n", |
341 | status); | 341 | status); |
342 | rc = -EIO; | ||
343 | } | 342 | } |
344 | goto out_free; | 343 | goto out_free; |
345 | } | 344 | } |
@@ -359,7 +358,6 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, | |||
359 | ata_dev_printk(dev, KERN_WARNING, | 358 | ata_dev_printk(dev, KERN_WARNING, |
360 | "_GTF unexpected object type 0x%x\n", | 359 | "_GTF unexpected object type 0x%x\n", |
361 | out_obj->type); | 360 | out_obj->type); |
362 | rc = -EINVAL; | ||
363 | goto out_free; | 361 | goto out_free; |
364 | } | 362 | } |
365 | 363 | ||
@@ -367,7 +365,6 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, | |||
367 | ata_dev_printk(dev, KERN_WARNING, | 365 | ata_dev_printk(dev, KERN_WARNING, |
368 | "unexpected _GTF length (%d)\n", | 366 | "unexpected _GTF length (%d)\n", |
369 | out_obj->buffer.length); | 367 | out_obj->buffer.length); |
370 | rc = -EINVAL; | ||
371 | goto out_free; | 368 | goto out_free; |
372 | } | 369 | } |
373 | 370 | ||
@@ -511,10 +508,7 @@ static int ata_acpi_exec_tfs(struct ata_device *dev) | |||
511 | int gtf_count, i, rc; | 508 | int gtf_count, i, rc; |
512 | 509 | ||
513 | /* get taskfiles */ | 510 | /* get taskfiles */ |
514 | rc = ata_dev_get_GTF(dev, >f, &ptr_to_free); | 511 | gtf_count = ata_dev_get_GTF(dev, >f, &ptr_to_free); |
515 | if (rc < 0) | ||
516 | return rc; | ||
517 | gtf_count = rc; | ||
518 | 512 | ||
519 | /* execute them */ | 513 | /* execute them */ |
520 | for (i = 0, rc = 0; i < gtf_count; i++) { | 514 | for (i = 0, rc = 0; i < gtf_count; i++) { |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 081e3dfb64d4..33f06277b3be 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> |
@@ -620,6 +628,183 @@ void ata_dev_disable(struct ata_device *dev) | |||
620 | } | 628 | } |
621 | } | 629 | } |
622 | 630 | ||
631 | static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy) | ||
632 | { | ||
633 | struct ata_link *link = dev->link; | ||
634 | struct ata_port *ap = link->ap; | ||
635 | u32 scontrol; | ||
636 | unsigned int err_mask; | ||
637 | int rc; | ||
638 | |||
639 | /* | ||
640 | * disallow DIPM for drivers which haven't set | ||
641 | * ATA_FLAG_IPM. This is because when DIPM is enabled, | ||
642 | * phy ready will be set in the interrupt status on | ||
643 | * state changes, which will cause some drivers to | ||
644 | * think there are errors - additionally drivers will | ||
645 | * need to disable hot plug. | ||
646 | */ | ||
647 | if (!(ap->flags & ATA_FLAG_IPM) || !ata_dev_enabled(dev)) { | ||
648 | ap->pm_policy = NOT_AVAILABLE; | ||
649 | return -EINVAL; | ||
650 | } | ||
651 | |||
652 | /* | ||
653 | * For DIPM, we will only enable it for the | ||
654 | * min_power setting. | ||
655 | * | ||
656 | * Why? Because Disks are too stupid to know that | ||
657 | * If the host rejects a request to go to SLUMBER | ||
658 | * they should retry at PARTIAL, and instead it | ||
659 | * just would give up. So, for medium_power to | ||
660 | * work at all, we need to only allow HIPM. | ||
661 | */ | ||
662 | rc = sata_scr_read(link, SCR_CONTROL, &scontrol); | ||
663 | if (rc) | ||
664 | return rc; | ||
665 | |||
666 | switch (policy) { | ||
667 | case MIN_POWER: | ||
668 | /* no restrictions on IPM transitions */ | ||
669 | scontrol &= ~(0x3 << 8); | ||
670 | rc = sata_scr_write(link, SCR_CONTROL, scontrol); | ||
671 | if (rc) | ||
672 | return rc; | ||
673 | |||
674 | /* enable DIPM */ | ||
675 | if (dev->flags & ATA_DFLAG_DIPM) | ||
676 | err_mask = ata_dev_set_feature(dev, | ||
677 | SETFEATURES_SATA_ENABLE, SATA_DIPM); | ||
678 | break; | ||
679 | case MEDIUM_POWER: | ||
680 | /* allow IPM to PARTIAL */ | ||
681 | scontrol &= ~(0x1 << 8); | ||
682 | scontrol |= (0x2 << 8); | ||
683 | rc = sata_scr_write(link, SCR_CONTROL, scontrol); | ||
684 | if (rc) | ||
685 | return rc; | ||
686 | |||
687 | /* | ||
688 | * we don't have to disable DIPM since IPM flags | ||
689 | * disallow transitions to SLUMBER, which effectively | ||
690 | * disable DIPM if it does not support PARTIAL | ||
691 | */ | ||
692 | break; | ||
693 | case NOT_AVAILABLE: | ||
694 | case MAX_PERFORMANCE: | ||
695 | /* disable all IPM transitions */ | ||
696 | scontrol |= (0x3 << 8); | ||
697 | rc = sata_scr_write(link, SCR_CONTROL, scontrol); | ||
698 | if (rc) | ||
699 | return rc; | ||
700 | |||
701 | /* | ||
702 | * we don't have to disable DIPM since IPM flags | ||
703 | * disallow all transitions which effectively | ||
704 | * disable DIPM anyway. | ||
705 | */ | ||
706 | break; | ||
707 | } | ||
708 | |||
709 | /* FIXME: handle SET FEATURES failure */ | ||
710 | (void) err_mask; | ||
711 | |||
712 | return 0; | ||
713 | } | ||
714 | |||
715 | /** | ||
716 | * ata_dev_enable_pm - enable SATA interface power management | ||
717 | * @dev: device to enable power management | ||
718 | * @policy: the link power management policy | ||
719 | * | ||
720 | * Enable SATA Interface power management. This will enable | ||
721 | * Device Interface Power Management (DIPM) for min_power | ||
722 | * policy, and then call driver specific callbacks for | ||
723 | * enabling Host Initiated Power management. | ||
724 | * | ||
725 | * Locking: Caller. | ||
726 | * Returns: -EINVAL if IPM is not supported, 0 otherwise. | ||
727 | */ | ||
728 | void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy) | ||
729 | { | ||
730 | int rc = 0; | ||
731 | struct ata_port *ap = dev->link->ap; | ||
732 | |||
733 | /* set HIPM first, then DIPM */ | ||
734 | if (ap->ops->enable_pm) | ||
735 | rc = ap->ops->enable_pm(ap, policy); | ||
736 | if (rc) | ||
737 | goto enable_pm_out; | ||
738 | rc = ata_dev_set_dipm(dev, policy); | ||
739 | |||
740 | enable_pm_out: | ||
741 | if (rc) | ||
742 | ap->pm_policy = MAX_PERFORMANCE; | ||
743 | else | ||
744 | ap->pm_policy = policy; | ||
745 | return /* rc */; /* hopefully we can use 'rc' eventually */ | ||
746 | } | ||
747 | |||
748 | #ifdef CONFIG_PM | ||
749 | /** | ||
750 | * ata_dev_disable_pm - disable SATA interface power management | ||
751 | * @dev: device to disable power management | ||
752 | * | ||
753 | * Disable SATA Interface power management. This will disable | ||
754 | * Device Interface Power Management (DIPM) without changing | ||
755 | * policy, call driver specific callbacks for disabling Host | ||
756 | * Initiated Power management. | ||
757 | * | ||
758 | * Locking: Caller. | ||
759 | * Returns: void | ||
760 | */ | ||
761 | static void ata_dev_disable_pm(struct ata_device *dev) | ||
762 | { | ||
763 | struct ata_port *ap = dev->link->ap; | ||
764 | |||
765 | ata_dev_set_dipm(dev, MAX_PERFORMANCE); | ||
766 | if (ap->ops->disable_pm) | ||
767 | ap->ops->disable_pm(ap); | ||
768 | } | ||
769 | #endif /* CONFIG_PM */ | ||
770 | |||
771 | void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy) | ||
772 | { | ||
773 | ap->pm_policy = policy; | ||
774 | ap->link.eh_info.action |= ATA_EHI_LPM; | ||
775 | ap->link.eh_info.flags |= ATA_EHI_NO_AUTOPSY; | ||
776 | ata_port_schedule_eh(ap); | ||
777 | } | ||
778 | |||
779 | #ifdef CONFIG_PM | ||
780 | static void ata_lpm_enable(struct ata_host *host) | ||
781 | { | ||
782 | struct ata_link *link; | ||
783 | struct ata_port *ap; | ||
784 | struct ata_device *dev; | ||
785 | int i; | ||
786 | |||
787 | for (i = 0; i < host->n_ports; i++) { | ||
788 | ap = host->ports[i]; | ||
789 | ata_port_for_each_link(link, ap) { | ||
790 | ata_link_for_each_dev(dev, link) | ||
791 | ata_dev_disable_pm(dev); | ||
792 | } | ||
793 | } | ||
794 | } | ||
795 | |||
796 | static void ata_lpm_disable(struct ata_host *host) | ||
797 | { | ||
798 | int i; | ||
799 | |||
800 | for (i = 0; i < host->n_ports; i++) { | ||
801 | struct ata_port *ap = host->ports[i]; | ||
802 | ata_lpm_schedule(ap, ap->pm_policy); | ||
803 | } | ||
804 | } | ||
805 | #endif /* CONFIG_PM */ | ||
806 | |||
807 | |||
623 | /** | 808 | /** |
624 | * ata_devchk - PATA device presence detection | 809 | * ata_devchk - PATA device presence detection |
625 | * @ap: ATA channel to examine | 810 | * @ap: ATA channel to examine |
@@ -2101,6 +2286,13 @@ int ata_dev_configure(struct ata_device *dev) | |||
2101 | if (dev->flags & ATA_DFLAG_LBA48) | 2286 | if (dev->flags & ATA_DFLAG_LBA48) |
2102 | dev->max_sectors = ATA_MAX_SECTORS_LBA48; | 2287 | dev->max_sectors = ATA_MAX_SECTORS_LBA48; |
2103 | 2288 | ||
2289 | if (!(dev->horkage & ATA_HORKAGE_IPM)) { | ||
2290 | if (ata_id_has_hipm(dev->id)) | ||
2291 | dev->flags |= ATA_DFLAG_HIPM; | ||
2292 | if (ata_id_has_dipm(dev->id)) | ||
2293 | dev->flags |= ATA_DFLAG_DIPM; | ||
2294 | } | ||
2295 | |||
2104 | if (dev->horkage & ATA_HORKAGE_DIAGNOSTIC) { | 2296 | if (dev->horkage & ATA_HORKAGE_DIAGNOSTIC) { |
2105 | /* Let the user know. We don't want to disallow opens for | 2297 | /* Let the user know. We don't want to disallow opens for |
2106 | rescue purposes, or in case the vendor is just a blithering | 2298 | rescue purposes, or in case the vendor is just a blithering |
@@ -2122,10 +2314,23 @@ int ata_dev_configure(struct ata_device *dev) | |||
2122 | dev->max_sectors = ATA_MAX_SECTORS; | 2314 | dev->max_sectors = ATA_MAX_SECTORS; |
2123 | } | 2315 | } |
2124 | 2316 | ||
2317 | if ((dev->class == ATA_DEV_ATAPI) && | ||
2318 | (atapi_command_packet_set(id) == TYPE_TAPE)) { | ||
2319 | dev->max_sectors = ATA_MAX_SECTORS_TAPE; | ||
2320 | dev->horkage |= ATA_HORKAGE_STUCK_ERR; | ||
2321 | } | ||
2322 | |||
2125 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) | 2323 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) |
2126 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, | 2324 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, |
2127 | dev->max_sectors); | 2325 | dev->max_sectors); |
2128 | 2326 | ||
2327 | if (ata_dev_blacklisted(dev) & ATA_HORKAGE_IPM) { | ||
2328 | dev->horkage |= ATA_HORKAGE_IPM; | ||
2329 | |||
2330 | /* reset link pm_policy for this port to no pm */ | ||
2331 | ap->pm_policy = MAX_PERFORMANCE; | ||
2332 | } | ||
2333 | |||
2129 | if (ap->ops->dev_config) | 2334 | if (ap->ops->dev_config) |
2130 | ap->ops->dev_config(dev); | 2335 | ap->ops->dev_config(dev); |
2131 | 2336 | ||
@@ -2219,6 +2424,25 @@ int ata_bus_probe(struct ata_port *ap) | |||
2219 | tries[dev->devno] = ATA_PROBE_MAX_TRIES; | 2424 | tries[dev->devno] = ATA_PROBE_MAX_TRIES; |
2220 | 2425 | ||
2221 | retry: | 2426 | retry: |
2427 | ata_link_for_each_dev(dev, &ap->link) { | ||
2428 | /* If we issue an SRST then an ATA drive (not ATAPI) | ||
2429 | * may change configuration and be in PIO0 timing. If | ||
2430 | * we do a hard reset (or are coming from power on) | ||
2431 | * this is true for ATA or ATAPI. Until we've set a | ||
2432 | * suitable controller mode we should not touch the | ||
2433 | * bus as we may be talking too fast. | ||
2434 | */ | ||
2435 | dev->pio_mode = XFER_PIO_0; | ||
2436 | |||
2437 | /* If the controller has a pio mode setup function | ||
2438 | * then use it to set the chipset to rights. Don't | ||
2439 | * touch the DMA setup as that will be dealt with when | ||
2440 | * configuring devices. | ||
2441 | */ | ||
2442 | if (ap->ops->set_piomode) | ||
2443 | ap->ops->set_piomode(ap, dev); | ||
2444 | } | ||
2445 | |||
2222 | /* reset and determine device classes */ | 2446 | /* reset and determine device classes */ |
2223 | ap->ops->phy_reset(ap); | 2447 | ap->ops->phy_reset(ap); |
2224 | 2448 | ||
@@ -2234,12 +2458,6 @@ int ata_bus_probe(struct ata_port *ap) | |||
2234 | 2458 | ||
2235 | ata_port_probe(ap); | 2459 | ata_port_probe(ap); |
2236 | 2460 | ||
2237 | /* after the reset the device state is PIO 0 and the controller | ||
2238 | state is undefined. Record the mode */ | ||
2239 | |||
2240 | ata_link_for_each_dev(dev, &ap->link) | ||
2241 | dev->pio_mode = XFER_PIO_0; | ||
2242 | |||
2243 | /* read IDENTIFY page and configure devices. We have to do the identify | 2461 | /* read IDENTIFY page and configure devices. We have to do the identify |
2244 | specific sequence bass-ackwards so that PDIAG- is released by | 2462 | specific sequence bass-ackwards so that PDIAG- is released by |
2245 | the slave device */ | 2463 | the slave device */ |
@@ -2373,81 +2591,6 @@ void sata_print_link_status(struct ata_link *link) | |||
2373 | } | 2591 | } |
2374 | 2592 | ||
2375 | /** | 2593 | /** |
2376 | * __sata_phy_reset - Wake/reset a low-level SATA PHY | ||
2377 | * @ap: SATA port associated with target SATA PHY. | ||
2378 | * | ||
2379 | * This function issues commands to standard SATA Sxxx | ||
2380 | * PHY registers, to wake up the phy (and device), and | ||
2381 | * clear any reset condition. | ||
2382 | * | ||
2383 | * LOCKING: | ||
2384 | * PCI/etc. bus probe sem. | ||
2385 | * | ||
2386 | */ | ||
2387 | void __sata_phy_reset(struct ata_port *ap) | ||
2388 | { | ||
2389 | struct ata_link *link = &ap->link; | ||
2390 | unsigned long timeout = jiffies + (HZ * 5); | ||
2391 | u32 sstatus; | ||
2392 | |||
2393 | if (ap->flags & ATA_FLAG_SATA_RESET) { | ||
2394 | /* issue phy wake/reset */ | ||
2395 | sata_scr_write_flush(link, SCR_CONTROL, 0x301); | ||
2396 | /* Couldn't find anything in SATA I/II specs, but | ||
2397 | * AHCI-1.1 10.4.2 says at least 1 ms. */ | ||
2398 | mdelay(1); | ||
2399 | } | ||
2400 | /* phy wake/clear reset */ | ||
2401 | sata_scr_write_flush(link, SCR_CONTROL, 0x300); | ||
2402 | |||
2403 | /* wait for phy to become ready, if necessary */ | ||
2404 | do { | ||
2405 | msleep(200); | ||
2406 | sata_scr_read(link, SCR_STATUS, &sstatus); | ||
2407 | if ((sstatus & 0xf) != 1) | ||
2408 | break; | ||
2409 | } while (time_before(jiffies, timeout)); | ||
2410 | |||
2411 | /* print link status */ | ||
2412 | sata_print_link_status(link); | ||
2413 | |||
2414 | /* TODO: phy layer with polling, timeouts, etc. */ | ||
2415 | if (!ata_link_offline(link)) | ||
2416 | ata_port_probe(ap); | ||
2417 | else | ||
2418 | ata_port_disable(ap); | ||
2419 | |||
2420 | if (ap->flags & ATA_FLAG_DISABLED) | ||
2421 | return; | ||
2422 | |||
2423 | if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) { | ||
2424 | ata_port_disable(ap); | ||
2425 | return; | ||
2426 | } | ||
2427 | |||
2428 | ap->cbl = ATA_CBL_SATA; | ||
2429 | } | ||
2430 | |||
2431 | /** | ||
2432 | * sata_phy_reset - Reset SATA bus. | ||
2433 | * @ap: SATA port associated with target SATA PHY. | ||
2434 | * | ||
2435 | * This function resets the SATA bus, and then probes | ||
2436 | * the bus for devices. | ||
2437 | * | ||
2438 | * LOCKING: | ||
2439 | * PCI/etc. bus probe sem. | ||
2440 | * | ||
2441 | */ | ||
2442 | void sata_phy_reset(struct ata_port *ap) | ||
2443 | { | ||
2444 | __sata_phy_reset(ap); | ||
2445 | if (ap->flags & ATA_FLAG_DISABLED) | ||
2446 | return; | ||
2447 | ata_bus_reset(ap); | ||
2448 | } | ||
2449 | |||
2450 | /** | ||
2451 | * ata_dev_pair - return other device on cable | 2594 | * ata_dev_pair - return other device on cable |
2452 | * @adev: device | 2595 | * @adev: device |
2453 | * | 2596 | * |
@@ -2545,17 +2688,27 @@ int sata_down_spd_limit(struct ata_link *link) | |||
2545 | 2688 | ||
2546 | static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol) | 2689 | static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol) |
2547 | { | 2690 | { |
2548 | u32 spd, limit; | 2691 | struct ata_link *host_link = &link->ap->link; |
2692 | u32 limit, target, spd; | ||
2693 | |||
2694 | limit = link->sata_spd_limit; | ||
2695 | |||
2696 | /* Don't configure downstream link faster than upstream link. | ||
2697 | * It doesn't speed up anything and some PMPs choke on such | ||
2698 | * configuration. | ||
2699 | */ | ||
2700 | if (!ata_is_host_link(link) && host_link->sata_spd) | ||
2701 | limit &= (1 << host_link->sata_spd) - 1; | ||
2549 | 2702 | ||
2550 | if (link->sata_spd_limit == UINT_MAX) | 2703 | if (limit == UINT_MAX) |
2551 | limit = 0; | 2704 | target = 0; |
2552 | else | 2705 | else |
2553 | limit = fls(link->sata_spd_limit); | 2706 | target = fls(limit); |
2554 | 2707 | ||
2555 | spd = (*scontrol >> 4) & 0xf; | 2708 | spd = (*scontrol >> 4) & 0xf; |
2556 | *scontrol = (*scontrol & ~0xf0) | ((limit & 0xf) << 4); | 2709 | *scontrol = (*scontrol & ~0xf0) | ((target & 0xf) << 4); |
2557 | 2710 | ||
2558 | return spd != limit; | 2711 | return spd != target; |
2559 | } | 2712 | } |
2560 | 2713 | ||
2561 | /** | 2714 | /** |
@@ -2578,7 +2731,7 @@ int sata_set_spd_needed(struct ata_link *link) | |||
2578 | u32 scontrol; | 2731 | u32 scontrol; |
2579 | 2732 | ||
2580 | if (sata_scr_read(link, SCR_CONTROL, &scontrol)) | 2733 | if (sata_scr_read(link, SCR_CONTROL, &scontrol)) |
2581 | return 0; | 2734 | return 1; |
2582 | 2735 | ||
2583 | return __sata_set_spd_needed(link, &scontrol); | 2736 | return __sata_set_spd_needed(link, &scontrol); |
2584 | } | 2737 | } |
@@ -3118,6 +3271,61 @@ int ata_busy_sleep(struct ata_port *ap, | |||
3118 | } | 3271 | } |
3119 | 3272 | ||
3120 | /** | 3273 | /** |
3274 | * ata_wait_after_reset - wait before checking status after reset | ||
3275 | * @ap: port containing status register to be polled | ||
3276 | * @deadline: deadline jiffies for the operation | ||
3277 | * | ||
3278 | * After reset, we need to pause a while before reading status. | ||
3279 | * Also, certain combination of controller and device report 0xff | ||
3280 | * for some duration (e.g. until SATA PHY is up and running) | ||
3281 | * which is interpreted as empty port in ATA world. This | ||
3282 | * function also waits for such devices to get out of 0xff | ||
3283 | * status. | ||
3284 | * | ||
3285 | * LOCKING: | ||
3286 | * Kernel thread context (may sleep). | ||
3287 | */ | ||
3288 | void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline) | ||
3289 | { | ||
3290 | unsigned long until = jiffies + ATA_TMOUT_FF_WAIT; | ||
3291 | |||
3292 | if (time_before(until, deadline)) | ||
3293 | deadline = until; | ||
3294 | |||
3295 | /* Spec mandates ">= 2ms" before checking status. We wait | ||
3296 | * 150ms, because that was the magic delay used for ATAPI | ||
3297 | * devices in Hale Landis's ATADRVR, for the period of time | ||
3298 | * between when the ATA command register is written, and then | ||
3299 | * status is checked. Because waiting for "a while" before | ||
3300 | * checking status is fine, post SRST, we perform this magic | ||
3301 | * delay here as well. | ||
3302 | * | ||
3303 | * Old drivers/ide uses the 2mS rule and then waits for ready. | ||
3304 | */ | ||
3305 | msleep(150); | ||
3306 | |||
3307 | /* Wait for 0xff to clear. Some SATA devices take a long time | ||
3308 | * to clear 0xff after reset. For example, HHD424020F7SV00 | ||
3309 | * iVDR needs >= 800ms while. Quantum GoVault needs even more | ||
3310 | * than that. | ||
3311 | * | ||
3312 | * Note that some PATA controllers (pata_ali) explode if | ||
3313 | * status register is read more than once when there's no | ||
3314 | * device attached. | ||
3315 | */ | ||
3316 | if (ap->flags & ATA_FLAG_SATA) { | ||
3317 | while (1) { | ||
3318 | u8 status = ata_chk_status(ap); | ||
3319 | |||
3320 | if (status != 0xff || time_after(jiffies, deadline)) | ||
3321 | return; | ||
3322 | |||
3323 | msleep(50); | ||
3324 | } | ||
3325 | } | ||
3326 | } | ||
3327 | |||
3328 | /** | ||
3121 | * ata_wait_ready - sleep until BSY clears, or timeout | 3329 | * ata_wait_ready - sleep until BSY clears, or timeout |
3122 | * @ap: port containing status register to be polled | 3330 | * @ap: port containing status register to be polled |
3123 | * @deadline: deadline jiffies for the operation | 3331 | * @deadline: deadline jiffies for the operation |
@@ -3223,8 +3431,6 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, | |||
3223 | unsigned long deadline) | 3431 | unsigned long deadline) |
3224 | { | 3432 | { |
3225 | struct ata_ioports *ioaddr = &ap->ioaddr; | 3433 | struct ata_ioports *ioaddr = &ap->ioaddr; |
3226 | struct ata_device *dev; | ||
3227 | int i = 0; | ||
3228 | 3434 | ||
3229 | DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); | 3435 | DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); |
3230 | 3436 | ||
@@ -3235,36 +3441,8 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, | |||
3235 | udelay(20); /* FIXME: flush */ | 3441 | udelay(20); /* FIXME: flush */ |
3236 | iowrite8(ap->ctl, ioaddr->ctl_addr); | 3442 | iowrite8(ap->ctl, ioaddr->ctl_addr); |
3237 | 3443 | ||
3238 | /* If we issued an SRST then an ATA drive (not ATAPI) | 3444 | /* wait a while before checking status */ |
3239 | * may have changed configuration and be in PIO0 timing. If | 3445 | ata_wait_after_reset(ap, deadline); |
3240 | * we did a hard reset (or are coming from power on) this is | ||
3241 | * true for ATA or ATAPI. Until we've set a suitable controller | ||
3242 | * mode we should not touch the bus as we may be talking too fast. | ||
3243 | */ | ||
3244 | |||
3245 | ata_link_for_each_dev(dev, &ap->link) | ||
3246 | dev->pio_mode = XFER_PIO_0; | ||
3247 | |||
3248 | /* If the controller has a pio mode setup function then use | ||
3249 | it to set the chipset to rights. Don't touch the DMA setup | ||
3250 | as that will be dealt with when revalidating */ | ||
3251 | if (ap->ops->set_piomode) { | ||
3252 | ata_link_for_each_dev(dev, &ap->link) | ||
3253 | if (devmask & (1 << i++)) | ||
3254 | ap->ops->set_piomode(ap, dev); | ||
3255 | } | ||
3256 | |||
3257 | /* spec mandates ">= 2ms" before checking status. | ||
3258 | * We wait 150ms, because that was the magic delay used for | ||
3259 | * ATAPI devices in Hale Landis's ATADRVR, for the period of time | ||
3260 | * between when the ATA command register is written, and then | ||
3261 | * status is checked. Because waiting for "a while" before | ||
3262 | * checking status is fine, post SRST, we perform this magic | ||
3263 | * delay here as well. | ||
3264 | * | ||
3265 | * Old drivers/ide uses the 2mS rule and then waits for ready | ||
3266 | */ | ||
3267 | msleep(150); | ||
3268 | 3446 | ||
3269 | /* Before we perform post reset processing we want to see if | 3447 | /* Before we perform post reset processing we want to see if |
3270 | * the bus shows 0xFF because the odd clown forgets the D7 | 3448 | * the bus shows 0xFF because the odd clown forgets the D7 |
@@ -3691,8 +3869,8 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class, | |||
3691 | return 0; | 3869 | return 0; |
3692 | } | 3870 | } |
3693 | 3871 | ||
3694 | /* wait a while before checking status, see SRST for more info */ | 3872 | /* wait a while before checking status */ |
3695 | msleep(150); | 3873 | ata_wait_after_reset(ap, deadline); |
3696 | 3874 | ||
3697 | /* If PMP is supported, we have to do follow-up SRST. Note | 3875 | /* If PMP is supported, we have to do follow-up SRST. Note |
3698 | * that some PMPs don't send D2H Reg FIS after hardreset at | 3876 | * that some PMPs don't send D2H Reg FIS after hardreset at |
@@ -3992,6 +4170,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
3992 | { "ST3160812AS", "3.ADJ", ATA_HORKAGE_NONCQ, }, | 4170 | { "ST3160812AS", "3.ADJ", ATA_HORKAGE_NONCQ, }, |
3993 | { "ST980813AS", "3.ADB", ATA_HORKAGE_NONCQ, }, | 4171 | { "ST980813AS", "3.ADB", ATA_HORKAGE_NONCQ, }, |
3994 | { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, }, | 4172 | { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, }, |
4173 | { "Maxtor 7V300F0", "VA111900", ATA_HORKAGE_NONCQ, }, | ||
3995 | 4174 | ||
3996 | /* devices which puke on READ_NATIVE_MAX */ | 4175 | /* devices which puke on READ_NATIVE_MAX */ |
3997 | { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, | 4176 | { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, |
@@ -4003,6 +4182,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4003 | { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, | 4182 | { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, |
4004 | { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, }, | 4183 | { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, }, |
4005 | 4184 | ||
4185 | /* Devices which get the IVB wrong */ | ||
4186 | { "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB, }, | ||
4187 | { "TSSTcorp CDDVDW SH-S202J", "SB00", ATA_HORKAGE_IVB, }, | ||
4188 | |||
4006 | /* End Marker */ | 4189 | /* End Marker */ |
4007 | { } | 4190 | { } |
4008 | }; | 4191 | }; |
@@ -4064,6 +4247,21 @@ static int ata_dma_blacklisted(const struct ata_device *dev) | |||
4064 | } | 4247 | } |
4065 | 4248 | ||
4066 | /** | 4249 | /** |
4250 | * ata_is_40wire - check drive side detection | ||
4251 | * @dev: device | ||
4252 | * | ||
4253 | * Perform drive side detection decoding, allowing for device vendors | ||
4254 | * who can't follow the documentation. | ||
4255 | */ | ||
4256 | |||
4257 | static int ata_is_40wire(struct ata_device *dev) | ||
4258 | { | ||
4259 | if (dev->horkage & ATA_HORKAGE_IVB) | ||
4260 | return ata_drive_40wire_relaxed(dev->id); | ||
4261 | return ata_drive_40wire(dev->id); | ||
4262 | } | ||
4263 | |||
4264 | /** | ||
4067 | * ata_dev_xfermask - Compute supported xfermask of the given device | 4265 | * ata_dev_xfermask - Compute supported xfermask of the given device |
4068 | * @dev: Device to compute xfermask for | 4266 | * @dev: Device to compute xfermask for |
4069 | * | 4267 | * |
@@ -4132,7 +4330,7 @@ static void ata_dev_xfermask(struct ata_device *dev) | |||
4132 | if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA)) | 4330 | if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA)) |
4133 | /* UDMA/44 or higher would be available */ | 4331 | /* UDMA/44 or higher would be available */ |
4134 | if ((ap->cbl == ATA_CBL_PATA40) || | 4332 | if ((ap->cbl == ATA_CBL_PATA40) || |
4135 | (ata_drive_40wire(dev->id) && | 4333 | (ata_is_40wire(dev) && |
4136 | (ap->cbl == ATA_CBL_PATA_UNK || | 4334 | (ap->cbl == ATA_CBL_PATA_UNK || |
4137 | ap->cbl == ATA_CBL_PATA80))) { | 4335 | ap->cbl == ATA_CBL_PATA80))) { |
4138 | ata_dev_printk(dev, KERN_WARNING, | 4336 | ata_dev_printk(dev, KERN_WARNING, |
@@ -4689,6 +4887,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) | |||
4689 | * data in this function or read data in ata_sg_clean. | 4887 | * data in this function or read data in ata_sg_clean. |
4690 | */ | 4888 | */ |
4691 | offset = lsg->offset + lsg->length - qc->pad_len; | 4889 | offset = lsg->offset + lsg->length - qc->pad_len; |
4890 | sg_init_table(psg, 1); | ||
4692 | sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT), | 4891 | sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT), |
4693 | qc->pad_len, offset_in_page(offset)); | 4892 | qc->pad_len, offset_in_page(offset)); |
4694 | 4893 | ||
@@ -5226,11 +5425,19 @@ fsm_start: | |||
5226 | * let the EH abort the command or reset the device. | 5425 | * let the EH abort the command or reset the device. |
5227 | */ | 5426 | */ |
5228 | if (unlikely(status & (ATA_ERR | ATA_DF))) { | 5427 | if (unlikely(status & (ATA_ERR | ATA_DF))) { |
5229 | ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device " | 5428 | /* Some ATAPI tape drives forget to clear the ERR bit |
5230 | "error, dev_stat 0x%X\n", status); | 5429 | * when doing the next command (mostly request sense). |
5231 | qc->err_mask |= AC_ERR_HSM; | 5430 | * We ignore ERR here to workaround and proceed sending |
5232 | ap->hsm_task_state = HSM_ST_ERR; | 5431 | * the CDB. |
5233 | goto fsm_start; | 5432 | */ |
5433 | if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) { | ||
5434 | ata_port_printk(ap, KERN_WARNING, | ||
5435 | "DRQ=1 with device error, " | ||
5436 | "dev_stat 0x%X\n", status); | ||
5437 | qc->err_mask |= AC_ERR_HSM; | ||
5438 | ap->hsm_task_state = HSM_ST_ERR; | ||
5439 | goto fsm_start; | ||
5440 | } | ||
5234 | } | 5441 | } |
5235 | 5442 | ||
5236 | /* Send the CDB (atapi) or the first data block (ata pio out). | 5443 | /* Send the CDB (atapi) or the first data block (ata pio out). |
@@ -5594,6 +5801,9 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
5594 | * taken care of. | 5801 | * taken care of. |
5595 | */ | 5802 | */ |
5596 | if (ap->ops->error_handler) { | 5803 | if (ap->ops->error_handler) { |
5804 | struct ata_device *dev = qc->dev; | ||
5805 | struct ata_eh_info *ehi = &dev->link->eh_info; | ||
5806 | |||
5597 | WARN_ON(ap->pflags & ATA_PFLAG_FROZEN); | 5807 | WARN_ON(ap->pflags & ATA_PFLAG_FROZEN); |
5598 | 5808 | ||
5599 | if (unlikely(qc->err_mask)) | 5809 | if (unlikely(qc->err_mask)) |
@@ -5612,6 +5822,27 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
5612 | if (qc->flags & ATA_QCFLAG_RESULT_TF) | 5822 | if (qc->flags & ATA_QCFLAG_RESULT_TF) |
5613 | fill_result_tf(qc); | 5823 | fill_result_tf(qc); |
5614 | 5824 | ||
5825 | /* Some commands need post-processing after successful | ||
5826 | * completion. | ||
5827 | */ | ||
5828 | switch (qc->tf.command) { | ||
5829 | case ATA_CMD_SET_FEATURES: | ||
5830 | if (qc->tf.feature != SETFEATURES_WC_ON && | ||
5831 | qc->tf.feature != SETFEATURES_WC_OFF) | ||
5832 | break; | ||
5833 | /* fall through */ | ||
5834 | case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */ | ||
5835 | case ATA_CMD_SET_MULTI: /* multi_count changed */ | ||
5836 | /* revalidate device */ | ||
5837 | ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE; | ||
5838 | ata_port_schedule_eh(ap); | ||
5839 | break; | ||
5840 | |||
5841 | case ATA_CMD_SLEEP: | ||
5842 | dev->flags |= ATA_DFLAG_SLEEPING; | ||
5843 | break; | ||
5844 | } | ||
5845 | |||
5615 | __ata_qc_complete(qc); | 5846 | __ata_qc_complete(qc); |
5616 | } else { | 5847 | } else { |
5617 | if (qc->flags & ATA_QCFLAG_EH_SCHEDULED) | 5848 | if (qc->flags & ATA_QCFLAG_EH_SCHEDULED) |
@@ -5749,6 +5980,14 @@ void ata_qc_issue(struct ata_queued_cmd *qc) | |||
5749 | qc->flags &= ~ATA_QCFLAG_DMAMAP; | 5980 | qc->flags &= ~ATA_QCFLAG_DMAMAP; |
5750 | } | 5981 | } |
5751 | 5982 | ||
5983 | /* if device is sleeping, schedule softreset and abort the link */ | ||
5984 | if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) { | ||
5985 | link->eh_info.action |= ATA_EH_SOFTRESET; | ||
5986 | ata_ehi_push_desc(&link->eh_info, "waking up from sleep"); | ||
5987 | ata_link_abort(link); | ||
5988 | return; | ||
5989 | } | ||
5990 | |||
5752 | ap->ops->qc_prep(qc); | 5991 | ap->ops->qc_prep(qc); |
5753 | 5992 | ||
5754 | qc->err_mask |= ap->ops->qc_issue(qc); | 5993 | qc->err_mask |= ap->ops->qc_issue(qc); |
@@ -6296,6 +6535,12 @@ int ata_host_suspend(struct ata_host *host, pm_message_t mesg) | |||
6296 | { | 6535 | { |
6297 | int rc; | 6536 | int rc; |
6298 | 6537 | ||
6538 | /* | ||
6539 | * disable link pm on all ports before requesting | ||
6540 | * any pm activity | ||
6541 | */ | ||
6542 | ata_lpm_enable(host); | ||
6543 | |||
6299 | rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1); | 6544 | rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1); |
6300 | if (rc == 0) | 6545 | if (rc == 0) |
6301 | host->dev->power.power_state = mesg; | 6546 | host->dev->power.power_state = mesg; |
@@ -6318,6 +6563,9 @@ void ata_host_resume(struct ata_host *host) | |||
6318 | ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET, | 6563 | ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET, |
6319 | ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); | 6564 | ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); |
6320 | host->dev->power.power_state = PMSG_ON; | 6565 | host->dev->power.power_state = PMSG_ON; |
6566 | |||
6567 | /* reenable link pm */ | ||
6568 | ata_lpm_disable(host); | ||
6321 | } | 6569 | } |
6322 | #endif | 6570 | #endif |
6323 | 6571 | ||
@@ -6522,19 +6770,6 @@ static void ata_host_release(struct device *gendev, void *res) | |||
6522 | if (!ap) | 6770 | if (!ap) |
6523 | continue; | 6771 | continue; |
6524 | 6772 | ||
6525 | if ((host->flags & ATA_HOST_STARTED) && ap->ops->port_stop) | ||
6526 | ap->ops->port_stop(ap); | ||
6527 | } | ||
6528 | |||
6529 | if ((host->flags & ATA_HOST_STARTED) && host->ops->host_stop) | ||
6530 | host->ops->host_stop(host); | ||
6531 | |||
6532 | for (i = 0; i < host->n_ports; i++) { | ||
6533 | struct ata_port *ap = host->ports[i]; | ||
6534 | |||
6535 | if (!ap) | ||
6536 | continue; | ||
6537 | |||
6538 | if (ap->scsi_host) | 6773 | if (ap->scsi_host) |
6539 | scsi_host_put(ap->scsi_host); | 6774 | scsi_host_put(ap->scsi_host); |
6540 | 6775 | ||
@@ -6661,6 +6896,24 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev, | |||
6661 | return host; | 6896 | return host; |
6662 | } | 6897 | } |
6663 | 6898 | ||
6899 | static void ata_host_stop(struct device *gendev, void *res) | ||
6900 | { | ||
6901 | struct ata_host *host = dev_get_drvdata(gendev); | ||
6902 | int i; | ||
6903 | |||
6904 | WARN_ON(!(host->flags & ATA_HOST_STARTED)); | ||
6905 | |||
6906 | for (i = 0; i < host->n_ports; i++) { | ||
6907 | struct ata_port *ap = host->ports[i]; | ||
6908 | |||
6909 | if (ap->ops->port_stop) | ||
6910 | ap->ops->port_stop(ap); | ||
6911 | } | ||
6912 | |||
6913 | if (host->ops->host_stop) | ||
6914 | host->ops->host_stop(host); | ||
6915 | } | ||
6916 | |||
6664 | /** | 6917 | /** |
6665 | * ata_host_start - start and freeze ports of an ATA host | 6918 | * ata_host_start - start and freeze ports of an ATA host |
6666 | * @host: ATA host to start ports for | 6919 | * @host: ATA host to start ports for |
@@ -6679,6 +6932,8 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev, | |||
6679 | */ | 6932 | */ |
6680 | int ata_host_start(struct ata_host *host) | 6933 | int ata_host_start(struct ata_host *host) |
6681 | { | 6934 | { |
6935 | int have_stop = 0; | ||
6936 | void *start_dr = NULL; | ||
6682 | int i, rc; | 6937 | int i, rc; |
6683 | 6938 | ||
6684 | if (host->flags & ATA_HOST_STARTED) | 6939 | if (host->flags & ATA_HOST_STARTED) |
@@ -6690,6 +6945,22 @@ int ata_host_start(struct ata_host *host) | |||
6690 | if (!host->ops && !ata_port_is_dummy(ap)) | 6945 | if (!host->ops && !ata_port_is_dummy(ap)) |
6691 | host->ops = ap->ops; | 6946 | host->ops = ap->ops; |
6692 | 6947 | ||
6948 | if (ap->ops->port_stop) | ||
6949 | have_stop = 1; | ||
6950 | } | ||
6951 | |||
6952 | if (host->ops->host_stop) | ||
6953 | have_stop = 1; | ||
6954 | |||
6955 | if (have_stop) { | ||
6956 | start_dr = devres_alloc(ata_host_stop, 0, GFP_KERNEL); | ||
6957 | if (!start_dr) | ||
6958 | return -ENOMEM; | ||
6959 | } | ||
6960 | |||
6961 | for (i = 0; i < host->n_ports; i++) { | ||
6962 | struct ata_port *ap = host->ports[i]; | ||
6963 | |||
6693 | if (ap->ops->port_start) { | 6964 | if (ap->ops->port_start) { |
6694 | rc = ap->ops->port_start(ap); | 6965 | rc = ap->ops->port_start(ap); |
6695 | if (rc) { | 6966 | if (rc) { |
@@ -6702,6 +6973,8 @@ int ata_host_start(struct ata_host *host) | |||
6702 | ata_eh_freeze_port(ap); | 6973 | ata_eh_freeze_port(ap); |
6703 | } | 6974 | } |
6704 | 6975 | ||
6976 | if (start_dr) | ||
6977 | devres_add(host->dev, start_dr); | ||
6705 | host->flags |= ATA_HOST_STARTED; | 6978 | host->flags |= ATA_HOST_STARTED; |
6706 | return 0; | 6979 | return 0; |
6707 | 6980 | ||
@@ -6712,6 +6985,7 @@ int ata_host_start(struct ata_host *host) | |||
6712 | if (ap->ops->port_stop) | 6985 | if (ap->ops->port_stop) |
6713 | ap->ops->port_stop(ap); | 6986 | ap->ops->port_stop(ap); |
6714 | } | 6987 | } |
6988 | devres_free(start_dr); | ||
6715 | return rc; | 6989 | return rc; |
6716 | } | 6990 | } |
6717 | 6991 | ||
@@ -6860,6 +7134,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6860 | struct ata_port *ap = host->ports[i]; | 7134 | struct ata_port *ap = host->ports[i]; |
6861 | 7135 | ||
6862 | ata_scsi_scan_host(ap, 1); | 7136 | ata_scsi_scan_host(ap, 1); |
7137 | ata_lpm_schedule(ap, ap->pm_policy); | ||
6863 | } | 7138 | } |
6864 | 7139 | ||
6865 | return 0; | 7140 | return 0; |
@@ -6878,6 +7153,10 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6878 | * request IRQ and register it. This helper takes necessasry | 7153 | * request IRQ and register it. This helper takes necessasry |
6879 | * arguments and performs the three steps in one go. | 7154 | * arguments and performs the three steps in one go. |
6880 | * | 7155 | * |
7156 | * An invalid IRQ skips the IRQ registration and expects the host to | ||
7157 | * have set polling mode on the port. In this case, @irq_handler | ||
7158 | * should be NULL. | ||
7159 | * | ||
6881 | * LOCKING: | 7160 | * LOCKING: |
6882 | * Inherited from calling layer (may sleep). | 7161 | * Inherited from calling layer (may sleep). |
6883 | * | 7162 | * |
@@ -6894,6 +7173,12 @@ int ata_host_activate(struct ata_host *host, int irq, | |||
6894 | if (rc) | 7173 | if (rc) |
6895 | return rc; | 7174 | return rc; |
6896 | 7175 | ||
7176 | /* Special case for polling mode */ | ||
7177 | if (!irq) { | ||
7178 | WARN_ON(irq_handler); | ||
7179 | return ata_host_register(host, sht); | ||
7180 | } | ||
7181 | |||
6897 | rc = devm_request_irq(host->dev, irq, irq_handler, irq_flags, | 7182 | rc = devm_request_irq(host->dev, irq, irq_handler, irq_flags, |
6898 | dev_driver_string(host->dev), host); | 7183 | dev_driver_string(host->dev), host); |
6899 | if (rc) | 7184 | if (rc) |
@@ -7256,7 +7541,6 @@ const struct ata_port_info ata_dummy_port_info = { | |||
7256 | * likely to change as new drivers are added and updated. | 7541 | * likely to change as new drivers are added and updated. |
7257 | * Do not depend on ABI/API stability. | 7542 | * Do not depend on ABI/API stability. |
7258 | */ | 7543 | */ |
7259 | |||
7260 | EXPORT_SYMBOL_GPL(sata_deb_timing_normal); | 7544 | EXPORT_SYMBOL_GPL(sata_deb_timing_normal); |
7261 | EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug); | 7545 | EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug); |
7262 | EXPORT_SYMBOL_GPL(sata_deb_timing_long); | 7546 | EXPORT_SYMBOL_GPL(sata_deb_timing_long); |
@@ -7312,8 +7596,6 @@ EXPORT_SYMBOL_GPL(ata_dev_disable); | |||
7312 | EXPORT_SYMBOL_GPL(sata_set_spd); | 7596 | EXPORT_SYMBOL_GPL(sata_set_spd); |
7313 | EXPORT_SYMBOL_GPL(sata_link_debounce); | 7597 | EXPORT_SYMBOL_GPL(sata_link_debounce); |
7314 | EXPORT_SYMBOL_GPL(sata_link_resume); | 7598 | EXPORT_SYMBOL_GPL(sata_link_resume); |
7315 | EXPORT_SYMBOL_GPL(sata_phy_reset); | ||
7316 | EXPORT_SYMBOL_GPL(__sata_phy_reset); | ||
7317 | EXPORT_SYMBOL_GPL(ata_bus_reset); | 7599 | EXPORT_SYMBOL_GPL(ata_bus_reset); |
7318 | EXPORT_SYMBOL_GPL(ata_std_prereset); | 7600 | EXPORT_SYMBOL_GPL(ata_std_prereset); |
7319 | EXPORT_SYMBOL_GPL(ata_std_softreset); | 7601 | EXPORT_SYMBOL_GPL(ata_std_softreset); |
@@ -7326,6 +7608,7 @@ EXPORT_SYMBOL_GPL(ata_port_disable); | |||
7326 | EXPORT_SYMBOL_GPL(ata_ratelimit); | 7608 | EXPORT_SYMBOL_GPL(ata_ratelimit); |
7327 | EXPORT_SYMBOL_GPL(ata_wait_register); | 7609 | EXPORT_SYMBOL_GPL(ata_wait_register); |
7328 | EXPORT_SYMBOL_GPL(ata_busy_sleep); | 7610 | EXPORT_SYMBOL_GPL(ata_busy_sleep); |
7611 | EXPORT_SYMBOL_GPL(ata_wait_after_reset); | ||
7329 | EXPORT_SYMBOL_GPL(ata_wait_ready); | 7612 | EXPORT_SYMBOL_GPL(ata_wait_ready); |
7330 | EXPORT_SYMBOL_GPL(ata_port_queue_task); | 7613 | EXPORT_SYMBOL_GPL(ata_port_queue_task); |
7331 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); | 7614 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); |
@@ -7383,7 +7666,6 @@ EXPORT_SYMBOL_GPL(ata_port_desc); | |||
7383 | #ifdef CONFIG_PCI | 7666 | #ifdef CONFIG_PCI |
7384 | EXPORT_SYMBOL_GPL(ata_port_pbar_desc); | 7667 | EXPORT_SYMBOL_GPL(ata_port_pbar_desc); |
7385 | #endif /* CONFIG_PCI */ | 7668 | #endif /* CONFIG_PCI */ |
7386 | EXPORT_SYMBOL_GPL(ata_eng_timeout); | ||
7387 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); | 7669 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); |
7388 | EXPORT_SYMBOL_GPL(ata_link_abort); | 7670 | EXPORT_SYMBOL_GPL(ata_link_abort); |
7389 | EXPORT_SYMBOL_GPL(ata_port_abort); | 7671 | EXPORT_SYMBOL_GPL(ata_port_abort); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 8cb35bb87605..0dac69db1fdf 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; |
@@ -1747,6 +1652,7 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
1747 | { | 1652 | { |
1748 | struct ata_port *ap = link->ap; | 1653 | struct ata_port *ap = link->ap; |
1749 | struct ata_eh_context *ehc = &link->eh_context; | 1654 | struct ata_eh_context *ehc = &link->eh_context; |
1655 | struct ata_device *dev; | ||
1750 | unsigned int all_err_mask = 0; | 1656 | unsigned int all_err_mask = 0; |
1751 | int tag, is_io = 0; | 1657 | int tag, is_io = 0; |
1752 | u32 serror; | 1658 | u32 serror; |
@@ -1800,10 +1706,8 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
1800 | qc->err_mask &= ~AC_ERR_OTHER; | 1706 | qc->err_mask &= ~AC_ERR_OTHER; |
1801 | 1707 | ||
1802 | /* SENSE_VALID trumps dev/unknown error and revalidation */ | 1708 | /* SENSE_VALID trumps dev/unknown error and revalidation */ |
1803 | if (qc->flags & ATA_QCFLAG_SENSE_VALID) { | 1709 | if (qc->flags & ATA_QCFLAG_SENSE_VALID) |
1804 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); | 1710 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); |
1805 | ehc->i.action &= ~ATA_EH_REVALIDATE; | ||
1806 | } | ||
1807 | 1711 | ||
1808 | /* accumulate error info */ | 1712 | /* accumulate error info */ |
1809 | ehc->i.dev = qc->dev; | 1713 | ehc->i.dev = qc->dev; |
@@ -1816,21 +1720,28 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
1816 | if (ap->pflags & ATA_PFLAG_FROZEN || | 1720 | if (ap->pflags & ATA_PFLAG_FROZEN || |
1817 | all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) | 1721 | all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) |
1818 | ehc->i.action |= ATA_EH_SOFTRESET; | 1722 | ehc->i.action |= ATA_EH_SOFTRESET; |
1819 | else if (all_err_mask) | 1723 | else if ((is_io && all_err_mask) || |
1724 | (!is_io && (all_err_mask & ~AC_ERR_DEV))) | ||
1820 | ehc->i.action |= ATA_EH_REVALIDATE; | 1725 | ehc->i.action |= ATA_EH_REVALIDATE; |
1821 | 1726 | ||
1822 | /* if we have offending qcs and the associated failed device */ | 1727 | /* If we have offending qcs and the associated failed device, |
1728 | * perform per-dev EH action only on the offending device. | ||
1729 | */ | ||
1823 | if (ehc->i.dev) { | 1730 | if (ehc->i.dev) { |
1824 | /* speed down */ | ||
1825 | ehc->i.action |= ata_eh_speed_down(ehc->i.dev, is_io, | ||
1826 | all_err_mask); | ||
1827 | |||
1828 | /* perform per-dev EH action only on the offending device */ | ||
1829 | ehc->i.dev_action[ehc->i.dev->devno] |= | 1731 | ehc->i.dev_action[ehc->i.dev->devno] |= |
1830 | ehc->i.action & ATA_EH_PERDEV_MASK; | 1732 | ehc->i.action & ATA_EH_PERDEV_MASK; |
1831 | ehc->i.action &= ~ATA_EH_PERDEV_MASK; | 1733 | ehc->i.action &= ~ATA_EH_PERDEV_MASK; |
1832 | } | 1734 | } |
1833 | 1735 | ||
1736 | /* consider speeding down */ | ||
1737 | dev = ehc->i.dev; | ||
1738 | if (!dev && ata_link_max_devices(link) == 1 && | ||
1739 | ata_dev_enabled(link->device)) | ||
1740 | dev = link->device; | ||
1741 | |||
1742 | if (dev) | ||
1743 | ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask); | ||
1744 | |||
1834 | DPRINTK("EXIT\n"); | 1745 | DPRINTK("EXIT\n"); |
1835 | } | 1746 | } |
1836 | 1747 | ||
@@ -1879,7 +1790,9 @@ static void ata_eh_link_report(struct ata_link *link) | |||
1879 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { | 1790 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { |
1880 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); | 1791 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); |
1881 | 1792 | ||
1882 | if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link) | 1793 | if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link || |
1794 | ((qc->flags & ATA_QCFLAG_QUIET) && | ||
1795 | qc->err_mask == AC_ERR_DEV)) | ||
1883 | continue; | 1796 | continue; |
1884 | if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) | 1797 | if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) |
1885 | continue; | 1798 | continue; |
@@ -2064,16 +1977,19 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2064 | ata_prereset_fn_t prereset, ata_reset_fn_t softreset, | 1977 | ata_prereset_fn_t prereset, ata_reset_fn_t softreset, |
2065 | ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) | 1978 | ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) |
2066 | { | 1979 | { |
1980 | const int max_tries = ARRAY_SIZE(ata_eh_reset_timeouts); | ||
2067 | struct ata_port *ap = link->ap; | 1981 | struct ata_port *ap = link->ap; |
2068 | struct ata_eh_context *ehc = &link->eh_context; | 1982 | struct ata_eh_context *ehc = &link->eh_context; |
2069 | unsigned int *classes = ehc->classes; | 1983 | unsigned int *classes = ehc->classes; |
1984 | unsigned int lflags = link->flags; | ||
2070 | int verbose = !(ehc->i.flags & ATA_EHI_QUIET); | 1985 | int verbose = !(ehc->i.flags & ATA_EHI_QUIET); |
2071 | int try = 0; | 1986 | int try = 0; |
2072 | struct ata_device *dev; | 1987 | struct ata_device *dev; |
2073 | unsigned long deadline; | 1988 | unsigned long deadline, now; |
2074 | unsigned int tmp_action; | 1989 | unsigned int tmp_action; |
2075 | ata_reset_fn_t reset; | 1990 | ata_reset_fn_t reset; |
2076 | unsigned long flags; | 1991 | unsigned long flags; |
1992 | u32 sstatus; | ||
2077 | int rc; | 1993 | int rc; |
2078 | 1994 | ||
2079 | /* about to reset */ | 1995 | /* about to reset */ |
@@ -2083,10 +1999,29 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2083 | 1999 | ||
2084 | ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); | 2000 | ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); |
2085 | 2001 | ||
2002 | ata_link_for_each_dev(dev, link) { | ||
2003 | /* If we issue an SRST then an ATA drive (not ATAPI) | ||
2004 | * may change configuration and be in PIO0 timing. If | ||
2005 | * we do a hard reset (or are coming from power on) | ||
2006 | * this is true for ATA or ATAPI. Until we've set a | ||
2007 | * suitable controller mode we should not touch the | ||
2008 | * bus as we may be talking too fast. | ||
2009 | */ | ||
2010 | dev->pio_mode = XFER_PIO_0; | ||
2011 | |||
2012 | /* If the controller has a pio mode setup function | ||
2013 | * then use it to set the chipset to rights. Don't | ||
2014 | * touch the DMA setup as that will be dealt with when | ||
2015 | * configuring devices. | ||
2016 | */ | ||
2017 | if (ap->ops->set_piomode) | ||
2018 | ap->ops->set_piomode(ap, dev); | ||
2019 | } | ||
2020 | |||
2086 | /* Determine which reset to use and record in ehc->i.action. | 2021 | /* Determine which reset to use and record in ehc->i.action. |
2087 | * prereset() may examine and modify it. | 2022 | * prereset() may examine and modify it. |
2088 | */ | 2023 | */ |
2089 | if (softreset && (!hardreset || (!(link->flags & ATA_LFLAG_NO_SRST) && | 2024 | if (softreset && (!hardreset || (!(lflags & ATA_LFLAG_NO_SRST) && |
2090 | !sata_set_spd_needed(link) && | 2025 | !sata_set_spd_needed(link) && |
2091 | !(ehc->i.action & ATA_EH_HARDRESET)))) | 2026 | !(ehc->i.action & ATA_EH_HARDRESET)))) |
2092 | tmp_action = ATA_EH_SOFTRESET; | 2027 | tmp_action = ATA_EH_SOFTRESET; |
@@ -2161,80 +2096,64 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2161 | "follow-up softreset required " | 2096 | "follow-up softreset required " |
2162 | "but no softreset avaliable\n"); | 2097 | "but no softreset avaliable\n"); |
2163 | rc = -EINVAL; | 2098 | rc = -EINVAL; |
2164 | goto out; | 2099 | goto fail; |
2165 | } | 2100 | } |
2166 | 2101 | ||
2167 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK); | 2102 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK); |
2168 | rc = ata_do_reset(link, reset, classes, deadline); | 2103 | rc = ata_do_reset(link, reset, classes, deadline); |
2169 | |||
2170 | if (rc == 0 && classify && classes[0] == ATA_DEV_UNKNOWN && | ||
2171 | !(link->flags & ATA_LFLAG_ASSUME_CLASS)) { | ||
2172 | ata_link_printk(link, KERN_ERR, | ||
2173 | "classification failed\n"); | ||
2174 | rc = -EINVAL; | ||
2175 | goto out; | ||
2176 | } | ||
2177 | } | 2104 | } |
2178 | 2105 | ||
2179 | /* if we skipped follow-up srst, clear rc */ | 2106 | /* -EAGAIN can happen if we skipped followup SRST */ |
2180 | if (rc == -EAGAIN) | 2107 | if (rc && rc != -EAGAIN) |
2181 | rc = 0; | 2108 | goto fail; |
2182 | |||
2183 | if (rc && rc != -ERESTART && try < ARRAY_SIZE(ata_eh_reset_timeouts)) { | ||
2184 | unsigned long now = jiffies; | ||
2185 | |||
2186 | if (time_before(now, deadline)) { | ||
2187 | unsigned long delta = deadline - jiffies; | ||
2188 | 2109 | ||
2189 | ata_link_printk(link, KERN_WARNING, "reset failed " | 2110 | /* was classification successful? */ |
2190 | "(errno=%d), retrying in %u secs\n", | 2111 | if (classify && classes[0] == ATA_DEV_UNKNOWN && |
2191 | rc, (jiffies_to_msecs(delta) + 999) / 1000); | 2112 | !(lflags & ATA_LFLAG_ASSUME_CLASS)) { |
2192 | 2113 | if (try < max_tries) { | |
2193 | while (delta) | 2114 | ata_link_printk(link, KERN_WARNING, |
2194 | delta = schedule_timeout_uninterruptible(delta); | 2115 | "classification failed\n"); |
2116 | rc = -EINVAL; | ||
2117 | goto fail; | ||
2195 | } | 2118 | } |
2196 | 2119 | ||
2197 | if (rc == -EPIPE || | 2120 | ata_link_printk(link, KERN_WARNING, |
2198 | try == ARRAY_SIZE(ata_eh_reset_timeouts) - 1) | 2121 | "classfication failed, assuming ATA\n"); |
2199 | sata_down_spd_limit(link); | 2122 | lflags |= ATA_LFLAG_ASSUME_ATA; |
2200 | if (hardreset) | ||
2201 | reset = hardreset; | ||
2202 | goto retry; | ||
2203 | } | 2123 | } |
2204 | 2124 | ||
2205 | if (rc == 0) { | 2125 | ata_link_for_each_dev(dev, link) { |
2206 | u32 sstatus; | 2126 | /* After the reset, the device state is PIO 0 and the |
2127 | * controller state is undefined. Reset also wakes up | ||
2128 | * drives from sleeping mode. | ||
2129 | */ | ||
2130 | dev->pio_mode = XFER_PIO_0; | ||
2131 | dev->flags &= ~ATA_DFLAG_SLEEPING; | ||
2207 | 2132 | ||
2208 | ata_link_for_each_dev(dev, link) { | 2133 | if (ata_link_offline(link)) |
2209 | /* After the reset, the device state is PIO 0 | 2134 | continue; |
2210 | * and the controller state is undefined. | ||
2211 | * Record the mode. | ||
2212 | */ | ||
2213 | dev->pio_mode = XFER_PIO_0; | ||
2214 | 2135 | ||
2215 | if (ata_link_offline(link)) | 2136 | /* apply class override and convert UNKNOWN to NONE */ |
2216 | continue; | 2137 | if (lflags & ATA_LFLAG_ASSUME_ATA) |
2138 | classes[dev->devno] = ATA_DEV_ATA; | ||
2139 | else if (lflags & ATA_LFLAG_ASSUME_SEMB) | ||
2140 | classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */ | ||
2141 | else if (classes[dev->devno] == ATA_DEV_UNKNOWN) | ||
2142 | classes[dev->devno] = ATA_DEV_NONE; | ||
2143 | } | ||
2217 | 2144 | ||
2218 | /* apply class override and convert UNKNOWN to NONE */ | 2145 | /* record current link speed */ |
2219 | if (link->flags & ATA_LFLAG_ASSUME_ATA) | 2146 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) |
2220 | classes[dev->devno] = ATA_DEV_ATA; | 2147 | link->sata_spd = (sstatus >> 4) & 0xf; |
2221 | else if (link->flags & ATA_LFLAG_ASSUME_SEMB) | ||
2222 | classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */ | ||
2223 | else if (classes[dev->devno] == ATA_DEV_UNKNOWN) | ||
2224 | classes[dev->devno] = ATA_DEV_NONE; | ||
2225 | } | ||
2226 | 2148 | ||
2227 | /* record current link speed */ | 2149 | if (postreset) |
2228 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) | 2150 | postreset(link, classes); |
2229 | link->sata_spd = (sstatus >> 4) & 0xf; | ||
2230 | 2151 | ||
2231 | if (postreset) | 2152 | /* reset successful, schedule revalidation */ |
2232 | postreset(link, classes); | 2153 | ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); |
2154 | ehc->i.action |= ATA_EH_REVALIDATE; | ||
2233 | 2155 | ||
2234 | /* reset successful, schedule revalidation */ | 2156 | rc = 0; |
2235 | ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); | ||
2236 | ehc->i.action |= ATA_EH_REVALIDATE; | ||
2237 | } | ||
2238 | out: | 2157 | out: |
2239 | /* clear hotplug flag */ | 2158 | /* clear hotplug flag */ |
2240 | ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; | 2159 | ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; |
@@ -2244,6 +2163,28 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2244 | spin_unlock_irqrestore(ap->lock, flags); | 2163 | spin_unlock_irqrestore(ap->lock, flags); |
2245 | 2164 | ||
2246 | return rc; | 2165 | return rc; |
2166 | |||
2167 | fail: | ||
2168 | if (rc == -ERESTART || try >= max_tries) | ||
2169 | goto out; | ||
2170 | |||
2171 | now = jiffies; | ||
2172 | if (time_before(now, deadline)) { | ||
2173 | unsigned long delta = deadline - now; | ||
2174 | |||
2175 | ata_link_printk(link, KERN_WARNING, "reset failed " | ||
2176 | "(errno=%d), retrying in %u secs\n", | ||
2177 | rc, (jiffies_to_msecs(delta) + 999) / 1000); | ||
2178 | |||
2179 | while (delta) | ||
2180 | delta = schedule_timeout_uninterruptible(delta); | ||
2181 | } | ||
2182 | |||
2183 | if (rc == -EPIPE || try == max_tries - 1) | ||
2184 | sata_down_spd_limit(link); | ||
2185 | if (hardreset) | ||
2186 | reset = hardreset; | ||
2187 | goto retry; | ||
2247 | } | 2188 | } |
2248 | 2189 | ||
2249 | static int ata_eh_revalidate_and_attach(struct ata_link *link, | 2190 | static int ata_eh_revalidate_and_attach(struct ata_link *link, |
@@ -2416,7 +2357,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
2416 | /* give it just one more chance */ | 2357 | /* give it just one more chance */ |
2417 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); | 2358 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); |
2418 | case -EIO: | 2359 | case -EIO: |
2419 | if (ehc->tries[dev->devno] == 1) { | 2360 | if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) { |
2420 | /* This is the last chance, better to slow | 2361 | /* This is the last chance, better to slow |
2421 | * down than lose it. | 2362 | * down than lose it. |
2422 | */ | 2363 | */ |
@@ -2607,6 +2548,10 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2607 | ehc->i.flags &= ~ATA_EHI_SETMODE; | 2548 | ehc->i.flags &= ~ATA_EHI_SETMODE; |
2608 | } | 2549 | } |
2609 | 2550 | ||
2551 | if (ehc->i.action & ATA_EHI_LPM) | ||
2552 | ata_link_for_each_dev(dev, link) | ||
2553 | ata_dev_enable_pm(dev, ap->pm_policy); | ||
2554 | |||
2610 | /* this link is okay now */ | 2555 | /* this link is okay now */ |
2611 | ehc->i.flags = 0; | 2556 | ehc->i.flags = 0; |
2612 | continue; | 2557 | continue; |
@@ -2672,8 +2617,15 @@ void ata_eh_finish(struct ata_port *ap) | |||
2672 | /* FIXME: Once EH migration is complete, | 2617 | /* FIXME: Once EH migration is complete, |
2673 | * generate sense data in this function, | 2618 | * generate sense data in this function, |
2674 | * considering both err_mask and tf. | 2619 | * considering both err_mask and tf. |
2620 | * | ||
2621 | * There's no point in retrying invalid | ||
2622 | * (detected by libata) and non-IO device | ||
2623 | * errors (rejected by device). Finish them | ||
2624 | * immediately. | ||
2675 | */ | 2625 | */ |
2676 | if (qc->err_mask & AC_ERR_INVALID) | 2626 | if ((qc->err_mask & AC_ERR_INVALID) || |
2627 | (!(qc->flags & ATA_QCFLAG_IO) && | ||
2628 | qc->err_mask == AC_ERR_DEV)) | ||
2677 | ata_eh_qc_complete(qc); | 2629 | ata_eh_qc_complete(qc); |
2678 | else | 2630 | else |
2679 | ata_eh_qc_retry(qc); | 2631 | ata_eh_qc_retry(qc); |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index f5d5420a1ba2..a883bb03d4c7 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -110,6 +110,74 @@ static struct scsi_transport_template ata_scsi_transport_template = { | |||
110 | }; | 110 | }; |
111 | 111 | ||
112 | 112 | ||
113 | static const struct { | ||
114 | enum link_pm value; | ||
115 | const char *name; | ||
116 | } link_pm_policy[] = { | ||
117 | { NOT_AVAILABLE, "max_performance" }, | ||
118 | { MIN_POWER, "min_power" }, | ||
119 | { MAX_PERFORMANCE, "max_performance" }, | ||
120 | { MEDIUM_POWER, "medium_power" }, | ||
121 | }; | ||
122 | |||
123 | static const char *ata_scsi_lpm_get(enum link_pm policy) | ||
124 | { | ||
125 | int i; | ||
126 | |||
127 | for (i = 0; i < ARRAY_SIZE(link_pm_policy); i++) | ||
128 | if (link_pm_policy[i].value == policy) | ||
129 | return link_pm_policy[i].name; | ||
130 | |||
131 | return NULL; | ||
132 | } | ||
133 | |||
134 | static ssize_t ata_scsi_lpm_put(struct class_device *class_dev, | ||
135 | const char *buf, size_t count) | ||
136 | { | ||
137 | struct Scsi_Host *shost = class_to_shost(class_dev); | ||
138 | struct ata_port *ap = ata_shost_to_port(shost); | ||
139 | enum link_pm policy = 0; | ||
140 | int i; | ||
141 | |||
142 | /* | ||
143 | * we are skipping array location 0 on purpose - this | ||
144 | * is because a value of NOT_AVAILABLE is displayed | ||
145 | * to the user as max_performance, but when the user | ||
146 | * writes "max_performance", they actually want the | ||
147 | * value to match MAX_PERFORMANCE. | ||
148 | */ | ||
149 | for (i = 1; i < ARRAY_SIZE(link_pm_policy); i++) { | ||
150 | const int len = strlen(link_pm_policy[i].name); | ||
151 | if (strncmp(link_pm_policy[i].name, buf, len) == 0 && | ||
152 | buf[len] == '\n') { | ||
153 | policy = link_pm_policy[i].value; | ||
154 | break; | ||
155 | } | ||
156 | } | ||
157 | if (!policy) | ||
158 | return -EINVAL; | ||
159 | |||
160 | ata_lpm_schedule(ap, policy); | ||
161 | return count; | ||
162 | } | ||
163 | |||
164 | static ssize_t | ||
165 | ata_scsi_lpm_show(struct class_device *class_dev, char *buf) | ||
166 | { | ||
167 | struct Scsi_Host *shost = class_to_shost(class_dev); | ||
168 | struct ata_port *ap = ata_shost_to_port(shost); | ||
169 | const char *policy = | ||
170 | ata_scsi_lpm_get(ap->pm_policy); | ||
171 | |||
172 | if (!policy) | ||
173 | return -EINVAL; | ||
174 | |||
175 | return snprintf(buf, 23, "%s\n", policy); | ||
176 | } | ||
177 | CLASS_DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR, | ||
178 | ata_scsi_lpm_show, ata_scsi_lpm_put); | ||
179 | EXPORT_SYMBOL_GPL(class_device_attr_link_power_management_policy); | ||
180 | |||
113 | static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, | 181 | static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, |
114 | void (*done)(struct scsi_cmnd *)) | 182 | void (*done)(struct scsi_cmnd *)) |
115 | { | 183 | { |
@@ -773,6 +841,9 @@ static void ata_scsi_dev_config(struct scsi_device *sdev, | |||
773 | blk_queue_max_hw_segments(q, q->max_hw_segments - 1); | 841 | blk_queue_max_hw_segments(q, q->max_hw_segments - 1); |
774 | } | 842 | } |
775 | 843 | ||
844 | if (dev->flags & ATA_DFLAG_AN) | ||
845 | set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); | ||
846 | |||
776 | if (dev->flags & ATA_DFLAG_NCQ) { | 847 | if (dev->flags & ATA_DFLAG_NCQ) { |
777 | int depth; | 848 | int depth; |
778 | 849 | ||
@@ -1040,6 +1111,9 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc) | |||
1040 | else | 1111 | else |
1041 | tf->command = ATA_CMD_FLUSH; | 1112 | tf->command = ATA_CMD_FLUSH; |
1042 | 1113 | ||
1114 | /* flush is critical for IO integrity, consider it an IO command */ | ||
1115 | qc->flags |= ATA_QCFLAG_IO; | ||
1116 | |||
1043 | return 0; | 1117 | return 0; |
1044 | } | 1118 | } |
1045 | 1119 | ||
@@ -1361,33 +1435,10 @@ nothing_to_do: | |||
1361 | static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) | 1435 | static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) |
1362 | { | 1436 | { |
1363 | struct ata_port *ap = qc->ap; | 1437 | struct ata_port *ap = qc->ap; |
1364 | struct ata_eh_info *ehi = &qc->dev->link->eh_info; | ||
1365 | struct scsi_cmnd *cmd = qc->scsicmd; | 1438 | struct scsi_cmnd *cmd = qc->scsicmd; |
1366 | u8 *cdb = cmd->cmnd; | 1439 | u8 *cdb = cmd->cmnd; |
1367 | int need_sense = (qc->err_mask != 0); | 1440 | int need_sense = (qc->err_mask != 0); |
1368 | 1441 | ||
1369 | /* We snoop the SET_FEATURES - Write Cache ON/OFF command, and | ||
1370 | * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE | ||
1371 | * cache | ||
1372 | */ | ||
1373 | if (ap->ops->error_handler && !need_sense) { | ||
1374 | switch (qc->tf.command) { | ||
1375 | case ATA_CMD_SET_FEATURES: | ||
1376 | if ((qc->tf.feature == SETFEATURES_WC_ON) || | ||
1377 | (qc->tf.feature == SETFEATURES_WC_OFF)) { | ||
1378 | ehi->action |= ATA_EH_REVALIDATE; | ||
1379 | ata_port_schedule_eh(ap); | ||
1380 | } | ||
1381 | break; | ||
1382 | |||
1383 | case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */ | ||
1384 | case ATA_CMD_SET_MULTI: /* multi_count changed */ | ||
1385 | ehi->action |= ATA_EH_REVALIDATE; | ||
1386 | ata_port_schedule_eh(ap); | ||
1387 | break; | ||
1388 | } | ||
1389 | } | ||
1390 | |||
1391 | /* For ATA pass thru (SAT) commands, generate a sense block if | 1442 | /* For ATA pass thru (SAT) commands, generate a sense block if |
1392 | * user mandated it or if there's an error. Note that if we | 1443 | * user mandated it or if there's an error. Note that if we |
1393 | * generate because the user forced us to, a check condition | 1444 | * generate because the user forced us to, a check condition |
@@ -2434,11 +2485,40 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
2434 | if (!using_pio && ata_check_atapi_dma(qc)) | 2485 | if (!using_pio && ata_check_atapi_dma(qc)) |
2435 | using_pio = 1; | 2486 | using_pio = 1; |
2436 | 2487 | ||
2437 | /* Some controller variants snoop this value for Packet transfers | 2488 | /* Some controller variants snoop this value for Packet |
2438 | to do state machine and FIFO management. Thus we want to set it | 2489 | * transfers to do state machine and FIFO management. Thus we |
2439 | 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 | */ | ||
2440 | nbytes = min(qc->nbytes, (unsigned int)63 * 1024); | 2493 | nbytes = min(qc->nbytes, (unsigned int)63 * 1024); |
2441 | 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 | |||
2442 | qc->tf.lbam = (nbytes & 0xFF); | 2522 | qc->tf.lbam = (nbytes & 0xFF); |
2443 | qc->tf.lbah = (nbytes >> 8); | 2523 | qc->tf.lbah = (nbytes >> 8); |
2444 | 2524 | ||
@@ -2719,8 +2799,8 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) | |||
2719 | */ | 2799 | */ |
2720 | qc->nbytes = scsi_bufflen(scmd); | 2800 | qc->nbytes = scsi_bufflen(scmd); |
2721 | 2801 | ||
2722 | /* request result TF */ | 2802 | /* request result TF and be quiet about device error */ |
2723 | qc->flags |= ATA_QCFLAG_RESULT_TF; | 2803 | qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET; |
2724 | 2804 | ||
2725 | return 0; | 2805 | return 0; |
2726 | 2806 | ||
@@ -2818,7 +2898,8 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, | |||
2818 | xlat_func = NULL; | 2898 | xlat_func = NULL; |
2819 | if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { | 2899 | if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { |
2820 | /* relay SCSI command to ATAPI device */ | 2900 | /* relay SCSI command to ATAPI device */ |
2821 | 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)) | ||
2822 | goto bad_cdb_len; | 2903 | goto bad_cdb_len; |
2823 | 2904 | ||
2824 | xlat_func = atapi_xlat; | 2905 | xlat_func = atapi_xlat; |
@@ -3248,10 +3329,9 @@ static void ata_scsi_handle_link_detach(struct ata_link *link) | |||
3248 | */ | 3329 | */ |
3249 | void ata_scsi_media_change_notify(struct ata_device *dev) | 3330 | void ata_scsi_media_change_notify(struct ata_device *dev) |
3250 | { | 3331 | { |
3251 | #ifdef OTHER_AN_PATCHES_HAVE_BEEN_APPLIED | ||
3252 | if (dev->sdev) | 3332 | if (dev->sdev) |
3253 | scsi_device_event_notify(dev->sdev, SDEV_MEDIA_CHANGE); | 3333 | sdev_evt_send_simple(dev->sdev, SDEV_EVT_MEDIA_CHANGE, |
3254 | #endif | 3334 | GFP_ATOMIC); |
3255 | } | 3335 | } |
3256 | 3336 | ||
3257 | /** | 3337 | /** |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 90df58a3edc9..0e6cf3a484dc 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -101,6 +101,8 @@ extern int sata_link_init_spd(struct ata_link *link); | |||
101 | extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); | 101 | extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); |
102 | extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); | 102 | extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); |
103 | extern struct ata_port *ata_port_alloc(struct ata_host *host); | 103 | extern struct ata_port *ata_port_alloc(struct ata_host *host); |
104 | extern void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy); | ||
105 | extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm); | ||
104 | 106 | ||
105 | /* libata-acpi.c */ | 107 | /* libata-acpi.c */ |
106 | #ifdef CONFIG_ATA_ACPI | 108 | #ifdef CONFIG_ATA_ACPI |
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index 0f6f7bcc3def..e4542ab9c7f8 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c | |||
@@ -181,7 +181,7 @@ static void pacpi_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
181 | int unit = adev->devno; | 181 | int unit = adev->devno; |
182 | struct pata_acpi *acpi = ap->private_data; | 182 | struct pata_acpi *acpi = ap->private_data; |
183 | 183 | ||
184 | if(!(acpi->gtm.flags & 0x10)) | 184 | if (!(acpi->gtm.flags & 0x10)) |
185 | unit = 0; | 185 | unit = 0; |
186 | 186 | ||
187 | /* Now stuff the nS values into the structure */ | 187 | /* Now stuff the nS values into the structure */ |
@@ -202,7 +202,7 @@ static void pacpi_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
202 | int unit = adev->devno; | 202 | int unit = adev->devno; |
203 | struct pata_acpi *acpi = ap->private_data; | 203 | struct pata_acpi *acpi = ap->private_data; |
204 | 204 | ||
205 | if(!(acpi->gtm.flags & 0x10)) | 205 | if (!(acpi->gtm.flags & 0x10)) |
206 | unit = 0; | 206 | unit = 0; |
207 | 207 | ||
208 | /* Now stuff the nS values into the structure */ | 208 | /* Now stuff the nS values into the structure */ |
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_bf54x.c b/drivers/ata/pata_bf54x.c index b5e38426b815..81db405a5445 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; |
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index e61cb1fd57b2..46dc70e0dee7 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -295,7 +295,7 @@ static unsigned long hpt370_filter(struct ata_device *adev, unsigned long mask) | |||
295 | 295 | ||
296 | static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask) | 296 | static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask) |
297 | { | 297 | { |
298 | if (adev->class != ATA_DEV_ATA) { | 298 | if (adev->class == ATA_DEV_ATA) { |
299 | if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5)) | 299 | if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5)) |
300 | mask &= ~ (0x1F << ATA_SHIFT_UDMA); | 300 | mask &= ~ (0x1F << ATA_SHIFT_UDMA); |
301 | } | 301 | } |
@@ -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; |
@@ -359,28 +359,25 @@ static int hpt374_pre_reset(struct ata_link *link, unsigned long deadline) | |||
359 | { 0x50, 1, 0x04, 0x04 }, | 359 | { 0x50, 1, 0x04, 0x04 }, |
360 | { 0x54, 1, 0x04, 0x04 } | 360 | { 0x54, 1, 0x04, 0x04 } |
361 | }; | 361 | }; |
362 | u16 mcr3, mcr6; | 362 | u16 mcr3; |
363 | u8 ata66; | 363 | u8 ata66; |
364 | struct ata_port *ap = link->ap; | 364 | struct ata_port *ap = link->ap; |
365 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 365 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
366 | unsigned int mcrbase = 0x50 + 4 * ap->port_no; | ||
366 | 367 | ||
367 | if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no])) | 368 | if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no])) |
368 | return -ENOENT; | 369 | return -ENOENT; |
369 | 370 | ||
370 | /* Do the extra channel work */ | 371 | /* Do the extra channel work */ |
371 | pci_read_config_word(pdev, 0x52, &mcr3); | 372 | pci_read_config_word(pdev, mcrbase + 2, &mcr3); |
372 | pci_read_config_word(pdev, 0x56, &mcr6); | ||
373 | /* Set bit 15 of 0x52 to enable TCBLID as input | 373 | /* Set bit 15 of 0x52 to enable TCBLID as input |
374 | Set bit 15 of 0x56 to enable FCBLID as input | ||
375 | */ | 374 | */ |
376 | pci_write_config_word(pdev, 0x52, mcr3 | 0x8000); | 375 | pci_write_config_word(pdev, mcrbase + 2, mcr3 | 0x8000); |
377 | pci_write_config_word(pdev, 0x56, mcr6 | 0x8000); | ||
378 | pci_read_config_byte(pdev, 0x5A, &ata66); | 376 | pci_read_config_byte(pdev, 0x5A, &ata66); |
379 | /* Reset TCBLID/FCBLID to output */ | 377 | /* Reset TCBLID/FCBLID to output */ |
380 | pci_write_config_word(pdev, 0x52, mcr3); | 378 | pci_write_config_word(pdev, 0x52, mcr3); |
381 | pci_write_config_word(pdev, 0x56, mcr6); | ||
382 | 379 | ||
383 | if (ata66 & (1 << ap->port_no)) | 380 | if (ata66 & (2 >> ap->port_no)) |
384 | ap->cbl = ATA_CBL_PATA40; | 381 | ap->cbl = ATA_CBL_PATA40; |
385 | else | 382 | else |
386 | ap->cbl = ATA_CBL_PATA80; | 383 | ap->cbl = ATA_CBL_PATA80; |
@@ -844,6 +841,25 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev) | |||
844 | /* Never went stable */ | 841 | /* Never went stable */ |
845 | return 0; | 842 | return 0; |
846 | } | 843 | } |
844 | |||
845 | static u32 hpt374_read_freq(struct pci_dev *pdev) | ||
846 | { | ||
847 | u32 freq; | ||
848 | unsigned long io_base = pci_resource_start(pdev, 4); | ||
849 | if (PCI_FUNC(pdev->devfn) & 1) { | ||
850 | struct pci_dev *pdev_0 = pci_get_slot(pdev->bus, pdev->devfn - 1); | ||
851 | /* Someone hot plugged the controller on us ? */ | ||
852 | if (pdev_0 == NULL) | ||
853 | return 0; | ||
854 | io_base = pci_resource_start(pdev_0, 4); | ||
855 | freq = inl(io_base + 0x90); | ||
856 | pci_dev_put(pdev_0); | ||
857 | } | ||
858 | else | ||
859 | freq = inl(io_base + 0x90); | ||
860 | return freq; | ||
861 | } | ||
862 | |||
847 | /** | 863 | /** |
848 | * hpt37x_init_one - Initialise an HPT37X/302 | 864 | * hpt37x_init_one - Initialise an HPT37X/302 |
849 | * @dev: PCI device | 865 | * @dev: PCI device |
@@ -902,7 +918,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
902 | .flags = ATA_FLAG_SLAVE_POSS, | 918 | .flags = ATA_FLAG_SLAVE_POSS, |
903 | .pio_mask = 0x1f, | 919 | .pio_mask = 0x1f, |
904 | .mwdma_mask = 0x07, | 920 | .mwdma_mask = 0x07, |
905 | .udma_mask = 0x0f, | 921 | .udma_mask = ATA_UDMA5, |
906 | .port_ops = &hpt370_port_ops | 922 | .port_ops = &hpt370_port_ops |
907 | }; | 923 | }; |
908 | /* HPT370A - UDMA100 */ | 924 | /* HPT370A - UDMA100 */ |
@@ -911,7 +927,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
911 | .flags = ATA_FLAG_SLAVE_POSS, | 927 | .flags = ATA_FLAG_SLAVE_POSS, |
912 | .pio_mask = 0x1f, | 928 | .pio_mask = 0x1f, |
913 | .mwdma_mask = 0x07, | 929 | .mwdma_mask = 0x07, |
914 | .udma_mask = 0x0f, | 930 | .udma_mask = ATA_UDMA5, |
915 | .port_ops = &hpt370a_port_ops | 931 | .port_ops = &hpt370a_port_ops |
916 | }; | 932 | }; |
917 | /* HPT371, 372 and friends - UDMA133 */ | 933 | /* HPT371, 372 and friends - UDMA133 */ |
@@ -1047,9 +1063,16 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1047 | outb(0x0e, iobase + 0x9c); | 1063 | outb(0x0e, iobase + 0x9c); |
1048 | 1064 | ||
1049 | /* Some devices do not let this value be accessed via PCI space | 1065 | /* Some devices do not let this value be accessed via PCI space |
1050 | according to the old driver */ | 1066 | according to the old driver. In addition we must use the value |
1067 | from FN 0 on the HPT374 */ | ||
1068 | |||
1069 | if (chip_table == &hpt374) { | ||
1070 | freq = hpt374_read_freq(dev); | ||
1071 | if (freq == 0) | ||
1072 | return -ENODEV; | ||
1073 | } else | ||
1074 | freq = inl(iobase + 0x90); | ||
1051 | 1075 | ||
1052 | freq = inl(iobase + 0x90); | ||
1053 | if ((freq >> 12) != 0xABCDE) { | 1076 | if ((freq >> 12) != 0xABCDE) { |
1054 | int i; | 1077 | int i; |
1055 | u8 sr; | 1078 | u8 sr; |
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_ns87415.c b/drivers/ata/pata_ns87415.c index b9a17eb100d0..d0e2e50823b1 100644 --- a/drivers/ata/pata_ns87415.c +++ b/drivers/ata/pata_ns87415.c | |||
@@ -215,6 +215,8 @@ static int ns87415_check_atapi_dma(struct ata_queued_cmd *qc) | |||
215 | 215 | ||
216 | #include <asm/superio.h> | 216 | #include <asm/superio.h> |
217 | 217 | ||
218 | #define SUPERIO_IDE_MAX_RETRIES 25 | ||
219 | |||
218 | /** | 220 | /** |
219 | * ns87560_read_buggy - workaround buggy Super I/O chip | 221 | * ns87560_read_buggy - workaround buggy Super I/O chip |
220 | * @port: Port to read | 222 | * @port: Port to read |
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c index 6b07b5b48532..f9b485a487ae 100644 --- a/drivers/ata/pata_optidma.c +++ b/drivers/ata/pata_optidma.c | |||
@@ -449,7 +449,7 @@ static int optiplus_with_udma(struct pci_dev *pdev) | |||
449 | 449 | ||
450 | /* Find function 1 */ | 450 | /* Find function 1 */ |
451 | dev1 = pci_get_device(0x1045, 0xC701, NULL); | 451 | dev1 = pci_get_device(0x1045, 0xC701, NULL); |
452 | if(dev1 == NULL) | 452 | if (dev1 == NULL) |
453 | return 0; | 453 | return 0; |
454 | 454 | ||
455 | /* Rev must be >= 0x10 */ | 455 | /* Rev must be >= 0x10 */ |
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 5db2013230b3..fd36099428a4 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
@@ -74,8 +74,7 @@ static int pcmcia_set_mode(struct ata_link *link, struct ata_device **r_failed_d | |||
74 | return ata_do_set_mode(link, r_failed_dev); | 74 | return ata_do_set_mode(link, r_failed_dev); |
75 | 75 | ||
76 | if (memcmp(master->id + ATA_ID_FW_REV, slave->id + ATA_ID_FW_REV, | 76 | if (memcmp(master->id + ATA_ID_FW_REV, slave->id + ATA_ID_FW_REV, |
77 | ATA_ID_FW_REV_LEN + ATA_ID_PROD_LEN) == 0) | 77 | ATA_ID_FW_REV_LEN + ATA_ID_PROD_LEN) == 0) { |
78 | { | ||
79 | /* Suspicious match, but could be two cards from | 78 | /* Suspicious match, but could be two cards from |
80 | the same vendor - check serial */ | 79 | the same vendor - check serial */ |
81 | if (memcmp(master->id + ATA_ID_SERNO, slave->id + ATA_ID_SERNO, | 80 | if (memcmp(master->id + ATA_ID_SERNO, slave->id + ATA_ID_SERNO, |
@@ -248,7 +247,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) | |||
248 | goto next_entry; | 247 | goto next_entry; |
249 | io_base = pdev->io.BasePort1; | 248 | io_base = pdev->io.BasePort1; |
250 | ctl_base = pdev->io.BasePort1 + 0x0e; | 249 | ctl_base = pdev->io.BasePort1 + 0x0e; |
251 | } else goto next_entry; | 250 | } else |
251 | goto next_entry; | ||
252 | /* If we've got this far, we're done */ | 252 | /* If we've got this far, we're done */ |
253 | break; | 253 | break; |
254 | } | 254 | } |
@@ -285,8 +285,8 @@ next_entry: | |||
285 | printk(KERN_WARNING DRV_NAME ": second channel not yet supported.\n"); | 285 | printk(KERN_WARNING DRV_NAME ": second channel not yet supported.\n"); |
286 | 286 | ||
287 | /* | 287 | /* |
288 | * Having done the PCMCIA plumbing the ATA side is relatively | 288 | * Having done the PCMCIA plumbing the ATA side is relatively |
289 | * sane. | 289 | * sane. |
290 | */ | 290 | */ |
291 | ret = -ENOMEM; | 291 | ret = -ENOMEM; |
292 | host = ata_host_alloc(&pdev->dev, 1); | 292 | host = ata_host_alloc(&pdev->dev, 1); |
@@ -363,7 +363,7 @@ static struct pcmcia_device_id pcmcia_devices[] = { | |||
363 | PCMCIA_DEVICE_MANF_CARD(0x0098, 0x0000), /* Toshiba */ | 363 | PCMCIA_DEVICE_MANF_CARD(0x0098, 0x0000), /* Toshiba */ |
364 | PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x002d), | 364 | PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x002d), |
365 | PCMCIA_DEVICE_MANF_CARD(0x00ce, 0x0000), /* Samsung */ | 365 | PCMCIA_DEVICE_MANF_CARD(0x00ce, 0x0000), /* Samsung */ |
366 | PCMCIA_DEVICE_MANF_CARD(0x0319, 0x0000), /* Hitachi */ | 366 | PCMCIA_DEVICE_MANF_CARD(0x0319, 0x0000), /* Hitachi */ |
367 | PCMCIA_DEVICE_MANF_CARD(0x2080, 0x0001), | 367 | PCMCIA_DEVICE_MANF_CARD(0x2080, 0x0001), |
368 | PCMCIA_DEVICE_MANF_CARD(0x4e01, 0x0100), /* Viking CFA */ | 368 | PCMCIA_DEVICE_MANF_CARD(0x4e01, 0x0100), /* Viking CFA */ |
369 | PCMCIA_DEVICE_MANF_CARD(0x4e01, 0x0200), /* Lexar, Viking CFA */ | 369 | PCMCIA_DEVICE_MANF_CARD(0x4e01, 0x0200), /* Lexar, Viking CFA */ |
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index 3d3f1558cdee..2622577521a1 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c | |||
@@ -348,7 +348,7 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long | |||
348 | ata_id_c_string(pair->id, model_num, ATA_ID_PROD, | 348 | ata_id_c_string(pair->id, model_num, ATA_ID_PROD, |
349 | ATA_ID_PROD_LEN + 1); | 349 | ATA_ID_PROD_LEN + 1); |
350 | /* If the master is a maxtor in UDMA6 then the slave should not use UDMA 6 */ | 350 | /* If the master is a maxtor in UDMA6 then the slave should not use UDMA 6 */ |
351 | if(strstr(model_num, "Maxtor") == 0 && pair->dma_mode == XFER_UDMA_6) | 351 | if (strstr(model_num, "Maxtor") == 0 && pair->dma_mode == XFER_UDMA_6) |
352 | mask &= ~ (1 << (6 + ATA_SHIFT_UDMA)); | 352 | mask &= ~ (1 << (6 + ATA_SHIFT_UDMA)); |
353 | 353 | ||
354 | return ata_pci_default_filter(adev, mask); | 354 | return ata_pci_default_filter(adev, mask); |
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c index 65d951618c60..bc7c2d5d8d5e 100644 --- a/drivers/ata/pata_pdc202xx_old.c +++ b/drivers/ata/pata_pdc202xx_old.c | |||
@@ -351,9 +351,9 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
351 | struct pci_dev *bridge = dev->bus->self; | 351 | struct pci_dev *bridge = dev->bus->self; |
352 | /* Don't grab anything behind a Promise I2O RAID */ | 352 | /* Don't grab anything behind a Promise I2O RAID */ |
353 | if (bridge && bridge->vendor == PCI_VENDOR_ID_INTEL) { | 353 | if (bridge && bridge->vendor == PCI_VENDOR_ID_INTEL) { |
354 | if( bridge->device == PCI_DEVICE_ID_INTEL_I960) | 354 | if (bridge->device == PCI_DEVICE_ID_INTEL_I960) |
355 | return -ENODEV; | 355 | return -ENODEV; |
356 | if( bridge->device == PCI_DEVICE_ID_INTEL_I960RM) | 356 | if (bridge->device == PCI_DEVICE_ID_INTEL_I960RM) |
357 | return -ENODEV; | 357 | return -ENODEV; |
358 | } | 358 | } |
359 | } | 359 | } |
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index fc72a965643d..ac03a90a6168 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Generic platform device PATA driver | 2 | * Generic platform device PATA driver |
3 | * | 3 | * |
4 | * Copyright (C) 2006 Paul Mundt | 4 | * Copyright (C) 2006 - 2007 Paul Mundt |
5 | * | 5 | * |
6 | * Based on pata_pcmcia: | 6 | * Based on pata_pcmcia: |
7 | * | 7 | * |
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/pata_platform.h> | 22 | #include <linux/pata_platform.h> |
23 | 23 | ||
24 | #define DRV_NAME "pata_platform" | 24 | #define DRV_NAME "pata_platform" |
25 | #define DRV_VERSION "1.1" | 25 | #define DRV_VERSION "1.2" |
26 | 26 | ||
27 | static int pio_mask = 1; | 27 | static int pio_mask = 1; |
28 | 28 | ||
@@ -120,15 +120,20 @@ static void pata_platform_setup_port(struct ata_ioports *ioaddr, | |||
120 | * Register a platform bus IDE interface. Such interfaces are PIO and we | 120 | * Register a platform bus IDE interface. Such interfaces are PIO and we |
121 | * assume do not support IRQ sharing. | 121 | * assume do not support IRQ sharing. |
122 | * | 122 | * |
123 | * Platform devices are expected to contain 3 resources per port: | 123 | * Platform devices are expected to contain at least 2 resources per port: |
124 | * | 124 | * |
125 | * - I/O Base (IORESOURCE_IO or IORESOURCE_MEM) | 125 | * - I/O Base (IORESOURCE_IO or IORESOURCE_MEM) |
126 | * - CTL Base (IORESOURCE_IO or IORESOURCE_MEM) | 126 | * - CTL Base (IORESOURCE_IO or IORESOURCE_MEM) |
127 | * | ||
128 | * and optionally: | ||
129 | * | ||
127 | * - IRQ (IORESOURCE_IRQ) | 130 | * - IRQ (IORESOURCE_IRQ) |
128 | * | 131 | * |
129 | * If the base resources are both mem types, the ioremap() is handled | 132 | * If the base resources are both mem types, the ioremap() is handled |
130 | * here. For IORESOURCE_IO, it's assumed that there's no remapping | 133 | * here. For IORESOURCE_IO, it's assumed that there's no remapping |
131 | * necessary. | 134 | * necessary. |
135 | * | ||
136 | * If no IRQ resource is present, PIO polling mode is used instead. | ||
132 | */ | 137 | */ |
133 | static int __devinit pata_platform_probe(struct platform_device *pdev) | 138 | static int __devinit pata_platform_probe(struct platform_device *pdev) |
134 | { | 139 | { |
@@ -137,11 +142,12 @@ static int __devinit pata_platform_probe(struct platform_device *pdev) | |||
137 | struct ata_port *ap; | 142 | struct ata_port *ap; |
138 | struct pata_platform_info *pp_info; | 143 | struct pata_platform_info *pp_info; |
139 | unsigned int mmio; | 144 | unsigned int mmio; |
145 | int irq; | ||
140 | 146 | ||
141 | /* | 147 | /* |
142 | * Simple resource validation .. | 148 | * Simple resource validation .. |
143 | */ | 149 | */ |
144 | if (unlikely(pdev->num_resources != 3)) { | 150 | if ((pdev->num_resources != 3) && (pdev->num_resources != 2)) { |
145 | dev_err(&pdev->dev, "invalid number of resources\n"); | 151 | dev_err(&pdev->dev, "invalid number of resources\n"); |
146 | return -EINVAL; | 152 | return -EINVAL; |
147 | } | 153 | } |
@@ -173,6 +179,13 @@ static int __devinit pata_platform_probe(struct platform_device *pdev) | |||
173 | (ctl_res->flags == IORESOURCE_MEM)); | 179 | (ctl_res->flags == IORESOURCE_MEM)); |
174 | 180 | ||
175 | /* | 181 | /* |
182 | * And the IRQ | ||
183 | */ | ||
184 | irq = platform_get_irq(pdev, 0); | ||
185 | if (irq < 0) | ||
186 | irq = 0; /* no irq */ | ||
187 | |||
188 | /* | ||
176 | * Now that that's out of the way, wire up the port.. | 189 | * Now that that's out of the way, wire up the port.. |
177 | */ | 190 | */ |
178 | host = ata_host_alloc(&pdev->dev, 1); | 191 | host = ata_host_alloc(&pdev->dev, 1); |
@@ -185,6 +198,14 @@ static int __devinit pata_platform_probe(struct platform_device *pdev) | |||
185 | ap->flags |= ATA_FLAG_SLAVE_POSS; | 198 | ap->flags |= ATA_FLAG_SLAVE_POSS; |
186 | 199 | ||
187 | /* | 200 | /* |
201 | * Use polling mode if there's no IRQ | ||
202 | */ | ||
203 | if (!irq) { | ||
204 | ap->flags |= ATA_FLAG_PIO_POLLING; | ||
205 | ata_port_desc(ap, "no IRQ, using PIO polling"); | ||
206 | } | ||
207 | |||
208 | /* | ||
188 | * Handle the MMIO case | 209 | * Handle the MMIO case |
189 | */ | 210 | */ |
190 | if (mmio) { | 211 | if (mmio) { |
@@ -213,9 +234,9 @@ static int __devinit pata_platform_probe(struct platform_device *pdev) | |||
213 | (unsigned long long)ctl_res->start); | 234 | (unsigned long long)ctl_res->start); |
214 | 235 | ||
215 | /* activate */ | 236 | /* activate */ |
216 | return ata_host_activate(host, platform_get_irq(pdev, 0), | 237 | return ata_host_activate(host, irq, irq ? ata_interrupt : NULL, |
217 | ata_interrupt, pp_info ? pp_info->irq_flags | 238 | pp_info ? pp_info->irq_flags : 0, |
218 | : 0, &pata_platform_sht); | 239 | &pata_platform_sht); |
219 | } | 240 | } |
220 | 241 | ||
221 | /** | 242 | /** |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 55576138faea..ea2ef9fc15be 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -570,17 +570,8 @@ static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask, | |||
570 | udelay(20); | 570 | udelay(20); |
571 | out_be32(ioaddr->ctl_addr, ap->ctl); | 571 | out_be32(ioaddr->ctl_addr, ap->ctl); |
572 | 572 | ||
573 | /* spec mandates ">= 2ms" before checking status. | 573 | /* wait a while before checking status */ |
574 | * We wait 150ms, because that was the magic delay used for | 574 | ata_wait_after_reset(ap, deadline); |
575 | * ATAPI devices in Hale Landis's ATADRVR, for the period of time | ||
576 | * between when the ATA command register is written, and then | ||
577 | * status is checked. Because waiting for "a while" before | ||
578 | * checking status is fine, post SRST, we perform this magic | ||
579 | * delay here as well. | ||
580 | * | ||
581 | * Old drivers/ide uses the 2mS rule and then waits for ready | ||
582 | */ | ||
583 | msleep(150); | ||
584 | 575 | ||
585 | /* Before we perform post reset processing we want to see if | 576 | /* Before we perform post reset processing we want to see if |
586 | * the bus shows 0xFF because the odd clown forgets the D7 | 577 | * the bus shows 0xFF because the odd clown forgets the D7 |
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c index df68806df4be..8bed88873720 100644 --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c | |||
@@ -274,28 +274,27 @@ static void serverworks_set_dmamode(struct ata_port *ap, struct ata_device *adev | |||
274 | { | 274 | { |
275 | static const u8 dma_mode[] = { 0x77, 0x21, 0x20 }; | 275 | static const u8 dma_mode[] = { 0x77, 0x21, 0x20 }; |
276 | int offset = 1 + 2 * ap->port_no - adev->devno; | 276 | int offset = 1 + 2 * ap->port_no - adev->devno; |
277 | int devbits = (2 * ap->port_no + adev->devno); | 277 | int devbits = 2 * ap->port_no + adev->devno; |
278 | u8 ultra; | 278 | u8 ultra; |
279 | u8 ultra_cfg; | 279 | u8 ultra_cfg; |
280 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 280 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
281 | 281 | ||
282 | pci_read_config_byte(pdev, 0x54, &ultra_cfg); | 282 | pci_read_config_byte(pdev, 0x54, &ultra_cfg); |
283 | pci_read_config_byte(pdev, 0x56 + ap->port_no, &ultra); | ||
284 | ultra &= ~(0x0F << (adev->devno * 4)); | ||
283 | 285 | ||
284 | if (adev->dma_mode >= XFER_UDMA_0) { | 286 | if (adev->dma_mode >= XFER_UDMA_0) { |
285 | pci_write_config_byte(pdev, 0x44 + offset, 0x20); | 287 | pci_write_config_byte(pdev, 0x44 + offset, 0x20); |
286 | 288 | ||
287 | pci_read_config_byte(pdev, 0x56 + ap->port_no, &ultra); | ||
288 | ultra &= ~(0x0F << (ap->port_no * 4)); | ||
289 | ultra |= (adev->dma_mode - XFER_UDMA_0) | 289 | ultra |= (adev->dma_mode - XFER_UDMA_0) |
290 | << (ap->port_no * 4); | 290 | << (adev->devno * 4); |
291 | pci_write_config_byte(pdev, 0x56 + ap->port_no, ultra); | ||
292 | |||
293 | ultra_cfg |= (1 << devbits); | 291 | ultra_cfg |= (1 << devbits); |
294 | } else { | 292 | } else { |
295 | pci_write_config_byte(pdev, 0x44 + offset, | 293 | pci_write_config_byte(pdev, 0x44 + offset, |
296 | dma_mode[adev->dma_mode - XFER_MW_DMA_0]); | 294 | dma_mode[adev->dma_mode - XFER_MW_DMA_0]); |
297 | ultra_cfg &= ~(1 << devbits); | 295 | ultra_cfg &= ~(1 << devbits); |
298 | } | 296 | } |
297 | pci_write_config_byte(pdev, 0x56 + ap->port_no, ultra); | ||
299 | pci_write_config_byte(pdev, 0x54, ultra_cfg); | 298 | pci_write_config_byte(pdev, 0x54, ultra_cfg); |
300 | } | 299 | } |
301 | 300 | ||
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 ea7a9a652e61..a4175fbdd170 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -176,7 +176,7 @@ static int via_cable_detect(struct ata_port *ap) { | |||
176 | if ((config->flags & VIA_UDMA) < VIA_UDMA_66) | 176 | if ((config->flags & VIA_UDMA) < VIA_UDMA_66) |
177 | return ATA_CBL_PATA40; | 177 | return ATA_CBL_PATA40; |
178 | /* UDMA 66 chips have only drive side logic */ | 178 | /* UDMA 66 chips have only drive side logic */ |
179 | else if((config->flags & VIA_UDMA) < VIA_UDMA_100) | 179 | else if ((config->flags & VIA_UDMA) < VIA_UDMA_100) |
180 | return ATA_CBL_PATA_UNK; | 180 | return ATA_CBL_PATA_UNK; |
181 | /* UDMA 100 or later */ | 181 | /* UDMA 100 or later */ |
182 | pci_read_config_dword(pdev, 0x50, &ata66); | 182 | pci_read_config_dword(pdev, 0x50, &ata66); |
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c index 549cbbe9fd07..311cdb3a5566 100644 --- a/drivers/ata/pata_winbond.c +++ b/drivers/ata/pata_winbond.c | |||
@@ -279,7 +279,7 @@ static __init int winbond_init(void) | |||
279 | 279 | ||
280 | if (request_region(port, 2, "pata_winbond")) { | 280 | if (request_region(port, 2, "pata_winbond")) { |
281 | ret = winbond_init_one(port); | 281 | ret = winbond_init_one(port); |
282 | if(ret <= 0) | 282 | if (ret <= 0) |
283 | release_region(port, 2); | 283 | release_region(port, 2); |
284 | else ct+= ret; | 284 | else ct+= ret; |
285 | } | 285 | } |
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c index 199f7e150eb3..bd4c2a3c88d7 100644 --- a/drivers/ata/pdc_adma.c +++ b/drivers/ata/pdc_adma.c | |||
@@ -47,10 +47,10 @@ | |||
47 | #define DRV_VERSION "1.0" | 47 | #define DRV_VERSION "1.0" |
48 | 48 | ||
49 | /* macro to calculate base address for ATA regs */ | 49 | /* macro to calculate base address for ATA regs */ |
50 | #define ADMA_ATA_REGS(base,port_no) ((base) + ((port_no) * 0x40)) | 50 | #define ADMA_ATA_REGS(base, port_no) ((base) + ((port_no) * 0x40)) |
51 | 51 | ||
52 | /* macro to calculate base address for ADMA regs */ | 52 | /* macro to calculate base address for ADMA regs */ |
53 | #define ADMA_REGS(base,port_no) ((base) + 0x80 + ((port_no) * 0x20)) | 53 | #define ADMA_REGS(base, port_no) ((base) + 0x80 + ((port_no) * 0x20)) |
54 | 54 | ||
55 | /* macro to obtain addresses from ata_port */ | 55 | /* macro to obtain addresses from ata_port */ |
56 | #define ADMA_PORT_REGS(ap) \ | 56 | #define ADMA_PORT_REGS(ap) \ |
@@ -128,7 +128,7 @@ struct adma_port_priv { | |||
128 | adma_state_t state; | 128 | adma_state_t state; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | static int adma_ata_init_one (struct pci_dev *pdev, | 131 | static int adma_ata_init_one(struct pci_dev *pdev, |
132 | const struct pci_device_id *ent); | 132 | const struct pci_device_id *ent); |
133 | static int adma_port_start(struct ata_port *ap); | 133 | static int adma_port_start(struct ata_port *ap); |
134 | static void adma_host_stop(struct ata_host *host); | 134 | static void adma_host_stop(struct ata_host *host); |
@@ -340,8 +340,8 @@ static int adma_fill_sg(struct ata_queued_cmd *qc) | |||
340 | buf[i++] = 0; /* pPKLW */ | 340 | buf[i++] = 0; /* pPKLW */ |
341 | buf[i++] = 0; /* reserved */ | 341 | buf[i++] = 0; /* reserved */ |
342 | 342 | ||
343 | *(__le32 *)(buf + i) | 343 | *(__le32 *)(buf + i) = |
344 | = (pFLAGS & pEND) ? 0 : cpu_to_le32(pp->pkt_dma + i + 4); | 344 | (pFLAGS & pEND) ? 0 : cpu_to_le32(pp->pkt_dma + i + 4); |
345 | i += 4; | 345 | i += 4; |
346 | 346 | ||
347 | VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4, | 347 | VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4, |
@@ -617,7 +617,7 @@ static int adma_port_start(struct ata_port *ap) | |||
617 | return -ENOMEM; | 617 | return -ENOMEM; |
618 | /* paranoia? */ | 618 | /* paranoia? */ |
619 | if ((pp->pkt_dma & 7) != 0) { | 619 | if ((pp->pkt_dma & 7) != 0) { |
620 | printk("bad alignment for pp->pkt_dma: %08x\n", | 620 | printk(KERN_ERR "bad alignment for pp->pkt_dma: %08x\n", |
621 | (u32)pp->pkt_dma); | 621 | (u32)pp->pkt_dma); |
622 | return -ENOMEM; | 622 | return -ENOMEM; |
623 | } | 623 | } |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index b4c37b9e413c..d015b4adcfe0 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -34,7 +34,8 @@ enum { | |||
34 | 34 | ||
35 | SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 35 | SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
36 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | | 36 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | |
37 | ATA_FLAG_NCQ | ATA_FLAG_SKIP_D2H_BSY), | 37 | ATA_FLAG_NCQ), |
38 | SATA_FSL_HOST_LFLAGS = ATA_LFLAG_SKIP_D2H_BSY, | ||
38 | 39 | ||
39 | SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, | 40 | SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, |
40 | SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ | 41 | SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ |
@@ -264,10 +265,11 @@ struct sata_fsl_host_priv { | |||
264 | void __iomem *hcr_base; | 265 | void __iomem *hcr_base; |
265 | void __iomem *ssr_base; | 266 | void __iomem *ssr_base; |
266 | void __iomem *csr_base; | 267 | void __iomem *csr_base; |
268 | int irq; | ||
267 | }; | 269 | }; |
268 | 270 | ||
269 | static inline unsigned int sata_fsl_tag(unsigned int tag, | 271 | static inline unsigned int sata_fsl_tag(unsigned int tag, |
270 | void __iomem * hcr_base) | 272 | void __iomem *hcr_base) |
271 | { | 273 | { |
272 | /* We let libATA core do actual (queue) tag allocation */ | 274 | /* We let libATA core do actual (queue) tag allocation */ |
273 | 275 | ||
@@ -306,7 +308,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp, | |||
306 | pp->cmdslot[tag].prde_fis_len = | 308 | pp->cmdslot[tag].prde_fis_len = |
307 | cpu_to_le32((num_prde << 16) | (fis_len << 2)); | 309 | cpu_to_le32((num_prde << 16) | (fis_len << 2)); |
308 | pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03); | 310 | pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03); |
309 | pp->cmdslot[tag].desc_info = cpu_to_le32((desc_info | (tag & 0x1F))); | 311 | pp->cmdslot[tag].desc_info = cpu_to_le32(desc_info | (tag & 0x1F)); |
310 | 312 | ||
311 | VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n", | 313 | VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n", |
312 | pp->cmdslot[tag].cda, | 314 | pp->cmdslot[tag].cda, |
@@ -316,7 +318,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp, | |||
316 | } | 318 | } |
317 | 319 | ||
318 | static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, | 320 | static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, |
319 | u32 * ttl, dma_addr_t cmd_desc_paddr) | 321 | u32 *ttl, dma_addr_t cmd_desc_paddr) |
320 | { | 322 | { |
321 | struct scatterlist *sg; | 323 | struct scatterlist *sg; |
322 | unsigned int num_prde = 0; | 324 | unsigned int num_prde = 0; |
@@ -353,7 +355,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, | |||
353 | "s/g len unaligned : 0x%x\n", sg_len); | 355 | "s/g len unaligned : 0x%x\n", sg_len); |
354 | 356 | ||
355 | if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) && | 357 | if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) && |
356 | !ata_sg_is_last(sg, qc)) { | 358 | (qc->n_iter + 1 != qc->n_elem)) { |
357 | VPRINTK("setting indirect prde\n"); | 359 | VPRINTK("setting indirect prde\n"); |
358 | prd_ptr_to_indirect_ext = prd; | 360 | prd_ptr_to_indirect_ext = prd; |
359 | prd->dba = cpu_to_le32(indirect_ext_segment_paddr); | 361 | prd->dba = cpu_to_le32(indirect_ext_segment_paddr); |
@@ -404,7 +406,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc) | |||
404 | cd = (struct command_desc *)pp->cmdentry + tag; | 406 | cd = (struct command_desc *)pp->cmdentry + tag; |
405 | cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; | 407 | cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; |
406 | 408 | ||
407 | ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) & cd->cfis); | 409 | ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) &cd->cfis); |
408 | 410 | ||
409 | VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", | 411 | VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", |
410 | cd->cfis[0], cd->cfis[1], cd->cfis[2]); | 412 | cd->cfis[0], cd->cfis[1], cd->cfis[2]); |
@@ -470,16 +472,10 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in, | |||
470 | 472 | ||
471 | switch (sc_reg_in) { | 473 | switch (sc_reg_in) { |
472 | case SCR_STATUS: | 474 | case SCR_STATUS: |
473 | sc_reg = 0; | ||
474 | break; | ||
475 | case SCR_ERROR: | 475 | case SCR_ERROR: |
476 | sc_reg = 1; | ||
477 | break; | ||
478 | case SCR_CONTROL: | 476 | case SCR_CONTROL: |
479 | sc_reg = 2; | ||
480 | break; | ||
481 | case SCR_ACTIVE: | 477 | case SCR_ACTIVE: |
482 | sc_reg = 3; | 478 | sc_reg = sc_reg_in; |
483 | break; | 479 | break; |
484 | default: | 480 | default: |
485 | return -EINVAL; | 481 | return -EINVAL; |
@@ -487,7 +483,7 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in, | |||
487 | 483 | ||
488 | VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg); | 484 | VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg); |
489 | 485 | ||
490 | iowrite32(val, (void __iomem *)ssr_base + (sc_reg * 4)); | 486 | iowrite32(val, ssr_base + (sc_reg * 4)); |
491 | return 0; | 487 | return 0; |
492 | } | 488 | } |
493 | 489 | ||
@@ -500,16 +496,10 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in, | |||
500 | 496 | ||
501 | switch (sc_reg_in) { | 497 | switch (sc_reg_in) { |
502 | case SCR_STATUS: | 498 | case SCR_STATUS: |
503 | sc_reg = 0; | ||
504 | break; | ||
505 | case SCR_ERROR: | 499 | case SCR_ERROR: |
506 | sc_reg = 1; | ||
507 | break; | ||
508 | case SCR_CONTROL: | 500 | case SCR_CONTROL: |
509 | sc_reg = 2; | ||
510 | break; | ||
511 | case SCR_ACTIVE: | 501 | case SCR_ACTIVE: |
512 | sc_reg = 3; | 502 | sc_reg = sc_reg_in; |
513 | break; | 503 | break; |
514 | default: | 504 | default: |
515 | return -EINVAL; | 505 | return -EINVAL; |
@@ -517,7 +507,7 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in, | |||
517 | 507 | ||
518 | VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg); | 508 | VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg); |
519 | 509 | ||
520 | *val = ioread32((void __iomem *)ssr_base + (sc_reg * 4)); | 510 | *val = ioread32(ssr_base + (sc_reg * 4)); |
521 | return 0; | 511 | return 0; |
522 | } | 512 | } |
523 | 513 | ||
@@ -571,7 +561,6 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd | |||
571 | struct ata_port *ap) | 561 | struct ata_port *ap) |
572 | { | 562 | { |
573 | struct sata_fsl_port_priv *pp = ap->private_data; | 563 | struct sata_fsl_port_priv *pp = ap->private_data; |
574 | u8 fis[6 * 4]; | ||
575 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 564 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
576 | void __iomem *hcr_base = host_priv->hcr_base; | 565 | void __iomem *hcr_base = host_priv->hcr_base; |
577 | unsigned int tag = sata_fsl_tag(qc->tag, hcr_base); | 566 | unsigned int tag = sata_fsl_tag(qc->tag, hcr_base); |
@@ -579,8 +568,7 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd | |||
579 | 568 | ||
580 | cd = pp->cmdentry + tag; | 569 | cd = pp->cmdentry + tag; |
581 | 570 | ||
582 | memcpy(fis, &cd->sfis, 6 * 4); /* should we use memcpy_from_io() */ | 571 | ata_tf_from_fis(cd->sfis, &pp->tf); |
583 | ata_tf_from_fis(fis, &pp->tf); | ||
584 | } | 572 | } |
585 | 573 | ||
586 | static u8 sata_fsl_check_status(struct ata_port *ap) | 574 | static u8 sata_fsl_check_status(struct ata_port *ap) |
@@ -664,6 +652,7 @@ static int sata_fsl_port_start(struct ata_port *ap) | |||
664 | VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); | 652 | VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); |
665 | VPRINTK("CHBA = 0x%x\n", ioread32(hcr_base + CHBA)); | 653 | VPRINTK("CHBA = 0x%x\n", ioread32(hcr_base + CHBA)); |
666 | 654 | ||
655 | #ifdef CONFIG_MPC8315_DS | ||
667 | /* | 656 | /* |
668 | * Workaround for 8315DS board 3gbps link-up issue, | 657 | * Workaround for 8315DS board 3gbps link-up issue, |
669 | * currently limit SATA port to GEN1 speed | 658 | * currently limit SATA port to GEN1 speed |
@@ -676,6 +665,7 @@ static int sata_fsl_port_start(struct ata_port *ap) | |||
676 | sata_fsl_scr_read(ap, SCR_CONTROL, &temp); | 665 | sata_fsl_scr_read(ap, SCR_CONTROL, &temp); |
677 | dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n", | 666 | dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n", |
678 | temp); | 667 | temp); |
668 | #endif | ||
679 | 669 | ||
680 | return 0; | 670 | return 0; |
681 | } | 671 | } |
@@ -728,9 +718,10 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap) | |||
728 | return ata_dev_classify(&tf); | 718 | return ata_dev_classify(&tf); |
729 | } | 719 | } |
730 | 720 | ||
731 | static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class, | 721 | static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, |
732 | unsigned long deadline) | 722 | unsigned long deadline) |
733 | { | 723 | { |
724 | struct ata_port *ap = link->ap; | ||
734 | struct sata_fsl_port_priv *pp = ap->private_data; | 725 | struct sata_fsl_port_priv *pp = ap->private_data; |
735 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 726 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
736 | void __iomem *hcr_base = host_priv->hcr_base; | 727 | void __iomem *hcr_base = host_priv->hcr_base; |
@@ -739,10 +730,6 @@ static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class, | |||
739 | u8 *cfis; | 730 | u8 *cfis; |
740 | u32 Serror; | 731 | u32 Serror; |
741 | int i = 0; | 732 | int i = 0; |
742 | struct ata_queued_cmd qc; | ||
743 | u8 *buf; | ||
744 | dma_addr_t dma_address; | ||
745 | struct scatterlist *sg; | ||
746 | unsigned long start_jiffies; | 733 | unsigned long start_jiffies; |
747 | 734 | ||
748 | DPRINTK("in xx_softreset\n"); | 735 | DPRINTK("in xx_softreset\n"); |
@@ -811,7 +798,7 @@ try_offline_again: | |||
811 | */ | 798 | */ |
812 | 799 | ||
813 | temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500); | 800 | temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500); |
814 | if ((!(temp & 0x10)) || ata_port_offline(ap)) { | 801 | if ((!(temp & 0x10)) || ata_link_offline(link)) { |
815 | ata_port_printk(ap, KERN_WARNING, | 802 | ata_port_printk(ap, KERN_WARNING, |
816 | "No Device OR PHYRDY change,Hstatus = 0x%x\n", | 803 | "No Device OR PHYRDY change,Hstatus = 0x%x\n", |
817 | ioread32(hcr_base + HSTATUS)); | 804 | ioread32(hcr_base + HSTATUS)); |
@@ -842,13 +829,10 @@ try_offline_again: | |||
842 | * reached here, we can send a command to the target device | 829 | * reached here, we can send a command to the target device |
843 | */ | 830 | */ |
844 | 831 | ||
845 | if (ap->sactive) | ||
846 | goto skip_srst_do_ncq_error_handling; | ||
847 | |||
848 | DPRINTK("Sending SRST/device reset\n"); | 832 | DPRINTK("Sending SRST/device reset\n"); |
849 | 833 | ||
850 | ata_tf_init(ap->device, &tf); | 834 | ata_tf_init(link->device, &tf); |
851 | cfis = (u8 *) & pp->cmdentry->cfis; | 835 | cfis = (u8 *) &pp->cmdentry->cfis; |
852 | 836 | ||
853 | /* device reset/SRST is a control register update FIS, uses tag0 */ | 837 | /* device reset/SRST is a control register update FIS, uses tag0 */ |
854 | sata_fsl_setup_cmd_hdr_entry(pp, 0, | 838 | sata_fsl_setup_cmd_hdr_entry(pp, 0, |
@@ -912,76 +896,13 @@ try_offline_again: | |||
912 | * command bit of the CCreg | 896 | * command bit of the CCreg |
913 | */ | 897 | */ |
914 | iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ | 898 | iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ |
915 | goto check_device_signature; | ||
916 | |||
917 | skip_srst_do_ncq_error_handling: | ||
918 | |||
919 | VPRINTK("Sending read log ext(10h) command\n"); | ||
920 | |||
921 | memset(&qc, 0, sizeof(struct ata_queued_cmd)); | ||
922 | ata_tf_init(ap->device, &tf); | ||
923 | |||
924 | tf.command = ATA_CMD_READ_LOG_EXT; | ||
925 | tf.lbal = ATA_LOG_SATA_NCQ; | ||
926 | tf.nsect = 1; | ||
927 | tf.hob_nsect = 0; | ||
928 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE; | ||
929 | tf.protocol = ATA_PROT_PIO; | ||
930 | |||
931 | qc.tag = ATA_TAG_INTERNAL; | ||
932 | qc.scsicmd = NULL; | ||
933 | qc.ap = ap; | ||
934 | qc.dev = ap->device; | ||
935 | |||
936 | qc.tf = tf; | ||
937 | qc.flags |= ATA_QCFLAG_RESULT_TF; | ||
938 | qc.dma_dir = DMA_FROM_DEVICE; | ||
939 | |||
940 | buf = ap->sector_buf; | ||
941 | ata_sg_init_one(&qc, buf, 1 * ATA_SECT_SIZE); | ||
942 | |||
943 | /* | ||
944 | * Need to DMA-map the memory buffer associated with the command | ||
945 | */ | ||
946 | |||
947 | sg = qc.__sg; | ||
948 | dma_address = dma_map_single(ap->dev, qc.buf_virt, | ||
949 | sg->length, DMA_FROM_DEVICE); | ||
950 | |||
951 | sg_dma_address(sg) = dma_address; | ||
952 | sg_dma_len(sg) = sg->length; | ||
953 | |||
954 | VPRINTK("EH, addr = 0x%x, len = 0x%x\n", dma_address, sg->length); | ||
955 | |||
956 | sata_fsl_qc_prep(&qc); | ||
957 | sata_fsl_qc_issue(&qc); | ||
958 | |||
959 | temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000); | ||
960 | if (temp & 0x1) { | ||
961 | VPRINTK("READ_LOG_EXT_10H issue failed\n"); | ||
962 | |||
963 | VPRINTK("READ_LOG@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n", | ||
964 | ioread32(CQ + hcr_base), | ||
965 | ioread32(CA + hcr_base), ioread32(CC + hcr_base)); | ||
966 | |||
967 | sata_fsl_scr_read(ap, SCR_ERROR, &Serror); | ||
968 | |||
969 | VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS)); | ||
970 | VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); | ||
971 | VPRINTK("Serror = 0x%x\n", Serror); | ||
972 | goto err; | ||
973 | } | ||
974 | |||
975 | iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ | ||
976 | |||
977 | check_device_signature: | ||
978 | 899 | ||
979 | DPRINTK("SATA FSL : Now checking device signature\n"); | 900 | DPRINTK("SATA FSL : Now checking device signature\n"); |
980 | 901 | ||
981 | *class = ATA_DEV_NONE; | 902 | *class = ATA_DEV_NONE; |
982 | 903 | ||
983 | /* Verify if SStatus indicates device presence */ | 904 | /* Verify if SStatus indicates device presence */ |
984 | if (ata_port_online(ap)) { | 905 | if (ata_link_online(link)) { |
985 | /* | 906 | /* |
986 | * if we are here, device presence has been detected, | 907 | * if we are here, device presence has been detected, |
987 | * 1st D2H FIS would have been received, but sfis in | 908 | * 1st D2H FIS would have been received, but sfis in |
@@ -1002,25 +923,13 @@ err: | |||
1002 | return -EIO; | 923 | return -EIO; |
1003 | } | 924 | } |
1004 | 925 | ||
1005 | static int sata_fsl_hardreset(struct ata_port *ap, unsigned int *class, | ||
1006 | unsigned long deadline) | ||
1007 | { | ||
1008 | int retval; | ||
1009 | |||
1010 | retval = sata_std_hardreset(ap, class, deadline); | ||
1011 | |||
1012 | DPRINTK("SATA FSL : in xx_hardreset, retval = 0x%d\n", retval); | ||
1013 | |||
1014 | return retval; | ||
1015 | } | ||
1016 | |||
1017 | static void sata_fsl_error_handler(struct ata_port *ap) | 926 | static void sata_fsl_error_handler(struct ata_port *ap) |
1018 | { | 927 | { |
1019 | 928 | ||
1020 | DPRINTK("in xx_error_handler\n"); | 929 | DPRINTK("in xx_error_handler\n"); |
1021 | 930 | ||
1022 | /* perform recovery */ | 931 | /* perform recovery */ |
1023 | ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_fsl_hardreset, | 932 | ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_std_hardreset, |
1024 | ata_std_postreset); | 933 | ata_std_postreset); |
1025 | } | 934 | } |
1026 | 935 | ||
@@ -1042,7 +951,8 @@ static void sata_fsl_irq_clear(struct ata_port *ap) | |||
1042 | 951 | ||
1043 | static void sata_fsl_error_intr(struct ata_port *ap) | 952 | static void sata_fsl_error_intr(struct ata_port *ap) |
1044 | { | 953 | { |
1045 | struct ata_eh_info *ehi = &ap->eh_info; | 954 | struct ata_link *link = &ap->link; |
955 | struct ata_eh_info *ehi = &link->eh_info; | ||
1046 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 956 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
1047 | void __iomem *hcr_base = host_priv->hcr_base; | 957 | void __iomem *hcr_base = host_priv->hcr_base; |
1048 | u32 hstatus, dereg, cereg = 0, SError = 0; | 958 | u32 hstatus, dereg, cereg = 0, SError = 0; |
@@ -1111,7 +1021,7 @@ static void sata_fsl_error_intr(struct ata_port *ap) | |||
1111 | } | 1021 | } |
1112 | 1022 | ||
1113 | /* record error info */ | 1023 | /* record error info */ |
1114 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1024 | qc = ata_qc_from_tag(ap, link->active_tag); |
1115 | 1025 | ||
1116 | if (qc) { | 1026 | if (qc) { |
1117 | sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap); | 1027 | sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap); |
@@ -1139,6 +1049,7 @@ static void sata_fsl_qc_complete(struct ata_queued_cmd *qc) | |||
1139 | 1049 | ||
1140 | static void sata_fsl_host_intr(struct ata_port *ap) | 1050 | static void sata_fsl_host_intr(struct ata_port *ap) |
1141 | { | 1051 | { |
1052 | struct ata_link *link = &ap->link; | ||
1142 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 1053 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
1143 | void __iomem *hcr_base = host_priv->hcr_base; | 1054 | void __iomem *hcr_base = host_priv->hcr_base; |
1144 | u32 hstatus, qc_active = 0; | 1055 | u32 hstatus, qc_active = 0; |
@@ -1161,7 +1072,7 @@ static void sata_fsl_host_intr(struct ata_port *ap) | |||
1161 | return; | 1072 | return; |
1162 | } | 1073 | } |
1163 | 1074 | ||
1164 | if (ap->sactive) { /* only true for NCQ commands */ | 1075 | if (link->sactive) { /* only true for NCQ commands */ |
1165 | int i; | 1076 | int i; |
1166 | /* Read command completed register */ | 1077 | /* Read command completed register */ |
1167 | qc_active = ioread32(hcr_base + CC); | 1078 | qc_active = ioread32(hcr_base + CC); |
@@ -1190,10 +1101,10 @@ static void sata_fsl_host_intr(struct ata_port *ap) | |||
1190 | 1101 | ||
1191 | } else if (ap->qc_active) { | 1102 | } else if (ap->qc_active) { |
1192 | iowrite32(1, hcr_base + CC); | 1103 | iowrite32(1, hcr_base + CC); |
1193 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1104 | qc = ata_qc_from_tag(ap, link->active_tag); |
1194 | 1105 | ||
1195 | DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", | 1106 | DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", |
1196 | ap->active_tag, ioread32(hcr_base + CC)); | 1107 | link->active_tag, ioread32(hcr_base + CC)); |
1197 | 1108 | ||
1198 | if (qc) { | 1109 | if (qc) { |
1199 | sata_fsl_qc_complete(qc); | 1110 | sata_fsl_qc_complete(qc); |
@@ -1312,15 +1223,9 @@ static struct scsi_host_template sata_fsl_sht = { | |||
1312 | .slave_configure = ata_scsi_slave_config, | 1223 | .slave_configure = ata_scsi_slave_config, |
1313 | .slave_destroy = ata_scsi_slave_destroy, | 1224 | .slave_destroy = ata_scsi_slave_destroy, |
1314 | .bios_param = ata_std_bios_param, | 1225 | .bios_param = ata_std_bios_param, |
1315 | #ifdef CONFIG_PM | ||
1316 | .suspend = ata_scsi_device_suspend, | ||
1317 | .resume = ata_scsi_device_resume, | ||
1318 | #endif | ||
1319 | }; | 1226 | }; |
1320 | 1227 | ||
1321 | static const struct ata_port_operations sata_fsl_ops = { | 1228 | static const struct ata_port_operations sata_fsl_ops = { |
1322 | .port_disable = ata_port_disable, | ||
1323 | |||
1324 | .check_status = sata_fsl_check_status, | 1229 | .check_status = sata_fsl_check_status, |
1325 | .check_altstatus = sata_fsl_check_status, | 1230 | .check_altstatus = sata_fsl_check_status, |
1326 | .dev_select = ata_noop_dev_select, | 1231 | .dev_select = ata_noop_dev_select, |
@@ -1330,8 +1235,6 @@ static const struct ata_port_operations sata_fsl_ops = { | |||
1330 | .qc_prep = sata_fsl_qc_prep, | 1235 | .qc_prep = sata_fsl_qc_prep, |
1331 | .qc_issue = sata_fsl_qc_issue, | 1236 | .qc_issue = sata_fsl_qc_issue, |
1332 | .irq_clear = sata_fsl_irq_clear, | 1237 | .irq_clear = sata_fsl_irq_clear, |
1333 | .irq_on = ata_dummy_irq_on, | ||
1334 | .irq_ack = ata_dummy_irq_ack, | ||
1335 | 1238 | ||
1336 | .scr_read = sata_fsl_scr_read, | 1239 | .scr_read = sata_fsl_scr_read, |
1337 | .scr_write = sata_fsl_scr_write, | 1240 | .scr_write = sata_fsl_scr_write, |
@@ -1348,6 +1251,7 @@ static const struct ata_port_operations sata_fsl_ops = { | |||
1348 | static const struct ata_port_info sata_fsl_port_info[] = { | 1251 | static const struct ata_port_info sata_fsl_port_info[] = { |
1349 | { | 1252 | { |
1350 | .flags = SATA_FSL_HOST_FLAGS, | 1253 | .flags = SATA_FSL_HOST_FLAGS, |
1254 | .link_flags = SATA_FSL_HOST_LFLAGS, | ||
1351 | .pio_mask = 0x1f, /* pio 0-4 */ | 1255 | .pio_mask = 0x1f, /* pio 0-4 */ |
1352 | .udma_mask = 0x7f, /* udma 0-6 */ | 1256 | .udma_mask = 0x7f, /* udma 0-6 */ |
1353 | .port_ops = &sata_fsl_ops, | 1257 | .port_ops = &sata_fsl_ops, |
@@ -1398,6 +1302,7 @@ static int sata_fsl_probe(struct of_device *ofdev, | |||
1398 | dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n"); | 1302 | dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n"); |
1399 | goto error_exit_with_cleanup; | 1303 | goto error_exit_with_cleanup; |
1400 | } | 1304 | } |
1305 | host_priv->irq = irq; | ||
1401 | 1306 | ||
1402 | /* allocate host structure */ | 1307 | /* allocate host structure */ |
1403 | host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS); | 1308 | host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS); |
@@ -1444,7 +1349,7 @@ static int sata_fsl_remove(struct of_device *ofdev) | |||
1444 | 1349 | ||
1445 | dev_set_drvdata(&ofdev->dev, NULL); | 1350 | dev_set_drvdata(&ofdev->dev, NULL); |
1446 | 1351 | ||
1447 | irq_dispose_mapping(host->irq); | 1352 | irq_dispose_mapping(host_priv->irq); |
1448 | iounmap(host_priv->hcr_base); | 1353 | iounmap(host_priv->hcr_base); |
1449 | kfree(host_priv); | 1354 | kfree(host_priv); |
1450 | 1355 | ||
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index 08595f34b3e8..323c087e8cc1 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
@@ -143,7 +143,7 @@ static const int scr_map[] = { | |||
143 | [SCR_CONTROL] = 2, | 143 | [SCR_CONTROL] = 2, |
144 | }; | 144 | }; |
145 | 145 | ||
146 | static void __iomem * inic_port_base(struct ata_port *ap) | 146 | static void __iomem *inic_port_base(struct ata_port *ap) |
147 | { | 147 | { |
148 | return ap->host->iomap[MMIO_BAR] + ap->port_no * PORT_SIZE; | 148 | return ap->host->iomap[MMIO_BAR] + ap->port_no * PORT_SIZE; |
149 | } | 149 | } |
@@ -448,7 +448,7 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class, | |||
448 | struct ata_taskfile tf; | 448 | struct ata_taskfile tf; |
449 | 449 | ||
450 | /* wait a while before checking status */ | 450 | /* wait a while before checking status */ |
451 | msleep(150); | 451 | ata_wait_after_reset(ap, deadline); |
452 | 452 | ||
453 | rc = ata_wait_ready(ap, deadline); | 453 | rc = ata_wait_ready(ap, deadline); |
454 | /* link occupied, -ENODEV too is an error */ | 454 | /* link occupied, -ENODEV too is an error */ |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index b39648f0914b..a43f64d2775b 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -1156,7 +1156,7 @@ static void mv_fill_sg(struct ata_queued_cmd *qc) | |||
1156 | last_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); | 1156 | last_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); |
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last) | 1159 | static void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last) |
1160 | { | 1160 | { |
1161 | u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS | | 1161 | u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS | |
1162 | (last ? CRQB_CMD_LAST : 0); | 1162 | (last ? CRQB_CMD_LAST : 0); |
@@ -2429,7 +2429,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
2429 | struct mv_host_priv *hpriv = host->private_data; | 2429 | struct mv_host_priv *hpriv = host->private_data; |
2430 | u32 hp_flags = hpriv->hp_flags; | 2430 | u32 hp_flags = hpriv->hp_flags; |
2431 | 2431 | ||
2432 | switch(board_idx) { | 2432 | switch (board_idx) { |
2433 | case chip_5080: | 2433 | case chip_5080: |
2434 | hpriv->ops = &mv5xxx_ops; | 2434 | hpriv->ops = &mv5xxx_ops; |
2435 | hp_flags |= MV_HP_GEN_I; | 2435 | hp_flags |= MV_HP_GEN_I; |
@@ -2510,7 +2510,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
2510 | break; | 2510 | break; |
2511 | 2511 | ||
2512 | default: | 2512 | default: |
2513 | printk(KERN_ERR DRV_NAME ": BUG: invalid board index %u\n", board_idx); | 2513 | dev_printk(KERN_ERR, &pdev->dev, |
2514 | "BUG: invalid board index %u\n", board_idx); | ||
2514 | return 1; | 2515 | return 1; |
2515 | } | 2516 | } |
2516 | 2517 | ||
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index f1b422f7c749..44f9e5d9e362 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -291,7 +291,7 @@ struct nv_swncq_port_priv { | |||
291 | }; | 291 | }; |
292 | 292 | ||
293 | 293 | ||
294 | #define NV_ADMA_CHECK_INTR(GCTL, PORT) ((GCTL) & ( 1 << (19 + (12 * (PORT))))) | 294 | #define NV_ADMA_CHECK_INTR(GCTL, PORT) ((GCTL) & (1 << (19 + (12 * (PORT))))) |
295 | 295 | ||
296 | static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 296 | static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
297 | #ifdef CONFIG_PM | 297 | #ifdef CONFIG_PM |
@@ -884,8 +884,9 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err) | |||
884 | /* Notifier bits set without a command may indicate the drive | 884 | /* Notifier bits set without a command may indicate the drive |
885 | is misbehaving. Raise host state machine violation on this | 885 | is misbehaving. Raise host state machine violation on this |
886 | condition. */ | 886 | condition. */ |
887 | ata_port_printk(ap, KERN_ERR, "notifier for tag %d with no command?\n", | 887 | ata_port_printk(ap, KERN_ERR, |
888 | cpb_num); | 888 | "notifier for tag %d with no cmd?\n", |
889 | cpb_num); | ||
889 | ehi->err_mask |= AC_ERR_HSM; | 890 | ehi->err_mask |= AC_ERR_HSM; |
890 | ehi->action |= ATA_EH_SOFTRESET; | 891 | ehi->action |= ATA_EH_SOFTRESET; |
891 | ata_port_freeze(ap); | 892 | ata_port_freeze(ap); |
@@ -1012,7 +1013,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) | |||
1012 | u32 check_commands; | 1013 | u32 check_commands; |
1013 | int pos, error = 0; | 1014 | int pos, error = 0; |
1014 | 1015 | ||
1015 | if(ata_tag_valid(ap->link.active_tag)) | 1016 | if (ata_tag_valid(ap->link.active_tag)) |
1016 | check_commands = 1 << ap->link.active_tag; | 1017 | check_commands = 1 << ap->link.active_tag; |
1017 | else | 1018 | else |
1018 | check_commands = ap->link.sactive; | 1019 | check_commands = ap->link.sactive; |
@@ -1021,14 +1022,14 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) | |||
1021 | while ((pos = ffs(check_commands)) && !error) { | 1022 | while ((pos = ffs(check_commands)) && !error) { |
1022 | pos--; | 1023 | pos--; |
1023 | error = nv_adma_check_cpb(ap, pos, | 1024 | error = nv_adma_check_cpb(ap, pos, |
1024 | notifier_error & (1 << pos) ); | 1025 | notifier_error & (1 << pos)); |
1025 | check_commands &= ~(1 << pos ); | 1026 | check_commands &= ~(1 << pos); |
1026 | } | 1027 | } |
1027 | } | 1028 | } |
1028 | } | 1029 | } |
1029 | } | 1030 | } |
1030 | 1031 | ||
1031 | if(notifier_clears[0] || notifier_clears[1]) { | 1032 | if (notifier_clears[0] || notifier_clears[1]) { |
1032 | /* Note: Both notifier clear registers must be written | 1033 | /* Note: Both notifier clear registers must be written |
1033 | if either is set, even if one is zero, according to NVIDIA. */ | 1034 | if either is set, even if one is zero, according to NVIDIA. */ |
1034 | struct nv_adma_port_priv *pp = host->ports[0]->private_data; | 1035 | struct nv_adma_port_priv *pp = host->ports[0]->private_data; |
@@ -1061,7 +1062,7 @@ static void nv_adma_freeze(struct ata_port *ap) | |||
1061 | tmp = readw(mmio + NV_ADMA_CTL); | 1062 | tmp = readw(mmio + NV_ADMA_CTL); |
1062 | writew(tmp & ~(NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN), | 1063 | writew(tmp & ~(NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN), |
1063 | mmio + NV_ADMA_CTL); | 1064 | mmio + NV_ADMA_CTL); |
1064 | readw(mmio + NV_ADMA_CTL ); /* flush posted write */ | 1065 | readw(mmio + NV_ADMA_CTL); /* flush posted write */ |
1065 | } | 1066 | } |
1066 | 1067 | ||
1067 | static void nv_adma_thaw(struct ata_port *ap) | 1068 | static void nv_adma_thaw(struct ata_port *ap) |
@@ -1079,7 +1080,7 @@ static void nv_adma_thaw(struct ata_port *ap) | |||
1079 | tmp = readw(mmio + NV_ADMA_CTL); | 1080 | tmp = readw(mmio + NV_ADMA_CTL); |
1080 | writew(tmp | (NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN), | 1081 | writew(tmp | (NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN), |
1081 | mmio + NV_ADMA_CTL); | 1082 | mmio + NV_ADMA_CTL); |
1082 | readw(mmio + NV_ADMA_CTL ); /* flush posted write */ | 1083 | readw(mmio + NV_ADMA_CTL); /* flush posted write */ |
1083 | } | 1084 | } |
1084 | 1085 | ||
1085 | static void nv_adma_irq_clear(struct ata_port *ap) | 1086 | static void nv_adma_irq_clear(struct ata_port *ap) |
@@ -1119,7 +1120,7 @@ static void nv_adma_post_internal_cmd(struct ata_queued_cmd *qc) | |||
1119 | { | 1120 | { |
1120 | struct nv_adma_port_priv *pp = qc->ap->private_data; | 1121 | struct nv_adma_port_priv *pp = qc->ap->private_data; |
1121 | 1122 | ||
1122 | if(pp->flags & NV_ADMA_PORT_REGISTER_MODE) | 1123 | if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) |
1123 | ata_bmdma_post_internal_cmd(qc); | 1124 | ata_bmdma_post_internal_cmd(qc); |
1124 | } | 1125 | } |
1125 | 1126 | ||
@@ -1165,7 +1166,7 @@ static int nv_adma_port_start(struct ata_port *ap) | |||
1165 | pp->cpb_dma = mem_dma; | 1166 | pp->cpb_dma = mem_dma; |
1166 | 1167 | ||
1167 | writel(mem_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW); | 1168 | writel(mem_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW); |
1168 | writel((mem_dma >> 16 ) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH); | 1169 | writel((mem_dma >> 16) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH); |
1169 | 1170 | ||
1170 | mem += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ; | 1171 | mem += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ; |
1171 | mem_dma += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ; | 1172 | mem_dma += NV_ADMA_MAX_CPBS * NV_ADMA_CPB_SZ; |
@@ -1189,15 +1190,15 @@ static int nv_adma_port_start(struct ata_port *ap) | |||
1189 | 1190 | ||
1190 | /* clear GO for register mode, enable interrupt */ | 1191 | /* clear GO for register mode, enable interrupt */ |
1191 | tmp = readw(mmio + NV_ADMA_CTL); | 1192 | tmp = readw(mmio + NV_ADMA_CTL); |
1192 | writew( (tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN | | 1193 | writew((tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN | |
1193 | NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL); | 1194 | NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL); |
1194 | 1195 | ||
1195 | tmp = readw(mmio + NV_ADMA_CTL); | 1196 | tmp = readw(mmio + NV_ADMA_CTL); |
1196 | writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); | 1197 | writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); |
1197 | readw( mmio + NV_ADMA_CTL ); /* flush posted write */ | 1198 | readw(mmio + NV_ADMA_CTL); /* flush posted write */ |
1198 | udelay(1); | 1199 | udelay(1); |
1199 | writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); | 1200 | writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); |
1200 | readw( mmio + NV_ADMA_CTL ); /* flush posted write */ | 1201 | readw(mmio + NV_ADMA_CTL); /* flush posted write */ |
1201 | 1202 | ||
1202 | return 0; | 1203 | return 0; |
1203 | } | 1204 | } |
@@ -1237,7 +1238,7 @@ static int nv_adma_port_resume(struct ata_port *ap) | |||
1237 | 1238 | ||
1238 | /* set CPB block location */ | 1239 | /* set CPB block location */ |
1239 | writel(pp->cpb_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW); | 1240 | writel(pp->cpb_dma & 0xFFFFFFFF, mmio + NV_ADMA_CPB_BASE_LOW); |
1240 | writel((pp->cpb_dma >> 16 ) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH); | 1241 | writel((pp->cpb_dma >> 16) >> 16, mmio + NV_ADMA_CPB_BASE_HIGH); |
1241 | 1242 | ||
1242 | /* clear any outstanding interrupt conditions */ | 1243 | /* clear any outstanding interrupt conditions */ |
1243 | writew(0xffff, mmio + NV_ADMA_STAT); | 1244 | writew(0xffff, mmio + NV_ADMA_STAT); |
@@ -1250,15 +1251,15 @@ static int nv_adma_port_resume(struct ata_port *ap) | |||
1250 | 1251 | ||
1251 | /* clear GO for register mode, enable interrupt */ | 1252 | /* clear GO for register mode, enable interrupt */ |
1252 | tmp = readw(mmio + NV_ADMA_CTL); | 1253 | tmp = readw(mmio + NV_ADMA_CTL); |
1253 | writew( (tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN | | 1254 | writew((tmp & ~NV_ADMA_CTL_GO) | NV_ADMA_CTL_AIEN | |
1254 | NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL); | 1255 | NV_ADMA_CTL_HOTPLUG_IEN, mmio + NV_ADMA_CTL); |
1255 | 1256 | ||
1256 | tmp = readw(mmio + NV_ADMA_CTL); | 1257 | tmp = readw(mmio + NV_ADMA_CTL); |
1257 | writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); | 1258 | writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); |
1258 | readw( mmio + NV_ADMA_CTL ); /* flush posted write */ | 1259 | readw(mmio + NV_ADMA_CTL); /* flush posted write */ |
1259 | udelay(1); | 1260 | udelay(1); |
1260 | writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); | 1261 | writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); |
1261 | readw( mmio + NV_ADMA_CTL ); /* flush posted write */ | 1262 | readw(mmio + NV_ADMA_CTL); /* flush posted write */ |
1262 | 1263 | ||
1263 | return 0; | 1264 | return 0; |
1264 | } | 1265 | } |
@@ -1342,7 +1343,8 @@ static void nv_adma_fill_sg(struct ata_queued_cmd *qc, struct nv_adma_cpb *cpb) | |||
1342 | idx = 0; | 1343 | idx = 0; |
1343 | 1344 | ||
1344 | ata_for_each_sg(sg, qc) { | 1345 | ata_for_each_sg(sg, qc) { |
1345 | aprd = (idx < 5) ? &cpb->aprd[idx] : &pp->aprd[NV_ADMA_SGTBL_LEN * qc->tag + (idx-5)]; | 1346 | aprd = (idx < 5) ? &cpb->aprd[idx] : |
1347 | &pp->aprd[NV_ADMA_SGTBL_LEN * qc->tag + (idx-5)]; | ||
1346 | nv_adma_fill_aprd(qc, sg, idx, aprd); | 1348 | nv_adma_fill_aprd(qc, sg, idx, aprd); |
1347 | idx++; | 1349 | idx++; |
1348 | } | 1350 | } |
@@ -1359,12 +1361,12 @@ static int nv_adma_use_reg_mode(struct ata_queued_cmd *qc) | |||
1359 | /* ADMA engine can only be used for non-ATAPI DMA commands, | 1361 | /* ADMA engine can only be used for non-ATAPI DMA commands, |
1360 | or interrupt-driven no-data commands, where a result taskfile | 1362 | or interrupt-driven no-data commands, where a result taskfile |
1361 | is not required. */ | 1363 | is not required. */ |
1362 | if((pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) || | 1364 | if ((pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) || |
1363 | (qc->tf.flags & ATA_TFLAG_POLLING) || | 1365 | (qc->tf.flags & ATA_TFLAG_POLLING) || |
1364 | (qc->flags & ATA_QCFLAG_RESULT_TF)) | 1366 | (qc->flags & ATA_QCFLAG_RESULT_TF)) |
1365 | return 1; | 1367 | return 1; |
1366 | 1368 | ||
1367 | if((qc->flags & ATA_QCFLAG_DMAMAP) || | 1369 | if ((qc->flags & ATA_QCFLAG_DMAMAP) || |
1368 | (qc->tf.protocol == ATA_PROT_NODATA)) | 1370 | (qc->tf.protocol == ATA_PROT_NODATA)) |
1369 | return 0; | 1371 | return 0; |
1370 | 1372 | ||
@@ -1401,14 +1403,14 @@ static void nv_adma_qc_prep(struct ata_queued_cmd *qc) | |||
1401 | 1403 | ||
1402 | nv_adma_tf_to_cpb(&qc->tf, cpb->tf); | 1404 | nv_adma_tf_to_cpb(&qc->tf, cpb->tf); |
1403 | 1405 | ||
1404 | if(qc->flags & ATA_QCFLAG_DMAMAP) { | 1406 | if (qc->flags & ATA_QCFLAG_DMAMAP) { |
1405 | nv_adma_fill_sg(qc, cpb); | 1407 | nv_adma_fill_sg(qc, cpb); |
1406 | ctl_flags |= NV_CPB_CTL_APRD_VALID; | 1408 | ctl_flags |= NV_CPB_CTL_APRD_VALID; |
1407 | } else | 1409 | } else |
1408 | memset(&cpb->aprd[0], 0, sizeof(struct nv_adma_prd) * 5); | 1410 | memset(&cpb->aprd[0], 0, sizeof(struct nv_adma_prd) * 5); |
1409 | 1411 | ||
1410 | /* Be paranoid and don't let the device see NV_CPB_CTL_CPB_VALID until we are | 1412 | /* Be paranoid and don't let the device see NV_CPB_CTL_CPB_VALID |
1411 | finished filling in all of the contents */ | 1413 | until we are finished filling in all of the contents */ |
1412 | wmb(); | 1414 | wmb(); |
1413 | cpb->ctl_flags = ctl_flags; | 1415 | cpb->ctl_flags = ctl_flags; |
1414 | wmb(); | 1416 | wmb(); |
@@ -1435,16 +1437,16 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc) | |||
1435 | and (number of cpbs to append -1) in top 8 bits */ | 1437 | and (number of cpbs to append -1) in top 8 bits */ |
1436 | wmb(); | 1438 | wmb(); |
1437 | 1439 | ||
1438 | if(curr_ncq != pp->last_issue_ncq) { | 1440 | if (curr_ncq != pp->last_issue_ncq) { |
1439 | /* Seems to need some delay before switching between NCQ and non-NCQ | 1441 | /* Seems to need some delay before switching between NCQ and |
1440 | commands, else we get command timeouts and such. */ | 1442 | non-NCQ commands, else we get command timeouts and such. */ |
1441 | udelay(20); | 1443 | udelay(20); |
1442 | pp->last_issue_ncq = curr_ncq; | 1444 | pp->last_issue_ncq = curr_ncq; |
1443 | } | 1445 | } |
1444 | 1446 | ||
1445 | writew(qc->tag, mmio + NV_ADMA_APPEND); | 1447 | writew(qc->tag, mmio + NV_ADMA_APPEND); |
1446 | 1448 | ||
1447 | DPRINTK("Issued tag %u\n",qc->tag); | 1449 | DPRINTK("Issued tag %u\n", qc->tag); |
1448 | 1450 | ||
1449 | return 0; | 1451 | return 0; |
1450 | } | 1452 | } |
@@ -1627,7 +1629,7 @@ static int nv_hardreset(struct ata_link *link, unsigned int *class, | |||
1627 | 1629 | ||
1628 | /* SATA hardreset fails to retrieve proper device signature on | 1630 | /* SATA hardreset fails to retrieve proper device signature on |
1629 | * some controllers. Don't classify on hardreset. For more | 1631 | * some controllers. Don't classify on hardreset. For more |
1630 | * info, see http://bugme.osdl.org/show_bug.cgi?id=3352 | 1632 | * info, see http://bugzilla.kernel.org/show_bug.cgi?id=3352 |
1631 | */ | 1633 | */ |
1632 | return sata_std_hardreset(link, &dummy, deadline); | 1634 | return sata_std_hardreset(link, &dummy, deadline); |
1633 | } | 1635 | } |
@@ -1641,12 +1643,12 @@ static void nv_error_handler(struct ata_port *ap) | |||
1641 | static void nv_adma_error_handler(struct ata_port *ap) | 1643 | static void nv_adma_error_handler(struct ata_port *ap) |
1642 | { | 1644 | { |
1643 | struct nv_adma_port_priv *pp = ap->private_data; | 1645 | struct nv_adma_port_priv *pp = ap->private_data; |
1644 | if(!(pp->flags & NV_ADMA_PORT_REGISTER_MODE)) { | 1646 | if (!(pp->flags & NV_ADMA_PORT_REGISTER_MODE)) { |
1645 | void __iomem *mmio = pp->ctl_block; | 1647 | void __iomem *mmio = pp->ctl_block; |
1646 | int i; | 1648 | int i; |
1647 | u16 tmp; | 1649 | u16 tmp; |
1648 | 1650 | ||
1649 | if(ata_tag_valid(ap->link.active_tag) || ap->link.sactive) { | 1651 | if (ata_tag_valid(ap->link.active_tag) || ap->link.sactive) { |
1650 | u32 notifier = readl(mmio + NV_ADMA_NOTIFIER); | 1652 | u32 notifier = readl(mmio + NV_ADMA_NOTIFIER); |
1651 | u32 notifier_error = readl(mmio + NV_ADMA_NOTIFIER_ERROR); | 1653 | u32 notifier_error = readl(mmio + NV_ADMA_NOTIFIER_ERROR); |
1652 | u32 gen_ctl = readl(pp->gen_block + NV_ADMA_GEN_CTL); | 1654 | u32 gen_ctl = readl(pp->gen_block + NV_ADMA_GEN_CTL); |
@@ -1654,16 +1656,17 @@ static void nv_adma_error_handler(struct ata_port *ap) | |||
1654 | u8 cpb_count = readb(mmio + NV_ADMA_CPB_COUNT); | 1656 | u8 cpb_count = readb(mmio + NV_ADMA_CPB_COUNT); |
1655 | u8 next_cpb_idx = readb(mmio + NV_ADMA_NEXT_CPB_IDX); | 1657 | u8 next_cpb_idx = readb(mmio + NV_ADMA_NEXT_CPB_IDX); |
1656 | 1658 | ||
1657 | ata_port_printk(ap, KERN_ERR, "EH in ADMA mode, notifier 0x%X " | 1659 | ata_port_printk(ap, KERN_ERR, |
1660 | "EH in ADMA mode, notifier 0x%X " | ||
1658 | "notifier_error 0x%X gen_ctl 0x%X status 0x%X " | 1661 | "notifier_error 0x%X gen_ctl 0x%X status 0x%X " |
1659 | "next cpb count 0x%X next cpb idx 0x%x\n", | 1662 | "next cpb count 0x%X next cpb idx 0x%x\n", |
1660 | notifier, notifier_error, gen_ctl, status, | 1663 | notifier, notifier_error, gen_ctl, status, |
1661 | cpb_count, next_cpb_idx); | 1664 | cpb_count, next_cpb_idx); |
1662 | 1665 | ||
1663 | for( i=0;i<NV_ADMA_MAX_CPBS;i++) { | 1666 | for (i = 0; i < NV_ADMA_MAX_CPBS; i++) { |
1664 | struct nv_adma_cpb *cpb = &pp->cpb[i]; | 1667 | struct nv_adma_cpb *cpb = &pp->cpb[i]; |
1665 | if( (ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) || | 1668 | if ((ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) || |
1666 | ap->link.sactive & (1 << i) ) | 1669 | ap->link.sactive & (1 << i)) |
1667 | ata_port_printk(ap, KERN_ERR, | 1670 | ata_port_printk(ap, KERN_ERR, |
1668 | "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n", | 1671 | "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n", |
1669 | i, cpb->ctl_flags, cpb->resp_flags); | 1672 | i, cpb->ctl_flags, cpb->resp_flags); |
@@ -1673,8 +1676,9 @@ static void nv_adma_error_handler(struct ata_port *ap) | |||
1673 | /* Push us back into port register mode for error handling. */ | 1676 | /* Push us back into port register mode for error handling. */ |
1674 | nv_adma_register_mode(ap); | 1677 | nv_adma_register_mode(ap); |
1675 | 1678 | ||
1676 | /* Mark all of the CPBs as invalid to prevent them from being executed */ | 1679 | /* Mark all of the CPBs as invalid to prevent them from |
1677 | for( i=0;i<NV_ADMA_MAX_CPBS;i++) | 1680 | being executed */ |
1681 | for (i = 0; i < NV_ADMA_MAX_CPBS; i++) | ||
1678 | pp->cpb[i].ctl_flags &= ~NV_CPB_CTL_CPB_VALID; | 1682 | pp->cpb[i].ctl_flags &= ~NV_CPB_CTL_CPB_VALID; |
1679 | 1683 | ||
1680 | /* clear CPB fetch count */ | 1684 | /* clear CPB fetch count */ |
@@ -1683,10 +1687,10 @@ static void nv_adma_error_handler(struct ata_port *ap) | |||
1683 | /* Reset channel */ | 1687 | /* Reset channel */ |
1684 | tmp = readw(mmio + NV_ADMA_CTL); | 1688 | tmp = readw(mmio + NV_ADMA_CTL); |
1685 | writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); | 1689 | writew(tmp | NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); |
1686 | readw( mmio + NV_ADMA_CTL ); /* flush posted write */ | 1690 | readw(mmio + NV_ADMA_CTL); /* flush posted write */ |
1687 | udelay(1); | 1691 | udelay(1); |
1688 | writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); | 1692 | writew(tmp & ~NV_ADMA_CTL_CHANNEL_RESET, mmio + NV_ADMA_CTL); |
1689 | readw( mmio + NV_ADMA_CTL ); /* flush posted write */ | 1693 | readw(mmio + NV_ADMA_CTL); /* flush posted write */ |
1690 | } | 1694 | } |
1691 | 1695 | ||
1692 | ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, | 1696 | ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, |
@@ -2350,9 +2354,9 @@ static irqreturn_t nv_swncq_interrupt(int irq, void *dev_instance) | |||
2350 | return IRQ_RETVAL(handled); | 2354 | return IRQ_RETVAL(handled); |
2351 | } | 2355 | } |
2352 | 2356 | ||
2353 | static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 2357 | static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
2354 | { | 2358 | { |
2355 | static int printed_version = 0; | 2359 | static int printed_version; |
2356 | const struct ata_port_info *ppi[] = { NULL, NULL }; | 2360 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
2357 | struct ata_host *host; | 2361 | struct ata_host *host; |
2358 | struct nv_host_priv *hpriv; | 2362 | struct nv_host_priv *hpriv; |
@@ -2364,7 +2368,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2364 | // Make sure this is a SATA controller by counting the number of bars | 2368 | // Make sure this is a SATA controller by counting the number of bars |
2365 | // (NVIDIA SATA controllers will always have six bars). Otherwise, | 2369 | // (NVIDIA SATA controllers will always have six bars). Otherwise, |
2366 | // it's an IDE controller and we ignore it. | 2370 | // it's an IDE controller and we ignore it. |
2367 | for (bar=0; bar<6; bar++) | 2371 | for (bar = 0; bar < 6; bar++) |
2368 | if (pci_resource_start(pdev, bar) == 0) | 2372 | if (pci_resource_start(pdev, bar) == 0) |
2369 | return -ENODEV; | 2373 | return -ENODEV; |
2370 | 2374 | ||
@@ -2381,6 +2385,14 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2381 | type = ADMA; | 2385 | type = ADMA; |
2382 | } | 2386 | } |
2383 | 2387 | ||
2388 | if (type == SWNCQ) { | ||
2389 | if (swncq_enabled) | ||
2390 | dev_printk(KERN_NOTICE, &pdev->dev, | ||
2391 | "Using SWNCQ mode\n"); | ||
2392 | else | ||
2393 | type = GENERIC; | ||
2394 | } | ||
2395 | |||
2384 | ppi[0] = &nv_port_info[type]; | 2396 | ppi[0] = &nv_port_info[type]; |
2385 | rc = ata_pci_prepare_sff_host(pdev, ppi, &host); | 2397 | rc = ata_pci_prepare_sff_host(pdev, ppi, &host); |
2386 | if (rc) | 2398 | if (rc) |
@@ -2422,10 +2434,8 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2422 | rc = nv_adma_host_init(host); | 2434 | rc = nv_adma_host_init(host); |
2423 | if (rc) | 2435 | if (rc) |
2424 | return rc; | 2436 | return rc; |
2425 | } else if (type == SWNCQ && swncq_enabled) { | 2437 | } else if (type == SWNCQ) |
2426 | dev_printk(KERN_NOTICE, &pdev->dev, "Using SWNCQ mode\n"); | ||
2427 | nv_swncq_host_init(host); | 2438 | nv_swncq_host_init(host); |
2428 | } | ||
2429 | 2439 | ||
2430 | pci_set_master(pdev); | 2440 | pci_set_master(pdev); |
2431 | return ata_host_activate(host, pdev->irq, ppi[0]->irq_handler, | 2441 | return ata_host_activate(host, pdev->irq, ppi[0]->irq_handler, |
@@ -2440,37 +2450,37 @@ static int nv_pci_device_resume(struct pci_dev *pdev) | |||
2440 | int rc; | 2450 | int rc; |
2441 | 2451 | ||
2442 | rc = ata_pci_device_do_resume(pdev); | 2452 | rc = ata_pci_device_do_resume(pdev); |
2443 | if(rc) | 2453 | if (rc) |
2444 | return rc; | 2454 | return rc; |
2445 | 2455 | ||
2446 | if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { | 2456 | if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { |
2447 | if(hpriv->type >= CK804) { | 2457 | if (hpriv->type >= CK804) { |
2448 | u8 regval; | 2458 | u8 regval; |
2449 | 2459 | ||
2450 | pci_read_config_byte(pdev, NV_MCP_SATA_CFG_20, ®val); | 2460 | pci_read_config_byte(pdev, NV_MCP_SATA_CFG_20, ®val); |
2451 | regval |= NV_MCP_SATA_CFG_20_SATA_SPACE_EN; | 2461 | regval |= NV_MCP_SATA_CFG_20_SATA_SPACE_EN; |
2452 | pci_write_config_byte(pdev, NV_MCP_SATA_CFG_20, regval); | 2462 | pci_write_config_byte(pdev, NV_MCP_SATA_CFG_20, regval); |
2453 | } | 2463 | } |
2454 | if(hpriv->type == ADMA) { | 2464 | if (hpriv->type == ADMA) { |
2455 | u32 tmp32; | 2465 | u32 tmp32; |
2456 | struct nv_adma_port_priv *pp; | 2466 | struct nv_adma_port_priv *pp; |
2457 | /* enable/disable ADMA on the ports appropriately */ | 2467 | /* enable/disable ADMA on the ports appropriately */ |
2458 | pci_read_config_dword(pdev, NV_MCP_SATA_CFG_20, &tmp32); | 2468 | pci_read_config_dword(pdev, NV_MCP_SATA_CFG_20, &tmp32); |
2459 | 2469 | ||
2460 | pp = host->ports[0]->private_data; | 2470 | pp = host->ports[0]->private_data; |
2461 | if(pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) | 2471 | if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) |
2462 | tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT0_EN | | 2472 | tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT0_EN | |
2463 | NV_MCP_SATA_CFG_20_PORT0_PWB_EN); | 2473 | NV_MCP_SATA_CFG_20_PORT0_PWB_EN); |
2464 | else | 2474 | else |
2465 | tmp32 |= (NV_MCP_SATA_CFG_20_PORT0_EN | | 2475 | tmp32 |= (NV_MCP_SATA_CFG_20_PORT0_EN | |
2466 | NV_MCP_SATA_CFG_20_PORT0_PWB_EN); | 2476 | NV_MCP_SATA_CFG_20_PORT0_PWB_EN); |
2467 | pp = host->ports[1]->private_data; | 2477 | pp = host->ports[1]->private_data; |
2468 | if(pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) | 2478 | if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) |
2469 | tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT1_EN | | 2479 | tmp32 &= ~(NV_MCP_SATA_CFG_20_PORT1_EN | |
2470 | NV_MCP_SATA_CFG_20_PORT1_PWB_EN); | 2480 | NV_MCP_SATA_CFG_20_PORT1_PWB_EN); |
2471 | else | 2481 | else |
2472 | tmp32 |= (NV_MCP_SATA_CFG_20_PORT1_EN | | 2482 | tmp32 |= (NV_MCP_SATA_CFG_20_PORT1_EN | |
2473 | NV_MCP_SATA_CFG_20_PORT1_PWB_EN); | 2483 | NV_MCP_SATA_CFG_20_PORT1_PWB_EN); |
2474 | 2484 | ||
2475 | pci_write_config_dword(pdev, NV_MCP_SATA_CFG_20, tmp32); | 2485 | pci_write_config_dword(pdev, NV_MCP_SATA_CFG_20, tmp32); |
2476 | } | 2486 | } |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 903213153b5d..7914def54fa3 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * sata_promise.c - Promise SATA | 2 | * sata_promise.c - Promise SATA |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> |
5 | * Mikael Pettersson <mikpe@it.uu.se> | ||
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 6 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 7 | * on emails. |
7 | * | 8 | * |
@@ -45,11 +46,12 @@ | |||
45 | #include "sata_promise.h" | 46 | #include "sata_promise.h" |
46 | 47 | ||
47 | #define DRV_NAME "sata_promise" | 48 | #define DRV_NAME "sata_promise" |
48 | #define DRV_VERSION "2.10" | 49 | #define DRV_VERSION "2.11" |
49 | 50 | ||
50 | enum { | 51 | enum { |
51 | PDC_MAX_PORTS = 4, | 52 | PDC_MAX_PORTS = 4, |
52 | PDC_MMIO_BAR = 3, | 53 | PDC_MMIO_BAR = 3, |
54 | PDC_MAX_PRD = LIBATA_MAX_PRD - 1, /* -1 for ASIC PRD bug workaround */ | ||
53 | 55 | ||
54 | /* register offsets */ | 56 | /* register offsets */ |
55 | PDC_FEATURE = 0x04, /* Feature/Error reg (per port) */ | 57 | PDC_FEATURE = 0x04, /* Feature/Error reg (per port) */ |
@@ -83,10 +85,12 @@ enum { | |||
83 | PDC_PCI_SYS_ERR = (1 << 22), /* PCI system error */ | 85 | PDC_PCI_SYS_ERR = (1 << 22), /* PCI system error */ |
84 | PDC1_PCI_PARITY_ERR = (1 << 23), /* PCI parity error (from SATA150 driver) */ | 86 | PDC1_PCI_PARITY_ERR = (1 << 23), /* PCI parity error (from SATA150 driver) */ |
85 | PDC1_ERR_MASK = PDC1_PCI_PARITY_ERR, | 87 | PDC1_ERR_MASK = PDC1_PCI_PARITY_ERR, |
86 | PDC2_ERR_MASK = PDC2_HTO_ERR | PDC2_ATA_HBA_ERR | PDC2_ATA_DMA_CNT_ERR, | 88 | PDC2_ERR_MASK = PDC2_HTO_ERR | PDC2_ATA_HBA_ERR | |
87 | PDC_ERR_MASK = (PDC_PH_ERR | PDC_SH_ERR | PDC_DH_ERR | PDC_OVERRUN_ERR | 89 | PDC2_ATA_DMA_CNT_ERR, |
88 | | PDC_UNDERRUN_ERR | PDC_DRIVE_ERR | PDC_PCI_SYS_ERR | 90 | PDC_ERR_MASK = PDC_PH_ERR | PDC_SH_ERR | PDC_DH_ERR | |
89 | | PDC1_ERR_MASK | PDC2_ERR_MASK), | 91 | PDC_OVERRUN_ERR | PDC_UNDERRUN_ERR | |
92 | PDC_DRIVE_ERR | PDC_PCI_SYS_ERR | | ||
93 | PDC1_ERR_MASK | PDC2_ERR_MASK, | ||
90 | 94 | ||
91 | board_2037x = 0, /* FastTrak S150 TX2plus */ | 95 | board_2037x = 0, /* FastTrak S150 TX2plus */ |
92 | board_2037x_pata = 1, /* FastTrak S150 TX2plus PATA port */ | 96 | board_2037x_pata = 1, /* FastTrak S150 TX2plus PATA port */ |
@@ -155,7 +159,7 @@ static struct scsi_host_template pdc_ata_sht = { | |||
155 | .queuecommand = ata_scsi_queuecmd, | 159 | .queuecommand = ata_scsi_queuecmd, |
156 | .can_queue = ATA_DEF_QUEUE, | 160 | .can_queue = ATA_DEF_QUEUE, |
157 | .this_id = ATA_SHT_THIS_ID, | 161 | .this_id = ATA_SHT_THIS_ID, |
158 | .sg_tablesize = LIBATA_MAX_PRD, | 162 | .sg_tablesize = PDC_MAX_PRD, |
159 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | 163 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, |
160 | .emulated = ATA_SHT_EMULATED, | 164 | .emulated = ATA_SHT_EMULATED, |
161 | .use_clustering = ATA_SHT_USE_CLUSTERING, | 165 | .use_clustering = ATA_SHT_USE_CLUSTERING, |
@@ -238,7 +242,7 @@ static const struct ata_port_operations pdc_pata_ops = { | |||
238 | }; | 242 | }; |
239 | 243 | ||
240 | static const struct ata_port_info pdc_port_info[] = { | 244 | static const struct ata_port_info pdc_port_info[] = { |
241 | /* board_2037x */ | 245 | [board_2037x] = |
242 | { | 246 | { |
243 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | | 247 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | |
244 | PDC_FLAG_SATA_PATA, | 248 | PDC_FLAG_SATA_PATA, |
@@ -248,7 +252,7 @@ static const struct ata_port_info pdc_port_info[] = { | |||
248 | .port_ops = &pdc_old_sata_ops, | 252 | .port_ops = &pdc_old_sata_ops, |
249 | }, | 253 | }, |
250 | 254 | ||
251 | /* board_2037x_pata */ | 255 | [board_2037x_pata] = |
252 | { | 256 | { |
253 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS, | 257 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS, |
254 | .pio_mask = 0x1f, /* pio0-4 */ | 258 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -257,7 +261,7 @@ static const struct ata_port_info pdc_port_info[] = { | |||
257 | .port_ops = &pdc_pata_ops, | 261 | .port_ops = &pdc_pata_ops, |
258 | }, | 262 | }, |
259 | 263 | ||
260 | /* board_20319 */ | 264 | [board_20319] = |
261 | { | 265 | { |
262 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | | 266 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | |
263 | PDC_FLAG_4_PORTS, | 267 | PDC_FLAG_4_PORTS, |
@@ -267,7 +271,7 @@ static const struct ata_port_info pdc_port_info[] = { | |||
267 | .port_ops = &pdc_old_sata_ops, | 271 | .port_ops = &pdc_old_sata_ops, |
268 | }, | 272 | }, |
269 | 273 | ||
270 | /* board_20619 */ | 274 | [board_20619] = |
271 | { | 275 | { |
272 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS | | 276 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS | |
273 | PDC_FLAG_4_PORTS, | 277 | PDC_FLAG_4_PORTS, |
@@ -277,7 +281,7 @@ static const struct ata_port_info pdc_port_info[] = { | |||
277 | .port_ops = &pdc_pata_ops, | 281 | .port_ops = &pdc_pata_ops, |
278 | }, | 282 | }, |
279 | 283 | ||
280 | /* board_2057x */ | 284 | [board_2057x] = |
281 | { | 285 | { |
282 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | | 286 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | |
283 | PDC_FLAG_GEN_II | PDC_FLAG_SATA_PATA, | 287 | PDC_FLAG_GEN_II | PDC_FLAG_SATA_PATA, |
@@ -287,7 +291,7 @@ static const struct ata_port_info pdc_port_info[] = { | |||
287 | .port_ops = &pdc_sata_ops, | 291 | .port_ops = &pdc_sata_ops, |
288 | }, | 292 | }, |
289 | 293 | ||
290 | /* board_2057x_pata */ | 294 | [board_2057x_pata] = |
291 | { | 295 | { |
292 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS | | 296 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS | |
293 | PDC_FLAG_GEN_II, | 297 | PDC_FLAG_GEN_II, |
@@ -297,7 +301,7 @@ static const struct ata_port_info pdc_port_info[] = { | |||
297 | .port_ops = &pdc_pata_ops, | 301 | .port_ops = &pdc_pata_ops, |
298 | }, | 302 | }, |
299 | 303 | ||
300 | /* board_40518 */ | 304 | [board_40518] = |
301 | { | 305 | { |
302 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | | 306 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA | |
303 | PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS, | 307 | PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS, |
@@ -521,6 +525,84 @@ static void pdc_atapi_pkt(struct ata_queued_cmd *qc) | |||
521 | memcpy(buf+31, cdb, cdb_len); | 525 | memcpy(buf+31, cdb, cdb_len); |
522 | } | 526 | } |
523 | 527 | ||
528 | /** | ||
529 | * pdc_fill_sg - Fill PCI IDE PRD table | ||
530 | * @qc: Metadata associated with taskfile to be transferred | ||
531 | * | ||
532 | * Fill PCI IDE PRD (scatter-gather) table with segments | ||
533 | * associated with the current disk command. | ||
534 | * Make sure hardware does not choke on it. | ||
535 | * | ||
536 | * LOCKING: | ||
537 | * spin_lock_irqsave(host lock) | ||
538 | * | ||
539 | */ | ||
540 | static void pdc_fill_sg(struct ata_queued_cmd *qc) | ||
541 | { | ||
542 | struct ata_port *ap = qc->ap; | ||
543 | struct scatterlist *sg; | ||
544 | unsigned int idx; | ||
545 | const u32 SG_COUNT_ASIC_BUG = 41*4; | ||
546 | |||
547 | if (!(qc->flags & ATA_QCFLAG_DMAMAP)) | ||
548 | return; | ||
549 | |||
550 | WARN_ON(qc->__sg == NULL); | ||
551 | WARN_ON(qc->n_elem == 0 && qc->pad_len == 0); | ||
552 | |||
553 | idx = 0; | ||
554 | ata_for_each_sg(sg, qc) { | ||
555 | u32 addr, offset; | ||
556 | u32 sg_len, len; | ||
557 | |||
558 | /* determine if physical DMA addr spans 64K boundary. | ||
559 | * Note h/w doesn't support 64-bit, so we unconditionally | ||
560 | * truncate dma_addr_t to u32. | ||
561 | */ | ||
562 | addr = (u32) sg_dma_address(sg); | ||
563 | sg_len = sg_dma_len(sg); | ||
564 | |||
565 | while (sg_len) { | ||
566 | offset = addr & 0xffff; | ||
567 | len = sg_len; | ||
568 | if ((offset + sg_len) > 0x10000) | ||
569 | len = 0x10000 - offset; | ||
570 | |||
571 | ap->prd[idx].addr = cpu_to_le32(addr); | ||
572 | ap->prd[idx].flags_len = cpu_to_le32(len & 0xffff); | ||
573 | VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len); | ||
574 | |||
575 | idx++; | ||
576 | sg_len -= len; | ||
577 | addr += len; | ||
578 | } | ||
579 | } | ||
580 | |||
581 | if (idx) { | ||
582 | u32 len = le32_to_cpu(ap->prd[idx - 1].flags_len); | ||
583 | |||
584 | if (len > SG_COUNT_ASIC_BUG) { | ||
585 | u32 addr; | ||
586 | |||
587 | VPRINTK("Splitting last PRD.\n"); | ||
588 | |||
589 | addr = le32_to_cpu(ap->prd[idx - 1].addr); | ||
590 | ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG); | ||
591 | VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG); | ||
592 | |||
593 | addr = addr + len - SG_COUNT_ASIC_BUG; | ||
594 | len = SG_COUNT_ASIC_BUG; | ||
595 | ap->prd[idx].addr = cpu_to_le32(addr); | ||
596 | ap->prd[idx].flags_len = cpu_to_le32(len); | ||
597 | VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len); | ||
598 | |||
599 | idx++; | ||
600 | } | ||
601 | |||
602 | ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT); | ||
603 | } | ||
604 | } | ||
605 | |||
524 | static void pdc_qc_prep(struct ata_queued_cmd *qc) | 606 | static void pdc_qc_prep(struct ata_queued_cmd *qc) |
525 | { | 607 | { |
526 | struct pdc_port_priv *pp = qc->ap->private_data; | 608 | struct pdc_port_priv *pp = qc->ap->private_data; |
@@ -530,7 +612,7 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc) | |||
530 | 612 | ||
531 | switch (qc->tf.protocol) { | 613 | switch (qc->tf.protocol) { |
532 | case ATA_PROT_DMA: | 614 | case ATA_PROT_DMA: |
533 | ata_qc_prep(qc); | 615 | pdc_fill_sg(qc); |
534 | /* fall through */ | 616 | /* fall through */ |
535 | 617 | ||
536 | case ATA_PROT_NODATA: | 618 | case ATA_PROT_NODATA: |
@@ -546,11 +628,11 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc) | |||
546 | break; | 628 | break; |
547 | 629 | ||
548 | case ATA_PROT_ATAPI: | 630 | case ATA_PROT_ATAPI: |
549 | ata_qc_prep(qc); | 631 | pdc_fill_sg(qc); |
550 | break; | 632 | break; |
551 | 633 | ||
552 | case ATA_PROT_ATAPI_DMA: | 634 | case ATA_PROT_ATAPI_DMA: |
553 | ata_qc_prep(qc); | 635 | pdc_fill_sg(qc); |
554 | /*FALLTHROUGH*/ | 636 | /*FALLTHROUGH*/ |
555 | case ATA_PROT_ATAPI_NODATA: | 637 | case ATA_PROT_ATAPI_NODATA: |
556 | pdc_atapi_pkt(qc); | 638 | pdc_atapi_pkt(qc); |
@@ -695,19 +777,20 @@ static void pdc_irq_clear(struct ata_port *ap) | |||
695 | readl(mmio + PDC_INT_SEQMASK); | 777 | readl(mmio + PDC_INT_SEQMASK); |
696 | } | 778 | } |
697 | 779 | ||
698 | static inline int pdc_is_sataii_tx4(unsigned long flags) | 780 | static int pdc_is_sataii_tx4(unsigned long flags) |
699 | { | 781 | { |
700 | const unsigned long mask = PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS; | 782 | const unsigned long mask = PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS; |
701 | return (flags & mask) == mask; | 783 | return (flags & mask) == mask; |
702 | } | 784 | } |
703 | 785 | ||
704 | static inline unsigned int pdc_port_no_to_ata_no(unsigned int port_no, int is_sataii_tx4) | 786 | static unsigned int pdc_port_no_to_ata_no(unsigned int port_no, |
787 | int is_sataii_tx4) | ||
705 | { | 788 | { |
706 | static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2}; | 789 | static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2}; |
707 | return is_sataii_tx4 ? sataii_tx4_port_remap[port_no] : port_no; | 790 | return is_sataii_tx4 ? sataii_tx4_port_remap[port_no] : port_no; |
708 | } | 791 | } |
709 | 792 | ||
710 | static irqreturn_t pdc_interrupt (int irq, void *dev_instance) | 793 | static irqreturn_t pdc_interrupt(int irq, void *dev_instance) |
711 | { | 794 | { |
712 | struct ata_host *host = dev_instance; | 795 | struct ata_host *host = dev_instance; |
713 | struct ata_port *ap; | 796 | struct ata_port *ap; |
@@ -839,15 +922,16 @@ static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc) | |||
839 | 922 | ||
840 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) | 923 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
841 | { | 924 | { |
842 | WARN_ON (tf->protocol == ATA_PROT_DMA || | 925 | WARN_ON(tf->protocol == ATA_PROT_DMA || |
843 | tf->protocol == ATA_PROT_ATAPI_DMA); | 926 | tf->protocol == ATA_PROT_ATAPI_DMA); |
844 | ata_tf_load(ap, tf); | 927 | ata_tf_load(ap, tf); |
845 | } | 928 | } |
846 | 929 | ||
847 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) | 930 | static void pdc_exec_command_mmio(struct ata_port *ap, |
931 | const struct ata_taskfile *tf) | ||
848 | { | 932 | { |
849 | WARN_ON (tf->protocol == ATA_PROT_DMA || | 933 | WARN_ON(tf->protocol == ATA_PROT_DMA || |
850 | tf->protocol == ATA_PROT_ATAPI_DMA); | 934 | tf->protocol == ATA_PROT_ATAPI_DMA); |
851 | ata_exec_command(ap, tf); | 935 | ata_exec_command(ap, tf); |
852 | } | 936 | } |
853 | 937 | ||
@@ -870,8 +954,11 @@ static int pdc_check_atapi_dma(struct ata_queued_cmd *qc) | |||
870 | } | 954 | } |
871 | /* -45150 (FFFF4FA2) to -1 (FFFFFFFF) shall use PIO mode */ | 955 | /* -45150 (FFFF4FA2) to -1 (FFFFFFFF) shall use PIO mode */ |
872 | if (scsicmd[0] == WRITE_10) { | 956 | if (scsicmd[0] == WRITE_10) { |
873 | unsigned int lba; | 957 | unsigned int lba = |
874 | lba = (scsicmd[2] << 24) | (scsicmd[3] << 16) | (scsicmd[4] << 8) | scsicmd[5]; | 958 | (scsicmd[2] << 24) | |
959 | (scsicmd[3] << 16) | | ||
960 | (scsicmd[4] << 8) | | ||
961 | scsicmd[5]; | ||
875 | if (lba >= 0xFFFF4FA2) | 962 | if (lba >= 0xFFFF4FA2) |
876 | pio = 1; | 963 | pio = 1; |
877 | } | 964 | } |
@@ -956,7 +1043,8 @@ static void pdc_host_init(struct ata_host *host) | |||
956 | writel(tmp, mmio + PDC_SLEW_CTL); | 1043 | writel(tmp, mmio + PDC_SLEW_CTL); |
957 | } | 1044 | } |
958 | 1045 | ||
959 | static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 1046 | static int pdc_ata_init_one(struct pci_dev *pdev, |
1047 | const struct pci_device_id *ent) | ||
960 | { | 1048 | { |
961 | static int printed_version; | 1049 | static int printed_version; |
962 | const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; | 1050 | const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; |
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c index c4c4cd29eebb..2f1de6ec044c 100644 --- a/drivers/ata/sata_qstor.c +++ b/drivers/ata/sata_qstor.c | |||
@@ -103,7 +103,7 @@ enum { | |||
103 | QS_DMA_BOUNDARY = ~0UL | 103 | QS_DMA_BOUNDARY = ~0UL |
104 | }; | 104 | }; |
105 | 105 | ||
106 | typedef enum { qs_state_idle, qs_state_pkt, qs_state_mmio } qs_state_t; | 106 | typedef enum { qs_state_mmio, qs_state_pkt } qs_state_t; |
107 | 107 | ||
108 | struct qs_port_priv { | 108 | struct qs_port_priv { |
109 | u8 *pkt; | 109 | u8 *pkt; |
@@ -113,17 +113,18 @@ struct qs_port_priv { | |||
113 | 113 | ||
114 | static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); | 114 | static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); |
115 | static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); | 115 | static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); |
116 | static int qs_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 116 | static int qs_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
117 | static int qs_port_start(struct ata_port *ap); | 117 | static int qs_port_start(struct ata_port *ap); |
118 | static void qs_host_stop(struct ata_host *host); | 118 | static void qs_host_stop(struct ata_host *host); |
119 | static void qs_phy_reset(struct ata_port *ap); | ||
120 | static void qs_qc_prep(struct ata_queued_cmd *qc); | 119 | static void qs_qc_prep(struct ata_queued_cmd *qc); |
121 | static unsigned int qs_qc_issue(struct ata_queued_cmd *qc); | 120 | static unsigned int qs_qc_issue(struct ata_queued_cmd *qc); |
122 | static int qs_check_atapi_dma(struct ata_queued_cmd *qc); | 121 | static int qs_check_atapi_dma(struct ata_queued_cmd *qc); |
123 | static void qs_bmdma_stop(struct ata_queued_cmd *qc); | 122 | static void qs_bmdma_stop(struct ata_queued_cmd *qc); |
124 | static u8 qs_bmdma_status(struct ata_port *ap); | 123 | static u8 qs_bmdma_status(struct ata_port *ap); |
125 | static void qs_irq_clear(struct ata_port *ap); | 124 | static void qs_irq_clear(struct ata_port *ap); |
126 | static void qs_eng_timeout(struct ata_port *ap); | 125 | static void qs_freeze(struct ata_port *ap); |
126 | static void qs_thaw(struct ata_port *ap); | ||
127 | static void qs_error_handler(struct ata_port *ap); | ||
127 | 128 | ||
128 | static struct scsi_host_template qs_ata_sht = { | 129 | static struct scsi_host_template qs_ata_sht = { |
129 | .module = THIS_MODULE, | 130 | .module = THIS_MODULE, |
@@ -135,7 +136,6 @@ static struct scsi_host_template qs_ata_sht = { | |||
135 | .sg_tablesize = QS_MAX_PRD, | 136 | .sg_tablesize = QS_MAX_PRD, |
136 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | 137 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, |
137 | .emulated = ATA_SHT_EMULATED, | 138 | .emulated = ATA_SHT_EMULATED, |
138 | //FIXME .use_clustering = ATA_SHT_USE_CLUSTERING, | ||
139 | .use_clustering = ENABLE_CLUSTERING, | 139 | .use_clustering = ENABLE_CLUSTERING, |
140 | .proc_name = DRV_NAME, | 140 | .proc_name = DRV_NAME, |
141 | .dma_boundary = QS_DMA_BOUNDARY, | 141 | .dma_boundary = QS_DMA_BOUNDARY, |
@@ -151,11 +151,12 @@ static const struct ata_port_operations qs_ata_ops = { | |||
151 | .check_atapi_dma = qs_check_atapi_dma, | 151 | .check_atapi_dma = qs_check_atapi_dma, |
152 | .exec_command = ata_exec_command, | 152 | .exec_command = ata_exec_command, |
153 | .dev_select = ata_std_dev_select, | 153 | .dev_select = ata_std_dev_select, |
154 | .phy_reset = qs_phy_reset, | ||
155 | .qc_prep = qs_qc_prep, | 154 | .qc_prep = qs_qc_prep, |
156 | .qc_issue = qs_qc_issue, | 155 | .qc_issue = qs_qc_issue, |
157 | .data_xfer = ata_data_xfer, | 156 | .data_xfer = ata_data_xfer, |
158 | .eng_timeout = qs_eng_timeout, | 157 | .freeze = qs_freeze, |
158 | .thaw = qs_thaw, | ||
159 | .error_handler = qs_error_handler, | ||
159 | .irq_clear = qs_irq_clear, | 160 | .irq_clear = qs_irq_clear, |
160 | .irq_on = ata_irq_on, | 161 | .irq_on = ata_irq_on, |
161 | .scr_read = qs_scr_read, | 162 | .scr_read = qs_scr_read, |
@@ -170,8 +171,6 @@ static const struct ata_port_info qs_port_info[] = { | |||
170 | /* board_2068_idx */ | 171 | /* board_2068_idx */ |
171 | { | 172 | { |
172 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 173 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
173 | ATA_FLAG_SATA_RESET | | ||
174 | //FIXME ATA_FLAG_SRST | | ||
175 | ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING, | 174 | ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING, |
176 | .pio_mask = 0x10, /* pio4 */ | 175 | .pio_mask = 0x10, /* pio4 */ |
177 | .udma_mask = ATA_UDMA6, | 176 | .udma_mask = ATA_UDMA6, |
@@ -220,7 +219,9 @@ static void qs_irq_clear(struct ata_port *ap) | |||
220 | static inline void qs_enter_reg_mode(struct ata_port *ap) | 219 | static inline void qs_enter_reg_mode(struct ata_port *ap) |
221 | { | 220 | { |
222 | u8 __iomem *chan = qs_mmio_base(ap->host) + (ap->port_no * 0x4000); | 221 | u8 __iomem *chan = qs_mmio_base(ap->host) + (ap->port_no * 0x4000); |
222 | struct qs_port_priv *pp = ap->private_data; | ||
223 | 223 | ||
224 | pp->state = qs_state_mmio; | ||
224 | writeb(QS_CTR0_REG, chan + QS_CCT_CTR0); | 225 | writeb(QS_CTR0_REG, chan + QS_CCT_CTR0); |
225 | readb(chan + QS_CCT_CTR0); /* flush */ | 226 | readb(chan + QS_CCT_CTR0); /* flush */ |
226 | } | 227 | } |
@@ -234,23 +235,28 @@ static inline void qs_reset_channel_logic(struct ata_port *ap) | |||
234 | qs_enter_reg_mode(ap); | 235 | qs_enter_reg_mode(ap); |
235 | } | 236 | } |
236 | 237 | ||
237 | static void qs_phy_reset(struct ata_port *ap) | 238 | static void qs_freeze(struct ata_port *ap) |
238 | { | 239 | { |
239 | struct qs_port_priv *pp = ap->private_data; | 240 | u8 __iomem *mmio_base = qs_mmio_base(ap->host); |
240 | 241 | ||
241 | pp->state = qs_state_idle; | 242 | writeb(0, mmio_base + QS_HCT_CTRL); /* disable host interrupts */ |
242 | qs_reset_channel_logic(ap); | 243 | qs_enter_reg_mode(ap); |
243 | sata_phy_reset(ap); | ||
244 | } | 244 | } |
245 | 245 | ||
246 | static void qs_eng_timeout(struct ata_port *ap) | 246 | static void qs_thaw(struct ata_port *ap) |
247 | { | 247 | { |
248 | struct qs_port_priv *pp = ap->private_data; | 248 | u8 __iomem *mmio_base = qs_mmio_base(ap->host); |
249 | |||
250 | qs_enter_reg_mode(ap); | ||
251 | writeb(1, mmio_base + QS_HCT_CTRL); /* enable host interrupts */ | ||
252 | } | ||
253 | |||
254 | static int qs_prereset(struct ata_link *link, unsigned long deadline) | ||
255 | { | ||
256 | struct ata_port *ap = link->ap; | ||
249 | 257 | ||
250 | if (pp->state != qs_state_idle) /* healthy paranoia */ | ||
251 | pp->state = qs_state_mmio; | ||
252 | qs_reset_channel_logic(ap); | 258 | qs_reset_channel_logic(ap); |
253 | ata_eng_timeout(ap); | 259 | return ata_std_prereset(link, deadline); |
254 | } | 260 | } |
255 | 261 | ||
256 | static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) | 262 | static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) |
@@ -261,6 +267,13 @@ static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) | |||
261 | return 0; | 267 | return 0; |
262 | } | 268 | } |
263 | 269 | ||
270 | static void qs_error_handler(struct ata_port *ap) | ||
271 | { | ||
272 | qs_enter_reg_mode(ap); | ||
273 | ata_do_eh(ap, qs_prereset, ata_std_softreset, NULL, | ||
274 | ata_std_postreset); | ||
275 | } | ||
276 | |||
264 | static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) | 277 | static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) |
265 | { | 278 | { |
266 | if (sc_reg > SCR_CONTROL) | 279 | if (sc_reg > SCR_CONTROL) |
@@ -359,7 +372,6 @@ static unsigned int qs_qc_issue(struct ata_queued_cmd *qc) | |||
359 | 372 | ||
360 | switch (qc->tf.protocol) { | 373 | switch (qc->tf.protocol) { |
361 | case ATA_PROT_DMA: | 374 | case ATA_PROT_DMA: |
362 | |||
363 | pp->state = qs_state_pkt; | 375 | pp->state = qs_state_pkt; |
364 | qs_packet_start(qc); | 376 | qs_packet_start(qc); |
365 | return 0; | 377 | return 0; |
@@ -376,6 +388,26 @@ static unsigned int qs_qc_issue(struct ata_queued_cmd *qc) | |||
376 | return ata_qc_issue_prot(qc); | 388 | return ata_qc_issue_prot(qc); |
377 | } | 389 | } |
378 | 390 | ||
391 | static void qs_do_or_die(struct ata_queued_cmd *qc, u8 status) | ||
392 | { | ||
393 | qc->err_mask |= ac_err_mask(status); | ||
394 | |||
395 | if (!qc->err_mask) { | ||
396 | ata_qc_complete(qc); | ||
397 | } else { | ||
398 | struct ata_port *ap = qc->ap; | ||
399 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
400 | |||
401 | ata_ehi_clear_desc(ehi); | ||
402 | ata_ehi_push_desc(ehi, "status 0x%02X", status); | ||
403 | |||
404 | if (qc->err_mask == AC_ERR_DEV) | ||
405 | ata_port_abort(ap); | ||
406 | else | ||
407 | ata_port_freeze(ap); | ||
408 | } | ||
409 | } | ||
410 | |||
379 | static inline unsigned int qs_intr_pkt(struct ata_host *host) | 411 | static inline unsigned int qs_intr_pkt(struct ata_host *host) |
380 | { | 412 | { |
381 | unsigned int handled = 0; | 413 | unsigned int handled = 0; |
@@ -407,10 +439,8 @@ static inline unsigned int qs_intr_pkt(struct ata_host *host) | |||
407 | switch (sHST) { | 439 | switch (sHST) { |
408 | case 0: /* successful CPB */ | 440 | case 0: /* successful CPB */ |
409 | case 3: /* device error */ | 441 | case 3: /* device error */ |
410 | pp->state = qs_state_idle; | ||
411 | qs_enter_reg_mode(qc->ap); | 442 | qs_enter_reg_mode(qc->ap); |
412 | qc->err_mask |= ac_err_mask(sDST); | 443 | qs_do_or_die(qc, sDST); |
413 | ata_qc_complete(qc); | ||
414 | break; | 444 | break; |
415 | default: | 445 | default: |
416 | break; | 446 | break; |
@@ -432,25 +462,27 @@ static inline unsigned int qs_intr_mmio(struct ata_host *host) | |||
432 | if (ap && | 462 | if (ap && |
433 | !(ap->flags & ATA_FLAG_DISABLED)) { | 463 | !(ap->flags & ATA_FLAG_DISABLED)) { |
434 | struct ata_queued_cmd *qc; | 464 | struct ata_queued_cmd *qc; |
435 | struct qs_port_priv *pp = ap->private_data; | 465 | struct qs_port_priv *pp; |
436 | if (!pp || pp->state != qs_state_mmio) | ||
437 | continue; | ||
438 | qc = ata_qc_from_tag(ap, ap->link.active_tag); | 466 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
439 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { | 467 | if (!qc || !(qc->flags & ATA_QCFLAG_ACTIVE)) { |
440 | 468 | /* | |
441 | /* check main status, clearing INTRQ */ | 469 | * The qstor hardware generates spurious |
442 | u8 status = ata_check_status(ap); | 470 | * interrupts from time to time when switching |
443 | if ((status & ATA_BUSY)) | 471 | * in and out of packet mode. |
444 | continue; | 472 | * There's no obvious way to know if we're |
445 | DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", | 473 | * here now due to that, so just ack the irq |
446 | ap->print_id, qc->tf.protocol, status); | 474 | * and pretend we knew it was ours.. (ugh). |
447 | 475 | * This does not affect packet mode. | |
448 | /* complete taskfile transaction */ | 476 | */ |
449 | pp->state = qs_state_idle; | 477 | ata_check_status(ap); |
450 | qc->err_mask |= ac_err_mask(status); | ||
451 | ata_qc_complete(qc); | ||
452 | handled = 1; | 478 | handled = 1; |
479 | continue; | ||
453 | } | 480 | } |
481 | pp = ap->private_data; | ||
482 | if (!pp || pp->state != qs_state_mmio) | ||
483 | continue; | ||
484 | if (!(qc->tf.flags & ATA_TFLAG_POLLING)) | ||
485 | handled |= ata_host_intr(ap, qc); | ||
454 | } | 486 | } |
455 | } | 487 | } |
456 | return handled; | 488 | return handled; |
@@ -460,12 +492,13 @@ static irqreturn_t qs_intr(int irq, void *dev_instance) | |||
460 | { | 492 | { |
461 | struct ata_host *host = dev_instance; | 493 | struct ata_host *host = dev_instance; |
462 | unsigned int handled = 0; | 494 | unsigned int handled = 0; |
495 | unsigned long flags; | ||
463 | 496 | ||
464 | VPRINTK("ENTER\n"); | 497 | VPRINTK("ENTER\n"); |
465 | 498 | ||
466 | spin_lock(&host->lock); | 499 | spin_lock_irqsave(&host->lock, flags); |
467 | handled = qs_intr_pkt(host) | qs_intr_mmio(host); | 500 | handled = qs_intr_pkt(host) | qs_intr_mmio(host); |
468 | spin_unlock(&host->lock); | 501 | spin_unlock_irqrestore(&host->lock, flags); |
469 | 502 | ||
470 | VPRINTK("EXIT\n"); | 503 | VPRINTK("EXIT\n"); |
471 | 504 | ||
@@ -502,7 +535,6 @@ static int qs_port_start(struct ata_port *ap) | |||
502 | rc = ata_port_start(ap); | 535 | rc = ata_port_start(ap); |
503 | if (rc) | 536 | if (rc) |
504 | return rc; | 537 | return rc; |
505 | qs_enter_reg_mode(ap); | ||
506 | pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); | 538 | pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); |
507 | if (!pp) | 539 | if (!pp) |
508 | return -ENOMEM; | 540 | return -ENOMEM; |
@@ -513,6 +545,7 @@ static int qs_port_start(struct ata_port *ap) | |||
513 | memset(pp->pkt, 0, QS_PKT_BYTES); | 545 | memset(pp->pkt, 0, QS_PKT_BYTES); |
514 | ap->private_data = pp; | 546 | ap->private_data = pp; |
515 | 547 | ||
548 | qs_enter_reg_mode(ap); | ||
516 | addr = (u64)pp->pkt_dma; | 549 | addr = (u64)pp->pkt_dma; |
517 | writel((u32) addr, chan + QS_CCF_CPBA); | 550 | writel((u32) addr, chan + QS_CCF_CPBA); |
518 | writel((u32)(addr >> 32), chan + QS_CCF_CPBA + 4); | 551 | writel((u32)(addr >> 32), chan + QS_CCF_CPBA + 4); |
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index ea3a0ab7e027..4e6e381279cc 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -111,7 +111,7 @@ enum { | |||
111 | SIL_QUIRK_UDMA5MAX = (1 << 1), | 111 | SIL_QUIRK_UDMA5MAX = (1 << 1), |
112 | }; | 112 | }; |
113 | 113 | ||
114 | static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 114 | static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
115 | #ifdef CONFIG_PM | 115 | #ifdef CONFIG_PM |
116 | static int sil_pci_device_resume(struct pci_dev *pdev); | 116 | static int sil_pci_device_resume(struct pci_dev *pdev); |
117 | #endif | 117 | #endif |
@@ -138,7 +138,7 @@ static const struct pci_device_id sil_pci_tbl[] = { | |||
138 | 138 | ||
139 | /* TODO firmware versions should be added - eric */ | 139 | /* TODO firmware versions should be added - eric */ |
140 | static const struct sil_drivelist { | 140 | static const struct sil_drivelist { |
141 | const char * product; | 141 | const char *product; |
142 | unsigned int quirk; | 142 | unsigned int quirk; |
143 | } sil_blacklist [] = { | 143 | } sil_blacklist [] = { |
144 | { "ST320012AS", SIL_QUIRK_MOD15WRITE }, | 144 | { "ST320012AS", SIL_QUIRK_MOD15WRITE }, |
@@ -279,7 +279,7 @@ MODULE_LICENSE("GPL"); | |||
279 | MODULE_DEVICE_TABLE(pci, sil_pci_tbl); | 279 | MODULE_DEVICE_TABLE(pci, sil_pci_tbl); |
280 | MODULE_VERSION(DRV_VERSION); | 280 | MODULE_VERSION(DRV_VERSION); |
281 | 281 | ||
282 | static int slow_down = 0; | 282 | static int slow_down; |
283 | module_param(slow_down, int, 0444); | 283 | module_param(slow_down, int, 0444); |
284 | MODULE_PARM_DESC(slow_down, "Sledgehammer used to work around random problems, by limiting commands to 15 sectors (0=off, 1=on)"); | 284 | MODULE_PARM_DESC(slow_down, "Sledgehammer used to work around random problems, by limiting commands to 15 sectors (0=off, 1=on)"); |
285 | 285 | ||
@@ -332,7 +332,8 @@ static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed) | |||
332 | return 0; | 332 | return 0; |
333 | } | 333 | } |
334 | 334 | ||
335 | static inline void __iomem *sil_scr_addr(struct ata_port *ap, unsigned int sc_reg) | 335 | static inline void __iomem *sil_scr_addr(struct ata_port *ap, |
336 | unsigned int sc_reg) | ||
336 | { | 337 | { |
337 | void __iomem *offset = ap->ioaddr.scr_addr; | 338 | void __iomem *offset = ap->ioaddr.scr_addr; |
338 | 339 | ||
@@ -643,7 +644,7 @@ static void sil_init_controller(struct ata_host *host) | |||
643 | } | 644 | } |
644 | } | 645 | } |
645 | 646 | ||
646 | static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 647 | static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
647 | { | 648 | { |
648 | static int printed_version; | 649 | static int printed_version; |
649 | int board_id = ent->driver_data; | 650 | int board_id = ent->driver_data; |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 26ebffc10f3e..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 { |
@@ -265,11 +280,11 @@ static struct sil24_cerr_info { | |||
265 | unsigned int err_mask, action; | 280 | unsigned int err_mask, action; |
266 | const char *desc; | 281 | const char *desc; |
267 | } sil24_cerr_db[] = { | 282 | } sil24_cerr_db[] = { |
268 | [0] = { AC_ERR_DEV, ATA_EH_REVALIDATE, | 283 | [0] = { AC_ERR_DEV, 0, |
269 | "device error" }, | 284 | "device error" }, |
270 | [PORT_CERR_DEV] = { AC_ERR_DEV, ATA_EH_REVALIDATE, | 285 | [PORT_CERR_DEV] = { AC_ERR_DEV, 0, |
271 | "device error via D2H FIS" }, | 286 | "device error via D2H FIS" }, |
272 | [PORT_CERR_SDB] = { AC_ERR_DEV, ATA_EH_REVALIDATE, | 287 | [PORT_CERR_SDB] = { AC_ERR_DEV, 0, |
273 | "device error via SDB FIS" }, | 288 | "device error via SDB FIS" }, |
274 | [PORT_CERR_DATA] = { AC_ERR_ATA_BUS, ATA_EH_SOFTRESET, | 289 | [PORT_CERR_DATA] = { AC_ERR_ATA_BUS, ATA_EH_SOFTRESET, |
275 | "error in data FIS" }, | 290 | "error in data FIS" }, |
@@ -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, |
@@ -674,7 +689,7 @@ static int sil24_do_softreset(struct ata_link *link, unsigned int *class, | |||
674 | 689 | ||
675 | /* put the port into known state */ | 690 | /* put the port into known state */ |
676 | if (sil24_init_port(ap)) { | 691 | if (sil24_init_port(ap)) { |
677 | reason ="port not ready"; | 692 | reason = "port not ready"; |
678 | goto err; | 693 | goto err; |
679 | } | 694 | } |
680 | 695 | ||
@@ -756,7 +771,8 @@ static int sil24_hardreset(struct ata_link *link, unsigned int *class, | |||
756 | 771 | ||
757 | writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT); | 772 | writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT); |
758 | tmp = ata_wait_register(port + PORT_CTRL_STAT, | 773 | tmp = ata_wait_register(port + PORT_CTRL_STAT, |
759 | PORT_CS_DEV_RST, PORT_CS_DEV_RST, 10, tout_msec); | 774 | PORT_CS_DEV_RST, PORT_CS_DEV_RST, 10, |
775 | tout_msec); | ||
760 | 776 | ||
761 | /* SStatus oscillates between zero and valid status after | 777 | /* SStatus oscillates between zero and valid status after |
762 | * DEV_RST, debounce it. | 778 | * DEV_RST, debounce it. |
@@ -1270,7 +1286,7 @@ static void sil24_init_controller(struct ata_host *host) | |||
1270 | PORT_CS_PORT_RST, 10, 100); | 1286 | PORT_CS_PORT_RST, 10, 100); |
1271 | if (tmp & PORT_CS_PORT_RST) | 1287 | if (tmp & PORT_CS_PORT_RST) |
1272 | dev_printk(KERN_ERR, host->dev, | 1288 | dev_printk(KERN_ERR, host->dev, |
1273 | "failed to clear port RST\n"); | 1289 | "failed to clear port RST\n"); |
1274 | } | 1290 | } |
1275 | 1291 | ||
1276 | /* configure port */ | 1292 | /* configure port */ |
@@ -1283,7 +1299,8 @@ static void sil24_init_controller(struct ata_host *host) | |||
1283 | 1299 | ||
1284 | 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) |
1285 | { | 1301 | { |
1286 | static int printed_version = 0; | 1302 | extern int __MARKER__sil24_cmd_block_is_sized_wrongly; |
1303 | static int printed_version; | ||
1287 | struct ata_port_info pi = sil24_port_info[ent->driver_data]; | 1304 | struct ata_port_info pi = sil24_port_info[ent->driver_data]; |
1288 | const struct ata_port_info *ppi[] = { &pi, NULL }; | 1305 | const struct ata_port_info *ppi[] = { &pi, NULL }; |
1289 | void __iomem * const *iomap; | 1306 | void __iomem * const *iomap; |
@@ -1291,6 +1308,10 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1291 | int i, rc; | 1308 | int i, rc; |
1292 | u32 tmp; | 1309 | u32 tmp; |
1293 | 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 | |||
1294 | if (!printed_version++) | 1315 | if (!printed_version++) |
1295 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); | 1316 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
1296 | 1317 | ||
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c index f147dc7bf464..a01260a56432 100644 --- a/drivers/ata/sata_sis.c +++ b/drivers/ata/sata_sis.c | |||
@@ -63,17 +63,17 @@ enum { | |||
63 | GENCTL_IOMAPPED_SCR = (1 << 26), /* if set, SCRs are in IO space */ | 63 | GENCTL_IOMAPPED_SCR = (1 << 26), /* if set, SCRs are in IO space */ |
64 | }; | 64 | }; |
65 | 65 | ||
66 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 66 | static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
67 | static int sis_scr_read (struct ata_port *ap, unsigned int sc_reg, u32 *val); | 67 | static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); |
68 | static int sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 68 | static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); |
69 | 69 | ||
70 | static const struct pci_device_id sis_pci_tbl[] = { | 70 | static const struct pci_device_id sis_pci_tbl[] = { |
71 | { PCI_VDEVICE(SI, 0x0180), sis_180 }, /* SiS 964/180 */ | 71 | { PCI_VDEVICE(SI, 0x0180), sis_180 }, /* SiS 964/180 */ |
72 | { PCI_VDEVICE(SI, 0x0181), sis_180 }, /* SiS 964/180 */ | 72 | { PCI_VDEVICE(SI, 0x0181), sis_180 }, /* SiS 964/180 */ |
73 | { PCI_VDEVICE(SI, 0x0182), sis_180 }, /* SiS 965/965L */ | 73 | { PCI_VDEVICE(SI, 0x0182), sis_180 }, /* SiS 965/965L */ |
74 | { PCI_VDEVICE(SI, 0x0183), sis_180 }, /* SiS 965/965L */ | 74 | { PCI_VDEVICE(SI, 0x0183), sis_180 }, /* SiS 965/965L */ |
75 | { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/680 */ | 75 | { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/680 */ |
76 | { PCI_VDEVICE(SI, 0x1183), sis_180 }, /* SiS 966/966L/968/680 */ | 76 | { PCI_VDEVICE(SI, 0x1183), sis_180 }, /* SiS 966/966L/968/680 */ |
77 | 77 | ||
78 | { } /* terminate list */ | 78 | { } /* terminate list */ |
79 | }; | 79 | }; |
@@ -149,24 +149,24 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg) | |||
149 | 149 | ||
150 | if (ap->port_no) { | 150 | if (ap->port_no) { |
151 | switch (pdev->device) { | 151 | switch (pdev->device) { |
152 | case 0x0180: | 152 | case 0x0180: |
153 | case 0x0181: | 153 | case 0x0181: |
154 | pci_read_config_byte(pdev, SIS_PMR, &pmr); | 154 | pci_read_config_byte(pdev, SIS_PMR, &pmr); |
155 | if ((pmr & SIS_PMR_COMBINED) == 0) | 155 | if ((pmr & SIS_PMR_COMBINED) == 0) |
156 | addr += SIS180_SATA1_OFS; | 156 | addr += SIS180_SATA1_OFS; |
157 | break; | 157 | break; |
158 | 158 | ||
159 | case 0x0182: | 159 | case 0x0182: |
160 | case 0x0183: | 160 | case 0x0183: |
161 | case 0x1182: | 161 | case 0x1182: |
162 | addr += SIS182_SATA1_OFS; | 162 | addr += SIS182_SATA1_OFS; |
163 | break; | 163 | break; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | return addr; | 166 | return addr; |
167 | } | 167 | } |
168 | 168 | ||
169 | static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg, u32 *val) | 169 | static u32 sis_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) |
170 | { | 170 | { |
171 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 171 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
172 | unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); | 172 | unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); |
@@ -190,7 +190,7 @@ static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg, u32 *val) | |||
190 | return 0; | 190 | return 0; |
191 | } | 191 | } |
192 | 192 | ||
193 | static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | 193 | static void sis_scr_cfg_write(struct ata_port *ap, unsigned int sc_reg, u32 val) |
194 | { | 194 | { |
195 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 195 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
196 | unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); | 196 | unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); |
@@ -253,7 +253,7 @@ static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) | |||
253 | return 0; | 253 | return 0; |
254 | } | 254 | } |
255 | 255 | ||
256 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 256 | static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
257 | { | 257 | { |
258 | static int printed_version; | 258 | static int printed_version; |
259 | struct ata_port_info pi = sis_port_info; | 259 | struct ata_port_info pi = sis_port_info; |
@@ -309,29 +309,33 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
309 | } else { | 309 | } else { |
310 | dev_printk(KERN_INFO, &pdev->dev, | 310 | dev_printk(KERN_INFO, &pdev->dev, |
311 | "Detected SiS 180/181 chipset in combined mode\n"); | 311 | "Detected SiS 180/181 chipset in combined mode\n"); |
312 | port2_start=0; | 312 | port2_start = 0; |
313 | pi.flags |= ATA_FLAG_SLAVE_POSS; | 313 | pi.flags |= ATA_FLAG_SLAVE_POSS; |
314 | } | 314 | } |
315 | break; | 315 | break; |
316 | 316 | ||
317 | case 0x0182: | 317 | case 0x0182: |
318 | case 0x0183: | 318 | case 0x0183: |
319 | pci_read_config_dword ( pdev, 0x6C, &val); | 319 | pci_read_config_dword(pdev, 0x6C, &val); |
320 | if (val & (1L << 31)) { | 320 | if (val & (1L << 31)) { |
321 | dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 182/965 chipset\n"); | 321 | dev_printk(KERN_INFO, &pdev->dev, |
322 | "Detected SiS 182/965 chipset\n"); | ||
322 | pi.flags |= ATA_FLAG_SLAVE_POSS; | 323 | pi.flags |= ATA_FLAG_SLAVE_POSS; |
323 | } else { | 324 | } else { |
324 | dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 182/965L chipset\n"); | 325 | dev_printk(KERN_INFO, &pdev->dev, |
326 | "Detected SiS 182/965L chipset\n"); | ||
325 | } | 327 | } |
326 | break; | 328 | break; |
327 | 329 | ||
328 | case 0x1182: | 330 | case 0x1182: |
329 | dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/966/680 SATA controller\n"); | 331 | dev_printk(KERN_INFO, &pdev->dev, |
332 | "Detected SiS 1182/966/680 SATA controller\n"); | ||
330 | pi.flags |= ATA_FLAG_SLAVE_POSS; | 333 | pi.flags |= ATA_FLAG_SLAVE_POSS; |
331 | break; | 334 | break; |
332 | 335 | ||
333 | case 0x1183: | 336 | case 0x1183: |
334 | dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1183/966/966L/968/680 controller in PATA mode\n"); | 337 | dev_printk(KERN_INFO, &pdev->dev, |
338 | "Detected SiS 1183/966/966L/968/680 controller in PATA mode\n"); | ||
335 | ppi[0] = &sis_info133_for_sata; | 339 | ppi[0] = &sis_info133_for_sata; |
336 | ppi[1] = &sis_info133_for_sata; | 340 | ppi[1] = &sis_info133_for_sata; |
337 | break; | 341 | break; |
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c index 12d613c48c19..69f651e0bc98 100644 --- a/drivers/ata/sata_svw.c +++ b/drivers/ata/sata_svw.c | |||
@@ -182,7 +182,7 @@ static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | |||
182 | tf->hob_lbal = lbal >> 8; | 182 | tf->hob_lbal = lbal >> 8; |
183 | tf->hob_lbam = lbam >> 8; | 183 | tf->hob_lbam = lbam >> 8; |
184 | tf->hob_lbah = lbah >> 8; | 184 | tf->hob_lbah = lbah >> 8; |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | /** | 188 | /** |
@@ -193,7 +193,7 @@ static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | |||
193 | * spin_lock_irqsave(host lock) | 193 | * spin_lock_irqsave(host lock) |
194 | */ | 194 | */ |
195 | 195 | ||
196 | static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc) | 196 | static void k2_bmdma_setup_mmio(struct ata_queued_cmd *qc) |
197 | { | 197 | { |
198 | struct ata_port *ap = qc->ap; | 198 | struct ata_port *ap = qc->ap; |
199 | unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); | 199 | unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); |
@@ -224,7 +224,7 @@ static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc) | |||
224 | * spin_lock_irqsave(host lock) | 224 | * spin_lock_irqsave(host lock) |
225 | */ | 225 | */ |
226 | 226 | ||
227 | static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc) | 227 | static void k2_bmdma_start_mmio(struct ata_queued_cmd *qc) |
228 | { | 228 | { |
229 | struct ata_port *ap = qc->ap; | 229 | struct ata_port *ap = qc->ap; |
230 | void __iomem *mmio = ap->ioaddr.bmdma_addr; | 230 | void __iomem *mmio = ap->ioaddr.bmdma_addr; |
@@ -255,7 +255,7 @@ static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc) | |||
255 | 255 | ||
256 | static u8 k2_stat_check_status(struct ata_port *ap) | 256 | static u8 k2_stat_check_status(struct ata_port *ap) |
257 | { | 257 | { |
258 | return readl(ap->ioaddr.status_addr); | 258 | return readl(ap->ioaddr.status_addr); |
259 | } | 259 | } |
260 | 260 | ||
261 | #ifdef CONFIG_PPC_OF | 261 | #ifdef CONFIG_PPC_OF |
@@ -395,7 +395,7 @@ static void k2_sata_setup_port(struct ata_ioports *port, void __iomem *base) | |||
395 | } | 395 | } |
396 | 396 | ||
397 | 397 | ||
398 | static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 398 | static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
399 | { | 399 | { |
400 | static int printed_version; | 400 | static int printed_version; |
401 | const struct ata_port_info *ppi[] = | 401 | const struct ata_port_info *ppi[] = |
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index b6026bceccd1..4d857185f33b 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c | |||
@@ -212,9 +212,9 @@ struct pdc_host_priv { | |||
212 | }; | 212 | }; |
213 | 213 | ||
214 | 214 | ||
215 | static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 215 | static int pdc_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
216 | static void pdc_eng_timeout(struct ata_port *ap); | 216 | static void pdc_eng_timeout(struct ata_port *ap); |
217 | static void pdc_20621_phy_reset (struct ata_port *ap); | 217 | static void pdc_20621_phy_reset(struct ata_port *ap); |
218 | static int pdc_port_start(struct ata_port *ap); | 218 | static int pdc_port_start(struct ata_port *ap); |
219 | static void pdc20621_qc_prep(struct ata_queued_cmd *qc); | 219 | static void pdc20621_qc_prep(struct ata_queued_cmd *qc); |
220 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); | 220 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
@@ -320,16 +320,16 @@ static int pdc_port_start(struct ata_port *ap) | |||
320 | return 0; | 320 | return 0; |
321 | } | 321 | } |
322 | 322 | ||
323 | static void pdc_20621_phy_reset (struct ata_port *ap) | 323 | static void pdc_20621_phy_reset(struct ata_port *ap) |
324 | { | 324 | { |
325 | VPRINTK("ENTER\n"); | 325 | VPRINTK("ENTER\n"); |
326 | ap->cbl = ATA_CBL_SATA; | 326 | ap->cbl = ATA_CBL_SATA; |
327 | ata_port_probe(ap); | 327 | ata_port_probe(ap); |
328 | ata_bus_reset(ap); | 328 | ata_bus_reset(ap); |
329 | } | 329 | } |
330 | 330 | ||
331 | static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf, | 331 | static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf, |
332 | unsigned int portno, | 332 | unsigned int portno, |
333 | unsigned int total_len) | 333 | unsigned int total_len) |
334 | { | 334 | { |
335 | u32 addr; | 335 | u32 addr; |
@@ -351,7 +351,7 @@ static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf, | |||
351 | } | 351 | } |
352 | 352 | ||
353 | static inline void pdc20621_host_sg(struct ata_taskfile *tf, u8 *buf, | 353 | static inline void pdc20621_host_sg(struct ata_taskfile *tf, u8 *buf, |
354 | unsigned int portno, | 354 | unsigned int portno, |
355 | unsigned int total_len) | 355 | unsigned int total_len) |
356 | { | 356 | { |
357 | u32 addr; | 357 | u32 addr; |
@@ -711,8 +711,8 @@ static unsigned int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc) | |||
711 | return ata_qc_issue_prot(qc); | 711 | return ata_qc_issue_prot(qc); |
712 | } | 712 | } |
713 | 713 | ||
714 | static inline unsigned int pdc20621_host_intr( struct ata_port *ap, | 714 | static inline unsigned int pdc20621_host_intr(struct ata_port *ap, |
715 | struct ata_queued_cmd *qc, | 715 | struct ata_queued_cmd *qc, |
716 | unsigned int doing_hdma, | 716 | unsigned int doing_hdma, |
717 | void __iomem *mmio) | 717 | void __iomem *mmio) |
718 | { | 718 | { |
@@ -803,7 +803,7 @@ static void pdc20621_irq_clear(struct ata_port *ap) | |||
803 | readl(mmio + PDC_20621_SEQMASK); | 803 | readl(mmio + PDC_20621_SEQMASK); |
804 | } | 804 | } |
805 | 805 | ||
806 | static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance) | 806 | static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance) |
807 | { | 807 | { |
808 | struct ata_host *host = dev_instance; | 808 | struct ata_host *host = dev_instance; |
809 | struct ata_port *ap; | 809 | struct ata_port *ap; |
@@ -836,9 +836,9 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance) | |||
836 | return IRQ_NONE; | 836 | return IRQ_NONE; |
837 | } | 837 | } |
838 | 838 | ||
839 | spin_lock(&host->lock); | 839 | spin_lock(&host->lock); |
840 | 840 | ||
841 | for (i = 1; i < 9; i++) { | 841 | for (i = 1; i < 9; i++) { |
842 | port_no = i - 1; | 842 | port_no = i - 1; |
843 | if (port_no > 3) | 843 | if (port_no > 3) |
844 | port_no -= 4; | 844 | port_no -= 4; |
@@ -859,7 +859,7 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance) | |||
859 | } | 859 | } |
860 | } | 860 | } |
861 | 861 | ||
862 | spin_unlock(&host->lock); | 862 | spin_unlock(&host->lock); |
863 | 863 | ||
864 | VPRINTK("mask == 0x%x\n", mask); | 864 | VPRINTK("mask == 0x%x\n", mask); |
865 | 865 | ||
@@ -906,16 +906,16 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
906 | 906 | ||
907 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) | 907 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
908 | { | 908 | { |
909 | WARN_ON (tf->protocol == ATA_PROT_DMA || | 909 | WARN_ON(tf->protocol == ATA_PROT_DMA || |
910 | tf->protocol == ATA_PROT_NODATA); | 910 | tf->protocol == ATA_PROT_NODATA); |
911 | ata_tf_load(ap, tf); | 911 | ata_tf_load(ap, tf); |
912 | } | 912 | } |
913 | 913 | ||
914 | 914 | ||
915 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) | 915 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
916 | { | 916 | { |
917 | WARN_ON (tf->protocol == ATA_PROT_DMA || | 917 | WARN_ON(tf->protocol == ATA_PROT_DMA || |
918 | tf->protocol == ATA_PROT_NODATA); | 918 | tf->protocol == ATA_PROT_NODATA); |
919 | ata_exec_command(ap, tf); | 919 | ata_exec_command(ap, tf); |
920 | } | 920 | } |
921 | 921 | ||
@@ -953,7 +953,7 @@ static void pdc20621_get_from_dimm(struct ata_host *host, void *psource, | |||
953 | mmio += PDC_CHIP0_OFS; | 953 | mmio += PDC_CHIP0_OFS; |
954 | 954 | ||
955 | page_mask = 0x00; | 955 | page_mask = 0x00; |
956 | window_size = 0x2000 * 4; /* 32K byte uchar size */ | 956 | window_size = 0x2000 * 4; /* 32K byte uchar size */ |
957 | idx = (u16) (offset / window_size); | 957 | idx = (u16) (offset / window_size); |
958 | 958 | ||
959 | writel(0x01, mmio + PDC_GENERAL_CTLR); | 959 | writel(0x01, mmio + PDC_GENERAL_CTLR); |
@@ -979,7 +979,7 @@ static void pdc20621_get_from_dimm(struct ata_host *host, void *psource, | |||
979 | window_size / 4); | 979 | window_size / 4); |
980 | psource += window_size; | 980 | psource += window_size; |
981 | size -= window_size; | 981 | size -= window_size; |
982 | idx ++; | 982 | idx++; |
983 | } | 983 | } |
984 | 984 | ||
985 | if (size) { | 985 | if (size) { |
@@ -1008,7 +1008,7 @@ static void pdc20621_put_to_dimm(struct ata_host *host, void *psource, | |||
1008 | mmio += PDC_CHIP0_OFS; | 1008 | mmio += PDC_CHIP0_OFS; |
1009 | 1009 | ||
1010 | page_mask = 0x00; | 1010 | page_mask = 0x00; |
1011 | window_size = 0x2000 * 4; /* 32K byte uchar size */ | 1011 | window_size = 0x2000 * 4; /* 32K byte uchar size */ |
1012 | idx = (u16) (offset / window_size); | 1012 | idx = (u16) (offset / window_size); |
1013 | 1013 | ||
1014 | writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); | 1014 | writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); |
@@ -1031,7 +1031,7 @@ static void pdc20621_put_to_dimm(struct ata_host *host, void *psource, | |||
1031 | readl(mmio + PDC_GENERAL_CTLR); | 1031 | readl(mmio + PDC_GENERAL_CTLR); |
1032 | psource += window_size; | 1032 | psource += window_size; |
1033 | size -= window_size; | 1033 | size -= window_size; |
1034 | idx ++; | 1034 | idx++; |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | if (size) { | 1037 | if (size) { |
@@ -1050,7 +1050,7 @@ static unsigned int pdc20621_i2c_read(struct ata_host *host, u32 device, | |||
1050 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; | 1050 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; |
1051 | u32 i2creg = 0; | 1051 | u32 i2creg = 0; |
1052 | u32 status; | 1052 | u32 status; |
1053 | u32 count =0; | 1053 | u32 count = 0; |
1054 | 1054 | ||
1055 | /* hard-code chip #0 */ | 1055 | /* hard-code chip #0 */ |
1056 | mmio += PDC_CHIP0_OFS; | 1056 | mmio += PDC_CHIP0_OFS; |
@@ -1082,21 +1082,21 @@ static unsigned int pdc20621_i2c_read(struct ata_host *host, u32 device, | |||
1082 | 1082 | ||
1083 | static int pdc20621_detect_dimm(struct ata_host *host) | 1083 | static int pdc20621_detect_dimm(struct ata_host *host) |
1084 | { | 1084 | { |
1085 | u32 data=0 ; | 1085 | u32 data = 0; |
1086 | if (pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, | 1086 | if (pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, |
1087 | PDC_DIMM_SPD_SYSTEM_FREQ, &data)) { | 1087 | PDC_DIMM_SPD_SYSTEM_FREQ, &data)) { |
1088 | if (data == 100) | 1088 | if (data == 100) |
1089 | return 100; | 1089 | return 100; |
1090 | } else | 1090 | } else |
1091 | return 0; | 1091 | return 0; |
1092 | 1092 | ||
1093 | if (pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, 9, &data)) { | 1093 | if (pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, 9, &data)) { |
1094 | if(data <= 0x75) | 1094 | if (data <= 0x75) |
1095 | return 133; | 1095 | return 133; |
1096 | } else | 1096 | } else |
1097 | return 0; | 1097 | return 0; |
1098 | 1098 | ||
1099 | return 0; | 1099 | return 0; |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | 1102 | ||
@@ -1104,8 +1104,8 @@ static int pdc20621_prog_dimm0(struct ata_host *host) | |||
1104 | { | 1104 | { |
1105 | u32 spd0[50]; | 1105 | u32 spd0[50]; |
1106 | u32 data = 0; | 1106 | u32 data = 0; |
1107 | int size, i; | 1107 | int size, i; |
1108 | u8 bdimmsize; | 1108 | u8 bdimmsize; |
1109 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; | 1109 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; |
1110 | static const struct { | 1110 | static const struct { |
1111 | unsigned int reg; | 1111 | unsigned int reg; |
@@ -1128,40 +1128,40 @@ static int pdc20621_prog_dimm0(struct ata_host *host) | |||
1128 | /* hard-code chip #0 */ | 1128 | /* hard-code chip #0 */ |
1129 | mmio += PDC_CHIP0_OFS; | 1129 | mmio += PDC_CHIP0_OFS; |
1130 | 1130 | ||
1131 | for(i=0; i<ARRAY_SIZE(pdc_i2c_read_data); i++) | 1131 | for (i = 0; i < ARRAY_SIZE(pdc_i2c_read_data); i++) |
1132 | pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, | 1132 | pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, |
1133 | pdc_i2c_read_data[i].reg, | 1133 | pdc_i2c_read_data[i].reg, |
1134 | &spd0[pdc_i2c_read_data[i].ofs]); | 1134 | &spd0[pdc_i2c_read_data[i].ofs]); |
1135 | 1135 | ||
1136 | data |= (spd0[4] - 8) | ((spd0[21] != 0) << 3) | ((spd0[3]-11) << 4); | 1136 | data |= (spd0[4] - 8) | ((spd0[21] != 0) << 3) | ((spd0[3]-11) << 4); |
1137 | data |= ((spd0[17] / 4) << 6) | ((spd0[5] / 2) << 7) | | 1137 | data |= ((spd0[17] / 4) << 6) | ((spd0[5] / 2) << 7) | |
1138 | ((((spd0[27] + 9) / 10) - 1) << 8) ; | 1138 | ((((spd0[27] + 9) / 10) - 1) << 8) ; |
1139 | data |= (((((spd0[29] > spd0[28]) | 1139 | data |= (((((spd0[29] > spd0[28]) |
1140 | ? spd0[29] : spd0[28]) + 9) / 10) - 1) << 10; | 1140 | ? spd0[29] : spd0[28]) + 9) / 10) - 1) << 10; |
1141 | data |= ((spd0[30] - spd0[29] + 9) / 10 - 2) << 12; | 1141 | data |= ((spd0[30] - spd0[29] + 9) / 10 - 2) << 12; |
1142 | 1142 | ||
1143 | if (spd0[18] & 0x08) | 1143 | if (spd0[18] & 0x08) |
1144 | data |= ((0x03) << 14); | 1144 | data |= ((0x03) << 14); |
1145 | else if (spd0[18] & 0x04) | 1145 | else if (spd0[18] & 0x04) |
1146 | data |= ((0x02) << 14); | 1146 | data |= ((0x02) << 14); |
1147 | else if (spd0[18] & 0x01) | 1147 | else if (spd0[18] & 0x01) |
1148 | data |= ((0x01) << 14); | 1148 | data |= ((0x01) << 14); |
1149 | else | 1149 | else |
1150 | data |= (0 << 14); | 1150 | data |= (0 << 14); |
1151 | 1151 | ||
1152 | /* | 1152 | /* |
1153 | Calculate the size of bDIMMSize (power of 2) and | 1153 | Calculate the size of bDIMMSize (power of 2) and |
1154 | merge the DIMM size by program start/end address. | 1154 | merge the DIMM size by program start/end address. |
1155 | */ | 1155 | */ |
1156 | 1156 | ||
1157 | bdimmsize = spd0[4] + (spd0[5] / 2) + spd0[3] + (spd0[17] / 2) + 3; | 1157 | bdimmsize = spd0[4] + (spd0[5] / 2) + spd0[3] + (spd0[17] / 2) + 3; |
1158 | size = (1 << bdimmsize) >> 20; /* size = xxx(MB) */ | 1158 | size = (1 << bdimmsize) >> 20; /* size = xxx(MB) */ |
1159 | data |= (((size / 16) - 1) << 16); | 1159 | data |= (((size / 16) - 1) << 16); |
1160 | data |= (0 << 23); | 1160 | data |= (0 << 23); |
1161 | data |= 8; | 1161 | data |= 8; |
1162 | writel(data, mmio + PDC_DIMM0_CONTROL); | 1162 | writel(data, mmio + PDC_DIMM0_CONTROL); |
1163 | readl(mmio + PDC_DIMM0_CONTROL); | 1163 | readl(mmio + PDC_DIMM0_CONTROL); |
1164 | return size; | 1164 | return size; |
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | 1167 | ||
@@ -1172,9 +1172,9 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_host *host) | |||
1172 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; | 1172 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; |
1173 | 1173 | ||
1174 | /* hard-code chip #0 */ | 1174 | /* hard-code chip #0 */ |
1175 | mmio += PDC_CHIP0_OFS; | 1175 | mmio += PDC_CHIP0_OFS; |
1176 | 1176 | ||
1177 | /* | 1177 | /* |
1178 | Set To Default : DIMM Module Global Control Register (0x022259F1) | 1178 | Set To Default : DIMM Module Global Control Register (0x022259F1) |
1179 | DIMM Arbitration Disable (bit 20) | 1179 | DIMM Arbitration Disable (bit 20) |
1180 | DIMM Data/Control Output Driving Selection (bit12 - bit15) | 1180 | DIMM Data/Control Output Driving Selection (bit12 - bit15) |
@@ -1193,40 +1193,40 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_host *host) | |||
1193 | writel(data, mmio + PDC_SDRAM_CONTROL); | 1193 | writel(data, mmio + PDC_SDRAM_CONTROL); |
1194 | readl(mmio + PDC_SDRAM_CONTROL); | 1194 | readl(mmio + PDC_SDRAM_CONTROL); |
1195 | printk(KERN_ERR "Local DIMM ECC Enabled\n"); | 1195 | printk(KERN_ERR "Local DIMM ECC Enabled\n"); |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | /* DIMM Initialization Select/Enable (bit 18/19) */ | 1198 | /* DIMM Initialization Select/Enable (bit 18/19) */ |
1199 | data &= (~(1<<18)); | 1199 | data &= (~(1<<18)); |
1200 | data |= (1<<19); | 1200 | data |= (1<<19); |
1201 | writel(data, mmio + PDC_SDRAM_CONTROL); | 1201 | writel(data, mmio + PDC_SDRAM_CONTROL); |
1202 | 1202 | ||
1203 | error = 1; | 1203 | error = 1; |
1204 | for (i = 1; i <= 10; i++) { /* polling ~5 secs */ | 1204 | for (i = 1; i <= 10; i++) { /* polling ~5 secs */ |
1205 | data = readl(mmio + PDC_SDRAM_CONTROL); | 1205 | data = readl(mmio + PDC_SDRAM_CONTROL); |
1206 | if (!(data & (1<<19))) { | 1206 | if (!(data & (1<<19))) { |
1207 | error = 0; | 1207 | error = 0; |
1208 | break; | 1208 | break; |
1209 | } | 1209 | } |
1210 | msleep(i*100); | 1210 | msleep(i*100); |
1211 | } | 1211 | } |
1212 | return error; | 1212 | return error; |
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | 1215 | ||
1216 | static unsigned int pdc20621_dimm_init(struct ata_host *host) | 1216 | static unsigned int pdc20621_dimm_init(struct ata_host *host) |
1217 | { | 1217 | { |
1218 | int speed, size, length; | 1218 | int speed, size, length; |
1219 | u32 addr,spd0,pci_status; | 1219 | u32 addr, spd0, pci_status; |
1220 | u32 tmp=0; | 1220 | u32 tmp = 0; |
1221 | u32 time_period=0; | 1221 | u32 time_period = 0; |
1222 | u32 tcount=0; | 1222 | u32 tcount = 0; |
1223 | u32 ticks=0; | 1223 | u32 ticks = 0; |
1224 | u32 clock=0; | 1224 | u32 clock = 0; |
1225 | u32 fparam=0; | 1225 | u32 fparam = 0; |
1226 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; | 1226 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; |
1227 | 1227 | ||
1228 | /* hard-code chip #0 */ | 1228 | /* hard-code chip #0 */ |
1229 | mmio += PDC_CHIP0_OFS; | 1229 | mmio += PDC_CHIP0_OFS; |
1230 | 1230 | ||
1231 | /* Initialize PLL based upon PCI Bus Frequency */ | 1231 | /* Initialize PLL based upon PCI Bus Frequency */ |
1232 | 1232 | ||
@@ -1254,7 +1254,7 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host) | |||
1254 | If SX4 is on PCI-X bus, after 3 seconds, the timer counter | 1254 | If SX4 is on PCI-X bus, after 3 seconds, the timer counter |
1255 | register should be >= (0xffffffff - 3x10^8). | 1255 | register should be >= (0xffffffff - 3x10^8). |
1256 | */ | 1256 | */ |
1257 | if(tcount >= PCI_X_TCOUNT) { | 1257 | if (tcount >= PCI_X_TCOUNT) { |
1258 | ticks = (time_period - tcount); | 1258 | ticks = (time_period - tcount); |
1259 | VPRINTK("Num counters 0x%x (%d)\n", ticks, ticks); | 1259 | VPRINTK("Num counters 0x%x (%d)\n", ticks, ticks); |
1260 | 1260 | ||
@@ -1285,41 +1285,43 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host) | |||
1285 | if (!(speed = pdc20621_detect_dimm(host))) { | 1285 | if (!(speed = pdc20621_detect_dimm(host))) { |
1286 | printk(KERN_ERR "Detect Local DIMM Fail\n"); | 1286 | printk(KERN_ERR "Detect Local DIMM Fail\n"); |
1287 | return 1; /* DIMM error */ | 1287 | return 1; /* DIMM error */ |
1288 | } | 1288 | } |
1289 | VPRINTK("Local DIMM Speed = %d\n", speed); | 1289 | VPRINTK("Local DIMM Speed = %d\n", speed); |
1290 | 1290 | ||
1291 | /* Programming DIMM0 Module Control Register (index_CID0:80h) */ | 1291 | /* Programming DIMM0 Module Control Register (index_CID0:80h) */ |
1292 | size = pdc20621_prog_dimm0(host); | 1292 | size = pdc20621_prog_dimm0(host); |
1293 | VPRINTK("Local DIMM Size = %dMB\n",size); | 1293 | VPRINTK("Local DIMM Size = %dMB\n", size); |
1294 | 1294 | ||
1295 | /* Programming DIMM Module Global Control Register (index_CID0:88h) */ | 1295 | /* Programming DIMM Module Global Control Register (index_CID0:88h) */ |
1296 | if (pdc20621_prog_dimm_global(host)) { | 1296 | if (pdc20621_prog_dimm_global(host)) { |
1297 | printk(KERN_ERR "Programming DIMM Module Global Control Register Fail\n"); | 1297 | printk(KERN_ERR "Programming DIMM Module Global Control Register Fail\n"); |
1298 | return 1; | 1298 | return 1; |
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | #ifdef ATA_VERBOSE_DEBUG | 1301 | #ifdef ATA_VERBOSE_DEBUG |
1302 | { | 1302 | { |
1303 | u8 test_parttern1[40] = {0x55,0xAA,'P','r','o','m','i','s','e',' ', | 1303 | u8 test_parttern1[40] = |
1304 | 'N','o','t',' ','Y','e','t',' ','D','e','f','i','n','e','d',' ', | 1304 | {0x55,0xAA,'P','r','o','m','i','s','e',' ', |
1305 | '1','.','1','0', | 1305 | 'N','o','t',' ','Y','e','t',' ', |
1306 | '9','8','0','3','1','6','1','2',0,0}; | 1306 | 'D','e','f','i','n','e','d',' ', |
1307 | '1','.','1','0', | ||
1308 | '9','8','0','3','1','6','1','2',0,0}; | ||
1307 | u8 test_parttern2[40] = {0}; | 1309 | u8 test_parttern2[40] = {0}; |
1308 | 1310 | ||
1309 | pdc20621_put_to_dimm(host, (void *) test_parttern2, 0x10040, 40); | 1311 | pdc20621_put_to_dimm(host, test_parttern2, 0x10040, 40); |
1310 | pdc20621_put_to_dimm(host, (void *) test_parttern2, 0x40, 40); | 1312 | pdc20621_put_to_dimm(host, test_parttern2, 0x40, 40); |
1311 | 1313 | ||
1312 | pdc20621_put_to_dimm(host, (void *) test_parttern1, 0x10040, 40); | 1314 | pdc20621_put_to_dimm(host, test_parttern1, 0x10040, 40); |
1313 | pdc20621_get_from_dimm(host, (void *) test_parttern2, 0x40, 40); | 1315 | pdc20621_get_from_dimm(host, test_parttern2, 0x40, 40); |
1314 | printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], | 1316 | printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], |
1315 | test_parttern2[1], &(test_parttern2[2])); | 1317 | test_parttern2[1], &(test_parttern2[2])); |
1316 | pdc20621_get_from_dimm(host, (void *) test_parttern2, 0x10040, | 1318 | pdc20621_get_from_dimm(host, test_parttern2, 0x10040, |
1317 | 40); | 1319 | 40); |
1318 | printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], | 1320 | printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], |
1319 | test_parttern2[1], &(test_parttern2[2])); | 1321 | test_parttern2[1], &(test_parttern2[2])); |
1320 | 1322 | ||
1321 | pdc20621_put_to_dimm(host, (void *) test_parttern1, 0x40, 40); | 1323 | pdc20621_put_to_dimm(host, test_parttern1, 0x40, 40); |
1322 | pdc20621_get_from_dimm(host, (void *) test_parttern2, 0x40, 40); | 1324 | pdc20621_get_from_dimm(host, test_parttern2, 0x40, 40); |
1323 | printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], | 1325 | printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], |
1324 | test_parttern2[1], &(test_parttern2[2])); | 1326 | test_parttern2[1], &(test_parttern2[2])); |
1325 | } | 1327 | } |
@@ -1375,7 +1377,8 @@ static void pdc_20621_init(struct ata_host *host) | |||
1375 | readl(mmio + PDC_HDMA_CTLSTAT); /* flush */ | 1377 | readl(mmio + PDC_HDMA_CTLSTAT); /* flush */ |
1376 | } | 1378 | } |
1377 | 1379 | ||
1378 | static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 1380 | static int pdc_sata_init_one(struct pci_dev *pdev, |
1381 | const struct pci_device_id *ent) | ||
1379 | { | 1382 | { |
1380 | static int printed_version; | 1383 | static int printed_version; |
1381 | const struct ata_port_info *ppi[] = | 1384 | const struct ata_port_info *ppi[] = |
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c index d394da085ae4..e710e71b7b92 100644 --- a/drivers/ata/sata_uli.c +++ b/drivers/ata/sata_uli.c | |||
@@ -56,9 +56,9 @@ struct uli_priv { | |||
56 | unsigned int scr_cfg_addr[uli_max_ports]; | 56 | unsigned int scr_cfg_addr[uli_max_ports]; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 59 | static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
60 | static int uli_scr_read (struct ata_port *ap, unsigned int sc_reg, u32 *val); | 60 | static int uli_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); |
61 | static int uli_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 61 | static int uli_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); |
62 | 62 | ||
63 | static const struct pci_device_id uli_pci_tbl[] = { | 63 | static const struct pci_device_id uli_pci_tbl[] = { |
64 | { PCI_VDEVICE(AL, 0x5289), uli_5289 }, | 64 | { PCI_VDEVICE(AL, 0x5289), uli_5289 }, |
@@ -143,7 +143,7 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg) | |||
143 | return hpriv->scr_cfg_addr[ap->port_no] + (4 * sc_reg); | 143 | return hpriv->scr_cfg_addr[ap->port_no] + (4 * sc_reg); |
144 | } | 144 | } |
145 | 145 | ||
146 | static u32 uli_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) | 146 | static u32 uli_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg) |
147 | { | 147 | { |
148 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 148 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
149 | unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); | 149 | unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); |
@@ -153,7 +153,7 @@ static u32 uli_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) | |||
153 | return val; | 153 | return val; |
154 | } | 154 | } |
155 | 155 | ||
156 | static void uli_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val) | 156 | static void uli_scr_cfg_write(struct ata_port *ap, unsigned int scr, u32 val) |
157 | { | 157 | { |
158 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 158 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
159 | unsigned int cfg_addr = get_scr_cfg_addr(ap, scr); | 159 | unsigned int cfg_addr = get_scr_cfg_addr(ap, scr); |
@@ -161,7 +161,7 @@ static void uli_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val) | |||
161 | pci_write_config_dword(pdev, cfg_addr, val); | 161 | pci_write_config_dword(pdev, cfg_addr, val); |
162 | } | 162 | } |
163 | 163 | ||
164 | static int uli_scr_read (struct ata_port *ap, unsigned int sc_reg, u32 *val) | 164 | static int uli_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) |
165 | { | 165 | { |
166 | if (sc_reg > SCR_CONTROL) | 166 | if (sc_reg > SCR_CONTROL) |
167 | return -EINVAL; | 167 | return -EINVAL; |
@@ -170,16 +170,16 @@ static int uli_scr_read (struct ata_port *ap, unsigned int sc_reg, u32 *val) | |||
170 | return 0; | 170 | return 0; |
171 | } | 171 | } |
172 | 172 | ||
173 | static int uli_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | 173 | static int uli_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) |
174 | { | 174 | { |
175 | if (sc_reg > SCR_CONTROL) //SCR_CONTROL=2, SCR_ERROR=1, SCR_STATUS=0 | 175 | if (sc_reg > SCR_CONTROL) //SCR_CONTROL=2, SCR_ERROR=1, SCR_STATUS=0 |
176 | return -EINVAL; | 176 | return -EINVAL; |
177 | 177 | ||
178 | uli_scr_cfg_write(ap, sc_reg, val); | 178 | uli_scr_cfg_write(ap, sc_reg, val); |
179 | return 0; | 179 | return 0; |
180 | } | 180 | } |
181 | 181 | ||
182 | static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 182 | static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
183 | { | 183 | { |
184 | static int printed_version; | 184 | static int printed_version; |
185 | const struct ata_port_info *ppi[] = { &uli_port_info, NULL }; | 185 | const struct ata_port_info *ppi[] = { &uli_port_info, NULL }; |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index cc6ee0890f56..3ef072ff319d 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | on emails. | 6 | * on emails. |
7 | * | 7 | * |
8 | * Copyright 2003-2004 Red Hat, Inc. All rights reserved. | 8 | * Copyright 2003-2004 Red Hat, Inc. All rights reserved. |
9 | * Copyright 2003-2004 Jeff Garzik | 9 | * Copyright 2003-2004 Jeff Garzik |
@@ -69,7 +69,7 @@ enum { | |||
69 | SATA_EXT_PHY = (1 << 6), /* 0==use PATA, 1==ext phy */ | 69 | SATA_EXT_PHY = (1 << 6), /* 0==use PATA, 1==ext phy */ |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 72 | static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
73 | static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); | 73 | static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); |
74 | static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); | 74 | static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); |
75 | static void svia_noop_freeze(struct ata_port *ap); | 75 | static void svia_noop_freeze(struct ata_port *ap); |
@@ -372,12 +372,12 @@ static const unsigned int vt6421_bar_sizes[] = { | |||
372 | 16, 16, 16, 16, 32, 128 | 372 | 16, 16, 16, 16, 32, 128 |
373 | }; | 373 | }; |
374 | 374 | ||
375 | static void __iomem * svia_scr_addr(void __iomem *addr, unsigned int port) | 375 | static void __iomem *svia_scr_addr(void __iomem *addr, unsigned int port) |
376 | { | 376 | { |
377 | return addr + (port * 128); | 377 | return addr + (port * 128); |
378 | } | 378 | } |
379 | 379 | ||
380 | static void __iomem * vt6421_scr_addr(void __iomem *addr, unsigned int port) | 380 | static void __iomem *vt6421_scr_addr(void __iomem *addr, unsigned int port) |
381 | { | 381 | { |
382 | return addr + (port * 64); | 382 | return addr + (port * 64); |
383 | } | 383 | } |
@@ -472,7 +472,7 @@ static void svia_configure(struct pci_dev *pdev) | |||
472 | if ((tmp8 & ALL_PORTS) != ALL_PORTS) { | 472 | if ((tmp8 & ALL_PORTS) != ALL_PORTS) { |
473 | dev_printk(KERN_DEBUG, &pdev->dev, | 473 | dev_printk(KERN_DEBUG, &pdev->dev, |
474 | "enabling SATA channels (0x%x)\n", | 474 | "enabling SATA channels (0x%x)\n", |
475 | (int) tmp8); | 475 | (int) tmp8); |
476 | tmp8 |= ALL_PORTS; | 476 | tmp8 |= ALL_PORTS; |
477 | pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8); | 477 | pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8); |
478 | } | 478 | } |
@@ -482,7 +482,7 @@ static void svia_configure(struct pci_dev *pdev) | |||
482 | if ((tmp8 & ALL_PORTS) != ALL_PORTS) { | 482 | if ((tmp8 & ALL_PORTS) != ALL_PORTS) { |
483 | dev_printk(KERN_DEBUG, &pdev->dev, | 483 | dev_printk(KERN_DEBUG, &pdev->dev, |
484 | "enabling SATA channel interrupts (0x%x)\n", | 484 | "enabling SATA channel interrupts (0x%x)\n", |
485 | (int) tmp8); | 485 | (int) tmp8); |
486 | tmp8 |= ALL_PORTS; | 486 | tmp8 |= ALL_PORTS; |
487 | pci_write_config_byte(pdev, SATA_INT_GATE, tmp8); | 487 | pci_write_config_byte(pdev, SATA_INT_GATE, tmp8); |
488 | } | 488 | } |
@@ -492,13 +492,13 @@ static void svia_configure(struct pci_dev *pdev) | |||
492 | if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) { | 492 | if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) { |
493 | dev_printk(KERN_DEBUG, &pdev->dev, | 493 | dev_printk(KERN_DEBUG, &pdev->dev, |
494 | "enabling SATA channel native mode (0x%x)\n", | 494 | "enabling SATA channel native mode (0x%x)\n", |
495 | (int) tmp8); | 495 | (int) tmp8); |
496 | tmp8 |= NATIVE_MODE_ALL; | 496 | tmp8 |= NATIVE_MODE_ALL; |
497 | pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8); | 497 | pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8); |
498 | } | 498 | } |
499 | } | 499 | } |
500 | 500 | ||
501 | static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 501 | static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
502 | { | 502 | { |
503 | static int printed_version; | 503 | static int printed_version; |
504 | unsigned int i; | 504 | unsigned int i; |
@@ -525,8 +525,8 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
525 | dev_printk(KERN_ERR, &pdev->dev, | 525 | dev_printk(KERN_ERR, &pdev->dev, |
526 | "invalid PCI BAR %u (sz 0x%llx, val 0x%llx)\n", | 526 | "invalid PCI BAR %u (sz 0x%llx, val 0x%llx)\n", |
527 | i, | 527 | i, |
528 | (unsigned long long)pci_resource_start(pdev, i), | 528 | (unsigned long long)pci_resource_start(pdev, i), |
529 | (unsigned long long)pci_resource_len(pdev, i)); | 529 | (unsigned long long)pci_resource_len(pdev, i)); |
530 | return -ENODEV; | 530 | return -ENODEV; |
531 | } | 531 | } |
532 | 532 | ||
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c index 0d9be1684873..95ae3ed24a9d 100644 --- a/drivers/ata/sata_vsc.c +++ b/drivers/ata/sata_vsc.c | |||
@@ -162,7 +162,8 @@ static void vsc_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | |||
162 | /* | 162 | /* |
163 | * The only thing the ctl register is used for is SRST. | 163 | * The only thing the ctl register is used for is SRST. |
164 | * That is not enabled or disabled via tf_load. | 164 | * That is not enabled or disabled via tf_load. |
165 | * However, if ATA_NIEN is changed, then we need to change the interrupt register. | 165 | * However, if ATA_NIEN is changed, then we need to change |
166 | * the interrupt register. | ||
166 | */ | 167 | */ |
167 | if ((tf->ctl & ATA_NIEN) != (ap->last_ctl & ATA_NIEN)) { | 168 | if ((tf->ctl & ATA_NIEN) != (ap->last_ctl & ATA_NIEN)) { |
168 | ap->last_ctl = tf->ctl; | 169 | ap->last_ctl = tf->ctl; |
@@ -219,7 +220,7 @@ static void vsc_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | |||
219 | tf->hob_lbal = lbal >> 8; | 220 | tf->hob_lbal = lbal >> 8; |
220 | tf->hob_lbam = lbam >> 8; | 221 | tf->hob_lbam = lbam >> 8; |
221 | tf->hob_lbah = lbah >> 8; | 222 | tf->hob_lbah = lbah >> 8; |
222 | } | 223 | } |
223 | } | 224 | } |
224 | 225 | ||
225 | static inline void vsc_error_intr(u8 port_status, struct ata_port *ap) | 226 | static inline void vsc_error_intr(u8 port_status, struct ata_port *ap) |
@@ -256,9 +257,10 @@ static void vsc_port_intr(u8 port_status, struct ata_port *ap) | |||
256 | /* | 257 | /* |
257 | * vsc_sata_interrupt | 258 | * vsc_sata_interrupt |
258 | * | 259 | * |
259 | * Read the interrupt register and process for the devices that have them pending. | 260 | * Read the interrupt register and process for the devices that have |
261 | * them pending. | ||
260 | */ | 262 | */ |
261 | static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance) | 263 | static irqreturn_t vsc_sata_interrupt(int irq, void *dev_instance) |
262 | { | 264 | { |
263 | struct ata_host *host = dev_instance; | 265 | struct ata_host *host = dev_instance; |
264 | unsigned int i; | 266 | unsigned int i; |
@@ -287,7 +289,7 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance) | |||
287 | handled++; | 289 | handled++; |
288 | } else | 290 | } else |
289 | dev_printk(KERN_ERR, host->dev, | 291 | dev_printk(KERN_ERR, host->dev, |
290 | ": interrupt from disabled port %d\n", i); | 292 | "interrupt from disabled port %d\n", i); |
291 | } | 293 | } |
292 | } | 294 | } |
293 | 295 | ||
@@ -363,7 +365,8 @@ static void __devinit vsc_sata_setup_port(struct ata_ioports *port, | |||
363 | } | 365 | } |
364 | 366 | ||
365 | 367 | ||
366 | static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 368 | static int __devinit vsc_sata_init_one(struct pci_dev *pdev, |
369 | const struct pci_device_id *ent) | ||
367 | { | 370 | { |
368 | static const struct ata_port_info pi = { | 371 | static const struct ata_port_info pi = { |
369 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 372 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
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 c1343414d285..3f4d6aa13990 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -1228,18 +1228,18 @@ int device_rename(struct device *dev, char *new_name) | |||
1228 | sysfs_remove_link(&dev->parent->kobj, old_class_name); | 1228 | sysfs_remove_link(&dev->parent->kobj, old_class_name); |
1229 | } | 1229 | } |
1230 | } | 1230 | } |
1231 | #endif | 1231 | #else |
1232 | |||
1233 | if (dev->class) { | 1232 | if (dev->class) { |
1234 | sysfs_remove_link(&dev->class->subsys.kobj, old_device_name); | 1233 | sysfs_remove_link(&dev->class->subsys.kobj, old_device_name); |
1235 | error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, | 1234 | error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, |
1236 | dev->bus_id); | 1235 | dev->bus_id); |
1237 | if (error) { | 1236 | if (error) { |
1238 | /* Uh... how to unravel this if restoring can fail? */ | ||
1239 | dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n", | 1237 | dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n", |
1240 | __FUNCTION__, error); | 1238 | __FUNCTION__, error); |
1241 | } | 1239 | } |
1242 | } | 1240 | } |
1241 | #endif | ||
1242 | |||
1243 | out: | 1243 | out: |
1244 | put_device(dev); | 1244 | put_device(dev); |
1245 | 1245 | ||
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c index 5beddc322e6f..b5034dc72a05 100644 --- a/drivers/base/dmapool.c +++ b/drivers/base/dmapool.c | |||
@@ -2,7 +2,6 @@ | |||
2 | #include <linux/device.h> | 2 | #include <linux/device.h> |
3 | #include <linux/mm.h> | 3 | #include <linux/mm.h> |
4 | #include <asm/io.h> /* Needed for i386 to build */ | 4 | #include <asm/io.h> /* Needed for i386 to build */ |
5 | #include <asm/scatterlist.h> /* Needed for i386 to build */ | ||
6 | #include <linux/dma-mapping.h> | 5 | #include <linux/dma-mapping.h> |
7 | #include <linux/dmapool.h> | 6 | #include <linux/dmapool.h> |
8 | #include <linux/slab.h> | 7 | #include <linux/slab.h> |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 5a6fe17fc638..7d704968765f 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * Disk Array driver for HP SA 5xxx and 6xxx Controllers | 2 | * Disk Array driver for HP Smart Array controllers. |
3 | * Copyright 2000, 2006 Hewlett-Packard Development Company, L.P. | 3 | * (C) Copyright 2000, 2007 Hewlett-Packard Development Company, L.P. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; version 2 of the License. |
8 | * (at your option) any later version. | ||
9 | * | 8 | * |
10 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | 11 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * NON INFRINGEMENT. See the GNU General Public License for more details. | 12 | * General Public License for more details. |
14 | * | 13 | * |
15 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
17 | * 02111-1307, USA. | ||
18 | * | 18 | * |
19 | * Questions/Comments/Bugfixes to iss_storagedev@hp.com | 19 | * Questions/Comments/Bugfixes to iss_storagedev@hp.com |
20 | * | 20 | * |
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index 4aca7ddfdddf..63ee6c076cb3 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * Disk Array driver for Compaq SA53xx Controllers, SCSI Tape module | 2 | * Disk Array driver for HP Smart Array controllers, SCSI Tape module. |
3 | * Copyright 2001 Compaq Computer Corporation | 3 | * (C) Copyright 2001, 2007 Hewlett-Packard Development Company, L.P. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; version 2 of the License. |
8 | * (at your option) any later version. | ||
9 | * | 8 | * |
10 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | 11 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * NON INFRINGEMENT. See the GNU General Public License for more details. | 12 | * General Public License for more details. |
14 | * | 13 | * |
15 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 16 | * Foundation, Inc., 59 Temple Place, Suite 300, Boston, MA |
17 | * 02111-1307, USA. | ||
18 | * | 18 | * |
19 | * Questions/Comments/Bugfixes to iss_storagedev@hp.com | 19 | * Questions/Comments/Bugfixes to iss_storagedev@hp.com |
20 | * | 20 | * |
diff --git a/drivers/block/cciss_scsi.h b/drivers/block/cciss_scsi.h index 5e7e06c07d6c..d9c2c586502f 100644 --- a/drivers/block/cciss_scsi.h +++ b/drivers/block/cciss_scsi.h | |||
@@ -1,20 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * Disk Array driver for Compaq SA53xx Controllers, SCSI Tape module | 2 | * Disk Array driver for HP Smart Array controllers, SCSI Tape module. |
3 | * Copyright 2001 Compaq Computer Corporation | 3 | * (C) Copyright 2001, 2007 Hewlett-Packard Development Company, L.P. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; version 2 of the License. |
8 | * (at your option) any later version. | ||
9 | * | 8 | * |
10 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | 11 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * NON INFRINGEMENT. See the GNU General Public License for more details. | 12 | * General Public License for more details. |
14 | * | 13 | * |
15 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 16 | * Foundation, Inc., 59 Temple Place, Suite 300, Boston, MA |
17 | * 02111-1307, USA. | ||
18 | * | 18 | * |
19 | * Questions/Comments/Bugfixes to iss_storagedev@hp.com | 19 | * Questions/Comments/Bugfixes to iss_storagedev@hp.com |
20 | * | 20 | * |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 6332acad078c..b4c0888aedc3 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | #include <net/sock.h> | 30 | #include <net/sock.h> |
31 | #include <linux/net.h> | ||
31 | 32 | ||
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
33 | #include <asm/system.h> | 34 | #include <asm/system.h> |
@@ -126,7 +127,7 @@ static void sock_shutdown(struct nbd_device *lo, int lock) | |||
126 | if (lo->sock) { | 127 | if (lo->sock) { |
127 | printk(KERN_WARNING "%s: shutting down socket\n", | 128 | printk(KERN_WARNING "%s: shutting down socket\n", |
128 | lo->disk->disk_name); | 129 | lo->disk->disk_name); |
129 | lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN); | 130 | kernel_sock_shutdown(lo->sock, SHUT_RDWR); |
130 | lo->sock = NULL; | 131 | lo->sock = NULL; |
131 | } | 132 | } |
132 | if (lock) | 133 | if (lock) |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index ceffa6034e20..e7fe6ca97dd8 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -488,13 +488,11 @@ static int pf_atapi(struct pf_unit *pf, char *cmd, int dlen, char *buf, char *fu | |||
488 | return r; | 488 | return r; |
489 | } | 489 | } |
490 | 490 | ||
491 | #define DBMSG(msg) ((verbose>1)?(msg):NULL) | ||
492 | |||
493 | static void pf_lock(struct pf_unit *pf, int func) | 491 | static void pf_lock(struct pf_unit *pf, int func) |
494 | { | 492 | { |
495 | char lo_cmd[12] = { ATAPI_LOCK, pf->lun << 5, 0, 0, func, 0, 0, 0, 0, 0, 0, 0 }; | 493 | char lo_cmd[12] = { ATAPI_LOCK, pf->lun << 5, 0, 0, func, 0, 0, 0, 0, 0, 0, 0 }; |
496 | 494 | ||
497 | pf_atapi(pf, lo_cmd, 0, pf_scratch, func ? "unlock" : "lock"); | 495 | pf_atapi(pf, lo_cmd, 0, pf_scratch, func ? "lock" : "unlock"); |
498 | } | 496 | } |
499 | 497 | ||
500 | static void pf_eject(struct pf_unit *pf) | 498 | static void pf_eject(struct pf_unit *pf) |
@@ -555,7 +553,7 @@ static void pf_mode_sense(struct pf_unit *pf) | |||
555 | { ATAPI_MODE_SENSE, pf->lun << 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0 }; | 553 | { ATAPI_MODE_SENSE, pf->lun << 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0 }; |
556 | char buf[8]; | 554 | char buf[8]; |
557 | 555 | ||
558 | pf_atapi(pf, ms_cmd, 8, buf, DBMSG("mode sense")); | 556 | pf_atapi(pf, ms_cmd, 8, buf, "mode sense"); |
559 | pf->media_status = PF_RW; | 557 | pf->media_status = PF_RW; |
560 | if (buf[3] & 0x80) | 558 | if (buf[3] & 0x80) |
561 | pf->media_status = PF_RO; | 559 | pf->media_status = PF_RO; |
@@ -591,7 +589,7 @@ static void pf_get_capacity(struct pf_unit *pf) | |||
591 | char buf[8]; | 589 | char buf[8]; |
592 | int bs; | 590 | int bs; |
593 | 591 | ||
594 | if (pf_atapi(pf, rc_cmd, 8, buf, DBMSG("get capacity"))) { | 592 | if (pf_atapi(pf, rc_cmd, 8, buf, "get capacity")) { |
595 | pf->media_status = PF_NM; | 593 | pf->media_status = PF_NM; |
596 | return; | 594 | return; |
597 | } | 595 | } |
@@ -804,13 +802,18 @@ static int pf_next_buf(void) | |||
804 | pf_buf += 512; | 802 | pf_buf += 512; |
805 | pf_block++; | 803 | pf_block++; |
806 | if (!pf_run) | 804 | if (!pf_run) |
807 | return 0; | ||
808 | if (!pf_count) | ||
809 | return 1; | 805 | return 1; |
810 | spin_lock_irqsave(&pf_spin_lock, saved_flags); | 806 | if (!pf_count) { |
811 | pf_end_request(1); | 807 | spin_lock_irqsave(&pf_spin_lock, saved_flags); |
812 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | 808 | pf_end_request(1); |
813 | return 1; | 809 | pf_req = elv_next_request(pf_queue); |
810 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | ||
811 | if (!pf_req) | ||
812 | return 1; | ||
813 | pf_count = pf_req->current_nr_sectors; | ||
814 | pf_buf = pf_req->buffer; | ||
815 | } | ||
816 | return 0; | ||
814 | } | 817 | } |
815 | 818 | ||
816 | static inline void next_request(int success) | 819 | static inline void next_request(int success) |
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index 9f4e67ee1eb0..b91accf12656 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c | |||
@@ -664,7 +664,7 @@ static int pt_open(struct inode *inode, struct file *file) | |||
664 | goto out; | 664 | goto out; |
665 | 665 | ||
666 | err = -EROFS; | 666 | err = -EROFS; |
667 | if ((!tape->flags & PT_WRITE_OK) && (file->f_mode & 2)) | 667 | if ((!(tape->flags & PT_WRITE_OK)) && (file->f_mode & 2)) |
668 | goto out; | 668 | goto out; |
669 | 669 | ||
670 | if (!(iminor(inode) & 128)) | 670 | if (!(iminor(inode) & 128)) |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index a8130a4ad6d4..a5ee21319d37 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -358,10 +358,19 @@ static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf, | |||
358 | size_t count) | 358 | size_t count) |
359 | { | 359 | { |
360 | unsigned int major, minor; | 360 | unsigned int major, minor; |
361 | |||
361 | if (sscanf(buf, "%u:%u", &major, &minor) == 2) { | 362 | if (sscanf(buf, "%u:%u", &major, &minor) == 2) { |
363 | /* pkt_setup_dev() expects caller to hold reference to self */ | ||
364 | if (!try_module_get(THIS_MODULE)) | ||
365 | return -ENODEV; | ||
366 | |||
362 | pkt_setup_dev(MKDEV(major, minor), NULL); | 367 | pkt_setup_dev(MKDEV(major, minor), NULL); |
368 | |||
369 | module_put(THIS_MODULE); | ||
370 | |||
363 | return count; | 371 | return count; |
364 | } | 372 | } |
373 | |||
365 | return -EINVAL; | 374 | return -EINVAL; |
366 | } | 375 | } |
367 | 376 | ||
diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 47f8ac6cce57..82f4eecc8699 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c | |||
@@ -189,6 +189,18 @@ static int ramdisk_set_page_dirty(struct page *page) | |||
189 | return 0; | 189 | return 0; |
190 | } | 190 | } |
191 | 191 | ||
192 | /* | ||
193 | * releasepage is called by pagevec_strip/try_to_release_page if | ||
194 | * buffers_heads_over_limit is true. Without a releasepage function | ||
195 | * try_to_free_buffers is called instead. That can unset the dirty | ||
196 | * bit of our ram disk pages, which will be eventually freed, even | ||
197 | * if the page is still in use. | ||
198 | */ | ||
199 | static int ramdisk_releasepage(struct page *page, gfp_t dummy) | ||
200 | { | ||
201 | return 0; | ||
202 | } | ||
203 | |||
192 | static const struct address_space_operations ramdisk_aops = { | 204 | static const struct address_space_operations ramdisk_aops = { |
193 | .readpage = ramdisk_readpage, | 205 | .readpage = ramdisk_readpage, |
194 | .prepare_write = ramdisk_prepare_write, | 206 | .prepare_write = ramdisk_prepare_write, |
@@ -196,6 +208,7 @@ static const struct address_space_operations ramdisk_aops = { | |||
196 | .writepage = ramdisk_writepage, | 208 | .writepage = ramdisk_writepage, |
197 | .set_page_dirty = ramdisk_set_page_dirty, | 209 | .set_page_dirty = ramdisk_set_page_dirty, |
198 | .writepages = ramdisk_writepages, | 210 | .writepages = ramdisk_writepages, |
211 | .releasepage = ramdisk_releasepage, | ||
199 | }; | 212 | }; |
200 | 213 | ||
201 | static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector, | 214 | static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector, |
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/agp/Kconfig b/drivers/char/agp/Kconfig index f22c253bc09f..ccb1fa89de29 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig | |||
@@ -56,9 +56,9 @@ config AGP_AMD | |||
56 | X on AMD Irongate, 761, and 762 chipsets. | 56 | X on AMD Irongate, 761, and 762 chipsets. |
57 | 57 | ||
58 | config AGP_AMD64 | 58 | config AGP_AMD64 |
59 | tristate "AMD Opteron/Athlon64 on-CPU GART support" if !IOMMU | 59 | tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU |
60 | depends on AGP && X86 | 60 | depends on AGP && X86 |
61 | default y if IOMMU | 61 | default y if GART_IOMMU |
62 | help | 62 | help |
63 | This option gives you AGP support for the GLX component of | 63 | This option gives you AGP support for the GLX component of |
64 | X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs. | 64 | X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs. |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index d95662e96326..d8200ac8f8cb 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -787,7 +787,7 @@ static void __exit agp_amd64_cleanup(void) | |||
787 | 787 | ||
788 | /* On AMD64 the PCI driver needs to initialize this driver early | 788 | /* On AMD64 the PCI driver needs to initialize this driver early |
789 | for the IOMMU, so it has to be called via a backdoor. */ | 789 | for the IOMMU, so it has to be called via a backdoor. */ |
790 | #ifndef CONFIG_IOMMU | 790 | #ifndef CONFIG_GART_IOMMU |
791 | module_init(agp_amd64_init); | 791 | module_init(agp_amd64_init); |
792 | module_exit(agp_amd64_cleanup); | 792 | module_exit(agp_amd64_cleanup); |
793 | #endif | 793 | #endif |
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 9dd0760dd87a..dde02a15fa59 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -559,8 +559,6 @@ struct drm_mm { | |||
559 | * a family of cards. There will one drm_device for each card present | 559 | * a family of cards. There will one drm_device for each card present |
560 | * in this family | 560 | * in this family |
561 | */ | 561 | */ |
562 | struct drm_device; | ||
563 | |||
564 | struct drm_driver { | 562 | struct drm_driver { |
565 | int (*load) (struct drm_device *, unsigned long flags); | 563 | int (*load) (struct drm_device *, unsigned long flags); |
566 | int (*firstopen) (struct drm_device *); | 564 | int (*firstopen) (struct drm_device *); |
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c index d9be14624526..3cbebf868e68 100644 --- a/drivers/char/drm/drm_ioctl.c +++ b/drivers/char/drm/drm_ioctl.c | |||
@@ -272,7 +272,7 @@ int drm_getstats(struct drm_device *dev, void *data, | |||
272 | struct drm_stats *stats = data; | 272 | struct drm_stats *stats = data; |
273 | int i; | 273 | int i; |
274 | 274 | ||
275 | memset(stats, 0, sizeof(stats)); | 275 | memset(stats, 0, sizeof(*stats)); |
276 | 276 | ||
277 | mutex_lock(&dev->struct_mutex); | 277 | mutex_lock(&dev->struct_mutex); |
278 | 278 | ||
diff --git a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h index 76e44ac94fb5..daa69c9d8977 100644 --- a/drivers/char/drm/drm_os_linux.h +++ b/drivers/char/drm/drm_os_linux.h | |||
@@ -62,14 +62,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size) | |||
62 | 62 | ||
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | /** For data going into the kernel through the ioctl argument */ | ||
66 | #define DRM_COPY_FROM_USER_IOCTL(arg1, arg2, arg3) \ | ||
67 | if ( copy_from_user(&arg1, arg2, arg3) ) \ | ||
68 | return -EFAULT | ||
69 | /** For data going from the kernel through the ioctl argument */ | ||
70 | #define DRM_COPY_TO_USER_IOCTL(arg1, arg2, arg3) \ | ||
71 | if ( copy_to_user(arg1, &arg2, arg3) ) \ | ||
72 | return -EFAULT | ||
73 | /** Other copying of data to kernel space */ | 65 | /** Other copying of data to kernel space */ |
74 | #define DRM_COPY_FROM_USER(arg1, arg2, arg3) \ | 66 | #define DRM_COPY_FROM_USER(arg1, arg2, arg3) \ |
75 | copy_from_user(arg1, arg2, arg3) | 67 | copy_from_user(arg1, arg2, arg3) |
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 335423c5c186..24fca8ec1379 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c | |||
@@ -1679,7 +1679,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) | |||
1679 | dev_priv->gart_info.bus_addr = | 1679 | dev_priv->gart_info.bus_addr = |
1680 | dev_priv->pcigart_offset + dev_priv->fb_location; | 1680 | dev_priv->pcigart_offset + dev_priv->fb_location; |
1681 | dev_priv->gart_info.mapping.offset = | 1681 | dev_priv->gart_info.mapping.offset = |
1682 | dev_priv->gart_info.bus_addr; | 1682 | dev_priv->pcigart_offset + dev_priv->fb_aper_offset; |
1683 | dev_priv->gart_info.mapping.size = | 1683 | dev_priv->gart_info.mapping.size = |
1684 | dev_priv->gart_info.table_size; | 1684 | dev_priv->gart_info.table_size; |
1685 | 1685 | ||
@@ -2275,7 +2275,8 @@ int radeon_driver_firstopen(struct drm_device *dev) | |||
2275 | if (ret != 0) | 2275 | if (ret != 0) |
2276 | return ret; | 2276 | return ret; |
2277 | 2277 | ||
2278 | ret = drm_addmap(dev, drm_get_resource_start(dev, 0), | 2278 | dev_priv->fb_aper_offset = drm_get_resource_start(dev, 0); |
2279 | ret = drm_addmap(dev, dev_priv->fb_aper_offset, | ||
2279 | drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER, | 2280 | drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER, |
2280 | _DRM_WRITE_COMBINING, &map); | 2281 | _DRM_WRITE_COMBINING, &map); |
2281 | if (ret != 0) | 2282 | if (ret != 0) |
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h index e4077bc212b3..bfbb60a9298c 100644 --- a/drivers/char/drm/radeon_drv.h +++ b/drivers/char/drm/radeon_drv.h | |||
@@ -293,6 +293,7 @@ typedef struct drm_radeon_private { | |||
293 | 293 | ||
294 | /* starting from here on, data is preserved accross an open */ | 294 | /* starting from here on, data is preserved accross an open */ |
295 | uint32_t flags; /* see radeon_chip_flags */ | 295 | uint32_t flags; /* see radeon_chip_flags */ |
296 | unsigned long fb_aper_offset; | ||
296 | } drm_radeon_private_t; | 297 | } drm_radeon_private_t; |
297 | 298 | ||
298 | typedef struct drm_radeon_buf_priv { | 299 | typedef struct drm_radeon_buf_priv { |
diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c index 59484d56b333..d465b2f9c1cd 100644 --- a/drivers/char/drm/savage_bci.c +++ b/drivers/char/drm/savage_bci.c | |||
@@ -968,9 +968,6 @@ static int savage_bci_event_wait(struct drm_device *dev, void *data, struct drm_ | |||
968 | 968 | ||
969 | DRM_DEBUG("\n"); | 969 | DRM_DEBUG("\n"); |
970 | 970 | ||
971 | DRM_COPY_FROM_USER_IOCTL(event, (drm_savage_event_wait_t __user *) data, | ||
972 | sizeof(event)); | ||
973 | |||
974 | UPDATE_EVENT_COUNTER(); | 971 | UPDATE_EVENT_COUNTER(); |
975 | if (dev_priv->status_ptr) | 972 | if (dev_priv->status_ptr) |
976 | hw_e = dev_priv->status_ptr[1] & 0xffff; | 973 | hw_e = dev_priv->status_ptr[1] & 0xffff; |
diff --git a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c index 6be1c5757580..a6b7ccdaf73d 100644 --- a/drivers/char/drm/sis_mm.c +++ b/drivers/char/drm/sis_mm.c | |||
@@ -134,6 +134,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file_priv, | |||
134 | dev_priv->agp_initialized)) { | 134 | dev_priv->agp_initialized)) { |
135 | DRM_ERROR | 135 | DRM_ERROR |
136 | ("Attempt to allocate from uninitialized memory manager.\n"); | 136 | ("Attempt to allocate from uninitialized memory manager.\n"); |
137 | mutex_unlock(&dev->struct_mutex); | ||
137 | return -EINVAL; | 138 | return -EINVAL; |
138 | } | 139 | } |
139 | 140 | ||
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 0e937f64a789..20070b7c573d 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -41,7 +41,7 @@ | |||
41 | */ | 41 | */ |
42 | static inline int uncached_access(struct file *file, unsigned long addr) | 42 | static inline int uncached_access(struct file *file, unsigned long addr) |
43 | { | 43 | { |
44 | #if defined(__i386__) | 44 | #if defined(__i386__) && !defined(__arch_um__) |
45 | /* | 45 | /* |
46 | * On the PPro and successors, the MTRRs are used to set | 46 | * On the PPro and successors, the MTRRs are used to set |
47 | * memory types for physical addresses outside main memory, | 47 | * memory types for physical addresses outside main memory, |
@@ -57,7 +57,7 @@ static inline int uncached_access(struct file *file, unsigned long addr) | |||
57 | test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) || | 57 | test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) || |
58 | test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) ) | 58 | test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) ) |
59 | && addr >= __pa(high_memory); | 59 | && addr >= __pa(high_memory); |
60 | #elif defined(__x86_64__) | 60 | #elif defined(__x86_64__) && !defined(__arch_um__) |
61 | /* | 61 | /* |
62 | * This is broken because it can generate memory type aliases, | 62 | * This is broken because it can generate memory type aliases, |
63 | * which can cause cache corruptions | 63 | * which can cause cache corruptions |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index cc5d77797def..02518da6a386 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -47,7 +47,7 @@ | |||
47 | /* #define ATR_CSUM */ | 47 | /* #define ATR_CSUM */ |
48 | 48 | ||
49 | #ifdef PCMCIA_DEBUG | 49 | #ifdef PCMCIA_DEBUG |
50 | #define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle)) | 50 | #define reader_to_dev(x) (&handle_to_dev(x->p_dev)) |
51 | static int pc_debug = PCMCIA_DEBUG; | 51 | static int pc_debug = PCMCIA_DEBUG; |
52 | module_param(pc_debug, int, 0600); | 52 | module_param(pc_debug, int, 0600); |
53 | #define DEBUGP(n, rdr, x, args...) do { \ | 53 | #define DEBUGP(n, rdr, x, args...) do { \ |
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index a0b9c8728d56..5f291bf739a6 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -41,7 +41,7 @@ | |||
41 | 41 | ||
42 | 42 | ||
43 | #ifdef PCMCIA_DEBUG | 43 | #ifdef PCMCIA_DEBUG |
44 | #define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle)) | 44 | #define reader_to_dev(x) (&handle_to_dev(x->p_dev)) |
45 | static int pc_debug = PCMCIA_DEBUG; | 45 | static int pc_debug = PCMCIA_DEBUG; |
46 | module_param(pc_debug, int, 0600); | 46 | module_param(pc_debug, int, 0600); |
47 | #define DEBUGP(n, rdr, x, args...) do { \ | 47 | #define DEBUGP(n, rdr, x, args...) do { \ |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 1756b1f7cb72..5fee05661823 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -1494,7 +1494,7 @@ __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr, | |||
1494 | seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK; | 1494 | seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK; |
1495 | seq += keyptr->count; | 1495 | seq += keyptr->count; |
1496 | 1496 | ||
1497 | seq += ktime_get_real().tv64; | 1497 | seq += ktime_to_ns(ktime_get_real()); |
1498 | 1498 | ||
1499 | return seq; | 1499 | return seq; |
1500 | } | 1500 | } |
@@ -1556,7 +1556,7 @@ __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, | |||
1556 | * overlaps less than one time per MSL (2 minutes). | 1556 | * overlaps less than one time per MSL (2 minutes). |
1557 | * Choosing a clock of 64 ns period is OK. (period of 274 s) | 1557 | * Choosing a clock of 64 ns period is OK. (period of 274 s) |
1558 | */ | 1558 | */ |
1559 | seq += ktime_get_real().tv64 >> 6; | 1559 | seq += ktime_to_ns(ktime_get_real()) >> 6; |
1560 | #if 0 | 1560 | #if 0 |
1561 | printk("init_seq(%lx, %lx, %d, %d) = %d\n", | 1561 | printk("init_seq(%lx, %lx, %d, %d) = %d\n", |
1562 | saddr, daddr, sport, dport, seq); | 1562 | saddr, daddr, sport, dport, seq); |
@@ -1616,7 +1616,7 @@ u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, | |||
1616 | seq = half_md4_transform(hash, keyptr->secret); | 1616 | seq = half_md4_transform(hash, keyptr->secret); |
1617 | seq |= ((u64)keyptr->count) << (32 - HASH_BITS); | 1617 | seq |= ((u64)keyptr->count) << (32 - HASH_BITS); |
1618 | 1618 | ||
1619 | seq += ktime_get_real().tv64; | 1619 | seq += ktime_to_ns(ktime_get_real()); |
1620 | seq &= (1ull << 48) - 1; | 1620 | seq &= (1ull << 48) - 1; |
1621 | #if 0 | 1621 | #if 0 |
1622 | printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n", | 1622 | printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n", |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index ec6b65ec69ea..0c66b802736a 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -918,6 +918,31 @@ static const struct file_operations rtc_proc_fops = { | |||
918 | }; | 918 | }; |
919 | #endif | 919 | #endif |
920 | 920 | ||
921 | static resource_size_t rtc_size; | ||
922 | |||
923 | static struct resource * __init rtc_request_region(resource_size_t size) | ||
924 | { | ||
925 | struct resource *r; | ||
926 | |||
927 | if (RTC_IOMAPPED) | ||
928 | r = request_region(RTC_PORT(0), size, "rtc"); | ||
929 | else | ||
930 | r = request_mem_region(RTC_PORT(0), size, "rtc"); | ||
931 | |||
932 | if (r) | ||
933 | rtc_size = size; | ||
934 | |||
935 | return r; | ||
936 | } | ||
937 | |||
938 | static void rtc_release_region(void) | ||
939 | { | ||
940 | if (RTC_IOMAPPED) | ||
941 | release_region(RTC_PORT(0), rtc_size); | ||
942 | else | ||
943 | release_mem_region(RTC_PORT(0), rtc_size); | ||
944 | } | ||
945 | |||
921 | static int __init rtc_init(void) | 946 | static int __init rtc_init(void) |
922 | { | 947 | { |
923 | #ifdef CONFIG_PROC_FS | 948 | #ifdef CONFIG_PROC_FS |
@@ -968,10 +993,17 @@ found: | |||
968 | } | 993 | } |
969 | no_irq: | 994 | no_irq: |
970 | #else | 995 | #else |
971 | if (RTC_IOMAPPED) | 996 | r = rtc_request_region(RTC_IO_EXTENT); |
972 | r = request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); | 997 | |
973 | else | 998 | /* |
974 | r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); | 999 | * If we've already requested a smaller range (for example, because |
1000 | * PNPBIOS or ACPI told us how the device is configured), the request | ||
1001 | * above might fail because it's too big. | ||
1002 | * | ||
1003 | * If so, request just the range we actually use. | ||
1004 | */ | ||
1005 | if (!r) | ||
1006 | r = rtc_request_region(RTC_IO_EXTENT_USED); | ||
975 | if (!r) { | 1007 | if (!r) { |
976 | #ifdef RTC_IRQ | 1008 | #ifdef RTC_IRQ |
977 | rtc_has_irq = 0; | 1009 | rtc_has_irq = 0; |
@@ -992,10 +1024,7 @@ no_irq: | |||
992 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ | 1024 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ |
993 | rtc_has_irq = 0; | 1025 | rtc_has_irq = 0; |
994 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); | 1026 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); |
995 | if (RTC_IOMAPPED) | 1027 | rtc_release_region(); |
996 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
997 | else | ||
998 | release_mem_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
999 | return -EIO; | 1028 | return -EIO; |
1000 | } | 1029 | } |
1001 | hpet_rtc_timer_init(); | 1030 | hpet_rtc_timer_init(); |
@@ -1009,7 +1038,7 @@ no_irq: | |||
1009 | free_irq(RTC_IRQ, NULL); | 1038 | free_irq(RTC_IRQ, NULL); |
1010 | rtc_has_irq = 0; | 1039 | rtc_has_irq = 0; |
1011 | #endif | 1040 | #endif |
1012 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | 1041 | rtc_release_region(); |
1013 | return -ENODEV; | 1042 | return -ENODEV; |
1014 | } | 1043 | } |
1015 | 1044 | ||
@@ -1091,10 +1120,7 @@ static void __exit rtc_exit (void) | |||
1091 | if (rtc_has_irq) | 1120 | if (rtc_has_irq) |
1092 | free_irq (rtc_irq, &rtc_port); | 1121 | free_irq (rtc_irq, &rtc_port); |
1093 | #else | 1122 | #else |
1094 | if (RTC_IOMAPPED) | 1123 | rtc_release_region(); |
1095 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
1096 | else | ||
1097 | release_mem_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
1098 | #ifdef RTC_IRQ | 1124 | #ifdef RTC_IRQ |
1099 | if (rtc_has_irq) | 1125 | if (rtc_has_irq) |
1100 | free_irq (RTC_IRQ, NULL); | 1126 | free_irq (RTC_IRQ, NULL); |
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index 7a003504c265..1bdd2bf4f37d 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -730,13 +730,23 @@ static int send_prio_char(struct tty_struct *tty, char ch) | |||
730 | return 0; | 730 | return 0; |
731 | } | 731 | } |
732 | 732 | ||
733 | int n_tty_ioctl(struct tty_struct * tty, struct file * file, | 733 | /** |
734 | unsigned int cmd, unsigned long arg) | 734 | * tty_mode_ioctl - mode related ioctls |
735 | * @tty: tty for the ioctl | ||
736 | * @file: file pointer for the tty | ||
737 | * @cmd: command | ||
738 | * @arg: ioctl argument | ||
739 | * | ||
740 | * Perform non line discipline specific mode control ioctls. This | ||
741 | * is designed to be called by line disciplines to ensure they provide | ||
742 | * consistent mode setting. | ||
743 | */ | ||
744 | |||
745 | int tty_mode_ioctl(struct tty_struct * tty, struct file *file, | ||
746 | unsigned int cmd, unsigned long arg) | ||
735 | { | 747 | { |
736 | struct tty_struct * real_tty; | 748 | struct tty_struct * real_tty; |
737 | void __user *p = (void __user *)arg; | 749 | void __user *p = (void __user *)arg; |
738 | int retval; | ||
739 | struct tty_ldisc *ld; | ||
740 | 750 | ||
741 | if (tty->driver->type == TTY_DRIVER_TYPE_PTY && | 751 | if (tty->driver->type == TTY_DRIVER_TYPE_PTY && |
742 | tty->driver->subtype == PTY_TYPE_MASTER) | 752 | tty->driver->subtype == PTY_TYPE_MASTER) |
@@ -799,6 +809,93 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file, | |||
799 | return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO); | 809 | return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO); |
800 | case TCSETA: | 810 | case TCSETA: |
801 | return set_termios(real_tty, p, TERMIOS_TERMIO); | 811 | return set_termios(real_tty, p, TERMIOS_TERMIO); |
812 | #ifndef TCGETS2 | ||
813 | case TIOCGLCKTRMIOS: | ||
814 | if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked)) | ||
815 | return -EFAULT; | ||
816 | return 0; | ||
817 | |||
818 | case TIOCSLCKTRMIOS: | ||
819 | if (!capable(CAP_SYS_ADMIN)) | ||
820 | return -EPERM; | ||
821 | if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg)) | ||
822 | return -EFAULT; | ||
823 | return 0; | ||
824 | #else | ||
825 | case TIOCGLCKTRMIOS: | ||
826 | if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios_locked)) | ||
827 | return -EFAULT; | ||
828 | return 0; | ||
829 | |||
830 | case TIOCSLCKTRMIOS: | ||
831 | if (!capable(CAP_SYS_ADMIN)) | ||
832 | return -EPERM; | ||
833 | if (user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios __user *) arg)) | ||
834 | return -EFAULT; | ||
835 | return 0; | ||
836 | #endif | ||
837 | case TIOCGSOFTCAR: | ||
838 | return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg); | ||
839 | case TIOCSSOFTCAR: | ||
840 | if (get_user(arg, (unsigned int __user *) arg)) | ||
841 | return -EFAULT; | ||
842 | mutex_lock(&tty->termios_mutex); | ||
843 | tty->termios->c_cflag = | ||
844 | ((tty->termios->c_cflag & ~CLOCAL) | | ||
845 | (arg ? CLOCAL : 0)); | ||
846 | mutex_unlock(&tty->termios_mutex); | ||
847 | return 0; | ||
848 | default: | ||
849 | return -ENOIOCTLCMD; | ||
850 | } | ||
851 | } | ||
852 | |||
853 | EXPORT_SYMBOL_GPL(tty_mode_ioctl); | ||
854 | |||
855 | int tty_perform_flush(struct tty_struct *tty, unsigned long arg) | ||
856 | { | ||
857 | struct tty_ldisc *ld; | ||
858 | int retval = tty_check_change(tty); | ||
859 | if (retval) | ||
860 | return retval; | ||
861 | |||
862 | ld = tty_ldisc_ref(tty); | ||
863 | switch (arg) { | ||
864 | case TCIFLUSH: | ||
865 | if (ld && ld->flush_buffer) | ||
866 | ld->flush_buffer(tty); | ||
867 | break; | ||
868 | case TCIOFLUSH: | ||
869 | if (ld && ld->flush_buffer) | ||
870 | ld->flush_buffer(tty); | ||
871 | /* fall through */ | ||
872 | case TCOFLUSH: | ||
873 | if (tty->driver->flush_buffer) | ||
874 | tty->driver->flush_buffer(tty); | ||
875 | break; | ||
876 | default: | ||
877 | tty_ldisc_deref(ld); | ||
878 | return -EINVAL; | ||
879 | } | ||
880 | tty_ldisc_deref(ld); | ||
881 | return 0; | ||
882 | } | ||
883 | |||
884 | EXPORT_SYMBOL_GPL(tty_perform_flush); | ||
885 | |||
886 | int n_tty_ioctl(struct tty_struct * tty, struct file * file, | ||
887 | unsigned int cmd, unsigned long arg) | ||
888 | { | ||
889 | struct tty_struct * real_tty; | ||
890 | int retval; | ||
891 | |||
892 | if (tty->driver->type == TTY_DRIVER_TYPE_PTY && | ||
893 | tty->driver->subtype == PTY_TYPE_MASTER) | ||
894 | real_tty = tty->link; | ||
895 | else | ||
896 | real_tty = tty; | ||
897 | |||
898 | switch (cmd) { | ||
802 | case TCXONC: | 899 | case TCXONC: |
803 | retval = tty_check_change(tty); | 900 | retval = tty_check_change(tty); |
804 | if (retval) | 901 | if (retval) |
@@ -829,30 +926,7 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file, | |||
829 | } | 926 | } |
830 | return 0; | 927 | return 0; |
831 | case TCFLSH: | 928 | case TCFLSH: |
832 | retval = tty_check_change(tty); | 929 | return tty_perform_flush(tty, arg); |
833 | if (retval) | ||
834 | return retval; | ||
835 | |||
836 | ld = tty_ldisc_ref(tty); | ||
837 | switch (arg) { | ||
838 | case TCIFLUSH: | ||
839 | if (ld && ld->flush_buffer) | ||
840 | ld->flush_buffer(tty); | ||
841 | break; | ||
842 | case TCIOFLUSH: | ||
843 | if (ld && ld->flush_buffer) | ||
844 | ld->flush_buffer(tty); | ||
845 | /* fall through */ | ||
846 | case TCOFLUSH: | ||
847 | if (tty->driver->flush_buffer) | ||
848 | tty->driver->flush_buffer(tty); | ||
849 | break; | ||
850 | default: | ||
851 | tty_ldisc_deref(ld); | ||
852 | return -EINVAL; | ||
853 | } | ||
854 | tty_ldisc_deref(ld); | ||
855 | return 0; | ||
856 | case TIOCOUTQ: | 930 | case TIOCOUTQ: |
857 | return put_user(tty->driver->chars_in_buffer ? | 931 | return put_user(tty->driver->chars_in_buffer ? |
858 | tty->driver->chars_in_buffer(tty) : 0, | 932 | tty->driver->chars_in_buffer(tty) : 0, |
@@ -862,32 +936,6 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file, | |||
862 | if (L_ICANON(tty)) | 936 | if (L_ICANON(tty)) |
863 | retval = inq_canon(tty); | 937 | retval = inq_canon(tty); |
864 | return put_user(retval, (unsigned int __user *) arg); | 938 | return put_user(retval, (unsigned int __user *) arg); |
865 | #ifndef TCGETS2 | ||
866 | case TIOCGLCKTRMIOS: | ||
867 | if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked)) | ||
868 | return -EFAULT; | ||
869 | return 0; | ||
870 | |||
871 | case TIOCSLCKTRMIOS: | ||
872 | if (!capable(CAP_SYS_ADMIN)) | ||
873 | return -EPERM; | ||
874 | if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg)) | ||
875 | return -EFAULT; | ||
876 | return 0; | ||
877 | #else | ||
878 | case TIOCGLCKTRMIOS: | ||
879 | if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios_locked)) | ||
880 | return -EFAULT; | ||
881 | return 0; | ||
882 | |||
883 | case TIOCSLCKTRMIOS: | ||
884 | if (!capable(CAP_SYS_ADMIN)) | ||
885 | return -EPERM; | ||
886 | if (user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios __user *) arg)) | ||
887 | return -EFAULT; | ||
888 | return 0; | ||
889 | #endif | ||
890 | |||
891 | case TIOCPKT: | 939 | case TIOCPKT: |
892 | { | 940 | { |
893 | int pktmode; | 941 | int pktmode; |
@@ -906,19 +954,9 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file, | |||
906 | tty->packet = 0; | 954 | tty->packet = 0; |
907 | return 0; | 955 | return 0; |
908 | } | 956 | } |
909 | case TIOCGSOFTCAR: | ||
910 | return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg); | ||
911 | case TIOCSSOFTCAR: | ||
912 | if (get_user(arg, (unsigned int __user *) arg)) | ||
913 | return -EFAULT; | ||
914 | mutex_lock(&tty->termios_mutex); | ||
915 | tty->termios->c_cflag = | ||
916 | ((tty->termios->c_cflag & ~CLOCAL) | | ||
917 | (arg ? CLOCAL : 0)); | ||
918 | mutex_unlock(&tty->termios_mutex); | ||
919 | return 0; | ||
920 | default: | 957 | default: |
921 | return -ENOIOCTLCMD; | 958 | /* Try the mode commands */ |
959 | return tty_mode_ioctl(tty, file, cmd, arg); | ||
922 | } | 960 | } |
923 | } | 961 | } |
924 | 962 | ||
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 100e8a201e3a..e34da5c97196 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -141,7 +141,7 @@ int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)) | |||
141 | * never remove the console device we never need this pointer again. | 141 | * never remove the console device we never need this pointer again. |
142 | * | 142 | * |
143 | * Finally we put our input buffer in the input queue, ready to receive. */ | 143 | * Finally we put our input buffer in the input queue, ready to receive. */ |
144 | static int virtcons_probe(struct virtio_device *dev) | 144 | static int __devinit virtcons_probe(struct virtio_device *dev) |
145 | { | 145 | { |
146 | int err; | 146 | int err; |
147 | struct hvc_struct *hvc; | 147 | struct hvc_struct *hvc; |
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 0e328d387af4..6883fcb79ad3 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -218,7 +218,7 @@ static void cn_rx_skb(struct sk_buff *__skb) | |||
218 | skb->len < nlh->nlmsg_len || | 218 | skb->len < nlh->nlmsg_len || |
219 | nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) { | 219 | nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) { |
220 | kfree_skb(skb); | 220 | kfree_skb(skb); |
221 | goto out; | 221 | return; |
222 | } | 222 | } |
223 | 223 | ||
224 | len = NLMSG_ALIGN(nlh->nlmsg_len); | 224 | len = NLMSG_ALIGN(nlh->nlmsg_len); |
@@ -229,9 +229,6 @@ static void cn_rx_skb(struct sk_buff *__skb) | |||
229 | if (err < 0) | 229 | if (err < 0) |
230 | kfree_skb(skb); | 230 | kfree_skb(skb); |
231 | } | 231 | } |
232 | |||
233 | out: | ||
234 | kfree_skb(__skb); | ||
235 | } | 232 | } |
236 | 233 | ||
237 | /* | 234 | /* |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 4bd33ce8a6f3..1bba99747f5b 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -37,17 +37,17 @@ | |||
37 | #define DEF_FREQUENCY_UP_THRESHOLD (80) | 37 | #define DEF_FREQUENCY_UP_THRESHOLD (80) |
38 | #define DEF_FREQUENCY_DOWN_THRESHOLD (20) | 38 | #define DEF_FREQUENCY_DOWN_THRESHOLD (20) |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * The polling frequency of this governor depends on the capability of | 41 | * The polling frequency of this governor depends on the capability of |
42 | * the processor. Default polling frequency is 1000 times the transition | 42 | * the processor. Default polling frequency is 1000 times the transition |
43 | * latency of the processor. The governor will work on any processor with | 43 | * latency of the processor. The governor will work on any processor with |
44 | * transition latency <= 10mS, using appropriate sampling | 44 | * transition latency <= 10mS, using appropriate sampling |
45 | * rate. | 45 | * rate. |
46 | * For CPUs with transition latency > 10mS (mostly drivers | 46 | * For CPUs with transition latency > 10mS (mostly drivers |
47 | * with CPUFREQ_ETERNAL), this governor will not work. | 47 | * with CPUFREQ_ETERNAL), this governor will not work. |
48 | * All times here are in uS. | 48 | * All times here are in uS. |
49 | */ | 49 | */ |
50 | static unsigned int def_sampling_rate; | 50 | static unsigned int def_sampling_rate; |
51 | #define MIN_SAMPLING_RATE_RATIO (2) | 51 | #define MIN_SAMPLING_RATE_RATIO (2) |
52 | /* for correct statistics, we need at least 10 ticks between each measure */ | 52 | /* for correct statistics, we need at least 10 ticks between each measure */ |
53 | #define MIN_STAT_SAMPLING_RATE \ | 53 | #define MIN_STAT_SAMPLING_RATE \ |
@@ -63,12 +63,12 @@ static unsigned int def_sampling_rate; | |||
63 | static void do_dbs_timer(struct work_struct *work); | 63 | static void do_dbs_timer(struct work_struct *work); |
64 | 64 | ||
65 | struct cpu_dbs_info_s { | 65 | struct cpu_dbs_info_s { |
66 | struct cpufreq_policy *cur_policy; | 66 | struct cpufreq_policy *cur_policy; |
67 | unsigned int prev_cpu_idle_up; | 67 | unsigned int prev_cpu_idle_up; |
68 | unsigned int prev_cpu_idle_down; | 68 | unsigned int prev_cpu_idle_down; |
69 | unsigned int enable; | 69 | unsigned int enable; |
70 | unsigned int down_skip; | 70 | unsigned int down_skip; |
71 | unsigned int requested_freq; | 71 | unsigned int requested_freq; |
72 | }; | 72 | }; |
73 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); | 73 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); |
74 | 74 | ||
@@ -82,24 +82,24 @@ static unsigned int dbs_enable; /* number of CPUs using this policy */ | |||
82 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock | 82 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock |
83 | * is recursive for the same process. -Venki | 83 | * is recursive for the same process. -Venki |
84 | */ | 84 | */ |
85 | static DEFINE_MUTEX (dbs_mutex); | 85 | static DEFINE_MUTEX (dbs_mutex); |
86 | static DECLARE_DELAYED_WORK(dbs_work, do_dbs_timer); | 86 | static DECLARE_DELAYED_WORK(dbs_work, do_dbs_timer); |
87 | 87 | ||
88 | struct dbs_tuners { | 88 | struct dbs_tuners { |
89 | unsigned int sampling_rate; | 89 | unsigned int sampling_rate; |
90 | unsigned int sampling_down_factor; | 90 | unsigned int sampling_down_factor; |
91 | unsigned int up_threshold; | 91 | unsigned int up_threshold; |
92 | unsigned int down_threshold; | 92 | unsigned int down_threshold; |
93 | unsigned int ignore_nice; | 93 | unsigned int ignore_nice; |
94 | unsigned int freq_step; | 94 | unsigned int freq_step; |
95 | }; | 95 | }; |
96 | 96 | ||
97 | static struct dbs_tuners dbs_tuners_ins = { | 97 | static struct dbs_tuners dbs_tuners_ins = { |
98 | .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, | 98 | .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, |
99 | .down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD, | 99 | .down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD, |
100 | .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, | 100 | .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, |
101 | .ignore_nice = 0, | 101 | .ignore_nice = 0, |
102 | .freq_step = 5, | 102 | .freq_step = 5, |
103 | }; | 103 | }; |
104 | 104 | ||
105 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) | 105 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) |
@@ -109,13 +109,34 @@ static inline unsigned int get_cpu_idle_time(unsigned int cpu) | |||
109 | if (dbs_tuners_ins.ignore_nice) | 109 | if (dbs_tuners_ins.ignore_nice) |
110 | add_nice = kstat_cpu(cpu).cpustat.nice; | 110 | add_nice = kstat_cpu(cpu).cpustat.nice; |
111 | 111 | ||
112 | ret = kstat_cpu(cpu).cpustat.idle + | 112 | ret = kstat_cpu(cpu).cpustat.idle + |
113 | kstat_cpu(cpu).cpustat.iowait + | 113 | kstat_cpu(cpu).cpustat.iowait + |
114 | add_nice; | 114 | add_nice; |
115 | 115 | ||
116 | return ret; | 116 | return ret; |
117 | } | 117 | } |
118 | 118 | ||
119 | /* keep track of frequency transitions */ | ||
120 | static int | ||
121 | dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | ||
122 | void *data) | ||
123 | { | ||
124 | struct cpufreq_freqs *freq = data; | ||
125 | struct cpu_dbs_info_s *this_dbs_info = &per_cpu(cpu_dbs_info, | ||
126 | freq->cpu); | ||
127 | |||
128 | if (!this_dbs_info->enable) | ||
129 | return 0; | ||
130 | |||
131 | this_dbs_info->requested_freq = freq->new; | ||
132 | |||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static struct notifier_block dbs_cpufreq_notifier_block = { | ||
137 | .notifier_call = dbs_cpufreq_notifier | ||
138 | }; | ||
139 | |||
119 | /************************** sysfs interface ************************/ | 140 | /************************** sysfs interface ************************/ |
120 | static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf) | 141 | static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf) |
121 | { | 142 | { |
@@ -127,8 +148,8 @@ static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf) | |||
127 | return sprintf (buf, "%u\n", MIN_SAMPLING_RATE); | 148 | return sprintf (buf, "%u\n", MIN_SAMPLING_RATE); |
128 | } | 149 | } |
129 | 150 | ||
130 | #define define_one_ro(_name) \ | 151 | #define define_one_ro(_name) \ |
131 | static struct freq_attr _name = \ | 152 | static struct freq_attr _name = \ |
132 | __ATTR(_name, 0444, show_##_name, NULL) | 153 | __ATTR(_name, 0444, show_##_name, NULL) |
133 | 154 | ||
134 | define_one_ro(sampling_rate_max); | 155 | define_one_ro(sampling_rate_max); |
@@ -148,7 +169,7 @@ show_one(down_threshold, down_threshold); | |||
148 | show_one(ignore_nice_load, ignore_nice); | 169 | show_one(ignore_nice_load, ignore_nice); |
149 | show_one(freq_step, freq_step); | 170 | show_one(freq_step, freq_step); |
150 | 171 | ||
151 | static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, | 172 | static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, |
152 | const char *buf, size_t count) | 173 | const char *buf, size_t count) |
153 | { | 174 | { |
154 | unsigned int input; | 175 | unsigned int input; |
@@ -164,7 +185,7 @@ static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, | |||
164 | return count; | 185 | return count; |
165 | } | 186 | } |
166 | 187 | ||
167 | static ssize_t store_sampling_rate(struct cpufreq_policy *unused, | 188 | static ssize_t store_sampling_rate(struct cpufreq_policy *unused, |
168 | const char *buf, size_t count) | 189 | const char *buf, size_t count) |
169 | { | 190 | { |
170 | unsigned int input; | 191 | unsigned int input; |
@@ -183,7 +204,7 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused, | |||
183 | return count; | 204 | return count; |
184 | } | 205 | } |
185 | 206 | ||
186 | static ssize_t store_up_threshold(struct cpufreq_policy *unused, | 207 | static ssize_t store_up_threshold(struct cpufreq_policy *unused, |
187 | const char *buf, size_t count) | 208 | const char *buf, size_t count) |
188 | { | 209 | { |
189 | unsigned int input; | 210 | unsigned int input; |
@@ -202,7 +223,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused, | |||
202 | return count; | 223 | return count; |
203 | } | 224 | } |
204 | 225 | ||
205 | static ssize_t store_down_threshold(struct cpufreq_policy *unused, | 226 | static ssize_t store_down_threshold(struct cpufreq_policy *unused, |
206 | const char *buf, size_t count) | 227 | const char *buf, size_t count) |
207 | { | 228 | { |
208 | unsigned int input; | 229 | unsigned int input; |
@@ -228,16 +249,16 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy, | |||
228 | int ret; | 249 | int ret; |
229 | 250 | ||
230 | unsigned int j; | 251 | unsigned int j; |
231 | 252 | ||
232 | ret = sscanf (buf, "%u", &input); | 253 | ret = sscanf(buf, "%u", &input); |
233 | if ( ret != 1 ) | 254 | if (ret != 1) |
234 | return -EINVAL; | 255 | return -EINVAL; |
235 | 256 | ||
236 | if ( input > 1 ) | 257 | if (input > 1) |
237 | input = 1; | 258 | input = 1; |
238 | 259 | ||
239 | mutex_lock(&dbs_mutex); | 260 | mutex_lock(&dbs_mutex); |
240 | if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */ | 261 | if (input == dbs_tuners_ins.ignore_nice) { /* nothing to do */ |
241 | mutex_unlock(&dbs_mutex); | 262 | mutex_unlock(&dbs_mutex); |
242 | return count; | 263 | return count; |
243 | } | 264 | } |
@@ -261,14 +282,14 @@ static ssize_t store_freq_step(struct cpufreq_policy *policy, | |||
261 | unsigned int input; | 282 | unsigned int input; |
262 | int ret; | 283 | int ret; |
263 | 284 | ||
264 | ret = sscanf (buf, "%u", &input); | 285 | ret = sscanf(buf, "%u", &input); |
265 | 286 | ||
266 | if ( ret != 1 ) | 287 | if (ret != 1) |
267 | return -EINVAL; | 288 | return -EINVAL; |
268 | 289 | ||
269 | if ( input > 100 ) | 290 | if (input > 100) |
270 | input = 100; | 291 | input = 100; |
271 | 292 | ||
272 | /* no need to test here if freq_step is zero as the user might actually | 293 | /* no need to test here if freq_step is zero as the user might actually |
273 | * want this, they would be crazy though :) */ | 294 | * want this, they would be crazy though :) */ |
274 | mutex_lock(&dbs_mutex); | 295 | mutex_lock(&dbs_mutex); |
@@ -322,18 +343,18 @@ static void dbs_check_cpu(int cpu) | |||
322 | 343 | ||
323 | policy = this_dbs_info->cur_policy; | 344 | policy = this_dbs_info->cur_policy; |
324 | 345 | ||
325 | /* | 346 | /* |
326 | * The default safe range is 20% to 80% | 347 | * The default safe range is 20% to 80% |
327 | * Every sampling_rate, we check | 348 | * Every sampling_rate, we check |
328 | * - If current idle time is less than 20%, then we try to | 349 | * - If current idle time is less than 20%, then we try to |
329 | * increase frequency | 350 | * increase frequency |
330 | * Every sampling_rate*sampling_down_factor, we check | 351 | * Every sampling_rate*sampling_down_factor, we check |
331 | * - If current idle time is more than 80%, then we try to | 352 | * - If current idle time is more than 80%, then we try to |
332 | * decrease frequency | 353 | * decrease frequency |
333 | * | 354 | * |
334 | * Any frequency increase takes it to the maximum frequency. | 355 | * Any frequency increase takes it to the maximum frequency. |
335 | * Frequency reduction happens at minimum steps of | 356 | * Frequency reduction happens at minimum steps of |
336 | * 5% (default) of max_frequency | 357 | * 5% (default) of max_frequency |
337 | */ | 358 | */ |
338 | 359 | ||
339 | /* Check for frequency increase */ | 360 | /* Check for frequency increase */ |
@@ -361,13 +382,13 @@ static void dbs_check_cpu(int cpu) | |||
361 | /* if we are already at full speed then break out early */ | 382 | /* if we are already at full speed then break out early */ |
362 | if (this_dbs_info->requested_freq == policy->max) | 383 | if (this_dbs_info->requested_freq == policy->max) |
363 | return; | 384 | return; |
364 | 385 | ||
365 | freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100; | 386 | freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100; |
366 | 387 | ||
367 | /* max freq cannot be less than 100. But who knows.... */ | 388 | /* max freq cannot be less than 100. But who knows.... */ |
368 | if (unlikely(freq_step == 0)) | 389 | if (unlikely(freq_step == 0)) |
369 | freq_step = 5; | 390 | freq_step = 5; |
370 | 391 | ||
371 | this_dbs_info->requested_freq += freq_step; | 392 | this_dbs_info->requested_freq += freq_step; |
372 | if (this_dbs_info->requested_freq > policy->max) | 393 | if (this_dbs_info->requested_freq > policy->max) |
373 | this_dbs_info->requested_freq = policy->max; | 394 | this_dbs_info->requested_freq = policy->max; |
@@ -427,15 +448,15 @@ static void dbs_check_cpu(int cpu) | |||
427 | } | 448 | } |
428 | 449 | ||
429 | static void do_dbs_timer(struct work_struct *work) | 450 | static void do_dbs_timer(struct work_struct *work) |
430 | { | 451 | { |
431 | int i; | 452 | int i; |
432 | mutex_lock(&dbs_mutex); | 453 | mutex_lock(&dbs_mutex); |
433 | for_each_online_cpu(i) | 454 | for_each_online_cpu(i) |
434 | dbs_check_cpu(i); | 455 | dbs_check_cpu(i); |
435 | schedule_delayed_work(&dbs_work, | 456 | schedule_delayed_work(&dbs_work, |
436 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); | 457 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); |
437 | mutex_unlock(&dbs_mutex); | 458 | mutex_unlock(&dbs_mutex); |
438 | } | 459 | } |
439 | 460 | ||
440 | static inline void dbs_timer_init(void) | 461 | static inline void dbs_timer_init(void) |
441 | { | 462 | { |
@@ -462,13 +483,12 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
462 | 483 | ||
463 | switch (event) { | 484 | switch (event) { |
464 | case CPUFREQ_GOV_START: | 485 | case CPUFREQ_GOV_START: |
465 | if ((!cpu_online(cpu)) || | 486 | if ((!cpu_online(cpu)) || (!policy->cur)) |
466 | (!policy->cur)) | ||
467 | return -EINVAL; | 487 | return -EINVAL; |
468 | 488 | ||
469 | if (this_dbs_info->enable) /* Already enabled */ | 489 | if (this_dbs_info->enable) /* Already enabled */ |
470 | break; | 490 | break; |
471 | 491 | ||
472 | mutex_lock(&dbs_mutex); | 492 | mutex_lock(&dbs_mutex); |
473 | 493 | ||
474 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); | 494 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); |
@@ -481,7 +501,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
481 | struct cpu_dbs_info_s *j_dbs_info; | 501 | struct cpu_dbs_info_s *j_dbs_info; |
482 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 502 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
483 | j_dbs_info->cur_policy = policy; | 503 | j_dbs_info->cur_policy = policy; |
484 | 504 | ||
485 | j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(cpu); | 505 | j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(cpu); |
486 | j_dbs_info->prev_cpu_idle_down | 506 | j_dbs_info->prev_cpu_idle_down |
487 | = j_dbs_info->prev_cpu_idle_up; | 507 | = j_dbs_info->prev_cpu_idle_up; |
@@ -511,8 +531,11 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
511 | dbs_tuners_ins.sampling_rate = def_sampling_rate; | 531 | dbs_tuners_ins.sampling_rate = def_sampling_rate; |
512 | 532 | ||
513 | dbs_timer_init(); | 533 | dbs_timer_init(); |
534 | cpufreq_register_notifier( | ||
535 | &dbs_cpufreq_notifier_block, | ||
536 | CPUFREQ_TRANSITION_NOTIFIER); | ||
514 | } | 537 | } |
515 | 538 | ||
516 | mutex_unlock(&dbs_mutex); | 539 | mutex_unlock(&dbs_mutex); |
517 | break; | 540 | break; |
518 | 541 | ||
@@ -525,9 +548,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
525 | * Stop the timerschedule work, when this governor | 548 | * Stop the timerschedule work, when this governor |
526 | * is used for first time | 549 | * is used for first time |
527 | */ | 550 | */ |
528 | if (dbs_enable == 0) | 551 | if (dbs_enable == 0) { |
529 | dbs_timer_exit(); | 552 | dbs_timer_exit(); |
530 | 553 | cpufreq_unregister_notifier( | |
554 | &dbs_cpufreq_notifier_block, | ||
555 | CPUFREQ_TRANSITION_NOTIFIER); | ||
556 | } | ||
557 | |||
531 | mutex_unlock(&dbs_mutex); | 558 | mutex_unlock(&dbs_mutex); |
532 | 559 | ||
533 | break; | 560 | break; |
@@ -537,11 +564,11 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
537 | if (policy->max < this_dbs_info->cur_policy->cur) | 564 | if (policy->max < this_dbs_info->cur_policy->cur) |
538 | __cpufreq_driver_target( | 565 | __cpufreq_driver_target( |
539 | this_dbs_info->cur_policy, | 566 | this_dbs_info->cur_policy, |
540 | policy->max, CPUFREQ_RELATION_H); | 567 | policy->max, CPUFREQ_RELATION_H); |
541 | else if (policy->min > this_dbs_info->cur_policy->cur) | 568 | else if (policy->min > this_dbs_info->cur_policy->cur) |
542 | __cpufreq_driver_target( | 569 | __cpufreq_driver_target( |
543 | this_dbs_info->cur_policy, | 570 | this_dbs_info->cur_policy, |
544 | policy->min, CPUFREQ_RELATION_L); | 571 | policy->min, CPUFREQ_RELATION_L); |
545 | mutex_unlock(&dbs_mutex); | 572 | mutex_unlock(&dbs_mutex); |
546 | break; | 573 | break; |
547 | } | 574 | } |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index fdf4106b817b..d2fabe7863a9 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include "cpuidle.h" | 19 | #include "cpuidle.h" |
20 | 20 | ||
21 | DEFINE_PER_CPU(struct cpuidle_device *, cpuidle_devices); | 21 | DEFINE_PER_CPU(struct cpuidle_device *, cpuidle_devices); |
22 | EXPORT_PER_CPU_SYMBOL_GPL(cpuidle_devices); | ||
23 | 22 | ||
24 | DEFINE_MUTEX(cpuidle_lock); | 23 | DEFINE_MUTEX(cpuidle_lock); |
25 | LIST_HEAD(cpuidle_detected_devices); | 24 | LIST_HEAD(cpuidle_detected_devices); |
diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c index bb699cb2dc5a..70b59642a708 100644 --- a/drivers/cpuidle/governor.c +++ b/drivers/cpuidle/governor.c | |||
@@ -94,8 +94,6 @@ int cpuidle_register_governor(struct cpuidle_governor *gov) | |||
94 | return ret; | 94 | return ret; |
95 | } | 95 | } |
96 | 96 | ||
97 | EXPORT_SYMBOL_GPL(cpuidle_register_governor); | ||
98 | |||
99 | /** | 97 | /** |
100 | * cpuidle_replace_governor - find a replacement governor | 98 | * cpuidle_replace_governor - find a replacement governor |
101 | * @exclude_rating: the rating that will be skipped while looking for | 99 | * @exclude_rating: the rating that will be skipped while looking for |
@@ -138,4 +136,3 @@ void cpuidle_unregister_governor(struct cpuidle_governor *gov) | |||
138 | mutex_unlock(&cpuidle_lock); | 136 | mutex_unlock(&cpuidle_lock); |
139 | } | 137 | } |
140 | 138 | ||
141 | EXPORT_SYMBOL_GPL(cpuidle_unregister_governor); | ||
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c index f9a34abbf4fa..711e246e1ef0 100644 --- a/drivers/crypto/geode-aes.c +++ b/drivers/crypto/geode-aes.c | |||
@@ -110,8 +110,7 @@ geode_aes_crypt(struct geode_aes_op *op) | |||
110 | * we don't need to worry | 110 | * we don't need to worry |
111 | */ | 111 | */ |
112 | 112 | ||
113 | if (op->src == op->dst) | 113 | flags |= (AES_CTRL_DCA | AES_CTRL_SCA); |
114 | flags |= (AES_CTRL_DCA | AES_CTRL_SCA); | ||
115 | 114 | ||
116 | if (op->dir == AES_DIR_ENCRYPT) | 115 | if (op->dir == AES_DIR_ENCRYPT) |
117 | flags |= AES_CTRL_ENCRYPT; | 116 | flags |= AES_CTRL_ENCRYPT; |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 9c91b0fd134f..6a7d25fc2470 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -43,7 +43,6 @@ comment "DMA Clients" | |||
43 | config NET_DMA | 43 | config NET_DMA |
44 | bool "Network: TCP receive copy offload" | 44 | bool "Network: TCP receive copy offload" |
45 | depends on DMA_ENGINE && NET | 45 | depends on DMA_ENGINE && NET |
46 | default y | ||
47 | help | 46 | help |
48 | This enables the use of DMA engines in the network stack to | 47 | This enables the use of DMA engines in the network stack to |
49 | offload receive copy-to-user operations, freeing CPU cycles. | 48 | offload receive copy-to-user operations, freeing CPU cycles. |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 82489923af09..d59b2f417306 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -182,10 +182,9 @@ static void dma_client_chan_alloc(struct dma_client *client) | |||
182 | /* we are done once this client rejects | 182 | /* we are done once this client rejects |
183 | * an available resource | 183 | * an available resource |
184 | */ | 184 | */ |
185 | if (ack == DMA_ACK) { | 185 | if (ack == DMA_ACK) |
186 | dma_chan_get(chan); | 186 | dma_chan_get(chan); |
187 | kref_get(&device->refcount); | 187 | else if (ack == DMA_NAK) |
188 | } else if (ack == DMA_NAK) | ||
189 | return; | 188 | return; |
190 | } | 189 | } |
191 | } | 190 | } |
@@ -272,11 +271,8 @@ static void dma_clients_notify_removed(struct dma_chan *chan) | |||
272 | /* client was holding resources for this channel so | 271 | /* client was holding resources for this channel so |
273 | * free it | 272 | * free it |
274 | */ | 273 | */ |
275 | if (ack == DMA_ACK) { | 274 | if (ack == DMA_ACK) |
276 | dma_chan_put(chan); | 275 | dma_chan_put(chan); |
277 | kref_put(&chan->device->refcount, | ||
278 | dma_async_device_cleanup); | ||
279 | } | ||
280 | } | 276 | } |
281 | 277 | ||
282 | mutex_unlock(&dma_list_mutex); | 278 | mutex_unlock(&dma_list_mutex); |
@@ -316,11 +312,8 @@ void dma_async_client_unregister(struct dma_client *client) | |||
316 | ack = client->event_callback(client, chan, | 312 | ack = client->event_callback(client, chan, |
317 | DMA_RESOURCE_REMOVED); | 313 | DMA_RESOURCE_REMOVED); |
318 | 314 | ||
319 | if (ack == DMA_ACK) { | 315 | if (ack == DMA_ACK) |
320 | dma_chan_put(chan); | 316 | dma_chan_put(chan); |
321 | kref_put(&chan->device->refcount, | ||
322 | dma_async_device_cleanup); | ||
323 | } | ||
324 | } | 317 | } |
325 | 318 | ||
326 | list_del(&client->global_node); | 319 | list_del(&client->global_node); |
@@ -397,6 +390,8 @@ int dma_async_device_register(struct dma_device *device) | |||
397 | goto err_out; | 390 | goto err_out; |
398 | } | 391 | } |
399 | 392 | ||
393 | /* One for the channel, one of the class device */ | ||
394 | kref_get(&device->refcount); | ||
400 | kref_get(&device->refcount); | 395 | kref_get(&device->refcount); |
401 | kref_init(&chan->refcount); | 396 | kref_init(&chan->refcount); |
402 | chan->slow_ref = 0; | 397 | chan->slow_ref = 0; |
diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c index f204c39fb412..16e0fd8facfb 100644 --- a/drivers/dma/ioat.c +++ b/drivers/dma/ioat.c | |||
@@ -39,10 +39,14 @@ MODULE_LICENSE("GPL"); | |||
39 | MODULE_AUTHOR("Intel Corporation"); | 39 | MODULE_AUTHOR("Intel Corporation"); |
40 | 40 | ||
41 | static struct pci_device_id ioat_pci_tbl[] = { | 41 | static struct pci_device_id ioat_pci_tbl[] = { |
42 | /* I/OAT v1 platforms */ | ||
42 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT) }, | 43 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT) }, |
43 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB) }, | 44 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB) }, |
44 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SCNB) }, | 45 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SCNB) }, |
45 | { PCI_DEVICE(PCI_VENDOR_ID_UNISYS, PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR) }, | 46 | { PCI_DEVICE(PCI_VENDOR_ID_UNISYS, PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR) }, |
47 | |||
48 | /* I/OAT v2 platforms */ | ||
49 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SNB) }, | ||
46 | { 0, } | 50 | { 0, } |
47 | }; | 51 | }; |
48 | 52 | ||
@@ -74,10 +78,17 @@ static int ioat_setup_functionality(struct pci_dev *pdev, void __iomem *iobase) | |||
74 | if (device->dma && ioat_dca_enabled) | 78 | if (device->dma && ioat_dca_enabled) |
75 | device->dca = ioat_dca_init(pdev, iobase); | 79 | device->dca = ioat_dca_init(pdev, iobase); |
76 | break; | 80 | break; |
81 | case IOAT_VER_2_0: | ||
82 | device->dma = ioat_dma_probe(pdev, iobase); | ||
83 | if (device->dma && ioat_dca_enabled) | ||
84 | device->dca = ioat2_dca_init(pdev, iobase); | ||
85 | break; | ||
77 | default: | 86 | default: |
78 | err = -ENODEV; | 87 | err = -ENODEV; |
79 | break; | 88 | break; |
80 | } | 89 | } |
90 | if (!device->dma) | ||
91 | err = -ENODEV; | ||
81 | return err; | 92 | return err; |
82 | } | 93 | } |
83 | 94 | ||
diff --git a/drivers/dma/ioat_dca.c b/drivers/dma/ioat_dca.c index ba985715b803..0fa8a98051a8 100644 --- a/drivers/dma/ioat_dca.c +++ b/drivers/dma/ioat_dca.c | |||
@@ -261,3 +261,167 @@ struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase) | |||
261 | return dca; | 261 | return dca; |
262 | } | 262 | } |
263 | 263 | ||
264 | |||
265 | static int ioat2_dca_add_requester(struct dca_provider *dca, struct device *dev) | ||
266 | { | ||
267 | struct ioat_dca_priv *ioatdca = dca_priv(dca); | ||
268 | struct pci_dev *pdev; | ||
269 | int i; | ||
270 | u16 id; | ||
271 | u16 global_req_table; | ||
272 | |||
273 | /* This implementation only supports PCI-Express */ | ||
274 | if (dev->bus != &pci_bus_type) | ||
275 | return -ENODEV; | ||
276 | pdev = to_pci_dev(dev); | ||
277 | id = dcaid_from_pcidev(pdev); | ||
278 | |||
279 | if (ioatdca->requester_count == ioatdca->max_requesters) | ||
280 | return -ENODEV; | ||
281 | |||
282 | for (i = 0; i < ioatdca->max_requesters; i++) { | ||
283 | if (ioatdca->req_slots[i].pdev == NULL) { | ||
284 | /* found an empty slot */ | ||
285 | ioatdca->requester_count++; | ||
286 | ioatdca->req_slots[i].pdev = pdev; | ||
287 | ioatdca->req_slots[i].rid = id; | ||
288 | global_req_table = | ||
289 | readw(ioatdca->dca_base + IOAT_DCA_GREQID_OFFSET); | ||
290 | writel(id | IOAT_DCA_GREQID_VALID, | ||
291 | ioatdca->iobase + global_req_table + (i * 4)); | ||
292 | return i; | ||
293 | } | ||
294 | } | ||
295 | /* Error, ioatdma->requester_count is out of whack */ | ||
296 | return -EFAULT; | ||
297 | } | ||
298 | |||
299 | static int ioat2_dca_remove_requester(struct dca_provider *dca, | ||
300 | struct device *dev) | ||
301 | { | ||
302 | struct ioat_dca_priv *ioatdca = dca_priv(dca); | ||
303 | struct pci_dev *pdev; | ||
304 | int i; | ||
305 | u16 global_req_table; | ||
306 | |||
307 | /* This implementation only supports PCI-Express */ | ||
308 | if (dev->bus != &pci_bus_type) | ||
309 | return -ENODEV; | ||
310 | pdev = to_pci_dev(dev); | ||
311 | |||
312 | for (i = 0; i < ioatdca->max_requesters; i++) { | ||
313 | if (ioatdca->req_slots[i].pdev == pdev) { | ||
314 | global_req_table = | ||
315 | readw(ioatdca->dca_base + IOAT_DCA_GREQID_OFFSET); | ||
316 | writel(0, ioatdca->iobase + global_req_table + (i * 4)); | ||
317 | ioatdca->req_slots[i].pdev = NULL; | ||
318 | ioatdca->req_slots[i].rid = 0; | ||
319 | ioatdca->requester_count--; | ||
320 | return i; | ||
321 | } | ||
322 | } | ||
323 | return -ENODEV; | ||
324 | } | ||
325 | |||
326 | static u8 ioat2_dca_get_tag(struct dca_provider *dca, int cpu) | ||
327 | { | ||
328 | u8 tag; | ||
329 | |||
330 | tag = ioat_dca_get_tag(dca, cpu); | ||
331 | tag = (~tag) & 0x1F; | ||
332 | return tag; | ||
333 | } | ||
334 | |||
335 | static struct dca_ops ioat2_dca_ops = { | ||
336 | .add_requester = ioat2_dca_add_requester, | ||
337 | .remove_requester = ioat2_dca_remove_requester, | ||
338 | .get_tag = ioat2_dca_get_tag, | ||
339 | }; | ||
340 | |||
341 | static int ioat2_dca_count_dca_slots(void *iobase, u16 dca_offset) | ||
342 | { | ||
343 | int slots = 0; | ||
344 | u32 req; | ||
345 | u16 global_req_table; | ||
346 | |||
347 | global_req_table = readw(iobase + dca_offset + IOAT_DCA_GREQID_OFFSET); | ||
348 | if (global_req_table == 0) | ||
349 | return 0; | ||
350 | do { | ||
351 | req = readl(iobase + global_req_table + (slots * sizeof(u32))); | ||
352 | slots++; | ||
353 | } while ((req & IOAT_DCA_GREQID_LASTID) == 0); | ||
354 | |||
355 | return slots; | ||
356 | } | ||
357 | |||
358 | struct dca_provider *ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase) | ||
359 | { | ||
360 | struct dca_provider *dca; | ||
361 | struct ioat_dca_priv *ioatdca; | ||
362 | int slots; | ||
363 | int i; | ||
364 | int err; | ||
365 | u32 tag_map; | ||
366 | u16 dca_offset; | ||
367 | u16 csi_fsb_control; | ||
368 | u16 pcie_control; | ||
369 | u8 bit; | ||
370 | |||
371 | if (!system_has_dca_enabled(pdev)) | ||
372 | return NULL; | ||
373 | |||
374 | dca_offset = readw(iobase + IOAT_DCAOFFSET_OFFSET); | ||
375 | if (dca_offset == 0) | ||
376 | return NULL; | ||
377 | |||
378 | slots = ioat2_dca_count_dca_slots(iobase, dca_offset); | ||
379 | if (slots == 0) | ||
380 | return NULL; | ||
381 | |||
382 | dca = alloc_dca_provider(&ioat2_dca_ops, | ||
383 | sizeof(*ioatdca) | ||
384 | + (sizeof(struct ioat_dca_slot) * slots)); | ||
385 | if (!dca) | ||
386 | return NULL; | ||
387 | |||
388 | ioatdca = dca_priv(dca); | ||
389 | ioatdca->iobase = iobase; | ||
390 | ioatdca->dca_base = iobase + dca_offset; | ||
391 | ioatdca->max_requesters = slots; | ||
392 | |||
393 | /* some bios might not know to turn these on */ | ||
394 | csi_fsb_control = readw(ioatdca->dca_base + IOAT_FSB_CAP_ENABLE_OFFSET); | ||
395 | if ((csi_fsb_control & IOAT_FSB_CAP_ENABLE_PREFETCH) == 0) { | ||
396 | csi_fsb_control |= IOAT_FSB_CAP_ENABLE_PREFETCH; | ||
397 | writew(csi_fsb_control, | ||
398 | ioatdca->dca_base + IOAT_FSB_CAP_ENABLE_OFFSET); | ||
399 | } | ||
400 | pcie_control = readw(ioatdca->dca_base + IOAT_PCI_CAP_ENABLE_OFFSET); | ||
401 | if ((pcie_control & IOAT_PCI_CAP_ENABLE_MEMWR) == 0) { | ||
402 | pcie_control |= IOAT_PCI_CAP_ENABLE_MEMWR; | ||
403 | writew(pcie_control, | ||
404 | ioatdca->dca_base + IOAT_PCI_CAP_ENABLE_OFFSET); | ||
405 | } | ||
406 | |||
407 | |||
408 | /* TODO version, compatibility and configuration checks */ | ||
409 | |||
410 | /* copy out the APIC to DCA tag map */ | ||
411 | tag_map = readl(ioatdca->dca_base + IOAT_APICID_TAG_MAP_OFFSET); | ||
412 | for (i = 0; i < 5; i++) { | ||
413 | bit = (tag_map >> (4 * i)) & 0x0f; | ||
414 | if (bit < 8) | ||
415 | ioatdca->tag_map[i] = bit | DCA_TAG_MAP_VALID; | ||
416 | else | ||
417 | ioatdca->tag_map[i] = 0; | ||
418 | } | ||
419 | |||
420 | err = register_dca_provider(dca, &pdev->dev); | ||
421 | if (err) { | ||
422 | free_dca_provider(dca); | ||
423 | return NULL; | ||
424 | } | ||
425 | |||
426 | return dca; | ||
427 | } | ||
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index 7e4a785c2dff..c1c2dcc6fc2e 100644 --- a/drivers/dma/ioat_dma.c +++ b/drivers/dma/ioat_dma.c | |||
@@ -36,18 +36,24 @@ | |||
36 | #include "ioatdma_registers.h" | 36 | #include "ioatdma_registers.h" |
37 | #include "ioatdma_hw.h" | 37 | #include "ioatdma_hw.h" |
38 | 38 | ||
39 | #define INITIAL_IOAT_DESC_COUNT 128 | ||
40 | |||
41 | #define to_ioat_chan(chan) container_of(chan, struct ioat_dma_chan, common) | 39 | #define to_ioat_chan(chan) container_of(chan, struct ioat_dma_chan, common) |
42 | #define to_ioatdma_device(dev) container_of(dev, struct ioatdma_device, common) | 40 | #define to_ioatdma_device(dev) container_of(dev, struct ioatdma_device, common) |
43 | #define to_ioat_desc(lh) container_of(lh, struct ioat_desc_sw, node) | 41 | #define to_ioat_desc(lh) container_of(lh, struct ioat_desc_sw, node) |
44 | #define tx_to_ioat_desc(tx) container_of(tx, struct ioat_desc_sw, async_tx) | 42 | #define tx_to_ioat_desc(tx) container_of(tx, struct ioat_desc_sw, async_tx) |
45 | 43 | ||
44 | static int ioat_pending_level = 4; | ||
45 | module_param(ioat_pending_level, int, 0644); | ||
46 | MODULE_PARM_DESC(ioat_pending_level, | ||
47 | "high-water mark for pushing ioat descriptors (default: 4)"); | ||
48 | |||
46 | /* internal functions */ | 49 | /* internal functions */ |
47 | static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan); | 50 | static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan); |
48 | static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan); | 51 | static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan); |
52 | |||
53 | static struct ioat_desc_sw * | ||
54 | ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan); | ||
49 | static struct ioat_desc_sw * | 55 | static struct ioat_desc_sw * |
50 | ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan); | 56 | ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan); |
51 | 57 | ||
52 | static inline struct ioat_dma_chan *ioat_lookup_chan_by_index( | 58 | static inline struct ioat_dma_chan *ioat_lookup_chan_by_index( |
53 | struct ioatdma_device *device, | 59 | struct ioatdma_device *device, |
@@ -130,6 +136,12 @@ static int ioat_dma_enumerate_channels(struct ioatdma_device *device) | |||
130 | ioat_chan->device = device; | 136 | ioat_chan->device = device; |
131 | ioat_chan->reg_base = device->reg_base + (0x80 * (i + 1)); | 137 | ioat_chan->reg_base = device->reg_base + (0x80 * (i + 1)); |
132 | ioat_chan->xfercap = xfercap; | 138 | ioat_chan->xfercap = xfercap; |
139 | ioat_chan->desccount = 0; | ||
140 | if (ioat_chan->device->version != IOAT_VER_1_2) { | ||
141 | writel(IOAT_DCACTRL_CMPL_WRITE_ENABLE | ||
142 | | IOAT_DMA_DCA_ANY_CPU, | ||
143 | ioat_chan->reg_base + IOAT_DCACTRL_OFFSET); | ||
144 | } | ||
133 | spin_lock_init(&ioat_chan->cleanup_lock); | 145 | spin_lock_init(&ioat_chan->cleanup_lock); |
134 | spin_lock_init(&ioat_chan->desc_lock); | 146 | spin_lock_init(&ioat_chan->desc_lock); |
135 | INIT_LIST_HEAD(&ioat_chan->free_desc); | 147 | INIT_LIST_HEAD(&ioat_chan->free_desc); |
@@ -161,13 +173,17 @@ static void ioat_set_dest(dma_addr_t addr, | |||
161 | tx_to_ioat_desc(tx)->dst = addr; | 173 | tx_to_ioat_desc(tx)->dst = addr; |
162 | } | 174 | } |
163 | 175 | ||
164 | static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx) | 176 | static inline void __ioat1_dma_memcpy_issue_pending( |
177 | struct ioat_dma_chan *ioat_chan); | ||
178 | static inline void __ioat2_dma_memcpy_issue_pending( | ||
179 | struct ioat_dma_chan *ioat_chan); | ||
180 | |||
181 | static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx) | ||
165 | { | 182 | { |
166 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan); | 183 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan); |
167 | struct ioat_desc_sw *first = tx_to_ioat_desc(tx); | 184 | struct ioat_desc_sw *first = tx_to_ioat_desc(tx); |
168 | struct ioat_desc_sw *prev, *new; | 185 | struct ioat_desc_sw *prev, *new; |
169 | struct ioat_dma_descriptor *hw; | 186 | struct ioat_dma_descriptor *hw; |
170 | int append = 0; | ||
171 | dma_cookie_t cookie; | 187 | dma_cookie_t cookie; |
172 | LIST_HEAD(new_chain); | 188 | LIST_HEAD(new_chain); |
173 | u32 copy; | 189 | u32 copy; |
@@ -209,7 +225,7 @@ static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx) | |||
209 | list_add_tail(&new->node, &new_chain); | 225 | list_add_tail(&new->node, &new_chain); |
210 | desc_count++; | 226 | desc_count++; |
211 | prev = new; | 227 | prev = new; |
212 | } while (len && (new = ioat_dma_get_next_descriptor(ioat_chan))); | 228 | } while (len && (new = ioat1_dma_get_next_descriptor(ioat_chan))); |
213 | 229 | ||
214 | hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; | 230 | hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; |
215 | if (new->async_tx.callback) { | 231 | if (new->async_tx.callback) { |
@@ -246,20 +262,98 @@ static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx) | |||
246 | first->async_tx.phys; | 262 | first->async_tx.phys; |
247 | __list_splice(&new_chain, ioat_chan->used_desc.prev); | 263 | __list_splice(&new_chain, ioat_chan->used_desc.prev); |
248 | 264 | ||
265 | ioat_chan->dmacount += desc_count; | ||
249 | ioat_chan->pending += desc_count; | 266 | ioat_chan->pending += desc_count; |
250 | if (ioat_chan->pending >= 4) { | 267 | if (ioat_chan->pending >= ioat_pending_level) |
251 | append = 1; | 268 | __ioat1_dma_memcpy_issue_pending(ioat_chan); |
252 | ioat_chan->pending = 0; | ||
253 | } | ||
254 | spin_unlock_bh(&ioat_chan->desc_lock); | 269 | spin_unlock_bh(&ioat_chan->desc_lock); |
255 | 270 | ||
256 | if (append) | 271 | return cookie; |
257 | writeb(IOAT_CHANCMD_APPEND, | 272 | } |
258 | ioat_chan->reg_base + IOAT_CHANCMD_OFFSET); | 273 | |
274 | static dma_cookie_t ioat2_tx_submit(struct dma_async_tx_descriptor *tx) | ||
275 | { | ||
276 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan); | ||
277 | struct ioat_desc_sw *first = tx_to_ioat_desc(tx); | ||
278 | struct ioat_desc_sw *new; | ||
279 | struct ioat_dma_descriptor *hw; | ||
280 | dma_cookie_t cookie; | ||
281 | u32 copy; | ||
282 | size_t len; | ||
283 | dma_addr_t src, dst; | ||
284 | int orig_ack; | ||
285 | unsigned int desc_count = 0; | ||
286 | |||
287 | /* src and dest and len are stored in the initial descriptor */ | ||
288 | len = first->len; | ||
289 | src = first->src; | ||
290 | dst = first->dst; | ||
291 | orig_ack = first->async_tx.ack; | ||
292 | new = first; | ||
293 | |||
294 | /* ioat_chan->desc_lock is still in force in version 2 path */ | ||
295 | |||
296 | do { | ||
297 | copy = min((u32) len, ioat_chan->xfercap); | ||
298 | |||
299 | new->async_tx.ack = 1; | ||
300 | |||
301 | hw = new->hw; | ||
302 | hw->size = copy; | ||
303 | hw->ctl = 0; | ||
304 | hw->src_addr = src; | ||
305 | hw->dst_addr = dst; | ||
306 | |||
307 | len -= copy; | ||
308 | dst += copy; | ||
309 | src += copy; | ||
310 | desc_count++; | ||
311 | } while (len && (new = ioat2_dma_get_next_descriptor(ioat_chan))); | ||
312 | |||
313 | hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; | ||
314 | if (new->async_tx.callback) { | ||
315 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; | ||
316 | if (first != new) { | ||
317 | /* move callback into to last desc */ | ||
318 | new->async_tx.callback = first->async_tx.callback; | ||
319 | new->async_tx.callback_param | ||
320 | = first->async_tx.callback_param; | ||
321 | first->async_tx.callback = NULL; | ||
322 | first->async_tx.callback_param = NULL; | ||
323 | } | ||
324 | } | ||
325 | |||
326 | new->tx_cnt = desc_count; | ||
327 | new->async_tx.ack = orig_ack; /* client is in control of this ack */ | ||
328 | |||
329 | /* store the original values for use in later cleanup */ | ||
330 | if (new != first) { | ||
331 | new->src = first->src; | ||
332 | new->dst = first->dst; | ||
333 | new->len = first->len; | ||
334 | } | ||
335 | |||
336 | /* cookie incr and addition to used_list must be atomic */ | ||
337 | cookie = ioat_chan->common.cookie; | ||
338 | cookie++; | ||
339 | if (cookie < 0) | ||
340 | cookie = 1; | ||
341 | ioat_chan->common.cookie = new->async_tx.cookie = cookie; | ||
342 | |||
343 | ioat_chan->dmacount += desc_count; | ||
344 | ioat_chan->pending += desc_count; | ||
345 | if (ioat_chan->pending >= ioat_pending_level) | ||
346 | __ioat2_dma_memcpy_issue_pending(ioat_chan); | ||
347 | spin_unlock_bh(&ioat_chan->desc_lock); | ||
259 | 348 | ||
260 | return cookie; | 349 | return cookie; |
261 | } | 350 | } |
262 | 351 | ||
352 | /** | ||
353 | * ioat_dma_alloc_descriptor - allocate and return a sw and hw descriptor pair | ||
354 | * @ioat_chan: the channel supplying the memory pool for the descriptors | ||
355 | * @flags: allocation flags | ||
356 | */ | ||
263 | static struct ioat_desc_sw *ioat_dma_alloc_descriptor( | 357 | static struct ioat_desc_sw *ioat_dma_alloc_descriptor( |
264 | struct ioat_dma_chan *ioat_chan, | 358 | struct ioat_dma_chan *ioat_chan, |
265 | gfp_t flags) | 359 | gfp_t flags) |
@@ -284,15 +378,57 @@ static struct ioat_desc_sw *ioat_dma_alloc_descriptor( | |||
284 | dma_async_tx_descriptor_init(&desc_sw->async_tx, &ioat_chan->common); | 378 | dma_async_tx_descriptor_init(&desc_sw->async_tx, &ioat_chan->common); |
285 | desc_sw->async_tx.tx_set_src = ioat_set_src; | 379 | desc_sw->async_tx.tx_set_src = ioat_set_src; |
286 | desc_sw->async_tx.tx_set_dest = ioat_set_dest; | 380 | desc_sw->async_tx.tx_set_dest = ioat_set_dest; |
287 | desc_sw->async_tx.tx_submit = ioat_tx_submit; | 381 | switch (ioat_chan->device->version) { |
382 | case IOAT_VER_1_2: | ||
383 | desc_sw->async_tx.tx_submit = ioat1_tx_submit; | ||
384 | break; | ||
385 | case IOAT_VER_2_0: | ||
386 | desc_sw->async_tx.tx_submit = ioat2_tx_submit; | ||
387 | break; | ||
388 | } | ||
288 | INIT_LIST_HEAD(&desc_sw->async_tx.tx_list); | 389 | INIT_LIST_HEAD(&desc_sw->async_tx.tx_list); |
390 | |||
289 | desc_sw->hw = desc; | 391 | desc_sw->hw = desc; |
290 | desc_sw->async_tx.phys = phys; | 392 | desc_sw->async_tx.phys = phys; |
291 | 393 | ||
292 | return desc_sw; | 394 | return desc_sw; |
293 | } | 395 | } |
294 | 396 | ||
295 | /* returns the actual number of allocated descriptors */ | 397 | static int ioat_initial_desc_count = 256; |
398 | module_param(ioat_initial_desc_count, int, 0644); | ||
399 | MODULE_PARM_DESC(ioat_initial_desc_count, | ||
400 | "initial descriptors per channel (default: 256)"); | ||
401 | |||
402 | /** | ||
403 | * ioat2_dma_massage_chan_desc - link the descriptors into a circle | ||
404 | * @ioat_chan: the channel to be massaged | ||
405 | */ | ||
406 | static void ioat2_dma_massage_chan_desc(struct ioat_dma_chan *ioat_chan) | ||
407 | { | ||
408 | struct ioat_desc_sw *desc, *_desc; | ||
409 | |||
410 | /* setup used_desc */ | ||
411 | ioat_chan->used_desc.next = ioat_chan->free_desc.next; | ||
412 | ioat_chan->used_desc.prev = NULL; | ||
413 | |||
414 | /* pull free_desc out of the circle so that every node is a hw | ||
415 | * descriptor, but leave it pointing to the list | ||
416 | */ | ||
417 | ioat_chan->free_desc.prev->next = ioat_chan->free_desc.next; | ||
418 | ioat_chan->free_desc.next->prev = ioat_chan->free_desc.prev; | ||
419 | |||
420 | /* circle link the hw descriptors */ | ||
421 | desc = to_ioat_desc(ioat_chan->free_desc.next); | ||
422 | desc->hw->next = to_ioat_desc(desc->node.next)->async_tx.phys; | ||
423 | list_for_each_entry_safe(desc, _desc, ioat_chan->free_desc.next, node) { | ||
424 | desc->hw->next = to_ioat_desc(desc->node.next)->async_tx.phys; | ||
425 | } | ||
426 | } | ||
427 | |||
428 | /** | ||
429 | * ioat_dma_alloc_chan_resources - returns the number of allocated descriptors | ||
430 | * @chan: the channel to be filled out | ||
431 | */ | ||
296 | static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) | 432 | static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) |
297 | { | 433 | { |
298 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); | 434 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); |
@@ -304,7 +440,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) | |||
304 | 440 | ||
305 | /* have we already been set up? */ | 441 | /* have we already been set up? */ |
306 | if (!list_empty(&ioat_chan->free_desc)) | 442 | if (!list_empty(&ioat_chan->free_desc)) |
307 | return INITIAL_IOAT_DESC_COUNT; | 443 | return ioat_chan->desccount; |
308 | 444 | ||
309 | /* Setup register to interrupt and write completion status on error */ | 445 | /* Setup register to interrupt and write completion status on error */ |
310 | chanctrl = IOAT_CHANCTRL_ERR_INT_EN | | 446 | chanctrl = IOAT_CHANCTRL_ERR_INT_EN | |
@@ -320,7 +456,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) | |||
320 | } | 456 | } |
321 | 457 | ||
322 | /* Allocate descriptors */ | 458 | /* Allocate descriptors */ |
323 | for (i = 0; i < INITIAL_IOAT_DESC_COUNT; i++) { | 459 | for (i = 0; i < ioat_initial_desc_count; i++) { |
324 | desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL); | 460 | desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL); |
325 | if (!desc) { | 461 | if (!desc) { |
326 | dev_err(&ioat_chan->device->pdev->dev, | 462 | dev_err(&ioat_chan->device->pdev->dev, |
@@ -330,7 +466,10 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) | |||
330 | list_add_tail(&desc->node, &tmp_list); | 466 | list_add_tail(&desc->node, &tmp_list); |
331 | } | 467 | } |
332 | spin_lock_bh(&ioat_chan->desc_lock); | 468 | spin_lock_bh(&ioat_chan->desc_lock); |
469 | ioat_chan->desccount = i; | ||
333 | list_splice(&tmp_list, &ioat_chan->free_desc); | 470 | list_splice(&tmp_list, &ioat_chan->free_desc); |
471 | if (ioat_chan->device->version != IOAT_VER_1_2) | ||
472 | ioat2_dma_massage_chan_desc(ioat_chan); | ||
334 | spin_unlock_bh(&ioat_chan->desc_lock); | 473 | spin_unlock_bh(&ioat_chan->desc_lock); |
335 | 474 | ||
336 | /* allocate a completion writeback area */ | 475 | /* allocate a completion writeback area */ |
@@ -347,10 +486,14 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) | |||
347 | ioat_chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); | 486 | ioat_chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); |
348 | 487 | ||
349 | tasklet_enable(&ioat_chan->cleanup_task); | 488 | tasklet_enable(&ioat_chan->cleanup_task); |
350 | ioat_dma_start_null_desc(ioat_chan); | 489 | ioat_dma_start_null_desc(ioat_chan); /* give chain to dma device */ |
351 | return i; | 490 | return ioat_chan->desccount; |
352 | } | 491 | } |
353 | 492 | ||
493 | /** | ||
494 | * ioat_dma_free_chan_resources - release all the descriptors | ||
495 | * @chan: the channel to be cleaned | ||
496 | */ | ||
354 | static void ioat_dma_free_chan_resources(struct dma_chan *chan) | 497 | static void ioat_dma_free_chan_resources(struct dma_chan *chan) |
355 | { | 498 | { |
356 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); | 499 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); |
@@ -364,22 +507,45 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
364 | /* Delay 100ms after reset to allow internal DMA logic to quiesce | 507 | /* Delay 100ms after reset to allow internal DMA logic to quiesce |
365 | * before removing DMA descriptor resources. | 508 | * before removing DMA descriptor resources. |
366 | */ | 509 | */ |
367 | writeb(IOAT_CHANCMD_RESET, ioat_chan->reg_base + IOAT_CHANCMD_OFFSET); | 510 | writeb(IOAT_CHANCMD_RESET, |
511 | ioat_chan->reg_base | ||
512 | + IOAT_CHANCMD_OFFSET(ioat_chan->device->version)); | ||
368 | mdelay(100); | 513 | mdelay(100); |
369 | 514 | ||
370 | spin_lock_bh(&ioat_chan->desc_lock); | 515 | spin_lock_bh(&ioat_chan->desc_lock); |
371 | list_for_each_entry_safe(desc, _desc, &ioat_chan->used_desc, node) { | 516 | switch (ioat_chan->device->version) { |
372 | in_use_descs++; | 517 | case IOAT_VER_1_2: |
373 | list_del(&desc->node); | 518 | list_for_each_entry_safe(desc, _desc, |
374 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, | 519 | &ioat_chan->used_desc, node) { |
375 | desc->async_tx.phys); | 520 | in_use_descs++; |
376 | kfree(desc); | 521 | list_del(&desc->node); |
377 | } | 522 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, |
378 | list_for_each_entry_safe(desc, _desc, &ioat_chan->free_desc, node) { | 523 | desc->async_tx.phys); |
379 | list_del(&desc->node); | 524 | kfree(desc); |
525 | } | ||
526 | list_for_each_entry_safe(desc, _desc, | ||
527 | &ioat_chan->free_desc, node) { | ||
528 | list_del(&desc->node); | ||
529 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, | ||
530 | desc->async_tx.phys); | ||
531 | kfree(desc); | ||
532 | } | ||
533 | break; | ||
534 | case IOAT_VER_2_0: | ||
535 | list_for_each_entry_safe(desc, _desc, | ||
536 | ioat_chan->free_desc.next, node) { | ||
537 | list_del(&desc->node); | ||
538 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, | ||
539 | desc->async_tx.phys); | ||
540 | kfree(desc); | ||
541 | } | ||
542 | desc = to_ioat_desc(ioat_chan->free_desc.next); | ||
380 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, | 543 | pci_pool_free(ioatdma_device->dma_pool, desc->hw, |
381 | desc->async_tx.phys); | 544 | desc->async_tx.phys); |
382 | kfree(desc); | 545 | kfree(desc); |
546 | INIT_LIST_HEAD(&ioat_chan->free_desc); | ||
547 | INIT_LIST_HEAD(&ioat_chan->used_desc); | ||
548 | break; | ||
383 | } | 549 | } |
384 | spin_unlock_bh(&ioat_chan->desc_lock); | 550 | spin_unlock_bh(&ioat_chan->desc_lock); |
385 | 551 | ||
@@ -395,6 +561,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
395 | 561 | ||
396 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; | 562 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; |
397 | ioat_chan->pending = 0; | 563 | ioat_chan->pending = 0; |
564 | ioat_chan->dmacount = 0; | ||
398 | } | 565 | } |
399 | 566 | ||
400 | /** | 567 | /** |
@@ -406,7 +573,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
406 | * has run out. | 573 | * has run out. |
407 | */ | 574 | */ |
408 | static struct ioat_desc_sw * | 575 | static struct ioat_desc_sw * |
409 | ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) | 576 | ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) |
410 | { | 577 | { |
411 | struct ioat_desc_sw *new = NULL; | 578 | struct ioat_desc_sw *new = NULL; |
412 | 579 | ||
@@ -425,7 +592,82 @@ ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) | |||
425 | return new; | 592 | return new; |
426 | } | 593 | } |
427 | 594 | ||
428 | static struct dma_async_tx_descriptor *ioat_dma_prep_memcpy( | 595 | static struct ioat_desc_sw * |
596 | ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) | ||
597 | { | ||
598 | struct ioat_desc_sw *new = NULL; | ||
599 | |||
600 | /* | ||
601 | * used.prev points to where to start processing | ||
602 | * used.next points to next free descriptor | ||
603 | * if used.prev == NULL, there are none waiting to be processed | ||
604 | * if used.next == used.prev.prev, there is only one free descriptor, | ||
605 | * and we need to use it to as a noop descriptor before | ||
606 | * linking in a new set of descriptors, since the device | ||
607 | * has probably already read the pointer to it | ||
608 | */ | ||
609 | if (ioat_chan->used_desc.prev && | ||
610 | ioat_chan->used_desc.next == ioat_chan->used_desc.prev->prev) { | ||
611 | |||
612 | struct ioat_desc_sw *desc = NULL; | ||
613 | struct ioat_desc_sw *noop_desc = NULL; | ||
614 | int i; | ||
615 | |||
616 | /* set up the noop descriptor */ | ||
617 | noop_desc = to_ioat_desc(ioat_chan->used_desc.next); | ||
618 | noop_desc->hw->size = 0; | ||
619 | noop_desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL; | ||
620 | noop_desc->hw->src_addr = 0; | ||
621 | noop_desc->hw->dst_addr = 0; | ||
622 | |||
623 | ioat_chan->used_desc.next = ioat_chan->used_desc.next->next; | ||
624 | ioat_chan->pending++; | ||
625 | ioat_chan->dmacount++; | ||
626 | |||
627 | /* get a few more descriptors */ | ||
628 | for (i = 16; i; i--) { | ||
629 | desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_ATOMIC); | ||
630 | BUG_ON(!desc); | ||
631 | list_add_tail(&desc->node, ioat_chan->used_desc.next); | ||
632 | |||
633 | desc->hw->next | ||
634 | = to_ioat_desc(desc->node.next)->async_tx.phys; | ||
635 | to_ioat_desc(desc->node.prev)->hw->next | ||
636 | = desc->async_tx.phys; | ||
637 | ioat_chan->desccount++; | ||
638 | } | ||
639 | |||
640 | ioat_chan->used_desc.next = noop_desc->node.next; | ||
641 | } | ||
642 | new = to_ioat_desc(ioat_chan->used_desc.next); | ||
643 | prefetch(new); | ||
644 | ioat_chan->used_desc.next = new->node.next; | ||
645 | |||
646 | if (ioat_chan->used_desc.prev == NULL) | ||
647 | ioat_chan->used_desc.prev = &new->node; | ||
648 | |||
649 | prefetch(new->hw); | ||
650 | return new; | ||
651 | } | ||
652 | |||
653 | static struct ioat_desc_sw *ioat_dma_get_next_descriptor( | ||
654 | struct ioat_dma_chan *ioat_chan) | ||
655 | { | ||
656 | if (!ioat_chan) | ||
657 | return NULL; | ||
658 | |||
659 | switch (ioat_chan->device->version) { | ||
660 | case IOAT_VER_1_2: | ||
661 | return ioat1_dma_get_next_descriptor(ioat_chan); | ||
662 | break; | ||
663 | case IOAT_VER_2_0: | ||
664 | return ioat2_dma_get_next_descriptor(ioat_chan); | ||
665 | break; | ||
666 | } | ||
667 | return NULL; | ||
668 | } | ||
669 | |||
670 | static struct dma_async_tx_descriptor *ioat1_dma_prep_memcpy( | ||
429 | struct dma_chan *chan, | 671 | struct dma_chan *chan, |
430 | size_t len, | 672 | size_t len, |
431 | int int_en) | 673 | int int_en) |
@@ -441,19 +683,62 @@ static struct dma_async_tx_descriptor *ioat_dma_prep_memcpy( | |||
441 | return new ? &new->async_tx : NULL; | 683 | return new ? &new->async_tx : NULL; |
442 | } | 684 | } |
443 | 685 | ||
686 | static struct dma_async_tx_descriptor *ioat2_dma_prep_memcpy( | ||
687 | struct dma_chan *chan, | ||
688 | size_t len, | ||
689 | int int_en) | ||
690 | { | ||
691 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); | ||
692 | struct ioat_desc_sw *new; | ||
693 | |||
694 | spin_lock_bh(&ioat_chan->desc_lock); | ||
695 | new = ioat2_dma_get_next_descriptor(ioat_chan); | ||
696 | new->len = len; | ||
697 | |||
698 | /* leave ioat_chan->desc_lock set in version 2 path */ | ||
699 | return new ? &new->async_tx : NULL; | ||
700 | } | ||
701 | |||
702 | |||
444 | /** | 703 | /** |
445 | * ioat_dma_memcpy_issue_pending - push potentially unrecognized appended | 704 | * ioat_dma_memcpy_issue_pending - push potentially unrecognized appended |
446 | * descriptors to hw | 705 | * descriptors to hw |
447 | * @chan: DMA channel handle | 706 | * @chan: DMA channel handle |
448 | */ | 707 | */ |
449 | static void ioat_dma_memcpy_issue_pending(struct dma_chan *chan) | 708 | static inline void __ioat1_dma_memcpy_issue_pending( |
709 | struct ioat_dma_chan *ioat_chan) | ||
710 | { | ||
711 | ioat_chan->pending = 0; | ||
712 | writeb(IOAT_CHANCMD_APPEND, ioat_chan->reg_base + IOAT1_CHANCMD_OFFSET); | ||
713 | } | ||
714 | |||
715 | static void ioat1_dma_memcpy_issue_pending(struct dma_chan *chan) | ||
450 | { | 716 | { |
451 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); | 717 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); |
452 | 718 | ||
453 | if (ioat_chan->pending != 0) { | 719 | if (ioat_chan->pending != 0) { |
454 | ioat_chan->pending = 0; | 720 | spin_lock_bh(&ioat_chan->desc_lock); |
455 | writeb(IOAT_CHANCMD_APPEND, | 721 | __ioat1_dma_memcpy_issue_pending(ioat_chan); |
456 | ioat_chan->reg_base + IOAT_CHANCMD_OFFSET); | 722 | spin_unlock_bh(&ioat_chan->desc_lock); |
723 | } | ||
724 | } | ||
725 | |||
726 | static inline void __ioat2_dma_memcpy_issue_pending( | ||
727 | struct ioat_dma_chan *ioat_chan) | ||
728 | { | ||
729 | ioat_chan->pending = 0; | ||
730 | writew(ioat_chan->dmacount, | ||
731 | ioat_chan->reg_base + IOAT_CHAN_DMACOUNT_OFFSET); | ||
732 | } | ||
733 | |||
734 | static void ioat2_dma_memcpy_issue_pending(struct dma_chan *chan) | ||
735 | { | ||
736 | struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); | ||
737 | |||
738 | if (ioat_chan->pending != 0) { | ||
739 | spin_lock_bh(&ioat_chan->desc_lock); | ||
740 | __ioat2_dma_memcpy_issue_pending(ioat_chan); | ||
741 | spin_unlock_bh(&ioat_chan->desc_lock); | ||
457 | } | 742 | } |
458 | } | 743 | } |
459 | 744 | ||
@@ -465,11 +750,17 @@ static void ioat_dma_cleanup_tasklet(unsigned long data) | |||
465 | chan->reg_base + IOAT_CHANCTRL_OFFSET); | 750 | chan->reg_base + IOAT_CHANCTRL_OFFSET); |
466 | } | 751 | } |
467 | 752 | ||
753 | /** | ||
754 | * ioat_dma_memcpy_cleanup - cleanup up finished descriptors | ||
755 | * @chan: ioat channel to be cleaned up | ||
756 | */ | ||
468 | static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan) | 757 | static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan) |
469 | { | 758 | { |
470 | unsigned long phys_complete; | 759 | unsigned long phys_complete; |
471 | struct ioat_desc_sw *desc, *_desc; | 760 | struct ioat_desc_sw *desc, *_desc; |
472 | dma_cookie_t cookie = 0; | 761 | dma_cookie_t cookie = 0; |
762 | unsigned long desc_phys; | ||
763 | struct ioat_desc_sw *latest_desc; | ||
473 | 764 | ||
474 | prefetch(ioat_chan->completion_virt); | 765 | prefetch(ioat_chan->completion_virt); |
475 | 766 | ||
@@ -507,56 +798,115 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan) | |||
507 | 798 | ||
508 | cookie = 0; | 799 | cookie = 0; |
509 | spin_lock_bh(&ioat_chan->desc_lock); | 800 | spin_lock_bh(&ioat_chan->desc_lock); |
510 | list_for_each_entry_safe(desc, _desc, &ioat_chan->used_desc, node) { | 801 | switch (ioat_chan->device->version) { |
511 | 802 | case IOAT_VER_1_2: | |
512 | /* | 803 | list_for_each_entry_safe(desc, _desc, |
513 | * Incoming DMA requests may use multiple descriptors, due to | 804 | &ioat_chan->used_desc, node) { |
514 | * exceeding xfercap, perhaps. If so, only the last one will | ||
515 | * have a cookie, and require unmapping. | ||
516 | */ | ||
517 | if (desc->async_tx.cookie) { | ||
518 | cookie = desc->async_tx.cookie; | ||
519 | 805 | ||
520 | /* | 806 | /* |
521 | * yes we are unmapping both _page and _single alloc'd | 807 | * Incoming DMA requests may use multiple descriptors, |
522 | * regions with unmap_page. Is this *really* that bad? | 808 | * due to exceeding xfercap, perhaps. If so, only the |
809 | * last one will have a cookie, and require unmapping. | ||
523 | */ | 810 | */ |
524 | pci_unmap_page(ioat_chan->device->pdev, | 811 | if (desc->async_tx.cookie) { |
525 | pci_unmap_addr(desc, dst), | 812 | cookie = desc->async_tx.cookie; |
526 | pci_unmap_len(desc, len), | 813 | |
527 | PCI_DMA_FROMDEVICE); | 814 | /* |
528 | pci_unmap_page(ioat_chan->device->pdev, | 815 | * yes we are unmapping both _page and _single |
529 | pci_unmap_addr(desc, src), | 816 | * alloc'd regions with unmap_page. Is this |
530 | pci_unmap_len(desc, len), | 817 | * *really* that bad? |
531 | PCI_DMA_TODEVICE); | 818 | */ |
532 | if (desc->async_tx.callback) { | 819 | pci_unmap_page(ioat_chan->device->pdev, |
533 | desc->async_tx.callback( | 820 | pci_unmap_addr(desc, dst), |
534 | desc->async_tx.callback_param); | 821 | pci_unmap_len(desc, len), |
535 | desc->async_tx.callback = NULL; | 822 | PCI_DMA_FROMDEVICE); |
823 | pci_unmap_page(ioat_chan->device->pdev, | ||
824 | pci_unmap_addr(desc, src), | ||
825 | pci_unmap_len(desc, len), | ||
826 | PCI_DMA_TODEVICE); | ||
827 | |||
828 | if (desc->async_tx.callback) { | ||
829 | desc->async_tx.callback(desc->async_tx.callback_param); | ||
830 | desc->async_tx.callback = NULL; | ||
831 | } | ||
536 | } | 832 | } |
537 | } | ||
538 | 833 | ||
539 | if (desc->async_tx.phys != phys_complete) { | 834 | if (desc->async_tx.phys != phys_complete) { |
540 | /* | 835 | /* |
541 | * a completed entry, but not the last, so cleanup | 836 | * a completed entry, but not the last, so clean |
542 | * if the client is done with the descriptor | 837 | * up if the client is done with the descriptor |
543 | */ | 838 | */ |
544 | if (desc->async_tx.ack) { | 839 | if (desc->async_tx.ack) { |
545 | list_del(&desc->node); | 840 | list_del(&desc->node); |
546 | list_add_tail(&desc->node, | 841 | list_add_tail(&desc->node, |
547 | &ioat_chan->free_desc); | 842 | &ioat_chan->free_desc); |
548 | } else | 843 | } else |
844 | desc->async_tx.cookie = 0; | ||
845 | } else { | ||
846 | /* | ||
847 | * last used desc. Do not remove, so we can | ||
848 | * append from it, but don't look at it next | ||
849 | * time, either | ||
850 | */ | ||
549 | desc->async_tx.cookie = 0; | 851 | desc->async_tx.cookie = 0; |
550 | } else { | ||
551 | /* | ||
552 | * last used desc. Do not remove, so we can append from | ||
553 | * it, but don't look at it next time, either | ||
554 | */ | ||
555 | desc->async_tx.cookie = 0; | ||
556 | 852 | ||
557 | /* TODO check status bits? */ | 853 | /* TODO check status bits? */ |
854 | break; | ||
855 | } | ||
856 | } | ||
857 | break; | ||
858 | case IOAT_VER_2_0: | ||
859 | /* has some other thread has already cleaned up? */ | ||
860 | if (ioat_chan->used_desc.prev == NULL) | ||
558 | break; | 861 | break; |
862 | |||
863 | /* work backwards to find latest finished desc */ | ||
864 | desc = to_ioat_desc(ioat_chan->used_desc.next); | ||
865 | latest_desc = NULL; | ||
866 | do { | ||
867 | desc = to_ioat_desc(desc->node.prev); | ||
868 | desc_phys = (unsigned long)desc->async_tx.phys | ||
869 | & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR; | ||
870 | if (desc_phys == phys_complete) { | ||
871 | latest_desc = desc; | ||
872 | break; | ||
873 | } | ||
874 | } while (&desc->node != ioat_chan->used_desc.prev); | ||
875 | |||
876 | if (latest_desc != NULL) { | ||
877 | |||
878 | /* work forwards to clear finished descriptors */ | ||
879 | for (desc = to_ioat_desc(ioat_chan->used_desc.prev); | ||
880 | &desc->node != latest_desc->node.next && | ||
881 | &desc->node != ioat_chan->used_desc.next; | ||
882 | desc = to_ioat_desc(desc->node.next)) { | ||
883 | if (desc->async_tx.cookie) { | ||
884 | cookie = desc->async_tx.cookie; | ||
885 | desc->async_tx.cookie = 0; | ||
886 | |||
887 | pci_unmap_page(ioat_chan->device->pdev, | ||
888 | pci_unmap_addr(desc, dst), | ||
889 | pci_unmap_len(desc, len), | ||
890 | PCI_DMA_FROMDEVICE); | ||
891 | pci_unmap_page(ioat_chan->device->pdev, | ||
892 | pci_unmap_addr(desc, src), | ||
893 | pci_unmap_len(desc, len), | ||
894 | PCI_DMA_TODEVICE); | ||
895 | |||
896 | if (desc->async_tx.callback) { | ||
897 | desc->async_tx.callback(desc->async_tx.callback_param); | ||
898 | desc->async_tx.callback = NULL; | ||
899 | } | ||
900 | } | ||
901 | } | ||
902 | |||
903 | /* move used.prev up beyond those that are finished */ | ||
904 | if (&desc->node == ioat_chan->used_desc.next) | ||
905 | ioat_chan->used_desc.prev = NULL; | ||
906 | else | ||
907 | ioat_chan->used_desc.prev = &desc->node; | ||
559 | } | 908 | } |
909 | break; | ||
560 | } | 910 | } |
561 | 911 | ||
562 | spin_unlock_bh(&ioat_chan->desc_lock); | 912 | spin_unlock_bh(&ioat_chan->desc_lock); |
@@ -621,8 +971,6 @@ static enum dma_status ioat_dma_is_complete(struct dma_chan *chan, | |||
621 | return dma_async_is_complete(cookie, last_complete, last_used); | 971 | return dma_async_is_complete(cookie, last_complete, last_used); |
622 | } | 972 | } |
623 | 973 | ||
624 | /* PCI API */ | ||
625 | |||
626 | static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) | 974 | static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) |
627 | { | 975 | { |
628 | struct ioat_desc_sw *desc; | 976 | struct ioat_desc_sw *desc; |
@@ -633,21 +981,34 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) | |||
633 | desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL | 981 | desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL |
634 | | IOAT_DMA_DESCRIPTOR_CTL_INT_GN | 982 | | IOAT_DMA_DESCRIPTOR_CTL_INT_GN |
635 | | IOAT_DMA_DESCRIPTOR_CTL_CP_STS; | 983 | | IOAT_DMA_DESCRIPTOR_CTL_CP_STS; |
636 | desc->hw->next = 0; | ||
637 | desc->hw->size = 0; | 984 | desc->hw->size = 0; |
638 | desc->hw->src_addr = 0; | 985 | desc->hw->src_addr = 0; |
639 | desc->hw->dst_addr = 0; | 986 | desc->hw->dst_addr = 0; |
640 | desc->async_tx.ack = 1; | 987 | desc->async_tx.ack = 1; |
641 | 988 | switch (ioat_chan->device->version) { | |
642 | list_add_tail(&desc->node, &ioat_chan->used_desc); | 989 | case IOAT_VER_1_2: |
990 | desc->hw->next = 0; | ||
991 | list_add_tail(&desc->node, &ioat_chan->used_desc); | ||
992 | |||
993 | writel(((u64) desc->async_tx.phys) & 0x00000000FFFFFFFF, | ||
994 | ioat_chan->reg_base + IOAT1_CHAINADDR_OFFSET_LOW); | ||
995 | writel(((u64) desc->async_tx.phys) >> 32, | ||
996 | ioat_chan->reg_base + IOAT1_CHAINADDR_OFFSET_HIGH); | ||
997 | |||
998 | writeb(IOAT_CHANCMD_START, ioat_chan->reg_base | ||
999 | + IOAT_CHANCMD_OFFSET(ioat_chan->device->version)); | ||
1000 | break; | ||
1001 | case IOAT_VER_2_0: | ||
1002 | writel(((u64) desc->async_tx.phys) & 0x00000000FFFFFFFF, | ||
1003 | ioat_chan->reg_base + IOAT2_CHAINADDR_OFFSET_LOW); | ||
1004 | writel(((u64) desc->async_tx.phys) >> 32, | ||
1005 | ioat_chan->reg_base + IOAT2_CHAINADDR_OFFSET_HIGH); | ||
1006 | |||
1007 | ioat_chan->dmacount++; | ||
1008 | __ioat2_dma_memcpy_issue_pending(ioat_chan); | ||
1009 | break; | ||
1010 | } | ||
643 | spin_unlock_bh(&ioat_chan->desc_lock); | 1011 | spin_unlock_bh(&ioat_chan->desc_lock); |
644 | |||
645 | writel(((u64) desc->async_tx.phys) & 0x00000000FFFFFFFF, | ||
646 | ioat_chan->reg_base + IOAT_CHAINADDR_OFFSET_LOW); | ||
647 | writel(((u64) desc->async_tx.phys) >> 32, | ||
648 | ioat_chan->reg_base + IOAT_CHAINADDR_OFFSET_HIGH); | ||
649 | |||
650 | writeb(IOAT_CHANCMD_START, ioat_chan->reg_base + IOAT_CHANCMD_OFFSET); | ||
651 | } | 1012 | } |
652 | 1013 | ||
653 | /* | 1014 | /* |
@@ -693,14 +1054,14 @@ static int ioat_dma_self_test(struct ioatdma_device *device) | |||
693 | dma_chan = container_of(device->common.channels.next, | 1054 | dma_chan = container_of(device->common.channels.next, |
694 | struct dma_chan, | 1055 | struct dma_chan, |
695 | device_node); | 1056 | device_node); |
696 | if (ioat_dma_alloc_chan_resources(dma_chan) < 1) { | 1057 | if (device->common.device_alloc_chan_resources(dma_chan) < 1) { |
697 | dev_err(&device->pdev->dev, | 1058 | dev_err(&device->pdev->dev, |
698 | "selftest cannot allocate chan resource\n"); | 1059 | "selftest cannot allocate chan resource\n"); |
699 | err = -ENODEV; | 1060 | err = -ENODEV; |
700 | goto out; | 1061 | goto out; |
701 | } | 1062 | } |
702 | 1063 | ||
703 | tx = ioat_dma_prep_memcpy(dma_chan, IOAT_TEST_SIZE, 0); | 1064 | tx = device->common.device_prep_dma_memcpy(dma_chan, IOAT_TEST_SIZE, 0); |
704 | if (!tx) { | 1065 | if (!tx) { |
705 | dev_err(&device->pdev->dev, | 1066 | dev_err(&device->pdev->dev, |
706 | "Self-test prep failed, disabling\n"); | 1067 | "Self-test prep failed, disabling\n"); |
@@ -710,24 +1071,25 @@ static int ioat_dma_self_test(struct ioatdma_device *device) | |||
710 | 1071 | ||
711 | async_tx_ack(tx); | 1072 | async_tx_ack(tx); |
712 | addr = dma_map_single(dma_chan->device->dev, src, IOAT_TEST_SIZE, | 1073 | addr = dma_map_single(dma_chan->device->dev, src, IOAT_TEST_SIZE, |
713 | DMA_TO_DEVICE); | 1074 | DMA_TO_DEVICE); |
714 | ioat_set_src(addr, tx, 0); | 1075 | tx->tx_set_src(addr, tx, 0); |
715 | addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, | 1076 | addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, |
716 | DMA_FROM_DEVICE); | 1077 | DMA_FROM_DEVICE); |
717 | ioat_set_dest(addr, tx, 0); | 1078 | tx->tx_set_dest(addr, tx, 0); |
718 | tx->callback = ioat_dma_test_callback; | 1079 | tx->callback = ioat_dma_test_callback; |
719 | tx->callback_param = (void *)0x8086; | 1080 | tx->callback_param = (void *)0x8086; |
720 | cookie = ioat_tx_submit(tx); | 1081 | cookie = tx->tx_submit(tx); |
721 | if (cookie < 0) { | 1082 | if (cookie < 0) { |
722 | dev_err(&device->pdev->dev, | 1083 | dev_err(&device->pdev->dev, |
723 | "Self-test setup failed, disabling\n"); | 1084 | "Self-test setup failed, disabling\n"); |
724 | err = -ENODEV; | 1085 | err = -ENODEV; |
725 | goto free_resources; | 1086 | goto free_resources; |
726 | } | 1087 | } |
727 | ioat_dma_memcpy_issue_pending(dma_chan); | 1088 | device->common.device_issue_pending(dma_chan); |
728 | msleep(1); | 1089 | msleep(1); |
729 | 1090 | ||
730 | if (ioat_dma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { | 1091 | if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL) |
1092 | != DMA_SUCCESS) { | ||
731 | dev_err(&device->pdev->dev, | 1093 | dev_err(&device->pdev->dev, |
732 | "Self-test copy timed out, disabling\n"); | 1094 | "Self-test copy timed out, disabling\n"); |
733 | err = -ENODEV; | 1095 | err = -ENODEV; |
@@ -741,7 +1103,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device) | |||
741 | } | 1103 | } |
742 | 1104 | ||
743 | free_resources: | 1105 | free_resources: |
744 | ioat_dma_free_chan_resources(dma_chan); | 1106 | device->common.device_free_chan_resources(dma_chan); |
745 | out: | 1107 | out: |
746 | kfree(src); | 1108 | kfree(src); |
747 | kfree(dest); | 1109 | kfree(dest); |
@@ -941,16 +1303,28 @@ struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev, | |||
941 | INIT_LIST_HEAD(&device->common.channels); | 1303 | INIT_LIST_HEAD(&device->common.channels); |
942 | ioat_dma_enumerate_channels(device); | 1304 | ioat_dma_enumerate_channels(device); |
943 | 1305 | ||
944 | dma_cap_set(DMA_MEMCPY, device->common.cap_mask); | ||
945 | device->common.device_alloc_chan_resources = | 1306 | device->common.device_alloc_chan_resources = |
946 | ioat_dma_alloc_chan_resources; | 1307 | ioat_dma_alloc_chan_resources; |
947 | device->common.device_free_chan_resources = | 1308 | device->common.device_free_chan_resources = |
948 | ioat_dma_free_chan_resources; | 1309 | ioat_dma_free_chan_resources; |
949 | device->common.device_prep_dma_memcpy = ioat_dma_prep_memcpy; | 1310 | device->common.dev = &pdev->dev; |
1311 | |||
1312 | dma_cap_set(DMA_MEMCPY, device->common.cap_mask); | ||
950 | device->common.device_is_tx_complete = ioat_dma_is_complete; | 1313 | device->common.device_is_tx_complete = ioat_dma_is_complete; |
951 | device->common.device_issue_pending = ioat_dma_memcpy_issue_pending; | ||
952 | device->common.device_dependency_added = ioat_dma_dependency_added; | 1314 | device->common.device_dependency_added = ioat_dma_dependency_added; |
953 | device->common.dev = &pdev->dev; | 1315 | switch (device->version) { |
1316 | case IOAT_VER_1_2: | ||
1317 | device->common.device_prep_dma_memcpy = ioat1_dma_prep_memcpy; | ||
1318 | device->common.device_issue_pending = | ||
1319 | ioat1_dma_memcpy_issue_pending; | ||
1320 | break; | ||
1321 | case IOAT_VER_2_0: | ||
1322 | device->common.device_prep_dma_memcpy = ioat2_dma_prep_memcpy; | ||
1323 | device->common.device_issue_pending = | ||
1324 | ioat2_dma_memcpy_issue_pending; | ||
1325 | break; | ||
1326 | } | ||
1327 | |||
954 | dev_err(&device->pdev->dev, | 1328 | dev_err(&device->pdev->dev, |
955 | "Intel(R) I/OAT DMA Engine found," | 1329 | "Intel(R) I/OAT DMA Engine found," |
956 | " %d channels, device version 0x%02x, driver version %s\n", | 1330 | " %d channels, device version 0x%02x, driver version %s\n", |
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h index 5f9881e7b0ed..b668234ef654 100644 --- a/drivers/dma/ioatdma.h +++ b/drivers/dma/ioatdma.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved. | 2 | * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of the GNU General Public License as published by the Free | 5 | * under the terms of the GNU General Public License as published by the Free |
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/cache.h> | 28 | #include <linux/cache.h> |
29 | #include <linux/pci_ids.h> | 29 | #include <linux/pci_ids.h> |
30 | 30 | ||
31 | #define IOAT_DMA_VERSION "1.26" | 31 | #define IOAT_DMA_VERSION "2.04" |
32 | 32 | ||
33 | enum ioat_interrupt { | 33 | enum ioat_interrupt { |
34 | none = 0, | 34 | none = 0, |
@@ -39,6 +39,8 @@ enum ioat_interrupt { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | #define IOAT_LOW_COMPLETION_MASK 0xffffffc0 | 41 | #define IOAT_LOW_COMPLETION_MASK 0xffffffc0 |
42 | #define IOAT_DMA_DCA_ANY_CPU ~0 | ||
43 | |||
42 | 44 | ||
43 | /** | 45 | /** |
44 | * struct ioatdma_device - internal representation of a IOAT device | 46 | * struct ioatdma_device - internal representation of a IOAT device |
@@ -47,6 +49,9 @@ enum ioat_interrupt { | |||
47 | * @dma_pool: for allocating DMA descriptors | 49 | * @dma_pool: for allocating DMA descriptors |
48 | * @common: embedded struct dma_device | 50 | * @common: embedded struct dma_device |
49 | * @version: version of ioatdma device | 51 | * @version: version of ioatdma device |
52 | * @irq_mode: which style irq to use | ||
53 | * @msix_entries: irq handlers | ||
54 | * @idx: per channel data | ||
50 | */ | 55 | */ |
51 | 56 | ||
52 | struct ioatdma_device { | 57 | struct ioatdma_device { |
@@ -63,23 +68,7 @@ struct ioatdma_device { | |||
63 | 68 | ||
64 | /** | 69 | /** |
65 | * struct ioat_dma_chan - internal representation of a DMA channel | 70 | * struct ioat_dma_chan - internal representation of a DMA channel |
66 | * @device: | ||
67 | * @reg_base: | ||
68 | * @sw_in_use: | ||
69 | * @completion: | ||
70 | * @completion_low: | ||
71 | * @completion_high: | ||
72 | * @completed_cookie: last cookie seen completed on cleanup | ||
73 | * @cookie: value of last cookie given to client | ||
74 | * @last_completion: | ||
75 | * @xfercap: | ||
76 | * @desc_lock: | ||
77 | * @free_desc: | ||
78 | * @used_desc: | ||
79 | * @resource: | ||
80 | * @device_node: | ||
81 | */ | 71 | */ |
82 | |||
83 | struct ioat_dma_chan { | 72 | struct ioat_dma_chan { |
84 | 73 | ||
85 | void __iomem *reg_base; | 74 | void __iomem *reg_base; |
@@ -95,6 +84,8 @@ struct ioat_dma_chan { | |||
95 | struct list_head used_desc; | 84 | struct list_head used_desc; |
96 | 85 | ||
97 | int pending; | 86 | int pending; |
87 | int dmacount; | ||
88 | int desccount; | ||
98 | 89 | ||
99 | struct ioatdma_device *device; | 90 | struct ioatdma_device *device; |
100 | struct dma_chan common; | 91 | struct dma_chan common; |
@@ -134,12 +125,13 @@ struct ioat_desc_sw { | |||
134 | struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev, | 125 | struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev, |
135 | void __iomem *iobase); | 126 | void __iomem *iobase); |
136 | void ioat_dma_remove(struct ioatdma_device *device); | 127 | void ioat_dma_remove(struct ioatdma_device *device); |
137 | struct dca_provider *ioat_dca_init(struct pci_dev *pdev, | 128 | struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase); |
138 | void __iomem *iobase); | 129 | struct dca_provider *ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase); |
139 | #else | 130 | #else |
140 | #define ioat_dma_probe(pdev, iobase) NULL | 131 | #define ioat_dma_probe(pdev, iobase) NULL |
141 | #define ioat_dma_remove(device) do { } while (0) | 132 | #define ioat_dma_remove(device) do { } while (0) |
142 | #define ioat_dca_init(pdev, iobase) NULL | 133 | #define ioat_dca_init(pdev, iobase) NULL |
134 | #define ioat2_dca_init(pdev, iobase) NULL | ||
143 | #endif | 135 | #endif |
144 | 136 | ||
145 | #endif /* IOATDMA_H */ | 137 | #endif /* IOATDMA_H */ |
diff --git a/drivers/dma/ioatdma_hw.h b/drivers/dma/ioatdma_hw.h index 9e7434e1551f..dd470fa91d86 100644 --- a/drivers/dma/ioatdma_hw.h +++ b/drivers/dma/ioatdma_hw.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved. | 2 | * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of the GNU General Public License as published by the Free | 5 | * under the terms of the GNU General Public License as published by the Free |
@@ -22,12 +22,19 @@ | |||
22 | #define _IOAT_HW_H_ | 22 | #define _IOAT_HW_H_ |
23 | 23 | ||
24 | /* PCI Configuration Space Values */ | 24 | /* PCI Configuration Space Values */ |
25 | #define IOAT_PCI_VID 0x8086 | 25 | #define IOAT_PCI_VID 0x8086 |
26 | #define IOAT_PCI_DID 0x1A38 | 26 | |
27 | #define IOAT_PCI_RID 0x00 | 27 | /* CB device ID's */ |
28 | #define IOAT_PCI_SVID 0x8086 | 28 | #define IOAT_PCI_DID_5000 0x1A38 |
29 | #define IOAT_PCI_SID 0x8086 | 29 | #define IOAT_PCI_DID_CNB 0x360B |
30 | #define IOAT_VER_1_2 0x12 /* Version 1.2 */ | 30 | #define IOAT_PCI_DID_SCNB 0x65FF |
31 | #define IOAT_PCI_DID_SNB 0x402F | ||
32 | |||
33 | #define IOAT_PCI_RID 0x00 | ||
34 | #define IOAT_PCI_SVID 0x8086 | ||
35 | #define IOAT_PCI_SID 0x8086 | ||
36 | #define IOAT_VER_1_2 0x12 /* Version 1.2 */ | ||
37 | #define IOAT_VER_2_0 0x20 /* Version 2.0 */ | ||
31 | 38 | ||
32 | struct ioat_dma_descriptor { | 39 | struct ioat_dma_descriptor { |
33 | uint32_t size; | 40 | uint32_t size; |
@@ -47,6 +54,16 @@ struct ioat_dma_descriptor { | |||
47 | #define IOAT_DMA_DESCRIPTOR_CTL_CP_STS 0x00000008 | 54 | #define IOAT_DMA_DESCRIPTOR_CTL_CP_STS 0x00000008 |
48 | #define IOAT_DMA_DESCRIPTOR_CTL_FRAME 0x00000010 | 55 | #define IOAT_DMA_DESCRIPTOR_CTL_FRAME 0x00000010 |
49 | #define IOAT_DMA_DESCRIPTOR_NUL 0x00000020 | 56 | #define IOAT_DMA_DESCRIPTOR_NUL 0x00000020 |
50 | #define IOAT_DMA_DESCRIPTOR_OPCODE 0xFF000000 | 57 | #define IOAT_DMA_DESCRIPTOR_CTL_SP_BRK 0x00000040 |
58 | #define IOAT_DMA_DESCRIPTOR_CTL_DP_BRK 0x00000080 | ||
59 | #define IOAT_DMA_DESCRIPTOR_CTL_BNDL 0x00000100 | ||
60 | #define IOAT_DMA_DESCRIPTOR_CTL_DCA 0x00000200 | ||
61 | #define IOAT_DMA_DESCRIPTOR_CTL_BUFHINT 0x00000400 | ||
62 | |||
63 | #define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_CONTEXT 0xFF000000 | ||
64 | #define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_DMA 0x00000000 | ||
65 | |||
66 | #define IOAT_DMA_DESCRIPTOR_CTL_CONTEXT_DCA 0x00000001 | ||
67 | #define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_MASK 0xFF000000 | ||
51 | 68 | ||
52 | #endif | 69 | #endif |
diff --git a/drivers/dma/ioatdma_registers.h b/drivers/dma/ioatdma_registers.h index baaab5ea146a..9832d7ebd931 100644 --- a/drivers/dma/ioatdma_registers.h +++ b/drivers/dma/ioatdma_registers.h | |||
@@ -42,26 +42,25 @@ | |||
42 | #define IOAT_INTRCTRL_MASTER_INT_EN 0x01 /* Master Interrupt Enable */ | 42 | #define IOAT_INTRCTRL_MASTER_INT_EN 0x01 /* Master Interrupt Enable */ |
43 | #define IOAT_INTRCTRL_INT_STATUS 0x02 /* ATTNSTATUS -or- Channel Int */ | 43 | #define IOAT_INTRCTRL_INT_STATUS 0x02 /* ATTNSTATUS -or- Channel Int */ |
44 | #define IOAT_INTRCTRL_INT 0x04 /* INT_STATUS -and- MASTER_INT_EN */ | 44 | #define IOAT_INTRCTRL_INT 0x04 /* INT_STATUS -and- MASTER_INT_EN */ |
45 | #define IOAT_INTRCTRL_MSIX_VECTOR_CONTROL 0x08 /* Enable all MSI-X vectors */ | 45 | #define IOAT_INTRCTRL_MSIX_VECTOR_CONTROL 0x08 /* Enable all MSI-X vectors */ |
46 | 46 | ||
47 | #define IOAT_ATTNSTATUS_OFFSET 0x04 /* Each bit is a channel */ | 47 | #define IOAT_ATTNSTATUS_OFFSET 0x04 /* Each bit is a channel */ |
48 | 48 | ||
49 | #define IOAT_VER_OFFSET 0x08 /* 8-bit */ | 49 | #define IOAT_VER_OFFSET 0x08 /* 8-bit */ |
50 | #define IOAT_VER_MAJOR_MASK 0xF0 | 50 | #define IOAT_VER_MAJOR_MASK 0xF0 |
51 | #define IOAT_VER_MINOR_MASK 0x0F | 51 | #define IOAT_VER_MINOR_MASK 0x0F |
52 | #define GET_IOAT_VER_MAJOR(x) ((x) & IOAT_VER_MAJOR_MASK) | 52 | #define GET_IOAT_VER_MAJOR(x) (((x) & IOAT_VER_MAJOR_MASK) >> 4) |
53 | #define GET_IOAT_VER_MINOR(x) ((x) & IOAT_VER_MINOR_MASK) | 53 | #define GET_IOAT_VER_MINOR(x) ((x) & IOAT_VER_MINOR_MASK) |
54 | 54 | ||
55 | #define IOAT_PERPORTOFFSET_OFFSET 0x0A /* 16-bit */ | 55 | #define IOAT_PERPORTOFFSET_OFFSET 0x0A /* 16-bit */ |
56 | 56 | ||
57 | #define IOAT_INTRDELAY_OFFSET 0x0C /* 16-bit */ | 57 | #define IOAT_INTRDELAY_OFFSET 0x0C /* 16-bit */ |
58 | #define IOAT_INTRDELAY_INT_DELAY_MASK 0x3FFF /* Interrupt Delay Time */ | 58 | #define IOAT_INTRDELAY_INT_DELAY_MASK 0x3FFF /* Interrupt Delay Time */ |
59 | #define IOAT_INTRDELAY_COALESE_SUPPORT 0x8000 /* Interrupt Coalesing Supported */ | 59 | #define IOAT_INTRDELAY_COALESE_SUPPORT 0x8000 /* Interrupt Coalescing Supported */ |
60 | 60 | ||
61 | #define IOAT_DEVICE_STATUS_OFFSET 0x0E /* 16-bit */ | 61 | #define IOAT_DEVICE_STATUS_OFFSET 0x0E /* 16-bit */ |
62 | #define IOAT_DEVICE_STATUS_DEGRADED_MODE 0x0001 | 62 | #define IOAT_DEVICE_STATUS_DEGRADED_MODE 0x0001 |
63 | 63 | ||
64 | |||
65 | #define IOAT_CHANNEL_MMIO_SIZE 0x80 /* Each Channel MMIO space is this size */ | 64 | #define IOAT_CHANNEL_MMIO_SIZE 0x80 /* Each Channel MMIO space is this size */ |
66 | 65 | ||
67 | /* DMA Channel Registers */ | 66 | /* DMA Channel Registers */ |
@@ -74,25 +73,101 @@ | |||
74 | #define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004 | 73 | #define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004 |
75 | #define IOAT_CHANCTRL_INT_DISABLE 0x0001 | 74 | #define IOAT_CHANCTRL_INT_DISABLE 0x0001 |
76 | 75 | ||
77 | #define IOAT_DMA_COMP_OFFSET 0x02 /* 16-bit DMA channel compatability */ | 76 | #define IOAT_DMA_COMP_OFFSET 0x02 /* 16-bit DMA channel compatibility */ |
78 | #define IOAT_DMA_COMP_V1 0x0001 /* Compatability with DMA version 1 */ | 77 | #define IOAT_DMA_COMP_V1 0x0001 /* Compatibility with DMA version 1 */ |
79 | 78 | #define IOAT_DMA_COMP_V2 0x0002 /* Compatibility with DMA version 2 */ | |
80 | #define IOAT_CHANSTS_OFFSET 0x04 /* 64-bit Channel Status Register */ | 79 | |
81 | #define IOAT_CHANSTS_OFFSET_LOW 0x04 | 80 | |
82 | #define IOAT_CHANSTS_OFFSET_HIGH 0x08 | 81 | #define IOAT1_CHANSTS_OFFSET 0x04 /* 64-bit Channel Status Register */ |
83 | #define IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR 0xFFFFFFFFFFFFFFC0UL | 82 | #define IOAT2_CHANSTS_OFFSET 0x08 /* 64-bit Channel Status Register */ |
83 | #define IOAT_CHANSTS_OFFSET(ver) ((ver) < IOAT_VER_2_0 \ | ||
84 | ? IOAT1_CHANSTS_OFFSET : IOAT2_CHANSTS_OFFSET) | ||
85 | #define IOAT1_CHANSTS_OFFSET_LOW 0x04 | ||
86 | #define IOAT2_CHANSTS_OFFSET_LOW 0x08 | ||
87 | #define IOAT_CHANSTS_OFFSET_LOW(ver) ((ver) < IOAT_VER_2_0 \ | ||
88 | ? IOAT1_CHANSTS_OFFSET_LOW : IOAT2_CHANSTS_OFFSET_LOW) | ||
89 | #define IOAT1_CHANSTS_OFFSET_HIGH 0x08 | ||
90 | #define IOAT2_CHANSTS_OFFSET_HIGH 0x0C | ||
91 | #define IOAT_CHANSTS_OFFSET_HIGH(ver) ((ver) < IOAT_VER_2_0 \ | ||
92 | ? IOAT1_CHANSTS_OFFSET_HIGH : IOAT2_CHANSTS_OFFSET_HIGH) | ||
93 | #define IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR ~0x3F | ||
84 | #define IOAT_CHANSTS_SOFT_ERR 0x0000000000000010 | 94 | #define IOAT_CHANSTS_SOFT_ERR 0x0000000000000010 |
95 | #define IOAT_CHANSTS_UNAFFILIATED_ERR 0x0000000000000008 | ||
85 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS 0x0000000000000007 | 96 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS 0x0000000000000007 |
86 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_ACTIVE 0x0 | 97 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_ACTIVE 0x0 |
87 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_DONE 0x1 | 98 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_DONE 0x1 |
88 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_SUSPENDED 0x2 | 99 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_SUSPENDED 0x2 |
89 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED 0x3 | 100 | #define IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED 0x3 |
90 | 101 | ||
91 | #define IOAT_CHAINADDR_OFFSET 0x0C /* 64-bit Descriptor Chain Address Register */ | ||
92 | #define IOAT_CHAINADDR_OFFSET_LOW 0x0C | ||
93 | #define IOAT_CHAINADDR_OFFSET_HIGH 0x10 | ||
94 | 102 | ||
95 | #define IOAT_CHANCMD_OFFSET 0x14 /* 8-bit DMA Channel Command Register */ | 103 | |
104 | #define IOAT_CHAN_DMACOUNT_OFFSET 0x06 /* 16-bit DMA Count register */ | ||
105 | |||
106 | #define IOAT_DCACTRL_OFFSET 0x30 /* 32 bit Direct Cache Access Control Register */ | ||
107 | #define IOAT_DCACTRL_CMPL_WRITE_ENABLE 0x10000 | ||
108 | #define IOAT_DCACTRL_TARGET_CPU_MASK 0xFFFF /* APIC ID */ | ||
109 | |||
110 | /* CB DCA Memory Space Registers */ | ||
111 | #define IOAT_DCAOFFSET_OFFSET 0x14 | ||
112 | /* CB_BAR + IOAT_DCAOFFSET value */ | ||
113 | #define IOAT_DCA_VER_OFFSET 0x00 | ||
114 | #define IOAT_DCA_VER_MAJOR_MASK 0xF0 | ||
115 | #define IOAT_DCA_VER_MINOR_MASK 0x0F | ||
116 | |||
117 | #define IOAT_DCA_COMP_OFFSET 0x02 | ||
118 | #define IOAT_DCA_COMP_V1 0x1 | ||
119 | |||
120 | #define IOAT_FSB_CAPABILITY_OFFSET 0x04 | ||
121 | #define IOAT_FSB_CAPABILITY_PREFETCH 0x1 | ||
122 | |||
123 | #define IOAT_PCI_CAPABILITY_OFFSET 0x06 | ||
124 | #define IOAT_PCI_CAPABILITY_MEMWR 0x1 | ||
125 | |||
126 | #define IOAT_FSB_CAP_ENABLE_OFFSET 0x08 | ||
127 | #define IOAT_FSB_CAP_ENABLE_PREFETCH 0x1 | ||
128 | |||
129 | #define IOAT_PCI_CAP_ENABLE_OFFSET 0x0A | ||
130 | #define IOAT_PCI_CAP_ENABLE_MEMWR 0x1 | ||
131 | |||
132 | #define IOAT_APICID_TAG_MAP_OFFSET 0x0C | ||
133 | #define IOAT_APICID_TAG_MAP_TAG0 0x0000000F | ||
134 | #define IOAT_APICID_TAG_MAP_TAG0_SHIFT 0 | ||
135 | #define IOAT_APICID_TAG_MAP_TAG1 0x000000F0 | ||
136 | #define IOAT_APICID_TAG_MAP_TAG1_SHIFT 4 | ||
137 | #define IOAT_APICID_TAG_MAP_TAG2 0x00000F00 | ||
138 | #define IOAT_APICID_TAG_MAP_TAG2_SHIFT 8 | ||
139 | #define IOAT_APICID_TAG_MAP_TAG3 0x0000F000 | ||
140 | #define IOAT_APICID_TAG_MAP_TAG3_SHIFT 12 | ||
141 | #define IOAT_APICID_TAG_MAP_TAG4 0x000F0000 | ||
142 | #define IOAT_APICID_TAG_MAP_TAG4_SHIFT 16 | ||
143 | #define IOAT_APICID_TAG_CB2_VALID 0x8080808080 | ||
144 | |||
145 | #define IOAT_DCA_GREQID_OFFSET 0x10 | ||
146 | #define IOAT_DCA_GREQID_SIZE 0x04 | ||
147 | #define IOAT_DCA_GREQID_MASK 0xFFFF | ||
148 | #define IOAT_DCA_GREQID_IGNOREFUN 0x10000000 | ||
149 | #define IOAT_DCA_GREQID_VALID 0x20000000 | ||
150 | #define IOAT_DCA_GREQID_LASTID 0x80000000 | ||
151 | |||
152 | |||
153 | |||
154 | #define IOAT1_CHAINADDR_OFFSET 0x0C /* 64-bit Descriptor Chain Address Register */ | ||
155 | #define IOAT2_CHAINADDR_OFFSET 0x10 /* 64-bit Descriptor Chain Address Register */ | ||
156 | #define IOAT_CHAINADDR_OFFSET(ver) ((ver) < IOAT_VER_2_0 \ | ||
157 | ? IOAT1_CHAINADDR_OFFSET : IOAT2_CHAINADDR_OFFSET) | ||
158 | #define IOAT1_CHAINADDR_OFFSET_LOW 0x0C | ||
159 | #define IOAT2_CHAINADDR_OFFSET_LOW 0x10 | ||
160 | #define IOAT_CHAINADDR_OFFSET_LOW(ver) ((ver) < IOAT_VER_2_0 \ | ||
161 | ? IOAT1_CHAINADDR_OFFSET_LOW : IOAT2_CHAINADDR_OFFSET_LOW) | ||
162 | #define IOAT1_CHAINADDR_OFFSET_HIGH 0x10 | ||
163 | #define IOAT2_CHAINADDR_OFFSET_HIGH 0x14 | ||
164 | #define IOAT_CHAINADDR_OFFSET_HIGH(ver) ((ver) < IOAT_VER_2_0 \ | ||
165 | ? IOAT1_CHAINADDR_OFFSET_HIGH : IOAT2_CHAINADDR_OFFSET_HIGH) | ||
166 | |||
167 | #define IOAT1_CHANCMD_OFFSET 0x14 /* 8-bit DMA Channel Command Register */ | ||
168 | #define IOAT2_CHANCMD_OFFSET 0x04 /* 8-bit DMA Channel Command Register */ | ||
169 | #define IOAT_CHANCMD_OFFSET(ver) ((ver) < IOAT_VER_2_0 \ | ||
170 | ? IOAT1_CHANCMD_OFFSET : IOAT2_CHANCMD_OFFSET) | ||
96 | #define IOAT_CHANCMD_RESET 0x20 | 171 | #define IOAT_CHANCMD_RESET 0x20 |
97 | #define IOAT_CHANCMD_RESUME 0x10 | 172 | #define IOAT_CHANCMD_RESUME 0x10 |
98 | #define IOAT_CHANCMD_ABORT 0x08 | 173 | #define IOAT_CHANCMD_ABORT 0x08 |
@@ -124,6 +199,7 @@ | |||
124 | #define IOAT_CHANERR_COMPLETION_ADDR_ERR 0x1000 | 199 | #define IOAT_CHANERR_COMPLETION_ADDR_ERR 0x1000 |
125 | #define IOAT_CHANERR_INT_CONFIGURATION_ERR 0x2000 | 200 | #define IOAT_CHANERR_INT_CONFIGURATION_ERR 0x2000 |
126 | #define IOAT_CHANERR_SOFT_ERR 0x4000 | 201 | #define IOAT_CHANERR_SOFT_ERR 0x4000 |
202 | #define IOAT_CHANERR_UNAFFILIATED_ERR 0x8000 | ||
127 | 203 | ||
128 | #define IOAT_CHANERR_MASK_OFFSET 0x2C /* 32-bit Channel Error Register */ | 204 | #define IOAT_CHANERR_MASK_OFFSET 0x2C /* 32-bit Channel Error Register */ |
129 | 205 | ||
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c index 96f7e63e3996..a1f24c42d5ff 100644 --- a/drivers/edac/i5000_edac.c +++ b/drivers/edac/i5000_edac.c | |||
@@ -1462,7 +1462,7 @@ MODULE_DEVICE_TABLE(pci, i5000_pci_tbl); | |||
1462 | * | 1462 | * |
1463 | */ | 1463 | */ |
1464 | static struct pci_driver i5000_driver = { | 1464 | static struct pci_driver i5000_driver = { |
1465 | .name = __stringify(KBUILD_BASENAME), | 1465 | .name = KBUILD_BASENAME, |
1466 | .probe = i5000_init_one, | 1466 | .probe = i5000_init_one, |
1467 | .remove = __devexit_p(i5000_remove_one), | 1467 | .remove = __devexit_p(i5000_remove_one), |
1468 | .id_table = i5000_pci_tbl, | 1468 | .id_table = i5000_pci_tbl, |
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index 67588326ae56..c9b9081831da 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c | |||
@@ -984,8 +984,10 @@ static void bus_reset_tasklet(unsigned long data) | |||
984 | */ | 984 | */ |
985 | 985 | ||
986 | if (ohci->next_config_rom != NULL) { | 986 | if (ohci->next_config_rom != NULL) { |
987 | free_rom = ohci->config_rom; | 987 | if (ohci->next_config_rom != ohci->config_rom) { |
988 | free_rom_bus = ohci->config_rom_bus; | 988 | free_rom = ohci->config_rom; |
989 | free_rom_bus = ohci->config_rom_bus; | ||
990 | } | ||
989 | ohci->config_rom = ohci->next_config_rom; | 991 | ohci->config_rom = ohci->next_config_rom; |
990 | ohci->config_rom_bus = ohci->next_config_rom_bus; | 992 | ohci->config_rom_bus = ohci->next_config_rom_bus; |
991 | ohci->next_config_rom = NULL; | 993 | ohci->next_config_rom = NULL; |
@@ -1161,19 +1163,30 @@ static int ohci_enable(struct fw_card *card, u32 *config_rom, size_t length) | |||
1161 | * the right values in the bus reset tasklet. | 1163 | * the right values in the bus reset tasklet. |
1162 | */ | 1164 | */ |
1163 | 1165 | ||
1164 | ohci->next_config_rom = | 1166 | if (config_rom) { |
1165 | dma_alloc_coherent(ohci->card.device, CONFIG_ROM_SIZE, | 1167 | ohci->next_config_rom = |
1166 | &ohci->next_config_rom_bus, GFP_KERNEL); | 1168 | dma_alloc_coherent(ohci->card.device, CONFIG_ROM_SIZE, |
1167 | if (ohci->next_config_rom == NULL) | 1169 | &ohci->next_config_rom_bus, |
1168 | return -ENOMEM; | 1170 | GFP_KERNEL); |
1171 | if (ohci->next_config_rom == NULL) | ||
1172 | return -ENOMEM; | ||
1169 | 1173 | ||
1170 | memset(ohci->next_config_rom, 0, CONFIG_ROM_SIZE); | 1174 | memset(ohci->next_config_rom, 0, CONFIG_ROM_SIZE); |
1171 | fw_memcpy_to_be32(ohci->next_config_rom, config_rom, length * 4); | 1175 | fw_memcpy_to_be32(ohci->next_config_rom, config_rom, length * 4); |
1176 | } else { | ||
1177 | /* | ||
1178 | * In the suspend case, config_rom is NULL, which | ||
1179 | * means that we just reuse the old config rom. | ||
1180 | */ | ||
1181 | ohci->next_config_rom = ohci->config_rom; | ||
1182 | ohci->next_config_rom_bus = ohci->config_rom_bus; | ||
1183 | } | ||
1172 | 1184 | ||
1173 | ohci->next_header = config_rom[0]; | 1185 | ohci->next_header = be32_to_cpu(ohci->next_config_rom[0]); |
1174 | ohci->next_config_rom[0] = 0; | 1186 | ohci->next_config_rom[0] = 0; |
1175 | reg_write(ohci, OHCI1394_ConfigROMhdr, 0); | 1187 | reg_write(ohci, OHCI1394_ConfigROMhdr, 0); |
1176 | reg_write(ohci, OHCI1394_BusOptions, config_rom[2]); | 1188 | reg_write(ohci, OHCI1394_BusOptions, |
1189 | be32_to_cpu(ohci->next_config_rom[2])); | ||
1177 | reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); | 1190 | reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); |
1178 | 1191 | ||
1179 | reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000); | 1192 | reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000); |
@@ -1984,7 +1997,7 @@ static int pci_resume(struct pci_dev *pdev) | |||
1984 | return err; | 1997 | return err; |
1985 | } | 1998 | } |
1986 | 1999 | ||
1987 | return ohci_enable(&ohci->card, ohci->config_rom, CONFIG_ROM_SIZE); | 2000 | return ohci_enable(&ohci->card, NULL, 0); |
1988 | } | 2001 | } |
1989 | #endif | 2002 | #endif |
1990 | 2003 | ||
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 5596df65c8ed..624ff3e082f6 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -650,13 +650,14 @@ static void sbp2_login(struct work_struct *work) | |||
650 | if (sbp2_send_management_orb(lu, node_id, generation, | 650 | if (sbp2_send_management_orb(lu, node_id, generation, |
651 | SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) { | 651 | SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) { |
652 | if (lu->retries++ < 5) { | 652 | if (lu->retries++ < 5) { |
653 | queue_delayed_work(sbp2_wq, &lu->work, | 653 | if (queue_delayed_work(sbp2_wq, &lu->work, |
654 | DIV_ROUND_UP(HZ, 5)); | 654 | DIV_ROUND_UP(HZ, 5))) |
655 | kref_get(&lu->tgt->kref); | ||
655 | } else { | 656 | } else { |
656 | fw_error("failed to login to %s LUN %04x\n", | 657 | fw_error("failed to login to %s LUN %04x\n", |
657 | unit->device.bus_id, lu->lun); | 658 | unit->device.bus_id, lu->lun); |
658 | kref_put(&lu->tgt->kref, sbp2_release_target); | ||
659 | } | 659 | } |
660 | kref_put(&lu->tgt->kref, sbp2_release_target); | ||
660 | return; | 661 | return; |
661 | } | 662 | } |
662 | 663 | ||
@@ -914,7 +915,9 @@ static void sbp2_reconnect(struct work_struct *work) | |||
914 | lu->retries = 0; | 915 | lu->retries = 0; |
915 | PREPARE_DELAYED_WORK(&lu->work, sbp2_login); | 916 | PREPARE_DELAYED_WORK(&lu->work, sbp2_login); |
916 | } | 917 | } |
917 | queue_delayed_work(sbp2_wq, &lu->work, DIV_ROUND_UP(HZ, 5)); | 918 | if (queue_delayed_work(sbp2_wq, &lu->work, DIV_ROUND_UP(HZ, 5))) |
919 | kref_get(&lu->tgt->kref); | ||
920 | kref_put(&lu->tgt->kref, sbp2_release_target); | ||
918 | return; | 921 | return; |
919 | } | 922 | } |
920 | 923 | ||
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index dd332f28e08c..0b27da7d7497 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -297,7 +297,7 @@ static struct hid_usage *hidinput_find_key(struct hid_device *hid, | |||
297 | static int hidinput_getkeycode(struct input_dev *dev, int scancode, | 297 | static int hidinput_getkeycode(struct input_dev *dev, int scancode, |
298 | int *keycode) | 298 | int *keycode) |
299 | { | 299 | { |
300 | struct hid_device *hid = dev->private; | 300 | struct hid_device *hid = input_get_drvdata(dev); |
301 | struct hid_usage *usage; | 301 | struct hid_usage *usage; |
302 | 302 | ||
303 | usage = hidinput_find_key(hid, scancode, 0); | 303 | usage = hidinput_find_key(hid, scancode, 0); |
@@ -311,7 +311,7 @@ static int hidinput_getkeycode(struct input_dev *dev, int scancode, | |||
311 | static int hidinput_setkeycode(struct input_dev *dev, int scancode, | 311 | static int hidinput_setkeycode(struct input_dev *dev, int scancode, |
312 | int keycode) | 312 | int keycode) |
313 | { | 313 | { |
314 | struct hid_device *hid = dev->private; | 314 | struct hid_device *hid = input_get_drvdata(dev); |
315 | struct hid_usage *usage; | 315 | struct hid_usage *usage; |
316 | int old_keycode; | 316 | int old_keycode; |
317 | 317 | ||
@@ -1152,7 +1152,7 @@ int hidinput_connect(struct hid_device *hid) | |||
1152 | kfree(hidinput); | 1152 | kfree(hidinput); |
1153 | input_free_device(input_dev); | 1153 | input_free_device(input_dev); |
1154 | err_hid("Out of memory during hid input probe"); | 1154 | err_hid("Out of memory during hid input probe"); |
1155 | return -1; | 1155 | goto out_unwind; |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | input_set_drvdata(input_dev, hid); | 1158 | input_set_drvdata(input_dev, hid); |
@@ -1186,15 +1186,25 @@ int hidinput_connect(struct hid_device *hid) | |||
1186 | * UGCI) cram a lot of unrelated inputs into the | 1186 | * UGCI) cram a lot of unrelated inputs into the |
1187 | * same interface. */ | 1187 | * same interface. */ |
1188 | hidinput->report = report; | 1188 | hidinput->report = report; |
1189 | input_register_device(hidinput->input); | 1189 | if (input_register_device(hidinput->input)) |
1190 | goto out_cleanup; | ||
1190 | hidinput = NULL; | 1191 | hidinput = NULL; |
1191 | } | 1192 | } |
1192 | } | 1193 | } |
1193 | 1194 | ||
1194 | if (hidinput) | 1195 | if (hidinput && input_register_device(hidinput->input)) |
1195 | input_register_device(hidinput->input); | 1196 | goto out_cleanup; |
1196 | 1197 | ||
1197 | return 0; | 1198 | return 0; |
1199 | |||
1200 | out_cleanup: | ||
1201 | input_free_device(hidinput->input); | ||
1202 | kfree(hidinput); | ||
1203 | out_unwind: | ||
1204 | /* unwind the ones we already registered */ | ||
1205 | hidinput_disconnect(hid); | ||
1206 | |||
1207 | return -1; | ||
1198 | } | 1208 | } |
1199 | EXPORT_SYMBOL_GPL(hidinput_connect); | 1209 | EXPORT_SYMBOL_GPL(hidinput_connect); |
1200 | 1210 | ||
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 41a59a80e7ed..a2552856476b 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -129,6 +129,11 @@ | |||
129 | #define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053 | 129 | #define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053 |
130 | #define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058 | 130 | #define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058 |
131 | 131 | ||
132 | #define USB_VENDOR_ID_GOTOP 0x08f2 | ||
133 | #define USB_DEVICE_ID_SUPER_Q2 0x007f | ||
134 | #define USB_DEVICE_ID_GOGOPEN 0x00ce | ||
135 | #define USB_DEVICE_ID_PENPOWER 0x00f4 | ||
136 | |||
132 | #define USB_VENDOR_ID_GRIFFIN 0x077d | 137 | #define USB_VENDOR_ID_GRIFFIN 0x077d |
133 | #define USB_DEVICE_ID_POWERMATE 0x0410 | 138 | #define USB_DEVICE_ID_POWERMATE 0x0410 |
134 | #define USB_DEVICE_ID_SOUNDKNOB 0x04AA | 139 | #define USB_DEVICE_ID_SOUNDKNOB 0x04AA |
@@ -415,6 +420,9 @@ static const struct hid_blacklist { | |||
415 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT, HID_QUIRK_IGNORE }, | 420 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT, HID_QUIRK_IGNORE }, |
416 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE }, | 421 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE }, |
417 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL, HID_QUIRK_IGNORE }, | 422 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL, HID_QUIRK_IGNORE }, |
423 | { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2, HID_QUIRK_IGNORE }, | ||
424 | { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN, HID_QUIRK_IGNORE }, | ||
425 | { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER, HID_QUIRK_IGNORE }, | ||
418 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, | 426 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, |
419 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, | 427 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, |
420 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90, HID_QUIRK_IGNORE }, | 428 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90, HID_QUIRK_IGNORE }, |
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 9837adcb17e9..5fc4019956ba 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -743,7 +743,7 @@ inval: | |||
743 | static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 743 | static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
744 | { | 744 | { |
745 | struct inode *inode = file->f_path.dentry->d_inode; | 745 | struct inode *inode = file->f_path.dentry->d_inode; |
746 | return hiddev_ioctl(inode, file, cmd, compat_ptr(arg)); | 746 | return hiddev_ioctl(inode, file, cmd, (unsigned long)compat_ptr(arg)); |
747 | } | 747 | } |
748 | #endif | 748 | #endif |
749 | 749 | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 700a1657554f..a0445bea9f75 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -216,6 +216,16 @@ config SENSORS_DS1621 | |||
216 | This driver can also be built as a module. If so, the module | 216 | This driver can also be built as a module. If so, the module |
217 | will be called ds1621. | 217 | will be called ds1621. |
218 | 218 | ||
219 | config SENSORS_I5K_AMB | ||
220 | tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets" | ||
221 | depends on PCI && EXPERIMENTAL | ||
222 | help | ||
223 | If you say yes here you get support for FB-DIMM AMB temperature | ||
224 | monitoring chips on systems with the Intel 5000 series chipset. | ||
225 | |||
226 | This driver can also be built as a module. If so, the module | ||
227 | will be called i5k_amb. | ||
228 | |||
219 | config SENSORS_F71805F | 229 | config SENSORS_F71805F |
220 | tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG" | 230 | tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG" |
221 | depends on EXPERIMENTAL | 231 | depends on EXPERIMENTAL |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 6da3eef94306..55595f6e1aa6 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -38,6 +38,7 @@ obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o | |||
38 | obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o | 38 | obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o |
39 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o | 39 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o |
40 | obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o | 40 | obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o |
41 | obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o | ||
41 | obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o | 42 | obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o |
42 | obj-$(CONFIG_SENSORS_IT87) += it87.o | 43 | obj-$(CONFIG_SENSORS_IT87) += it87.o |
43 | obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o | 44 | obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o |
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index cb2331bfd9d5..d9f04ce90327 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
@@ -503,7 +503,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
503 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, | 503 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, |
504 | { NULL, 0, 0, 0, 0, 0 } } | 504 | { NULL, 0, 0, 0, 0, 0 } } |
505 | }, | 505 | }, |
506 | { 0x001A, "unknown", { | 506 | { 0x001A, "Abit IP35 Pro", { |
507 | { "CPU Core", 0, 0, 10, 1, 0 }, | 507 | { "CPU Core", 0, 0, 10, 1, 0 }, |
508 | { "DDR2", 1, 0, 20, 1, 0 }, | 508 | { "DDR2", 1, 0, 20, 1, 0 }, |
509 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 509 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -530,6 +530,60 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
530 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 530 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
531 | { NULL, 0, 0, 0, 0, 0 } } | 531 | { NULL, 0, 0, 0, 0, 0 } } |
532 | }, | 532 | }, |
533 | { 0x001B, "unknown", { | ||
534 | { "CPU Core", 0, 0, 10, 1, 0 }, | ||
535 | { "DDR3", 1, 0, 20, 1, 0 }, | ||
536 | { "DDR3 VTT", 2, 0, 10, 1, 0 }, | ||
537 | { "CPU VTT", 3, 0, 10, 1, 0 }, | ||
538 | { "MCH 1.25V", 4, 0, 10, 1, 0 }, | ||
539 | { "ICHIO 1.5V", 5, 0, 10, 1, 0 }, | ||
540 | { "ICH 1.05V", 6, 0, 10, 1, 0 }, | ||
541 | { "ATX +12V (24-Pin)", 7, 0, 60, 1, 0 }, | ||
542 | { "ATX +12V (8-pin)", 8, 0, 60, 1, 0 }, | ||
543 | { "ATX +5V", 9, 0, 30, 1, 0 }, | ||
544 | { "+3.3V", 10, 0, 20, 1, 0 }, | ||
545 | { "5VSB", 11, 0, 30, 1, 0 }, | ||
546 | { "CPU", 24, 1, 1, 1, 0 }, | ||
547 | { "System", 25, 1, 1, 1, 0 }, | ||
548 | { "PWM Phase1", 26, 1, 1, 1, 0 }, | ||
549 | { "PWM Phase2", 27, 1, 1, 1, 0 }, | ||
550 | { "PWM Phase3", 28, 1, 1, 1, 0 }, | ||
551 | { "PWM Phase4", 29, 1, 1, 1, 0 }, | ||
552 | { "PWM Phase5", 30, 1, 1, 1, 0 }, | ||
553 | { "CPU Fan", 32, 2, 60, 1, 0 }, | ||
554 | { "SYS Fan", 34, 2, 60, 1, 0 }, | ||
555 | { "AUX1 Fan", 33, 2, 60, 1, 0 }, | ||
556 | { "AUX2 Fan", 35, 2, 60, 1, 0 }, | ||
557 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | ||
558 | { NULL, 0, 0, 0, 0, 0 } } | ||
559 | }, | ||
560 | { 0x001C, "unknown", { | ||
561 | { "CPU Core", 0, 0, 10, 1, 0 }, | ||
562 | { "DDR2", 1, 0, 20, 1, 0 }, | ||
563 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | ||
564 | { "CPU VTT", 3, 0, 10, 1, 0 }, | ||
565 | { "MCH 1.25V", 4, 0, 10, 1, 0 }, | ||
566 | { "ICHIO 1.5V", 5, 0, 10, 1, 0 }, | ||
567 | { "ICH 1.05V", 6, 0, 10, 1, 0 }, | ||
568 | { "ATX +12V (24-Pin)", 7, 0, 60, 1, 0 }, | ||
569 | { "ATX +12V (8-pin)", 8, 0, 60, 1, 0 }, | ||
570 | { "ATX +5V", 9, 0, 30, 1, 0 }, | ||
571 | { "+3.3V", 10, 0, 20, 1, 0 }, | ||
572 | { "5VSB", 11, 0, 30, 1, 0 }, | ||
573 | { "CPU", 24, 1, 1, 1, 0 }, | ||
574 | { "System", 25, 1, 1, 1, 0 }, | ||
575 | { "PWM Phase1", 26, 1, 1, 1, 0 }, | ||
576 | { "PWM Phase2", 27, 1, 1, 1, 0 }, | ||
577 | { "PWM Phase3", 28, 1, 1, 1, 0 }, | ||
578 | { "PWM Phase4", 29, 1, 1, 1, 0 }, | ||
579 | { "PWM Phase5", 30, 1, 1, 1, 0 }, | ||
580 | { "CPU Fan", 32, 2, 60, 1, 0 }, | ||
581 | { "SYS Fan", 34, 2, 60, 1, 0 }, | ||
582 | { "AUX1 Fan", 33, 2, 60, 1, 0 }, | ||
583 | { "AUX2 Fan", 35, 2, 60, 1, 0 }, | ||
584 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | ||
585 | { NULL, 0, 0, 0, 0, 0 } } | ||
586 | }, | ||
533 | { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } | 587 | { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } |
534 | }; | 588 | }; |
535 | 589 | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 1001d2e122a2..86c66c345f8b 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -80,7 +80,7 @@ | |||
80 | /* | 80 | /* |
81 | * Temperature sensors keys (sp78 - 2 bytes). | 81 | * Temperature sensors keys (sp78 - 2 bytes). |
82 | */ | 82 | */ |
83 | static const char* temperature_sensors_sets[][13] = { | 83 | static const char* temperature_sensors_sets[][36] = { |
84 | /* Set 0: Macbook Pro */ | 84 | /* Set 0: Macbook Pro */ |
85 | { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", | 85 | { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", |
86 | "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, | 86 | "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, |
@@ -88,7 +88,13 @@ static const char* temperature_sensors_sets[][13] = { | |||
88 | { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", | 88 | { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", |
89 | "Th1H", "Ts0P", NULL }, | 89 | "Th1H", "Ts0P", NULL }, |
90 | /* Set 2: Macmini set */ | 90 | /* Set 2: Macmini set */ |
91 | { "TC0D", "TC0P", NULL } | 91 | { "TC0D", "TC0P", NULL }, |
92 | /* Set 3: Mac Pro (2 x Quad-Core) */ | ||
93 | { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P", | ||
94 | "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P", | ||
95 | "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", | ||
96 | "TM1P", "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", | ||
97 | "TM9S", "TN0H", "TS0C", NULL }, | ||
92 | }; | 98 | }; |
93 | 99 | ||
94 | /* List of keys used to read/write fan speeds */ | 100 | /* List of keys used to read/write fan speeds */ |
@@ -990,14 +996,18 @@ static struct attribute *fan##offset##_attributes[] = { \ | |||
990 | 996 | ||
991 | /* | 997 | /* |
992 | * Create the needed functions for each fan using the macro defined above | 998 | * Create the needed functions for each fan using the macro defined above |
993 | * (2 fans are supported) | 999 | * (4 fans are supported) |
994 | */ | 1000 | */ |
995 | sysfs_fan_speeds_offset(1); | 1001 | sysfs_fan_speeds_offset(1); |
996 | sysfs_fan_speeds_offset(2); | 1002 | sysfs_fan_speeds_offset(2); |
1003 | sysfs_fan_speeds_offset(3); | ||
1004 | sysfs_fan_speeds_offset(4); | ||
997 | 1005 | ||
998 | static const struct attribute_group fan_attribute_groups[] = { | 1006 | static const struct attribute_group fan_attribute_groups[] = { |
999 | { .attrs = fan1_attributes }, | 1007 | { .attrs = fan1_attributes }, |
1000 | { .attrs = fan2_attributes } | 1008 | { .attrs = fan2_attributes }, |
1009 | { .attrs = fan3_attributes }, | ||
1010 | { .attrs = fan4_attributes }, | ||
1001 | }; | 1011 | }; |
1002 | 1012 | ||
1003 | /* | 1013 | /* |
@@ -1027,6 +1037,52 @@ static SENSOR_DEVICE_ATTR(temp11_input, S_IRUGO, | |||
1027 | applesmc_show_temperature, NULL, 10); | 1037 | applesmc_show_temperature, NULL, 10); |
1028 | static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO, | 1038 | static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO, |
1029 | applesmc_show_temperature, NULL, 11); | 1039 | applesmc_show_temperature, NULL, 11); |
1040 | static SENSOR_DEVICE_ATTR(temp13_input, S_IRUGO, | ||
1041 | applesmc_show_temperature, NULL, 12); | ||
1042 | static SENSOR_DEVICE_ATTR(temp14_input, S_IRUGO, | ||
1043 | applesmc_show_temperature, NULL, 13); | ||
1044 | static SENSOR_DEVICE_ATTR(temp15_input, S_IRUGO, | ||
1045 | applesmc_show_temperature, NULL, 14); | ||
1046 | static SENSOR_DEVICE_ATTR(temp16_input, S_IRUGO, | ||
1047 | applesmc_show_temperature, NULL, 15); | ||
1048 | static SENSOR_DEVICE_ATTR(temp17_input, S_IRUGO, | ||
1049 | applesmc_show_temperature, NULL, 16); | ||
1050 | static SENSOR_DEVICE_ATTR(temp18_input, S_IRUGO, | ||
1051 | applesmc_show_temperature, NULL, 17); | ||
1052 | static SENSOR_DEVICE_ATTR(temp19_input, S_IRUGO, | ||
1053 | applesmc_show_temperature, NULL, 18); | ||
1054 | static SENSOR_DEVICE_ATTR(temp20_input, S_IRUGO, | ||
1055 | applesmc_show_temperature, NULL, 19); | ||
1056 | static SENSOR_DEVICE_ATTR(temp21_input, S_IRUGO, | ||
1057 | applesmc_show_temperature, NULL, 20); | ||
1058 | static SENSOR_DEVICE_ATTR(temp22_input, S_IRUGO, | ||
1059 | applesmc_show_temperature, NULL, 21); | ||
1060 | static SENSOR_DEVICE_ATTR(temp23_input, S_IRUGO, | ||
1061 | applesmc_show_temperature, NULL, 22); | ||
1062 | static SENSOR_DEVICE_ATTR(temp24_input, S_IRUGO, | ||
1063 | applesmc_show_temperature, NULL, 23); | ||
1064 | static SENSOR_DEVICE_ATTR(temp25_input, S_IRUGO, | ||
1065 | applesmc_show_temperature, NULL, 24); | ||
1066 | static SENSOR_DEVICE_ATTR(temp26_input, S_IRUGO, | ||
1067 | applesmc_show_temperature, NULL, 25); | ||
1068 | static SENSOR_DEVICE_ATTR(temp27_input, S_IRUGO, | ||
1069 | applesmc_show_temperature, NULL, 26); | ||
1070 | static SENSOR_DEVICE_ATTR(temp28_input, S_IRUGO, | ||
1071 | applesmc_show_temperature, NULL, 27); | ||
1072 | static SENSOR_DEVICE_ATTR(temp29_input, S_IRUGO, | ||
1073 | applesmc_show_temperature, NULL, 28); | ||
1074 | static SENSOR_DEVICE_ATTR(temp30_input, S_IRUGO, | ||
1075 | applesmc_show_temperature, NULL, 29); | ||
1076 | static SENSOR_DEVICE_ATTR(temp31_input, S_IRUGO, | ||
1077 | applesmc_show_temperature, NULL, 30); | ||
1078 | static SENSOR_DEVICE_ATTR(temp32_input, S_IRUGO, | ||
1079 | applesmc_show_temperature, NULL, 31); | ||
1080 | static SENSOR_DEVICE_ATTR(temp33_input, S_IRUGO, | ||
1081 | applesmc_show_temperature, NULL, 32); | ||
1082 | static SENSOR_DEVICE_ATTR(temp34_input, S_IRUGO, | ||
1083 | applesmc_show_temperature, NULL, 33); | ||
1084 | static SENSOR_DEVICE_ATTR(temp35_input, S_IRUGO, | ||
1085 | applesmc_show_temperature, NULL, 34); | ||
1030 | 1086 | ||
1031 | static struct attribute *temperature_attributes[] = { | 1087 | static struct attribute *temperature_attributes[] = { |
1032 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 1088 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
@@ -1041,6 +1097,29 @@ static struct attribute *temperature_attributes[] = { | |||
1041 | &sensor_dev_attr_temp10_input.dev_attr.attr, | 1097 | &sensor_dev_attr_temp10_input.dev_attr.attr, |
1042 | &sensor_dev_attr_temp11_input.dev_attr.attr, | 1098 | &sensor_dev_attr_temp11_input.dev_attr.attr, |
1043 | &sensor_dev_attr_temp12_input.dev_attr.attr, | 1099 | &sensor_dev_attr_temp12_input.dev_attr.attr, |
1100 | &sensor_dev_attr_temp13_input.dev_attr.attr, | ||
1101 | &sensor_dev_attr_temp14_input.dev_attr.attr, | ||
1102 | &sensor_dev_attr_temp15_input.dev_attr.attr, | ||
1103 | &sensor_dev_attr_temp16_input.dev_attr.attr, | ||
1104 | &sensor_dev_attr_temp17_input.dev_attr.attr, | ||
1105 | &sensor_dev_attr_temp18_input.dev_attr.attr, | ||
1106 | &sensor_dev_attr_temp19_input.dev_attr.attr, | ||
1107 | &sensor_dev_attr_temp20_input.dev_attr.attr, | ||
1108 | &sensor_dev_attr_temp21_input.dev_attr.attr, | ||
1109 | &sensor_dev_attr_temp22_input.dev_attr.attr, | ||
1110 | &sensor_dev_attr_temp23_input.dev_attr.attr, | ||
1111 | &sensor_dev_attr_temp24_input.dev_attr.attr, | ||
1112 | &sensor_dev_attr_temp25_input.dev_attr.attr, | ||
1113 | &sensor_dev_attr_temp26_input.dev_attr.attr, | ||
1114 | &sensor_dev_attr_temp27_input.dev_attr.attr, | ||
1115 | &sensor_dev_attr_temp28_input.dev_attr.attr, | ||
1116 | &sensor_dev_attr_temp29_input.dev_attr.attr, | ||
1117 | &sensor_dev_attr_temp30_input.dev_attr.attr, | ||
1118 | &sensor_dev_attr_temp31_input.dev_attr.attr, | ||
1119 | &sensor_dev_attr_temp32_input.dev_attr.attr, | ||
1120 | &sensor_dev_attr_temp33_input.dev_attr.attr, | ||
1121 | &sensor_dev_attr_temp34_input.dev_attr.attr, | ||
1122 | &sensor_dev_attr_temp35_input.dev_attr.attr, | ||
1044 | NULL | 1123 | NULL |
1045 | }; | 1124 | }; |
1046 | 1125 | ||
@@ -1137,6 +1216,8 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = { | |||
1137 | { .accelerometer = 1, .light = 0, .temperature_set = 1 }, | 1216 | { .accelerometer = 1, .light = 0, .temperature_set = 1 }, |
1138 | /* MacMini: temperature set 2 */ | 1217 | /* MacMini: temperature set 2 */ |
1139 | { .accelerometer = 0, .light = 0, .temperature_set = 2 }, | 1218 | { .accelerometer = 0, .light = 0, .temperature_set = 2 }, |
1219 | /* MacPro: temperature set 3 */ | ||
1220 | { .accelerometer = 0, .light = 0, .temperature_set = 3 }, | ||
1140 | }; | 1221 | }; |
1141 | 1222 | ||
1142 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". | 1223 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". |
@@ -1154,6 +1235,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { | |||
1154 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1235 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
1155 | DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, | 1236 | DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, |
1156 | (void*)&applesmc_dmi_data[2]}, | 1237 | (void*)&applesmc_dmi_data[2]}, |
1238 | { applesmc_dmi_match, "Apple MacPro2", { | ||
1239 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | ||
1240 | DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, | ||
1241 | (void*)&applesmc_dmi_data[3]}, | ||
1157 | { .ident = NULL } | 1242 | { .ident = NULL } |
1158 | }; | 1243 | }; |
1159 | 1244 | ||
@@ -1204,9 +1289,19 @@ static int __init applesmc_init(void) | |||
1204 | 1289 | ||
1205 | switch (count) { | 1290 | switch (count) { |
1206 | default: | 1291 | default: |
1207 | printk(KERN_WARNING "applesmc: More than 2 fans found," | 1292 | printk(KERN_WARNING "applesmc: More than 4 fans found," |
1208 | " but at most 2 fans are supported" | 1293 | " but at most 4 fans are supported" |
1209 | " by the driver.\n"); | 1294 | " by the driver.\n"); |
1295 | case 4: | ||
1296 | ret = sysfs_create_group(&pdev->dev.kobj, | ||
1297 | &fan_attribute_groups[3]); | ||
1298 | if (ret) | ||
1299 | goto out_key_enumeration; | ||
1300 | case 3: | ||
1301 | ret = sysfs_create_group(&pdev->dev.kobj, | ||
1302 | &fan_attribute_groups[2]); | ||
1303 | if (ret) | ||
1304 | goto out_key_enumeration; | ||
1210 | case 2: | 1305 | case 2: |
1211 | ret = sysfs_create_group(&pdev->dev.kobj, | 1306 | ret = sysfs_create_group(&pdev->dev.kobj, |
1212 | &fan_attribute_groups[1]); | 1307 | &fan_attribute_groups[1]); |
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 13a041326a04..6892f76fc18a 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/i2c.h> | 34 | #include <linux/i2c.h> |
35 | #include <linux/err.h> | 35 | #include <linux/err.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/f75375s.h> | ||
37 | 38 | ||
38 | /* Addresses to scan */ | 39 | /* Addresses to scan */ |
39 | static unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; | 40 | static unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; |
@@ -86,7 +87,7 @@ I2C_CLIENT_INSMOD_2(f75373, f75375); | |||
86 | 87 | ||
87 | struct f75375_data { | 88 | struct f75375_data { |
88 | unsigned short addr; | 89 | unsigned short addr; |
89 | struct i2c_client client; | 90 | struct i2c_client *client; |
90 | struct device *hwmon_dev; | 91 | struct device *hwmon_dev; |
91 | 92 | ||
92 | const char *name; | 93 | const char *name; |
@@ -116,15 +117,25 @@ struct f75375_data { | |||
116 | static int f75375_attach_adapter(struct i2c_adapter *adapter); | 117 | static int f75375_attach_adapter(struct i2c_adapter *adapter); |
117 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); | 118 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); |
118 | static int f75375_detach_client(struct i2c_client *client); | 119 | static int f75375_detach_client(struct i2c_client *client); |
120 | static int f75375_probe(struct i2c_client *client); | ||
121 | static int f75375_remove(struct i2c_client *client); | ||
119 | 122 | ||
120 | static struct i2c_driver f75375_driver = { | 123 | static struct i2c_driver f75375_legacy_driver = { |
121 | .driver = { | 124 | .driver = { |
122 | .name = "f75375", | 125 | .name = "f75375_legacy", |
123 | }, | 126 | }, |
124 | .attach_adapter = f75375_attach_adapter, | 127 | .attach_adapter = f75375_attach_adapter, |
125 | .detach_client = f75375_detach_client, | 128 | .detach_client = f75375_detach_client, |
126 | }; | 129 | }; |
127 | 130 | ||
131 | static struct i2c_driver f75375_driver = { | ||
132 | .driver = { | ||
133 | .name = "f75375", | ||
134 | }, | ||
135 | .probe = f75375_probe, | ||
136 | .remove = f75375_remove, | ||
137 | }; | ||
138 | |||
128 | static inline int f75375_read8(struct i2c_client *client, u8 reg) | 139 | static inline int f75375_read8(struct i2c_client *client, u8 reg) |
129 | { | 140 | { |
130 | return i2c_smbus_read_byte_data(client, reg); | 141 | return i2c_smbus_read_byte_data(client, reg); |
@@ -276,19 +287,14 @@ static ssize_t show_pwm_enable(struct device *dev, struct device_attribute | |||
276 | return sprintf(buf, "%d\n", data->pwm_enable[nr]); | 287 | return sprintf(buf, "%d\n", data->pwm_enable[nr]); |
277 | } | 288 | } |
278 | 289 | ||
279 | static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, | 290 | static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) |
280 | const char *buf, size_t count) | ||
281 | { | 291 | { |
282 | int nr = to_sensor_dev_attr(attr)->index; | ||
283 | struct i2c_client *client = to_i2c_client(dev); | ||
284 | struct f75375_data *data = i2c_get_clientdata(client); | 292 | struct f75375_data *data = i2c_get_clientdata(client); |
285 | int val = simple_strtoul(buf, NULL, 10); | ||
286 | u8 fanmode; | 293 | u8 fanmode; |
287 | 294 | ||
288 | if (val < 0 || val > 4) | 295 | if (val < 0 || val > 4) |
289 | return -EINVAL; | 296 | return -EINVAL; |
290 | 297 | ||
291 | mutex_lock(&data->update_lock); | ||
292 | fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); | 298 | fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); |
293 | fanmode = ~(3 << FAN_CTRL_MODE(nr)); | 299 | fanmode = ~(3 << FAN_CTRL_MODE(nr)); |
294 | 300 | ||
@@ -310,8 +316,22 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, | |||
310 | } | 316 | } |
311 | f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); | 317 | f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); |
312 | data->pwm_enable[nr] = val; | 318 | data->pwm_enable[nr] = val; |
319 | return 0; | ||
320 | } | ||
321 | |||
322 | static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, | ||
323 | const char *buf, size_t count) | ||
324 | { | ||
325 | int nr = to_sensor_dev_attr(attr)->index; | ||
326 | struct i2c_client *client = to_i2c_client(dev); | ||
327 | struct f75375_data *data = i2c_get_clientdata(client); | ||
328 | int val = simple_strtoul(buf, NULL, 10); | ||
329 | int err = 0; | ||
330 | |||
331 | mutex_lock(&data->update_lock); | ||
332 | err = set_pwm_enable_direct(client, nr, val); | ||
313 | mutex_unlock(&data->update_lock); | 333 | mutex_unlock(&data->update_lock); |
314 | return count; | 334 | return err ? err : count; |
315 | } | 335 | } |
316 | 336 | ||
317 | static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr, | 337 | static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr, |
@@ -323,7 +343,7 @@ static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr, | |||
323 | int val = simple_strtoul(buf, NULL, 10); | 343 | int val = simple_strtoul(buf, NULL, 10); |
324 | u8 conf = 0; | 344 | u8 conf = 0; |
325 | 345 | ||
326 | if (val != 0 || val != 1 || data->kind == f75373) | 346 | if (!(val == 0 || val == 1)) |
327 | return -EINVAL; | 347 | return -EINVAL; |
328 | 348 | ||
329 | mutex_lock(&data->update_lock); | 349 | mutex_lock(&data->update_lock); |
@@ -529,13 +549,13 @@ static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO|S_IWUSR, | |||
529 | show_pwm, set_pwm, 0); | 549 | show_pwm, set_pwm, 0); |
530 | static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR, | 550 | static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR, |
531 | show_pwm_enable, set_pwm_enable, 0); | 551 | show_pwm_enable, set_pwm_enable, 0); |
532 | static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO|S_IWUSR, | 552 | static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO, |
533 | show_pwm_mode, set_pwm_mode, 0); | 553 | show_pwm_mode, set_pwm_mode, 0); |
534 | static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, | 554 | static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, |
535 | show_pwm, set_pwm, 1); | 555 | show_pwm, set_pwm, 1); |
536 | static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR, | 556 | static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR, |
537 | show_pwm_enable, set_pwm_enable, 1); | 557 | show_pwm_enable, set_pwm_enable, 1); |
538 | static SENSOR_DEVICE_ATTR(pwm2_mode, S_IRUGO|S_IWUSR, | 558 | static SENSOR_DEVICE_ATTR(pwm2_mode, S_IRUGO, |
539 | show_pwm_mode, set_pwm_mode, 1); | 559 | show_pwm_mode, set_pwm_mode, 1); |
540 | 560 | ||
541 | static struct attribute *f75375_attributes[] = { | 561 | static struct attribute *f75375_attributes[] = { |
@@ -580,12 +600,9 @@ static const struct attribute_group f75375_group = { | |||
580 | 600 | ||
581 | static int f75375_detach_client(struct i2c_client *client) | 601 | static int f75375_detach_client(struct i2c_client *client) |
582 | { | 602 | { |
583 | struct f75375_data *data = i2c_get_clientdata(client); | ||
584 | int err; | 603 | int err; |
585 | 604 | ||
586 | hwmon_device_unregister(data->hwmon_dev); | 605 | f75375_remove(client); |
587 | sysfs_remove_group(&client->dev.kobj, &f75375_group); | ||
588 | |||
589 | err = i2c_detach_client(client); | 606 | err = i2c_detach_client(client); |
590 | if (err) { | 607 | if (err) { |
591 | dev_err(&client->dev, | 608 | dev_err(&client->dev, |
@@ -593,7 +610,91 @@ static int f75375_detach_client(struct i2c_client *client) | |||
593 | "client not detached.\n"); | 610 | "client not detached.\n"); |
594 | return err; | 611 | return err; |
595 | } | 612 | } |
613 | kfree(client); | ||
614 | return 0; | ||
615 | } | ||
616 | |||
617 | static void f75375_init(struct i2c_client *client, struct f75375_data *data, | ||
618 | struct f75375s_platform_data *f75375s_pdata) | ||
619 | { | ||
620 | int nr; | ||
621 | set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]); | ||
622 | set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]); | ||
623 | for (nr = 0; nr < 2; nr++) { | ||
624 | data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255); | ||
625 | f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), | ||
626 | data->pwm[nr]); | ||
627 | } | ||
628 | |||
629 | } | ||
630 | |||
631 | static int f75375_probe(struct i2c_client *client) | ||
632 | { | ||
633 | struct f75375_data *data = i2c_get_clientdata(client); | ||
634 | struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data; | ||
635 | int err; | ||
636 | |||
637 | if (!i2c_check_functionality(client->adapter, | ||
638 | I2C_FUNC_SMBUS_BYTE_DATA)) | ||
639 | return -EIO; | ||
640 | if (!(data = kzalloc(sizeof(struct f75375_data), GFP_KERNEL))) | ||
641 | return -ENOMEM; | ||
642 | |||
643 | i2c_set_clientdata(client, data); | ||
644 | data->client = client; | ||
645 | mutex_init(&data->update_lock); | ||
646 | |||
647 | if (strcmp(client->name, "f75375") == 0) | ||
648 | data->kind = f75375; | ||
649 | else if (strcmp(client->name, "f75373") == 0) | ||
650 | data->kind = f75373; | ||
651 | else { | ||
652 | dev_err(&client->dev, "Unsupported device: %s\n", client->name); | ||
653 | return -ENODEV; | ||
654 | } | ||
655 | |||
656 | if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) | ||
657 | goto exit_free; | ||
658 | |||
659 | if (data->kind == f75375) { | ||
660 | err = sysfs_chmod_file(&client->dev.kobj, | ||
661 | &sensor_dev_attr_pwm1_mode.dev_attr.attr, | ||
662 | S_IRUGO | S_IWUSR); | ||
663 | if (err) | ||
664 | goto exit_remove; | ||
665 | err = sysfs_chmod_file(&client->dev.kobj, | ||
666 | &sensor_dev_attr_pwm2_mode.dev_attr.attr, | ||
667 | S_IRUGO | S_IWUSR); | ||
668 | if (err) | ||
669 | goto exit_remove; | ||
670 | } | ||
671 | |||
672 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
673 | if (IS_ERR(data->hwmon_dev)) { | ||
674 | err = PTR_ERR(data->hwmon_dev); | ||
675 | goto exit_remove; | ||
676 | } | ||
677 | |||
678 | if (f75375s_pdata != NULL) | ||
679 | f75375_init(client, data, f75375s_pdata); | ||
680 | |||
681 | return 0; | ||
682 | |||
683 | exit_remove: | ||
684 | sysfs_remove_group(&client->dev.kobj, &f75375_group); | ||
685 | exit_free: | ||
596 | kfree(data); | 686 | kfree(data); |
687 | i2c_set_clientdata(client, NULL); | ||
688 | return err; | ||
689 | } | ||
690 | |||
691 | static int f75375_remove(struct i2c_client *client) | ||
692 | { | ||
693 | struct f75375_data *data = i2c_get_clientdata(client); | ||
694 | hwmon_device_unregister(data->hwmon_dev); | ||
695 | sysfs_remove_group(&client->dev.kobj, &f75375_group); | ||
696 | kfree(data); | ||
697 | i2c_set_clientdata(client, NULL); | ||
597 | return 0; | 698 | return 0; |
598 | } | 699 | } |
599 | 700 | ||
@@ -608,20 +709,17 @@ static int f75375_attach_adapter(struct i2c_adapter *adapter) | |||
608 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind) | 709 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind) |
609 | { | 710 | { |
610 | struct i2c_client *client; | 711 | struct i2c_client *client; |
611 | struct f75375_data *data; | ||
612 | u8 version = 0; | 712 | u8 version = 0; |
613 | int err = 0; | 713 | int err = 0; |
614 | const char *name = ""; | 714 | const char *name = ""; |
615 | 715 | ||
616 | if (!(data = kzalloc(sizeof(struct f75375_data), GFP_KERNEL))) { | 716 | if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) { |
617 | err = -ENOMEM; | 717 | err = -ENOMEM; |
618 | goto exit; | 718 | goto exit; |
619 | } | 719 | } |
620 | client = &data->client; | ||
621 | i2c_set_clientdata(client, data); | ||
622 | client->addr = address; | 720 | client->addr = address; |
623 | client->adapter = adapter; | 721 | client->adapter = adapter; |
624 | client->driver = &f75375_driver; | 722 | client->driver = &f75375_legacy_driver; |
625 | 723 | ||
626 | if (kind < 0) { | 724 | if (kind < 0) { |
627 | u16 vendid = f75375_read16(client, F75375_REG_VENDOR); | 725 | u16 vendid = f75375_read16(client, F75375_REG_VENDOR); |
@@ -644,42 +742,42 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind) | |||
644 | } else if (kind == f75373) { | 742 | } else if (kind == f75373) { |
645 | name = "f75373"; | 743 | name = "f75373"; |
646 | } | 744 | } |
647 | |||
648 | dev_info(&adapter->dev, "found %s version: %02X\n", name, version); | 745 | dev_info(&adapter->dev, "found %s version: %02X\n", name, version); |
649 | strlcpy(client->name, name, I2C_NAME_SIZE); | 746 | strlcpy(client->name, name, I2C_NAME_SIZE); |
650 | data->kind = kind; | 747 | |
651 | mutex_init(&data->update_lock); | ||
652 | if ((err = i2c_attach_client(client))) | 748 | if ((err = i2c_attach_client(client))) |
653 | goto exit_free; | 749 | goto exit_free; |
654 | 750 | ||
655 | if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) | 751 | if ((err = f75375_probe(client)) < 0) |
656 | goto exit_detach; | 752 | goto exit_detach; |
657 | 753 | ||
658 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
659 | if (IS_ERR(data->hwmon_dev)) { | ||
660 | err = PTR_ERR(data->hwmon_dev); | ||
661 | goto exit_remove; | ||
662 | } | ||
663 | |||
664 | return 0; | 754 | return 0; |
665 | 755 | ||
666 | exit_remove: | ||
667 | sysfs_remove_group(&client->dev.kobj, &f75375_group); | ||
668 | exit_detach: | 756 | exit_detach: |
669 | i2c_detach_client(client); | 757 | i2c_detach_client(client); |
670 | exit_free: | 758 | exit_free: |
671 | kfree(data); | 759 | kfree(client); |
672 | exit: | 760 | exit: |
673 | return err; | 761 | return err; |
674 | } | 762 | } |
675 | 763 | ||
676 | static int __init sensors_f75375_init(void) | 764 | static int __init sensors_f75375_init(void) |
677 | { | 765 | { |
678 | return i2c_add_driver(&f75375_driver); | 766 | int status; |
767 | status = i2c_add_driver(&f75375_driver); | ||
768 | if (status) | ||
769 | return status; | ||
770 | |||
771 | status = i2c_add_driver(&f75375_legacy_driver); | ||
772 | if (status) | ||
773 | i2c_del_driver(&f75375_driver); | ||
774 | |||
775 | return status; | ||
679 | } | 776 | } |
680 | 777 | ||
681 | static void __exit sensors_f75375_exit(void) | 778 | static void __exit sensors_f75375_exit(void) |
682 | { | 779 | { |
780 | i2c_del_driver(&f75375_legacy_driver); | ||
683 | i2c_del_driver(&f75375_driver); | 781 | i2c_del_driver(&f75375_driver); |
684 | } | 782 | } |
685 | 783 | ||
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c new file mode 100644 index 000000000000..6ac5c6f53585 --- /dev/null +++ b/drivers/hwmon/i5k_amb.c | |||
@@ -0,0 +1,552 @@ | |||
1 | /* | ||
2 | * A hwmon driver for the Intel 5000 series chipset FB-DIMM AMB | ||
3 | * temperature sensors | ||
4 | * Copyright (C) 2007 IBM | ||
5 | * | ||
6 | * Author: Darrick J. Wong <djwong@us.ibm.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/jiffies.h> | ||
25 | #include <linux/hwmon.h> | ||
26 | #include <linux/hwmon-sysfs.h> | ||
27 | #include <linux/err.h> | ||
28 | #include <linux/mutex.h> | ||
29 | #include <linux/delay.h> | ||
30 | #include <linux/log2.h> | ||
31 | #include <linux/pci.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | |||
34 | #define DRVNAME "i5k_amb" | ||
35 | |||
36 | #define I5K_REG_AMB_BASE_ADDR 0x48 | ||
37 | #define I5K_REG_AMB_LEN_ADDR 0x50 | ||
38 | #define I5K_REG_CHAN0_PRESENCE_ADDR 0x64 | ||
39 | #define I5K_REG_CHAN1_PRESENCE_ADDR 0x66 | ||
40 | |||
41 | #define AMB_REG_TEMP_MIN_ADDR 0x80 | ||
42 | #define AMB_REG_TEMP_MID_ADDR 0x81 | ||
43 | #define AMB_REG_TEMP_MAX_ADDR 0x82 | ||
44 | #define AMB_REG_TEMP_STATUS_ADDR 0x84 | ||
45 | #define AMB_REG_TEMP_ADDR 0x85 | ||
46 | |||
47 | #define AMB_CONFIG_SIZE 2048 | ||
48 | #define AMB_FUNC_3_OFFSET 768 | ||
49 | |||
50 | static unsigned long amb_reg_temp_status(unsigned int amb) | ||
51 | { | ||
52 | return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_STATUS_ADDR + | ||
53 | AMB_CONFIG_SIZE * amb; | ||
54 | } | ||
55 | |||
56 | static unsigned long amb_reg_temp_min(unsigned int amb) | ||
57 | { | ||
58 | return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MIN_ADDR + | ||
59 | AMB_CONFIG_SIZE * amb; | ||
60 | } | ||
61 | |||
62 | static unsigned long amb_reg_temp_mid(unsigned int amb) | ||
63 | { | ||
64 | return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MID_ADDR + | ||
65 | AMB_CONFIG_SIZE * amb; | ||
66 | } | ||
67 | |||
68 | static unsigned long amb_reg_temp_max(unsigned int amb) | ||
69 | { | ||
70 | return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MAX_ADDR + | ||
71 | AMB_CONFIG_SIZE * amb; | ||
72 | } | ||
73 | |||
74 | static unsigned long amb_reg_temp(unsigned int amb) | ||
75 | { | ||
76 | return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_ADDR + | ||
77 | AMB_CONFIG_SIZE * amb; | ||
78 | } | ||
79 | |||
80 | #define MAX_MEM_CHANNELS 4 | ||
81 | #define MAX_AMBS_PER_CHANNEL 16 | ||
82 | #define MAX_AMBS (MAX_MEM_CHANNELS * \ | ||
83 | MAX_AMBS_PER_CHANNEL) | ||
84 | /* | ||
85 | * Ugly hack: For some reason the highest bit is set if there | ||
86 | * are _any_ DIMMs in the channel. Attempting to read from | ||
87 | * this "high-order" AMB results in a memory bus error, so | ||
88 | * for now we'll just ignore that top bit, even though that | ||
89 | * might prevent us from seeing the 16th DIMM in the channel. | ||
90 | */ | ||
91 | #define REAL_MAX_AMBS_PER_CHANNEL 15 | ||
92 | #define KNOBS_PER_AMB 5 | ||
93 | |||
94 | static unsigned long amb_num_from_reg(unsigned int byte_num, unsigned int bit) | ||
95 | { | ||
96 | return byte_num * MAX_AMBS_PER_CHANNEL + bit; | ||
97 | } | ||
98 | |||
99 | #define AMB_SYSFS_NAME_LEN 16 | ||
100 | struct i5k_device_attribute { | ||
101 | struct sensor_device_attribute s_attr; | ||
102 | char name[AMB_SYSFS_NAME_LEN]; | ||
103 | }; | ||
104 | |||
105 | struct i5k_amb_data { | ||
106 | struct device *hwmon_dev; | ||
107 | |||
108 | unsigned long amb_base; | ||
109 | unsigned long amb_len; | ||
110 | u16 amb_present[MAX_MEM_CHANNELS]; | ||
111 | void __iomem *amb_mmio; | ||
112 | struct i5k_device_attribute *attrs; | ||
113 | unsigned int num_attrs; | ||
114 | }; | ||
115 | |||
116 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, | ||
117 | char *buf) | ||
118 | { | ||
119 | return sprintf(buf, "%s\n", DRVNAME); | ||
120 | } | ||
121 | |||
122 | |||
123 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | ||
124 | |||
125 | static struct platform_device *amb_pdev; | ||
126 | |||
127 | static u8 amb_read_byte(struct i5k_amb_data *data, unsigned long offset) | ||
128 | { | ||
129 | return ioread8(data->amb_mmio + offset); | ||
130 | } | ||
131 | |||
132 | static void amb_write_byte(struct i5k_amb_data *data, unsigned long offset, | ||
133 | u8 val) | ||
134 | { | ||
135 | iowrite8(val, data->amb_mmio + offset); | ||
136 | } | ||
137 | |||
138 | static ssize_t show_amb_alarm(struct device *dev, | ||
139 | struct device_attribute *devattr, | ||
140 | char *buf) | ||
141 | { | ||
142 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
143 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
144 | |||
145 | if (!(amb_read_byte(data, amb_reg_temp_status(attr->index)) & 0x20) && | ||
146 | (amb_read_byte(data, amb_reg_temp_status(attr->index)) & 0x8)) | ||
147 | return sprintf(buf, "1\n"); | ||
148 | else | ||
149 | return sprintf(buf, "0\n"); | ||
150 | } | ||
151 | |||
152 | static ssize_t store_amb_min(struct device *dev, | ||
153 | struct device_attribute *devattr, | ||
154 | const char *buf, | ||
155 | size_t count) | ||
156 | { | ||
157 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
158 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
159 | unsigned long temp = simple_strtoul(buf, NULL, 10) / 500; | ||
160 | |||
161 | if (temp > 255) | ||
162 | temp = 255; | ||
163 | |||
164 | amb_write_byte(data, amb_reg_temp_min(attr->index), temp); | ||
165 | return count; | ||
166 | } | ||
167 | |||
168 | static ssize_t store_amb_mid(struct device *dev, | ||
169 | struct device_attribute *devattr, | ||
170 | const char *buf, | ||
171 | size_t count) | ||
172 | { | ||
173 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
174 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
175 | unsigned long temp = simple_strtoul(buf, NULL, 10) / 500; | ||
176 | |||
177 | if (temp > 255) | ||
178 | temp = 255; | ||
179 | |||
180 | amb_write_byte(data, amb_reg_temp_mid(attr->index), temp); | ||
181 | return count; | ||
182 | } | ||
183 | |||
184 | static ssize_t store_amb_max(struct device *dev, | ||
185 | struct device_attribute *devattr, | ||
186 | const char *buf, | ||
187 | size_t count) | ||
188 | { | ||
189 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
190 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
191 | unsigned long temp = simple_strtoul(buf, NULL, 10) / 500; | ||
192 | |||
193 | if (temp > 255) | ||
194 | temp = 255; | ||
195 | |||
196 | amb_write_byte(data, amb_reg_temp_max(attr->index), temp); | ||
197 | return count; | ||
198 | } | ||
199 | |||
200 | static ssize_t show_amb_min(struct device *dev, | ||
201 | struct device_attribute *devattr, | ||
202 | char *buf) | ||
203 | { | ||
204 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
205 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
206 | return sprintf(buf, "%d\n", | ||
207 | 500 * amb_read_byte(data, amb_reg_temp_min(attr->index))); | ||
208 | } | ||
209 | |||
210 | static ssize_t show_amb_mid(struct device *dev, | ||
211 | struct device_attribute *devattr, | ||
212 | char *buf) | ||
213 | { | ||
214 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
215 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
216 | return sprintf(buf, "%d\n", | ||
217 | 500 * amb_read_byte(data, amb_reg_temp_mid(attr->index))); | ||
218 | } | ||
219 | |||
220 | static ssize_t show_amb_max(struct device *dev, | ||
221 | struct device_attribute *devattr, | ||
222 | char *buf) | ||
223 | { | ||
224 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
225 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
226 | return sprintf(buf, "%d\n", | ||
227 | 500 * amb_read_byte(data, amb_reg_temp_max(attr->index))); | ||
228 | } | ||
229 | |||
230 | static ssize_t show_amb_temp(struct device *dev, | ||
231 | struct device_attribute *devattr, | ||
232 | char *buf) | ||
233 | { | ||
234 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
235 | struct i5k_amb_data *data = dev_get_drvdata(dev); | ||
236 | return sprintf(buf, "%d\n", | ||
237 | 500 * amb_read_byte(data, amb_reg_temp(attr->index))); | ||
238 | } | ||
239 | |||
240 | static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | ||
241 | { | ||
242 | int i, j, k, d = 0; | ||
243 | u16 c; | ||
244 | int res = 0; | ||
245 | int num_ambs = 0; | ||
246 | struct i5k_amb_data *data = platform_get_drvdata(pdev); | ||
247 | |||
248 | /* Count the number of AMBs found */ | ||
249 | /* ignore the high-order bit, see "Ugly hack" comment above */ | ||
250 | for (i = 0; i < MAX_MEM_CHANNELS; i++) | ||
251 | num_ambs += hweight16(data->amb_present[i] & 0x7fff); | ||
252 | |||
253 | /* Set up sysfs stuff */ | ||
254 | data->attrs = kzalloc(sizeof(*data->attrs) * num_ambs * KNOBS_PER_AMB, | ||
255 | GFP_KERNEL); | ||
256 | if (!data->attrs) | ||
257 | return -ENOMEM; | ||
258 | data->num_attrs = 0; | ||
259 | |||
260 | for (i = 0; i < MAX_MEM_CHANNELS; i++) { | ||
261 | c = data->amb_present[i]; | ||
262 | for (j = 0; j < REAL_MAX_AMBS_PER_CHANNEL; j++, c >>= 1) { | ||
263 | struct i5k_device_attribute *iattr; | ||
264 | |||
265 | k = amb_num_from_reg(i, j); | ||
266 | if (!(c & 0x1)) | ||
267 | continue; | ||
268 | d++; | ||
269 | |||
270 | /* Temperature sysfs knob */ | ||
271 | iattr = data->attrs + data->num_attrs; | ||
272 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | ||
273 | "temp%d_input", d); | ||
274 | iattr->s_attr.dev_attr.attr.name = iattr->name; | ||
275 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; | ||
276 | iattr->s_attr.dev_attr.show = show_amb_temp; | ||
277 | iattr->s_attr.index = k; | ||
278 | res = device_create_file(&pdev->dev, | ||
279 | &iattr->s_attr.dev_attr); | ||
280 | if (res) | ||
281 | goto exit_remove; | ||
282 | data->num_attrs++; | ||
283 | |||
284 | /* Temperature min sysfs knob */ | ||
285 | iattr = data->attrs + data->num_attrs; | ||
286 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | ||
287 | "temp%d_min", d); | ||
288 | iattr->s_attr.dev_attr.attr.name = iattr->name; | ||
289 | iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO; | ||
290 | iattr->s_attr.dev_attr.show = show_amb_min; | ||
291 | iattr->s_attr.dev_attr.store = store_amb_min; | ||
292 | iattr->s_attr.index = k; | ||
293 | res = device_create_file(&pdev->dev, | ||
294 | &iattr->s_attr.dev_attr); | ||
295 | if (res) | ||
296 | goto exit_remove; | ||
297 | data->num_attrs++; | ||
298 | |||
299 | /* Temperature mid sysfs knob */ | ||
300 | iattr = data->attrs + data->num_attrs; | ||
301 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | ||
302 | "temp%d_mid", d); | ||
303 | iattr->s_attr.dev_attr.attr.name = iattr->name; | ||
304 | iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO; | ||
305 | iattr->s_attr.dev_attr.show = show_amb_mid; | ||
306 | iattr->s_attr.dev_attr.store = store_amb_mid; | ||
307 | iattr->s_attr.index = k; | ||
308 | res = device_create_file(&pdev->dev, | ||
309 | &iattr->s_attr.dev_attr); | ||
310 | if (res) | ||
311 | goto exit_remove; | ||
312 | data->num_attrs++; | ||
313 | |||
314 | /* Temperature max sysfs knob */ | ||
315 | iattr = data->attrs + data->num_attrs; | ||
316 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | ||
317 | "temp%d_max", d); | ||
318 | iattr->s_attr.dev_attr.attr.name = iattr->name; | ||
319 | iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO; | ||
320 | iattr->s_attr.dev_attr.show = show_amb_max; | ||
321 | iattr->s_attr.dev_attr.store = store_amb_max; | ||
322 | iattr->s_attr.index = k; | ||
323 | res = device_create_file(&pdev->dev, | ||
324 | &iattr->s_attr.dev_attr); | ||
325 | if (res) | ||
326 | goto exit_remove; | ||
327 | data->num_attrs++; | ||
328 | |||
329 | /* Temperature alarm sysfs knob */ | ||
330 | iattr = data->attrs + data->num_attrs; | ||
331 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | ||
332 | "temp%d_alarm", d); | ||
333 | iattr->s_attr.dev_attr.attr.name = iattr->name; | ||
334 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; | ||
335 | iattr->s_attr.dev_attr.show = show_amb_alarm; | ||
336 | iattr->s_attr.index = k; | ||
337 | res = device_create_file(&pdev->dev, | ||
338 | &iattr->s_attr.dev_attr); | ||
339 | if (res) | ||
340 | goto exit_remove; | ||
341 | data->num_attrs++; | ||
342 | } | ||
343 | } | ||
344 | |||
345 | res = device_create_file(&pdev->dev, &dev_attr_name); | ||
346 | if (res) | ||
347 | goto exit_remove; | ||
348 | |||
349 | data->hwmon_dev = hwmon_device_register(&pdev->dev); | ||
350 | if (IS_ERR(data->hwmon_dev)) { | ||
351 | res = PTR_ERR(data->hwmon_dev); | ||
352 | goto exit_remove; | ||
353 | } | ||
354 | |||
355 | return res; | ||
356 | |||
357 | exit_remove: | ||
358 | device_remove_file(&pdev->dev, &dev_attr_name); | ||
359 | for (i = 0; i < data->num_attrs; i++) | ||
360 | device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr); | ||
361 | kfree(data->attrs); | ||
362 | |||
363 | return res; | ||
364 | } | ||
365 | |||
366 | static int __devinit i5k_amb_add(void) | ||
367 | { | ||
368 | int res = -ENODEV; | ||
369 | |||
370 | /* only ever going to be one of these */ | ||
371 | amb_pdev = platform_device_alloc(DRVNAME, 0); | ||
372 | if (!amb_pdev) | ||
373 | return -ENOMEM; | ||
374 | |||
375 | res = platform_device_add(amb_pdev); | ||
376 | if (res) | ||
377 | goto err; | ||
378 | return 0; | ||
379 | |||
380 | err: | ||
381 | platform_device_put(amb_pdev); | ||
382 | return res; | ||
383 | } | ||
384 | |||
385 | static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data) | ||
386 | { | ||
387 | struct pci_dev *pcidev; | ||
388 | u32 val32; | ||
389 | int res = -ENODEV; | ||
390 | |||
391 | /* Find AMB register memory space */ | ||
392 | pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, | ||
393 | PCI_DEVICE_ID_INTEL_5000_ERR, | ||
394 | NULL); | ||
395 | if (!pcidev) | ||
396 | return -ENODEV; | ||
397 | |||
398 | if (pci_read_config_dword(pcidev, I5K_REG_AMB_BASE_ADDR, &val32)) | ||
399 | goto out; | ||
400 | data->amb_base = val32; | ||
401 | |||
402 | if (pci_read_config_dword(pcidev, I5K_REG_AMB_LEN_ADDR, &val32)) | ||
403 | goto out; | ||
404 | data->amb_len = val32; | ||
405 | |||
406 | /* Is it big enough? */ | ||
407 | if (data->amb_len < AMB_CONFIG_SIZE * MAX_AMBS) { | ||
408 | dev_err(&pcidev->dev, "AMB region too small!\n"); | ||
409 | goto out; | ||
410 | } | ||
411 | |||
412 | res = 0; | ||
413 | out: | ||
414 | pci_dev_put(pcidev); | ||
415 | return res; | ||
416 | } | ||
417 | |||
418 | static int __devinit i5k_channel_probe(u16 *amb_present, unsigned long dev_id) | ||
419 | { | ||
420 | struct pci_dev *pcidev; | ||
421 | u16 val16; | ||
422 | int res = -ENODEV; | ||
423 | |||
424 | /* Copy the DIMM presence map for these two channels */ | ||
425 | pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, dev_id, NULL); | ||
426 | if (!pcidev) | ||
427 | return -ENODEV; | ||
428 | |||
429 | if (pci_read_config_word(pcidev, I5K_REG_CHAN0_PRESENCE_ADDR, &val16)) | ||
430 | goto out; | ||
431 | amb_present[0] = val16; | ||
432 | |||
433 | if (pci_read_config_word(pcidev, I5K_REG_CHAN1_PRESENCE_ADDR, &val16)) | ||
434 | goto out; | ||
435 | amb_present[1] = val16; | ||
436 | |||
437 | res = 0; | ||
438 | |||
439 | out: | ||
440 | pci_dev_put(pcidev); | ||
441 | return res; | ||
442 | } | ||
443 | |||
444 | static int __devinit i5k_amb_probe(struct platform_device *pdev) | ||
445 | { | ||
446 | struct i5k_amb_data *data; | ||
447 | struct resource *reso; | ||
448 | int res = -ENODEV; | ||
449 | |||
450 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
451 | if (!data) | ||
452 | return -ENOMEM; | ||
453 | |||
454 | /* Figure out where the AMB registers live */ | ||
455 | res = i5k_find_amb_registers(data); | ||
456 | if (res) | ||
457 | goto err; | ||
458 | |||
459 | /* Copy the DIMM presence map for the first two channels */ | ||
460 | res = i5k_channel_probe(&data->amb_present[0], | ||
461 | PCI_DEVICE_ID_INTEL_5000_FBD0); | ||
462 | if (res) | ||
463 | goto err; | ||
464 | |||
465 | /* Copy the DIMM presence map for the optional second two channels */ | ||
466 | i5k_channel_probe(&data->amb_present[2], | ||
467 | PCI_DEVICE_ID_INTEL_5000_FBD1); | ||
468 | |||
469 | /* Set up resource regions */ | ||
470 | reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME); | ||
471 | if (!reso) { | ||
472 | res = -EBUSY; | ||
473 | goto err; | ||
474 | } | ||
475 | |||
476 | data->amb_mmio = ioremap_nocache(data->amb_base, data->amb_len); | ||
477 | if (!data->amb_mmio) { | ||
478 | res = -EBUSY; | ||
479 | goto err_map_failed; | ||
480 | } | ||
481 | |||
482 | platform_set_drvdata(pdev, data); | ||
483 | |||
484 | res = i5k_amb_hwmon_init(pdev); | ||
485 | if (res) | ||
486 | goto err_init_failed; | ||
487 | |||
488 | return res; | ||
489 | |||
490 | err_init_failed: | ||
491 | iounmap(data->amb_mmio); | ||
492 | platform_set_drvdata(pdev, NULL); | ||
493 | err_map_failed: | ||
494 | release_mem_region(data->amb_base, data->amb_len); | ||
495 | err: | ||
496 | kfree(data); | ||
497 | return res; | ||
498 | } | ||
499 | |||
500 | static int __devexit i5k_amb_remove(struct platform_device *pdev) | ||
501 | { | ||
502 | int i; | ||
503 | struct i5k_amb_data *data = platform_get_drvdata(pdev); | ||
504 | |||
505 | hwmon_device_unregister(data->hwmon_dev); | ||
506 | device_remove_file(&pdev->dev, &dev_attr_name); | ||
507 | for (i = 0; i < data->num_attrs; i++) | ||
508 | device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr); | ||
509 | kfree(data->attrs); | ||
510 | iounmap(data->amb_mmio); | ||
511 | release_mem_region(data->amb_base, data->amb_len); | ||
512 | platform_set_drvdata(pdev, NULL); | ||
513 | kfree(data); | ||
514 | return 0; | ||
515 | } | ||
516 | |||
517 | static struct platform_driver i5k_amb_driver = { | ||
518 | .driver = { | ||
519 | .owner = THIS_MODULE, | ||
520 | .name = DRVNAME, | ||
521 | }, | ||
522 | .probe = i5k_amb_probe, | ||
523 | .remove = __devexit_p(i5k_amb_remove), | ||
524 | }; | ||
525 | |||
526 | static int __init i5k_amb_init(void) | ||
527 | { | ||
528 | int res; | ||
529 | |||
530 | res = platform_driver_register(&i5k_amb_driver); | ||
531 | if (res) | ||
532 | return res; | ||
533 | |||
534 | res = i5k_amb_add(); | ||
535 | if (res) | ||
536 | platform_driver_unregister(&i5k_amb_driver); | ||
537 | |||
538 | return res; | ||
539 | } | ||
540 | |||
541 | static void __exit i5k_amb_exit(void) | ||
542 | { | ||
543 | platform_device_unregister(amb_pdev); | ||
544 | platform_driver_unregister(&i5k_amb_driver); | ||
545 | } | ||
546 | |||
547 | MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>"); | ||
548 | MODULE_DESCRIPTION("Intel 5000 chipset FB-DIMM AMB temperature sensor"); | ||
549 | MODULE_LICENSE("GPL"); | ||
550 | |||
551 | module_init(i5k_amb_init); | ||
552 | module_exit(i5k_amb_exit); | ||
diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c index c462824ffccf..9c9cdb0685e4 100644 --- a/drivers/hwmon/ibmpex.c +++ b/drivers/hwmon/ibmpex.c | |||
@@ -140,10 +140,10 @@ static int ibmpex_send_message(struct ibmpex_bmc_data *data) | |||
140 | 140 | ||
141 | return 0; | 141 | return 0; |
142 | out1: | 142 | out1: |
143 | printk(KERN_ERR "%s: request_settime=%x\n", __FUNCTION__, err); | 143 | dev_err(data->bmc_device, "request_settime=%x\n", err); |
144 | return err; | 144 | return err; |
145 | out: | 145 | out: |
146 | printk(KERN_ERR "%s: validate_addr=%x\n", __FUNCTION__, err); | 146 | dev_err(data->bmc_device, "validate_addr=%x\n", err); |
147 | return err; | 147 | return err; |
148 | } | 148 | } |
149 | 149 | ||
@@ -161,14 +161,14 @@ static int ibmpex_ver_check(struct ibmpex_bmc_data *data) | |||
161 | data->sensor_major = data->rx_msg_data[0]; | 161 | data->sensor_major = data->rx_msg_data[0]; |
162 | data->sensor_minor = data->rx_msg_data[1]; | 162 | data->sensor_minor = data->rx_msg_data[1]; |
163 | 163 | ||
164 | printk(KERN_INFO DRVNAME ": Found BMC with sensor interface " | 164 | dev_info(data->bmc_device, "Found BMC with sensor interface " |
165 | "v%d.%d %d-%02d-%02d on interface %d\n", | 165 | "v%d.%d %d-%02d-%02d on interface %d\n", |
166 | data->sensor_major, | 166 | data->sensor_major, |
167 | data->sensor_minor, | 167 | data->sensor_minor, |
168 | extract_value(data->rx_msg_data, 2), | 168 | extract_value(data->rx_msg_data, 2), |
169 | data->rx_msg_data[4], | 169 | data->rx_msg_data[4], |
170 | data->rx_msg_data[5], | 170 | data->rx_msg_data[5], |
171 | data->interface); | 171 | data->interface); |
172 | 172 | ||
173 | return 0; | 173 | return 0; |
174 | } | 174 | } |
@@ -212,8 +212,8 @@ static int ibmpex_query_sensor_data(struct ibmpex_bmc_data *data, int sensor) | |||
212 | wait_for_completion(&data->read_complete); | 212 | wait_for_completion(&data->read_complete); |
213 | 213 | ||
214 | if (data->rx_result || data->rx_msg_len < 26) { | 214 | if (data->rx_result || data->rx_msg_len < 26) { |
215 | printk(KERN_ERR "Error reading sensor %d, please check.\n", | 215 | dev_err(data->bmc_device, "Error reading sensor %d.\n", |
216 | sensor); | 216 | sensor); |
217 | return -ENOENT; | 217 | return -ENOENT; |
218 | } | 218 | } |
219 | 219 | ||
@@ -456,8 +456,7 @@ static void ibmpex_register_bmc(int iface, struct device *dev) | |||
456 | 456 | ||
457 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 457 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
458 | if (!data) { | 458 | if (!data) { |
459 | printk(KERN_ERR DRVNAME ": Insufficient memory for BMC " | 459 | dev_err(dev, "Insufficient memory for BMC interface.\n"); |
460 | "interface %d.\n", data->interface); | ||
461 | return; | 460 | return; |
462 | } | 461 | } |
463 | 462 | ||
@@ -471,9 +470,8 @@ static void ibmpex_register_bmc(int iface, struct device *dev) | |||
471 | err = ipmi_create_user(data->interface, &driver_data.ipmi_hndlrs, | 470 | err = ipmi_create_user(data->interface, &driver_data.ipmi_hndlrs, |
472 | data, &data->user); | 471 | data, &data->user); |
473 | if (err < 0) { | 472 | if (err < 0) { |
474 | printk(KERN_ERR DRVNAME ": Error, unable to register user with " | 473 | dev_err(dev, "Unable to register user with IPMI " |
475 | "ipmi interface %d\n", | 474 | "interface %d\n", data->interface); |
476 | data->interface); | ||
477 | goto out; | 475 | goto out; |
478 | } | 476 | } |
479 | 477 | ||
@@ -495,9 +493,9 @@ static void ibmpex_register_bmc(int iface, struct device *dev) | |||
495 | data->hwmon_dev = hwmon_device_register(data->bmc_device); | 493 | data->hwmon_dev = hwmon_device_register(data->bmc_device); |
496 | 494 | ||
497 | if (IS_ERR(data->hwmon_dev)) { | 495 | if (IS_ERR(data->hwmon_dev)) { |
498 | printk(KERN_ERR DRVNAME ": Error, unable to register hwmon " | 496 | dev_err(data->bmc_device, "Unable to register hwmon " |
499 | "class device for interface %d\n", | 497 | "device for IPMI interface %d\n", |
500 | data->interface); | 498 | data->interface); |
501 | goto out_user; | 499 | goto out_user; |
502 | } | 500 | } |
503 | 501 | ||
@@ -508,7 +506,7 @@ static void ibmpex_register_bmc(int iface, struct device *dev) | |||
508 | /* Now go find all the sensors */ | 506 | /* Now go find all the sensors */ |
509 | err = ibmpex_find_sensors(data); | 507 | err = ibmpex_find_sensors(data); |
510 | if (err) { | 508 | if (err) { |
511 | printk(KERN_ERR "Error %d allocating memory\n", err); | 509 | dev_err(data->bmc_device, "Error %d finding sensors\n", err); |
512 | goto out_register; | 510 | goto out_register; |
513 | } | 511 | } |
514 | 512 | ||
@@ -561,10 +559,10 @@ static void ibmpex_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) | |||
561 | struct ibmpex_bmc_data *data = (struct ibmpex_bmc_data *)user_msg_data; | 559 | struct ibmpex_bmc_data *data = (struct ibmpex_bmc_data *)user_msg_data; |
562 | 560 | ||
563 | if (msg->msgid != data->tx_msgid) { | 561 | if (msg->msgid != data->tx_msgid) { |
564 | printk(KERN_ERR "Received msgid (%02x) and transmitted " | 562 | dev_err(data->bmc_device, "Mismatch between received msgid " |
565 | "msgid (%02x) mismatch!\n", | 563 | "(%02x) and transmitted msgid (%02x)!\n", |
566 | (int)msg->msgid, | 564 | (int)msg->msgid, |
567 | (int)data->tx_msgid); | 565 | (int)data->tx_msgid); |
568 | ipmi_free_recv_msg(msg); | 566 | ipmi_free_recv_msg(msg); |
569 | return; | 567 | return; |
570 | } | 568 | } |
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index dd366889ce9b..d435f003292d 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c | |||
@@ -31,14 +31,15 @@ | |||
31 | #include <linux/err.h> | 31 | #include <linux/err.h> |
32 | #include <linux/sysfs.h> | 32 | #include <linux/sysfs.h> |
33 | #include <linux/hwmon.h> | 33 | #include <linux/hwmon.h> |
34 | #include <linux/mutex.h> | ||
34 | #include <linux/spi/spi.h> | 35 | #include <linux/spi/spi.h> |
35 | #include <asm/semaphore.h> | 36 | |
36 | 37 | ||
37 | #define DRVNAME "lm70" | 38 | #define DRVNAME "lm70" |
38 | 39 | ||
39 | struct lm70 { | 40 | struct lm70 { |
40 | struct device *hwmon_dev; | 41 | struct device *hwmon_dev; |
41 | struct semaphore sem; | 42 | struct mutex lock; |
42 | }; | 43 | }; |
43 | 44 | ||
44 | /* sysfs hook function */ | 45 | /* sysfs hook function */ |
@@ -51,7 +52,7 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
51 | s16 raw=0; | 52 | s16 raw=0; |
52 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); | 53 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); |
53 | 54 | ||
54 | if (down_interruptible(&p_lm70->sem)) | 55 | if (mutex_lock_interruptible(&p_lm70->lock)) |
55 | return -ERESTARTSYS; | 56 | return -ERESTARTSYS; |
56 | 57 | ||
57 | /* | 58 | /* |
@@ -83,7 +84,7 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
83 | val = ((int)raw/32) * 250; | 84 | val = ((int)raw/32) * 250; |
84 | status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ | 85 | status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ |
85 | out: | 86 | out: |
86 | up(&p_lm70->sem); | 87 | mutex_unlock(&p_lm70->lock); |
87 | return status; | 88 | return status; |
88 | } | 89 | } |
89 | 90 | ||
@@ -112,7 +113,7 @@ static int __devinit lm70_probe(struct spi_device *spi) | |||
112 | if (!p_lm70) | 113 | if (!p_lm70) |
113 | return -ENOMEM; | 114 | return -ENOMEM; |
114 | 115 | ||
115 | init_MUTEX(&p_lm70->sem); | 116 | mutex_init(&p_lm70->lock); |
116 | 117 | ||
117 | /* sysfs hook */ | 118 | /* sysfs hook */ |
118 | p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); | 119 | p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 7e2d9787babc..a276806f3d53 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -435,6 +435,22 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
435 | } | 435 | } |
436 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 436 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
437 | 437 | ||
438 | static ssize_t show_alarm(struct device *dev, struct device_attribute *da, | ||
439 | char *buf) | ||
440 | { | ||
441 | struct sis5595_data *data = sis5595_update_device(dev); | ||
442 | int nr = to_sensor_dev_attr(da)->index; | ||
443 | return sprintf(buf, "%u\n", (data->alarms >> nr) & 1); | ||
444 | } | ||
445 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
446 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
447 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2); | ||
448 | static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
449 | static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 15); | ||
450 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6); | ||
451 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7); | ||
452 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 15); | ||
453 | |||
438 | static ssize_t show_name(struct device *dev, struct device_attribute *attr, | 454 | static ssize_t show_name(struct device *dev, struct device_attribute *attr, |
439 | char *buf) | 455 | char *buf) |
440 | { | 456 | { |
@@ -447,22 +463,28 @@ static struct attribute *sis5595_attributes[] = { | |||
447 | &sensor_dev_attr_in0_input.dev_attr.attr, | 463 | &sensor_dev_attr_in0_input.dev_attr.attr, |
448 | &sensor_dev_attr_in0_min.dev_attr.attr, | 464 | &sensor_dev_attr_in0_min.dev_attr.attr, |
449 | &sensor_dev_attr_in0_max.dev_attr.attr, | 465 | &sensor_dev_attr_in0_max.dev_attr.attr, |
466 | &sensor_dev_attr_in0_alarm.dev_attr.attr, | ||
450 | &sensor_dev_attr_in1_input.dev_attr.attr, | 467 | &sensor_dev_attr_in1_input.dev_attr.attr, |
451 | &sensor_dev_attr_in1_min.dev_attr.attr, | 468 | &sensor_dev_attr_in1_min.dev_attr.attr, |
452 | &sensor_dev_attr_in1_max.dev_attr.attr, | 469 | &sensor_dev_attr_in1_max.dev_attr.attr, |
470 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
453 | &sensor_dev_attr_in2_input.dev_attr.attr, | 471 | &sensor_dev_attr_in2_input.dev_attr.attr, |
454 | &sensor_dev_attr_in2_min.dev_attr.attr, | 472 | &sensor_dev_attr_in2_min.dev_attr.attr, |
455 | &sensor_dev_attr_in2_max.dev_attr.attr, | 473 | &sensor_dev_attr_in2_max.dev_attr.attr, |
474 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
456 | &sensor_dev_attr_in3_input.dev_attr.attr, | 475 | &sensor_dev_attr_in3_input.dev_attr.attr, |
457 | &sensor_dev_attr_in3_min.dev_attr.attr, | 476 | &sensor_dev_attr_in3_min.dev_attr.attr, |
458 | &sensor_dev_attr_in3_max.dev_attr.attr, | 477 | &sensor_dev_attr_in3_max.dev_attr.attr, |
478 | &sensor_dev_attr_in3_alarm.dev_attr.attr, | ||
459 | 479 | ||
460 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 480 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
461 | &sensor_dev_attr_fan1_min.dev_attr.attr, | 481 | &sensor_dev_attr_fan1_min.dev_attr.attr, |
462 | &sensor_dev_attr_fan1_div.dev_attr.attr, | 482 | &sensor_dev_attr_fan1_div.dev_attr.attr, |
483 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
463 | &sensor_dev_attr_fan2_input.dev_attr.attr, | 484 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
464 | &sensor_dev_attr_fan2_min.dev_attr.attr, | 485 | &sensor_dev_attr_fan2_min.dev_attr.attr, |
465 | &sensor_dev_attr_fan2_div.dev_attr.attr, | 486 | &sensor_dev_attr_fan2_div.dev_attr.attr, |
487 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
466 | 488 | ||
467 | &dev_attr_alarms.attr, | 489 | &dev_attr_alarms.attr, |
468 | &dev_attr_name.attr, | 490 | &dev_attr_name.attr, |
@@ -473,19 +495,28 @@ static const struct attribute_group sis5595_group = { | |||
473 | .attrs = sis5595_attributes, | 495 | .attrs = sis5595_attributes, |
474 | }; | 496 | }; |
475 | 497 | ||
476 | static struct attribute *sis5595_attributes_opt[] = { | 498 | static struct attribute *sis5595_attributes_in4[] = { |
477 | &sensor_dev_attr_in4_input.dev_attr.attr, | 499 | &sensor_dev_attr_in4_input.dev_attr.attr, |
478 | &sensor_dev_attr_in4_min.dev_attr.attr, | 500 | &sensor_dev_attr_in4_min.dev_attr.attr, |
479 | &sensor_dev_attr_in4_max.dev_attr.attr, | 501 | &sensor_dev_attr_in4_max.dev_attr.attr, |
502 | &sensor_dev_attr_in4_alarm.dev_attr.attr, | ||
503 | NULL | ||
504 | }; | ||
505 | |||
506 | static const struct attribute_group sis5595_group_in4 = { | ||
507 | .attrs = sis5595_attributes_in4, | ||
508 | }; | ||
480 | 509 | ||
510 | static struct attribute *sis5595_attributes_temp1[] = { | ||
481 | &dev_attr_temp1_input.attr, | 511 | &dev_attr_temp1_input.attr, |
482 | &dev_attr_temp1_max.attr, | 512 | &dev_attr_temp1_max.attr, |
483 | &dev_attr_temp1_max_hyst.attr, | 513 | &dev_attr_temp1_max_hyst.attr, |
514 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
484 | NULL | 515 | NULL |
485 | }; | 516 | }; |
486 | 517 | ||
487 | static const struct attribute_group sis5595_group_opt = { | 518 | static const struct attribute_group sis5595_group_temp1 = { |
488 | .attrs = sis5595_attributes_opt, | 519 | .attrs = sis5595_attributes_temp1, |
489 | }; | 520 | }; |
490 | 521 | ||
491 | /* This is called when the module is loaded */ | 522 | /* This is called when the module is loaded */ |
@@ -540,20 +571,12 @@ static int __devinit sis5595_probe(struct platform_device *pdev) | |||
540 | if ((err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group))) | 571 | if ((err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group))) |
541 | goto exit_free; | 572 | goto exit_free; |
542 | if (data->maxins == 4) { | 573 | if (data->maxins == 4) { |
543 | if ((err = device_create_file(&pdev->dev, | 574 | if ((err = sysfs_create_group(&pdev->dev.kobj, |
544 | &sensor_dev_attr_in4_input.dev_attr)) | 575 | &sis5595_group_in4))) |
545 | || (err = device_create_file(&pdev->dev, | ||
546 | &sensor_dev_attr_in4_min.dev_attr)) | ||
547 | || (err = device_create_file(&pdev->dev, | ||
548 | &sensor_dev_attr_in4_max.dev_attr))) | ||
549 | goto exit_remove_files; | 576 | goto exit_remove_files; |
550 | } else { | 577 | } else { |
551 | if ((err = device_create_file(&pdev->dev, | 578 | if ((err = sysfs_create_group(&pdev->dev.kobj, |
552 | &dev_attr_temp1_input)) | 579 | &sis5595_group_temp1))) |
553 | || (err = device_create_file(&pdev->dev, | ||
554 | &dev_attr_temp1_max)) | ||
555 | || (err = device_create_file(&pdev->dev, | ||
556 | &dev_attr_temp1_max_hyst))) | ||
557 | goto exit_remove_files; | 580 | goto exit_remove_files; |
558 | } | 581 | } |
559 | 582 | ||
@@ -567,7 +590,8 @@ static int __devinit sis5595_probe(struct platform_device *pdev) | |||
567 | 590 | ||
568 | exit_remove_files: | 591 | exit_remove_files: |
569 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); | 592 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); |
570 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_opt); | 593 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4); |
594 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1); | ||
571 | exit_free: | 595 | exit_free: |
572 | kfree(data); | 596 | kfree(data); |
573 | exit_release: | 597 | exit_release: |
@@ -582,7 +606,8 @@ static int __devexit sis5595_remove(struct platform_device *pdev) | |||
582 | 606 | ||
583 | hwmon_device_unregister(data->hwmon_dev); | 607 | hwmon_device_unregister(data->hwmon_dev); |
584 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); | 608 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); |
585 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_opt); | 609 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4); |
610 | sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1); | ||
586 | 611 | ||
587 | release_region(data->addr, SIS5595_EXTENT); | 612 | release_region(data->addr, SIS5595_EXTENT); |
588 | platform_set_drvdata(pdev, NULL); | 613 | platform_set_drvdata(pdev, NULL); |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 20ae425a1980..879d0a6544cc 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -170,20 +170,16 @@ superio_exit(void) | |||
170 | #define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \ | 170 | #define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \ |
171 | (0x550 + (nr) - 7)) | 171 | (0x550 + (nr) - 7)) |
172 | 172 | ||
173 | #define W83781D_REG_FAN_MIN(nr) (0x3a + (nr)) | 173 | /* nr:0-2 for fans:1-3 */ |
174 | #define W83781D_REG_FAN(nr) (0x27 + (nr)) | 174 | #define W83627HF_REG_FAN_MIN(nr) (0x3b + (nr)) |
175 | 175 | #define W83627HF_REG_FAN(nr) (0x28 + (nr)) | |
176 | #define W83781D_REG_TEMP2_CONFIG 0x152 | 176 | |
177 | #define W83781D_REG_TEMP3_CONFIG 0x252 | 177 | #define W83627HF_REG_TEMP2_CONFIG 0x152 |
178 | #define W83781D_REG_TEMP(nr) ((nr == 3) ? (0x0250) : \ | 178 | #define W83627HF_REG_TEMP3_CONFIG 0x252 |
179 | ((nr == 2) ? (0x0150) : \ | 179 | /* these are zero-based, unlike config constants above */ |
180 | (0x27))) | 180 | static const u16 w83627hf_reg_temp[] = { 0x27, 0x150, 0x250 }; |
181 | #define W83781D_REG_TEMP_HYST(nr) ((nr == 3) ? (0x253) : \ | 181 | static const u16 w83627hf_reg_temp_hyst[] = { 0x3A, 0x153, 0x253 }; |
182 | ((nr == 2) ? (0x153) : \ | 182 | static const u16 w83627hf_reg_temp_over[] = { 0x39, 0x155, 0x255 }; |
183 | (0x3A))) | ||
184 | #define W83781D_REG_TEMP_OVER(nr) ((nr == 3) ? (0x255) : \ | ||
185 | ((nr == 2) ? (0x155) : \ | ||
186 | (0x39))) | ||
187 | 183 | ||
188 | #define W83781D_REG_BANK 0x4E | 184 | #define W83781D_REG_BANK 0x4E |
189 | 185 | ||
@@ -360,12 +356,9 @@ struct w83627hf_data { | |||
360 | u8 in_min[9]; /* Register value */ | 356 | u8 in_min[9]; /* Register value */ |
361 | u8 fan[3]; /* Register value */ | 357 | u8 fan[3]; /* Register value */ |
362 | u8 fan_min[3]; /* Register value */ | 358 | u8 fan_min[3]; /* Register value */ |
363 | u8 temp; | 359 | u16 temp[3]; /* Register value */ |
364 | u8 temp_max; /* Register value */ | 360 | u16 temp_max[3]; /* Register value */ |
365 | u8 temp_max_hyst; /* Register value */ | 361 | u16 temp_max_hyst[3]; /* Register value */ |
366 | u16 temp_add[2]; /* Register value */ | ||
367 | u16 temp_max_add[2]; /* Register value */ | ||
368 | u16 temp_max_hyst_add[2]; /* Register value */ | ||
369 | u8 fan_div[3]; /* Register encoding, shifted right */ | 362 | u8 fan_div[3]; /* Register encoding, shifted right */ |
370 | u8 vid; /* Register encoding, combined */ | 363 | u8 vid; /* Register encoding, combined */ |
371 | u32 alarms; /* Register encoding, combined */ | 364 | u32 alarms; /* Register encoding, combined */ |
@@ -590,7 +583,7 @@ store_fan_min(struct device *dev, struct device_attribute *devattr, | |||
590 | 583 | ||
591 | mutex_lock(&data->update_lock); | 584 | mutex_lock(&data->update_lock); |
592 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); | 585 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); |
593 | w83627hf_write_value(data, W83781D_REG_FAN_MIN(nr+1), | 586 | w83627hf_write_value(data, W83627HF_REG_FAN_MIN(nr), |
594 | data->fan_min[nr]); | 587 | data->fan_min[nr]); |
595 | 588 | ||
596 | mutex_unlock(&data->update_lock); | 589 | mutex_unlock(&data->update_lock); |
@@ -611,12 +604,10 @@ show_temp(struct device *dev, struct device_attribute *devattr, char *buf) | |||
611 | { | 604 | { |
612 | int nr = to_sensor_dev_attr(devattr)->index; | 605 | int nr = to_sensor_dev_attr(devattr)->index; |
613 | struct w83627hf_data *data = w83627hf_update_device(dev); | 606 | struct w83627hf_data *data = w83627hf_update_device(dev); |
614 | if (nr >= 2) { /* TEMP2 and TEMP3 */ | 607 | |
615 | return sprintf(buf, "%ld\n", | 608 | u16 tmp = data->temp[nr]; |
616 | (long)LM75_TEMP_FROM_REG(data->temp_add[nr-2])); | 609 | return sprintf(buf, "%ld\n", (nr) ? (long) LM75_TEMP_FROM_REG(tmp) |
617 | } else { /* TEMP1 */ | 610 | : (long) TEMP_FROM_REG(tmp)); |
618 | return sprintf(buf, "%ld\n", (long)TEMP_FROM_REG(data->temp)); | ||
619 | } | ||
620 | } | 611 | } |
621 | 612 | ||
622 | static ssize_t | 613 | static ssize_t |
@@ -625,13 +616,10 @@ show_temp_max(struct device *dev, struct device_attribute *devattr, | |||
625 | { | 616 | { |
626 | int nr = to_sensor_dev_attr(devattr)->index; | 617 | int nr = to_sensor_dev_attr(devattr)->index; |
627 | struct w83627hf_data *data = w83627hf_update_device(dev); | 618 | struct w83627hf_data *data = w83627hf_update_device(dev); |
628 | if (nr >= 2) { /* TEMP2 and TEMP3 */ | 619 | |
629 | return sprintf(buf, "%ld\n", | 620 | u16 tmp = data->temp_max[nr]; |
630 | (long)LM75_TEMP_FROM_REG(data->temp_max_add[nr-2])); | 621 | return sprintf(buf, "%ld\n", (nr) ? (long) LM75_TEMP_FROM_REG(tmp) |
631 | } else { /* TEMP1 */ | 622 | : (long) TEMP_FROM_REG(tmp)); |
632 | return sprintf(buf, "%ld\n", | ||
633 | (long)TEMP_FROM_REG(data->temp_max)); | ||
634 | } | ||
635 | } | 623 | } |
636 | 624 | ||
637 | static ssize_t | 625 | static ssize_t |
@@ -640,13 +628,10 @@ show_temp_max_hyst(struct device *dev, struct device_attribute *devattr, | |||
640 | { | 628 | { |
641 | int nr = to_sensor_dev_attr(devattr)->index; | 629 | int nr = to_sensor_dev_attr(devattr)->index; |
642 | struct w83627hf_data *data = w83627hf_update_device(dev); | 630 | struct w83627hf_data *data = w83627hf_update_device(dev); |
643 | if (nr >= 2) { /* TEMP2 and TEMP3 */ | 631 | |
644 | return sprintf(buf, "%ld\n", | 632 | u16 tmp = data->temp_max_hyst[nr]; |
645 | (long)LM75_TEMP_FROM_REG(data->temp_max_hyst_add[nr-2])); | 633 | return sprintf(buf, "%ld\n", (nr) ? (long) LM75_TEMP_FROM_REG(tmp) |
646 | } else { /* TEMP1 */ | 634 | : (long) TEMP_FROM_REG(tmp)); |
647 | return sprintf(buf, "%ld\n", | ||
648 | (long)TEMP_FROM_REG(data->temp_max_hyst)); | ||
649 | } | ||
650 | } | 635 | } |
651 | 636 | ||
652 | static ssize_t | 637 | static ssize_t |
@@ -656,18 +641,11 @@ store_temp_max(struct device *dev, struct device_attribute *devattr, | |||
656 | int nr = to_sensor_dev_attr(devattr)->index; | 641 | int nr = to_sensor_dev_attr(devattr)->index; |
657 | struct w83627hf_data *data = dev_get_drvdata(dev); | 642 | struct w83627hf_data *data = dev_get_drvdata(dev); |
658 | long val = simple_strtol(buf, NULL, 10); | 643 | long val = simple_strtol(buf, NULL, 10); |
644 | u16 tmp = (nr) ? LM75_TEMP_TO_REG(val) : TEMP_TO_REG(val); | ||
659 | 645 | ||
660 | mutex_lock(&data->update_lock); | 646 | mutex_lock(&data->update_lock); |
661 | 647 | data->temp_max[nr] = tmp; | |
662 | if (nr >= 2) { /* TEMP2 and TEMP3 */ | 648 | w83627hf_write_value(data, w83627hf_reg_temp_over[nr], tmp); |
663 | data->temp_max_add[nr-2] = LM75_TEMP_TO_REG(val); | ||
664 | w83627hf_write_value(data, W83781D_REG_TEMP_OVER(nr), | ||
665 | data->temp_max_add[nr-2]); | ||
666 | } else { /* TEMP1 */ | ||
667 | data->temp_max = TEMP_TO_REG(val); | ||
668 | w83627hf_write_value(data, W83781D_REG_TEMP_OVER(nr), | ||
669 | data->temp_max); | ||
670 | } | ||
671 | mutex_unlock(&data->update_lock); | 649 | mutex_unlock(&data->update_lock); |
672 | return count; | 650 | return count; |
673 | } | 651 | } |
@@ -679,29 +657,22 @@ store_temp_max_hyst(struct device *dev, struct device_attribute *devattr, | |||
679 | int nr = to_sensor_dev_attr(devattr)->index; | 657 | int nr = to_sensor_dev_attr(devattr)->index; |
680 | struct w83627hf_data *data = dev_get_drvdata(dev); | 658 | struct w83627hf_data *data = dev_get_drvdata(dev); |
681 | long val = simple_strtol(buf, NULL, 10); | 659 | long val = simple_strtol(buf, NULL, 10); |
660 | u16 tmp = (nr) ? LM75_TEMP_TO_REG(val) : TEMP_TO_REG(val); | ||
682 | 661 | ||
683 | mutex_lock(&data->update_lock); | 662 | mutex_lock(&data->update_lock); |
684 | 663 | data->temp_max_hyst[nr] = tmp; | |
685 | if (nr >= 2) { /* TEMP2 and TEMP3 */ | 664 | w83627hf_write_value(data, w83627hf_reg_temp_hyst[nr], tmp); |
686 | data->temp_max_hyst_add[nr-2] = LM75_TEMP_TO_REG(val); | ||
687 | w83627hf_write_value(data, W83781D_REG_TEMP_HYST(nr), | ||
688 | data->temp_max_hyst_add[nr-2]); | ||
689 | } else { /* TEMP1 */ | ||
690 | data->temp_max_hyst = TEMP_TO_REG(val); | ||
691 | w83627hf_write_value(data, W83781D_REG_TEMP_HYST(nr), | ||
692 | data->temp_max_hyst); | ||
693 | } | ||
694 | mutex_unlock(&data->update_lock); | 665 | mutex_unlock(&data->update_lock); |
695 | return count; | 666 | return count; |
696 | } | 667 | } |
697 | 668 | ||
698 | #define sysfs_temp_decl(offset) \ | 669 | #define sysfs_temp_decl(offset) \ |
699 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ | 670 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ |
700 | show_temp, NULL, offset); \ | 671 | show_temp, NULL, offset - 1); \ |
701 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO|S_IWUSR, \ | 672 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO|S_IWUSR, \ |
702 | show_temp_max, store_temp_max, offset); \ | 673 | show_temp_max, store_temp_max, offset - 1); \ |
703 | static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO|S_IWUSR, \ | 674 | static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO|S_IWUSR, \ |
704 | show_temp_max_hyst, store_temp_max_hyst, offset); | 675 | show_temp_max_hyst, store_temp_max_hyst, offset - 1); |
705 | 676 | ||
706 | sysfs_temp_decl(1); | 677 | sysfs_temp_decl(1); |
707 | sysfs_temp_decl(2); | 678 | sysfs_temp_decl(2); |
@@ -844,7 +815,7 @@ store_fan_div(struct device *dev, struct device_attribute *devattr, | |||
844 | 815 | ||
845 | /* Restore fan_min */ | 816 | /* Restore fan_min */ |
846 | data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); | 817 | data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); |
847 | w83627hf_write_value(data, W83781D_REG_FAN_MIN(nr+1), data->fan_min[nr]); | 818 | w83627hf_write_value(data, W83627HF_REG_FAN_MIN(nr), data->fan_min[nr]); |
848 | 819 | ||
849 | mutex_unlock(&data->update_lock); | 820 | mutex_unlock(&data->update_lock); |
850 | return count; | 821 | return count; |
@@ -1170,7 +1141,7 @@ static int __devinit w83627hf_probe(struct platform_device *pdev) | |||
1170 | struct w83627hf_sio_data *sio_data = dev->platform_data; | 1141 | struct w83627hf_sio_data *sio_data = dev->platform_data; |
1171 | struct w83627hf_data *data; | 1142 | struct w83627hf_data *data; |
1172 | struct resource *res; | 1143 | struct resource *res; |
1173 | int err; | 1144 | int err, i; |
1174 | 1145 | ||
1175 | static const char *names[] = { | 1146 | static const char *names[] = { |
1176 | "w83627hf", | 1147 | "w83627hf", |
@@ -1204,9 +1175,9 @@ static int __devinit w83627hf_probe(struct platform_device *pdev) | |||
1204 | w83627hf_init_device(pdev); | 1175 | w83627hf_init_device(pdev); |
1205 | 1176 | ||
1206 | /* A few vars need to be filled upon startup */ | 1177 | /* A few vars need to be filled upon startup */ |
1207 | data->fan_min[0] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(1)); | 1178 | for (i = 0; i <= 2; i++) |
1208 | data->fan_min[1] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(2)); | 1179 | data->fan_min[i] = w83627hf_read_value( |
1209 | data->fan_min[2] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(3)); | 1180 | data, W83627HF_REG_FAN_MIN(i)); |
1210 | w83627hf_update_fan_div(data); | 1181 | w83627hf_update_fan_div(data); |
1211 | 1182 | ||
1212 | /* Register common device attributes */ | 1183 | /* Register common device attributes */ |
@@ -1514,23 +1485,23 @@ static void __devinit w83627hf_init_device(struct platform_device *pdev) | |||
1514 | 1485 | ||
1515 | if(init) { | 1486 | if(init) { |
1516 | /* Enable temp2 */ | 1487 | /* Enable temp2 */ |
1517 | tmp = w83627hf_read_value(data, W83781D_REG_TEMP2_CONFIG); | 1488 | tmp = w83627hf_read_value(data, W83627HF_REG_TEMP2_CONFIG); |
1518 | if (tmp & 0x01) { | 1489 | if (tmp & 0x01) { |
1519 | dev_warn(&pdev->dev, "Enabling temp2, readings " | 1490 | dev_warn(&pdev->dev, "Enabling temp2, readings " |
1520 | "might not make sense\n"); | 1491 | "might not make sense\n"); |
1521 | w83627hf_write_value(data, W83781D_REG_TEMP2_CONFIG, | 1492 | w83627hf_write_value(data, W83627HF_REG_TEMP2_CONFIG, |
1522 | tmp & 0xfe); | 1493 | tmp & 0xfe); |
1523 | } | 1494 | } |
1524 | 1495 | ||
1525 | /* Enable temp3 */ | 1496 | /* Enable temp3 */ |
1526 | if (type != w83697hf) { | 1497 | if (type != w83697hf) { |
1527 | tmp = w83627hf_read_value(data, | 1498 | tmp = w83627hf_read_value(data, |
1528 | W83781D_REG_TEMP3_CONFIG); | 1499 | W83627HF_REG_TEMP3_CONFIG); |
1529 | if (tmp & 0x01) { | 1500 | if (tmp & 0x01) { |
1530 | dev_warn(&pdev->dev, "Enabling temp3, " | 1501 | dev_warn(&pdev->dev, "Enabling temp3, " |
1531 | "readings might not make sense\n"); | 1502 | "readings might not make sense\n"); |
1532 | w83627hf_write_value(data, | 1503 | w83627hf_write_value(data, |
1533 | W83781D_REG_TEMP3_CONFIG, tmp & 0xfe); | 1504 | W83627HF_REG_TEMP3_CONFIG, tmp & 0xfe); |
1534 | } | 1505 | } |
1535 | } | 1506 | } |
1536 | } | 1507 | } |
@@ -1563,7 +1534,7 @@ static void w83627hf_update_fan_div(struct w83627hf_data *data) | |||
1563 | static struct w83627hf_data *w83627hf_update_device(struct device *dev) | 1534 | static struct w83627hf_data *w83627hf_update_device(struct device *dev) |
1564 | { | 1535 | { |
1565 | struct w83627hf_data *data = dev_get_drvdata(dev); | 1536 | struct w83627hf_data *data = dev_get_drvdata(dev); |
1566 | int i; | 1537 | int i, num_temps = (data->type == w83697hf) ? 2 : 3; |
1567 | 1538 | ||
1568 | mutex_lock(&data->update_lock); | 1539 | mutex_lock(&data->update_lock); |
1569 | 1540 | ||
@@ -1584,12 +1555,12 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev) | |||
1584 | w83627hf_read_value(data, | 1555 | w83627hf_read_value(data, |
1585 | W83781D_REG_IN_MAX(i)); | 1556 | W83781D_REG_IN_MAX(i)); |
1586 | } | 1557 | } |
1587 | for (i = 1; i <= 3; i++) { | 1558 | for (i = 0; i <= 2; i++) { |
1588 | data->fan[i - 1] = | 1559 | data->fan[i] = |
1589 | w83627hf_read_value(data, W83781D_REG_FAN(i)); | 1560 | w83627hf_read_value(data, W83627HF_REG_FAN(i)); |
1590 | data->fan_min[i - 1] = | 1561 | data->fan_min[i] = |
1591 | w83627hf_read_value(data, | 1562 | w83627hf_read_value(data, |
1592 | W83781D_REG_FAN_MIN(i)); | 1563 | W83627HF_REG_FAN_MIN(i)); |
1593 | } | 1564 | } |
1594 | for (i = 0; i <= 2; i++) { | 1565 | for (i = 0; i <= 2; i++) { |
1595 | u8 tmp = w83627hf_read_value(data, | 1566 | u8 tmp = w83627hf_read_value(data, |
@@ -1616,25 +1587,13 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev) | |||
1616 | break; | 1587 | break; |
1617 | } | 1588 | } |
1618 | } | 1589 | } |
1619 | 1590 | for (i = 0; i < num_temps; i++) { | |
1620 | data->temp = w83627hf_read_value(data, W83781D_REG_TEMP(1)); | 1591 | data->temp[i] = w83627hf_read_value( |
1621 | data->temp_max = | 1592 | data, w83627hf_reg_temp[i]); |
1622 | w83627hf_read_value(data, W83781D_REG_TEMP_OVER(1)); | 1593 | data->temp_max[i] = w83627hf_read_value( |
1623 | data->temp_max_hyst = | 1594 | data, w83627hf_reg_temp_over[i]); |
1624 | w83627hf_read_value(data, W83781D_REG_TEMP_HYST(1)); | 1595 | data->temp_max_hyst[i] = w83627hf_read_value( |
1625 | data->temp_add[0] = | 1596 | data, w83627hf_reg_temp_hyst[i]); |
1626 | w83627hf_read_value(data, W83781D_REG_TEMP(2)); | ||
1627 | data->temp_max_add[0] = | ||
1628 | w83627hf_read_value(data, W83781D_REG_TEMP_OVER(2)); | ||
1629 | data->temp_max_hyst_add[0] = | ||
1630 | w83627hf_read_value(data, W83781D_REG_TEMP_HYST(2)); | ||
1631 | if (data->type != w83697hf) { | ||
1632 | data->temp_add[1] = | ||
1633 | w83627hf_read_value(data, W83781D_REG_TEMP(3)); | ||
1634 | data->temp_max_add[1] = | ||
1635 | w83627hf_read_value(data, W83781D_REG_TEMP_OVER(3)); | ||
1636 | data->temp_max_hyst_add[1] = | ||
1637 | w83627hf_read_value(data, W83781D_REG_TEMP_HYST(3)); | ||
1638 | } | 1597 | } |
1639 | 1598 | ||
1640 | w83627hf_update_fan_div(data); | 1599 | w83627hf_update_fan_div(data); |
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index a6a1edfe7614..e0fa7520400d 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
@@ -1122,12 +1122,13 @@ w83781d_create_files(struct device *dev, int kind, int is_isa) | |||
1122 | &sensor_dev_attr_temp3_beep.dev_attr))) | 1122 | &sensor_dev_attr_temp3_beep.dev_attr))) |
1123 | return err; | 1123 | return err; |
1124 | 1124 | ||
1125 | if (kind != w83781d) | 1125 | if (kind != w83781d) { |
1126 | err = sysfs_chmod_file(&dev->kobj, | 1126 | err = sysfs_chmod_file(&dev->kobj, |
1127 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | 1127 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, |
1128 | S_IRUGO | S_IWUSR); | 1128 | S_IRUGO | S_IWUSR); |
1129 | if (err) | 1129 | if (err) |
1130 | return err; | 1130 | return err; |
1131 | } | ||
1131 | } | 1132 | } |
1132 | 1133 | ||
1133 | if (kind != w83781d && kind != as99127f) { | 1134 | if (kind != w83781d && kind != as99127f) { |
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c index 58e32714afb5..ca18e0be4901 100644 --- a/drivers/i2c/busses/i2c-pasemi.c +++ b/drivers/i2c/busses/i2c-pasemi.c | |||
@@ -51,6 +51,7 @@ struct pasemi_smbus { | |||
51 | #define MRXFIFO_DATA_M 0x000000ff | 51 | #define MRXFIFO_DATA_M 0x000000ff |
52 | 52 | ||
53 | #define SMSTA_XEN 0x08000000 | 53 | #define SMSTA_XEN 0x08000000 |
54 | #define SMSTA_MTN 0x00200000 | ||
54 | 55 | ||
55 | #define CTL_MRR 0x00000400 | 56 | #define CTL_MRR 0x00000400 |
56 | #define CTL_MTR 0x00000200 | 57 | #define CTL_MTR 0x00000200 |
@@ -98,6 +99,10 @@ static unsigned int pasemi_smb_waitready(struct pasemi_smbus *smbus) | |||
98 | status = reg_read(smbus, REG_SMSTA); | 99 | status = reg_read(smbus, REG_SMSTA); |
99 | } | 100 | } |
100 | 101 | ||
102 | /* Got NACK? */ | ||
103 | if (status & SMSTA_MTN) | ||
104 | return -ENXIO; | ||
105 | |||
101 | if (timeout < 0) { | 106 | if (timeout < 0) { |
102 | dev_warn(&smbus->dev->dev, "Timeout, status 0x%08x\n", status); | 107 | dev_warn(&smbus->dev->dev, "Timeout, status 0x%08x\n", status); |
103 | reg_write(smbus, REG_SMSTA, status); | 108 | reg_write(smbus, REG_SMSTA, status); |
@@ -364,7 +369,7 @@ static int __devinit pasemi_smb_probe(struct pci_dev *dev, | |||
364 | smbus->adapter.algo = &smbus_algorithm; | 369 | smbus->adapter.algo = &smbus_algorithm; |
365 | smbus->adapter.algo_data = smbus; | 370 | smbus->adapter.algo_data = smbus; |
366 | 371 | ||
367 | /* set up the driverfs linkage to our parent device */ | 372 | /* set up the sysfs linkage to our parent device */ |
368 | smbus->adapter.dev.parent = &dev->dev; | 373 | smbus->adapter.dev.parent = &dev->dev; |
369 | 374 | ||
370 | reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | | 375 | reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | |
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index d3da1fb05b9b..1a7eeebac506 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c | |||
@@ -128,13 +128,20 @@ static ssize_t eeprom_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
128 | for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++) | 128 | for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++) |
129 | eeprom_update_client(client, slice); | 129 | eeprom_update_client(client, slice); |
130 | 130 | ||
131 | /* Hide Vaio security settings to regular users (16 first bytes) */ | 131 | /* Hide Vaio private settings to regular users: |
132 | if (data->nature == VAIO && off < 16 && !capable(CAP_SYS_ADMIN)) { | 132 | - BIOS passwords: bytes 0x00 to 0x0f |
133 | size_t in_row1 = 16 - off; | 133 | - UUID: bytes 0x10 to 0x1f |
134 | in_row1 = min(in_row1, count); | 134 | - Serial number: 0xc0 to 0xdf */ |
135 | memset(buf, 0, in_row1); | 135 | if (data->nature == VAIO && !capable(CAP_SYS_ADMIN)) { |
136 | if (count - in_row1 > 0) | 136 | int i; |
137 | memcpy(buf + in_row1, &data->data[16], count - in_row1); | 137 | |
138 | for (i = 0; i < count; i++) { | ||
139 | if ((off + i <= 0x1f) || | ||
140 | (off + i >= 0xc0 && off + i <= 0xdf)) | ||
141 | buf[i] = 0; | ||
142 | else | ||
143 | buf[i] = data->data[off + i]; | ||
144 | } | ||
138 | } else { | 145 | } else { |
139 | memcpy(buf, &data->data[off], count); | 146 | memcpy(buf, &data->data[off], count); |
140 | } | 147 | } |
@@ -197,14 +204,18 @@ static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) | |||
197 | goto exit_kfree; | 204 | goto exit_kfree; |
198 | 205 | ||
199 | /* Detect the Vaio nature of EEPROMs. | 206 | /* Detect the Vaio nature of EEPROMs. |
200 | We use the "PCG-" prefix as the signature. */ | 207 | We use the "PCG-" or "VGN-" prefix as the signature. */ |
201 | if (address == 0x57) { | 208 | if (address == 0x57) { |
202 | if (i2c_smbus_read_byte_data(new_client, 0x80) == 'P' | 209 | char name[4]; |
203 | && i2c_smbus_read_byte(new_client) == 'C' | 210 | |
204 | && i2c_smbus_read_byte(new_client) == 'G' | 211 | name[0] = i2c_smbus_read_byte_data(new_client, 0x80); |
205 | && i2c_smbus_read_byte(new_client) == '-') { | 212 | name[1] = i2c_smbus_read_byte(new_client); |
213 | name[2] = i2c_smbus_read_byte(new_client); | ||
214 | name[3] = i2c_smbus_read_byte(new_client); | ||
215 | |||
216 | if (!memcmp(name, "PCG-", 4) || !memcmp(name, "VGN-", 4)) { | ||
206 | dev_info(&new_client->dev, "Vaio EEPROM detected, " | 217 | dev_info(&new_client->dev, "Vaio EEPROM detected, " |
207 | "enabling password protection\n"); | 218 | "enabling privacy protection\n"); |
208 | data->nature = VAIO; | 219 | data->nature = VAIO; |
209 | } | 220 | } |
210 | } | 221 | } |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 1a4e8dc03b36..b5e13e405e72 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -673,7 +673,7 @@ static int __i2c_check_addr(struct i2c_adapter *adapter, unsigned int addr) | |||
673 | return 0; | 673 | return 0; |
674 | } | 674 | } |
675 | 675 | ||
676 | int i2c_check_addr(struct i2c_adapter *adapter, int addr) | 676 | static int i2c_check_addr(struct i2c_adapter *adapter, int addr) |
677 | { | 677 | { |
678 | int rval; | 678 | int rval; |
679 | 679 | ||
@@ -683,7 +683,6 @@ int i2c_check_addr(struct i2c_adapter *adapter, int addr) | |||
683 | 683 | ||
684 | return rval; | 684 | return rval; |
685 | } | 685 | } |
686 | EXPORT_SYMBOL(i2c_check_addr); | ||
687 | 686 | ||
688 | int i2c_attach_client(struct i2c_client *client) | 687 | int i2c_attach_client(struct i2c_client *client) |
689 | { | 688 | { |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 5a15e50748de..c21ae20ae362 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
@@ -38,6 +38,15 @@ | |||
38 | 38 | ||
39 | static struct i2c_driver i2cdev_driver; | 39 | static struct i2c_driver i2cdev_driver; |
40 | 40 | ||
41 | /* | ||
42 | * An i2c_dev represents an i2c_adapter ... an I2C or SMBus master, not a | ||
43 | * slave (i2c_client) with which messages will be exchanged. It's coupled | ||
44 | * with a character special file which is accessed by user mode drivers. | ||
45 | * | ||
46 | * The list of i2c_dev structures is parallel to the i2c_adapter lists | ||
47 | * maintained by the driver model, and is updated using notifications | ||
48 | * delivered to the i2cdev_driver. | ||
49 | */ | ||
41 | struct i2c_dev { | 50 | struct i2c_dev { |
42 | struct list_head list; | 51 | struct list_head list; |
43 | struct i2c_adapter *adap; | 52 | struct i2c_adapter *adap; |
@@ -103,6 +112,25 @@ static ssize_t show_adapter_name(struct device *dev, | |||
103 | } | 112 | } |
104 | static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); | 113 | static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); |
105 | 114 | ||
115 | /* ------------------------------------------------------------------------- */ | ||
116 | |||
117 | /* | ||
118 | * After opening an instance of this character special file, a file | ||
119 | * descriptor starts out associated only with an i2c_adapter (and bus). | ||
120 | * | ||
121 | * Using the I2C_RDWR ioctl(), you can then *immediately* issue i2c_msg | ||
122 | * traffic to any devices on the bus used by that adapter. That's because | ||
123 | * the i2c_msg vectors embed all the addressing information they need, and | ||
124 | * are submitted directly to an i2c_adapter. However, SMBus-only adapters | ||
125 | * don't support that interface. | ||
126 | * | ||
127 | * To use read()/write() system calls on that file descriptor, or to use | ||
128 | * SMBus interfaces (and work with SMBus-only hosts!), you must first issue | ||
129 | * an I2C_SLAVE (or I2C_SLAVE_FORCE) ioctl. That configures an anonymous | ||
130 | * (never registered) i2c_client so it holds the addressing information | ||
131 | * needed by those system calls and by this SMBus interface. | ||
132 | */ | ||
133 | |||
106 | static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count, | 134 | static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count, |
107 | loff_t *offset) | 135 | loff_t *offset) |
108 | { | 136 | { |
@@ -154,6 +182,29 @@ static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t c | |||
154 | return ret; | 182 | return ret; |
155 | } | 183 | } |
156 | 184 | ||
185 | /* This address checking function differs from the one in i2c-core | ||
186 | in that it considers an address with a registered device, but no | ||
187 | bounded driver, as NOT busy. */ | ||
188 | static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr) | ||
189 | { | ||
190 | struct list_head *item; | ||
191 | struct i2c_client *client; | ||
192 | int res = 0; | ||
193 | |||
194 | mutex_lock(&adapter->clist_lock); | ||
195 | list_for_each(item, &adapter->clients) { | ||
196 | client = list_entry(item, struct i2c_client, list); | ||
197 | if (client->addr == addr) { | ||
198 | if (client->driver) | ||
199 | res = -EBUSY; | ||
200 | break; | ||
201 | } | ||
202 | } | ||
203 | mutex_unlock(&adapter->clist_lock); | ||
204 | |||
205 | return res; | ||
206 | } | ||
207 | |||
157 | static int i2cdev_ioctl(struct inode *inode, struct file *file, | 208 | static int i2cdev_ioctl(struct inode *inode, struct file *file, |
158 | unsigned int cmd, unsigned long arg) | 209 | unsigned int cmd, unsigned long arg) |
159 | { | 210 | { |
@@ -172,11 +223,22 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, | |||
172 | switch ( cmd ) { | 223 | switch ( cmd ) { |
173 | case I2C_SLAVE: | 224 | case I2C_SLAVE: |
174 | case I2C_SLAVE_FORCE: | 225 | case I2C_SLAVE_FORCE: |
226 | /* NOTE: devices set up to work with "new style" drivers | ||
227 | * can't use I2C_SLAVE, even when the device node is not | ||
228 | * bound to a driver. Only I2C_SLAVE_FORCE will work. | ||
229 | * | ||
230 | * Setting the PEC flag here won't affect kernel drivers, | ||
231 | * which will be using the i2c_client node registered with | ||
232 | * the driver model core. Likewise, when that client has | ||
233 | * the PEC flag already set, the i2c-dev driver won't see | ||
234 | * (or use) this setting. | ||
235 | */ | ||
175 | if ((arg > 0x3ff) || | 236 | if ((arg > 0x3ff) || |
176 | (((client->flags & I2C_M_TEN) == 0) && arg > 0x7f)) | 237 | (((client->flags & I2C_M_TEN) == 0) && arg > 0x7f)) |
177 | return -EINVAL; | 238 | return -EINVAL; |
178 | if ((cmd == I2C_SLAVE) && i2c_check_addr(client->adapter,arg)) | 239 | if (cmd == I2C_SLAVE && i2cdev_check_addr(client->adapter, arg)) |
179 | return -EBUSY; | 240 | return -EBUSY; |
241 | /* REVISIT: address could become busy later */ | ||
180 | client->addr = arg; | 242 | client->addr = arg; |
181 | return 0; | 243 | return 0; |
182 | case I2C_TENBIT: | 244 | case I2C_TENBIT: |
@@ -386,6 +448,13 @@ static int i2cdev_open(struct inode *inode, struct file *file) | |||
386 | if (!adap) | 448 | if (!adap) |
387 | return -ENODEV; | 449 | return -ENODEV; |
388 | 450 | ||
451 | /* This creates an anonymous i2c_client, which may later be | ||
452 | * pointed to some address using I2C_SLAVE or I2C_SLAVE_FORCE. | ||
453 | * | ||
454 | * This client is ** NEVER REGISTERED ** with the driver model | ||
455 | * or I2C core code!! It just holds private copies of addressing | ||
456 | * information and maybe a PEC flag. | ||
457 | */ | ||
389 | client = kzalloc(sizeof(*client), GFP_KERNEL); | 458 | client = kzalloc(sizeof(*client), GFP_KERNEL); |
390 | if (!client) { | 459 | if (!client) { |
391 | i2c_put_adapter(adap); | 460 | i2c_put_adapter(adap); |
@@ -394,7 +463,6 @@ static int i2cdev_open(struct inode *inode, struct file *file) | |||
394 | snprintf(client->name, I2C_NAME_SIZE, "i2c-dev %d", adap->nr); | 463 | snprintf(client->name, I2C_NAME_SIZE, "i2c-dev %d", adap->nr); |
395 | client->driver = &i2cdev_driver; | 464 | client->driver = &i2cdev_driver; |
396 | 465 | ||
397 | /* registered with adapter, passed as client to user */ | ||
398 | client->adapter = adap; | 466 | client->adapter = adap; |
399 | file->private_data = client; | 467 | file->private_data = client; |
400 | 468 | ||
@@ -422,6 +490,14 @@ static const struct file_operations i2cdev_fops = { | |||
422 | .release = i2cdev_release, | 490 | .release = i2cdev_release, |
423 | }; | 491 | }; |
424 | 492 | ||
493 | /* ------------------------------------------------------------------------- */ | ||
494 | |||
495 | /* | ||
496 | * The legacy "i2cdev_driver" is used primarily to get notifications when | ||
497 | * I2C adapters are added or removed, so that each one gets an i2c_dev | ||
498 | * and is thus made available to userspace driver code. | ||
499 | */ | ||
500 | |||
425 | static struct class *i2c_dev_class; | 501 | static struct class *i2c_dev_class; |
426 | 502 | ||
427 | static int i2cdev_attach_adapter(struct i2c_adapter *adap) | 503 | static int i2cdev_attach_adapter(struct i2c_adapter *adap) |
@@ -486,6 +562,12 @@ static struct i2c_driver i2cdev_driver = { | |||
486 | .detach_client = i2cdev_detach_client, | 562 | .detach_client = i2cdev_detach_client, |
487 | }; | 563 | }; |
488 | 564 | ||
565 | /* ------------------------------------------------------------------------- */ | ||
566 | |||
567 | /* | ||
568 | * module load/unload record keeping | ||
569 | */ | ||
570 | |||
489 | static int __init i2c_dev_init(void) | 571 | static int __init i2c_dev_init(void) |
490 | { | 572 | { |
491 | int res; | 573 | int res; |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 6eaece96524e..e445fe6e4ba9 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -152,9 +152,22 @@ config BLK_DEV_IDEDISK | |||
152 | If unsure, say Y. | 152 | If unsure, say Y. |
153 | 153 | ||
154 | config IDEDISK_MULTI_MODE | 154 | config IDEDISK_MULTI_MODE |
155 | bool "Use multi-mode by default" | 155 | bool "Use multiple sector mode for Programmed Input/Output by default" |
156 | help | 156 | help |
157 | If you get this error, try to say Y here: | 157 | This setting is irrelevant for most IDE disks, with direct memory |
158 | access, to which multiple sector mode does not apply. Multiple sector | ||
159 | mode is a feature of most modern IDE hard drives, permitting the | ||
160 | transfer of multiple sectors per Programmed Input/Output interrupt, | ||
161 | rather than the usual one sector per interrupt. When this feature is | ||
162 | enabled, it can reduce operating system overhead for disk Programmed | ||
163 | Input/Output. On some systems, it also can increase the data | ||
164 | throughput of Programmed Input/Output. Some drives, however, seemed | ||
165 | to run slower with multiple sector mode enabled. Some drives claimed | ||
166 | to support multiple sector mode, but lost data at some settings. | ||
167 | Under rare circumstances, such failures could result in massive | ||
168 | filesystem corruption. | ||
169 | |||
170 | If you get the following error, try to say Y here: | ||
158 | 171 | ||
159 | hda: set_multmode: status=0x51 { DriveReady SeekComplete Error } | 172 | hda: set_multmode: status=0x51 { DriveReady SeekComplete Error } |
160 | hda: set_multmode: error=0x04 { DriveStatusError } | 173 | hda: set_multmode: error=0x04 { DriveStatusError } |
@@ -190,10 +203,6 @@ config BLK_DEV_IDECD | |||
190 | CD-ROM drive, you can say N to all other CD-ROM options, but be sure | 203 | CD-ROM drive, you can say N to all other CD-ROM options, but be sure |
191 | to say Y or M to "ISO 9660 CD-ROM file system support". | 204 | to say Y or M to "ISO 9660 CD-ROM file system support". |
192 | 205 | ||
193 | Note that older versions of LILO (LInux LOader) cannot properly deal | ||
194 | with IDE/ATAPI CD-ROMs, so install LILO 16 or higher, available from | ||
195 | <http://lilo.go.dyndns.org/>. | ||
196 | |||
197 | To compile this driver as a module, choose M here: the | 206 | To compile this driver as a module, choose M here: the |
198 | module will be called ide-cd. | 207 | module will be called ide-cd. |
199 | 208 | ||
@@ -380,9 +389,10 @@ config IDEPCI_SHARE_IRQ | |||
380 | config IDEPCI_PCIBUS_ORDER | 389 | config IDEPCI_PCIBUS_ORDER |
381 | def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI | 390 | def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI |
382 | 391 | ||
392 | # TODO: split it on per host driver config options (or module parameters) | ||
383 | config BLK_DEV_OFFBOARD | 393 | config BLK_DEV_OFFBOARD |
384 | bool "Boot off-board chipsets first support" | 394 | bool "Boot off-board chipsets first support" |
385 | depends on BLK_DEV_IDEPCI | 395 | depends on BLK_DEV_IDEPCI && (BLK_DEV_AEC62XX || BLK_DEV_GENERIC || BLK_DEV_HPT34X || BLK_DEV_HPT366 || BLK_DEV_PDC202XX_NEW || BLK_DEV_PDC202XX_OLD || BLK_DEV_TC86C001) |
386 | help | 396 | help |
387 | Normally, IDE controllers built into the motherboard (on-board | 397 | Normally, IDE controllers built into the motherboard (on-board |
388 | controllers) are assigned to ide0 and ide1 while those on add-in PCI | 398 | controllers) are assigned to ide0 and ide1 while those on add-in PCI |
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 410a0d13e35e..93f71fcfc04d 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -316,13 +316,13 @@ static int icside_dma_end(ide_drive_t *drive) | |||
316 | 316 | ||
317 | drive->waiting_for_dma = 0; | 317 | drive->waiting_for_dma = 0; |
318 | 318 | ||
319 | disable_dma(state->dev->dma); | 319 | disable_dma(ECARD_DEV(state->dev)->dma); |
320 | 320 | ||
321 | /* Teardown mappings after DMA has completed. */ | 321 | /* Teardown mappings after DMA has completed. */ |
322 | dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, | 322 | dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, |
323 | hwif->sg_dma_direction); | 323 | hwif->sg_dma_direction); |
324 | 324 | ||
325 | return get_dma_residue(state->dev->dma) != 0; | 325 | return get_dma_residue(ECARD_DEV(state->dev)->dma) != 0; |
326 | } | 326 | } |
327 | 327 | ||
328 | static void icside_dma_start(ide_drive_t *drive) | 328 | static void icside_dma_start(ide_drive_t *drive) |
@@ -331,8 +331,8 @@ static void icside_dma_start(ide_drive_t *drive) | |||
331 | struct icside_state *state = hwif->hwif_data; | 331 | struct icside_state *state = hwif->hwif_data; |
332 | 332 | ||
333 | /* We can not enable DMA on both channels simultaneously. */ | 333 | /* We can not enable DMA on both channels simultaneously. */ |
334 | BUG_ON(dma_channel_active(state->dev->dma)); | 334 | BUG_ON(dma_channel_active(ECARD_DEV(state->dev)->dma)); |
335 | enable_dma(state->dev->dma); | 335 | enable_dma(ECARD_DEV(state->dev)->dma); |
336 | } | 336 | } |
337 | 337 | ||
338 | static int icside_dma_setup(ide_drive_t *drive) | 338 | static int icside_dma_setup(ide_drive_t *drive) |
@@ -350,7 +350,7 @@ static int icside_dma_setup(ide_drive_t *drive) | |||
350 | /* | 350 | /* |
351 | * We can not enable DMA on both channels. | 351 | * We can not enable DMA on both channels. |
352 | */ | 352 | */ |
353 | BUG_ON(dma_channel_active(state->dev->dma)); | 353 | BUG_ON(dma_channel_active(ECARD_DEV(state->dev)->dma)); |
354 | 354 | ||
355 | icside_build_sglist(drive, rq); | 355 | icside_build_sglist(drive, rq); |
356 | 356 | ||
@@ -367,14 +367,14 @@ static int icside_dma_setup(ide_drive_t *drive) | |||
367 | /* | 367 | /* |
368 | * Select the correct timing for this drive. | 368 | * Select the correct timing for this drive. |
369 | */ | 369 | */ |
370 | set_dma_speed(state->dev->dma, drive->drive_data); | 370 | set_dma_speed(ECARD_DEV(state->dev)->dma, drive->drive_data); |
371 | 371 | ||
372 | /* | 372 | /* |
373 | * Tell the DMA engine about the SG table and | 373 | * Tell the DMA engine about the SG table and |
374 | * data direction. | 374 | * data direction. |
375 | */ | 375 | */ |
376 | set_dma_sg(state->dev->dma, hwif->sg_table, hwif->sg_nents); | 376 | set_dma_sg(ECARD_DEV(state->dev)->dma, hwif->sg_table, hwif->sg_nents); |
377 | set_dma_mode(state->dev->dma, dma_mode); | 377 | set_dma_mode(ECARD_DEV(state->dev)->dma, dma_mode); |
378 | 378 | ||
379 | drive->waiting_for_dma = 1; | 379 | drive->waiting_for_dma = 1; |
380 | 380 | ||
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index e196aefa2070..7f5bc2ee6c7e 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
@@ -748,8 +748,7 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
748 | hold = ATA_DMA2_HOLD; | 748 | hold = ATA_DMA2_HOLD; |
749 | break; | 749 | break; |
750 | default: | 750 | default: |
751 | BUG(); | 751 | return; |
752 | break; | ||
753 | } | 752 | } |
754 | 753 | ||
755 | if (speed >= XFER_UDMA_0) | 754 | if (speed >= XFER_UDMA_0) |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 428f7a8a00b6..e3add70b9cd8 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -340,7 +340,7 @@ static int config_drive_for_dma (ide_drive_t *drive) | |||
340 | 340 | ||
341 | if (drive->media != ide_disk) { | 341 | if (drive->media != ide_disk) { |
342 | if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA) | 342 | if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA) |
343 | return -1; | 343 | return 0; |
344 | } | 344 | } |
345 | 345 | ||
346 | /* | 346 | /* |
@@ -752,7 +752,8 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode) | |||
752 | mode = XFER_MW_DMA_1; | 752 | mode = XFER_MW_DMA_1; |
753 | } | 753 | } |
754 | 754 | ||
755 | printk(KERN_DEBUG "%s: selected mode 0x%x\n", drive->name, mode); | 755 | printk(KERN_DEBUG "%s: %s mode selected\n", drive->name, |
756 | mode ? ide_xfer_verbose(mode) : "no DMA"); | ||
756 | 757 | ||
757 | return min(mode, req_mode); | 758 | return min(mode, req_mode); |
758 | } | 759 | } |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index c89f0d3058e9..db22d1ff4e55 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -340,6 +340,8 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | |||
340 | if (args) { | 340 | if (args) { |
341 | args[0] = stat; | 341 | args[0] = stat; |
342 | args[1] = err; | 342 | args[1] = err; |
343 | /* be sure we're looking at the low order bits */ | ||
344 | hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG); | ||
343 | args[2] = hwif->INB(IDE_NSECTOR_REG); | 345 | args[2] = hwif->INB(IDE_NSECTOR_REG); |
344 | args[3] = hwif->INB(IDE_SECTOR_REG); | 346 | args[3] = hwif->INB(IDE_SECTOR_REG); |
345 | args[4] = hwif->INB(IDE_LCYL_REG); | 347 | args[4] = hwif->INB(IDE_LCYL_REG); |
@@ -654,7 +656,8 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive) | |||
654 | int retries = 10; | 656 | int retries = 10; |
655 | 657 | ||
656 | local_irq_enable_in_hardirq(); | 658 | local_irq_enable_in_hardirq(); |
657 | if ((stat & DRQ_STAT) && args && args[3]) { | 659 | if (rq->cmd_type == REQ_TYPE_ATA_CMD && |
660 | (stat & DRQ_STAT) && args && args[3]) { | ||
658 | u8 io_32bit = drive->io_32bit; | 661 | u8 io_32bit = drive->io_32bit; |
659 | drive->io_32bit = 0; | 662 | drive->io_32bit = 0; |
660 | hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS); | 663 | hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS); |
@@ -882,7 +885,6 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
882 | return do_rw_taskfile(drive, args); | 885 | return do_rw_taskfile(drive, args); |
883 | } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) { | 886 | } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) { |
884 | u8 *args = rq->buffer; | 887 | u8 *args = rq->buffer; |
885 | u8 sel; | ||
886 | 888 | ||
887 | if (!args) | 889 | if (!args) |
888 | goto done; | 890 | goto done; |
@@ -900,10 +902,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
900 | hwif->OUTB(args[3], IDE_SECTOR_REG); | 902 | hwif->OUTB(args[3], IDE_SECTOR_REG); |
901 | hwif->OUTB(args[4], IDE_LCYL_REG); | 903 | hwif->OUTB(args[4], IDE_LCYL_REG); |
902 | hwif->OUTB(args[5], IDE_HCYL_REG); | 904 | hwif->OUTB(args[5], IDE_HCYL_REG); |
903 | sel = (args[6] & ~0x10); | 905 | hwif->OUTB((args[6] & 0xEF)|drive->select.all, IDE_SELECT_REG); |
904 | if (drive->select.b.unit) | ||
905 | sel |= 0x10; | ||
906 | hwif->OUTB(sel, IDE_SELECT_REG); | ||
907 | ide_cmd(drive, args[0], args[2], &drive_cmd_intr); | 906 | ide_cmd(drive, args[0], args[2], &drive_cmd_intr); |
908 | return ide_started; | 907 | return ide_started; |
909 | } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) { | 908 | } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) { |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 95168833d069..e17a9ee120ea 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -403,8 +403,12 @@ void ide_fix_driveid (struct hd_driveid *id) | |||
403 | #endif | 403 | #endif |
404 | } | 404 | } |
405 | 405 | ||
406 | /* FIXME: exported for use by the USB storage (isd200.c) code only */ | 406 | /* |
407 | EXPORT_SYMBOL(ide_fix_driveid); | 407 | * ide_fixstring() cleans up and (optionally) byte-swaps a text string, |
408 | * removing leading/trailing blanks and compressing internal blanks. | ||
409 | * It is primarily used to tidy up the model name/number fields as | ||
410 | * returned by the WIN_[P]IDENTIFY commands. | ||
411 | */ | ||
408 | 412 | ||
409 | void ide_fixstring (u8 *s, const int bytecount, const int byteswap) | 413 | void ide_fixstring (u8 *s, const int bytecount, const int byteswap) |
410 | { | 414 | { |
@@ -582,9 +586,12 @@ EXPORT_SYMBOL_GPL(ide_in_drive_list); | |||
582 | /* | 586 | /* |
583 | * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid. | 587 | * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid. |
584 | * We list them here and depend on the device side cable detection for them. | 588 | * We list them here and depend on the device side cable detection for them. |
589 | * | ||
590 | * Some optical devices with the buggy firmwares have the same problem. | ||
585 | */ | 591 | */ |
586 | static const struct drive_list_entry ivb_list[] = { | 592 | static const struct drive_list_entry ivb_list[] = { |
587 | { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, | 593 | { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, |
594 | { "TSSTcorp CDDVDW SH-S202J" , "SB00" }, | ||
588 | { NULL , NULL } | 595 | { NULL , NULL } |
589 | }; | 596 | }; |
590 | 597 | ||
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index af86433baede..1609b8604f56 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -514,6 +514,7 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat) | |||
514 | if (drive->addressing == 1) { | 514 | if (drive->addressing == 1) { |
515 | __u64 sectors = 0; | 515 | __u64 sectors = 0; |
516 | u32 low = 0, high = 0; | 516 | u32 low = 0, high = 0; |
517 | hwif->OUTB(drive->ctl&~0x80, IDE_CONTROL_REG); | ||
517 | low = ide_read_24(drive); | 518 | low = ide_read_24(drive); |
518 | hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG); | 519 | hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG); |
519 | high = ide_read_24(drive); | 520 | high = ide_read_24(drive); |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 6a6f2e066b46..56fb0b843429 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -172,11 +172,12 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) | |||
172 | ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap); | 172 | ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap); |
173 | ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap); | 173 | ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap); |
174 | 174 | ||
175 | /* we depend on this a lot! */ | ||
176 | id->model[sizeof(id->model)-1] = '\0'; | ||
177 | |||
175 | if (strstr(id->model, "E X A B Y T E N E S T")) | 178 | if (strstr(id->model, "E X A B Y T E N E S T")) |
176 | goto err_misc; | 179 | goto err_misc; |
177 | 180 | ||
178 | /* we depend on this a lot! */ | ||
179 | id->model[sizeof(id->model)-1] = '\0'; | ||
180 | printk("%s: %s, ", drive->name, id->model); | 181 | printk("%s: %s, ", drive->name, id->model); |
181 | drive->present = 1; | 182 | drive->present = 1; |
182 | drive->dead = 0; | 183 | drive->dead = 0; |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index d066546f2831..2b60f1b0437e 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -471,6 +471,7 @@ static int ide_diag_taskfile(ide_drive_t *drive, ide_task_t *args, unsigned long | |||
471 | struct request rq; | 471 | struct request rq; |
472 | 472 | ||
473 | memset(&rq, 0, sizeof(rq)); | 473 | memset(&rq, 0, sizeof(rq)); |
474 | rq.ref_count = 1; | ||
474 | rq.cmd_type = REQ_TYPE_ATA_TASKFILE; | 475 | rq.cmd_type = REQ_TYPE_ATA_TASKFILE; |
475 | rq.buffer = buf; | 476 | rq.buffer = buf; |
476 | 477 | ||
@@ -511,6 +512,7 @@ int ide_raw_taskfile (ide_drive_t *drive, ide_task_t *args, u8 *buf) | |||
511 | 512 | ||
512 | EXPORT_SYMBOL(ide_raw_taskfile); | 513 | EXPORT_SYMBOL(ide_raw_taskfile); |
513 | 514 | ||
515 | #ifdef CONFIG_IDE_TASK_IOCTL | ||
514 | int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | 516 | int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) |
515 | { | 517 | { |
516 | ide_task_request_t *req_task; | 518 | ide_task_request_t *req_task; |
@@ -660,6 +662,7 @@ abort: | |||
660 | 662 | ||
661 | return err; | 663 | return err; |
662 | } | 664 | } |
665 | #endif | ||
663 | 666 | ||
664 | int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) | 667 | int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) |
665 | { | 668 | { |
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index ea0143ef5fe5..51fca441c294 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cmd64x.c Version 1.50 May 10, 2007 | 2 | * linux/drivers/ide/pci/cmd64x.c Version 1.51 Nov 8, 2007 |
3 | * | 3 | * |
4 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. | 4 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. |
5 | * Due to massive hardware bugs, UltraDMA is only supported | 5 | * Due to massive hardware bugs, UltraDMA is only supported |
@@ -339,7 +339,8 @@ static int cmd648_ide_dma_end (ide_drive_t *drive) | |||
339 | u8 mrdmode = inb(hwif->dma_master + 0x01); | 339 | u8 mrdmode = inb(hwif->dma_master + 0x01); |
340 | 340 | ||
341 | /* clear the interrupt bit */ | 341 | /* clear the interrupt bit */ |
342 | outb(mrdmode | irq_mask, hwif->dma_master + 0x01); | 342 | outb((mrdmode & ~(MRDMODE_INTR_CH0 | MRDMODE_INTR_CH1)) | irq_mask, |
343 | hwif->dma_master + 0x01); | ||
343 | 344 | ||
344 | return err; | 345 | return err; |
345 | } | 346 | } |
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index 599408952bd4..547690395eee 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c | |||
@@ -117,8 +117,7 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
117 | case XFER_MW_DMA_1: timings = 0x00012121; break; | 117 | case XFER_MW_DMA_1: timings = 0x00012121; break; |
118 | case XFER_MW_DMA_2: timings = 0x00002020; break; | 118 | case XFER_MW_DMA_2: timings = 0x00002020; break; |
119 | default: | 119 | default: |
120 | BUG(); | 120 | return; |
121 | break; | ||
122 | } | 121 | } |
123 | basereg = CS5530_BASEREG(drive->hwif); | 122 | basereg = CS5530_BASEREG(drive->hwif); |
124 | reg = inl(basereg + 4); /* get drive0 config register */ | 123 | reg = inl(basereg + 4); /* get drive0 config register */ |
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index 3ef4fc10fe2c..1cd4e9cb0521 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cy82c693.c Version 0.41 Aug 27, 2007 | 2 | * linux/drivers/ide/pci/cy82c693.c Version 0.42 Oct 23, 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer | 4 | * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer |
5 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator | 5 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator |
@@ -436,10 +436,10 @@ static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) | |||
436 | hwif->ide_dma_on = &cy82c693_ide_dma_on; | 436 | hwif->ide_dma_on = &cy82c693_ide_dma_on; |
437 | } | 437 | } |
438 | 438 | ||
439 | static __devinitdata ide_hwif_t *primary; | ||
440 | |||
441 | static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) | 439 | static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) |
442 | { | 440 | { |
441 | static ide_hwif_t *primary; | ||
442 | |||
443 | if (PCI_FUNC(hwif->pci_dev->devfn) == 1) | 443 | if (PCI_FUNC(hwif->pci_dev->devfn) == 1) |
444 | primary = hwif; | 444 | primary = hwif; |
445 | else { | 445 | else { |
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index f44d70852c3c..06885697ed7b 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c | |||
@@ -49,7 +49,7 @@ static int __init ide_generic_all_on(char *unused) | |||
49 | printk(KERN_INFO "IDE generic will claim all unknown PCI IDE storage controllers.\n"); | 49 | printk(KERN_INFO "IDE generic will claim all unknown PCI IDE storage controllers.\n"); |
50 | return 1; | 50 | return 1; |
51 | } | 51 | } |
52 | __setup("all-generic-ide", ide_generic_all_on); | 52 | const __setup("all-generic-ide", ide_generic_all_on); |
53 | #endif | 53 | #endif |
54 | module_param_named(all_generic_ide, ide_generic_all, bool, 0444); | 54 | module_param_named(all_generic_ide, ide_generic_all, bool, 0444); |
55 | MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); | 55 | MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); |
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 612b795241bf..5682895d36d9 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/hpt366.c Version 1.20 Oct 1, 2007 | 2 | * linux/drivers/ide/pci/hpt366.c Version 1.21 Oct 23, 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> |
5 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. | 5 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. |
@@ -433,7 +433,7 @@ static u32 *hpt37x_settings[NUM_ATA_CLOCKS] = { | |||
433 | sixty_six_base_hpt37x | 433 | sixty_six_base_hpt37x |
434 | }; | 434 | }; |
435 | 435 | ||
436 | static struct hpt_info hpt36x __devinitdata = { | 436 | static const struct hpt_info hpt36x __devinitdata = { |
437 | .chip_name = "HPT36x", | 437 | .chip_name = "HPT36x", |
438 | .chip_type = HPT36x, | 438 | .chip_type = HPT36x, |
439 | .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2, | 439 | .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2, |
@@ -441,7 +441,7 @@ static struct hpt_info hpt36x __devinitdata = { | |||
441 | .settings = hpt36x_settings | 441 | .settings = hpt36x_settings |
442 | }; | 442 | }; |
443 | 443 | ||
444 | static struct hpt_info hpt370 __devinitdata = { | 444 | static const struct hpt_info hpt370 __devinitdata = { |
445 | .chip_name = "HPT370", | 445 | .chip_name = "HPT370", |
446 | .chip_type = HPT370, | 446 | .chip_type = HPT370, |
447 | .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, | 447 | .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, |
@@ -449,7 +449,7 @@ static struct hpt_info hpt370 __devinitdata = { | |||
449 | .settings = hpt37x_settings | 449 | .settings = hpt37x_settings |
450 | }; | 450 | }; |
451 | 451 | ||
452 | static struct hpt_info hpt370a __devinitdata = { | 452 | static const struct hpt_info hpt370a __devinitdata = { |
453 | .chip_name = "HPT370A", | 453 | .chip_name = "HPT370A", |
454 | .chip_type = HPT370A, | 454 | .chip_type = HPT370A, |
455 | .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, | 455 | .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, |
@@ -457,7 +457,7 @@ static struct hpt_info hpt370a __devinitdata = { | |||
457 | .settings = hpt37x_settings | 457 | .settings = hpt37x_settings |
458 | }; | 458 | }; |
459 | 459 | ||
460 | static struct hpt_info hpt374 __devinitdata = { | 460 | static const struct hpt_info hpt374 __devinitdata = { |
461 | .chip_name = "HPT374", | 461 | .chip_name = "HPT374", |
462 | .chip_type = HPT374, | 462 | .chip_type = HPT374, |
463 | .udma_mask = ATA_UDMA5, | 463 | .udma_mask = ATA_UDMA5, |
@@ -465,7 +465,7 @@ static struct hpt_info hpt374 __devinitdata = { | |||
465 | .settings = hpt37x_settings | 465 | .settings = hpt37x_settings |
466 | }; | 466 | }; |
467 | 467 | ||
468 | static struct hpt_info hpt372 __devinitdata = { | 468 | static const struct hpt_info hpt372 __devinitdata = { |
469 | .chip_name = "HPT372", | 469 | .chip_name = "HPT372", |
470 | .chip_type = HPT372, | 470 | .chip_type = HPT372, |
471 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 471 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
@@ -473,7 +473,7 @@ static struct hpt_info hpt372 __devinitdata = { | |||
473 | .settings = hpt37x_settings | 473 | .settings = hpt37x_settings |
474 | }; | 474 | }; |
475 | 475 | ||
476 | static struct hpt_info hpt372a __devinitdata = { | 476 | static const struct hpt_info hpt372a __devinitdata = { |
477 | .chip_name = "HPT372A", | 477 | .chip_name = "HPT372A", |
478 | .chip_type = HPT372A, | 478 | .chip_type = HPT372A, |
479 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 479 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
@@ -481,7 +481,7 @@ static struct hpt_info hpt372a __devinitdata = { | |||
481 | .settings = hpt37x_settings | 481 | .settings = hpt37x_settings |
482 | }; | 482 | }; |
483 | 483 | ||
484 | static struct hpt_info hpt302 __devinitdata = { | 484 | static const struct hpt_info hpt302 __devinitdata = { |
485 | .chip_name = "HPT302", | 485 | .chip_name = "HPT302", |
486 | .chip_type = HPT302, | 486 | .chip_type = HPT302, |
487 | .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 487 | .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
@@ -489,7 +489,7 @@ static struct hpt_info hpt302 __devinitdata = { | |||
489 | .settings = hpt37x_settings | 489 | .settings = hpt37x_settings |
490 | }; | 490 | }; |
491 | 491 | ||
492 | static struct hpt_info hpt371 __devinitdata = { | 492 | static const struct hpt_info hpt371 __devinitdata = { |
493 | .chip_name = "HPT371", | 493 | .chip_name = "HPT371", |
494 | .chip_type = HPT371, | 494 | .chip_type = HPT371, |
495 | .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 495 | .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
@@ -497,7 +497,7 @@ static struct hpt_info hpt371 __devinitdata = { | |||
497 | .settings = hpt37x_settings | 497 | .settings = hpt37x_settings |
498 | }; | 498 | }; |
499 | 499 | ||
500 | static struct hpt_info hpt372n __devinitdata = { | 500 | static const struct hpt_info hpt372n __devinitdata = { |
501 | .chip_name = "HPT372N", | 501 | .chip_name = "HPT372N", |
502 | .chip_type = HPT372N, | 502 | .chip_type = HPT372N, |
503 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 503 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
@@ -505,7 +505,7 @@ static struct hpt_info hpt372n __devinitdata = { | |||
505 | .settings = hpt37x_settings | 505 | .settings = hpt37x_settings |
506 | }; | 506 | }; |
507 | 507 | ||
508 | static struct hpt_info hpt302n __devinitdata = { | 508 | static const struct hpt_info hpt302n __devinitdata = { |
509 | .chip_name = "HPT302N", | 509 | .chip_name = "HPT302N", |
510 | .chip_type = HPT302N, | 510 | .chip_type = HPT302N, |
511 | .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 511 | .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
@@ -513,7 +513,7 @@ static struct hpt_info hpt302n __devinitdata = { | |||
513 | .settings = hpt37x_settings | 513 | .settings = hpt37x_settings |
514 | }; | 514 | }; |
515 | 515 | ||
516 | static struct hpt_info hpt371n __devinitdata = { | 516 | static const struct hpt_info hpt371n __devinitdata = { |
517 | .chip_name = "HPT371N", | 517 | .chip_name = "HPT371N", |
518 | .chip_type = HPT371N, | 518 | .chip_type = HPT371N, |
519 | .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 519 | .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
@@ -1508,7 +1508,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = { | |||
1508 | */ | 1508 | */ |
1509 | static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 1509 | static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
1510 | { | 1510 | { |
1511 | struct hpt_info *info = NULL; | 1511 | const struct hpt_info *info = NULL; |
1512 | struct pci_dev *dev2 = NULL; | 1512 | struct pci_dev *dev2 = NULL; |
1513 | struct ide_port_info d; | 1513 | struct ide_port_info d; |
1514 | u8 idx = id->driver_data; | 1514 | u8 idx = id->driver_data; |
@@ -1522,7 +1522,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic | |||
1522 | if (rev < 3) | 1522 | if (rev < 3) |
1523 | info = &hpt36x; | 1523 | info = &hpt36x; |
1524 | else { | 1524 | else { |
1525 | static struct hpt_info *hpt37x_info[] = | 1525 | static const struct hpt_info *hpt37x_info[] = |
1526 | { &hpt370, &hpt370a, &hpt372, &hpt372n }; | 1526 | { &hpt370, &hpt370a, &hpt372, &hpt372n }; |
1527 | 1527 | ||
1528 | info = hpt37x_info[min_t(u8, rev, 6) - 3]; | 1528 | info = hpt37x_info[min_t(u8, rev, 6) - 3]; |
@@ -1552,7 +1552,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic | |||
1552 | d.name = info->chip_name; | 1552 | d.name = info->chip_name; |
1553 | d.udma_mask = info->udma_mask; | 1553 | d.udma_mask = info->udma_mask; |
1554 | 1554 | ||
1555 | pci_set_drvdata(dev, info); | 1555 | pci_set_drvdata(dev, (void *)info); |
1556 | 1556 | ||
1557 | if (info == &hpt36x || info == &hpt374) | 1557 | if (info == &hpt36x || info == &hpt374) |
1558 | dev2 = pci_get_slot(dev->bus, dev->devfn + 1); | 1558 | dev2 = pci_get_slot(dev->bus, dev->devfn + 1); |
@@ -1560,7 +1560,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic | |||
1560 | if (dev2) { | 1560 | if (dev2) { |
1561 | int ret; | 1561 | int ret; |
1562 | 1562 | ||
1563 | pci_set_drvdata(dev2, info); | 1563 | pci_set_drvdata(dev2, (void *)info); |
1564 | 1564 | ||
1565 | if (info == &hpt374) | 1565 | if (info == &hpt374) |
1566 | hpt374_init(dev, dev2); | 1566 | hpt374_init(dev, dev2); |
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 5c9975435319..99b7d763b6c7 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -653,8 +653,7 @@ static const struct ide_port_info it821x_chipsets[] __devinitdata = { | |||
653 | 653 | ||
654 | static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 654 | static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
655 | { | 655 | { |
656 | ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]); | 656 | return ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]); |
657 | return 0; | ||
658 | } | 657 | } |
659 | 658 | ||
660 | static const struct pci_device_id it821x_pci_tbl[] = { | 659 | static const struct pci_device_id it821x_pci_tbl[] = { |
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index bdf64d997708..0083eaf89c77 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c | |||
@@ -139,8 +139,7 @@ static const struct ide_port_info jmicron_chipset __devinitdata = { | |||
139 | 139 | ||
140 | static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 140 | static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
141 | { | 141 | { |
142 | ide_setup_pci_device(dev, &jmicron_chipset); | 142 | return ide_setup_pci_device(dev, &jmicron_chipset); |
143 | return 0; | ||
144 | } | 143 | } |
145 | 144 | ||
146 | /* All JMB PATA controllers have and will continue to have the same | 145 | /* All JMB PATA controllers have and will continue to have the same |
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 9329d4a810e5..63625a0be712 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
@@ -302,6 +302,7 @@ struct ich_laptop { | |||
302 | 302 | ||
303 | static const struct ich_laptop ich_laptop[] = { | 303 | static const struct ich_laptop ich_laptop[] = { |
304 | /* devid, subvendor, subdev */ | 304 | /* devid, subvendor, subdev */ |
305 | { 0x27DF, 0x1025, 0x0102 }, /* ICH7 on Acer 5602aWLMi */ | ||
305 | { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ | 306 | { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ |
306 | { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ | 307 | { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ |
307 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ | 308 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index d2c8b5524f28..707d5ff66b03 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -186,8 +186,7 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
186 | } | 186 | } |
187 | break; | 187 | break; |
188 | default: | 188 | default: |
189 | BUG(); | 189 | return; |
190 | break; | ||
191 | } | 190 | } |
192 | 191 | ||
193 | if (unit == 0) { /* are we configuring drive0? */ | 192 | if (unit == 0) { /* are we configuring drive0? */ |
@@ -324,17 +323,18 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state) | |||
324 | 323 | ||
325 | pci_disable_device(dev); | 324 | pci_disable_device(dev); |
326 | pci_set_power_state(dev, pci_choose_state(dev, state)); | 325 | pci_set_power_state(dev, pci_choose_state(dev, state)); |
327 | dev->current_state = state.event; | ||
328 | return 0; | 326 | return 0; |
329 | } | 327 | } |
330 | 328 | ||
331 | static int sc1200_resume (struct pci_dev *dev) | 329 | static int sc1200_resume (struct pci_dev *dev) |
332 | { | 330 | { |
333 | ide_hwif_t *hwif = NULL; | 331 | ide_hwif_t *hwif = NULL; |
332 | int i; | ||
333 | |||
334 | i = pci_enable_device(dev); | ||
335 | if (i) | ||
336 | return i; | ||
334 | 337 | ||
335 | pci_set_power_state(dev, PCI_D0); // bring chip back from sleep state | ||
336 | dev->current_state = PM_EVENT_ON; | ||
337 | pci_enable_device(dev); | ||
338 | // | 338 | // |
339 | // loop over all interfaces that are part of this pci device: | 339 | // loop over all interfaces that are part of this pci device: |
340 | // | 340 | // |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 6b7bb53acefd..f6e2ab3dd166 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -356,7 +356,6 @@ static void sis_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
356 | sis_program_timings(drive, speed); | 356 | sis_program_timings(drive, speed); |
357 | break; | 357 | break; |
358 | default: | 358 | default: |
359 | BUG(); | ||
360 | break; | 359 | break; |
361 | } | 360 | } |
362 | } | 361 | } |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 816b5311dad6..5afdfef7264c 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1138,6 +1138,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1138 | hwif->drives[0].autotune = IDE_TUNE_AUTO; | 1138 | hwif->drives[0].autotune = IDE_TUNE_AUTO; |
1139 | hwif->drives[1].autotune = IDE_TUNE_AUTO; | 1139 | hwif->drives[1].autotune = IDE_TUNE_AUTO; |
1140 | hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | | 1140 | hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | |
1141 | IDE_HFLAG_PIO_NO_DOWNGRADE | | ||
1141 | IDE_HFLAG_POST_SET_MODE; | 1142 | IDE_HFLAG_POST_SET_MODE; |
1142 | hwif->pio_mask = ATA_PIO4; | 1143 | hwif->pio_mask = ATA_PIO4; |
1143 | hwif->set_pio_mode = pmac_ide_set_pio_mode; | 1144 | hwif->set_pio_mode = pmac_ide_set_pio_mode; |
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 02d14bf85ab2..25fd09053220 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -7,11 +7,6 @@ | |||
7 | * May be copied or modified under the terms of the GNU General Public License | 7 | * May be copied or modified under the terms of the GNU General Public License |
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* | ||
11 | * This module provides support for automatic detection and | ||
12 | * configuration of all PCI IDE interfaces present in a system. | ||
13 | */ | ||
14 | |||
15 | #include <linux/module.h> | 10 | #include <linux/module.h> |
16 | #include <linux/types.h> | 11 | #include <linux/types.h> |
17 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c index f5f4983dfbf3..7c4eb39b7024 100644 --- a/drivers/ieee1394/dma.c +++ b/drivers/ieee1394/dma.c | |||
@@ -103,8 +103,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, | |||
103 | goto err; | 103 | goto err; |
104 | } | 104 | } |
105 | 105 | ||
106 | /* just to be safe - this will become unnecessary once sglist->address goes away */ | 106 | sg_init_table(dma->sglist, dma->n_pages); |
107 | memset(dma->sglist, 0, dma->n_pages * sizeof(*dma->sglist)); | ||
108 | 107 | ||
109 | /* fill scatter/gather list with pages */ | 108 | /* fill scatter/gather list with pages */ |
110 | for (i = 0; i < dma->n_pages; i++) { | 109 | for (i = 0; i < dma->n_pages; i++) { |
diff --git a/drivers/ieee1394/ieee1394_transactions.c b/drivers/ieee1394/ieee1394_transactions.c index c39c70a8aa9f..677989320951 100644 --- a/drivers/ieee1394/ieee1394_transactions.c +++ b/drivers/ieee1394/ieee1394_transactions.c | |||
@@ -235,7 +235,6 @@ int hpsb_packet_success(struct hpsb_packet *packet) | |||
235 | packet->node_id); | 235 | packet->node_id); |
236 | return -EAGAIN; | 236 | return -EAGAIN; |
237 | } | 237 | } |
238 | BUG(); | ||
239 | 238 | ||
240 | case ACK_BUSY_X: | 239 | case ACK_BUSY_X: |
241 | case ACK_BUSY_A: | 240 | case ACK_BUSY_A: |
@@ -282,7 +281,6 @@ int hpsb_packet_success(struct hpsb_packet *packet) | |||
282 | packet->ack_code, packet->node_id, packet->tcode); | 281 | packet->ack_code, packet->node_id, packet->tcode); |
283 | return -EAGAIN; | 282 | return -EAGAIN; |
284 | } | 283 | } |
285 | BUG(); | ||
286 | } | 284 | } |
287 | 285 | ||
288 | struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, | 286 | struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index d5dfe11aa5c6..b83d254bc86e 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -71,11 +71,11 @@ | |||
71 | #include <linux/types.h> | 71 | #include <linux/types.h> |
72 | #include <linux/wait.h> | 72 | #include <linux/wait.h> |
73 | #include <linux/workqueue.h> | 73 | #include <linux/workqueue.h> |
74 | #include <linux/scatterlist.h> | ||
74 | 75 | ||
75 | #include <asm/byteorder.h> | 76 | #include <asm/byteorder.h> |
76 | #include <asm/errno.h> | 77 | #include <asm/errno.h> |
77 | #include <asm/param.h> | 78 | #include <asm/param.h> |
78 | #include <asm/scatterlist.h> | ||
79 | #include <asm/system.h> | 79 | #include <asm/system.h> |
80 | #include <asm/types.h> | 80 | #include <asm/types.h> |
81 | 81 | ||
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c index d7f64525469b..e8d5f6b64998 100644 --- a/drivers/infiniband/core/fmr_pool.c +++ b/drivers/infiniband/core/fmr_pool.c | |||
@@ -291,10 +291,10 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd, | |||
291 | atomic_set(&pool->flush_ser, 0); | 291 | atomic_set(&pool->flush_ser, 0); |
292 | init_waitqueue_head(&pool->force_wait); | 292 | init_waitqueue_head(&pool->force_wait); |
293 | 293 | ||
294 | pool->thread = kthread_create(ib_fmr_cleanup_thread, | 294 | pool->thread = kthread_run(ib_fmr_cleanup_thread, |
295 | pool, | 295 | pool, |
296 | "ib_fmr(%s)", | 296 | "ib_fmr(%s)", |
297 | device->name); | 297 | device->name); |
298 | if (IS_ERR(pool->thread)) { | 298 | if (IS_ERR(pool->thread)) { |
299 | printk(KERN_WARNING PFX "couldn't start cleanup thread\n"); | 299 | printk(KERN_WARNING PFX "couldn't start cleanup thread\n"); |
300 | ret = PTR_ERR(pool->thread); | 300 | ret = PTR_ERR(pool->thread); |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index f0c777589374..b5436ca92e68 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -1000,6 +1000,7 @@ static int iwch_query_device(struct ib_device *ibdev, | |||
1000 | props->max_sge = dev->attr.max_sge_per_wr; | 1000 | props->max_sge = dev->attr.max_sge_per_wr; |
1001 | props->max_sge_rd = 1; | 1001 | props->max_sge_rd = 1; |
1002 | props->max_qp_rd_atom = dev->attr.max_rdma_reads_per_qp; | 1002 | props->max_qp_rd_atom = dev->attr.max_rdma_reads_per_qp; |
1003 | props->max_qp_init_rd_atom = dev->attr.max_rdma_reads_per_qp; | ||
1003 | props->max_cq = dev->attr.max_cqs; | 1004 | props->max_cq = dev->attr.max_cqs; |
1004 | props->max_cqe = dev->attr.max_cqes_per_cq; | 1005 | props->max_cqe = dev->attr.max_cqes_per_cq; |
1005 | props->max_mr = dev->attr.max_mem_regs; | 1006 | props->max_mr = dev->attr.max_mem_regs; |
diff --git a/drivers/infiniband/hw/ehca/ehca_av.c b/drivers/infiniband/hw/ehca/ehca_av.c index 97d108634c58..453eb995c1d4 100644 --- a/drivers/infiniband/hw/ehca/ehca_av.c +++ b/drivers/infiniband/hw/ehca/ehca_av.c | |||
@@ -50,6 +50,38 @@ | |||
50 | 50 | ||
51 | static struct kmem_cache *av_cache; | 51 | static struct kmem_cache *av_cache; |
52 | 52 | ||
53 | int ehca_calc_ipd(struct ehca_shca *shca, int port, | ||
54 | enum ib_rate path_rate, u32 *ipd) | ||
55 | { | ||
56 | int path = ib_rate_to_mult(path_rate); | ||
57 | int link, ret; | ||
58 | struct ib_port_attr pa; | ||
59 | |||
60 | if (path_rate == IB_RATE_PORT_CURRENT) { | ||
61 | *ipd = 0; | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | if (unlikely(path < 0)) { | ||
66 | ehca_err(&shca->ib_device, "Invalid static rate! path_rate=%x", | ||
67 | path_rate); | ||
68 | return -EINVAL; | ||
69 | } | ||
70 | |||
71 | ret = ehca_query_port(&shca->ib_device, port, &pa); | ||
72 | if (unlikely(ret < 0)) { | ||
73 | ehca_err(&shca->ib_device, "Failed to query port ret=%i", ret); | ||
74 | return ret; | ||
75 | } | ||
76 | |||
77 | link = ib_width_enum_to_int(pa.active_width) * pa.active_speed; | ||
78 | |||
79 | /* IPD = round((link / path) - 1) */ | ||
80 | *ipd = ((link + (path >> 1)) / path) - 1; | ||
81 | |||
82 | return 0; | ||
83 | } | ||
84 | |||
53 | struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) | 85 | struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) |
54 | { | 86 | { |
55 | int ret; | 87 | int ret; |
@@ -69,15 +101,13 @@ struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) | |||
69 | av->av.slid_path_bits = ah_attr->src_path_bits; | 101 | av->av.slid_path_bits = ah_attr->src_path_bits; |
70 | 102 | ||
71 | if (ehca_static_rate < 0) { | 103 | if (ehca_static_rate < 0) { |
72 | int ah_mult = ib_rate_to_mult(ah_attr->static_rate); | 104 | u32 ipd; |
73 | int ehca_mult = | 105 | if (ehca_calc_ipd(shca, ah_attr->port_num, |
74 | ib_rate_to_mult(shca->sport[ah_attr->port_num].rate ); | 106 | ah_attr->static_rate, &ipd)) { |
75 | 107 | ret = -EINVAL; | |
76 | if (ah_mult >= ehca_mult) | 108 | goto create_ah_exit1; |
77 | av->av.ipd = 0; | 109 | } |
78 | else | 110 | av->av.ipd = ipd; |
79 | av->av.ipd = (ah_mult > 0) ? | ||
80 | ((ehca_mult - 1) / ah_mult) : 0; | ||
81 | } else | 111 | } else |
82 | av->av.ipd = ehca_static_rate; | 112 | av->av.ipd = ehca_static_rate; |
83 | 113 | ||
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 2d660ae189e5..87f12d4312a7 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
@@ -95,7 +95,6 @@ struct ehca_sma_attr { | |||
95 | struct ehca_sport { | 95 | struct ehca_sport { |
96 | struct ib_cq *ibcq_aqp1; | 96 | struct ib_cq *ibcq_aqp1; |
97 | struct ib_qp *ibqp_aqp1; | 97 | struct ib_qp *ibqp_aqp1; |
98 | enum ib_rate rate; | ||
99 | enum ib_port_state port_state; | 98 | enum ib_port_state port_state; |
100 | struct ehca_sma_attr saved_attr; | 99 | struct ehca_sma_attr saved_attr; |
101 | }; | 100 | }; |
diff --git a/drivers/infiniband/hw/ehca/ehca_hca.c b/drivers/infiniband/hw/ehca/ehca_hca.c index 15806d140461..5bd7b591987e 100644 --- a/drivers/infiniband/hw/ehca/ehca_hca.c +++ b/drivers/infiniband/hw/ehca/ehca_hca.c | |||
@@ -151,7 +151,6 @@ int ehca_query_port(struct ib_device *ibdev, | |||
151 | } | 151 | } |
152 | 152 | ||
153 | memset(props, 0, sizeof(struct ib_port_attr)); | 153 | memset(props, 0, sizeof(struct ib_port_attr)); |
154 | props->state = rblock->state; | ||
155 | 154 | ||
156 | switch (rblock->max_mtu) { | 155 | switch (rblock->max_mtu) { |
157 | case 0x1: | 156 | case 0x1: |
@@ -188,11 +187,20 @@ int ehca_query_port(struct ib_device *ibdev, | |||
188 | props->subnet_timeout = rblock->subnet_timeout; | 187 | props->subnet_timeout = rblock->subnet_timeout; |
189 | props->init_type_reply = rblock->init_type_reply; | 188 | props->init_type_reply = rblock->init_type_reply; |
190 | 189 | ||
191 | props->active_width = IB_WIDTH_12X; | 190 | if (rblock->state && rblock->phys_width) { |
192 | props->active_speed = 0x1; | 191 | props->phys_state = rblock->phys_pstate; |
193 | 192 | props->state = rblock->phys_state; | |
194 | /* at the moment (logical) link state is always LINK_UP */ | 193 | props->active_width = rblock->phys_width; |
195 | props->phys_state = 0x5; | 194 | props->active_speed = rblock->phys_speed; |
195 | } else { | ||
196 | /* old firmware releases don't report physical | ||
197 | * port info, so use default values | ||
198 | */ | ||
199 | props->phys_state = 5; | ||
200 | props->state = rblock->state; | ||
201 | props->active_width = IB_WIDTH_12X; | ||
202 | props->active_speed = 0x1; | ||
203 | } | ||
196 | 204 | ||
197 | query_port1: | 205 | query_port1: |
198 | ehca_free_fw_ctrlblock(rblock); | 206 | ehca_free_fw_ctrlblock(rblock); |
diff --git a/drivers/infiniband/hw/ehca/ehca_iverbs.h b/drivers/infiniband/hw/ehca/ehca_iverbs.h index dce503bb7d6b..5485799cdc8d 100644 --- a/drivers/infiniband/hw/ehca/ehca_iverbs.h +++ b/drivers/infiniband/hw/ehca/ehca_iverbs.h | |||
@@ -189,6 +189,9 @@ int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma); | |||
189 | 189 | ||
190 | void ehca_poll_eqs(unsigned long data); | 190 | void ehca_poll_eqs(unsigned long data); |
191 | 191 | ||
192 | int ehca_calc_ipd(struct ehca_shca *shca, int port, | ||
193 | enum ib_rate path_rate, u32 *ipd); | ||
194 | |||
192 | #ifdef CONFIG_PPC_64K_PAGES | 195 | #ifdef CONFIG_PPC_64K_PAGES |
193 | void *ehca_alloc_fw_ctrlblock(gfp_t flags); | 196 | void *ehca_alloc_fw_ctrlblock(gfp_t flags); |
194 | void ehca_free_fw_ctrlblock(void *ptr); | 197 | void ehca_free_fw_ctrlblock(void *ptr); |
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index c6cd38c5321f..90d4334179bf 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
@@ -327,9 +327,6 @@ static int ehca_sense_attributes(struct ehca_shca *shca) | |||
327 | shca->hw_level = ehca_hw_level; | 327 | shca->hw_level = ehca_hw_level; |
328 | ehca_gen_dbg(" ... hardware level=%x", shca->hw_level); | 328 | ehca_gen_dbg(" ... hardware level=%x", shca->hw_level); |
329 | 329 | ||
330 | shca->sport[0].rate = IB_RATE_30_GBPS; | ||
331 | shca->sport[1].rate = IB_RATE_30_GBPS; | ||
332 | |||
333 | shca->hca_cap = rblock->hca_cap_indicators; | 330 | shca->hca_cap = rblock->hca_cap_indicators; |
334 | ehca_gen_dbg(" ... HCA capabilities:"); | 331 | ehca_gen_dbg(" ... HCA capabilities:"); |
335 | for (i = 0; i < ARRAY_SIZE(hca_cap_descr); i++) | 332 | for (i = 0; i < ARRAY_SIZE(hca_cap_descr); i++) |
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c index de182648b282..2e3e6547cb78 100644 --- a/drivers/infiniband/hw/ehca/ehca_qp.c +++ b/drivers/infiniband/hw/ehca/ehca_qp.c | |||
@@ -1196,10 +1196,6 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1196 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_QKEY, 1); | 1196 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_QKEY, 1); |
1197 | } | 1197 | } |
1198 | if (attr_mask & IB_QP_AV) { | 1198 | if (attr_mask & IB_QP_AV) { |
1199 | int ah_mult = ib_rate_to_mult(attr->ah_attr.static_rate); | ||
1200 | int ehca_mult = ib_rate_to_mult(shca->sport[my_qp-> | ||
1201 | init_attr.port_num].rate); | ||
1202 | |||
1203 | mqpcb->dlid = attr->ah_attr.dlid; | 1199 | mqpcb->dlid = attr->ah_attr.dlid; |
1204 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_DLID, 1); | 1200 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_DLID, 1); |
1205 | mqpcb->source_path_bits = attr->ah_attr.src_path_bits; | 1201 | mqpcb->source_path_bits = attr->ah_attr.src_path_bits; |
@@ -1207,11 +1203,12 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1207 | mqpcb->service_level = attr->ah_attr.sl; | 1203 | mqpcb->service_level = attr->ah_attr.sl; |
1208 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1); | 1204 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1); |
1209 | 1205 | ||
1210 | if (ah_mult < ehca_mult) | 1206 | if (ehca_calc_ipd(shca, my_qp->init_attr.port_num, |
1211 | mqpcb->max_static_rate = (ah_mult > 0) ? | 1207 | attr->ah_attr.static_rate, |
1212 | ((ehca_mult - 1) / ah_mult) : 0; | 1208 | &mqpcb->max_static_rate)) { |
1213 | else | 1209 | ret = -EINVAL; |
1214 | mqpcb->max_static_rate = 0; | 1210 | goto modify_qp_exit2; |
1211 | } | ||
1215 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_MAX_STATIC_RATE, 1); | 1212 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_MAX_STATIC_RATE, 1); |
1216 | 1213 | ||
1217 | /* | 1214 | /* |
@@ -1280,10 +1277,6 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1280 | (MQPCB_MASK_RDMA_ATOMIC_OUTST_DEST_QP, 1); | 1277 | (MQPCB_MASK_RDMA_ATOMIC_OUTST_DEST_QP, 1); |
1281 | } | 1278 | } |
1282 | if (attr_mask & IB_QP_ALT_PATH) { | 1279 | if (attr_mask & IB_QP_ALT_PATH) { |
1283 | int ah_mult = ib_rate_to_mult(attr->alt_ah_attr.static_rate); | ||
1284 | int ehca_mult = ib_rate_to_mult( | ||
1285 | shca->sport[my_qp->init_attr.port_num].rate); | ||
1286 | |||
1287 | if (attr->alt_port_num < 1 | 1280 | if (attr->alt_port_num < 1 |
1288 | || attr->alt_port_num > shca->num_ports) { | 1281 | || attr->alt_port_num > shca->num_ports) { |
1289 | ret = -EINVAL; | 1282 | ret = -EINVAL; |
@@ -1309,10 +1302,12 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1309 | 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; |
1310 | mqpcb->service_level_al = attr->alt_ah_attr.sl; | 1303 | mqpcb->service_level_al = attr->alt_ah_attr.sl; |
1311 | 1304 | ||
1312 | if (ah_mult > 0 && ah_mult < ehca_mult) | 1305 | if (ehca_calc_ipd(shca, my_qp->init_attr.port_num, |
1313 | mqpcb->max_static_rate_al = (ehca_mult - 1) / ah_mult; | 1306 | attr->alt_ah_attr.static_rate, |
1314 | else | 1307 | &mqpcb->max_static_rate_al)) { |
1315 | mqpcb->max_static_rate_al = 0; | 1308 | ret = -EINVAL; |
1309 | goto modify_qp_exit2; | ||
1310 | } | ||
1316 | 1311 | ||
1317 | /* OpenIB doesn't support alternate retry counts - copy them */ | 1312 | /* OpenIB doesn't support alternate retry counts - copy them */ |
1318 | mqpcb->retry_count_al = mqpcb->retry_count; | 1313 | mqpcb->retry_count_al = mqpcb->retry_count; |
diff --git a/drivers/infiniband/hw/ehca/hipz_hw.h b/drivers/infiniband/hw/ehca/hipz_hw.h index d9739e554515..485b8400359e 100644 --- a/drivers/infiniband/hw/ehca/hipz_hw.h +++ b/drivers/infiniband/hw/ehca/hipz_hw.h | |||
@@ -402,7 +402,11 @@ struct hipz_query_port { | |||
402 | u64 max_msg_sz; | 402 | u64 max_msg_sz; |
403 | u32 max_mtu; | 403 | u32 max_mtu; |
404 | u32 vl_cap; | 404 | u32 vl_cap; |
405 | u8 reserved2[1900]; | 405 | u32 phys_pstate; |
406 | u32 phys_state; | ||
407 | u32 phys_speed; | ||
408 | u32 phys_width; | ||
409 | u8 reserved2[1884]; | ||
406 | u64 guid_entries[255]; | 410 | u64 guid_entries[255]; |
407 | } __attribute__ ((packed)); | 411 | } __attribute__ ((packed)); |
408 | 412 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c b/drivers/infiniband/hw/ipath/ipath_cq.c index 645ed71fd797..08d8ae148cd0 100644 --- a/drivers/infiniband/hw/ipath/ipath_cq.c +++ b/drivers/infiniband/hw/ipath/ipath_cq.c | |||
@@ -404,7 +404,7 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) | |||
404 | 404 | ||
405 | ret = ib_copy_to_udata(udata, &offset, sizeof(offset)); | 405 | ret = ib_copy_to_udata(udata, &offset, sizeof(offset)); |
406 | if (ret) | 406 | if (ret) |
407 | goto bail; | 407 | goto bail_free; |
408 | } | 408 | } |
409 | 409 | ||
410 | spin_lock_irq(&cq->lock); | 410 | spin_lock_irq(&cq->lock); |
@@ -424,10 +424,8 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) | |||
424 | else | 424 | else |
425 | n = head - tail; | 425 | n = head - tail; |
426 | if (unlikely((u32)cqe < n)) { | 426 | if (unlikely((u32)cqe < n)) { |
427 | spin_unlock_irq(&cq->lock); | ||
428 | vfree(wc); | ||
429 | ret = -EOVERFLOW; | 427 | ret = -EOVERFLOW; |
430 | goto bail; | 428 | goto bail_unlock; |
431 | } | 429 | } |
432 | for (n = 0; tail != head; n++) { | 430 | for (n = 0; tail != head; n++) { |
433 | if (cq->ip) | 431 | if (cq->ip) |
@@ -459,7 +457,12 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) | |||
459 | } | 457 | } |
460 | 458 | ||
461 | ret = 0; | 459 | ret = 0; |
460 | goto bail; | ||
462 | 461 | ||
462 | bail_unlock: | ||
463 | spin_unlock_irq(&cq->lock); | ||
464 | bail_free: | ||
465 | vfree(wc); | ||
463 | bail: | 466 | bail: |
464 | return ret; | 467 | return ret; |
465 | } | 468 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_eeprom.c b/drivers/infiniband/hw/ipath/ipath_eeprom.c index bcfa3ccb555f..e7c25dbbcdc9 100644 --- a/drivers/infiniband/hw/ipath/ipath_eeprom.c +++ b/drivers/infiniband/hw/ipath/ipath_eeprom.c | |||
@@ -538,7 +538,15 @@ static u8 flash_csum(struct ipath_flash *ifp, int adjust) | |||
538 | u8 *ip = (u8 *) ifp; | 538 | u8 *ip = (u8 *) ifp; |
539 | u8 csum = 0, len; | 539 | u8 csum = 0, len; |
540 | 540 | ||
541 | for (len = 0; len < ifp->if_length; len++) | 541 | /* |
542 | * Limit length checksummed to max length of actual data. | ||
543 | * Checksum of erased eeprom will still be bad, but we avoid | ||
544 | * reading past the end of the buffer we were passed. | ||
545 | */ | ||
546 | len = ifp->if_length; | ||
547 | if (len > sizeof(struct ipath_flash)) | ||
548 | len = sizeof(struct ipath_flash); | ||
549 | while (len--) | ||
542 | csum += *ip++; | 550 | csum += *ip++; |
543 | csum -= ifp->if_csum; | 551 | csum -= ifp->if_csum; |
544 | csum = ~csum; | 552 | csum = ~csum; |
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c index 6a5dd5cd773d..c61f9da2964a 100644 --- a/drivers/infiniband/hw/ipath/ipath_intr.c +++ b/drivers/infiniband/hw/ipath/ipath_intr.c | |||
@@ -453,7 +453,7 @@ skip_ibchange: | |||
453 | } | 453 | } |
454 | 454 | ||
455 | static void handle_supp_msgs(struct ipath_devdata *dd, | 455 | static void handle_supp_msgs(struct ipath_devdata *dd, |
456 | unsigned supp_msgs, char msg[512]) | 456 | unsigned supp_msgs, char *msg, int msgsz) |
457 | { | 457 | { |
458 | /* | 458 | /* |
459 | * Print the message unless it's ibc status change only, which | 459 | * Print the message unless it's ibc status change only, which |
@@ -461,9 +461,9 @@ static void handle_supp_msgs(struct ipath_devdata *dd, | |||
461 | */ | 461 | */ |
462 | if (dd->ipath_lasterror & ~INFINIPATH_E_IBSTATUSCHANGED) { | 462 | if (dd->ipath_lasterror & ~INFINIPATH_E_IBSTATUSCHANGED) { |
463 | int iserr; | 463 | int iserr; |
464 | iserr = ipath_decode_err(msg, sizeof msg, | 464 | iserr = ipath_decode_err(msg, msgsz, |
465 | dd->ipath_lasterror & | 465 | dd->ipath_lasterror & |
466 | ~INFINIPATH_E_IBSTATUSCHANGED); | 466 | ~INFINIPATH_E_IBSTATUSCHANGED); |
467 | if (dd->ipath_lasterror & | 467 | if (dd->ipath_lasterror & |
468 | ~(INFINIPATH_E_RRCVEGRFULL | | 468 | ~(INFINIPATH_E_RRCVEGRFULL | |
469 | INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS)) | 469 | INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS)) |
@@ -492,8 +492,8 @@ static void handle_supp_msgs(struct ipath_devdata *dd, | |||
492 | } | 492 | } |
493 | 493 | ||
494 | static unsigned handle_frequent_errors(struct ipath_devdata *dd, | 494 | static unsigned handle_frequent_errors(struct ipath_devdata *dd, |
495 | ipath_err_t errs, char msg[512], | 495 | ipath_err_t errs, char *msg, |
496 | int *noprint) | 496 | int msgsz, int *noprint) |
497 | { | 497 | { |
498 | unsigned long nc; | 498 | unsigned long nc; |
499 | static unsigned long nextmsg_time; | 499 | static unsigned long nextmsg_time; |
@@ -512,7 +512,7 @@ static unsigned handle_frequent_errors(struct ipath_devdata *dd, | |||
512 | nextmsg_time = nc + HZ * 3; | 512 | nextmsg_time = nc + HZ * 3; |
513 | } | 513 | } |
514 | else if (supp_msgs) { | 514 | else if (supp_msgs) { |
515 | handle_supp_msgs(dd, supp_msgs, msg); | 515 | handle_supp_msgs(dd, supp_msgs, msg, msgsz); |
516 | supp_msgs = 0; | 516 | supp_msgs = 0; |
517 | nmsgs = 0; | 517 | nmsgs = 0; |
518 | } | 518 | } |
@@ -525,14 +525,14 @@ static unsigned handle_frequent_errors(struct ipath_devdata *dd, | |||
525 | 525 | ||
526 | static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs) | 526 | static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs) |
527 | { | 527 | { |
528 | char msg[512]; | 528 | char msg[128]; |
529 | u64 ignore_this_time = 0; | 529 | u64 ignore_this_time = 0; |
530 | int i, iserr = 0; | 530 | int i, iserr = 0; |
531 | int chkerrpkts = 0, noprint = 0; | 531 | int chkerrpkts = 0, noprint = 0; |
532 | unsigned supp_msgs; | 532 | unsigned supp_msgs; |
533 | int log_idx; | 533 | int log_idx; |
534 | 534 | ||
535 | supp_msgs = handle_frequent_errors(dd, errs, msg, &noprint); | 535 | supp_msgs = handle_frequent_errors(dd, errs, msg, sizeof msg, &noprint); |
536 | 536 | ||
537 | /* don't report errors that are masked */ | 537 | /* don't report errors that are masked */ |
538 | errs &= ~dd->ipath_maskederrs; | 538 | errs &= ~dd->ipath_maskederrs; |
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c index 5c29b2bfea17..120a61b03bc4 100644 --- a/drivers/infiniband/hw/ipath/ipath_rc.c +++ b/drivers/infiniband/hw/ipath/ipath_rc.c | |||
@@ -959,8 +959,9 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode, | |||
959 | /* If this is a partial ACK, reset the retransmit timer. */ | 959 | /* If this is a partial ACK, reset the retransmit timer. */ |
960 | if (qp->s_last != qp->s_tail) { | 960 | if (qp->s_last != qp->s_tail) { |
961 | spin_lock(&dev->pending_lock); | 961 | spin_lock(&dev->pending_lock); |
962 | list_add_tail(&qp->timerwait, | 962 | if (list_empty(&qp->timerwait)) |
963 | &dev->pending[dev->pending_index]); | 963 | list_add_tail(&qp->timerwait, |
964 | &dev->pending[dev->pending_index]); | ||
964 | spin_unlock(&dev->pending_lock); | 965 | spin_unlock(&dev->pending_lock); |
965 | /* | 966 | /* |
966 | * If we get a partial ACK for a resent operation, | 967 | * If we get a partial ACK for a resent operation, |
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c index 4b6b7ee8e5c1..54c61a972de2 100644 --- a/drivers/infiniband/hw/ipath/ipath_ruc.c +++ b/drivers/infiniband/hw/ipath/ipath_ruc.c | |||
@@ -630,11 +630,8 @@ bail:; | |||
630 | void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe, | 630 | void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe, |
631 | enum ib_wc_status status) | 631 | enum ib_wc_status status) |
632 | { | 632 | { |
633 | u32 last = qp->s_last; | 633 | unsigned long flags; |
634 | 634 | u32 last; | |
635 | if (++last == qp->s_size) | ||
636 | last = 0; | ||
637 | qp->s_last = last; | ||
638 | 635 | ||
639 | /* See ch. 11.2.4.1 and 10.7.3.1 */ | 636 | /* See ch. 11.2.4.1 and 10.7.3.1 */ |
640 | if (!(qp->s_flags & IPATH_S_SIGNAL_REQ_WR) || | 637 | if (!(qp->s_flags & IPATH_S_SIGNAL_REQ_WR) || |
@@ -658,4 +655,11 @@ void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe, | |||
658 | wc.port_num = 0; | 655 | wc.port_num = 0; |
659 | ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 0); | 656 | ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 0); |
660 | } | 657 | } |
658 | |||
659 | spin_lock_irqsave(&qp->s_lock, flags); | ||
660 | last = qp->s_last; | ||
661 | if (++last >= qp->s_size) | ||
662 | last = 0; | ||
663 | qp->s_last = last; | ||
664 | spin_unlock_irqrestore(&qp->s_lock, flags); | ||
661 | } | 665 | } |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 6b3322486b5e..8cba9c532e64 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -1282,7 +1282,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1282 | int size; | 1282 | int size; |
1283 | int i; | 1283 | int i; |
1284 | 1284 | ||
1285 | spin_lock_irqsave(&qp->rq.lock, flags); | 1285 | spin_lock_irqsave(&qp->sq.lock, flags); |
1286 | 1286 | ||
1287 | ind = qp->sq.head; | 1287 | ind = qp->sq.head; |
1288 | 1288 | ||
@@ -1448,7 +1448,7 @@ out: | |||
1448 | (qp->sq.wqe_cnt - 1)); | 1448 | (qp->sq.wqe_cnt - 1)); |
1449 | } | 1449 | } |
1450 | 1450 | ||
1451 | spin_unlock_irqrestore(&qp->rq.lock, flags); | 1451 | spin_unlock_irqrestore(&qp->sq.lock, flags); |
1452 | 1452 | ||
1453 | return err; | 1453 | return err; |
1454 | } | 1454 | } |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 87610772a979..059cf92b60a5 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -60,7 +60,7 @@ static struct ib_qp_attr ipoib_cm_err_attr = { | |||
60 | .qp_state = IB_QPS_ERR | 60 | .qp_state = IB_QPS_ERR |
61 | }; | 61 | }; |
62 | 62 | ||
63 | #define IPOIB_CM_RX_DRAIN_WRID 0x7fffffff | 63 | #define IPOIB_CM_RX_DRAIN_WRID 0xffffffff |
64 | 64 | ||
65 | static struct ib_send_wr ipoib_cm_rx_drain_wr = { | 65 | static struct ib_send_wr ipoib_cm_rx_drain_wr = { |
66 | .wr_id = IPOIB_CM_RX_DRAIN_WRID, | 66 | .wr_id = IPOIB_CM_RX_DRAIN_WRID, |
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c index 4941a9e61e90..43aaa5cebd12 100644 --- a/drivers/input/misc/pcspkr.c +++ b/drivers/input/misc/pcspkr.c | |||
@@ -24,7 +24,7 @@ MODULE_DESCRIPTION("PC Speaker beeper driver"); | |||
24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
25 | MODULE_ALIAS("platform:pcspkr"); | 25 | MODULE_ALIAS("platform:pcspkr"); |
26 | 26 | ||
27 | #ifdef CONFIG_X86 | 27 | #if defined(CONFIG_MIPS) || defined(CONFIG_X86) |
28 | /* Use the global PIT lock ! */ | 28 | /* Use the global PIT lock ! */ |
29 | #include <asm/i8253.h> | 29 | #include <asm/i8253.h> |
30 | #else | 30 | #else |
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/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c index 476012b6dfac..48c1775ef5b3 100644 --- a/drivers/isdn/capi/capidrv.c +++ b/drivers/isdn/capi/capidrv.c | |||
@@ -1843,6 +1843,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) | |||
1843 | int msglen; | 1843 | int msglen; |
1844 | u16 errcode; | 1844 | u16 errcode; |
1845 | u16 datahandle; | 1845 | u16 datahandle; |
1846 | u32 data; | ||
1846 | 1847 | ||
1847 | if (!card) { | 1848 | if (!card) { |
1848 | printk(KERN_ERR "capidrv: if_sendbuf called with invalid driverId %d!\n", | 1849 | printk(KERN_ERR "capidrv: if_sendbuf called with invalid driverId %d!\n", |
@@ -1860,9 +1861,26 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) | |||
1860 | return 0; | 1861 | return 0; |
1861 | } | 1862 | } |
1862 | datahandle = nccip->datahandle; | 1863 | datahandle = nccip->datahandle; |
1864 | |||
1865 | /* | ||
1866 | * Here we copy pointer skb->data into the 32-bit 'Data' field. | ||
1867 | * The 'Data' field is not used in practice in linux kernel | ||
1868 | * (neither in 32 or 64 bit), but should have some value, | ||
1869 | * since a CAPI message trace will display it. | ||
1870 | * | ||
1871 | * The correct value in the 32 bit case is the address of the | ||
1872 | * data, in 64 bit it makes no sense, we use 0 there. | ||
1873 | */ | ||
1874 | |||
1875 | #ifdef CONFIG_64BIT | ||
1876 | data = 0; | ||
1877 | #else | ||
1878 | data = (unsigned long) skb->data; | ||
1879 | #endif | ||
1880 | |||
1863 | capi_fill_DATA_B3_REQ(&sendcmsg, global.ap.applid, card->msgid++, | 1881 | capi_fill_DATA_B3_REQ(&sendcmsg, global.ap.applid, card->msgid++, |
1864 | nccip->ncci, /* adr */ | 1882 | nccip->ncci, /* adr */ |
1865 | (u32) skb->data, /* Data */ | 1883 | data, /* Data */ |
1866 | skb->len, /* DataLength */ | 1884 | skb->len, /* DataLength */ |
1867 | datahandle, /* DataHandle */ | 1885 | datahandle, /* DataHandle */ |
1868 | 0 /* Flags */ | 1886 | 0 /* Flags */ |
@@ -2123,7 +2141,10 @@ static int capidrv_delcontr(u16 contr) | |||
2123 | printk(KERN_ERR "capidrv: delcontr: no contr %u\n", contr); | 2141 | printk(KERN_ERR "capidrv: delcontr: no contr %u\n", contr); |
2124 | return -1; | 2142 | return -1; |
2125 | } | 2143 | } |
2126 | #warning FIXME: maybe a race condition the card should be removed here from global list /kkeil | 2144 | |
2145 | /* FIXME: maybe a race condition the card should be removed | ||
2146 | * here from global list /kkeil | ||
2147 | */ | ||
2127 | spin_unlock_irqrestore(&global_lock, flags); | 2148 | spin_unlock_irqrestore(&global_lock, flags); |
2128 | 2149 | ||
2129 | del_timer(&card->listentimer); | 2150 | del_timer(&card->listentimer); |
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig index a3b945ac3256..7832d8ba8e44 100644 --- a/drivers/isdn/hisax/Kconfig +++ b/drivers/isdn/hisax/Kconfig | |||
@@ -109,7 +109,7 @@ config HISAX_16_3 | |||
109 | 109 | ||
110 | config HISAX_TELESPCI | 110 | config HISAX_TELESPCI |
111 | bool "Teles PCI" | 111 | bool "Teles PCI" |
112 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) | 112 | depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) |
113 | help | 113 | help |
114 | This enables HiSax support for the Teles PCI. | 114 | This enables HiSax support for the Teles PCI. |
115 | See <file:Documentation/isdn/README.HiSax> on how to configure it. | 115 | See <file:Documentation/isdn/README.HiSax> on how to configure it. |
@@ -237,7 +237,7 @@ config HISAX_MIC | |||
237 | 237 | ||
238 | config HISAX_NETJET | 238 | config HISAX_NETJET |
239 | bool "NETjet card" | 239 | bool "NETjet card" |
240 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) | 240 | depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) |
241 | help | 241 | help |
242 | This enables HiSax support for the NetJet from Traverse | 242 | This enables HiSax support for the NetJet from Traverse |
243 | Technologies. | 243 | Technologies. |
@@ -248,7 +248,7 @@ config HISAX_NETJET | |||
248 | 248 | ||
249 | config HISAX_NETJET_U | 249 | config HISAX_NETJET_U |
250 | bool "NETspider U card" | 250 | bool "NETspider U card" |
251 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) | 251 | depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) |
252 | help | 252 | help |
253 | This enables HiSax support for the Netspider U interface ISDN card | 253 | This enables HiSax support for the Netspider U interface ISDN card |
254 | from Traverse Technologies. | 254 | from Traverse Technologies. |
@@ -287,7 +287,7 @@ config HISAX_HSTSAPHIR | |||
287 | 287 | ||
288 | config HISAX_BKM_A4T | 288 | config HISAX_BKM_A4T |
289 | bool "Telekom A4T card" | 289 | bool "Telekom A4T card" |
290 | depends on PCI | 290 | depends on PCI && PCI_LEGACY |
291 | help | 291 | help |
292 | This enables HiSax support for the Telekom A4T card. | 292 | This enables HiSax support for the Telekom A4T card. |
293 | 293 | ||
@@ -297,7 +297,7 @@ config HISAX_BKM_A4T | |||
297 | 297 | ||
298 | config HISAX_SCT_QUADRO | 298 | config HISAX_SCT_QUADRO |
299 | bool "Scitel Quadro card" | 299 | bool "Scitel Quadro card" |
300 | depends on PCI | 300 | depends on PCI && PCI_LEGACY |
301 | help | 301 | help |
302 | This enables HiSax support for the Scitel Quadro card. | 302 | This enables HiSax support for the Scitel Quadro card. |
303 | 303 | ||
@@ -316,7 +316,7 @@ config HISAX_GAZEL | |||
316 | 316 | ||
317 | config HISAX_HFC_PCI | 317 | config HISAX_HFC_PCI |
318 | bool "HFC PCI-Bus cards" | 318 | bool "HFC PCI-Bus cards" |
319 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) | 319 | depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) |
320 | help | 320 | help |
321 | This enables HiSax support for the HFC-S PCI 2BDS0 based cards. | 321 | This enables HiSax support for the HFC-S PCI 2BDS0 based cards. |
322 | 322 | ||
@@ -325,7 +325,7 @@ config HISAX_HFC_PCI | |||
325 | 325 | ||
326 | config HISAX_W6692 | 326 | config HISAX_W6692 |
327 | bool "Winbond W6692 based cards" | 327 | bool "Winbond W6692 based cards" |
328 | depends on PCI | 328 | depends on PCI && PCI_LEGACY |
329 | help | 329 | help |
330 | This enables HiSax support for Winbond W6692 based PCI ISDN cards. | 330 | This enables HiSax support for Winbond W6692 based PCI ISDN cards. |
331 | 331 | ||
@@ -341,7 +341,7 @@ config HISAX_HFC_SX | |||
341 | 341 | ||
342 | config HISAX_ENTERNOW_PCI | 342 | config HISAX_ENTERNOW_PCI |
343 | bool "Formula-n enter:now PCI card" | 343 | bool "Formula-n enter:now PCI card" |
344 | depends on HISAX_NETJET && PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) | 344 | depends on HISAX_NETJET && PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) |
345 | help | 345 | help |
346 | This enables HiSax support for the Formula-n enter:now PCI | 346 | This enables HiSax support for the Formula-n enter:now PCI |
347 | ISDN card. | 347 | ISDN card. |
@@ -411,7 +411,7 @@ config HISAX_HFC4S8S | |||
411 | 411 | ||
412 | config HISAX_FRITZ_PCIPNP | 412 | config HISAX_FRITZ_PCIPNP |
413 | tristate "AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)" | 413 | tristate "AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)" |
414 | depends on PCI && EXPERIMENTAL | 414 | depends on PCI && PCI_LEGACY && EXPERIMENTAL |
415 | help | 415 | help |
416 | This enables the driver for the AVM Fritz!Card PCI, | 416 | This enables the driver for the AVM Fritz!Card PCI, |
417 | Fritz!Card PCI v2 and Fritz!Card PnP. | 417 | Fritz!Card PCI v2 and Fritz!Card PnP. |
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c index f8b79783c8b3..035d158779df 100644 --- a/drivers/isdn/hisax/avm_pci.c +++ b/drivers/isdn/hisax/avm_pci.c | |||
@@ -830,7 +830,7 @@ static int __devinit avm_pnp_setup(struct IsdnCardState *cs) | |||
830 | 830 | ||
831 | #endif /* __ISAPNP__ */ | 831 | #endif /* __ISAPNP__ */ |
832 | 832 | ||
833 | #ifndef CONFIG_PCI | 833 | #ifndef CONFIG_PCI_LEGACY |
834 | 834 | ||
835 | static int __devinit avm_pci_setup(struct IsdnCardState *cs) | 835 | static int __devinit avm_pci_setup(struct IsdnCardState *cs) |
836 | { | 836 | { |
@@ -872,7 +872,7 @@ static int __devinit avm_pci_setup(struct IsdnCardState *cs) | |||
872 | return (1); | 872 | return (1); |
873 | } | 873 | } |
874 | 874 | ||
875 | #endif /* CONFIG_PCI */ | 875 | #endif /* CONFIG_PCI_LEGACY */ |
876 | 876 | ||
877 | int __devinit | 877 | int __devinit |
878 | setup_avm_pcipnp(struct IsdnCard *card) | 878 | setup_avm_pcipnp(struct IsdnCard *card) |
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c index 826745078746..2d670856d141 100644 --- a/drivers/isdn/hisax/diva.c +++ b/drivers/isdn/hisax/diva.c | |||
@@ -1148,7 +1148,7 @@ static int __devinit setup_diva_isapnp(struct IsdnCard *card) | |||
1148 | 1148 | ||
1149 | #endif /* ISAPNP */ | 1149 | #endif /* ISAPNP */ |
1150 | 1150 | ||
1151 | #ifdef CONFIG_PCI | 1151 | #ifdef CONFIG_PCI_LEGACY |
1152 | static struct pci_dev *dev_diva __devinitdata = NULL; | 1152 | static struct pci_dev *dev_diva __devinitdata = NULL; |
1153 | static struct pci_dev *dev_diva_u __devinitdata = NULL; | 1153 | static struct pci_dev *dev_diva_u __devinitdata = NULL; |
1154 | static struct pci_dev *dev_diva201 __devinitdata = NULL; | 1154 | static struct pci_dev *dev_diva201 __devinitdata = NULL; |
@@ -1229,14 +1229,14 @@ static int __devinit setup_diva_pci(struct IsdnCard *card) | |||
1229 | return (1); /* card found */ | 1229 | return (1); /* card found */ |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | #else /* if !CONFIG_PCI */ | 1232 | #else /* if !CONFIG_PCI_LEGACY */ |
1233 | 1233 | ||
1234 | static int __devinit setup_diva_pci(struct IsdnCard *card) | 1234 | static int __devinit setup_diva_pci(struct IsdnCard *card) |
1235 | { | 1235 | { |
1236 | return (-1); /* card not found; continue search */ | 1236 | return (-1); /* card not found; continue search */ |
1237 | } | 1237 | } |
1238 | 1238 | ||
1239 | #endif /* CONFIG_PCI */ | 1239 | #endif /* CONFIG_PCI_LEGACY */ |
1240 | 1240 | ||
1241 | int __devinit | 1241 | int __devinit |
1242 | setup_diva(struct IsdnCard *card) | 1242 | setup_diva(struct IsdnCard *card) |
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c index 948a9b290fd1..d272d8ce6537 100644 --- a/drivers/isdn/hisax/elsa.c +++ b/drivers/isdn/hisax/elsa.c | |||
@@ -883,7 +883,7 @@ setup_elsa_isa(struct IsdnCard *card) | |||
883 | val += 'A' - 3; | 883 | val += 'A' - 3; |
884 | if (val == 'B' || val == 'C') | 884 | if (val == 'B' || val == 'C') |
885 | val ^= 1; | 885 | val ^= 1; |
886 | if ((cs->subtyp == ELSA_PCFPRO) && (val = 'G')) | 886 | if ((cs->subtyp == ELSA_PCFPRO) && (val == 'G')) |
887 | val = 'C'; | 887 | val = 'C'; |
888 | printk(KERN_INFO | 888 | printk(KERN_INFO |
889 | "Elsa: %s found at %#lx Rev.:%c IRQ %d\n", | 889 | "Elsa: %s found at %#lx Rev.:%c IRQ %d\n", |
@@ -1025,7 +1025,7 @@ setup_elsa_pcmcia(struct IsdnCard *card) | |||
1025 | cs->irq); | 1025 | cs->irq); |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | #ifdef CONFIG_PCI | 1028 | #ifdef CONFIG_PCI_LEGACY |
1029 | static struct pci_dev *dev_qs1000 __devinitdata = NULL; | 1029 | static struct pci_dev *dev_qs1000 __devinitdata = NULL; |
1030 | static struct pci_dev *dev_qs3000 __devinitdata = NULL; | 1030 | static struct pci_dev *dev_qs3000 __devinitdata = NULL; |
1031 | 1031 | ||
@@ -1093,7 +1093,7 @@ setup_elsa_pci(struct IsdnCard *card) | |||
1093 | { | 1093 | { |
1094 | return (1); | 1094 | return (1); |
1095 | } | 1095 | } |
1096 | #endif /* CONFIG_PCI */ | 1096 | #endif /* CONFIG_PCI_LEGACY */ |
1097 | 1097 | ||
1098 | static int __devinit | 1098 | static int __devinit |
1099 | setup_elsa_common(struct IsdnCard *card) | 1099 | setup_elsa_common(struct IsdnCard *card) |
diff --git a/drivers/isdn/hisax/gazel.c b/drivers/isdn/hisax/gazel.c index 3efa719b6d29..f66620ad8e7c 100644 --- a/drivers/isdn/hisax/gazel.c +++ b/drivers/isdn/hisax/gazel.c | |||
@@ -532,6 +532,7 @@ setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs) | |||
532 | return (0); | 532 | return (0); |
533 | } | 533 | } |
534 | 534 | ||
535 | #ifdef CONFIG_PCI_LEGACY | ||
535 | static struct pci_dev *dev_tel __devinitdata = NULL; | 536 | static struct pci_dev *dev_tel __devinitdata = NULL; |
536 | 537 | ||
537 | static int __devinit | 538 | static int __devinit |
@@ -620,6 +621,7 @@ setup_gazelpci(struct IsdnCardState *cs) | |||
620 | 621 | ||
621 | return (0); | 622 | return (0); |
622 | } | 623 | } |
624 | #endif /* CONFIG_PCI_LEGACY */ | ||
623 | 625 | ||
624 | int __devinit | 626 | int __devinit |
625 | setup_gazel(struct IsdnCard *card) | 627 | setup_gazel(struct IsdnCard *card) |
@@ -639,7 +641,7 @@ setup_gazel(struct IsdnCard *card) | |||
639 | return (0); | 641 | return (0); |
640 | } else { | 642 | } else { |
641 | 643 | ||
642 | #ifdef CONFIG_PCI | 644 | #ifdef CONFIG_PCI_LEGACY |
643 | if (setup_gazelpci(cs)) | 645 | if (setup_gazelpci(cs)) |
644 | return (0); | 646 | return (0); |
645 | #else | 647 | #else |
diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c index e5918c6fe73d..bd9921128aa8 100644 --- a/drivers/isdn/hisax/niccy.c +++ b/drivers/isdn/hisax/niccy.c | |||
@@ -223,7 +223,6 @@ static int niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
223 | return 0; | 223 | return 0; |
224 | } | 224 | } |
225 | 225 | ||
226 | static struct pci_dev *niccy_dev __devinitdata = NULL; | ||
227 | #ifdef __ISAPNP__ | 226 | #ifdef __ISAPNP__ |
228 | static struct pnp_card *pnp_c __devinitdata = NULL; | 227 | static struct pnp_card *pnp_c __devinitdata = NULL; |
229 | #endif | 228 | #endif |
@@ -299,7 +298,9 @@ int __devinit setup_niccy(struct IsdnCard *card) | |||
299 | return 0; | 298 | return 0; |
300 | } | 299 | } |
301 | } else { | 300 | } else { |
302 | #ifdef CONFIG_PCI | 301 | #ifdef CONFIG_PCI_LEGACY |
302 | static struct pci_dev *niccy_dev __devinitdata; | ||
303 | |||
303 | u_int pci_ioaddr; | 304 | u_int pci_ioaddr; |
304 | cs->subtyp = 0; | 305 | cs->subtyp = 0; |
305 | if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM, | 306 | if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM, |
@@ -356,7 +357,7 @@ int __devinit setup_niccy(struct IsdnCard *card) | |||
356 | printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n"); | 357 | printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n"); |
357 | printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n"); | 358 | printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n"); |
358 | return 0; | 359 | return 0; |
359 | #endif /* CONFIG_PCI */ | 360 | #endif /* CONFIG_PCI_LEGACY */ |
360 | } | 361 | } |
361 | printk(KERN_INFO "HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n", | 362 | printk(KERN_INFO "HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n", |
362 | CardType[cs->typ], (cs->subtyp == 1) ? "PnP" : "PCI", | 363 | CardType[cs->typ], (cs->subtyp == 1) ? "PnP" : "PCI", |
diff --git a/drivers/isdn/hisax/sedlbauer.c b/drivers/isdn/hisax/sedlbauer.c index 03dfc32166a0..95425f3d2220 100644 --- a/drivers/isdn/hisax/sedlbauer.c +++ b/drivers/isdn/hisax/sedlbauer.c | |||
@@ -600,7 +600,7 @@ setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt) | |||
600 | } | 600 | } |
601 | #endif /* __ISAPNP__ */ | 601 | #endif /* __ISAPNP__ */ |
602 | 602 | ||
603 | #ifdef CONFIG_PCI | 603 | #ifdef CONFIG_PCI_LEGACY |
604 | static struct pci_dev *dev_sedl __devinitdata = NULL; | 604 | static struct pci_dev *dev_sedl __devinitdata = NULL; |
605 | 605 | ||
606 | static int __devinit | 606 | static int __devinit |
@@ -675,7 +675,7 @@ setup_sedlbauer_pci(struct IsdnCard *card) | |||
675 | return (1); | 675 | return (1); |
676 | } | 676 | } |
677 | 677 | ||
678 | #endif /* CONFIG_PCI */ | 678 | #endif /* CONFIG_PCI_LEGACY */ |
679 | 679 | ||
680 | int __devinit | 680 | int __devinit |
681 | setup_sedlbauer(struct IsdnCard *card) | 681 | setup_sedlbauer(struct IsdnCard *card) |
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/isdn/sc/card.h b/drivers/isdn/sc/card.h index 5992f63c383e..0120bcf88311 100644 --- a/drivers/isdn/sc/card.h +++ b/drivers/isdn/sc/card.h | |||
@@ -109,7 +109,7 @@ void memcpy_fromshmem(int card, void *dest, const void *src, size_t n); | |||
109 | int get_card_from_id(int driver); | 109 | int get_card_from_id(int driver); |
110 | int indicate_status(int card, int event, ulong Channel, char *Data); | 110 | int indicate_status(int card, int event, ulong Channel, char *Data); |
111 | irqreturn_t interrupt_handler(int interrupt, void *cardptr); | 111 | irqreturn_t interrupt_handler(int interrupt, void *cardptr); |
112 | int sndpkt(int devId, int channel, struct sk_buff *data); | 112 | int sndpkt(int devId, int channel, int ack, struct sk_buff *data); |
113 | void rcvpkt(int card, RspMessage *rcvmsg); | 113 | void rcvpkt(int card, RspMessage *rcvmsg); |
114 | int command(isdn_ctrl *cmd); | 114 | int command(isdn_ctrl *cmd); |
115 | int reset(int card); | 115 | int reset(int card); |
diff --git a/drivers/isdn/sc/packet.c b/drivers/isdn/sc/packet.c index 92016a2608e9..5ff6ae868440 100644 --- a/drivers/isdn/sc/packet.c +++ b/drivers/isdn/sc/packet.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include "message.h" | 20 | #include "message.h" |
21 | #include "card.h" | 21 | #include "card.h" |
22 | 22 | ||
23 | int sndpkt(int devId, int channel, struct sk_buff *data) | 23 | int sndpkt(int devId, int channel, int ack, struct sk_buff *data) |
24 | { | 24 | { |
25 | LLData ReqLnkWrite; | 25 | LLData ReqLnkWrite; |
26 | int status; | 26 | int status; |
diff --git a/drivers/isdn/sc/shmem.c b/drivers/isdn/sc/shmem.c index e0331e0094f1..712220cef139 100644 --- a/drivers/isdn/sc/shmem.c +++ b/drivers/isdn/sc/shmem.c | |||
@@ -50,7 +50,7 @@ void memcpy_toshmem(int card, void *dest, const void *src, size_t n) | |||
50 | 50 | ||
51 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, | 51 | outb(((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, |
52 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); | 52 | sc_adapter[card]->ioport[sc_adapter[card]->shmem_pgport]); |
53 | memcpy_toio(sc_adapter[card]->rambase + dest_rem, src, n); | 53 | memcpy_toio((void __iomem *)(sc_adapter[card]->rambase + dest_rem), src, n); |
54 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 54 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
55 | pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename, | 55 | pr_debug("%s: set page to %#x\n",sc_adapter[card]->devicename, |
56 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); | 56 | ((sc_adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); |
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 729f1cd93606..7a6eead63a6b 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -494,6 +494,7 @@ static void init_vmcb(struct vmcb *vmcb) | |||
494 | */ | 494 | */ |
495 | /* (1ULL << INTERCEPT_SELECTIVE_CR0) | */ | 495 | /* (1ULL << INTERCEPT_SELECTIVE_CR0) | */ |
496 | (1ULL << INTERCEPT_CPUID) | | 496 | (1ULL << INTERCEPT_CPUID) | |
497 | (1ULL << INTERCEPT_INVD) | | ||
497 | (1ULL << INTERCEPT_HLT) | | 498 | (1ULL << INTERCEPT_HLT) | |
498 | (1ULL << INTERCEPT_INVLPGA) | | 499 | (1ULL << INTERCEPT_INVLPGA) | |
499 | (1ULL << INTERCEPT_IOIO_PROT) | | 500 | (1ULL << INTERCEPT_IOIO_PROT) | |
@@ -507,6 +508,7 @@ static void init_vmcb(struct vmcb *vmcb) | |||
507 | (1ULL << INTERCEPT_STGI) | | 508 | (1ULL << INTERCEPT_STGI) | |
508 | (1ULL << INTERCEPT_CLGI) | | 509 | (1ULL << INTERCEPT_CLGI) | |
509 | (1ULL << INTERCEPT_SKINIT) | | 510 | (1ULL << INTERCEPT_SKINIT) | |
511 | (1ULL << INTERCEPT_WBINVD) | | ||
510 | (1ULL << INTERCEPT_MONITOR) | | 512 | (1ULL << INTERCEPT_MONITOR) | |
511 | (1ULL << INTERCEPT_MWAIT); | 513 | (1ULL << INTERCEPT_MWAIT); |
512 | 514 | ||
@@ -561,6 +563,12 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu) | |||
561 | struct vcpu_svm *svm = to_svm(vcpu); | 563 | struct vcpu_svm *svm = to_svm(vcpu); |
562 | 564 | ||
563 | init_vmcb(svm->vmcb); | 565 | init_vmcb(svm->vmcb); |
566 | |||
567 | if (vcpu->vcpu_id != 0) { | ||
568 | svm->vmcb->save.rip = 0; | ||
569 | svm->vmcb->save.cs.base = svm->vcpu.sipi_vector << 12; | ||
570 | svm->vmcb->save.cs.selector = svm->vcpu.sipi_vector << 8; | ||
571 | } | ||
564 | } | 572 | } |
565 | 573 | ||
566 | static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) | 574 | static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) |
@@ -1241,6 +1249,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm, | |||
1241 | [SVM_EXIT_VINTR] = interrupt_window_interception, | 1249 | [SVM_EXIT_VINTR] = interrupt_window_interception, |
1242 | /* [SVM_EXIT_CR0_SEL_WRITE] = emulate_on_interception, */ | 1250 | /* [SVM_EXIT_CR0_SEL_WRITE] = emulate_on_interception, */ |
1243 | [SVM_EXIT_CPUID] = cpuid_interception, | 1251 | [SVM_EXIT_CPUID] = cpuid_interception, |
1252 | [SVM_EXIT_INVD] = emulate_on_interception, | ||
1244 | [SVM_EXIT_HLT] = halt_interception, | 1253 | [SVM_EXIT_HLT] = halt_interception, |
1245 | [SVM_EXIT_INVLPG] = emulate_on_interception, | 1254 | [SVM_EXIT_INVLPG] = emulate_on_interception, |
1246 | [SVM_EXIT_INVLPGA] = invalid_op_interception, | 1255 | [SVM_EXIT_INVLPGA] = invalid_op_interception, |
@@ -1255,6 +1264,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm, | |||
1255 | [SVM_EXIT_STGI] = invalid_op_interception, | 1264 | [SVM_EXIT_STGI] = invalid_op_interception, |
1256 | [SVM_EXIT_CLGI] = invalid_op_interception, | 1265 | [SVM_EXIT_CLGI] = invalid_op_interception, |
1257 | [SVM_EXIT_SKINIT] = invalid_op_interception, | 1266 | [SVM_EXIT_SKINIT] = invalid_op_interception, |
1267 | [SVM_EXIT_WBINVD] = emulate_on_interception, | ||
1258 | [SVM_EXIT_MONITOR] = invalid_op_interception, | 1268 | [SVM_EXIT_MONITOR] = invalid_op_interception, |
1259 | [SVM_EXIT_MWAIT] = invalid_op_interception, | 1269 | [SVM_EXIT_MWAIT] = invalid_op_interception, |
1260 | }; | 1270 | }; |
@@ -1579,10 +1589,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1579 | #endif | 1589 | #endif |
1580 | : "cc", "memory" ); | 1590 | : "cc", "memory" ); |
1581 | 1591 | ||
1582 | local_irq_disable(); | ||
1583 | |||
1584 | stgi(); | ||
1585 | |||
1586 | if ((svm->vmcb->save.dr7 & 0xff)) | 1592 | if ((svm->vmcb->save.dr7 & 0xff)) |
1587 | load_db_regs(svm->host_db_regs); | 1593 | load_db_regs(svm->host_db_regs); |
1588 | 1594 | ||
@@ -1599,6 +1605,10 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1599 | 1605 | ||
1600 | reload_tss(vcpu); | 1606 | reload_tss(vcpu); |
1601 | 1607 | ||
1608 | local_irq_disable(); | ||
1609 | |||
1610 | stgi(); | ||
1611 | |||
1602 | svm->next_rip = 0; | 1612 | svm->next_rip = 0; |
1603 | } | 1613 | } |
1604 | 1614 | ||
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index a6ace302e0cd..33b181451557 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c | |||
@@ -167,7 +167,7 @@ static u8 opcode_table[256] = { | |||
167 | static u16 twobyte_table[256] = { | 167 | static u16 twobyte_table[256] = { |
168 | /* 0x00 - 0x0F */ | 168 | /* 0x00 - 0x0F */ |
169 | 0, SrcMem | ModRM | DstReg, 0, 0, 0, 0, ImplicitOps, 0, | 169 | 0, SrcMem | ModRM | DstReg, 0, 0, 0, 0, ImplicitOps, 0, |
170 | 0, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0, | 170 | ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0, |
171 | /* 0x10 - 0x1F */ | 171 | /* 0x10 - 0x1F */ |
172 | 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0, | 172 | 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0, |
173 | /* 0x20 - 0x2F */ | 173 | /* 0x20 - 0x2F */ |
@@ -980,17 +980,6 @@ done_prefixes: | |||
980 | goto cannot_emulate; | 980 | goto cannot_emulate; |
981 | dst.val = (s32) src.val; | 981 | dst.val = (s32) src.val; |
982 | break; | 982 | break; |
983 | case 0x6a: /* push imm8 */ | ||
984 | src.val = 0L; | ||
985 | src.val = insn_fetch(s8, 1, _eip); | ||
986 | push: | ||
987 | dst.type = OP_MEM; | ||
988 | dst.bytes = op_bytes; | ||
989 | dst.val = src.val; | ||
990 | register_address_increment(_regs[VCPU_REGS_RSP], -op_bytes); | ||
991 | dst.ptr = (void *) register_address(ctxt->ss_base, | ||
992 | _regs[VCPU_REGS_RSP]); | ||
993 | break; | ||
994 | case 0x80 ... 0x83: /* Grp1 */ | 983 | case 0x80 ... 0x83: /* Grp1 */ |
995 | switch (modrm_reg) { | 984 | switch (modrm_reg) { |
996 | case 0: | 985 | case 0: |
@@ -1243,6 +1232,17 @@ special_insn: | |||
1243 | register_address_increment(_regs[VCPU_REGS_RSP], op_bytes); | 1232 | register_address_increment(_regs[VCPU_REGS_RSP], op_bytes); |
1244 | no_wb = 1; /* Disable writeback. */ | 1233 | no_wb = 1; /* Disable writeback. */ |
1245 | break; | 1234 | break; |
1235 | case 0x6a: /* push imm8 */ | ||
1236 | src.val = 0L; | ||
1237 | src.val = insn_fetch(s8, 1, _eip); | ||
1238 | push: | ||
1239 | dst.type = OP_MEM; | ||
1240 | dst.bytes = op_bytes; | ||
1241 | dst.val = src.val; | ||
1242 | register_address_increment(_regs[VCPU_REGS_RSP], -op_bytes); | ||
1243 | dst.ptr = (void *) register_address(ctxt->ss_base, | ||
1244 | _regs[VCPU_REGS_RSP]); | ||
1245 | break; | ||
1246 | case 0x6c: /* insb */ | 1246 | case 0x6c: /* insb */ |
1247 | case 0x6d: /* insw/insd */ | 1247 | case 0x6d: /* insw/insd */ |
1248 | if (kvm_emulate_pio_string(ctxt->vcpu, NULL, | 1248 | if (kvm_emulate_pio_string(ctxt->vcpu, NULL, |
@@ -1532,6 +1532,8 @@ twobyte_special_insn: | |||
1532 | case 0x06: | 1532 | case 0x06: |
1533 | emulate_clts(ctxt->vcpu); | 1533 | emulate_clts(ctxt->vcpu); |
1534 | break; | 1534 | break; |
1535 | case 0x08: /* invd */ | ||
1536 | break; | ||
1535 | case 0x09: /* wbinvd */ | 1537 | case 0x09: /* wbinvd */ |
1536 | break; | 1538 | break; |
1537 | case 0x0d: /* GrpP (prefetch) */ | 1539 | case 0x0d: /* GrpP (prefetch) */ |
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 47d90db280ce..99bc50059d35 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c | |||
@@ -60,7 +60,7 @@ static void gpio_led_set(struct led_classdev *led_cdev, | |||
60 | gpio_set_value(led_dat->gpio, level); | 60 | gpio_set_value(led_dat->gpio, level); |
61 | } | 61 | } |
62 | 62 | ||
63 | static int __init gpio_led_probe(struct platform_device *pdev) | 63 | static int gpio_led_probe(struct platform_device *pdev) |
64 | { | 64 | { |
65 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; | 65 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; |
66 | struct gpio_led *cur_led; | 66 | struct gpio_led *cur_led; |
@@ -93,13 +93,13 @@ static int __init gpio_led_probe(struct platform_device *pdev) | |||
93 | 93 | ||
94 | gpio_direction_output(led_dat->gpio, led_dat->active_low); | 94 | gpio_direction_output(led_dat->gpio, led_dat->active_low); |
95 | 95 | ||
96 | INIT_WORK(&led_dat->work, gpio_led_work); | ||
97 | |||
96 | ret = led_classdev_register(&pdev->dev, &led_dat->cdev); | 98 | ret = led_classdev_register(&pdev->dev, &led_dat->cdev); |
97 | if (ret < 0) { | 99 | if (ret < 0) { |
98 | gpio_free(led_dat->gpio); | 100 | gpio_free(led_dat->gpio); |
99 | goto err; | 101 | goto err; |
100 | } | 102 | } |
101 | |||
102 | INIT_WORK(&led_dat->work, gpio_led_work); | ||
103 | } | 103 | } |
104 | 104 | ||
105 | platform_set_drvdata(pdev, leds_data); | 105 | platform_set_drvdata(pdev, leds_data); |
@@ -110,17 +110,17 @@ err: | |||
110 | if (i > 0) { | 110 | if (i > 0) { |
111 | for (i = i - 1; i >= 0; i--) { | 111 | for (i = i - 1; i >= 0; i--) { |
112 | led_classdev_unregister(&leds_data[i].cdev); | 112 | led_classdev_unregister(&leds_data[i].cdev); |
113 | cancel_work_sync(&leds_data[i].work); | ||
113 | gpio_free(leds_data[i].gpio); | 114 | gpio_free(leds_data[i].gpio); |
114 | } | 115 | } |
115 | } | 116 | } |
116 | 117 | ||
117 | flush_scheduled_work(); | ||
118 | kfree(leds_data); | 118 | kfree(leds_data); |
119 | 119 | ||
120 | return ret; | 120 | return ret; |
121 | } | 121 | } |
122 | 122 | ||
123 | static int __exit gpio_led_remove(struct platform_device *pdev) | 123 | static int __devexit gpio_led_remove(struct platform_device *pdev) |
124 | { | 124 | { |
125 | int i; | 125 | int i; |
126 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; | 126 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; |
@@ -130,9 +130,10 @@ static int __exit gpio_led_remove(struct platform_device *pdev) | |||
130 | 130 | ||
131 | for (i = 0; i < pdata->num_leds; i++) { | 131 | for (i = 0; i < pdata->num_leds; i++) { |
132 | led_classdev_unregister(&leds_data[i].cdev); | 132 | led_classdev_unregister(&leds_data[i].cdev); |
133 | cancel_work_sync(&leds_data[i].work); | ||
133 | gpio_free(leds_data[i].gpio); | 134 | gpio_free(leds_data[i].gpio); |
134 | } | 135 | } |
135 | 136 | ||
136 | kfree(leds_data); | 137 | kfree(leds_data); |
137 | 138 | ||
138 | return 0; | 139 | return 0; |
@@ -144,7 +145,7 @@ static int gpio_led_suspend(struct platform_device *pdev, pm_message_t state) | |||
144 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; | 145 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; |
145 | struct gpio_led_data *leds_data; | 146 | struct gpio_led_data *leds_data; |
146 | int i; | 147 | int i; |
147 | 148 | ||
148 | leds_data = platform_get_drvdata(pdev); | 149 | leds_data = platform_get_drvdata(pdev); |
149 | 150 | ||
150 | for (i = 0; i < pdata->num_leds; i++) | 151 | for (i = 0; i < pdata->num_leds; i++) |
@@ -172,7 +173,8 @@ static int gpio_led_resume(struct platform_device *pdev) | |||
172 | #endif | 173 | #endif |
173 | 174 | ||
174 | static struct platform_driver gpio_led_driver = { | 175 | static struct platform_driver gpio_led_driver = { |
175 | .remove = __exit_p(gpio_led_remove), | 176 | .probe = gpio_led_probe, |
177 | .remove = __devexit_p(gpio_led_remove), | ||
176 | .suspend = gpio_led_suspend, | 178 | .suspend = gpio_led_suspend, |
177 | .resume = gpio_led_resume, | 179 | .resume = gpio_led_resume, |
178 | .driver = { | 180 | .driver = { |
@@ -183,7 +185,7 @@ static struct platform_driver gpio_led_driver = { | |||
183 | 185 | ||
184 | static int __init gpio_led_init(void) | 186 | static int __init gpio_led_init(void) |
185 | { | 187 | { |
186 | return platform_driver_probe(&gpio_led_driver, gpio_led_probe); | 188 | return platform_driver_register(&gpio_led_driver); |
187 | } | 189 | } |
188 | 190 | ||
189 | static void __exit gpio_led_exit(void) | 191 | static void __exit gpio_led_exit(void) |
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 8904f72f97c6..e2eec38c83c2 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
@@ -200,7 +200,8 @@ static struct virtqueue *lg_find_vq(struct virtio_device *vdev, | |||
200 | 200 | ||
201 | /* Figure out how many pages the ring will take, and map that memory */ | 201 | /* Figure out how many pages the ring will take, and map that memory */ |
202 | lvq->pages = lguest_map((unsigned long)lvq->config.pfn << PAGE_SHIFT, | 202 | lvq->pages = lguest_map((unsigned long)lvq->config.pfn << PAGE_SHIFT, |
203 | DIV_ROUND_UP(vring_size(lvq->config.num), | 203 | DIV_ROUND_UP(vring_size(lvq->config.num, |
204 | PAGE_SIZE), | ||
204 | PAGE_SIZE)); | 205 | PAGE_SIZE)); |
205 | if (!lvq->pages) { | 206 | if (!lvq->pages) { |
206 | err = -ENOMEM; | 207 | err = -ENOMEM; |
@@ -246,6 +247,8 @@ static void lg_del_vq(struct virtqueue *vq) | |||
246 | { | 247 | { |
247 | struct lguest_vq_info *lvq = vq->priv; | 248 | struct lguest_vq_info *lvq = vq->priv; |
248 | 249 | ||
250 | /* Release the interrupt */ | ||
251 | free_irq(lvq->config.irq, vq); | ||
249 | /* Tell virtio_ring.c to free the virtqueue. */ | 252 | /* Tell virtio_ring.c to free the virtqueue. */ |
250 | vring_del_virtqueue(vq); | 253 | vring_del_virtqueue(vq); |
251 | /* Unmap the pages containing the ring. */ | 254 | /* Unmap the pages containing the ring. */ |
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c index 9d716fa42cad..3b92a61ba8d2 100644 --- a/drivers/lguest/lguest_user.c +++ b/drivers/lguest/lguest_user.c | |||
@@ -184,7 +184,7 @@ static int initialize(struct file *file, const unsigned long __user *input) | |||
184 | free_regs: | 184 | free_regs: |
185 | free_page(lg->regs_page); | 185 | free_page(lg->regs_page); |
186 | release_guest: | 186 | release_guest: |
187 | memset(lg, 0, sizeof(*lg)); | 187 | kfree(lg); |
188 | unlock: | 188 | unlock: |
189 | mutex_unlock(&lguest_lock); | 189 | mutex_unlock(&lguest_lock); |
190 | return err; | 190 | return err; |
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c index 516d943227e2..075b4d99e354 100644 --- a/drivers/macintosh/windfarm_core.c +++ b/drivers/macintosh/windfarm_core.c | |||
@@ -94,7 +94,9 @@ static int wf_thread_func(void *data) | |||
94 | DBG("wf: thread started\n"); | 94 | DBG("wf: thread started\n"); |
95 | 95 | ||
96 | set_freezable(); | 96 | set_freezable(); |
97 | while(!kthread_should_stop()) { | 97 | while (!kthread_should_stop()) { |
98 | try_to_freeze(); | ||
99 | |||
98 | if (time_after_eq(jiffies, next)) { | 100 | if (time_after_eq(jiffies, next)) { |
99 | wf_notify(WF_EVENT_TICK, NULL); | 101 | wf_notify(WF_EVENT_TICK, NULL); |
100 | if (wf_overtemp) { | 102 | if (wf_overtemp) { |
@@ -116,12 +118,6 @@ static int wf_thread_func(void *data) | |||
116 | delay = next - jiffies; | 118 | delay = next - jiffies; |
117 | if (delay <= HZ) | 119 | if (delay <= HZ) |
118 | schedule_timeout_interruptible(delay); | 120 | schedule_timeout_interruptible(delay); |
119 | |||
120 | /* there should be no non-suspend signal, but oh well */ | ||
121 | if (signal_pending(current) && !try_to_freeze()) { | ||
122 | printk(KERN_WARNING "windfarm: thread got sigl !\n"); | ||
123 | break; | ||
124 | } | ||
125 | } | 121 | } |
126 | 122 | ||
127 | DBG("wf: thread stopped\n"); | 123 | DBG("wf: thread stopped\n"); |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 7c426d07a555..1b1ef3130e6e 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1207,8 +1207,7 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect | |||
1207 | prepare_to_wait(&bitmap->overflow_wait, &__wait, | 1207 | prepare_to_wait(&bitmap->overflow_wait, &__wait, |
1208 | TASK_UNINTERRUPTIBLE); | 1208 | TASK_UNINTERRUPTIBLE); |
1209 | spin_unlock_irq(&bitmap->lock); | 1209 | spin_unlock_irq(&bitmap->lock); |
1210 | bitmap->mddev->queue | 1210 | blk_unplug(bitmap->mddev->queue); |
1211 | ->unplug_fn(bitmap->mddev->queue); | ||
1212 | schedule(); | 1211 | schedule(); |
1213 | finish_wait(&bitmap->overflow_wait, &__wait); | 1212 | finish_wait(&bitmap->overflow_wait, &__wait); |
1214 | continue; | 1213 | continue; |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 8939e6105088..e298d8d11f24 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -102,6 +102,8 @@ static void combine_restrictions_low(struct io_restrictions *lhs, | |||
102 | lhs->seg_boundary_mask = | 102 | lhs->seg_boundary_mask = |
103 | min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask); | 103 | min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask); |
104 | 104 | ||
105 | lhs->bounce_pfn = min_not_zero(lhs->bounce_pfn, rhs->bounce_pfn); | ||
106 | |||
105 | lhs->no_cluster |= rhs->no_cluster; | 107 | lhs->no_cluster |= rhs->no_cluster; |
106 | } | 108 | } |
107 | 109 | ||
@@ -566,6 +568,8 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev) | |||
566 | min_not_zero(rs->seg_boundary_mask, | 568 | min_not_zero(rs->seg_boundary_mask, |
567 | q->seg_boundary_mask); | 569 | q->seg_boundary_mask); |
568 | 570 | ||
571 | rs->bounce_pfn = min_not_zero(rs->bounce_pfn, q->bounce_pfn); | ||
572 | |||
569 | rs->no_cluster |= !test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); | 573 | rs->no_cluster |= !test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); |
570 | } | 574 | } |
571 | EXPORT_SYMBOL_GPL(dm_set_device_limits); | 575 | EXPORT_SYMBOL_GPL(dm_set_device_limits); |
@@ -707,6 +711,8 @@ static void check_for_valid_limits(struct io_restrictions *rs) | |||
707 | rs->max_segment_size = MAX_SEGMENT_SIZE; | 711 | rs->max_segment_size = MAX_SEGMENT_SIZE; |
708 | if (!rs->seg_boundary_mask) | 712 | if (!rs->seg_boundary_mask) |
709 | rs->seg_boundary_mask = -1; | 713 | rs->seg_boundary_mask = -1; |
714 | if (!rs->bounce_pfn) | ||
715 | rs->bounce_pfn = -1; | ||
710 | } | 716 | } |
711 | 717 | ||
712 | int dm_table_add_target(struct dm_table *t, const char *type, | 718 | int dm_table_add_target(struct dm_table *t, const char *type, |
@@ -891,6 +897,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q) | |||
891 | q->hardsect_size = t->limits.hardsect_size; | 897 | q->hardsect_size = t->limits.hardsect_size; |
892 | q->max_segment_size = t->limits.max_segment_size; | 898 | q->max_segment_size = t->limits.max_segment_size; |
893 | q->seg_boundary_mask = t->limits.seg_boundary_mask; | 899 | q->seg_boundary_mask = t->limits.seg_boundary_mask; |
900 | q->bounce_pfn = t->limits.bounce_pfn; | ||
894 | if (t->limits.no_cluster) | 901 | if (t->limits.no_cluster) |
895 | q->queue_flags &= ~(1 << QUEUE_FLAG_CLUSTER); | 902 | q->queue_flags &= ~(1 << QUEUE_FLAG_CLUSTER); |
896 | else | 903 | else |
@@ -993,8 +1000,7 @@ void dm_table_unplug_all(struct dm_table *t) | |||
993 | struct dm_dev *dd = list_entry(d, struct dm_dev, list); | 1000 | struct dm_dev *dd = list_entry(d, struct dm_dev, list); |
994 | struct request_queue *q = bdev_get_queue(dd->bdev); | 1001 | struct request_queue *q = bdev_get_queue(dd->bdev); |
995 | 1002 | ||
996 | if (q->unplug_fn) | 1003 | blk_unplug(q); |
997 | q->unplug_fn(q); | ||
998 | } | 1004 | } |
999 | } | 1005 | } |
1000 | 1006 | ||
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 56a11f6c127b..3dac1cfb8189 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -87,8 +87,7 @@ static void linear_unplug(struct request_queue *q) | |||
87 | 87 | ||
88 | for (i=0; i < mddev->raid_disks; i++) { | 88 | for (i=0; i < mddev->raid_disks; i++) { |
89 | struct request_queue *r_queue = bdev_get_queue(conf->disks[i].rdev->bdev); | 89 | struct request_queue *r_queue = bdev_get_queue(conf->disks[i].rdev->bdev); |
90 | if (r_queue->unplug_fn) | 90 | blk_unplug(r_queue); |
91 | r_queue->unplug_fn(r_queue); | ||
92 | } | 91 | } |
93 | } | 92 | } |
94 | 93 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 808cd9549456..cef9ebd5a046 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5445,7 +5445,7 @@ void md_do_sync(mddev_t *mddev) | |||
5445 | * about not overloading the IO subsystem. (things like an | 5445 | * about not overloading the IO subsystem. (things like an |
5446 | * e2fsck being done on the RAID array should execute fast) | 5446 | * e2fsck being done on the RAID array should execute fast) |
5447 | */ | 5447 | */ |
5448 | mddev->queue->unplug_fn(mddev->queue); | 5448 | blk_unplug(mddev->queue); |
5449 | cond_resched(); | 5449 | cond_resched(); |
5450 | 5450 | ||
5451 | currspeed = ((unsigned long)(io_sectors-mddev->resync_mark_cnt))/2 | 5451 | currspeed = ((unsigned long)(io_sectors-mddev->resync_mark_cnt))/2 |
@@ -5464,7 +5464,7 @@ void md_do_sync(mddev_t *mddev) | |||
5464 | * this also signals 'finished resyncing' to md_stop | 5464 | * this also signals 'finished resyncing' to md_stop |
5465 | */ | 5465 | */ |
5466 | out: | 5466 | out: |
5467 | mddev->queue->unplug_fn(mddev->queue); | 5467 | blk_unplug(mddev->queue); |
5468 | 5468 | ||
5469 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); | 5469 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); |
5470 | 5470 | ||
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index b35731cceac6..eb631ebed686 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -125,8 +125,7 @@ static void unplug_slaves(mddev_t *mddev) | |||
125 | atomic_inc(&rdev->nr_pending); | 125 | atomic_inc(&rdev->nr_pending); |
126 | rcu_read_unlock(); | 126 | rcu_read_unlock(); |
127 | 127 | ||
128 | if (r_queue->unplug_fn) | 128 | blk_unplug(r_queue); |
129 | r_queue->unplug_fn(r_queue); | ||
130 | 129 | ||
131 | rdev_dec_pending(rdev, mddev); | 130 | rdev_dec_pending(rdev, mddev); |
132 | rcu_read_lock(); | 131 | rcu_read_lock(); |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index c111105fc2dc..f8e591708d1f 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -35,8 +35,7 @@ static void raid0_unplug(struct request_queue *q) | |||
35 | for (i=0; i<mddev->raid_disks; i++) { | 35 | for (i=0; i<mddev->raid_disks; i++) { |
36 | struct request_queue *r_queue = bdev_get_queue(devlist[i]->bdev); | 36 | struct request_queue *r_queue = bdev_get_queue(devlist[i]->bdev); |
37 | 37 | ||
38 | if (r_queue->unplug_fn) | 38 | blk_unplug(r_queue); |
39 | r_queue->unplug_fn(r_queue); | ||
40 | } | 39 | } |
41 | } | 40 | } |
42 | 41 | ||
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 85478d6a9c1a..4a69c416e045 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -549,8 +549,7 @@ static void unplug_slaves(mddev_t *mddev) | |||
549 | atomic_inc(&rdev->nr_pending); | 549 | atomic_inc(&rdev->nr_pending); |
550 | rcu_read_unlock(); | 550 | rcu_read_unlock(); |
551 | 551 | ||
552 | if (r_queue->unplug_fn) | 552 | blk_unplug(r_queue); |
553 | r_queue->unplug_fn(r_queue); | ||
554 | 553 | ||
555 | rdev_dec_pending(rdev, mddev); | 554 | rdev_dec_pending(rdev, mddev); |
556 | rcu_read_lock(); | 555 | rcu_read_lock(); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index fc6607acb6e4..5cdcc9386200 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -593,8 +593,7 @@ static void unplug_slaves(mddev_t *mddev) | |||
593 | atomic_inc(&rdev->nr_pending); | 593 | atomic_inc(&rdev->nr_pending); |
594 | rcu_read_unlock(); | 594 | rcu_read_unlock(); |
595 | 595 | ||
596 | if (r_queue->unplug_fn) | 596 | blk_unplug(r_queue); |
597 | r_queue->unplug_fn(r_queue); | ||
598 | 597 | ||
599 | rdev_dec_pending(rdev, mddev); | 598 | rdev_dec_pending(rdev, mddev); |
600 | rcu_read_lock(); | 599 | rcu_read_lock(); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 80a67d789b72..a5aad8cad843 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -688,7 +688,8 @@ ops_run_prexor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
688 | } | 688 | } |
689 | 689 | ||
690 | static struct dma_async_tx_descriptor * | 690 | static struct dma_async_tx_descriptor * |
691 | ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | 691 | ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx, |
692 | unsigned long pending) | ||
692 | { | 693 | { |
693 | int disks = sh->disks; | 694 | int disks = sh->disks; |
694 | int pd_idx = sh->pd_idx, i; | 695 | int pd_idx = sh->pd_idx, i; |
@@ -696,7 +697,7 @@ ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
696 | /* check if prexor is active which means only process blocks | 697 | /* check if prexor is active which means only process blocks |
697 | * that are part of a read-modify-write (Wantprexor) | 698 | * that are part of a read-modify-write (Wantprexor) |
698 | */ | 699 | */ |
699 | int prexor = test_bit(STRIPE_OP_PREXOR, &sh->ops.pending); | 700 | int prexor = test_bit(STRIPE_OP_PREXOR, &pending); |
700 | 701 | ||
701 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 702 | pr_debug("%s: stripe %llu\n", __FUNCTION__, |
702 | (unsigned long long)sh->sector); | 703 | (unsigned long long)sh->sector); |
@@ -773,7 +774,8 @@ static void ops_complete_write(void *stripe_head_ref) | |||
773 | } | 774 | } |
774 | 775 | ||
775 | static void | 776 | static void |
776 | ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | 777 | ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx, |
778 | unsigned long pending) | ||
777 | { | 779 | { |
778 | /* kernel stack size limits the total number of disks */ | 780 | /* kernel stack size limits the total number of disks */ |
779 | int disks = sh->disks; | 781 | int disks = sh->disks; |
@@ -781,7 +783,7 @@ ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
781 | 783 | ||
782 | int count = 0, pd_idx = sh->pd_idx, i; | 784 | int count = 0, pd_idx = sh->pd_idx, i; |
783 | struct page *xor_dest; | 785 | struct page *xor_dest; |
784 | int prexor = test_bit(STRIPE_OP_PREXOR, &sh->ops.pending); | 786 | int prexor = test_bit(STRIPE_OP_PREXOR, &pending); |
785 | unsigned long flags; | 787 | unsigned long flags; |
786 | dma_async_tx_callback callback; | 788 | dma_async_tx_callback callback; |
787 | 789 | ||
@@ -808,7 +810,7 @@ ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
808 | } | 810 | } |
809 | 811 | ||
810 | /* check whether this postxor is part of a write */ | 812 | /* check whether this postxor is part of a write */ |
811 | callback = test_bit(STRIPE_OP_BIODRAIN, &sh->ops.pending) ? | 813 | callback = test_bit(STRIPE_OP_BIODRAIN, &pending) ? |
812 | ops_complete_write : ops_complete_postxor; | 814 | ops_complete_write : ops_complete_postxor; |
813 | 815 | ||
814 | /* 1/ if we prexor'd then the dest is reused as a source | 816 | /* 1/ if we prexor'd then the dest is reused as a source |
@@ -896,12 +898,12 @@ static void raid5_run_ops(struct stripe_head *sh, unsigned long pending) | |||
896 | tx = ops_run_prexor(sh, tx); | 898 | tx = ops_run_prexor(sh, tx); |
897 | 899 | ||
898 | if (test_bit(STRIPE_OP_BIODRAIN, &pending)) { | 900 | if (test_bit(STRIPE_OP_BIODRAIN, &pending)) { |
899 | tx = ops_run_biodrain(sh, tx); | 901 | tx = ops_run_biodrain(sh, tx, pending); |
900 | overlap_clear++; | 902 | overlap_clear++; |
901 | } | 903 | } |
902 | 904 | ||
903 | if (test_bit(STRIPE_OP_POSTXOR, &pending)) | 905 | if (test_bit(STRIPE_OP_POSTXOR, &pending)) |
904 | ops_run_postxor(sh, tx); | 906 | ops_run_postxor(sh, tx, pending); |
905 | 907 | ||
906 | if (test_bit(STRIPE_OP_CHECK, &pending)) | 908 | if (test_bit(STRIPE_OP_CHECK, &pending)) |
907 | ops_run_check(sh); | 909 | ops_run_check(sh); |
@@ -2624,6 +2626,13 @@ static void handle_stripe5(struct stripe_head *sh) | |||
2624 | s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state); | 2626 | s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state); |
2625 | /* Now to look around and see what can be done */ | 2627 | /* Now to look around and see what can be done */ |
2626 | 2628 | ||
2629 | /* clean-up completed biofill operations */ | ||
2630 | if (test_bit(STRIPE_OP_BIOFILL, &sh->ops.complete)) { | ||
2631 | clear_bit(STRIPE_OP_BIOFILL, &sh->ops.pending); | ||
2632 | clear_bit(STRIPE_OP_BIOFILL, &sh->ops.ack); | ||
2633 | clear_bit(STRIPE_OP_BIOFILL, &sh->ops.complete); | ||
2634 | } | ||
2635 | |||
2627 | rcu_read_lock(); | 2636 | rcu_read_lock(); |
2628 | for (i=disks; i--; ) { | 2637 | for (i=disks; i--; ) { |
2629 | mdk_rdev_t *rdev; | 2638 | mdk_rdev_t *rdev; |
@@ -2897,13 +2906,6 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page) | |||
2897 | s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state); | 2906 | s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state); |
2898 | /* Now to look around and see what can be done */ | 2907 | /* Now to look around and see what can be done */ |
2899 | 2908 | ||
2900 | /* clean-up completed biofill operations */ | ||
2901 | if (test_bit(STRIPE_OP_BIOFILL, &sh->ops.complete)) { | ||
2902 | clear_bit(STRIPE_OP_BIOFILL, &sh->ops.pending); | ||
2903 | clear_bit(STRIPE_OP_BIOFILL, &sh->ops.ack); | ||
2904 | clear_bit(STRIPE_OP_BIOFILL, &sh->ops.complete); | ||
2905 | } | ||
2906 | |||
2907 | rcu_read_lock(); | 2909 | rcu_read_lock(); |
2908 | for (i=disks; i--; ) { | 2910 | for (i=disks; i--; ) { |
2909 | mdk_rdev_t *rdev; | 2911 | mdk_rdev_t *rdev; |
@@ -3186,8 +3188,7 @@ static void unplug_slaves(mddev_t *mddev) | |||
3186 | atomic_inc(&rdev->nr_pending); | 3188 | atomic_inc(&rdev->nr_pending); |
3187 | rcu_read_unlock(); | 3189 | rcu_read_unlock(); |
3188 | 3190 | ||
3189 | if (r_queue->unplug_fn) | 3191 | blk_unplug(r_queue); |
3190 | r_queue->unplug_fn(r_queue); | ||
3191 | 3192 | ||
3192 | rdev_dec_pending(rdev, mddev); | 3193 | rdev_dec_pending(rdev, mddev); |
3193 | rcu_read_lock(); | 3194 | rcu_read_lock(); |
diff --git a/drivers/md/raid6algos.c b/drivers/md/raid6algos.c index 926576156578..77a6e4bf503d 100644 --- a/drivers/md/raid6algos.c +++ b/drivers/md/raid6algos.c | |||
@@ -52,7 +52,7 @@ const struct raid6_calls * const raid6_algos[] = { | |||
52 | &raid6_intx16, | 52 | &raid6_intx16, |
53 | &raid6_intx32, | 53 | &raid6_intx32, |
54 | #endif | 54 | #endif |
55 | #if defined(__i386__) | 55 | #if defined(__i386__) && !defined(__arch_um__) |
56 | &raid6_mmxx1, | 56 | &raid6_mmxx1, |
57 | &raid6_mmxx2, | 57 | &raid6_mmxx2, |
58 | &raid6_sse1x1, | 58 | &raid6_sse1x1, |
@@ -60,7 +60,7 @@ const struct raid6_calls * const raid6_algos[] = { | |||
60 | &raid6_sse2x1, | 60 | &raid6_sse2x1, |
61 | &raid6_sse2x2, | 61 | &raid6_sse2x2, |
62 | #endif | 62 | #endif |
63 | #if defined(__x86_64__) | 63 | #if defined(__x86_64__) && !defined(__arch_um__) |
64 | &raid6_sse2x1, | 64 | &raid6_sse2x1, |
65 | &raid6_sse2x2, | 65 | &raid6_sse2x2, |
66 | &raid6_sse2x4, | 66 | &raid6_sse2x4, |
diff --git a/drivers/md/raid6mmx.c b/drivers/md/raid6mmx.c index 6181a5a3365a..d4e4a1bd70ad 100644 --- a/drivers/md/raid6mmx.c +++ b/drivers/md/raid6mmx.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * MMX implementation of RAID-6 syndrome functions | 16 | * MMX implementation of RAID-6 syndrome functions |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #if defined(__i386__) | 19 | #if defined(__i386__) && !defined(__arch_um__) |
20 | 20 | ||
21 | #include "raid6.h" | 21 | #include "raid6.h" |
22 | #include "raid6x86.h" | 22 | #include "raid6x86.h" |
diff --git a/drivers/md/raid6sse1.c b/drivers/md/raid6sse1.c index f0a1ba8f40ba..0666237276ff 100644 --- a/drivers/md/raid6sse1.c +++ b/drivers/md/raid6sse1.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * worthwhile as a separate implementation. | 21 | * worthwhile as a separate implementation. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #if defined(__i386__) | 24 | #if defined(__i386__) && !defined(__arch_um__) |
25 | 25 | ||
26 | #include "raid6.h" | 26 | #include "raid6.h" |
27 | #include "raid6x86.h" | 27 | #include "raid6x86.h" |
diff --git a/drivers/md/raid6sse2.c b/drivers/md/raid6sse2.c index 0f019762a7c3..b034ad868039 100644 --- a/drivers/md/raid6sse2.c +++ b/drivers/md/raid6sse2.c | |||
@@ -17,7 +17,7 @@ | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #if defined(__i386__) || defined(__x86_64__) | 20 | #if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__) |
21 | 21 | ||
22 | #include "raid6.h" | 22 | #include "raid6.h" |
23 | #include "raid6x86.h" | 23 | #include "raid6x86.h" |
@@ -161,7 +161,7 @@ const struct raid6_calls raid6_sse2x2 = { | |||
161 | 161 | ||
162 | #endif | 162 | #endif |
163 | 163 | ||
164 | #ifdef __x86_64__ | 164 | #if defined(__x86_64__) && !defined(__arch_um__) |
165 | 165 | ||
166 | /* | 166 | /* |
167 | * Unrolled-by-4 SSE2 implementation | 167 | * Unrolled-by-4 SSE2 implementation |
diff --git a/drivers/md/raid6x86.h b/drivers/md/raid6x86.h index 9111950414ff..99fea7a70ca7 100644 --- a/drivers/md/raid6x86.h +++ b/drivers/md/raid6x86.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #ifndef LINUX_RAID_RAID6X86_H | 19 | #ifndef LINUX_RAID_RAID6X86_H |
20 | #define LINUX_RAID_RAID6X86_H | 20 | #define LINUX_RAID_RAID6X86_H |
21 | 21 | ||
22 | #if defined(__i386__) || defined(__x86_64__) | 22 | #if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__) |
23 | 23 | ||
24 | #ifdef __KERNEL__ /* Real code */ | 24 | #ifdef __KERNEL__ /* Real code */ |
25 | 25 | ||
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index dd9bd4310c84..1604f0490404 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -151,6 +151,7 @@ config VIDEO_IR_I2C | |||
151 | 151 | ||
152 | config VIDEO_IR | 152 | config VIDEO_IR |
153 | tristate | 153 | tristate |
154 | depends on INPUT | ||
154 | select VIDEO_IR_I2C if I2C | 155 | select VIDEO_IR_I2C if I2C |
155 | 156 | ||
156 | config VIDEO_TVEEPROM | 157 | config VIDEO_TVEEPROM |
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index cb034ead95ab..7d04a6fd1acb 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -59,43 +59,89 @@ void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data) | |||
59 | } | 59 | } |
60 | 60 | ||
61 | /* This DEBI code is based on the saa7146 Stradis driver by Nathan Laredo */ | 61 | /* This DEBI code is based on the saa7146 Stradis driver by Nathan Laredo */ |
62 | int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop) | 62 | static inline int saa7146_wait_for_debi_done_sleep(struct saa7146_dev *dev, |
63 | unsigned long us1, unsigned long us2) | ||
63 | { | 64 | { |
64 | unsigned long start; | 65 | unsigned long timeout; |
65 | int err; | 66 | int err; |
66 | 67 | ||
67 | /* wait for registers to be programmed */ | 68 | /* wait for registers to be programmed */ |
68 | start = jiffies; | 69 | timeout = jiffies + usecs_to_jiffies(us1); |
69 | while (1) { | 70 | while (1) { |
70 | err = time_after(jiffies, start + HZ/20); | 71 | err = time_after(jiffies, timeout); |
71 | if (saa7146_read(dev, MC2) & 2) | 72 | if (saa7146_read(dev, MC2) & 2) |
72 | break; | 73 | break; |
73 | if (err) { | 74 | if (err) { |
74 | DEB_S(("timed out while waiting for registers getting programmed\n")); | 75 | printk(KERN_ERR "%s: %s timed out while waiting for " |
76 | "registers getting programmed\n", | ||
77 | dev->name, __FUNCTION__); | ||
75 | return -ETIMEDOUT; | 78 | return -ETIMEDOUT; |
76 | } | 79 | } |
77 | if (nobusyloop) | 80 | msleep(1); |
78 | msleep(1); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | /* wait for transfer to complete */ | 83 | /* wait for transfer to complete */ |
82 | start = jiffies; | 84 | timeout = jiffies + usecs_to_jiffies(us2); |
83 | while (1) { | 85 | while (1) { |
84 | err = time_after(jiffies, start + HZ/4); | 86 | err = time_after(jiffies, timeout); |
85 | if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S)) | 87 | if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S)) |
86 | break; | 88 | break; |
87 | saa7146_read(dev, MC2); | 89 | saa7146_read(dev, MC2); |
88 | if (err) { | 90 | if (err) { |
89 | DEB_S(("timed out while waiting for transfer completion\n")); | 91 | DEB_S(("%s: %s timed out while waiting for transfer " |
92 | "completion\n", dev->name, __FUNCTION__)); | ||
90 | return -ETIMEDOUT; | 93 | return -ETIMEDOUT; |
91 | } | 94 | } |
92 | if (nobusyloop) | 95 | msleep(1); |
93 | msleep(1); | ||
94 | } | 96 | } |
95 | 97 | ||
96 | return 0; | 98 | return 0; |
97 | } | 99 | } |
98 | 100 | ||
101 | static inline int saa7146_wait_for_debi_done_busyloop(struct saa7146_dev *dev, | ||
102 | unsigned long us1, unsigned long us2) | ||
103 | { | ||
104 | unsigned long loops; | ||
105 | |||
106 | /* wait for registers to be programmed */ | ||
107 | loops = us1; | ||
108 | while (1) { | ||
109 | if (saa7146_read(dev, MC2) & 2) | ||
110 | break; | ||
111 | if (!loops--) { | ||
112 | printk(KERN_ERR "%s: %s timed out while waiting for " | ||
113 | "registers getting programmed\n", | ||
114 | dev->name, __FUNCTION__); | ||
115 | return -ETIMEDOUT; | ||
116 | } | ||
117 | udelay(1); | ||
118 | } | ||
119 | |||
120 | /* wait for transfer to complete */ | ||
121 | loops = us2 / 5; | ||
122 | while (1) { | ||
123 | if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S)) | ||
124 | break; | ||
125 | saa7146_read(dev, MC2); | ||
126 | if (!loops--) { | ||
127 | DEB_S(("%s: %s timed out while waiting for transfer " | ||
128 | "completion\n", dev->name, __FUNCTION__)); | ||
129 | return -ETIMEDOUT; | ||
130 | } | ||
131 | udelay(5); | ||
132 | } | ||
133 | |||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop) | ||
138 | { | ||
139 | if (nobusyloop) | ||
140 | return saa7146_wait_for_debi_done_sleep(dev, 50000, 250000); | ||
141 | else | ||
142 | return saa7146_wait_for_debi_done_busyloop(dev, 50000, 250000); | ||
143 | } | ||
144 | |||
99 | /**************************************************************************** | 145 | /**************************************************************************** |
100 | * general helper functions | 146 | * general helper functions |
101 | ****************************************************************************/ | 147 | ****************************************************************************/ |
diff --git a/drivers/media/dvb/frontends/mt2131.c b/drivers/media/dvb/frontends/mt2131.c index 4b93931de4e1..13cf16668171 100644 --- a/drivers/media/dvb/frontends/mt2131.c +++ b/drivers/media/dvb/frontends/mt2131.c | |||
@@ -116,7 +116,7 @@ static int mt2131_set_params(struct dvb_frontend *fe, | |||
116 | f_lo1 = (f_lo1 / 250) * 250; | 116 | f_lo1 = (f_lo1 / 250) * 250; |
117 | f_lo2 = f_lo1 - freq - MT2131_IF2; | 117 | f_lo2 = f_lo1 - freq - MT2131_IF2; |
118 | 118 | ||
119 | priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000, | 119 | priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000; |
120 | 120 | ||
121 | /* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */ | 121 | /* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */ |
122 | num1 = f_lo1 * 64 / (MT2131_FREF / 128); | 122 | num1 = f_lo1 * 64 / (MT2131_FREF / 128); |
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c index 30e8a705fad4..8dee7ec9456a 100644 --- a/drivers/media/dvb/frontends/s5h1409.c +++ b/drivers/media/dvb/frontends/s5h1409.c | |||
@@ -42,6 +42,9 @@ struct s5h1409_state { | |||
42 | fe_modulation_t current_modulation; | 42 | fe_modulation_t current_modulation; |
43 | 43 | ||
44 | u32 current_frequency; | 44 | u32 current_frequency; |
45 | |||
46 | u32 is_qam_locked; | ||
47 | u32 qam_state; | ||
45 | }; | 48 | }; |
46 | 49 | ||
47 | static int debug = 0; | 50 | static int debug = 0; |
@@ -94,6 +97,7 @@ static struct init_tab { | |||
94 | { 0xac, 0x1003, }, | 97 | { 0xac, 0x1003, }, |
95 | { 0xad, 0x103f, }, | 98 | { 0xad, 0x103f, }, |
96 | { 0xe2, 0x0100, }, | 99 | { 0xe2, 0x0100, }, |
100 | { 0xe3, 0x0000, }, | ||
97 | { 0x28, 0x1010, }, | 101 | { 0x28, 0x1010, }, |
98 | { 0xb1, 0x000e, }, | 102 | { 0xb1, 0x000e, }, |
99 | }; | 103 | }; |
@@ -335,6 +339,8 @@ static int s5h1409_softreset(struct dvb_frontend* fe) | |||
335 | 339 | ||
336 | s5h1409_writereg(state, 0xf5, 0); | 340 | s5h1409_writereg(state, 0xf5, 0); |
337 | s5h1409_writereg(state, 0xf5, 1); | 341 | s5h1409_writereg(state, 0xf5, 1); |
342 | state->is_qam_locked = 0; | ||
343 | state->qam_state = 0; | ||
338 | return 0; | 344 | return 0; |
339 | } | 345 | } |
340 | 346 | ||
@@ -349,6 +355,11 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz) | |||
349 | s5h1409_writereg(state, 0x87, 0x01be); | 355 | s5h1409_writereg(state, 0x87, 0x01be); |
350 | s5h1409_writereg(state, 0x88, 0x0436); | 356 | s5h1409_writereg(state, 0x88, 0x0436); |
351 | s5h1409_writereg(state, 0x89, 0x054d); | 357 | s5h1409_writereg(state, 0x89, 0x054d); |
358 | } else | ||
359 | if (KHz == 4000) { | ||
360 | s5h1409_writereg(state, 0x87, 0x014b); | ||
361 | s5h1409_writereg(state, 0x88, 0x0cb5); | ||
362 | s5h1409_writereg(state, 0x89, 0x03e2); | ||
352 | } else { | 363 | } else { |
353 | printk("%s() Invalid arg = %d KHz\n", __FUNCTION__, KHz); | 364 | printk("%s() Invalid arg = %d KHz\n", __FUNCTION__, KHz); |
354 | ret = -1; | 365 | ret = -1; |
@@ -361,7 +372,7 @@ static int s5h1409_set_spectralinversion(struct dvb_frontend* fe, int inverted) | |||
361 | { | 372 | { |
362 | struct s5h1409_state* state = fe->demodulator_priv; | 373 | struct s5h1409_state* state = fe->demodulator_priv; |
363 | 374 | ||
364 | dprintk("%s()\n", __FUNCTION__); | 375 | dprintk("%s(%d)\n", __FUNCTION__, inverted); |
365 | 376 | ||
366 | if(inverted == 1) | 377 | if(inverted == 1) |
367 | return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */ | 378 | return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */ |
@@ -382,14 +393,10 @@ static int s5h1409_enable_modulation(struct dvb_frontend* fe, | |||
382 | s5h1409_writereg(state, 0xf4, 0); | 393 | s5h1409_writereg(state, 0xf4, 0); |
383 | break; | 394 | break; |
384 | case QAM_64: | 395 | case QAM_64: |
385 | dprintk("%s() QAM_64\n", __FUNCTION__); | ||
386 | s5h1409_writereg(state, 0xf4, 1); | ||
387 | s5h1409_writereg(state, 0x85, 0x100); | ||
388 | break; | ||
389 | case QAM_256: | 396 | case QAM_256: |
390 | dprintk("%s() QAM_256\n", __FUNCTION__); | 397 | dprintk("%s() QAM_AUTO (64/256)\n", __FUNCTION__); |
391 | s5h1409_writereg(state, 0xf4, 1); | 398 | s5h1409_writereg(state, 0xf4, 1); |
392 | s5h1409_writereg(state, 0x85, 0x101); | 399 | s5h1409_writereg(state, 0x85, 0x110); |
393 | break; | 400 | break; |
394 | default: | 401 | default: |
395 | dprintk("%s() Invalid modulation\n", __FUNCTION__); | 402 | dprintk("%s() Invalid modulation\n", __FUNCTION__); |
@@ -423,7 +430,7 @@ static int s5h1409_set_gpio(struct dvb_frontend* fe, int enable) | |||
423 | if (enable) | 430 | if (enable) |
424 | return s5h1409_writereg(state, 0xe3, 0x1100); | 431 | return s5h1409_writereg(state, 0xe3, 0x1100); |
425 | else | 432 | else |
426 | return s5h1409_writereg(state, 0xe3, 0); | 433 | return s5h1409_writereg(state, 0xe3, 0x1000); |
427 | } | 434 | } |
428 | 435 | ||
429 | static int s5h1409_sleep(struct dvb_frontend* fe, int enable) | 436 | static int s5h1409_sleep(struct dvb_frontend* fe, int enable) |
@@ -444,6 +451,66 @@ static int s5h1409_register_reset(struct dvb_frontend* fe) | |||
444 | return s5h1409_writereg(state, 0xfa, 0); | 451 | return s5h1409_writereg(state, 0xfa, 0); |
445 | } | 452 | } |
446 | 453 | ||
454 | static void s5h1409_set_qam_amhum_mode(struct dvb_frontend *fe) | ||
455 | { | ||
456 | struct s5h1409_state *state = fe->demodulator_priv; | ||
457 | u16 reg; | ||
458 | |||
459 | if (state->is_qam_locked) | ||
460 | return; | ||
461 | |||
462 | /* QAM EQ lock check */ | ||
463 | reg = s5h1409_readreg(state, 0xf0); | ||
464 | |||
465 | if ((reg >> 13) & 0x1) { | ||
466 | |||
467 | state->is_qam_locked = 1; | ||
468 | reg &= 0xff; | ||
469 | |||
470 | s5h1409_writereg(state, 0x96, 0x00c); | ||
471 | if ((reg < 0x38) || (reg > 0x68) ) { | ||
472 | s5h1409_writereg(state, 0x93, 0x3332); | ||
473 | s5h1409_writereg(state, 0x9e, 0x2c37); | ||
474 | } else { | ||
475 | s5h1409_writereg(state, 0x93, 0x3130); | ||
476 | s5h1409_writereg(state, 0x9e, 0x2836); | ||
477 | } | ||
478 | |||
479 | } else { | ||
480 | s5h1409_writereg(state, 0x96, 0x0008); | ||
481 | s5h1409_writereg(state, 0x93, 0x3332); | ||
482 | s5h1409_writereg(state, 0x9e, 0x2c37); | ||
483 | } | ||
484 | } | ||
485 | |||
486 | static void s5h1409_set_qam_interleave_mode(struct dvb_frontend *fe) | ||
487 | { | ||
488 | struct s5h1409_state *state = fe->demodulator_priv; | ||
489 | u16 reg, reg1, reg2; | ||
490 | |||
491 | reg = s5h1409_readreg(state, 0xf1); | ||
492 | |||
493 | /* Master lock */ | ||
494 | if ((reg >> 15) & 0x1) { | ||
495 | if (state->qam_state != 2) { | ||
496 | state->qam_state = 2; | ||
497 | reg1 = s5h1409_readreg(state, 0xb2); | ||
498 | reg2 = s5h1409_readreg(state, 0xad); | ||
499 | |||
500 | s5h1409_writereg(state, 0x96, 0x20); | ||
501 | s5h1409_writereg(state, 0xad, | ||
502 | ( ((reg1 & 0xf000) >> 4) | (reg2 & 0xf0ff)) ); | ||
503 | s5h1409_writereg(state, 0xab, 0x1100); | ||
504 | } | ||
505 | } else { | ||
506 | if (state->qam_state != 1) { | ||
507 | state->qam_state = 1; | ||
508 | s5h1409_writereg(state, 0x96, 0x08); | ||
509 | s5h1409_writereg(state, 0xab, 0x1101); | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | |||
447 | /* Talk to the demod, set the FEC, GUARD, QAM settings etc */ | 514 | /* Talk to the demod, set the FEC, GUARD, QAM settings etc */ |
448 | static int s5h1409_set_frontend (struct dvb_frontend* fe, | 515 | static int s5h1409_set_frontend (struct dvb_frontend* fe, |
449 | struct dvb_frontend_parameters *p) | 516 | struct dvb_frontend_parameters *p) |
@@ -458,12 +525,21 @@ static int s5h1409_set_frontend (struct dvb_frontend* fe, | |||
458 | 525 | ||
459 | s5h1409_enable_modulation(fe, p->u.vsb.modulation); | 526 | s5h1409_enable_modulation(fe, p->u.vsb.modulation); |
460 | 527 | ||
528 | /* Allow the demod to settle */ | ||
529 | msleep(100); | ||
530 | |||
461 | if (fe->ops.tuner_ops.set_params) { | 531 | if (fe->ops.tuner_ops.set_params) { |
462 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); | 532 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); |
463 | fe->ops.tuner_ops.set_params(fe, p); | 533 | fe->ops.tuner_ops.set_params(fe, p); |
464 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); | 534 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); |
465 | } | 535 | } |
466 | 536 | ||
537 | /* Optimize the demod for QAM */ | ||
538 | if (p->u.vsb.modulation != VSB_8) { | ||
539 | s5h1409_set_qam_amhum_mode(fe); | ||
540 | s5h1409_set_qam_interleave_mode(fe); | ||
541 | } | ||
542 | |||
467 | return 0; | 543 | return 0; |
468 | } | 544 | } |
469 | 545 | ||
@@ -495,8 +571,8 @@ static int s5h1409_init (struct dvb_frontend* fe) | |||
495 | s5h1409_set_gpio(fe, state->config->gpio); | 571 | s5h1409_set_gpio(fe, state->config->gpio); |
496 | s5h1409_softreset(fe); | 572 | s5h1409_softreset(fe); |
497 | 573 | ||
498 | /* Note: Leaving the I2C gate open here. */ | 574 | /* Note: Leaving the I2C gate closed. */ |
499 | s5h1409_i2c_gate_ctrl(fe, 1); | 575 | s5h1409_i2c_gate_ctrl(fe, 0); |
500 | 576 | ||
501 | return 0; | 577 | return 0; |
502 | } | 578 | } |
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index 17e5cb561cd8..7c23775f77db 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
@@ -358,11 +358,23 @@ static int stv0297_read_ber(struct dvb_frontend *fe, u32 * ber) | |||
358 | static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength) | 358 | static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength) |
359 | { | 359 | { |
360 | struct stv0297_state *state = fe->demodulator_priv; | 360 | struct stv0297_state *state = fe->demodulator_priv; |
361 | u8 STRENGTH[2]; | 361 | u8 STRENGTH[3]; |
362 | 362 | u16 tmp; | |
363 | stv0297_readregs(state, 0x41, STRENGTH, 2); | 363 | |
364 | *strength = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0]; | 364 | stv0297_readregs(state, 0x41, STRENGTH, 3); |
365 | 365 | tmp = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0]; | |
366 | if (STRENGTH[2] & 0x20) { | ||
367 | if (tmp < 0x200) | ||
368 | tmp = 0; | ||
369 | else | ||
370 | tmp = tmp - 0x200; | ||
371 | } else { | ||
372 | if (tmp > 0x1ff) | ||
373 | tmp = 0; | ||
374 | else | ||
375 | tmp = 0x1ff - tmp; | ||
376 | } | ||
377 | *strength = (tmp << 7) | (tmp >> 2); | ||
366 | return 0; | 378 | return 0; |
367 | } | 379 | } |
368 | 380 | ||
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c index 4cd9e82c4669..45137d2ebfb9 100644 --- a/drivers/media/dvb/frontends/tda10021.c +++ b/drivers/media/dvb/frontends/tda10021.c | |||
@@ -301,6 +301,8 @@ static int tda10021_read_ber(struct dvb_frontend* fe, u32* ber) | |||
301 | u32 _ber = tda10021_readreg(state, 0x14) | | 301 | u32 _ber = tda10021_readreg(state, 0x14) | |
302 | (tda10021_readreg(state, 0x15) << 8) | | 302 | (tda10021_readreg(state, 0x15) << 8) | |
303 | ((tda10021_readreg(state, 0x16) & 0x0f) << 16); | 303 | ((tda10021_readreg(state, 0x16) & 0x0f) << 16); |
304 | _tda10021_writereg(state, 0x10, (tda10021_readreg(state, 0x10) & ~0xc0) | ||
305 | | (tda10021_inittab[0x10] & 0xc0)); | ||
304 | *ber = 10 * _ber; | 306 | *ber = 10 * _ber; |
305 | 307 | ||
306 | return 0; | 308 | return 0; |
@@ -310,7 +312,11 @@ static int tda10021_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
310 | { | 312 | { |
311 | struct tda10021_state* state = fe->demodulator_priv; | 313 | struct tda10021_state* state = fe->demodulator_priv; |
312 | 314 | ||
315 | u8 config = tda10021_readreg(state, 0x02); | ||
313 | u8 gain = tda10021_readreg(state, 0x17); | 316 | u8 gain = tda10021_readreg(state, 0x17); |
317 | if (config & 0x02) | ||
318 | /* the agc value is inverted */ | ||
319 | gain = ~gain; | ||
314 | *strength = (gain << 8) | gain; | 320 | *strength = (gain << 8) | gain; |
315 | 321 | ||
316 | return 0; | 322 | return 0; |
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c index 066b73b75698..60433b5011fd 100644 --- a/drivers/media/dvb/frontends/ves1820.c +++ b/drivers/media/dvb/frontends/ves1820.c | |||
@@ -47,7 +47,7 @@ struct ves1820_state { | |||
47 | static int verbose; | 47 | static int verbose; |
48 | 48 | ||
49 | static u8 ves1820_inittab[] = { | 49 | static u8 ves1820_inittab[] = { |
50 | 0x69, 0x6A, 0x93, 0x12, 0x12, 0x46, 0x26, 0x1A, | 50 | 0x69, 0x6A, 0x93, 0x1A, 0x12, 0x46, 0x26, 0x1A, |
51 | 0x43, 0x6A, 0xAA, 0xAA, 0x1E, 0x85, 0x43, 0x20, | 51 | 0x43, 0x6A, 0xAA, 0xAA, 0x1E, 0x85, 0x43, 0x20, |
52 | 0xE0, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, | 52 | 0xE0, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, |
53 | 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, | 53 | 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, |
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig index 6d53289b3276..54b91f26ca63 100644 --- a/drivers/media/dvb/ttpci/Kconfig +++ b/drivers/media/dvb/ttpci/Kconfig | |||
@@ -84,7 +84,7 @@ config DVB_BUDGET | |||
84 | 84 | ||
85 | config DVB_BUDGET_CI | 85 | config DVB_BUDGET_CI |
86 | tristate "Budget cards with onboard CI connector" | 86 | tristate "Budget cards with onboard CI connector" |
87 | depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 | 87 | depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 && INPUT |
88 | select VIDEO_SAA7146 | 88 | select VIDEO_SAA7146 |
89 | select DVB_STV0297 if !DVB_FE_CUSTOMISE | 89 | select DVB_STV0297 if !DVB_FE_CUSTOMISE |
90 | select DVB_STV0299 if !DVB_FE_CUSTOMISE | 90 | select DVB_STV0299 if !DVB_FE_CUSTOMISE |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 2e571eb9313a..c9f14bfc8544 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -363,7 +363,7 @@ endmenu # encoder / decoder chips | |||
363 | 363 | ||
364 | config VIDEO_VIVI | 364 | config VIDEO_VIVI |
365 | tristate "Virtual Video Driver" | 365 | tristate "Virtual Video Driver" |
366 | depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI | 366 | depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 |
367 | select VIDEOBUF_VMALLOC | 367 | select VIDEOBUF_VMALLOC |
368 | default n | 368 | default n |
369 | ---help--- | 369 | ---help--- |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 9feeb636ff9b..a88b56e6ca05 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -2881,10 +2881,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2881 | if (NULL == fmt) | 2881 | if (NULL == fmt) |
2882 | return -EINVAL; | 2882 | return -EINVAL; |
2883 | mutex_lock(&fh->cap.lock); | 2883 | mutex_lock(&fh->cap.lock); |
2884 | if (fmt->depth != pic->depth) { | ||
2885 | retval = -EINVAL; | ||
2886 | goto fh_unlock_and_return; | ||
2887 | } | ||
2888 | if (fmt->flags & FORMAT_FLAGS_RAW) { | 2884 | if (fmt->flags & FORMAT_FLAGS_RAW) { |
2889 | /* VIDIOCMCAPTURE uses gbufsize, not RAW_BPL * | 2885 | /* VIDIOCMCAPTURE uses gbufsize, not RAW_BPL * |
2890 | RAW_LINES * 2. F1 is stored at offset 0, F2 | 2886 | RAW_LINES * 2. F1 is stored at offset 0, F2 |
@@ -3117,6 +3113,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
3117 | vm->width,vm->height,field); | 3113 | vm->width,vm->height,field); |
3118 | if (0 != retval) | 3114 | if (0 != retval) |
3119 | goto fh_unlock_and_return; | 3115 | goto fh_unlock_and_return; |
3116 | btv->init.width = vm->width; | ||
3117 | btv->init.height = vm->height; | ||
3120 | spin_lock_irqsave(&btv->s_lock,flags); | 3118 | spin_lock_irqsave(&btv->s_lock,flags); |
3121 | buffer_queue(&fh->cap,&buf->vb); | 3119 | buffer_queue(&fh->cap,&buf->vb); |
3122 | spin_unlock_irqrestore(&btv->s_lock,flags); | 3120 | spin_unlock_irqrestore(&btv->s_lock,flags); |
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 0b92c35a8435..d4ac4c4b49b4 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
37 | #include <linux/input.h> | 37 | #include <linux/input.h> |
38 | #include <linux/mutex.h> | 38 | #include <linux/mutex.h> |
39 | #include <asm/scatterlist.h> | 39 | #include <linux/scatterlist.h> |
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | #include <media/v4l2-common.h> | 41 | #include <media/v4l2-common.h> |
42 | 42 | ||
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index b63cab336920..7ae499c9c54c 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -3,6 +3,9 @@ | |||
3 | * multifunction chip. Currently works with the Omnivision OV7670 | 3 | * multifunction chip. Currently works with the Omnivision OV7670 |
4 | * sensor. | 4 | * sensor. |
5 | * | 5 | * |
6 | * The data sheet for this device can be found at: | ||
7 | * http://www.marvell.com/products/pcconn/88ALP01.jsp | ||
8 | * | ||
6 | * Copyright 2006 One Laptop Per Child Association, Inc. | 9 | * Copyright 2006 One Laptop Per Child Association, Inc. |
7 | * Copyright 2006-7 Jonathan Corbet <corbet@lwn.net> | 10 | * Copyright 2006-7 Jonathan Corbet <corbet@lwn.net> |
8 | * | 11 | * |
@@ -2232,13 +2235,16 @@ static int cafe_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2232 | { | 2235 | { |
2233 | struct cafe_camera *cam = cafe_find_by_pdev(pdev); | 2236 | struct cafe_camera *cam = cafe_find_by_pdev(pdev); |
2234 | int ret; | 2237 | int ret; |
2238 | enum cafe_state cstate; | ||
2235 | 2239 | ||
2236 | ret = pci_save_state(pdev); | 2240 | ret = pci_save_state(pdev); |
2237 | if (ret) | 2241 | if (ret) |
2238 | return ret; | 2242 | return ret; |
2243 | cstate = cam->state; /* HACK - stop_dma sets to idle */ | ||
2239 | cafe_ctlr_stop_dma(cam); | 2244 | cafe_ctlr_stop_dma(cam); |
2240 | cafe_ctlr_power_down(cam); | 2245 | cafe_ctlr_power_down(cam); |
2241 | pci_disable_device(pdev); | 2246 | pci_disable_device(pdev); |
2247 | cam->state = cstate; | ||
2242 | return 0; | 2248 | return 0; |
2243 | } | 2249 | } |
2244 | 2250 | ||
diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig index 72004a07b2d5..d8b1ccb44913 100644 --- a/drivers/media/video/cx23885/Kconfig +++ b/drivers/media/video/cx23885/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_CX23885 | 1 | config VIDEO_CX23885 |
2 | tristate "Conexant cx23885 (2388x successor) support" | 2 | tristate "Conexant cx23885 (2388x successor) support" |
3 | depends on DVB_CORE && VIDEO_DEV && PCI && I2C | 3 | depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT |
4 | select I2C_ALGOBIT | 4 | select I2C_ALGOBIT |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | select VIDEO_BTCX | 6 | select VIDEO_BTCX |
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index eeb5224ca101..ceb31d4a2512 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_CX88 | 1 | config VIDEO_CX88 |
2 | tristate "Conexant 2388x (bt878 successor) support" | 2 | tristate "Conexant 2388x (bt878 successor) support" |
3 | depends on VIDEO_DEV && PCI && I2C | 3 | depends on VIDEO_DEV && PCI && I2C && INPUT |
4 | select I2C_ALGOBIT | 4 | select I2C_ALGOBIT |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | select VIDEO_BTCX | 6 | select VIDEO_BTCX |
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig index 5b6a40371602..c1127802ad9c 100644 --- a/drivers/media/video/em28xx/Kconfig +++ b/drivers/media/video/em28xx/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_EM28XX | 1 | config VIDEO_EM28XX |
2 | tristate "Empia EM2800/2820/2840 USB video capture support" | 2 | tristate "Empia EM2800/2820/2840 USB video capture support" |
3 | depends on VIDEO_V4L1 && I2C | 3 | depends on VIDEO_V4L1 && I2C && INPUT |
4 | select VIDEO_TUNER | 4 | select VIDEO_TUNER |
5 | select VIDEO_TVEEPROM | 5 | select VIDEO_TVEEPROM |
6 | select VIDEO_IR | 6 | select VIDEO_IR |
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 997d067e32e0..e3a4aa7a9df4 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c | |||
@@ -416,8 +416,10 @@ static int attach_inform(struct i2c_client *client) | |||
416 | struct em28xx *dev = client->adapter->algo_data; | 416 | struct em28xx *dev = client->adapter->algo_data; |
417 | 417 | ||
418 | switch (client->addr << 1) { | 418 | switch (client->addr << 1) { |
419 | case 0x43: | 419 | case 0x86: |
420 | case 0x4b: | 420 | case 0x84: |
421 | case 0x96: | ||
422 | case 0x94: | ||
421 | { | 423 | { |
422 | struct tuner_setup tun_setup; | 424 | struct tuner_setup tun_setup; |
423 | 425 | ||
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index a4c2a907124a..2529c298b862 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/usb.h> | 32 | #include <linux/usb.h> |
33 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
34 | #include <linux/version.h> | 34 | #include <linux/version.h> |
35 | #include <linux/mm.h> | ||
35 | #include <linux/video_decoder.h> | 36 | #include <linux/video_decoder.h> |
36 | #include <linux/mutex.h> | 37 | #include <linux/mutex.h> |
37 | 38 | ||
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 285fca676a69..623eea2652ca 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -741,7 +741,7 @@ int __devinit init_ivtv_i2c(struct ivtv *itv) | |||
741 | return i2c_bit_add_bus(&itv->i2c_adap); | 741 | return i2c_bit_add_bus(&itv->i2c_adap); |
742 | } | 742 | } |
743 | 743 | ||
744 | void __devexit exit_ivtv_i2c(struct ivtv *itv) | 744 | void exit_ivtv_i2c(struct ivtv *itv) |
745 | { | 745 | { |
746 | IVTV_DEBUG_I2C("i2c exit\n"); | 746 | IVTV_DEBUG_I2C("i2c exit\n"); |
747 | 747 | ||
diff --git a/drivers/media/video/ivtv/ivtv-i2c.h b/drivers/media/video/ivtv/ivtv-i2c.h index 677c3292855e..de6a07442298 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.h +++ b/drivers/media/video/ivtv/ivtv-i2c.h | |||
@@ -36,6 +36,6 @@ 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 __devinit init_ivtv_i2c(struct ivtv *itv); |
39 | void __devexit 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/planb.c b/drivers/media/video/planb.c index ce4b2f9791ee..36047d4e70f6 100644 --- a/drivers/media/video/planb.c +++ b/drivers/media/video/planb.c | |||
@@ -91,7 +91,6 @@ static void planb_close(struct video_device *); | |||
91 | static int planb_ioctl(struct video_device *, unsigned int, void *); | 91 | static int planb_ioctl(struct video_device *, unsigned int, void *); |
92 | static int planb_init_done(struct video_device *); | 92 | static int planb_init_done(struct video_device *); |
93 | static int planb_mmap(struct video_device *, const char *, unsigned long); | 93 | static int planb_mmap(struct video_device *, const char *, unsigned long); |
94 | static void planb_irq(int, void *); | ||
95 | static void release_planb(void); | 94 | static void release_planb(void); |
96 | int init_planbs(struct video_init *); | 95 | int init_planbs(struct video_init *); |
97 | 96 | ||
@@ -1315,7 +1314,7 @@ cmd_tab_data_end: | |||
1315 | return c1; | 1314 | return c1; |
1316 | } | 1315 | } |
1317 | 1316 | ||
1318 | static void planb_irq(int irq, void *dev_id) | 1317 | static irqreturn_t planb_irq(int irq, void *dev_id) |
1319 | { | 1318 | { |
1320 | unsigned int stat, astat; | 1319 | unsigned int stat, astat; |
1321 | struct planb *pb = (struct planb *)dev_id; | 1320 | struct planb *pb = (struct planb *)dev_id; |
@@ -1358,13 +1357,14 @@ static void planb_irq(int irq, void *dev_id) | |||
1358 | pb->frame_stat[fr] = GBUFFER_DONE; | 1357 | pb->frame_stat[fr] = GBUFFER_DONE; |
1359 | pb->grabbing--; | 1358 | pb->grabbing--; |
1360 | wake_up_interruptible(&pb->capq); | 1359 | wake_up_interruptible(&pb->capq); |
1361 | return; | 1360 | return IRQ_HANDLED; |
1362 | } | 1361 | } |
1363 | /* incorrect interrupts? */ | 1362 | /* incorrect interrupts? */ |
1364 | pb->intr_mask = PLANB_CLR_IRQ; | 1363 | pb->intr_mask = PLANB_CLR_IRQ; |
1365 | out_le32(&pb->planb_base->intr_stat, PLANB_CLR_IRQ); | 1364 | out_le32(&pb->planb_base->intr_stat, PLANB_CLR_IRQ); |
1366 | printk(KERN_ERR "PlanB: IRQ lockup, cleared intrrupts" | 1365 | printk(KERN_ERR "PlanB: IRQ lockup, cleared intrrupts" |
1367 | " unconditionally\n"); | 1366 | " unconditionally\n"); |
1367 | return IRQ_HANDLED; | ||
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | /******************************* | 1370 | /******************************* |
@@ -2090,7 +2090,7 @@ static int init_planb(struct planb *pb) | |||
2090 | /* clear interrupt mask */ | 2090 | /* clear interrupt mask */ |
2091 | pb->intr_mask = PLANB_CLR_IRQ; | 2091 | pb->intr_mask = PLANB_CLR_IRQ; |
2092 | 2092 | ||
2093 | result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb); | 2093 | result = request_irq(pb->irq, planb_irq, 0, "PlanB", pb); |
2094 | if (result < 0) { | 2094 | if (result < 0) { |
2095 | if (result==-EINVAL) | 2095 | if (result==-EINVAL) |
2096 | printk(KERN_ERR "PlanB: Bad irq number (%d) " | 2096 | printk(KERN_ERR "PlanB: Bad irq number (%d) " |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index f569b00201dd..46f156fb108c 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c | |||
@@ -410,7 +410,7 @@ static int parse_mtoken(const char *ptr,unsigned int len, | |||
410 | int msk; | 410 | int msk; |
411 | *valptr = 0; | 411 | *valptr = 0; |
412 | for (idx = 0, msk = 1; valid_bits; idx++, msk <<= 1) { | 412 | for (idx = 0, msk = 1; valid_bits; idx++, msk <<= 1) { |
413 | if (!msk & valid_bits) continue; | 413 | if (!(msk & valid_bits)) continue; |
414 | valid_bits &= ~msk; | 414 | valid_bits &= ~msk; |
415 | if (!names[idx]) continue; | 415 | if (!names[idx]) continue; |
416 | slen = strlen(names[idx]); | 416 | slen = strlen(names[idx]); |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-main.c b/drivers/media/video/pvrusb2/pvrusb2-main.c index ca9e2789c8ca..11b3b2e84b90 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-main.c +++ b/drivers/media/video/pvrusb2/pvrusb2-main.c | |||
@@ -136,14 +136,13 @@ static int __init pvr_init(void) | |||
136 | 136 | ||
137 | static void __exit pvr_exit(void) | 137 | static void __exit pvr_exit(void) |
138 | { | 138 | { |
139 | |||
140 | pvr2_trace(PVR2_TRACE_INIT,"pvr_exit"); | 139 | pvr2_trace(PVR2_TRACE_INIT,"pvr_exit"); |
141 | 140 | ||
141 | usb_deregister(&pvr_driver); | ||
142 | |||
142 | #ifdef CONFIG_VIDEO_PVRUSB2_SYSFS | 143 | #ifdef CONFIG_VIDEO_PVRUSB2_SYSFS |
143 | pvr2_sysfs_class_destroy(class_ptr); | 144 | pvr2_sysfs_class_destroy(class_ptr); |
144 | #endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */ | 145 | #endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */ |
145 | |||
146 | usb_deregister(&pvr_driver); | ||
147 | } | 146 | } |
148 | 147 | ||
149 | module_init(pvr_init); | 148 | module_init(pvr_init); |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index 2ee3c3049e8f..3c57a7d8200b 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | |||
@@ -905,13 +905,6 @@ struct pvr2_sysfs *pvr2_sysfs_create(struct pvr2_context *mp, | |||
905 | } | 905 | } |
906 | 906 | ||
907 | 907 | ||
908 | static int pvr2_sysfs_hotplug(struct device *d, | ||
909 | struct kobj_uevent_env *env) | ||
910 | { | ||
911 | /* Even though we don't do anything here, we still need this function | ||
912 | because sysfs will still try to call it. */ | ||
913 | return 0; | ||
914 | } | ||
915 | 908 | ||
916 | struct pvr2_sysfs_class *pvr2_sysfs_class_create(void) | 909 | struct pvr2_sysfs_class *pvr2_sysfs_class_create(void) |
917 | { | 910 | { |
@@ -922,7 +915,6 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void) | |||
922 | clp->class.name = "pvrusb2"; | 915 | clp->class.name = "pvrusb2"; |
923 | clp->class.class_release = pvr2_sysfs_class_release; | 916 | clp->class.class_release = pvr2_sysfs_class_release; |
924 | clp->class.dev_release = pvr2_sysfs_release; | 917 | clp->class.dev_release = pvr2_sysfs_release; |
925 | clp->class.dev_uevent = pvr2_sysfs_hotplug; | ||
926 | if (class_register(&clp->class)) { | 918 | if (class_register(&clp->class)) { |
927 | pvr2_sysfs_trace( | 919 | pvr2_sysfs_trace( |
928 | "Registration failed for pvr2_sysfs_class id=%p",clp); | 920 | "Registration failed for pvr2_sysfs_class id=%p",clp); |
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig index d6d8d660196d..3aa8cb2b860a 100644 --- a/drivers/media/video/saa7134/Kconfig +++ b/drivers/media/video/saa7134/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_SAA7134 | 1 | config VIDEO_SAA7134 |
2 | tristate "Philips SAA7134 support" | 2 | tristate "Philips SAA7134 support" |
3 | depends on VIDEO_DEV && PCI && I2C | 3 | depends on VIDEO_DEV && PCI && I2C && INPUT |
4 | select VIDEOBUF_DMA_SG | 4 | select VIDEOBUF_DMA_SG |
5 | select VIDEO_IR | 5 | select VIDEO_IR |
6 | select VIDEO_TUNER | 6 | select VIDEO_TUNER |
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index c6f7279669c1..b9c5cf7dc849 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c | |||
@@ -543,8 +543,10 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, | |||
543 | V4L functions, and force ALSA to use that as the DMA area */ | 543 | V4L functions, and force ALSA to use that as the DMA area */ |
544 | 544 | ||
545 | substream->runtime->dma_area = dev->dmasound.dma.vmalloc; | 545 | substream->runtime->dma_area = dev->dmasound.dma.vmalloc; |
546 | substream->runtime->dma_bytes = dev->dmasound.bufsize; | ||
547 | substream->runtime->dma_addr = 0; | ||
546 | 548 | ||
547 | return 1; | 549 | return 0; |
548 | 550 | ||
549 | } | 551 | } |
550 | 552 | ||
@@ -652,6 +654,17 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream) | |||
652 | } | 654 | } |
653 | 655 | ||
654 | /* | 656 | /* |
657 | * page callback (needed for mmap) | ||
658 | */ | ||
659 | |||
660 | static struct page *snd_card_saa7134_page(struct snd_pcm_substream *substream, | ||
661 | unsigned long offset) | ||
662 | { | ||
663 | void *pageptr = substream->runtime->dma_area + offset; | ||
664 | return vmalloc_to_page(pageptr); | ||
665 | } | ||
666 | |||
667 | /* | ||
655 | * ALSA capture callbacks definition | 668 | * ALSA capture callbacks definition |
656 | */ | 669 | */ |
657 | 670 | ||
@@ -664,6 +677,7 @@ static struct snd_pcm_ops snd_card_saa7134_capture_ops = { | |||
664 | .prepare = snd_card_saa7134_capture_prepare, | 677 | .prepare = snd_card_saa7134_capture_prepare, |
665 | .trigger = snd_card_saa7134_capture_trigger, | 678 | .trigger = snd_card_saa7134_capture_trigger, |
666 | .pointer = snd_card_saa7134_capture_pointer, | 679 | .pointer = snd_card_saa7134_capture_pointer, |
680 | .page = snd_card_saa7134_page, | ||
667 | }; | 681 | }; |
668 | 682 | ||
669 | /* | 683 | /* |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index a4c192fb4e41..4f3dad9ae6d6 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -2996,11 +2996,11 @@ struct saa7134_board saa7134_boards[] = { | |||
2996 | },{ | 2996 | },{ |
2997 | .name = name_comp1, | 2997 | .name = name_comp1, |
2998 | .vmux = 0, | 2998 | .vmux = 0, |
2999 | .amux = LINE2, | 2999 | .amux = LINE1, |
3000 | },{ | 3000 | },{ |
3001 | .name = name_svideo, | 3001 | .name = name_svideo, |
3002 | .vmux = 8, | 3002 | .vmux = 8, |
3003 | .amux = LINE2, | 3003 | .amux = LINE1, |
3004 | }}, | 3004 | }}, |
3005 | }, | 3005 | }, |
3006 | [SAA7134_BOARD_FLYDVBS_LR300] = { | 3006 | [SAA7134_BOARD_FLYDVBS_LR300] = { |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 6a777604f070..9e99f3636d3d 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | /* standard i2c insmod options */ | 31 | /* standard i2c insmod options */ |
32 | static unsigned short normal_i2c[] = { | 32 | static unsigned short normal_i2c[] = { |
33 | #ifdef CONFIG_TUNER_TEA5761 | 33 | #if defined(CONFIG_TUNER_TEA5761) || (defined(CONFIG_TUNER_TEA5761_MODULE) && defined(MODULE)) |
34 | 0x10, | 34 | 0x10, |
35 | #endif | 35 | #endif |
36 | 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */ | 36 | 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */ |
@@ -292,7 +292,6 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
292 | } | 292 | } |
293 | t->mode_mask = T_RADIO; | 293 | t->mode_mask = T_RADIO; |
294 | break; | 294 | break; |
295 | #ifdef CONFIG_TUNER_TEA5761 | ||
296 | case TUNER_TEA5761: | 295 | case TUNER_TEA5761: |
297 | if (tea5761_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) { | 296 | if (tea5761_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) { |
298 | t->type = TUNER_ABSENT; | 297 | t->type = TUNER_ABSENT; |
@@ -301,7 +300,6 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
301 | } | 300 | } |
302 | t->mode_mask = T_RADIO; | 301 | t->mode_mask = T_RADIO; |
303 | break; | 302 | break; |
304 | #endif | ||
305 | case TUNER_PHILIPS_FMD1216ME_MK3: | 303 | case TUNER_PHILIPS_FMD1216ME_MK3: |
306 | buffer[0] = 0x0b; | 304 | buffer[0] = 0x0b; |
307 | buffer[1] = 0xdc; | 305 | buffer[1] = 0xdc; |
@@ -594,7 +592,6 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
594 | /* autodetection code based on the i2c addr */ | 592 | /* autodetection code based on the i2c addr */ |
595 | if (!no_autodetect) { | 593 | if (!no_autodetect) { |
596 | switch (addr) { | 594 | switch (addr) { |
597 | #ifdef CONFIG_TUNER_TEA5761 | ||
598 | case 0x10: | 595 | case 0x10: |
599 | if (tea5761_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) { | 596 | if (tea5761_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) { |
600 | t->type = TUNER_TEA5761; | 597 | t->type = TUNER_TEA5761; |
@@ -606,7 +603,6 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
606 | goto register_client; | 603 | goto register_client; |
607 | } | 604 | } |
608 | break; | 605 | break; |
609 | #endif | ||
610 | case 0x42: | 606 | case 0x42: |
611 | case 0x43: | 607 | case 0x43: |
612 | case 0x4a: | 608 | case 0x4a: |
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index e2f1c972754b..25d0aef88ef5 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
@@ -799,10 +799,10 @@ static inline void tvp5150_reset(struct i2c_client *c) | |||
799 | tvp5150_write_inittab(c, tvp5150_init_enable); | 799 | tvp5150_write_inittab(c, tvp5150_init_enable); |
800 | 800 | ||
801 | /* Initialize image preferences */ | 801 | /* Initialize image preferences */ |
802 | tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright >> 8); | 802 | tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright); |
803 | tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast >> 8); | 803 | tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast); |
804 | tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast >> 8); | 804 | tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast); |
805 | tvp5150_write(c, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8); | 805 | tvp5150_write(c, TVP5150_HUE_CTL, decoder->hue); |
806 | 806 | ||
807 | tvp5150_set_std(c, decoder->norm); | 807 | tvp5150_set_std(c, decoder->norm); |
808 | }; | 808 | }; |
@@ -1077,10 +1077,10 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter, | |||
1077 | core->norm = V4L2_STD_ALL; /* Default is autodetect */ | 1077 | core->norm = V4L2_STD_ALL; /* Default is autodetect */ |
1078 | core->route.input = TVP5150_COMPOSITE1; | 1078 | core->route.input = TVP5150_COMPOSITE1; |
1079 | core->enable = 1; | 1079 | core->enable = 1; |
1080 | core->bright = 32768; | 1080 | core->bright = 128; |
1081 | core->contrast = 32768; | 1081 | core->contrast = 128; |
1082 | core->hue = 32768; | 1082 | core->hue = 0; |
1083 | core->sat = 32768; | 1083 | core->sat = 128; |
1084 | 1084 | ||
1085 | if (rv) { | 1085 | if (rv) { |
1086 | kfree(c); | 1086 | kfree(c); |
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index 682406168de9..e4ad7a1c4fbd 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -1077,8 +1077,8 @@ static int i2o_block_probe(struct device *dev) | |||
1077 | blk_queue_max_sectors(queue, max_sectors); | 1077 | blk_queue_max_sectors(queue, max_sectors); |
1078 | blk_queue_max_hw_segments(queue, i2o_sg_tablesize(c, body_size)); | 1078 | blk_queue_max_hw_segments(queue, i2o_sg_tablesize(c, body_size)); |
1079 | 1079 | ||
1080 | osm_debug("max sectors = %d\n", queue->max_phys_segments); | 1080 | osm_debug("max sectors = %d\n", queue->max_sectors); |
1081 | osm_debug("phys segments = %d\n", queue->max_sectors); | 1081 | osm_debug("phys segments = %d\n", queue->max_phys_segments); |
1082 | osm_debug("max hw segments = %d\n", queue->max_hw_segments); | 1082 | osm_debug("max hw segments = %d\n", queue->max_hw_segments); |
1083 | 1083 | ||
1084 | /* | 1084 | /* |
diff --git a/drivers/misc/fujitsu-laptop.c b/drivers/misc/fujitsu-laptop.c index d366a6cc1fd9..c8d62c268b11 100644 --- a/drivers/misc/fujitsu-laptop.c +++ b/drivers/misc/fujitsu-laptop.c | |||
@@ -122,9 +122,6 @@ static int get_lcd_level(void) | |||
122 | else | 122 | else |
123 | fujitsu->brightness_changed = 0; | 123 | fujitsu->brightness_changed = 0; |
124 | 124 | ||
125 | if (status < 0) | ||
126 | return status; | ||
127 | |||
128 | return fujitsu->brightness_level; | 125 | return fujitsu->brightness_level; |
129 | } | 126 | } |
130 | 127 | ||
@@ -198,7 +195,7 @@ static struct platform_driver fujitsupf_driver = { | |||
198 | 195 | ||
199 | /* ACPI device */ | 196 | /* ACPI device */ |
200 | 197 | ||
201 | int acpi_fujitsu_add(struct acpi_device *device) | 198 | static int acpi_fujitsu_add(struct acpi_device *device) |
202 | { | 199 | { |
203 | int result = 0; | 200 | int result = 0; |
204 | int state = 0; | 201 | int state = 0; |
@@ -229,7 +226,7 @@ int acpi_fujitsu_add(struct acpi_device *device) | |||
229 | return result; | 226 | return result; |
230 | } | 227 | } |
231 | 228 | ||
232 | int acpi_fujitsu_remove(struct acpi_device *device, int type) | 229 | static int acpi_fujitsu_remove(struct acpi_device *device, int type) |
233 | { | 230 | { |
234 | ACPI_FUNCTION_TRACE("acpi_fujitsu_remove"); | 231 | ACPI_FUNCTION_TRACE("acpi_fujitsu_remove"); |
235 | 232 | ||
diff --git a/drivers/misc/ioc4.c b/drivers/misc/ioc4.c index 6a5a05d1f392..05172d2613d6 100644 --- a/drivers/misc/ioc4.c +++ b/drivers/misc/ioc4.c | |||
@@ -244,10 +244,11 @@ ioc4_variant(struct ioc4_driver_data *idd) | |||
244 | idd->idd_pdev->bus->number == pdev->bus->number && | 244 | idd->idd_pdev->bus->number == pdev->bus->number && |
245 | 3 == PCI_SLOT(pdev->devfn)) | 245 | 3 == PCI_SLOT(pdev->devfn)) |
246 | found = 1; | 246 | found = 1; |
247 | pci_dev_put(pdev); | ||
248 | } while (pdev && !found); | 247 | } while (pdev && !found); |
249 | if (NULL != pdev) | 248 | if (NULL != pdev) { |
249 | pci_dev_put(pdev); | ||
250 | return IOC4_VARIANT_IO9; | 250 | return IOC4_VARIANT_IO9; |
251 | } | ||
251 | 252 | ||
252 | /* IO10: Look for a Vitesse VSC 7174 at the same bus and slot 3. */ | 253 | /* IO10: Look for a Vitesse VSC 7174 at the same bus and slot 3. */ |
253 | pdev = NULL; | 254 | pdev = NULL; |
@@ -258,10 +259,11 @@ ioc4_variant(struct ioc4_driver_data *idd) | |||
258 | idd->idd_pdev->bus->number == pdev->bus->number && | 259 | idd->idd_pdev->bus->number == pdev->bus->number && |
259 | 3 == PCI_SLOT(pdev->devfn)) | 260 | 3 == PCI_SLOT(pdev->devfn)) |
260 | found = 1; | 261 | found = 1; |
261 | pci_dev_put(pdev); | ||
262 | } while (pdev && !found); | 262 | } while (pdev && !found); |
263 | if (NULL != pdev) | 263 | if (NULL != pdev) { |
264 | pci_dev_put(pdev); | ||
264 | return IOC4_VARIANT_IO10; | 265 | return IOC4_VARIANT_IO10; |
266 | } | ||
265 | 267 | ||
266 | /* PCI-RT: No SCSI/SATA controller will be present */ | 268 | /* PCI-RT: No SCSI/SATA controller will be present */ |
267 | return IOC4_VARIANT_PCI_RT; | 269 | return IOC4_VARIANT_PCI_RT; |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index e953276664a0..ab23a3221585 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, |
@@ -993,9 +993,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
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 9203a0b221b3..1b9c9b6da5b7 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -310,7 +310,7 @@ static void copy_sg(struct scatterlist *dst, unsigned int dst_len, | |||
310 | } | 310 | } |
311 | 311 | ||
312 | if (src_size == 0) { | 312 | if (src_size == 0) { |
313 | src_buf = sg_virt(dst); | 313 | src_buf = sg_virt(src); |
314 | src_size = src->length; | 314 | src_size = src->length; |
315 | } | 315 | } |
316 | 316 | ||
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 09435e0ec680..b96667448eb5 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/pagemap.h> | 19 | #include <linux/pagemap.h> |
20 | #include <linux/err.h> | 20 | #include <linux/err.h> |
21 | #include <linux/leds.h> | 21 | #include <linux/leds.h> |
22 | #include <asm/scatterlist.h> | ||
23 | #include <linux/scatterlist.h> | 22 | #include <linux/scatterlist.h> |
24 | 23 | ||
25 | #include <linux/mmc/card.h> | 24 | #include <linux/mmc/card.h> |
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 7471d49909b2..64b05c6270f2 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <asm/scatterlist.h> | ||
14 | #include <linux/scatterlist.h> | 13 | #include <linux/scatterlist.h> |
15 | 14 | ||
16 | #include <linux/mmc/host.h> | 15 | #include <linux/mmc/host.h> |
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c index a6dafe62b992..0d96080d44b0 100644 --- a/drivers/mmc/core/sd_ops.c +++ b/drivers/mmc/core/sd_ops.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <asm/scatterlist.h> | ||
14 | #include <linux/scatterlist.h> | 13 | #include <linux/scatterlist.h> |
15 | 14 | ||
16 | #include <linux/mmc/host.h> | 15 | #include <linux/mmc/host.h> |
diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c index 4d289b275031..e1fca588e385 100644 --- a/drivers/mmc/core/sdio_ops.c +++ b/drivers/mmc/core/sdio_ops.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * your option) any later version. | 9 | * your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <asm/scatterlist.h> | ||
13 | #include <linux/scatterlist.h> | 12 | #include <linux/scatterlist.h> |
14 | 13 | ||
15 | #include <linux/mmc/host.h> | 14 | #include <linux/mmc/host.h> |
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c index b2104d4f87af..c3926eb3bf43 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <linux/mm.h> | 40 | #include <linux/mm.h> |
41 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
42 | #include <linux/dma-mapping.h> | 42 | #include <linux/dma-mapping.h> |
43 | #include <scatterlist/scatterlist.h> | 43 | #include <linux/scatterlist.h> |
44 | 44 | ||
45 | #include <linux/mmc/host.h> | 45 | #include <linux/mmc/host.h> |
46 | #include <asm/io.h> | 46 | #include <asm/io.h> |
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c index fc72e1fadb6a..f2070a19cfa7 100644 --- a/drivers/mmc/host/imxmmc.c +++ b/drivers/mmc/host/imxmmc.c | |||
@@ -262,7 +262,7 @@ static void imxmci_setup_data(struct imxmci_host *host, struct mmc_data *data) | |||
262 | } | 262 | } |
263 | 263 | ||
264 | /* Convert back to virtual address */ | 264 | /* Convert back to virtual address */ |
265 | host->data_ptr = (u16*)sg_virt(sg); | 265 | host->data_ptr = (u16*)sg_virt(data->sg); |
266 | host->data_cnt = 0; | 266 | host->data_cnt = 0; |
267 | 267 | ||
268 | clear_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events); | 268 | clear_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events); |
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index a25ee71998a9..1654a3330340 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #define DRIVER_NAME "pxa2xx-mci" | 39 | #define DRIVER_NAME "pxa2xx-mci" |
40 | 40 | ||
41 | #define NR_SG 1 | 41 | #define NR_SG 1 |
42 | #define CLKRT_OFF (~0) | ||
42 | 43 | ||
43 | struct pxamci_host { | 44 | struct pxamci_host { |
44 | struct mmc_host *mmc; | 45 | struct mmc_host *mmc; |
@@ -371,6 +372,9 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
371 | unsigned long rate = host->clkrate; | 372 | unsigned long rate = host->clkrate; |
372 | unsigned int clk = rate / ios->clock; | 373 | unsigned int clk = rate / ios->clock; |
373 | 374 | ||
375 | if (host->clkrt == CLKRT_OFF) | ||
376 | clk_enable(host->clk); | ||
377 | |||
374 | /* | 378 | /* |
375 | * clk might result in a lower divisor than we | 379 | * clk might result in a lower divisor than we |
376 | * desire. check for that condition and adjust | 380 | * desire. check for that condition and adjust |
@@ -379,14 +383,16 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
379 | if (rate / clk > ios->clock) | 383 | if (rate / clk > ios->clock) |
380 | clk <<= 1; | 384 | clk <<= 1; |
381 | host->clkrt = fls(clk) - 1; | 385 | host->clkrt = fls(clk) - 1; |
382 | clk_enable(host->clk); | ||
383 | 386 | ||
384 | /* | 387 | /* |
385 | * we write clkrt on the next command | 388 | * we write clkrt on the next command |
386 | */ | 389 | */ |
387 | } else { | 390 | } else { |
388 | pxamci_stop_clock(host); | 391 | pxamci_stop_clock(host); |
389 | clk_disable(host->clk); | 392 | if (host->clkrt != CLKRT_OFF) { |
393 | host->clkrt = CLKRT_OFF; | ||
394 | clk_disable(host->clk); | ||
395 | } | ||
390 | } | 396 | } |
391 | 397 | ||
392 | if (host->power_mode != ios->power_mode) { | 398 | if (host->power_mode != ios->power_mode) { |
@@ -498,6 +504,7 @@ static int pxamci_probe(struct platform_device *pdev) | |||
498 | host->mmc = mmc; | 504 | host->mmc = mmc; |
499 | host->dma = -1; | 505 | host->dma = -1; |
500 | host->pdata = pdev->dev.platform_data; | 506 | host->pdata = pdev->dev.platform_data; |
507 | host->clkrt = CLKRT_OFF; | ||
501 | 508 | ||
502 | host->clk = clk_get(&pdev->dev, "MMCCLK"); | 509 | host->clk = clk_get(&pdev->dev, "MMCCLK"); |
503 | if (IS_ERR(host->clk)) { | 510 | if (IS_ERR(host->clk)) { |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 6b80bf77a4ef..ff59d2e0475b 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -1301,7 +1301,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1301 | 1301 | ||
1302 | if ((chip->quirks & SDHCI_QUIRK_BROKEN_DMA) && | 1302 | if ((chip->quirks & SDHCI_QUIRK_BROKEN_DMA) && |
1303 | (host->flags & SDHCI_USE_DMA)) { | 1303 | (host->flags & SDHCI_USE_DMA)) { |
1304 | DBG("Disabling DMA as it is marked broken"); | 1304 | DBG("Disabling DMA as it is marked broken\n"); |
1305 | host->flags &= ~SDHCI_USE_DMA; | 1305 | host->flags &= ~SDHCI_USE_DMA; |
1306 | } | 1306 | } |
1307 | 1307 | ||
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/82596.c b/drivers/net/82596.c index bb30d5be7824..2797da7eeee6 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c | |||
@@ -1192,6 +1192,8 @@ struct net_device * __init i82596_probe(int unit) | |||
1192 | goto out; | 1192 | goto out; |
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | dev->base_addr = ioaddr; | ||
1196 | |||
1195 | for (i = 0; i < 8; i++) { | 1197 | for (i = 0; i < 8; i++) { |
1196 | eth_addr[i] = inb(ioaddr + 8 + i); | 1198 | eth_addr[i] = inb(ioaddr + 8 + i); |
1197 | checksum += eth_addr[i]; | 1199 | checksum += eth_addr[i]; |
@@ -1209,7 +1211,6 @@ struct net_device * __init i82596_probe(int unit) | |||
1209 | goto out1; | 1211 | goto out1; |
1210 | } | 1212 | } |
1211 | 1213 | ||
1212 | dev->base_addr = ioaddr; | ||
1213 | dev->irq = 10; | 1214 | dev->irq = 10; |
1214 | } | 1215 | } |
1215 | #endif | 1216 | #endif |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 86b8641b4664..e8d69b0adf90 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -136,10 +136,11 @@ config TUN | |||
136 | If you don't know what to use this for, you don't need it. | 136 | If you don't know what to use this for, you don't need it. |
137 | 137 | ||
138 | config VETH | 138 | config VETH |
139 | tristate "Virtual ethernet device" | 139 | tristate "Virtual ethernet pair device" |
140 | ---help--- | 140 | ---help--- |
141 | The device is an ethernet tunnel. Devices are created in pairs. When | 141 | This device is a local ethernet tunnel. Devices are created in pairs. |
142 | one end receives the packet it appears on its pair and vice versa. | 142 | When one end receives the packet it appears on its pair and vice |
143 | versa. | ||
143 | 144 | ||
144 | config NET_SB1000 | 145 | config NET_SB1000 |
145 | tristate "General Instruments Surfboard 1000" | 146 | tristate "General Instruments Surfboard 1000" |
@@ -166,13 +167,14 @@ config NET_SB1000 | |||
166 | If you don't have this card, of course say N. | 167 | If you don't have this card, of course say N. |
167 | 168 | ||
168 | config IP1000 | 169 | config IP1000 |
169 | tristate "IP1000 Gigabit Ethernet support" | 170 | tristate "IP1000 Gigabit Ethernet support" |
170 | depends on PCI && EXPERIMENTAL | 171 | depends on PCI && EXPERIMENTAL |
171 | ---help--- | 172 | select MII |
172 | This driver supports IP1000 gigabit Ethernet cards. | 173 | ---help--- |
174 | This driver supports IP1000 gigabit Ethernet cards. | ||
173 | 175 | ||
174 | To compile this driver as a module, choose M here: the module | 176 | To compile this driver as a module, choose M here: the module |
175 | will be called ipg. This is recommended. | 177 | will be called ipg. This is recommended. |
176 | 178 | ||
177 | source "drivers/net/arcnet/Kconfig" | 179 | source "drivers/net/arcnet/Kconfig" |
178 | 180 | ||
@@ -233,7 +235,7 @@ source "drivers/net/arm/Kconfig" | |||
233 | 235 | ||
234 | config AX88796 | 236 | config AX88796 |
235 | tristate "ASIX AX88796 NE2000 clone support" | 237 | tristate "ASIX AX88796 NE2000 clone support" |
236 | depends on ARM || MIPS | 238 | depends on ARM || MIPS || SUPERH |
237 | select CRC32 | 239 | select CRC32 |
238 | select MII | 240 | select MII |
239 | help | 241 | help |
@@ -364,8 +366,7 @@ config MAC89x0 | |||
364 | read the Ethernet-HOWTO, available from | 366 | read the Ethernet-HOWTO, available from |
365 | <http://www.tldp.org/docs.html#howto>. | 367 | <http://www.tldp.org/docs.html#howto>. |
366 | 368 | ||
367 | To compile this driver as a module, choose M here and read | 369 | To compile this driver as a module, choose M here. This module will |
368 | <file:Documentation/networking/net-modules.txt>. This module will | ||
369 | be called mac89x0. | 370 | be called mac89x0. |
370 | 371 | ||
371 | config MACSONIC | 372 | config MACSONIC |
@@ -378,8 +379,7 @@ config MACSONIC | |||
378 | one of these say Y and read the Ethernet-HOWTO, available from | 379 | one of these say Y and read the Ethernet-HOWTO, available from |
379 | <http://www.tldp.org/docs.html#howto>. | 380 | <http://www.tldp.org/docs.html#howto>. |
380 | 381 | ||
381 | To compile this driver as a module, choose M here and read | 382 | To compile this driver as a module, choose M here. This module will |
382 | <file:Documentation/networking/net-modules.txt>. This module will | ||
383 | be called macsonic. | 383 | be called macsonic. |
384 | 384 | ||
385 | config MACMACE | 385 | config MACMACE |
@@ -617,8 +617,7 @@ config EL1 | |||
617 | have problems. Some people suggest to ping ("man ping") a nearby | 617 | have problems. Some people suggest to ping ("man ping") a nearby |
618 | machine every minute ("man cron") when using this card. | 618 | machine every minute ("man cron") when using this card. |
619 | 619 | ||
620 | To compile this driver as a module, choose M here and read | 620 | To compile this driver as a module, choose M here. The module |
621 | <file:Documentation/networking/net-modules.txt>. The module | ||
622 | will be called 3c501. | 621 | will be called 3c501. |
623 | 622 | ||
624 | config EL2 | 623 | config EL2 |
@@ -630,8 +629,7 @@ config EL2 | |||
630 | the Ethernet-HOWTO, available from | 629 | the Ethernet-HOWTO, available from |
631 | <http://www.tldp.org/docs.html#howto>. | 630 | <http://www.tldp.org/docs.html#howto>. |
632 | 631 | ||
633 | To compile this driver as a module, choose M here and read | 632 | To compile this driver as a module, choose M here. The module |
634 | <file:Documentation/networking/net-modules.txt>. The module | ||
635 | will be called 3c503. | 633 | will be called 3c503. |
636 | 634 | ||
637 | config ELPLUS | 635 | config ELPLUS |
@@ -643,8 +641,7 @@ config ELPLUS | |||
643 | this type, say Y and read the Ethernet-HOWTO, available from | 641 | this type, say Y and read the Ethernet-HOWTO, available from |
644 | <http://www.tldp.org/docs.html#howto>. | 642 | <http://www.tldp.org/docs.html#howto>. |
645 | 643 | ||
646 | To compile this driver as a module, choose M here and read | 644 | To compile this driver as a module, choose M here. The module |
647 | <file:Documentation/networking/net-modules.txt>. The module | ||
648 | will be called 3c505. | 645 | will be called 3c505. |
649 | 646 | ||
650 | config EL16 | 647 | config EL16 |
@@ -655,8 +652,7 @@ config EL16 | |||
655 | the Ethernet-HOWTO, available from | 652 | the Ethernet-HOWTO, available from |
656 | <http://www.tldp.org/docs.html#howto>. | 653 | <http://www.tldp.org/docs.html#howto>. |
657 | 654 | ||
658 | To compile this driver as a module, choose M here and read | 655 | To compile this driver as a module, choose M here. The module |
659 | <file:Documentation/networking/net-modules.txt>. The module | ||
660 | will be called 3c507. | 656 | will be called 3c507. |
661 | 657 | ||
662 | config EL3 | 658 | config EL3 |
@@ -671,8 +667,7 @@ config EL3 | |||
671 | setup disk to disable Plug & Play mode, and to select the default | 667 | setup disk to disable Plug & Play mode, and to select the default |
672 | media type. | 668 | media type. |
673 | 669 | ||
674 | To compile this driver as a module, choose M here and read | 670 | To compile this driver as a module, choose M here. The module |
675 | <file:Documentation/networking/net-modules.txt>. The module | ||
676 | will be called 3c509. | 671 | will be called 3c509. |
677 | 672 | ||
678 | config 3C515 | 673 | config 3C515 |
@@ -683,8 +678,7 @@ config 3C515 | |||
683 | network card, say Y and read the Ethernet-HOWTO, available from | 678 | network card, say Y and read the Ethernet-HOWTO, available from |
684 | <http://www.tldp.org/docs.html#howto>. | 679 | <http://www.tldp.org/docs.html#howto>. |
685 | 680 | ||
686 | To compile this driver as a module, choose M here and read | 681 | To compile this driver as a module, choose M here. The module |
687 | <file:Documentation/networking/net-modules.txt>. The module | ||
688 | will be called 3c515. | 682 | will be called 3c515. |
689 | 683 | ||
690 | config ELMC | 684 | config ELMC |
@@ -695,8 +689,7 @@ config ELMC | |||
695 | the Ethernet-HOWTO, available from | 689 | the Ethernet-HOWTO, available from |
696 | <http://www.tldp.org/docs.html#howto>. | 690 | <http://www.tldp.org/docs.html#howto>. |
697 | 691 | ||
698 | To compile this driver as a module, choose M here and read | 692 | To compile this driver as a module, choose M here. The module |
699 | <file:Documentation/networking/net-modules.txt>. The module | ||
700 | will be called 3c523. | 693 | will be called 3c523. |
701 | 694 | ||
702 | config ELMC_II | 695 | config ELMC_II |
@@ -707,8 +700,7 @@ config ELMC_II | |||
707 | the Ethernet-HOWTO, available from | 700 | the Ethernet-HOWTO, available from |
708 | <http://www.tldp.org/docs.html#howto>. | 701 | <http://www.tldp.org/docs.html#howto>. |
709 | 702 | ||
710 | To compile this driver as a module, choose M here and read | 703 | To compile this driver as a module, choose M here. The module |
711 | <file:Documentation/networking/net-modules.txt>. The module | ||
712 | will be called 3c527. | 704 | will be called 3c527. |
713 | 705 | ||
714 | config VORTEX | 706 | config VORTEX |
@@ -731,8 +723,7 @@ config VORTEX | |||
731 | <file:Documentation/networking/vortex.txt> and in the comments at | 723 | <file:Documentation/networking/vortex.txt> and in the comments at |
732 | the beginning of <file:drivers/net/3c59x.c>. | 724 | the beginning of <file:drivers/net/3c59x.c>. |
733 | 725 | ||
734 | To compile this support as a module, choose M here and read | 726 | To compile this support as a module, choose M here. |
735 | <file:Documentation/networking/net-modules.txt>. | ||
736 | 727 | ||
737 | config TYPHOON | 728 | config TYPHOON |
738 | tristate "3cr990 series \"Typhoon\" support" | 729 | tristate "3cr990 series \"Typhoon\" support" |
@@ -749,8 +740,7 @@ config TYPHOON | |||
749 | the Ethernet-HOWTO, available from | 740 | the Ethernet-HOWTO, available from |
750 | <http://www.tldp.org/docs.html#howto>. | 741 | <http://www.tldp.org/docs.html#howto>. |
751 | 742 | ||
752 | To compile this driver as a module, choose M here and read | 743 | To compile this driver as a module, choose M here. The module |
753 | <file:Documentation/networking/net-modules.txt>. The module | ||
754 | will be called typhoon. | 744 | will be called typhoon. |
755 | 745 | ||
756 | config LANCE | 746 | config LANCE |
@@ -787,8 +777,7 @@ config WD80x3 | |||
787 | the Ethernet-HOWTO, available from | 777 | the Ethernet-HOWTO, available from |
788 | <http://www.tldp.org/docs.html#howto>. | 778 | <http://www.tldp.org/docs.html#howto>. |
789 | 779 | ||
790 | To compile this driver as a module, choose M here and read | 780 | To compile this driver as a module, choose M here. The module |
791 | <file:Documentation/networking/net-modules.txt>. The module | ||
792 | will be called wd. | 781 | will be called wd. |
793 | 782 | ||
794 | config ULTRAMCA | 783 | config ULTRAMCA |
@@ -800,8 +789,7 @@ config ULTRAMCA | |||
800 | an MCA based system (PS/2), say Y and read the Ethernet-HOWTO, | 789 | an MCA based system (PS/2), say Y and read the Ethernet-HOWTO, |
801 | available from <http://www.tldp.org/docs.html#howto>. | 790 | available from <http://www.tldp.org/docs.html#howto>. |
802 | 791 | ||
803 | To compile this driver as a module, choose M here and read | 792 | To compile this driver as a module, choose M here. The module |
804 | <file:Documentation/networking/net-modules.txt>. The module | ||
805 | will be called smc-mca. | 793 | will be called smc-mca. |
806 | 794 | ||
807 | config ULTRA | 795 | config ULTRA |
@@ -820,8 +808,7 @@ config ULTRA | |||
820 | this but keep it in mind if you have such a SCSI card and have | 808 | this but keep it in mind if you have such a SCSI card and have |
821 | problems. | 809 | problems. |
822 | 810 | ||
823 | To compile this driver as a module, choose M here and read | 811 | To compile this driver as a module, choose M here. The module |
824 | <file:Documentation/networking/net-modules.txt>. The module | ||
825 | will be called smc-ultra. | 812 | will be called smc-ultra. |
826 | 813 | ||
827 | config ULTRA32 | 814 | config ULTRA32 |
@@ -833,8 +820,7 @@ config ULTRA32 | |||
833 | the Ethernet-HOWTO, available from | 820 | the Ethernet-HOWTO, available from |
834 | <http://www.tldp.org/docs.html#howto>. | 821 | <http://www.tldp.org/docs.html#howto>. |
835 | 822 | ||
836 | To compile this driver as a module, choose M here and read | 823 | To compile this driver as a module, choose M here. The module |
837 | <file:Documentation/networking/net-modules.txt>. The module | ||
838 | will be called smc-ultra32. | 824 | will be called smc-ultra32. |
839 | 825 | ||
840 | config BFIN_MAC | 826 | config BFIN_MAC |
@@ -895,8 +881,7 @@ config SMC9194 | |||
895 | <file:Documentation/networking/smc9.txt> and the Ethernet-HOWTO, | 881 | <file:Documentation/networking/smc9.txt> and the Ethernet-HOWTO, |
896 | available from <http://www.tldp.org/docs.html#howto>. | 882 | available from <http://www.tldp.org/docs.html#howto>. |
897 | 883 | ||
898 | To compile this driver as a module, choose M here and read | 884 | To compile this driver as a module, choose M here. The module |
899 | <file:Documentation/networking/net-modules.txt>. The module | ||
900 | will be called smc9194. | 885 | will be called smc9194. |
901 | 886 | ||
902 | config SMC91X | 887 | config SMC91X |
@@ -914,8 +899,7 @@ config SMC91X | |||
914 | This driver is also available as a module ( = code which can be | 899 | This driver is also available as a module ( = code which can be |
915 | inserted in and removed from the running kernel whenever you want). | 900 | inserted in and removed from the running kernel whenever you want). |
916 | The module will be called smc91x. If you want to compile it as a | 901 | The module will be called smc91x. If you want to compile it as a |
917 | module, say M here and read <file:Documentation/kbuild/modules.txt> | 902 | module, say M here and read <file:Documentation/kbuild/modules.txt>. |
918 | as well as <file:Documentation/networking/net-modules.txt>. | ||
919 | 903 | ||
920 | config NET_NETX | 904 | config NET_NETX |
921 | tristate "NetX Ethernet support" | 905 | tristate "NetX Ethernet support" |
@@ -924,8 +908,7 @@ config NET_NETX | |||
924 | help | 908 | help |
925 | This is support for the Hilscher netX builtin Ethernet ports | 909 | This is support for the Hilscher netX builtin Ethernet ports |
926 | 910 | ||
927 | To compile this driver as a module, choose M here and read | 911 | To compile this driver as a module, choose M here. The module |
928 | <file:Documentation/networking/net-modules.txt>. The module | ||
929 | will be called netx-eth. | 912 | will be called netx-eth. |
930 | 913 | ||
931 | config DM9000 | 914 | config DM9000 |
@@ -936,9 +919,8 @@ config DM9000 | |||
936 | ---help--- | 919 | ---help--- |
937 | Support for DM9000 chipset. | 920 | Support for DM9000 chipset. |
938 | 921 | ||
939 | To compile this driver as a module, choose M here and read | 922 | To compile this driver as a module, choose M here. The module |
940 | <file:Documentation/networking/net-modules.txt>. The module will be | 923 | will be called dm9000. |
941 | called dm9000. | ||
942 | 924 | ||
943 | config SMC911X | 925 | config SMC911X |
944 | tristate "SMSC LAN911[5678] support" | 926 | tristate "SMSC LAN911[5678] support" |
@@ -978,8 +960,7 @@ config NI5010 | |||
978 | <http://www.tldp.org/docs.html#howto>. Note that this is still | 960 | <http://www.tldp.org/docs.html#howto>. Note that this is still |
979 | experimental code. | 961 | experimental code. |
980 | 962 | ||
981 | To compile this driver as a module, choose M here and read | 963 | To compile this driver as a module, choose M here. The module |
982 | <file:Documentation/networking/net-modules.txt>. The module | ||
983 | will be called ni5010. | 964 | will be called ni5010. |
984 | 965 | ||
985 | config NI52 | 966 | config NI52 |
@@ -990,8 +971,7 @@ config NI52 | |||
990 | the Ethernet-HOWTO, available from | 971 | the Ethernet-HOWTO, available from |
991 | <http://www.tldp.org/docs.html#howto>. | 972 | <http://www.tldp.org/docs.html#howto>. |
992 | 973 | ||
993 | To compile this driver as a module, choose M here and read | 974 | To compile this driver as a module, choose M here. The module |
994 | <file:Documentation/networking/net-modules.txt>. The module | ||
995 | will be called ni52. | 975 | will be called ni52. |
996 | 976 | ||
997 | config NI65 | 977 | config NI65 |
@@ -1002,8 +982,7 @@ config NI65 | |||
1002 | the Ethernet-HOWTO, available from | 982 | the Ethernet-HOWTO, available from |
1003 | <http://www.tldp.org/docs.html#howto>. | 983 | <http://www.tldp.org/docs.html#howto>. |
1004 | 984 | ||
1005 | To compile this driver as a module, choose M here and read | 985 | To compile this driver as a module, choose M here. The module |
1006 | <file:Documentation/networking/net-modules.txt>. The module | ||
1007 | will be called ni65. | 986 | will be called ni65. |
1008 | 987 | ||
1009 | source "drivers/net/tulip/Kconfig" | 988 | source "drivers/net/tulip/Kconfig" |
@@ -1017,8 +996,7 @@ config AT1700 | |||
1017 | the Ethernet-HOWTO, available from | 996 | the Ethernet-HOWTO, available from |
1018 | <http://www.tldp.org/docs.html#howto>. | 997 | <http://www.tldp.org/docs.html#howto>. |
1019 | 998 | ||
1020 | To compile this driver as a module, choose M here and read | 999 | To compile this driver as a module, choose M here. The module |
1021 | <file:Documentation/networking/net-modules.txt>. The module | ||
1022 | will be called at1700. | 1000 | will be called at1700. |
1023 | 1001 | ||
1024 | config DEPCA | 1002 | config DEPCA |
@@ -1031,8 +1009,7 @@ config DEPCA | |||
1031 | <http://www.tldp.org/docs.html#howto> as well as | 1009 | <http://www.tldp.org/docs.html#howto> as well as |
1032 | <file:drivers/net/depca.c>. | 1010 | <file:drivers/net/depca.c>. |
1033 | 1011 | ||
1034 | To compile this driver as a module, choose M here and read | 1012 | To compile this driver as a module, choose M here. The module |
1035 | <file:Documentation/networking/net-modules.txt>. The module | ||
1036 | will be called depca. | 1013 | will be called depca. |
1037 | 1014 | ||
1038 | config HP100 | 1015 | config HP100 |
@@ -1043,8 +1020,7 @@ config HP100 | |||
1043 | the Ethernet-HOWTO, available from | 1020 | the Ethernet-HOWTO, available from |
1044 | <http://www.tldp.org/docs.html#howto>. | 1021 | <http://www.tldp.org/docs.html#howto>. |
1045 | 1022 | ||
1046 | To compile this driver as a module, choose M here and read | 1023 | To compile this driver as a module, choose M here. The module |
1047 | <file:Documentation/networking/net-modules.txt>. The module | ||
1048 | will be called hp100. | 1024 | will be called hp100. |
1049 | 1025 | ||
1050 | config NET_ISA | 1026 | config NET_ISA |
@@ -1073,8 +1049,7 @@ config E2100 | |||
1073 | the Ethernet-HOWTO, available from | 1049 | the Ethernet-HOWTO, available from |
1074 | <http://www.tldp.org/docs.html#howto>. | 1050 | <http://www.tldp.org/docs.html#howto>. |
1075 | 1051 | ||
1076 | To compile this driver as a module, choose M here and read | 1052 | To compile this driver as a module, choose M here. The module |
1077 | <file:Documentation/networking/net-modules.txt>. The module | ||
1078 | will be called e2100. | 1053 | will be called e2100. |
1079 | 1054 | ||
1080 | config EWRK3 | 1055 | config EWRK3 |
@@ -1088,8 +1063,7 @@ config EWRK3 | |||
1088 | well as the Ethernet-HOWTO, available from | 1063 | well as the Ethernet-HOWTO, available from |
1089 | <http://www.tldp.org/docs.html#howto>. | 1064 | <http://www.tldp.org/docs.html#howto>. |
1090 | 1065 | ||
1091 | To compile this driver as a module, choose M here and read | 1066 | To compile this driver as a module, choose M here. The module |
1092 | <file:Documentation/networking/net-modules.txt>. The module | ||
1093 | will be called ewrk3. | 1067 | will be called ewrk3. |
1094 | 1068 | ||
1095 | config EEXPRESS | 1069 | config EEXPRESS |
@@ -1103,8 +1077,7 @@ config EEXPRESS | |||
1103 | because the driver was very unreliable. We now have a new driver | 1077 | because the driver was very unreliable. We now have a new driver |
1104 | that should do better. | 1078 | that should do better. |
1105 | 1079 | ||
1106 | To compile this driver as a module, choose M here and read | 1080 | To compile this driver as a module, choose M here. The module |
1107 | <file:Documentation/networking/net-modules.txt>. The module | ||
1108 | will be called eexpress. | 1081 | will be called eexpress. |
1109 | 1082 | ||
1110 | config EEXPRESS_PRO | 1083 | config EEXPRESS_PRO |
@@ -1117,8 +1090,7 @@ config EEXPRESS_PRO | |||
1117 | driver. Please read the Ethernet-HOWTO, available from | 1090 | driver. Please read the Ethernet-HOWTO, available from |
1118 | <http://www.tldp.org/docs.html#howto>. | 1091 | <http://www.tldp.org/docs.html#howto>. |
1119 | 1092 | ||
1120 | To compile this driver as a module, choose M here and read | 1093 | To compile this driver as a module, choose M here. The module |
1121 | <file:Documentation/networking/net-modules.txt>. The module | ||
1122 | will be called eepro. | 1094 | will be called eepro. |
1123 | 1095 | ||
1124 | config HPLAN_PLUS | 1096 | config HPLAN_PLUS |
@@ -1130,8 +1102,7 @@ config HPLAN_PLUS | |||
1130 | the Ethernet-HOWTO, available from | 1102 | the Ethernet-HOWTO, available from |
1131 | <http://www.tldp.org/docs.html#howto>. | 1103 | <http://www.tldp.org/docs.html#howto>. |
1132 | 1104 | ||
1133 | To compile this driver as a module, choose M here and read | 1105 | To compile this driver as a module, choose M here. The module |
1134 | <file:Documentation/networking/net-modules.txt>. The module | ||
1135 | will be called hp-plus. | 1106 | will be called hp-plus. |
1136 | 1107 | ||
1137 | config HPLAN | 1108 | config HPLAN |
@@ -1143,8 +1114,7 @@ config HPLAN | |||
1143 | the Ethernet-HOWTO, available from | 1114 | the Ethernet-HOWTO, available from |
1144 | <http://www.tldp.org/docs.html#howto>. | 1115 | <http://www.tldp.org/docs.html#howto>. |
1145 | 1116 | ||
1146 | To compile this driver as a module, choose M here and read | 1117 | To compile this driver as a module, choose M here. The module |
1147 | <file:Documentation/networking/net-modules.txt>. The module | ||
1148 | will be called hp. | 1118 | will be called hp. |
1149 | 1119 | ||
1150 | config LP486E | 1120 | config LP486E |
@@ -1163,8 +1133,7 @@ config ETH16I | |||
1163 | the Ethernet-HOWTO, available from | 1133 | the Ethernet-HOWTO, available from |
1164 | <http://www.tldp.org/docs.html#howto>. | 1134 | <http://www.tldp.org/docs.html#howto>. |
1165 | 1135 | ||
1166 | To compile this driver as a module, choose M here and read | 1136 | To compile this driver as a module, choose M here. The module |
1167 | <file:Documentation/networking/net-modules.txt>. The module | ||
1168 | will be called eth16i. | 1137 | will be called eth16i. |
1169 | 1138 | ||
1170 | config NE2000 | 1139 | config NE2000 |
@@ -1184,8 +1153,7 @@ config NE2000 | |||
1184 | laptops), say N here and Y to "NE/2 (ne2000 MCA version) support", | 1153 | laptops), say N here and Y to "NE/2 (ne2000 MCA version) support", |
1185 | below. | 1154 | below. |
1186 | 1155 | ||
1187 | To compile this driver as a module, choose M here and read | 1156 | To compile this driver as a module, choose M here. The module |
1188 | <file:Documentation/networking/net-modules.txt>. The module | ||
1189 | will be called ne. | 1157 | will be called ne. |
1190 | 1158 | ||
1191 | config ZNET | 1159 | config ZNET |
@@ -1206,8 +1174,7 @@ config SEEQ8005 | |||
1206 | is for you, read the Ethernet-HOWTO, available from | 1174 | is for you, read the Ethernet-HOWTO, available from |
1207 | <http://www.tldp.org/docs.html#howto>. | 1175 | <http://www.tldp.org/docs.html#howto>. |
1208 | 1176 | ||
1209 | To compile this driver as a module, choose M here and read | 1177 | To compile this driver as a module, choose M here. The module |
1210 | <file:Documentation/networking/net-modules.txt>. The module | ||
1211 | will be called seeq8005. | 1178 | will be called seeq8005. |
1212 | 1179 | ||
1213 | config NE2_MCA | 1180 | config NE2_MCA |
@@ -1219,8 +1186,7 @@ config NE2_MCA | |||
1219 | the Ethernet-HOWTO, available from | 1186 | the Ethernet-HOWTO, available from |
1220 | <http://www.tldp.org/docs.html#howto>. | 1187 | <http://www.tldp.org/docs.html#howto>. |
1221 | 1188 | ||
1222 | To compile this driver as a module, choose M here and read | 1189 | To compile this driver as a module, choose M here. The module |
1223 | <file:Documentation/networking/net-modules.txt>. The module | ||
1224 | will be called ne2. | 1190 | will be called ne2. |
1225 | 1191 | ||
1226 | config IBMLANA | 1192 | config IBMLANA |
@@ -1231,8 +1197,7 @@ config IBMLANA | |||
1231 | CONFIG_MCA to use this driver. It is both available as an in-kernel | 1197 | CONFIG_MCA to use this driver. It is both available as an in-kernel |
1232 | driver and as a module. | 1198 | driver and as a module. |
1233 | 1199 | ||
1234 | To compile this driver as a module, choose M here and read | 1200 | To compile this driver as a module, choose M here. The only |
1235 | <file:Documentation/networking/net-modules.txt>. The only | ||
1236 | currently supported card is the IBM LAN Adapter/A for Ethernet. It | 1201 | currently supported card is the IBM LAN Adapter/A for Ethernet. It |
1237 | will both support 16K and 32K memory windows, however a 32K window | 1202 | will both support 16K and 32K memory windows, however a 32K window |
1238 | gives a better security against packet losses. Usage of multiple | 1203 | gives a better security against packet losses. Usage of multiple |
@@ -1246,8 +1211,7 @@ config IBMVETH | |||
1246 | This driver supports virtual ethernet adapters on newer IBM iSeries | 1211 | This driver supports virtual ethernet adapters on newer IBM iSeries |
1247 | and pSeries systems. | 1212 | and pSeries systems. |
1248 | 1213 | ||
1249 | To compile this driver as a module, choose M here and read | 1214 | To compile this driver as a module, choose M here. The module will |
1250 | <file:Documentation/networking/net-modules.txt>. The module will | ||
1251 | be called ibmveth. | 1215 | be called ibmveth. |
1252 | 1216 | ||
1253 | source "drivers/net/ibm_emac/Kconfig" | 1217 | source "drivers/net/ibm_emac/Kconfig" |
@@ -1277,8 +1241,7 @@ config PCNET32 | |||
1277 | answer Y here and read the Ethernet-HOWTO, available from | 1241 | answer Y here and read the Ethernet-HOWTO, available from |
1278 | <http://www.tldp.org/docs.html#howto>. | 1242 | <http://www.tldp.org/docs.html#howto>. |
1279 | 1243 | ||
1280 | To compile this driver as a module, choose M here and read | 1244 | To compile this driver as a module, choose M here. The module |
1281 | <file:Documentation/networking/net-modules.txt>. The module | ||
1282 | will be called pcnet32. | 1245 | will be called pcnet32. |
1283 | 1246 | ||
1284 | config PCNET32_NAPI | 1247 | config PCNET32_NAPI |
@@ -1305,8 +1268,7 @@ config AMD8111_ETH | |||
1305 | answer Y here and read the Ethernet-HOWTO, available from | 1268 | answer Y here and read the Ethernet-HOWTO, available from |
1306 | <http://www.tldp.org/docs.html#howto>. | 1269 | <http://www.tldp.org/docs.html#howto>. |
1307 | 1270 | ||
1308 | To compile this driver as a module, choose M here and read | 1271 | To compile this driver as a module, choose M here. The module |
1309 | <file:Documentation/networking/net-modules.txt>. The module | ||
1310 | will be called amd8111e. | 1272 | will be called amd8111e. |
1311 | 1273 | ||
1312 | config AMD8111E_NAPI | 1274 | config AMD8111E_NAPI |
@@ -1360,8 +1322,7 @@ config AC3200 | |||
1360 | the Ethernet-HOWTO, available from | 1322 | the Ethernet-HOWTO, available from |
1361 | <http://www.tldp.org/docs.html#howto>. | 1323 | <http://www.tldp.org/docs.html#howto>. |
1362 | 1324 | ||
1363 | To compile this driver as a module, choose M here and read | 1325 | To compile this driver as a module, choose M here. The module |
1364 | <file:Documentation/networking/net-modules.txt>. The module | ||
1365 | will be called ac3200. | 1326 | will be called ac3200. |
1366 | 1327 | ||
1367 | config APRICOT | 1328 | config APRICOT |
@@ -1372,9 +1333,8 @@ config APRICOT | |||
1372 | read the Ethernet-HOWTO, available from | 1333 | read the Ethernet-HOWTO, available from |
1373 | <http://www.tldp.org/docs.html#howto>. | 1334 | <http://www.tldp.org/docs.html#howto>. |
1374 | 1335 | ||
1375 | To compile this driver as a module, choose M here and read | 1336 | To compile this driver as a module, choose M here. The module |
1376 | <file:Documentation/networking/net-modules.txt>. The module will be | 1337 | will be called apricot. |
1377 | called apricot. | ||
1378 | 1338 | ||
1379 | config B44 | 1339 | config B44 |
1380 | tristate "Broadcom 440x/47xx ethernet support" | 1340 | tristate "Broadcom 440x/47xx ethernet support" |
@@ -1386,9 +1346,8 @@ config B44 | |||
1386 | or M and read the Ethernet-HOWTO, available from | 1346 | or M and read the Ethernet-HOWTO, available from |
1387 | <http://www.tldp.org/docs.html#howto>. | 1347 | <http://www.tldp.org/docs.html#howto>. |
1388 | 1348 | ||
1389 | To compile this driver as a module, choose M here and read | 1349 | To compile this driver as a module, choose M here. The module |
1390 | <file:Documentation/networking/net-modules.txt>. The module will be | 1350 | will be called b44. |
1391 | called b44. | ||
1392 | 1351 | ||
1393 | # Auto-select SSB PCI-HOST support, if possible | 1352 | # Auto-select SSB PCI-HOST support, if possible |
1394 | config B44_PCI_AUTOSELECT | 1353 | config B44_PCI_AUTOSELECT |
@@ -1417,9 +1376,8 @@ config FORCEDETH | |||
1417 | read the Ethernet-HOWTO, available from | 1376 | read the Ethernet-HOWTO, available from |
1418 | <http://www.tldp.org/docs.html#howto>. | 1377 | <http://www.tldp.org/docs.html#howto>. |
1419 | 1378 | ||
1420 | To compile this driver as a module, choose M here and read | 1379 | To compile this driver as a module, choose M here. The module |
1421 | <file:Documentation/networking/net-modules.txt>. The module will be | 1380 | will be called forcedeth. |
1422 | called forcedeth. | ||
1423 | 1381 | ||
1424 | config FORCEDETH_NAPI | 1382 | config FORCEDETH_NAPI |
1425 | bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" | 1383 | bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" |
@@ -1445,9 +1403,8 @@ config CS89x0 | |||
1445 | <http://www.tldp.org/docs.html#howto> as well as | 1403 | <http://www.tldp.org/docs.html#howto> as well as |
1446 | <file:Documentation/networking/cs89x0.txt>. | 1404 | <file:Documentation/networking/cs89x0.txt>. |
1447 | 1405 | ||
1448 | To compile this driver as a module, choose M here and read | 1406 | To compile this driver as a module, choose M here. The module |
1449 | <file:Documentation/networking/net-modules.txt>. The module will be | 1407 | will be called cs89x0. |
1450 | called cs89x0. | ||
1451 | 1408 | ||
1452 | config TC35815 | 1409 | config TC35815 |
1453 | tristate "TOSHIBA TC35815 Ethernet support" | 1410 | tristate "TOSHIBA TC35815 Ethernet support" |
@@ -1463,8 +1420,7 @@ config EEPRO100 | |||
1463 | card, say Y and read the Ethernet-HOWTO, available from | 1420 | card, say Y and read the Ethernet-HOWTO, available from |
1464 | <http://www.tldp.org/docs.html#howto>. | 1421 | <http://www.tldp.org/docs.html#howto>. |
1465 | 1422 | ||
1466 | To compile this driver as a module, choose M here and read | 1423 | To compile this driver as a module, choose M here. The module |
1467 | <file:Documentation/networking/net-modules.txt>. The module | ||
1468 | will be called eepro100. | 1424 | will be called eepro100. |
1469 | 1425 | ||
1470 | 1426 | ||
@@ -1491,8 +1447,7 @@ config E100 | |||
1491 | More specific information on configuring the driver is in | 1447 | More specific information on configuring the driver is in |
1492 | <file:Documentation/networking/e100.txt>. | 1448 | <file:Documentation/networking/e100.txt>. |
1493 | 1449 | ||
1494 | To compile this driver as a module, choose M here and read | 1450 | To compile this driver as a module, choose M here. The module |
1495 | <file:Documentation/networking/net-modules.txt>. The module | ||
1496 | will be called e100. | 1451 | will be called e100. |
1497 | 1452 | ||
1498 | config LNE390 | 1453 | config LNE390 |
@@ -1504,8 +1459,7 @@ config LNE390 | |||
1504 | the Ethernet-HOWTO, available from | 1459 | the Ethernet-HOWTO, available from |
1505 | <http://www.tldp.org/docs.html#howto>. | 1460 | <http://www.tldp.org/docs.html#howto>. |
1506 | 1461 | ||
1507 | To compile this driver as a module, choose M here and read | 1462 | To compile this driver as a module, choose M here. The module |
1508 | <file:Documentation/networking/net-modules.txt>. The module | ||
1509 | will be called lne390. | 1463 | will be called lne390. |
1510 | 1464 | ||
1511 | config FEALNX | 1465 | config FEALNX |
@@ -1545,8 +1499,7 @@ config NE2K_PCI | |||
1545 | NetVin NV5000SC Via 86C926 SureCom NE34 Winbond | 1499 | NetVin NV5000SC Via 86C926 SureCom NE34 Winbond |
1546 | Holtek HT80232 Holtek HT80229 | 1500 | Holtek HT80232 Holtek HT80229 |
1547 | 1501 | ||
1548 | To compile this driver as a module, choose M here and read | 1502 | To compile this driver as a module, choose M here. The module |
1549 | <file:Documentation/networking/net-modules.txt>. The module | ||
1550 | will be called ne2k-pci. | 1503 | will be called ne2k-pci. |
1551 | 1504 | ||
1552 | config NE3210 | 1505 | config NE3210 |
@@ -1559,8 +1512,7 @@ config NE3210 | |||
1559 | <http://www.tldp.org/docs.html#howto>. Note that this driver | 1512 | <http://www.tldp.org/docs.html#howto>. Note that this driver |
1560 | will NOT WORK for NE3200 cards as they are completely different. | 1513 | will NOT WORK for NE3200 cards as they are completely different. |
1561 | 1514 | ||
1562 | To compile this driver as a module, choose M here and read | 1515 | To compile this driver as a module, choose M here. The module |
1563 | <file:Documentation/networking/net-modules.txt>. The module | ||
1564 | will be called ne3210. | 1516 | will be called ne3210. |
1565 | 1517 | ||
1566 | config ES3210 | 1518 | config ES3210 |
@@ -1572,8 +1524,7 @@ config ES3210 | |||
1572 | the Ethernet-HOWTO, available from | 1524 | the Ethernet-HOWTO, available from |
1573 | <http://www.tldp.org/docs.html#howto>. | 1525 | <http://www.tldp.org/docs.html#howto>. |
1574 | 1526 | ||
1575 | To compile this driver as a module, choose M here and read | 1527 | To compile this driver as a module, choose M here. The module |
1576 | <file:Documentation/networking/net-modules.txt>. The module | ||
1577 | will be called es3210. | 1528 | will be called es3210. |
1578 | 1529 | ||
1579 | config 8139CP | 1530 | config 8139CP |
@@ -1703,8 +1654,7 @@ config TLAN | |||
1703 | Compaq NetFlex and Olicom cards. Please read the file | 1654 | Compaq NetFlex and Olicom cards. Please read the file |
1704 | <file:Documentation/networking/tlan.txt> for more details. | 1655 | <file:Documentation/networking/tlan.txt> for more details. |
1705 | 1656 | ||
1706 | To compile this driver as a module, choose M here and read | 1657 | To compile this driver as a module, choose M here. The module |
1707 | <file:Documentation/networking/net-modules.txt>. The module | ||
1708 | will be called tlan. | 1658 | will be called tlan. |
1709 | 1659 | ||
1710 | Please email feedback to <torben.mathiasen@compaq.com>. | 1660 | Please email feedback to <torben.mathiasen@compaq.com>. |
@@ -1880,6 +1830,28 @@ config FEC2 | |||
1880 | Say Y here if you want to use the second built-in 10/100 Fast | 1830 | Say Y here if you want to use the second built-in 10/100 Fast |
1881 | ethernet controller on some Motorola ColdFire processors. | 1831 | ethernet controller on some Motorola ColdFire processors. |
1882 | 1832 | ||
1833 | config FEC_MPC52xx | ||
1834 | tristate "MPC52xx FEC driver" | ||
1835 | depends on PPC_MERGE && PPC_MPC52xx && PPC_BESTCOMM_FEC | ||
1836 | select CRC32 | ||
1837 | select PHYLIB | ||
1838 | ---help--- | ||
1839 | This option enables support for the MPC5200's on-chip | ||
1840 | Fast Ethernet Controller | ||
1841 | If compiled as module, it will be called 'fec_mpc52xx.ko'. | ||
1842 | |||
1843 | config FEC_MPC52xx_MDIO | ||
1844 | bool "MPC52xx FEC MDIO bus driver" | ||
1845 | depends on FEC_MPC52xx | ||
1846 | default y | ||
1847 | ---help--- | ||
1848 | The MPC5200's FEC can connect to the Ethernet either with | ||
1849 | an external MII PHY chip or 10 Mbps 7-wire interface | ||
1850 | (Motorola? industry standard). | ||
1851 | If your board uses an external PHY connected to FEC, enable this. | ||
1852 | If not sure, enable. | ||
1853 | If compiled as module, it will be called 'fec_mpc52xx_phy.ko'. | ||
1854 | |||
1883 | config NE_H8300 | 1855 | config NE_H8300 |
1884 | tristate "NE2000 compatible support for H8/300" | 1856 | tristate "NE2000 compatible support for H8/300" |
1885 | depends on H8300 | 1857 | depends on H8300 |
@@ -1972,8 +1944,7 @@ config E1000 | |||
1972 | More specific information on configuring the driver is in | 1944 | More specific information on configuring the driver is in |
1973 | <file:Documentation/networking/e1000.txt>. | 1945 | <file:Documentation/networking/e1000.txt>. |
1974 | 1946 | ||
1975 | To compile this driver as a module, choose M here and read | 1947 | To compile this driver as a module, choose M here. The module |
1976 | <file:Documentation/networking/net-modules.txt>. The module | ||
1977 | will be called e1000. | 1948 | will be called e1000. |
1978 | 1949 | ||
1979 | config E1000_NAPI | 1950 | config E1000_NAPI |
@@ -2018,8 +1989,7 @@ config E1000E | |||
2018 | More specific information on configuring the driver is in | 1989 | More specific information on configuring the driver is in |
2019 | <file:Documentation/networking/e1000e.txt>. | 1990 | <file:Documentation/networking/e1000e.txt>. |
2020 | 1991 | ||
2021 | To compile this driver as a module, choose M here and read | 1992 | To compile this driver as a module, choose M here. The module |
2022 | <file:Documentation/networking/net-modules.txt>. The module | ||
2023 | will be called e1000e. | 1993 | will be called e1000e. |
2024 | 1994 | ||
2025 | source "drivers/net/ixp2000/Kconfig" | 1995 | source "drivers/net/ixp2000/Kconfig" |
@@ -2052,8 +2022,7 @@ config HAMACHI | |||
2052 | the Ethernet-HOWTO, available from | 2022 | the Ethernet-HOWTO, available from |
2053 | <http://www.tldp.org/docs.html#howto>. | 2023 | <http://www.tldp.org/docs.html#howto>. |
2054 | 2024 | ||
2055 | To compile this driver as a module, choose M here and read | 2025 | To compile this driver as a module, choose M here. The module will be |
2056 | <file:Documentation/networking/net-modules.txt>. The module will be | ||
2057 | called hamachi. | 2026 | called hamachi. |
2058 | 2027 | ||
2059 | config YELLOWFIN | 2028 | config YELLOWFIN |
@@ -2502,8 +2471,7 @@ config IXGBE | |||
2502 | More specific information on configuring the driver is in | 2471 | More specific information on configuring the driver is in |
2503 | <file:Documentation/networking/ixgbe.txt>. | 2472 | <file:Documentation/networking/ixgbe.txt>. |
2504 | 2473 | ||
2505 | To compile this driver as a module, choose M here and read | 2474 | To compile this driver as a module, choose M here. The module |
2506 | <file:Documentation/networking/net-modules.txt>. The module | ||
2507 | will be called ixgbe. | 2475 | will be called ixgbe. |
2508 | 2476 | ||
2509 | config IXGB | 2477 | config IXGB |
@@ -2525,8 +2493,7 @@ config IXGB | |||
2525 | More specific information on configuring the driver is in | 2493 | More specific information on configuring the driver is in |
2526 | <file:Documentation/networking/ixgb.txt>. | 2494 | <file:Documentation/networking/ixgb.txt>. |
2527 | 2495 | ||
2528 | To compile this driver as a module, choose M here and read | 2496 | To compile this driver as a module, choose M here. The module |
2529 | <file:Documentation/networking/net-modules.txt>. The module | ||
2530 | will be called ixgb. | 2497 | will be called ixgb. |
2531 | 2498 | ||
2532 | config IXGB_NAPI | 2499 | config IXGB_NAPI |
@@ -2579,8 +2546,7 @@ config MYRI10GE | |||
2579 | 2546 | ||
2580 | <http://www.myri.com/scs/download-Myri10GE.html> | 2547 | <http://www.myri.com/scs/download-Myri10GE.html> |
2581 | 2548 | ||
2582 | To compile this driver as a module, choose M here and read | 2549 | To compile this driver as a module, choose M here. The module |
2583 | <file:Documentation/networking/net-modules.txt>. The module | ||
2584 | will be called myri10ge. | 2550 | will be called myri10ge. |
2585 | 2551 | ||
2586 | config NETXEN_NIC | 2552 | config NETXEN_NIC |
@@ -2804,10 +2770,9 @@ config PLIP | |||
2804 | with the PLIP support in Linux versions 1.0.x. This option enlarges | 2770 | with the PLIP support in Linux versions 1.0.x. This option enlarges |
2805 | your kernel by about 8 KB. | 2771 | your kernel by about 8 KB. |
2806 | 2772 | ||
2807 | To compile this driver as a module, choose M here and read | 2773 | To compile this driver as a module, choose M here. The module |
2808 | <file:Documentation/networking/net-modules.txt>. The module will be | 2774 | will be called plip. If unsure, say Y or M, in case you buy |
2809 | called plip. If unsure, say Y or M, in case you buy a laptop | 2775 | a laptop later. |
2810 | later. | ||
2811 | 2776 | ||
2812 | config PPP | 2777 | config PPP |
2813 | tristate "PPP (point-to-point protocol) support" | 2778 | tristate "PPP (point-to-point protocol) support" |
@@ -2837,8 +2802,7 @@ config PPP | |||
2837 | If you said Y to "Version information on all symbols" above, then | 2802 | If you said Y to "Version information on all symbols" above, then |
2838 | you cannot compile the PPP driver into the kernel; you can then only | 2803 | you cannot compile the PPP driver into the kernel; you can then only |
2839 | compile it as a module. To compile this driver as a module, choose M | 2804 | compile it as a module. To compile this driver as a module, choose M |
2840 | here and read <file:Documentation/networking/net-modules.txt>. | 2805 | here. The module will be called ppp_generic. |
2841 | The module will be called ppp_generic. | ||
2842 | 2806 | ||
2843 | config PPP_MULTILINK | 2807 | config PPP_MULTILINK |
2844 | bool "PPP multilink support (EXPERIMENTAL)" | 2808 | bool "PPP multilink support (EXPERIMENTAL)" |
@@ -2999,9 +2963,8 @@ config SLIP | |||
2999 | <http://www.bart.nl/~patrickr/term-howto/Term-HOWTO.html>). SLIP | 2963 | <http://www.bart.nl/~patrickr/term-howto/Term-HOWTO.html>). SLIP |
3000 | support will enlarge your kernel by about 4 KB. If unsure, say N. | 2964 | support will enlarge your kernel by about 4 KB. If unsure, say N. |
3001 | 2965 | ||
3002 | To compile this driver as a module, choose M here and read | 2966 | To compile this driver as a module, choose M here. The module |
3003 | <file:Documentation/networking/net-modules.txt>. The module will be | 2967 | will be called slip. |
3004 | called slip. | ||
3005 | 2968 | ||
3006 | config SLIP_COMPRESSED | 2969 | config SLIP_COMPRESSED |
3007 | bool "CSLIP compressed headers" | 2970 | bool "CSLIP compressed headers" |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 593262065c9b..0e5fde4a1b2c 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -96,6 +96,10 @@ obj-$(CONFIG_SHAPER) += shaper.o | |||
96 | obj-$(CONFIG_HP100) += hp100.o | 96 | obj-$(CONFIG_HP100) += hp100.o |
97 | obj-$(CONFIG_SMC9194) += smc9194.o | 97 | obj-$(CONFIG_SMC9194) += smc9194.o |
98 | obj-$(CONFIG_FEC) += fec.o | 98 | obj-$(CONFIG_FEC) += fec.o |
99 | obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx.o | ||
100 | ifeq ($(CONFIG_FEC_MPC52xx_MDIO),y) | ||
101 | obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx_phy.o | ||
102 | endif | ||
99 | obj-$(CONFIG_68360_ENET) += 68360enet.o | 103 | obj-$(CONFIG_68360_ENET) += 68360enet.o |
100 | obj-$(CONFIG_WD80x3) += wd.o 8390.o | 104 | obj-$(CONFIG_WD80x3) += wd.o 8390.o |
101 | obj-$(CONFIG_EL2) += 3c503.o 8390.o | 105 | obj-$(CONFIG_EL2) += 3c503.o 8390.o |
diff --git a/drivers/net/arcnet/Kconfig b/drivers/net/arcnet/Kconfig index 4030274fe788..3b2f7f115464 100644 --- a/drivers/net/arcnet/Kconfig +++ b/drivers/net/arcnet/Kconfig | |||
@@ -19,8 +19,7 @@ menuconfig ARCNET | |||
19 | from <http://www.tldp.org/docs.html#howto>(even though ARCnet | 19 | from <http://www.tldp.org/docs.html#howto>(even though ARCnet |
20 | is not really Ethernet). | 20 | is not really Ethernet). |
21 | 21 | ||
22 | To compile this driver as a module, choose M here and read | 22 | To compile this driver as a module, choose M here. The module will |
23 | <file:Documentation/networking/net-modules.txt>. The module will | ||
24 | be called arcnet. | 23 | be called arcnet. |
25 | 24 | ||
26 | if ARCNET | 25 | if ARCNET |
@@ -81,8 +80,7 @@ config ARCNET_COM90xx | |||
81 | have always used the old ARCnet driver without knowing what type of | 80 | have always used the old ARCnet driver without knowing what type of |
82 | card you had, this is probably the one for you. | 81 | card you had, this is probably the one for you. |
83 | 82 | ||
84 | To compile this driver as a module, choose M here and read | 83 | To compile this driver as a module, choose M here. The module will |
85 | <file:Documentation/networking/net-modules.txt>. The module will | ||
86 | be called com90xx. | 84 | be called com90xx. |
87 | 85 | ||
88 | config ARCNET_COM90xxIO | 86 | config ARCNET_COM90xxIO |
@@ -93,8 +91,7 @@ config ARCNET_COM90xxIO | |||
93 | the normal driver. Only use it if your card doesn't support shared | 91 | the normal driver. Only use it if your card doesn't support shared |
94 | memory. | 92 | memory. |
95 | 93 | ||
96 | To compile this driver as a module, choose M here and read | 94 | To compile this driver as a module, choose M here. The module will |
97 | <file:Documentation/networking/net-modules.txt>. The module will | ||
98 | be called com90io. | 95 | be called com90io. |
99 | 96 | ||
100 | config ARCNET_RIM_I | 97 | config ARCNET_RIM_I |
@@ -105,8 +102,7 @@ config ARCNET_RIM_I | |||
105 | driver is completely untested, so if you have one of these cards, | 102 | driver is completely untested, so if you have one of these cards, |
106 | please mail <dwmw2@infradead.org>, especially if it works! | 103 | please mail <dwmw2@infradead.org>, especially if it works! |
107 | 104 | ||
108 | To compile this driver as a module, choose M here and read | 105 | To compile this driver as a module, choose M here. The module will |
109 | <file:Documentation/networking/net-modules.txt>. The module will | ||
110 | be called arc-rimi. | 106 | be called arc-rimi. |
111 | 107 | ||
112 | config ARCNET_COM20020 | 108 | config ARCNET_COM20020 |
@@ -116,8 +112,7 @@ config ARCNET_COM20020 | |||
116 | things as promiscuous mode, so packet sniffing is possible, and | 112 | things as promiscuous mode, so packet sniffing is possible, and |
117 | extra diagnostic information. | 113 | extra diagnostic information. |
118 | 114 | ||
119 | To compile this driver as a module, choose M here and read | 115 | To compile this driver as a module, choose M here. The module will |
120 | <file:Documentation/networking/net-modules.txt>. The module will | ||
121 | be called com20020. | 116 | be called com20020. |
122 | 117 | ||
123 | config ARCNET_COM20020_ISA | 118 | config ARCNET_COM20020_ISA |
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c index 7f016f3d5bf0..91a6590d107b 100644 --- a/drivers/net/arm/ep93xx_eth.c +++ b/drivers/net/arm/ep93xx_eth.c | |||
@@ -417,7 +417,7 @@ static irqreturn_t ep93xx_irq(int irq, void *dev_id) | |||
417 | 417 | ||
418 | if (status & REG_INTSTS_RX) { | 418 | if (status & REG_INTSTS_RX) { |
419 | spin_lock(&ep->rx_lock); | 419 | spin_lock(&ep->rx_lock); |
420 | if (likely(__netif_rx_schedule_prep(dev, &ep->napi))) { | 420 | if (likely(netif_rx_schedule_prep(dev, &ep->napi))) { |
421 | wrl(ep, REG_INTEN, REG_INTEN_TX); | 421 | wrl(ep, REG_INTEN, REG_INTEN_TX); |
422 | __netif_rx_schedule(dev, &ep->napi); | 422 | __netif_rx_schedule(dev, &ep->napi); |
423 | } | 423 | } |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 53fe7ded5d50..0b99b5549295 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -371,7 +371,6 @@ static void bf537_adjust_link(struct net_device *dev) | |||
371 | if (phydev->speed != lp->old_speed) { | 371 | if (phydev->speed != lp->old_speed) { |
372 | #if defined(CONFIG_BFIN_MAC_RMII) | 372 | #if defined(CONFIG_BFIN_MAC_RMII) |
373 | u32 opmode = bfin_read_EMAC_OPMODE(); | 373 | u32 opmode = bfin_read_EMAC_OPMODE(); |
374 | bf537mac_disable(); | ||
375 | switch (phydev->speed) { | 374 | switch (phydev->speed) { |
376 | case 10: | 375 | case 10: |
377 | opmode |= RMII_10; | 376 | opmode |= RMII_10; |
@@ -386,7 +385,6 @@ static void bf537_adjust_link(struct net_device *dev) | |||
386 | break; | 385 | break; |
387 | } | 386 | } |
388 | bfin_write_EMAC_OPMODE(opmode); | 387 | bfin_write_EMAC_OPMODE(opmode); |
389 | bf537mac_enable(); | ||
390 | #endif | 388 | #endif |
391 | 389 | ||
392 | new_state = 1; | 390 | new_state = 1; |
@@ -926,7 +924,7 @@ static int __init bf537mac_probe(struct net_device *dev) | |||
926 | if (!is_valid_ether_addr(dev->dev_addr)) { | 924 | if (!is_valid_ether_addr(dev->dev_addr)) { |
927 | /* 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 |
928 | arch/blackfin/mach-bf537/boards/eth_mac.c */ | 926 | arch/blackfin/mach-bf537/boards/eth_mac.c */ |
929 | get_bf537_ether_addr(dev->dev_addr); | 927 | bfin_get_ether_addr(dev->dev_addr); |
930 | } | 928 | } |
931 | 929 | ||
932 | /* 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/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 6937ef0e7275..423298c84a1d 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1847,9 +1847,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1847 | */ | 1847 | */ |
1848 | void bond_destroy(struct bonding *bond) | 1848 | void bond_destroy(struct bonding *bond) |
1849 | { | 1849 | { |
1850 | unregister_netdevice(bond->dev); | ||
1851 | bond_deinit(bond->dev); | 1850 | bond_deinit(bond->dev); |
1852 | bond_destroy_sysfs_entry(bond); | 1851 | bond_destroy_sysfs_entry(bond); |
1852 | unregister_netdevice(bond->dev); | ||
1853 | } | 1853 | } |
1854 | 1854 | ||
1855 | /* | 1855 | /* |
@@ -4405,6 +4405,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params) | |||
4405 | bond_dev->set_multicast_list = bond_set_multicast_list; | 4405 | bond_dev->set_multicast_list = bond_set_multicast_list; |
4406 | bond_dev->change_mtu = bond_change_mtu; | 4406 | bond_dev->change_mtu = bond_change_mtu; |
4407 | bond_dev->set_mac_address = bond_set_mac_address; | 4407 | bond_dev->set_mac_address = bond_set_mac_address; |
4408 | bond_dev->validate_addr = NULL; | ||
4408 | 4409 | ||
4409 | bond_set_mode_ops(bond, bond->params.mode); | 4410 | bond_set_mode_ops(bond, bond->params.mode); |
4410 | 4411 | ||
@@ -4474,8 +4475,8 @@ static void bond_free_all(void) | |||
4474 | bond_mc_list_destroy(bond); | 4475 | bond_mc_list_destroy(bond); |
4475 | /* Release the bonded slaves */ | 4476 | /* Release the bonded slaves */ |
4476 | bond_release_all(bond_dev); | 4477 | bond_release_all(bond_dev); |
4477 | unregister_netdevice(bond_dev); | ||
4478 | bond_deinit(bond_dev); | 4478 | bond_deinit(bond_dev); |
4479 | unregister_netdevice(bond_dev); | ||
4479 | } | 4480 | } |
4480 | 4481 | ||
4481 | #ifdef CONFIG_PROC_FS | 4482 | #ifdef CONFIG_PROC_FS |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 7a06ade85b02..b29330d8e309 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -1193,8 +1193,6 @@ static ssize_t bonding_show_active_slave(struct device *d, | |||
1193 | struct bonding *bond = to_bond(d); | 1193 | struct bonding *bond = to_bond(d); |
1194 | int count; | 1194 | int count; |
1195 | 1195 | ||
1196 | rtnl_lock(); | ||
1197 | |||
1198 | read_lock(&bond->curr_slave_lock); | 1196 | read_lock(&bond->curr_slave_lock); |
1199 | curr = bond->curr_active_slave; | 1197 | curr = bond->curr_active_slave; |
1200 | read_unlock(&bond->curr_slave_lock); | 1198 | read_unlock(&bond->curr_slave_lock); |
@@ -1216,7 +1214,9 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1216 | struct slave *new_active = NULL; | 1214 | struct slave *new_active = NULL; |
1217 | struct bonding *bond = to_bond(d); | 1215 | struct bonding *bond = to_bond(d); |
1218 | 1216 | ||
1217 | rtnl_lock(); | ||
1219 | write_lock_bh(&bond->lock); | 1218 | write_lock_bh(&bond->lock); |
1219 | |||
1220 | if (!USES_PRIMARY(bond->params.mode)) { | 1220 | if (!USES_PRIMARY(bond->params.mode)) { |
1221 | printk(KERN_INFO DRV_NAME | 1221 | printk(KERN_INFO DRV_NAME |
1222 | ": %s: Unable to change active slave; %s is in mode %d\n", | 1222 | ": %s: Unable to change active slave; %s is in mode %d\n", |
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index ffa7e649a6ef..443666292a5c 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -1379,11 +1379,11 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len) | |||
1379 | } | 1379 | } |
1380 | __skb_pull(skb, sizeof(*p)); | 1380 | __skb_pull(skb, sizeof(*p)); |
1381 | 1381 | ||
1382 | skb->dev->last_rx = jiffies; | ||
1383 | st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); | 1382 | st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); |
1384 | st->rx_packets++; | 1383 | st->rx_packets++; |
1385 | 1384 | ||
1386 | skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); | 1385 | skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); |
1386 | skb->dev->last_rx = jiffies; | ||
1387 | if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff && | 1387 | if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff && |
1388 | skb->protocol == htons(ETH_P_IP) && | 1388 | skb->protocol == htons(ETH_P_IP) && |
1389 | (skb->data[9] == IPPROTO_TCP || skb->data[9] == IPPROTO_UDP)) { | 1389 | (skb->data[9] == IPPROTO_TCP || skb->data[9] == IPPROTO_UDP)) { |
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index edd6828f0a78..917b7b46f1a7 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -250,6 +250,7 @@ | |||
250 | #include <asm/system.h> | 250 | #include <asm/system.h> |
251 | #include <asm/ethernet.h> | 251 | #include <asm/ethernet.h> |
252 | #include <asm/cache.h> | 252 | #include <asm/cache.h> |
253 | #include <asm/arch/io_interface_mux.h> | ||
253 | 254 | ||
254 | //#define ETHDEBUG | 255 | //#define ETHDEBUG |
255 | #define D(x) | 256 | #define D(x) |
@@ -279,6 +280,9 @@ struct net_local { | |||
279 | * by this lock as well. | 280 | * by this lock as well. |
280 | */ | 281 | */ |
281 | spinlock_t lock; | 282 | spinlock_t lock; |
283 | |||
284 | spinlock_t led_lock; /* Protect LED state */ | ||
285 | spinlock_t transceiver_lock; /* Protect transceiver state. */ | ||
282 | }; | 286 | }; |
283 | 287 | ||
284 | typedef struct etrax_eth_descr | 288 | typedef struct etrax_eth_descr |
@@ -295,8 +299,6 @@ struct transceiver_ops | |||
295 | void (*check_duplex)(struct net_device* dev); | 299 | void (*check_duplex)(struct net_device* dev); |
296 | }; | 300 | }; |
297 | 301 | ||
298 | struct transceiver_ops* transceiver; | ||
299 | |||
300 | /* Duplex settings */ | 302 | /* Duplex settings */ |
301 | enum duplex | 303 | enum duplex |
302 | { | 304 | { |
@@ -307,7 +309,7 @@ enum duplex | |||
307 | 309 | ||
308 | /* Dma descriptors etc. */ | 310 | /* Dma descriptors etc. */ |
309 | 311 | ||
310 | #define MAX_MEDIA_DATA_SIZE 1518 | 312 | #define MAX_MEDIA_DATA_SIZE 1522 |
311 | 313 | ||
312 | #define MIN_PACKET_LEN 46 | 314 | #define MIN_PACKET_LEN 46 |
313 | #define ETHER_HEAD_LEN 14 | 315 | #define ETHER_HEAD_LEN 14 |
@@ -332,8 +334,8 @@ enum duplex | |||
332 | 334 | ||
333 | /*Intel LXT972A specific*/ | 335 | /*Intel LXT972A specific*/ |
334 | #define MDIO_INT_STATUS_REG_2 0x0011 | 336 | #define MDIO_INT_STATUS_REG_2 0x0011 |
335 | #define MDIO_INT_FULL_DUPLEX_IND ( 1 << 9 ) | 337 | #define MDIO_INT_FULL_DUPLEX_IND (1 << 9) |
336 | #define MDIO_INT_SPEED ( 1 << 14 ) | 338 | #define MDIO_INT_SPEED (1 << 14) |
337 | 339 | ||
338 | /* Network flash constants */ | 340 | /* Network flash constants */ |
339 | #define NET_FLASH_TIME (HZ/50) /* 20 ms */ | 341 | #define NET_FLASH_TIME (HZ/50) /* 20 ms */ |
@@ -344,8 +346,8 @@ enum duplex | |||
344 | #define NO_NETWORK_ACTIVITY 0 | 346 | #define NO_NETWORK_ACTIVITY 0 |
345 | #define NETWORK_ACTIVITY 1 | 347 | #define NETWORK_ACTIVITY 1 |
346 | 348 | ||
347 | #define NBR_OF_RX_DESC 64 | 349 | #define NBR_OF_RX_DESC 32 |
348 | #define NBR_OF_TX_DESC 256 | 350 | #define NBR_OF_TX_DESC 16 |
349 | 351 | ||
350 | /* Large packets are sent directly to upper layers while small packets are */ | 352 | /* Large packets are sent directly to upper layers while small packets are */ |
351 | /* copied (to reduce memory waste). The following constant decides the breakpoint */ | 353 | /* copied (to reduce memory waste). The following constant decides the breakpoint */ |
@@ -367,7 +369,6 @@ enum duplex | |||
367 | static etrax_eth_descr *myNextRxDesc; /* Points to the next descriptor to | 369 | static etrax_eth_descr *myNextRxDesc; /* Points to the next descriptor to |
368 | to be processed */ | 370 | to be processed */ |
369 | static etrax_eth_descr *myLastRxDesc; /* The last processed descriptor */ | 371 | static etrax_eth_descr *myLastRxDesc; /* The last processed descriptor */ |
370 | static etrax_eth_descr *myPrevRxDesc; /* The descriptor right before myNextRxDesc */ | ||
371 | 372 | ||
372 | static etrax_eth_descr RxDescList[NBR_OF_RX_DESC] __attribute__ ((aligned(32))); | 373 | static etrax_eth_descr RxDescList[NBR_OF_RX_DESC] __attribute__ ((aligned(32))); |
373 | 374 | ||
@@ -377,7 +378,6 @@ static etrax_eth_descr* myNextTxDesc; /* Next descriptor to use */ | |||
377 | static etrax_eth_descr TxDescList[NBR_OF_TX_DESC] __attribute__ ((aligned(32))); | 378 | static etrax_eth_descr TxDescList[NBR_OF_TX_DESC] __attribute__ ((aligned(32))); |
378 | 379 | ||
379 | static unsigned int network_rec_config_shadow = 0; | 380 | static unsigned int network_rec_config_shadow = 0; |
380 | static unsigned int mdio_phy_addr; /* Transciever address */ | ||
381 | 381 | ||
382 | static unsigned int network_tr_ctrl_shadow = 0; | 382 | static unsigned int network_tr_ctrl_shadow = 0; |
383 | 383 | ||
@@ -411,7 +411,7 @@ static int e100_set_config(struct net_device* dev, struct ifmap* map); | |||
411 | static void e100_tx_timeout(struct net_device *dev); | 411 | static void e100_tx_timeout(struct net_device *dev); |
412 | static struct net_device_stats *e100_get_stats(struct net_device *dev); | 412 | static struct net_device_stats *e100_get_stats(struct net_device *dev); |
413 | static void set_multicast_list(struct net_device *dev); | 413 | static void set_multicast_list(struct net_device *dev); |
414 | static void e100_hardware_send_packet(char *buf, int length); | 414 | static void e100_hardware_send_packet(struct net_local* np, char *buf, int length); |
415 | static void update_rx_stats(struct net_device_stats *); | 415 | static void update_rx_stats(struct net_device_stats *); |
416 | static void update_tx_stats(struct net_device_stats *); | 416 | static void update_tx_stats(struct net_device_stats *); |
417 | static int e100_probe_transceiver(struct net_device* dev); | 417 | static int e100_probe_transceiver(struct net_device* dev); |
@@ -434,7 +434,10 @@ static void e100_clear_network_leds(unsigned long dummy); | |||
434 | static void e100_set_network_leds(int active); | 434 | static void e100_set_network_leds(int active); |
435 | 435 | ||
436 | static const struct ethtool_ops e100_ethtool_ops; | 436 | static const struct ethtool_ops e100_ethtool_ops; |
437 | 437 | #if defined(CONFIG_ETRAX_NO_PHY) | |
438 | static void dummy_check_speed(struct net_device* dev); | ||
439 | static void dummy_check_duplex(struct net_device* dev); | ||
440 | #else | ||
438 | static void broadcom_check_speed(struct net_device* dev); | 441 | static void broadcom_check_speed(struct net_device* dev); |
439 | static void broadcom_check_duplex(struct net_device* dev); | 442 | static void broadcom_check_duplex(struct net_device* dev); |
440 | static void tdk_check_speed(struct net_device* dev); | 443 | static void tdk_check_speed(struct net_device* dev); |
@@ -443,16 +446,28 @@ static void intel_check_speed(struct net_device* dev); | |||
443 | static void intel_check_duplex(struct net_device* dev); | 446 | static void intel_check_duplex(struct net_device* dev); |
444 | static void generic_check_speed(struct net_device* dev); | 447 | static void generic_check_speed(struct net_device* dev); |
445 | static void generic_check_duplex(struct net_device* dev); | 448 | static void generic_check_duplex(struct net_device* dev); |
449 | #endif | ||
450 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
451 | static void e100_netpoll(struct net_device* dev); | ||
452 | #endif | ||
453 | |||
454 | static int autoneg_normal = 1; | ||
446 | 455 | ||
447 | struct transceiver_ops transceivers[] = | 456 | struct transceiver_ops transceivers[] = |
448 | { | 457 | { |
458 | #if defined(CONFIG_ETRAX_NO_PHY) | ||
459 | {0x0000, dummy_check_speed, dummy_check_duplex} /* Dummy */ | ||
460 | #else | ||
449 | {0x1018, broadcom_check_speed, broadcom_check_duplex}, /* Broadcom */ | 461 | {0x1018, broadcom_check_speed, broadcom_check_duplex}, /* Broadcom */ |
450 | {0xC039, tdk_check_speed, tdk_check_duplex}, /* TDK 2120 */ | 462 | {0xC039, tdk_check_speed, tdk_check_duplex}, /* TDK 2120 */ |
451 | {0x039C, tdk_check_speed, tdk_check_duplex}, /* TDK 2120C */ | 463 | {0x039C, tdk_check_speed, tdk_check_duplex}, /* TDK 2120C */ |
452 | {0x04de, intel_check_speed, intel_check_duplex}, /* Intel LXT972A*/ | 464 | {0x04de, intel_check_speed, intel_check_duplex}, /* Intel LXT972A*/ |
453 | {0x0000, generic_check_speed, generic_check_duplex} /* Generic, must be last */ | 465 | {0x0000, generic_check_speed, generic_check_duplex} /* Generic, must be last */ |
466 | #endif | ||
454 | }; | 467 | }; |
455 | 468 | ||
469 | struct transceiver_ops* transceiver = &transceivers[0]; | ||
470 | |||
456 | #define tx_done(dev) (*R_DMA_CH0_CMD == 0) | 471 | #define tx_done(dev) (*R_DMA_CH0_CMD == 0) |
457 | 472 | ||
458 | /* | 473 | /* |
@@ -471,14 +486,22 @@ etrax_ethernet_init(void) | |||
471 | int i, err; | 486 | int i, err; |
472 | 487 | ||
473 | printk(KERN_INFO | 488 | printk(KERN_INFO |
474 | "ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2003 Axis Communications AB\n"); | 489 | "ETRAX 100LX 10/100MBit ethernet v2.0 (c) 1998-2007 Axis Communications AB\n"); |
475 | 490 | ||
476 | dev = alloc_etherdev(sizeof(struct net_local)); | 491 | if (cris_request_io_interface(if_eth, cardname)) { |
477 | np = dev->priv; | 492 | printk(KERN_CRIT "etrax_ethernet_init failed to get IO interface\n"); |
493 | return -EBUSY; | ||
494 | } | ||
478 | 495 | ||
496 | dev = alloc_etherdev(sizeof(struct net_local)); | ||
479 | if (!dev) | 497 | if (!dev) |
480 | return -ENOMEM; | 498 | return -ENOMEM; |
481 | 499 | ||
500 | np = netdev_priv(dev); | ||
501 | |||
502 | /* we do our own locking */ | ||
503 | dev->features |= NETIF_F_LLTX; | ||
504 | |||
482 | dev->base_addr = (unsigned int)R_NETWORK_SA_0; /* just to have something to show */ | 505 | dev->base_addr = (unsigned int)R_NETWORK_SA_0; /* just to have something to show */ |
483 | 506 | ||
484 | /* now setup our etrax specific stuff */ | 507 | /* now setup our etrax specific stuff */ |
@@ -498,14 +521,22 @@ etrax_ethernet_init(void) | |||
498 | dev->do_ioctl = e100_ioctl; | 521 | dev->do_ioctl = e100_ioctl; |
499 | dev->set_config = e100_set_config; | 522 | dev->set_config = e100_set_config; |
500 | dev->tx_timeout = e100_tx_timeout; | 523 | dev->tx_timeout = e100_tx_timeout; |
524 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
525 | dev->poll_controller = e100_netpoll; | ||
526 | #endif | ||
527 | |||
528 | spin_lock_init(&np->lock); | ||
529 | spin_lock_init(&np->led_lock); | ||
530 | spin_lock_init(&np->transceiver_lock); | ||
501 | 531 | ||
502 | /* Initialise the list of Etrax DMA-descriptors */ | 532 | /* Initialise the list of Etrax DMA-descriptors */ |
503 | 533 | ||
504 | /* Initialise receive descriptors */ | 534 | /* Initialise receive descriptors */ |
505 | 535 | ||
506 | for (i = 0; i < NBR_OF_RX_DESC; i++) { | 536 | for (i = 0; i < NBR_OF_RX_DESC; i++) { |
507 | /* Allocate two extra cachelines to make sure that buffer used by DMA | 537 | /* Allocate two extra cachelines to make sure that buffer used |
508 | * does not share cacheline with any other data (to avoid cache bug) | 538 | * by DMA does not share cacheline with any other data (to |
539 | * avoid cache bug) | ||
509 | */ | 540 | */ |
510 | RxDescList[i].skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES); | 541 | RxDescList[i].skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES); |
511 | if (!RxDescList[i].skb) | 542 | if (!RxDescList[i].skb) |
@@ -541,7 +572,6 @@ etrax_ethernet_init(void) | |||
541 | 572 | ||
542 | myNextRxDesc = &RxDescList[0]; | 573 | myNextRxDesc = &RxDescList[0]; |
543 | myLastRxDesc = &RxDescList[NBR_OF_RX_DESC - 1]; | 574 | myLastRxDesc = &RxDescList[NBR_OF_RX_DESC - 1]; |
544 | myPrevRxDesc = &RxDescList[NBR_OF_RX_DESC - 1]; | ||
545 | myFirstTxDesc = &TxDescList[0]; | 575 | myFirstTxDesc = &TxDescList[0]; |
546 | myNextTxDesc = &TxDescList[0]; | 576 | myNextTxDesc = &TxDescList[0]; |
547 | myLastTxDesc = &TxDescList[NBR_OF_TX_DESC - 1]; | 577 | myLastTxDesc = &TxDescList[NBR_OF_TX_DESC - 1]; |
@@ -562,10 +592,11 @@ etrax_ethernet_init(void) | |||
562 | current_speed = 10; | 592 | current_speed = 10; |
563 | current_speed_selection = 0; /* Auto */ | 593 | current_speed_selection = 0; /* Auto */ |
564 | speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; | 594 | speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; |
565 | duplex_timer.data = (unsigned long)dev; | 595 | speed_timer.data = (unsigned long)dev; |
566 | speed_timer.function = e100_check_speed; | 596 | speed_timer.function = e100_check_speed; |
567 | 597 | ||
568 | clear_led_timer.function = e100_clear_network_leds; | 598 | clear_led_timer.function = e100_clear_network_leds; |
599 | clear_led_timer.data = (unsigned long)dev; | ||
569 | 600 | ||
570 | full_duplex = 0; | 601 | full_duplex = 0; |
571 | current_duplex = autoneg; | 602 | current_duplex = autoneg; |
@@ -574,7 +605,6 @@ etrax_ethernet_init(void) | |||
574 | duplex_timer.function = e100_check_duplex; | 605 | duplex_timer.function = e100_check_duplex; |
575 | 606 | ||
576 | /* Initialize mii interface */ | 607 | /* Initialize mii interface */ |
577 | np->mii_if.phy_id = mdio_phy_addr; | ||
578 | np->mii_if.phy_id_mask = 0x1f; | 608 | np->mii_if.phy_id_mask = 0x1f; |
579 | np->mii_if.reg_num_mask = 0x1f; | 609 | np->mii_if.reg_num_mask = 0x1f; |
580 | np->mii_if.dev = dev; | 610 | np->mii_if.dev = dev; |
@@ -585,6 +615,9 @@ etrax_ethernet_init(void) | |||
585 | /* unwanted addresses are matched */ | 615 | /* unwanted addresses are matched */ |
586 | *R_NETWORK_GA_0 = 0x00000000; | 616 | *R_NETWORK_GA_0 = 0x00000000; |
587 | *R_NETWORK_GA_1 = 0x00000000; | 617 | *R_NETWORK_GA_1 = 0x00000000; |
618 | |||
619 | /* Initialize next time the led can flash */ | ||
620 | led_next_time = jiffies; | ||
588 | return 0; | 621 | return 0; |
589 | } | 622 | } |
590 | 623 | ||
@@ -595,9 +628,9 @@ etrax_ethernet_init(void) | |||
595 | static int | 628 | static int |
596 | e100_set_mac_address(struct net_device *dev, void *p) | 629 | e100_set_mac_address(struct net_device *dev, void *p) |
597 | { | 630 | { |
598 | struct net_local *np = (struct net_local *)dev->priv; | 631 | struct net_local *np = netdev_priv(dev); |
599 | struct sockaddr *addr = p; | 632 | struct sockaddr *addr = p; |
600 | int i; | 633 | DECLARE_MAC_BUF(mac); |
601 | 634 | ||
602 | spin_lock(&np->lock); /* preemption protection */ | 635 | spin_lock(&np->lock); /* preemption protection */ |
603 | 636 | ||
@@ -686,6 +719,25 @@ e100_open(struct net_device *dev) | |||
686 | goto grace_exit2; | 719 | goto grace_exit2; |
687 | } | 720 | } |
688 | 721 | ||
722 | /* | ||
723 | * Always allocate the DMA channels after the IRQ, | ||
724 | * and clean up on failure. | ||
725 | */ | ||
726 | |||
727 | if (cris_request_dma(NETWORK_TX_DMA_NBR, | ||
728 | cardname, | ||
729 | DMA_VERBOSE_ON_ERROR, | ||
730 | dma_eth)) { | ||
731 | goto grace_exit3; | ||
732 | } | ||
733 | |||
734 | if (cris_request_dma(NETWORK_RX_DMA_NBR, | ||
735 | cardname, | ||
736 | DMA_VERBOSE_ON_ERROR, | ||
737 | dma_eth)) { | ||
738 | goto grace_exit4; | ||
739 | } | ||
740 | |||
689 | /* give the HW an idea of what MAC address we want */ | 741 | /* give the HW an idea of what MAC address we want */ |
690 | 742 | ||
691 | *R_NETWORK_SA_0 = dev->dev_addr[0] | (dev->dev_addr[1] << 8) | | 743 | *R_NETWORK_SA_0 = dev->dev_addr[0] | (dev->dev_addr[1] << 8) | |
@@ -700,6 +752,7 @@ e100_open(struct net_device *dev) | |||
700 | 752 | ||
701 | *R_NETWORK_REC_CONFIG = 0xd; /* broadcast rec, individ. rec, ma0 enabled */ | 753 | *R_NETWORK_REC_CONFIG = 0xd; /* broadcast rec, individ. rec, ma0 enabled */ |
702 | #else | 754 | #else |
755 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, max_size, size1522); | ||
703 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, broadcast, receive); | 756 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, broadcast, receive); |
704 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, ma0, enable); | 757 | SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, ma0, enable); |
705 | SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex); | 758 | SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex); |
@@ -719,8 +772,7 @@ e100_open(struct net_device *dev) | |||
719 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, crc, enable); | 772 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, crc, enable); |
720 | *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; | 773 | *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; |
721 | 774 | ||
722 | save_flags(flags); | 775 | local_irq_save(flags); |
723 | cli(); | ||
724 | 776 | ||
725 | /* enable the irq's for ethernet DMA */ | 777 | /* enable the irq's for ethernet DMA */ |
726 | 778 | ||
@@ -752,12 +804,13 @@ e100_open(struct net_device *dev) | |||
752 | 804 | ||
753 | *R_DMA_CH0_FIRST = 0; | 805 | *R_DMA_CH0_FIRST = 0; |
754 | *R_DMA_CH0_DESCR = virt_to_phys(myLastTxDesc); | 806 | *R_DMA_CH0_DESCR = virt_to_phys(myLastTxDesc); |
807 | netif_start_queue(dev); | ||
755 | 808 | ||
756 | restore_flags(flags); | 809 | local_irq_restore(flags); |
757 | 810 | ||
758 | /* Probe for transceiver */ | 811 | /* Probe for transceiver */ |
759 | if (e100_probe_transceiver(dev)) | 812 | if (e100_probe_transceiver(dev)) |
760 | goto grace_exit3; | 813 | goto grace_exit5; |
761 | 814 | ||
762 | /* Start duplex/speed timers */ | 815 | /* Start duplex/speed timers */ |
763 | add_timer(&speed_timer); | 816 | add_timer(&speed_timer); |
@@ -766,10 +819,14 @@ e100_open(struct net_device *dev) | |||
766 | /* We are now ready to accept transmit requeusts from | 819 | /* We are now ready to accept transmit requeusts from |
767 | * the queueing layer of the networking. | 820 | * the queueing layer of the networking. |
768 | */ | 821 | */ |
769 | netif_start_queue(dev); | 822 | netif_carrier_on(dev); |
770 | 823 | ||
771 | return 0; | 824 | return 0; |
772 | 825 | ||
826 | grace_exit5: | ||
827 | cris_free_dma(NETWORK_RX_DMA_NBR, cardname); | ||
828 | grace_exit4: | ||
829 | cris_free_dma(NETWORK_TX_DMA_NBR, cardname); | ||
773 | grace_exit3: | 830 | grace_exit3: |
774 | free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev); | 831 | free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev); |
775 | grace_exit2: | 832 | grace_exit2: |
@@ -780,12 +837,20 @@ grace_exit0: | |||
780 | return -EAGAIN; | 837 | return -EAGAIN; |
781 | } | 838 | } |
782 | 839 | ||
783 | 840 | #if defined(CONFIG_ETRAX_NO_PHY) | |
841 | static void | ||
842 | dummy_check_speed(struct net_device* dev) | ||
843 | { | ||
844 | current_speed = 100; | ||
845 | } | ||
846 | #else | ||
784 | static void | 847 | static void |
785 | generic_check_speed(struct net_device* dev) | 848 | generic_check_speed(struct net_device* dev) |
786 | { | 849 | { |
787 | unsigned long data; | 850 | unsigned long data; |
788 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE); | 851 | struct net_local *np = netdev_priv(dev); |
852 | |||
853 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE); | ||
789 | if ((data & ADVERTISE_100FULL) || | 854 | if ((data & ADVERTISE_100FULL) || |
790 | (data & ADVERTISE_100HALF)) | 855 | (data & ADVERTISE_100HALF)) |
791 | current_speed = 100; | 856 | current_speed = 100; |
@@ -797,7 +862,10 @@ static void | |||
797 | tdk_check_speed(struct net_device* dev) | 862 | tdk_check_speed(struct net_device* dev) |
798 | { | 863 | { |
799 | unsigned long data; | 864 | unsigned long data; |
800 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_TDK_DIAGNOSTIC_REG); | 865 | struct net_local *np = netdev_priv(dev); |
866 | |||
867 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
868 | MDIO_TDK_DIAGNOSTIC_REG); | ||
801 | current_speed = (data & MDIO_TDK_DIAGNOSTIC_RATE ? 100 : 10); | 869 | current_speed = (data & MDIO_TDK_DIAGNOSTIC_RATE ? 100 : 10); |
802 | } | 870 | } |
803 | 871 | ||
@@ -805,7 +873,10 @@ static void | |||
805 | broadcom_check_speed(struct net_device* dev) | 873 | broadcom_check_speed(struct net_device* dev) |
806 | { | 874 | { |
807 | unsigned long data; | 875 | unsigned long data; |
808 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_AUX_CTRL_STATUS_REG); | 876 | struct net_local *np = netdev_priv(dev); |
877 | |||
878 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
879 | MDIO_AUX_CTRL_STATUS_REG); | ||
809 | current_speed = (data & MDIO_BC_SPEED ? 100 : 10); | 880 | current_speed = (data & MDIO_BC_SPEED ? 100 : 10); |
810 | } | 881 | } |
811 | 882 | ||
@@ -813,46 +884,62 @@ static void | |||
813 | intel_check_speed(struct net_device* dev) | 884 | intel_check_speed(struct net_device* dev) |
814 | { | 885 | { |
815 | unsigned long data; | 886 | unsigned long data; |
816 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_INT_STATUS_REG_2); | 887 | struct net_local *np = netdev_priv(dev); |
888 | |||
889 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
890 | MDIO_INT_STATUS_REG_2); | ||
817 | current_speed = (data & MDIO_INT_SPEED ? 100 : 10); | 891 | current_speed = (data & MDIO_INT_SPEED ? 100 : 10); |
818 | } | 892 | } |
819 | 893 | #endif | |
820 | static void | 894 | static void |
821 | e100_check_speed(unsigned long priv) | 895 | e100_check_speed(unsigned long priv) |
822 | { | 896 | { |
823 | struct net_device* dev = (struct net_device*)priv; | 897 | struct net_device* dev = (struct net_device*)priv; |
898 | struct net_local *np = netdev_priv(dev); | ||
824 | static int led_initiated = 0; | 899 | static int led_initiated = 0; |
825 | unsigned long data; | 900 | unsigned long data; |
826 | int old_speed = current_speed; | 901 | int old_speed = current_speed; |
827 | 902 | ||
828 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMSR); | 903 | spin_lock(&np->transceiver_lock); |
904 | |||
905 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMSR); | ||
829 | if (!(data & BMSR_LSTATUS)) { | 906 | if (!(data & BMSR_LSTATUS)) { |
830 | current_speed = 0; | 907 | current_speed = 0; |
831 | } else { | 908 | } else { |
832 | transceiver->check_speed(dev); | 909 | transceiver->check_speed(dev); |
833 | } | 910 | } |
834 | 911 | ||
912 | spin_lock(&np->led_lock); | ||
835 | if ((old_speed != current_speed) || !led_initiated) { | 913 | if ((old_speed != current_speed) || !led_initiated) { |
836 | led_initiated = 1; | 914 | led_initiated = 1; |
837 | e100_set_network_leds(NO_NETWORK_ACTIVITY); | 915 | e100_set_network_leds(NO_NETWORK_ACTIVITY); |
916 | if (current_speed) | ||
917 | netif_carrier_on(dev); | ||
918 | else | ||
919 | netif_carrier_off(dev); | ||
838 | } | 920 | } |
921 | spin_unlock(&np->led_lock); | ||
839 | 922 | ||
840 | /* Reinitialize the timer. */ | 923 | /* Reinitialize the timer. */ |
841 | speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; | 924 | speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; |
842 | add_timer(&speed_timer); | 925 | add_timer(&speed_timer); |
926 | |||
927 | spin_unlock(&np->transceiver_lock); | ||
843 | } | 928 | } |
844 | 929 | ||
845 | static void | 930 | static void |
846 | e100_negotiate(struct net_device* dev) | 931 | e100_negotiate(struct net_device* dev) |
847 | { | 932 | { |
848 | unsigned short data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE); | 933 | struct net_local *np = netdev_priv(dev); |
934 | unsigned short data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
935 | MII_ADVERTISE); | ||
849 | 936 | ||
850 | /* Discard old speed and duplex settings */ | 937 | /* Discard old speed and duplex settings */ |
851 | data &= ~(ADVERTISE_100HALF | ADVERTISE_100FULL | | 938 | data &= ~(ADVERTISE_100HALF | ADVERTISE_100FULL | |
852 | ADVERTISE_10HALF | ADVERTISE_10FULL); | 939 | ADVERTISE_10HALF | ADVERTISE_10FULL); |
853 | 940 | ||
854 | switch (current_speed_selection) { | 941 | switch (current_speed_selection) { |
855 | case 10 : | 942 | case 10: |
856 | if (current_duplex == full) | 943 | if (current_duplex == full) |
857 | data |= ADVERTISE_10FULL; | 944 | data |= ADVERTISE_10FULL; |
858 | else if (current_duplex == half) | 945 | else if (current_duplex == half) |
@@ -861,7 +948,7 @@ e100_negotiate(struct net_device* dev) | |||
861 | data |= ADVERTISE_10HALF | ADVERTISE_10FULL; | 948 | data |= ADVERTISE_10HALF | ADVERTISE_10FULL; |
862 | break; | 949 | break; |
863 | 950 | ||
864 | case 100 : | 951 | case 100: |
865 | if (current_duplex == full) | 952 | if (current_duplex == full) |
866 | data |= ADVERTISE_100FULL; | 953 | data |= ADVERTISE_100FULL; |
867 | else if (current_duplex == half) | 954 | else if (current_duplex == half) |
@@ -870,7 +957,7 @@ e100_negotiate(struct net_device* dev) | |||
870 | data |= ADVERTISE_100HALF | ADVERTISE_100FULL; | 957 | data |= ADVERTISE_100HALF | ADVERTISE_100FULL; |
871 | break; | 958 | break; |
872 | 959 | ||
873 | case 0 : /* Auto */ | 960 | case 0: /* Auto */ |
874 | if (current_duplex == full) | 961 | if (current_duplex == full) |
875 | data |= ADVERTISE_100FULL | ADVERTISE_10FULL; | 962 | data |= ADVERTISE_100FULL | ADVERTISE_10FULL; |
876 | else if (current_duplex == half) | 963 | else if (current_duplex == half) |
@@ -880,35 +967,44 @@ e100_negotiate(struct net_device* dev) | |||
880 | ADVERTISE_100HALF | ADVERTISE_100FULL; | 967 | ADVERTISE_100HALF | ADVERTISE_100FULL; |
881 | break; | 968 | break; |
882 | 969 | ||
883 | default : /* assume autoneg speed and duplex */ | 970 | default: /* assume autoneg speed and duplex */ |
884 | data |= ADVERTISE_10HALF | ADVERTISE_10FULL | | 971 | data |= ADVERTISE_10HALF | ADVERTISE_10FULL | |
885 | ADVERTISE_100HALF | ADVERTISE_100FULL; | 972 | ADVERTISE_100HALF | ADVERTISE_100FULL; |
973 | break; | ||
886 | } | 974 | } |
887 | 975 | ||
888 | e100_set_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE, data); | 976 | e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE, data); |
889 | 977 | ||
890 | /* Renegotiate with link partner */ | 978 | /* Renegotiate with link partner */ |
891 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMCR); | 979 | if (autoneg_normal) { |
980 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR); | ||
892 | data |= BMCR_ANENABLE | BMCR_ANRESTART; | 981 | data |= BMCR_ANENABLE | BMCR_ANRESTART; |
893 | 982 | } | |
894 | e100_set_mdio_reg(dev, mdio_phy_addr, MII_BMCR, data); | 983 | e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR, data); |
895 | } | 984 | } |
896 | 985 | ||
897 | static void | 986 | static void |
898 | e100_set_speed(struct net_device* dev, unsigned long speed) | 987 | e100_set_speed(struct net_device* dev, unsigned long speed) |
899 | { | 988 | { |
989 | struct net_local *np = netdev_priv(dev); | ||
990 | |||
991 | spin_lock(&np->transceiver_lock); | ||
900 | if (speed != current_speed_selection) { | 992 | if (speed != current_speed_selection) { |
901 | current_speed_selection = speed; | 993 | current_speed_selection = speed; |
902 | e100_negotiate(dev); | 994 | e100_negotiate(dev); |
903 | } | 995 | } |
996 | spin_unlock(&np->transceiver_lock); | ||
904 | } | 997 | } |
905 | 998 | ||
906 | static void | 999 | static void |
907 | e100_check_duplex(unsigned long priv) | 1000 | e100_check_duplex(unsigned long priv) |
908 | { | 1001 | { |
909 | struct net_device *dev = (struct net_device *)priv; | 1002 | struct net_device *dev = (struct net_device *)priv; |
910 | struct net_local *np = (struct net_local *)dev->priv; | 1003 | struct net_local *np = netdev_priv(dev); |
911 | int old_duplex = full_duplex; | 1004 | int old_duplex; |
1005 | |||
1006 | spin_lock(&np->transceiver_lock); | ||
1007 | old_duplex = full_duplex; | ||
912 | transceiver->check_duplex(dev); | 1008 | transceiver->check_duplex(dev); |
913 | if (old_duplex != full_duplex) { | 1009 | if (old_duplex != full_duplex) { |
914 | /* Duplex changed */ | 1010 | /* Duplex changed */ |
@@ -920,13 +1016,22 @@ e100_check_duplex(unsigned long priv) | |||
920 | duplex_timer.expires = jiffies + NET_DUPLEX_CHECK_INTERVAL; | 1016 | duplex_timer.expires = jiffies + NET_DUPLEX_CHECK_INTERVAL; |
921 | add_timer(&duplex_timer); | 1017 | add_timer(&duplex_timer); |
922 | np->mii_if.full_duplex = full_duplex; | 1018 | np->mii_if.full_duplex = full_duplex; |
1019 | spin_unlock(&np->transceiver_lock); | ||
923 | } | 1020 | } |
924 | 1021 | #if defined(CONFIG_ETRAX_NO_PHY) | |
1022 | static void | ||
1023 | dummy_check_duplex(struct net_device* dev) | ||
1024 | { | ||
1025 | full_duplex = 1; | ||
1026 | } | ||
1027 | #else | ||
925 | static void | 1028 | static void |
926 | generic_check_duplex(struct net_device* dev) | 1029 | generic_check_duplex(struct net_device* dev) |
927 | { | 1030 | { |
928 | unsigned long data; | 1031 | unsigned long data; |
929 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE); | 1032 | struct net_local *np = netdev_priv(dev); |
1033 | |||
1034 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE); | ||
930 | if ((data & ADVERTISE_10FULL) || | 1035 | if ((data & ADVERTISE_10FULL) || |
931 | (data & ADVERTISE_100FULL)) | 1036 | (data & ADVERTISE_100FULL)) |
932 | full_duplex = 1; | 1037 | full_duplex = 1; |
@@ -938,7 +1043,10 @@ static void | |||
938 | tdk_check_duplex(struct net_device* dev) | 1043 | tdk_check_duplex(struct net_device* dev) |
939 | { | 1044 | { |
940 | unsigned long data; | 1045 | unsigned long data; |
941 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_TDK_DIAGNOSTIC_REG); | 1046 | struct net_local *np = netdev_priv(dev); |
1047 | |||
1048 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
1049 | MDIO_TDK_DIAGNOSTIC_REG); | ||
942 | full_duplex = (data & MDIO_TDK_DIAGNOSTIC_DPLX) ? 1 : 0; | 1050 | full_duplex = (data & MDIO_TDK_DIAGNOSTIC_DPLX) ? 1 : 0; |
943 | } | 1051 | } |
944 | 1052 | ||
@@ -946,7 +1054,10 @@ static void | |||
946 | broadcom_check_duplex(struct net_device* dev) | 1054 | broadcom_check_duplex(struct net_device* dev) |
947 | { | 1055 | { |
948 | unsigned long data; | 1056 | unsigned long data; |
949 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_AUX_CTRL_STATUS_REG); | 1057 | struct net_local *np = netdev_priv(dev); |
1058 | |||
1059 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
1060 | MDIO_AUX_CTRL_STATUS_REG); | ||
950 | full_duplex = (data & MDIO_BC_FULL_DUPLEX_IND) ? 1 : 0; | 1061 | full_duplex = (data & MDIO_BC_FULL_DUPLEX_IND) ? 1 : 0; |
951 | } | 1062 | } |
952 | 1063 | ||
@@ -954,38 +1065,55 @@ static void | |||
954 | intel_check_duplex(struct net_device* dev) | 1065 | intel_check_duplex(struct net_device* dev) |
955 | { | 1066 | { |
956 | unsigned long data; | 1067 | unsigned long data; |
957 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_INT_STATUS_REG_2); | 1068 | struct net_local *np = netdev_priv(dev); |
1069 | |||
1070 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, | ||
1071 | MDIO_INT_STATUS_REG_2); | ||
958 | full_duplex = (data & MDIO_INT_FULL_DUPLEX_IND) ? 1 : 0; | 1072 | full_duplex = (data & MDIO_INT_FULL_DUPLEX_IND) ? 1 : 0; |
959 | } | 1073 | } |
960 | 1074 | #endif | |
961 | static void | 1075 | static void |
962 | e100_set_duplex(struct net_device* dev, enum duplex new_duplex) | 1076 | e100_set_duplex(struct net_device* dev, enum duplex new_duplex) |
963 | { | 1077 | { |
1078 | struct net_local *np = netdev_priv(dev); | ||
1079 | |||
1080 | spin_lock(&np->transceiver_lock); | ||
964 | if (new_duplex != current_duplex) { | 1081 | if (new_duplex != current_duplex) { |
965 | current_duplex = new_duplex; | 1082 | current_duplex = new_duplex; |
966 | e100_negotiate(dev); | 1083 | e100_negotiate(dev); |
967 | } | 1084 | } |
1085 | spin_unlock(&np->transceiver_lock); | ||
968 | } | 1086 | } |
969 | 1087 | ||
970 | static int | 1088 | static int |
971 | e100_probe_transceiver(struct net_device* dev) | 1089 | e100_probe_transceiver(struct net_device* dev) |
972 | { | 1090 | { |
1091 | int ret = 0; | ||
1092 | |||
1093 | #if !defined(CONFIG_ETRAX_NO_PHY) | ||
973 | unsigned int phyid_high; | 1094 | unsigned int phyid_high; |
974 | unsigned int phyid_low; | 1095 | unsigned int phyid_low; |
975 | unsigned int oui; | 1096 | unsigned int oui; |
976 | struct transceiver_ops* ops = NULL; | 1097 | struct transceiver_ops* ops = NULL; |
1098 | struct net_local *np = netdev_priv(dev); | ||
1099 | |||
1100 | spin_lock(&np->transceiver_lock); | ||
977 | 1101 | ||
978 | /* Probe MDIO physical address */ | 1102 | /* Probe MDIO physical address */ |
979 | for (mdio_phy_addr = 0; mdio_phy_addr <= 31; mdio_phy_addr++) { | 1103 | for (np->mii_if.phy_id = 0; np->mii_if.phy_id <= 31; |
980 | if (e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMSR) != 0xffff) | 1104 | np->mii_if.phy_id++) { |
1105 | if (e100_get_mdio_reg(dev, | ||
1106 | np->mii_if.phy_id, MII_BMSR) != 0xffff) | ||
981 | break; | 1107 | break; |
982 | } | 1108 | } |
983 | if (mdio_phy_addr == 32) | 1109 | if (np->mii_if.phy_id == 32) { |
984 | return -ENODEV; | 1110 | ret = -ENODEV; |
1111 | goto out; | ||
1112 | } | ||
985 | 1113 | ||
986 | /* Get manufacturer */ | 1114 | /* Get manufacturer */ |
987 | phyid_high = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID1); | 1115 | phyid_high = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_PHYSID1); |
988 | phyid_low = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID2); | 1116 | phyid_low = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_PHYSID2); |
989 | oui = (phyid_high << 6) | (phyid_low >> 10); | 1117 | oui = (phyid_high << 6) | (phyid_low >> 10); |
990 | 1118 | ||
991 | for (ops = &transceivers[0]; ops->oui; ops++) { | 1119 | for (ops = &transceivers[0]; ops->oui; ops++) { |
@@ -993,8 +1121,10 @@ e100_probe_transceiver(struct net_device* dev) | |||
993 | break; | 1121 | break; |
994 | } | 1122 | } |
995 | transceiver = ops; | 1123 | transceiver = ops; |
996 | 1124 | out: | |
997 | return 0; | 1125 | spin_unlock(&np->transceiver_lock); |
1126 | #endif | ||
1127 | return ret; | ||
998 | } | 1128 | } |
999 | 1129 | ||
1000 | static int | 1130 | static int |
@@ -1088,13 +1218,14 @@ e100_receive_mdio_bit() | |||
1088 | static void | 1218 | static void |
1089 | e100_reset_transceiver(struct net_device* dev) | 1219 | e100_reset_transceiver(struct net_device* dev) |
1090 | { | 1220 | { |
1221 | struct net_local *np = netdev_priv(dev); | ||
1091 | unsigned short cmd; | 1222 | unsigned short cmd; |
1092 | unsigned short data; | 1223 | unsigned short data; |
1093 | int bitCounter; | 1224 | int bitCounter; |
1094 | 1225 | ||
1095 | data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMCR); | 1226 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR); |
1096 | 1227 | ||
1097 | cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (mdio_phy_addr << 7) | (MII_BMCR << 2); | 1228 | cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (np->mii_if.phy_id << 7) | (MII_BMCR << 2); |
1098 | 1229 | ||
1099 | e100_send_mdio_cmd(cmd, 1); | 1230 | e100_send_mdio_cmd(cmd, 1); |
1100 | 1231 | ||
@@ -1112,7 +1243,7 @@ e100_reset_transceiver(struct net_device* dev) | |||
1112 | static void | 1243 | static void |
1113 | e100_tx_timeout(struct net_device *dev) | 1244 | e100_tx_timeout(struct net_device *dev) |
1114 | { | 1245 | { |
1115 | struct net_local *np = (struct net_local *)dev->priv; | 1246 | struct net_local *np = netdev_priv(dev); |
1116 | unsigned long flags; | 1247 | unsigned long flags; |
1117 | 1248 | ||
1118 | spin_lock_irqsave(&np->lock, flags); | 1249 | spin_lock_irqsave(&np->lock, flags); |
@@ -1134,8 +1265,7 @@ e100_tx_timeout(struct net_device *dev) | |||
1134 | e100_reset_transceiver(dev); | 1265 | e100_reset_transceiver(dev); |
1135 | 1266 | ||
1136 | /* and get rid of the packets that never got an interrupt */ | 1267 | /* and get rid of the packets that never got an interrupt */ |
1137 | while (myFirstTxDesc != myNextTxDesc) | 1268 | while (myFirstTxDesc != myNextTxDesc) { |
1138 | { | ||
1139 | dev_kfree_skb(myFirstTxDesc->skb); | 1269 | dev_kfree_skb(myFirstTxDesc->skb); |
1140 | myFirstTxDesc->skb = 0; | 1270 | myFirstTxDesc->skb = 0; |
1141 | myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next); | 1271 | myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next); |
@@ -1161,7 +1291,7 @@ e100_tx_timeout(struct net_device *dev) | |||
1161 | static int | 1291 | static int |
1162 | e100_send_packet(struct sk_buff *skb, struct net_device *dev) | 1292 | e100_send_packet(struct sk_buff *skb, struct net_device *dev) |
1163 | { | 1293 | { |
1164 | struct net_local *np = (struct net_local *)dev->priv; | 1294 | struct net_local *np = netdev_priv(dev); |
1165 | unsigned char *buf = skb->data; | 1295 | unsigned char *buf = skb->data; |
1166 | unsigned long flags; | 1296 | unsigned long flags; |
1167 | 1297 | ||
@@ -1174,7 +1304,7 @@ e100_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1174 | 1304 | ||
1175 | dev->trans_start = jiffies; | 1305 | dev->trans_start = jiffies; |
1176 | 1306 | ||
1177 | e100_hardware_send_packet(buf, skb->len); | 1307 | e100_hardware_send_packet(np, buf, skb->len); |
1178 | 1308 | ||
1179 | myNextTxDesc = phys_to_virt(myNextTxDesc->descr.next); | 1309 | myNextTxDesc = phys_to_virt(myNextTxDesc->descr.next); |
1180 | 1310 | ||
@@ -1197,13 +1327,15 @@ static irqreturn_t | |||
1197 | e100rxtx_interrupt(int irq, void *dev_id) | 1327 | e100rxtx_interrupt(int irq, void *dev_id) |
1198 | { | 1328 | { |
1199 | struct net_device *dev = (struct net_device *)dev_id; | 1329 | struct net_device *dev = (struct net_device *)dev_id; |
1200 | struct net_local *np = (struct net_local *)dev->priv; | 1330 | struct net_local *np = netdev_priv(dev); |
1201 | unsigned long irqbits = *R_IRQ_MASK2_RD; | 1331 | unsigned long irqbits; |
1202 | 1332 | ||
1203 | /* Disable RX/TX IRQs to avoid reentrancy */ | 1333 | /* |
1204 | *R_IRQ_MASK2_CLR = | 1334 | * Note that both rx and tx interrupts are blocked at this point, |
1205 | IO_STATE(R_IRQ_MASK2_CLR, dma0_eop, clr) | | 1335 | * regardless of which got us here. |
1206 | IO_STATE(R_IRQ_MASK2_CLR, dma1_eop, clr); | 1336 | */ |
1337 | |||
1338 | irqbits = *R_IRQ_MASK2_RD; | ||
1207 | 1339 | ||
1208 | /* Handle received packets */ | 1340 | /* Handle received packets */ |
1209 | if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma1_eop, active)) { | 1341 | if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma1_eop, active)) { |
@@ -1219,7 +1351,7 @@ e100rxtx_interrupt(int irq, void *dev_id) | |||
1219 | * allocate a new buffer to put a packet in. | 1351 | * allocate a new buffer to put a packet in. |
1220 | */ | 1352 | */ |
1221 | e100_rx(dev); | 1353 | e100_rx(dev); |
1222 | ((struct net_local *)dev->priv)->stats.rx_packets++; | 1354 | np->stats.rx_packets++; |
1223 | /* restart/continue on the channel, for safety */ | 1355 | /* restart/continue on the channel, for safety */ |
1224 | *R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, restart); | 1356 | *R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, restart); |
1225 | /* clear dma channel 1 eop/descr irq bits */ | 1357 | /* clear dma channel 1 eop/descr irq bits */ |
@@ -1233,9 +1365,8 @@ e100rxtx_interrupt(int irq, void *dev_id) | |||
1233 | } | 1365 | } |
1234 | 1366 | ||
1235 | /* Report any packets that have been sent */ | 1367 | /* Report any packets that have been sent */ |
1236 | while (myFirstTxDesc != phys_to_virt(*R_DMA_CH0_FIRST) && | 1368 | while (virt_to_phys(myFirstTxDesc) != *R_DMA_CH0_FIRST && |
1237 | myFirstTxDesc != myNextTxDesc) | 1369 | (netif_queue_stopped(dev) || myFirstTxDesc != myNextTxDesc)) { |
1238 | { | ||
1239 | np->stats.tx_bytes += myFirstTxDesc->skb->len; | 1370 | np->stats.tx_bytes += myFirstTxDesc->skb->len; |
1240 | np->stats.tx_packets++; | 1371 | np->stats.tx_packets++; |
1241 | 1372 | ||
@@ -1244,19 +1375,15 @@ e100rxtx_interrupt(int irq, void *dev_id) | |||
1244 | dev_kfree_skb_irq(myFirstTxDesc->skb); | 1375 | dev_kfree_skb_irq(myFirstTxDesc->skb); |
1245 | myFirstTxDesc->skb = 0; | 1376 | myFirstTxDesc->skb = 0; |
1246 | myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next); | 1377 | myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next); |
1378 | /* Wake up queue. */ | ||
1379 | netif_wake_queue(dev); | ||
1247 | } | 1380 | } |
1248 | 1381 | ||
1249 | if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma0_eop, active)) { | 1382 | if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma0_eop, active)) { |
1250 | /* acknowledge the eop interrupt and wake up queue */ | 1383 | /* acknowledge the eop interrupt. */ |
1251 | *R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do); | 1384 | *R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do); |
1252 | netif_wake_queue(dev); | ||
1253 | } | 1385 | } |
1254 | 1386 | ||
1255 | /* Enable RX/TX IRQs again */ | ||
1256 | *R_IRQ_MASK2_SET = | ||
1257 | IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set) | | ||
1258 | IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set); | ||
1259 | |||
1260 | return IRQ_HANDLED; | 1387 | return IRQ_HANDLED; |
1261 | } | 1388 | } |
1262 | 1389 | ||
@@ -1264,7 +1391,7 @@ static irqreturn_t | |||
1264 | e100nw_interrupt(int irq, void *dev_id) | 1391 | e100nw_interrupt(int irq, void *dev_id) |
1265 | { | 1392 | { |
1266 | struct net_device *dev = (struct net_device *)dev_id; | 1393 | struct net_device *dev = (struct net_device *)dev_id; |
1267 | struct net_local *np = (struct net_local *)dev->priv; | 1394 | struct net_local *np = netdev_priv(dev); |
1268 | unsigned long irqbits = *R_IRQ_MASK0_RD; | 1395 | unsigned long irqbits = *R_IRQ_MASK0_RD; |
1269 | 1396 | ||
1270 | /* check for underrun irq */ | 1397 | /* check for underrun irq */ |
@@ -1286,7 +1413,6 @@ e100nw_interrupt(int irq, void *dev_id) | |||
1286 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr); | 1413 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr); |
1287 | *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; | 1414 | *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; |
1288 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop); | 1415 | SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop); |
1289 | *R_NETWORK_TR_CTRL = IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr); | ||
1290 | np->stats.tx_errors++; | 1416 | np->stats.tx_errors++; |
1291 | D(printk("ethernet excessive collisions!\n")); | 1417 | D(printk("ethernet excessive collisions!\n")); |
1292 | } | 1418 | } |
@@ -1299,12 +1425,13 @@ e100_rx(struct net_device *dev) | |||
1299 | { | 1425 | { |
1300 | struct sk_buff *skb; | 1426 | struct sk_buff *skb; |
1301 | int length = 0; | 1427 | int length = 0; |
1302 | struct net_local *np = (struct net_local *)dev->priv; | 1428 | struct net_local *np = netdev_priv(dev); |
1303 | unsigned char *skb_data_ptr; | 1429 | unsigned char *skb_data_ptr; |
1304 | #ifdef ETHDEBUG | 1430 | #ifdef ETHDEBUG |
1305 | int i; | 1431 | int i; |
1306 | #endif | 1432 | #endif |
1307 | 1433 | etrax_eth_descr *prevRxDesc; /* The descriptor right before myNextRxDesc */ | |
1434 | spin_lock(&np->led_lock); | ||
1308 | if (!led_active && time_after(jiffies, led_next_time)) { | 1435 | if (!led_active && time_after(jiffies, led_next_time)) { |
1309 | /* light the network leds depending on the current speed. */ | 1436 | /* light the network leds depending on the current speed. */ |
1310 | e100_set_network_leds(NETWORK_ACTIVITY); | 1437 | e100_set_network_leds(NETWORK_ACTIVITY); |
@@ -1314,9 +1441,10 @@ e100_rx(struct net_device *dev) | |||
1314 | led_active = 1; | 1441 | led_active = 1; |
1315 | mod_timer(&clear_led_timer, jiffies + HZ/10); | 1442 | mod_timer(&clear_led_timer, jiffies + HZ/10); |
1316 | } | 1443 | } |
1444 | spin_unlock(&np->led_lock); | ||
1317 | 1445 | ||
1318 | length = myNextRxDesc->descr.hw_len - 4; | 1446 | length = myNextRxDesc->descr.hw_len - 4; |
1319 | ((struct net_local *)dev->priv)->stats.rx_bytes += length; | 1447 | np->stats.rx_bytes += length; |
1320 | 1448 | ||
1321 | #ifdef ETHDEBUG | 1449 | #ifdef ETHDEBUG |
1322 | printk("Got a packet of length %d:\n", length); | 1450 | printk("Got a packet of length %d:\n", length); |
@@ -1336,7 +1464,7 @@ e100_rx(struct net_device *dev) | |||
1336 | if (!skb) { | 1464 | if (!skb) { |
1337 | np->stats.rx_errors++; | 1465 | np->stats.rx_errors++; |
1338 | printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); | 1466 | printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); |
1339 | return; | 1467 | goto update_nextrxdesc; |
1340 | } | 1468 | } |
1341 | 1469 | ||
1342 | skb_put(skb, length - ETHER_HEAD_LEN); /* allocate room for the packet body */ | 1470 | skb_put(skb, length - ETHER_HEAD_LEN); /* allocate room for the packet body */ |
@@ -1354,15 +1482,15 @@ e100_rx(struct net_device *dev) | |||
1354 | else { | 1482 | else { |
1355 | /* Large packet, send directly to upper layers and allocate new | 1483 | /* Large packet, send directly to upper layers and allocate new |
1356 | * memory (aligned to cache line boundary to avoid bug). | 1484 | * memory (aligned to cache line boundary to avoid bug). |
1357 | * Before sending the skb to upper layers we must make sure that | 1485 | * Before sending the skb to upper layers we must make sure |
1358 | * skb->data points to the aligned start of the packet. | 1486 | * that skb->data points to the aligned start of the packet. |
1359 | */ | 1487 | */ |
1360 | int align; | 1488 | int align; |
1361 | struct sk_buff *new_skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES); | 1489 | struct sk_buff *new_skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES); |
1362 | if (!new_skb) { | 1490 | if (!new_skb) { |
1363 | np->stats.rx_errors++; | 1491 | np->stats.rx_errors++; |
1364 | printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); | 1492 | printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); |
1365 | return; | 1493 | goto update_nextrxdesc; |
1366 | } | 1494 | } |
1367 | skb = myNextRxDesc->skb; | 1495 | skb = myNextRxDesc->skb; |
1368 | align = (int)phys_to_virt(myNextRxDesc->descr.buf) - (int)skb->data; | 1496 | align = (int)phys_to_virt(myNextRxDesc->descr.buf) - (int)skb->data; |
@@ -1377,9 +1505,10 @@ e100_rx(struct net_device *dev) | |||
1377 | /* Send the packet to the upper layers */ | 1505 | /* Send the packet to the upper layers */ |
1378 | netif_rx(skb); | 1506 | netif_rx(skb); |
1379 | 1507 | ||
1508 | update_nextrxdesc: | ||
1380 | /* Prepare for next packet */ | 1509 | /* Prepare for next packet */ |
1381 | myNextRxDesc->descr.status = 0; | 1510 | myNextRxDesc->descr.status = 0; |
1382 | myPrevRxDesc = myNextRxDesc; | 1511 | prevRxDesc = myNextRxDesc; |
1383 | myNextRxDesc = phys_to_virt(myNextRxDesc->descr.next); | 1512 | myNextRxDesc = phys_to_virt(myNextRxDesc->descr.next); |
1384 | 1513 | ||
1385 | rx_queue_len++; | 1514 | rx_queue_len++; |
@@ -1387,9 +1516,9 @@ e100_rx(struct net_device *dev) | |||
1387 | /* Check if descriptors should be returned */ | 1516 | /* Check if descriptors should be returned */ |
1388 | if (rx_queue_len == RX_QUEUE_THRESHOLD) { | 1517 | if (rx_queue_len == RX_QUEUE_THRESHOLD) { |
1389 | flush_etrax_cache(); | 1518 | flush_etrax_cache(); |
1390 | myPrevRxDesc->descr.ctrl |= d_eol; | 1519 | prevRxDesc->descr.ctrl |= d_eol; |
1391 | myLastRxDesc->descr.ctrl &= ~d_eol; | 1520 | myLastRxDesc->descr.ctrl &= ~d_eol; |
1392 | myLastRxDesc = myPrevRxDesc; | 1521 | myLastRxDesc = prevRxDesc; |
1393 | rx_queue_len = 0; | 1522 | rx_queue_len = 0; |
1394 | } | 1523 | } |
1395 | } | 1524 | } |
@@ -1398,7 +1527,7 @@ e100_rx(struct net_device *dev) | |||
1398 | static int | 1527 | static int |
1399 | e100_close(struct net_device *dev) | 1528 | e100_close(struct net_device *dev) |
1400 | { | 1529 | { |
1401 | struct net_local *np = (struct net_local *)dev->priv; | 1530 | struct net_local *np = netdev_priv(dev); |
1402 | 1531 | ||
1403 | printk(KERN_INFO "Closing %s.\n", dev->name); | 1532 | printk(KERN_INFO "Closing %s.\n", dev->name); |
1404 | 1533 | ||
@@ -1426,6 +1555,9 @@ e100_close(struct net_device *dev) | |||
1426 | free_irq(NETWORK_DMA_TX_IRQ_NBR, (void *)dev); | 1555 | free_irq(NETWORK_DMA_TX_IRQ_NBR, (void *)dev); |
1427 | free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev); | 1556 | free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev); |
1428 | 1557 | ||
1558 | cris_free_dma(NETWORK_TX_DMA_NBR, cardname); | ||
1559 | cris_free_dma(NETWORK_RX_DMA_NBR, cardname); | ||
1560 | |||
1429 | /* Update the statistics here. */ | 1561 | /* Update the statistics here. */ |
1430 | 1562 | ||
1431 | update_rx_stats(&np->stats); | 1563 | update_rx_stats(&np->stats); |
@@ -1443,18 +1575,11 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1443 | { | 1575 | { |
1444 | struct mii_ioctl_data *data = if_mii(ifr); | 1576 | struct mii_ioctl_data *data = if_mii(ifr); |
1445 | struct net_local *np = netdev_priv(dev); | 1577 | struct net_local *np = netdev_priv(dev); |
1578 | int rc = 0; | ||
1579 | int old_autoneg; | ||
1446 | 1580 | ||
1447 | spin_lock(&np->lock); /* Preempt protection */ | 1581 | spin_lock(&np->lock); /* Preempt protection */ |
1448 | switch (cmd) { | 1582 | switch (cmd) { |
1449 | case SIOCGMIIPHY: /* Get PHY address */ | ||
1450 | data->phy_id = mdio_phy_addr; | ||
1451 | break; | ||
1452 | case SIOCGMIIREG: /* Read MII register */ | ||
1453 | data->val_out = e100_get_mdio_reg(dev, mdio_phy_addr, data->reg_num); | ||
1454 | break; | ||
1455 | case SIOCSMIIREG: /* Write MII register */ | ||
1456 | e100_set_mdio_reg(dev, mdio_phy_addr, data->reg_num, data->val_in); | ||
1457 | break; | ||
1458 | /* The ioctls below should be considered obsolete but are */ | 1583 | /* The ioctls below should be considered obsolete but are */ |
1459 | /* still present for compatability with old scripts/apps */ | 1584 | /* still present for compatability with old scripts/apps */ |
1460 | case SET_ETH_SPEED_10: /* 10 Mbps */ | 1585 | case SET_ETH_SPEED_10: /* 10 Mbps */ |
@@ -1463,60 +1588,47 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1463 | case SET_ETH_SPEED_100: /* 100 Mbps */ | 1588 | case SET_ETH_SPEED_100: /* 100 Mbps */ |
1464 | e100_set_speed(dev, 100); | 1589 | e100_set_speed(dev, 100); |
1465 | break; | 1590 | break; |
1466 | case SET_ETH_SPEED_AUTO: /* Auto negotiate speed */ | 1591 | case SET_ETH_SPEED_AUTO: /* Auto-negotiate speed */ |
1467 | e100_set_speed(dev, 0); | 1592 | e100_set_speed(dev, 0); |
1468 | break; | 1593 | break; |
1469 | case SET_ETH_DUPLEX_HALF: /* Half duplex. */ | 1594 | case SET_ETH_DUPLEX_HALF: /* Half duplex */ |
1470 | e100_set_duplex(dev, half); | 1595 | e100_set_duplex(dev, half); |
1471 | break; | 1596 | break; |
1472 | case SET_ETH_DUPLEX_FULL: /* Full duplex. */ | 1597 | case SET_ETH_DUPLEX_FULL: /* Full duplex */ |
1473 | e100_set_duplex(dev, full); | 1598 | e100_set_duplex(dev, full); |
1474 | break; | 1599 | break; |
1475 | case SET_ETH_DUPLEX_AUTO: /* Autonegotiate duplex*/ | 1600 | case SET_ETH_DUPLEX_AUTO: /* Auto-negotiate duplex */ |
1476 | e100_set_duplex(dev, autoneg); | 1601 | e100_set_duplex(dev, autoneg); |
1477 | break; | 1602 | break; |
1603 | case SET_ETH_AUTONEG: | ||
1604 | old_autoneg = autoneg_normal; | ||
1605 | autoneg_normal = *(int*)data; | ||
1606 | if (autoneg_normal != old_autoneg) | ||
1607 | e100_negotiate(dev); | ||
1608 | break; | ||
1478 | default: | 1609 | default: |
1479 | return -EINVAL; | 1610 | rc = generic_mii_ioctl(&np->mii_if, if_mii(ifr), |
1611 | cmd, NULL); | ||
1612 | break; | ||
1480 | } | 1613 | } |
1481 | spin_unlock(&np->lock); | 1614 | spin_unlock(&np->lock); |
1482 | return 0; | 1615 | return rc; |
1483 | } | 1616 | } |
1484 | 1617 | ||
1485 | static int e100_set_settings(struct net_device *dev, | 1618 | static int e100_get_settings(struct net_device *dev, |
1486 | struct ethtool_cmd *ecmd) | 1619 | struct ethtool_cmd *cmd) |
1487 | { | 1620 | { |
1488 | ecmd->supported = SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII | | 1621 | struct net_local *np = netdev_priv(dev); |
1489 | SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | | 1622 | int err; |
1490 | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full; | ||
1491 | ecmd->port = PORT_TP; | ||
1492 | ecmd->transceiver = XCVR_EXTERNAL; | ||
1493 | ecmd->phy_address = mdio_phy_addr; | ||
1494 | ecmd->speed = current_speed; | ||
1495 | ecmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; | ||
1496 | ecmd->advertising = ADVERTISED_TP; | ||
1497 | 1623 | ||
1498 | if (current_duplex == autoneg && current_speed_selection == 0) | 1624 | spin_lock_irq(&np->lock); |
1499 | ecmd->advertising |= ADVERTISED_Autoneg; | 1625 | err = mii_ethtool_gset(&np->mii_if, cmd); |
1500 | else { | 1626 | spin_unlock_irq(&np->lock); |
1501 | ecmd->advertising |= | ||
1502 | ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | ||
1503 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; | ||
1504 | if (current_speed_selection == 10) | ||
1505 | ecmd->advertising &= ~(ADVERTISED_100baseT_Half | | ||
1506 | ADVERTISED_100baseT_Full); | ||
1507 | else if (current_speed_selection == 100) | ||
1508 | ecmd->advertising &= ~(ADVERTISED_10baseT_Half | | ||
1509 | ADVERTISED_10baseT_Full); | ||
1510 | if (current_duplex == half) | ||
1511 | ecmd->advertising &= ~(ADVERTISED_10baseT_Full | | ||
1512 | ADVERTISED_100baseT_Full); | ||
1513 | else if (current_duplex == full) | ||
1514 | ecmd->advertising &= ~(ADVERTISED_10baseT_Half | | ||
1515 | ADVERTISED_100baseT_Half); | ||
1516 | } | ||
1517 | 1627 | ||
1518 | ecmd->autoneg = AUTONEG_ENABLE; | 1628 | /* The PHY may support 1000baseT, but the Etrax100 does not. */ |
1519 | return 0; | 1629 | cmd->supported &= ~(SUPPORTED_1000baseT_Half |
1630 | | SUPPORTED_1000baseT_Full); | ||
1631 | return err; | ||
1520 | } | 1632 | } |
1521 | 1633 | ||
1522 | static int e100_set_settings(struct net_device *dev, | 1634 | static int e100_set_settings(struct net_device *dev, |
@@ -1560,7 +1672,8 @@ static const struct ethtool_ops e100_ethtool_ops = { | |||
1560 | static int | 1672 | static int |
1561 | e100_set_config(struct net_device *dev, struct ifmap *map) | 1673 | e100_set_config(struct net_device *dev, struct ifmap *map) |
1562 | { | 1674 | { |
1563 | struct net_local *np = (struct net_local *)dev->priv; | 1675 | struct net_local *np = netdev_priv(dev); |
1676 | |||
1564 | spin_lock(&np->lock); /* Preempt protection */ | 1677 | spin_lock(&np->lock); /* Preempt protection */ |
1565 | 1678 | ||
1566 | switch(map->port) { | 1679 | switch(map->port) { |
@@ -1612,7 +1725,6 @@ update_tx_stats(struct net_device_stats *es) | |||
1612 | es->collisions += | 1725 | es->collisions += |
1613 | IO_EXTRACT(R_TR_COUNTERS, single_col, r) + | 1726 | IO_EXTRACT(R_TR_COUNTERS, single_col, r) + |
1614 | IO_EXTRACT(R_TR_COUNTERS, multiple_col, r); | 1727 | IO_EXTRACT(R_TR_COUNTERS, multiple_col, r); |
1615 | es->tx_errors += IO_EXTRACT(R_TR_COUNTERS, deferred, r); | ||
1616 | } | 1728 | } |
1617 | 1729 | ||
1618 | /* | 1730 | /* |
@@ -1622,8 +1734,9 @@ update_tx_stats(struct net_device_stats *es) | |||
1622 | static struct net_device_stats * | 1734 | static struct net_device_stats * |
1623 | e100_get_stats(struct net_device *dev) | 1735 | e100_get_stats(struct net_device *dev) |
1624 | { | 1736 | { |
1625 | struct net_local *lp = (struct net_local *)dev->priv; | 1737 | struct net_local *lp = netdev_priv(dev); |
1626 | unsigned long flags; | 1738 | unsigned long flags; |
1739 | |||
1627 | spin_lock_irqsave(&lp->lock, flags); | 1740 | spin_lock_irqsave(&lp->lock, flags); |
1628 | 1741 | ||
1629 | update_rx_stats(&lp->stats); | 1742 | update_rx_stats(&lp->stats); |
@@ -1643,13 +1756,13 @@ e100_get_stats(struct net_device *dev) | |||
1643 | static void | 1756 | static void |
1644 | set_multicast_list(struct net_device *dev) | 1757 | set_multicast_list(struct net_device *dev) |
1645 | { | 1758 | { |
1646 | struct net_local *lp = (struct net_local *)dev->priv; | 1759 | struct net_local *lp = netdev_priv(dev); |
1647 | int num_addr = dev->mc_count; | 1760 | int num_addr = dev->mc_count; |
1648 | unsigned long int lo_bits; | 1761 | unsigned long int lo_bits; |
1649 | unsigned long int hi_bits; | 1762 | unsigned long int hi_bits; |
1763 | |||
1650 | spin_lock(&lp->lock); | 1764 | spin_lock(&lp->lock); |
1651 | if (dev->flags & IFF_PROMISC) | 1765 | if (dev->flags & IFF_PROMISC) { |
1652 | { | ||
1653 | /* promiscuous mode */ | 1766 | /* promiscuous mode */ |
1654 | lo_bits = 0xfffffffful; | 1767 | lo_bits = 0xfffffffful; |
1655 | hi_bits = 0xfffffffful; | 1768 | hi_bits = 0xfffffffful; |
@@ -1679,9 +1792,10 @@ set_multicast_list(struct net_device *dev) | |||
1679 | struct dev_mc_list *dmi = dev->mc_list; | 1792 | struct dev_mc_list *dmi = dev->mc_list; |
1680 | int i; | 1793 | int i; |
1681 | char *baddr; | 1794 | char *baddr; |
1795 | |||
1682 | lo_bits = 0x00000000ul; | 1796 | lo_bits = 0x00000000ul; |
1683 | hi_bits = 0x00000000ul; | 1797 | hi_bits = 0x00000000ul; |
1684 | for (i=0; i<num_addr; i++) { | 1798 | for (i = 0; i < num_addr; i++) { |
1685 | /* Calculate the hash index for the GA registers */ | 1799 | /* Calculate the hash index for the GA registers */ |
1686 | 1800 | ||
1687 | hash_ix = 0; | 1801 | hash_ix = 0; |
@@ -1708,8 +1822,7 @@ set_multicast_list(struct net_device *dev) | |||
1708 | 1822 | ||
1709 | if (hash_ix >= 32) { | 1823 | if (hash_ix >= 32) { |
1710 | hi_bits |= (1 << (hash_ix-32)); | 1824 | hi_bits |= (1 << (hash_ix-32)); |
1711 | } | 1825 | } else { |
1712 | else { | ||
1713 | lo_bits |= (1 << hash_ix); | 1826 | lo_bits |= (1 << hash_ix); |
1714 | } | 1827 | } |
1715 | dmi = dmi->next; | 1828 | dmi = dmi->next; |
@@ -1724,10 +1837,11 @@ set_multicast_list(struct net_device *dev) | |||
1724 | } | 1837 | } |
1725 | 1838 | ||
1726 | void | 1839 | void |
1727 | e100_hardware_send_packet(char *buf, int length) | 1840 | e100_hardware_send_packet(struct net_local *np, char *buf, int length) |
1728 | { | 1841 | { |
1729 | D(printk("e100 send pack, buf 0x%x len %d\n", buf, length)); | 1842 | D(printk("e100 send pack, buf 0x%x len %d\n", buf, length)); |
1730 | 1843 | ||
1844 | spin_lock(&np->led_lock); | ||
1731 | if (!led_active && time_after(jiffies, led_next_time)) { | 1845 | if (!led_active && time_after(jiffies, led_next_time)) { |
1732 | /* light the network leds depending on the current speed. */ | 1846 | /* light the network leds depending on the current speed. */ |
1733 | e100_set_network_leds(NETWORK_ACTIVITY); | 1847 | e100_set_network_leds(NETWORK_ACTIVITY); |
@@ -1737,6 +1851,7 @@ e100_hardware_send_packet(char *buf, int length) | |||
1737 | led_active = 1; | 1851 | led_active = 1; |
1738 | mod_timer(&clear_led_timer, jiffies + HZ/10); | 1852 | mod_timer(&clear_led_timer, jiffies + HZ/10); |
1739 | } | 1853 | } |
1854 | spin_unlock(&np->led_lock); | ||
1740 | 1855 | ||
1741 | /* configure the tx dma descriptor */ | 1856 | /* configure the tx dma descriptor */ |
1742 | myNextTxDesc->descr.sw_len = length; | 1857 | myNextTxDesc->descr.sw_len = length; |
@@ -1754,6 +1869,11 @@ e100_hardware_send_packet(char *buf, int length) | |||
1754 | static void | 1869 | static void |
1755 | e100_clear_network_leds(unsigned long dummy) | 1870 | e100_clear_network_leds(unsigned long dummy) |
1756 | { | 1871 | { |
1872 | struct net_device *dev = (struct net_device *)dummy; | ||
1873 | struct net_local *np = netdev_priv(dev); | ||
1874 | |||
1875 | spin_lock(&np->led_lock); | ||
1876 | |||
1757 | if (led_active && time_after(jiffies, led_next_time)) { | 1877 | if (led_active && time_after(jiffies, led_next_time)) { |
1758 | e100_set_network_leds(NO_NETWORK_ACTIVITY); | 1878 | e100_set_network_leds(NO_NETWORK_ACTIVITY); |
1759 | 1879 | ||
@@ -1761,6 +1881,8 @@ e100_clear_network_leds(unsigned long dummy) | |||
1761 | led_next_time = jiffies + NET_FLASH_PAUSE; | 1881 | led_next_time = jiffies + NET_FLASH_PAUSE; |
1762 | led_active = 0; | 1882 | led_active = 0; |
1763 | } | 1883 | } |
1884 | |||
1885 | spin_unlock(&np->led_lock); | ||
1764 | } | 1886 | } |
1765 | 1887 | ||
1766 | static void | 1888 | static void |
@@ -1781,19 +1903,25 @@ e100_set_network_leds(int active) | |||
1781 | #else | 1903 | #else |
1782 | LED_NETWORK_SET(LED_OFF); | 1904 | LED_NETWORK_SET(LED_OFF); |
1783 | #endif | 1905 | #endif |
1784 | } | 1906 | } else if (light_leds) { |
1785 | else if (light_leds) { | ||
1786 | if (current_speed == 10) { | 1907 | if (current_speed == 10) { |
1787 | LED_NETWORK_SET(LED_ORANGE); | 1908 | LED_NETWORK_SET(LED_ORANGE); |
1788 | } else { | 1909 | } else { |
1789 | LED_NETWORK_SET(LED_GREEN); | 1910 | LED_NETWORK_SET(LED_GREEN); |
1790 | } | 1911 | } |
1791 | } | 1912 | } else { |
1792 | else { | ||
1793 | LED_NETWORK_SET(LED_OFF); | 1913 | LED_NETWORK_SET(LED_OFF); |
1794 | } | 1914 | } |
1795 | } | 1915 | } |
1796 | 1916 | ||
1917 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1918 | static void | ||
1919 | e100_netpoll(struct net_device* netdev) | ||
1920 | { | ||
1921 | e100rxtx_interrupt(NETWORK_DMA_TX_IRQ_NBR, netdev, NULL); | ||
1922 | } | ||
1923 | #endif | ||
1924 | |||
1797 | static int | 1925 | static int |
1798 | etrax_init_module(void) | 1926 | etrax_init_module(void) |
1799 | { | 1927 | { |
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index 781ed9968489..3b840283a9c3 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h | |||
@@ -351,4 +351,12 @@ enum e1000_state_t { | |||
351 | __E1000_DOWN | 351 | __E1000_DOWN |
352 | }; | 352 | }; |
353 | 353 | ||
354 | extern char e1000_driver_name[]; | ||
355 | extern const char e1000_driver_version[]; | ||
356 | |||
357 | extern void e1000_power_up_phy(struct e1000_adapter *); | ||
358 | extern void e1000_set_ethtool_ops(struct net_device *netdev); | ||
359 | extern void e1000_check_options(struct e1000_adapter *adapter); | ||
360 | |||
361 | |||
354 | #endif /* _E1000_H_ */ | 362 | #endif /* _E1000_H_ */ |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 6c9a643426f5..667f18bcc172 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -32,9 +32,6 @@ | |||
32 | 32 | ||
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | 34 | ||
35 | extern char e1000_driver_name[]; | ||
36 | extern char e1000_driver_version[]; | ||
37 | |||
38 | extern int e1000_up(struct e1000_adapter *adapter); | 35 | extern int e1000_up(struct e1000_adapter *adapter); |
39 | extern void e1000_down(struct e1000_adapter *adapter); | 36 | extern void e1000_down(struct e1000_adapter *adapter); |
40 | extern void e1000_reinit_locked(struct e1000_adapter *adapter); | 37 | extern void e1000_reinit_locked(struct e1000_adapter *adapter); |
@@ -733,16 +730,16 @@ err_setup: | |||
733 | 730 | ||
734 | #define REG_PATTERN_TEST(R, M, W) \ | 731 | #define REG_PATTERN_TEST(R, M, W) \ |
735 | { \ | 732 | { \ |
736 | uint32_t pat, value; \ | 733 | uint32_t pat, val; \ |
737 | uint32_t test[] = \ | 734 | const uint32_t test[] = \ |
738 | {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \ | 735 | {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \ |
739 | for (pat = 0; pat < ARRAY_SIZE(test); pat++) { \ | 736 | for (pat = 0; pat < ARRAY_SIZE(test); pat++) { \ |
740 | E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ | 737 | E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ |
741 | value = E1000_READ_REG(&adapter->hw, R); \ | 738 | val = E1000_READ_REG(&adapter->hw, R); \ |
742 | if (value != (test[pat] & W & M)) { \ | 739 | if (val != (test[pat] & W & M)) { \ |
743 | DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \ | 740 | DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \ |
744 | "0x%08X expected 0x%08X\n", \ | 741 | "0x%08X expected 0x%08X\n", \ |
745 | E1000_##R, value, (test[pat] & W & M)); \ | 742 | E1000_##R, val, (test[pat] & W & M)); \ |
746 | *data = (adapter->hw.mac_type < e1000_82543) ? \ | 743 | *data = (adapter->hw.mac_type < e1000_82543) ? \ |
747 | E1000_82542_##R : E1000_##R; \ | 744 | E1000_82542_##R : E1000_##R; \ |
748 | return 1; \ | 745 | return 1; \ |
@@ -752,12 +749,12 @@ err_setup: | |||
752 | 749 | ||
753 | #define REG_SET_AND_CHECK(R, M, W) \ | 750 | #define REG_SET_AND_CHECK(R, M, W) \ |
754 | { \ | 751 | { \ |
755 | uint32_t value; \ | 752 | uint32_t val; \ |
756 | E1000_WRITE_REG(&adapter->hw, R, W & M); \ | 753 | E1000_WRITE_REG(&adapter->hw, R, W & M); \ |
757 | value = E1000_READ_REG(&adapter->hw, R); \ | 754 | val = E1000_READ_REG(&adapter->hw, R); \ |
758 | if ((W & M) != (value & M)) { \ | 755 | if ((W & M) != (val & M)) { \ |
759 | DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\ | 756 | DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\ |
760 | "expected 0x%08X\n", E1000_##R, (value & M), (W & M)); \ | 757 | "expected 0x%08X\n", E1000_##R, (val & M), (W & M)); \ |
761 | *data = (adapter->hw.mac_type < e1000_82543) ? \ | 758 | *data = (adapter->hw.mac_type < e1000_82543) ? \ |
762 | E1000_82542_##R : E1000_##R; \ | 759 | E1000_82542_##R : E1000_##R; \ |
763 | return 1; \ | 760 | return 1; \ |
@@ -1621,8 +1618,6 @@ e1000_get_sset_count(struct net_device *netdev, int sset) | |||
1621 | } | 1618 | } |
1622 | } | 1619 | } |
1623 | 1620 | ||
1624 | extern void e1000_power_up_phy(struct e1000_adapter *); | ||
1625 | |||
1626 | static void | 1621 | static void |
1627 | e1000_diag_test(struct net_device *netdev, | 1622 | e1000_diag_test(struct net_device *netdev, |
1628 | struct ethtool_test *eth_test, uint64_t *data) | 1623 | struct ethtool_test *eth_test, uint64_t *data) |
@@ -1859,8 +1854,8 @@ e1000_phys_id(struct net_device *netdev, uint32_t data) | |||
1859 | { | 1854 | { |
1860 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1855 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1861 | 1856 | ||
1862 | if (!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) | 1857 | if (!data) |
1863 | data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); | 1858 | data = INT_MAX; |
1864 | 1859 | ||
1865 | if (adapter->hw.mac_type < e1000_82571) { | 1860 | if (adapter->hw.mac_type < e1000_82571) { |
1866 | if (!adapter->blink_timer.function) { | 1861 | if (!adapter->blink_timer.function) { |
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 8fa0fe4009d5..7c6888c58c21 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -8607,7 +8607,7 @@ e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index, | |||
8607 | 8607 | ||
8608 | DEBUGFUNC("e1000_read_ich8_data"); | 8608 | DEBUGFUNC("e1000_read_ich8_data"); |
8609 | 8609 | ||
8610 | if (size < 1 || size > 2 || data == 0x0 || | 8610 | if (size < 1 || size > 2 || data == NULL || |
8611 | index > ICH_FLASH_LINEAR_ADDR_MASK) | 8611 | index > ICH_FLASH_LINEAR_ADDR_MASK) |
8612 | return error; | 8612 | return error; |
8613 | 8613 | ||
@@ -8841,7 +8841,7 @@ e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t *data) | |||
8841 | * amount of NVM used in each bank is a *minimum* of 4 KBytes, but in fact the | 8841 | * amount of NVM used in each bank is a *minimum* of 4 KBytes, but in fact the |
8842 | * bank size may be 4, 8 or 64 KBytes | 8842 | * bank size may be 4, 8 or 64 KBytes |
8843 | *****************************************************************************/ | 8843 | *****************************************************************************/ |
8844 | int32_t | 8844 | static int32_t |
8845 | e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank) | 8845 | e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank) |
8846 | { | 8846 | { |
8847 | union ich8_hws_flash_status hsfsts; | 8847 | union ich8_hws_flash_status hsfsts; |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index f1ce348470cc..cf39473ef90a 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -37,8 +37,8 @@ static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | |||
37 | #define DRIVERNAPI "-NAPI" | 37 | #define DRIVERNAPI "-NAPI" |
38 | #endif | 38 | #endif |
39 | #define DRV_VERSION "7.3.20-k2"DRIVERNAPI | 39 | #define DRV_VERSION "7.3.20-k2"DRIVERNAPI |
40 | char e1000_driver_version[] = DRV_VERSION; | 40 | const char e1000_driver_version[] = DRV_VERSION; |
41 | static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; | 41 | static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; |
42 | 42 | ||
43 | /* e1000_pci_tbl - PCI Device ID Table | 43 | /* e1000_pci_tbl - PCI Device ID Table |
44 | * | 44 | * |
@@ -188,7 +188,6 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
188 | static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); | 188 | static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); |
189 | static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, | 189 | static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, |
190 | int cmd); | 190 | int cmd); |
191 | void e1000_set_ethtool_ops(struct net_device *netdev); | ||
192 | static void e1000_enter_82542_rst(struct e1000_adapter *adapter); | 191 | static void e1000_enter_82542_rst(struct e1000_adapter *adapter); |
193 | static void e1000_leave_82542_rst(struct e1000_adapter *adapter); | 192 | static void e1000_leave_82542_rst(struct e1000_adapter *adapter); |
194 | static void e1000_tx_timeout(struct net_device *dev); | 193 | static void e1000_tx_timeout(struct net_device *dev); |
@@ -213,8 +212,6 @@ static void e1000_shutdown(struct pci_dev *pdev); | |||
213 | static void e1000_netpoll (struct net_device *netdev); | 212 | static void e1000_netpoll (struct net_device *netdev); |
214 | #endif | 213 | #endif |
215 | 214 | ||
216 | extern void e1000_check_options(struct e1000_adapter *adapter); | ||
217 | |||
218 | #define COPYBREAK_DEFAULT 256 | 215 | #define COPYBREAK_DEFAULT 256 |
219 | static unsigned int copybreak __read_mostly = COPYBREAK_DEFAULT; | 216 | static unsigned int copybreak __read_mostly = COPYBREAK_DEFAULT; |
220 | module_param(copybreak, uint, 0644); | 217 | module_param(copybreak, uint, 0644); |
@@ -4807,6 +4804,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4807 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | 4804 | spin_unlock_irqrestore(&adapter->stats_lock, flags); |
4808 | return -EIO; | 4805 | return -EIO; |
4809 | } | 4806 | } |
4807 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | ||
4810 | if (adapter->hw.media_type == e1000_media_type_copper) { | 4808 | if (adapter->hw.media_type == e1000_media_type_copper) { |
4811 | switch (data->reg_num) { | 4809 | switch (data->reg_num) { |
4812 | case PHY_CTRL: | 4810 | case PHY_CTRL: |
@@ -4827,12 +4825,8 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4827 | DUPLEX_HALF; | 4825 | DUPLEX_HALF; |
4828 | retval = e1000_set_spd_dplx(adapter, | 4826 | retval = e1000_set_spd_dplx(adapter, |
4829 | spddplx); | 4827 | spddplx); |
4830 | if (retval) { | 4828 | if (retval) |
4831 | spin_unlock_irqrestore( | ||
4832 | &adapter->stats_lock, | ||
4833 | flags); | ||
4834 | return retval; | 4829 | return retval; |
4835 | } | ||
4836 | } | 4830 | } |
4837 | if (netif_running(adapter->netdev)) | 4831 | if (netif_running(adapter->netdev)) |
4838 | e1000_reinit_locked(adapter); | 4832 | e1000_reinit_locked(adapter); |
@@ -4841,11 +4835,8 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4841 | break; | 4835 | break; |
4842 | case M88E1000_PHY_SPEC_CTRL: | 4836 | case M88E1000_PHY_SPEC_CTRL: |
4843 | case M88E1000_EXT_PHY_SPEC_CTRL: | 4837 | case M88E1000_EXT_PHY_SPEC_CTRL: |
4844 | if (e1000_phy_reset(&adapter->hw)) { | 4838 | if (e1000_phy_reset(&adapter->hw)) |
4845 | spin_unlock_irqrestore( | ||
4846 | &adapter->stats_lock, flags); | ||
4847 | return -EIO; | 4839 | return -EIO; |
4848 | } | ||
4849 | break; | 4840 | break; |
4850 | } | 4841 | } |
4851 | } else { | 4842 | } else { |
@@ -4860,7 +4851,6 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4860 | break; | 4851 | break; |
4861 | } | 4852 | } |
4862 | } | 4853 | } |
4863 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | ||
4864 | break; | 4854 | break; |
4865 | default: | 4855 | default: |
4866 | return -EOPNOTSUPP; | 4856 | return -EOPNOTSUPP; |
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index f485874a63f5..e6565ce686bc 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } | 46 | #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } |
47 | #define E1000_PARAM(X, desc) \ | 47 | #define E1000_PARAM(X, desc) \ |
48 | static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ | 48 | static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ |
49 | static int num_##X = 0; \ | 49 | static unsigned int num_##X; \ |
50 | module_param_array_named(X, X, int, &num_##X, 0); \ | 50 | module_param_array_named(X, X, int, &num_##X, 0); \ |
51 | MODULE_PARM_DESC(X, desc); | 51 | MODULE_PARM_DESC(X, desc); |
52 | 52 | ||
@@ -198,9 +198,9 @@ E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); | |||
198 | 198 | ||
199 | struct e1000_option { | 199 | struct e1000_option { |
200 | enum { enable_option, range_option, list_option } type; | 200 | enum { enable_option, range_option, list_option } type; |
201 | char *name; | 201 | const char *name; |
202 | char *err; | 202 | const char *err; |
203 | int def; | 203 | int def; |
204 | union { | 204 | union { |
205 | struct { /* range_option info */ | 205 | struct { /* range_option info */ |
206 | int min; | 206 | int min; |
@@ -214,8 +214,9 @@ struct e1000_option { | |||
214 | }; | 214 | }; |
215 | 215 | ||
216 | static int __devinit | 216 | static int __devinit |
217 | e1000_validate_option(int *value, struct e1000_option *opt, | 217 | e1000_validate_option(unsigned int *value, |
218 | struct e1000_adapter *adapter) | 218 | const struct e1000_option *opt, |
219 | struct e1000_adapter *adapter) | ||
219 | { | 220 | { |
220 | if (*value == OPTION_UNSET) { | 221 | if (*value == OPTION_UNSET) { |
221 | *value = opt->def; | 222 | *value = opt->def; |
@@ -348,7 +349,7 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
348 | }; | 349 | }; |
349 | 350 | ||
350 | if (num_XsumRX > bd) { | 351 | if (num_XsumRX > bd) { |
351 | int rx_csum = XsumRX[bd]; | 352 | unsigned int rx_csum = XsumRX[bd]; |
352 | e1000_validate_option(&rx_csum, &opt, adapter); | 353 | e1000_validate_option(&rx_csum, &opt, adapter); |
353 | adapter->rx_csum = rx_csum; | 354 | adapter->rx_csum = rx_csum; |
354 | } else { | 355 | } else { |
@@ -374,7 +375,7 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
374 | }; | 375 | }; |
375 | 376 | ||
376 | if (num_FlowControl > bd) { | 377 | if (num_FlowControl > bd) { |
377 | int fc = FlowControl[bd]; | 378 | unsigned int fc = FlowControl[bd]; |
378 | e1000_validate_option(&fc, &opt, adapter); | 379 | e1000_validate_option(&fc, &opt, adapter); |
379 | adapter->hw.fc = adapter->hw.original_fc = fc; | 380 | adapter->hw.fc = adapter->hw.original_fc = fc; |
380 | } else { | 381 | } else { |
@@ -506,7 +507,7 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
506 | }; | 507 | }; |
507 | 508 | ||
508 | if (num_SmartPowerDownEnable > bd) { | 509 | if (num_SmartPowerDownEnable > bd) { |
509 | int spd = SmartPowerDownEnable[bd]; | 510 | unsigned int spd = SmartPowerDownEnable[bd]; |
510 | e1000_validate_option(&spd, &opt, adapter); | 511 | e1000_validate_option(&spd, &opt, adapter); |
511 | adapter->smart_power_down = spd; | 512 | adapter->smart_power_down = spd; |
512 | } else { | 513 | } else { |
@@ -522,7 +523,7 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
522 | }; | 523 | }; |
523 | 524 | ||
524 | if (num_KumeranLockLoss > bd) { | 525 | if (num_KumeranLockLoss > bd) { |
525 | int kmrn_lock_loss = KumeranLockLoss[bd]; | 526 | unsigned int kmrn_lock_loss = KumeranLockLoss[bd]; |
526 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); | 527 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); |
527 | adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss; | 528 | adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss; |
528 | } else { | 529 | } else { |
@@ -581,7 +582,7 @@ e1000_check_fiber_options(struct e1000_adapter *adapter) | |||
581 | static void __devinit | 582 | static void __devinit |
582 | e1000_check_copper_options(struct e1000_adapter *adapter) | 583 | e1000_check_copper_options(struct e1000_adapter *adapter) |
583 | { | 584 | { |
584 | int speed, dplx, an; | 585 | unsigned int speed, dplx, an; |
585 | int bd = adapter->bd_number; | 586 | int bd = adapter->bd_number; |
586 | 587 | ||
587 | { /* Speed */ | 588 | { /* Speed */ |
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index cf70522fc851..14141a55eaa6 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c | |||
@@ -283,7 +283,7 @@ static s32 e1000_get_invariants_82571(struct e1000_adapter *adapter) | |||
283 | adapter->flags &= ~FLAG_HAS_WOL; | 283 | adapter->flags &= ~FLAG_HAS_WOL; |
284 | /* quad ports only support WoL on port A */ | 284 | /* quad ports only support WoL on port A */ |
285 | if (adapter->flags & FLAG_IS_QUAD_PORT && | 285 | if (adapter->flags & FLAG_IS_QUAD_PORT && |
286 | (!adapter->flags & FLAG_IS_QUAD_PORT_A)) | 286 | (!(adapter->flags & FLAG_IS_QUAD_PORT_A))) |
287 | adapter->flags &= ~FLAG_HAS_WOL; | 287 | adapter->flags &= ~FLAG_HAS_WOL; |
288 | break; | 288 | break; |
289 | 289 | ||
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index d2499bb07c13..473f78de4be0 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -122,7 +122,8 @@ struct e1000_buffer { | |||
122 | u16 next_to_watch; | 122 | u16 next_to_watch; |
123 | }; | 123 | }; |
124 | /* RX */ | 124 | /* RX */ |
125 | struct page *page; | 125 | /* arrays of page information for packet split */ |
126 | struct e1000_ps_page *ps_pages; | ||
126 | }; | 127 | }; |
127 | 128 | ||
128 | }; | 129 | }; |
@@ -142,8 +143,6 @@ struct e1000_ring { | |||
142 | /* array of buffer information structs */ | 143 | /* array of buffer information structs */ |
143 | struct e1000_buffer *buffer_info; | 144 | struct e1000_buffer *buffer_info; |
144 | 145 | ||
145 | /* arrays of page information for packet split */ | ||
146 | struct e1000_ps_page *ps_pages; | ||
147 | struct sk_buff *rx_skb_top; | 146 | struct sk_buff *rx_skb_top; |
148 | 147 | ||
149 | struct e1000_queue_stats stats; | 148 | struct e1000_queue_stats stats; |
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 0666e62e9ad2..6a39784e7ee2 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -1680,8 +1680,8 @@ static int e1000_phys_id(struct net_device *netdev, u32 data) | |||
1680 | { | 1680 | { |
1681 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1681 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1682 | 1682 | ||
1683 | if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) | 1683 | if (!data) |
1684 | data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); | 1684 | data = INT_MAX; |
1685 | 1685 | ||
1686 | if (adapter->hw.phy.type == e1000_phy_ife) { | 1686 | if (adapter->hw.phy.type == e1000_phy_ife) { |
1687 | if (!adapter->blink_timer.function) { | 1687 | if (!adapter->blink_timer.function) { |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 033e124d1c1f..4fd2e23720b6 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -245,37 +245,36 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
245 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); | 245 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); |
246 | 246 | ||
247 | for (j = 0; j < PS_PAGE_BUFFERS; j++) { | 247 | for (j = 0; j < PS_PAGE_BUFFERS; j++) { |
248 | ps_page = &rx_ring->ps_pages[(i * PS_PAGE_BUFFERS) | 248 | ps_page = &buffer_info->ps_pages[j]; |
249 | + j]; | 249 | if (j >= adapter->rx_ps_pages) { |
250 | if (j < adapter->rx_ps_pages) { | 250 | /* all unused desc entries get hw null ptr */ |
251 | rx_desc->read.buffer_addr[j+1] = ~0; | ||
252 | continue; | ||
253 | } | ||
254 | if (!ps_page->page) { | ||
255 | ps_page->page = alloc_page(GFP_ATOMIC); | ||
251 | if (!ps_page->page) { | 256 | if (!ps_page->page) { |
252 | ps_page->page = alloc_page(GFP_ATOMIC); | 257 | adapter->alloc_rx_buff_failed++; |
253 | if (!ps_page->page) { | 258 | goto no_buffers; |
254 | adapter->alloc_rx_buff_failed++; | 259 | } |
255 | goto no_buffers; | 260 | ps_page->dma = pci_map_page(pdev, |
256 | } | 261 | ps_page->page, |
257 | ps_page->dma = pci_map_page(pdev, | 262 | 0, PAGE_SIZE, |
258 | ps_page->page, | 263 | PCI_DMA_FROMDEVICE); |
259 | 0, PAGE_SIZE, | 264 | if (pci_dma_mapping_error(ps_page->dma)) { |
260 | PCI_DMA_FROMDEVICE); | 265 | dev_err(&adapter->pdev->dev, |
261 | if (pci_dma_mapping_error( | 266 | "RX DMA page map failed\n"); |
262 | ps_page->dma)) { | 267 | adapter->rx_dma_failed++; |
263 | dev_err(&adapter->pdev->dev, | 268 | goto no_buffers; |
264 | "RX DMA page map failed\n"); | ||
265 | adapter->rx_dma_failed++; | ||
266 | goto no_buffers; | ||
267 | } | ||
268 | } | 269 | } |
269 | /* | ||
270 | * Refresh the desc even if buffer_addrs | ||
271 | * didn't change because each write-back | ||
272 | * erases this info. | ||
273 | */ | ||
274 | rx_desc->read.buffer_addr[j+1] = | ||
275 | cpu_to_le64(ps_page->dma); | ||
276 | } else { | ||
277 | rx_desc->read.buffer_addr[j+1] = ~0; | ||
278 | } | 270 | } |
271 | /* | ||
272 | * Refresh the desc even if buffer_addrs | ||
273 | * didn't change because each write-back | ||
274 | * erases this info. | ||
275 | */ | ||
276 | rx_desc->read.buffer_addr[j+1] = | ||
277 | cpu_to_le64(ps_page->dma); | ||
279 | } | 278 | } |
280 | 279 | ||
281 | skb = netdev_alloc_skb(netdev, | 280 | skb = netdev_alloc_skb(netdev, |
@@ -334,94 +333,6 @@ no_buffers: | |||
334 | } | 333 | } |
335 | 334 | ||
336 | /** | 335 | /** |
337 | * e1000_alloc_rx_buffers_jumbo - Replace used jumbo receive buffers | ||
338 | * | ||
339 | * @adapter: address of board private structure | ||
340 | * @cleaned_count: number of buffers to allocate this pass | ||
341 | **/ | ||
342 | static void e1000_alloc_rx_buffers_jumbo(struct e1000_adapter *adapter, | ||
343 | int cleaned_count) | ||
344 | { | ||
345 | struct net_device *netdev = adapter->netdev; | ||
346 | struct pci_dev *pdev = adapter->pdev; | ||
347 | struct e1000_ring *rx_ring = adapter->rx_ring; | ||
348 | struct e1000_rx_desc *rx_desc; | ||
349 | struct e1000_buffer *buffer_info; | ||
350 | struct sk_buff *skb; | ||
351 | unsigned int i; | ||
352 | unsigned int bufsz = 256 - | ||
353 | 16 /*for skb_reserve */ - | ||
354 | NET_IP_ALIGN; | ||
355 | |||
356 | i = rx_ring->next_to_use; | ||
357 | buffer_info = &rx_ring->buffer_info[i]; | ||
358 | |||
359 | while (cleaned_count--) { | ||
360 | skb = buffer_info->skb; | ||
361 | if (skb) { | ||
362 | skb_trim(skb, 0); | ||
363 | goto check_page; | ||
364 | } | ||
365 | |||
366 | skb = netdev_alloc_skb(netdev, bufsz); | ||
367 | if (!skb) { | ||
368 | /* Better luck next round */ | ||
369 | adapter->alloc_rx_buff_failed++; | ||
370 | break; | ||
371 | } | ||
372 | |||
373 | /* Make buffer alignment 2 beyond a 16 byte boundary | ||
374 | * this will result in a 16 byte aligned IP header after | ||
375 | * the 14 byte MAC header is removed | ||
376 | */ | ||
377 | skb_reserve(skb, NET_IP_ALIGN); | ||
378 | |||
379 | buffer_info->skb = skb; | ||
380 | check_page: | ||
381 | /* allocate a new page if necessary */ | ||
382 | if (!buffer_info->page) { | ||
383 | buffer_info->page = alloc_page(GFP_ATOMIC); | ||
384 | if (!buffer_info->page) { | ||
385 | adapter->alloc_rx_buff_failed++; | ||
386 | break; | ||
387 | } | ||
388 | } | ||
389 | |||
390 | if (!buffer_info->dma) | ||
391 | buffer_info->dma = pci_map_page(pdev, | ||
392 | buffer_info->page, 0, | ||
393 | PAGE_SIZE, | ||
394 | PCI_DMA_FROMDEVICE); | ||
395 | if (pci_dma_mapping_error(buffer_info->dma)) { | ||
396 | dev_err(&adapter->pdev->dev, "RX DMA page map failed\n"); | ||
397 | adapter->rx_dma_failed++; | ||
398 | break; | ||
399 | } | ||
400 | |||
401 | rx_desc = E1000_RX_DESC(*rx_ring, i); | ||
402 | rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); | ||
403 | |||
404 | i++; | ||
405 | if (i == rx_ring->count) | ||
406 | i = 0; | ||
407 | buffer_info = &rx_ring->buffer_info[i]; | ||
408 | } | ||
409 | |||
410 | if (rx_ring->next_to_use != i) { | ||
411 | rx_ring->next_to_use = i; | ||
412 | if (i-- == 0) | ||
413 | i = (rx_ring->count - 1); | ||
414 | |||
415 | /* Force memory writes to complete before letting h/w | ||
416 | * know there are new descriptors to fetch. (Only | ||
417 | * applicable for weak-ordered memory model archs, | ||
418 | * such as IA-64). */ | ||
419 | wmb(); | ||
420 | writel(i, adapter->hw.hw_addr + rx_ring->tail); | ||
421 | } | ||
422 | } | ||
423 | |||
424 | /** | ||
425 | * e1000_clean_rx_irq - Send received data up the network stack; legacy | 336 | * e1000_clean_rx_irq - Send received data up the network stack; legacy |
426 | * @adapter: board private structure | 337 | * @adapter: board private structure |
427 | * | 338 | * |
@@ -495,10 +406,6 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
495 | goto next_desc; | 406 | goto next_desc; |
496 | } | 407 | } |
497 | 408 | ||
498 | /* adjust length to remove Ethernet CRC */ | ||
499 | length -= 4; | ||
500 | |||
501 | /* probably a little skewed due to removing CRC */ | ||
502 | total_rx_bytes += length; | 409 | total_rx_bytes += length; |
503 | total_rx_packets++; | 410 | total_rx_packets++; |
504 | 411 | ||
@@ -554,15 +461,6 @@ next_desc: | |||
554 | return cleaned; | 461 | return cleaned; |
555 | } | 462 | } |
556 | 463 | ||
557 | static void e1000_consume_page(struct e1000_buffer *bi, struct sk_buff *skb, | ||
558 | u16 length) | ||
559 | { | ||
560 | bi->page = NULL; | ||
561 | skb->len += length; | ||
562 | skb->data_len += length; | ||
563 | skb->truesize += length; | ||
564 | } | ||
565 | |||
566 | static void e1000_put_txbuf(struct e1000_adapter *adapter, | 464 | static void e1000_put_txbuf(struct e1000_adapter *adapter, |
567 | struct e1000_buffer *buffer_info) | 465 | struct e1000_buffer *buffer_info) |
568 | { | 466 | { |
@@ -699,174 +597,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
699 | } | 597 | } |
700 | 598 | ||
701 | /** | 599 | /** |
702 | * e1000_clean_rx_irq_jumbo - Send received data up the network stack; legacy | ||
703 | * @adapter: board private structure | ||
704 | * | ||
705 | * the return value indicates whether actual cleaning was done, there | ||
706 | * is no guarantee that everything was cleaned | ||
707 | **/ | ||
708 | static bool e1000_clean_rx_irq_jumbo(struct e1000_adapter *adapter, | ||
709 | int *work_done, int work_to_do) | ||
710 | { | ||
711 | struct net_device *netdev = adapter->netdev; | ||
712 | struct pci_dev *pdev = adapter->pdev; | ||
713 | struct e1000_ring *rx_ring = adapter->rx_ring; | ||
714 | struct e1000_rx_desc *rx_desc, *next_rxd; | ||
715 | struct e1000_buffer *buffer_info, *next_buffer; | ||
716 | u32 length; | ||
717 | unsigned int i; | ||
718 | int cleaned_count = 0; | ||
719 | bool cleaned = 0; | ||
720 | unsigned int total_rx_bytes = 0, total_rx_packets = 0; | ||
721 | |||
722 | i = rx_ring->next_to_clean; | ||
723 | rx_desc = E1000_RX_DESC(*rx_ring, i); | ||
724 | buffer_info = &rx_ring->buffer_info[i]; | ||
725 | |||
726 | while (rx_desc->status & E1000_RXD_STAT_DD) { | ||
727 | struct sk_buff *skb; | ||
728 | u8 status; | ||
729 | |||
730 | if (*work_done >= work_to_do) | ||
731 | break; | ||
732 | (*work_done)++; | ||
733 | |||
734 | status = rx_desc->status; | ||
735 | skb = buffer_info->skb; | ||
736 | buffer_info->skb = NULL; | ||
737 | |||
738 | i++; | ||
739 | if (i == rx_ring->count) | ||
740 | i = 0; | ||
741 | next_rxd = E1000_RX_DESC(*rx_ring, i); | ||
742 | prefetch(next_rxd); | ||
743 | |||
744 | next_buffer = &rx_ring->buffer_info[i]; | ||
745 | |||
746 | cleaned = 1; | ||
747 | cleaned_count++; | ||
748 | pci_unmap_page(pdev, | ||
749 | buffer_info->dma, | ||
750 | PAGE_SIZE, | ||
751 | PCI_DMA_FROMDEVICE); | ||
752 | buffer_info->dma = 0; | ||
753 | |||
754 | length = le16_to_cpu(rx_desc->length); | ||
755 | |||
756 | /* errors is only valid for DD + EOP descriptors */ | ||
757 | if ((status & E1000_RXD_STAT_EOP) && | ||
758 | (rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK)) { | ||
759 | /* recycle both page and skb */ | ||
760 | buffer_info->skb = skb; | ||
761 | /* an error means any chain goes out the window too */ | ||
762 | if (rx_ring->rx_skb_top) | ||
763 | dev_kfree_skb(rx_ring->rx_skb_top); | ||
764 | rx_ring->rx_skb_top = NULL; | ||
765 | goto next_desc; | ||
766 | } | ||
767 | |||
768 | #define rxtop rx_ring->rx_skb_top | ||
769 | if (!(status & E1000_RXD_STAT_EOP)) { | ||
770 | /* this descriptor is only the beginning (or middle) */ | ||
771 | if (!rxtop) { | ||
772 | /* this is the beginning of a chain */ | ||
773 | rxtop = skb; | ||
774 | skb_fill_page_desc(rxtop, 0, buffer_info->page, | ||
775 | 0, length); | ||
776 | } else { | ||
777 | /* this is the middle of a chain */ | ||
778 | skb_fill_page_desc(rxtop, | ||
779 | skb_shinfo(rxtop)->nr_frags, | ||
780 | buffer_info->page, 0, | ||
781 | length); | ||
782 | /* re-use the skb, only consumed the page */ | ||
783 | buffer_info->skb = skb; | ||
784 | } | ||
785 | e1000_consume_page(buffer_info, rxtop, length); | ||
786 | goto next_desc; | ||
787 | } else { | ||
788 | if (rxtop) { | ||
789 | /* end of the chain */ | ||
790 | skb_fill_page_desc(rxtop, | ||
791 | skb_shinfo(rxtop)->nr_frags, | ||
792 | buffer_info->page, 0, length); | ||
793 | /* re-use the current skb, we only consumed the | ||
794 | * page */ | ||
795 | buffer_info->skb = skb; | ||
796 | skb = rxtop; | ||
797 | rxtop = NULL; | ||
798 | e1000_consume_page(buffer_info, skb, length); | ||
799 | } else { | ||
800 | /* no chain, got EOP, this buf is the packet | ||
801 | * copybreak to save the put_page/alloc_page */ | ||
802 | if (length <= copybreak && | ||
803 | skb_tailroom(skb) >= length) { | ||
804 | u8 *vaddr; | ||
805 | vaddr = kmap_atomic(buffer_info->page, | ||
806 | KM_SKB_DATA_SOFTIRQ); | ||
807 | memcpy(skb_tail_pointer(skb), | ||
808 | vaddr, length); | ||
809 | kunmap_atomic(vaddr, | ||
810 | KM_SKB_DATA_SOFTIRQ); | ||
811 | /* re-use the page, so don't erase | ||
812 | * buffer_info->page */ | ||
813 | skb_put(skb, length); | ||
814 | } else { | ||
815 | skb_fill_page_desc(skb, 0, | ||
816 | buffer_info->page, 0, | ||
817 | length); | ||
818 | e1000_consume_page(buffer_info, skb, | ||
819 | length); | ||
820 | } | ||
821 | } | ||
822 | } | ||
823 | |||
824 | /* Receive Checksum Offload XXX recompute due to CRC strip? */ | ||
825 | e1000_rx_checksum(adapter, | ||
826 | (u32)(status) | | ||
827 | ((u32)(rx_desc->errors) << 24), | ||
828 | le16_to_cpu(rx_desc->csum), skb); | ||
829 | |||
830 | pskb_trim(skb, skb->len - 4); | ||
831 | |||
832 | /* probably a little skewed due to removing CRC */ | ||
833 | total_rx_bytes += skb->len; | ||
834 | total_rx_packets++; | ||
835 | |||
836 | /* eth type trans needs skb->data to point to something */ | ||
837 | if (!pskb_may_pull(skb, ETH_HLEN)) { | ||
838 | ndev_err(netdev, "__pskb_pull_tail failed.\n"); | ||
839 | dev_kfree_skb(skb); | ||
840 | goto next_desc; | ||
841 | } | ||
842 | |||
843 | e1000_receive_skb(adapter, netdev, skb,status,rx_desc->special); | ||
844 | |||
845 | next_desc: | ||
846 | rx_desc->status = 0; | ||
847 | |||
848 | /* return some buffers to hardware, one at a time is too slow */ | ||
849 | if (cleaned_count >= E1000_RX_BUFFER_WRITE) { | ||
850 | adapter->alloc_rx_buf(adapter, cleaned_count); | ||
851 | cleaned_count = 0; | ||
852 | } | ||
853 | |||
854 | /* use prefetched values */ | ||
855 | rx_desc = next_rxd; | ||
856 | buffer_info = next_buffer; | ||
857 | } | ||
858 | rx_ring->next_to_clean = i; | ||
859 | |||
860 | cleaned_count = e1000_desc_unused(rx_ring); | ||
861 | if (cleaned_count) | ||
862 | adapter->alloc_rx_buf(adapter, cleaned_count); | ||
863 | |||
864 | adapter->total_rx_packets += total_rx_packets; | ||
865 | adapter->total_rx_bytes += total_rx_bytes; | ||
866 | return cleaned; | ||
867 | } | ||
868 | |||
869 | /** | ||
870 | * e1000_clean_rx_irq_ps - Send received data up the network stack; packet split | 600 | * e1000_clean_rx_irq_ps - Send received data up the network stack; packet split |
871 | * @adapter: board private structure | 601 | * @adapter: board private structure |
872 | * | 602 | * |
@@ -953,7 +683,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
953 | ((length + l1) <= adapter->rx_ps_bsize0)) { | 683 | ((length + l1) <= adapter->rx_ps_bsize0)) { |
954 | u8 *vaddr; | 684 | u8 *vaddr; |
955 | 685 | ||
956 | ps_page = &rx_ring->ps_pages[i * PS_PAGE_BUFFERS]; | 686 | ps_page = &buffer_info->ps_pages[0]; |
957 | 687 | ||
958 | /* there is no documentation about how to call | 688 | /* there is no documentation about how to call |
959 | * kmap_atomic, so we can't hold the mapping | 689 | * kmap_atomic, so we can't hold the mapping |
@@ -965,8 +695,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
965 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); | 695 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); |
966 | pci_dma_sync_single_for_device(pdev, ps_page->dma, | 696 | pci_dma_sync_single_for_device(pdev, ps_page->dma, |
967 | PAGE_SIZE, PCI_DMA_FROMDEVICE); | 697 | PAGE_SIZE, PCI_DMA_FROMDEVICE); |
968 | /* remove the CRC */ | 698 | |
969 | l1 -= 4; | ||
970 | skb_put(skb, l1); | 699 | skb_put(skb, l1); |
971 | goto copydone; | 700 | goto copydone; |
972 | } /* if */ | 701 | } /* if */ |
@@ -977,7 +706,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
977 | if (!length) | 706 | if (!length) |
978 | break; | 707 | break; |
979 | 708 | ||
980 | ps_page = &rx_ring->ps_pages[(i * PS_PAGE_BUFFERS) + j]; | 709 | ps_page = &buffer_info->ps_pages[j]; |
981 | pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE, | 710 | pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE, |
982 | PCI_DMA_FROMDEVICE); | 711 | PCI_DMA_FROMDEVICE); |
983 | ps_page->dma = 0; | 712 | ps_page->dma = 0; |
@@ -988,10 +717,6 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
988 | skb->truesize += length; | 717 | skb->truesize += length; |
989 | } | 718 | } |
990 | 719 | ||
991 | /* strip the ethernet crc, problem is we're using pages now so | ||
992 | * this whole operation can get a little cpu intensive */ | ||
993 | pskb_trim(skb, skb->len - 4); | ||
994 | |||
995 | copydone: | 720 | copydone: |
996 | total_rx_bytes += skb->len; | 721 | total_rx_bytes += skb->len; |
997 | total_rx_packets++; | 722 | total_rx_packets++; |
@@ -1043,7 +768,6 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1043 | struct e1000_buffer *buffer_info; | 768 | struct e1000_buffer *buffer_info; |
1044 | struct e1000_ps_page *ps_page; | 769 | struct e1000_ps_page *ps_page; |
1045 | struct pci_dev *pdev = adapter->pdev; | 770 | struct pci_dev *pdev = adapter->pdev; |
1046 | unsigned long size; | ||
1047 | unsigned int i, j; | 771 | unsigned int i, j; |
1048 | 772 | ||
1049 | /* Free all the Rx ring sk_buffs */ | 773 | /* Free all the Rx ring sk_buffs */ |
@@ -1054,9 +778,6 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1054 | pci_unmap_single(pdev, buffer_info->dma, | 778 | pci_unmap_single(pdev, buffer_info->dma, |
1055 | adapter->rx_buffer_len, | 779 | adapter->rx_buffer_len, |
1056 | PCI_DMA_FROMDEVICE); | 780 | PCI_DMA_FROMDEVICE); |
1057 | else if (adapter->clean_rx == e1000_clean_rx_irq_jumbo) | ||
1058 | pci_unmap_page(pdev, buffer_info->dma, | ||
1059 | PAGE_SIZE, PCI_DMA_FROMDEVICE); | ||
1060 | else if (adapter->clean_rx == e1000_clean_rx_irq_ps) | 781 | else if (adapter->clean_rx == e1000_clean_rx_irq_ps) |
1061 | pci_unmap_single(pdev, buffer_info->dma, | 782 | pci_unmap_single(pdev, buffer_info->dma, |
1062 | adapter->rx_ps_bsize0, | 783 | adapter->rx_ps_bsize0, |
@@ -1064,19 +785,13 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1064 | buffer_info->dma = 0; | 785 | buffer_info->dma = 0; |
1065 | } | 786 | } |
1066 | 787 | ||
1067 | if (buffer_info->page) { | ||
1068 | put_page(buffer_info->page); | ||
1069 | buffer_info->page = NULL; | ||
1070 | } | ||
1071 | |||
1072 | if (buffer_info->skb) { | 788 | if (buffer_info->skb) { |
1073 | dev_kfree_skb(buffer_info->skb); | 789 | dev_kfree_skb(buffer_info->skb); |
1074 | buffer_info->skb = NULL; | 790 | buffer_info->skb = NULL; |
1075 | } | 791 | } |
1076 | 792 | ||
1077 | for (j = 0; j < PS_PAGE_BUFFERS; j++) { | 793 | for (j = 0; j < PS_PAGE_BUFFERS; j++) { |
1078 | ps_page = &rx_ring->ps_pages[(i * PS_PAGE_BUFFERS) | 794 | ps_page = &buffer_info->ps_pages[j]; |
1079 | + j]; | ||
1080 | if (!ps_page->page) | 795 | if (!ps_page->page) |
1081 | break; | 796 | break; |
1082 | pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE, | 797 | pci_unmap_page(pdev, ps_page->dma, PAGE_SIZE, |
@@ -1093,12 +808,6 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1093 | rx_ring->rx_skb_top = NULL; | 808 | rx_ring->rx_skb_top = NULL; |
1094 | } | 809 | } |
1095 | 810 | ||
1096 | size = sizeof(struct e1000_buffer) * rx_ring->count; | ||
1097 | memset(rx_ring->buffer_info, 0, size); | ||
1098 | size = sizeof(struct e1000_ps_page) | ||
1099 | * (rx_ring->count * PS_PAGE_BUFFERS); | ||
1100 | memset(rx_ring->ps_pages, 0, size); | ||
1101 | |||
1102 | /* Zero out the descriptor ring */ | 811 | /* Zero out the descriptor ring */ |
1103 | memset(rx_ring->desc, 0, rx_ring->size); | 812 | memset(rx_ring->desc, 0, rx_ring->size); |
1104 | 813 | ||
@@ -1421,7 +1130,8 @@ err: | |||
1421 | int e1000e_setup_rx_resources(struct e1000_adapter *adapter) | 1130 | int e1000e_setup_rx_resources(struct e1000_adapter *adapter) |
1422 | { | 1131 | { |
1423 | struct e1000_ring *rx_ring = adapter->rx_ring; | 1132 | struct e1000_ring *rx_ring = adapter->rx_ring; |
1424 | int size, desc_len, err = -ENOMEM; | 1133 | struct e1000_buffer *buffer_info; |
1134 | int i, size, desc_len, err = -ENOMEM; | ||
1425 | 1135 | ||
1426 | size = sizeof(struct e1000_buffer) * rx_ring->count; | 1136 | size = sizeof(struct e1000_buffer) * rx_ring->count; |
1427 | rx_ring->buffer_info = vmalloc(size); | 1137 | rx_ring->buffer_info = vmalloc(size); |
@@ -1429,11 +1139,14 @@ int e1000e_setup_rx_resources(struct e1000_adapter *adapter) | |||
1429 | goto err; | 1139 | goto err; |
1430 | memset(rx_ring->buffer_info, 0, size); | 1140 | memset(rx_ring->buffer_info, 0, size); |
1431 | 1141 | ||
1432 | rx_ring->ps_pages = kcalloc(rx_ring->count * PS_PAGE_BUFFERS, | 1142 | for (i = 0; i < rx_ring->count; i++) { |
1433 | sizeof(struct e1000_ps_page), | 1143 | buffer_info = &rx_ring->buffer_info[i]; |
1434 | GFP_KERNEL); | 1144 | buffer_info->ps_pages = kcalloc(PS_PAGE_BUFFERS, |
1435 | if (!rx_ring->ps_pages) | 1145 | sizeof(struct e1000_ps_page), |
1436 | goto err; | 1146 | GFP_KERNEL); |
1147 | if (!buffer_info->ps_pages) | ||
1148 | goto err_pages; | ||
1149 | } | ||
1437 | 1150 | ||
1438 | desc_len = sizeof(union e1000_rx_desc_packet_split); | 1151 | desc_len = sizeof(union e1000_rx_desc_packet_split); |
1439 | 1152 | ||
@@ -1443,16 +1156,21 @@ int e1000e_setup_rx_resources(struct e1000_adapter *adapter) | |||
1443 | 1156 | ||
1444 | err = e1000_alloc_ring_dma(adapter, rx_ring); | 1157 | err = e1000_alloc_ring_dma(adapter, rx_ring); |
1445 | if (err) | 1158 | if (err) |
1446 | goto err; | 1159 | goto err_pages; |
1447 | 1160 | ||
1448 | rx_ring->next_to_clean = 0; | 1161 | rx_ring->next_to_clean = 0; |
1449 | rx_ring->next_to_use = 0; | 1162 | rx_ring->next_to_use = 0; |
1450 | rx_ring->rx_skb_top = NULL; | 1163 | rx_ring->rx_skb_top = NULL; |
1451 | 1164 | ||
1452 | return 0; | 1165 | return 0; |
1166 | |||
1167 | err_pages: | ||
1168 | for (i = 0; i < rx_ring->count; i++) { | ||
1169 | buffer_info = &rx_ring->buffer_info[i]; | ||
1170 | kfree(buffer_info->ps_pages); | ||
1171 | } | ||
1453 | err: | 1172 | err: |
1454 | vfree(rx_ring->buffer_info); | 1173 | vfree(rx_ring->buffer_info); |
1455 | kfree(rx_ring->ps_pages); | ||
1456 | ndev_err(adapter->netdev, | 1174 | ndev_err(adapter->netdev, |
1457 | "Unable to allocate memory for the transmit descriptor ring\n"); | 1175 | "Unable to allocate memory for the transmit descriptor ring\n"); |
1458 | return err; | 1176 | return err; |
@@ -1518,15 +1236,17 @@ void e1000e_free_rx_resources(struct e1000_adapter *adapter) | |||
1518 | { | 1236 | { |
1519 | struct pci_dev *pdev = adapter->pdev; | 1237 | struct pci_dev *pdev = adapter->pdev; |
1520 | struct e1000_ring *rx_ring = adapter->rx_ring; | 1238 | struct e1000_ring *rx_ring = adapter->rx_ring; |
1239 | int i; | ||
1521 | 1240 | ||
1522 | e1000_clean_rx_ring(adapter); | 1241 | e1000_clean_rx_ring(adapter); |
1523 | 1242 | ||
1243 | for (i = 0; i < rx_ring->count; i++) { | ||
1244 | kfree(rx_ring->buffer_info[i].ps_pages); | ||
1245 | } | ||
1246 | |||
1524 | vfree(rx_ring->buffer_info); | 1247 | vfree(rx_ring->buffer_info); |
1525 | rx_ring->buffer_info = NULL; | 1248 | rx_ring->buffer_info = NULL; |
1526 | 1249 | ||
1527 | kfree(rx_ring->ps_pages); | ||
1528 | rx_ring->ps_pages = NULL; | ||
1529 | |||
1530 | dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc, | 1250 | dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc, |
1531 | rx_ring->dma); | 1251 | rx_ring->dma); |
1532 | rx_ring->desc = NULL; | 1252 | rx_ring->desc = NULL; |
@@ -2032,9 +1752,11 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
2032 | 1752 | ||
2033 | ew32(RFCTL, rfctl); | 1753 | ew32(RFCTL, rfctl); |
2034 | 1754 | ||
2035 | /* disable the stripping of CRC because it breaks | 1755 | /* Enable Packet split descriptors */ |
2036 | * BMC firmware connected over SMBUS */ | 1756 | rctl |= E1000_RCTL_DTYP_PS; |
2037 | rctl |= E1000_RCTL_DTYP_PS /* | E1000_RCTL_SECRC */; | 1757 | |
1758 | /* Enable hardware CRC frame stripping */ | ||
1759 | rctl |= E1000_RCTL_SECRC; | ||
2038 | 1760 | ||
2039 | psrctl |= adapter->rx_ps_bsize0 >> | 1761 | psrctl |= adapter->rx_ps_bsize0 >> |
2040 | E1000_PSRCTL_BSIZE0_SHIFT; | 1762 | E1000_PSRCTL_BSIZE0_SHIFT; |
@@ -2077,11 +1799,6 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) | |||
2077 | sizeof(union e1000_rx_desc_packet_split); | 1799 | sizeof(union e1000_rx_desc_packet_split); |
2078 | adapter->clean_rx = e1000_clean_rx_irq_ps; | 1800 | adapter->clean_rx = e1000_clean_rx_irq_ps; |
2079 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; | 1801 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; |
2080 | } else if (adapter->netdev->mtu > ETH_FRAME_LEN + VLAN_HLEN + 4) { | ||
2081 | rdlen = rx_ring->count * | ||
2082 | sizeof(struct e1000_rx_desc); | ||
2083 | adapter->clean_rx = e1000_clean_rx_irq_jumbo; | ||
2084 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers_jumbo; | ||
2085 | } else { | 1802 | } else { |
2086 | rdlen = rx_ring->count * | 1803 | rdlen = rx_ring->count * |
2087 | sizeof(struct e1000_rx_desc); | 1804 | sizeof(struct e1000_rx_desc); |
@@ -2326,8 +2043,11 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
2326 | struct e1000_mac_info *mac = &adapter->hw.mac; | 2043 | struct e1000_mac_info *mac = &adapter->hw.mac; |
2327 | struct e1000_hw *hw = &adapter->hw; | 2044 | struct e1000_hw *hw = &adapter->hw; |
2328 | u32 tx_space, min_tx_space, min_rx_space; | 2045 | u32 tx_space, min_tx_space, min_rx_space; |
2046 | u32 pba; | ||
2329 | u16 hwm; | 2047 | u16 hwm; |
2330 | 2048 | ||
2049 | ew32(PBA, adapter->pba); | ||
2050 | |||
2331 | if (mac->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN ) { | 2051 | if (mac->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN ) { |
2332 | /* To maintain wire speed transmits, the Tx FIFO should be | 2052 | /* To maintain wire speed transmits, the Tx FIFO should be |
2333 | * large enough to accommodate two full transmit packets, | 2053 | * large enough to accommodate two full transmit packets, |
@@ -2335,11 +2055,11 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
2335 | * the Rx FIFO should be large enough to accommodate at least | 2055 | * the Rx FIFO should be large enough to accommodate at least |
2336 | * one full receive packet and is similarly rounded up and | 2056 | * one full receive packet and is similarly rounded up and |
2337 | * expressed in KB. */ | 2057 | * expressed in KB. */ |
2338 | adapter->pba = er32(PBA); | 2058 | pba = er32(PBA); |
2339 | /* upper 16 bits has Tx packet buffer allocation size in KB */ | 2059 | /* upper 16 bits has Tx packet buffer allocation size in KB */ |
2340 | tx_space = adapter->pba >> 16; | 2060 | tx_space = pba >> 16; |
2341 | /* lower 16 bits has Rx packet buffer allocation size in KB */ | 2061 | /* lower 16 bits has Rx packet buffer allocation size in KB */ |
2342 | adapter->pba &= 0xffff; | 2062 | pba &= 0xffff; |
2343 | /* the tx fifo also stores 16 bytes of information about the tx | 2063 | /* the tx fifo also stores 16 bytes of information about the tx |
2344 | * but don't include ethernet FCS because hardware appends it */ | 2064 | * but don't include ethernet FCS because hardware appends it */ |
2345 | min_tx_space = (mac->max_frame_size + | 2065 | min_tx_space = (mac->max_frame_size + |
@@ -2355,20 +2075,21 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
2355 | /* If current Tx allocation is less than the min Tx FIFO size, | 2075 | /* If current Tx allocation is less than the min Tx FIFO size, |
2356 | * and the min Tx FIFO size is less than the current Rx FIFO | 2076 | * and the min Tx FIFO size is less than the current Rx FIFO |
2357 | * allocation, take space away from current Rx allocation */ | 2077 | * allocation, take space away from current Rx allocation */ |
2358 | if (tx_space < min_tx_space && | 2078 | if ((tx_space < min_tx_space) && |
2359 | ((min_tx_space - tx_space) < adapter->pba)) { | 2079 | ((min_tx_space - tx_space) < pba)) { |
2360 | adapter->pba -= - (min_tx_space - tx_space); | 2080 | pba -= min_tx_space - tx_space; |
2361 | 2081 | ||
2362 | /* if short on rx space, rx wins and must trump tx | 2082 | /* if short on rx space, rx wins and must trump tx |
2363 | * adjustment or use Early Receive if available */ | 2083 | * adjustment or use Early Receive if available */ |
2364 | if ((adapter->pba < min_rx_space) && | 2084 | if ((pba < min_rx_space) && |
2365 | (!(adapter->flags & FLAG_HAS_ERT))) | 2085 | (!(adapter->flags & FLAG_HAS_ERT))) |
2366 | /* ERT enabled in e1000_configure_rx */ | 2086 | /* ERT enabled in e1000_configure_rx */ |
2367 | adapter->pba = min_rx_space; | 2087 | pba = min_rx_space; |
2368 | } | 2088 | } |
2089 | |||
2090 | ew32(PBA, pba); | ||
2369 | } | 2091 | } |
2370 | 2092 | ||
2371 | ew32(PBA, adapter->pba); | ||
2372 | 2093 | ||
2373 | /* flow control settings */ | 2094 | /* flow control settings */ |
2374 | /* The high water mark must be low enough to fit one full frame | 2095 | /* The high water mark must be low enough to fit one full frame |
@@ -3624,9 +3345,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
3624 | /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN | 3345 | /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN |
3625 | * means we reserve 2 more, this pushes us to allocate from the next | 3346 | * means we reserve 2 more, this pushes us to allocate from the next |
3626 | * larger slab size. | 3347 | * larger slab size. |
3627 | * i.e. RXBUFFER_2048 --> size-4096 slab | 3348 | * i.e. RXBUFFER_2048 --> size-4096 slab */ |
3628 | * however with the new *_jumbo* routines, jumbo receives will use | ||
3629 | * fragmented skbs */ | ||
3630 | 3349 | ||
3631 | if (max_frame <= 256) | 3350 | if (max_frame <= 256) |
3632 | adapter->rx_buffer_len = 256; | 3351 | adapter->rx_buffer_len = 256; |
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c index e4e655efb23c..332789238b9c 100644 --- a/drivers/net/e1000e/param.c +++ b/drivers/net/e1000e/param.c | |||
@@ -52,10 +52,11 @@ MODULE_PARM_DESC(copybreak, | |||
52 | */ | 52 | */ |
53 | 53 | ||
54 | #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } | 54 | #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } |
55 | #define E1000_PARAM(X, desc) \ | 55 | #define E1000_PARAM(X, desc) \ |
56 | static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ | 56 | static int __devinitdata X[E1000_MAX_NIC+1] \ |
57 | static int num_##X; \ | 57 | = E1000_PARAM_INIT; \ |
58 | module_param_array_named(X, X, int, &num_##X, 0); \ | 58 | static unsigned int num_##X; \ |
59 | module_param_array_named(X, X, int, &num_##X, 0); \ | ||
59 | MODULE_PARM_DESC(X, desc); | 60 | MODULE_PARM_DESC(X, desc); |
60 | 61 | ||
61 | 62 | ||
@@ -124,9 +125,9 @@ E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); | |||
124 | 125 | ||
125 | struct e1000_option { | 126 | struct e1000_option { |
126 | enum { enable_option, range_option, list_option } type; | 127 | enum { enable_option, range_option, list_option } type; |
127 | char *name; | 128 | const char *name; |
128 | char *err; | 129 | const char *err; |
129 | int def; | 130 | int def; |
130 | union { | 131 | union { |
131 | struct { /* range_option info */ | 132 | struct { /* range_option info */ |
132 | int min; | 133 | int min; |
@@ -139,8 +140,8 @@ struct e1000_option { | |||
139 | } arg; | 140 | } arg; |
140 | }; | 141 | }; |
141 | 142 | ||
142 | static int __devinit e1000_validate_option(int *value, | 143 | static int __devinit e1000_validate_option(unsigned int *value, |
143 | struct e1000_option *opt, | 144 | const struct e1000_option *opt, |
144 | struct e1000_adapter *adapter) | 145 | struct e1000_adapter *adapter) |
145 | { | 146 | { |
146 | if (*value == OPTION_UNSET) { | 147 | if (*value == OPTION_UNSET) { |
@@ -213,7 +214,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
213 | } | 214 | } |
214 | 215 | ||
215 | { /* Transmit Interrupt Delay */ | 216 | { /* Transmit Interrupt Delay */ |
216 | struct e1000_option opt = { | 217 | const struct e1000_option opt = { |
217 | .type = range_option, | 218 | .type = range_option, |
218 | .name = "Transmit Interrupt Delay", | 219 | .name = "Transmit Interrupt Delay", |
219 | .err = "using default of " | 220 | .err = "using default of " |
@@ -232,7 +233,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
232 | } | 233 | } |
233 | } | 234 | } |
234 | { /* Transmit Absolute Interrupt Delay */ | 235 | { /* Transmit Absolute Interrupt Delay */ |
235 | struct e1000_option opt = { | 236 | const struct e1000_option opt = { |
236 | .type = range_option, | 237 | .type = range_option, |
237 | .name = "Transmit Absolute Interrupt Delay", | 238 | .name = "Transmit Absolute Interrupt Delay", |
238 | .err = "using default of " | 239 | .err = "using default of " |
@@ -277,7 +278,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
277 | } | 278 | } |
278 | } | 279 | } |
279 | { /* Receive Absolute Interrupt Delay */ | 280 | { /* Receive Absolute Interrupt Delay */ |
280 | struct e1000_option opt = { | 281 | const struct e1000_option opt = { |
281 | .type = range_option, | 282 | .type = range_option, |
282 | .name = "Receive Absolute Interrupt Delay", | 283 | .name = "Receive Absolute Interrupt Delay", |
283 | .err = "using default of " | 284 | .err = "using default of " |
@@ -296,7 +297,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
296 | } | 297 | } |
297 | } | 298 | } |
298 | { /* Interrupt Throttling Rate */ | 299 | { /* Interrupt Throttling Rate */ |
299 | struct e1000_option opt = { | 300 | const struct e1000_option opt = { |
300 | .type = range_option, | 301 | .type = range_option, |
301 | .name = "Interrupt Throttling Rate (ints/sec)", | 302 | .name = "Interrupt Throttling Rate (ints/sec)", |
302 | .err = "using default of " | 303 | .err = "using default of " |
@@ -344,7 +345,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
344 | } | 345 | } |
345 | } | 346 | } |
346 | { /* Smart Power Down */ | 347 | { /* Smart Power Down */ |
347 | struct e1000_option opt = { | 348 | const struct e1000_option opt = { |
348 | .type = enable_option, | 349 | .type = enable_option, |
349 | .name = "PHY Smart Power Down", | 350 | .name = "PHY Smart Power Down", |
350 | .err = "defaulting to Disabled", | 351 | .err = "defaulting to Disabled", |
@@ -352,7 +353,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
352 | }; | 353 | }; |
353 | 354 | ||
354 | if (num_SmartPowerDownEnable > bd) { | 355 | if (num_SmartPowerDownEnable > bd) { |
355 | int spd = SmartPowerDownEnable[bd]; | 356 | unsigned int spd = SmartPowerDownEnable[bd]; |
356 | e1000_validate_option(&spd, &opt, adapter); | 357 | e1000_validate_option(&spd, &opt, adapter); |
357 | if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) | 358 | if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) |
358 | && spd) | 359 | && spd) |
@@ -360,7 +361,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
360 | } | 361 | } |
361 | } | 362 | } |
362 | { /* Kumeran Lock Loss Workaround */ | 363 | { /* Kumeran Lock Loss Workaround */ |
363 | struct e1000_option opt = { | 364 | const struct e1000_option opt = { |
364 | .type = enable_option, | 365 | .type = enable_option, |
365 | .name = "Kumeran Lock Loss Workaround", | 366 | .name = "Kumeran Lock Loss Workaround", |
366 | .err = "defaulting to Enabled", | 367 | .err = "defaulting to Enabled", |
@@ -368,7 +369,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
368 | }; | 369 | }; |
369 | 370 | ||
370 | if (num_KumeranLockLoss > bd) { | 371 | if (num_KumeranLockLoss > bd) { |
371 | int kmrn_lock_loss = KumeranLockLoss[bd]; | 372 | unsigned int kmrn_lock_loss = KumeranLockLoss[bd]; |
372 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); | 373 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); |
373 | if (hw->mac.type == e1000_ich8lan) | 374 | if (hw->mac.type == e1000_ich8lan) |
374 | e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, | 375 | e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 4b4b74e47a67..f78e5bf7cb33 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_0079" | 43 | #define DRV_VERSION "EHEA_0080" |
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 0a7e78925540..f0319f1e8e05 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -33,6 +33,9 @@ | |||
33 | #include <linux/if.h> | 33 | #include <linux/if.h> |
34 | #include <linux/list.h> | 34 | #include <linux/list.h> |
35 | #include <linux/if_ether.h> | 35 | #include <linux/if_ether.h> |
36 | #include <linux/notifier.h> | ||
37 | #include <linux/reboot.h> | ||
38 | |||
36 | #include <net/ip.h> | 39 | #include <net/ip.h> |
37 | 40 | ||
38 | #include "ehea.h" | 41 | #include "ehea.h" |
@@ -3295,6 +3298,20 @@ static int __devexit ehea_remove(struct of_device *dev) | |||
3295 | return 0; | 3298 | return 0; |
3296 | } | 3299 | } |
3297 | 3300 | ||
3301 | static int ehea_reboot_notifier(struct notifier_block *nb, | ||
3302 | unsigned long action, void *unused) | ||
3303 | { | ||
3304 | if (action == SYS_RESTART) { | ||
3305 | ehea_info("Reboot: freeing all eHEA resources"); | ||
3306 | ibmebus_unregister_driver(&ehea_driver); | ||
3307 | } | ||
3308 | return NOTIFY_DONE; | ||
3309 | } | ||
3310 | |||
3311 | static struct notifier_block ehea_reboot_nb = { | ||
3312 | .notifier_call = ehea_reboot_notifier, | ||
3313 | }; | ||
3314 | |||
3298 | static int check_module_parm(void) | 3315 | static int check_module_parm(void) |
3299 | { | 3316 | { |
3300 | int ret = 0; | 3317 | int ret = 0; |
@@ -3351,6 +3368,8 @@ int __init ehea_module_init(void) | |||
3351 | if (ret) | 3368 | if (ret) |
3352 | goto out; | 3369 | goto out; |
3353 | 3370 | ||
3371 | register_reboot_notifier(&ehea_reboot_nb); | ||
3372 | |||
3354 | ret = ibmebus_register_driver(&ehea_driver); | 3373 | ret = ibmebus_register_driver(&ehea_driver); |
3355 | if (ret) { | 3374 | if (ret) { |
3356 | ehea_error("failed registering eHEA device driver on ebus"); | 3375 | ehea_error("failed registering eHEA device driver on ebus"); |
@@ -3362,6 +3381,7 @@ int __init ehea_module_init(void) | |||
3362 | if (ret) { | 3381 | if (ret) { |
3363 | ehea_error("failed to register capabilities attribute, ret=%d", | 3382 | ehea_error("failed to register capabilities attribute, ret=%d", |
3364 | ret); | 3383 | ret); |
3384 | unregister_reboot_notifier(&ehea_reboot_nb); | ||
3365 | ibmebus_unregister_driver(&ehea_driver); | 3385 | ibmebus_unregister_driver(&ehea_driver); |
3366 | goto out; | 3386 | goto out; |
3367 | } | 3387 | } |
@@ -3375,6 +3395,7 @@ static void __exit ehea_module_exit(void) | |||
3375 | flush_scheduled_work(); | 3395 | flush_scheduled_work(); |
3376 | driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); | 3396 | driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); |
3377 | ibmebus_unregister_driver(&ehea_driver); | 3397 | ibmebus_unregister_driver(&ehea_driver); |
3398 | unregister_reboot_notifier(&ehea_reboot_nb); | ||
3378 | ehea_destroy_busmap(); | 3399 | ehea_destroy_busmap(); |
3379 | } | 3400 | } |
3380 | 3401 | ||
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c new file mode 100644 index 000000000000..a8a0ee220da6 --- /dev/null +++ b/drivers/net/fec_mpc52xx.c | |||
@@ -0,0 +1,1112 @@ | |||
1 | /* | ||
2 | * Driver for the MPC5200 Fast Ethernet Controller | ||
3 | * | ||
4 | * Originally written by Dale Farnsworth <dfarnsworth@mvista.com> and | ||
5 | * now maintained by Sylvain Munaut <tnt@246tNt.com> | ||
6 | * | ||
7 | * Copyright (C) 2007 Domen Puncer, Telargo, Inc. | ||
8 | * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com> | ||
9 | * Copyright (C) 2003-2004 MontaVista, Software, Inc. | ||
10 | * | ||
11 | * This file is licensed under the terms of the GNU General Public License | ||
12 | * version 2. This program is licensed "as is" without any warranty of any | ||
13 | * kind, whether express or implied. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/types.h> | ||
21 | #include <linux/spinlock.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/crc32.h> | ||
25 | #include <linux/hardirq.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <linux/of_device.h> | ||
28 | #include <linux/of_platform.h> | ||
29 | |||
30 | #include <linux/netdevice.h> | ||
31 | #include <linux/etherdevice.h> | ||
32 | #include <linux/ethtool.h> | ||
33 | #include <linux/skbuff.h> | ||
34 | |||
35 | #include <asm/io.h> | ||
36 | #include <asm/delay.h> | ||
37 | #include <asm/mpc52xx.h> | ||
38 | |||
39 | #include <sysdev/bestcomm/bestcomm.h> | ||
40 | #include <sysdev/bestcomm/fec.h> | ||
41 | |||
42 | #include "fec_mpc52xx.h" | ||
43 | |||
44 | #define DRIVER_NAME "mpc52xx-fec" | ||
45 | |||
46 | static irqreturn_t mpc52xx_fec_interrupt(int, void *); | ||
47 | static irqreturn_t mpc52xx_fec_rx_interrupt(int, void *); | ||
48 | static irqreturn_t mpc52xx_fec_tx_interrupt(int, void *); | ||
49 | static void mpc52xx_fec_stop(struct net_device *dev); | ||
50 | static void mpc52xx_fec_start(struct net_device *dev); | ||
51 | static void mpc52xx_fec_reset(struct net_device *dev); | ||
52 | |||
53 | static u8 mpc52xx_fec_mac_addr[6]; | ||
54 | module_param_array_named(mac, mpc52xx_fec_mac_addr, byte, NULL, 0); | ||
55 | MODULE_PARM_DESC(mac, "six hex digits, ie. 0x1,0x2,0xc0,0x01,0xba,0xbe"); | ||
56 | |||
57 | #define MPC52xx_MESSAGES_DEFAULT ( NETIF_MSG_DRV | NETIF_MSG_PROBE | \ | ||
58 | NETIF_MSG_LINK | NETIF_MSG_IFDOWN | NETIF_MSG_IFDOWN ) | ||
59 | static int debug = -1; /* the above default */ | ||
60 | module_param(debug, int, 0); | ||
61 | MODULE_PARM_DESC(debug, "debugging messages level"); | ||
62 | |||
63 | static void mpc52xx_fec_tx_timeout(struct net_device *dev) | ||
64 | { | ||
65 | dev_warn(&dev->dev, "transmit timed out\n"); | ||
66 | |||
67 | mpc52xx_fec_reset(dev); | ||
68 | |||
69 | dev->stats.tx_errors++; | ||
70 | |||
71 | netif_wake_queue(dev); | ||
72 | } | ||
73 | |||
74 | static void mpc52xx_fec_set_paddr(struct net_device *dev, u8 *mac) | ||
75 | { | ||
76 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
77 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
78 | |||
79 | out_be32(&fec->paddr1, *(u32 *)(&mac[0])); | ||
80 | out_be32(&fec->paddr2, (*(u16 *)(&mac[4]) << 16) | FEC_PADDR2_TYPE); | ||
81 | } | ||
82 | |||
83 | static void mpc52xx_fec_get_paddr(struct net_device *dev, u8 *mac) | ||
84 | { | ||
85 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
86 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
87 | |||
88 | *(u32 *)(&mac[0]) = in_be32(&fec->paddr1); | ||
89 | *(u16 *)(&mac[4]) = in_be32(&fec->paddr2) >> 16; | ||
90 | } | ||
91 | |||
92 | static int mpc52xx_fec_set_mac_address(struct net_device *dev, void *addr) | ||
93 | { | ||
94 | struct sockaddr *sock = addr; | ||
95 | |||
96 | memcpy(dev->dev_addr, sock->sa_data, dev->addr_len); | ||
97 | |||
98 | mpc52xx_fec_set_paddr(dev, sock->sa_data); | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | static void mpc52xx_fec_free_rx_buffers(struct net_device *dev, struct bcom_task *s) | ||
103 | { | ||
104 | while (!bcom_queue_empty(s)) { | ||
105 | struct bcom_fec_bd *bd; | ||
106 | struct sk_buff *skb; | ||
107 | |||
108 | skb = bcom_retrieve_buffer(s, NULL, (struct bcom_bd **)&bd); | ||
109 | dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_FROM_DEVICE); | ||
110 | kfree_skb(skb); | ||
111 | } | ||
112 | } | ||
113 | |||
114 | static int mpc52xx_fec_alloc_rx_buffers(struct net_device *dev, struct bcom_task *rxtsk) | ||
115 | { | ||
116 | while (!bcom_queue_full(rxtsk)) { | ||
117 | struct sk_buff *skb; | ||
118 | struct bcom_fec_bd *bd; | ||
119 | |||
120 | skb = dev_alloc_skb(FEC_RX_BUFFER_SIZE); | ||
121 | if (skb == NULL) | ||
122 | return -EAGAIN; | ||
123 | |||
124 | /* zero out the initial receive buffers to aid debugging */ | ||
125 | memset(skb->data, 0, FEC_RX_BUFFER_SIZE); | ||
126 | |||
127 | bd = (struct bcom_fec_bd *)bcom_prepare_next_buffer(rxtsk); | ||
128 | |||
129 | bd->status = FEC_RX_BUFFER_SIZE; | ||
130 | bd->skb_pa = dma_map_single(&dev->dev, skb->data, | ||
131 | FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); | ||
132 | |||
133 | bcom_submit_next_buffer(rxtsk, skb); | ||
134 | } | ||
135 | |||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | /* based on generic_adjust_link from fs_enet-main.c */ | ||
140 | static void mpc52xx_fec_adjust_link(struct net_device *dev) | ||
141 | { | ||
142 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
143 | struct phy_device *phydev = priv->phydev; | ||
144 | int new_state = 0; | ||
145 | |||
146 | if (phydev->link != PHY_DOWN) { | ||
147 | if (phydev->duplex != priv->duplex) { | ||
148 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
149 | u32 rcntrl; | ||
150 | u32 tcntrl; | ||
151 | |||
152 | new_state = 1; | ||
153 | priv->duplex = phydev->duplex; | ||
154 | |||
155 | rcntrl = in_be32(&fec->r_cntrl); | ||
156 | tcntrl = in_be32(&fec->x_cntrl); | ||
157 | |||
158 | rcntrl &= ~FEC_RCNTRL_DRT; | ||
159 | tcntrl &= ~FEC_TCNTRL_FDEN; | ||
160 | if (phydev->duplex == DUPLEX_FULL) | ||
161 | tcntrl |= FEC_TCNTRL_FDEN; /* FD enable */ | ||
162 | else | ||
163 | rcntrl |= FEC_RCNTRL_DRT; /* disable Rx on Tx (HD) */ | ||
164 | |||
165 | out_be32(&fec->r_cntrl, rcntrl); | ||
166 | out_be32(&fec->x_cntrl, tcntrl); | ||
167 | } | ||
168 | |||
169 | if (phydev->speed != priv->speed) { | ||
170 | new_state = 1; | ||
171 | priv->speed = phydev->speed; | ||
172 | } | ||
173 | |||
174 | if (priv->link == PHY_DOWN) { | ||
175 | new_state = 1; | ||
176 | priv->link = phydev->link; | ||
177 | netif_schedule(dev); | ||
178 | netif_carrier_on(dev); | ||
179 | netif_start_queue(dev); | ||
180 | } | ||
181 | |||
182 | } else if (priv->link) { | ||
183 | new_state = 1; | ||
184 | priv->link = PHY_DOWN; | ||
185 | priv->speed = 0; | ||
186 | priv->duplex = -1; | ||
187 | netif_stop_queue(dev); | ||
188 | netif_carrier_off(dev); | ||
189 | } | ||
190 | |||
191 | if (new_state && netif_msg_link(priv)) | ||
192 | phy_print_status(phydev); | ||
193 | } | ||
194 | |||
195 | static int mpc52xx_fec_init_phy(struct net_device *dev) | ||
196 | { | ||
197 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
198 | struct phy_device *phydev; | ||
199 | char phy_id[BUS_ID_SIZE]; | ||
200 | |||
201 | snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, | ||
202 | (unsigned int)dev->base_addr, priv->phy_addr); | ||
203 | |||
204 | priv->link = PHY_DOWN; | ||
205 | priv->speed = 0; | ||
206 | priv->duplex = -1; | ||
207 | |||
208 | phydev = phy_connect(dev, phy_id, &mpc52xx_fec_adjust_link, 0, PHY_INTERFACE_MODE_MII); | ||
209 | if (IS_ERR(phydev)) { | ||
210 | dev_err(&dev->dev, "phy_connect failed\n"); | ||
211 | return PTR_ERR(phydev); | ||
212 | } | ||
213 | dev_info(&dev->dev, "attached phy %i to driver %s\n", | ||
214 | phydev->addr, phydev->drv->name); | ||
215 | |||
216 | priv->phydev = phydev; | ||
217 | |||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static int mpc52xx_fec_phy_start(struct net_device *dev) | ||
222 | { | ||
223 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
224 | int err; | ||
225 | |||
226 | if (!priv->has_phy) | ||
227 | return 0; | ||
228 | |||
229 | err = mpc52xx_fec_init_phy(dev); | ||
230 | if (err) { | ||
231 | dev_err(&dev->dev, "mpc52xx_fec_init_phy failed\n"); | ||
232 | return err; | ||
233 | } | ||
234 | |||
235 | /* reset phy - this also wakes it from PDOWN */ | ||
236 | phy_write(priv->phydev, MII_BMCR, BMCR_RESET); | ||
237 | phy_start(priv->phydev); | ||
238 | |||
239 | return 0; | ||
240 | } | ||
241 | |||
242 | static void mpc52xx_fec_phy_stop(struct net_device *dev) | ||
243 | { | ||
244 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
245 | |||
246 | if (!priv->has_phy) | ||
247 | return; | ||
248 | |||
249 | phy_disconnect(priv->phydev); | ||
250 | /* power down phy */ | ||
251 | phy_stop(priv->phydev); | ||
252 | phy_write(priv->phydev, MII_BMCR, BMCR_PDOWN); | ||
253 | } | ||
254 | |||
255 | static int mpc52xx_fec_phy_mii_ioctl(struct mpc52xx_fec_priv *priv, | ||
256 | struct mii_ioctl_data *mii_data, int cmd) | ||
257 | { | ||
258 | if (!priv->has_phy) | ||
259 | return -ENOTSUPP; | ||
260 | |||
261 | return phy_mii_ioctl(priv->phydev, mii_data, cmd); | ||
262 | } | ||
263 | |||
264 | static void mpc52xx_fec_phy_hw_init(struct mpc52xx_fec_priv *priv) | ||
265 | { | ||
266 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
267 | |||
268 | if (!priv->has_phy) | ||
269 | return; | ||
270 | |||
271 | out_be32(&fec->mii_speed, priv->phy_speed); | ||
272 | } | ||
273 | |||
274 | static int mpc52xx_fec_open(struct net_device *dev) | ||
275 | { | ||
276 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
277 | int err = -EBUSY; | ||
278 | |||
279 | if (request_irq(dev->irq, &mpc52xx_fec_interrupt, IRQF_SHARED, | ||
280 | DRIVER_NAME "_ctrl", dev)) { | ||
281 | dev_err(&dev->dev, "ctrl interrupt request failed\n"); | ||
282 | goto out; | ||
283 | } | ||
284 | if (request_irq(priv->r_irq, &mpc52xx_fec_rx_interrupt, 0, | ||
285 | DRIVER_NAME "_rx", dev)) { | ||
286 | dev_err(&dev->dev, "rx interrupt request failed\n"); | ||
287 | goto free_ctrl_irq; | ||
288 | } | ||
289 | if (request_irq(priv->t_irq, &mpc52xx_fec_tx_interrupt, 0, | ||
290 | DRIVER_NAME "_tx", dev)) { | ||
291 | dev_err(&dev->dev, "tx interrupt request failed\n"); | ||
292 | goto free_2irqs; | ||
293 | } | ||
294 | |||
295 | bcom_fec_rx_reset(priv->rx_dmatsk); | ||
296 | bcom_fec_tx_reset(priv->tx_dmatsk); | ||
297 | |||
298 | err = mpc52xx_fec_alloc_rx_buffers(dev, priv->rx_dmatsk); | ||
299 | if (err) { | ||
300 | dev_err(&dev->dev, "mpc52xx_fec_alloc_rx_buffers failed\n"); | ||
301 | goto free_irqs; | ||
302 | } | ||
303 | |||
304 | err = mpc52xx_fec_phy_start(dev); | ||
305 | if (err) | ||
306 | goto free_skbs; | ||
307 | |||
308 | bcom_enable(priv->rx_dmatsk); | ||
309 | bcom_enable(priv->tx_dmatsk); | ||
310 | |||
311 | mpc52xx_fec_start(dev); | ||
312 | |||
313 | netif_start_queue(dev); | ||
314 | |||
315 | return 0; | ||
316 | |||
317 | free_skbs: | ||
318 | mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk); | ||
319 | |||
320 | free_irqs: | ||
321 | free_irq(priv->t_irq, dev); | ||
322 | free_2irqs: | ||
323 | free_irq(priv->r_irq, dev); | ||
324 | free_ctrl_irq: | ||
325 | free_irq(dev->irq, dev); | ||
326 | out: | ||
327 | |||
328 | return err; | ||
329 | } | ||
330 | |||
331 | static int mpc52xx_fec_close(struct net_device *dev) | ||
332 | { | ||
333 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
334 | |||
335 | netif_stop_queue(dev); | ||
336 | |||
337 | mpc52xx_fec_stop(dev); | ||
338 | |||
339 | mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk); | ||
340 | |||
341 | free_irq(dev->irq, dev); | ||
342 | free_irq(priv->r_irq, dev); | ||
343 | free_irq(priv->t_irq, dev); | ||
344 | |||
345 | mpc52xx_fec_phy_stop(dev); | ||
346 | |||
347 | return 0; | ||
348 | } | ||
349 | |||
350 | /* This will only be invoked if your driver is _not_ in XOFF state. | ||
351 | * What this means is that you need not check it, and that this | ||
352 | * invariant will hold if you make sure that the netif_*_queue() | ||
353 | * calls are done at the proper times. | ||
354 | */ | ||
355 | static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
356 | { | ||
357 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
358 | struct bcom_fec_bd *bd; | ||
359 | |||
360 | if (bcom_queue_full(priv->tx_dmatsk)) { | ||
361 | if (net_ratelimit()) | ||
362 | dev_err(&dev->dev, "transmit queue overrun\n"); | ||
363 | return 1; | ||
364 | } | ||
365 | |||
366 | spin_lock_irq(&priv->lock); | ||
367 | dev->trans_start = jiffies; | ||
368 | |||
369 | bd = (struct bcom_fec_bd *) | ||
370 | bcom_prepare_next_buffer(priv->tx_dmatsk); | ||
371 | |||
372 | bd->status = skb->len | BCOM_FEC_TX_BD_TFD | BCOM_FEC_TX_BD_TC; | ||
373 | bd->skb_pa = dma_map_single(&dev->dev, skb->data, skb->len, DMA_TO_DEVICE); | ||
374 | |||
375 | bcom_submit_next_buffer(priv->tx_dmatsk, skb); | ||
376 | |||
377 | if (bcom_queue_full(priv->tx_dmatsk)) { | ||
378 | netif_stop_queue(dev); | ||
379 | } | ||
380 | |||
381 | spin_unlock_irq(&priv->lock); | ||
382 | |||
383 | return 0; | ||
384 | } | ||
385 | |||
386 | /* This handles BestComm transmit task interrupts | ||
387 | */ | ||
388 | static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id) | ||
389 | { | ||
390 | struct net_device *dev = dev_id; | ||
391 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
392 | |||
393 | spin_lock(&priv->lock); | ||
394 | |||
395 | while (bcom_buffer_done(priv->tx_dmatsk)) { | ||
396 | struct sk_buff *skb; | ||
397 | struct bcom_fec_bd *bd; | ||
398 | skb = bcom_retrieve_buffer(priv->tx_dmatsk, NULL, | ||
399 | (struct bcom_bd **)&bd); | ||
400 | dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_TO_DEVICE); | ||
401 | |||
402 | dev_kfree_skb_irq(skb); | ||
403 | } | ||
404 | |||
405 | netif_wake_queue(dev); | ||
406 | |||
407 | spin_unlock(&priv->lock); | ||
408 | |||
409 | return IRQ_HANDLED; | ||
410 | } | ||
411 | |||
412 | static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) | ||
413 | { | ||
414 | struct net_device *dev = dev_id; | ||
415 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
416 | |||
417 | while (bcom_buffer_done(priv->rx_dmatsk)) { | ||
418 | struct sk_buff *skb; | ||
419 | struct sk_buff *rskb; | ||
420 | struct bcom_fec_bd *bd; | ||
421 | u32 status; | ||
422 | |||
423 | rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status, | ||
424 | (struct bcom_bd **)&bd); | ||
425 | dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_FROM_DEVICE); | ||
426 | |||
427 | /* Test for errors in received frame */ | ||
428 | if (status & BCOM_FEC_RX_BD_ERRORS) { | ||
429 | /* Drop packet and reuse the buffer */ | ||
430 | bd = (struct bcom_fec_bd *) | ||
431 | bcom_prepare_next_buffer(priv->rx_dmatsk); | ||
432 | |||
433 | bd->status = FEC_RX_BUFFER_SIZE; | ||
434 | bd->skb_pa = dma_map_single(&dev->dev, rskb->data, | ||
435 | FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); | ||
436 | |||
437 | bcom_submit_next_buffer(priv->rx_dmatsk, rskb); | ||
438 | |||
439 | dev->stats.rx_dropped++; | ||
440 | |||
441 | continue; | ||
442 | } | ||
443 | |||
444 | /* skbs are allocated on open, so now we allocate a new one, | ||
445 | * and remove the old (with the packet) */ | ||
446 | skb = dev_alloc_skb(FEC_RX_BUFFER_SIZE); | ||
447 | if (skb) { | ||
448 | /* Process the received skb */ | ||
449 | int length = status & BCOM_FEC_RX_BD_LEN_MASK; | ||
450 | |||
451 | skb_put(rskb, length - 4); /* length without CRC32 */ | ||
452 | |||
453 | rskb->dev = dev; | ||
454 | rskb->protocol = eth_type_trans(rskb, dev); | ||
455 | |||
456 | netif_rx(rskb); | ||
457 | dev->last_rx = jiffies; | ||
458 | } else { | ||
459 | /* Can't get a new one : reuse the same & drop pkt */ | ||
460 | dev_notice(&dev->dev, "Memory squeeze, dropping packet.\n"); | ||
461 | dev->stats.rx_dropped++; | ||
462 | |||
463 | skb = rskb; | ||
464 | } | ||
465 | |||
466 | bd = (struct bcom_fec_bd *) | ||
467 | bcom_prepare_next_buffer(priv->rx_dmatsk); | ||
468 | |||
469 | bd->status = FEC_RX_BUFFER_SIZE; | ||
470 | bd->skb_pa = dma_map_single(&dev->dev, rskb->data, | ||
471 | FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); | ||
472 | |||
473 | bcom_submit_next_buffer(priv->rx_dmatsk, skb); | ||
474 | } | ||
475 | |||
476 | return IRQ_HANDLED; | ||
477 | } | ||
478 | |||
479 | static irqreturn_t mpc52xx_fec_interrupt(int irq, void *dev_id) | ||
480 | { | ||
481 | struct net_device *dev = dev_id; | ||
482 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
483 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
484 | u32 ievent; | ||
485 | |||
486 | ievent = in_be32(&fec->ievent); | ||
487 | |||
488 | ievent &= ~FEC_IEVENT_MII; /* mii is handled separately */ | ||
489 | if (!ievent) | ||
490 | return IRQ_NONE; | ||
491 | |||
492 | out_be32(&fec->ievent, ievent); /* clear pending events */ | ||
493 | |||
494 | if (ievent & ~(FEC_IEVENT_RFIFO_ERROR | FEC_IEVENT_XFIFO_ERROR)) { | ||
495 | if (ievent & ~FEC_IEVENT_TFINT) | ||
496 | dev_dbg(&dev->dev, "ievent: %08x\n", ievent); | ||
497 | return IRQ_HANDLED; | ||
498 | } | ||
499 | |||
500 | if (net_ratelimit() && (ievent & FEC_IEVENT_RFIFO_ERROR)) | ||
501 | dev_warn(&dev->dev, "FEC_IEVENT_RFIFO_ERROR\n"); | ||
502 | if (net_ratelimit() && (ievent & FEC_IEVENT_XFIFO_ERROR)) | ||
503 | dev_warn(&dev->dev, "FEC_IEVENT_XFIFO_ERROR\n"); | ||
504 | |||
505 | mpc52xx_fec_reset(dev); | ||
506 | |||
507 | netif_wake_queue(dev); | ||
508 | return IRQ_HANDLED; | ||
509 | } | ||
510 | |||
511 | /* | ||
512 | * Get the current statistics. | ||
513 | * This may be called with the card open or closed. | ||
514 | */ | ||
515 | static struct net_device_stats *mpc52xx_fec_get_stats(struct net_device *dev) | ||
516 | { | ||
517 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
518 | struct net_device_stats *stats = &dev->stats; | ||
519 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
520 | |||
521 | stats->rx_bytes = in_be32(&fec->rmon_r_octets); | ||
522 | stats->rx_packets = in_be32(&fec->rmon_r_packets); | ||
523 | stats->rx_errors = in_be32(&fec->rmon_r_crc_align) + | ||
524 | in_be32(&fec->rmon_r_undersize) + | ||
525 | in_be32(&fec->rmon_r_oversize) + | ||
526 | in_be32(&fec->rmon_r_frag) + | ||
527 | in_be32(&fec->rmon_r_jab); | ||
528 | |||
529 | stats->tx_bytes = in_be32(&fec->rmon_t_octets); | ||
530 | stats->tx_packets = in_be32(&fec->rmon_t_packets); | ||
531 | stats->tx_errors = in_be32(&fec->rmon_t_crc_align) + | ||
532 | in_be32(&fec->rmon_t_undersize) + | ||
533 | in_be32(&fec->rmon_t_oversize) + | ||
534 | in_be32(&fec->rmon_t_frag) + | ||
535 | in_be32(&fec->rmon_t_jab); | ||
536 | |||
537 | stats->multicast = in_be32(&fec->rmon_r_mc_pkt); | ||
538 | stats->collisions = in_be32(&fec->rmon_t_col); | ||
539 | |||
540 | /* detailed rx_errors: */ | ||
541 | stats->rx_length_errors = in_be32(&fec->rmon_r_undersize) | ||
542 | + in_be32(&fec->rmon_r_oversize) | ||
543 | + in_be32(&fec->rmon_r_frag) | ||
544 | + in_be32(&fec->rmon_r_jab); | ||
545 | stats->rx_over_errors = in_be32(&fec->r_macerr); | ||
546 | stats->rx_crc_errors = in_be32(&fec->ieee_r_crc); | ||
547 | stats->rx_frame_errors = in_be32(&fec->ieee_r_align); | ||
548 | stats->rx_fifo_errors = in_be32(&fec->rmon_r_drop); | ||
549 | stats->rx_missed_errors = in_be32(&fec->rmon_r_drop); | ||
550 | |||
551 | /* detailed tx_errors: */ | ||
552 | stats->tx_aborted_errors = 0; | ||
553 | stats->tx_carrier_errors = in_be32(&fec->ieee_t_cserr); | ||
554 | stats->tx_fifo_errors = in_be32(&fec->rmon_t_drop); | ||
555 | stats->tx_heartbeat_errors = in_be32(&fec->ieee_t_sqe); | ||
556 | stats->tx_window_errors = in_be32(&fec->ieee_t_lcol); | ||
557 | |||
558 | return stats; | ||
559 | } | ||
560 | |||
561 | /* | ||
562 | * Read MIB counters in order to reset them, | ||
563 | * then zero all the stats fields in memory | ||
564 | */ | ||
565 | static void mpc52xx_fec_reset_stats(struct net_device *dev) | ||
566 | { | ||
567 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
568 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
569 | |||
570 | out_be32(&fec->mib_control, FEC_MIB_DISABLE); | ||
571 | memset_io(&fec->rmon_t_drop, 0, (__force u32)&fec->reserved10 - | ||
572 | (__force u32)&fec->rmon_t_drop); | ||
573 | out_be32(&fec->mib_control, 0); | ||
574 | |||
575 | memset(&dev->stats, 0, sizeof(dev->stats)); | ||
576 | } | ||
577 | |||
578 | /* | ||
579 | * Set or clear the multicast filter for this adaptor. | ||
580 | */ | ||
581 | static void mpc52xx_fec_set_multicast_list(struct net_device *dev) | ||
582 | { | ||
583 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
584 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
585 | u32 rx_control; | ||
586 | |||
587 | rx_control = in_be32(&fec->r_cntrl); | ||
588 | |||
589 | if (dev->flags & IFF_PROMISC) { | ||
590 | rx_control |= FEC_RCNTRL_PROM; | ||
591 | out_be32(&fec->r_cntrl, rx_control); | ||
592 | } else { | ||
593 | rx_control &= ~FEC_RCNTRL_PROM; | ||
594 | out_be32(&fec->r_cntrl, rx_control); | ||
595 | |||
596 | if (dev->flags & IFF_ALLMULTI) { | ||
597 | out_be32(&fec->gaddr1, 0xffffffff); | ||
598 | out_be32(&fec->gaddr2, 0xffffffff); | ||
599 | } else { | ||
600 | u32 crc; | ||
601 | int i; | ||
602 | struct dev_mc_list *dmi; | ||
603 | u32 gaddr1 = 0x00000000; | ||
604 | u32 gaddr2 = 0x00000000; | ||
605 | |||
606 | dmi = dev->mc_list; | ||
607 | for (i=0; i<dev->mc_count; i++) { | ||
608 | crc = ether_crc_le(6, dmi->dmi_addr) >> 26; | ||
609 | if (crc >= 32) | ||
610 | gaddr1 |= 1 << (crc-32); | ||
611 | else | ||
612 | gaddr2 |= 1 << crc; | ||
613 | dmi = dmi->next; | ||
614 | } | ||
615 | out_be32(&fec->gaddr1, gaddr1); | ||
616 | out_be32(&fec->gaddr2, gaddr2); | ||
617 | } | ||
618 | } | ||
619 | } | ||
620 | |||
621 | /** | ||
622 | * mpc52xx_fec_hw_init | ||
623 | * @dev: network device | ||
624 | * | ||
625 | * Setup various hardware setting, only needed once on start | ||
626 | */ | ||
627 | static void mpc52xx_fec_hw_init(struct net_device *dev) | ||
628 | { | ||
629 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
630 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
631 | int i; | ||
632 | |||
633 | /* Whack a reset. We should wait for this. */ | ||
634 | out_be32(&fec->ecntrl, FEC_ECNTRL_RESET); | ||
635 | for (i = 0; i < FEC_RESET_DELAY; ++i) { | ||
636 | if ((in_be32(&fec->ecntrl) & FEC_ECNTRL_RESET) == 0) | ||
637 | break; | ||
638 | udelay(1); | ||
639 | } | ||
640 | if (i == FEC_RESET_DELAY) | ||
641 | dev_err(&dev->dev, "FEC Reset timeout!\n"); | ||
642 | |||
643 | /* set pause to 0x20 frames */ | ||
644 | out_be32(&fec->op_pause, FEC_OP_PAUSE_OPCODE | 0x20); | ||
645 | |||
646 | /* high service request will be deasserted when there's < 7 bytes in fifo | ||
647 | * low service request will be deasserted when there's < 4*7 bytes in fifo | ||
648 | */ | ||
649 | out_be32(&fec->rfifo_cntrl, FEC_FIFO_CNTRL_FRAME | FEC_FIFO_CNTRL_LTG_7); | ||
650 | out_be32(&fec->tfifo_cntrl, FEC_FIFO_CNTRL_FRAME | FEC_FIFO_CNTRL_LTG_7); | ||
651 | |||
652 | /* alarm when <= x bytes in FIFO */ | ||
653 | out_be32(&fec->rfifo_alarm, 0x0000030c); | ||
654 | out_be32(&fec->tfifo_alarm, 0x00000100); | ||
655 | |||
656 | /* begin transmittion when 256 bytes are in FIFO (or EOF or FIFO full) */ | ||
657 | out_be32(&fec->x_wmrk, FEC_FIFO_WMRK_256B); | ||
658 | |||
659 | /* enable crc generation */ | ||
660 | out_be32(&fec->xmit_fsm, FEC_XMIT_FSM_APPEND_CRC | FEC_XMIT_FSM_ENABLE_CRC); | ||
661 | out_be32(&fec->iaddr1, 0x00000000); /* No individual filter */ | ||
662 | out_be32(&fec->iaddr2, 0x00000000); /* No individual filter */ | ||
663 | |||
664 | /* set phy speed. | ||
665 | * this can't be done in phy driver, since it needs to be called | ||
666 | * before fec stuff (even on resume) */ | ||
667 | mpc52xx_fec_phy_hw_init(priv); | ||
668 | } | ||
669 | |||
670 | /** | ||
671 | * mpc52xx_fec_start | ||
672 | * @dev: network device | ||
673 | * | ||
674 | * This function is called to start or restart the FEC during a link | ||
675 | * change. This happens on fifo errors or when switching between half | ||
676 | * and full duplex. | ||
677 | */ | ||
678 | static void mpc52xx_fec_start(struct net_device *dev) | ||
679 | { | ||
680 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
681 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
682 | u32 rcntrl; | ||
683 | u32 tcntrl; | ||
684 | u32 tmp; | ||
685 | |||
686 | /* clear sticky error bits */ | ||
687 | tmp = FEC_FIFO_STATUS_ERR | FEC_FIFO_STATUS_UF | FEC_FIFO_STATUS_OF; | ||
688 | out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status) & tmp); | ||
689 | out_be32(&fec->tfifo_status, in_be32(&fec->tfifo_status) & tmp); | ||
690 | |||
691 | /* FIFOs will reset on mpc52xx_fec_enable */ | ||
692 | out_be32(&fec->reset_cntrl, FEC_RESET_CNTRL_ENABLE_IS_RESET); | ||
693 | |||
694 | /* Set station address. */ | ||
695 | mpc52xx_fec_set_paddr(dev, dev->dev_addr); | ||
696 | |||
697 | mpc52xx_fec_set_multicast_list(dev); | ||
698 | |||
699 | /* set max frame len, enable flow control, select mii mode */ | ||
700 | rcntrl = FEC_RX_BUFFER_SIZE << 16; /* max frame length */ | ||
701 | rcntrl |= FEC_RCNTRL_FCE; | ||
702 | |||
703 | if (priv->has_phy) | ||
704 | rcntrl |= FEC_RCNTRL_MII_MODE; | ||
705 | |||
706 | if (priv->duplex == DUPLEX_FULL) | ||
707 | tcntrl = FEC_TCNTRL_FDEN; /* FD enable */ | ||
708 | else { | ||
709 | rcntrl |= FEC_RCNTRL_DRT; /* disable Rx on Tx (HD) */ | ||
710 | tcntrl = 0; | ||
711 | } | ||
712 | out_be32(&fec->r_cntrl, rcntrl); | ||
713 | out_be32(&fec->x_cntrl, tcntrl); | ||
714 | |||
715 | /* Clear any outstanding interrupt. */ | ||
716 | out_be32(&fec->ievent, 0xffffffff); | ||
717 | |||
718 | /* Enable interrupts we wish to service. */ | ||
719 | out_be32(&fec->imask, FEC_IMASK_ENABLE); | ||
720 | |||
721 | /* And last, enable the transmit and receive processing. */ | ||
722 | out_be32(&fec->ecntrl, FEC_ECNTRL_ETHER_EN); | ||
723 | out_be32(&fec->r_des_active, 0x01000000); | ||
724 | } | ||
725 | |||
726 | /** | ||
727 | * mpc52xx_fec_stop | ||
728 | * @dev: network device | ||
729 | * | ||
730 | * stop all activity on fec and empty dma buffers | ||
731 | */ | ||
732 | static void mpc52xx_fec_stop(struct net_device *dev) | ||
733 | { | ||
734 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
735 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
736 | unsigned long timeout; | ||
737 | |||
738 | /* disable all interrupts */ | ||
739 | out_be32(&fec->imask, 0); | ||
740 | |||
741 | /* Disable the rx task. */ | ||
742 | bcom_disable(priv->rx_dmatsk); | ||
743 | |||
744 | /* Wait for tx queue to drain, but only if we're in process context */ | ||
745 | if (!in_interrupt()) { | ||
746 | timeout = jiffies + msecs_to_jiffies(2000); | ||
747 | while (time_before(jiffies, timeout) && | ||
748 | !bcom_queue_empty(priv->tx_dmatsk)) | ||
749 | msleep(100); | ||
750 | |||
751 | if (time_after_eq(jiffies, timeout)) | ||
752 | dev_err(&dev->dev, "queues didn't drain\n"); | ||
753 | #if 1 | ||
754 | if (time_after_eq(jiffies, timeout)) { | ||
755 | dev_err(&dev->dev, " tx: index: %i, outdex: %i\n", | ||
756 | priv->tx_dmatsk->index, | ||
757 | priv->tx_dmatsk->outdex); | ||
758 | dev_err(&dev->dev, " rx: index: %i, outdex: %i\n", | ||
759 | priv->rx_dmatsk->index, | ||
760 | priv->rx_dmatsk->outdex); | ||
761 | } | ||
762 | #endif | ||
763 | } | ||
764 | |||
765 | bcom_disable(priv->tx_dmatsk); | ||
766 | |||
767 | /* Stop FEC */ | ||
768 | out_be32(&fec->ecntrl, in_be32(&fec->ecntrl) & ~FEC_ECNTRL_ETHER_EN); | ||
769 | |||
770 | return; | ||
771 | } | ||
772 | |||
773 | /* reset fec and bestcomm tasks */ | ||
774 | static void mpc52xx_fec_reset(struct net_device *dev) | ||
775 | { | ||
776 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
777 | struct mpc52xx_fec __iomem *fec = priv->fec; | ||
778 | |||
779 | mpc52xx_fec_stop(dev); | ||
780 | |||
781 | out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status)); | ||
782 | out_be32(&fec->reset_cntrl, FEC_RESET_CNTRL_RESET_FIFO); | ||
783 | |||
784 | mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk); | ||
785 | |||
786 | mpc52xx_fec_hw_init(dev); | ||
787 | |||
788 | phy_stop(priv->phydev); | ||
789 | phy_write(priv->phydev, MII_BMCR, BMCR_RESET); | ||
790 | phy_start(priv->phydev); | ||
791 | |||
792 | bcom_fec_rx_reset(priv->rx_dmatsk); | ||
793 | bcom_fec_tx_reset(priv->tx_dmatsk); | ||
794 | |||
795 | mpc52xx_fec_alloc_rx_buffers(dev, priv->rx_dmatsk); | ||
796 | |||
797 | bcom_enable(priv->rx_dmatsk); | ||
798 | bcom_enable(priv->tx_dmatsk); | ||
799 | |||
800 | mpc52xx_fec_start(dev); | ||
801 | } | ||
802 | |||
803 | |||
804 | /* ethtool interface */ | ||
805 | static void mpc52xx_fec_get_drvinfo(struct net_device *dev, | ||
806 | struct ethtool_drvinfo *info) | ||
807 | { | ||
808 | strcpy(info->driver, DRIVER_NAME); | ||
809 | } | ||
810 | |||
811 | static int mpc52xx_fec_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
812 | { | ||
813 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
814 | return phy_ethtool_gset(priv->phydev, cmd); | ||
815 | } | ||
816 | |||
817 | static int mpc52xx_fec_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
818 | { | ||
819 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
820 | return phy_ethtool_sset(priv->phydev, cmd); | ||
821 | } | ||
822 | |||
823 | static u32 mpc52xx_fec_get_msglevel(struct net_device *dev) | ||
824 | { | ||
825 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
826 | return priv->msg_enable; | ||
827 | } | ||
828 | |||
829 | static void mpc52xx_fec_set_msglevel(struct net_device *dev, u32 level) | ||
830 | { | ||
831 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
832 | priv->msg_enable = level; | ||
833 | } | ||
834 | |||
835 | static const struct ethtool_ops mpc52xx_fec_ethtool_ops = { | ||
836 | .get_drvinfo = mpc52xx_fec_get_drvinfo, | ||
837 | .get_settings = mpc52xx_fec_get_settings, | ||
838 | .set_settings = mpc52xx_fec_set_settings, | ||
839 | .get_link = ethtool_op_get_link, | ||
840 | .get_msglevel = mpc52xx_fec_get_msglevel, | ||
841 | .set_msglevel = mpc52xx_fec_set_msglevel, | ||
842 | }; | ||
843 | |||
844 | |||
845 | static int mpc52xx_fec_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | ||
846 | { | ||
847 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | ||
848 | |||
849 | return mpc52xx_fec_phy_mii_ioctl(priv, if_mii(rq), cmd); | ||
850 | } | ||
851 | |||
852 | /* ======================================================================== */ | ||
853 | /* OF Driver */ | ||
854 | /* ======================================================================== */ | ||
855 | |||
856 | static int __devinit | ||
857 | mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) | ||
858 | { | ||
859 | int rv; | ||
860 | struct net_device *ndev; | ||
861 | struct mpc52xx_fec_priv *priv = NULL; | ||
862 | struct resource mem; | ||
863 | const phandle *ph; | ||
864 | |||
865 | phys_addr_t rx_fifo; | ||
866 | phys_addr_t tx_fifo; | ||
867 | |||
868 | /* Get the ether ndev & it's private zone */ | ||
869 | ndev = alloc_etherdev(sizeof(struct mpc52xx_fec_priv)); | ||
870 | if (!ndev) | ||
871 | return -ENOMEM; | ||
872 | |||
873 | priv = netdev_priv(ndev); | ||
874 | |||
875 | /* Reserve FEC control zone */ | ||
876 | rv = of_address_to_resource(op->node, 0, &mem); | ||
877 | if (rv) { | ||
878 | printk(KERN_ERR DRIVER_NAME ": " | ||
879 | "Error while parsing device node resource\n" ); | ||
880 | return rv; | ||
881 | } | ||
882 | if ((mem.end - mem.start + 1) < sizeof(struct mpc52xx_fec)) { | ||
883 | printk(KERN_ERR DRIVER_NAME | ||
884 | " - invalid resource size (%lx < %x), check mpc52xx_devices.c\n", | ||
885 | (unsigned long)(mem.end - mem.start + 1), sizeof(struct mpc52xx_fec)); | ||
886 | return -EINVAL; | ||
887 | } | ||
888 | |||
889 | if (!request_mem_region(mem.start, sizeof(struct mpc52xx_fec), DRIVER_NAME)) | ||
890 | return -EBUSY; | ||
891 | |||
892 | /* Init ether ndev with what we have */ | ||
893 | ndev->open = mpc52xx_fec_open; | ||
894 | ndev->stop = mpc52xx_fec_close; | ||
895 | ndev->hard_start_xmit = mpc52xx_fec_hard_start_xmit; | ||
896 | ndev->do_ioctl = mpc52xx_fec_ioctl; | ||
897 | ndev->ethtool_ops = &mpc52xx_fec_ethtool_ops; | ||
898 | ndev->get_stats = mpc52xx_fec_get_stats; | ||
899 | ndev->set_mac_address = mpc52xx_fec_set_mac_address; | ||
900 | ndev->set_multicast_list = mpc52xx_fec_set_multicast_list; | ||
901 | ndev->tx_timeout = mpc52xx_fec_tx_timeout; | ||
902 | ndev->watchdog_timeo = FEC_WATCHDOG_TIMEOUT; | ||
903 | ndev->base_addr = mem.start; | ||
904 | |||
905 | priv->t_irq = priv->r_irq = ndev->irq = NO_IRQ; /* IRQ are free for now */ | ||
906 | |||
907 | spin_lock_init(&priv->lock); | ||
908 | |||
909 | /* ioremap the zones */ | ||
910 | priv->fec = ioremap(mem.start, sizeof(struct mpc52xx_fec)); | ||
911 | |||
912 | if (!priv->fec) { | ||
913 | rv = -ENOMEM; | ||
914 | goto probe_error; | ||
915 | } | ||
916 | |||
917 | /* Bestcomm init */ | ||
918 | rx_fifo = ndev->base_addr + offsetof(struct mpc52xx_fec, rfifo_data); | ||
919 | tx_fifo = ndev->base_addr + offsetof(struct mpc52xx_fec, tfifo_data); | ||
920 | |||
921 | priv->rx_dmatsk = bcom_fec_rx_init(FEC_RX_NUM_BD, rx_fifo, FEC_RX_BUFFER_SIZE); | ||
922 | priv->tx_dmatsk = bcom_fec_tx_init(FEC_TX_NUM_BD, tx_fifo); | ||
923 | |||
924 | if (!priv->rx_dmatsk || !priv->tx_dmatsk) { | ||
925 | printk(KERN_ERR DRIVER_NAME ": Can not init SDMA tasks\n" ); | ||
926 | rv = -ENOMEM; | ||
927 | goto probe_error; | ||
928 | } | ||
929 | |||
930 | /* Get the IRQ we need one by one */ | ||
931 | /* Control */ | ||
932 | ndev->irq = irq_of_parse_and_map(op->node, 0); | ||
933 | |||
934 | /* RX */ | ||
935 | priv->r_irq = bcom_get_task_irq(priv->rx_dmatsk); | ||
936 | |||
937 | /* TX */ | ||
938 | priv->t_irq = bcom_get_task_irq(priv->tx_dmatsk); | ||
939 | |||
940 | /* MAC address init */ | ||
941 | if (!is_zero_ether_addr(mpc52xx_fec_mac_addr)) | ||
942 | memcpy(ndev->dev_addr, mpc52xx_fec_mac_addr, 6); | ||
943 | else | ||
944 | mpc52xx_fec_get_paddr(ndev, ndev->dev_addr); | ||
945 | |||
946 | priv->msg_enable = netif_msg_init(debug, MPC52xx_MESSAGES_DEFAULT); | ||
947 | priv->duplex = DUPLEX_FULL; | ||
948 | |||
949 | /* is the phy present in device tree? */ | ||
950 | ph = of_get_property(op->node, "phy-handle", NULL); | ||
951 | if (ph) { | ||
952 | const unsigned int *prop; | ||
953 | struct device_node *phy_dn; | ||
954 | priv->has_phy = 1; | ||
955 | |||
956 | phy_dn = of_find_node_by_phandle(*ph); | ||
957 | prop = of_get_property(phy_dn, "reg", NULL); | ||
958 | priv->phy_addr = *prop; | ||
959 | |||
960 | of_node_put(phy_dn); | ||
961 | |||
962 | /* Phy speed */ | ||
963 | priv->phy_speed = ((mpc52xx_find_ipb_freq(op->node) >> 20) / 5) << 1; | ||
964 | } else { | ||
965 | dev_info(&ndev->dev, "can't find \"phy-handle\" in device" | ||
966 | " tree, using 7-wire mode\n"); | ||
967 | } | ||
968 | |||
969 | /* Hardware init */ | ||
970 | mpc52xx_fec_hw_init(ndev); | ||
971 | |||
972 | mpc52xx_fec_reset_stats(ndev); | ||
973 | |||
974 | /* Register the new network device */ | ||
975 | rv = register_netdev(ndev); | ||
976 | if (rv < 0) | ||
977 | goto probe_error; | ||
978 | |||
979 | /* We're done ! */ | ||
980 | dev_set_drvdata(&op->dev, ndev); | ||
981 | |||
982 | return 0; | ||
983 | |||
984 | |||
985 | /* Error handling - free everything that might be allocated */ | ||
986 | probe_error: | ||
987 | |||
988 | irq_dispose_mapping(ndev->irq); | ||
989 | |||
990 | if (priv->rx_dmatsk) | ||
991 | bcom_fec_rx_release(priv->rx_dmatsk); | ||
992 | if (priv->tx_dmatsk) | ||
993 | bcom_fec_tx_release(priv->tx_dmatsk); | ||
994 | |||
995 | if (priv->fec) | ||
996 | iounmap(priv->fec); | ||
997 | |||
998 | release_mem_region(mem.start, sizeof(struct mpc52xx_fec)); | ||
999 | |||
1000 | free_netdev(ndev); | ||
1001 | |||
1002 | return rv; | ||
1003 | } | ||
1004 | |||
1005 | static int | ||
1006 | mpc52xx_fec_remove(struct of_device *op) | ||
1007 | { | ||
1008 | struct net_device *ndev; | ||
1009 | struct mpc52xx_fec_priv *priv; | ||
1010 | |||
1011 | ndev = dev_get_drvdata(&op->dev); | ||
1012 | priv = netdev_priv(ndev); | ||
1013 | |||
1014 | unregister_netdev(ndev); | ||
1015 | |||
1016 | irq_dispose_mapping(ndev->irq); | ||
1017 | |||
1018 | bcom_fec_rx_release(priv->rx_dmatsk); | ||
1019 | bcom_fec_tx_release(priv->tx_dmatsk); | ||
1020 | |||
1021 | iounmap(priv->fec); | ||
1022 | |||
1023 | release_mem_region(ndev->base_addr, sizeof(struct mpc52xx_fec)); | ||
1024 | |||
1025 | free_netdev(ndev); | ||
1026 | |||
1027 | dev_set_drvdata(&op->dev, NULL); | ||
1028 | return 0; | ||
1029 | } | ||
1030 | |||
1031 | #ifdef CONFIG_PM | ||
1032 | static int mpc52xx_fec_of_suspend(struct of_device *op, pm_message_t state) | ||
1033 | { | ||
1034 | struct net_device *dev = dev_get_drvdata(&op->dev); | ||
1035 | |||
1036 | if (netif_running(dev)) | ||
1037 | mpc52xx_fec_close(dev); | ||
1038 | |||
1039 | return 0; | ||
1040 | } | ||
1041 | |||
1042 | static int mpc52xx_fec_of_resume(struct of_device *op) | ||
1043 | { | ||
1044 | struct net_device *dev = dev_get_drvdata(&op->dev); | ||
1045 | |||
1046 | mpc52xx_fec_hw_init(dev); | ||
1047 | mpc52xx_fec_reset_stats(dev); | ||
1048 | |||
1049 | if (netif_running(dev)) | ||
1050 | mpc52xx_fec_open(dev); | ||
1051 | |||
1052 | return 0; | ||
1053 | } | ||
1054 | #endif | ||
1055 | |||
1056 | static struct of_device_id mpc52xx_fec_match[] = { | ||
1057 | { | ||
1058 | .type = "network", | ||
1059 | .compatible = "mpc5200-fec", | ||
1060 | }, | ||
1061 | { } | ||
1062 | }; | ||
1063 | |||
1064 | MODULE_DEVICE_TABLE(of, mpc52xx_fec_match); | ||
1065 | |||
1066 | static struct of_platform_driver mpc52xx_fec_driver = { | ||
1067 | .owner = THIS_MODULE, | ||
1068 | .name = DRIVER_NAME, | ||
1069 | .match_table = mpc52xx_fec_match, | ||
1070 | .probe = mpc52xx_fec_probe, | ||
1071 | .remove = mpc52xx_fec_remove, | ||
1072 | #ifdef CONFIG_PM | ||
1073 | .suspend = mpc52xx_fec_of_suspend, | ||
1074 | .resume = mpc52xx_fec_of_resume, | ||
1075 | #endif | ||
1076 | }; | ||
1077 | |||
1078 | |||
1079 | /* ======================================================================== */ | ||
1080 | /* Module */ | ||
1081 | /* ======================================================================== */ | ||
1082 | |||
1083 | static int __init | ||
1084 | mpc52xx_fec_init(void) | ||
1085 | { | ||
1086 | #ifdef CONFIG_FEC_MPC52xx_MDIO | ||
1087 | int ret; | ||
1088 | ret = of_register_platform_driver(&mpc52xx_fec_mdio_driver); | ||
1089 | if (ret) { | ||
1090 | printk(KERN_ERR DRIVER_NAME ": failed to register mdio driver\n"); | ||
1091 | return ret; | ||
1092 | } | ||
1093 | #endif | ||
1094 | return of_register_platform_driver(&mpc52xx_fec_driver); | ||
1095 | } | ||
1096 | |||
1097 | static void __exit | ||
1098 | mpc52xx_fec_exit(void) | ||
1099 | { | ||
1100 | of_unregister_platform_driver(&mpc52xx_fec_driver); | ||
1101 | #ifdef CONFIG_FEC_MPC52xx_MDIO | ||
1102 | of_unregister_platform_driver(&mpc52xx_fec_mdio_driver); | ||
1103 | #endif | ||
1104 | } | ||
1105 | |||
1106 | |||
1107 | module_init(mpc52xx_fec_init); | ||
1108 | module_exit(mpc52xx_fec_exit); | ||
1109 | |||
1110 | MODULE_LICENSE("GPL"); | ||
1111 | MODULE_AUTHOR("Dale Farnsworth"); | ||
1112 | MODULE_DESCRIPTION("Ethernet driver for the Freescale MPC52xx FEC"); | ||
diff --git a/drivers/net/fec_mpc52xx.h b/drivers/net/fec_mpc52xx.h new file mode 100644 index 000000000000..8b1f75397b9a --- /dev/null +++ b/drivers/net/fec_mpc52xx.h | |||
@@ -0,0 +1,313 @@ | |||
1 | /* | ||
2 | * drivers/drivers/net/fec_mpc52xx/fec.h | ||
3 | * | ||
4 | * Driver for the MPC5200 Fast Ethernet Controller | ||
5 | * | ||
6 | * Author: Dale Farnsworth <dfarnsworth@mvista.com> | ||
7 | * | ||
8 | * 2003-2004 (c) MontaVista, Software, Inc. This file is licensed under | ||
9 | * the terms of the GNU General Public License version 2. This program | ||
10 | * is licensed "as is" without any warranty of any kind, whether express | ||
11 | * or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __DRIVERS_NET_MPC52XX_FEC_H__ | ||
15 | #define __DRIVERS_NET_MPC52XX_FEC_H__ | ||
16 | |||
17 | #include <linux/phy.h> | ||
18 | |||
19 | /* Tunable constant */ | ||
20 | /* FEC_RX_BUFFER_SIZE includes 4 bytes for CRC32 */ | ||
21 | #define FEC_RX_BUFFER_SIZE 1522 /* max receive packet size */ | ||
22 | #define FEC_RX_NUM_BD 256 | ||
23 | #define FEC_TX_NUM_BD 64 | ||
24 | |||
25 | #define FEC_RESET_DELAY 50 /* uS */ | ||
26 | |||
27 | #define FEC_WATCHDOG_TIMEOUT ((400*HZ)/1000) | ||
28 | |||
29 | struct mpc52xx_fec_priv { | ||
30 | int duplex; | ||
31 | int r_irq; | ||
32 | int t_irq; | ||
33 | struct mpc52xx_fec __iomem *fec; | ||
34 | struct bcom_task *rx_dmatsk; | ||
35 | struct bcom_task *tx_dmatsk; | ||
36 | spinlock_t lock; | ||
37 | int msg_enable; | ||
38 | |||
39 | int has_phy; | ||
40 | unsigned int phy_speed; | ||
41 | unsigned int phy_addr; | ||
42 | struct phy_device *phydev; | ||
43 | enum phy_state link; | ||
44 | int speed; | ||
45 | }; | ||
46 | |||
47 | |||
48 | /* ======================================================================== */ | ||
49 | /* Hardware register sets & bits */ | ||
50 | /* ======================================================================== */ | ||
51 | |||
52 | struct mpc52xx_fec { | ||
53 | u32 fec_id; /* FEC + 0x000 */ | ||
54 | u32 ievent; /* FEC + 0x004 */ | ||
55 | u32 imask; /* FEC + 0x008 */ | ||
56 | |||
57 | u32 reserved0[1]; /* FEC + 0x00C */ | ||
58 | u32 r_des_active; /* FEC + 0x010 */ | ||
59 | u32 x_des_active; /* FEC + 0x014 */ | ||
60 | u32 r_des_active_cl; /* FEC + 0x018 */ | ||
61 | u32 x_des_active_cl; /* FEC + 0x01C */ | ||
62 | u32 ivent_set; /* FEC + 0x020 */ | ||
63 | u32 ecntrl; /* FEC + 0x024 */ | ||
64 | |||
65 | u32 reserved1[6]; /* FEC + 0x028-03C */ | ||
66 | u32 mii_data; /* FEC + 0x040 */ | ||
67 | u32 mii_speed; /* FEC + 0x044 */ | ||
68 | u32 mii_status; /* FEC + 0x048 */ | ||
69 | |||
70 | u32 reserved2[5]; /* FEC + 0x04C-05C */ | ||
71 | u32 mib_data; /* FEC + 0x060 */ | ||
72 | u32 mib_control; /* FEC + 0x064 */ | ||
73 | |||
74 | u32 reserved3[6]; /* FEC + 0x068-7C */ | ||
75 | u32 r_activate; /* FEC + 0x080 */ | ||
76 | u32 r_cntrl; /* FEC + 0x084 */ | ||
77 | u32 r_hash; /* FEC + 0x088 */ | ||
78 | u32 r_data; /* FEC + 0x08C */ | ||
79 | u32 ar_done; /* FEC + 0x090 */ | ||
80 | u32 r_test; /* FEC + 0x094 */ | ||
81 | u32 r_mib; /* FEC + 0x098 */ | ||
82 | u32 r_da_low; /* FEC + 0x09C */ | ||
83 | u32 r_da_high; /* FEC + 0x0A0 */ | ||
84 | |||
85 | u32 reserved4[7]; /* FEC + 0x0A4-0BC */ | ||
86 | u32 x_activate; /* FEC + 0x0C0 */ | ||
87 | u32 x_cntrl; /* FEC + 0x0C4 */ | ||
88 | u32 backoff; /* FEC + 0x0C8 */ | ||
89 | u32 x_data; /* FEC + 0x0CC */ | ||
90 | u32 x_status; /* FEC + 0x0D0 */ | ||
91 | u32 x_mib; /* FEC + 0x0D4 */ | ||
92 | u32 x_test; /* FEC + 0x0D8 */ | ||
93 | u32 fdxfc_da1; /* FEC + 0x0DC */ | ||
94 | u32 fdxfc_da2; /* FEC + 0x0E0 */ | ||
95 | u32 paddr1; /* FEC + 0x0E4 */ | ||
96 | u32 paddr2; /* FEC + 0x0E8 */ | ||
97 | u32 op_pause; /* FEC + 0x0EC */ | ||
98 | |||
99 | u32 reserved5[4]; /* FEC + 0x0F0-0FC */ | ||
100 | u32 instr_reg; /* FEC + 0x100 */ | ||
101 | u32 context_reg; /* FEC + 0x104 */ | ||
102 | u32 test_cntrl; /* FEC + 0x108 */ | ||
103 | u32 acc_reg; /* FEC + 0x10C */ | ||
104 | u32 ones; /* FEC + 0x110 */ | ||
105 | u32 zeros; /* FEC + 0x114 */ | ||
106 | u32 iaddr1; /* FEC + 0x118 */ | ||
107 | u32 iaddr2; /* FEC + 0x11C */ | ||
108 | u32 gaddr1; /* FEC + 0x120 */ | ||
109 | u32 gaddr2; /* FEC + 0x124 */ | ||
110 | u32 random; /* FEC + 0x128 */ | ||
111 | u32 rand1; /* FEC + 0x12C */ | ||
112 | u32 tmp; /* FEC + 0x130 */ | ||
113 | |||
114 | u32 reserved6[3]; /* FEC + 0x134-13C */ | ||
115 | u32 fifo_id; /* FEC + 0x140 */ | ||
116 | u32 x_wmrk; /* FEC + 0x144 */ | ||
117 | u32 fcntrl; /* FEC + 0x148 */ | ||
118 | u32 r_bound; /* FEC + 0x14C */ | ||
119 | u32 r_fstart; /* FEC + 0x150 */ | ||
120 | u32 r_count; /* FEC + 0x154 */ | ||
121 | u32 r_lag; /* FEC + 0x158 */ | ||
122 | u32 r_read; /* FEC + 0x15C */ | ||
123 | u32 r_write; /* FEC + 0x160 */ | ||
124 | u32 x_count; /* FEC + 0x164 */ | ||
125 | u32 x_lag; /* FEC + 0x168 */ | ||
126 | u32 x_retry; /* FEC + 0x16C */ | ||
127 | u32 x_write; /* FEC + 0x170 */ | ||
128 | u32 x_read; /* FEC + 0x174 */ | ||
129 | |||
130 | u32 reserved7[2]; /* FEC + 0x178-17C */ | ||
131 | u32 fm_cntrl; /* FEC + 0x180 */ | ||
132 | u32 rfifo_data; /* FEC + 0x184 */ | ||
133 | u32 rfifo_status; /* FEC + 0x188 */ | ||
134 | u32 rfifo_cntrl; /* FEC + 0x18C */ | ||
135 | u32 rfifo_lrf_ptr; /* FEC + 0x190 */ | ||
136 | u32 rfifo_lwf_ptr; /* FEC + 0x194 */ | ||
137 | u32 rfifo_alarm; /* FEC + 0x198 */ | ||
138 | u32 rfifo_rdptr; /* FEC + 0x19C */ | ||
139 | u32 rfifo_wrptr; /* FEC + 0x1A0 */ | ||
140 | u32 tfifo_data; /* FEC + 0x1A4 */ | ||
141 | u32 tfifo_status; /* FEC + 0x1A8 */ | ||
142 | u32 tfifo_cntrl; /* FEC + 0x1AC */ | ||
143 | u32 tfifo_lrf_ptr; /* FEC + 0x1B0 */ | ||
144 | u32 tfifo_lwf_ptr; /* FEC + 0x1B4 */ | ||
145 | u32 tfifo_alarm; /* FEC + 0x1B8 */ | ||
146 | u32 tfifo_rdptr; /* FEC + 0x1BC */ | ||
147 | u32 tfifo_wrptr; /* FEC + 0x1C0 */ | ||
148 | |||
149 | u32 reset_cntrl; /* FEC + 0x1C4 */ | ||
150 | u32 xmit_fsm; /* FEC + 0x1C8 */ | ||
151 | |||
152 | u32 reserved8[3]; /* FEC + 0x1CC-1D4 */ | ||
153 | u32 rdes_data0; /* FEC + 0x1D8 */ | ||
154 | u32 rdes_data1; /* FEC + 0x1DC */ | ||
155 | u32 r_length; /* FEC + 0x1E0 */ | ||
156 | u32 x_length; /* FEC + 0x1E4 */ | ||
157 | u32 x_addr; /* FEC + 0x1E8 */ | ||
158 | u32 cdes_data; /* FEC + 0x1EC */ | ||
159 | u32 status; /* FEC + 0x1F0 */ | ||
160 | u32 dma_control; /* FEC + 0x1F4 */ | ||
161 | u32 des_cmnd; /* FEC + 0x1F8 */ | ||
162 | u32 data; /* FEC + 0x1FC */ | ||
163 | |||
164 | u32 rmon_t_drop; /* FEC + 0x200 */ | ||
165 | u32 rmon_t_packets; /* FEC + 0x204 */ | ||
166 | u32 rmon_t_bc_pkt; /* FEC + 0x208 */ | ||
167 | u32 rmon_t_mc_pkt; /* FEC + 0x20C */ | ||
168 | u32 rmon_t_crc_align; /* FEC + 0x210 */ | ||
169 | u32 rmon_t_undersize; /* FEC + 0x214 */ | ||
170 | u32 rmon_t_oversize; /* FEC + 0x218 */ | ||
171 | u32 rmon_t_frag; /* FEC + 0x21C */ | ||
172 | u32 rmon_t_jab; /* FEC + 0x220 */ | ||
173 | u32 rmon_t_col; /* FEC + 0x224 */ | ||
174 | u32 rmon_t_p64; /* FEC + 0x228 */ | ||
175 | u32 rmon_t_p65to127; /* FEC + 0x22C */ | ||
176 | u32 rmon_t_p128to255; /* FEC + 0x230 */ | ||
177 | u32 rmon_t_p256to511; /* FEC + 0x234 */ | ||
178 | u32 rmon_t_p512to1023; /* FEC + 0x238 */ | ||
179 | u32 rmon_t_p1024to2047; /* FEC + 0x23C */ | ||
180 | u32 rmon_t_p_gte2048; /* FEC + 0x240 */ | ||
181 | u32 rmon_t_octets; /* FEC + 0x244 */ | ||
182 | u32 ieee_t_drop; /* FEC + 0x248 */ | ||
183 | u32 ieee_t_frame_ok; /* FEC + 0x24C */ | ||
184 | u32 ieee_t_1col; /* FEC + 0x250 */ | ||
185 | u32 ieee_t_mcol; /* FEC + 0x254 */ | ||
186 | u32 ieee_t_def; /* FEC + 0x258 */ | ||
187 | u32 ieee_t_lcol; /* FEC + 0x25C */ | ||
188 | u32 ieee_t_excol; /* FEC + 0x260 */ | ||
189 | u32 ieee_t_macerr; /* FEC + 0x264 */ | ||
190 | u32 ieee_t_cserr; /* FEC + 0x268 */ | ||
191 | u32 ieee_t_sqe; /* FEC + 0x26C */ | ||
192 | u32 t_fdxfc; /* FEC + 0x270 */ | ||
193 | u32 ieee_t_octets_ok; /* FEC + 0x274 */ | ||
194 | |||
195 | u32 reserved9[2]; /* FEC + 0x278-27C */ | ||
196 | u32 rmon_r_drop; /* FEC + 0x280 */ | ||
197 | u32 rmon_r_packets; /* FEC + 0x284 */ | ||
198 | u32 rmon_r_bc_pkt; /* FEC + 0x288 */ | ||
199 | u32 rmon_r_mc_pkt; /* FEC + 0x28C */ | ||
200 | u32 rmon_r_crc_align; /* FEC + 0x290 */ | ||
201 | u32 rmon_r_undersize; /* FEC + 0x294 */ | ||
202 | u32 rmon_r_oversize; /* FEC + 0x298 */ | ||
203 | u32 rmon_r_frag; /* FEC + 0x29C */ | ||
204 | u32 rmon_r_jab; /* FEC + 0x2A0 */ | ||
205 | |||
206 | u32 rmon_r_resvd_0; /* FEC + 0x2A4 */ | ||
207 | |||
208 | u32 rmon_r_p64; /* FEC + 0x2A8 */ | ||
209 | u32 rmon_r_p65to127; /* FEC + 0x2AC */ | ||
210 | u32 rmon_r_p128to255; /* FEC + 0x2B0 */ | ||
211 | u32 rmon_r_p256to511; /* FEC + 0x2B4 */ | ||
212 | u32 rmon_r_p512to1023; /* FEC + 0x2B8 */ | ||
213 | u32 rmon_r_p1024to2047; /* FEC + 0x2BC */ | ||
214 | u32 rmon_r_p_gte2048; /* FEC + 0x2C0 */ | ||
215 | u32 rmon_r_octets; /* FEC + 0x2C4 */ | ||
216 | u32 ieee_r_drop; /* FEC + 0x2C8 */ | ||
217 | u32 ieee_r_frame_ok; /* FEC + 0x2CC */ | ||
218 | u32 ieee_r_crc; /* FEC + 0x2D0 */ | ||
219 | u32 ieee_r_align; /* FEC + 0x2D4 */ | ||
220 | u32 r_macerr; /* FEC + 0x2D8 */ | ||
221 | u32 r_fdxfc; /* FEC + 0x2DC */ | ||
222 | u32 ieee_r_octets_ok; /* FEC + 0x2E0 */ | ||
223 | |||
224 | u32 reserved10[7]; /* FEC + 0x2E4-2FC */ | ||
225 | |||
226 | u32 reserved11[64]; /* FEC + 0x300-3FF */ | ||
227 | }; | ||
228 | |||
229 | #define FEC_MIB_DISABLE 0x80000000 | ||
230 | |||
231 | #define FEC_IEVENT_HBERR 0x80000000 | ||
232 | #define FEC_IEVENT_BABR 0x40000000 | ||
233 | #define FEC_IEVENT_BABT 0x20000000 | ||
234 | #define FEC_IEVENT_GRA 0x10000000 | ||
235 | #define FEC_IEVENT_TFINT 0x08000000 | ||
236 | #define FEC_IEVENT_MII 0x00800000 | ||
237 | #define FEC_IEVENT_LATE_COL 0x00200000 | ||
238 | #define FEC_IEVENT_COL_RETRY_LIM 0x00100000 | ||
239 | #define FEC_IEVENT_XFIFO_UN 0x00080000 | ||
240 | #define FEC_IEVENT_XFIFO_ERROR 0x00040000 | ||
241 | #define FEC_IEVENT_RFIFO_ERROR 0x00020000 | ||
242 | |||
243 | #define FEC_IMASK_HBERR 0x80000000 | ||
244 | #define FEC_IMASK_BABR 0x40000000 | ||
245 | #define FEC_IMASK_BABT 0x20000000 | ||
246 | #define FEC_IMASK_GRA 0x10000000 | ||
247 | #define FEC_IMASK_MII 0x00800000 | ||
248 | #define FEC_IMASK_LATE_COL 0x00200000 | ||
249 | #define FEC_IMASK_COL_RETRY_LIM 0x00100000 | ||
250 | #define FEC_IMASK_XFIFO_UN 0x00080000 | ||
251 | #define FEC_IMASK_XFIFO_ERROR 0x00040000 | ||
252 | #define FEC_IMASK_RFIFO_ERROR 0x00020000 | ||
253 | |||
254 | /* all but MII, which is enabled separately */ | ||
255 | #define FEC_IMASK_ENABLE (FEC_IMASK_HBERR | FEC_IMASK_BABR | \ | ||
256 | FEC_IMASK_BABT | FEC_IMASK_GRA | FEC_IMASK_LATE_COL | \ | ||
257 | FEC_IMASK_COL_RETRY_LIM | FEC_IMASK_XFIFO_UN | \ | ||
258 | FEC_IMASK_XFIFO_ERROR | FEC_IMASK_RFIFO_ERROR) | ||
259 | |||
260 | #define FEC_RCNTRL_MAX_FL_SHIFT 16 | ||
261 | #define FEC_RCNTRL_LOOP 0x01 | ||
262 | #define FEC_RCNTRL_DRT 0x02 | ||
263 | #define FEC_RCNTRL_MII_MODE 0x04 | ||
264 | #define FEC_RCNTRL_PROM 0x08 | ||
265 | #define FEC_RCNTRL_BC_REJ 0x10 | ||
266 | #define FEC_RCNTRL_FCE 0x20 | ||
267 | |||
268 | #define FEC_TCNTRL_GTS 0x00000001 | ||
269 | #define FEC_TCNTRL_HBC 0x00000002 | ||
270 | #define FEC_TCNTRL_FDEN 0x00000004 | ||
271 | #define FEC_TCNTRL_TFC_PAUSE 0x00000008 | ||
272 | #define FEC_TCNTRL_RFC_PAUSE 0x00000010 | ||
273 | |||
274 | #define FEC_ECNTRL_RESET 0x00000001 | ||
275 | #define FEC_ECNTRL_ETHER_EN 0x00000002 | ||
276 | |||
277 | #define FEC_MII_DATA_ST 0x40000000 /* Start frame */ | ||
278 | #define FEC_MII_DATA_OP_RD 0x20000000 /* Perform read */ | ||
279 | #define FEC_MII_DATA_OP_WR 0x10000000 /* Perform write */ | ||
280 | #define FEC_MII_DATA_PA_MSK 0x0f800000 /* PHY Address mask */ | ||
281 | #define FEC_MII_DATA_RA_MSK 0x007c0000 /* PHY Register mask */ | ||
282 | #define FEC_MII_DATA_TA 0x00020000 /* Turnaround */ | ||
283 | #define FEC_MII_DATA_DATAMSK 0x0000ffff /* PHY data mask */ | ||
284 | |||
285 | #define FEC_MII_READ_FRAME (FEC_MII_DATA_ST | FEC_MII_DATA_OP_RD | FEC_MII_DATA_TA) | ||
286 | #define FEC_MII_WRITE_FRAME (FEC_MII_DATA_ST | FEC_MII_DATA_OP_WR | FEC_MII_DATA_TA) | ||
287 | |||
288 | #define FEC_MII_DATA_RA_SHIFT 0x12 /* MII reg addr bits */ | ||
289 | #define FEC_MII_DATA_PA_SHIFT 0x17 /* MII PHY addr bits */ | ||
290 | |||
291 | #define FEC_PADDR2_TYPE 0x8808 | ||
292 | |||
293 | #define FEC_OP_PAUSE_OPCODE 0x00010000 | ||
294 | |||
295 | #define FEC_FIFO_WMRK_256B 0x3 | ||
296 | |||
297 | #define FEC_FIFO_STATUS_ERR 0x00400000 | ||
298 | #define FEC_FIFO_STATUS_UF 0x00200000 | ||
299 | #define FEC_FIFO_STATUS_OF 0x00100000 | ||
300 | |||
301 | #define FEC_FIFO_CNTRL_FRAME 0x08000000 | ||
302 | #define FEC_FIFO_CNTRL_LTG_7 0x07000000 | ||
303 | |||
304 | #define FEC_RESET_CNTRL_RESET_FIFO 0x02000000 | ||
305 | #define FEC_RESET_CNTRL_ENABLE_IS_RESET 0x01000000 | ||
306 | |||
307 | #define FEC_XMIT_FSM_APPEND_CRC 0x02000000 | ||
308 | #define FEC_XMIT_FSM_ENABLE_CRC 0x01000000 | ||
309 | |||
310 | |||
311 | extern struct of_platform_driver mpc52xx_fec_mdio_driver; | ||
312 | |||
313 | #endif /* __DRIVERS_NET_MPC52XX_FEC_H__ */ | ||
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c new file mode 100644 index 000000000000..ba6e8b218e0a --- /dev/null +++ b/drivers/net/fec_mpc52xx_phy.c | |||
@@ -0,0 +1,198 @@ | |||
1 | /* | ||
2 | * Driver for the MPC5200 Fast Ethernet Controller - MDIO bus driver | ||
3 | * | ||
4 | * Copyright (C) 2007 Domen Puncer, Telargo, Inc. | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public License | ||
7 | * version 2. This program is licensed "as is" without any warranty of any | ||
8 | * kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/netdevice.h> | ||
14 | #include <linux/phy.h> | ||
15 | #include <linux/of_platform.h> | ||
16 | #include <asm/io.h> | ||
17 | #include <asm/mpc52xx.h> | ||
18 | #include "fec_mpc52xx.h" | ||
19 | |||
20 | struct mpc52xx_fec_mdio_priv { | ||
21 | struct mpc52xx_fec __iomem *regs; | ||
22 | }; | ||
23 | |||
24 | static int mpc52xx_fec_mdio_read(struct mii_bus *bus, int phy_id, int reg) | ||
25 | { | ||
26 | struct mpc52xx_fec_mdio_priv *priv = bus->priv; | ||
27 | struct mpc52xx_fec __iomem *fec; | ||
28 | int tries = 100; | ||
29 | u32 request = FEC_MII_READ_FRAME; | ||
30 | |||
31 | fec = priv->regs; | ||
32 | out_be32(&fec->ievent, FEC_IEVENT_MII); | ||
33 | |||
34 | request |= (phy_id << FEC_MII_DATA_PA_SHIFT) & FEC_MII_DATA_PA_MSK; | ||
35 | request |= (reg << FEC_MII_DATA_RA_SHIFT) & FEC_MII_DATA_RA_MSK; | ||
36 | |||
37 | out_be32(&priv->regs->mii_data, request); | ||
38 | |||
39 | /* wait for it to finish, this takes about 23 us on lite5200b */ | ||
40 | while (!(in_be32(&fec->ievent) & FEC_IEVENT_MII) && --tries) | ||
41 | udelay(5); | ||
42 | |||
43 | if (tries == 0) | ||
44 | return -ETIMEDOUT; | ||
45 | |||
46 | return in_be32(&priv->regs->mii_data) & FEC_MII_DATA_DATAMSK; | ||
47 | } | ||
48 | |||
49 | static int mpc52xx_fec_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 data) | ||
50 | { | ||
51 | struct mpc52xx_fec_mdio_priv *priv = bus->priv; | ||
52 | struct mpc52xx_fec __iomem *fec; | ||
53 | u32 value = data; | ||
54 | int tries = 100; | ||
55 | |||
56 | fec = priv->regs; | ||
57 | out_be32(&fec->ievent, FEC_IEVENT_MII); | ||
58 | |||
59 | value |= FEC_MII_WRITE_FRAME; | ||
60 | value |= (phy_id << FEC_MII_DATA_PA_SHIFT) & FEC_MII_DATA_PA_MSK; | ||
61 | value |= (reg << FEC_MII_DATA_RA_SHIFT) & FEC_MII_DATA_RA_MSK; | ||
62 | |||
63 | out_be32(&priv->regs->mii_data, value); | ||
64 | |||
65 | /* wait for request to finish */ | ||
66 | while (!(in_be32(&fec->ievent) & FEC_IEVENT_MII) && --tries) | ||
67 | udelay(5); | ||
68 | |||
69 | if (tries == 0) | ||
70 | return -ETIMEDOUT; | ||
71 | |||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | static int mpc52xx_fec_mdio_probe(struct of_device *of, const struct of_device_id *match) | ||
76 | { | ||
77 | struct device *dev = &of->dev; | ||
78 | struct device_node *np = of->node; | ||
79 | struct device_node *child = NULL; | ||
80 | struct mii_bus *bus; | ||
81 | struct mpc52xx_fec_mdio_priv *priv; | ||
82 | struct resource res = {}; | ||
83 | int err; | ||
84 | int i; | ||
85 | |||
86 | bus = kzalloc(sizeof(*bus), GFP_KERNEL); | ||
87 | if (bus == NULL) | ||
88 | return -ENOMEM; | ||
89 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
90 | if (priv == NULL) { | ||
91 | err = -ENOMEM; | ||
92 | goto out_free; | ||
93 | } | ||
94 | |||
95 | bus->name = "mpc52xx MII bus"; | ||
96 | bus->read = mpc52xx_fec_mdio_read; | ||
97 | bus->write = mpc52xx_fec_mdio_write; | ||
98 | |||
99 | /* setup irqs */ | ||
100 | bus->irq = kmalloc(sizeof(bus->irq[0]) * PHY_MAX_ADDR, GFP_KERNEL); | ||
101 | if (bus->irq == NULL) { | ||
102 | err = -ENOMEM; | ||
103 | goto out_free; | ||
104 | } | ||
105 | for (i=0; i<PHY_MAX_ADDR; i++) | ||
106 | bus->irq[i] = PHY_POLL; | ||
107 | |||
108 | while ((child = of_get_next_child(np, child)) != NULL) { | ||
109 | int irq = irq_of_parse_and_map(child, 0); | ||
110 | if (irq != NO_IRQ) { | ||
111 | const u32 *id = of_get_property(child, "reg", NULL); | ||
112 | bus->irq[*id] = irq; | ||
113 | } | ||
114 | } | ||
115 | |||
116 | /* setup registers */ | ||
117 | err = of_address_to_resource(np, 0, &res); | ||
118 | if (err) | ||
119 | goto out_free; | ||
120 | priv->regs = ioremap(res.start, res.end - res.start + 1); | ||
121 | if (priv->regs == NULL) { | ||
122 | err = -ENOMEM; | ||
123 | goto out_free; | ||
124 | } | ||
125 | |||
126 | bus->id = res.start; | ||
127 | bus->priv = priv; | ||
128 | |||
129 | bus->dev = dev; | ||
130 | dev_set_drvdata(dev, bus); | ||
131 | |||
132 | /* set MII speed */ | ||
133 | out_be32(&priv->regs->mii_speed, ((mpc52xx_find_ipb_freq(of->node) >> 20) / 5) << 1); | ||
134 | |||
135 | /* enable MII interrupt */ | ||
136 | out_be32(&priv->regs->imask, in_be32(&priv->regs->imask) | FEC_IMASK_MII); | ||
137 | |||
138 | err = mdiobus_register(bus); | ||
139 | if (err) | ||
140 | goto out_unmap; | ||
141 | |||
142 | return 0; | ||
143 | |||
144 | out_unmap: | ||
145 | iounmap(priv->regs); | ||
146 | out_free: | ||
147 | for (i=0; i<PHY_MAX_ADDR; i++) | ||
148 | if (bus->irq[i] != PHY_POLL) | ||
149 | irq_dispose_mapping(bus->irq[i]); | ||
150 | kfree(bus->irq); | ||
151 | kfree(priv); | ||
152 | kfree(bus); | ||
153 | |||
154 | return err; | ||
155 | } | ||
156 | |||
157 | static int mpc52xx_fec_mdio_remove(struct of_device *of) | ||
158 | { | ||
159 | struct device *dev = &of->dev; | ||
160 | struct mii_bus *bus = dev_get_drvdata(dev); | ||
161 | struct mpc52xx_fec_mdio_priv *priv = bus->priv; | ||
162 | int i; | ||
163 | |||
164 | mdiobus_unregister(bus); | ||
165 | dev_set_drvdata(dev, NULL); | ||
166 | |||
167 | iounmap(priv->regs); | ||
168 | for (i=0; i<PHY_MAX_ADDR; i++) | ||
169 | if (bus->irq[i]) | ||
170 | irq_dispose_mapping(bus->irq[i]); | ||
171 | kfree(priv); | ||
172 | kfree(bus->irq); | ||
173 | kfree(bus); | ||
174 | |||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | |||
179 | static struct of_device_id mpc52xx_fec_mdio_match[] = { | ||
180 | { | ||
181 | .type = "mdio", | ||
182 | .compatible = "mpc5200b-fec-phy", | ||
183 | }, | ||
184 | {}, | ||
185 | }; | ||
186 | |||
187 | struct of_platform_driver mpc52xx_fec_mdio_driver = { | ||
188 | .name = "mpc5200b-fec-phy", | ||
189 | .probe = mpc52xx_fec_mdio_probe, | ||
190 | .remove = mpc52xx_fec_mdio_remove, | ||
191 | .match_table = mpc52xx_fec_mdio_match, | ||
192 | }; | ||
193 | |||
194 | /* let fec driver call it, since this has to be registered before it */ | ||
195 | EXPORT_SYMBOL_GPL(mpc52xx_fec_mdio_driver); | ||
196 | |||
197 | |||
198 | MODULE_LICENSE("Dual BSD/GPL"); | ||
diff --git a/drivers/net/fs_enet/Kconfig b/drivers/net/fs_enet/Kconfig index 2765e49e07df..562ea68ed99b 100644 --- a/drivers/net/fs_enet/Kconfig +++ b/drivers/net/fs_enet/Kconfig | |||
@@ -2,6 +2,7 @@ config FS_ENET | |||
2 | tristate "Freescale Ethernet Driver" | 2 | tristate "Freescale Ethernet Driver" |
3 | depends on CPM1 || CPM2 | 3 | depends on CPM1 || CPM2 |
4 | select MII | 4 | select MII |
5 | select PHYLIB | ||
5 | 6 | ||
6 | config FS_ENET_HAS_SCC | 7 | config FS_ENET_HAS_SCC |
7 | bool "Chip has an SCC usable for ethernet" | 8 | bool "Chip has an SCC usable for ethernet" |
@@ -11,11 +12,19 @@ config FS_ENET_HAS_SCC | |||
11 | config FS_ENET_HAS_FCC | 12 | config FS_ENET_HAS_FCC |
12 | bool "Chip has an FCC usable for ethernet" | 13 | bool "Chip has an FCC usable for ethernet" |
13 | depends on FS_ENET && CPM2 | 14 | depends on FS_ENET && CPM2 |
14 | select MDIO_BITBANG | ||
15 | default y | 15 | default y |
16 | 16 | ||
17 | config FS_ENET_HAS_FEC | 17 | config FS_ENET_HAS_FEC |
18 | bool "Chip has an FEC usable for ethernet" | 18 | bool "Chip has an FEC usable for ethernet" |
19 | depends on FS_ENET && CPM1 | 19 | depends on FS_ENET && CPM1 |
20 | select FS_ENET_MDIO_FEC | ||
20 | default y | 21 | default y |
21 | 22 | ||
23 | config FS_ENET_MDIO_FEC | ||
24 | tristate "MDIO driver for FEC" | ||
25 | depends on FS_ENET && CPM1 | ||
26 | |||
27 | config FS_ENET_MDIO_FCC | ||
28 | tristate "MDIO driver for FCC" | ||
29 | depends on FS_ENET && CPM2 | ||
30 | select MDIO_BITBANG | ||
diff --git a/drivers/net/fs_enet/Makefile b/drivers/net/fs_enet/Makefile index 02d4dc18ba69..1ffbe0756a0c 100644 --- a/drivers/net/fs_enet/Makefile +++ b/drivers/net/fs_enet/Makefile | |||
@@ -4,7 +4,16 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_FS_ENET) += fs_enet.o | 5 | obj-$(CONFIG_FS_ENET) += fs_enet.o |
6 | 6 | ||
7 | obj-$(CONFIG_8xx) += mac-fec.o mac-scc.o mii-fec.o | 7 | fs_enet-$(CONFIG_FS_ENET_HAS_SCC) += mac-scc.o |
8 | obj-$(CONFIG_CPM2) += mac-fcc.o mii-bitbang.o | 8 | fs_enet-$(CONFIG_FS_ENET_HAS_FEC) += mac-fec.o |
9 | fs_enet-$(CONFIG_FS_ENET_HAS_FCC) += mac-fcc.o | ||
9 | 10 | ||
10 | fs_enet-objs := fs_enet-main.o | 11 | ifeq ($(CONFIG_PPC_CPM_NEW_BINDING),y) |
12 | obj-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o | ||
13 | obj-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o | ||
14 | else | ||
15 | fs_enet-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o | ||
16 | fs_enet-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o | ||
17 | endif | ||
18 | |||
19 | fs_enet-objs := fs_enet-main.o $(fs_enet-m) | ||
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index e0119f6a3319..580cb4ab2af1 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -762,26 +762,20 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file, | |||
762 | 762 | ||
763 | if (copy_from_user(&addr, | 763 | if (copy_from_user(&addr, |
764 | (void __user *) arg, AX25_ADDR_LEN)) { | 764 | (void __user *) arg, AX25_ADDR_LEN)) { |
765 | err = -EFAULT; | 765 | err = -EFAULT; |
766 | break; | 766 | break; |
767 | } | 767 | } |
768 | 768 | ||
769 | netif_tx_lock_bh(dev); | 769 | netif_tx_lock_bh(dev); |
770 | memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN); | 770 | memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN); |
771 | netif_tx_unlock_bh(dev); | 771 | netif_tx_unlock_bh(dev); |
772 | 772 | ||
773 | err = 0; | 773 | err = 0; |
774 | break; | 774 | break; |
775 | } | 775 | } |
776 | |||
777 | /* Allow stty to read, but not set, the serial port */ | ||
778 | case TCGETS: | ||
779 | case TCGETA: | ||
780 | err = n_tty_ioctl(tty, (struct file *) file, cmd, arg); | ||
781 | break; | ||
782 | 776 | ||
783 | default: | 777 | default: |
784 | err = -ENOIOCTLCMD; | 778 | err = tty_mode_ioctl(tty, file, cmd, arg); |
785 | } | 779 | } |
786 | 780 | ||
787 | sp_put(sp); | 781 | sp_put(sp); |
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c index 4dbdfaaf37bf..a1e4508717c8 100644 --- a/drivers/net/irda/au1k_ir.c +++ b/drivers/net/irda/au1k_ir.c | |||
@@ -627,19 +627,16 @@ static int au1k_irda_rx(struct net_device *dev) | |||
627 | } | 627 | } |
628 | 628 | ||
629 | 629 | ||
630 | void au1k_irda_interrupt(int irq, void *dev_id) | 630 | static irqreturn_t au1k_irda_interrupt(int dummy, void *dev_id) |
631 | { | 631 | { |
632 | struct net_device *dev = (struct net_device *) dev_id; | 632 | struct net_device *dev = dev_id; |
633 | |||
634 | if (dev == NULL) { | ||
635 | printk(KERN_ERR "%s: isr: null dev ptr\n", dev->name); | ||
636 | return; | ||
637 | } | ||
638 | 633 | ||
639 | writel(0, IR_INT_CLEAR); /* ack irda interrupts */ | 634 | writel(0, IR_INT_CLEAR); /* ack irda interrupts */ |
640 | 635 | ||
641 | au1k_irda_rx(dev); | 636 | au1k_irda_rx(dev); |
642 | au1k_tx_ack(dev); | 637 | au1k_tx_ack(dev); |
638 | |||
639 | return IRQ_HANDLED; | ||
643 | } | 640 | } |
644 | 641 | ||
645 | 642 | ||
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index 2c6f7be36e8a..fc753d7f674e 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -434,11 +434,6 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
434 | IRDA_ASSERT(dev != NULL, return -1;); | 434 | IRDA_ASSERT(dev != NULL, return -1;); |
435 | 435 | ||
436 | switch (cmd) { | 436 | switch (cmd) { |
437 | case TCGETS: | ||
438 | case TCGETA: | ||
439 | err = n_tty_ioctl(tty, file, cmd, arg); | ||
440 | break; | ||
441 | |||
442 | case IRTTY_IOCTDONGLE: | 437 | case IRTTY_IOCTDONGLE: |
443 | /* this call blocks for completion */ | 438 | /* this call blocks for completion */ |
444 | err = sirdev_set_dongle(dev, (IRDA_DONGLE) arg); | 439 | err = sirdev_set_dongle(dev, (IRDA_DONGLE) arg); |
@@ -454,7 +449,7 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
454 | err = -EFAULT; | 449 | err = -EFAULT; |
455 | break; | 450 | break; |
456 | default: | 451 | default: |
457 | err = -ENOIOCTLCMD; | 452 | err = tty_mode_ioctl(tty, file, cmd, arg); |
458 | break; | 453 | break; |
459 | } | 454 | } |
460 | return err; | 455 | return err; |
diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h index 1eee8894c732..3d2e7217e9af 100644 --- a/drivers/net/ixgb/ixgb.h +++ b/drivers/net/ixgb/ixgb.h | |||
@@ -196,4 +196,11 @@ struct ixgb_adapter { | |||
196 | uint32_t alloc_rx_buff_failed; | 196 | uint32_t alloc_rx_buff_failed; |
197 | boolean_t have_msi; | 197 | boolean_t have_msi; |
198 | }; | 198 | }; |
199 | |||
200 | /* Exported from other modules */ | ||
201 | extern void ixgb_check_options(struct ixgb_adapter *adapter); | ||
202 | extern void ixgb_set_ethtool_ops(struct net_device *netdev); | ||
203 | extern char ixgb_driver_name[]; | ||
204 | extern const char ixgb_driver_version[]; | ||
205 | |||
199 | #endif /* _IXGB_H_ */ | 206 | #endif /* _IXGB_H_ */ |
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c index fddd5844168d..a267dd862520 100644 --- a/drivers/net/ixgb/ixgb_ethtool.c +++ b/drivers/net/ixgb/ixgb_ethtool.c | |||
@@ -32,9 +32,6 @@ | |||
32 | 32 | ||
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | 34 | ||
35 | extern char ixgb_driver_name[]; | ||
36 | extern char ixgb_driver_version[]; | ||
37 | |||
38 | extern int ixgb_up(struct ixgb_adapter *adapter); | 35 | extern int ixgb_up(struct ixgb_adapter *adapter); |
39 | extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog); | 36 | extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog); |
40 | extern void ixgb_reset(struct ixgb_adapter *adapter); | 37 | extern void ixgb_reset(struct ixgb_adapter *adapter); |
@@ -639,8 +636,8 @@ ixgb_phys_id(struct net_device *netdev, uint32_t data) | |||
639 | { | 636 | { |
640 | struct ixgb_adapter *adapter = netdev_priv(netdev); | 637 | struct ixgb_adapter *adapter = netdev_priv(netdev); |
641 | 638 | ||
642 | if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) | 639 | if (!data) |
643 | data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); | 640 | data = INT_MAX; |
644 | 641 | ||
645 | if(!adapter->blink_timer.function) { | 642 | if(!adapter->blink_timer.function) { |
646 | init_timer(&adapter->blink_timer); | 643 | init_timer(&adapter->blink_timer); |
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c index ecbf45861c68..2c6367ace3cd 100644 --- a/drivers/net/ixgb/ixgb_hw.c +++ b/drivers/net/ixgb/ixgb_hw.c | |||
@@ -1174,7 +1174,7 @@ mac_addr_valid(uint8_t *mac_addr) | |||
1174 | * | 1174 | * |
1175 | * hw - Struct containing variables accessed by shared code | 1175 | * hw - Struct containing variables accessed by shared code |
1176 | *****************************************************************************/ | 1176 | *****************************************************************************/ |
1177 | boolean_t | 1177 | static boolean_t |
1178 | ixgb_link_reset(struct ixgb_hw *hw) | 1178 | ixgb_link_reset(struct ixgb_hw *hw) |
1179 | { | 1179 | { |
1180 | boolean_t link_status = FALSE; | 1180 | boolean_t link_status = FALSE; |
@@ -1205,7 +1205,7 @@ ixgb_link_reset(struct ixgb_hw *hw) | |||
1205 | * | 1205 | * |
1206 | * hw - Struct containing variables accessed by shared code | 1206 | * hw - Struct containing variables accessed by shared code |
1207 | *****************************************************************************/ | 1207 | *****************************************************************************/ |
1208 | void | 1208 | static void |
1209 | ixgb_optics_reset(struct ixgb_hw *hw) | 1209 | ixgb_optics_reset(struct ixgb_hw *hw) |
1210 | { | 1210 | { |
1211 | if (hw->phy_type == ixgb_phy_type_txn17401) { | 1211 | if (hw->phy_type == ixgb_phy_type_txn17401) { |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index d444de58ba34..3021234b1e17 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -37,8 +37,8 @@ static char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver"; | |||
37 | #define DRIVERNAPI "-NAPI" | 37 | #define DRIVERNAPI "-NAPI" |
38 | #endif | 38 | #endif |
39 | #define DRV_VERSION "1.0.126-k2"DRIVERNAPI | 39 | #define DRV_VERSION "1.0.126-k2"DRIVERNAPI |
40 | char ixgb_driver_version[] = DRV_VERSION; | 40 | const char ixgb_driver_version[] = DRV_VERSION; |
41 | static char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; | 41 | static const char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; |
42 | 42 | ||
43 | /* ixgb_pci_tbl - PCI Device ID Table | 43 | /* ixgb_pci_tbl - PCI Device ID Table |
44 | * | 44 | * |
@@ -104,7 +104,6 @@ static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter, | |||
104 | static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter); | 104 | static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter); |
105 | #endif | 105 | #endif |
106 | static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter); | 106 | static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter); |
107 | void ixgb_set_ethtool_ops(struct net_device *netdev); | ||
108 | static void ixgb_tx_timeout(struct net_device *dev); | 107 | static void ixgb_tx_timeout(struct net_device *dev); |
109 | static void ixgb_tx_timeout_task(struct work_struct *work); | 108 | static void ixgb_tx_timeout_task(struct work_struct *work); |
110 | static void ixgb_vlan_rx_register(struct net_device *netdev, | 109 | static void ixgb_vlan_rx_register(struct net_device *netdev, |
@@ -123,9 +122,6 @@ static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev, | |||
123 | static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev); | 122 | static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev); |
124 | static void ixgb_io_resume (struct pci_dev *pdev); | 123 | static void ixgb_io_resume (struct pci_dev *pdev); |
125 | 124 | ||
126 | /* Exported from other modules */ | ||
127 | extern void ixgb_check_options(struct ixgb_adapter *adapter); | ||
128 | |||
129 | static struct pci_error_handlers ixgb_err_handler = { | 125 | static struct pci_error_handlers ixgb_err_handler = { |
130 | .error_detected = ixgb_io_error_detected, | 126 | .error_detected = ixgb_io_error_detected, |
131 | .slot_reset = ixgb_io_slot_reset, | 127 | .slot_reset = ixgb_io_slot_reset, |
@@ -1085,7 +1081,8 @@ ixgb_set_multi(struct net_device *netdev) | |||
1085 | rctl |= IXGB_RCTL_MPE; | 1081 | rctl |= IXGB_RCTL_MPE; |
1086 | IXGB_WRITE_REG(hw, RCTL, rctl); | 1082 | IXGB_WRITE_REG(hw, RCTL, rctl); |
1087 | } else { | 1083 | } else { |
1088 | uint8_t mta[netdev->mc_count * IXGB_ETH_LENGTH_OF_ADDRESS]; | 1084 | uint8_t mta[IXGB_MAX_NUM_MULTICAST_ADDRESSES * |
1085 | IXGB_ETH_LENGTH_OF_ADDRESS]; | ||
1089 | 1086 | ||
1090 | IXGB_WRITE_REG(hw, RCTL, rctl); | 1087 | IXGB_WRITE_REG(hw, RCTL, rctl); |
1091 | 1088 | ||
@@ -1324,8 +1321,8 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb, | |||
1324 | 1321 | ||
1325 | /* Workaround for premature desc write-backs | 1322 | /* Workaround for premature desc write-backs |
1326 | * in TSO mode. Append 4-byte sentinel desc */ | 1323 | * in TSO mode. Append 4-byte sentinel desc */ |
1327 | if (unlikely(mss && !nr_frags && size == len | 1324 | if (unlikely(mss && (f == (nr_frags - 1)) |
1328 | && size > 8)) | 1325 | && size == len && size > 8)) |
1329 | size -= 4; | 1326 | size -= 4; |
1330 | 1327 | ||
1331 | buffer_info->length = size; | 1328 | buffer_info->length = size; |
diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c index 5d5ddabf4360..865d14d6e5a7 100644 --- a/drivers/net/ixgb/ixgb_param.c +++ b/drivers/net/ixgb/ixgb_param.c | |||
@@ -44,10 +44,11 @@ | |||
44 | */ | 44 | */ |
45 | 45 | ||
46 | #define IXGB_PARAM_INIT { [0 ... IXGB_MAX_NIC] = OPTION_UNSET } | 46 | #define IXGB_PARAM_INIT { [0 ... IXGB_MAX_NIC] = OPTION_UNSET } |
47 | #define IXGB_PARAM(X, desc) \ | 47 | #define IXGB_PARAM(X, desc) \ |
48 | static int __devinitdata X[IXGB_MAX_NIC+1] = IXGB_PARAM_INIT; \ | 48 | static int __devinitdata X[IXGB_MAX_NIC+1] \ |
49 | static int num_##X = 0; \ | 49 | = IXGB_PARAM_INIT; \ |
50 | module_param_array_named(X, X, int, &num_##X, 0); \ | 50 | static unsigned int num_##X = 0; \ |
51 | module_param_array_named(X, X, int, &num_##X, 0); \ | ||
51 | MODULE_PARM_DESC(X, desc); | 52 | MODULE_PARM_DESC(X, desc); |
52 | 53 | ||
53 | /* Transmit Descriptor Count | 54 | /* Transmit Descriptor Count |
@@ -178,8 +179,8 @@ IXGB_PARAM(IntDelayEnable, "Transmit Interrupt Delay Enable"); | |||
178 | 179 | ||
179 | struct ixgb_option { | 180 | struct ixgb_option { |
180 | enum { enable_option, range_option, list_option } type; | 181 | enum { enable_option, range_option, list_option } type; |
181 | char *name; | 182 | const char *name; |
182 | char *err; | 183 | const char *err; |
183 | int def; | 184 | int def; |
184 | union { | 185 | union { |
185 | struct { /* range_option info */ | 186 | struct { /* range_option info */ |
@@ -197,7 +198,7 @@ struct ixgb_option { | |||
197 | }; | 198 | }; |
198 | 199 | ||
199 | static int __devinit | 200 | static int __devinit |
200 | ixgb_validate_option(int *value, struct ixgb_option *opt) | 201 | ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt) |
201 | { | 202 | { |
202 | if(*value == OPTION_UNSET) { | 203 | if(*value == OPTION_UNSET) { |
203 | *value = opt->def; | 204 | *value = opt->def; |
@@ -266,7 +267,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
266 | } | 267 | } |
267 | 268 | ||
268 | { /* Transmit Descriptor Count */ | 269 | { /* Transmit Descriptor Count */ |
269 | struct ixgb_option opt = { | 270 | const struct ixgb_option opt = { |
270 | .type = range_option, | 271 | .type = range_option, |
271 | .name = "Transmit Descriptors", | 272 | .name = "Transmit Descriptors", |
272 | .err = "using default of " __MODULE_STRING(DEFAULT_TXD), | 273 | .err = "using default of " __MODULE_STRING(DEFAULT_TXD), |
@@ -285,7 +286,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
285 | tx_ring->count = ALIGN(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); | 286 | tx_ring->count = ALIGN(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); |
286 | } | 287 | } |
287 | { /* Receive Descriptor Count */ | 288 | { /* Receive Descriptor Count */ |
288 | struct ixgb_option opt = { | 289 | const struct ixgb_option opt = { |
289 | .type = range_option, | 290 | .type = range_option, |
290 | .name = "Receive Descriptors", | 291 | .name = "Receive Descriptors", |
291 | .err = "using default of " __MODULE_STRING(DEFAULT_RXD), | 292 | .err = "using default of " __MODULE_STRING(DEFAULT_RXD), |
@@ -304,7 +305,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
304 | rx_ring->count = ALIGN(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); | 305 | rx_ring->count = ALIGN(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); |
305 | } | 306 | } |
306 | { /* Receive Checksum Offload Enable */ | 307 | { /* Receive Checksum Offload Enable */ |
307 | struct ixgb_option opt = { | 308 | const struct ixgb_option opt = { |
308 | .type = enable_option, | 309 | .type = enable_option, |
309 | .name = "Receive Checksum Offload", | 310 | .name = "Receive Checksum Offload", |
310 | .err = "defaulting to Enabled", | 311 | .err = "defaulting to Enabled", |
@@ -312,7 +313,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
312 | }; | 313 | }; |
313 | 314 | ||
314 | if(num_XsumRX > bd) { | 315 | if(num_XsumRX > bd) { |
315 | int rx_csum = XsumRX[bd]; | 316 | unsigned int rx_csum = XsumRX[bd]; |
316 | ixgb_validate_option(&rx_csum, &opt); | 317 | ixgb_validate_option(&rx_csum, &opt); |
317 | adapter->rx_csum = rx_csum; | 318 | adapter->rx_csum = rx_csum; |
318 | } else { | 319 | } else { |
@@ -328,7 +329,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
328 | { ixgb_fc_full, "Flow Control Enabled" }, | 329 | { ixgb_fc_full, "Flow Control Enabled" }, |
329 | { ixgb_fc_default, "Flow Control Hardware Default" }}; | 330 | { ixgb_fc_default, "Flow Control Hardware Default" }}; |
330 | 331 | ||
331 | struct ixgb_option opt = { | 332 | const struct ixgb_option opt = { |
332 | .type = list_option, | 333 | .type = list_option, |
333 | .name = "Flow Control", | 334 | .name = "Flow Control", |
334 | .err = "reading default settings from EEPROM", | 335 | .err = "reading default settings from EEPROM", |
@@ -338,7 +339,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
338 | }; | 339 | }; |
339 | 340 | ||
340 | if(num_FlowControl > bd) { | 341 | if(num_FlowControl > bd) { |
341 | int fc = FlowControl[bd]; | 342 | unsigned int fc = FlowControl[bd]; |
342 | ixgb_validate_option(&fc, &opt); | 343 | ixgb_validate_option(&fc, &opt); |
343 | adapter->hw.fc.type = fc; | 344 | adapter->hw.fc.type = fc; |
344 | } else { | 345 | } else { |
@@ -346,7 +347,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
346 | } | 347 | } |
347 | } | 348 | } |
348 | { /* Receive Flow Control High Threshold */ | 349 | { /* Receive Flow Control High Threshold */ |
349 | struct ixgb_option opt = { | 350 | const struct ixgb_option opt = { |
350 | .type = range_option, | 351 | .type = range_option, |
351 | .name = "Rx Flow Control High Threshold", | 352 | .name = "Rx Flow Control High Threshold", |
352 | .err = "using default of " __MODULE_STRING(DEFAULT_FCRTH), | 353 | .err = "using default of " __MODULE_STRING(DEFAULT_FCRTH), |
@@ -366,7 +367,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
366 | "Ignoring RxFCHighThresh when no RxFC\n"); | 367 | "Ignoring RxFCHighThresh when no RxFC\n"); |
367 | } | 368 | } |
368 | { /* Receive Flow Control Low Threshold */ | 369 | { /* Receive Flow Control Low Threshold */ |
369 | struct ixgb_option opt = { | 370 | const struct ixgb_option opt = { |
370 | .type = range_option, | 371 | .type = range_option, |
371 | .name = "Rx Flow Control Low Threshold", | 372 | .name = "Rx Flow Control Low Threshold", |
372 | .err = "using default of " __MODULE_STRING(DEFAULT_FCRTL), | 373 | .err = "using default of " __MODULE_STRING(DEFAULT_FCRTL), |
@@ -386,7 +387,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
386 | "Ignoring RxFCLowThresh when no RxFC\n"); | 387 | "Ignoring RxFCLowThresh when no RxFC\n"); |
387 | } | 388 | } |
388 | { /* Flow Control Pause Time Request*/ | 389 | { /* Flow Control Pause Time Request*/ |
389 | struct ixgb_option opt = { | 390 | const struct ixgb_option opt = { |
390 | .type = range_option, | 391 | .type = range_option, |
391 | .name = "Flow Control Pause Time Request", | 392 | .name = "Flow Control Pause Time Request", |
392 | .err = "using default of "__MODULE_STRING(DEFAULT_FCPAUSE), | 393 | .err = "using default of "__MODULE_STRING(DEFAULT_FCPAUSE), |
@@ -396,7 +397,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
396 | }; | 397 | }; |
397 | 398 | ||
398 | if(num_FCReqTimeout > bd) { | 399 | if(num_FCReqTimeout > bd) { |
399 | int pause_time = FCReqTimeout[bd]; | 400 | unsigned int pause_time = FCReqTimeout[bd]; |
400 | ixgb_validate_option(&pause_time, &opt); | 401 | ixgb_validate_option(&pause_time, &opt); |
401 | adapter->hw.fc.pause_time = pause_time; | 402 | adapter->hw.fc.pause_time = pause_time; |
402 | } else { | 403 | } else { |
@@ -419,7 +420,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
419 | } | 420 | } |
420 | } | 421 | } |
421 | { /* Receive Interrupt Delay */ | 422 | { /* Receive Interrupt Delay */ |
422 | struct ixgb_option opt = { | 423 | const struct ixgb_option opt = { |
423 | .type = range_option, | 424 | .type = range_option, |
424 | .name = "Receive Interrupt Delay", | 425 | .name = "Receive Interrupt Delay", |
425 | .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), | 426 | .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), |
@@ -436,7 +437,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
436 | } | 437 | } |
437 | } | 438 | } |
438 | { /* Transmit Interrupt Delay */ | 439 | { /* Transmit Interrupt Delay */ |
439 | struct ixgb_option opt = { | 440 | const struct ixgb_option opt = { |
440 | .type = range_option, | 441 | .type = range_option, |
441 | .name = "Transmit Interrupt Delay", | 442 | .name = "Transmit Interrupt Delay", |
442 | .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), | 443 | .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), |
@@ -454,7 +455,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
454 | } | 455 | } |
455 | 456 | ||
456 | { /* Transmit Interrupt Delay Enable */ | 457 | { /* Transmit Interrupt Delay Enable */ |
457 | struct ixgb_option opt = { | 458 | const struct ixgb_option opt = { |
458 | .type = enable_option, | 459 | .type = enable_option, |
459 | .name = "Tx Interrupt Delay Enable", | 460 | .name = "Tx Interrupt Delay Enable", |
460 | .err = "defaulting to Enabled", | 461 | .err = "defaulting to Enabled", |
@@ -462,7 +463,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) | |||
462 | }; | 463 | }; |
463 | 464 | ||
464 | if(num_IntDelayEnable > bd) { | 465 | if(num_IntDelayEnable > bd) { |
465 | int ide = IntDelayEnable[bd]; | 466 | unsigned int ide = IntDelayEnable[bd]; |
466 | ixgb_validate_option(&ide, &opt); | 467 | ixgb_validate_option(&ide, &opt); |
467 | adapter->tx_int_delay_enable = ide; | 468 | adapter->tx_int_delay_enable = ide; |
468 | } else { | 469 | } else { |
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index c160a7d91e21..bc51432b8d26 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -244,7 +244,7 @@ extern struct ixgbe_info ixgbe_82598EB_info; | |||
244 | extern struct ixgbe_info ixgbe_82598AT_info; | 244 | extern struct ixgbe_info ixgbe_82598AT_info; |
245 | 245 | ||
246 | extern char ixgbe_driver_name[]; | 246 | extern char ixgbe_driver_name[]; |
247 | extern char ixgbe_driver_version[]; | 247 | extern const char ixgbe_driver_version[]; |
248 | 248 | ||
249 | extern int ixgbe_up(struct ixgbe_adapter *adapter); | 249 | extern int ixgbe_up(struct ixgbe_adapter *adapter); |
250 | extern void ixgbe_down(struct ixgbe_adapter *adapter); | 250 | extern void ixgbe_down(struct ixgbe_adapter *adapter); |
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c index 00ee20125ca9..4d64673164ca 100644 --- a/drivers/net/ixgbe/ixgbe_82598.c +++ b/drivers/net/ixgbe/ixgbe_82598.c | |||
@@ -30,8 +30,7 @@ | |||
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
32 | 32 | ||
33 | #include "ixgbe_type.h" | 33 | #include "ixgbe.h" |
34 | #include "ixgbe_common.h" | ||
35 | #include "ixgbe_phy.h" | 34 | #include "ixgbe_phy.h" |
36 | 35 | ||
37 | #define IXGBE_82598_MAX_TX_QUEUES 32 | 36 | #define IXGBE_82598_MAX_TX_QUEUES 32 |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index b75f1c6efc42..00bc525c6560 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -45,12 +45,13 @@ | |||
45 | #include "ixgbe_common.h" | 45 | #include "ixgbe_common.h" |
46 | 46 | ||
47 | char ixgbe_driver_name[] = "ixgbe"; | 47 | char ixgbe_driver_name[] = "ixgbe"; |
48 | static char ixgbe_driver_string[] = | 48 | static const char ixgbe_driver_string[] = |
49 | "Intel(R) 10 Gigabit PCI Express Network Driver"; | 49 | "Intel(R) 10 Gigabit PCI Express Network Driver"; |
50 | 50 | ||
51 | #define DRV_VERSION "1.1.18" | 51 | #define DRV_VERSION "1.1.18" |
52 | char ixgbe_driver_version[] = DRV_VERSION; | 52 | const char ixgbe_driver_version[] = DRV_VERSION; |
53 | static char ixgbe_copyright[] = "Copyright (c) 1999-2007 Intel Corporation."; | 53 | static const char ixgbe_copyright[] = |
54 | "Copyright (c) 1999-2007 Intel Corporation."; | ||
54 | 55 | ||
55 | static const struct ixgbe_info *ixgbe_info_tbl[] = { | 56 | static const struct ixgbe_info *ixgbe_info_tbl[] = { |
56 | [board_82598AF] = &ixgbe_82598AF_info, | 57 | [board_82598AF] = &ixgbe_82598AF_info, |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 45f30a2974b8..662b8d16803c 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -284,7 +284,7 @@ static __net_exit void loopback_net_exit(struct net *net) | |||
284 | unregister_netdev(dev); | 284 | unregister_netdev(dev); |
285 | } | 285 | } |
286 | 286 | ||
287 | static struct pernet_operations loopback_net_ops = { | 287 | static struct pernet_operations __net_initdata loopback_net_ops = { |
288 | .init = loopback_net_init, | 288 | .init = loopback_net_init, |
289 | .exit = loopback_net_exit, | 289 | .exit = loopback_net_exit, |
290 | }; | 290 | }; |
diff --git a/drivers/net/meth.c b/drivers/net/meth.c index e25dbab67363..0c89b028a80c 100644 --- a/drivers/net/meth.c +++ b/drivers/net/meth.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <asm/ip32/ip32_ints.h> | 33 | #include <asm/ip32/ip32_ints.h> |
34 | 34 | ||
35 | #include <asm/io.h> | 35 | #include <asm/io.h> |
36 | #include <asm/scatterlist.h> | ||
37 | 36 | ||
38 | #include "meth.h" | 37 | #include "meth.h" |
39 | 38 | ||
diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c index f8d63d39f592..b226e019bc8b 100644 --- a/drivers/net/mlx4/alloc.c +++ b/drivers/net/mlx4/alloc.c | |||
@@ -171,9 +171,10 @@ void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf) | |||
171 | buf->u.direct.map); | 171 | buf->u.direct.map); |
172 | else { | 172 | else { |
173 | for (i = 0; i < buf->nbufs; ++i) | 173 | for (i = 0; i < buf->nbufs; ++i) |
174 | dma_free_coherent(&dev->pdev->dev, PAGE_SIZE, | 174 | if (buf->u.page_list[i].buf) |
175 | buf->u.page_list[i].buf, | 175 | dma_free_coherent(&dev->pdev->dev, PAGE_SIZE, |
176 | buf->u.page_list[i].map); | 176 | buf->u.page_list[i].buf, |
177 | buf->u.page_list[i].map); | ||
177 | kfree(buf->u.page_list); | 178 | kfree(buf->u.page_list); |
178 | } | 179 | } |
179 | } | 180 | } |
diff --git a/drivers/net/mlx4/qp.c b/drivers/net/mlx4/qp.c index cc4b1be18219..42b47639c81c 100644 --- a/drivers/net/mlx4/qp.c +++ b/drivers/net/mlx4/qp.c | |||
@@ -240,7 +240,7 @@ void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp) | |||
240 | mlx4_table_put(dev, &qp_table->auxc_table, qp->qpn); | 240 | mlx4_table_put(dev, &qp_table->auxc_table, qp->qpn); |
241 | mlx4_table_put(dev, &qp_table->qp_table, qp->qpn); | 241 | mlx4_table_put(dev, &qp_table->qp_table, qp->qpn); |
242 | 242 | ||
243 | if (qp->qpn < dev->caps.sqp_start + 8) | 243 | if (qp->qpn >= dev->caps.sqp_start + 8) |
244 | mlx4_bitmap_free(&qp_table->bitmap, qp->qpn); | 244 | mlx4_bitmap_free(&qp_table->bitmap, qp->qpn); |
245 | } | 245 | } |
246 | EXPORT_SYMBOL_GPL(mlx4_qp_free); | 246 | EXPORT_SYMBOL_GPL(mlx4_qp_free); |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 366e62a2b1e5..0f306ddb5630 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -1151,7 +1151,7 @@ static inline int myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int budget) | |||
1151 | u16 length; | 1151 | u16 length; |
1152 | __wsum checksum; | 1152 | __wsum checksum; |
1153 | 1153 | ||
1154 | while (rx_done->entry[idx].length != 0 && work_done++ < budget) { | 1154 | while (rx_done->entry[idx].length != 0 && work_done < budget) { |
1155 | length = ntohs(rx_done->entry[idx].length); | 1155 | length = ntohs(rx_done->entry[idx].length); |
1156 | rx_done->entry[idx].length = 0; | 1156 | rx_done->entry[idx].length = 0; |
1157 | checksum = csum_unfold(rx_done->entry[idx].checksum); | 1157 | checksum = csum_unfold(rx_done->entry[idx].checksum); |
@@ -1167,6 +1167,7 @@ static inline int myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int budget) | |||
1167 | rx_bytes += rx_ok * (unsigned long)length; | 1167 | rx_bytes += rx_ok * (unsigned long)length; |
1168 | cnt++; | 1168 | cnt++; |
1169 | idx = cnt & (myri10ge_max_intr_slots - 1); | 1169 | idx = cnt & (myri10ge_max_intr_slots - 1); |
1170 | work_done++; | ||
1170 | } | 1171 | } |
1171 | rx_done->idx = idx; | 1172 | rx_done->idx = idx; |
1172 | rx_done->cnt = cnt; | 1173 | rx_done->cnt = cnt; |
@@ -1233,13 +1234,12 @@ static int myri10ge_poll(struct napi_struct *napi, int budget) | |||
1233 | struct myri10ge_priv *mgp = | 1234 | struct myri10ge_priv *mgp = |
1234 | container_of(napi, struct myri10ge_priv, napi); | 1235 | container_of(napi, struct myri10ge_priv, napi); |
1235 | struct net_device *netdev = mgp->dev; | 1236 | struct net_device *netdev = mgp->dev; |
1236 | struct myri10ge_rx_done *rx_done = &mgp->rx_done; | ||
1237 | int work_done; | 1237 | int work_done; |
1238 | 1238 | ||
1239 | /* process as many rx events as NAPI will allow */ | 1239 | /* process as many rx events as NAPI will allow */ |
1240 | work_done = myri10ge_clean_rx_done(mgp, budget); | 1240 | work_done = myri10ge_clean_rx_done(mgp, budget); |
1241 | 1241 | ||
1242 | if (rx_done->entry[rx_done->idx].length == 0 || !netif_running(netdev)) { | 1242 | if (work_done < budget || !netif_running(netdev)) { |
1243 | netif_rx_complete(netdev, napi); | 1243 | netif_rx_complete(netdev, napi); |
1244 | put_be32(htonl(3), mgp->irq_claim); | 1244 | put_be32(htonl(3), mgp->irq_claim); |
1245 | } | 1245 | } |
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c index 8d29319cc5cb..656a260fc956 100644 --- a/drivers/net/myri_sbus.c +++ b/drivers/net/myri_sbus.c | |||
@@ -134,7 +134,7 @@ static int myri_do_handshake(struct myri_eth *mp) | |||
134 | 134 | ||
135 | myri_disable_irq(mp->lregs, cregs); | 135 | myri_disable_irq(mp->lregs, cregs); |
136 | 136 | ||
137 | while (tick++ <= 25) { | 137 | while (tick++ < 25) { |
138 | u32 softstate; | 138 | u32 softstate; |
139 | 139 | ||
140 | /* Wake it up. */ | 140 | /* Wake it up. */ |
diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c index eb0aff787dfd..5267e031daa0 100644 --- a/drivers/net/netx-eth.c +++ b/drivers/net/netx-eth.c | |||
@@ -128,8 +128,8 @@ netx_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
128 | FIFO_PTR_FRAMELEN(len)); | 128 | FIFO_PTR_FRAMELEN(len)); |
129 | 129 | ||
130 | ndev->trans_start = jiffies; | 130 | ndev->trans_start = jiffies; |
131 | dev->stats.tx_packets++; | 131 | ndev->stats.tx_packets++; |
132 | dev->stats.tx_bytes += skb->len; | 132 | ndev->stats.tx_bytes += skb->len; |
133 | 133 | ||
134 | netif_stop_queue(ndev); | 134 | netif_stop_queue(ndev); |
135 | spin_unlock_irq(&priv->lock); | 135 | spin_unlock_irq(&priv->lock); |
@@ -155,7 +155,7 @@ static void netx_eth_receive(struct net_device *ndev) | |||
155 | if (unlikely(skb == NULL)) { | 155 | if (unlikely(skb == NULL)) { |
156 | printk(KERN_NOTICE "%s: Low memory, packet dropped.\n", | 156 | printk(KERN_NOTICE "%s: Low memory, packet dropped.\n", |
157 | ndev->name); | 157 | ndev->name); |
158 | dev->stats.rx_dropped++; | 158 | ndev->stats.rx_dropped++; |
159 | return; | 159 | return; |
160 | } | 160 | } |
161 | 161 | ||
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index ab4d309a858f..09b4fde8d924 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -580,6 +580,16 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) | |||
580 | 580 | ||
581 | len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S; | 581 | len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S; |
582 | 582 | ||
583 | pci_unmap_single(mac->dma_pdev, dma, len, PCI_DMA_FROMDEVICE); | ||
584 | |||
585 | if (macrx & XCT_MACRX_CRC) { | ||
586 | /* CRC error flagged */ | ||
587 | mac->netdev->stats.rx_errors++; | ||
588 | mac->netdev->stats.rx_crc_errors++; | ||
589 | dev_kfree_skb_irq(skb); | ||
590 | goto next; | ||
591 | } | ||
592 | |||
583 | if (len < 256) { | 593 | if (len < 256) { |
584 | struct sk_buff *new_skb; | 594 | struct sk_buff *new_skb; |
585 | 595 | ||
@@ -595,11 +605,10 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) | |||
595 | } else | 605 | } else |
596 | info->skb = NULL; | 606 | info->skb = NULL; |
597 | 607 | ||
598 | pci_unmap_single(mac->dma_pdev, dma, len, PCI_DMA_FROMDEVICE); | ||
599 | |||
600 | info->dma = 0; | 608 | info->dma = 0; |
601 | 609 | ||
602 | skb_put(skb, len); | 610 | /* Don't include CRC */ |
611 | skb_put(skb, len-4); | ||
603 | 612 | ||
604 | if (likely((macrx & XCT_MACRX_HTY_M) == XCT_MACRX_HTY_IPV4_OK)) { | 613 | if (likely((macrx & XCT_MACRX_HTY_M) == XCT_MACRX_HTY_IPV4_OK)) { |
605 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 614 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -614,6 +623,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) | |||
614 | skb->protocol = eth_type_trans(skb, mac->netdev); | 623 | skb->protocol = eth_type_trans(skb, mac->netdev); |
615 | netif_receive_skb(skb); | 624 | netif_receive_skb(skb); |
616 | 625 | ||
626 | next: | ||
617 | RX_RING(mac, n) = 0; | 627 | RX_RING(mac, n) = 0; |
618 | RX_RING(mac, n+1) = 0; | 628 | RX_RING(mac, n+1) = 0; |
619 | 629 | ||
@@ -1126,7 +1136,7 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1126 | unsigned long flags; | 1136 | unsigned long flags; |
1127 | int i, nfrags; | 1137 | int i, nfrags; |
1128 | 1138 | ||
1129 | dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_SS | XCT_MACTX_CRC_PAD; | 1139 | dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_CRC_PAD; |
1130 | 1140 | ||
1131 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1141 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1132 | const unsigned char *nh = skb_network_header(skb); | 1142 | const unsigned char *nh = skb_network_header(skb); |
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 73dcbb7296da..ad134a61302a 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -274,7 +274,7 @@ static int tc574_probe(struct pcmcia_device *link) | |||
274 | spin_lock_init(&lp->window_lock); | 274 | spin_lock_init(&lp->window_lock); |
275 | link->io.NumPorts1 = 32; | 275 | link->io.NumPorts1 = 32; |
276 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 276 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
277 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 277 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; |
278 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 278 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; |
279 | link->irq.Handler = &el3_interrupt; | 279 | link->irq.Handler = &el3_interrupt; |
280 | link->irq.Instance = dev; | 280 | link->irq.Instance = dev; |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 32076ca6a9e1..a98fe07cce70 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -188,7 +188,7 @@ static int tc589_probe(struct pcmcia_device *link) | |||
188 | spin_lock_init(&lp->lock); | 188 | spin_lock_init(&lp->lock); |
189 | link->io.NumPorts1 = 16; | 189 | link->io.NumPorts1 = 16; |
190 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 190 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
191 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 191 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; |
192 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 192 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; |
193 | link->irq.Handler = &el3_interrupt; | 193 | link->irq.Handler = &el3_interrupt; |
194 | link->irq.Instance = dev; | 194 | link->irq.Instance = dev; |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index a95a2cae6b23..8d910a372f89 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -158,7 +158,7 @@ static int axnet_probe(struct pcmcia_device *link) | |||
158 | info = PRIV(dev); | 158 | info = PRIV(dev); |
159 | info->p_dev = link; | 159 | info->p_dev = link; |
160 | link->priv = dev; | 160 | link->priv = dev; |
161 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 161 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
162 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 162 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; |
163 | link->conf.Attributes = CONF_ENABLE_IRQ; | 163 | link->conf.Attributes = CONF_ENABLE_IRQ; |
164 | link->conf.IntType = INT_MEMORY_AND_IO; | 164 | link->conf.IntType = INT_MEMORY_AND_IO; |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 62844677c784..8c719b4df544 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -249,7 +249,7 @@ static int fmvj18x_probe(struct pcmcia_device *link) | |||
249 | link->io.IOAddrLines = 5; | 249 | link->io.IOAddrLines = 5; |
250 | 250 | ||
251 | /* Interrupt setup */ | 251 | /* Interrupt setup */ |
252 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 252 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; |
253 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 253 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; |
254 | link->irq.Handler = &fjn_interrupt; | 254 | link->irq.Handler = &fjn_interrupt; |
255 | link->irq.Instance = dev; | 255 | link->irq.Instance = dev; |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 9d45e9696e16..db6a97d1d7b1 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -254,7 +254,7 @@ static int pcnet_probe(struct pcmcia_device *link) | |||
254 | info->p_dev = link; | 254 | info->p_dev = link; |
255 | link->priv = dev; | 255 | link->priv = dev; |
256 | 256 | ||
257 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 257 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
258 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 258 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; |
259 | link->conf.Attributes = CONF_ENABLE_IRQ; | 259 | link->conf.Attributes = CONF_ENABLE_IRQ; |
260 | link->conf.IntType = INT_MEMORY_AND_IO; | 260 | link->conf.IntType = INT_MEMORY_AND_IO; |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 58d716fd17cf..c9868e9dac4c 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -328,7 +328,7 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
328 | link->io.NumPorts1 = 16; | 328 | link->io.NumPorts1 = 16; |
329 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 329 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
330 | link->io.IOAddrLines = 4; | 330 | link->io.IOAddrLines = 4; |
331 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 331 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; |
332 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 332 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; |
333 | link->irq.Handler = &smc_interrupt; | 333 | link->irq.Handler = &smc_interrupt; |
334 | link->irq.Instance = dev; | 334 | link->irq.Instance = dev; |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index c3b69602e275..1f09bea6db5a 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -886,7 +886,7 @@ xirc2ps_config(struct pcmcia_device * link) | |||
886 | } | 886 | } |
887 | printk(KNOT_XIRC "no ports available\n"); | 887 | printk(KNOT_XIRC "no ports available\n"); |
888 | } else { | 888 | } else { |
889 | link->irq.Attributes |= IRQ_TYPE_EXCLUSIVE; | 889 | link->irq.Attributes |= IRQ_TYPE_DYNAMIC_SHARING; |
890 | link->io.NumPorts1 = 16; | 890 | link->io.NumPorts1 = 16; |
891 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { | 891 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { |
892 | link->io.BasePort1 = ioaddr; | 892 | link->io.BasePort1 = ioaddr; |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index d2ede5ff9fff..035fd41fb61f 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -265,7 +265,7 @@ static struct phy_driver marvell_drivers[] = { | |||
265 | .read_status = &genphy_read_status, | 265 | .read_status = &genphy_read_status, |
266 | .ack_interrupt = &marvell_ack_interrupt, | 266 | .ack_interrupt = &marvell_ack_interrupt, |
267 | .config_intr = &marvell_config_intr, | 267 | .config_intr = &marvell_config_intr, |
268 | .driver = {.owner = THIS_MODULE,}, | 268 | .driver = { .owner = THIS_MODULE }, |
269 | }, | 269 | }, |
270 | { | 270 | { |
271 | .phy_id = 0x01410c90, | 271 | .phy_id = 0x01410c90, |
@@ -278,7 +278,7 @@ static struct phy_driver marvell_drivers[] = { | |||
278 | .read_status = &genphy_read_status, | 278 | .read_status = &genphy_read_status, |
279 | .ack_interrupt = &marvell_ack_interrupt, | 279 | .ack_interrupt = &marvell_ack_interrupt, |
280 | .config_intr = &marvell_config_intr, | 280 | .config_intr = &marvell_config_intr, |
281 | .driver = {.owner = THIS_MODULE,}, | 281 | .driver = { .owner = THIS_MODULE }, |
282 | }, | 282 | }, |
283 | { | 283 | { |
284 | .phy_id = 0x01410cc0, | 284 | .phy_id = 0x01410cc0, |
@@ -291,7 +291,7 @@ static struct phy_driver marvell_drivers[] = { | |||
291 | .read_status = &genphy_read_status, | 291 | .read_status = &genphy_read_status, |
292 | .ack_interrupt = &marvell_ack_interrupt, | 292 | .ack_interrupt = &marvell_ack_interrupt, |
293 | .config_intr = &marvell_config_intr, | 293 | .config_intr = &marvell_config_intr, |
294 | .driver = {.owner = THIS_MODULE,}, | 294 | .driver = { .owner = THIS_MODULE }, |
295 | }, | 295 | }, |
296 | { | 296 | { |
297 | .phy_id = 0x01410cd0, | 297 | .phy_id = 0x01410cd0, |
@@ -304,8 +304,21 @@ static struct phy_driver marvell_drivers[] = { | |||
304 | .read_status = &genphy_read_status, | 304 | .read_status = &genphy_read_status, |
305 | .ack_interrupt = &marvell_ack_interrupt, | 305 | .ack_interrupt = &marvell_ack_interrupt, |
306 | .config_intr = &marvell_config_intr, | 306 | .config_intr = &marvell_config_intr, |
307 | .driver = {.owner = THIS_MODULE,}, | 307 | .driver = { .owner = THIS_MODULE }, |
308 | } | 308 | }, |
309 | { | ||
310 | .phy_id = 0x01410e30, | ||
311 | .phy_id_mask = 0xfffffff0, | ||
312 | .name = "Marvell 88E1240", | ||
313 | .features = PHY_GBIT_FEATURES, | ||
314 | .flags = PHY_HAS_INTERRUPT, | ||
315 | .config_init = &m88e1111_config_init, | ||
316 | .config_aneg = &marvell_config_aneg, | ||
317 | .read_status = &genphy_read_status, | ||
318 | .ack_interrupt = &marvell_ack_interrupt, | ||
319 | .config_intr = &marvell_config_intr, | ||
320 | .driver = { .owner = THIS_MODULE }, | ||
321 | }, | ||
309 | }; | 322 | }; |
310 | 323 | ||
311 | static int __init marvell_init(void) | 324 | static int __init marvell_init(void) |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index c0461217b108..f6e484812a98 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -706,7 +706,7 @@ int phy_driver_register(struct phy_driver *new_driver) | |||
706 | return retval; | 706 | return retval; |
707 | } | 707 | } |
708 | 708 | ||
709 | pr_info("%s: Registered new driver\n", new_driver->name); | 709 | pr_debug("%s: Registered new driver\n", new_driver->name); |
710 | 710 | ||
711 | return 0; | 711 | return 0; |
712 | } | 712 | } |
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/ppp_async.c b/drivers/net/ppp_async.c index 27f5b904f48e..f023d5b67e6e 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -160,7 +160,7 @@ ppp_asynctty_open(struct tty_struct *tty) | |||
160 | 160 | ||
161 | err = -ENOMEM; | 161 | err = -ENOMEM; |
162 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 162 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
163 | if (ap == 0) | 163 | if (!ap) |
164 | goto out; | 164 | goto out; |
165 | 165 | ||
166 | /* initialize the asyncppp structure */ | 166 | /* initialize the asyncppp structure */ |
@@ -215,7 +215,7 @@ ppp_asynctty_close(struct tty_struct *tty) | |||
215 | ap = tty->disc_data; | 215 | ap = tty->disc_data; |
216 | tty->disc_data = NULL; | 216 | tty->disc_data = NULL; |
217 | write_unlock_irq(&disc_data_lock); | 217 | write_unlock_irq(&disc_data_lock); |
218 | if (ap == 0) | 218 | if (!ap) |
219 | return; | 219 | return; |
220 | 220 | ||
221 | /* | 221 | /* |
@@ -230,10 +230,10 @@ ppp_asynctty_close(struct tty_struct *tty) | |||
230 | tasklet_kill(&ap->tsk); | 230 | tasklet_kill(&ap->tsk); |
231 | 231 | ||
232 | ppp_unregister_channel(&ap->chan); | 232 | ppp_unregister_channel(&ap->chan); |
233 | if (ap->rpkt != 0) | 233 | if (ap->rpkt) |
234 | kfree_skb(ap->rpkt); | 234 | kfree_skb(ap->rpkt); |
235 | skb_queue_purge(&ap->rqueue); | 235 | skb_queue_purge(&ap->rqueue); |
236 | if (ap->tpkt != 0) | 236 | if (ap->tpkt) |
237 | kfree_skb(ap->tpkt); | 237 | kfree_skb(ap->tpkt); |
238 | kfree(ap); | 238 | kfree(ap); |
239 | } | 239 | } |
@@ -285,13 +285,13 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, | |||
285 | int err, val; | 285 | int err, val; |
286 | int __user *p = (int __user *)arg; | 286 | int __user *p = (int __user *)arg; |
287 | 287 | ||
288 | if (ap == 0) | 288 | if (!ap) |
289 | return -ENXIO; | 289 | return -ENXIO; |
290 | err = -EFAULT; | 290 | err = -EFAULT; |
291 | switch (cmd) { | 291 | switch (cmd) { |
292 | case PPPIOCGCHAN: | 292 | case PPPIOCGCHAN: |
293 | err = -ENXIO; | 293 | err = -ENXIO; |
294 | if (ap == 0) | 294 | if (!ap) |
295 | break; | 295 | break; |
296 | err = -EFAULT; | 296 | err = -EFAULT; |
297 | if (put_user(ppp_channel_index(&ap->chan), p)) | 297 | if (put_user(ppp_channel_index(&ap->chan), p)) |
@@ -301,7 +301,7 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, | |||
301 | 301 | ||
302 | case PPPIOCGUNIT: | 302 | case PPPIOCGUNIT: |
303 | err = -ENXIO; | 303 | err = -ENXIO; |
304 | if (ap == 0) | 304 | if (!ap) |
305 | break; | 305 | break; |
306 | err = -EFAULT; | 306 | err = -EFAULT; |
307 | if (put_user(ppp_unit_number(&ap->chan), p)) | 307 | if (put_user(ppp_unit_number(&ap->chan), p)) |
@@ -309,16 +309,11 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, | |||
309 | err = 0; | 309 | err = 0; |
310 | break; | 310 | break; |
311 | 311 | ||
312 | case TCGETS: | ||
313 | case TCGETA: | ||
314 | err = n_tty_ioctl(tty, file, cmd, arg); | ||
315 | break; | ||
316 | |||
317 | case TCFLSH: | 312 | case TCFLSH: |
318 | /* flush our buffers and the serial port's buffer */ | 313 | /* flush our buffers and the serial port's buffer */ |
319 | if (arg == TCIOFLUSH || arg == TCOFLUSH) | 314 | if (arg == TCIOFLUSH || arg == TCOFLUSH) |
320 | ppp_async_flush_output(ap); | 315 | ppp_async_flush_output(ap); |
321 | err = n_tty_ioctl(tty, file, cmd, arg); | 316 | err = tty_perform_flush(tty, arg); |
322 | break; | 317 | break; |
323 | 318 | ||
324 | case FIONREAD: | 319 | case FIONREAD: |
@@ -329,7 +324,8 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, | |||
329 | break; | 324 | break; |
330 | 325 | ||
331 | default: | 326 | default: |
332 | err = -ENOIOCTLCMD; | 327 | /* Try the various mode ioctls */ |
328 | err = tty_mode_ioctl(tty, file, cmd, arg); | ||
333 | } | 329 | } |
334 | 330 | ||
335 | ap_put(ap); | 331 | ap_put(ap); |
@@ -354,7 +350,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
354 | struct asyncppp *ap = ap_get(tty); | 350 | struct asyncppp *ap = ap_get(tty); |
355 | unsigned long flags; | 351 | unsigned long flags; |
356 | 352 | ||
357 | if (ap == 0) | 353 | if (!ap) |
358 | return; | 354 | return; |
359 | spin_lock_irqsave(&ap->recv_lock, flags); | 355 | spin_lock_irqsave(&ap->recv_lock, flags); |
360 | ppp_async_input(ap, buf, cflags, count); | 356 | ppp_async_input(ap, buf, cflags, count); |
@@ -373,7 +369,7 @@ ppp_asynctty_wakeup(struct tty_struct *tty) | |||
373 | struct asyncppp *ap = ap_get(tty); | 369 | struct asyncppp *ap = ap_get(tty); |
374 | 370 | ||
375 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 371 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
376 | if (ap == 0) | 372 | if (!ap) |
377 | return; | 373 | return; |
378 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); | 374 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); |
379 | tasklet_schedule(&ap->tsk); | 375 | tasklet_schedule(&ap->tsk); |
@@ -688,7 +684,7 @@ ppp_async_push(struct asyncppp *ap) | |||
688 | tty_stuffed = 1; | 684 | tty_stuffed = 1; |
689 | continue; | 685 | continue; |
690 | } | 686 | } |
691 | if (ap->optr >= ap->olim && ap->tpkt != 0) { | 687 | if (ap->optr >= ap->olim && ap->tpkt) { |
692 | if (ppp_async_encode(ap)) { | 688 | if (ppp_async_encode(ap)) { |
693 | /* finished processing ap->tpkt */ | 689 | /* finished processing ap->tpkt */ |
694 | clear_bit(XMIT_FULL, &ap->xmit_flags); | 690 | clear_bit(XMIT_FULL, &ap->xmit_flags); |
@@ -708,7 +704,7 @@ ppp_async_push(struct asyncppp *ap) | |||
708 | clear_bit(XMIT_BUSY, &ap->xmit_flags); | 704 | clear_bit(XMIT_BUSY, &ap->xmit_flags); |
709 | /* any more work to do? if not, exit the loop */ | 705 | /* any more work to do? if not, exit the loop */ |
710 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) | 706 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) |
711 | || (!tty_stuffed && ap->tpkt != 0))) | 707 | || (!tty_stuffed && ap->tpkt))) |
712 | break; | 708 | break; |
713 | /* more work to do, see if we can do it now */ | 709 | /* more work to do, see if we can do it now */ |
714 | if (test_and_set_bit(XMIT_BUSY, &ap->xmit_flags)) | 710 | if (test_and_set_bit(XMIT_BUSY, &ap->xmit_flags)) |
@@ -719,7 +715,7 @@ ppp_async_push(struct asyncppp *ap) | |||
719 | 715 | ||
720 | flush: | 716 | flush: |
721 | clear_bit(XMIT_BUSY, &ap->xmit_flags); | 717 | clear_bit(XMIT_BUSY, &ap->xmit_flags); |
722 | if (ap->tpkt != 0) { | 718 | if (ap->tpkt) { |
723 | kfree_skb(ap->tpkt); | 719 | kfree_skb(ap->tpkt); |
724 | ap->tpkt = NULL; | 720 | ap->tpkt = NULL; |
725 | clear_bit(XMIT_FULL, &ap->xmit_flags); | 721 | clear_bit(XMIT_FULL, &ap->xmit_flags); |
@@ -852,7 +848,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
852 | s = 0; | 848 | s = 0; |
853 | for (i = 0; i < count; ++i) { | 849 | for (i = 0; i < count; ++i) { |
854 | c = buf[i]; | 850 | c = buf[i]; |
855 | if (flags != 0 && flags[i] != 0) | 851 | if (flags && flags[i] != 0) |
856 | continue; | 852 | continue; |
857 | s |= (c & 0x80)? SC_RCV_B7_1: SC_RCV_B7_0; | 853 | s |= (c & 0x80)? SC_RCV_B7_1: SC_RCV_B7_0; |
858 | c = ((c >> 4) ^ c) & 0xf; | 854 | c = ((c >> 4) ^ c) & 0xf; |
@@ -869,7 +865,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
869 | n = scan_ordinary(ap, buf, count); | 865 | n = scan_ordinary(ap, buf, count); |
870 | 866 | ||
871 | f = 0; | 867 | f = 0; |
872 | if (flags != 0 && (ap->state & SC_TOSS) == 0) { | 868 | if (flags && (ap->state & SC_TOSS) == 0) { |
873 | /* check the flags to see if any char had an error */ | 869 | /* check the flags to see if any char had an error */ |
874 | for (j = 0; j < n; ++j) | 870 | for (j = 0; j < n; ++j) |
875 | if ((f = flags[j]) != 0) | 871 | if ((f = flags[j]) != 0) |
@@ -882,9 +878,9 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
882 | } else if (n > 0 && (ap->state & SC_TOSS) == 0) { | 878 | } else if (n > 0 && (ap->state & SC_TOSS) == 0) { |
883 | /* stuff the chars in the skb */ | 879 | /* stuff the chars in the skb */ |
884 | skb = ap->rpkt; | 880 | skb = ap->rpkt; |
885 | if (skb == 0) { | 881 | if (!skb) { |
886 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); | 882 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); |
887 | if (skb == 0) | 883 | if (!skb) |
888 | goto nomem; | 884 | goto nomem; |
889 | ap->rpkt = skb; | 885 | ap->rpkt = skb; |
890 | } | 886 | } |
@@ -931,7 +927,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
931 | ++n; | 927 | ++n; |
932 | 928 | ||
933 | buf += n; | 929 | buf += n; |
934 | if (flags != 0) | 930 | if (flags) |
935 | flags += n; | 931 | flags += n; |
936 | count -= n; | 932 | count -= n; |
937 | } | 933 | } |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 4b49d0e8c7eb..4f690378bb77 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -367,7 +367,7 @@ static int ppp_release(struct inode *inode, struct file *file) | |||
367 | struct ppp_file *pf = file->private_data; | 367 | struct ppp_file *pf = file->private_data; |
368 | struct ppp *ppp; | 368 | struct ppp *ppp; |
369 | 369 | ||
370 | if (pf != 0) { | 370 | if (pf) { |
371 | file->private_data = NULL; | 371 | file->private_data = NULL; |
372 | if (pf->kind == INTERFACE) { | 372 | if (pf->kind == INTERFACE) { |
373 | ppp = PF_TO_PPP(pf); | 373 | ppp = PF_TO_PPP(pf); |
@@ -398,7 +398,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf, | |||
398 | 398 | ||
399 | ret = count; | 399 | ret = count; |
400 | 400 | ||
401 | if (pf == 0) | 401 | if (!pf) |
402 | return -ENXIO; | 402 | return -ENXIO; |
403 | add_wait_queue(&pf->rwait, &wait); | 403 | add_wait_queue(&pf->rwait, &wait); |
404 | for (;;) { | 404 | for (;;) { |
@@ -431,7 +431,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf, | |||
431 | set_current_state(TASK_RUNNING); | 431 | set_current_state(TASK_RUNNING); |
432 | remove_wait_queue(&pf->rwait, &wait); | 432 | remove_wait_queue(&pf->rwait, &wait); |
433 | 433 | ||
434 | if (skb == 0) | 434 | if (!skb) |
435 | goto out; | 435 | goto out; |
436 | 436 | ||
437 | ret = -EOVERFLOW; | 437 | ret = -EOVERFLOW; |
@@ -455,11 +455,11 @@ static ssize_t ppp_write(struct file *file, const char __user *buf, | |||
455 | struct sk_buff *skb; | 455 | struct sk_buff *skb; |
456 | ssize_t ret; | 456 | ssize_t ret; |
457 | 457 | ||
458 | if (pf == 0) | 458 | if (!pf) |
459 | return -ENXIO; | 459 | return -ENXIO; |
460 | ret = -ENOMEM; | 460 | ret = -ENOMEM; |
461 | skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); | 461 | skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); |
462 | if (skb == 0) | 462 | if (!skb) |
463 | goto out; | 463 | goto out; |
464 | skb_reserve(skb, pf->hdrlen); | 464 | skb_reserve(skb, pf->hdrlen); |
465 | ret = -EFAULT; | 465 | ret = -EFAULT; |
@@ -491,11 +491,11 @@ static unsigned int ppp_poll(struct file *file, poll_table *wait) | |||
491 | struct ppp_file *pf = file->private_data; | 491 | struct ppp_file *pf = file->private_data; |
492 | unsigned int mask; | 492 | unsigned int mask; |
493 | 493 | ||
494 | if (pf == 0) | 494 | if (!pf) |
495 | return 0; | 495 | return 0; |
496 | poll_wait(file, &pf->rwait, wait); | 496 | poll_wait(file, &pf->rwait, wait); |
497 | mask = POLLOUT | POLLWRNORM; | 497 | mask = POLLOUT | POLLWRNORM; |
498 | if (skb_peek(&pf->rq) != 0) | 498 | if (skb_peek(&pf->rq)) |
499 | mask |= POLLIN | POLLRDNORM; | 499 | mask |= POLLIN | POLLRDNORM; |
500 | if (pf->dead) | 500 | if (pf->dead) |
501 | mask |= POLLHUP; | 501 | mask |= POLLHUP; |
@@ -559,7 +559,7 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
559 | void __user *argp = (void __user *)arg; | 559 | void __user *argp = (void __user *)arg; |
560 | int __user *p = argp; | 560 | int __user *p = argp; |
561 | 561 | ||
562 | if (pf == 0) | 562 | if (!pf) |
563 | return ppp_unattached_ioctl(pf, file, cmd, arg); | 563 | return ppp_unattached_ioctl(pf, file, cmd, arg); |
564 | 564 | ||
565 | if (cmd == PPPIOCDETACH) { | 565 | if (cmd == PPPIOCDETACH) { |
@@ -689,13 +689,13 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
689 | val &= 0xffff; | 689 | val &= 0xffff; |
690 | } | 690 | } |
691 | vj = slhc_init(val2+1, val+1); | 691 | vj = slhc_init(val2+1, val+1); |
692 | if (vj == 0) { | 692 | if (!vj) { |
693 | printk(KERN_ERR "PPP: no memory (VJ compressor)\n"); | 693 | printk(KERN_ERR "PPP: no memory (VJ compressor)\n"); |
694 | err = -ENOMEM; | 694 | err = -ENOMEM; |
695 | break; | 695 | break; |
696 | } | 696 | } |
697 | ppp_lock(ppp); | 697 | ppp_lock(ppp); |
698 | if (ppp->vj != 0) | 698 | if (ppp->vj) |
699 | slhc_free(ppp->vj); | 699 | slhc_free(ppp->vj); |
700 | ppp->vj = vj; | 700 | ppp->vj = vj; |
701 | ppp_unlock(ppp); | 701 | ppp_unlock(ppp); |
@@ -786,7 +786,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file, | |||
786 | if (get_user(unit, p)) | 786 | if (get_user(unit, p)) |
787 | break; | 787 | break; |
788 | ppp = ppp_create_interface(unit, &err); | 788 | ppp = ppp_create_interface(unit, &err); |
789 | if (ppp == 0) | 789 | if (!ppp) |
790 | break; | 790 | break; |
791 | file->private_data = &ppp->file; | 791 | file->private_data = &ppp->file; |
792 | ppp->owner = file; | 792 | ppp->owner = file; |
@@ -803,7 +803,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file, | |||
803 | mutex_lock(&all_ppp_mutex); | 803 | mutex_lock(&all_ppp_mutex); |
804 | err = -ENXIO; | 804 | err = -ENXIO; |
805 | ppp = ppp_find_unit(unit); | 805 | ppp = ppp_find_unit(unit); |
806 | if (ppp != 0) { | 806 | if (ppp) { |
807 | atomic_inc(&ppp->file.refcnt); | 807 | atomic_inc(&ppp->file.refcnt); |
808 | file->private_data = &ppp->file; | 808 | file->private_data = &ppp->file; |
809 | err = 0; | 809 | err = 0; |
@@ -817,7 +817,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file, | |||
817 | spin_lock_bh(&all_channels_lock); | 817 | spin_lock_bh(&all_channels_lock); |
818 | err = -ENXIO; | 818 | err = -ENXIO; |
819 | chan = ppp_find_channel(unit); | 819 | chan = ppp_find_channel(unit); |
820 | if (chan != 0) { | 820 | if (chan) { |
821 | atomic_inc(&chan->file.refcnt); | 821 | atomic_inc(&chan->file.refcnt); |
822 | file->private_data = &chan->file; | 822 | file->private_data = &chan->file; |
823 | err = 0; | 823 | err = 0; |
@@ -946,9 +946,9 @@ ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
946 | 946 | ||
947 | case SIOCGPPPCSTATS: | 947 | case SIOCGPPPCSTATS: |
948 | memset(&cstats, 0, sizeof(cstats)); | 948 | memset(&cstats, 0, sizeof(cstats)); |
949 | if (ppp->xc_state != 0) | 949 | if (ppp->xc_state) |
950 | ppp->xcomp->comp_stat(ppp->xc_state, &cstats.c); | 950 | ppp->xcomp->comp_stat(ppp->xc_state, &cstats.c); |
951 | if (ppp->rc_state != 0) | 951 | if (ppp->rc_state) |
952 | ppp->rcomp->decomp_stat(ppp->rc_state, &cstats.d); | 952 | ppp->rcomp->decomp_stat(ppp->rc_state, &cstats.d); |
953 | if (copy_to_user(addr, &cstats, sizeof(cstats))) | 953 | if (copy_to_user(addr, &cstats, sizeof(cstats))) |
954 | break; | 954 | break; |
@@ -993,14 +993,14 @@ ppp_xmit_process(struct ppp *ppp) | |||
993 | struct sk_buff *skb; | 993 | struct sk_buff *skb; |
994 | 994 | ||
995 | ppp_xmit_lock(ppp); | 995 | ppp_xmit_lock(ppp); |
996 | if (ppp->dev != 0) { | 996 | if (ppp->dev) { |
997 | ppp_push(ppp); | 997 | ppp_push(ppp); |
998 | while (ppp->xmit_pending == 0 | 998 | while (!ppp->xmit_pending |
999 | && (skb = skb_dequeue(&ppp->file.xq)) != 0) | 999 | && (skb = skb_dequeue(&ppp->file.xq))) |
1000 | ppp_send_frame(ppp, skb); | 1000 | ppp_send_frame(ppp, skb); |
1001 | /* If there's no work left to do, tell the core net | 1001 | /* If there's no work left to do, tell the core net |
1002 | code that we can accept some more. */ | 1002 | code that we can accept some more. */ |
1003 | if (ppp->xmit_pending == 0 && skb_peek(&ppp->file.xq) == 0) | 1003 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) |
1004 | netif_wake_queue(ppp->dev); | 1004 | netif_wake_queue(ppp->dev); |
1005 | } | 1005 | } |
1006 | ppp_xmit_unlock(ppp); | 1006 | ppp_xmit_unlock(ppp); |
@@ -1100,12 +1100,12 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1100 | 1100 | ||
1101 | switch (proto) { | 1101 | switch (proto) { |
1102 | case PPP_IP: | 1102 | case PPP_IP: |
1103 | if (ppp->vj == 0 || (ppp->flags & SC_COMP_TCP) == 0) | 1103 | if (!ppp->vj || (ppp->flags & SC_COMP_TCP) == 0) |
1104 | break; | 1104 | break; |
1105 | /* try to do VJ TCP header compression */ | 1105 | /* try to do VJ TCP header compression */ |
1106 | new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2, | 1106 | new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2, |
1107 | GFP_ATOMIC); | 1107 | GFP_ATOMIC); |
1108 | if (new_skb == 0) { | 1108 | if (!new_skb) { |
1109 | printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n"); | 1109 | printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n"); |
1110 | goto drop; | 1110 | goto drop; |
1111 | } | 1111 | } |
@@ -1140,7 +1140,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | /* try to do packet compression */ | 1142 | /* try to do packet compression */ |
1143 | if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0 | 1143 | if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state |
1144 | && proto != PPP_LCP && proto != PPP_CCP) { | 1144 | && proto != PPP_LCP && proto != PPP_CCP) { |
1145 | if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { | 1145 | if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { |
1146 | if (net_ratelimit()) | 1146 | if (net_ratelimit()) |
@@ -1185,7 +1185,7 @@ ppp_push(struct ppp *ppp) | |||
1185 | struct channel *pch; | 1185 | struct channel *pch; |
1186 | struct sk_buff *skb = ppp->xmit_pending; | 1186 | struct sk_buff *skb = ppp->xmit_pending; |
1187 | 1187 | ||
1188 | if (skb == 0) | 1188 | if (!skb) |
1189 | return; | 1189 | return; |
1190 | 1190 | ||
1191 | list = &ppp->channels; | 1191 | list = &ppp->channels; |
@@ -1355,7 +1355,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1355 | if (flen == len && nfree == 0) | 1355 | if (flen == len && nfree == 0) |
1356 | bits |= E; | 1356 | bits |= E; |
1357 | frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC); | 1357 | frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC); |
1358 | if (frag == 0) | 1358 | if (!frag) |
1359 | goto noskb; | 1359 | goto noskb; |
1360 | q = skb_put(frag, flen + hdrlen); | 1360 | q = skb_put(frag, flen + hdrlen); |
1361 | 1361 | ||
@@ -1425,7 +1425,7 @@ ppp_channel_push(struct channel *pch) | |||
1425 | struct ppp *ppp; | 1425 | struct ppp *ppp; |
1426 | 1426 | ||
1427 | spin_lock_bh(&pch->downl); | 1427 | spin_lock_bh(&pch->downl); |
1428 | if (pch->chan != 0) { | 1428 | if (pch->chan) { |
1429 | while (!skb_queue_empty(&pch->file.xq)) { | 1429 | while (!skb_queue_empty(&pch->file.xq)) { |
1430 | skb = skb_dequeue(&pch->file.xq); | 1430 | skb = skb_dequeue(&pch->file.xq); |
1431 | if (!pch->chan->ops->start_xmit(pch->chan, skb)) { | 1431 | if (!pch->chan->ops->start_xmit(pch->chan, skb)) { |
@@ -1443,7 +1443,7 @@ ppp_channel_push(struct channel *pch) | |||
1443 | if (skb_queue_empty(&pch->file.xq)) { | 1443 | if (skb_queue_empty(&pch->file.xq)) { |
1444 | read_lock_bh(&pch->upl); | 1444 | read_lock_bh(&pch->upl); |
1445 | ppp = pch->ppp; | 1445 | ppp = pch->ppp; |
1446 | if (ppp != 0) | 1446 | if (ppp) |
1447 | ppp_xmit_process(ppp); | 1447 | ppp_xmit_process(ppp); |
1448 | read_unlock_bh(&pch->upl); | 1448 | read_unlock_bh(&pch->upl); |
1449 | } | 1449 | } |
@@ -1462,7 +1462,7 @@ ppp_do_recv(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | |||
1462 | { | 1462 | { |
1463 | ppp_recv_lock(ppp); | 1463 | ppp_recv_lock(ppp); |
1464 | /* ppp->dev == 0 means interface is closing down */ | 1464 | /* ppp->dev == 0 means interface is closing down */ |
1465 | if (ppp->dev != 0) | 1465 | if (ppp->dev) |
1466 | ppp_receive_frame(ppp, skb, pch); | 1466 | ppp_receive_frame(ppp, skb, pch); |
1467 | else | 1467 | else |
1468 | kfree_skb(skb); | 1468 | kfree_skb(skb); |
@@ -1475,19 +1475,19 @@ ppp_input(struct ppp_channel *chan, struct sk_buff *skb) | |||
1475 | struct channel *pch = chan->ppp; | 1475 | struct channel *pch = chan->ppp; |
1476 | int proto; | 1476 | int proto; |
1477 | 1477 | ||
1478 | if (pch == 0 || skb->len == 0) { | 1478 | if (!pch || skb->len == 0) { |
1479 | kfree_skb(skb); | 1479 | kfree_skb(skb); |
1480 | return; | 1480 | return; |
1481 | } | 1481 | } |
1482 | 1482 | ||
1483 | proto = PPP_PROTO(skb); | 1483 | proto = PPP_PROTO(skb); |
1484 | read_lock_bh(&pch->upl); | 1484 | read_lock_bh(&pch->upl); |
1485 | if (pch->ppp == 0 || proto >= 0xc000 || proto == PPP_CCPFRAG) { | 1485 | if (!pch->ppp || proto >= 0xc000 || proto == PPP_CCPFRAG) { |
1486 | /* put it on the channel queue */ | 1486 | /* put it on the channel queue */ |
1487 | skb_queue_tail(&pch->file.rq, skb); | 1487 | skb_queue_tail(&pch->file.rq, skb); |
1488 | /* drop old frames if queue too long */ | 1488 | /* drop old frames if queue too long */ |
1489 | while (pch->file.rq.qlen > PPP_MAX_RQLEN | 1489 | while (pch->file.rq.qlen > PPP_MAX_RQLEN |
1490 | && (skb = skb_dequeue(&pch->file.rq)) != 0) | 1490 | && (skb = skb_dequeue(&pch->file.rq))) |
1491 | kfree_skb(skb); | 1491 | kfree_skb(skb); |
1492 | wake_up_interruptible(&pch->file.rwait); | 1492 | wake_up_interruptible(&pch->file.rwait); |
1493 | } else { | 1493 | } else { |
@@ -1503,13 +1503,13 @@ ppp_input_error(struct ppp_channel *chan, int code) | |||
1503 | struct channel *pch = chan->ppp; | 1503 | struct channel *pch = chan->ppp; |
1504 | struct sk_buff *skb; | 1504 | struct sk_buff *skb; |
1505 | 1505 | ||
1506 | if (pch == 0) | 1506 | if (!pch) |
1507 | return; | 1507 | return; |
1508 | 1508 | ||
1509 | read_lock_bh(&pch->upl); | 1509 | read_lock_bh(&pch->upl); |
1510 | if (pch->ppp != 0) { | 1510 | if (pch->ppp) { |
1511 | skb = alloc_skb(0, GFP_ATOMIC); | 1511 | skb = alloc_skb(0, GFP_ATOMIC); |
1512 | if (skb != 0) { | 1512 | if (skb) { |
1513 | skb->len = 0; /* probably unnecessary */ | 1513 | skb->len = 0; /* probably unnecessary */ |
1514 | skb->cb[0] = code; | 1514 | skb->cb[0] = code; |
1515 | ppp_do_recv(pch->ppp, skb, pch); | 1515 | ppp_do_recv(pch->ppp, skb, pch); |
@@ -1548,7 +1548,7 @@ static void | |||
1548 | ppp_receive_error(struct ppp *ppp) | 1548 | ppp_receive_error(struct ppp *ppp) |
1549 | { | 1549 | { |
1550 | ++ppp->stats.rx_errors; | 1550 | ++ppp->stats.rx_errors; |
1551 | if (ppp->vj != 0) | 1551 | if (ppp->vj) |
1552 | slhc_toss(ppp->vj); | 1552 | slhc_toss(ppp->vj); |
1553 | } | 1553 | } |
1554 | 1554 | ||
@@ -1563,7 +1563,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1563 | * Note that some decompressors need to see uncompressed frames | 1563 | * Note that some decompressors need to see uncompressed frames |
1564 | * that come in as well as compressed frames. | 1564 | * that come in as well as compressed frames. |
1565 | */ | 1565 | */ |
1566 | if (ppp->rc_state != 0 && (ppp->rstate & SC_DECOMP_RUN) | 1566 | if (ppp->rc_state && (ppp->rstate & SC_DECOMP_RUN) |
1567 | && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) | 1567 | && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) |
1568 | skb = ppp_decompress_frame(ppp, skb); | 1568 | skb = ppp_decompress_frame(ppp, skb); |
1569 | 1569 | ||
@@ -1574,13 +1574,13 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1574 | switch (proto) { | 1574 | switch (proto) { |
1575 | case PPP_VJC_COMP: | 1575 | case PPP_VJC_COMP: |
1576 | /* decompress VJ compressed packets */ | 1576 | /* decompress VJ compressed packets */ |
1577 | if (ppp->vj == 0 || (ppp->flags & SC_REJ_COMP_TCP)) | 1577 | if (!ppp->vj || (ppp->flags & SC_REJ_COMP_TCP)) |
1578 | goto err; | 1578 | goto err; |
1579 | 1579 | ||
1580 | if (skb_tailroom(skb) < 124 || skb_cloned(skb)) { | 1580 | if (skb_tailroom(skb) < 124 || skb_cloned(skb)) { |
1581 | /* copy to a new sk_buff with more tailroom */ | 1581 | /* copy to a new sk_buff with more tailroom */ |
1582 | ns = dev_alloc_skb(skb->len + 128); | 1582 | ns = dev_alloc_skb(skb->len + 128); |
1583 | if (ns == 0) { | 1583 | if (!ns) { |
1584 | printk(KERN_ERR"PPP: no memory (VJ decomp)\n"); | 1584 | printk(KERN_ERR"PPP: no memory (VJ decomp)\n"); |
1585 | goto err; | 1585 | goto err; |
1586 | } | 1586 | } |
@@ -1606,7 +1606,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1606 | break; | 1606 | break; |
1607 | 1607 | ||
1608 | case PPP_VJC_UNCOMP: | 1608 | case PPP_VJC_UNCOMP: |
1609 | if (ppp->vj == 0 || (ppp->flags & SC_REJ_COMP_TCP)) | 1609 | if (!ppp->vj || (ppp->flags & SC_REJ_COMP_TCP)) |
1610 | goto err; | 1610 | goto err; |
1611 | 1611 | ||
1612 | /* Until we fix the decompressor need to make sure | 1612 | /* Until we fix the decompressor need to make sure |
@@ -1636,7 +1636,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1636 | skb_queue_tail(&ppp->file.rq, skb); | 1636 | skb_queue_tail(&ppp->file.rq, skb); |
1637 | /* limit queue length by dropping old frames */ | 1637 | /* limit queue length by dropping old frames */ |
1638 | while (ppp->file.rq.qlen > PPP_MAX_RQLEN | 1638 | while (ppp->file.rq.qlen > PPP_MAX_RQLEN |
1639 | && (skb = skb_dequeue(&ppp->file.rq)) != 0) | 1639 | && (skb = skb_dequeue(&ppp->file.rq))) |
1640 | kfree_skb(skb); | 1640 | kfree_skb(skb); |
1641 | /* wake up any process polling or blocking on read */ | 1641 | /* wake up any process polling or blocking on read */ |
1642 | wake_up_interruptible(&ppp->file.rwait); | 1642 | wake_up_interruptible(&ppp->file.rwait); |
@@ -1718,7 +1718,7 @@ ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1718 | } | 1718 | } |
1719 | 1719 | ||
1720 | ns = dev_alloc_skb(obuff_size); | 1720 | ns = dev_alloc_skb(obuff_size); |
1721 | if (ns == 0) { | 1721 | if (!ns) { |
1722 | printk(KERN_ERR "ppp_decompress_frame: no memory\n"); | 1722 | printk(KERN_ERR "ppp_decompress_frame: no memory\n"); |
1723 | goto err; | 1723 | goto err; |
1724 | } | 1724 | } |
@@ -1836,7 +1836,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | |||
1836 | ppp->minseq = ppp->mrq.next->sequence; | 1836 | ppp->minseq = ppp->mrq.next->sequence; |
1837 | 1837 | ||
1838 | /* Pull completed packets off the queue and receive them. */ | 1838 | /* Pull completed packets off the queue and receive them. */ |
1839 | while ((skb = ppp_mp_reconstruct(ppp)) != 0) | 1839 | while ((skb = ppp_mp_reconstruct(ppp))) |
1840 | ppp_receive_nonmp_frame(ppp, skb); | 1840 | ppp_receive_nonmp_frame(ppp, skb); |
1841 | 1841 | ||
1842 | return; | 1842 | return; |
@@ -2002,7 +2002,7 @@ ppp_register_channel(struct ppp_channel *chan) | |||
2002 | struct channel *pch; | 2002 | struct channel *pch; |
2003 | 2003 | ||
2004 | pch = kzalloc(sizeof(struct channel), GFP_KERNEL); | 2004 | pch = kzalloc(sizeof(struct channel), GFP_KERNEL); |
2005 | if (pch == 0) | 2005 | if (!pch) |
2006 | return -ENOMEM; | 2006 | return -ENOMEM; |
2007 | pch->ppp = NULL; | 2007 | pch->ppp = NULL; |
2008 | pch->chan = chan; | 2008 | pch->chan = chan; |
@@ -2030,7 +2030,7 @@ int ppp_channel_index(struct ppp_channel *chan) | |||
2030 | { | 2030 | { |
2031 | struct channel *pch = chan->ppp; | 2031 | struct channel *pch = chan->ppp; |
2032 | 2032 | ||
2033 | if (pch != 0) | 2033 | if (pch) |
2034 | return pch->file.index; | 2034 | return pch->file.index; |
2035 | return -1; | 2035 | return -1; |
2036 | } | 2036 | } |
@@ -2043,9 +2043,9 @@ int ppp_unit_number(struct ppp_channel *chan) | |||
2043 | struct channel *pch = chan->ppp; | 2043 | struct channel *pch = chan->ppp; |
2044 | int unit = -1; | 2044 | int unit = -1; |
2045 | 2045 | ||
2046 | if (pch != 0) { | 2046 | if (pch) { |
2047 | read_lock_bh(&pch->upl); | 2047 | read_lock_bh(&pch->upl); |
2048 | if (pch->ppp != 0) | 2048 | if (pch->ppp) |
2049 | unit = pch->ppp->file.index; | 2049 | unit = pch->ppp->file.index; |
2050 | read_unlock_bh(&pch->upl); | 2050 | read_unlock_bh(&pch->upl); |
2051 | } | 2051 | } |
@@ -2061,7 +2061,7 @@ ppp_unregister_channel(struct ppp_channel *chan) | |||
2061 | { | 2061 | { |
2062 | struct channel *pch = chan->ppp; | 2062 | struct channel *pch = chan->ppp; |
2063 | 2063 | ||
2064 | if (pch == 0) | 2064 | if (!pch) |
2065 | return; /* should never happen */ | 2065 | return; /* should never happen */ |
2066 | chan->ppp = NULL; | 2066 | chan->ppp = NULL; |
2067 | 2067 | ||
@@ -2093,7 +2093,7 @@ ppp_output_wakeup(struct ppp_channel *chan) | |||
2093 | { | 2093 | { |
2094 | struct channel *pch = chan->ppp; | 2094 | struct channel *pch = chan->ppp; |
2095 | 2095 | ||
2096 | if (pch == 0) | 2096 | if (!pch) |
2097 | return; | 2097 | return; |
2098 | ppp_channel_push(pch); | 2098 | ppp_channel_push(pch); |
2099 | } | 2099 | } |
@@ -2124,18 +2124,18 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) | |||
2124 | 2124 | ||
2125 | cp = find_compressor(ccp_option[0]); | 2125 | cp = find_compressor(ccp_option[0]); |
2126 | #ifdef CONFIG_KMOD | 2126 | #ifdef CONFIG_KMOD |
2127 | if (cp == 0) { | 2127 | if (!cp) { |
2128 | request_module("ppp-compress-%d", ccp_option[0]); | 2128 | request_module("ppp-compress-%d", ccp_option[0]); |
2129 | cp = find_compressor(ccp_option[0]); | 2129 | cp = find_compressor(ccp_option[0]); |
2130 | } | 2130 | } |
2131 | #endif /* CONFIG_KMOD */ | 2131 | #endif /* CONFIG_KMOD */ |
2132 | if (cp == 0) | 2132 | if (!cp) |
2133 | goto out; | 2133 | goto out; |
2134 | 2134 | ||
2135 | err = -ENOBUFS; | 2135 | err = -ENOBUFS; |
2136 | if (data.transmit) { | 2136 | if (data.transmit) { |
2137 | state = cp->comp_alloc(ccp_option, data.length); | 2137 | state = cp->comp_alloc(ccp_option, data.length); |
2138 | if (state != 0) { | 2138 | if (state) { |
2139 | ppp_xmit_lock(ppp); | 2139 | ppp_xmit_lock(ppp); |
2140 | ppp->xstate &= ~SC_COMP_RUN; | 2140 | ppp->xstate &= ~SC_COMP_RUN; |
2141 | ocomp = ppp->xcomp; | 2141 | ocomp = ppp->xcomp; |
@@ -2143,7 +2143,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) | |||
2143 | ppp->xcomp = cp; | 2143 | ppp->xcomp = cp; |
2144 | ppp->xc_state = state; | 2144 | ppp->xc_state = state; |
2145 | ppp_xmit_unlock(ppp); | 2145 | ppp_xmit_unlock(ppp); |
2146 | if (ostate != 0) { | 2146 | if (ostate) { |
2147 | ocomp->comp_free(ostate); | 2147 | ocomp->comp_free(ostate); |
2148 | module_put(ocomp->owner); | 2148 | module_put(ocomp->owner); |
2149 | } | 2149 | } |
@@ -2153,7 +2153,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) | |||
2153 | 2153 | ||
2154 | } else { | 2154 | } else { |
2155 | state = cp->decomp_alloc(ccp_option, data.length); | 2155 | state = cp->decomp_alloc(ccp_option, data.length); |
2156 | if (state != 0) { | 2156 | if (state) { |
2157 | ppp_recv_lock(ppp); | 2157 | ppp_recv_lock(ppp); |
2158 | ppp->rstate &= ~SC_DECOMP_RUN; | 2158 | ppp->rstate &= ~SC_DECOMP_RUN; |
2159 | ocomp = ppp->rcomp; | 2159 | ocomp = ppp->rcomp; |
@@ -2161,7 +2161,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) | |||
2161 | ppp->rcomp = cp; | 2161 | ppp->rcomp = cp; |
2162 | ppp->rc_state = state; | 2162 | ppp->rc_state = state; |
2163 | ppp_recv_unlock(ppp); | 2163 | ppp_recv_unlock(ppp); |
2164 | if (ostate != 0) { | 2164 | if (ostate) { |
2165 | ocomp->decomp_free(ostate); | 2165 | ocomp->decomp_free(ostate); |
2166 | module_put(ocomp->owner); | 2166 | module_put(ocomp->owner); |
2167 | } | 2167 | } |
@@ -2228,7 +2228,7 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound) | |||
2228 | break; | 2228 | break; |
2229 | if (inbound) { | 2229 | if (inbound) { |
2230 | /* we will start receiving compressed packets */ | 2230 | /* we will start receiving compressed packets */ |
2231 | if (ppp->rc_state == 0) | 2231 | if (!ppp->rc_state) |
2232 | break; | 2232 | break; |
2233 | if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len, | 2233 | if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len, |
2234 | ppp->file.index, 0, ppp->mru, ppp->debug)) { | 2234 | ppp->file.index, 0, ppp->mru, ppp->debug)) { |
@@ -2237,7 +2237,7 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound) | |||
2237 | } | 2237 | } |
2238 | } else { | 2238 | } else { |
2239 | /* we will soon start sending compressed packets */ | 2239 | /* we will soon start sending compressed packets */ |
2240 | if (ppp->xc_state == 0) | 2240 | if (!ppp->xc_state) |
2241 | break; | 2241 | break; |
2242 | if (ppp->xcomp->comp_init(ppp->xc_state, dp, len, | 2242 | if (ppp->xcomp->comp_init(ppp->xc_state, dp, len, |
2243 | ppp->file.index, 0, ppp->debug)) | 2243 | ppp->file.index, 0, ppp->debug)) |
@@ -2320,11 +2320,11 @@ ppp_register_compressor(struct compressor *cp) | |||
2320 | int ret; | 2320 | int ret; |
2321 | spin_lock(&compressor_list_lock); | 2321 | spin_lock(&compressor_list_lock); |
2322 | ret = -EEXIST; | 2322 | ret = -EEXIST; |
2323 | if (find_comp_entry(cp->compress_proto) != 0) | 2323 | if (find_comp_entry(cp->compress_proto)) |
2324 | goto out; | 2324 | goto out; |
2325 | ret = -ENOMEM; | 2325 | ret = -ENOMEM; |
2326 | ce = kmalloc(sizeof(struct compressor_entry), GFP_ATOMIC); | 2326 | ce = kmalloc(sizeof(struct compressor_entry), GFP_ATOMIC); |
2327 | if (ce == 0) | 2327 | if (!ce) |
2328 | goto out; | 2328 | goto out; |
2329 | ret = 0; | 2329 | ret = 0; |
2330 | ce->comp = cp; | 2330 | ce->comp = cp; |
@@ -2342,7 +2342,7 @@ ppp_unregister_compressor(struct compressor *cp) | |||
2342 | 2342 | ||
2343 | spin_lock(&compressor_list_lock); | 2343 | spin_lock(&compressor_list_lock); |
2344 | ce = find_comp_entry(cp->compress_proto); | 2344 | ce = find_comp_entry(cp->compress_proto); |
2345 | if (ce != 0 && ce->comp == cp) { | 2345 | if (ce && ce->comp == cp) { |
2346 | list_del(&ce->list); | 2346 | list_del(&ce->list); |
2347 | kfree(ce); | 2347 | kfree(ce); |
2348 | } | 2348 | } |
@@ -2358,7 +2358,7 @@ find_compressor(int type) | |||
2358 | 2358 | ||
2359 | spin_lock(&compressor_list_lock); | 2359 | spin_lock(&compressor_list_lock); |
2360 | ce = find_comp_entry(type); | 2360 | ce = find_comp_entry(type); |
2361 | if (ce != 0) { | 2361 | if (ce) { |
2362 | cp = ce->comp; | 2362 | cp = ce->comp; |
2363 | if (!try_module_get(cp->owner)) | 2363 | if (!try_module_get(cp->owner)) |
2364 | cp = NULL; | 2364 | cp = NULL; |
@@ -2383,7 +2383,7 @@ ppp_get_stats(struct ppp *ppp, struct ppp_stats *st) | |||
2383 | st->p.ppp_opackets = ppp->stats.tx_packets; | 2383 | st->p.ppp_opackets = ppp->stats.tx_packets; |
2384 | st->p.ppp_oerrors = ppp->stats.tx_errors; | 2384 | st->p.ppp_oerrors = ppp->stats.tx_errors; |
2385 | st->p.ppp_obytes = ppp->stats.tx_bytes; | 2385 | st->p.ppp_obytes = ppp->stats.tx_bytes; |
2386 | if (vj == 0) | 2386 | if (!vj) |
2387 | return; | 2387 | return; |
2388 | st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed; | 2388 | st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed; |
2389 | st->vj.vjs_compressed = vj->sls_o_compressed; | 2389 | st->vj.vjs_compressed = vj->sls_o_compressed; |
@@ -2604,11 +2604,11 @@ ppp_connect_channel(struct channel *pch, int unit) | |||
2604 | 2604 | ||
2605 | mutex_lock(&all_ppp_mutex); | 2605 | mutex_lock(&all_ppp_mutex); |
2606 | ppp = ppp_find_unit(unit); | 2606 | ppp = ppp_find_unit(unit); |
2607 | if (ppp == 0) | 2607 | if (!ppp) |
2608 | goto out; | 2608 | goto out; |
2609 | write_lock_bh(&pch->upl); | 2609 | write_lock_bh(&pch->upl); |
2610 | ret = -EINVAL; | 2610 | ret = -EINVAL; |
2611 | if (pch->ppp != 0) | 2611 | if (pch->ppp) |
2612 | goto outl; | 2612 | goto outl; |
2613 | 2613 | ||
2614 | ppp_lock(ppp); | 2614 | ppp_lock(ppp); |
@@ -2644,7 +2644,7 @@ ppp_disconnect_channel(struct channel *pch) | |||
2644 | ppp = pch->ppp; | 2644 | ppp = pch->ppp; |
2645 | pch->ppp = NULL; | 2645 | pch->ppp = NULL; |
2646 | write_unlock_bh(&pch->upl); | 2646 | write_unlock_bh(&pch->upl); |
2647 | if (ppp != 0) { | 2647 | if (ppp) { |
2648 | /* remove it from the ppp unit's list */ | 2648 | /* remove it from the ppp unit's list */ |
2649 | ppp_lock(ppp); | 2649 | ppp_lock(ppp); |
2650 | list_del(&pch->clist); | 2650 | list_del(&pch->clist); |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index ce64032a465a..f0c6a1926a02 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -209,7 +209,7 @@ ppp_sync_open(struct tty_struct *tty) | |||
209 | 209 | ||
210 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 210 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
211 | err = -ENOMEM; | 211 | err = -ENOMEM; |
212 | if (ap == 0) | 212 | if (!ap) |
213 | goto out; | 213 | goto out; |
214 | 214 | ||
215 | /* initialize the syncppp structure */ | 215 | /* initialize the syncppp structure */ |
@@ -262,7 +262,7 @@ ppp_sync_close(struct tty_struct *tty) | |||
262 | ap = tty->disc_data; | 262 | ap = tty->disc_data; |
263 | tty->disc_data = NULL; | 263 | tty->disc_data = NULL; |
264 | write_unlock_irq(&disc_data_lock); | 264 | write_unlock_irq(&disc_data_lock); |
265 | if (ap == 0) | 265 | if (!ap) |
266 | return; | 266 | return; |
267 | 267 | ||
268 | /* | 268 | /* |
@@ -278,7 +278,7 @@ ppp_sync_close(struct tty_struct *tty) | |||
278 | 278 | ||
279 | ppp_unregister_channel(&ap->chan); | 279 | ppp_unregister_channel(&ap->chan); |
280 | skb_queue_purge(&ap->rqueue); | 280 | skb_queue_purge(&ap->rqueue); |
281 | if (ap->tpkt != 0) | 281 | if (ap->tpkt) |
282 | kfree_skb(ap->tpkt); | 282 | kfree_skb(ap->tpkt); |
283 | kfree(ap); | 283 | kfree(ap); |
284 | } | 284 | } |
@@ -325,13 +325,13 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, | |||
325 | int __user *p = (int __user *)arg; | 325 | int __user *p = (int __user *)arg; |
326 | int err, val; | 326 | int err, val; |
327 | 327 | ||
328 | if (ap == 0) | 328 | if (!ap) |
329 | return -ENXIO; | 329 | return -ENXIO; |
330 | err = -EFAULT; | 330 | err = -EFAULT; |
331 | switch (cmd) { | 331 | switch (cmd) { |
332 | case PPPIOCGCHAN: | 332 | case PPPIOCGCHAN: |
333 | err = -ENXIO; | 333 | err = -ENXIO; |
334 | if (ap == 0) | 334 | if (!ap) |
335 | break; | 335 | break; |
336 | err = -EFAULT; | 336 | err = -EFAULT; |
337 | if (put_user(ppp_channel_index(&ap->chan), p)) | 337 | if (put_user(ppp_channel_index(&ap->chan), p)) |
@@ -341,7 +341,7 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, | |||
341 | 341 | ||
342 | case PPPIOCGUNIT: | 342 | case PPPIOCGUNIT: |
343 | err = -ENXIO; | 343 | err = -ENXIO; |
344 | if (ap == 0) | 344 | if (!ap) |
345 | break; | 345 | break; |
346 | err = -EFAULT; | 346 | err = -EFAULT; |
347 | if (put_user(ppp_unit_number(&ap->chan), p)) | 347 | if (put_user(ppp_unit_number(&ap->chan), p)) |
@@ -349,16 +349,11 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, | |||
349 | err = 0; | 349 | err = 0; |
350 | break; | 350 | break; |
351 | 351 | ||
352 | case TCGETS: | ||
353 | case TCGETA: | ||
354 | err = n_tty_ioctl(tty, file, cmd, arg); | ||
355 | break; | ||
356 | |||
357 | case TCFLSH: | 352 | case TCFLSH: |
358 | /* flush our buffers and the serial port's buffer */ | 353 | /* flush our buffers and the serial port's buffer */ |
359 | if (arg == TCIOFLUSH || arg == TCOFLUSH) | 354 | if (arg == TCIOFLUSH || arg == TCOFLUSH) |
360 | ppp_sync_flush_output(ap); | 355 | ppp_sync_flush_output(ap); |
361 | err = n_tty_ioctl(tty, file, cmd, arg); | 356 | err = tty_perform_flush(tty, arg); |
362 | break; | 357 | break; |
363 | 358 | ||
364 | case FIONREAD: | 359 | case FIONREAD: |
@@ -369,7 +364,8 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, | |||
369 | break; | 364 | break; |
370 | 365 | ||
371 | default: | 366 | default: |
372 | err = -ENOIOCTLCMD; | 367 | err = tty_mode_ioctl(tty, file, cmd, arg); |
368 | break; | ||
373 | } | 369 | } |
374 | 370 | ||
375 | sp_put(ap); | 371 | sp_put(ap); |
@@ -394,7 +390,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | |||
394 | struct syncppp *ap = sp_get(tty); | 390 | struct syncppp *ap = sp_get(tty); |
395 | unsigned long flags; | 391 | unsigned long flags; |
396 | 392 | ||
397 | if (ap == 0) | 393 | if (!ap) |
398 | return; | 394 | return; |
399 | spin_lock_irqsave(&ap->recv_lock, flags); | 395 | spin_lock_irqsave(&ap->recv_lock, flags); |
400 | ppp_sync_input(ap, buf, cflags, count); | 396 | ppp_sync_input(ap, buf, cflags, count); |
@@ -413,7 +409,7 @@ ppp_sync_wakeup(struct tty_struct *tty) | |||
413 | struct syncppp *ap = sp_get(tty); | 409 | struct syncppp *ap = sp_get(tty); |
414 | 410 | ||
415 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 411 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
416 | if (ap == 0) | 412 | if (!ap) |
417 | return; | 413 | return; |
418 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); | 414 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); |
419 | tasklet_schedule(&ap->tsk); | 415 | tasklet_schedule(&ap->tsk); |
@@ -655,7 +651,7 @@ ppp_sync_push(struct syncppp *ap) | |||
655 | for (;;) { | 651 | for (;;) { |
656 | if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags)) | 652 | if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags)) |
657 | tty_stuffed = 0; | 653 | tty_stuffed = 0; |
658 | if (!tty_stuffed && ap->tpkt != 0) { | 654 | if (!tty_stuffed && ap->tpkt) { |
659 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 655 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
660 | sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len); | 656 | sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len); |
661 | if (sent < 0) | 657 | if (sent < 0) |
@@ -673,7 +669,7 @@ ppp_sync_push(struct syncppp *ap) | |||
673 | /* haven't made any progress */ | 669 | /* haven't made any progress */ |
674 | spin_unlock_bh(&ap->xmit_lock); | 670 | spin_unlock_bh(&ap->xmit_lock); |
675 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) | 671 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) |
676 | || (!tty_stuffed && ap->tpkt != 0))) | 672 | || (!tty_stuffed && ap->tpkt))) |
677 | break; | 673 | break; |
678 | if (!spin_trylock_bh(&ap->xmit_lock)) | 674 | if (!spin_trylock_bh(&ap->xmit_lock)) |
679 | break; | 675 | break; |
@@ -681,7 +677,7 @@ ppp_sync_push(struct syncppp *ap) | |||
681 | return done; | 677 | return done; |
682 | 678 | ||
683 | flush: | 679 | flush: |
684 | if (ap->tpkt != 0) { | 680 | if (ap->tpkt) { |
685 | kfree_skb(ap->tpkt); | 681 | kfree_skb(ap->tpkt); |
686 | ap->tpkt = NULL; | 682 | ap->tpkt = NULL; |
687 | clear_bit(XMIT_FULL, &ap->xmit_flags); | 683 | clear_bit(XMIT_FULL, &ap->xmit_flags); |
@@ -736,7 +732,8 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf, | |||
736 | ppp_print_buffer ("receive buffer", buf, count); | 732 | ppp_print_buffer ("receive buffer", buf, count); |
737 | 733 | ||
738 | /* stuff the chars in the skb */ | 734 | /* stuff the chars in the skb */ |
739 | if ((skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2)) == 0) { | 735 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); |
736 | if (!skb) { | ||
740 | printk(KERN_ERR "PPPsync: no memory (input pkt)\n"); | 737 | printk(KERN_ERR "PPPsync: no memory (input pkt)\n"); |
741 | goto err; | 738 | goto err; |
742 | } | 739 | } |
@@ -744,7 +741,7 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf, | |||
744 | if (buf[0] != PPP_ALLSTATIONS) | 741 | if (buf[0] != PPP_ALLSTATIONS) |
745 | skb_reserve(skb, 2 + (buf[0] & 1)); | 742 | skb_reserve(skb, 2 + (buf[0] & 1)); |
746 | 743 | ||
747 | if (flags != 0 && *flags) { | 744 | if (flags && *flags) { |
748 | /* error flag set, ignore frame */ | 745 | /* error flag set, ignore frame */ |
749 | goto err; | 746 | goto err; |
750 | } else if (count > skb_tailroom(skb)) { | 747 | } else if (count > skb_tailroom(skb)) { |
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 8936ed3469cf..a005d8f4c38e 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -491,7 +491,7 @@ static int pppoe_create(struct net *net, struct socket *sock) | |||
491 | int error = -ENOMEM; | 491 | int error = -ENOMEM; |
492 | struct sock *sk; | 492 | struct sock *sk; |
493 | 493 | ||
494 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto, 1); | 494 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto); |
495 | if (!sk) | 495 | if (!sk) |
496 | goto out; | 496 | goto out; |
497 | 497 | ||
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index 921d4ef6d14b..a7556cd2df79 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -488,7 +488,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb) | |||
488 | { | 488 | { |
489 | struct pppol2tp_session *session = NULL; | 489 | struct pppol2tp_session *session = NULL; |
490 | struct pppol2tp_tunnel *tunnel; | 490 | struct pppol2tp_tunnel *tunnel; |
491 | unsigned char *ptr; | 491 | unsigned char *ptr, *optr; |
492 | u16 hdrflags; | 492 | u16 hdrflags; |
493 | u16 tunnel_id, session_id; | 493 | u16 tunnel_id, session_id; |
494 | int length; | 494 | int length; |
@@ -496,7 +496,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb) | |||
496 | 496 | ||
497 | tunnel = pppol2tp_sock_to_tunnel(sock); | 497 | tunnel = pppol2tp_sock_to_tunnel(sock); |
498 | if (tunnel == NULL) | 498 | if (tunnel == NULL) |
499 | goto error; | 499 | goto no_tunnel; |
500 | 500 | ||
501 | /* UDP always verifies the packet length. */ | 501 | /* UDP always verifies the packet length. */ |
502 | __skb_pull(skb, sizeof(struct udphdr)); | 502 | __skb_pull(skb, sizeof(struct udphdr)); |
@@ -509,7 +509,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb) | |||
509 | } | 509 | } |
510 | 510 | ||
511 | /* Point to L2TP header */ | 511 | /* Point to L2TP header */ |
512 | ptr = skb->data; | 512 | optr = ptr = skb->data; |
513 | 513 | ||
514 | /* Get L2TP header flags */ | 514 | /* Get L2TP header flags */ |
515 | hdrflags = ntohs(*(__be16*)ptr); | 515 | hdrflags = ntohs(*(__be16*)ptr); |
@@ -637,12 +637,14 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb) | |||
637 | /* If offset bit set, skip it. */ | 637 | /* If offset bit set, skip it. */ |
638 | if (hdrflags & L2TP_HDRFLAG_O) { | 638 | if (hdrflags & L2TP_HDRFLAG_O) { |
639 | offset = ntohs(*(__be16 *)ptr); | 639 | offset = ntohs(*(__be16 *)ptr); |
640 | skb->transport_header += 2 + offset; | 640 | ptr += 2 + offset; |
641 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + 2)) | ||
642 | goto discard; | ||
643 | } | 641 | } |
644 | 642 | ||
645 | __skb_pull(skb, skb_transport_offset(skb)); | 643 | offset = ptr - optr; |
644 | if (!pskb_may_pull(skb, offset)) | ||
645 | goto discard; | ||
646 | |||
647 | __skb_pull(skb, offset); | ||
646 | 648 | ||
647 | /* Skip PPP header, if present. In testing, Microsoft L2TP clients | 649 | /* Skip PPP header, if present. In testing, Microsoft L2TP clients |
648 | * don't send the PPP header (PPP header compression enabled), but | 650 | * don't send the PPP header (PPP header compression enabled), but |
@@ -652,6 +654,9 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb) | |||
652 | * Note that skb->data[] isn't dereferenced from a u16 ptr here since | 654 | * Note that skb->data[] isn't dereferenced from a u16 ptr here since |
653 | * the field may be unaligned. | 655 | * the field may be unaligned. |
654 | */ | 656 | */ |
657 | if (!pskb_may_pull(skb, 2)) | ||
658 | goto discard; | ||
659 | |||
655 | if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03)) | 660 | if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03)) |
656 | skb_pull(skb, 2); | 661 | skb_pull(skb, 2); |
657 | 662 | ||
@@ -709,6 +714,10 @@ discard: | |||
709 | return 0; | 714 | return 0; |
710 | 715 | ||
711 | error: | 716 | error: |
717 | /* Put UDP header back */ | ||
718 | __skb_push(skb, sizeof(struct udphdr)); | ||
719 | |||
720 | no_tunnel: | ||
712 | return 1; | 721 | return 1; |
713 | } | 722 | } |
714 | 723 | ||
@@ -1050,6 +1059,8 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
1050 | /* Get routing info from the tunnel socket */ | 1059 | /* Get routing info from the tunnel socket */ |
1051 | dst_release(skb->dst); | 1060 | dst_release(skb->dst); |
1052 | skb->dst = sk_dst_get(sk_tun); | 1061 | skb->dst = sk_dst_get(sk_tun); |
1062 | skb_orphan(skb); | ||
1063 | skb->sk = sk_tun; | ||
1053 | 1064 | ||
1054 | /* Queue the packet to IP for output */ | 1065 | /* Queue the packet to IP for output */ |
1055 | len = skb->len; | 1066 | len = skb->len; |
@@ -1416,7 +1427,7 @@ static int pppol2tp_create(struct net *net, struct socket *sock) | |||
1416 | int error = -ENOMEM; | 1427 | int error = -ENOMEM; |
1417 | struct sock *sk; | 1428 | struct sock *sk; |
1418 | 1429 | ||
1419 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto, 1); | 1430 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto); |
1420 | if (!sk) | 1431 | if (!sk) |
1421 | goto out; | 1432 | goto out; |
1422 | 1433 | ||
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index 30adf726743c..a5791114b7bd 100644 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c | |||
@@ -1456,16 +1456,11 @@ static void ql_phy_start_neg_ex(struct ql3_adapter *qdev) | |||
1456 | PHYAddr[qdev->mac_index]); | 1456 | PHYAddr[qdev->mac_index]); |
1457 | reg &= ~PHY_GIG_ALL_PARAMS; | 1457 | reg &= ~PHY_GIG_ALL_PARAMS; |
1458 | 1458 | ||
1459 | if(portConfiguration & | 1459 | if(portConfiguration & PORT_CONFIG_1000MB_SPEED) { |
1460 | PORT_CONFIG_FULL_DUPLEX_ENABLED & | 1460 | if(portConfiguration & PORT_CONFIG_FULL_DUPLEX_ENABLED) |
1461 | PORT_CONFIG_1000MB_SPEED) { | 1461 | reg |= PHY_GIG_ADV_1000F; |
1462 | reg |= PHY_GIG_ADV_1000F; | 1462 | else |
1463 | } | 1463 | reg |= PHY_GIG_ADV_1000H; |
1464 | |||
1465 | if(portConfiguration & | ||
1466 | PORT_CONFIG_HALF_DUPLEX_ENABLED & | ||
1467 | PORT_CONFIG_1000MB_SPEED) { | ||
1468 | reg |= PHY_GIG_ADV_1000H; | ||
1469 | } | 1464 | } |
1470 | 1465 | ||
1471 | ql_mii_write_reg_ex(qdev, PHY_GIG_CONTROL, reg, | 1466 | ql_mii_write_reg_ex(qdev, PHY_GIG_CONTROL, reg, |
@@ -1645,8 +1640,11 @@ static int ql_finish_auto_neg(struct ql3_adapter *qdev) | |||
1645 | return 0; | 1640 | return 0; |
1646 | } | 1641 | } |
1647 | 1642 | ||
1648 | static void ql_link_state_machine(struct ql3_adapter *qdev) | 1643 | static void ql_link_state_machine_work(struct work_struct *work) |
1649 | { | 1644 | { |
1645 | struct ql3_adapter *qdev = | ||
1646 | container_of(work, struct ql3_adapter, link_state_work.work); | ||
1647 | |||
1650 | u32 curr_link_state; | 1648 | u32 curr_link_state; |
1651 | unsigned long hw_flags; | 1649 | unsigned long hw_flags; |
1652 | 1650 | ||
@@ -1661,6 +1659,10 @@ static void ql_link_state_machine(struct ql3_adapter *qdev) | |||
1661 | "state.\n", qdev->ndev->name); | 1659 | "state.\n", qdev->ndev->name); |
1662 | 1660 | ||
1663 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | 1661 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); |
1662 | |||
1663 | /* Restart timer on 2 second interval. */ | ||
1664 | mod_timer(&qdev->adapter_timer, jiffies + HZ * 1);\ | ||
1665 | |||
1664 | return; | 1666 | return; |
1665 | } | 1667 | } |
1666 | 1668 | ||
@@ -1705,6 +1707,9 @@ static void ql_link_state_machine(struct ql3_adapter *qdev) | |||
1705 | break; | 1707 | break; |
1706 | } | 1708 | } |
1707 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | 1709 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); |
1710 | |||
1711 | /* Restart timer on 2 second interval. */ | ||
1712 | mod_timer(&qdev->adapter_timer, jiffies + HZ * 1); | ||
1708 | } | 1713 | } |
1709 | 1714 | ||
1710 | /* | 1715 | /* |
@@ -3941,19 +3946,7 @@ static void ql_get_board_info(struct ql3_adapter *qdev) | |||
3941 | static void ql3xxx_timer(unsigned long ptr) | 3946 | static void ql3xxx_timer(unsigned long ptr) |
3942 | { | 3947 | { |
3943 | struct ql3_adapter *qdev = (struct ql3_adapter *)ptr; | 3948 | struct ql3_adapter *qdev = (struct ql3_adapter *)ptr; |
3944 | 3949 | queue_delayed_work(qdev->workqueue, &qdev->link_state_work, 0); | |
3945 | if (test_bit(QL_RESET_ACTIVE,&qdev->flags)) { | ||
3946 | printk(KERN_DEBUG PFX | ||
3947 | "%s: Reset in progress.\n", | ||
3948 | qdev->ndev->name); | ||
3949 | goto end; | ||
3950 | } | ||
3951 | |||
3952 | ql_link_state_machine(qdev); | ||
3953 | |||
3954 | /* Restart timer on 2 second interval. */ | ||
3955 | end: | ||
3956 | mod_timer(&qdev->adapter_timer, jiffies + HZ * 1); | ||
3957 | } | 3950 | } |
3958 | 3951 | ||
3959 | static int __devinit ql3xxx_probe(struct pci_dev *pdev, | 3952 | static int __devinit ql3xxx_probe(struct pci_dev *pdev, |
@@ -4103,6 +4096,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev, | |||
4103 | qdev->workqueue = create_singlethread_workqueue(ndev->name); | 4096 | qdev->workqueue = create_singlethread_workqueue(ndev->name); |
4104 | INIT_DELAYED_WORK(&qdev->reset_work, ql_reset_work); | 4097 | INIT_DELAYED_WORK(&qdev->reset_work, ql_reset_work); |
4105 | INIT_DELAYED_WORK(&qdev->tx_timeout_work, ql_tx_timeout_work); | 4098 | INIT_DELAYED_WORK(&qdev->tx_timeout_work, ql_tx_timeout_work); |
4099 | INIT_DELAYED_WORK(&qdev->link_state_work, ql_link_state_machine_work); | ||
4106 | 4100 | ||
4107 | init_timer(&qdev->adapter_timer); | 4101 | init_timer(&qdev->adapter_timer); |
4108 | qdev->adapter_timer.function = ql3xxx_timer; | 4102 | qdev->adapter_timer.function = ql3xxx_timer; |
diff --git a/drivers/net/qla3xxx.h b/drivers/net/qla3xxx.h index fbcb0b949639..d0ffb30ef371 100644 --- a/drivers/net/qla3xxx.h +++ b/drivers/net/qla3xxx.h | |||
@@ -1286,6 +1286,7 @@ struct ql3_adapter { | |||
1286 | struct workqueue_struct *workqueue; | 1286 | struct workqueue_struct *workqueue; |
1287 | struct delayed_work reset_work; | 1287 | struct delayed_work reset_work; |
1288 | struct delayed_work tx_timeout_work; | 1288 | struct delayed_work tx_timeout_work; |
1289 | struct delayed_work link_state_work; | ||
1289 | u32 max_frame_size; | 1290 | u32 max_frame_size; |
1290 | u32 device_id; | 1291 | u32 device_id; |
1291 | u16 phyType; | 1292 | u16 phyType; |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index e8960f294a6e..1f647b9ce352 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -171,6 +171,8 @@ static struct pci_device_id rtl8169_pci_tbl[] = { | |||
171 | { PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 }, | 171 | { PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 }, |
172 | { PCI_VENDOR_ID_LINKSYS, 0x1032, | 172 | { PCI_VENDOR_ID_LINKSYS, 0x1032, |
173 | PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 }, | 173 | PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 }, |
174 | { 0x0001, 0x8168, | ||
175 | PCI_ANY_ID, 0x2410, 0, 0, RTL_CFG_2 }, | ||
174 | {0,}, | 176 | {0,}, |
175 | }; | 177 | }; |
176 | 178 | ||
@@ -392,7 +394,9 @@ struct rtl8169_private { | |||
392 | void __iomem *mmio_addr; /* memory map physical address */ | 394 | void __iomem *mmio_addr; /* memory map physical address */ |
393 | struct pci_dev *pci_dev; /* Index of PCI device */ | 395 | struct pci_dev *pci_dev; /* Index of PCI device */ |
394 | struct net_device *dev; | 396 | struct net_device *dev; |
397 | #ifdef CONFIG_R8169_NAPI | ||
395 | struct napi_struct napi; | 398 | struct napi_struct napi; |
399 | #endif | ||
396 | spinlock_t lock; /* spin lock flag */ | 400 | spinlock_t lock; /* spin lock flag */ |
397 | u32 msg_enable; | 401 | u32 msg_enable; |
398 | int chipset; | 402 | int chipset; |
@@ -466,7 +470,7 @@ static void mdio_write(void __iomem *ioaddr, int reg_addr, int value) | |||
466 | { | 470 | { |
467 | int i; | 471 | int i; |
468 | 472 | ||
469 | RTL_W32(PHYAR, 0x80000000 | (reg_addr & 0xFF) << 16 | value); | 473 | RTL_W32(PHYAR, 0x80000000 | (reg_addr & 0x1f) << 16 | (value & 0xffff)); |
470 | 474 | ||
471 | for (i = 20; i > 0; i--) { | 475 | for (i = 20; i > 0; i--) { |
472 | /* | 476 | /* |
@@ -483,7 +487,7 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr) | |||
483 | { | 487 | { |
484 | int i, value = -1; | 488 | int i, value = -1; |
485 | 489 | ||
486 | RTL_W32(PHYAR, 0x0 | (reg_addr & 0xFF) << 16); | 490 | RTL_W32(PHYAR, 0x0 | (reg_addr & 0x1f) << 16); |
487 | 491 | ||
488 | for (i = 20; i > 0; i--) { | 492 | for (i = 20; i > 0; i--) { |
489 | /* | 493 | /* |
@@ -491,7 +495,7 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr) | |||
491 | * the specified MII register. | 495 | * the specified MII register. |
492 | */ | 496 | */ |
493 | if (RTL_R32(PHYAR) & 0x80000000) { | 497 | if (RTL_R32(PHYAR) & 0x80000000) { |
494 | value = (int) (RTL_R32(PHYAR) & 0xFFFF); | 498 | value = RTL_R32(PHYAR) & 0xffff; |
495 | break; | 499 | break; |
496 | } | 500 | } |
497 | udelay(25); | 501 | udelay(25); |
@@ -1243,16 +1247,6 @@ static void rtl8169sb_hw_phy_config(void __iomem *ioaddr) | |||
1243 | 1247 | ||
1244 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); | 1248 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); |
1245 | } | 1249 | } |
1246 | static void rtl8168b_hw_phy_config(void __iomem *ioaddr) | ||
1247 | { | ||
1248 | struct phy_reg phy_reg_init[] = { | ||
1249 | { 0x1f, 0x0000 }, | ||
1250 | { 0x10, 0xf41b }, | ||
1251 | { 0x1f, 0x0000 } | ||
1252 | }; | ||
1253 | |||
1254 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); | ||
1255 | } | ||
1256 | 1250 | ||
1257 | static void rtl8168cp_hw_phy_config(void __iomem *ioaddr) | 1251 | static void rtl8168cp_hw_phy_config(void __iomem *ioaddr) |
1258 | { | 1252 | { |
@@ -1322,11 +1316,6 @@ static void rtl_hw_phy_config(struct net_device *dev) | |||
1322 | case RTL_GIGA_MAC_VER_04: | 1316 | case RTL_GIGA_MAC_VER_04: |
1323 | rtl8169sb_hw_phy_config(ioaddr); | 1317 | rtl8169sb_hw_phy_config(ioaddr); |
1324 | break; | 1318 | break; |
1325 | case RTL_GIGA_MAC_VER_11: | ||
1326 | case RTL_GIGA_MAC_VER_12: | ||
1327 | case RTL_GIGA_MAC_VER_17: | ||
1328 | rtl8168b_hw_phy_config(ioaddr); | ||
1329 | break; | ||
1330 | case RTL_GIGA_MAC_VER_18: | 1319 | case RTL_GIGA_MAC_VER_18: |
1331 | rtl8168cp_hw_phy_config(ioaddr); | 1320 | rtl8168cp_hw_phy_config(ioaddr); |
1332 | break; | 1321 | break; |
@@ -1737,7 +1726,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1737 | tp->features |= rtl_try_msi(pdev, ioaddr, cfg); | 1726 | tp->features |= rtl_try_msi(pdev, ioaddr, cfg); |
1738 | RTL_W8(Cfg9346, Cfg9346_Lock); | 1727 | RTL_W8(Cfg9346, Cfg9346_Lock); |
1739 | 1728 | ||
1740 | if (RTL_R8(PHYstatus) & TBI_Enable) { | 1729 | if ((tp->mac_version <= RTL_GIGA_MAC_VER_06) && |
1730 | (RTL_R8(PHYstatus) & TBI_Enable)) { | ||
1741 | tp->set_speed = rtl8169_set_speed_tbi; | 1731 | tp->set_speed = rtl8169_set_speed_tbi; |
1742 | tp->get_settings = rtl8169_gset_tbi; | 1732 | tp->get_settings = rtl8169_gset_tbi; |
1743 | tp->phy_reset_enable = rtl8169_tbi_reset_enable; | 1733 | tp->phy_reset_enable = rtl8169_tbi_reset_enable; |
@@ -2989,13 +2979,16 @@ static void rtl8169_down(struct net_device *dev) | |||
2989 | { | 2979 | { |
2990 | struct rtl8169_private *tp = netdev_priv(dev); | 2980 | struct rtl8169_private *tp = netdev_priv(dev); |
2991 | void __iomem *ioaddr = tp->mmio_addr; | 2981 | void __iomem *ioaddr = tp->mmio_addr; |
2992 | unsigned int poll_locked = 0; | ||
2993 | unsigned int intrmask; | 2982 | unsigned int intrmask; |
2994 | 2983 | ||
2995 | rtl8169_delete_timer(dev); | 2984 | rtl8169_delete_timer(dev); |
2996 | 2985 | ||
2997 | netif_stop_queue(dev); | 2986 | netif_stop_queue(dev); |
2998 | 2987 | ||
2988 | #ifdef CONFIG_R8169_NAPI | ||
2989 | napi_disable(&tp->napi); | ||
2990 | #endif | ||
2991 | |||
2999 | core_down: | 2992 | core_down: |
3000 | spin_lock_irq(&tp->lock); | 2993 | spin_lock_irq(&tp->lock); |
3001 | 2994 | ||
@@ -3009,11 +3002,6 @@ core_down: | |||
3009 | 3002 | ||
3010 | synchronize_irq(dev->irq); | 3003 | synchronize_irq(dev->irq); |
3011 | 3004 | ||
3012 | if (!poll_locked) { | ||
3013 | napi_disable(&tp->napi); | ||
3014 | poll_locked++; | ||
3015 | } | ||
3016 | |||
3017 | /* Give a racing hard_start_xmit a few cycles to complete. */ | 3005 | /* Give a racing hard_start_xmit a few cycles to complete. */ |
3018 | synchronize_sched(); /* FIXME: should this be synchronize_irq()? */ | 3006 | synchronize_sched(); /* FIXME: should this be synchronize_irq()? */ |
3019 | 3007 | ||
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index b822859c8de3..73a7e6529ee0 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c | |||
@@ -78,12 +78,6 @@ static char version[] __devinitdata = "rrunner.c: v0.50 11/11/2002 Jes Sorensen | |||
78 | * stack will need to know about I/O vectors or something similar. | 78 | * stack will need to know about I/O vectors or something similar. |
79 | */ | 79 | */ |
80 | 80 | ||
81 | /* | ||
82 | * sysctl_[wr]mem_max are checked at init time to see if they are at | ||
83 | * least 256KB and increased to 256KB if they are not. This is done to | ||
84 | * avoid ending up with socket buffers smaller than the MTU size, | ||
85 | */ | ||
86 | |||
87 | static int __devinit rr_init_one(struct pci_dev *pdev, | 81 | static int __devinit rr_init_one(struct pci_dev *pdev, |
88 | const struct pci_device_id *ent) | 82 | const struct pci_device_id *ent) |
89 | { | 83 | { |
@@ -561,18 +555,6 @@ static int __devinit rr_init(struct net_device *dev) | |||
561 | sram_size = rr_read_eeprom_word(rrpriv, (void *)8); | 555 | sram_size = rr_read_eeprom_word(rrpriv, (void *)8); |
562 | printk(" SRAM size 0x%06x\n", sram_size); | 556 | printk(" SRAM size 0x%06x\n", sram_size); |
563 | 557 | ||
564 | if (sysctl_rmem_max < 262144){ | ||
565 | printk(" Receive socket buffer limit too low (%i), " | ||
566 | "setting to 262144\n", sysctl_rmem_max); | ||
567 | sysctl_rmem_max = 262144; | ||
568 | } | ||
569 | |||
570 | if (sysctl_wmem_max < 262144){ | ||
571 | printk(" Transmit socket buffer limit too low (%i), " | ||
572 | "setting to 262144\n", sysctl_wmem_max); | ||
573 | sysctl_wmem_max = 262144; | ||
574 | } | ||
575 | |||
576 | return 0; | 558 | return 0; |
577 | } | 559 | } |
578 | 560 | ||
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index b8c0e7b4ca1c..632666706247 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.5" | 87 | #define DRV_VERSION "2.0.26.6" |
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"; |
@@ -3775,6 +3775,40 @@ static int __devinit s2io_test_msi(struct s2io_nic *sp) | |||
3775 | 3775 | ||
3776 | return err; | 3776 | return err; |
3777 | } | 3777 | } |
3778 | |||
3779 | static void remove_msix_isr(struct s2io_nic *sp) | ||
3780 | { | ||
3781 | int i; | ||
3782 | u16 msi_control; | ||
3783 | |||
3784 | for (i = 0; i < MAX_REQUESTED_MSI_X; i++) { | ||
3785 | if (sp->s2io_entries[i].in_use == | ||
3786 | MSIX_REGISTERED_SUCCESS) { | ||
3787 | int vector = sp->entries[i].vector; | ||
3788 | void *arg = sp->s2io_entries[i].arg; | ||
3789 | free_irq(vector, arg); | ||
3790 | } | ||
3791 | } | ||
3792 | |||
3793 | kfree(sp->entries); | ||
3794 | kfree(sp->s2io_entries); | ||
3795 | sp->entries = NULL; | ||
3796 | sp->s2io_entries = NULL; | ||
3797 | |||
3798 | pci_read_config_word(sp->pdev, 0x42, &msi_control); | ||
3799 | msi_control &= 0xFFFE; /* Disable MSI */ | ||
3800 | pci_write_config_word(sp->pdev, 0x42, msi_control); | ||
3801 | |||
3802 | pci_disable_msix(sp->pdev); | ||
3803 | } | ||
3804 | |||
3805 | static void remove_inta_isr(struct s2io_nic *sp) | ||
3806 | { | ||
3807 | struct net_device *dev = sp->dev; | ||
3808 | |||
3809 | free_irq(sp->pdev->irq, dev); | ||
3810 | } | ||
3811 | |||
3778 | /* ********************************************************* * | 3812 | /* ********************************************************* * |
3779 | * Functions defined below concern the OS part of the driver * | 3813 | * Functions defined below concern the OS part of the driver * |
3780 | * ********************************************************* */ | 3814 | * ********************************************************* */ |
@@ -3809,28 +3843,9 @@ static int s2io_open(struct net_device *dev) | |||
3809 | int ret = s2io_enable_msi_x(sp); | 3843 | int ret = s2io_enable_msi_x(sp); |
3810 | 3844 | ||
3811 | if (!ret) { | 3845 | if (!ret) { |
3812 | u16 msi_control; | ||
3813 | |||
3814 | ret = s2io_test_msi(sp); | 3846 | ret = s2io_test_msi(sp); |
3815 | |||
3816 | /* rollback MSI-X, will re-enable during add_isr() */ | 3847 | /* rollback MSI-X, will re-enable during add_isr() */ |
3817 | kfree(sp->entries); | 3848 | remove_msix_isr(sp); |
3818 | sp->mac_control.stats_info->sw_stat.mem_freed += | ||
3819 | (MAX_REQUESTED_MSI_X * | ||
3820 | sizeof(struct msix_entry)); | ||
3821 | kfree(sp->s2io_entries); | ||
3822 | sp->mac_control.stats_info->sw_stat.mem_freed += | ||
3823 | (MAX_REQUESTED_MSI_X * | ||
3824 | sizeof(struct s2io_msix_entry)); | ||
3825 | sp->entries = NULL; | ||
3826 | sp->s2io_entries = NULL; | ||
3827 | |||
3828 | pci_read_config_word(sp->pdev, 0x42, &msi_control); | ||
3829 | msi_control &= 0xFFFE; /* Disable MSI */ | ||
3830 | pci_write_config_word(sp->pdev, 0x42, msi_control); | ||
3831 | |||
3832 | pci_disable_msix(sp->pdev); | ||
3833 | |||
3834 | } | 3849 | } |
3835 | if (ret) { | 3850 | if (ret) { |
3836 | 3851 | ||
@@ -6719,15 +6734,22 @@ static int s2io_add_isr(struct s2io_nic * sp) | |||
6719 | } | 6734 | } |
6720 | } | 6735 | } |
6721 | if (err) { | 6736 | if (err) { |
6737 | remove_msix_isr(sp); | ||
6722 | DBG_PRINT(ERR_DBG,"%s:MSI-X-%d registration " | 6738 | DBG_PRINT(ERR_DBG,"%s:MSI-X-%d registration " |
6723 | "failed\n", dev->name, i); | 6739 | "failed\n", dev->name, i); |
6724 | DBG_PRINT(ERR_DBG, "Returned: %d\n", err); | 6740 | DBG_PRINT(ERR_DBG, "%s: defaulting to INTA\n", |
6725 | return -1; | 6741 | dev->name); |
6742 | sp->config.intr_type = INTA; | ||
6743 | break; | ||
6726 | } | 6744 | } |
6727 | sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS; | 6745 | sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS; |
6728 | } | 6746 | } |
6729 | printk("MSI-X-TX %d entries enabled\n",msix_tx_cnt); | 6747 | if (!err) { |
6730 | printk("MSI-X-RX %d entries enabled\n",msix_rx_cnt); | 6748 | printk(KERN_INFO "MSI-X-TX %d entries enabled\n", |
6749 | msix_tx_cnt); | ||
6750 | printk(KERN_INFO "MSI-X-RX %d entries enabled\n", | ||
6751 | msix_rx_cnt); | ||
6752 | } | ||
6731 | } | 6753 | } |
6732 | if (sp->config.intr_type == INTA) { | 6754 | if (sp->config.intr_type == INTA) { |
6733 | err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED, | 6755 | err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED, |
@@ -6742,40 +6764,10 @@ static int s2io_add_isr(struct s2io_nic * sp) | |||
6742 | } | 6764 | } |
6743 | static void s2io_rem_isr(struct s2io_nic * sp) | 6765 | static void s2io_rem_isr(struct s2io_nic * sp) |
6744 | { | 6766 | { |
6745 | struct net_device *dev = sp->dev; | 6767 | if (sp->config.intr_type == MSI_X) |
6746 | struct swStat *stats = &sp->mac_control.stats_info->sw_stat; | 6768 | remove_msix_isr(sp); |
6747 | 6769 | else | |
6748 | if (sp->config.intr_type == MSI_X) { | 6770 | remove_inta_isr(sp); |
6749 | int i; | ||
6750 | u16 msi_control; | ||
6751 | |||
6752 | for (i=1; (sp->s2io_entries[i].in_use == | ||
6753 | MSIX_REGISTERED_SUCCESS); i++) { | ||
6754 | int vector = sp->entries[i].vector; | ||
6755 | void *arg = sp->s2io_entries[i].arg; | ||
6756 | |||
6757 | synchronize_irq(vector); | ||
6758 | free_irq(vector, arg); | ||
6759 | } | ||
6760 | |||
6761 | kfree(sp->entries); | ||
6762 | stats->mem_freed += | ||
6763 | (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); | ||
6764 | kfree(sp->s2io_entries); | ||
6765 | stats->mem_freed += | ||
6766 | (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); | ||
6767 | sp->entries = NULL; | ||
6768 | sp->s2io_entries = NULL; | ||
6769 | |||
6770 | pci_read_config_word(sp->pdev, 0x42, &msi_control); | ||
6771 | msi_control &= 0xFFFE; /* Disable MSI */ | ||
6772 | pci_write_config_word(sp->pdev, 0x42, msi_control); | ||
6773 | |||
6774 | pci_disable_msix(sp->pdev); | ||
6775 | } else { | ||
6776 | synchronize_irq(sp->pdev->irq); | ||
6777 | free_irq(sp->pdev->irq, dev); | ||
6778 | } | ||
6779 | } | 6771 | } |
6780 | 6772 | ||
6781 | static void do_s2io_card_down(struct s2io_nic * sp, int do_io) | 6773 | static void do_s2io_card_down(struct s2io_nic * sp, int do_io) |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index b9961dc47606..6d62250fba07 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -2512,31 +2512,32 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2512 | return err; | 2512 | return err; |
2513 | } | 2513 | } |
2514 | 2514 | ||
2515 | /* Assign Ram Buffer allocation to queue */ | 2515 | static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, size_t len) |
2516 | static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, u32 space) | ||
2517 | { | 2516 | { |
2518 | u32 end; | 2517 | u32 end; |
2519 | 2518 | ||
2520 | /* convert from K bytes to qwords used for hw register */ | 2519 | start /= 8; |
2521 | start *= 1024/8; | 2520 | len /= 8; |
2522 | space *= 1024/8; | 2521 | end = start + len - 1; |
2523 | end = start + space - 1; | ||
2524 | 2522 | ||
2525 | skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR); | 2523 | skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR); |
2526 | skge_write32(hw, RB_ADDR(q, RB_START), start); | 2524 | skge_write32(hw, RB_ADDR(q, RB_START), start); |
2527 | skge_write32(hw, RB_ADDR(q, RB_END), end); | ||
2528 | skge_write32(hw, RB_ADDR(q, RB_WP), start); | 2525 | skge_write32(hw, RB_ADDR(q, RB_WP), start); |
2529 | skge_write32(hw, RB_ADDR(q, RB_RP), start); | 2526 | skge_write32(hw, RB_ADDR(q, RB_RP), start); |
2527 | skge_write32(hw, RB_ADDR(q, RB_END), end); | ||
2530 | 2528 | ||
2531 | if (q == Q_R1 || q == Q_R2) { | 2529 | if (q == Q_R1 || q == Q_R2) { |
2532 | u32 tp = space - space/4; | ||
2533 | |||
2534 | /* Set thresholds on receive queue's */ | 2530 | /* Set thresholds on receive queue's */ |
2535 | skge_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp); | 2531 | skge_write32(hw, RB_ADDR(q, RB_RX_UTPP), |
2536 | skge_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4); | 2532 | start + (2*len)/3); |
2537 | } else if (hw->chip_id != CHIP_ID_GENESIS) | 2533 | skge_write32(hw, RB_ADDR(q, RB_RX_LTPP), |
2538 | /* Genesis Tx Fifo is too small for normal store/forward */ | 2534 | start + (len/3)); |
2535 | } else { | ||
2536 | /* Enable store & forward on Tx queue's because | ||
2537 | * Tx FIFO is only 4K on Genesis and 1K on Yukon | ||
2538 | */ | ||
2539 | skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_STFWD); | 2539 | skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_STFWD); |
2540 | } | ||
2540 | 2541 | ||
2541 | skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_OP_MD); | 2542 | skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_OP_MD); |
2542 | } | 2543 | } |
@@ -2564,7 +2565,7 @@ static int skge_up(struct net_device *dev) | |||
2564 | struct skge_port *skge = netdev_priv(dev); | 2565 | struct skge_port *skge = netdev_priv(dev); |
2565 | struct skge_hw *hw = skge->hw; | 2566 | struct skge_hw *hw = skge->hw; |
2566 | int port = skge->port; | 2567 | int port = skge->port; |
2567 | u32 ramaddr, ramsize, rxspace; | 2568 | u32 chunk, ram_addr; |
2568 | size_t rx_size, tx_size; | 2569 | size_t rx_size, tx_size; |
2569 | int err; | 2570 | int err; |
2570 | 2571 | ||
@@ -2619,15 +2620,14 @@ static int skge_up(struct net_device *dev) | |||
2619 | spin_unlock_bh(&hw->phy_lock); | 2620 | spin_unlock_bh(&hw->phy_lock); |
2620 | 2621 | ||
2621 | /* Configure RAMbuffers */ | 2622 | /* Configure RAMbuffers */ |
2622 | ramsize = (hw->ram_size - hw->ram_offset) / hw->ports; | 2623 | chunk = hw->ram_size / ((hw->ports + 1)*2); |
2623 | ramaddr = hw->ram_offset + port * ramsize; | 2624 | ram_addr = hw->ram_offset + 2 * chunk * port; |
2624 | rxspace = 8 + (2*(ramsize - 16))/3; | ||
2625 | |||
2626 | skge_ramset(hw, rxqaddr[port], ramaddr, rxspace); | ||
2627 | skge_ramset(hw, txqaddr[port], ramaddr + rxspace, ramsize - rxspace); | ||
2628 | 2625 | ||
2626 | skge_ramset(hw, rxqaddr[port], ram_addr, chunk); | ||
2629 | skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean); | 2627 | skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean); |
2628 | |||
2630 | BUG_ON(skge->tx_ring.to_use != skge->tx_ring.to_clean); | 2629 | BUG_ON(skge->tx_ring.to_use != skge->tx_ring.to_clean); |
2630 | skge_ramset(hw, txqaddr[port], ram_addr+chunk, chunk); | ||
2631 | skge_qset(skge, txqaddr[port], skge->tx_ring.to_use); | 2631 | skge_qset(skge, txqaddr[port], skge->tx_ring.to_use); |
2632 | 2632 | ||
2633 | /* Start receiver BMU */ | 2633 | /* Start receiver BMU */ |
@@ -3591,12 +3591,15 @@ static int skge_reset(struct skge_hw *hw) | |||
3591 | if (hw->chip_id == CHIP_ID_GENESIS) { | 3591 | if (hw->chip_id == CHIP_ID_GENESIS) { |
3592 | if (t8 == 3) { | 3592 | if (t8 == 3) { |
3593 | /* special case: 4 x 64k x 36, offset = 0x80000 */ | 3593 | /* special case: 4 x 64k x 36, offset = 0x80000 */ |
3594 | hw->ram_size = 1024; | 3594 | hw->ram_size = 0x100000; |
3595 | hw->ram_offset = 512; | 3595 | hw->ram_offset = 0x80000; |
3596 | } else | 3596 | } else |
3597 | hw->ram_size = t8 * 512; | 3597 | hw->ram_size = t8 * 512; |
3598 | } else /* Yukon */ | 3598 | } |
3599 | hw->ram_size = t8 ? t8 * 4 : 128; | 3599 | else if (t8 == 0) |
3600 | hw->ram_size = 0x20000; | ||
3601 | else | ||
3602 | hw->ram_size = t8 * 4096; | ||
3600 | 3603 | ||
3601 | hw->intr_mask = IS_HW_ERR; | 3604 | hw->intr_mask = IS_HW_ERR; |
3602 | 3605 | ||
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index c27c7d63b6a5..a2070db725c9 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -52,7 +52,7 @@ | |||
52 | #include "sky2.h" | 52 | #include "sky2.h" |
53 | 53 | ||
54 | #define DRV_NAME "sky2" | 54 | #define DRV_NAME "sky2" |
55 | #define DRV_VERSION "1.19" | 55 | #define DRV_VERSION "1.20" |
56 | #define PFX DRV_NAME " " | 56 | #define PFX DRV_NAME " " |
57 | 57 | ||
58 | /* | 58 | /* |
@@ -121,6 +121,7 @@ static const struct pci_device_id sky2_id_table[] = { | |||
121 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */ | 121 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */ |
122 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4354) }, /* 88E8040 */ | 122 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4354) }, /* 88E8040 */ |
123 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */ | 123 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */ |
124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4357) }, /* 88E8042 */ | ||
124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */ | 125 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */ |
125 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) }, /* 88E8052 */ | 126 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) }, /* 88E8052 */ |
126 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ | 127 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ |
@@ -134,6 +135,7 @@ static const struct pci_device_id sky2_id_table[] = { | |||
134 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4369) }, /* 88EC042 */ | 135 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4369) }, /* 88EC042 */ |
135 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436A) }, /* 88E8058 */ | 136 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436A) }, /* 88E8058 */ |
136 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436B) }, /* 88E8071 */ | 137 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436B) }, /* 88E8071 */ |
138 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436C) }, /* 88E8072 */ | ||
137 | { 0 } | 139 | { 0 } |
138 | }; | 140 | }; |
139 | 141 | ||
@@ -156,7 +158,7 @@ static const char *yukon2_name[] = { | |||
156 | 158 | ||
157 | static void sky2_set_multicast(struct net_device *dev); | 159 | static void sky2_set_multicast(struct net_device *dev); |
158 | 160 | ||
159 | /* Access to external PHY */ | 161 | /* Access to PHY via serial interconnect */ |
160 | static int gm_phy_write(struct sky2_hw *hw, unsigned port, u16 reg, u16 val) | 162 | static int gm_phy_write(struct sky2_hw *hw, unsigned port, u16 reg, u16 val) |
161 | { | 163 | { |
162 | int i; | 164 | int i; |
@@ -166,13 +168,22 @@ static int gm_phy_write(struct sky2_hw *hw, unsigned port, u16 reg, u16 val) | |||
166 | GM_SMI_CT_PHY_AD(PHY_ADDR_MARV) | GM_SMI_CT_REG_AD(reg)); | 168 | GM_SMI_CT_PHY_AD(PHY_ADDR_MARV) | GM_SMI_CT_REG_AD(reg)); |
167 | 169 | ||
168 | for (i = 0; i < PHY_RETRIES; i++) { | 170 | for (i = 0; i < PHY_RETRIES; i++) { |
169 | if (!(gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY)) | 171 | u16 ctrl = gma_read16(hw, port, GM_SMI_CTRL); |
172 | if (ctrl == 0xffff) | ||
173 | goto io_error; | ||
174 | |||
175 | if (!(ctrl & GM_SMI_CT_BUSY)) | ||
170 | return 0; | 176 | return 0; |
171 | udelay(1); | 177 | |
178 | udelay(10); | ||
172 | } | 179 | } |
173 | 180 | ||
174 | printk(KERN_WARNING PFX "%s: phy write timeout\n", hw->dev[port]->name); | 181 | dev_warn(&hw->pdev->dev,"%s: phy write timeout\n", hw->dev[port]->name); |
175 | return -ETIMEDOUT; | 182 | return -ETIMEDOUT; |
183 | |||
184 | io_error: | ||
185 | dev_err(&hw->pdev->dev, "%s: phy I/O error\n", hw->dev[port]->name); | ||
186 | return -EIO; | ||
176 | } | 187 | } |
177 | 188 | ||
178 | static int __gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg, u16 *val) | 189 | static int __gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg, u16 *val) |
@@ -183,23 +194,29 @@ static int __gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg, u16 *val) | |||
183 | | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); | 194 | | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); |
184 | 195 | ||
185 | for (i = 0; i < PHY_RETRIES; i++) { | 196 | for (i = 0; i < PHY_RETRIES; i++) { |
186 | if (gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) { | 197 | u16 ctrl = gma_read16(hw, port, GM_SMI_CTRL); |
198 | if (ctrl == 0xffff) | ||
199 | goto io_error; | ||
200 | |||
201 | if (ctrl & GM_SMI_CT_RD_VAL) { | ||
187 | *val = gma_read16(hw, port, GM_SMI_DATA); | 202 | *val = gma_read16(hw, port, GM_SMI_DATA); |
188 | return 0; | 203 | return 0; |
189 | } | 204 | } |
190 | 205 | ||
191 | udelay(1); | 206 | udelay(10); |
192 | } | 207 | } |
193 | 208 | ||
209 | dev_warn(&hw->pdev->dev, "%s: phy read timeout\n", hw->dev[port]->name); | ||
194 | return -ETIMEDOUT; | 210 | return -ETIMEDOUT; |
211 | io_error: | ||
212 | dev_err(&hw->pdev->dev, "%s: phy I/O error\n", hw->dev[port]->name); | ||
213 | return -EIO; | ||
195 | } | 214 | } |
196 | 215 | ||
197 | static u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg) | 216 | static inline u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg) |
198 | { | 217 | { |
199 | u16 v; | 218 | u16 v; |
200 | 219 | __gm_phy_read(hw, port, reg, &v); | |
201 | if (__gm_phy_read(hw, port, reg, &v) != 0) | ||
202 | printk(KERN_WARNING PFX "%s: phy read timeout\n", hw->dev[port]->name); | ||
203 | return v; | 220 | return v; |
204 | } | 221 | } |
205 | 222 | ||
@@ -273,8 +290,6 @@ static void sky2_gmac_reset(struct sky2_hw *hw, unsigned port) | |||
273 | 290 | ||
274 | /* disable all GMAC IRQ's */ | 291 | /* disable all GMAC IRQ's */ |
275 | sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0); | 292 | sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0); |
276 | /* disable PHY IRQs */ | ||
277 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0); | ||
278 | 293 | ||
279 | gma_write16(hw, port, GM_MC_ADDR_H1, 0); /* clear MC hash */ | 294 | gma_write16(hw, port, GM_MC_ADDR_H1, 0); /* clear MC hash */ |
280 | gma_write16(hw, port, GM_MC_ADDR_H2, 0); | 295 | gma_write16(hw, port, GM_MC_ADDR_H2, 0); |
@@ -1805,29 +1820,6 @@ static void sky2_link_up(struct sky2_port *sky2) | |||
1805 | sky2_write8(hw, SK_REG(port, LNK_LED_REG), | 1820 | sky2_write8(hw, SK_REG(port, LNK_LED_REG), |
1806 | LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF); | 1821 | LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF); |
1807 | 1822 | ||
1808 | if (hw->flags & SKY2_HW_NEWER_PHY) { | ||
1809 | u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR); | ||
1810 | u16 led = PHY_M_LEDC_LOS_CTRL(1); /* link active */ | ||
1811 | |||
1812 | switch(sky2->speed) { | ||
1813 | case SPEED_10: | ||
1814 | led |= PHY_M_LEDC_INIT_CTRL(7); | ||
1815 | break; | ||
1816 | |||
1817 | case SPEED_100: | ||
1818 | led |= PHY_M_LEDC_STA1_CTRL(7); | ||
1819 | break; | ||
1820 | |||
1821 | case SPEED_1000: | ||
1822 | led |= PHY_M_LEDC_STA0_CTRL(7); | ||
1823 | break; | ||
1824 | } | ||
1825 | |||
1826 | gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3); | ||
1827 | gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, led); | ||
1828 | gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); | ||
1829 | } | ||
1830 | |||
1831 | if (netif_msg_link(sky2)) | 1823 | if (netif_msg_link(sky2)) |
1832 | printk(KERN_INFO PFX | 1824 | printk(KERN_INFO PFX |
1833 | "%s: Link is up at %d Mbps, %s duplex, flow control %s\n", | 1825 | "%s: Link is up at %d Mbps, %s duplex, flow control %s\n", |
@@ -2247,20 +2239,26 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
2247 | do { | 2239 | do { |
2248 | struct sky2_port *sky2; | 2240 | struct sky2_port *sky2; |
2249 | struct sky2_status_le *le = hw->st_le + hw->st_idx; | 2241 | struct sky2_status_le *le = hw->st_le + hw->st_idx; |
2250 | unsigned port = le->css & CSS_LINK_BIT; | 2242 | unsigned port; |
2251 | struct net_device *dev; | 2243 | struct net_device *dev; |
2252 | struct sk_buff *skb; | 2244 | struct sk_buff *skb; |
2253 | u32 status; | 2245 | u32 status; |
2254 | u16 length; | 2246 | u16 length; |
2247 | u8 opcode = le->opcode; | ||
2248 | |||
2249 | if (!(opcode & HW_OWNER)) | ||
2250 | break; | ||
2255 | 2251 | ||
2256 | hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE); | 2252 | hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE); |
2257 | 2253 | ||
2254 | port = le->css & CSS_LINK_BIT; | ||
2258 | dev = hw->dev[port]; | 2255 | dev = hw->dev[port]; |
2259 | sky2 = netdev_priv(dev); | 2256 | sky2 = netdev_priv(dev); |
2260 | length = le16_to_cpu(le->length); | 2257 | length = le16_to_cpu(le->length); |
2261 | status = le32_to_cpu(le->status); | 2258 | status = le32_to_cpu(le->status); |
2262 | 2259 | ||
2263 | switch (le->opcode & ~HW_OWNER) { | 2260 | le->opcode = 0; |
2261 | switch (opcode & ~HW_OWNER) { | ||
2264 | case OP_RXSTAT: | 2262 | case OP_RXSTAT: |
2265 | ++rx[port]; | 2263 | ++rx[port]; |
2266 | skb = sky2_receive(dev, length, status); | 2264 | skb = sky2_receive(dev, length, status); |
@@ -2353,7 +2351,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
2353 | default: | 2351 | default: |
2354 | if (net_ratelimit()) | 2352 | if (net_ratelimit()) |
2355 | printk(KERN_WARNING PFX | 2353 | printk(KERN_WARNING PFX |
2356 | "unknown status opcode 0x%x\n", le->opcode); | 2354 | "unknown status opcode 0x%x\n", opcode); |
2357 | } | 2355 | } |
2358 | } while (hw->st_idx != idx); | 2356 | } while (hw->st_idx != idx); |
2359 | 2357 | ||
@@ -2439,13 +2437,26 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2439 | 2437 | ||
2440 | if (status & Y2_IS_PCI_EXP) { | 2438 | if (status & Y2_IS_PCI_EXP) { |
2441 | /* PCI-Express uncorrectable Error occurred */ | 2439 | /* PCI-Express uncorrectable Error occurred */ |
2442 | int pos = pci_find_aer_capability(hw->pdev); | 2440 | int aer = pci_find_aer_capability(hw->pdev); |
2443 | u32 err; | 2441 | u32 err; |
2444 | 2442 | ||
2445 | pci_read_config_dword(pdev, pos + PCI_ERR_UNCOR_STATUS, &err); | 2443 | if (aer) { |
2444 | pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_STATUS, | ||
2445 | &err); | ||
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 | |||
2446 | if (net_ratelimit()) | 2457 | if (net_ratelimit()) |
2447 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); | 2458 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); |
2448 | pci_cleanup_aer_uncorrect_error_status(pdev); | 2459 | |
2449 | } | 2460 | } |
2450 | 2461 | ||
2451 | if (status & Y2_HWE_L1_MASK) | 2462 | if (status & Y2_HWE_L1_MASK) |
@@ -2791,6 +2802,9 @@ static void sky2_reset(struct sky2_hw *hw) | |||
2791 | sky2_write8(hw, B0_CTST, CS_RST_SET); | 2802 | sky2_write8(hw, B0_CTST, CS_RST_SET); |
2792 | sky2_write8(hw, B0_CTST, CS_RST_CLR); | 2803 | sky2_write8(hw, B0_CTST, CS_RST_CLR); |
2793 | 2804 | ||
2805 | /* allow writes to PCI config */ | ||
2806 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2807 | |||
2794 | /* clear PCI errors, if any */ | 2808 | /* clear PCI errors, if any */ |
2795 | pci_read_config_word(pdev, PCI_STATUS, &status); | 2809 | pci_read_config_word(pdev, PCI_STATUS, &status); |
2796 | status |= PCI_STATUS_ERROR_BITS; | 2810 | status |= PCI_STATUS_ERROR_BITS; |
@@ -2800,9 +2814,18 @@ static void sky2_reset(struct sky2_hw *hw) | |||
2800 | 2814 | ||
2801 | cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 2815 | cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); |
2802 | if (cap) { | 2816 | if (cap) { |
2803 | /* Check for advanced error reporting */ | 2817 | if (pci_find_aer_capability(pdev)) { |
2804 | pci_cleanup_aer_uncorrect_error_status(pdev); | 2818 | /* Check for advanced error reporting */ |
2805 | pci_cleanup_aer_correct_error_status(pdev); | 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 | } | ||
2806 | 2829 | ||
2807 | /* If error bit is stuck on ignore it */ | 2830 | /* If error bit is stuck on ignore it */ |
2808 | if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP) | 2831 | if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP) |
@@ -3974,7 +3997,8 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | |||
3974 | dev->tx_timeout = sky2_tx_timeout; | 3997 | dev->tx_timeout = sky2_tx_timeout; |
3975 | dev->watchdog_timeo = TX_WATCHDOG; | 3998 | dev->watchdog_timeo = TX_WATCHDOG; |
3976 | #ifdef CONFIG_NET_POLL_CONTROLLER | 3999 | #ifdef CONFIG_NET_POLL_CONTROLLER |
3977 | dev->poll_controller = sky2_netpoll; | 4000 | if (port == 0) |
4001 | dev->poll_controller = sky2_netpoll; | ||
3978 | #endif | 4002 | #endif |
3979 | 4003 | ||
3980 | sky2 = netdev_priv(dev); | 4004 | sky2 = netdev_priv(dev); |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 49ee264064ab..69525fd7908d 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -247,7 +247,8 @@ enum csr_regs { | |||
247 | B3_PA_CTRL = 0x01f0, | 247 | B3_PA_CTRL = 0x01f0, |
248 | B3_PA_TEST = 0x01f2, | 248 | B3_PA_TEST = 0x01f2, |
249 | 249 | ||
250 | Y2_CFG_SPC = 0x1c00, | 250 | Y2_CFG_SPC = 0x1c00, /* PCI config space region */ |
251 | Y2_CFG_AER = 0x1d00, /* PCI Advanced Error Report region */ | ||
251 | }; | 252 | }; |
252 | 253 | ||
253 | /* B0_CTST 16 bit Control/Status register */ | 254 | /* B0_CTST 16 bit Control/Status register */ |
diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 335b7cc80eba..251a3ce376ac 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c | |||
@@ -1218,14 +1218,8 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm | |||
1218 | return 0; | 1218 | return 0; |
1219 | /* VSV changes end */ | 1219 | /* VSV changes end */ |
1220 | #endif | 1220 | #endif |
1221 | |||
1222 | /* Allow stty to read, but not set, the serial port */ | ||
1223 | case TCGETS: | ||
1224 | case TCGETA: | ||
1225 | return n_tty_ioctl(tty, file, cmd, arg); | ||
1226 | |||
1227 | default: | 1221 | default: |
1228 | return -ENOIOCTLCMD; | 1222 | return tty_mode_ioctl(tty, file, cmd, arg); |
1229 | } | 1223 | } |
1230 | } | 1224 | } |
1231 | 1225 | ||
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 729fd28c08b5..db34e1eb67e9 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -224,6 +224,21 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | #elif defined(CONFIG_MACH_ZYLONITE) | ||
228 | |||
229 | #define SMC_CAN_USE_8BIT 1 | ||
230 | #define SMC_CAN_USE_16BIT 1 | ||
231 | #define SMC_CAN_USE_32BIT 0 | ||
232 | #define SMC_IO_SHIFT 0 | ||
233 | #define SMC_NOWAIT 1 | ||
234 | #define SMC_USE_PXA_DMA 1 | ||
235 | #define SMC_inb(a, r) readb((a) + (r)) | ||
236 | #define SMC_inw(a, r) readw((a) + (r)) | ||
237 | #define SMC_insw(a, r, p, l) insw((a) + (r), p, l) | ||
238 | #define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l) | ||
239 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
240 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
241 | |||
227 | #elif defined(CONFIG_ARCH_OMAP) | 242 | #elif defined(CONFIG_ARCH_OMAP) |
228 | 243 | ||
229 | /* We can only do 16-bit reads and writes in the static memory space. */ | 244 | /* We can only do 16-bit reads and writes in the static memory space. */ |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 53b8344a68ef..f6fedcc32de1 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -2333,10 +2333,10 @@ static int gem_close(struct net_device *dev) | |||
2333 | { | 2333 | { |
2334 | struct gem *gp = dev->priv; | 2334 | struct gem *gp = dev->priv; |
2335 | 2335 | ||
2336 | napi_disable(&gp->napi); | ||
2337 | |||
2338 | mutex_lock(&gp->pm_mutex); | 2336 | mutex_lock(&gp->pm_mutex); |
2339 | 2337 | ||
2338 | napi_disable(&gp->napi); | ||
2339 | |||
2340 | gp->opened = 0; | 2340 | gp->opened = 0; |
2341 | if (!gp->asleep) | 2341 | if (!gp->asleep) |
2342 | gem_do_stop(dev, 0); | 2342 | gem_do_stop(dev, 0); |
@@ -2355,8 +2355,6 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2355 | 2355 | ||
2356 | mutex_lock(&gp->pm_mutex); | 2356 | mutex_lock(&gp->pm_mutex); |
2357 | 2357 | ||
2358 | napi_disable(&gp->napi); | ||
2359 | |||
2360 | printk(KERN_INFO "%s: suspending, WakeOnLan %s\n", | 2358 | printk(KERN_INFO "%s: suspending, WakeOnLan %s\n", |
2361 | dev->name, | 2359 | dev->name, |
2362 | (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled"); | 2360 | (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled"); |
@@ -2370,6 +2368,8 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2370 | 2368 | ||
2371 | /* If the driver is opened, we stop the MAC */ | 2369 | /* If the driver is opened, we stop the MAC */ |
2372 | if (gp->opened) { | 2370 | if (gp->opened) { |
2371 | napi_disable(&gp->napi); | ||
2372 | |||
2373 | /* Stop traffic, mark us closed */ | 2373 | /* Stop traffic, mark us closed */ |
2374 | netif_device_detach(dev); | 2374 | netif_device_detach(dev); |
2375 | 2375 | ||
@@ -2460,6 +2460,7 @@ static int gem_resume(struct pci_dev *pdev) | |||
2460 | /* Re-attach net device */ | 2460 | /* Re-attach net device */ |
2461 | netif_device_attach(dev); | 2461 | netif_device_attach(dev); |
2462 | 2462 | ||
2463 | napi_enable(&gp->napi); | ||
2463 | } | 2464 | } |
2464 | 2465 | ||
2465 | spin_lock_irqsave(&gp->lock, flags); | 2466 | spin_lock_irqsave(&gp->lock, flags); |
@@ -2479,8 +2480,6 @@ static int gem_resume(struct pci_dev *pdev) | |||
2479 | spin_unlock(&gp->tx_lock); | 2480 | spin_unlock(&gp->tx_lock); |
2480 | spin_unlock_irqrestore(&gp->lock, flags); | 2481 | spin_unlock_irqrestore(&gp->lock, flags); |
2481 | 2482 | ||
2482 | napi_enable(&gp->napi); | ||
2483 | |||
2484 | mutex_unlock(&gp->pm_mutex); | 2483 | mutex_unlock(&gp->pm_mutex); |
2485 | 2484 | ||
2486 | return 0; | 2485 | return 0; |
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index 120c8affe83d..9cc13dd8a821 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c | |||
@@ -1281,7 +1281,7 @@ static void happy_meal_init_rings(struct happy_meal *hp) | |||
1281 | skb->dev = dev; | 1281 | skb->dev = dev; |
1282 | 1282 | ||
1283 | /* Because we reserve afterwards. */ | 1283 | /* Because we reserve afterwards. */ |
1284 | skb_put(skb, (ETH_FRAME_LEN + RX_OFFSET)); | 1284 | skb_put(skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); |
1285 | hme_write_rxd(hp, &hb->happy_meal_rxd[i], | 1285 | hme_write_rxd(hp, &hb->happy_meal_rxd[i], |
1286 | (RXFLAG_OWN | ((RX_BUF_ALLOC_SIZE - RX_OFFSET) << 16)), | 1286 | (RXFLAG_OWN | ((RX_BUF_ALLOC_SIZE - RX_OFFSET) << 16)), |
1287 | hme_dma_map(hp, skb->data, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE)); | 1287 | hme_dma_map(hp, skb->data, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE)); |
@@ -1700,6 +1700,11 @@ static int happy_meal_init(struct happy_meal *hp) | |||
1700 | HMD(("tx old[%08x] and rx [%08x] ON!\n", | 1700 | HMD(("tx old[%08x] and rx [%08x] ON!\n", |
1701 | hme_read32(hp, bregs + BMAC_TXCFG), | 1701 | hme_read32(hp, bregs + BMAC_TXCFG), |
1702 | hme_read32(hp, bregs + BMAC_RXCFG))); | 1702 | hme_read32(hp, bregs + BMAC_RXCFG))); |
1703 | |||
1704 | /* Set larger TX/RX size to allow for 802.1q */ | ||
1705 | hme_write32(hp, bregs + BMAC_TXMAX, ETH_FRAME_LEN + 8); | ||
1706 | hme_write32(hp, bregs + BMAC_RXMAX, ETH_FRAME_LEN + 8); | ||
1707 | |||
1703 | hme_write32(hp, bregs + BMAC_TXCFG, | 1708 | hme_write32(hp, bregs + BMAC_TXCFG, |
1704 | hme_read32(hp, bregs + BMAC_TXCFG) | BIGMAC_TXCFG_ENABLE); | 1709 | hme_read32(hp, bregs + BMAC_TXCFG) | BIGMAC_TXCFG_ENABLE); |
1705 | hme_write32(hp, bregs + BMAC_RXCFG, | 1710 | hme_write32(hp, bregs + BMAC_RXCFG, |
@@ -2039,7 +2044,7 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev) | |||
2039 | hme_dma_unmap(hp, dma_addr, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE); | 2044 | hme_dma_unmap(hp, dma_addr, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE); |
2040 | hp->rx_skbs[elem] = new_skb; | 2045 | hp->rx_skbs[elem] = new_skb; |
2041 | new_skb->dev = dev; | 2046 | new_skb->dev = dev; |
2042 | skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET)); | 2047 | skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); |
2043 | hme_write_rxd(hp, this, | 2048 | hme_write_rxd(hp, this, |
2044 | (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), | 2049 | (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), |
2045 | hme_dma_map(hp, new_skb->data, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE)); | 2050 | hme_dma_map(hp, new_skb->data, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE)); |
@@ -2809,8 +2814,8 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe | |||
2809 | dev->watchdog_timeo = 5*HZ; | 2814 | dev->watchdog_timeo = 5*HZ; |
2810 | dev->ethtool_ops = &hme_ethtool_ops; | 2815 | dev->ethtool_ops = &hme_ethtool_ops; |
2811 | 2816 | ||
2812 | /* Happy Meal can do it all... except VLAN. */ | 2817 | /* Happy Meal can do it all... */ |
2813 | dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_VLAN_CHALLENGED; | 2818 | dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM; |
2814 | 2819 | ||
2815 | dev->irq = sdev->irqs[0]; | 2820 | dev->irq = sdev->irqs[0]; |
2816 | 2821 | ||
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index 4e1b84e6d66a..21230c97b2a0 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c | |||
@@ -2168,10 +2168,10 @@ bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | |||
2168 | { | 2168 | { |
2169 | struct bdx_priv *priv = netdev->priv; | 2169 | struct bdx_priv *priv = netdev->priv; |
2170 | 2170 | ||
2171 | strncat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); | 2171 | strlcat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); |
2172 | strncat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); | 2172 | strlcat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); |
2173 | strncat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | 2173 | strlcat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
2174 | strncat(drvinfo->bus_info, pci_name(priv->pdev), | 2174 | strlcat(drvinfo->bus_info, pci_name(priv->pdev), |
2175 | sizeof(drvinfo->bus_info)); | 2175 | sizeof(drvinfo->bus_info)); |
2176 | 2176 | ||
2177 | drvinfo->n_stats = ((priv->stats_flag) ? | 2177 | drvinfo->n_stats = ((priv->stats_flag) ? |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 09440d783e65..4942f7d18937 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -64,8 +64,8 @@ | |||
64 | 64 | ||
65 | #define DRV_MODULE_NAME "tg3" | 65 | #define DRV_MODULE_NAME "tg3" |
66 | #define PFX DRV_MODULE_NAME ": " | 66 | #define PFX DRV_MODULE_NAME ": " |
67 | #define DRV_MODULE_VERSION "3.85" | 67 | #define DRV_MODULE_VERSION "3.86" |
68 | #define DRV_MODULE_RELDATE "October 18, 2007" | 68 | #define DRV_MODULE_RELDATE "November 9, 2007" |
69 | 69 | ||
70 | #define TG3_DEF_MAC_MODE 0 | 70 | #define TG3_DEF_MAC_MODE 0 |
71 | #define TG3_DEF_RX_MODE 0 | 71 | #define TG3_DEF_RX_MODE 0 |
@@ -1106,6 +1106,24 @@ static int tg3_phy_reset(struct tg3 *tp) | |||
1106 | if (err) | 1106 | if (err) |
1107 | return err; | 1107 | return err; |
1108 | 1108 | ||
1109 | if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { | ||
1110 | u32 val; | ||
1111 | |||
1112 | val = tr32(TG3_CPMU_LSPD_1000MB_CLK); | ||
1113 | if ((val & CPMU_LSPD_1000MB_MACCLK_MASK) == | ||
1114 | CPMU_LSPD_1000MB_MACCLK_12_5) { | ||
1115 | val &= ~CPMU_LSPD_1000MB_MACCLK_MASK; | ||
1116 | udelay(40); | ||
1117 | tw32_f(TG3_CPMU_LSPD_1000MB_CLK, val); | ||
1118 | } | ||
1119 | |||
1120 | /* Disable GPHY autopowerdown. */ | ||
1121 | tg3_writephy(tp, MII_TG3_MISC_SHDW, | ||
1122 | MII_TG3_MISC_SHDW_WREN | | ||
1123 | MII_TG3_MISC_SHDW_APD_SEL | | ||
1124 | MII_TG3_MISC_SHDW_APD_WKTM_84MS); | ||
1125 | } | ||
1126 | |||
1109 | out: | 1127 | out: |
1110 | if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) { | 1128 | if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) { |
1111 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); | 1129 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); |
@@ -1297,6 +1315,8 @@ static void tg3_nvram_unlock(struct tg3 *); | |||
1297 | 1315 | ||
1298 | static void tg3_power_down_phy(struct tg3 *tp) | 1316 | static void tg3_power_down_phy(struct tg3 *tp) |
1299 | { | 1317 | { |
1318 | u32 val; | ||
1319 | |||
1300 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { | 1320 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { |
1301 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { | 1321 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { |
1302 | u32 sg_dig_ctrl = tr32(SG_DIG_CTRL); | 1322 | u32 sg_dig_ctrl = tr32(SG_DIG_CTRL); |
@@ -1311,8 +1331,6 @@ static void tg3_power_down_phy(struct tg3 *tp) | |||
1311 | } | 1331 | } |
1312 | 1332 | ||
1313 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 1333 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
1314 | u32 val; | ||
1315 | |||
1316 | tg3_bmcr_reset(tp); | 1334 | tg3_bmcr_reset(tp); |
1317 | val = tr32(GRC_MISC_CFG); | 1335 | val = tr32(GRC_MISC_CFG); |
1318 | tw32_f(GRC_MISC_CFG, val | GRC_MISC_CFG_EPHY_IDDQ); | 1336 | tw32_f(GRC_MISC_CFG, val | GRC_MISC_CFG_EPHY_IDDQ); |
@@ -1332,6 +1350,14 @@ static void tg3_power_down_phy(struct tg3 *tp) | |||
1332 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && | 1350 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && |
1333 | (tp->tg3_flags2 & TG3_FLG2_MII_SERDES))) | 1351 | (tp->tg3_flags2 & TG3_FLG2_MII_SERDES))) |
1334 | return; | 1352 | return; |
1353 | |||
1354 | if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { | ||
1355 | val = tr32(TG3_CPMU_LSPD_1000MB_CLK); | ||
1356 | val &= ~CPMU_LSPD_1000MB_MACCLK_MASK; | ||
1357 | val |= CPMU_LSPD_1000MB_MACCLK_12_5; | ||
1358 | tw32_f(TG3_CPMU_LSPD_1000MB_CLK, val); | ||
1359 | } | ||
1360 | |||
1335 | tg3_writephy(tp, MII_BMCR, BMCR_PDOWN); | 1361 | tg3_writephy(tp, MII_BMCR, BMCR_PDOWN); |
1336 | } | 1362 | } |
1337 | 1363 | ||
@@ -3126,6 +3152,23 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset) | |||
3126 | err = tg3_setup_copper_phy(tp, force_reset); | 3152 | err = tg3_setup_copper_phy(tp, force_reset); |
3127 | } | 3153 | } |
3128 | 3154 | ||
3155 | if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 || | ||
3156 | tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) { | ||
3157 | u32 val, scale; | ||
3158 | |||
3159 | val = tr32(TG3_CPMU_CLCK_STAT) & CPMU_CLCK_STAT_MAC_CLCK_MASK; | ||
3160 | if (val == CPMU_CLCK_STAT_MAC_CLCK_62_5) | ||
3161 | scale = 65; | ||
3162 | else if (val == CPMU_CLCK_STAT_MAC_CLCK_6_25) | ||
3163 | scale = 6; | ||
3164 | else | ||
3165 | scale = 12; | ||
3166 | |||
3167 | val = tr32(GRC_MISC_CFG) & ~GRC_MISC_CFG_PRESCALAR_MASK; | ||
3168 | val |= (scale << GRC_MISC_CFG_PRESCALAR_SHIFT); | ||
3169 | tw32(GRC_MISC_CFG, val); | ||
3170 | } | ||
3171 | |||
3129 | if (tp->link_config.active_speed == SPEED_1000 && | 3172 | if (tp->link_config.active_speed == SPEED_1000 && |
3130 | tp->link_config.active_duplex == DUPLEX_HALF) | 3173 | tp->link_config.active_duplex == DUPLEX_HALF) |
3131 | tw32(MAC_TX_LENGTHS, | 3174 | tw32(MAC_TX_LENGTHS, |
@@ -5054,12 +5097,15 @@ static void tg3_restore_pci_state(struct tg3 *tp) | |||
5054 | 5097 | ||
5055 | pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd); | 5098 | pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd); |
5056 | 5099 | ||
5057 | if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) { | 5100 | if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) |
5101 | pcie_set_readrq(tp->pdev, 4096); | ||
5102 | else { | ||
5058 | pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE, | 5103 | pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE, |
5059 | tp->pci_cacheline_sz); | 5104 | tp->pci_cacheline_sz); |
5060 | pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER, | 5105 | pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER, |
5061 | tp->pci_lat_timer); | 5106 | tp->pci_lat_timer); |
5062 | } | 5107 | } |
5108 | |||
5063 | /* Make sure PCI-X relaxed ordering bit is clear. */ | 5109 | /* Make sure PCI-X relaxed ordering bit is clear. */ |
5064 | if (tp->pcix_cap) { | 5110 | if (tp->pcix_cap) { |
5065 | u16 pcix_cmd; | 5111 | u16 pcix_cmd; |
@@ -6343,10 +6389,26 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
6343 | 6389 | ||
6344 | tg3_write_sig_legacy(tp, RESET_KIND_INIT); | 6390 | tg3_write_sig_legacy(tp, RESET_KIND_INIT); |
6345 | 6391 | ||
6346 | if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0) { | 6392 | if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 || |
6393 | tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) { | ||
6347 | val = tr32(TG3_CPMU_CTRL); | 6394 | val = tr32(TG3_CPMU_CTRL); |
6348 | val &= ~(CPMU_CTRL_LINK_AWARE_MODE | CPMU_CTRL_LINK_IDLE_MODE); | 6395 | val &= ~(CPMU_CTRL_LINK_AWARE_MODE | CPMU_CTRL_LINK_IDLE_MODE); |
6349 | tw32(TG3_CPMU_CTRL, val); | 6396 | tw32(TG3_CPMU_CTRL, val); |
6397 | |||
6398 | val = tr32(TG3_CPMU_LSPD_10MB_CLK); | ||
6399 | val &= ~CPMU_LSPD_10MB_MACCLK_MASK; | ||
6400 | val |= CPMU_LSPD_10MB_MACCLK_6_25; | ||
6401 | tw32(TG3_CPMU_LSPD_10MB_CLK, val); | ||
6402 | |||
6403 | val = tr32(TG3_CPMU_LNK_AWARE_PWRMD); | ||
6404 | val &= ~CPMU_LNK_AWARE_MACCLK_MASK; | ||
6405 | val |= CPMU_LNK_AWARE_MACCLK_6_25; | ||
6406 | tw32(TG3_CPMU_LNK_AWARE_PWRMD, val); | ||
6407 | |||
6408 | val = tr32(TG3_CPMU_HST_ACC); | ||
6409 | val &= ~CPMU_HST_ACC_MACCLK_MASK; | ||
6410 | val |= CPMU_HST_ACC_MACCLK_6_25; | ||
6411 | tw32(TG3_CPMU_HST_ACC, val); | ||
6350 | } | 6412 | } |
6351 | 6413 | ||
6352 | /* This works around an issue with Athlon chipsets on | 6414 | /* This works around an issue with Athlon chipsets on |
@@ -7365,10 +7427,6 @@ static int tg3_open(struct net_device *dev) | |||
7365 | } else if (pci_enable_msi(tp->pdev) == 0) { | 7427 | } else if (pci_enable_msi(tp->pdev) == 0) { |
7366 | u32 msi_mode; | 7428 | u32 msi_mode; |
7367 | 7429 | ||
7368 | /* Hardware bug - MSI won't work if INTX disabled. */ | ||
7369 | if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) | ||
7370 | pci_intx(tp->pdev, 1); | ||
7371 | |||
7372 | msi_mode = tr32(MSGINT_MODE); | 7430 | msi_mode = tr32(MSGINT_MODE); |
7373 | tw32(MSGINT_MODE, msi_mode | MSGINT_MODE_ENABLE); | 7431 | tw32(MSGINT_MODE, msi_mode | MSGINT_MODE_ENABLE); |
7374 | tp->tg3_flags2 |= TG3_FLG2_USING_MSI; | 7432 | tp->tg3_flags2 |= TG3_FLG2_USING_MSI; |
@@ -8271,7 +8329,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
8271 | SUPPORTED_100baseT_Full | | 8329 | SUPPORTED_100baseT_Full | |
8272 | SUPPORTED_10baseT_Half | | 8330 | SUPPORTED_10baseT_Half | |
8273 | SUPPORTED_10baseT_Full | | 8331 | SUPPORTED_10baseT_Full | |
8274 | SUPPORTED_MII); | 8332 | SUPPORTED_TP); |
8275 | cmd->port = PORT_TP; | 8333 | cmd->port = PORT_TP; |
8276 | } else { | 8334 | } else { |
8277 | cmd->supported |= SUPPORTED_FIBRE; | 8335 | cmd->supported |= SUPPORTED_FIBRE; |
@@ -8668,7 +8726,9 @@ static void tg3_get_ethtool_stats (struct net_device *dev, | |||
8668 | } | 8726 | } |
8669 | 8727 | ||
8670 | #define NVRAM_TEST_SIZE 0x100 | 8728 | #define NVRAM_TEST_SIZE 0x100 |
8671 | #define NVRAM_SELFBOOT_FORMAT1_SIZE 0x14 | 8729 | #define NVRAM_SELFBOOT_FORMAT1_0_SIZE 0x14 |
8730 | #define NVRAM_SELFBOOT_FORMAT1_2_SIZE 0x18 | ||
8731 | #define NVRAM_SELFBOOT_FORMAT1_3_SIZE 0x1c | ||
8672 | #define NVRAM_SELFBOOT_HW_SIZE 0x20 | 8732 | #define NVRAM_SELFBOOT_HW_SIZE 0x20 |
8673 | #define NVRAM_SELFBOOT_DATA_SIZE 0x1c | 8733 | #define NVRAM_SELFBOOT_DATA_SIZE 0x1c |
8674 | 8734 | ||
@@ -8683,9 +8743,22 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8683 | if (magic == TG3_EEPROM_MAGIC) | 8743 | if (magic == TG3_EEPROM_MAGIC) |
8684 | size = NVRAM_TEST_SIZE; | 8744 | size = NVRAM_TEST_SIZE; |
8685 | else if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) { | 8745 | else if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) { |
8686 | if ((magic & 0xe00000) == 0x200000) | 8746 | if ((magic & TG3_EEPROM_SB_FORMAT_MASK) == |
8687 | size = NVRAM_SELFBOOT_FORMAT1_SIZE; | 8747 | TG3_EEPROM_SB_FORMAT_1) { |
8688 | else | 8748 | switch (magic & TG3_EEPROM_SB_REVISION_MASK) { |
8749 | case TG3_EEPROM_SB_REVISION_0: | ||
8750 | size = NVRAM_SELFBOOT_FORMAT1_0_SIZE; | ||
8751 | break; | ||
8752 | case TG3_EEPROM_SB_REVISION_2: | ||
8753 | size = NVRAM_SELFBOOT_FORMAT1_2_SIZE; | ||
8754 | break; | ||
8755 | case TG3_EEPROM_SB_REVISION_3: | ||
8756 | size = NVRAM_SELFBOOT_FORMAT1_3_SIZE; | ||
8757 | break; | ||
8758 | default: | ||
8759 | return 0; | ||
8760 | } | ||
8761 | } else | ||
8689 | return 0; | 8762 | return 0; |
8690 | } else if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW) | 8763 | } else if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW) |
8691 | size = NVRAM_SELFBOOT_HW_SIZE; | 8764 | size = NVRAM_SELFBOOT_HW_SIZE; |
@@ -8712,8 +8785,17 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8712 | TG3_EEPROM_MAGIC_FW) { | 8785 | TG3_EEPROM_MAGIC_FW) { |
8713 | u8 *buf8 = (u8 *) buf, csum8 = 0; | 8786 | u8 *buf8 = (u8 *) buf, csum8 = 0; |
8714 | 8787 | ||
8715 | for (i = 0; i < size; i++) | 8788 | if ((cpu_to_be32(buf[0]) & TG3_EEPROM_SB_REVISION_MASK) == |
8716 | csum8 += buf8[i]; | 8789 | TG3_EEPROM_SB_REVISION_2) { |
8790 | /* For rev 2, the csum doesn't include the MBA. */ | ||
8791 | for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++) | ||
8792 | csum8 += buf8[i]; | ||
8793 | for (i = TG3_EEPROM_SB_F1R2_MBA_OFF + 4; i < size; i++) | ||
8794 | csum8 += buf8[i]; | ||
8795 | } else { | ||
8796 | for (i = 0; i < size; i++) | ||
8797 | csum8 += buf8[i]; | ||
8798 | } | ||
8717 | 8799 | ||
8718 | if (csum8 == 0) { | 8800 | if (csum8 == 0) { |
8719 | err = 0; | 8801 | err = 0; |
@@ -9297,7 +9379,7 @@ static int tg3_test_loopback(struct tg3 *tp) | |||
9297 | if (err) | 9379 | if (err) |
9298 | return TG3_LOOPBACK_FAILED; | 9380 | return TG3_LOOPBACK_FAILED; |
9299 | 9381 | ||
9300 | if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) { | 9382 | if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { |
9301 | int i; | 9383 | int i; |
9302 | u32 status; | 9384 | u32 status; |
9303 | 9385 | ||
@@ -9314,17 +9396,17 @@ static int tg3_test_loopback(struct tg3 *tp) | |||
9314 | if (status != CPMU_MUTEX_GNT_DRIVER) | 9396 | if (status != CPMU_MUTEX_GNT_DRIVER) |
9315 | return TG3_LOOPBACK_FAILED; | 9397 | return TG3_LOOPBACK_FAILED; |
9316 | 9398 | ||
9317 | cpmuctrl = tr32(TG3_CPMU_CTRL); | ||
9318 | |||
9319 | /* Turn off power management based on link speed. */ | 9399 | /* Turn off power management based on link speed. */ |
9400 | cpmuctrl = tr32(TG3_CPMU_CTRL); | ||
9320 | tw32(TG3_CPMU_CTRL, | 9401 | tw32(TG3_CPMU_CTRL, |
9321 | cpmuctrl & ~CPMU_CTRL_LINK_SPEED_MODE); | 9402 | cpmuctrl & ~(CPMU_CTRL_LINK_SPEED_MODE | |
9403 | CPMU_CTRL_LINK_AWARE_MODE)); | ||
9322 | } | 9404 | } |
9323 | 9405 | ||
9324 | if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK)) | 9406 | if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK)) |
9325 | err |= TG3_MAC_LOOPBACK_FAILED; | 9407 | err |= TG3_MAC_LOOPBACK_FAILED; |
9326 | 9408 | ||
9327 | if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) { | 9409 | if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { |
9328 | tw32(TG3_CPMU_CTRL, cpmuctrl); | 9410 | tw32(TG3_CPMU_CTRL, cpmuctrl); |
9329 | 9411 | ||
9330 | /* Release the mutex */ | 9412 | /* Release the mutex */ |
@@ -10545,6 +10627,10 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
10545 | tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) | 10627 | tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) |
10546 | tp->led_ctrl = LED_CTRL_MODE_PHY_2; | 10628 | tp->led_ctrl = LED_CTRL_MODE_PHY_2; |
10547 | 10629 | ||
10630 | if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 || | ||
10631 | tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) | ||
10632 | tp->led_ctrl = LED_CTRL_MODE_MAC; | ||
10633 | |||
10548 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) { | 10634 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) { |
10549 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | 10635 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; |
10550 | if ((tp->pdev->subsystem_vendor == | 10636 | if ((tp->pdev->subsystem_vendor == |
@@ -10863,7 +10949,7 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp) | |||
10863 | } | 10949 | } |
10864 | 10950 | ||
10865 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || | 10951 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || |
10866 | (tp->tg3_flags & TG3_FLG3_ENABLE_APE)) | 10952 | (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)) |
10867 | return; | 10953 | return; |
10868 | 10954 | ||
10869 | for (offset = TG3_NVM_DIR_START; | 10955 | for (offset = TG3_NVM_DIR_START; |
@@ -11131,6 +11217,9 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
11131 | pcie_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_EXP); | 11217 | pcie_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_EXP); |
11132 | if (pcie_cap != 0) { | 11218 | if (pcie_cap != 0) { |
11133 | tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; | 11219 | tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; |
11220 | |||
11221 | pcie_set_readrq(tp->pdev, 4096); | ||
11222 | |||
11134 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 11223 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
11135 | u16 lnkctl; | 11224 | u16 lnkctl; |
11136 | 11225 | ||
@@ -11311,9 +11400,16 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
11311 | } | 11400 | } |
11312 | 11401 | ||
11313 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || | 11402 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || |
11314 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) | 11403 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) { |
11315 | tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT; | 11404 | tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT; |
11316 | 11405 | ||
11406 | if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 || | ||
11407 | tp->pci_chip_rev_id == CHIPREV_ID_5784_A1 || | ||
11408 | tp->pci_chip_rev_id == CHIPREV_ID_5761_A0 || | ||
11409 | tp->pci_chip_rev_id == CHIPREV_ID_5761_A1) | ||
11410 | tp->tg3_flags3 |= TG3_FLG3_5761_5784_AX_FIXES; | ||
11411 | } | ||
11412 | |||
11317 | /* Set up tp->grc_local_ctrl before calling tg3_set_power_state(). | 11413 | /* Set up tp->grc_local_ctrl before calling tg3_set_power_state(). |
11318 | * GPIO1 driven high will bring 5700's external PHY out of reset. | 11414 | * GPIO1 driven high will bring 5700's external PHY out of reset. |
11319 | * It is also used as eeprom write protect on LOMs. | 11415 | * It is also used as eeprom write protect on LOMs. |
@@ -12468,6 +12564,28 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
12468 | goto err_out_iounmap; | 12564 | goto err_out_iounmap; |
12469 | } | 12565 | } |
12470 | 12566 | ||
12567 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) { | ||
12568 | if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { | ||
12569 | printk(KERN_ERR PFX "Cannot find proper PCI device " | ||
12570 | "base address for APE, aborting.\n"); | ||
12571 | err = -ENODEV; | ||
12572 | goto err_out_iounmap; | ||
12573 | } | ||
12574 | |||
12575 | tg3reg_base = pci_resource_start(pdev, 2); | ||
12576 | tg3reg_len = pci_resource_len(pdev, 2); | ||
12577 | |||
12578 | tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len); | ||
12579 | if (tp->aperegs == 0UL) { | ||
12580 | printk(KERN_ERR PFX "Cannot map APE registers, " | ||
12581 | "aborting.\n"); | ||
12582 | err = -ENOMEM; | ||
12583 | goto err_out_iounmap; | ||
12584 | } | ||
12585 | |||
12586 | tg3_ape_lock_init(tp); | ||
12587 | } | ||
12588 | |||
12471 | /* | 12589 | /* |
12472 | * Reset chip in case UNDI or EFI driver did not shutdown | 12590 | * Reset chip in case UNDI or EFI driver did not shutdown |
12473 | * DMA self test will enable WDMAC and we'll see (spurious) | 12591 | * DMA self test will enable WDMAC and we'll see (spurious) |
@@ -12482,7 +12600,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
12482 | err = tg3_test_dma(tp); | 12600 | err = tg3_test_dma(tp); |
12483 | if (err) { | 12601 | if (err) { |
12484 | printk(KERN_ERR PFX "DMA engine test failed, aborting.\n"); | 12602 | printk(KERN_ERR PFX "DMA engine test failed, aborting.\n"); |
12485 | goto err_out_iounmap; | 12603 | goto err_out_apeunmap; |
12486 | } | 12604 | } |
12487 | 12605 | ||
12488 | /* Tigon3 can do ipv4 only... and some chips have buggy | 12606 | /* Tigon3 can do ipv4 only... and some chips have buggy |
@@ -12505,28 +12623,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
12505 | 12623 | ||
12506 | tg3_init_coal(tp); | 12624 | tg3_init_coal(tp); |
12507 | 12625 | ||
12508 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) { | ||
12509 | if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { | ||
12510 | printk(KERN_ERR PFX "Cannot find proper PCI device " | ||
12511 | "base address for APE, aborting.\n"); | ||
12512 | err = -ENODEV; | ||
12513 | goto err_out_iounmap; | ||
12514 | } | ||
12515 | |||
12516 | tg3reg_base = pci_resource_start(pdev, 2); | ||
12517 | tg3reg_len = pci_resource_len(pdev, 2); | ||
12518 | |||
12519 | tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len); | ||
12520 | if (tp->aperegs == 0UL) { | ||
12521 | printk(KERN_ERR PFX "Cannot map APE registers, " | ||
12522 | "aborting.\n"); | ||
12523 | err = -ENOMEM; | ||
12524 | goto err_out_iounmap; | ||
12525 | } | ||
12526 | |||
12527 | tg3_ape_lock_init(tp); | ||
12528 | } | ||
12529 | |||
12530 | pci_set_drvdata(pdev, dev); | 12626 | pci_set_drvdata(pdev, dev); |
12531 | 12627 | ||
12532 | err = register_netdev(dev); | 12628 | err = register_netdev(dev); |
@@ -12681,11 +12777,6 @@ static int tg3_resume(struct pci_dev *pdev) | |||
12681 | if (err) | 12777 | if (err) |
12682 | return err; | 12778 | return err; |
12683 | 12779 | ||
12684 | /* Hardware bug - MSI won't work if INTX disabled. */ | ||
12685 | if ((tp->tg3_flags2 & TG3_FLG2_5780_CLASS) && | ||
12686 | (tp->tg3_flags2 & TG3_FLG2_USING_MSI)) | ||
12687 | pci_intx(tp->pdev, 1); | ||
12688 | |||
12689 | netif_device_attach(dev); | 12780 | netif_device_attach(dev); |
12690 | 12781 | ||
12691 | tg3_full_lock(tp, 0); | 12782 | tg3_full_lock(tp, 0); |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 1d5b2a3dd29d..da18fb220712 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -109,6 +109,9 @@ | |||
109 | #define CHIPREV_ID_5714_A2 0x9002 | 109 | #define CHIPREV_ID_5714_A2 0x9002 |
110 | #define CHIPREV_ID_5906_A1 0xc001 | 110 | #define CHIPREV_ID_5906_A1 0xc001 |
111 | #define CHIPREV_ID_5784_A0 0x5784000 | 111 | #define CHIPREV_ID_5784_A0 0x5784000 |
112 | #define CHIPREV_ID_5784_A1 0x5784001 | ||
113 | #define CHIPREV_ID_5761_A0 0x5761000 | ||
114 | #define CHIPREV_ID_5761_A1 0x5761001 | ||
112 | #define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) | 115 | #define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) |
113 | #define ASIC_REV_5700 0x07 | 116 | #define ASIC_REV_5700 0x07 |
114 | #define ASIC_REV_5701 0x00 | 117 | #define ASIC_REV_5701 0x00 |
@@ -856,7 +859,31 @@ | |||
856 | #define CPMU_CTRL_LINK_IDLE_MODE 0x00000200 | 859 | #define CPMU_CTRL_LINK_IDLE_MODE 0x00000200 |
857 | #define CPMU_CTRL_LINK_AWARE_MODE 0x00000400 | 860 | #define CPMU_CTRL_LINK_AWARE_MODE 0x00000400 |
858 | #define CPMU_CTRL_LINK_SPEED_MODE 0x00004000 | 861 | #define CPMU_CTRL_LINK_SPEED_MODE 0x00004000 |
859 | /* 0x3604 --> 0x365c unused */ | 862 | #define TG3_CPMU_LSPD_10MB_CLK 0x00003604 |
863 | #define CPMU_LSPD_10MB_MACCLK_MASK 0x001f0000 | ||
864 | #define CPMU_LSPD_10MB_MACCLK_6_25 0x00130000 | ||
865 | /* 0x3608 --> 0x360c unused */ | ||
866 | |||
867 | #define TG3_CPMU_LSPD_1000MB_CLK 0x0000360c | ||
868 | #define CPMU_LSPD_1000MB_MACCLK_62_5 0x00000000 | ||
869 | #define CPMU_LSPD_1000MB_MACCLK_12_5 0x00110000 | ||
870 | #define CPMU_LSPD_1000MB_MACCLK_MASK 0x001f0000 | ||
871 | #define TG3_CPMU_LNK_AWARE_PWRMD 0x00003610 | ||
872 | #define CPMU_LNK_AWARE_MACCLK_MASK 0x001f0000 | ||
873 | #define CPMU_LNK_AWARE_MACCLK_6_25 0x00130000 | ||
874 | /* 0x3614 --> 0x361c unused */ | ||
875 | |||
876 | #define TG3_CPMU_HST_ACC 0x0000361c | ||
877 | #define CPMU_HST_ACC_MACCLK_MASK 0x001f0000 | ||
878 | #define CPMU_HST_ACC_MACCLK_6_25 0x00130000 | ||
879 | /* 0x3620 --> 0x3630 unused */ | ||
880 | |||
881 | #define TG3_CPMU_CLCK_STAT 0x00003630 | ||
882 | #define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000 | ||
883 | #define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 | ||
884 | #define CPMU_CLCK_STAT_MAC_CLCK_12_5 0x00110000 | ||
885 | #define CPMU_CLCK_STAT_MAC_CLCK_6_25 0x00130000 | ||
886 | /* 0x3634 --> 0x365c unused */ | ||
860 | 887 | ||
861 | #define TG3_CPMU_MUTEX_REQ 0x0000365c | 888 | #define TG3_CPMU_MUTEX_REQ 0x0000365c |
862 | #define CPMU_MUTEX_REQ_DRIVER 0x00001000 | 889 | #define CPMU_MUTEX_REQ_DRIVER 0x00001000 |
@@ -1537,6 +1564,12 @@ | |||
1537 | #define TG3_EEPROM_MAGIC 0x669955aa | 1564 | #define TG3_EEPROM_MAGIC 0x669955aa |
1538 | #define TG3_EEPROM_MAGIC_FW 0xa5000000 | 1565 | #define TG3_EEPROM_MAGIC_FW 0xa5000000 |
1539 | #define TG3_EEPROM_MAGIC_FW_MSK 0xff000000 | 1566 | #define TG3_EEPROM_MAGIC_FW_MSK 0xff000000 |
1567 | #define TG3_EEPROM_SB_FORMAT_MASK 0x00e00000 | ||
1568 | #define TG3_EEPROM_SB_FORMAT_1 0x00200000 | ||
1569 | #define TG3_EEPROM_SB_REVISION_MASK 0x001f0000 | ||
1570 | #define TG3_EEPROM_SB_REVISION_0 0x00000000 | ||
1571 | #define TG3_EEPROM_SB_REVISION_2 0x00020000 | ||
1572 | #define TG3_EEPROM_SB_REVISION_3 0x00030000 | ||
1540 | #define TG3_EEPROM_MAGIC_HW 0xabcd | 1573 | #define TG3_EEPROM_MAGIC_HW 0xabcd |
1541 | #define TG3_EEPROM_MAGIC_HW_MSK 0xffff | 1574 | #define TG3_EEPROM_MAGIC_HW_MSK 0xffff |
1542 | 1575 | ||
@@ -1691,6 +1724,12 @@ | |||
1691 | #define MII_TG3_ISTAT 0x1a /* IRQ status register */ | 1724 | #define MII_TG3_ISTAT 0x1a /* IRQ status register */ |
1692 | #define MII_TG3_IMASK 0x1b /* IRQ mask register */ | 1725 | #define MII_TG3_IMASK 0x1b /* IRQ mask register */ |
1693 | 1726 | ||
1727 | #define MII_TG3_MISC_SHDW 0x1c | ||
1728 | #define MII_TG3_MISC_SHDW_WREN 0x8000 | ||
1729 | #define MII_TG3_MISC_SHDW_APD_SEL 0x2800 | ||
1730 | |||
1731 | #define MII_TG3_MISC_SHDW_APD_WKTM_84MS 0x0001 | ||
1732 | |||
1694 | /* ISTAT/IMASK event bits */ | 1733 | /* ISTAT/IMASK event bits */ |
1695 | #define MII_TG3_INT_LINKCHG 0x0002 | 1734 | #define MII_TG3_INT_LINKCHG 0x0002 |
1696 | #define MII_TG3_INT_SPEEDCHG 0x0004 | 1735 | #define MII_TG3_INT_SPEEDCHG 0x0004 |
@@ -1747,6 +1786,8 @@ | |||
1747 | /* APE convenience enumerations. */ | 1786 | /* APE convenience enumerations. */ |
1748 | #define TG3_APE_LOCK_MEM 4 | 1787 | #define TG3_APE_LOCK_MEM 4 |
1749 | 1788 | ||
1789 | #define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10 | ||
1790 | |||
1750 | 1791 | ||
1751 | /* There are two ways to manage the TX descriptors on the tigon3. | 1792 | /* There are two ways to manage the TX descriptors on the tigon3. |
1752 | * Either the descriptors are in host DMA'able memory, or they | 1793 | * Either the descriptors are in host DMA'able memory, or they |
@@ -2352,6 +2393,7 @@ struct tg3 { | |||
2352 | u32 tg3_flags3; | 2393 | u32 tg3_flags3; |
2353 | #define TG3_FLG3_NO_NVRAM_ADDR_TRANS 0x00000001 | 2394 | #define TG3_FLG3_NO_NVRAM_ADDR_TRANS 0x00000001 |
2354 | #define TG3_FLG3_ENABLE_APE 0x00000002 | 2395 | #define TG3_FLG3_ENABLE_APE 0x00000002 |
2396 | #define TG3_FLG3_5761_5784_AX_FIXES 0x00000004 | ||
2355 | 2397 | ||
2356 | struct timer_list timer; | 2398 | struct timer_list timer; |
2357 | u16 timer_counter; | 2399 | u16 timer_counter; |
diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig index 49d7a290dbbc..20ac1503021e 100644 --- a/drivers/net/tulip/Kconfig +++ b/drivers/net/tulip/Kconfig | |||
@@ -24,8 +24,7 @@ config DE2104X | |||
24 | will say Y here.) Do read the Ethernet-HOWTO, available from | 24 | will say Y here.) Do read the Ethernet-HOWTO, available from |
25 | <http://www.tldp.org/docs.html#howto>. | 25 | <http://www.tldp.org/docs.html#howto>. |
26 | 26 | ||
27 | To compile this driver as a module, choose M here and read | 27 | To compile this driver as a module, choose M here. The module will |
28 | <file:Documentation/networking/net-modules.txt>. The module will | ||
29 | be called de2104x. | 28 | be called de2104x. |
30 | 29 | ||
31 | config TULIP | 30 | config TULIP |
@@ -42,8 +41,7 @@ config TULIP | |||
42 | will say Y here.) Do read the Ethernet-HOWTO, available from | 41 | will say Y here.) Do read the Ethernet-HOWTO, available from |
43 | <http://www.tldp.org/docs.html#howto>. | 42 | <http://www.tldp.org/docs.html#howto>. |
44 | 43 | ||
45 | To compile this driver as a module, choose M here and read | 44 | To compile this driver as a module, choose M here. The module will |
46 | <file:Documentation/networking/net-modules.txt>. The module will | ||
47 | be called tulip. | 45 | be called tulip. |
48 | 46 | ||
49 | config TULIP_MWI | 47 | config TULIP_MWI |
@@ -104,8 +102,7 @@ config DE4X5 | |||
104 | information is contained in | 102 | information is contained in |
105 | <file:Documentation/networking/de4x5.txt>. | 103 | <file:Documentation/networking/de4x5.txt>. |
106 | 104 | ||
107 | To compile this driver as a module, choose M here and read | 105 | To compile this driver as a module, choose M here. The module will |
108 | <file:Documentation/networking/net-modules.txt>. The module will | ||
109 | be called de4x5. | 106 | be called de4x5. |
110 | 107 | ||
111 | config WINBOND_840 | 108 | config WINBOND_840 |
@@ -129,8 +126,7 @@ config DM9102 | |||
129 | (Ethernet) card, say Y. Some information is contained in the file | 126 | (Ethernet) card, say Y. Some information is contained in the file |
130 | <file:Documentation/networking/dmfe.txt>. | 127 | <file:Documentation/networking/dmfe.txt>. |
131 | 128 | ||
132 | To compile this driver as a module, choose M here and read | 129 | To compile this driver as a module, choose M here. The module will |
133 | <file:Documentation/networking/net-modules.txt>. The module will | ||
134 | be called dmfe. | 130 | be called dmfe. |
135 | 131 | ||
136 | config ULI526X | 132 | config ULI526X |
@@ -141,8 +137,7 @@ config ULI526X | |||
141 | This driver is for ULi M5261/M5263 10/100M Ethernet Controller | 137 | This driver is for ULi M5261/M5263 10/100M Ethernet Controller |
142 | (<http://www.uli.com.tw/>). | 138 | (<http://www.uli.com.tw/>). |
143 | 139 | ||
144 | To compile this driver as a module, choose M here and read | 140 | To compile this driver as a module, choose M here. The module will |
145 | <file:Documentation/networking/net-modules.txt>. The module will | ||
146 | be called uli526x. | 141 | be called uli526x. |
147 | 142 | ||
148 | config PCMCIA_XIRCOM | 143 | config PCMCIA_XIRCOM |
@@ -154,8 +149,7 @@ config PCMCIA_XIRCOM | |||
154 | as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and | 149 | as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and |
155 | ASIX. | 150 | ASIX. |
156 | 151 | ||
157 | To compile this driver as a module, choose M here and read | 152 | To compile this driver as a module, choose M here. The module will |
158 | <file:Documentation/networking/net-modules.txt>. The module will | ||
159 | be called xircom_cb. If unsure, say N. | 153 | be called xircom_cb. If unsure, say N. |
160 | 154 | ||
161 | config PCMCIA_XIRTULIP | 155 | config PCMCIA_XIRTULIP |
@@ -168,8 +162,7 @@ config PCMCIA_XIRTULIP | |||
168 | as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and | 162 | as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and |
169 | ASIX. | 163 | ASIX. |
170 | 164 | ||
171 | To compile this driver as a module, choose M here and read | 165 | To compile this driver as a module, choose M here. The module will |
172 | <file:Documentation/networking/net-modules.txt>. The module will | ||
173 | be called xircom_tulip_cb. If unsure, say N. | 166 | be called xircom_tulip_cb. If unsure, say N. |
174 | 167 | ||
175 | endif # NET_TULIP | 168 | endif # NET_TULIP |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 9741d613ba6f..a3ff270593f1 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -2214,9 +2214,7 @@ static void ucc_geth_set_multi(struct net_device *dev) | |||
2214 | struct dev_mc_list *dmi; | 2214 | struct dev_mc_list *dmi; |
2215 | struct ucc_fast *uf_regs; | 2215 | struct ucc_fast *uf_regs; |
2216 | struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt; | 2216 | struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt; |
2217 | u8 tempaddr[6]; | 2217 | int i; |
2218 | u8 *mcptr, *tdptr; | ||
2219 | int i, j; | ||
2220 | 2218 | ||
2221 | ugeth = netdev_priv(dev); | 2219 | ugeth = netdev_priv(dev); |
2222 | 2220 | ||
@@ -2255,19 +2253,10 @@ static void ucc_geth_set_multi(struct net_device *dev) | |||
2255 | if (!(dmi->dmi_addr[0] & 1)) | 2253 | if (!(dmi->dmi_addr[0] & 1)) |
2256 | continue; | 2254 | continue; |
2257 | 2255 | ||
2258 | /* The address in dmi_addr is LSB first, | ||
2259 | * and taddr is MSB first. We have to | ||
2260 | * copy bytes MSB first from dmi_addr. | ||
2261 | */ | ||
2262 | mcptr = (u8 *) dmi->dmi_addr + 5; | ||
2263 | tdptr = (u8 *) tempaddr; | ||
2264 | for (j = 0; j < 6; j++) | ||
2265 | *tdptr++ = *mcptr--; | ||
2266 | |||
2267 | /* Ask CPM to run CRC and set bit in | 2256 | /* Ask CPM to run CRC and set bit in |
2268 | * filter mask. | 2257 | * filter mask. |
2269 | */ | 2258 | */ |
2270 | hw_add_addr_in_hash(ugeth, tempaddr); | 2259 | hw_add_addr_in_hash(ugeth, dmi->dmi_addr); |
2271 | } | 2260 | } |
2272 | } | 2261 | } |
2273 | } | 2262 | } |
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 5a96d74e4ce8..a12c9c41b217 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
@@ -93,13 +93,9 @@ config USB_RTL8150 | |||
93 | To compile this driver as a module, choose M here: the | 93 | To compile this driver as a module, choose M here: the |
94 | module will be called rtl8150. | 94 | module will be called rtl8150. |
95 | 95 | ||
96 | config USB_USBNET_MII | ||
97 | tristate | ||
98 | default n | ||
99 | |||
100 | config USB_USBNET | 96 | config USB_USBNET |
101 | tristate "Multi-purpose USB Networking Framework" | 97 | tristate "Multi-purpose USB Networking Framework" |
102 | select MII if USB_USBNET_MII != n | 98 | select MII |
103 | ---help--- | 99 | ---help--- |
104 | This driver supports several kinds of network links over USB, | 100 | This driver supports several kinds of network links over USB, |
105 | with "minidrivers" built around a common network driver core | 101 | with "minidrivers" built around a common network driver core |
@@ -135,7 +131,6 @@ config USB_NET_AX8817X | |||
135 | tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" | 131 | tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" |
136 | depends on USB_USBNET && NET_ETHERNET | 132 | depends on USB_USBNET && NET_ETHERNET |
137 | select CRC32 | 133 | select CRC32 |
138 | select USB_USBNET_MII | ||
139 | default y | 134 | default y |
140 | help | 135 | help |
141 | This option adds support for ASIX AX88xxx based USB 2.0 | 136 | This option adds support for ASIX AX88xxx based USB 2.0 |
@@ -190,7 +185,6 @@ config USB_NET_DM9601 | |||
190 | tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices" | 185 | tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices" |
191 | depends on USB_USBNET | 186 | depends on USB_USBNET |
192 | select CRC32 | 187 | select CRC32 |
193 | select USB_USBNET_MII | ||
194 | help | 188 | help |
195 | This option adds support for Davicom DM9601 based USB 1.1 | 189 | This option adds support for Davicom DM9601 based USB 1.1 |
196 | 10/100 Ethernet adapters. | 190 | 10/100 Ethernet adapters. |
@@ -225,7 +219,6 @@ config USB_NET_PLUSB | |||
225 | config USB_NET_MCS7830 | 219 | config USB_NET_MCS7830 |
226 | tristate "MosChip MCS7830 based Ethernet adapters" | 220 | tristate "MosChip MCS7830 based Ethernet adapters" |
227 | depends on USB_USBNET | 221 | depends on USB_USBNET |
228 | select USB_USBNET_MII | ||
229 | help | 222 | help |
230 | Choose this option if you're using a 10/100 Ethernet USB2 | 223 | Choose this option if you're using a 10/100 Ethernet USB2 |
231 | adapter based on the MosChip 7830 controller. This includes | 224 | adapter based on the MosChip 7830 controller. This includes |
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index a2de32fabc17..2c685734b7a4 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
@@ -586,6 +586,10 @@ static const struct usb_device_id products[] = { | |||
586 | USB_DEVICE(0x0a46, 0x0268), /* ShanTou ST268 USB NIC */ | 586 | USB_DEVICE(0x0a46, 0x0268), /* ShanTou ST268 USB NIC */ |
587 | .driver_info = (unsigned long)&dm9601_info, | 587 | .driver_info = (unsigned long)&dm9601_info, |
588 | }, | 588 | }, |
589 | { | ||
590 | USB_DEVICE(0x0a46, 0x8515), /* ADMtek ADM8515 USB NIC */ | ||
591 | .driver_info = (unsigned long)&dm9601_info, | ||
592 | }, | ||
589 | {}, // END | 593 | {}, // END |
590 | }; | 594 | }; |
591 | 595 | ||
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index acd5f1c0e63a..8ed1fc5cbc70 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -683,9 +683,6 @@ done_nopm: | |||
683 | * they'll probably want to use this base set. | 683 | * they'll probably want to use this base set. |
684 | */ | 684 | */ |
685 | 685 | ||
686 | #if defined(CONFIG_MII) || defined(CONFIG_MII_MODULE) | ||
687 | #define HAVE_MII | ||
688 | |||
689 | int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) | 686 | int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) |
690 | { | 687 | { |
691 | struct usbnet *dev = netdev_priv(net); | 688 | struct usbnet *dev = netdev_priv(net); |
@@ -744,8 +741,6 @@ int usbnet_nway_reset(struct net_device *net) | |||
744 | } | 741 | } |
745 | EXPORT_SYMBOL_GPL(usbnet_nway_reset); | 742 | EXPORT_SYMBOL_GPL(usbnet_nway_reset); |
746 | 743 | ||
747 | #endif /* HAVE_MII */ | ||
748 | |||
749 | void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) | 744 | void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) |
750 | { | 745 | { |
751 | struct usbnet *dev = netdev_priv(net); | 746 | struct usbnet *dev = netdev_priv(net); |
@@ -776,12 +771,10 @@ EXPORT_SYMBOL_GPL(usbnet_set_msglevel); | |||
776 | 771 | ||
777 | /* drivers may override default ethtool_ops in their bind() routine */ | 772 | /* drivers may override default ethtool_ops in their bind() routine */ |
778 | static struct ethtool_ops usbnet_ethtool_ops = { | 773 | static struct ethtool_ops usbnet_ethtool_ops = { |
779 | #ifdef HAVE_MII | ||
780 | .get_settings = usbnet_get_settings, | 774 | .get_settings = usbnet_get_settings, |
781 | .set_settings = usbnet_set_settings, | 775 | .set_settings = usbnet_set_settings, |
782 | .get_link = usbnet_get_link, | 776 | .get_link = usbnet_get_link, |
783 | .nway_reset = usbnet_nway_reset, | 777 | .nway_reset = usbnet_nway_reset, |
784 | #endif | ||
785 | .get_drvinfo = usbnet_get_drvinfo, | 778 | .get_drvinfo = usbnet_get_drvinfo, |
786 | .get_msglevel = usbnet_get_msglevel, | 779 | .get_msglevel = usbnet_get_msglevel, |
787 | .set_msglevel = usbnet_set_msglevel, | 780 | .set_msglevel = usbnet_set_msglevel, |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 5c4a92de9a07..450e29d7a9f3 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -1963,6 +1963,11 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu) | |||
1963 | return -EINVAL; | 1963 | return -EINVAL; |
1964 | } | 1964 | } |
1965 | 1965 | ||
1966 | if (!netif_running(dev)) { | ||
1967 | dev->mtu = new_mtu; | ||
1968 | return 0; | ||
1969 | } | ||
1970 | |||
1966 | if (new_mtu != oldmtu) { | 1971 | if (new_mtu != oldmtu) { |
1967 | spin_lock_irqsave(&vptr->lock, flags); | 1972 | spin_lock_irqsave(&vptr->lock, flags); |
1968 | 1973 | ||
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index e396c9d2af8d..5413dbf3d4ac 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -146,6 +146,7 @@ static void try_fill_recv(struct virtnet_info *vi) | |||
146 | struct scatterlist sg[1+MAX_SKB_FRAGS]; | 146 | struct scatterlist sg[1+MAX_SKB_FRAGS]; |
147 | int num, err; | 147 | int num, err; |
148 | 148 | ||
149 | sg_init_table(sg, 1+MAX_SKB_FRAGS); | ||
149 | for (;;) { | 150 | for (;;) { |
150 | skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN); | 151 | skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN); |
151 | if (unlikely(!skb)) | 152 | if (unlikely(!skb)) |
@@ -197,8 +198,8 @@ again: | |||
197 | if (vi->num < vi->max / 2) | 198 | if (vi->num < vi->max / 2) |
198 | try_fill_recv(vi); | 199 | try_fill_recv(vi); |
199 | 200 | ||
200 | /* All done? */ | 201 | /* Out of packets? */ |
201 | if (!skb) { | 202 | if (received < budget) { |
202 | netif_rx_complete(vi->dev, napi); | 203 | netif_rx_complete(vi->dev, napi); |
203 | if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) | 204 | if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) |
204 | && netif_rx_reschedule(vi->dev, napi)) | 205 | && netif_rx_reschedule(vi->dev, napi)) |
@@ -231,6 +232,8 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
231 | const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest; | 232 | const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest; |
232 | DECLARE_MAC_BUF(mac); | 233 | DECLARE_MAC_BUF(mac); |
233 | 234 | ||
235 | sg_init_table(sg, 1+MAX_SKB_FRAGS); | ||
236 | |||
234 | pr_debug("%s: xmit %p %s\n", dev->name, skb, print_mac(mac, dest)); | 237 | pr_debug("%s: xmit %p %s\n", dev->name, skb, print_mac(mac, dest)); |
235 | 238 | ||
236 | free_old_xmit_skbs(vi); | 239 | free_old_xmit_skbs(vi); |
@@ -401,8 +404,12 @@ free: | |||
401 | 404 | ||
402 | static void virtnet_remove(struct virtio_device *vdev) | 405 | static void virtnet_remove(struct virtio_device *vdev) |
403 | { | 406 | { |
404 | unregister_netdev(vdev->priv); | 407 | struct virtnet_info *vi = vdev->priv; |
405 | 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); | ||
406 | } | 413 | } |
407 | 414 | ||
408 | static struct virtio_device_id id_table[] = { | 415 | static struct virtio_device_id id_table[] = { |
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index 5ea877221f46..37c52e131750 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c | |||
@@ -142,9 +142,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
142 | * To date internally, just copy this out to the user. | 142 | * To date internally, just copy this out to the user. |
143 | */ | 143 | */ |
144 | case LMCIOCGINFO: /*fold01*/ | 144 | case LMCIOCGINFO: /*fold01*/ |
145 | if (copy_to_user(ifr->ifr_data, &sc->ictl, sizeof (lmc_ctl_t))) | 145 | if (copy_to_user(ifr->ifr_data, &sc->ictl, sizeof(lmc_ctl_t))) |
146 | return -EFAULT; | 146 | ret = -EFAULT; |
147 | ret = 0; | 147 | else |
148 | ret = 0; | ||
148 | break; | 149 | break; |
149 | 150 | ||
150 | case LMCIOCSINFO: /*fold01*/ | 151 | case LMCIOCSINFO: /*fold01*/ |
@@ -159,8 +160,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
159 | break; | 160 | break; |
160 | } | 161 | } |
161 | 162 | ||
162 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t))) | 163 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof(lmc_ctl_t))) { |
163 | return -EFAULT; | 164 | ret = -EFAULT; |
165 | break; | ||
166 | } | ||
164 | 167 | ||
165 | sc->lmc_media->set_status (sc, &ctl); | 168 | sc->lmc_media->set_status (sc, &ctl); |
166 | 169 | ||
@@ -190,8 +193,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
190 | break; | 193 | break; |
191 | } | 194 | } |
192 | 195 | ||
193 | if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u_int16_t))) | 196 | if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u_int16_t))) { |
194 | return -EFAULT; | 197 | ret = -EFAULT; |
198 | break; | ||
199 | } | ||
195 | 200 | ||
196 | 201 | ||
197 | if (new_type == old_type) | 202 | if (new_type == old_type) |
@@ -229,9 +234,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
229 | sc->lmc_xinfo.Magic1 = 0xDEADBEEF; | 234 | sc->lmc_xinfo.Magic1 = 0xDEADBEEF; |
230 | 235 | ||
231 | if (copy_to_user(ifr->ifr_data, &sc->lmc_xinfo, | 236 | if (copy_to_user(ifr->ifr_data, &sc->lmc_xinfo, |
232 | sizeof (struct lmc_xinfo))) | 237 | sizeof(struct lmc_xinfo))) |
233 | return -EFAULT; | 238 | ret = -EFAULT; |
234 | ret = 0; | 239 | else |
240 | ret = 0; | ||
235 | 241 | ||
236 | break; | 242 | break; |
237 | 243 | ||
@@ -262,9 +268,9 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
262 | 268 | ||
263 | if (copy_to_user(ifr->ifr_data, &sc->stats, | 269 | if (copy_to_user(ifr->ifr_data, &sc->stats, |
264 | sizeof (struct lmc_statistics))) | 270 | sizeof (struct lmc_statistics))) |
265 | return -EFAULT; | 271 | ret = -EFAULT; |
266 | 272 | else | |
267 | ret = 0; | 273 | ret = 0; |
268 | break; | 274 | break; |
269 | 275 | ||
270 | case LMCIOCCLEARLMCSTATS: /*fold01*/ | 276 | case LMCIOCCLEARLMCSTATS: /*fold01*/ |
@@ -292,8 +298,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
292 | break; | 298 | break; |
293 | } | 299 | } |
294 | 300 | ||
295 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t))) | 301 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof(lmc_ctl_t))) { |
296 | return -EFAULT; | 302 | ret = -EFAULT; |
303 | break; | ||
304 | } | ||
297 | sc->lmc_media->set_circuit_type(sc, ctl.circuit_type); | 305 | sc->lmc_media->set_circuit_type(sc, ctl.circuit_type); |
298 | sc->ictl.circuit_type = ctl.circuit_type; | 306 | sc->ictl.circuit_type = ctl.circuit_type; |
299 | ret = 0; | 307 | ret = 0; |
@@ -318,12 +326,15 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
318 | 326 | ||
319 | #ifdef DEBUG | 327 | #ifdef DEBUG |
320 | case LMCIOCDUMPEVENTLOG: | 328 | case LMCIOCDUMPEVENTLOG: |
321 | if (copy_to_user(ifr->ifr_data, &lmcEventLogIndex, sizeof (u32))) | 329 | if (copy_to_user(ifr->ifr_data, &lmcEventLogIndex, sizeof(u32))) { |
322 | return -EFAULT; | 330 | ret = -EFAULT; |
331 | break; | ||
332 | } | ||
323 | if (copy_to_user(ifr->ifr_data + sizeof (u32), lmcEventLogBuf, sizeof (lmcEventLogBuf))) | 333 | if (copy_to_user(ifr->ifr_data + sizeof (u32), lmcEventLogBuf, sizeof (lmcEventLogBuf))) |
324 | return -EFAULT; | 334 | ret = -EFAULT; |
335 | else | ||
336 | ret = 0; | ||
325 | 337 | ||
326 | ret = 0; | ||
327 | break; | 338 | break; |
328 | #endif /* end ifdef _DBG_EVENTLOG */ | 339 | #endif /* end ifdef _DBG_EVENTLOG */ |
329 | case LMCIOCT1CONTROL: /*fold01*/ | 340 | case LMCIOCT1CONTROL: /*fold01*/ |
@@ -346,8 +357,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
346 | */ | 357 | */ |
347 | netif_stop_queue(dev); | 358 | netif_stop_queue(dev); |
348 | 359 | ||
349 | if (copy_from_user(&xc, ifr->ifr_data, sizeof (struct lmc_xilinx_control))) | 360 | if (copy_from_user(&xc, ifr->ifr_data, sizeof(struct lmc_xilinx_control))) { |
350 | return -EFAULT; | 361 | ret = -EFAULT; |
362 | break; | ||
363 | } | ||
351 | switch(xc.command){ | 364 | switch(xc.command){ |
352 | case lmc_xilinx_reset: /*fold02*/ | 365 | case lmc_xilinx_reset: /*fold02*/ |
353 | { | 366 | { |
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index c48b1cc63fd5..1e89d4de1bb7 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
@@ -719,12 +719,8 @@ static int x25_asy_ioctl(struct tty_struct *tty, struct file *file, | |||
719 | return 0; | 719 | return 0; |
720 | case SIOCSIFHWADDR: | 720 | case SIOCSIFHWADDR: |
721 | return -EINVAL; | 721 | return -EINVAL; |
722 | /* Allow stty to read, but not set, the serial port */ | ||
723 | case TCGETS: | ||
724 | case TCGETA: | ||
725 | return n_tty_ioctl(tty, file, cmd, arg); | ||
726 | default: | 722 | default: |
727 | return -ENOIOCTLCMD; | 723 | return tty_mode_ioctl(tty, file, cmd, arg); |
728 | } | 724 | } |
729 | } | 725 | } |
730 | 726 | ||
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index dae5c8d5a318..2b733c582915 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -325,7 +325,7 @@ config HERMES | |||
325 | Cabletron/EnteraSys Roamabout, ELSA AirLancer, MELCO Buffalo, Avaya, | 325 | Cabletron/EnteraSys Roamabout, ELSA AirLancer, MELCO Buffalo, Avaya, |
326 | IBM High Rate Wireless, Farralon Syyline, Samsung MagicLAN, Netgear | 326 | IBM High Rate Wireless, Farralon Syyline, Samsung MagicLAN, Netgear |
327 | MA401, LinkSys WPC-11, D-Link DWL-650, 3Com AirConnect, Intel | 327 | MA401, LinkSys WPC-11, D-Link DWL-650, 3Com AirConnect, Intel |
328 | PRO/Wireless, and Symbol Spectrum24 High Rate amongst others. | 328 | IPW2011, and Symbol Spectrum24 High Rate amongst others. |
329 | 329 | ||
330 | This option includes the guts of the driver, but in order to | 330 | This option includes the guts of the driver, but in order to |
331 | actually use a card you will also need to enable support for PCMCIA | 331 | actually use a card you will also need to enable support for PCMCIA |
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index e3c573e56b63..fdbc351ac333 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -61,16 +61,18 @@ config B43_PCMCIA | |||
61 | 61 | ||
62 | If unsure, say N. | 62 | If unsure, say N. |
63 | 63 | ||
64 | # LED support | 64 | # This config option automatically enables b43 LEDS support, |
65 | # if it's possible. | ||
65 | config B43_LEDS | 66 | config B43_LEDS |
66 | bool | 67 | bool |
67 | depends on B43 && MAC80211_LEDS | 68 | depends on B43 && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43) |
68 | default y | 69 | default y |
69 | 70 | ||
70 | # RFKILL support | 71 | # This config option automatically enables b43 RFKILL support, |
72 | # if it's possible. | ||
71 | config B43_RFKILL | 73 | config B43_RFKILL |
72 | bool | 74 | bool |
73 | depends on B43 && RFKILL && RFKILL_INPUT && INPUT_POLLDEV | 75 | depends on B43 && (RFKILL = y || RFKILL = B43) && RFKILL_INPUT && (INPUT_POLLDEV = y || INPUT_POLLDEV = B43) |
74 | default y | 76 | default y |
75 | 77 | ||
76 | config B43_DEBUG | 78 | config B43_DEBUG |
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index 734e70e1a06d..ef0075d9f9cb 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -128,7 +128,7 @@ static ssize_t shm_read_file(struct b43_wldev *dev, | |||
128 | __le16 *le16buf = (__le16 *)buf; | 128 | __le16 *le16buf = (__le16 *)buf; |
129 | 129 | ||
130 | for (i = 0; i < 0x1000; i++) { | 130 | for (i = 0; i < 0x1000; i++) { |
131 | if (bufsize <= 0) | 131 | if (bufsize < sizeof(tmp)) |
132 | break; | 132 | break; |
133 | tmp = b43_shm_read16(dev, B43_SHM_SHARED, 2 * i); | 133 | tmp = b43_shm_read16(dev, B43_SHM_SHARED, 2 * i); |
134 | le16buf[i] = cpu_to_le16(tmp); | 134 | le16buf[i] = cpu_to_le16(tmp); |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 9d9ff76a9bc6..2b17c1dc46f1 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -2391,7 +2391,7 @@ out_requeue: | |||
2391 | if (b43_debug(dev, B43_DBG_PWORK_FAST)) | 2391 | if (b43_debug(dev, B43_DBG_PWORK_FAST)) |
2392 | delay = msecs_to_jiffies(50); | 2392 | delay = msecs_to_jiffies(50); |
2393 | else | 2393 | else |
2394 | delay = round_jiffies(HZ * 15); | 2394 | delay = round_jiffies_relative(HZ * 15); |
2395 | queue_delayed_work(wl->hw->workqueue, &dev->periodic_work, delay); | 2395 | queue_delayed_work(wl->hw->workqueue, &dev->periodic_work, delay); |
2396 | out: | 2396 | out: |
2397 | mutex_unlock(&wl->mutex); | 2397 | mutex_unlock(&wl->mutex); |
@@ -2985,6 +2985,16 @@ static void b43_wireless_core_stop(struct b43_wldev *dev) | |||
2985 | 2985 | ||
2986 | if (b43_status(dev) < B43_STAT_STARTED) | 2986 | if (b43_status(dev) < B43_STAT_STARTED) |
2987 | return; | 2987 | return; |
2988 | |||
2989 | /* Disable and sync interrupts. We must do this before than | ||
2990 | * setting the status to INITIALIZED, as the interrupt handler | ||
2991 | * won't care about IRQs then. */ | ||
2992 | spin_lock_irqsave(&wl->irq_lock, flags); | ||
2993 | dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL); | ||
2994 | b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* flush */ | ||
2995 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
2996 | b43_synchronize_irq(dev); | ||
2997 | |||
2988 | b43_set_status(dev, B43_STAT_INITIALIZED); | 2998 | b43_set_status(dev, B43_STAT_INITIALIZED); |
2989 | 2999 | ||
2990 | mutex_unlock(&wl->mutex); | 3000 | mutex_unlock(&wl->mutex); |
@@ -2995,13 +3005,6 @@ static void b43_wireless_core_stop(struct b43_wldev *dev) | |||
2995 | 3005 | ||
2996 | ieee80211_stop_queues(wl->hw); //FIXME this could cause a deadlock, as mac80211 seems buggy. | 3006 | ieee80211_stop_queues(wl->hw); //FIXME this could cause a deadlock, as mac80211 seems buggy. |
2997 | 3007 | ||
2998 | /* Disable and sync interrupts. */ | ||
2999 | spin_lock_irqsave(&wl->irq_lock, flags); | ||
3000 | dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL); | ||
3001 | b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* flush */ | ||
3002 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
3003 | b43_synchronize_irq(dev); | ||
3004 | |||
3005 | b43_mac_suspend(dev); | 3008 | b43_mac_suspend(dev); |
3006 | free_irq(dev->dev->irq, dev); | 3009 | free_irq(dev->dev->irq, dev); |
3007 | b43dbg(wl, "Wireless interface stopped\n"); | 3010 | b43dbg(wl, "Wireless interface stopped\n"); |
@@ -3661,7 +3664,6 @@ static int b43_setup_modes(struct b43_wldev *dev, | |||
3661 | 3664 | ||
3662 | static void b43_wireless_core_detach(struct b43_wldev *dev) | 3665 | static void b43_wireless_core_detach(struct b43_wldev *dev) |
3663 | { | 3666 | { |
3664 | b43_rfkill_free(dev); | ||
3665 | /* We release firmware that late to not be required to re-request | 3667 | /* We release firmware that late to not be required to re-request |
3666 | * is all the time when we reinit the core. */ | 3668 | * is all the time when we reinit the core. */ |
3667 | b43_release_firmware(dev); | 3669 | b43_release_firmware(dev); |
@@ -3747,7 +3749,6 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
3747 | if (!wl->current_dev) | 3749 | if (!wl->current_dev) |
3748 | wl->current_dev = dev; | 3750 | wl->current_dev = dev; |
3749 | INIT_WORK(&dev->restart_work, b43_chip_reset); | 3751 | INIT_WORK(&dev->restart_work, b43_chip_reset); |
3750 | b43_rfkill_alloc(dev); | ||
3751 | 3752 | ||
3752 | b43_radio_turn_off(dev, 1); | 3753 | b43_radio_turn_off(dev, 1); |
3753 | b43_switch_analog(dev, 0); | 3754 | b43_switch_analog(dev, 0); |
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index b242a9a90dd2..b79a6bd5396d 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -65,12 +65,12 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
65 | tuple_t tuple; | 65 | tuple_t tuple; |
66 | cisparse_t parse; | 66 | cisparse_t parse; |
67 | int err = -ENOMEM; | 67 | int err = -ENOMEM; |
68 | int res; | 68 | int res = 0; |
69 | unsigned char buf[64]; | 69 | unsigned char buf[64]; |
70 | 70 | ||
71 | ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); | 71 | ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); |
72 | if (!ssb) | 72 | if (!ssb) |
73 | goto out; | 73 | goto out_error; |
74 | 74 | ||
75 | err = -ENODEV; | 75 | err = -ENODEV; |
76 | tuple.DesiredTuple = CISTPL_CONFIG; | 76 | tuple.DesiredTuple = CISTPL_CONFIG; |
@@ -96,10 +96,12 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
96 | dev->io.NumPorts2 = 0; | 96 | dev->io.NumPorts2 = 0; |
97 | dev->io.Attributes2 = 0; | 97 | dev->io.Attributes2 = 0; |
98 | 98 | ||
99 | win.Attributes = WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; | 99 | win.Attributes = WIN_ADDR_SPACE_MEM | WIN_MEMORY_TYPE_CM | |
100 | WIN_ENABLE | WIN_DATA_WIDTH_16 | | ||
101 | WIN_USE_WAIT; | ||
100 | win.Base = 0; | 102 | win.Base = 0; |
101 | win.Size = SSB_CORE_SIZE; | 103 | win.Size = SSB_CORE_SIZE; |
102 | win.AccessSpeed = 1000; | 104 | win.AccessSpeed = 250; |
103 | res = pcmcia_request_window(&dev, &win, &dev->win); | 105 | res = pcmcia_request_window(&dev, &win, &dev->win); |
104 | if (res != CS_SUCCESS) | 106 | if (res != CS_SUCCESS) |
105 | goto err_kfree_ssb; | 107 | goto err_kfree_ssb; |
@@ -108,21 +110,34 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
108 | mem.Page = 0; | 110 | mem.Page = 0; |
109 | res = pcmcia_map_mem_page(dev->win, &mem); | 111 | res = pcmcia_map_mem_page(dev->win, &mem); |
110 | if (res != CS_SUCCESS) | 112 | if (res != CS_SUCCESS) |
111 | goto err_kfree_ssb; | 113 | goto err_disable; |
114 | |||
115 | dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_FIRST_SHARED; | ||
116 | dev->irq.IRQInfo1 = IRQ_LEVEL_ID | IRQ_SHARE_ID; | ||
117 | dev->irq.Handler = NULL; /* The handler is registered later. */ | ||
118 | dev->irq.Instance = NULL; | ||
119 | res = pcmcia_request_irq(dev, &dev->irq); | ||
120 | if (res != CS_SUCCESS) | ||
121 | goto err_disable; | ||
112 | 122 | ||
113 | res = pcmcia_request_configuration(dev, &dev->conf); | 123 | res = pcmcia_request_configuration(dev, &dev->conf); |
114 | if (res != CS_SUCCESS) | 124 | if (res != CS_SUCCESS) |
115 | goto err_disable; | 125 | goto err_disable; |
116 | 126 | ||
117 | err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); | 127 | err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); |
128 | if (err) | ||
129 | goto err_disable; | ||
118 | dev->priv = ssb; | 130 | dev->priv = ssb; |
119 | 131 | ||
120 | out: | 132 | return 0; |
121 | return err; | 133 | |
122 | err_disable: | 134 | err_disable: |
123 | pcmcia_disable_device(dev); | 135 | pcmcia_disable_device(dev); |
124 | err_kfree_ssb: | 136 | err_kfree_ssb: |
125 | kfree(ssb); | 137 | kfree(ssb); |
138 | out_error: | ||
139 | printk(KERN_ERR "b43-pcmcia: Initialization failed (%d, %d)\n", | ||
140 | res, err); | ||
126 | return err; | 141 | return err; |
127 | } | 142 | } |
128 | 143 | ||
@@ -131,22 +146,21 @@ static void __devexit b43_pcmcia_remove(struct pcmcia_device *dev) | |||
131 | struct ssb_bus *ssb = dev->priv; | 146 | struct ssb_bus *ssb = dev->priv; |
132 | 147 | ||
133 | ssb_bus_unregister(ssb); | 148 | ssb_bus_unregister(ssb); |
134 | pcmcia_release_window(dev->win); | ||
135 | pcmcia_disable_device(dev); | 149 | pcmcia_disable_device(dev); |
136 | kfree(ssb); | 150 | kfree(ssb); |
137 | dev->priv = NULL; | 151 | dev->priv = NULL; |
138 | } | 152 | } |
139 | 153 | ||
140 | static struct pcmcia_driver b43_pcmcia_driver = { | 154 | static struct pcmcia_driver b43_pcmcia_driver = { |
141 | .owner = THIS_MODULE, | 155 | .owner = THIS_MODULE, |
142 | .drv = { | 156 | .drv = { |
143 | .name = "b43-pcmcia", | 157 | .name = "b43-pcmcia", |
144 | }, | 158 | }, |
145 | .id_table = b43_pcmcia_tbl, | 159 | .id_table = b43_pcmcia_tbl, |
146 | .probe = b43_pcmcia_probe, | 160 | .probe = b43_pcmcia_probe, |
147 | .remove = b43_pcmcia_remove, | 161 | .remove = __devexit_p(b43_pcmcia_remove), |
148 | .suspend = b43_pcmcia_suspend, | 162 | .suspend = b43_pcmcia_suspend, |
149 | .resume = b43_pcmcia_resume, | 163 | .resume = b43_pcmcia_resume, |
150 | }; | 164 | }; |
151 | 165 | ||
152 | int b43_pcmcia_init(void) | 166 | int b43_pcmcia_init(void) |
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c index 800e0a61a7f5..9b1f905ffbf4 100644 --- a/drivers/net/wireless/b43/rfkill.c +++ b/drivers/net/wireless/b43/rfkill.c | |||
@@ -47,32 +47,35 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev) | |||
47 | struct b43_wldev *dev = poll_dev->private; | 47 | struct b43_wldev *dev = poll_dev->private; |
48 | struct b43_wl *wl = dev->wl; | 48 | struct b43_wl *wl = dev->wl; |
49 | bool enabled; | 49 | bool enabled; |
50 | bool report_change = 0; | ||
50 | 51 | ||
51 | mutex_lock(&wl->mutex); | 52 | mutex_lock(&wl->mutex); |
52 | B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); | 53 | B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); |
53 | enabled = b43_is_hw_radio_enabled(dev); | 54 | enabled = b43_is_hw_radio_enabled(dev); |
54 | if (unlikely(enabled != dev->radio_hw_enable)) { | 55 | if (unlikely(enabled != dev->radio_hw_enable)) { |
55 | dev->radio_hw_enable = enabled; | 56 | dev->radio_hw_enable = enabled; |
57 | report_change = 1; | ||
56 | b43info(wl, "Radio hardware status changed to %s\n", | 58 | b43info(wl, "Radio hardware status changed to %s\n", |
57 | enabled ? "ENABLED" : "DISABLED"); | 59 | enabled ? "ENABLED" : "DISABLED"); |
58 | mutex_unlock(&wl->mutex); | 60 | } |
61 | mutex_unlock(&wl->mutex); | ||
62 | |||
63 | if (unlikely(report_change)) | ||
59 | input_report_key(poll_dev->input, KEY_WLAN, enabled); | 64 | input_report_key(poll_dev->input, KEY_WLAN, enabled); |
60 | } else | ||
61 | mutex_unlock(&wl->mutex); | ||
62 | } | 65 | } |
63 | 66 | ||
64 | /* Called when the RFKILL toggled in software. | 67 | /* Called when the RFKILL toggled in software. */ |
65 | * This is called without locking. */ | ||
66 | static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) | 68 | static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) |
67 | { | 69 | { |
68 | struct b43_wldev *dev = data; | 70 | struct b43_wldev *dev = data; |
69 | struct b43_wl *wl = dev->wl; | 71 | struct b43_wl *wl = dev->wl; |
70 | int err = 0; | 72 | int err = 0; |
71 | 73 | ||
72 | mutex_lock(&wl->mutex); | 74 | if (!wl->rfkill.registered) |
73 | if (b43_status(dev) < B43_STAT_INITIALIZED) | 75 | return 0; |
74 | goto out_unlock; | ||
75 | 76 | ||
77 | mutex_lock(&wl->mutex); | ||
78 | B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); | ||
76 | switch (state) { | 79 | switch (state) { |
77 | case RFKILL_STATE_ON: | 80 | case RFKILL_STATE_ON: |
78 | if (!dev->radio_hw_enable) { | 81 | if (!dev->radio_hw_enable) { |
@@ -89,7 +92,6 @@ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) | |||
89 | b43_radio_turn_off(dev, 0); | 92 | b43_radio_turn_off(dev, 0); |
90 | break; | 93 | break; |
91 | } | 94 | } |
92 | |||
93 | out_unlock: | 95 | out_unlock: |
94 | mutex_unlock(&wl->mutex); | 96 | mutex_unlock(&wl->mutex); |
95 | 97 | ||
@@ -98,11 +100,11 @@ out_unlock: | |||
98 | 100 | ||
99 | char * b43_rfkill_led_name(struct b43_wldev *dev) | 101 | char * b43_rfkill_led_name(struct b43_wldev *dev) |
100 | { | 102 | { |
101 | struct b43_wl *wl = dev->wl; | 103 | struct b43_rfkill *rfk = &(dev->wl->rfkill); |
102 | 104 | ||
103 | if (!wl->rfkill.rfkill) | 105 | if (!rfk->registered) |
104 | return NULL; | 106 | return NULL; |
105 | return rfkill_get_led_name(wl->rfkill.rfkill); | 107 | return rfkill_get_led_name(rfk->rfkill); |
106 | } | 108 | } |
107 | 109 | ||
108 | void b43_rfkill_init(struct b43_wldev *dev) | 110 | void b43_rfkill_init(struct b43_wldev *dev) |
@@ -111,53 +113,13 @@ void b43_rfkill_init(struct b43_wldev *dev) | |||
111 | struct b43_rfkill *rfk = &(wl->rfkill); | 113 | struct b43_rfkill *rfk = &(wl->rfkill); |
112 | int err; | 114 | int err; |
113 | 115 | ||
114 | if (rfk->rfkill) { | 116 | rfk->registered = 0; |
115 | err = rfkill_register(rfk->rfkill); | ||
116 | if (err) { | ||
117 | b43warn(wl, "Failed to register RF-kill button\n"); | ||
118 | goto err_free_rfk; | ||
119 | } | ||
120 | } | ||
121 | if (rfk->poll_dev) { | ||
122 | err = input_register_polled_device(rfk->poll_dev); | ||
123 | if (err) { | ||
124 | b43warn(wl, "Failed to register RF-kill polldev\n"); | ||
125 | goto err_free_polldev; | ||
126 | } | ||
127 | } | ||
128 | |||
129 | return; | ||
130 | err_free_rfk: | ||
131 | rfkill_free(rfk->rfkill); | ||
132 | rfk->rfkill = NULL; | ||
133 | err_free_polldev: | ||
134 | input_free_polled_device(rfk->poll_dev); | ||
135 | rfk->poll_dev = NULL; | ||
136 | } | ||
137 | |||
138 | void b43_rfkill_exit(struct b43_wldev *dev) | ||
139 | { | ||
140 | struct b43_rfkill *rfk = &(dev->wl->rfkill); | ||
141 | |||
142 | if (rfk->poll_dev) | ||
143 | input_unregister_polled_device(rfk->poll_dev); | ||
144 | if (rfk->rfkill) | ||
145 | rfkill_unregister(rfk->rfkill); | ||
146 | } | ||
147 | |||
148 | void b43_rfkill_alloc(struct b43_wldev *dev) | ||
149 | { | ||
150 | struct b43_wl *wl = dev->wl; | ||
151 | struct b43_rfkill *rfk = &(wl->rfkill); | ||
152 | 117 | ||
118 | rfk->rfkill = rfkill_allocate(dev->dev->dev, RFKILL_TYPE_WLAN); | ||
119 | if (!rfk->rfkill) | ||
120 | goto out_error; | ||
153 | snprintf(rfk->name, sizeof(rfk->name), | 121 | snprintf(rfk->name, sizeof(rfk->name), |
154 | "b43-%s", wiphy_name(wl->hw->wiphy)); | 122 | "b43-%s", wiphy_name(wl->hw->wiphy)); |
155 | |||
156 | rfk->rfkill = rfkill_allocate(dev->dev->dev, RFKILL_TYPE_WLAN); | ||
157 | if (!rfk->rfkill) { | ||
158 | b43warn(wl, "Failed to allocate RF-kill button\n"); | ||
159 | return; | ||
160 | } | ||
161 | rfk->rfkill->name = rfk->name; | 123 | rfk->rfkill->name = rfk->name; |
162 | rfk->rfkill->state = RFKILL_STATE_ON; | 124 | rfk->rfkill->state = RFKILL_STATE_ON; |
163 | rfk->rfkill->data = dev; | 125 | rfk->rfkill->data = dev; |
@@ -165,18 +127,45 @@ void b43_rfkill_alloc(struct b43_wldev *dev) | |||
165 | rfk->rfkill->user_claim_unsupported = 1; | 127 | rfk->rfkill->user_claim_unsupported = 1; |
166 | 128 | ||
167 | rfk->poll_dev = input_allocate_polled_device(); | 129 | rfk->poll_dev = input_allocate_polled_device(); |
168 | if (rfk->poll_dev) { | 130 | if (!rfk->poll_dev) |
169 | rfk->poll_dev->private = dev; | 131 | goto err_free_rfk; |
170 | rfk->poll_dev->poll = b43_rfkill_poll; | 132 | rfk->poll_dev->private = dev; |
171 | rfk->poll_dev->poll_interval = 1000; /* msecs */ | 133 | rfk->poll_dev->poll = b43_rfkill_poll; |
172 | } else | 134 | rfk->poll_dev->poll_interval = 1000; /* msecs */ |
173 | b43warn(wl, "Failed to allocate RF-kill polldev\n"); | 135 | |
136 | err = rfkill_register(rfk->rfkill); | ||
137 | if (err) | ||
138 | goto err_free_polldev; | ||
139 | err = input_register_polled_device(rfk->poll_dev); | ||
140 | if (err) | ||
141 | goto err_unreg_rfk; | ||
142 | |||
143 | rfk->registered = 1; | ||
144 | |||
145 | return; | ||
146 | err_unreg_rfk: | ||
147 | rfkill_unregister(rfk->rfkill); | ||
148 | err_free_polldev: | ||
149 | input_free_polled_device(rfk->poll_dev); | ||
150 | rfk->poll_dev = NULL; | ||
151 | err_free_rfk: | ||
152 | rfkill_free(rfk->rfkill); | ||
153 | rfk->rfkill = NULL; | ||
154 | out_error: | ||
155 | rfk->registered = 0; | ||
156 | b43warn(wl, "RF-kill button init failed\n"); | ||
174 | } | 157 | } |
175 | 158 | ||
176 | void b43_rfkill_free(struct b43_wldev *dev) | 159 | void b43_rfkill_exit(struct b43_wldev *dev) |
177 | { | 160 | { |
178 | struct b43_rfkill *rfk = &(dev->wl->rfkill); | 161 | struct b43_rfkill *rfk = &(dev->wl->rfkill); |
179 | 162 | ||
163 | if (!rfk->registered) | ||
164 | return; | ||
165 | rfk->registered = 0; | ||
166 | |||
167 | input_unregister_polled_device(rfk->poll_dev); | ||
168 | rfkill_unregister(rfk->rfkill); | ||
180 | input_free_polled_device(rfk->poll_dev); | 169 | input_free_polled_device(rfk->poll_dev); |
181 | rfk->poll_dev = NULL; | 170 | rfk->poll_dev = NULL; |
182 | rfkill_free(rfk->rfkill); | 171 | rfkill_free(rfk->rfkill); |
diff --git a/drivers/net/wireless/b43/rfkill.h b/drivers/net/wireless/b43/rfkill.h index 29544e8c9e5f..adacf936d815 100644 --- a/drivers/net/wireless/b43/rfkill.h +++ b/drivers/net/wireless/b43/rfkill.h | |||
@@ -15,14 +15,14 @@ struct b43_rfkill { | |||
15 | struct rfkill *rfkill; | 15 | struct rfkill *rfkill; |
16 | /* The poll device for the RFKILL input button */ | 16 | /* The poll device for the RFKILL input button */ |
17 | struct input_polled_dev *poll_dev; | 17 | struct input_polled_dev *poll_dev; |
18 | /* Did initialization succeed? Used for freeing. */ | ||
19 | bool registered; | ||
18 | /* The unique name of this rfkill switch */ | 20 | /* The unique name of this rfkill switch */ |
19 | char name[32]; | 21 | char name[sizeof("b43-phy4294967295")]; |
20 | }; | 22 | }; |
21 | 23 | ||
22 | /* All the init functions return void, because we are not interested | 24 | /* The init function returns void, because we are not interested |
23 | * in failing the b43 init process when rfkill init failed. */ | 25 | * in failing the b43 init process when rfkill init failed. */ |
24 | void b43_rfkill_alloc(struct b43_wldev *dev); | ||
25 | void b43_rfkill_free(struct b43_wldev *dev); | ||
26 | void b43_rfkill_init(struct b43_wldev *dev); | 26 | void b43_rfkill_init(struct b43_wldev *dev); |
27 | void b43_rfkill_exit(struct b43_wldev *dev); | 27 | void b43_rfkill_exit(struct b43_wldev *dev); |
28 | 28 | ||
@@ -36,12 +36,6 @@ struct b43_rfkill { | |||
36 | /* empty */ | 36 | /* empty */ |
37 | }; | 37 | }; |
38 | 38 | ||
39 | static inline void b43_rfkill_alloc(struct b43_wldev *dev) | ||
40 | { | ||
41 | } | ||
42 | static inline void b43_rfkill_free(struct b43_wldev *dev) | ||
43 | { | ||
44 | } | ||
45 | static inline void b43_rfkill_init(struct b43_wldev *dev) | 39 | static inline void b43_rfkill_init(struct b43_wldev *dev) |
46 | { | 40 | { |
47 | } | 41 | } |
diff --git a/drivers/net/wireless/b43legacy/debugfs.c b/drivers/net/wireless/b43legacy/debugfs.c index eefa6fb79685..619b4534ef09 100644 --- a/drivers/net/wireless/b43legacy/debugfs.c +++ b/drivers/net/wireless/b43legacy/debugfs.c | |||
@@ -124,7 +124,7 @@ static ssize_t shm_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufs | |||
124 | __le16 *le16buf = (__le16 *)buf; | 124 | __le16 *le16buf = (__le16 *)buf; |
125 | 125 | ||
126 | for (i = 0; i < 0x1000; i++) { | 126 | for (i = 0; i < 0x1000; i++) { |
127 | if (bufsize <= 0) | 127 | if (bufsize < sizeof(tmp)) |
128 | break; | 128 | break; |
129 | tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 2 * i); | 129 | tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 2 * i); |
130 | le16buf[i] = cpu_to_le16(tmp); | 130 | le16buf[i] = cpu_to_le16(tmp); |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index d09479e816cd..3bde1e9ab428 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -2260,7 +2260,7 @@ out_requeue: | |||
2260 | if (b43legacy_debug(dev, B43legacy_DBG_PWORK_FAST)) | 2260 | if (b43legacy_debug(dev, B43legacy_DBG_PWORK_FAST)) |
2261 | delay = msecs_to_jiffies(50); | 2261 | delay = msecs_to_jiffies(50); |
2262 | else | 2262 | else |
2263 | delay = round_jiffies(HZ); | 2263 | delay = round_jiffies_relative(HZ); |
2264 | queue_delayed_work(dev->wl->hw->workqueue, | 2264 | queue_delayed_work(dev->wl->hw->workqueue, |
2265 | &dev->periodic_work, delay); | 2265 | &dev->periodic_work, delay); |
2266 | out: | 2266 | out: |
@@ -2781,6 +2781,17 @@ static void b43legacy_wireless_core_stop(struct b43legacy_wldev *dev) | |||
2781 | 2781 | ||
2782 | if (b43legacy_status(dev) < B43legacy_STAT_STARTED) | 2782 | if (b43legacy_status(dev) < B43legacy_STAT_STARTED) |
2783 | return; | 2783 | return; |
2784 | |||
2785 | /* Disable and sync interrupts. We must do this before than | ||
2786 | * setting the status to INITIALIZED, as the interrupt handler | ||
2787 | * won't care about IRQs then. */ | ||
2788 | spin_lock_irqsave(&wl->irq_lock, flags); | ||
2789 | dev->irq_savedstate = b43legacy_interrupt_disable(dev, | ||
2790 | B43legacy_IRQ_ALL); | ||
2791 | b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_MASK); /* flush */ | ||
2792 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
2793 | b43legacy_synchronize_irq(dev); | ||
2794 | |||
2784 | b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED); | 2795 | b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED); |
2785 | 2796 | ||
2786 | mutex_unlock(&wl->mutex); | 2797 | mutex_unlock(&wl->mutex); |
@@ -2791,14 +2802,6 @@ static void b43legacy_wireless_core_stop(struct b43legacy_wldev *dev) | |||
2791 | 2802 | ||
2792 | ieee80211_stop_queues(wl->hw); /* FIXME this could cause a deadlock */ | 2803 | ieee80211_stop_queues(wl->hw); /* FIXME this could cause a deadlock */ |
2793 | 2804 | ||
2794 | /* Disable and sync interrupts. */ | ||
2795 | spin_lock_irqsave(&wl->irq_lock, flags); | ||
2796 | dev->irq_savedstate = b43legacy_interrupt_disable(dev, | ||
2797 | B43legacy_IRQ_ALL); | ||
2798 | b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_MASK); /* flush */ | ||
2799 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
2800 | b43legacy_synchronize_irq(dev); | ||
2801 | |||
2802 | b43legacy_mac_suspend(dev); | 2805 | b43legacy_mac_suspend(dev); |
2803 | free_irq(dev->dev->irq, dev); | 2806 | free_irq(dev->dev->irq, dev); |
2804 | b43legacydbg(wl, "Wireless interface stopped\n"); | 2807 | b43legacydbg(wl, "Wireless interface stopped\n"); |
@@ -3332,7 +3335,7 @@ out_mutex_unlock: | |||
3332 | return err; | 3335 | return err; |
3333 | } | 3336 | } |
3334 | 3337 | ||
3335 | void b43legacy_stop(struct ieee80211_hw *hw) | 3338 | static void b43legacy_stop(struct ieee80211_hw *hw) |
3336 | { | 3339 | { |
3337 | struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); | 3340 | struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); |
3338 | struct b43legacy_wldev *dev = wl->current_dev; | 3341 | struct b43legacy_wldev *dev = wl->current_dev; |
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index 7da3664b8515..fc876ba18572 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c | |||
@@ -444,7 +444,7 @@ static int prism2_pci_resume(struct pci_dev *pdev) | |||
444 | 444 | ||
445 | MODULE_DEVICE_TABLE(pci, prism2_pci_id_table); | 445 | MODULE_DEVICE_TABLE(pci, prism2_pci_id_table); |
446 | 446 | ||
447 | static struct pci_driver prism2_pci_drv_id = { | 447 | static struct pci_driver prism2_pci_driver = { |
448 | .name = "hostap_pci", | 448 | .name = "hostap_pci", |
449 | .id_table = prism2_pci_id_table, | 449 | .id_table = prism2_pci_id_table, |
450 | .probe = prism2_pci_probe, | 450 | .probe = prism2_pci_probe, |
@@ -458,13 +458,13 @@ static struct pci_driver prism2_pci_drv_id = { | |||
458 | 458 | ||
459 | static int __init init_prism2_pci(void) | 459 | static int __init init_prism2_pci(void) |
460 | { | 460 | { |
461 | return pci_register_driver(&prism2_pci_drv_id); | 461 | return pci_register_driver(&prism2_pci_driver); |
462 | } | 462 | } |
463 | 463 | ||
464 | 464 | ||
465 | static void __exit exit_prism2_pci(void) | 465 | static void __exit exit_prism2_pci(void) |
466 | { | 466 | { |
467 | pci_unregister_driver(&prism2_pci_drv_id); | 467 | pci_unregister_driver(&prism2_pci_driver); |
468 | } | 468 | } |
469 | 469 | ||
470 | 470 | ||
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index a6c7904de282..fc6cdd8086c1 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -1267,7 +1267,7 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv) | |||
1267 | IPW2100_INTA_FATAL_ERROR | | 1267 | IPW2100_INTA_FATAL_ERROR | |
1268 | IPW2100_INTA_PARITY_ERROR); | 1268 | IPW2100_INTA_PARITY_ERROR); |
1269 | } | 1269 | } |
1270 | } while (i--); | 1270 | } while (--i); |
1271 | 1271 | ||
1272 | /* Clear out any pending INTAs since we aren't supposed to have | 1272 | /* Clear out any pending INTAs since we aren't supposed to have |
1273 | * interrupts enabled at this point... */ | 1273 | * interrupts enabled at this point... */ |
@@ -1339,7 +1339,7 @@ static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) | |||
1339 | 1339 | ||
1340 | if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) | 1340 | if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) |
1341 | break; | 1341 | break; |
1342 | } while (i--); | 1342 | } while (--i); |
1343 | 1343 | ||
1344 | priv->status &= ~STATUS_RESET_PENDING; | 1344 | priv->status &= ~STATUS_RESET_PENDING; |
1345 | 1345 | ||
@@ -1769,7 +1769,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | |||
1769 | if (priv->stop_rf_kill) { | 1769 | if (priv->stop_rf_kill) { |
1770 | priv->stop_rf_kill = 0; | 1770 | priv->stop_rf_kill = 0; |
1771 | queue_delayed_work(priv->workqueue, &priv->rf_kill, | 1771 | queue_delayed_work(priv->workqueue, &priv->rf_kill, |
1772 | round_jiffies(HZ)); | 1772 | round_jiffies_relative(HZ)); |
1773 | } | 1773 | } |
1774 | 1774 | ||
1775 | deferred = 1; | 1775 | deferred = 1; |
@@ -2086,7 +2086,8 @@ static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) | |||
2086 | /* Make sure the RF Kill check timer is running */ | 2086 | /* Make sure the RF Kill check timer is running */ |
2087 | priv->stop_rf_kill = 0; | 2087 | priv->stop_rf_kill = 0; |
2088 | cancel_delayed_work(&priv->rf_kill); | 2088 | cancel_delayed_work(&priv->rf_kill); |
2089 | queue_delayed_work(priv->workqueue, &priv->rf_kill, round_jiffies(HZ)); | 2089 | queue_delayed_work(priv->workqueue, &priv->rf_kill, |
2090 | round_jiffies_relative(HZ)); | ||
2090 | } | 2091 | } |
2091 | 2092 | ||
2092 | static void send_scan_event(void *data) | 2093 | static void send_scan_event(void *data) |
@@ -2123,7 +2124,7 @@ static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) | |||
2123 | if (!delayed_work_pending(&priv->scan_event_later)) | 2124 | if (!delayed_work_pending(&priv->scan_event_later)) |
2124 | queue_delayed_work(priv->workqueue, | 2125 | queue_delayed_work(priv->workqueue, |
2125 | &priv->scan_event_later, | 2126 | &priv->scan_event_later, |
2126 | round_jiffies(msecs_to_jiffies(4000))); | 2127 | round_jiffies_relative(msecs_to_jiffies(4000))); |
2127 | } else { | 2128 | } else { |
2128 | priv->user_requested_scan = 0; | 2129 | priv->user_requested_scan = 0; |
2129 | cancel_delayed_work(&priv->scan_event_later); | 2130 | cancel_delayed_work(&priv->scan_event_later); |
@@ -4242,7 +4243,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) | |||
4242 | priv->stop_rf_kill = 0; | 4243 | priv->stop_rf_kill = 0; |
4243 | cancel_delayed_work(&priv->rf_kill); | 4244 | cancel_delayed_work(&priv->rf_kill); |
4244 | queue_delayed_work(priv->workqueue, &priv->rf_kill, | 4245 | queue_delayed_work(priv->workqueue, &priv->rf_kill, |
4245 | round_jiffies(HZ)); | 4246 | round_jiffies_relative(HZ)); |
4246 | } else | 4247 | } else |
4247 | schedule_reset(priv); | 4248 | schedule_reset(priv); |
4248 | } | 4249 | } |
@@ -5981,7 +5982,7 @@ static void ipw2100_rf_kill(struct work_struct *work) | |||
5981 | IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n"); | 5982 | IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n"); |
5982 | if (!priv->stop_rf_kill) | 5983 | if (!priv->stop_rf_kill) |
5983 | queue_delayed_work(priv->workqueue, &priv->rf_kill, | 5984 | queue_delayed_work(priv->workqueue, &priv->rf_kill, |
5984 | round_jiffies(HZ)); | 5985 | round_jiffies_relative(HZ)); |
5985 | goto exit_unlock; | 5986 | goto exit_unlock; |
5986 | } | 5987 | } |
5987 | 5988 | ||
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index e3c828401b9a..54f44e5473c0 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -1753,7 +1753,7 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) | |||
1753 | /* Make sure the RF_KILL check timer is running */ | 1753 | /* Make sure the RF_KILL check timer is running */ |
1754 | cancel_delayed_work(&priv->rf_kill); | 1754 | cancel_delayed_work(&priv->rf_kill); |
1755 | queue_delayed_work(priv->workqueue, &priv->rf_kill, | 1755 | queue_delayed_work(priv->workqueue, &priv->rf_kill, |
1756 | round_jiffies(2 * HZ)); | 1756 | round_jiffies_relative(2 * HZ)); |
1757 | } else | 1757 | } else |
1758 | queue_work(priv->workqueue, &priv->up); | 1758 | queue_work(priv->workqueue, &priv->up); |
1759 | } | 1759 | } |
@@ -4364,7 +4364,7 @@ static void handle_scan_event(struct ipw_priv *priv) | |||
4364 | if (!priv->user_requested_scan) { | 4364 | if (!priv->user_requested_scan) { |
4365 | if (!delayed_work_pending(&priv->scan_event)) | 4365 | if (!delayed_work_pending(&priv->scan_event)) |
4366 | queue_delayed_work(priv->workqueue, &priv->scan_event, | 4366 | queue_delayed_work(priv->workqueue, &priv->scan_event, |
4367 | round_jiffies(msecs_to_jiffies(4000))); | 4367 | round_jiffies_relative(msecs_to_jiffies(4000))); |
4368 | } else { | 4368 | } else { |
4369 | union iwreq_data wrqu; | 4369 | union iwreq_data wrqu; |
4370 | 4370 | ||
@@ -4728,7 +4728,7 @@ static void ipw_rx_notification(struct ipw_priv *priv, | |||
4728 | && priv->status & STATUS_ASSOCIATED) | 4728 | && priv->status & STATUS_ASSOCIATED) |
4729 | queue_delayed_work(priv->workqueue, | 4729 | queue_delayed_work(priv->workqueue, |
4730 | &priv->request_scan, | 4730 | &priv->request_scan, |
4731 | round_jiffies(HZ)); | 4731 | round_jiffies_relative(HZ)); |
4732 | 4732 | ||
4733 | /* Send an empty event to user space. | 4733 | /* Send an empty event to user space. |
4734 | * We don't send the received data on the event because | 4734 | * We don't send the received data on the event because |
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index 25cfc6c32509..8d52a26c248a 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig | |||
@@ -96,8 +96,8 @@ config IWL4965 | |||
96 | 96 | ||
97 | If you want to compile the driver as a module ( = code which can be | 97 | If you want to compile the driver as a module ( = code which can be |
98 | inserted in and remvoed from the running kernel whenever you want), | 98 | inserted in and remvoed from the running kernel whenever you want), |
99 | say M here and read <file:Documentation/modules.txt>. The module | 99 | say M here and read <file:Documentation/kbuild/modules.txt>. The |
100 | will be called iwl4965.ko. | 100 | module will be called iwl4965.ko. |
101 | 101 | ||
102 | config IWL3945 | 102 | config IWL3945 |
103 | tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" | 103 | tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" |
@@ -124,5 +124,5 @@ config IWL3945 | |||
124 | 124 | ||
125 | If you want to compile the driver as a module ( = code which can be | 125 | If you want to compile the driver as a module ( = code which can be |
126 | inserted in and remvoed from the running kernel whenever you want), | 126 | inserted in and remvoed from the running kernel whenever you want), |
127 | say M here and read <file:Documentation/modules.txt>. The module | 127 | say M here and read <file:Documentation/kbuild/modules.txt>. The |
128 | will be called iwl3945.ko. | 128 | module will be called iwl3945.ko. |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 262ab0b55824..c48b1b537d2b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -71,19 +71,19 @@ struct iwl_rate_scale_priv { | |||
71 | }; | 71 | }; |
72 | 72 | ||
73 | static s32 iwl_expected_tpt_g[IWL_RATE_COUNT] = { | 73 | static s32 iwl_expected_tpt_g[IWL_RATE_COUNT] = { |
74 | 0, 0, 76, 104, 130, 168, 191, 202, 7, 13, 35, 58 | 74 | 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 |
75 | }; | 75 | }; |
76 | 76 | ||
77 | static s32 iwl_expected_tpt_g_prot[IWL_RATE_COUNT] = { | 77 | static s32 iwl_expected_tpt_g_prot[IWL_RATE_COUNT] = { |
78 | 0, 0, 0, 80, 93, 113, 123, 125, 7, 13, 35, 58 | 78 | 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125 |
79 | }; | 79 | }; |
80 | 80 | ||
81 | static s32 iwl_expected_tpt_a[IWL_RATE_COUNT] = { | 81 | static s32 iwl_expected_tpt_a[IWL_RATE_COUNT] = { |
82 | 40, 57, 72, 98, 121, 154, 177, 186, 0, 0, 0, 0 | 82 | 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186 |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static s32 iwl_expected_tpt_b[IWL_RATE_COUNT] = { | 85 | static s32 iwl_expected_tpt_b[IWL_RATE_COUNT] = { |
86 | 0, 0, 0, 0, 0, 0, 0, 0, 7, 13, 35, 58 | 86 | 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0 |
87 | }; | 87 | }; |
88 | 88 | ||
89 | struct iwl_tpt_entry { | 89 | struct iwl_tpt_entry { |
@@ -350,6 +350,10 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
350 | 350 | ||
351 | sta->last_txrate = sta->txrate; | 351 | sta->last_txrate = sta->txrate; |
352 | 352 | ||
353 | /* For MODE_IEEE80211A mode it start at IWL_FIRST_OFDM_RATE */ | ||
354 | if (local->hw.conf.phymode == MODE_IEEE80211A) | ||
355 | sta->last_txrate += IWL_FIRST_OFDM_RATE; | ||
356 | |||
353 | IWL_DEBUG_RATE("leave\n"); | 357 | IWL_DEBUG_RATE("leave\n"); |
354 | } | 358 | } |
355 | 359 | ||
@@ -417,6 +421,33 @@ static void rs_free_sta(void *priv, void *priv_sta) | |||
417 | IWL_DEBUG_RATE("leave\n"); | 421 | IWL_DEBUG_RATE("leave\n"); |
418 | } | 422 | } |
419 | 423 | ||
424 | |||
425 | /* | ||
426 | * get ieee prev rate from rate scale table. | ||
427 | * for A and B mode we need to overright prev | ||
428 | * value | ||
429 | */ | ||
430 | static int rs_adjust_next_rate(struct iwl_priv *priv, int rate) | ||
431 | { | ||
432 | int next_rate = iwl_get_prev_ieee_rate(rate); | ||
433 | |||
434 | switch (priv->phymode) { | ||
435 | case MODE_IEEE80211A: | ||
436 | if (rate == IWL_RATE_12M_INDEX) | ||
437 | next_rate = IWL_RATE_9M_INDEX; | ||
438 | else if (rate == IWL_RATE_6M_INDEX) | ||
439 | next_rate = IWL_RATE_6M_INDEX; | ||
440 | break; | ||
441 | case MODE_IEEE80211B: | ||
442 | if (rate == IWL_RATE_11M_INDEX_TABLE) | ||
443 | next_rate = IWL_RATE_5M_INDEX_TABLE; | ||
444 | break; | ||
445 | default: | ||
446 | break; | ||
447 | } | ||
448 | |||
449 | return next_rate; | ||
450 | } | ||
420 | /** | 451 | /** |
421 | * rs_tx_status - Update rate control values based on Tx results | 452 | * rs_tx_status - Update rate control values based on Tx results |
422 | * | 453 | * |
@@ -479,7 +510,8 @@ static void rs_tx_status(void *priv_rate, | |||
479 | last_index = scale_rate_index; | 510 | last_index = scale_rate_index; |
480 | } else { | 511 | } else { |
481 | current_count = priv->retry_rate; | 512 | current_count = priv->retry_rate; |
482 | last_index = iwl_get_prev_ieee_rate(scale_rate_index); | 513 | last_index = rs_adjust_next_rate(priv, |
514 | scale_rate_index); | ||
483 | } | 515 | } |
484 | 516 | ||
485 | /* Update this rate accounting for as many retries | 517 | /* Update this rate accounting for as many retries |
@@ -494,9 +526,10 @@ static void rs_tx_status(void *priv_rate, | |||
494 | 526 | ||
495 | if (retries) | 527 | if (retries) |
496 | scale_rate_index = | 528 | scale_rate_index = |
497 | iwl_get_prev_ieee_rate(scale_rate_index); | 529 | rs_adjust_next_rate(priv, scale_rate_index); |
498 | } | 530 | } |
499 | 531 | ||
532 | |||
500 | /* Update the last index window with success/failure based on ACK */ | 533 | /* Update the last index window with success/failure based on ACK */ |
501 | IWL_DEBUG_RATE("Update rate %d with %s.\n", | 534 | IWL_DEBUG_RATE("Update rate %d with %s.\n", |
502 | last_index, | 535 | last_index, |
@@ -672,7 +705,10 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate, | |||
672 | } | 705 | } |
673 | 706 | ||
674 | rate_mask = sta->supp_rates; | 707 | rate_mask = sta->supp_rates; |
675 | index = min(sta->txrate & 0xffff, IWL_RATE_COUNT - 1); | 708 | index = min(sta->last_txrate & 0xffff, IWL_RATE_COUNT - 1); |
709 | |||
710 | if (priv->phymode == (u8) MODE_IEEE80211A) | ||
711 | rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; | ||
676 | 712 | ||
677 | rs_priv = (void *)sta->rate_ctrl_priv; | 713 | rs_priv = (void *)sta->rate_ctrl_priv; |
678 | 714 | ||
@@ -801,7 +837,11 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate, | |||
801 | out: | 837 | out: |
802 | 838 | ||
803 | sta->last_txrate = index; | 839 | sta->last_txrate = index; |
804 | sta->txrate = sta->last_txrate; | 840 | if (priv->phymode == (u8) MODE_IEEE80211A) |
841 | sta->txrate = sta->last_txrate - IWL_FIRST_OFDM_RATE; | ||
842 | else | ||
843 | sta->txrate = sta->last_txrate; | ||
844 | |||
805 | sta_info_put(sta); | 845 | sta_info_put(sta); |
806 | 846 | ||
807 | IWL_DEBUG_RATE("leave: %d\n", index); | 847 | IWL_DEBUG_RATE("leave: %d\n", index); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h index b926738e0ea1..bec4d3ffca1d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h | |||
@@ -36,10 +36,17 @@ struct iwl_rate_info { | |||
36 | u8 next_rs; /* next rate used in rs algo */ | 36 | u8 next_rs; /* next rate used in rs algo */ |
37 | u8 prev_rs_tgg; /* previous rate used in TGG rs algo */ | 37 | u8 prev_rs_tgg; /* previous rate used in TGG rs algo */ |
38 | u8 next_rs_tgg; /* next rate used in TGG rs algo */ | 38 | u8 next_rs_tgg; /* next rate used in TGG rs algo */ |
39 | u8 table_rs_index; /* index in rate scale table cmd */ | ||
40 | u8 prev_table_rs; /* prev in rate table cmd */ | ||
41 | |||
39 | }; | 42 | }; |
40 | 43 | ||
41 | enum { | 44 | enum { |
42 | IWL_RATE_6M_INDEX = 0, | 45 | IWL_RATE_1M_INDEX = 0, |
46 | IWL_RATE_2M_INDEX, | ||
47 | IWL_RATE_5M_INDEX, | ||
48 | IWL_RATE_11M_INDEX, | ||
49 | IWL_RATE_6M_INDEX, | ||
43 | IWL_RATE_9M_INDEX, | 50 | IWL_RATE_9M_INDEX, |
44 | IWL_RATE_12M_INDEX, | 51 | IWL_RATE_12M_INDEX, |
45 | IWL_RATE_18M_INDEX, | 52 | IWL_RATE_18M_INDEX, |
@@ -47,16 +54,28 @@ enum { | |||
47 | IWL_RATE_36M_INDEX, | 54 | IWL_RATE_36M_INDEX, |
48 | IWL_RATE_48M_INDEX, | 55 | IWL_RATE_48M_INDEX, |
49 | IWL_RATE_54M_INDEX, | 56 | IWL_RATE_54M_INDEX, |
50 | IWL_RATE_1M_INDEX, | ||
51 | IWL_RATE_2M_INDEX, | ||
52 | IWL_RATE_5M_INDEX, | ||
53 | IWL_RATE_11M_INDEX, | ||
54 | IWL_RATE_COUNT, | 57 | IWL_RATE_COUNT, |
55 | IWL_RATE_INVM_INDEX, | 58 | IWL_RATE_INVM_INDEX, |
56 | IWL_RATE_INVALID = IWL_RATE_INVM_INDEX | 59 | IWL_RATE_INVALID = IWL_RATE_INVM_INDEX |
57 | }; | 60 | }; |
58 | 61 | ||
59 | enum { | 62 | enum { |
63 | IWL_RATE_6M_INDEX_TABLE = 0, | ||
64 | IWL_RATE_9M_INDEX_TABLE, | ||
65 | IWL_RATE_12M_INDEX_TABLE, | ||
66 | IWL_RATE_18M_INDEX_TABLE, | ||
67 | IWL_RATE_24M_INDEX_TABLE, | ||
68 | IWL_RATE_36M_INDEX_TABLE, | ||
69 | IWL_RATE_48M_INDEX_TABLE, | ||
70 | IWL_RATE_54M_INDEX_TABLE, | ||
71 | IWL_RATE_1M_INDEX_TABLE, | ||
72 | IWL_RATE_2M_INDEX_TABLE, | ||
73 | IWL_RATE_5M_INDEX_TABLE, | ||
74 | IWL_RATE_11M_INDEX_TABLE, | ||
75 | IWL_RATE_INVM_INDEX_TABLE = IWL_RATE_INVM_INDEX, | ||
76 | }; | ||
77 | |||
78 | enum { | ||
60 | IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX, | 79 | IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX, |
61 | IWL_LAST_OFDM_RATE = IWL_RATE_54M_INDEX, | 80 | IWL_LAST_OFDM_RATE = IWL_RATE_54M_INDEX, |
62 | IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX, | 81 | IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 19bcb01e2784..3a45fe99a83e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -54,7 +54,9 @@ | |||
54 | IWL_RATE_##rp##M_INDEX, \ | 54 | IWL_RATE_##rp##M_INDEX, \ |
55 | IWL_RATE_##rn##M_INDEX, \ | 55 | IWL_RATE_##rn##M_INDEX, \ |
56 | IWL_RATE_##pp##M_INDEX, \ | 56 | IWL_RATE_##pp##M_INDEX, \ |
57 | IWL_RATE_##np##M_INDEX } | 57 | IWL_RATE_##np##M_INDEX, \ |
58 | IWL_RATE_##r##M_INDEX_TABLE, \ | ||
59 | IWL_RATE_##ip##M_INDEX_TABLE } | ||
58 | 60 | ||
59 | /* | 61 | /* |
60 | * Parameter order: | 62 | * Parameter order: |
@@ -65,6 +67,10 @@ | |||
65 | * | 67 | * |
66 | */ | 68 | */ |
67 | const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { | 69 | const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { |
70 | IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */ | ||
71 | IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */ | ||
72 | IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */ | ||
73 | IWL_DECLARE_RATE_INFO(11, 9, 12, 5, 12, 5, 18), /* 11mbps */ | ||
68 | IWL_DECLARE_RATE_INFO(6, 5, 9, 5, 11, 5, 11), /* 6mbps */ | 74 | IWL_DECLARE_RATE_INFO(6, 5, 9, 5, 11, 5, 11), /* 6mbps */ |
69 | IWL_DECLARE_RATE_INFO(9, 6, 11, 5, 11, 5, 11), /* 9mbps */ | 75 | IWL_DECLARE_RATE_INFO(9, 6, 11, 5, 11, 5, 11), /* 9mbps */ |
70 | IWL_DECLARE_RATE_INFO(12, 11, 18, 11, 18, 11, 18), /* 12mbps */ | 76 | IWL_DECLARE_RATE_INFO(12, 11, 18, 11, 18, 11, 18), /* 12mbps */ |
@@ -73,10 +79,6 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { | |||
73 | IWL_DECLARE_RATE_INFO(36, 24, 48, 24, 48, 24, 48), /* 36mbps */ | 79 | IWL_DECLARE_RATE_INFO(36, 24, 48, 24, 48, 24, 48), /* 36mbps */ |
74 | IWL_DECLARE_RATE_INFO(48, 36, 54, 36, 54, 36, 54), /* 48mbps */ | 80 | IWL_DECLARE_RATE_INFO(48, 36, 54, 36, 54, 36, 54), /* 48mbps */ |
75 | IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */ | 81 | IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */ |
76 | IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */ | ||
77 | IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */ | ||
78 | IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */ | ||
79 | IWL_DECLARE_RATE_INFO(11, 9, 12, 5, 12, 5, 18), /* 11mbps */ | ||
80 | }; | 82 | }; |
81 | 83 | ||
82 | /* 1 = enable the iwl_disable_events() function */ | 84 | /* 1 = enable the iwl_disable_events() function */ |
@@ -662,10 +664,11 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, | |||
662 | cmd->cmd.tx.tx_flags = tx_flags; | 664 | cmd->cmd.tx.tx_flags = tx_flags; |
663 | 665 | ||
664 | /* OFDM */ | 666 | /* OFDM */ |
665 | cmd->cmd.tx.supp_rates[0] = rate_mask & IWL_OFDM_RATES_MASK; | 667 | cmd->cmd.tx.supp_rates[0] = |
668 | ((rate_mask & IWL_OFDM_RATES_MASK) >> IWL_FIRST_OFDM_RATE) & 0xFF; | ||
666 | 669 | ||
667 | /* CCK */ | 670 | /* CCK */ |
668 | cmd->cmd.tx.supp_rates[1] = (rate_mask >> 8) & 0xF; | 671 | cmd->cmd.tx.supp_rates[1] = (rate_mask & 0xF); |
669 | 672 | ||
670 | IWL_DEBUG_RATE("Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " | 673 | IWL_DEBUG_RATE("Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " |
671 | "cck/ofdm mask: 0x%x/0x%x\n", sta_id, | 674 | "cck/ofdm mask: 0x%x/0x%x\n", sta_id, |
@@ -1432,7 +1435,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index, | |||
1432 | /* use this channel group's 6Mbit clipping/saturation pwr, | 1435 | /* use this channel group's 6Mbit clipping/saturation pwr, |
1433 | * but cap at regulatory scan power restriction (set during init | 1436 | * but cap at regulatory scan power restriction (set during init |
1434 | * based on eeprom channel data) for this channel. */ | 1437 | * based on eeprom channel data) for this channel. */ |
1435 | power = min(ch_info->scan_power, clip_pwrs[IWL_RATE_6M_INDEX]); | 1438 | power = min(ch_info->scan_power, clip_pwrs[IWL_RATE_6M_INDEX_TABLE]); |
1436 | 1439 | ||
1437 | /* further limit to user's max power preference. | 1440 | /* further limit to user's max power preference. |
1438 | * FIXME: Other spectrum management power limitations do not | 1441 | * FIXME: Other spectrum management power limitations do not |
@@ -1447,7 +1450,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index, | |||
1447 | * *index*. */ | 1450 | * *index*. */ |
1448 | power_index = ch_info->power_info[rate_index].power_table_index | 1451 | power_index = ch_info->power_info[rate_index].power_table_index |
1449 | - (power - ch_info->power_info | 1452 | - (power - ch_info->power_info |
1450 | [IWL_RATE_6M_INDEX].requested_power) * 2; | 1453 | [IWL_RATE_6M_INDEX_TABLE].requested_power) * 2; |
1451 | 1454 | ||
1452 | /* store reference index that we use when adjusting *all* scan | 1455 | /* store reference index that we use when adjusting *all* scan |
1453 | * powers. So we can accommodate user (all channel) or spectrum | 1456 | * powers. So we can accommodate user (all channel) or spectrum |
@@ -1476,7 +1479,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index, | |||
1476 | */ | 1479 | */ |
1477 | int iwl_hw_reg_send_txpower(struct iwl_priv *priv) | 1480 | int iwl_hw_reg_send_txpower(struct iwl_priv *priv) |
1478 | { | 1481 | { |
1479 | int rate_idx; | 1482 | int rate_idx, i; |
1480 | const struct iwl_channel_info *ch_info = NULL; | 1483 | const struct iwl_channel_info *ch_info = NULL; |
1481 | struct iwl_txpowertable_cmd txpower = { | 1484 | struct iwl_txpowertable_cmd txpower = { |
1482 | .channel = priv->active_rxon.channel, | 1485 | .channel = priv->active_rxon.channel, |
@@ -1500,20 +1503,36 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) | |||
1500 | } | 1503 | } |
1501 | 1504 | ||
1502 | /* fill cmd with power settings for all rates for current channel */ | 1505 | /* fill cmd with power settings for all rates for current channel */ |
1503 | for (rate_idx = 0; rate_idx < IWL_RATE_COUNT; rate_idx++) { | 1506 | /* Fill OFDM rate */ |
1504 | txpower.power[rate_idx].tpc = ch_info->power_info[rate_idx].tpc; | 1507 | for (rate_idx = IWL_FIRST_OFDM_RATE, i = 0; |
1505 | txpower.power[rate_idx].rate = iwl_rates[rate_idx].plcp; | 1508 | rate_idx <= IWL_LAST_OFDM_RATE; rate_idx++, i++) { |
1509 | |||
1510 | txpower.power[i].tpc = ch_info->power_info[i].tpc; | ||
1511 | txpower.power[i].rate = iwl_rates[rate_idx].plcp; | ||
1506 | 1512 | ||
1507 | IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", | 1513 | IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", |
1508 | le16_to_cpu(txpower.channel), | 1514 | le16_to_cpu(txpower.channel), |
1509 | txpower.band, | 1515 | txpower.band, |
1510 | txpower.power[rate_idx].tpc.tx_gain, | 1516 | txpower.power[i].tpc.tx_gain, |
1511 | txpower.power[rate_idx].tpc.dsp_atten, | 1517 | txpower.power[i].tpc.dsp_atten, |
1512 | txpower.power[rate_idx].rate); | 1518 | txpower.power[i].rate); |
1519 | } | ||
1520 | /* Fill CCK rates */ | ||
1521 | for (rate_idx = IWL_FIRST_CCK_RATE; | ||
1522 | rate_idx <= IWL_LAST_CCK_RATE; rate_idx++, i++) { | ||
1523 | txpower.power[i].tpc = ch_info->power_info[i].tpc; | ||
1524 | txpower.power[i].rate = iwl_rates[rate_idx].plcp; | ||
1525 | |||
1526 | IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", | ||
1527 | le16_to_cpu(txpower.channel), | ||
1528 | txpower.band, | ||
1529 | txpower.power[i].tpc.tx_gain, | ||
1530 | txpower.power[i].tpc.dsp_atten, | ||
1531 | txpower.power[i].rate); | ||
1513 | } | 1532 | } |
1514 | 1533 | ||
1515 | return iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, | 1534 | return iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, |
1516 | sizeof(struct iwl_txpowertable_cmd), &txpower); | 1535 | sizeof(struct iwl_txpowertable_cmd), &txpower); |
1517 | 1536 | ||
1518 | } | 1537 | } |
1519 | 1538 | ||
@@ -1549,7 +1568,7 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv, | |||
1549 | power_info = ch_info->power_info; | 1568 | power_info = ch_info->power_info; |
1550 | 1569 | ||
1551 | /* update OFDM Txpower settings */ | 1570 | /* update OFDM Txpower settings */ |
1552 | for (i = IWL_FIRST_OFDM_RATE; i <= IWL_LAST_OFDM_RATE; | 1571 | for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; |
1553 | i++, ++power_info) { | 1572 | i++, ++power_info) { |
1554 | int delta_idx; | 1573 | int delta_idx; |
1555 | 1574 | ||
@@ -1573,14 +1592,14 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv, | |||
1573 | * ... all CCK power settings for a given channel are the *same*. */ | 1592 | * ... all CCK power settings for a given channel are the *same*. */ |
1574 | if (power_changed) { | 1593 | if (power_changed) { |
1575 | power = | 1594 | power = |
1576 | ch_info->power_info[IWL_RATE_12M_INDEX]. | 1595 | ch_info->power_info[IWL_RATE_12M_INDEX_TABLE]. |
1577 | requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF; | 1596 | requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF; |
1578 | 1597 | ||
1579 | /* do all CCK rates' iwl_channel_power_info structures */ | 1598 | /* do all CCK rates' iwl_channel_power_info structures */ |
1580 | for (i = IWL_FIRST_CCK_RATE; i <= IWL_LAST_CCK_RATE; i++) { | 1599 | for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) { |
1581 | power_info->requested_power = power; | 1600 | power_info->requested_power = power; |
1582 | power_info->base_power_index = | 1601 | power_info->base_power_index = |
1583 | ch_info->power_info[IWL_RATE_12M_INDEX]. | 1602 | ch_info->power_info[IWL_RATE_12M_INDEX_TABLE]. |
1584 | base_power_index + IWL_CCK_FROM_OFDM_INDEX_DIFF; | 1603 | base_power_index + IWL_CCK_FROM_OFDM_INDEX_DIFF; |
1585 | ++power_info; | 1604 | ++power_info; |
1586 | } | 1605 | } |
@@ -1674,7 +1693,7 @@ static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv) | |||
1674 | for (scan_tbl_index = 0; | 1693 | for (scan_tbl_index = 0; |
1675 | scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { | 1694 | scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { |
1676 | s32 actual_index = (scan_tbl_index == 0) ? | 1695 | s32 actual_index = (scan_tbl_index == 0) ? |
1677 | IWL_RATE_1M_INDEX : IWL_RATE_6M_INDEX; | 1696 | IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE; |
1678 | iwl_hw_reg_set_scan_power(priv, scan_tbl_index, | 1697 | iwl_hw_reg_set_scan_power(priv, scan_tbl_index, |
1679 | actual_index, clip_pwrs, | 1698 | actual_index, clip_pwrs, |
1680 | ch_info, a_band); | 1699 | ch_info, a_band); |
@@ -1905,19 +1924,19 @@ static void iwl_hw_reg_init_channel_groups(struct iwl_priv *priv) | |||
1905 | for (rate_index = 0; | 1924 | for (rate_index = 0; |
1906 | rate_index < IWL_RATE_COUNT; rate_index++, clip_pwrs++) { | 1925 | rate_index < IWL_RATE_COUNT; rate_index++, clip_pwrs++) { |
1907 | switch (rate_index) { | 1926 | switch (rate_index) { |
1908 | case IWL_RATE_36M_INDEX: | 1927 | case IWL_RATE_36M_INDEX_TABLE: |
1909 | if (i == 0) /* B/G */ | 1928 | if (i == 0) /* B/G */ |
1910 | *clip_pwrs = satur_pwr; | 1929 | *clip_pwrs = satur_pwr; |
1911 | else /* A */ | 1930 | else /* A */ |
1912 | *clip_pwrs = satur_pwr - 5; | 1931 | *clip_pwrs = satur_pwr - 5; |
1913 | break; | 1932 | break; |
1914 | case IWL_RATE_48M_INDEX: | 1933 | case IWL_RATE_48M_INDEX_TABLE: |
1915 | if (i == 0) | 1934 | if (i == 0) |
1916 | *clip_pwrs = satur_pwr - 7; | 1935 | *clip_pwrs = satur_pwr - 7; |
1917 | else | 1936 | else |
1918 | *clip_pwrs = satur_pwr - 10; | 1937 | *clip_pwrs = satur_pwr - 10; |
1919 | break; | 1938 | break; |
1920 | case IWL_RATE_54M_INDEX: | 1939 | case IWL_RATE_54M_INDEX_TABLE: |
1921 | if (i == 0) | 1940 | if (i == 0) |
1922 | *clip_pwrs = satur_pwr - 9; | 1941 | *clip_pwrs = satur_pwr - 9; |
1923 | else | 1942 | else |
@@ -2031,7 +2050,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) | |||
2031 | } | 2050 | } |
2032 | 2051 | ||
2033 | /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/ | 2052 | /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/ |
2034 | pwr_info = &ch_info->power_info[IWL_RATE_12M_INDEX]; | 2053 | pwr_info = &ch_info->power_info[IWL_RATE_12M_INDEX_TABLE]; |
2035 | power = pwr_info->requested_power + | 2054 | power = pwr_info->requested_power + |
2036 | IWL_CCK_FROM_OFDM_POWER_DIFF; | 2055 | IWL_CCK_FROM_OFDM_POWER_DIFF; |
2037 | pwr_index = pwr_info->power_table_index + | 2056 | pwr_index = pwr_info->power_table_index + |
@@ -2047,9 +2066,9 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) | |||
2047 | /* fill each CCK rate's iwl_channel_power_info structure | 2066 | /* fill each CCK rate's iwl_channel_power_info structure |
2048 | * NOTE: All CCK-rate Txpwrs are the same for a given chnl! | 2067 | * NOTE: All CCK-rate Txpwrs are the same for a given chnl! |
2049 | * NOTE: CCK rates start at end of OFDM rates! */ | 2068 | * NOTE: CCK rates start at end of OFDM rates! */ |
2050 | for (rate_index = IWL_OFDM_RATES; | 2069 | for (rate_index = 0; |
2051 | rate_index < IWL_RATE_COUNT; rate_index++) { | 2070 | rate_index < IWL_CCK_RATES; rate_index++) { |
2052 | pwr_info = &ch_info->power_info[rate_index]; | 2071 | pwr_info = &ch_info->power_info[rate_index+IWL_OFDM_RATES]; |
2053 | pwr_info->requested_power = power; | 2072 | pwr_info->requested_power = power; |
2054 | pwr_info->power_table_index = pwr_index; | 2073 | pwr_info->power_table_index = pwr_index; |
2055 | pwr_info->base_power_index = base_pwr_index; | 2074 | pwr_info->base_power_index = base_pwr_index; |
@@ -2061,7 +2080,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) | |||
2061 | for (scan_tbl_index = 0; | 2080 | for (scan_tbl_index = 0; |
2062 | scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { | 2081 | scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { |
2063 | s32 actual_index = (scan_tbl_index == 0) ? | 2082 | s32 actual_index = (scan_tbl_index == 0) ? |
2064 | IWL_RATE_1M_INDEX : IWL_RATE_6M_INDEX; | 2083 | IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE; |
2065 | iwl_hw_reg_set_scan_power(priv, scan_tbl_index, | 2084 | iwl_hw_reg_set_scan_power(priv, scan_tbl_index, |
2066 | actual_index, clip_pwrs, ch_info, a_band); | 2085 | actual_index, clip_pwrs, ch_info, a_band); |
2067 | } | 2086 | } |
@@ -2139,17 +2158,20 @@ int iwl_hw_get_rx_read(struct iwl_priv *priv) | |||
2139 | */ | 2158 | */ |
2140 | int iwl3945_init_hw_rate_table(struct iwl_priv *priv) | 2159 | int iwl3945_init_hw_rate_table(struct iwl_priv *priv) |
2141 | { | 2160 | { |
2142 | int rc, i; | 2161 | int rc, i, index, prev_index; |
2143 | struct iwl_rate_scaling_cmd rate_cmd = { | 2162 | struct iwl_rate_scaling_cmd rate_cmd = { |
2144 | .reserved = {0, 0, 0}, | 2163 | .reserved = {0, 0, 0}, |
2145 | }; | 2164 | }; |
2146 | struct iwl_rate_scaling_info *table = rate_cmd.table; | 2165 | struct iwl_rate_scaling_info *table = rate_cmd.table; |
2147 | 2166 | ||
2148 | for (i = 0; i < ARRAY_SIZE(iwl_rates); i++) { | 2167 | for (i = 0; i < ARRAY_SIZE(iwl_rates); i++) { |
2149 | table[i].rate_n_flags = | 2168 | index = iwl_rates[i].table_rs_index; |
2169 | |||
2170 | table[index].rate_n_flags = | ||
2150 | iwl_hw_set_rate_n_flags(iwl_rates[i].plcp, 0); | 2171 | iwl_hw_set_rate_n_flags(iwl_rates[i].plcp, 0); |
2151 | table[i].try_cnt = priv->retry_rate; | 2172 | table[index].try_cnt = priv->retry_rate; |
2152 | table[i].next_rate_index = iwl_get_prev_ieee_rate(i); | 2173 | prev_index = iwl_get_prev_ieee_rate(i); |
2174 | table[index].next_rate_index = iwl_rates[prev_index].table_rs_index; | ||
2153 | } | 2175 | } |
2154 | 2176 | ||
2155 | switch (priv->phymode) { | 2177 | switch (priv->phymode) { |
@@ -2157,26 +2179,26 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv) | |||
2157 | IWL_DEBUG_RATE("Select A mode rate scale\n"); | 2179 | IWL_DEBUG_RATE("Select A mode rate scale\n"); |
2158 | /* If one of the following CCK rates is used, | 2180 | /* If one of the following CCK rates is used, |
2159 | * have it fall back to the 6M OFDM rate */ | 2181 | * have it fall back to the 6M OFDM rate */ |
2160 | for (i = IWL_FIRST_CCK_RATE; i <= IWL_LAST_CCK_RATE; i++) | 2182 | for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) |
2161 | table[i].next_rate_index = IWL_FIRST_OFDM_RATE; | 2183 | table[i].next_rate_index = iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index; |
2162 | 2184 | ||
2163 | /* Don't fall back to CCK rates */ | 2185 | /* Don't fall back to CCK rates */ |
2164 | table[IWL_RATE_12M_INDEX].next_rate_index = IWL_RATE_9M_INDEX; | 2186 | table[IWL_RATE_12M_INDEX_TABLE].next_rate_index = IWL_RATE_9M_INDEX_TABLE; |
2165 | 2187 | ||
2166 | /* Don't drop out of OFDM rates */ | 2188 | /* Don't drop out of OFDM rates */ |
2167 | table[IWL_FIRST_OFDM_RATE].next_rate_index = | 2189 | table[IWL_RATE_6M_INDEX_TABLE].next_rate_index = |
2168 | IWL_FIRST_OFDM_RATE; | 2190 | iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index; |
2169 | break; | 2191 | break; |
2170 | 2192 | ||
2171 | case MODE_IEEE80211B: | 2193 | case MODE_IEEE80211B: |
2172 | IWL_DEBUG_RATE("Select B mode rate scale\n"); | 2194 | IWL_DEBUG_RATE("Select B mode rate scale\n"); |
2173 | /* If an OFDM rate is used, have it fall back to the | 2195 | /* If an OFDM rate is used, have it fall back to the |
2174 | * 1M CCK rates */ | 2196 | * 1M CCK rates */ |
2175 | for (i = IWL_FIRST_OFDM_RATE; i <= IWL_LAST_OFDM_RATE; i++) | 2197 | for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; i++) |
2176 | table[i].next_rate_index = IWL_FIRST_CCK_RATE; | 2198 | table[i].next_rate_index = iwl_rates[IWL_FIRST_CCK_RATE].table_rs_index; |
2177 | 2199 | ||
2178 | /* CCK shouldn't fall back to OFDM... */ | 2200 | /* CCK shouldn't fall back to OFDM... */ |
2179 | table[IWL_RATE_11M_INDEX].next_rate_index = IWL_RATE_5M_INDEX; | 2201 | table[IWL_RATE_11M_INDEX_TABLE].next_rate_index = IWL_RATE_5M_INDEX_TABLE; |
2180 | break; | 2202 | break; |
2181 | 2203 | ||
2182 | default: | 2204 | default: |
@@ -2248,22 +2270,12 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, | |||
2248 | tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | | 2270 | tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | |
2249 | TX_CMD_FLG_TSF_MSK); | 2271 | TX_CMD_FLG_TSF_MSK); |
2250 | 2272 | ||
2251 | /* supp_rates[0] == OFDM */ | 2273 | /* supp_rates[0] == OFDM start at IWL_FIRST_OFDM_RATE*/ |
2252 | tx_beacon_cmd->tx.supp_rates[0] = IWL_OFDM_BASIC_RATES_MASK; | 2274 | tx_beacon_cmd->tx.supp_rates[0] = |
2253 | 2275 | (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | |
2254 | /* supp_rates[1] == CCK | 2276 | |
2255 | * | ||
2256 | * NOTE: IWL_*_RATES_MASK are not in the order that supp_rates | ||
2257 | * expects so we have to shift them around. | ||
2258 | * | ||
2259 | * supp_rates expects: | ||
2260 | * CCK rates are bit0..3 | ||
2261 | * | ||
2262 | * However IWL_*_RATES_MASK has: | ||
2263 | * CCK rates are bit8..11 | ||
2264 | */ | ||
2265 | tx_beacon_cmd->tx.supp_rates[1] = | 2277 | tx_beacon_cmd->tx.supp_rates[1] = |
2266 | (IWL_CCK_BASIC_RATES_MASK >> 8) & 0xF; | 2278 | (IWL_CCK_BASIC_RATES_MASK & 0xF); |
2267 | 2279 | ||
2268 | return (sizeof(struct iwl_tx_beacon_cmd) + frame_size); | 2280 | return (sizeof(struct iwl_tx_beacon_cmd) + frame_size); |
2269 | } | 2281 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 557deebca1b9..891f90d2f019 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -3232,9 +3232,7 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, | |||
3232 | tx->rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[rate_index].plcp, | 3232 | tx->rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[rate_index].plcp, |
3233 | rate_flags); | 3233 | rate_flags); |
3234 | 3234 | ||
3235 | if (ieee80211_is_probe_request(fc)) | 3235 | if (ieee80211_is_back_request(fc)) |
3236 | tx->tx_flags |= TX_CMD_FLG_TSF_MSK; | ||
3237 | else if (ieee80211_is_back_request(fc)) | ||
3238 | tx->tx_flags |= TX_CMD_FLG_ACK_MSK | | 3236 | tx->tx_flags |= TX_CMD_FLG_ACK_MSK | |
3239 | TX_CMD_FLG_IMM_BA_RSP_MASK; | 3237 | TX_CMD_FLG_IMM_BA_RSP_MASK; |
3240 | #ifdef CONFIG_IWLWIFI_HT | 3238 | #ifdef CONFIG_IWLWIFI_HT |
@@ -3872,7 +3870,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, | |||
3872 | */ | 3870 | */ |
3873 | case IEEE80211_STYPE_ASSOC_RESP: | 3871 | case IEEE80211_STYPE_ASSOC_RESP: |
3874 | case IEEE80211_STYPE_REASSOC_RESP: | 3872 | case IEEE80211_STYPE_REASSOC_RESP: |
3875 | if (network_packet && iwl_is_associated(priv)) { | 3873 | if (network_packet) { |
3876 | #ifdef CONFIG_IWLWIFI_HT | 3874 | #ifdef CONFIG_IWLWIFI_HT |
3877 | u8 *pos = NULL; | 3875 | u8 *pos = NULL; |
3878 | struct ieee802_11_elems elems; | 3876 | struct ieee802_11_elems elems; |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 83019d1d7ccc..465da4f67ce7 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -4850,7 +4850,7 @@ static irqreturn_t iwl_isr(int irq, void *data) | |||
4850 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { | 4850 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { |
4851 | /* Hardware disappeared */ | 4851 | /* Hardware disappeared */ |
4852 | IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta); | 4852 | IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta); |
4853 | goto none; | 4853 | goto unplugged; |
4854 | } | 4854 | } |
4855 | 4855 | ||
4856 | IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", | 4856 | IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", |
@@ -4858,6 +4858,7 @@ static irqreturn_t iwl_isr(int irq, void *data) | |||
4858 | 4858 | ||
4859 | /* iwl_irq_tasklet() will service interrupts and re-enable them */ | 4859 | /* iwl_irq_tasklet() will service interrupts and re-enable them */ |
4860 | tasklet_schedule(&priv->irq_tasklet); | 4860 | tasklet_schedule(&priv->irq_tasklet); |
4861 | unplugged: | ||
4861 | spin_unlock(&priv->lock); | 4862 | spin_unlock(&priv->lock); |
4862 | 4863 | ||
4863 | return IRQ_HANDLED; | 4864 | return IRQ_HANDLED; |
@@ -5331,13 +5332,13 @@ static int iwl_init_geos(struct iwl_priv *priv) | |||
5331 | /* 5.2GHz channels start after the 2.4GHz channels */ | 5332 | /* 5.2GHz channels start after the 2.4GHz channels */ |
5332 | modes[A].mode = MODE_IEEE80211A; | 5333 | modes[A].mode = MODE_IEEE80211A; |
5333 | modes[A].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; | 5334 | modes[A].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; |
5334 | modes[A].rates = rates; | 5335 | modes[A].rates = &rates[4]; |
5335 | modes[A].num_rates = 8; /* just OFDM */ | 5336 | modes[A].num_rates = 8; /* just OFDM */ |
5336 | modes[A].num_channels = 0; | 5337 | modes[A].num_channels = 0; |
5337 | 5338 | ||
5338 | modes[B].mode = MODE_IEEE80211B; | 5339 | modes[B].mode = MODE_IEEE80211B; |
5339 | modes[B].channels = channels; | 5340 | modes[B].channels = channels; |
5340 | modes[B].rates = &rates[8]; | 5341 | modes[B].rates = rates; |
5341 | modes[B].num_rates = 4; /* just CCK */ | 5342 | modes[B].num_rates = 4; /* just CCK */ |
5342 | modes[B].num_channels = 0; | 5343 | modes[B].num_channels = 0; |
5343 | 5344 | ||
@@ -6478,8 +6479,9 @@ static void iwl_bg_scan_check(struct work_struct *data) | |||
6478 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, | 6479 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, |
6479 | "Scan completion watchdog resetting adapter (%dms)\n", | 6480 | "Scan completion watchdog resetting adapter (%dms)\n", |
6480 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); | 6481 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); |
6482 | |||
6481 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) | 6483 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6482 | queue_work(priv->workqueue, &priv->restart); | 6484 | iwl_send_scan_abort(priv); |
6483 | } | 6485 | } |
6484 | mutex_unlock(&priv->mutex); | 6486 | mutex_unlock(&priv->mutex); |
6485 | } | 6487 | } |
@@ -6575,7 +6577,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
6575 | spin_unlock_irqrestore(&priv->lock, flags); | 6577 | spin_unlock_irqrestore(&priv->lock, flags); |
6576 | 6578 | ||
6577 | scan->suspend_time = 0; | 6579 | scan->suspend_time = 0; |
6578 | scan->max_out_time = cpu_to_le32(600 * 1024); | 6580 | scan->max_out_time = cpu_to_le32(200 * 1024); |
6579 | if (!interval) | 6581 | if (!interval) |
6580 | interval = suspend_time; | 6582 | interval = suspend_time; |
6581 | /* | 6583 | /* |
@@ -6605,7 +6607,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
6605 | memcpy(scan->direct_scan[0].ssid, | 6607 | memcpy(scan->direct_scan[0].ssid, |
6606 | priv->direct_ssid, priv->direct_ssid_len); | 6608 | priv->direct_ssid, priv->direct_ssid_len); |
6607 | direct_mask = 1; | 6609 | direct_mask = 1; |
6608 | } else if (!iwl_is_associated(priv)) { | 6610 | } else if (!iwl_is_associated(priv) && priv->essid_len) { |
6609 | scan->direct_scan[0].id = WLAN_EID_SSID; | 6611 | scan->direct_scan[0].id = WLAN_EID_SSID; |
6610 | scan->direct_scan[0].len = priv->essid_len; | 6612 | scan->direct_scan[0].len = priv->essid_len; |
6611 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | 6613 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); |
@@ -6744,6 +6746,12 @@ static void iwl_bg_post_associate(struct work_struct *data) | |||
6744 | 6746 | ||
6745 | mutex_lock(&priv->mutex); | 6747 | mutex_lock(&priv->mutex); |
6746 | 6748 | ||
6749 | if (!priv->interface_id || !priv->is_open) { | ||
6750 | mutex_unlock(&priv->mutex); | ||
6751 | return; | ||
6752 | } | ||
6753 | iwl_scan_cancel_timeout(priv, 200); | ||
6754 | |||
6747 | conf = ieee80211_get_hw_conf(priv->hw); | 6755 | conf = ieee80211_get_hw_conf(priv->hw); |
6748 | 6756 | ||
6749 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 6757 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
@@ -6882,9 +6890,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw) | |||
6882 | struct iwl_priv *priv = hw->priv; | 6890 | struct iwl_priv *priv = hw->priv; |
6883 | 6891 | ||
6884 | IWL_DEBUG_MAC80211("enter\n"); | 6892 | IWL_DEBUG_MAC80211("enter\n"); |
6893 | |||
6894 | |||
6895 | mutex_lock(&priv->mutex); | ||
6896 | /* stop mac, cancel any scan request and clear | ||
6897 | * RXON_FILTER_ASSOC_MSK BIT | ||
6898 | */ | ||
6885 | priv->is_open = 0; | 6899 | priv->is_open = 0; |
6886 | /*netif_stop_queue(dev); */ | 6900 | iwl_scan_cancel_timeout(priv, 100); |
6887 | flush_workqueue(priv->workqueue); | 6901 | cancel_delayed_work(&priv->post_associate); |
6902 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
6903 | iwl_commit_rxon(priv); | ||
6904 | mutex_unlock(&priv->mutex); | ||
6905 | |||
6888 | IWL_DEBUG_MAC80211("leave\n"); | 6906 | IWL_DEBUG_MAC80211("leave\n"); |
6889 | } | 6907 | } |
6890 | 6908 | ||
@@ -7169,8 +7187,6 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7169 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 7187 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) |
7170 | iwl_config_ap(priv); | 7188 | iwl_config_ap(priv); |
7171 | else { | 7189 | else { |
7172 | priv->staging_rxon.filter_flags |= | ||
7173 | RXON_FILTER_ASSOC_MSK; | ||
7174 | rc = iwl_commit_rxon(priv); | 7190 | rc = iwl_commit_rxon(priv); |
7175 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) | 7191 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) |
7176 | iwl_add_station(priv, | 7192 | iwl_add_station(priv, |
@@ -7178,6 +7194,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7178 | } | 7194 | } |
7179 | 7195 | ||
7180 | } else { | 7196 | } else { |
7197 | iwl_scan_cancel_timeout(priv, 100); | ||
7181 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7198 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
7182 | iwl_commit_rxon(priv); | 7199 | iwl_commit_rxon(priv); |
7183 | } | 7200 | } |
@@ -7217,6 +7234,12 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw, | |||
7217 | IWL_DEBUG_MAC80211("enter\n"); | 7234 | IWL_DEBUG_MAC80211("enter\n"); |
7218 | 7235 | ||
7219 | mutex_lock(&priv->mutex); | 7236 | mutex_lock(&priv->mutex); |
7237 | |||
7238 | iwl_scan_cancel_timeout(priv, 100); | ||
7239 | cancel_delayed_work(&priv->post_associate); | ||
7240 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
7241 | iwl_commit_rxon(priv); | ||
7242 | |||
7220 | if (priv->interface_id == conf->if_id) { | 7243 | if (priv->interface_id == conf->if_id) { |
7221 | priv->interface_id = 0; | 7244 | priv->interface_id = 0; |
7222 | memset(priv->bssid, 0, ETH_ALEN); | 7245 | memset(priv->bssid, 0, ETH_ALEN); |
@@ -7238,6 +7261,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7238 | 7261 | ||
7239 | IWL_DEBUG_MAC80211("enter\n"); | 7262 | IWL_DEBUG_MAC80211("enter\n"); |
7240 | 7263 | ||
7264 | mutex_lock(&priv->mutex); | ||
7241 | spin_lock_irqsave(&priv->lock, flags); | 7265 | spin_lock_irqsave(&priv->lock, flags); |
7242 | 7266 | ||
7243 | if (!iwl_is_ready_rf(priv)) { | 7267 | if (!iwl_is_ready_rf(priv)) { |
@@ -7268,7 +7292,8 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7268 | priv->direct_ssid_len = (u8) | 7292 | priv->direct_ssid_len = (u8) |
7269 | min((u8) len, (u8) IW_ESSID_MAX_SIZE); | 7293 | min((u8) len, (u8) IW_ESSID_MAX_SIZE); |
7270 | memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); | 7294 | memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); |
7271 | } | 7295 | } else |
7296 | priv->one_direct_scan = 0; | ||
7272 | 7297 | ||
7273 | rc = iwl_scan_initiate(priv); | 7298 | rc = iwl_scan_initiate(priv); |
7274 | 7299 | ||
@@ -7276,6 +7301,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7276 | 7301 | ||
7277 | out_unlock: | 7302 | out_unlock: |
7278 | spin_unlock_irqrestore(&priv->lock, flags); | 7303 | spin_unlock_irqrestore(&priv->lock, flags); |
7304 | mutex_unlock(&priv->mutex); | ||
7279 | 7305 | ||
7280 | return rc; | 7306 | return rc; |
7281 | } | 7307 | } |
@@ -7310,6 +7336,8 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
7310 | 7336 | ||
7311 | mutex_lock(&priv->mutex); | 7337 | mutex_lock(&priv->mutex); |
7312 | 7338 | ||
7339 | iwl_scan_cancel_timeout(priv, 100); | ||
7340 | |||
7313 | switch (cmd) { | 7341 | switch (cmd) { |
7314 | case SET_KEY: | 7342 | case SET_KEY: |
7315 | rc = iwl_update_sta_key_info(priv, key, sta_id); | 7343 | rc = iwl_update_sta_key_info(priv, key, sta_id); |
@@ -7479,8 +7507,18 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7479 | 7507 | ||
7480 | spin_unlock_irqrestore(&priv->lock, flags); | 7508 | spin_unlock_irqrestore(&priv->lock, flags); |
7481 | 7509 | ||
7510 | /* we are restarting association process | ||
7511 | * clear RXON_FILTER_ASSOC_MSK bit | ||
7512 | */ | ||
7513 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | ||
7514 | iwl_scan_cancel_timeout(priv, 100); | ||
7515 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
7516 | iwl_commit_rxon(priv); | ||
7517 | } | ||
7518 | |||
7482 | /* Per mac80211.h: This is only used in IBSS mode... */ | 7519 | /* Per mac80211.h: This is only used in IBSS mode... */ |
7483 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 7520 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { |
7521 | |||
7484 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); | 7522 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); |
7485 | mutex_unlock(&priv->mutex); | 7523 | mutex_unlock(&priv->mutex); |
7486 | return; | 7524 | return; |
@@ -8317,6 +8355,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8317 | } | 8355 | } |
8318 | SET_IEEE80211_DEV(hw, &pdev->dev); | 8356 | SET_IEEE80211_DEV(hw, &pdev->dev); |
8319 | 8357 | ||
8358 | hw->rate_control_algorithm = "iwl-3945-rs"; | ||
8359 | |||
8320 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); | 8360 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); |
8321 | priv = hw->priv; | 8361 | priv = hw->priv; |
8322 | priv->hw = hw; | 8362 | priv->hw = hw; |
@@ -8558,6 +8598,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) | |||
8558 | iwl_rate_control_unregister(priv->hw); | 8598 | iwl_rate_control_unregister(priv->hw); |
8559 | } | 8599 | } |
8560 | 8600 | ||
8601 | /*netif_stop_queue(dev); */ | ||
8602 | flush_workqueue(priv->workqueue); | ||
8603 | |||
8561 | /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes | 8604 | /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes |
8562 | * priv->workqueue... so we can't take down the workqueue | 8605 | * priv->workqueue... so we can't take down the workqueue |
8563 | * until now... */ | 8606 | * until now... */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 5e1279263b22..9918780f5e86 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -5156,9 +5156,10 @@ static irqreturn_t iwl_isr(int irq, void *data) | |||
5156 | } | 5156 | } |
5157 | 5157 | ||
5158 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { | 5158 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { |
5159 | /* Hardware disappeared */ | 5159 | /* Hardware disappeared. It might have already raised |
5160 | * an interrupt */ | ||
5160 | IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta); | 5161 | IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta); |
5161 | goto none; | 5162 | goto unplugged; |
5162 | } | 5163 | } |
5163 | 5164 | ||
5164 | IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", | 5165 | IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", |
@@ -5166,8 +5167,9 @@ static irqreturn_t iwl_isr(int irq, void *data) | |||
5166 | 5167 | ||
5167 | /* iwl_irq_tasklet() will service interrupts and re-enable them */ | 5168 | /* iwl_irq_tasklet() will service interrupts and re-enable them */ |
5168 | tasklet_schedule(&priv->irq_tasklet); | 5169 | tasklet_schedule(&priv->irq_tasklet); |
5169 | spin_unlock(&priv->lock); | ||
5170 | 5170 | ||
5171 | unplugged: | ||
5172 | spin_unlock(&priv->lock); | ||
5171 | return IRQ_HANDLED; | 5173 | return IRQ_HANDLED; |
5172 | 5174 | ||
5173 | none: | 5175 | none: |
@@ -6845,8 +6847,9 @@ static void iwl_bg_scan_check(struct work_struct *data) | |||
6845 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, | 6847 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, |
6846 | "Scan completion watchdog resetting adapter (%dms)\n", | 6848 | "Scan completion watchdog resetting adapter (%dms)\n", |
6847 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); | 6849 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); |
6850 | |||
6848 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) | 6851 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6849 | queue_work(priv->workqueue, &priv->restart); | 6852 | iwl_send_scan_abort(priv); |
6850 | } | 6853 | } |
6851 | mutex_unlock(&priv->mutex); | 6854 | mutex_unlock(&priv->mutex); |
6852 | } | 6855 | } |
@@ -6942,7 +6945,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
6942 | spin_unlock_irqrestore(&priv->lock, flags); | 6945 | spin_unlock_irqrestore(&priv->lock, flags); |
6943 | 6946 | ||
6944 | scan->suspend_time = 0; | 6947 | scan->suspend_time = 0; |
6945 | scan->max_out_time = cpu_to_le32(600 * 1024); | 6948 | scan->max_out_time = cpu_to_le32(200 * 1024); |
6946 | if (!interval) | 6949 | if (!interval) |
6947 | interval = suspend_time; | 6950 | interval = suspend_time; |
6948 | 6951 | ||
@@ -6965,7 +6968,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
6965 | memcpy(scan->direct_scan[0].ssid, | 6968 | memcpy(scan->direct_scan[0].ssid, |
6966 | priv->direct_ssid, priv->direct_ssid_len); | 6969 | priv->direct_ssid, priv->direct_ssid_len); |
6967 | direct_mask = 1; | 6970 | direct_mask = 1; |
6968 | } else if (!iwl_is_associated(priv)) { | 6971 | } else if (!iwl_is_associated(priv) && priv->essid_len) { |
6969 | scan->direct_scan[0].id = WLAN_EID_SSID; | 6972 | scan->direct_scan[0].id = WLAN_EID_SSID; |
6970 | scan->direct_scan[0].len = priv->essid_len; | 6973 | scan->direct_scan[0].len = priv->essid_len; |
6971 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | 6974 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); |
@@ -7118,6 +7121,12 @@ static void iwl_bg_post_associate(struct work_struct *data) | |||
7118 | 7121 | ||
7119 | mutex_lock(&priv->mutex); | 7122 | mutex_lock(&priv->mutex); |
7120 | 7123 | ||
7124 | if (!priv->interface_id || !priv->is_open) { | ||
7125 | mutex_unlock(&priv->mutex); | ||
7126 | return; | ||
7127 | } | ||
7128 | iwl_scan_cancel_timeout(priv, 200); | ||
7129 | |||
7121 | conf = ieee80211_get_hw_conf(priv->hw); | 7130 | conf = ieee80211_get_hw_conf(priv->hw); |
7122 | 7131 | ||
7123 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7132 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
@@ -7271,9 +7280,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw) | |||
7271 | struct iwl_priv *priv = hw->priv; | 7280 | struct iwl_priv *priv = hw->priv; |
7272 | 7281 | ||
7273 | IWL_DEBUG_MAC80211("enter\n"); | 7282 | IWL_DEBUG_MAC80211("enter\n"); |
7283 | |||
7284 | |||
7285 | mutex_lock(&priv->mutex); | ||
7286 | /* stop mac, cancel any scan request and clear | ||
7287 | * RXON_FILTER_ASSOC_MSK BIT | ||
7288 | */ | ||
7274 | priv->is_open = 0; | 7289 | priv->is_open = 0; |
7275 | /*netif_stop_queue(dev); */ | 7290 | iwl_scan_cancel_timeout(priv, 100); |
7276 | flush_workqueue(priv->workqueue); | 7291 | cancel_delayed_work(&priv->post_associate); |
7292 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
7293 | iwl_commit_rxon(priv); | ||
7294 | mutex_unlock(&priv->mutex); | ||
7295 | |||
7277 | IWL_DEBUG_MAC80211("leave\n"); | 7296 | IWL_DEBUG_MAC80211("leave\n"); |
7278 | } | 7297 | } |
7279 | 7298 | ||
@@ -7573,8 +7592,6 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7573 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 7592 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) |
7574 | iwl_config_ap(priv); | 7593 | iwl_config_ap(priv); |
7575 | else { | 7594 | else { |
7576 | priv->staging_rxon.filter_flags |= | ||
7577 | RXON_FILTER_ASSOC_MSK; | ||
7578 | rc = iwl_commit_rxon(priv); | 7595 | rc = iwl_commit_rxon(priv); |
7579 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) | 7596 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) |
7580 | iwl_rxon_add_station( | 7597 | iwl_rxon_add_station( |
@@ -7582,6 +7599,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7582 | } | 7599 | } |
7583 | 7600 | ||
7584 | } else { | 7601 | } else { |
7602 | iwl_scan_cancel_timeout(priv, 100); | ||
7585 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7603 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
7586 | iwl_commit_rxon(priv); | 7604 | iwl_commit_rxon(priv); |
7587 | } | 7605 | } |
@@ -7621,6 +7639,12 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw, | |||
7621 | IWL_DEBUG_MAC80211("enter\n"); | 7639 | IWL_DEBUG_MAC80211("enter\n"); |
7622 | 7640 | ||
7623 | mutex_lock(&priv->mutex); | 7641 | mutex_lock(&priv->mutex); |
7642 | |||
7643 | iwl_scan_cancel_timeout(priv, 100); | ||
7644 | cancel_delayed_work(&priv->post_associate); | ||
7645 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
7646 | iwl_commit_rxon(priv); | ||
7647 | |||
7624 | if (priv->interface_id == conf->if_id) { | 7648 | if (priv->interface_id == conf->if_id) { |
7625 | priv->interface_id = 0; | 7649 | priv->interface_id = 0; |
7626 | memset(priv->bssid, 0, ETH_ALEN); | 7650 | memset(priv->bssid, 0, ETH_ALEN); |
@@ -7642,6 +7666,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7642 | 7666 | ||
7643 | IWL_DEBUG_MAC80211("enter\n"); | 7667 | IWL_DEBUG_MAC80211("enter\n"); |
7644 | 7668 | ||
7669 | mutex_lock(&priv->mutex); | ||
7645 | spin_lock_irqsave(&priv->lock, flags); | 7670 | spin_lock_irqsave(&priv->lock, flags); |
7646 | 7671 | ||
7647 | if (!iwl_is_ready_rf(priv)) { | 7672 | if (!iwl_is_ready_rf(priv)) { |
@@ -7672,7 +7697,8 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7672 | priv->direct_ssid_len = (u8) | 7697 | priv->direct_ssid_len = (u8) |
7673 | min((u8) len, (u8) IW_ESSID_MAX_SIZE); | 7698 | min((u8) len, (u8) IW_ESSID_MAX_SIZE); |
7674 | memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); | 7699 | memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); |
7675 | } | 7700 | } else |
7701 | priv->one_direct_scan = 0; | ||
7676 | 7702 | ||
7677 | rc = iwl_scan_initiate(priv); | 7703 | rc = iwl_scan_initiate(priv); |
7678 | 7704 | ||
@@ -7680,6 +7706,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7680 | 7706 | ||
7681 | out_unlock: | 7707 | out_unlock: |
7682 | spin_unlock_irqrestore(&priv->lock, flags); | 7708 | spin_unlock_irqrestore(&priv->lock, flags); |
7709 | mutex_unlock(&priv->mutex); | ||
7683 | 7710 | ||
7684 | return rc; | 7711 | return rc; |
7685 | } | 7712 | } |
@@ -7713,6 +7740,8 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
7713 | 7740 | ||
7714 | mutex_lock(&priv->mutex); | 7741 | mutex_lock(&priv->mutex); |
7715 | 7742 | ||
7743 | iwl_scan_cancel_timeout(priv, 100); | ||
7744 | |||
7716 | switch (cmd) { | 7745 | switch (cmd) { |
7717 | case SET_KEY: | 7746 | case SET_KEY: |
7718 | rc = iwl_update_sta_key_info(priv, key, sta_id); | 7747 | rc = iwl_update_sta_key_info(priv, key, sta_id); |
@@ -7903,8 +7932,18 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7903 | 7932 | ||
7904 | spin_unlock_irqrestore(&priv->lock, flags); | 7933 | spin_unlock_irqrestore(&priv->lock, flags); |
7905 | 7934 | ||
7935 | /* we are restarting association process | ||
7936 | * clear RXON_FILTER_ASSOC_MSK bit | ||
7937 | */ | ||
7938 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | ||
7939 | iwl_scan_cancel_timeout(priv, 100); | ||
7940 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
7941 | iwl_commit_rxon(priv); | ||
7942 | } | ||
7943 | |||
7906 | /* Per mac80211.h: This is only used in IBSS mode... */ | 7944 | /* Per mac80211.h: This is only used in IBSS mode... */ |
7907 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 7945 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { |
7946 | |||
7908 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); | 7947 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); |
7909 | mutex_unlock(&priv->mutex); | 7948 | mutex_unlock(&priv->mutex); |
7910 | return; | 7949 | return; |
@@ -8918,6 +8957,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8918 | } | 8957 | } |
8919 | SET_IEEE80211_DEV(hw, &pdev->dev); | 8958 | SET_IEEE80211_DEV(hw, &pdev->dev); |
8920 | 8959 | ||
8960 | hw->rate_control_algorithm = "iwl-4965-rs"; | ||
8961 | |||
8921 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); | 8962 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); |
8922 | priv = hw->priv; | 8963 | priv = hw->priv; |
8923 | priv->hw = hw; | 8964 | priv->hw = hw; |
@@ -9152,6 +9193,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) | |||
9152 | iwl_rate_control_unregister(priv->hw); | 9193 | iwl_rate_control_unregister(priv->hw); |
9153 | } | 9194 | } |
9154 | 9195 | ||
9196 | /*netif_stop_queue(dev); */ | ||
9197 | flush_workqueue(priv->workqueue); | ||
9198 | |||
9155 | /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes | 9199 | /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes |
9156 | * priv->workqueue... so we can't take down the workqueue | 9200 | * priv->workqueue... so we can't take down the workqueue |
9157 | * until now... */ | 9201 | * until now... */ |
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 1cbbd96fdbde..be5cfd8402c7 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -912,6 +912,10 @@ static int wlan_cmd_set_boot2_ver(wlan_private * priv, | |||
912 | return 0; | 912 | return 0; |
913 | } | 913 | } |
914 | 914 | ||
915 | /* | ||
916 | * Note: NEVER use libertas_queue_cmd() with addtail==0 other than for | ||
917 | * the command timer, because it does not account for queued commands. | ||
918 | */ | ||
915 | void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail) | 919 | void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail) |
916 | { | 920 | { |
917 | unsigned long flags; | 921 | unsigned long flags; |
@@ -941,10 +945,11 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u | |||
941 | 945 | ||
942 | spin_lock_irqsave(&adapter->driver_lock, flags); | 946 | spin_lock_irqsave(&adapter->driver_lock, flags); |
943 | 947 | ||
944 | if (addtail) | 948 | if (addtail) { |
945 | list_add_tail((struct list_head *)cmdnode, | 949 | list_add_tail((struct list_head *)cmdnode, |
946 | &adapter->cmdpendingq); | 950 | &adapter->cmdpendingq); |
947 | else | 951 | adapter->nr_cmd_pending++; |
952 | } else | ||
948 | list_add((struct list_head *)cmdnode, &adapter->cmdpendingq); | 953 | list_add((struct list_head *)cmdnode, &adapter->cmdpendingq); |
949 | 954 | ||
950 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 955 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
@@ -1412,7 +1417,6 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1412 | cmdnode->cmdwaitqwoken = 0; | 1417 | cmdnode->cmdwaitqwoken = 0; |
1413 | 1418 | ||
1414 | libertas_queue_cmd(adapter, cmdnode, 1); | 1419 | libertas_queue_cmd(adapter, cmdnode, 1); |
1415 | adapter->nr_cmd_pending++; | ||
1416 | wake_up_interruptible(&priv->waitq); | 1420 | wake_up_interruptible(&priv->waitq); |
1417 | 1421 | ||
1418 | if (wait_option & CMD_OPTION_WAITFORRSP) { | 1422 | if (wait_option & CMD_OPTION_WAITFORRSP) { |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 0360cad363a8..ec89dabc412c 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
@@ -148,11 +148,11 @@ static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 r | |||
148 | { | 148 | { |
149 | int i; | 149 | int i; |
150 | 150 | ||
151 | for (i = 0; i < 500; i++) { | 151 | for (i = 0; i < 1000; i++) { |
152 | u8 val = if_cs_read8(card, addr); | 152 | u8 val = if_cs_read8(card, addr); |
153 | if (val == reg) | 153 | if (val == reg) |
154 | return i; | 154 | return i; |
155 | udelay(100); | 155 | udelay(500); |
156 | } | 156 | } |
157 | return -ETIME; | 157 | return -ETIME; |
158 | } | 158 | } |
@@ -878,6 +878,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
878 | goto out3; | 878 | goto out3; |
879 | } | 879 | } |
880 | 880 | ||
881 | /* Clear any interrupt cause that happend while sending | ||
882 | * firmware/initializing card */ | ||
883 | if_cs_write16(card, IF_CS_C_INT_CAUSE, IF_CS_C_IC_MASK); | ||
881 | if_cs_enable_ints(card); | 884 | if_cs_enable_ints(card); |
882 | 885 | ||
883 | /* And finally bring the card up */ | 886 | /* And finally bring the card up */ |
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index a8e17076e7de..b24425f74883 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c | |||
@@ -182,12 +182,14 @@ static int if_sdio_handle_data(struct if_sdio_card *card, | |||
182 | goto out; | 182 | goto out; |
183 | } | 183 | } |
184 | 184 | ||
185 | skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE); | 185 | skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + NET_IP_ALIGN); |
186 | if (!skb) { | 186 | if (!skb) { |
187 | ret = -ENOMEM; | 187 | ret = -ENOMEM; |
188 | goto out; | 188 | goto out; |
189 | } | 189 | } |
190 | 190 | ||
191 | skb_reserve(skb, NET_IP_ALIGN); | ||
192 | |||
191 | data = skb_put(skb, size); | 193 | data = skb_put(skb, size); |
192 | 194 | ||
193 | memcpy(data, buffer, size); | 195 | memcpy(data, buffer, size); |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index ff2d63267b19..702321c30164 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -620,7 +620,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev) | |||
620 | * up to version C the link tuning should halt after 20 | 620 | * up to version C the link tuning should halt after 20 |
621 | * seconds. | 621 | * seconds. |
622 | */ | 622 | */ |
623 | if (rt2x00_get_rev(&rt2x00dev->chip) < RT2560_VERSION_D && | 623 | if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D && |
624 | rt2x00dev->link.count > 20) | 624 | rt2x00dev->link.count > 20) |
625 | return; | 625 | return; |
626 | 626 | ||
@@ -630,7 +630,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev) | |||
630 | * Chipset versions C and lower should directly continue | 630 | * Chipset versions C and lower should directly continue |
631 | * to the dynamic CCA tuning. | 631 | * to the dynamic CCA tuning. |
632 | */ | 632 | */ |
633 | if (rt2x00_get_rev(&rt2x00dev->chip) < RT2560_VERSION_D) | 633 | if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D) |
634 | goto dynamic_cca_tune; | 634 | goto dynamic_cca_tune; |
635 | 635 | ||
636 | /* | 636 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 7cdc80a122bb..50775f9234cc 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -753,7 +753,7 @@ static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev) | |||
753 | rt2x00_set_field16(®, MAC_CSR1_HOST_READY, 1); | 753 | rt2x00_set_field16(®, MAC_CSR1_HOST_READY, 1); |
754 | rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg); | 754 | rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg); |
755 | 755 | ||
756 | if (rt2x00_get_rev(&rt2x00dev->chip) >= RT2570_VERSION_C) { | 756 | if (rt2x00_rev(&rt2x00dev->chip) >= RT2570_VERSION_C) { |
757 | rt2500usb_register_read(rt2x00dev, PHY_CSR2, ®); | 757 | rt2500usb_register_read(rt2x00dev, PHY_CSR2, ®); |
758 | reg &= ~0x0002; | 758 | reg &= ~0x0002; |
759 | } else { | 759 | } else { |
@@ -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 | } |
@@ -1257,7 +1257,7 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1257 | rt2500usb_register_read(rt2x00dev, MAC_CSR0, ®); | 1257 | rt2500usb_register_read(rt2x00dev, MAC_CSR0, ®); |
1258 | rt2x00_set_chip(rt2x00dev, RT2570, value, reg); | 1258 | rt2x00_set_chip(rt2x00dev, RT2570, value, reg); |
1259 | 1259 | ||
1260 | if (rt2x00_rev(&rt2x00dev->chip, 0xffff0)) { | 1260 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0)) { |
1261 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 1261 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
1262 | return -ENODEV; | 1262 | return -ENODEV; |
1263 | } | 1263 | } |
@@ -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 9845e584b731..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; |
@@ -751,14 +756,16 @@ static inline char rt2x00_rf(const struct rt2x00_chip *chipset, const u16 chip) | |||
751 | return (chipset->rf == chip); | 756 | return (chipset->rf == chip); |
752 | } | 757 | } |
753 | 758 | ||
754 | static inline u16 rt2x00_get_rev(const struct rt2x00_chip *chipset) | 759 | static inline u16 rt2x00_rev(const struct rt2x00_chip *chipset) |
755 | { | 760 | { |
756 | return chipset->rev; | 761 | return chipset->rev; |
757 | } | 762 | } |
758 | 763 | ||
759 | static inline u16 rt2x00_rev(const struct rt2x00_chip *chipset, const u32 mask) | 764 | static inline u16 rt2x00_check_rev(const struct rt2x00_chip *chipset, |
765 | const u32 rev) | ||
760 | { | 766 | { |
761 | return chipset->rev & mask; | 767 | return (((chipset->rev & 0xffff0) == rev) && |
768 | !!(chipset->rev & 0x0000f)); | ||
762 | } | 769 | } |
763 | 770 | ||
764 | /* | 771 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 298faa9d3f61..06d9bc0015c0 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -30,7 +30,7 @@ | |||
30 | * Interval defines | 30 | * Interval defines |
31 | * Both the link tuner as the rfkill will be called once per second. | 31 | * Both the link tuner as the rfkill will be called once per second. |
32 | */ | 32 | */ |
33 | #define LINK_TUNE_INTERVAL ( round_jiffies(HZ) ) | 33 | #define LINK_TUNE_INTERVAL ( round_jiffies_relative(HZ) ) |
34 | #define RFKILL_POLL_INTERVAL ( 1000 ) | 34 | #define RFKILL_POLL_INTERVAL ( 1000 ) |
35 | 35 | ||
36 | /* | 36 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 4a6a0bd01ff1..85ea8a8e658e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -196,6 +196,14 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, | |||
196 | struct rt2x00_dev *rt2x00dev = hw->priv; | 196 | struct rt2x00_dev *rt2x00dev = hw->priv; |
197 | struct interface *intf = &rt2x00dev->interface; | 197 | struct interface *intf = &rt2x00dev->interface; |
198 | 198 | ||
199 | /* FIXME: Beaconing is broken in rt2x00. */ | ||
200 | if (conf->type == IEEE80211_IF_TYPE_IBSS || | ||
201 | conf->type == IEEE80211_IF_TYPE_AP) { | ||
202 | ERROR(rt2x00dev, | ||
203 | "rt2x00 does not support Adhoc or Master mode"); | ||
204 | return -EOPNOTSUPP; | ||
205 | } | ||
206 | |||
199 | /* | 207 | /* |
200 | * Don't allow interfaces to be added while | 208 | * Don't allow interfaces to be added while |
201 | * either the device has disappeared or when | 209 | * either the device has disappeared or when |
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 46c8c0840a65..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 | } |
@@ -1486,7 +1486,7 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1486 | rt73usb_register_read(rt2x00dev, MAC_CSR0, ®); | 1486 | rt73usb_register_read(rt2x00dev, MAC_CSR0, ®); |
1487 | rt2x00_set_chip(rt2x00dev, RT2571, value, reg); | 1487 | rt2x00_set_chip(rt2x00dev, RT2571, value, reg); |
1488 | 1488 | ||
1489 | if (!rt2x00_rev(&rt2x00dev->chip, 0x25730)) { | 1489 | if (!rt2x00_check_rev(&rt2x00dev->chip, 0x25730)) { |
1490 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); | 1490 | ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); |
1491 | return -ENODEV; | 1491 | return -ENODEV; |
1492 | } | 1492 | } |
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index de61c8fe6492..e454ae83e97a 100644 --- a/drivers/net/wireless/rtl8187_dev.c +++ b/drivers/net/wireless/rtl8187_dev.c | |||
@@ -433,6 +433,9 @@ static int rtl8187_start(struct ieee80211_hw *dev) | |||
433 | 433 | ||
434 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF); | 434 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF); |
435 | 435 | ||
436 | rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0); | ||
437 | rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0); | ||
438 | |||
436 | rtl8187_init_urbs(dev); | 439 | rtl8187_init_urbs(dev); |
437 | 440 | ||
438 | reg = RTL818X_RX_CONF_ONLYERLPKT | | 441 | reg = RTL818X_RX_CONF_ONLYERLPKT | |
@@ -582,32 +585,31 @@ static int rtl8187_config_interface(struct ieee80211_hw *dev, int if_id, | |||
582 | static void rtl8187_configure_filter(struct ieee80211_hw *dev, | 585 | static void rtl8187_configure_filter(struct ieee80211_hw *dev, |
583 | unsigned int changed_flags, | 586 | unsigned int changed_flags, |
584 | unsigned int *total_flags, | 587 | unsigned int *total_flags, |
585 | int mc_count, struct dev_addr_list *mc_list) | 588 | int mc_count, struct dev_addr_list *mclist) |
586 | { | 589 | { |
587 | struct rtl8187_priv *priv = dev->priv; | 590 | struct rtl8187_priv *priv = dev->priv; |
588 | 591 | ||
589 | *total_flags = 0; | ||
590 | |||
591 | if (changed_flags & FIF_ALLMULTI) | ||
592 | priv->rx_conf ^= RTL818X_RX_CONF_MULTICAST; | ||
593 | if (changed_flags & FIF_FCSFAIL) | 592 | if (changed_flags & FIF_FCSFAIL) |
594 | priv->rx_conf ^= RTL818X_RX_CONF_FCS; | 593 | priv->rx_conf ^= RTL818X_RX_CONF_FCS; |
595 | if (changed_flags & FIF_CONTROL) | 594 | if (changed_flags & FIF_CONTROL) |
596 | priv->rx_conf ^= RTL818X_RX_CONF_CTRL; | 595 | priv->rx_conf ^= RTL818X_RX_CONF_CTRL; |
597 | if (changed_flags & FIF_OTHER_BSS) | 596 | if (changed_flags & FIF_OTHER_BSS) |
598 | priv->rx_conf ^= RTL818X_RX_CONF_MONITOR; | 597 | priv->rx_conf ^= RTL818X_RX_CONF_MONITOR; |
599 | 598 | if (*total_flags & FIF_ALLMULTI || mc_count > 0) | |
600 | if (mc_count > 0) | ||
601 | priv->rx_conf |= RTL818X_RX_CONF_MULTICAST; | 599 | priv->rx_conf |= RTL818X_RX_CONF_MULTICAST; |
600 | else | ||
601 | priv->rx_conf &= ~RTL818X_RX_CONF_MULTICAST; | ||
602 | |||
603 | *total_flags = 0; | ||
602 | 604 | ||
603 | if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST) | ||
604 | *total_flags |= FIF_ALLMULTI; | ||
605 | if (priv->rx_conf & RTL818X_RX_CONF_FCS) | 605 | if (priv->rx_conf & RTL818X_RX_CONF_FCS) |
606 | *total_flags |= FIF_FCSFAIL; | 606 | *total_flags |= FIF_FCSFAIL; |
607 | if (priv->rx_conf & RTL818X_RX_CONF_CTRL) | 607 | if (priv->rx_conf & RTL818X_RX_CONF_CTRL) |
608 | *total_flags |= FIF_CONTROL; | 608 | *total_flags |= FIF_CONTROL; |
609 | if (priv->rx_conf & RTL818X_RX_CONF_MONITOR) | 609 | if (priv->rx_conf & RTL818X_RX_CONF_MONITOR) |
610 | *total_flags |= FIF_OTHER_BSS; | 610 | *total_flags |= FIF_OTHER_BSS; |
611 | if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST) | ||
612 | *total_flags |= FIF_ALLMULTI; | ||
611 | 613 | ||
612 | rtl818x_iowrite32_async(priv, &priv->map->RX_CONF, priv->rx_conf); | 614 | rtl818x_iowrite32_async(priv, &priv->map->RX_CONF, priv->rx_conf); |
613 | } | 615 | } |
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c index 4bd14b331862..88efe1bae58f 100644 --- a/drivers/net/wireless/strip.c +++ b/drivers/net/wireless/strip.c | |||
@@ -2735,16 +2735,8 @@ static int strip_ioctl(struct tty_struct *tty, struct file *file, | |||
2735 | return -EFAULT; | 2735 | return -EFAULT; |
2736 | return set_mac_address(strip_info, &addr); | 2736 | return set_mac_address(strip_info, &addr); |
2737 | } | 2737 | } |
2738 | /* | ||
2739 | * Allow stty to read, but not set, the serial port | ||
2740 | */ | ||
2741 | |||
2742 | case TCGETS: | ||
2743 | case TCGETA: | ||
2744 | return n_tty_ioctl(tty, file, cmd, arg); | ||
2745 | break; | ||
2746 | default: | 2738 | default: |
2747 | return -ENOIOCTLCMD; | 2739 | return tty_mode_ioctl(tty, file, cmd, arg); |
2748 | break; | 2740 | break; |
2749 | } | 2741 | } |
2750 | return 0; | 2742 | return 0; |
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c index a83c3db7d18f..c93d3d2640ab 100644 --- a/drivers/oprofile/cpu_buffer.c +++ b/drivers/oprofile/cpu_buffer.c | |||
@@ -64,6 +64,8 @@ int alloc_cpu_buffers(void) | |||
64 | b->head_pos = 0; | 64 | b->head_pos = 0; |
65 | b->sample_received = 0; | 65 | b->sample_received = 0; |
66 | b->sample_lost_overflow = 0; | 66 | b->sample_lost_overflow = 0; |
67 | b->backtrace_aborted = 0; | ||
68 | b->sample_invalid_eip = 0; | ||
67 | b->cpu = i; | 69 | b->cpu = i; |
68 | INIT_DELAYED_WORK(&b->work, wq_sync_buffer); | 70 | INIT_DELAYED_WORK(&b->work, wq_sync_buffer); |
69 | } | 71 | } |
@@ -175,6 +177,11 @@ static int log_sample(struct oprofile_cpu_buffer * cpu_buf, unsigned long pc, | |||
175 | 177 | ||
176 | cpu_buf->sample_received++; | 178 | cpu_buf->sample_received++; |
177 | 179 | ||
180 | if (pc == ESCAPE_CODE) { | ||
181 | cpu_buf->sample_invalid_eip++; | ||
182 | return 0; | ||
183 | } | ||
184 | |||
178 | if (nr_available_slots(cpu_buf) < 3) { | 185 | if (nr_available_slots(cpu_buf) < 3) { |
179 | cpu_buf->sample_lost_overflow++; | 186 | cpu_buf->sample_lost_overflow++; |
180 | return 0; | 187 | return 0; |
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h index 49900d9e3235..c66c025abe75 100644 --- a/drivers/oprofile/cpu_buffer.h +++ b/drivers/oprofile/cpu_buffer.h | |||
@@ -42,6 +42,7 @@ struct oprofile_cpu_buffer { | |||
42 | unsigned long sample_received; | 42 | unsigned long sample_received; |
43 | unsigned long sample_lost_overflow; | 43 | unsigned long sample_lost_overflow; |
44 | unsigned long backtrace_aborted; | 44 | unsigned long backtrace_aborted; |
45 | unsigned long sample_invalid_eip; | ||
45 | int cpu; | 46 | int cpu; |
46 | struct delayed_work work; | 47 | struct delayed_work work; |
47 | } ____cacheline_aligned; | 48 | } ____cacheline_aligned; |
diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c index f0acb661c253..d1f6d776e9e4 100644 --- a/drivers/oprofile/oprofile_stats.c +++ b/drivers/oprofile/oprofile_stats.c | |||
@@ -26,6 +26,8 @@ void oprofile_reset_stats(void) | |||
26 | cpu_buf = &cpu_buffer[i]; | 26 | cpu_buf = &cpu_buffer[i]; |
27 | cpu_buf->sample_received = 0; | 27 | cpu_buf->sample_received = 0; |
28 | cpu_buf->sample_lost_overflow = 0; | 28 | cpu_buf->sample_lost_overflow = 0; |
29 | cpu_buf->backtrace_aborted = 0; | ||
30 | cpu_buf->sample_invalid_eip = 0; | ||
29 | } | 31 | } |
30 | 32 | ||
31 | atomic_set(&oprofile_stats.sample_lost_no_mm, 0); | 33 | atomic_set(&oprofile_stats.sample_lost_no_mm, 0); |
@@ -61,6 +63,8 @@ void oprofile_create_stats_files(struct super_block * sb, struct dentry * root) | |||
61 | &cpu_buf->sample_lost_overflow); | 63 | &cpu_buf->sample_lost_overflow); |
62 | oprofilefs_create_ro_ulong(sb, cpudir, "backtrace_aborted", | 64 | oprofilefs_create_ro_ulong(sb, cpudir, "backtrace_aborted", |
63 | &cpu_buf->backtrace_aborted); | 65 | &cpu_buf->backtrace_aborted); |
66 | oprofilefs_create_ro_ulong(sb, cpudir, "sample_invalid_eip", | ||
67 | &cpu_buf->sample_invalid_eip); | ||
64 | } | 68 | } |
65 | 69 | ||
66 | oprofilefs_create_ro_atomic(sb, dir, "sample_lost_no_mm", | 70 | oprofilefs_create_ro_atomic(sb, dir, "sample_lost_no_mm", |
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 7a1d6d512837..e1ca42591ac4 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig | |||
@@ -21,6 +21,17 @@ config PCI_MSI | |||
21 | 21 | ||
22 | If you don't know what to do here, say N. | 22 | If you don't know what to do here, say N. |
23 | 23 | ||
24 | config PCI_LEGACY | ||
25 | bool "Enable deprecated pci_find_* API" | ||
26 | depends on PCI | ||
27 | default y | ||
28 | help | ||
29 | Say Y here if you want to include support for the deprecated | ||
30 | pci_find_slot() and pci_find_device() APIs. Most drivers have | ||
31 | been converted over to using the proper hotplug APIs, so this | ||
32 | option serves to include/exclude only a few drivers that are | ||
33 | still using this API. | ||
34 | |||
24 | config PCI_DEBUG | 35 | config PCI_DEBUG |
25 | bool "PCI Debugging" | 36 | bool "PCI Debugging" |
26 | depends on PCI && DEBUG_KERNEL | 37 | depends on PCI && DEBUG_KERNEL |
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig index 63d62752fb91..a64449d489d6 100644 --- a/drivers/pci/hotplug/Kconfig +++ b/drivers/pci/hotplug/Kconfig | |||
@@ -41,7 +41,7 @@ config HOTPLUG_PCI_FAKE | |||
41 | 41 | ||
42 | config HOTPLUG_PCI_COMPAQ | 42 | config HOTPLUG_PCI_COMPAQ |
43 | tristate "Compaq PCI Hotplug driver" | 43 | tristate "Compaq PCI Hotplug driver" |
44 | depends on X86 && PCI_BIOS | 44 | depends on X86 && PCI_BIOS && PCI_LEGACY |
45 | help | 45 | help |
46 | Say Y here if you have a motherboard with a Compaq PCI Hotplug | 46 | Say Y here if you have a motherboard with a Compaq PCI Hotplug |
47 | controller. | 47 | controller. |
@@ -63,7 +63,7 @@ config HOTPLUG_PCI_COMPAQ_NVRAM | |||
63 | 63 | ||
64 | config HOTPLUG_PCI_IBM | 64 | config HOTPLUG_PCI_IBM |
65 | tristate "IBM PCI Hotplug driver" | 65 | tristate "IBM PCI Hotplug driver" |
66 | depends on X86_IO_APIC && X86 && PCI_BIOS | 66 | depends on X86_IO_APIC && X86 && PCI_BIOS && PCI_LEGACY |
67 | help | 67 | help |
68 | Say Y here if you have a motherboard with a IBM PCI Hotplug | 68 | Say Y here if you have a motherboard with a IBM PCI Hotplug |
69 | controller. | 69 | controller. |
@@ -119,7 +119,7 @@ config HOTPLUG_PCI_CPCI_ZT5550 | |||
119 | 119 | ||
120 | config HOTPLUG_PCI_CPCI_GENERIC | 120 | config HOTPLUG_PCI_CPCI_GENERIC |
121 | tristate "Generic port I/O CompactPCI Hotplug driver" | 121 | tristate "Generic port I/O CompactPCI Hotplug driver" |
122 | depends on HOTPLUG_PCI_CPCI && X86 | 122 | depends on HOTPLUG_PCI_CPCI && X86 && PCI_LEGACY |
123 | help | 123 | help |
124 | Say Y here if you have a CompactPCI system card that exposes the #ENUM | 124 | Say Y here if you have a CompactPCI system card that exposes the #ENUM |
125 | hotswap signal as a bit in a system register that can be read through | 125 | hotswap signal as a bit in a system register that can be read through |
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 3ef0a4875a62..856d57b4d604 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c | |||
@@ -1931,16 +1931,14 @@ void cpqhp_pushbutton_thread(unsigned long slot) | |||
1931 | return ; | 1931 | return ; |
1932 | } | 1932 | } |
1933 | 1933 | ||
1934 | if (func != NULL && ctrl != NULL) { | 1934 | if (cpqhp_process_SS(ctrl, func) != 0) { |
1935 | if (cpqhp_process_SS(ctrl, func) != 0) { | 1935 | amber_LED_on(ctrl, hp_slot); |
1936 | amber_LED_on (ctrl, hp_slot); | 1936 | green_LED_on(ctrl, hp_slot); |
1937 | green_LED_on (ctrl, hp_slot); | ||
1938 | |||
1939 | set_SOGO(ctrl); | ||
1940 | 1937 | ||
1941 | /* Wait for SOBS to be unset */ | 1938 | set_SOGO(ctrl); |
1942 | wait_for_ctrl_irq (ctrl); | 1939 | |
1943 | } | 1940 | /* Wait for SOBS to be unset */ |
1941 | wait_for_ctrl_irq(ctrl); | ||
1944 | } | 1942 | } |
1945 | 1943 | ||
1946 | p_slot->state = STATIC_STATE; | 1944 | p_slot->state = STATIC_STATE; |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 0c4ab3b07274..e079a5237c94 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include "intel-iommu.h" | 34 | #include "intel-iommu.h" |
35 | #include <asm/proto.h> /* force_iommu in this header in x86-64*/ | 35 | #include <asm/proto.h> /* force_iommu in this header in x86-64*/ |
36 | #include <asm/cacheflush.h> | 36 | #include <asm/cacheflush.h> |
37 | #include <asm/iommu.h> | 37 | #include <asm/gart.h> |
38 | #include "pci.h" | 38 | #include "pci.h" |
39 | 39 | ||
40 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) | 40 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) |
@@ -745,12 +745,12 @@ static char *fault_reason_strings[] = | |||
745 | "non-zero reserved fields in PTE", | 745 | "non-zero reserved fields in PTE", |
746 | "Unknown" | 746 | "Unknown" |
747 | }; | 747 | }; |
748 | #define MAX_FAULT_REASON_IDX ARRAY_SIZE(fault_reason_strings) | 748 | #define MAX_FAULT_REASON_IDX ARRAY_SIZE(fault_reason_strings) - 1 |
749 | 749 | ||
750 | char *dmar_get_fault_reason(u8 fault_reason) | 750 | char *dmar_get_fault_reason(u8 fault_reason) |
751 | { | 751 | { |
752 | if (fault_reason > MAX_FAULT_REASON_IDX) | 752 | if (fault_reason >= MAX_FAULT_REASON_IDX) |
753 | return fault_reason_strings[MAX_FAULT_REASON_IDX]; | 753 | return fault_reason_strings[MAX_FAULT_REASON_IDX - 1]; |
754 | else | 754 | else |
755 | return fault_reason_strings[fault_reason]; | 755 | return fault_reason_strings[fault_reason]; |
756 | } | 756 | } |
@@ -995,7 +995,6 @@ static struct intel_iommu *alloc_iommu(struct dmar_drhd_unit *drhd) | |||
995 | return iommu; | 995 | return iommu; |
996 | error_unmap: | 996 | error_unmap: |
997 | iounmap(iommu->reg); | 997 | iounmap(iommu->reg); |
998 | iommu->reg = 0; | ||
999 | error: | 998 | error: |
1000 | kfree(iommu); | 999 | kfree(iommu); |
1001 | return NULL; | 1000 | return NULL; |
@@ -1808,7 +1807,7 @@ get_valid_domain_for_dev(struct pci_dev *pdev) | |||
1808 | if (!domain) { | 1807 | if (!domain) { |
1809 | printk(KERN_ERR | 1808 | printk(KERN_ERR |
1810 | "Allocating domain for %s failed", pci_name(pdev)); | 1809 | "Allocating domain for %s failed", pci_name(pdev)); |
1811 | return 0; | 1810 | return NULL; |
1812 | } | 1811 | } |
1813 | 1812 | ||
1814 | /* make sure context mapping is ok */ | 1813 | /* make sure context mapping is ok */ |
@@ -1818,7 +1817,7 @@ get_valid_domain_for_dev(struct pci_dev *pdev) | |||
1818 | printk(KERN_ERR | 1817 | printk(KERN_ERR |
1819 | "Domain context map for %s failed", | 1818 | "Domain context map for %s failed", |
1820 | pci_name(pdev)); | 1819 | pci_name(pdev)); |
1821 | return 0; | 1820 | return NULL; |
1822 | } | 1821 | } |
1823 | } | 1822 | } |
1824 | 1823 | ||
diff --git a/drivers/pci/intel-iommu.h b/drivers/pci/intel-iommu.h index ee88dd2400cb..459ad1f9dc54 100644 --- a/drivers/pci/intel-iommu.h +++ b/drivers/pci/intel-iommu.h | |||
@@ -58,7 +58,7 @@ | |||
58 | hi = readl(dmar + reg + 4); \ | 58 | hi = readl(dmar + reg + 4); \ |
59 | (((u64) hi) << 32) + lo; }) | 59 | (((u64) hi) << 32) + lo; }) |
60 | */ | 60 | */ |
61 | static inline u64 dmar_readq(void *addr) | 61 | static inline u64 dmar_readq(void __iomem *addr) |
62 | { | 62 | { |
63 | u32 lo, hi; | 63 | u32 lo, hi; |
64 | lo = readl(addr); | 64 | lo = readl(addr); |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 87e01615053d..07c9f09c856d 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -224,6 +224,12 @@ static struct msi_desc* alloc_msi_entry(void) | |||
224 | return entry; | 224 | return entry; |
225 | } | 225 | } |
226 | 226 | ||
227 | static void pci_intx_for_msi(struct pci_dev *dev, int enable) | ||
228 | { | ||
229 | if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG)) | ||
230 | pci_intx(dev, enable); | ||
231 | } | ||
232 | |||
227 | #ifdef CONFIG_PM | 233 | #ifdef CONFIG_PM |
228 | static void __pci_restore_msi_state(struct pci_dev *dev) | 234 | static void __pci_restore_msi_state(struct pci_dev *dev) |
229 | { | 235 | { |
@@ -237,7 +243,7 @@ static void __pci_restore_msi_state(struct pci_dev *dev) | |||
237 | entry = get_irq_msi(dev->irq); | 243 | entry = get_irq_msi(dev->irq); |
238 | pos = entry->msi_attrib.pos; | 244 | pos = entry->msi_attrib.pos; |
239 | 245 | ||
240 | pci_intx(dev, 0); /* disable intx */ | 246 | pci_intx_for_msi(dev, 0); |
241 | msi_set_enable(dev, 0); | 247 | msi_set_enable(dev, 0); |
242 | write_msi_msg(dev->irq, &entry->msg); | 248 | write_msi_msg(dev->irq, &entry->msg); |
243 | if (entry->msi_attrib.maskbit) | 249 | if (entry->msi_attrib.maskbit) |
@@ -260,7 +266,7 @@ static void __pci_restore_msix_state(struct pci_dev *dev) | |||
260 | return; | 266 | return; |
261 | 267 | ||
262 | /* route the table */ | 268 | /* route the table */ |
263 | pci_intx(dev, 0); /* disable intx */ | 269 | pci_intx_for_msi(dev, 0); |
264 | msix_set_enable(dev, 0); | 270 | msix_set_enable(dev, 0); |
265 | 271 | ||
266 | list_for_each_entry(entry, &dev->msi_list, list) { | 272 | list_for_each_entry(entry, &dev->msi_list, list) { |
@@ -343,7 +349,7 @@ static int msi_capability_init(struct pci_dev *dev) | |||
343 | } | 349 | } |
344 | 350 | ||
345 | /* Set MSI enabled bits */ | 351 | /* Set MSI enabled bits */ |
346 | pci_intx(dev, 0); /* disable intx */ | 352 | pci_intx_for_msi(dev, 0); |
347 | msi_set_enable(dev, 1); | 353 | msi_set_enable(dev, 1); |
348 | dev->msi_enabled = 1; | 354 | dev->msi_enabled = 1; |
349 | 355 | ||
@@ -433,7 +439,7 @@ static int msix_capability_init(struct pci_dev *dev, | |||
433 | i++; | 439 | i++; |
434 | } | 440 | } |
435 | /* Set MSI-X enabled bits */ | 441 | /* Set MSI-X enabled bits */ |
436 | pci_intx(dev, 0); /* disable intx */ | 442 | pci_intx_for_msi(dev, 0); |
437 | msix_set_enable(dev, 1); | 443 | msix_set_enable(dev, 1); |
438 | dev->msix_enabled = 1; | 444 | dev->msix_enabled = 1; |
439 | 445 | ||
@@ -528,7 +534,7 @@ void pci_disable_msi(struct pci_dev* dev) | |||
528 | return; | 534 | return; |
529 | 535 | ||
530 | msi_set_enable(dev, 0); | 536 | msi_set_enable(dev, 0); |
531 | pci_intx(dev, 1); /* enable intx */ | 537 | pci_intx_for_msi(dev, 1); |
532 | dev->msi_enabled = 0; | 538 | dev->msi_enabled = 0; |
533 | 539 | ||
534 | BUG_ON(list_empty(&dev->msi_list)); | 540 | BUG_ON(list_empty(&dev->msi_list)); |
@@ -640,7 +646,7 @@ void pci_disable_msix(struct pci_dev* dev) | |||
640 | return; | 646 | return; |
641 | 647 | ||
642 | msix_set_enable(dev, 0); | 648 | msix_set_enable(dev, 0); |
643 | pci_intx(dev, 1); /* enable intx */ | 649 | pci_intx_for_msi(dev, 1); |
644 | dev->msix_enabled = 0; | 650 | dev->msix_enabled = 0; |
645 | 651 | ||
646 | msix_free_all_irqs(dev); | 652 | msix_free_all_irqs(dev); |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 6e2760b6c20a..6d1a21611818 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -143,8 +143,8 @@ const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, | |||
143 | * system is in its list of supported devices. Returns the matching | 143 | * system is in its list of supported devices. Returns the matching |
144 | * pci_device_id structure or %NULL if there is no match. | 144 | * pci_device_id structure or %NULL if there is no match. |
145 | */ | 145 | */ |
146 | const struct pci_device_id *pci_match_device(struct pci_driver *drv, | 146 | static const struct pci_device_id *pci_match_device(struct pci_driver *drv, |
147 | struct pci_dev *dev) | 147 | struct pci_dev *dev) |
148 | { | 148 | { |
149 | struct pci_dynid *dynid; | 149 | struct pci_dynid *dynid; |
150 | 150 | ||
@@ -559,7 +559,6 @@ static int __init pci_driver_init(void) | |||
559 | postcore_initcall(pci_driver_init); | 559 | postcore_initcall(pci_driver_init); |
560 | 560 | ||
561 | EXPORT_SYMBOL(pci_match_id); | 561 | EXPORT_SYMBOL(pci_match_id); |
562 | EXPORT_SYMBOL(pci_match_device); | ||
563 | EXPORT_SYMBOL(__pci_register_driver); | 562 | EXPORT_SYMBOL(__pci_register_driver); |
564 | EXPORT_SYMBOL(pci_unregister_driver); | 563 | EXPORT_SYMBOL(pci_unregister_driver); |
565 | EXPORT_SYMBOL(pci_dev_driver); | 564 | EXPORT_SYMBOL(pci_dev_driver); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index d0bb5b9d2120..26cc4dcf4f0e 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1621,12 +1621,8 @@ static void __init quirk_disable_all_msi(struct pci_dev *dev) | |||
1621 | printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n"); | 1621 | printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n"); |
1622 | } | 1622 | } |
1623 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi); | 1623 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi); |
1624 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX, quirk_disable_all_msi); | ||
1625 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi); | 1624 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi); |
1626 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi); | 1625 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi); |
1627 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RD580, quirk_disable_all_msi); | ||
1628 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RX790, quirk_disable_all_msi); | ||
1629 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS690, quirk_disable_all_msi); | ||
1630 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi); | 1626 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi); |
1631 | 1627 | ||
1632 | /* Disable MSI on chipsets that are known to not support it */ | 1628 | /* Disable MSI on chipsets that are known to not support it */ |
@@ -1678,6 +1674,9 @@ static void __devinit quirk_msi_ht_cap(struct pci_dev *dev) | |||
1678 | } | 1674 | } |
1679 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE, | 1675 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE, |
1680 | quirk_msi_ht_cap); | 1676 | quirk_msi_ht_cap); |
1677 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, | ||
1678 | PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB, | ||
1679 | quirk_msi_ht_cap); | ||
1681 | 1680 | ||
1682 | /* The nVidia CK804 chipset may have 2 HT MSI mappings. | 1681 | /* The nVidia CK804 chipset may have 2 HT MSI mappings. |
1683 | * MSI are supported if the MSI capability set in any of these mappings. | 1682 | * MSI are supported if the MSI capability set in any of these mappings. |
@@ -1705,4 +1704,48 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev) | |||
1705 | } | 1704 | } |
1706 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, | 1705 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, |
1707 | quirk_nvidia_ck804_msi_ht_cap); | 1706 | quirk_nvidia_ck804_msi_ht_cap); |
1707 | |||
1708 | static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev) | ||
1709 | { | ||
1710 | dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG; | ||
1711 | } | ||
1712 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
1713 | PCI_DEVICE_ID_TIGON3_5780, | ||
1714 | quirk_msi_intx_disable_bug); | ||
1715 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
1716 | PCI_DEVICE_ID_TIGON3_5780S, | ||
1717 | quirk_msi_intx_disable_bug); | ||
1718 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
1719 | PCI_DEVICE_ID_TIGON3_5714, | ||
1720 | quirk_msi_intx_disable_bug); | ||
1721 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
1722 | PCI_DEVICE_ID_TIGON3_5714S, | ||
1723 | quirk_msi_intx_disable_bug); | ||
1724 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
1725 | PCI_DEVICE_ID_TIGON3_5715, | ||
1726 | quirk_msi_intx_disable_bug); | ||
1727 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
1728 | PCI_DEVICE_ID_TIGON3_5715S, | ||
1729 | quirk_msi_intx_disable_bug); | ||
1730 | |||
1731 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4390, | ||
1732 | quirk_msi_intx_disable_bug); | ||
1733 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4391, | ||
1734 | quirk_msi_intx_disable_bug); | ||
1735 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4392, | ||
1736 | quirk_msi_intx_disable_bug); | ||
1737 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4393, | ||
1738 | quirk_msi_intx_disable_bug); | ||
1739 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4394, | ||
1740 | quirk_msi_intx_disable_bug); | ||
1741 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4395, | ||
1742 | quirk_msi_intx_disable_bug); | ||
1743 | |||
1744 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4373, | ||
1745 | quirk_msi_intx_disable_bug); | ||
1746 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4374, | ||
1747 | quirk_msi_intx_disable_bug); | ||
1748 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4375, | ||
1749 | quirk_msi_intx_disable_bug); | ||
1750 | |||
1708 | #endif /* CONFIG_PCI_MSI */ | 1751 | #endif /* CONFIG_PCI_MSI */ |
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index b001b5922e33..8541034021f0 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -113,6 +113,8 @@ pci_find_next_bus(const struct pci_bus *from) | |||
113 | return b; | 113 | return b; |
114 | } | 114 | } |
115 | 115 | ||
116 | #ifdef CONFIG_PCI_LEGACY | ||
117 | |||
116 | /** | 118 | /** |
117 | * pci_find_slot - locate PCI device from a given PCI slot | 119 | * pci_find_slot - locate PCI device from a given PCI slot |
118 | * @bus: number of PCI bus on which desired PCI device resides | 120 | * @bus: number of PCI bus on which desired PCI device resides |
@@ -137,6 +139,8 @@ pci_find_slot(unsigned int bus, unsigned int devfn) | |||
137 | return NULL; | 139 | return NULL; |
138 | } | 140 | } |
139 | 141 | ||
142 | #endif /* CONFIG_PCI_LEGACY */ | ||
143 | |||
140 | /** | 144 | /** |
141 | * pci_get_slot - locate PCI device for a given PCI slot | 145 | * pci_get_slot - locate PCI device for a given PCI slot |
142 | * @bus: PCI bus on which desired PCI device resides | 146 | * @bus: PCI bus on which desired PCI device resides |
@@ -200,6 +204,7 @@ struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn) | |||
200 | return NULL; | 204 | return NULL; |
201 | } | 205 | } |
202 | 206 | ||
207 | #ifdef CONFIG_PCI_LEGACY | ||
203 | /** | 208 | /** |
204 | * pci_find_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id | 209 | * pci_find_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id |
205 | * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids | 210 | * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids |
@@ -278,6 +283,7 @@ pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev * | |||
278 | { | 283 | { |
279 | return pci_find_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); | 284 | return pci_find_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); |
280 | } | 285 | } |
286 | #endif /* CONFIG_PCI_LEGACY */ | ||
281 | 287 | ||
282 | /** | 288 | /** |
283 | * pci_get_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id | 289 | * pci_get_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id |
@@ -468,8 +474,11 @@ int pci_dev_present(const struct pci_device_id *ids) | |||
468 | EXPORT_SYMBOL(pci_dev_present); | 474 | EXPORT_SYMBOL(pci_dev_present); |
469 | EXPORT_SYMBOL(pci_find_present); | 475 | EXPORT_SYMBOL(pci_find_present); |
470 | 476 | ||
477 | #ifdef CONFIG_PCI_LEGACY | ||
471 | EXPORT_SYMBOL(pci_find_device); | 478 | EXPORT_SYMBOL(pci_find_device); |
472 | EXPORT_SYMBOL(pci_find_slot); | 479 | EXPORT_SYMBOL(pci_find_slot); |
480 | #endif /* CONFIG_PCI_LEGACY */ | ||
481 | |||
473 | /* For boot time work */ | 482 | /* For boot time work */ |
474 | EXPORT_SYMBOL(pci_find_bus); | 483 | EXPORT_SYMBOL(pci_find_bus); |
475 | EXPORT_SYMBOL(pci_find_next_bus); | 484 | EXPORT_SYMBOL(pci_find_next_bus); |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index cd0a204d96d1..11adab13f2b7 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; |
@@ -85,15 +86,22 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
85 | if (i >= PNP_MAX_IRQ) | 86 | if (i >= PNP_MAX_IRQ) |
86 | return; | 87 | return; |
87 | 88 | ||
88 | #ifdef CONFIG_X86 | 89 | /* |
89 | if (gsi < 16 && (triggering != ACPI_EDGE_SENSITIVE || | 90 | * in IO-APIC mode, use overrided attribute. Two reasons: |
90 | polarity != ACPI_ACTIVE_HIGH)) { | 91 | * 1. BIOS bug in DSDT |
91 | pnp_warn("BIOS BUG: legacy PNP IRQ %d should be edge trigger, " | 92 | * 2. BIOS uses IO-APIC mode Interrupt Source Override |
92 | "active high", gsi); | 93 | */ |
93 | triggering = ACPI_EDGE_SENSITIVE; | 94 | if (!acpi_get_override_irq(gsi, &t, &p)) { |
94 | polarity = ACPI_ACTIVE_HIGH; | 95 | t = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; |
96 | p = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; | ||
97 | |||
98 | if (triggering != t || polarity != p) { | ||
99 | pnp_warn("IRQ %d override to %s, %s", | ||
100 | gsi, t ? "edge":"level", p ? "low":"high"); | ||
101 | triggering = t; | ||
102 | polarity = p; | ||
103 | } | ||
95 | } | 104 | } |
96 | #endif | ||
97 | 105 | ||
98 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 106 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
99 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); | 107 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index cbde770eb121..1e6715ec51ef 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -36,7 +36,9 @@ config RTC_HCTOSYS_DEVICE | |||
36 | help | 36 | help |
37 | The RTC device that will be used to (re)initialize the system | 37 | The RTC device that will be used to (re)initialize the system |
38 | clock, usually rtc0. Initialization is done when the system | 38 | clock, usually rtc0. Initialization is done when the system |
39 | starts up, and when it resumes from a low power state. | 39 | starts up, and when it resumes from a low power state. This |
40 | device should record time in UTC, since the kernel won't do | ||
41 | timezone correction. | ||
40 | 42 | ||
41 | The driver for this RTC device must be loaded before late_initcall | 43 | The driver for this RTC device must be loaded before late_initcall |
42 | functions run, so it must usually be statically linked. | 44 | functions run, so it must usually be statically linked. |
@@ -133,8 +135,8 @@ config RTC_DRV_DS1307 | |||
133 | 135 | ||
134 | The first seven registers on these chips hold an RTC, and other | 136 | The first seven registers on these chips hold an RTC, and other |
135 | registers may add features such as NVRAM, a trickle charger for | 137 | registers may add features such as NVRAM, a trickle charger for |
136 | the RTC/NVRAM backup power, and alarms. This driver may not | 138 | the RTC/NVRAM backup power, and alarms. NVRAM is visible in |
137 | expose all those available chip features. | 139 | sysfs, but other chip features may not be available. |
138 | 140 | ||
139 | This driver can also be built as a module. If so, the module | 141 | This driver can also be built as a module. If so, the module |
140 | will be called rtc-ds1307. | 142 | will be called rtc-ds1307. |
@@ -445,7 +447,7 @@ config RTC_DRV_AT91RM9200 | |||
445 | 447 | ||
446 | config RTC_DRV_BFIN | 448 | config RTC_DRV_BFIN |
447 | tristate "Blackfin On-Chip RTC" | 449 | tristate "Blackfin On-Chip RTC" |
448 | depends on BFIN | 450 | depends on BLACKFIN |
449 | help | 451 | help |
450 | If you say yes here you will get support for the | 452 | If you say yes here you will get support for the |
451 | Blackfin On-Chip Real Time Clock. | 453 | Blackfin On-Chip Real Time Clock. |
diff --git a/drivers/rtc/hctosys.c b/drivers/rtc/hctosys.c index 178527252c6a..33c0e98243ee 100644 --- a/drivers/rtc/hctosys.c +++ b/drivers/rtc/hctosys.c | |||
@@ -47,8 +47,8 @@ static int __init rtc_hctosys(void) | |||
47 | do_settimeofday(&tv); | 47 | do_settimeofday(&tv); |
48 | 48 | ||
49 | dev_info(rtc->dev.parent, | 49 | dev_info(rtc->dev.parent, |
50 | "setting the system clock to " | 50 | "setting system clock to " |
51 | "%d-%02d-%02d %02d:%02d:%02d (%u)\n", | 51 | "%d-%02d-%02d %02d:%02d:%02d UTC (%u)\n", |
52 | tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, | 52 | tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, |
53 | tm.tm_hour, tm.tm_min, tm.tm_sec, | 53 | tm.tm_hour, tm.tm_min, tm.tm_sec, |
54 | (unsigned int) tv.tv_sec); | 54 | (unsigned int) tv.tv_sec); |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index e3fe83a23cf7..29cf1457ca10 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -120,7 +120,8 @@ static int cmos_read_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
120 | t->time.tm_hour = CMOS_READ(RTC_HOURS_ALARM); | 120 | t->time.tm_hour = CMOS_READ(RTC_HOURS_ALARM); |
121 | 121 | ||
122 | if (cmos->day_alrm) { | 122 | if (cmos->day_alrm) { |
123 | t->time.tm_mday = CMOS_READ(cmos->day_alrm); | 123 | /* ignore upper bits on readback per ACPI spec */ |
124 | t->time.tm_mday = CMOS_READ(cmos->day_alrm) & 0x3f; | ||
124 | if (!t->time.tm_mday) | 125 | if (!t->time.tm_mday) |
125 | t->time.tm_mday = -1; | 126 | t->time.tm_mday = -1; |
126 | 127 | ||
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index db6f3f0d8982..bc1c7fe94ad3 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
@@ -89,6 +89,7 @@ enum ds_type { | |||
89 | 89 | ||
90 | struct ds1307 { | 90 | struct ds1307 { |
91 | u8 reg_addr; | 91 | u8 reg_addr; |
92 | bool has_nvram; | ||
92 | u8 regs[8]; | 93 | u8 regs[8]; |
93 | enum ds_type type; | 94 | enum ds_type type; |
94 | struct i2c_msg msg[2]; | 95 | struct i2c_msg msg[2]; |
@@ -242,6 +243,87 @@ static const struct rtc_class_ops ds13xx_rtc_ops = { | |||
242 | .set_time = ds1307_set_time, | 243 | .set_time = ds1307_set_time, |
243 | }; | 244 | }; |
244 | 245 | ||
246 | /*----------------------------------------------------------------------*/ | ||
247 | |||
248 | #define NVRAM_SIZE 56 | ||
249 | |||
250 | static ssize_t | ||
251 | ds1307_nvram_read(struct kobject *kobj, struct bin_attribute *attr, | ||
252 | char *buf, loff_t off, size_t count) | ||
253 | { | ||
254 | struct i2c_client *client; | ||
255 | struct ds1307 *ds1307; | ||
256 | struct i2c_msg msg[2]; | ||
257 | int result; | ||
258 | |||
259 | client = to_i2c_client(container_of(kobj, struct device, kobj)); | ||
260 | ds1307 = i2c_get_clientdata(client); | ||
261 | |||
262 | if (unlikely(off >= NVRAM_SIZE)) | ||
263 | return 0; | ||
264 | if ((off + count) > NVRAM_SIZE) | ||
265 | count = NVRAM_SIZE - off; | ||
266 | if (unlikely(!count)) | ||
267 | return count; | ||
268 | |||
269 | msg[0].addr = client->addr; | ||
270 | msg[0].flags = 0; | ||
271 | msg[0].len = 1; | ||
272 | msg[0].buf = buf; | ||
273 | |||
274 | buf[0] = 8 + off; | ||
275 | |||
276 | msg[1].addr = client->addr; | ||
277 | msg[1].flags = I2C_M_RD; | ||
278 | msg[1].len = count; | ||
279 | msg[1].buf = buf; | ||
280 | |||
281 | result = i2c_transfer(to_i2c_adapter(client->dev.parent), msg, 2); | ||
282 | if (result != 2) { | ||
283 | dev_err(&client->dev, "%s error %d\n", "nvram read", result); | ||
284 | return -EIO; | ||
285 | } | ||
286 | return count; | ||
287 | } | ||
288 | |||
289 | static ssize_t | ||
290 | ds1307_nvram_write(struct kobject *kobj, struct bin_attribute *attr, | ||
291 | char *buf, loff_t off, size_t count) | ||
292 | { | ||
293 | struct i2c_client *client; | ||
294 | u8 buffer[NVRAM_SIZE + 1]; | ||
295 | int ret; | ||
296 | |||
297 | client = to_i2c_client(container_of(kobj, struct device, kobj)); | ||
298 | |||
299 | if (unlikely(off >= NVRAM_SIZE)) | ||
300 | return -EFBIG; | ||
301 | if ((off + count) > NVRAM_SIZE) | ||
302 | count = NVRAM_SIZE - off; | ||
303 | if (unlikely(!count)) | ||
304 | return count; | ||
305 | |||
306 | buffer[0] = 8 + off; | ||
307 | memcpy(buffer + 1, buf, count); | ||
308 | |||
309 | ret = i2c_master_send(client, buffer, count + 1); | ||
310 | return (ret < 0) ? ret : (ret - 1); | ||
311 | } | ||
312 | |||
313 | static struct bin_attribute nvram = { | ||
314 | .attr = { | ||
315 | .name = "nvram", | ||
316 | .mode = S_IRUGO | S_IWUSR, | ||
317 | .owner = THIS_MODULE, | ||
318 | }, | ||
319 | |||
320 | .read = ds1307_nvram_read, | ||
321 | .write = ds1307_nvram_write, | ||
322 | .size = NVRAM_SIZE, | ||
323 | }; | ||
324 | |||
325 | /*----------------------------------------------------------------------*/ | ||
326 | |||
245 | static struct i2c_driver ds1307_driver; | 327 | static struct i2c_driver ds1307_driver; |
246 | 328 | ||
247 | static int __devinit ds1307_probe(struct i2c_client *client) | 329 | static int __devinit ds1307_probe(struct i2c_client *client) |
@@ -413,6 +495,14 @@ read_rtc: | |||
413 | goto exit_free; | 495 | goto exit_free; |
414 | } | 496 | } |
415 | 497 | ||
498 | if (chip->nvram56) { | ||
499 | err = sysfs_create_bin_file(&client->dev.kobj, &nvram); | ||
500 | if (err == 0) { | ||
501 | ds1307->has_nvram = true; | ||
502 | dev_info(&client->dev, "56 bytes nvram\n"); | ||
503 | } | ||
504 | } | ||
505 | |||
416 | return 0; | 506 | return 0; |
417 | 507 | ||
418 | exit_bad: | 508 | exit_bad: |
@@ -432,6 +522,9 @@ static int __devexit ds1307_remove(struct i2c_client *client) | |||
432 | { | 522 | { |
433 | struct ds1307 *ds1307 = i2c_get_clientdata(client); | 523 | struct ds1307 *ds1307 = i2c_get_clientdata(client); |
434 | 524 | ||
525 | if (ds1307->has_nvram) | ||
526 | sysfs_remove_bin_file(&client->dev.kobj, &nvram); | ||
527 | |||
435 | rtc_device_unregister(ds1307->rtc); | 528 | rtc_device_unregister(ds1307->rtc); |
436 | kfree(ds1307); | 529 | kfree(ds1307); |
437 | return 0; | 530 | return 0; |
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index bb53c09bad16..d9e848dcd450 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c | |||
@@ -291,7 +291,7 @@ static ssize_t ds1553_nvram_write(struct kobject *kobj, | |||
291 | static struct bin_attribute ds1553_nvram_attr = { | 291 | static struct bin_attribute ds1553_nvram_attr = { |
292 | .attr = { | 292 | .attr = { |
293 | .name = "nvram", | 293 | .name = "nvram", |
294 | .mode = S_IRUGO | S_IWUGO, | 294 | .mode = S_IRUGO | S_IWUSR, |
295 | }, | 295 | }, |
296 | .size = RTC_OFFSET, | 296 | .size = RTC_OFFSET, |
297 | .read = ds1553_nvram_read, | 297 | .read = ds1553_nvram_read, |
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index c535b78698e2..2e73f0b183b2 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c | |||
@@ -160,10 +160,13 @@ static ssize_t ds1742_nvram_write(struct kobject *kobj, | |||
160 | static struct bin_attribute ds1742_nvram_attr = { | 160 | static struct bin_attribute ds1742_nvram_attr = { |
161 | .attr = { | 161 | .attr = { |
162 | .name = "nvram", | 162 | .name = "nvram", |
163 | .mode = S_IRUGO | S_IWUGO, | 163 | .mode = S_IRUGO | S_IWUSR, |
164 | }, | 164 | }, |
165 | .read = ds1742_nvram_read, | 165 | .read = ds1742_nvram_read, |
166 | .write = ds1742_nvram_write, | 166 | .write = ds1742_nvram_write, |
167 | /* REVISIT: size in sysfs won't match actual size... if it's | ||
168 | * not a constant, each RTC should have its own attribute. | ||
169 | */ | ||
167 | }; | 170 | }; |
168 | 171 | ||
169 | static int __devinit ds1742_rtc_probe(struct platform_device *pdev) | 172 | static int __devinit ds1742_rtc_probe(struct platform_device *pdev) |
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index bf60d35f580b..cd0bbc0e8038 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c | |||
@@ -353,11 +353,12 @@ static ssize_t m48t59_nvram_write(struct kobject *kobj, | |||
353 | static struct bin_attribute m48t59_nvram_attr = { | 353 | static struct bin_attribute m48t59_nvram_attr = { |
354 | .attr = { | 354 | .attr = { |
355 | .name = "nvram", | 355 | .name = "nvram", |
356 | .mode = S_IRUGO | S_IWUGO, | 356 | .mode = S_IRUGO | S_IWUSR, |
357 | .owner = THIS_MODULE, | 357 | .owner = THIS_MODULE, |
358 | }, | 358 | }, |
359 | .read = m48t59_nvram_read, | 359 | .read = m48t59_nvram_read, |
360 | .write = m48t59_nvram_write, | 360 | .write = m48t59_nvram_write, |
361 | .size = M48T59_NVRAM_SIZE, | ||
361 | }; | 362 | }; |
362 | 363 | ||
363 | static int __devinit m48t59_rtc_probe(struct platform_device *pdev) | 364 | static int __devinit m48t59_rtc_probe(struct platform_device *pdev) |
@@ -464,7 +465,7 @@ static int __devexit m48t59_rtc_remove(struct platform_device *pdev) | |||
464 | return 0; | 465 | return 0; |
465 | } | 466 | } |
466 | 467 | ||
467 | static struct platform_driver m48t59_rtc_platdrv = { | 468 | static struct platform_driver m48t59_rtc_driver = { |
468 | .driver = { | 469 | .driver = { |
469 | .name = "rtc-m48t59", | 470 | .name = "rtc-m48t59", |
470 | .owner = THIS_MODULE, | 471 | .owner = THIS_MODULE, |
@@ -475,12 +476,12 @@ static struct platform_driver m48t59_rtc_platdrv = { | |||
475 | 476 | ||
476 | static int __init m48t59_rtc_init(void) | 477 | static int __init m48t59_rtc_init(void) |
477 | { | 478 | { |
478 | return platform_driver_register(&m48t59_rtc_platdrv); | 479 | return platform_driver_register(&m48t59_rtc_driver); |
479 | } | 480 | } |
480 | 481 | ||
481 | static void __exit m48t59_rtc_exit(void) | 482 | static void __exit m48t59_rtc_exit(void) |
482 | { | 483 | { |
483 | platform_driver_unregister(&m48t59_rtc_platdrv); | 484 | platform_driver_unregister(&m48t59_rtc_driver); |
484 | } | 485 | } |
485 | 486 | ||
486 | module_init(m48t59_rtc_init); | 487 | module_init(m48t59_rtc_init); |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 8c1012b432bb..e2041b4d0c85 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -542,8 +542,6 @@ static int s3c_rtc_probe(struct platform_device *pdev) | |||
542 | 542 | ||
543 | /* RTC Power management control */ | 543 | /* RTC Power management control */ |
544 | 544 | ||
545 | static struct timespec s3c_rtc_delta; | ||
546 | |||
547 | static int ticnt_save; | 545 | static int ticnt_save; |
548 | 546 | ||
549 | static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) | 547 | static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) |
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 78277a118b67..8e8c8b8e81ee 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -351,8 +351,10 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
351 | tm->tm_sec, tm->tm_min, tm->tm_hour, | 351 | tm->tm_sec, tm->tm_min, tm->tm_hour, |
352 | tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday); | 352 | tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday); |
353 | 353 | ||
354 | if (rtc_valid_tm(tm) < 0) | 354 | if (rtc_valid_tm(tm) < 0) { |
355 | dev_err(dev, "invalid date\n"); | 355 | dev_err(dev, "invalid date\n"); |
356 | rtc_time_to_tm(0, tm); | ||
357 | } | ||
356 | 358 | ||
357 | return 0; | 359 | return 0; |
358 | } | 360 | } |
@@ -588,7 +590,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
588 | 590 | ||
589 | rtc->rtc_dev = rtc_device_register("sh", &pdev->dev, | 591 | rtc->rtc_dev = rtc_device_register("sh", &pdev->dev, |
590 | &sh_rtc_ops, THIS_MODULE); | 592 | &sh_rtc_ops, THIS_MODULE); |
591 | if (IS_ERR(rtc)) { | 593 | if (IS_ERR(rtc->rtc_dev)) { |
592 | ret = PTR_ERR(rtc->rtc_dev); | 594 | ret = PTR_ERR(rtc->rtc_dev); |
593 | goto err_badmap; | 595 | goto err_badmap; |
594 | } | 596 | } |
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c index 8288b6b2bf2b..a265da7c6ff8 100644 --- a/drivers/rtc/rtc-stk17ta8.c +++ b/drivers/rtc/rtc-stk17ta8.c | |||
@@ -291,7 +291,7 @@ static ssize_t stk17ta8_nvram_write(struct kobject *kobj, | |||
291 | static struct bin_attribute stk17ta8_nvram_attr = { | 291 | static struct bin_attribute stk17ta8_nvram_attr = { |
292 | .attr = { | 292 | .attr = { |
293 | .name = "nvram", | 293 | .name = "nvram", |
294 | .mode = S_IRUGO | S_IWUGO, | 294 | .mode = S_IRUGO | S_IWUSR, |
295 | .owner = THIS_MODULE, | 295 | .owner = THIS_MODULE, |
296 | }, | 296 | }, |
297 | .size = RTC_OFFSET, | 297 | .size = RTC_OFFSET, |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 859f870552e3..5e083d1f57e7 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -193,6 +193,12 @@ dcssblk_segment_warn(int rc, char* seg_name) | |||
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | static void dcssblk_unregister_callback(struct device *dev) | ||
197 | { | ||
198 | device_unregister(dev); | ||
199 | put_device(dev); | ||
200 | } | ||
201 | |||
196 | /* | 202 | /* |
197 | * device attribute for switching shared/nonshared (exclusive) | 203 | * device attribute for switching shared/nonshared (exclusive) |
198 | * operation (show + store) | 204 | * operation (show + store) |
@@ -276,8 +282,7 @@ removeseg: | |||
276 | blk_cleanup_queue(dev_info->dcssblk_queue); | 282 | blk_cleanup_queue(dev_info->dcssblk_queue); |
277 | dev_info->gd->queue = NULL; | 283 | dev_info->gd->queue = NULL; |
278 | put_disk(dev_info->gd); | 284 | put_disk(dev_info->gd); |
279 | device_unregister(dev); | 285 | rc = device_schedule_callback(dev, dcssblk_unregister_callback); |
280 | put_device(dev); | ||
281 | out: | 286 | out: |
282 | up_write(&dcssblk_devices_sem); | 287 | up_write(&dcssblk_devices_sem); |
283 | return rc; | 288 | return rc; |
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c index 725b0dd14269..f4c132ab39ed 100644 --- a/drivers/s390/cio/cmf.c +++ b/drivers/s390/cio/cmf.c | |||
@@ -343,10 +343,10 @@ static int cmf_copy_block(struct ccw_device *cdev) | |||
343 | 343 | ||
344 | if (sch->schib.scsw.fctl & SCSW_FCTL_START_FUNC) { | 344 | if (sch->schib.scsw.fctl & SCSW_FCTL_START_FUNC) { |
345 | /* Don't copy if a start function is in progress. */ | 345 | /* Don't copy if a start function is in progress. */ |
346 | if ((!sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED) && | 346 | if ((!(sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED)) && |
347 | (sch->schib.scsw.actl & | 347 | (sch->schib.scsw.actl & |
348 | (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) && | 348 | (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) && |
349 | (!sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS)) | 349 | (!(sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS))) |
350 | return -EBUSY; | 350 | return -EBUSY; |
351 | } | 351 | } |
352 | cmb_data = cdev->private->cmb; | 352 | cmb_data = cdev->private->cmb; |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 838f7ac0dc32..6db31089d2d7 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -483,7 +483,7 @@ static DECLARE_WORK(css_reprobe_work, reprobe_all); | |||
483 | void css_schedule_reprobe(void) | 483 | void css_schedule_reprobe(void) |
484 | { | 484 | { |
485 | need_reprobe = 1; | 485 | need_reprobe = 1; |
486 | queue_work(ccw_device_work, &css_reprobe_work); | 486 | queue_work(slow_path_wq, &css_reprobe_work); |
487 | } | 487 | } |
488 | 488 | ||
489 | EXPORT_SYMBOL_GPL(css_schedule_reprobe); | 489 | EXPORT_SYMBOL_GPL(css_schedule_reprobe); |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 7ee57f084a89..74f6b539974a 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -738,7 +738,7 @@ static int io_subchannel_initialize_dev(struct subchannel *sch, | |||
738 | atomic_set(&cdev->private->onoff, 0); | 738 | atomic_set(&cdev->private->onoff, 0); |
739 | cdev->dev.parent = &sch->dev; | 739 | cdev->dev.parent = &sch->dev; |
740 | cdev->dev.release = ccw_device_release; | 740 | cdev->dev.release = ccw_device_release; |
741 | INIT_LIST_HEAD(&cdev->private->kick_work.entry); | 741 | INIT_WORK(&cdev->private->kick_work, NULL); |
742 | cdev->dev.groups = ccwdev_attr_groups; | 742 | cdev->dev.groups = ccwdev_attr_groups; |
743 | /* Do first half of device_register. */ | 743 | /* Do first half of device_register. */ |
744 | device_initialize(&cdev->dev); | 744 | device_initialize(&cdev->dev); |
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..2f6bf462425e 100644 --- a/drivers/s390/cio/device_id.c +++ b/drivers/s390/cio/device_id.c | |||
@@ -113,19 +113,10 @@ __ccw_device_sense_id_start(struct ccw_device *cdev) | |||
113 | { | 113 | { |
114 | struct subchannel *sch; | 114 | struct subchannel *sch; |
115 | struct ccw1 *ccw; | 115 | struct ccw1 *ccw; |
116 | int ret; | ||
117 | 116 | ||
118 | sch = to_subchannel(cdev->dev.parent); | 117 | sch = to_subchannel(cdev->dev.parent); |
119 | /* Setup sense channel program. */ | 118 | /* Setup sense channel program. */ |
120 | ccw = cdev->private->iccws; | 119 | 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; | 120 | ccw->cmd_code = CCW_CMD_SENSE_ID; |
130 | ccw->cda = (__u32) __pa (&cdev->private->senseid); | 121 | ccw->cda = (__u32) __pa (&cdev->private->senseid); |
131 | ccw->count = sizeof (struct senseid); | 122 | ccw->count = sizeof (struct senseid); |
@@ -133,25 +124,9 @@ __ccw_device_sense_id_start(struct ccw_device *cdev) | |||
133 | 124 | ||
134 | /* Reset device status. */ | 125 | /* Reset device status. */ |
135 | memset(&cdev->private->irb, 0, sizeof(struct irb)); | 126 | memset(&cdev->private->irb, 0, sizeof(struct irb)); |
127 | cdev->private->flags.intretry = 0; | ||
136 | 128 | ||
137 | /* Try on every path. */ | 129 | return cio_start(sch, ccw, LPM_ANYPATH); |
138 | ret = -ENODEV; | ||
139 | while (cdev->private->imask != 0) { | ||
140 | if ((sch->opm & cdev->private->imask) != 0 && | ||
141 | cdev->private->iretry > 0) { | ||
142 | cdev->private->iretry--; | ||
143 | /* Reset internal retry indication. */ | ||
144 | cdev->private->flags.intretry = 0; | ||
145 | ret = cio_start (sch, cdev->private->iccws, | ||
146 | cdev->private->imask); | ||
147 | /* ret is 0, -EBUSY, -EACCES or -ENODEV */ | ||
148 | if (ret != -EACCES) | ||
149 | return ret; | ||
150 | } | ||
151 | cdev->private->imask >>= 1; | ||
152 | cdev->private->iretry = 5; | ||
153 | } | ||
154 | return ret; | ||
155 | } | 130 | } |
156 | 131 | ||
157 | void | 132 | void |
@@ -161,8 +136,7 @@ ccw_device_sense_id_start(struct ccw_device *cdev) | |||
161 | 136 | ||
162 | memset (&cdev->private->senseid, 0, sizeof (struct senseid)); | 137 | memset (&cdev->private->senseid, 0, sizeof (struct senseid)); |
163 | cdev->private->senseid.cu_type = 0xFFFF; | 138 | cdev->private->senseid.cu_type = 0xFFFF; |
164 | cdev->private->imask = 0x80; | 139 | cdev->private->iretry = 3; |
165 | cdev->private->iretry = 5; | ||
166 | ret = __ccw_device_sense_id_start(cdev); | 140 | ret = __ccw_device_sense_id_start(cdev); |
167 | if (ret && ret != -EBUSY) | 141 | if (ret && ret != -EBUSY) |
168 | ccw_device_sense_id_done(cdev, ret); | 142 | ccw_device_sense_id_done(cdev, ret); |
@@ -278,14 +252,13 @@ ccw_device_sense_id_irq(struct ccw_device *cdev, enum dev_event dev_event) | |||
278 | ccw_device_sense_id_done(cdev, ret); | 252 | ccw_device_sense_id_done(cdev, ret); |
279 | break; | 253 | break; |
280 | case -EACCES: /* channel is not operational. */ | 254 | case -EACCES: /* channel is not operational. */ |
281 | sch->lpm &= ~cdev->private->imask; | ||
282 | cdev->private->imask >>= 1; | ||
283 | cdev->private->iretry = 5; | ||
284 | /* fall through. */ | ||
285 | case -EAGAIN: /* try again. */ | 255 | case -EAGAIN: /* try again. */ |
286 | ret = __ccw_device_sense_id_start(cdev); | 256 | cdev->private->iretry--; |
287 | if (ret == 0 || ret == -EBUSY) | 257 | if (cdev->private->iretry > 0) { |
288 | break; | 258 | ret = __ccw_device_sense_id_start(cdev); |
259 | if (ret == 0 || ret == -EBUSY) | ||
260 | break; | ||
261 | } | ||
289 | /* fall through. */ | 262 | /* fall through. */ |
290 | default: /* Sense ID failed. Try asking VM. */ | 263 | default: /* Sense ID failed. Try asking VM. */ |
291 | if (MACHINE_IS_VM) { | 264 | if (MACHINE_IS_VM) { |
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c index 3ccca5871fdf..47bb47b48581 100644 --- a/drivers/s390/net/smsgiucv.c +++ b/drivers/s390/net/smsgiucv.c | |||
@@ -148,6 +148,10 @@ static int __init smsg_init(void) | |||
148 | { | 148 | { |
149 | int rc; | 149 | int rc; |
150 | 150 | ||
151 | if (!MACHINE_IS_VM) { | ||
152 | rc = -EPROTONOSUPPORT; | ||
153 | goto out; | ||
154 | } | ||
151 | rc = driver_register(&smsg_driver); | 155 | rc = driver_register(&smsg_driver); |
152 | if (rc != 0) | 156 | if (rc != 0) |
153 | goto out; | 157 | goto out; |
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 0754542978b6..e268f79bdbd2 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h | |||
@@ -70,11 +70,12 @@ zfcp_sg_to_address(struct scatterlist *list) | |||
70 | * zfcp_address_to_sg - set up struct scatterlist from kernel address | 70 | * zfcp_address_to_sg - set up struct scatterlist from kernel address |
71 | * @address: kernel address | 71 | * @address: kernel address |
72 | * @list: struct scatterlist | 72 | * @list: struct scatterlist |
73 | * @size: buffer size | ||
73 | */ | 74 | */ |
74 | static inline void | 75 | static inline void |
75 | zfcp_address_to_sg(void *address, struct scatterlist *list) | 76 | zfcp_address_to_sg(void *address, struct scatterlist *list, unsigned int size) |
76 | { | 77 | { |
77 | sg_set_buf(list, address, 0); | 78 | sg_set_buf(list, address, size); |
78 | } | 79 | } |
79 | 80 | ||
80 | #define REQUEST_LIST_SIZE 128 | 81 | #define REQUEST_LIST_SIZE 128 |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index a5763c6e9362..a6676be87843 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -172,12 +172,12 @@ config CHR_DEV_SCH | |||
172 | don't need this for those tiny 6-slot cdrom changers. Media | 172 | don't need this for those tiny 6-slot cdrom changers. Media |
173 | changers are listed as "Type: Medium Changer" in /proc/scsi/scsi. | 173 | changers are listed as "Type: Medium Changer" in /proc/scsi/scsi. |
174 | If you have such hardware and want to use it with linux, say Y | 174 | If you have such hardware and want to use it with linux, say Y |
175 | here. Check <file:Documentation/scsi-changer.txt> for details. | 175 | here. Check <file:Documentation/scsi/scsi-changer.txt> for details. |
176 | 176 | ||
177 | If you want to compile this as a module ( = code which can be | 177 | If you want to compile this as a module ( = code which can be |
178 | inserted in and removed from the running kernel whenever you want), | 178 | inserted in and removed from the running kernel whenever you want), |
179 | say M here and read <file:Documentation/kbuild/modules.txt> and | 179 | say M here and read <file:Documentation/kbuild/modules.txt> and |
180 | <file:Documentation/scsi.txt>. The module will be called ch.o. | 180 | <file:Documentation/scsi/scsi.txt>. The module will be called ch.o. |
181 | If unsure, say N. | 181 | If unsure, say N. |
182 | 182 | ||
183 | 183 | ||
@@ -725,7 +725,7 @@ config SCSI_FD_MCS | |||
725 | 725 | ||
726 | config SCSI_GDTH | 726 | config SCSI_GDTH |
727 | tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support" | 727 | tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support" |
728 | depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API | 728 | depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API && PCI_LEGACY |
729 | ---help--- | 729 | ---help--- |
730 | Formerly called GDT SCSI Disk Array Controller Support. | 730 | Formerly called GDT SCSI Disk Array Controller Support. |
731 | 731 | ||
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 72b0393b4596..1e6d7a9c75bf 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c | |||
@@ -391,7 +391,7 @@ static int close_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
391 | /* | 391 | /* |
392 | * Extract the fibctx from the input parameters | 392 | * Extract the fibctx from the input parameters |
393 | */ | 393 | */ |
394 | if (fibctx->unique == (u32)(ptrdiff_t)arg) /* We found a winner */ | 394 | if (fibctx->unique == (u32)(uintptr_t)arg) /* We found a winner */ |
395 | break; | 395 | break; |
396 | entry = entry->next; | 396 | entry = entry->next; |
397 | fibctx = NULL; | 397 | fibctx = NULL; |
@@ -590,7 +590,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
590 | } | 590 | } |
591 | addr = (u64)upsg->sg[i].addr[0]; | 591 | addr = (u64)upsg->sg[i].addr[0]; |
592 | addr += ((u64)upsg->sg[i].addr[1]) << 32; | 592 | addr += ((u64)upsg->sg[i].addr[1]) << 32; |
593 | sg_user[i] = (void __user *)(ptrdiff_t)addr; | 593 | sg_user[i] = (void __user *)(uintptr_t)addr; |
594 | sg_list[i] = p; // save so we can clean up later | 594 | sg_list[i] = p; // save so we can clean up later |
595 | sg_indx = i; | 595 | sg_indx = i; |
596 | 596 | ||
@@ -633,7 +633,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
633 | rcode = -ENOMEM; | 633 | rcode = -ENOMEM; |
634 | goto cleanup; | 634 | goto cleanup; |
635 | } | 635 | } |
636 | sg_user[i] = (void __user *)(ptrdiff_t)usg->sg[i].addr; | 636 | sg_user[i] = (void __user *)(uintptr_t)usg->sg[i].addr; |
637 | sg_list[i] = p; // save so we can clean up later | 637 | sg_list[i] = p; // save so we can clean up later |
638 | sg_indx = i; | 638 | sg_indx = i; |
639 | 639 | ||
@@ -664,7 +664,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
664 | if (actual_fibsize64 == fibsize) { | 664 | if (actual_fibsize64 == fibsize) { |
665 | struct user_sgmap64* usg = (struct user_sgmap64 *)upsg; | 665 | struct user_sgmap64* usg = (struct user_sgmap64 *)upsg; |
666 | for (i = 0; i < upsg->count; i++) { | 666 | for (i = 0; i < upsg->count; i++) { |
667 | u64 addr; | 667 | uintptr_t addr; |
668 | void* p; | 668 | void* p; |
669 | /* Does this really need to be GFP_DMA? */ | 669 | /* Does this really need to be GFP_DMA? */ |
670 | p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA); | 670 | p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA); |
@@ -676,7 +676,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
676 | } | 676 | } |
677 | addr = (u64)usg->sg[i].addr[0]; | 677 | addr = (u64)usg->sg[i].addr[0]; |
678 | addr += ((u64)usg->sg[i].addr[1]) << 32; | 678 | addr += ((u64)usg->sg[i].addr[1]) << 32; |
679 | sg_user[i] = (void __user *)(ptrdiff_t)addr; | 679 | sg_user[i] = (void __user *)addr; |
680 | sg_list[i] = p; // save so we can clean up later | 680 | sg_list[i] = p; // save so we can clean up later |
681 | sg_indx = i; | 681 | sg_indx = i; |
682 | 682 | ||
@@ -704,7 +704,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
704 | rcode = -ENOMEM; | 704 | rcode = -ENOMEM; |
705 | goto cleanup; | 705 | goto cleanup; |
706 | } | 706 | } |
707 | sg_user[i] = (void __user *)(ptrdiff_t)upsg->sg[i].addr; | 707 | sg_user[i] = (void __user *)(uintptr_t)upsg->sg[i].addr; |
708 | sg_list[i] = p; // save so we can clean up later | 708 | sg_list[i] = p; // save so we can clean up later |
709 | sg_indx = i; | 709 | sg_indx = i; |
710 | 710 | ||
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 3009ad8c4073..8736813a0296 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c | |||
@@ -110,7 +110,7 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co | |||
110 | /* | 110 | /* |
111 | * Align the beginning of Headers to commalign | 111 | * Align the beginning of Headers to commalign |
112 | */ | 112 | */ |
113 | align = (commalign - ((ptrdiff_t)(base) & (commalign - 1))); | 113 | align = (commalign - ((uintptr_t)(base) & (commalign - 1))); |
114 | base = base + align; | 114 | base = base + align; |
115 | phys = phys + align; | 115 | phys = phys + align; |
116 | /* | 116 | /* |
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c index fcd25f7d0bc6..e6032ffc66a6 100644 --- a/drivers/scsi/aacraid/dpcsup.c +++ b/drivers/scsi/aacraid/dpcsup.c | |||
@@ -254,7 +254,7 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index) | |||
254 | kfree (fib); | 254 | kfree (fib); |
255 | return 1; | 255 | return 1; |
256 | } | 256 | } |
257 | memcpy(hw_fib, (struct hw_fib *)(((ptrdiff_t)(dev->regs.sa)) + | 257 | memcpy(hw_fib, (struct hw_fib *)(((uintptr_t)(dev->regs.sa)) + |
258 | (index & ~0x00000002L)), sizeof(struct hw_fib)); | 258 | (index & ~0x00000002L)), sizeof(struct hw_fib)); |
259 | INIT_LIST_HEAD(&fib->fiblink); | 259 | INIT_LIST_HEAD(&fib->fiblink); |
260 | fib->type = FSAFS_NTC_FIB_CONTEXT; | 260 | fib->type = FSAFS_NTC_FIB_CONTEXT; |
diff --git a/drivers/scsi/aic94xx/aic94xx_sds.c b/drivers/scsi/aic94xx/aic94xx_sds.c index 5b0932f61473..06509bff71f7 100644 --- a/drivers/scsi/aic94xx/aic94xx_sds.c +++ b/drivers/scsi/aic94xx/aic94xx_sds.c | |||
@@ -377,7 +377,7 @@ out: | |||
377 | 377 | ||
378 | #define FLASH_RESET 0xF0 | 378 | #define FLASH_RESET 0xF0 |
379 | 379 | ||
380 | #define FLASH_SIZE 0x200000 | 380 | #define ASD_FLASH_SIZE 0x200000 |
381 | #define FLASH_DIR_COOKIE "*** ADAPTEC FLASH DIRECTORY *** " | 381 | #define FLASH_DIR_COOKIE "*** ADAPTEC FLASH DIRECTORY *** " |
382 | #define FLASH_NEXT_ENTRY_OFFS 0x2000 | 382 | #define FLASH_NEXT_ENTRY_OFFS 0x2000 |
383 | #define FLASH_MAX_DIR_ENTRIES 32 | 383 | #define FLASH_MAX_DIR_ENTRIES 32 |
@@ -609,7 +609,7 @@ static int asd_find_flash_dir(struct asd_ha_struct *asd_ha, | |||
609 | struct asd_flash_dir *flash_dir) | 609 | struct asd_flash_dir *flash_dir) |
610 | { | 610 | { |
611 | u32 v; | 611 | u32 v; |
612 | for (v = 0; v < FLASH_SIZE; v += FLASH_NEXT_ENTRY_OFFS) { | 612 | for (v = 0; v < ASD_FLASH_SIZE; v += FLASH_NEXT_ENTRY_OFFS) { |
613 | asd_read_flash_seg(asd_ha, flash_dir, v, | 613 | asd_read_flash_seg(asd_ha, flash_dir, v, |
614 | sizeof(FLASH_DIR_COOKIE)-1); | 614 | sizeof(FLASH_DIR_COOKIE)-1); |
615 | if (memcmp(flash_dir->cookie, FLASH_DIR_COOKIE, | 615 | if (memcmp(flash_dir->cookie, FLASH_DIR_COOKIE, |
diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h index ace7a15b413e..a67e29f83ae5 100644 --- a/drivers/scsi/arcmsr/arcmsr.h +++ b/drivers/scsi/arcmsr/arcmsr.h | |||
@@ -141,14 +141,14 @@ struct CMD_MESSAGE_FIELD | |||
141 | #define IS_SG64_ADDR 0x01000000 /* bit24 */ | 141 | #define IS_SG64_ADDR 0x01000000 /* bit24 */ |
142 | struct SG32ENTRY | 142 | struct SG32ENTRY |
143 | { | 143 | { |
144 | uint32_t length; | 144 | __le32 length; |
145 | uint32_t address; | 145 | __le32 address; |
146 | }; | 146 | }; |
147 | struct SG64ENTRY | 147 | struct SG64ENTRY |
148 | { | 148 | { |
149 | uint32_t length; | 149 | __le32 length; |
150 | uint32_t address; | 150 | __le32 address; |
151 | uint32_t addresshigh; | 151 | __le32 addresshigh; |
152 | }; | 152 | }; |
153 | struct SGENTRY_UNION | 153 | struct SGENTRY_UNION |
154 | { | 154 | { |
@@ -339,23 +339,15 @@ struct MessageUnit_B | |||
339 | uint32_t done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE]; | 339 | uint32_t done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE]; |
340 | uint32_t postq_index; | 340 | uint32_t postq_index; |
341 | uint32_t doneq_index; | 341 | uint32_t doneq_index; |
342 | uint32_t *drv2iop_doorbell_reg; | 342 | uint32_t __iomem *drv2iop_doorbell_reg; |
343 | uint32_t *drv2iop_doorbell_mask_reg; | 343 | uint32_t __iomem *drv2iop_doorbell_mask_reg; |
344 | uint32_t *iop2drv_doorbell_reg; | 344 | uint32_t __iomem *iop2drv_doorbell_reg; |
345 | uint32_t *iop2drv_doorbell_mask_reg; | 345 | uint32_t __iomem *iop2drv_doorbell_mask_reg; |
346 | uint32_t *msgcode_rwbuffer_reg; | 346 | uint32_t __iomem *msgcode_rwbuffer_reg; |
347 | uint32_t *ioctl_wbuffer_reg; | 347 | uint32_t __iomem *ioctl_wbuffer_reg; |
348 | uint32_t *ioctl_rbuffer_reg; | 348 | uint32_t __iomem *ioctl_rbuffer_reg; |
349 | }; | 349 | }; |
350 | 350 | ||
351 | struct MessageUnit | ||
352 | { | ||
353 | union | ||
354 | { | ||
355 | struct MessageUnit_A pmu_A; | ||
356 | struct MessageUnit_B pmu_B; | ||
357 | } u; | ||
358 | }; | ||
359 | /* | 351 | /* |
360 | ******************************************************************************* | 352 | ******************************************************************************* |
361 | ** Adapter Control Block | 353 | ** Adapter Control Block |
@@ -374,7 +366,10 @@ struct AdapterControlBlock | |||
374 | /* Offset is used in making arc cdb physical to virtual calculations */ | 366 | /* Offset is used in making arc cdb physical to virtual calculations */ |
375 | uint32_t outbound_int_enable; | 367 | uint32_t outbound_int_enable; |
376 | 368 | ||
377 | struct MessageUnit * pmu; | 369 | union { |
370 | struct MessageUnit_A __iomem * pmuA; | ||
371 | struct MessageUnit_B * pmuB; | ||
372 | }; | ||
378 | /* message unit ATU inbound base address0 */ | 373 | /* message unit ATU inbound base address0 */ |
379 | 374 | ||
380 | uint32_t acb_flags; | 375 | uint32_t acb_flags; |
@@ -558,7 +553,7 @@ struct SENSE_DATA | |||
558 | 553 | ||
559 | extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *); | 554 | extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *); |
560 | extern void arcmsr_iop_message_read(struct AdapterControlBlock *); | 555 | extern void arcmsr_iop_message_read(struct AdapterControlBlock *); |
561 | extern struct QBUFFER *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *); | 556 | extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *); |
562 | extern struct class_device_attribute *arcmsr_host_attrs[]; | 557 | extern struct class_device_attribute *arcmsr_host_attrs[]; |
563 | extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *); | 558 | extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *); |
564 | void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb); | 559 | void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb); |
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c index d04d1aa28fa4..7d7b0a554276 100644 --- a/drivers/scsi/arcmsr/arcmsr_attr.c +++ b/drivers/scsi/arcmsr/arcmsr_attr.c | |||
@@ -85,13 +85,13 @@ static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj, | |||
85 | allxfer_len++; | 85 | allxfer_len++; |
86 | } | 86 | } |
87 | if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) { | 87 | if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) { |
88 | struct QBUFFER *prbuffer; | 88 | struct QBUFFER __iomem *prbuffer; |
89 | uint8_t *iop_data; | 89 | uint8_t __iomem *iop_data; |
90 | int32_t iop_len; | 90 | int32_t iop_len; |
91 | 91 | ||
92 | acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; | 92 | acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; |
93 | prbuffer = arcmsr_get_iop_rqbuffer(acb); | 93 | prbuffer = arcmsr_get_iop_rqbuffer(acb); |
94 | iop_data = (uint8_t *)prbuffer->data; | 94 | iop_data = prbuffer->data; |
95 | iop_len = readl(&prbuffer->data_len); | 95 | iop_len = readl(&prbuffer->data_len); |
96 | while (iop_len > 0) { | 96 | while (iop_len > 0) { |
97 | acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data); | 97 | acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data); |
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index f7a252885a5c..d466a2dac1db 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c | |||
@@ -236,18 +236,22 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb) | |||
236 | uint32_t intmask_org; | 236 | uint32_t intmask_org; |
237 | int i, j; | 237 | int i, j; |
238 | 238 | ||
239 | acb->pmu = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); | 239 | acb->pmuA = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); |
240 | if (!acb->pmu) { | 240 | if (!acb->pmuA) { |
241 | printk(KERN_NOTICE "arcmsr%d: memory mapping region fail \n", | 241 | printk(KERN_NOTICE "arcmsr%d: memory mapping region fail \n", |
242 | acb->host->host_no); | 242 | acb->host->host_no); |
243 | return -ENOMEM; | ||
243 | } | 244 | } |
244 | 245 | ||
245 | dma_coherent = dma_alloc_coherent(&pdev->dev, | 246 | dma_coherent = dma_alloc_coherent(&pdev->dev, |
246 | ARCMSR_MAX_FREECCB_NUM * | 247 | ARCMSR_MAX_FREECCB_NUM * |
247 | sizeof (struct CommandControlBlock) + 0x20, | 248 | sizeof (struct CommandControlBlock) + 0x20, |
248 | &dma_coherent_handle, GFP_KERNEL); | 249 | &dma_coherent_handle, GFP_KERNEL); |
249 | if (!dma_coherent) | 250 | |
251 | if (!dma_coherent) { | ||
252 | iounmap(acb->pmuA); | ||
250 | return -ENOMEM; | 253 | return -ENOMEM; |
254 | } | ||
251 | 255 | ||
252 | acb->dma_coherent = dma_coherent; | 256 | acb->dma_coherent = dma_coherent; |
253 | acb->dma_coherent_handle = dma_coherent_handle; | 257 | acb->dma_coherent_handle = dma_coherent_handle; |
@@ -287,7 +291,7 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb) | |||
287 | 291 | ||
288 | struct pci_dev *pdev = acb->pdev; | 292 | struct pci_dev *pdev = acb->pdev; |
289 | struct MessageUnit_B *reg; | 293 | struct MessageUnit_B *reg; |
290 | void *mem_base0, *mem_base1; | 294 | void __iomem *mem_base0, *mem_base1; |
291 | void *dma_coherent; | 295 | void *dma_coherent; |
292 | dma_addr_t dma_coherent_handle, dma_addr; | 296 | dma_addr_t dma_coherent_handle, dma_addr; |
293 | uint32_t intmask_org; | 297 | uint32_t intmask_org; |
@@ -328,25 +332,28 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb) | |||
328 | 332 | ||
329 | reg = (struct MessageUnit_B *)(dma_coherent + | 333 | reg = (struct MessageUnit_B *)(dma_coherent + |
330 | ARCMSR_MAX_FREECCB_NUM * sizeof(struct CommandControlBlock)); | 334 | ARCMSR_MAX_FREECCB_NUM * sizeof(struct CommandControlBlock)); |
331 | acb->pmu = (struct MessageUnit *)reg; | 335 | acb->pmuB = reg; |
332 | mem_base0 = ioremap(pci_resource_start(pdev, 0), | 336 | mem_base0 = ioremap(pci_resource_start(pdev, 0), |
333 | pci_resource_len(pdev, 0)); | 337 | pci_resource_len(pdev, 0)); |
338 | if (!mem_base0) | ||
339 | goto out; | ||
340 | |||
334 | mem_base1 = ioremap(pci_resource_start(pdev, 2), | 341 | mem_base1 = ioremap(pci_resource_start(pdev, 2), |
335 | pci_resource_len(pdev, 2)); | 342 | pci_resource_len(pdev, 2)); |
336 | reg->drv2iop_doorbell_reg = (uint32_t *)((char *)mem_base0 + | 343 | if (!mem_base1) { |
337 | ARCMSR_DRV2IOP_DOORBELL); | 344 | iounmap(mem_base0); |
338 | reg->drv2iop_doorbell_mask_reg = (uint32_t *)((char *)mem_base0 + | 345 | goto out; |
339 | ARCMSR_DRV2IOP_DOORBELL_MASK); | 346 | } |
340 | reg->iop2drv_doorbell_reg = (uint32_t *)((char *)mem_base0 + | 347 | |
341 | ARCMSR_IOP2DRV_DOORBELL); | 348 | reg->drv2iop_doorbell_reg = mem_base0 + ARCMSR_DRV2IOP_DOORBELL; |
342 | reg->iop2drv_doorbell_mask_reg = (uint32_t *)((char *)mem_base0 + | 349 | reg->drv2iop_doorbell_mask_reg = mem_base0 + |
343 | ARCMSR_IOP2DRV_DOORBELL_MASK); | 350 | ARCMSR_DRV2IOP_DOORBELL_MASK; |
344 | reg->ioctl_wbuffer_reg = (uint32_t *)((char *)mem_base1 + | 351 | reg->iop2drv_doorbell_reg = mem_base0 + ARCMSR_IOP2DRV_DOORBELL; |
345 | ARCMSR_IOCTL_WBUFFER); | 352 | reg->iop2drv_doorbell_mask_reg = mem_base0 + |
346 | reg->ioctl_rbuffer_reg = (uint32_t *)((char *)mem_base1 + | 353 | ARCMSR_IOP2DRV_DOORBELL_MASK; |
347 | ARCMSR_IOCTL_RBUFFER); | 354 | reg->ioctl_wbuffer_reg = mem_base1 + ARCMSR_IOCTL_WBUFFER; |
348 | reg->msgcode_rwbuffer_reg = (uint32_t *)((char *)mem_base1 + | 355 | reg->ioctl_rbuffer_reg = mem_base1 + ARCMSR_IOCTL_RBUFFER; |
349 | ARCMSR_MSGCODE_RWBUFFER); | 356 | reg->msgcode_rwbuffer_reg = mem_base1 + ARCMSR_MSGCODE_RWBUFFER; |
350 | 357 | ||
351 | acb->vir2phy_offset = (unsigned long)ccb_tmp -(unsigned long)dma_addr; | 358 | acb->vir2phy_offset = (unsigned long)ccb_tmp -(unsigned long)dma_addr; |
352 | for (i = 0; i < ARCMSR_MAX_TARGETID; i++) | 359 | for (i = 0; i < ARCMSR_MAX_TARGETID; i++) |
@@ -362,6 +369,12 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb) | |||
362 | break; | 369 | break; |
363 | } | 370 | } |
364 | return 0; | 371 | return 0; |
372 | |||
373 | out: | ||
374 | dma_free_coherent(&acb->pdev->dev, | ||
375 | ARCMSR_MAX_FREECCB_NUM * sizeof(struct CommandControlBlock) + 0x20, | ||
376 | acb->dma_coherent, acb->dma_coherent_handle); | ||
377 | return -ENOMEM; | ||
365 | } | 378 | } |
366 | 379 | ||
367 | static int arcmsr_probe(struct pci_dev *pdev, | 380 | static int arcmsr_probe(struct pci_dev *pdev, |
@@ -454,7 +467,6 @@ static int arcmsr_probe(struct pci_dev *pdev, | |||
454 | free_irq(pdev->irq, acb); | 467 | free_irq(pdev->irq, acb); |
455 | out_free_ccb_pool: | 468 | out_free_ccb_pool: |
456 | arcmsr_free_ccb_pool(acb); | 469 | arcmsr_free_ccb_pool(acb); |
457 | iounmap(acb->pmu); | ||
458 | out_release_regions: | 470 | out_release_regions: |
459 | pci_release_regions(pdev); | 471 | pci_release_regions(pdev); |
460 | out_host_put: | 472 | out_host_put: |
@@ -467,7 +479,7 @@ static int arcmsr_probe(struct pci_dev *pdev, | |||
467 | 479 | ||
468 | static uint8_t arcmsr_hba_wait_msgint_ready(struct AdapterControlBlock *acb) | 480 | static uint8_t arcmsr_hba_wait_msgint_ready(struct AdapterControlBlock *acb) |
469 | { | 481 | { |
470 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 482 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
471 | uint32_t Index; | 483 | uint32_t Index; |
472 | uint8_t Retries = 0x00; | 484 | uint8_t Retries = 0x00; |
473 | 485 | ||
@@ -488,7 +500,7 @@ static uint8_t arcmsr_hba_wait_msgint_ready(struct AdapterControlBlock *acb) | |||
488 | 500 | ||
489 | static uint8_t arcmsr_hbb_wait_msgint_ready(struct AdapterControlBlock *acb) | 501 | static uint8_t arcmsr_hbb_wait_msgint_ready(struct AdapterControlBlock *acb) |
490 | { | 502 | { |
491 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 503 | struct MessageUnit_B *reg = acb->pmuB; |
492 | uint32_t Index; | 504 | uint32_t Index; |
493 | uint8_t Retries = 0x00; | 505 | uint8_t Retries = 0x00; |
494 | 506 | ||
@@ -509,7 +521,7 @@ static uint8_t arcmsr_hbb_wait_msgint_ready(struct AdapterControlBlock *acb) | |||
509 | 521 | ||
510 | static void arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb) | 522 | static void arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb) |
511 | { | 523 | { |
512 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 524 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
513 | 525 | ||
514 | writel(ARCMSR_INBOUND_MESG0_ABORT_CMD, ®->inbound_msgaddr0); | 526 | writel(ARCMSR_INBOUND_MESG0_ABORT_CMD, ®->inbound_msgaddr0); |
515 | if (arcmsr_hba_wait_msgint_ready(acb)) | 527 | if (arcmsr_hba_wait_msgint_ready(acb)) |
@@ -520,7 +532,7 @@ static void arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb) | |||
520 | 532 | ||
521 | static void arcmsr_abort_hbb_allcmd(struct AdapterControlBlock *acb) | 533 | static void arcmsr_abort_hbb_allcmd(struct AdapterControlBlock *acb) |
522 | { | 534 | { |
523 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 535 | struct MessageUnit_B *reg = acb->pmuB; |
524 | 536 | ||
525 | writel(ARCMSR_MESSAGE_ABORT_CMD, reg->drv2iop_doorbell_reg); | 537 | writel(ARCMSR_MESSAGE_ABORT_CMD, reg->drv2iop_doorbell_reg); |
526 | if (arcmsr_hbb_wait_msgint_ready(acb)) | 538 | if (arcmsr_hbb_wait_msgint_ready(acb)) |
@@ -566,7 +578,7 @@ static void arcmsr_ccb_complete(struct CommandControlBlock *ccb, int stand_flag) | |||
566 | 578 | ||
567 | static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb) | 579 | static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb) |
568 | { | 580 | { |
569 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 581 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
570 | int retry_count = 30; | 582 | int retry_count = 30; |
571 | 583 | ||
572 | writel(ARCMSR_INBOUND_MESG0_FLUSH_CACHE, ®->inbound_msgaddr0); | 584 | writel(ARCMSR_INBOUND_MESG0_FLUSH_CACHE, ®->inbound_msgaddr0); |
@@ -583,7 +595,7 @@ static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb) | |||
583 | 595 | ||
584 | static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb) | 596 | static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb) |
585 | { | 597 | { |
586 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 598 | struct MessageUnit_B *reg = acb->pmuB; |
587 | int retry_count = 30; | 599 | int retry_count = 30; |
588 | 600 | ||
589 | writel(ARCMSR_MESSAGE_FLUSH_CACHE, reg->drv2iop_doorbell_reg); | 601 | writel(ARCMSR_MESSAGE_FLUSH_CACHE, reg->drv2iop_doorbell_reg); |
@@ -637,7 +649,7 @@ static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb) | |||
637 | switch (acb->adapter_type) { | 649 | switch (acb->adapter_type) { |
638 | 650 | ||
639 | case ACB_ADAPTER_TYPE_A : { | 651 | case ACB_ADAPTER_TYPE_A : { |
640 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 652 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
641 | orig_mask = readl(®->outbound_intmask)|\ | 653 | orig_mask = readl(®->outbound_intmask)|\ |
642 | ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE; | 654 | ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE; |
643 | writel(orig_mask|ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE, \ | 655 | writel(orig_mask|ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE, \ |
@@ -646,7 +658,7 @@ static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb) | |||
646 | break; | 658 | break; |
647 | 659 | ||
648 | case ACB_ADAPTER_TYPE_B : { | 660 | case ACB_ADAPTER_TYPE_B : { |
649 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 661 | struct MessageUnit_B *reg = acb->pmuB; |
650 | orig_mask = readl(reg->iop2drv_doorbell_mask_reg) & \ | 662 | orig_mask = readl(reg->iop2drv_doorbell_mask_reg) & \ |
651 | (~ARCMSR_IOP2DRV_MESSAGE_CMD_DONE); | 663 | (~ARCMSR_IOP2DRV_MESSAGE_CMD_DONE); |
652 | writel(0, reg->iop2drv_doorbell_mask_reg); | 664 | writel(0, reg->iop2drv_doorbell_mask_reg); |
@@ -748,14 +760,13 @@ static void arcmsr_done4abort_postqueue(struct AdapterControlBlock *acb) | |||
748 | switch (acb->adapter_type) { | 760 | switch (acb->adapter_type) { |
749 | 761 | ||
750 | case ACB_ADAPTER_TYPE_A: { | 762 | case ACB_ADAPTER_TYPE_A: { |
751 | struct MessageUnit_A __iomem *reg = \ | 763 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
752 | (struct MessageUnit_A *)acb->pmu; | ||
753 | uint32_t outbound_intstatus; | 764 | uint32_t outbound_intstatus; |
754 | outbound_intstatus = readl(®->outbound_intstatus) & \ | 765 | outbound_intstatus = readl(®->outbound_intstatus) & |
755 | acb->outbound_int_enable; | 766 | acb->outbound_int_enable; |
756 | /*clear and abort all outbound posted Q*/ | 767 | /*clear and abort all outbound posted Q*/ |
757 | writel(outbound_intstatus, ®->outbound_intstatus);/*clear interrupt*/ | 768 | writel(outbound_intstatus, ®->outbound_intstatus);/*clear interrupt*/ |
758 | while (((flag_ccb = readl(®->outbound_queueport)) != 0xFFFFFFFF) \ | 769 | while (((flag_ccb = readl(®->outbound_queueport)) != 0xFFFFFFFF) |
759 | && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) { | 770 | && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) { |
760 | arcmsr_drain_donequeue(acb, flag_ccb); | 771 | arcmsr_drain_donequeue(acb, flag_ccb); |
761 | } | 772 | } |
@@ -763,7 +774,7 @@ static void arcmsr_done4abort_postqueue(struct AdapterControlBlock *acb) | |||
763 | break; | 774 | break; |
764 | 775 | ||
765 | case ACB_ADAPTER_TYPE_B: { | 776 | case ACB_ADAPTER_TYPE_B: { |
766 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 777 | struct MessageUnit_B *reg = acb->pmuB; |
767 | /*clear all outbound posted Q*/ | 778 | /*clear all outbound posted Q*/ |
768 | for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) { | 779 | for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) { |
769 | if ((flag_ccb = readl(®->done_qbuffer[i])) != 0) { | 780 | if ((flag_ccb = readl(®->done_qbuffer[i])) != 0) { |
@@ -816,7 +827,6 @@ static void arcmsr_remove(struct pci_dev *pdev) | |||
816 | } | 827 | } |
817 | 828 | ||
818 | free_irq(pdev->irq, acb); | 829 | free_irq(pdev->irq, acb); |
819 | iounmap(acb->pmu); | ||
820 | arcmsr_free_ccb_pool(acb); | 830 | arcmsr_free_ccb_pool(acb); |
821 | pci_release_regions(pdev); | 831 | pci_release_regions(pdev); |
822 | 832 | ||
@@ -859,7 +869,7 @@ static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb, \ | |||
859 | switch (acb->adapter_type) { | 869 | switch (acb->adapter_type) { |
860 | 870 | ||
861 | case ACB_ADAPTER_TYPE_A : { | 871 | case ACB_ADAPTER_TYPE_A : { |
862 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 872 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
863 | mask = intmask_org & ~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE | | 873 | mask = intmask_org & ~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE | |
864 | ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE); | 874 | ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE); |
865 | writel(mask, ®->outbound_intmask); | 875 | writel(mask, ®->outbound_intmask); |
@@ -868,7 +878,7 @@ static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb, \ | |||
868 | break; | 878 | break; |
869 | 879 | ||
870 | case ACB_ADAPTER_TYPE_B : { | 880 | case ACB_ADAPTER_TYPE_B : { |
871 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 881 | struct MessageUnit_B *reg = acb->pmuB; |
872 | mask = intmask_org | (ARCMSR_IOP2DRV_DATA_WRITE_OK | \ | 882 | mask = intmask_org | (ARCMSR_IOP2DRV_DATA_WRITE_OK | \ |
873 | ARCMSR_IOP2DRV_DATA_READ_OK | ARCMSR_IOP2DRV_CDB_DONE); | 883 | ARCMSR_IOP2DRV_DATA_READ_OK | ARCMSR_IOP2DRV_CDB_DONE); |
874 | writel(mask, reg->iop2drv_doorbell_mask_reg); | 884 | writel(mask, reg->iop2drv_doorbell_mask_reg); |
@@ -882,7 +892,7 @@ static void arcmsr_build_ccb(struct AdapterControlBlock *acb, | |||
882 | { | 892 | { |
883 | struct ARCMSR_CDB *arcmsr_cdb = (struct ARCMSR_CDB *)&ccb->arcmsr_cdb; | 893 | struct ARCMSR_CDB *arcmsr_cdb = (struct ARCMSR_CDB *)&ccb->arcmsr_cdb; |
884 | int8_t *psge = (int8_t *)&arcmsr_cdb->u; | 894 | int8_t *psge = (int8_t *)&arcmsr_cdb->u; |
885 | uint32_t address_lo, address_hi; | 895 | __le32 address_lo, address_hi; |
886 | int arccdbsize = 0x30; | 896 | int arccdbsize = 0x30; |
887 | int nseg; | 897 | int nseg; |
888 | 898 | ||
@@ -900,7 +910,8 @@ static void arcmsr_build_ccb(struct AdapterControlBlock *acb, | |||
900 | BUG_ON(nseg < 0); | 910 | BUG_ON(nseg < 0); |
901 | 911 | ||
902 | if (nseg) { | 912 | if (nseg) { |
903 | int length, i, cdb_sgcount = 0; | 913 | __le32 length; |
914 | int i, cdb_sgcount = 0; | ||
904 | struct scatterlist *sg; | 915 | struct scatterlist *sg; |
905 | 916 | ||
906 | /* map stor port SG list to our iop SG List. */ | 917 | /* map stor port SG list to our iop SG List. */ |
@@ -921,7 +932,7 @@ static void arcmsr_build_ccb(struct AdapterControlBlock *acb, | |||
921 | 932 | ||
922 | pdma_sg->addresshigh = address_hi; | 933 | pdma_sg->addresshigh = address_hi; |
923 | pdma_sg->address = address_lo; | 934 | pdma_sg->address = address_lo; |
924 | pdma_sg->length = length|IS_SG64_ADDR; | 935 | pdma_sg->length = length|cpu_to_le32(IS_SG64_ADDR); |
925 | psge += sizeof (struct SG64ENTRY); | 936 | psge += sizeof (struct SG64ENTRY); |
926 | arccdbsize += sizeof (struct SG64ENTRY); | 937 | arccdbsize += sizeof (struct SG64ENTRY); |
927 | } | 938 | } |
@@ -947,7 +958,7 @@ static void arcmsr_post_ccb(struct AdapterControlBlock *acb, struct CommandContr | |||
947 | 958 | ||
948 | switch (acb->adapter_type) { | 959 | switch (acb->adapter_type) { |
949 | case ACB_ADAPTER_TYPE_A: { | 960 | case ACB_ADAPTER_TYPE_A: { |
950 | struct MessageUnit_A *reg = (struct MessageUnit_A *)acb->pmu; | 961 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
951 | 962 | ||
952 | if (arcmsr_cdb->Flags & ARCMSR_CDB_FLAG_SGL_BSIZE) | 963 | if (arcmsr_cdb->Flags & ARCMSR_CDB_FLAG_SGL_BSIZE) |
953 | writel(cdb_shifted_phyaddr | ARCMSR_CCBPOST_FLAG_SGL_BSIZE, | 964 | writel(cdb_shifted_phyaddr | ARCMSR_CCBPOST_FLAG_SGL_BSIZE, |
@@ -959,7 +970,7 @@ static void arcmsr_post_ccb(struct AdapterControlBlock *acb, struct CommandContr | |||
959 | break; | 970 | break; |
960 | 971 | ||
961 | case ACB_ADAPTER_TYPE_B: { | 972 | case ACB_ADAPTER_TYPE_B: { |
962 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 973 | struct MessageUnit_B *reg = acb->pmuB; |
963 | uint32_t ending_index, index = reg->postq_index; | 974 | uint32_t ending_index, index = reg->postq_index; |
964 | 975 | ||
965 | ending_index = ((index + 1) % ARCMSR_MAX_HBB_POSTQUEUE); | 976 | ending_index = ((index + 1) % ARCMSR_MAX_HBB_POSTQUEUE); |
@@ -982,7 +993,7 @@ static void arcmsr_post_ccb(struct AdapterControlBlock *acb, struct CommandContr | |||
982 | 993 | ||
983 | static void arcmsr_stop_hba_bgrb(struct AdapterControlBlock *acb) | 994 | static void arcmsr_stop_hba_bgrb(struct AdapterControlBlock *acb) |
984 | { | 995 | { |
985 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 996 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
986 | acb->acb_flags &= ~ACB_F_MSG_START_BGRB; | 997 | acb->acb_flags &= ~ACB_F_MSG_START_BGRB; |
987 | writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, ®->inbound_msgaddr0); | 998 | writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, ®->inbound_msgaddr0); |
988 | 999 | ||
@@ -995,7 +1006,7 @@ static void arcmsr_stop_hba_bgrb(struct AdapterControlBlock *acb) | |||
995 | 1006 | ||
996 | static void arcmsr_stop_hbb_bgrb(struct AdapterControlBlock *acb) | 1007 | static void arcmsr_stop_hbb_bgrb(struct AdapterControlBlock *acb) |
997 | { | 1008 | { |
998 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 1009 | struct MessageUnit_B *reg = acb->pmuB; |
999 | acb->acb_flags &= ~ACB_F_MSG_START_BGRB; | 1010 | acb->acb_flags &= ~ACB_F_MSG_START_BGRB; |
1000 | writel(ARCMSR_MESSAGE_STOP_BGRB, reg->drv2iop_doorbell_reg); | 1011 | writel(ARCMSR_MESSAGE_STOP_BGRB, reg->drv2iop_doorbell_reg); |
1001 | 1012 | ||
@@ -1023,6 +1034,17 @@ static void arcmsr_stop_adapter_bgrb(struct AdapterControlBlock *acb) | |||
1023 | 1034 | ||
1024 | static void arcmsr_free_ccb_pool(struct AdapterControlBlock *acb) | 1035 | static void arcmsr_free_ccb_pool(struct AdapterControlBlock *acb) |
1025 | { | 1036 | { |
1037 | switch (acb->adapter_type) { | ||
1038 | case ACB_ADAPTER_TYPE_A: { | ||
1039 | iounmap(acb->pmuA); | ||
1040 | break; | ||
1041 | } | ||
1042 | case ACB_ADAPTER_TYPE_B: { | ||
1043 | struct MessageUnit_B *reg = acb->pmuB; | ||
1044 | iounmap(reg->drv2iop_doorbell_reg - ARCMSR_DRV2IOP_DOORBELL); | ||
1045 | iounmap(reg->ioctl_wbuffer_reg - ARCMSR_IOCTL_WBUFFER); | ||
1046 | } | ||
1047 | } | ||
1026 | dma_free_coherent(&acb->pdev->dev, | 1048 | dma_free_coherent(&acb->pdev->dev, |
1027 | ARCMSR_MAX_FREECCB_NUM * sizeof (struct CommandControlBlock) + 0x20, | 1049 | ARCMSR_MAX_FREECCB_NUM * sizeof (struct CommandControlBlock) + 0x20, |
1028 | acb->dma_coherent, | 1050 | acb->dma_coherent, |
@@ -1033,13 +1055,13 @@ void arcmsr_iop_message_read(struct AdapterControlBlock *acb) | |||
1033 | { | 1055 | { |
1034 | switch (acb->adapter_type) { | 1056 | switch (acb->adapter_type) { |
1035 | case ACB_ADAPTER_TYPE_A: { | 1057 | case ACB_ADAPTER_TYPE_A: { |
1036 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 1058 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
1037 | writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, ®->inbound_doorbell); | 1059 | writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, ®->inbound_doorbell); |
1038 | } | 1060 | } |
1039 | break; | 1061 | break; |
1040 | 1062 | ||
1041 | case ACB_ADAPTER_TYPE_B: { | 1063 | case ACB_ADAPTER_TYPE_B: { |
1042 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 1064 | struct MessageUnit_B *reg = acb->pmuB; |
1043 | writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg); | 1065 | writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg); |
1044 | } | 1066 | } |
1045 | break; | 1067 | break; |
@@ -1050,7 +1072,7 @@ static void arcmsr_iop_message_wrote(struct AdapterControlBlock *acb) | |||
1050 | { | 1072 | { |
1051 | switch (acb->adapter_type) { | 1073 | switch (acb->adapter_type) { |
1052 | case ACB_ADAPTER_TYPE_A: { | 1074 | case ACB_ADAPTER_TYPE_A: { |
1053 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 1075 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
1054 | /* | 1076 | /* |
1055 | ** push inbound doorbell tell iop, driver data write ok | 1077 | ** push inbound doorbell tell iop, driver data write ok |
1056 | ** and wait reply on next hwinterrupt for next Qbuffer post | 1078 | ** and wait reply on next hwinterrupt for next Qbuffer post |
@@ -1060,7 +1082,7 @@ static void arcmsr_iop_message_wrote(struct AdapterControlBlock *acb) | |||
1060 | break; | 1082 | break; |
1061 | 1083 | ||
1062 | case ACB_ADAPTER_TYPE_B: { | 1084 | case ACB_ADAPTER_TYPE_B: { |
1063 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 1085 | struct MessageUnit_B *reg = acb->pmuB; |
1064 | /* | 1086 | /* |
1065 | ** push inbound doorbell tell iop, driver data write ok | 1087 | ** push inbound doorbell tell iop, driver data write ok |
1066 | ** and wait reply on next hwinterrupt for next Qbuffer post | 1088 | ** and wait reply on next hwinterrupt for next Qbuffer post |
@@ -1071,41 +1093,41 @@ static void arcmsr_iop_message_wrote(struct AdapterControlBlock *acb) | |||
1071 | } | 1093 | } |
1072 | } | 1094 | } |
1073 | 1095 | ||
1074 | struct QBUFFER *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *acb) | 1096 | struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *acb) |
1075 | { | 1097 | { |
1076 | static struct QBUFFER *qbuffer; | 1098 | struct QBUFFER __iomem *qbuffer = NULL; |
1077 | 1099 | ||
1078 | switch (acb->adapter_type) { | 1100 | switch (acb->adapter_type) { |
1079 | 1101 | ||
1080 | case ACB_ADAPTER_TYPE_A: { | 1102 | case ACB_ADAPTER_TYPE_A: { |
1081 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 1103 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
1082 | qbuffer = (struct QBUFFER __iomem *) ®->message_rbuffer; | 1104 | qbuffer = (struct QBUFFER __iomem *)®->message_rbuffer; |
1083 | } | 1105 | } |
1084 | break; | 1106 | break; |
1085 | 1107 | ||
1086 | case ACB_ADAPTER_TYPE_B: { | 1108 | case ACB_ADAPTER_TYPE_B: { |
1087 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 1109 | struct MessageUnit_B *reg = acb->pmuB; |
1088 | qbuffer = (struct QBUFFER __iomem *) reg->ioctl_rbuffer_reg; | 1110 | qbuffer = (struct QBUFFER __iomem *)reg->ioctl_rbuffer_reg; |
1089 | } | 1111 | } |
1090 | break; | 1112 | break; |
1091 | } | 1113 | } |
1092 | return qbuffer; | 1114 | return qbuffer; |
1093 | } | 1115 | } |
1094 | 1116 | ||
1095 | static struct QBUFFER *arcmsr_get_iop_wqbuffer(struct AdapterControlBlock *acb) | 1117 | static struct QBUFFER __iomem *arcmsr_get_iop_wqbuffer(struct AdapterControlBlock *acb) |
1096 | { | 1118 | { |
1097 | static struct QBUFFER *pqbuffer; | 1119 | struct QBUFFER __iomem *pqbuffer = NULL; |
1098 | 1120 | ||
1099 | switch (acb->adapter_type) { | 1121 | switch (acb->adapter_type) { |
1100 | 1122 | ||
1101 | case ACB_ADAPTER_TYPE_A: { | 1123 | case ACB_ADAPTER_TYPE_A: { |
1102 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 1124 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
1103 | pqbuffer = (struct QBUFFER *) ®->message_wbuffer; | 1125 | pqbuffer = (struct QBUFFER __iomem *) ®->message_wbuffer; |
1104 | } | 1126 | } |
1105 | break; | 1127 | break; |
1106 | 1128 | ||
1107 | case ACB_ADAPTER_TYPE_B: { | 1129 | case ACB_ADAPTER_TYPE_B: { |
1108 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 1130 | struct MessageUnit_B *reg = acb->pmuB; |
1109 | pqbuffer = (struct QBUFFER __iomem *)reg->ioctl_wbuffer_reg; | 1131 | pqbuffer = (struct QBUFFER __iomem *)reg->ioctl_wbuffer_reg; |
1110 | } | 1132 | } |
1111 | break; | 1133 | break; |
@@ -1115,15 +1137,15 @@ static struct QBUFFER *arcmsr_get_iop_wqbuffer(struct AdapterControlBlock *acb) | |||
1115 | 1137 | ||
1116 | static void arcmsr_iop2drv_data_wrote_handle(struct AdapterControlBlock *acb) | 1138 | static void arcmsr_iop2drv_data_wrote_handle(struct AdapterControlBlock *acb) |
1117 | { | 1139 | { |
1118 | struct QBUFFER *prbuffer; | 1140 | struct QBUFFER __iomem *prbuffer; |
1119 | struct QBUFFER *pQbuffer; | 1141 | struct QBUFFER *pQbuffer; |
1120 | uint8_t *iop_data; | 1142 | uint8_t __iomem *iop_data; |
1121 | int32_t my_empty_len, iop_len, rqbuf_firstindex, rqbuf_lastindex; | 1143 | int32_t my_empty_len, iop_len, rqbuf_firstindex, rqbuf_lastindex; |
1122 | 1144 | ||
1123 | rqbuf_lastindex = acb->rqbuf_lastindex; | 1145 | rqbuf_lastindex = acb->rqbuf_lastindex; |
1124 | rqbuf_firstindex = acb->rqbuf_firstindex; | 1146 | rqbuf_firstindex = acb->rqbuf_firstindex; |
1125 | prbuffer = arcmsr_get_iop_rqbuffer(acb); | 1147 | prbuffer = arcmsr_get_iop_rqbuffer(acb); |
1126 | iop_data = (uint8_t *)prbuffer->data; | 1148 | iop_data = (uint8_t __iomem *)prbuffer->data; |
1127 | iop_len = prbuffer->data_len; | 1149 | iop_len = prbuffer->data_len; |
1128 | my_empty_len = (rqbuf_firstindex - rqbuf_lastindex -1)&(ARCMSR_MAX_QBUFFER -1); | 1150 | my_empty_len = (rqbuf_firstindex - rqbuf_lastindex -1)&(ARCMSR_MAX_QBUFFER -1); |
1129 | 1151 | ||
@@ -1151,8 +1173,8 @@ static void arcmsr_iop2drv_data_read_handle(struct AdapterControlBlock *acb) | |||
1151 | acb->acb_flags |= ACB_F_MESSAGE_WQBUFFER_READED; | 1173 | acb->acb_flags |= ACB_F_MESSAGE_WQBUFFER_READED; |
1152 | if (acb->wqbuf_firstindex != acb->wqbuf_lastindex) { | 1174 | if (acb->wqbuf_firstindex != acb->wqbuf_lastindex) { |
1153 | uint8_t *pQbuffer; | 1175 | uint8_t *pQbuffer; |
1154 | struct QBUFFER *pwbuffer; | 1176 | struct QBUFFER __iomem *pwbuffer; |
1155 | uint8_t *iop_data; | 1177 | uint8_t __iomem *iop_data; |
1156 | int32_t allxfer_len = 0; | 1178 | int32_t allxfer_len = 0; |
1157 | 1179 | ||
1158 | acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READED); | 1180 | acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READED); |
@@ -1181,7 +1203,7 @@ static void arcmsr_iop2drv_data_read_handle(struct AdapterControlBlock *acb) | |||
1181 | static void arcmsr_hba_doorbell_isr(struct AdapterControlBlock *acb) | 1203 | static void arcmsr_hba_doorbell_isr(struct AdapterControlBlock *acb) |
1182 | { | 1204 | { |
1183 | uint32_t outbound_doorbell; | 1205 | uint32_t outbound_doorbell; |
1184 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 1206 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
1185 | 1207 | ||
1186 | outbound_doorbell = readl(®->outbound_doorbell); | 1208 | outbound_doorbell = readl(®->outbound_doorbell); |
1187 | writel(outbound_doorbell, ®->outbound_doorbell); | 1209 | writel(outbound_doorbell, ®->outbound_doorbell); |
@@ -1197,7 +1219,7 @@ static void arcmsr_hba_doorbell_isr(struct AdapterControlBlock *acb) | |||
1197 | static void arcmsr_hba_postqueue_isr(struct AdapterControlBlock *acb) | 1219 | static void arcmsr_hba_postqueue_isr(struct AdapterControlBlock *acb) |
1198 | { | 1220 | { |
1199 | uint32_t flag_ccb; | 1221 | uint32_t flag_ccb; |
1200 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 1222 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
1201 | 1223 | ||
1202 | while ((flag_ccb = readl(®->outbound_queueport)) != 0xFFFFFFFF) { | 1224 | while ((flag_ccb = readl(®->outbound_queueport)) != 0xFFFFFFFF) { |
1203 | arcmsr_drain_donequeue(acb, flag_ccb); | 1225 | arcmsr_drain_donequeue(acb, flag_ccb); |
@@ -1208,7 +1230,7 @@ static void arcmsr_hbb_postqueue_isr(struct AdapterControlBlock *acb) | |||
1208 | { | 1230 | { |
1209 | uint32_t index; | 1231 | uint32_t index; |
1210 | uint32_t flag_ccb; | 1232 | uint32_t flag_ccb; |
1211 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 1233 | struct MessageUnit_B *reg = acb->pmuB; |
1212 | 1234 | ||
1213 | index = reg->doneq_index; | 1235 | index = reg->doneq_index; |
1214 | 1236 | ||
@@ -1224,7 +1246,7 @@ static void arcmsr_hbb_postqueue_isr(struct AdapterControlBlock *acb) | |||
1224 | static int arcmsr_handle_hba_isr(struct AdapterControlBlock *acb) | 1246 | static int arcmsr_handle_hba_isr(struct AdapterControlBlock *acb) |
1225 | { | 1247 | { |
1226 | uint32_t outbound_intstatus; | 1248 | uint32_t outbound_intstatus; |
1227 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 1249 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
1228 | 1250 | ||
1229 | outbound_intstatus = readl(®->outbound_intstatus) & \ | 1251 | outbound_intstatus = readl(®->outbound_intstatus) & \ |
1230 | acb->outbound_int_enable; | 1252 | acb->outbound_int_enable; |
@@ -1244,7 +1266,7 @@ static int arcmsr_handle_hba_isr(struct AdapterControlBlock *acb) | |||
1244 | static int arcmsr_handle_hbb_isr(struct AdapterControlBlock *acb) | 1266 | static int arcmsr_handle_hbb_isr(struct AdapterControlBlock *acb) |
1245 | { | 1267 | { |
1246 | uint32_t outbound_doorbell; | 1268 | uint32_t outbound_doorbell; |
1247 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 1269 | struct MessageUnit_B *reg = acb->pmuB; |
1248 | 1270 | ||
1249 | outbound_doorbell = readl(reg->iop2drv_doorbell_reg) & \ | 1271 | outbound_doorbell = readl(reg->iop2drv_doorbell_reg) & \ |
1250 | acb->outbound_int_enable; | 1272 | acb->outbound_int_enable; |
@@ -1305,8 +1327,8 @@ void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *acb) | |||
1305 | { | 1327 | { |
1306 | int32_t wqbuf_firstindex, wqbuf_lastindex; | 1328 | int32_t wqbuf_firstindex, wqbuf_lastindex; |
1307 | uint8_t *pQbuffer; | 1329 | uint8_t *pQbuffer; |
1308 | struct QBUFFER *pwbuffer; | 1330 | struct QBUFFER __iomem *pwbuffer; |
1309 | uint8_t *iop_data; | 1331 | uint8_t __iomem *iop_data; |
1310 | int32_t allxfer_len = 0; | 1332 | int32_t allxfer_len = 0; |
1311 | 1333 | ||
1312 | pwbuffer = arcmsr_get_iop_wqbuffer(acb); | 1334 | pwbuffer = arcmsr_get_iop_wqbuffer(acb); |
@@ -1380,13 +1402,13 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, \ | |||
1380 | } | 1402 | } |
1381 | if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) { | 1403 | if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) { |
1382 | 1404 | ||
1383 | struct QBUFFER *prbuffer; | 1405 | struct QBUFFER __iomem *prbuffer; |
1384 | uint8_t *iop_data; | 1406 | uint8_t __iomem *iop_data; |
1385 | int32_t iop_len; | 1407 | int32_t iop_len; |
1386 | 1408 | ||
1387 | acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; | 1409 | acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; |
1388 | prbuffer = arcmsr_get_iop_rqbuffer(acb); | 1410 | prbuffer = arcmsr_get_iop_rqbuffer(acb); |
1389 | iop_data = (uint8_t *)prbuffer->data; | 1411 | iop_data = prbuffer->data; |
1390 | iop_len = readl(&prbuffer->data_len); | 1412 | iop_len = readl(&prbuffer->data_len); |
1391 | while (iop_len > 0) { | 1413 | while (iop_len > 0) { |
1392 | acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data); | 1414 | acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data); |
@@ -1669,11 +1691,11 @@ static int arcmsr_queue_command(struct scsi_cmnd *cmd, | |||
1669 | 1691 | ||
1670 | static void arcmsr_get_hba_config(struct AdapterControlBlock *acb) | 1692 | static void arcmsr_get_hba_config(struct AdapterControlBlock *acb) |
1671 | { | 1693 | { |
1672 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 1694 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
1673 | char *acb_firm_model = acb->firm_model; | 1695 | char *acb_firm_model = acb->firm_model; |
1674 | char *acb_firm_version = acb->firm_version; | 1696 | char *acb_firm_version = acb->firm_version; |
1675 | char *iop_firm_model = (char *) (®->message_rwbuffer[15]); | 1697 | char __iomem *iop_firm_model = (char __iomem *)(®->message_rwbuffer[15]); |
1676 | char *iop_firm_version = (char *) (®->message_rwbuffer[17]); | 1698 | char __iomem *iop_firm_version = (char __iomem *)(®->message_rwbuffer[17]); |
1677 | int count; | 1699 | int count; |
1678 | 1700 | ||
1679 | writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, ®->inbound_msgaddr0); | 1701 | writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, ®->inbound_msgaddr0); |
@@ -1710,13 +1732,13 @@ static void arcmsr_get_hba_config(struct AdapterControlBlock *acb) | |||
1710 | 1732 | ||
1711 | static void arcmsr_get_hbb_config(struct AdapterControlBlock *acb) | 1733 | static void arcmsr_get_hbb_config(struct AdapterControlBlock *acb) |
1712 | { | 1734 | { |
1713 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 1735 | struct MessageUnit_B *reg = acb->pmuB; |
1714 | uint32_t *lrwbuffer = reg->msgcode_rwbuffer_reg; | 1736 | uint32_t __iomem *lrwbuffer = reg->msgcode_rwbuffer_reg; |
1715 | char *acb_firm_model = acb->firm_model; | 1737 | char *acb_firm_model = acb->firm_model; |
1716 | char *acb_firm_version = acb->firm_version; | 1738 | char *acb_firm_version = acb->firm_version; |
1717 | char *iop_firm_model = (char *) (&lrwbuffer[15]); | 1739 | char __iomem *iop_firm_model = (char __iomem *)(&lrwbuffer[15]); |
1718 | /*firm_model,15,60-67*/ | 1740 | /*firm_model,15,60-67*/ |
1719 | char *iop_firm_version = (char *) (&lrwbuffer[17]); | 1741 | char __iomem *iop_firm_version = (char __iomem *)(&lrwbuffer[17]); |
1720 | /*firm_version,17,68-83*/ | 1742 | /*firm_version,17,68-83*/ |
1721 | int count; | 1743 | int count; |
1722 | 1744 | ||
@@ -1777,7 +1799,7 @@ static void arcmsr_get_firmware_spec(struct AdapterControlBlock *acb) | |||
1777 | static void arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb, | 1799 | static void arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb, |
1778 | struct CommandControlBlock *poll_ccb) | 1800 | struct CommandControlBlock *poll_ccb) |
1779 | { | 1801 | { |
1780 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 1802 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
1781 | struct CommandControlBlock *ccb; | 1803 | struct CommandControlBlock *ccb; |
1782 | uint32_t flag_ccb, outbound_intstatus, poll_ccb_done = 0, poll_count = 0; | 1804 | uint32_t flag_ccb, outbound_intstatus, poll_ccb_done = 0, poll_count = 0; |
1783 | 1805 | ||
@@ -1826,7 +1848,7 @@ static void arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb, | |||
1826 | static void arcmsr_polling_hbb_ccbdone(struct AdapterControlBlock *acb, \ | 1848 | static void arcmsr_polling_hbb_ccbdone(struct AdapterControlBlock *acb, \ |
1827 | struct CommandControlBlock *poll_ccb) | 1849 | struct CommandControlBlock *poll_ccb) |
1828 | { | 1850 | { |
1829 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 1851 | struct MessageUnit_B *reg = acb->pmuB; |
1830 | struct CommandControlBlock *ccb; | 1852 | struct CommandControlBlock *ccb; |
1831 | uint32_t flag_ccb, poll_ccb_done = 0, poll_count = 0; | 1853 | uint32_t flag_ccb, poll_ccb_done = 0, poll_count = 0; |
1832 | int index; | 1854 | int index; |
@@ -1918,8 +1940,7 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb) | |||
1918 | 1940 | ||
1919 | case ACB_ADAPTER_TYPE_A: { | 1941 | case ACB_ADAPTER_TYPE_A: { |
1920 | if (ccb_phyaddr_hi32 != 0) { | 1942 | if (ccb_phyaddr_hi32 != 0) { |
1921 | struct MessageUnit_A __iomem *reg = \ | 1943 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
1922 | (struct MessageUnit_A *)acb->pmu; | ||
1923 | uint32_t intmask_org; | 1944 | uint32_t intmask_org; |
1924 | intmask_org = arcmsr_disable_outbound_ints(acb); | 1945 | intmask_org = arcmsr_disable_outbound_ints(acb); |
1925 | writel(ARCMSR_SIGNATURE_SET_CONFIG, \ | 1946 | writel(ARCMSR_SIGNATURE_SET_CONFIG, \ |
@@ -1940,9 +1961,9 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb) | |||
1940 | 1961 | ||
1941 | case ACB_ADAPTER_TYPE_B: { | 1962 | case ACB_ADAPTER_TYPE_B: { |
1942 | unsigned long post_queue_phyaddr; | 1963 | unsigned long post_queue_phyaddr; |
1943 | uint32_t *rwbuffer; | 1964 | uint32_t __iomem *rwbuffer; |
1944 | 1965 | ||
1945 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 1966 | struct MessageUnit_B *reg = acb->pmuB; |
1946 | uint32_t intmask_org; | 1967 | uint32_t intmask_org; |
1947 | intmask_org = arcmsr_disable_outbound_ints(acb); | 1968 | intmask_org = arcmsr_disable_outbound_ints(acb); |
1948 | reg->postq_index = 0; | 1969 | reg->postq_index = 0; |
@@ -1994,7 +2015,7 @@ static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb) | |||
1994 | switch (acb->adapter_type) { | 2015 | switch (acb->adapter_type) { |
1995 | 2016 | ||
1996 | case ACB_ADAPTER_TYPE_A: { | 2017 | case ACB_ADAPTER_TYPE_A: { |
1997 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 2018 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
1998 | do { | 2019 | do { |
1999 | firmware_state = readl(®->outbound_msgaddr1); | 2020 | firmware_state = readl(®->outbound_msgaddr1); |
2000 | } while ((firmware_state & ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK) == 0); | 2021 | } while ((firmware_state & ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK) == 0); |
@@ -2002,7 +2023,7 @@ static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb) | |||
2002 | break; | 2023 | break; |
2003 | 2024 | ||
2004 | case ACB_ADAPTER_TYPE_B: { | 2025 | case ACB_ADAPTER_TYPE_B: { |
2005 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 2026 | struct MessageUnit_B *reg = acb->pmuB; |
2006 | do { | 2027 | do { |
2007 | firmware_state = readl(reg->iop2drv_doorbell_reg); | 2028 | firmware_state = readl(reg->iop2drv_doorbell_reg); |
2008 | } while ((firmware_state & ARCMSR_MESSAGE_FIRMWARE_OK) == 0); | 2029 | } while ((firmware_state & ARCMSR_MESSAGE_FIRMWARE_OK) == 0); |
@@ -2013,7 +2034,7 @@ static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb) | |||
2013 | 2034 | ||
2014 | static void arcmsr_start_hba_bgrb(struct AdapterControlBlock *acb) | 2035 | static void arcmsr_start_hba_bgrb(struct AdapterControlBlock *acb) |
2015 | { | 2036 | { |
2016 | struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; | 2037 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
2017 | acb->acb_flags |= ACB_F_MSG_START_BGRB; | 2038 | acb->acb_flags |= ACB_F_MSG_START_BGRB; |
2018 | writel(ARCMSR_INBOUND_MESG0_START_BGRB, ®->inbound_msgaddr0); | 2039 | writel(ARCMSR_INBOUND_MESG0_START_BGRB, ®->inbound_msgaddr0); |
2019 | if (arcmsr_hba_wait_msgint_ready(acb)) { | 2040 | if (arcmsr_hba_wait_msgint_ready(acb)) { |
@@ -2024,7 +2045,7 @@ static void arcmsr_start_hba_bgrb(struct AdapterControlBlock *acb) | |||
2024 | 2045 | ||
2025 | static void arcmsr_start_hbb_bgrb(struct AdapterControlBlock *acb) | 2046 | static void arcmsr_start_hbb_bgrb(struct AdapterControlBlock *acb) |
2026 | { | 2047 | { |
2027 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 2048 | struct MessageUnit_B *reg = acb->pmuB; |
2028 | acb->acb_flags |= ACB_F_MSG_START_BGRB; | 2049 | acb->acb_flags |= ACB_F_MSG_START_BGRB; |
2029 | writel(ARCMSR_MESSAGE_START_BGRB, reg->drv2iop_doorbell_reg); | 2050 | writel(ARCMSR_MESSAGE_START_BGRB, reg->drv2iop_doorbell_reg); |
2030 | if (arcmsr_hbb_wait_msgint_ready(acb)) { | 2051 | if (arcmsr_hbb_wait_msgint_ready(acb)) { |
@@ -2049,7 +2070,7 @@ static void arcmsr_clear_doorbell_queue_buffer(struct AdapterControlBlock *acb) | |||
2049 | { | 2070 | { |
2050 | switch (acb->adapter_type) { | 2071 | switch (acb->adapter_type) { |
2051 | case ACB_ADAPTER_TYPE_A: { | 2072 | case ACB_ADAPTER_TYPE_A: { |
2052 | struct MessageUnit_A *reg = (struct MessageUnit_A *)acb->pmu; | 2073 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
2053 | uint32_t outbound_doorbell; | 2074 | uint32_t outbound_doorbell; |
2054 | /* empty doorbell Qbuffer if door bell ringed */ | 2075 | /* empty doorbell Qbuffer if door bell ringed */ |
2055 | outbound_doorbell = readl(®->outbound_doorbell); | 2076 | outbound_doorbell = readl(®->outbound_doorbell); |
@@ -2060,7 +2081,7 @@ static void arcmsr_clear_doorbell_queue_buffer(struct AdapterControlBlock *acb) | |||
2060 | break; | 2081 | break; |
2061 | 2082 | ||
2062 | case ACB_ADAPTER_TYPE_B: { | 2083 | case ACB_ADAPTER_TYPE_B: { |
2063 | struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; | 2084 | struct MessageUnit_B *reg = acb->pmuB; |
2064 | /*clear interrupt and message state*/ | 2085 | /*clear interrupt and message state*/ |
2065 | writel(ARCMSR_MESSAGE_INT_CLEAR_PATTERN, reg->iop2drv_doorbell_reg); | 2086 | writel(ARCMSR_MESSAGE_INT_CLEAR_PATTERN, reg->iop2drv_doorbell_reg); |
2066 | writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg); | 2087 | writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg); |
diff --git a/drivers/scsi/arm/scsi.h b/drivers/scsi/arm/scsi.h index 21ba57155bea..bb6550e31926 100644 --- a/drivers/scsi/arm/scsi.h +++ b/drivers/scsi/arm/scsi.h | |||
@@ -38,9 +38,7 @@ static inline int next_SCp(struct scsi_pointer *SCp) | |||
38 | if (ret) { | 38 | if (ret) { |
39 | SCp->buffer++; | 39 | SCp->buffer++; |
40 | SCp->buffers_residual--; | 40 | SCp->buffers_residual--; |
41 | SCp->ptr = (char *) | 41 | SCp->ptr = sg_virt(SCp->buffer); |
42 | (page_address(SCp->buffer->page) + | ||
43 | SCp->buffer->offset); | ||
44 | SCp->this_residual = SCp->buffer->length; | 42 | SCp->this_residual = SCp->buffer->length; |
45 | } else { | 43 | } else { |
46 | SCp->ptr = NULL; | 44 | SCp->ptr = NULL; |
@@ -76,9 +74,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt) | |||
76 | 74 | ||
77 | SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; | 75 | SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; |
78 | SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; | 76 | SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; |
79 | SCpnt->SCp.ptr = (char *) | 77 | SCpnt->SCp.ptr = sg_virt(SCpnt->SCp.buffer); |
80 | (page_address(SCpnt->SCp.buffer->page) + | ||
81 | SCpnt->SCp.buffer->offset); | ||
82 | SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; | 78 | SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; |
83 | SCpnt->SCp.phase = SCpnt->request_bufflen; | 79 | SCpnt->SCp.phase = SCpnt->request_bufflen; |
84 | 80 | ||
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 22d91ee173c5..5f2396c03958 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -556,7 +556,7 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, | |||
556 | unsigned long timeout) | 556 | unsigned long timeout) |
557 | { | 557 | { |
558 | u64 *crq_as_u64 = (u64 *) &evt_struct->crq; | 558 | u64 *crq_as_u64 = (u64 *) &evt_struct->crq; |
559 | int request_status; | 559 | int request_status = 0; |
560 | int rc; | 560 | int rc; |
561 | 561 | ||
562 | /* If we have exhausted our request limit, just fail this request, | 562 | /* If we have exhausted our request limit, just fail this request, |
@@ -574,6 +574,13 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, | |||
574 | if (request_status < -1) | 574 | if (request_status < -1) |
575 | goto send_error; | 575 | goto send_error; |
576 | /* Otherwise, we may have run out of requests. */ | 576 | /* Otherwise, we may have run out of requests. */ |
577 | /* If request limit was 0 when we started the adapter is in the | ||
578 | * process of performing a login with the server adapter, or | ||
579 | * we may have run out of requests. | ||
580 | */ | ||
581 | else if (request_status == -1 && | ||
582 | evt_struct->iu.srp.login_req.opcode != SRP_LOGIN_REQ) | ||
583 | goto send_busy; | ||
577 | /* Abort and reset calls should make it through. | 584 | /* Abort and reset calls should make it through. |
578 | * Nothing except abort and reset should use the last two | 585 | * Nothing except abort and reset should use the last two |
579 | * slots unless we had two or less to begin with. | 586 | * slots unless we had two or less to begin with. |
@@ -633,7 +640,8 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, | |||
633 | unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); | 640 | unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); |
634 | 641 | ||
635 | free_event_struct(&hostdata->pool, evt_struct); | 642 | free_event_struct(&hostdata->pool, evt_struct); |
636 | atomic_inc(&hostdata->request_limit); | 643 | if (request_status != -1) |
644 | atomic_inc(&hostdata->request_limit); | ||
637 | return SCSI_MLQUEUE_HOST_BUSY; | 645 | return SCSI_MLQUEUE_HOST_BUSY; |
638 | 646 | ||
639 | send_error: | 647 | send_error: |
@@ -927,10 +935,11 @@ static int send_srp_login(struct ibmvscsi_host_data *hostdata) | |||
927 | login->req_buf_fmt = SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_INDIRECT; | 935 | login->req_buf_fmt = SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_INDIRECT; |
928 | 936 | ||
929 | spin_lock_irqsave(hostdata->host->host_lock, flags); | 937 | spin_lock_irqsave(hostdata->host->host_lock, flags); |
930 | /* Start out with a request limit of 1, since this is negotiated in | 938 | /* Start out with a request limit of 0, since this is negotiated in |
931 | * the login request we are just sending | 939 | * the login request we are just sending and login requests always |
940 | * get sent by the driver regardless of request_limit. | ||
932 | */ | 941 | */ |
933 | atomic_set(&hostdata->request_limit, 1); | 942 | atomic_set(&hostdata->request_limit, 0); |
934 | 943 | ||
935 | rc = ibmvscsi_send_srp_event(evt_struct, hostdata, init_timeout * 2); | 944 | rc = ibmvscsi_send_srp_event(evt_struct, hostdata, init_timeout * 2); |
936 | spin_unlock_irqrestore(hostdata->host->host_lock, flags); | 945 | spin_unlock_irqrestore(hostdata->host->host_lock, flags); |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index c0755565fae9..4e46045dea6d 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -682,6 +682,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
682 | IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb; | 682 | IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb; |
683 | struct lpfc_iocbq *piocbq = &(lpfc_cmd->cur_iocbq); | 683 | struct lpfc_iocbq *piocbq = &(lpfc_cmd->cur_iocbq); |
684 | int datadir = scsi_cmnd->sc_data_direction; | 684 | int datadir = scsi_cmnd->sc_data_direction; |
685 | char tag[2]; | ||
685 | 686 | ||
686 | lpfc_cmd->fcp_rsp->rspSnsLen = 0; | 687 | lpfc_cmd->fcp_rsp->rspSnsLen = 0; |
687 | /* clear task management bits */ | 688 | /* clear task management bits */ |
@@ -692,8 +693,8 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
692 | 693 | ||
693 | memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, 16); | 694 | memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, 16); |
694 | 695 | ||
695 | if (scsi_cmnd->device->tagged_supported) { | 696 | if (scsi_populate_tag_msg(scsi_cmnd, tag)) { |
696 | switch (scsi_cmnd->tag) { | 697 | switch (tag[0]) { |
697 | case HEAD_OF_QUEUE_TAG: | 698 | case HEAD_OF_QUEUE_TAG: |
698 | fcp_cmnd->fcpCntl1 = HEAD_OF_Q; | 699 | fcp_cmnd->fcpCntl1 = HEAD_OF_Q; |
699 | break; | 700 | break; |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 4652ad22516b..abef7048f25b 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -593,10 +593,11 @@ static int osst_verify_frame(struct osst_tape * STp, int frame_seq_number, int q | |||
593 | if (aux->frame_type != OS_FRAME_TYPE_DATA && | 593 | if (aux->frame_type != OS_FRAME_TYPE_DATA && |
594 | aux->frame_type != OS_FRAME_TYPE_EOD && | 594 | aux->frame_type != OS_FRAME_TYPE_EOD && |
595 | aux->frame_type != OS_FRAME_TYPE_MARKER) { | 595 | aux->frame_type != OS_FRAME_TYPE_MARKER) { |
596 | if (!quiet) | 596 | if (!quiet) { |
597 | #if DEBUG | 597 | #if DEBUG |
598 | printk(OSST_DEB_MSG "%s:D: Skipping frame, frame type %x\n", name, aux->frame_type); | 598 | printk(OSST_DEB_MSG "%s:D: Skipping frame, frame type %x\n", name, aux->frame_type); |
599 | #endif | 599 | #endif |
600 | } | ||
600 | goto err_out; | 601 | goto err_out; |
601 | } | 602 | } |
602 | if (aux->frame_type == OS_FRAME_TYPE_EOD && | 603 | if (aux->frame_type == OS_FRAME_TYPE_EOD && |
@@ -606,11 +607,12 @@ static int osst_verify_frame(struct osst_tape * STp, int frame_seq_number, int q | |||
606 | goto err_out; | 607 | goto err_out; |
607 | } | 608 | } |
608 | if (frame_seq_number != -1 && ntohl(aux->frame_seq_num) != frame_seq_number) { | 609 | if (frame_seq_number != -1 && ntohl(aux->frame_seq_num) != frame_seq_number) { |
609 | if (!quiet) | 610 | if (!quiet) { |
610 | #if DEBUG | 611 | #if DEBUG |
611 | printk(OSST_DEB_MSG "%s:D: Skipping frame, sequence number %u (expected %d)\n", | 612 | printk(OSST_DEB_MSG "%s:D: Skipping frame, sequence number %u (expected %d)\n", |
612 | name, ntohl(aux->frame_seq_num), frame_seq_number); | 613 | name, ntohl(aux->frame_seq_num), frame_seq_number); |
613 | #endif | 614 | #endif |
615 | } | ||
614 | goto err_out; | 616 | goto err_out; |
615 | } | 617 | } |
616 | if (aux->frame_type == OS_FRAME_TYPE_MARKER) { | 618 | if (aux->frame_type == OS_FRAME_TYPE_MARKER) { |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 61fdaf02f251..0e81e4cf8876 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -785,7 +785,7 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask) | |||
785 | * end-of-list | 785 | * end-of-list |
786 | */ | 786 | */ |
787 | if (!left) | 787 | if (!left) |
788 | sg_mark_end(sgl, this); | 788 | sg_mark_end(&sgl[this - 1]); |
789 | 789 | ||
790 | /* | 790 | /* |
791 | * don't allow subsequent mempool allocs to sleep, it would | 791 | * don't allow subsequent mempool allocs to sleep, it would |
@@ -2115,6 +2115,142 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state) | |||
2115 | EXPORT_SYMBOL(scsi_device_set_state); | 2115 | EXPORT_SYMBOL(scsi_device_set_state); |
2116 | 2116 | ||
2117 | /** | 2117 | /** |
2118 | * sdev_evt_emit - emit a single SCSI device uevent | ||
2119 | * @sdev: associated SCSI device | ||
2120 | * @evt: event to emit | ||
2121 | * | ||
2122 | * Send a single uevent (scsi_event) to the associated scsi_device. | ||
2123 | */ | ||
2124 | static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt) | ||
2125 | { | ||
2126 | int idx = 0; | ||
2127 | char *envp[3]; | ||
2128 | |||
2129 | switch (evt->evt_type) { | ||
2130 | case SDEV_EVT_MEDIA_CHANGE: | ||
2131 | envp[idx++] = "SDEV_MEDIA_CHANGE=1"; | ||
2132 | break; | ||
2133 | |||
2134 | default: | ||
2135 | /* do nothing */ | ||
2136 | break; | ||
2137 | } | ||
2138 | |||
2139 | envp[idx++] = NULL; | ||
2140 | |||
2141 | kobject_uevent_env(&sdev->sdev_gendev.kobj, KOBJ_CHANGE, envp); | ||
2142 | } | ||
2143 | |||
2144 | /** | ||
2145 | * sdev_evt_thread - send a uevent for each scsi event | ||
2146 | * @work: work struct for scsi_device | ||
2147 | * | ||
2148 | * Dispatch queued events to their associated scsi_device kobjects | ||
2149 | * as uevents. | ||
2150 | */ | ||
2151 | void scsi_evt_thread(struct work_struct *work) | ||
2152 | { | ||
2153 | struct scsi_device *sdev; | ||
2154 | LIST_HEAD(event_list); | ||
2155 | |||
2156 | sdev = container_of(work, struct scsi_device, event_work); | ||
2157 | |||
2158 | while (1) { | ||
2159 | struct scsi_event *evt; | ||
2160 | struct list_head *this, *tmp; | ||
2161 | unsigned long flags; | ||
2162 | |||
2163 | spin_lock_irqsave(&sdev->list_lock, flags); | ||
2164 | list_splice_init(&sdev->event_list, &event_list); | ||
2165 | spin_unlock_irqrestore(&sdev->list_lock, flags); | ||
2166 | |||
2167 | if (list_empty(&event_list)) | ||
2168 | break; | ||
2169 | |||
2170 | list_for_each_safe(this, tmp, &event_list) { | ||
2171 | evt = list_entry(this, struct scsi_event, node); | ||
2172 | list_del(&evt->node); | ||
2173 | scsi_evt_emit(sdev, evt); | ||
2174 | kfree(evt); | ||
2175 | } | ||
2176 | } | ||
2177 | } | ||
2178 | |||
2179 | /** | ||
2180 | * sdev_evt_send - send asserted event to uevent thread | ||
2181 | * @sdev: scsi_device event occurred on | ||
2182 | * @evt: event to send | ||
2183 | * | ||
2184 | * Assert scsi device event asynchronously. | ||
2185 | */ | ||
2186 | void sdev_evt_send(struct scsi_device *sdev, struct scsi_event *evt) | ||
2187 | { | ||
2188 | unsigned long flags; | ||
2189 | |||
2190 | if (!test_bit(evt->evt_type, sdev->supported_events)) { | ||
2191 | kfree(evt); | ||
2192 | return; | ||
2193 | } | ||
2194 | |||
2195 | spin_lock_irqsave(&sdev->list_lock, flags); | ||
2196 | list_add_tail(&evt->node, &sdev->event_list); | ||
2197 | schedule_work(&sdev->event_work); | ||
2198 | spin_unlock_irqrestore(&sdev->list_lock, flags); | ||
2199 | } | ||
2200 | EXPORT_SYMBOL_GPL(sdev_evt_send); | ||
2201 | |||
2202 | /** | ||
2203 | * sdev_evt_alloc - allocate a new scsi event | ||
2204 | * @evt_type: type of event to allocate | ||
2205 | * @gfpflags: GFP flags for allocation | ||
2206 | * | ||
2207 | * Allocates and returns a new scsi_event. | ||
2208 | */ | ||
2209 | struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, | ||
2210 | gfp_t gfpflags) | ||
2211 | { | ||
2212 | struct scsi_event *evt = kzalloc(sizeof(struct scsi_event), gfpflags); | ||
2213 | if (!evt) | ||
2214 | return NULL; | ||
2215 | |||
2216 | evt->evt_type = evt_type; | ||
2217 | INIT_LIST_HEAD(&evt->node); | ||
2218 | |||
2219 | /* evt_type-specific initialization, if any */ | ||
2220 | switch (evt_type) { | ||
2221 | case SDEV_EVT_MEDIA_CHANGE: | ||
2222 | default: | ||
2223 | /* do nothing */ | ||
2224 | break; | ||
2225 | } | ||
2226 | |||
2227 | return evt; | ||
2228 | } | ||
2229 | EXPORT_SYMBOL_GPL(sdev_evt_alloc); | ||
2230 | |||
2231 | /** | ||
2232 | * sdev_evt_send_simple - send asserted event to uevent thread | ||
2233 | * @sdev: scsi_device event occurred on | ||
2234 | * @evt_type: type of event to send | ||
2235 | * @gfpflags: GFP flags for allocation | ||
2236 | * | ||
2237 | * Assert scsi device event asynchronously, given an event type. | ||
2238 | */ | ||
2239 | void sdev_evt_send_simple(struct scsi_device *sdev, | ||
2240 | enum scsi_device_event evt_type, gfp_t gfpflags) | ||
2241 | { | ||
2242 | struct scsi_event *evt = sdev_evt_alloc(evt_type, gfpflags); | ||
2243 | if (!evt) { | ||
2244 | sdev_printk(KERN_ERR, sdev, "event %d eaten due to OOM\n", | ||
2245 | evt_type); | ||
2246 | return; | ||
2247 | } | ||
2248 | |||
2249 | sdev_evt_send(sdev, evt); | ||
2250 | } | ||
2251 | EXPORT_SYMBOL_GPL(sdev_evt_send_simple); | ||
2252 | |||
2253 | /** | ||
2118 | * scsi_device_quiesce - Block user issued commands. | 2254 | * scsi_device_quiesce - Block user issued commands. |
2119 | * @sdev: scsi device to quiesce. | 2255 | * @sdev: scsi device to quiesce. |
2120 | * | 2256 | * |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index b53c5f67e372..40ea71cd2ca6 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -236,6 +236,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, | |||
236 | struct scsi_device *sdev; | 236 | struct scsi_device *sdev; |
237 | int display_failure_msg = 1, ret; | 237 | int display_failure_msg = 1, ret; |
238 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 238 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
239 | extern void scsi_evt_thread(struct work_struct *work); | ||
239 | 240 | ||
240 | sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size, | 241 | sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size, |
241 | GFP_ATOMIC); | 242 | GFP_ATOMIC); |
@@ -254,7 +255,9 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, | |||
254 | INIT_LIST_HEAD(&sdev->same_target_siblings); | 255 | INIT_LIST_HEAD(&sdev->same_target_siblings); |
255 | INIT_LIST_HEAD(&sdev->cmd_list); | 256 | INIT_LIST_HEAD(&sdev->cmd_list); |
256 | INIT_LIST_HEAD(&sdev->starved_entry); | 257 | INIT_LIST_HEAD(&sdev->starved_entry); |
258 | INIT_LIST_HEAD(&sdev->event_list); | ||
257 | spin_lock_init(&sdev->list_lock); | 259 | spin_lock_init(&sdev->list_lock); |
260 | INIT_WORK(&sdev->event_work, scsi_evt_thread); | ||
258 | 261 | ||
259 | sdev->sdev_gendev.parent = get_device(&starget->dev); | 262 | sdev->sdev_gendev.parent = get_device(&starget->dev); |
260 | sdev->sdev_target = starget; | 263 | sdev->sdev_target = starget; |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index d531ceeb0d8c..f374fdcb6815 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -268,6 +268,7 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) | |||
268 | struct scsi_device *sdev; | 268 | struct scsi_device *sdev; |
269 | struct device *parent; | 269 | struct device *parent; |
270 | struct scsi_target *starget; | 270 | struct scsi_target *starget; |
271 | struct list_head *this, *tmp; | ||
271 | unsigned long flags; | 272 | unsigned long flags; |
272 | 273 | ||
273 | sdev = container_of(work, struct scsi_device, ew.work); | 274 | sdev = container_of(work, struct scsi_device, ew.work); |
@@ -282,6 +283,16 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) | |||
282 | list_del(&sdev->starved_entry); | 283 | list_del(&sdev->starved_entry); |
283 | spin_unlock_irqrestore(sdev->host->host_lock, flags); | 284 | spin_unlock_irqrestore(sdev->host->host_lock, flags); |
284 | 285 | ||
286 | cancel_work_sync(&sdev->event_work); | ||
287 | |||
288 | list_for_each_safe(this, tmp, &sdev->event_list) { | ||
289 | struct scsi_event *evt; | ||
290 | |||
291 | evt = list_entry(this, struct scsi_event, node); | ||
292 | list_del(&evt->node); | ||
293 | kfree(evt); | ||
294 | } | ||
295 | |||
285 | if (sdev->request_queue) { | 296 | if (sdev->request_queue) { |
286 | sdev->request_queue->queuedata = NULL; | 297 | sdev->request_queue->queuedata = NULL; |
287 | /* user context needed to free queue */ | 298 | /* user context needed to free queue */ |
@@ -614,6 +625,41 @@ sdev_show_modalias(struct device *dev, struct device_attribute *attr, char *buf) | |||
614 | } | 625 | } |
615 | static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL); | 626 | static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL); |
616 | 627 | ||
628 | #define DECLARE_EVT_SHOW(name, Cap_name) \ | ||
629 | static ssize_t \ | ||
630 | sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \ | ||
631 | char *buf) \ | ||
632 | { \ | ||
633 | struct scsi_device *sdev = to_scsi_device(dev); \ | ||
634 | int val = test_bit(SDEV_EVT_##Cap_name, sdev->supported_events);\ | ||
635 | return snprintf(buf, 20, "%d\n", val); \ | ||
636 | } | ||
637 | |||
638 | #define DECLARE_EVT_STORE(name, Cap_name) \ | ||
639 | static ssize_t \ | ||
640 | sdev_store_evt_##name(struct device *dev, struct device_attribute *attr, \ | ||
641 | const char *buf, size_t count) \ | ||
642 | { \ | ||
643 | struct scsi_device *sdev = to_scsi_device(dev); \ | ||
644 | int val = simple_strtoul(buf, NULL, 0); \ | ||
645 | if (val == 0) \ | ||
646 | clear_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \ | ||
647 | else if (val == 1) \ | ||
648 | set_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \ | ||
649 | else \ | ||
650 | return -EINVAL; \ | ||
651 | return count; \ | ||
652 | } | ||
653 | |||
654 | #define DECLARE_EVT(name, Cap_name) \ | ||
655 | DECLARE_EVT_SHOW(name, Cap_name) \ | ||
656 | DECLARE_EVT_STORE(name, Cap_name) \ | ||
657 | static DEVICE_ATTR(evt_##name, S_IRUGO, sdev_show_evt_##name, \ | ||
658 | sdev_store_evt_##name); | ||
659 | #define REF_EVT(name) &dev_attr_evt_##name.attr | ||
660 | |||
661 | DECLARE_EVT(media_change, MEDIA_CHANGE) | ||
662 | |||
617 | /* Default template for device attributes. May NOT be modified */ | 663 | /* Default template for device attributes. May NOT be modified */ |
618 | static struct attribute *scsi_sdev_attrs[] = { | 664 | static struct attribute *scsi_sdev_attrs[] = { |
619 | &dev_attr_device_blocked.attr, | 665 | &dev_attr_device_blocked.attr, |
@@ -631,6 +677,7 @@ static struct attribute *scsi_sdev_attrs[] = { | |||
631 | &dev_attr_iodone_cnt.attr, | 677 | &dev_attr_iodone_cnt.attr, |
632 | &dev_attr_ioerr_cnt.attr, | 678 | &dev_attr_ioerr_cnt.attr, |
633 | &dev_attr_modalias.attr, | 679 | &dev_attr_modalias.attr, |
680 | REF_EVT(media_change), | ||
634 | NULL | 681 | NULL |
635 | }; | 682 | }; |
636 | 683 | ||
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index b5fa4f091387..f1871ea04045 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize) | |||
1652 | schp->buffer = kzalloc(sg_bufflen, gfp_flags); | 1652 | schp->buffer = kzalloc(sg_bufflen, gfp_flags); |
1653 | if (!schp->buffer) | 1653 | if (!schp->buffer) |
1654 | return -ENOMEM; | 1654 | return -ENOMEM; |
1655 | sg_init_table(schp->buffer, tablesize); | ||
1655 | schp->sglist_len = sg_bufflen; | 1656 | schp->sglist_len = sg_bufflen; |
1656 | return tablesize; /* number of scat_gath elements allocated */ | 1657 | return tablesize; /* number of scat_gath elements allocated */ |
1657 | } | 1658 | } |
diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c index 4d4c9f01be8d..1f16de719962 100644 --- a/drivers/serial/8250_early.c +++ b/drivers/serial/8250_early.c | |||
@@ -76,7 +76,7 @@ static void __init wait_for_xmitr(struct uart_port *port) | |||
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | static void __init putc(struct uart_port *port, int c) | 79 | static void __init serial_putc(struct uart_port *port, int c) |
80 | { | 80 | { |
81 | wait_for_xmitr(port); | 81 | wait_for_xmitr(port); |
82 | serial_out(port, UART_TX, c); | 82 | serial_out(port, UART_TX, c); |
@@ -91,7 +91,7 @@ static void __init early_serial8250_write(struct console *console, const char *s | |||
91 | ier = serial_in(port, UART_IER); | 91 | ier = serial_in(port, UART_IER); |
92 | serial_out(port, UART_IER, 0); | 92 | serial_out(port, UART_IER, 0); |
93 | 93 | ||
94 | uart_console_write(port, s, count, putc); | 94 | uart_console_write(port, s, count, serial_putc); |
95 | 95 | ||
96 | /* Wait for transmitter to become empty and restore the IER */ | 96 | /* Wait for transmitter to become empty and restore the IER */ |
97 | wait_for_xmitr(port); | 97 | wait_for_xmitr(port); |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 0e357562ce9e..ceb03c9e749f 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -1986,6 +1986,7 @@ static int pciserial_suspend_one(struct pci_dev *dev, pm_message_t state) | |||
1986 | 1986 | ||
1987 | static int pciserial_resume_one(struct pci_dev *dev) | 1987 | static int pciserial_resume_one(struct pci_dev *dev) |
1988 | { | 1988 | { |
1989 | int err; | ||
1989 | struct serial_private *priv = pci_get_drvdata(dev); | 1990 | struct serial_private *priv = pci_get_drvdata(dev); |
1990 | 1991 | ||
1991 | pci_set_power_state(dev, PCI_D0); | 1992 | pci_set_power_state(dev, PCI_D0); |
@@ -1995,7 +1996,9 @@ static int pciserial_resume_one(struct pci_dev *dev) | |||
1995 | /* | 1996 | /* |
1996 | * The device may have been disabled. Re-enable it. | 1997 | * The device may have been disabled. Re-enable it. |
1997 | */ | 1998 | */ |
1998 | pci_enable_device(dev); | 1999 | err = pci_enable_device(dev); |
2000 | if (err) | ||
2001 | return err; | ||
1999 | 2002 | ||
2000 | pciserial_resume_ports(priv); | 2003 | pciserial_resume_ports(priv); |
2001 | } | 2004 | } |
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index 926f58a674a1..1de098e75497 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
@@ -69,6 +69,8 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
69 | { "CTL3001", 0 }, | 69 | { "CTL3001", 0 }, |
70 | /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */ | 70 | /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */ |
71 | { "CTL3011", 0 }, | 71 | { "CTL3011", 0 }, |
72 | /* Davicom ISA 33.6K Modem */ | ||
73 | { "DAV0336", 0 }, | ||
72 | /* Creative */ | 74 | /* Creative */ |
73 | /* Creative Modem Blaster Flash56 DI5601-1 */ | 75 | /* Creative Modem Blaster Flash56 DI5601-1 */ |
74 | { "DMB1032", 0 }, | 76 | { "DMB1032", 0 }, |
@@ -345,6 +347,11 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
345 | /* Fujitsu Wacom Tablet PC devices */ | 347 | /* Fujitsu Wacom Tablet PC devices */ |
346 | { "FUJ02E5", 0 }, | 348 | { "FUJ02E5", 0 }, |
347 | { "FUJ02E6", 0 }, | 349 | { "FUJ02E6", 0 }, |
350 | /* | ||
351 | * LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in | ||
352 | * disguise) | ||
353 | */ | ||
354 | { "LTS0001", 0 }, | ||
348 | /* Rockwell's (PORALiNK) 33600 INT PNP */ | 355 | /* Rockwell's (PORALiNK) 33600 INT PNP */ |
349 | { "WCI0003", 0 }, | 356 | { "WCI0003", 0 }, |
350 | /* Unkown PnP modems */ | 357 | /* Unkown PnP modems */ |
@@ -432,7 +439,8 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) | |||
432 | } | 439 | } |
433 | 440 | ||
434 | memset(&port, 0, sizeof(struct uart_port)); | 441 | memset(&port, 0, sizeof(struct uart_port)); |
435 | port.irq = pnp_irq(dev, 0); | 442 | if (pnp_irq_valid(dev, 0)) |
443 | port.irq = pnp_irq(dev, 0); | ||
436 | if (pnp_port_valid(dev, 0)) { | 444 | if (pnp_port_valid(dev, 0)) { |
437 | port.iobase = pnp_port_start(dev, 0); | 445 | port.iobase = pnp_port_start(dev, 0); |
438 | port.iotype = UPIO_PORT; | 446 | port.iotype = UPIO_PORT; |
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/atmel_serial.c b/drivers/serial/atmel_serial.c index 4d6b3c56d20e..111da57f5334 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -204,8 +204,6 @@ static u_int atmel_get_mctrl(struct uart_port *port) | |||
204 | */ | 204 | */ |
205 | static void atmel_stop_tx(struct uart_port *port) | 205 | static void atmel_stop_tx(struct uart_port *port) |
206 | { | 206 | { |
207 | struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; | ||
208 | |||
209 | UART_PUT_IDR(port, ATMEL_US_TXRDY); | 207 | UART_PUT_IDR(port, ATMEL_US_TXRDY); |
210 | } | 208 | } |
211 | 209 | ||
@@ -214,8 +212,6 @@ static void atmel_stop_tx(struct uart_port *port) | |||
214 | */ | 212 | */ |
215 | static void atmel_start_tx(struct uart_port *port) | 213 | static void atmel_start_tx(struct uart_port *port) |
216 | { | 214 | { |
217 | struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; | ||
218 | |||
219 | UART_PUT_IER(port, ATMEL_US_TXRDY); | 215 | UART_PUT_IER(port, ATMEL_US_TXRDY); |
220 | } | 216 | } |
221 | 217 | ||
@@ -224,8 +220,6 @@ static void atmel_start_tx(struct uart_port *port) | |||
224 | */ | 220 | */ |
225 | static void atmel_stop_rx(struct uart_port *port) | 221 | static void atmel_stop_rx(struct uart_port *port) |
226 | { | 222 | { |
227 | struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; | ||
228 | |||
229 | UART_PUT_IDR(port, ATMEL_US_RXRDY); | 223 | UART_PUT_IDR(port, ATMEL_US_RXRDY); |
230 | } | 224 | } |
231 | 225 | ||
@@ -409,7 +403,6 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id) | |||
409 | */ | 403 | */ |
410 | static int atmel_startup(struct uart_port *port) | 404 | static int atmel_startup(struct uart_port *port) |
411 | { | 405 | { |
412 | struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; | ||
413 | int retval; | 406 | int retval; |
414 | 407 | ||
415 | /* | 408 | /* |
@@ -456,8 +449,6 @@ static int atmel_startup(struct uart_port *port) | |||
456 | */ | 449 | */ |
457 | static void atmel_shutdown(struct uart_port *port) | 450 | static void atmel_shutdown(struct uart_port *port) |
458 | { | 451 | { |
459 | struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port; | ||
460 | |||
461 | /* | 452 | /* |
462 | * Disable all interrupts, port and break condition. | 453 | * Disable all interrupts, port and break condition. |
463 | */ | 454 | */ |
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index f523cdf4b02b..a4e23cf47906 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -1,426 +1,10 @@ | |||
1 | /* $Id: serial.c,v 1.25 2004/09/29 10:33:49 starvik Exp $ | 1 | /* |
2 | * | ||
3 | * Serial port driver for the ETRAX 100LX chip | 2 | * Serial port driver for the ETRAX 100LX chip |
4 | * | 3 | * |
5 | * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Axis Communications AB | 4 | * Copyright (C) 1998-2007 Axis Communications AB |
6 | * | 5 | * |
7 | * Many, many authors. Based once upon a time on serial.c for 16x50. | 6 | * Many, many authors. Based once upon a time on serial.c for 16x50. |
8 | * | 7 | * |
9 | * $Log: serial.c,v $ | ||
10 | * Revision 1.25 2004/09/29 10:33:49 starvik | ||
11 | * Resolved a dealock when printing debug from kernel. | ||
12 | * | ||
13 | * Revision 1.24 2004/08/27 23:25:59 johana | ||
14 | * rs_set_termios() must call change_speed() if c_iflag has changed or | ||
15 | * automatic XOFF handling will be enabled and transmitter will stop | ||
16 | * if 0x13 is received. | ||
17 | * | ||
18 | * Revision 1.23 2004/08/24 06:57:13 starvik | ||
19 | * More whitespace cleanup | ||
20 | * | ||
21 | * Revision 1.22 2004/08/24 06:12:20 starvik | ||
22 | * Whitespace cleanup | ||
23 | * | ||
24 | * Revision 1.20 2004/05/24 12:00:20 starvik | ||
25 | * Big merge of stuff from Linux 2.4 (e.g. manual mode for the serial port). | ||
26 | * | ||
27 | * Revision 1.19 2004/05/17 13:12:15 starvik | ||
28 | * Kernel console hook | ||
29 | * Big merge from Linux 2.4 still pending. | ||
30 | * | ||
31 | * Revision 1.18 2003/10/28 07:18:30 starvik | ||
32 | * Compiles with debug info | ||
33 | * | ||
34 | * Revision 1.17 2003/07/04 08:27:37 starvik | ||
35 | * Merge of Linux 2.5.74 | ||
36 | * | ||
37 | * Revision 1.16 2003/06/13 10:05:19 johana | ||
38 | * Help the user to avoid trouble by: | ||
39 | * Forcing mixed mode for status/control lines if not all pins are used. | ||
40 | * | ||
41 | * Revision 1.15 2003/06/13 09:43:01 johana | ||
42 | * Merged in the following changes from os/linux/arch/cris/drivers/serial.c | ||
43 | * + some minor changes to reduce diff. | ||
44 | * | ||
45 | * Revision 1.49 2003/05/30 11:31:54 johana | ||
46 | * Merged in change-branch--serial9bit that adds CMSPAR support for sticky | ||
47 | * parity (mark/space) | ||
48 | * | ||
49 | * Revision 1.48 2003/05/30 11:03:57 johana | ||
50 | * Implemented rs_send_xchar() by disabling the DMA and writing manually. | ||
51 | * Added e100_disable_txdma_channel() and e100_enable_txdma_channel(). | ||
52 | * Fixed rs_throttle() and rs_unthrottle() to properly call rs_send_xchar | ||
53 | * instead of setting info->x_char and check the CRTSCTS flag before | ||
54 | * controlling the rts pin. | ||
55 | * | ||
56 | * Revision 1.14 2003/04/09 08:12:44 pkj | ||
57 | * Corrected typo changes made upstream. | ||
58 | * | ||
59 | * Revision 1.13 2003/04/09 05:20:47 starvik | ||
60 | * Merge of Linux 2.5.67 | ||
61 | * | ||
62 | * Revision 1.11 2003/01/22 06:48:37 starvik | ||
63 | * Fixed warnings issued by GCC 3.2.1 | ||
64 | * | ||
65 | * Revision 1.9 2002/12/13 09:07:47 starvik | ||
66 | * Alert user that RX_TIMEOUT_TICKS==0 doesn't work | ||
67 | * | ||
68 | * Revision 1.8 2002/12/11 13:13:57 starvik | ||
69 | * Added arch/ to v10 specific includes | ||
70 | * Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer) | ||
71 | * | ||
72 | * Revision 1.7 2002/12/06 07:13:57 starvik | ||
73 | * Corrected work queue stuff | ||
74 | * Removed CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST | ||
75 | * | ||
76 | * Revision 1.6 2002/11/21 07:17:46 starvik | ||
77 | * Change static inline to extern inline where otherwise outlined with gcc-3.2 | ||
78 | * | ||
79 | * Revision 1.5 2002/11/14 15:59:49 starvik | ||
80 | * Linux 2.5 port of the latest serial driver from 2.4. The work queue stuff | ||
81 | * probably doesn't work yet. | ||
82 | * | ||
83 | * Revision 1.42 2002/11/05 09:08:47 johana | ||
84 | * Better implementation of rs_stop() and rs_start() that uses the XOFF | ||
85 | * register to start/stop transmission. | ||
86 | * change_speed() also initilises XOFF register correctly so that | ||
87 | * auto_xoff is enabled when IXON flag is set by user. | ||
88 | * This gives fast XOFF response times. | ||
89 | * | ||
90 | * Revision 1.41 2002/11/04 18:40:57 johana | ||
91 | * Implemented rs_stop() and rs_start(). | ||
92 | * Simple tests using hwtestserial indicates that this should be enough | ||
93 | * to make it work. | ||
94 | * | ||
95 | * Revision 1.40 2002/10/14 05:33:18 starvik | ||
96 | * RS-485 uses fast timers even if SERIAL_FAST_TIMER is disabled | ||
97 | * | ||
98 | * Revision 1.39 2002/09/30 21:00:57 johana | ||
99 | * Support for CONFIG_ETRAX_SERx_DTR_RI_DSR_CD_MIXED where the status and | ||
100 | * control pins can be mixed between PA and PB. | ||
101 | * If no serial port uses MIXED old solution is used | ||
102 | * (saves a few bytes and cycles). | ||
103 | * control_pins struct uses masks instead of bit numbers. | ||
104 | * Corrected dummy values and polarity in line_info() so | ||
105 | * /proc/tty/driver/serial is now correct. | ||
106 | * (the E100_xxx_GET() macros is really active low - perhaps not obvious) | ||
107 | * | ||
108 | * Revision 1.38 2002/08/23 11:01:36 starvik | ||
109 | * Check that serial port is enabled in all interrupt handlers to avoid | ||
110 | * restarts of DMA channels not assigned to serial ports | ||
111 | * | ||
112 | * Revision 1.37 2002/08/13 13:02:37 bjornw | ||
113 | * Removed some warnings because of unused code | ||
114 | * | ||
115 | * Revision 1.36 2002/08/08 12:50:01 starvik | ||
116 | * Serial interrupt is shared with synchronous serial port driver | ||
117 | * | ||
118 | * Revision 1.35 2002/06/03 10:40:49 starvik | ||
119 | * Increased RS-485 RTS toggle timer to 2 characters | ||
120 | * | ||
121 | * Revision 1.34 2002/05/28 18:59:36 johana | ||
122 | * Whitespace and comment fixing to be more like etrax100ser.c 1.71. | ||
123 | * | ||
124 | * Revision 1.33 2002/05/28 17:55:43 johana | ||
125 | * RS-485 uses FAST_TIMER if enabled, and starts a short (one char time) | ||
126 | * timer from tranismit_chars (interrupt context). | ||
127 | * The timer toggles RTS in interrupt context when expired giving minimum | ||
128 | * latencies. | ||
129 | * | ||
130 | * Revision 1.32 2002/05/22 13:58:00 johana | ||
131 | * Renamed rs_write() to raw_write() and made it inline. | ||
132 | * New rs_write() handles RS-485 if configured and enabled | ||
133 | * (moved code from e100_write_rs485()). | ||
134 | * RS-485 ioctl's uses copy_from_user() instead of verify_area(). | ||
135 | * | ||
136 | * Revision 1.31 2002/04/22 11:20:03 johana | ||
137 | * Updated copyright years. | ||
138 | * | ||
139 | * Revision 1.30 2002/04/22 09:39:12 johana | ||
140 | * RS-485 support compiles. | ||
141 | * | ||
142 | * Revision 1.29 2002/01/14 16:10:01 pkj | ||
143 | * Allocate the receive buffers dynamically. The static 4kB buffer was | ||
144 | * too small for the peaks. This means that we can get rid of the extra | ||
145 | * buffer and the copying to it. It also means we require less memory | ||
146 | * under normal operations, but can use more when needed (there is a | ||
147 | * cap at 64kB for safety reasons). If there is no memory available | ||
148 | * we panic(), and die a horrible death... | ||
149 | * | ||
150 | * Revision 1.28 2001/12/18 15:04:53 johana | ||
151 | * Cleaned up write_rs485() - now it works correctly without padding extra | ||
152 | * char. | ||
153 | * Added sane default initialisation of rs485. | ||
154 | * Added #ifdef around dummy variables. | ||
155 | * | ||
156 | * Revision 1.27 2001/11/29 17:00:41 pkj | ||
157 | * 2kB seems to be too small a buffer when using 921600 bps, | ||
158 | * so increase it to 4kB (this was already done for the elinux | ||
159 | * version of the serial driver). | ||
160 | * | ||
161 | * Revision 1.26 2001/11/19 14:20:41 pkj | ||
162 | * Minor changes to comments and unused code. | ||
163 | * | ||
164 | * Revision 1.25 2001/11/12 20:03:43 pkj | ||
165 | * Fixed compiler warnings. | ||
166 | * | ||
167 | * Revision 1.24 2001/11/12 15:10:05 pkj | ||
168 | * Total redesign of the receiving part of the serial driver. | ||
169 | * Uses eight chained descriptors to write to a 4kB buffer. | ||
170 | * This data is then serialised into a 2kB buffer. From there it | ||
171 | * is copied into the TTY's flip buffers when they become available. | ||
172 | * A lot of copying, and the sizes of the buffers might need to be | ||
173 | * tweaked, but all in all it should work better than the previous | ||
174 | * version, without the need to modify the TTY code in any way. | ||
175 | * Also note that erroneous bytes are now correctly marked in the | ||
176 | * flag buffers (instead of always marking the first byte). | ||
177 | * | ||
178 | * Revision 1.23 2001/10/30 17:53:26 pkj | ||
179 | * * Set info->uses_dma to 0 when a port is closed. | ||
180 | * * Mark the timer1 interrupt as a fast one (SA_INTERRUPT). | ||
181 | * * Call start_flush_timer() in start_receive() if | ||
182 | * CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST is defined. | ||
183 | * | ||
184 | * Revision 1.22 2001/10/30 17:44:03 pkj | ||
185 | * Use %lu for received and transmitted counters in line_info(). | ||
186 | * | ||
187 | * Revision 1.21 2001/10/30 17:40:34 pkj | ||
188 | * Clean-up. The only change to functionality is that | ||
189 | * CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS(=5) is used instead of | ||
190 | * MAX_FLUSH_TIME(=8). | ||
191 | * | ||
192 | * Revision 1.20 2001/10/30 15:24:49 johana | ||
193 | * Added char_time stuff from 2.0 driver. | ||
194 | * | ||
195 | * Revision 1.19 2001/10/30 15:23:03 johana | ||
196 | * Merged with 1.13.2 branch + fixed indentation | ||
197 | * and changed CONFIG_ETRAX100_XYS to CONFIG_ETRAX_XYZ | ||
198 | * | ||
199 | * Revision 1.18 2001/09/24 09:27:22 pkj | ||
200 | * Completed ext_baud_table[] in cflag_to_baud() and cflag_to_etrax_baud(). | ||
201 | * | ||
202 | * Revision 1.17 2001/08/24 11:32:49 ronny | ||
203 | * More fixes for the CONFIG_ETRAX_SERIAL_PORT0 define. | ||
204 | * | ||
205 | * Revision 1.16 2001/08/24 07:56:22 ronny | ||
206 | * Added config ifdefs around ser0 irq requests. | ||
207 | * | ||
208 | * Revision 1.15 2001/08/16 09:10:31 bjarne | ||
209 | * serial.c - corrected the initialization of rs_table, the wrong defines | ||
210 | * where used. | ||
211 | * Corrected a test in timed_flush_handler. | ||
212 | * Changed configured to enabled. | ||
213 | * serial.h - Changed configured to enabled. | ||
214 | * | ||
215 | * Revision 1.14 2001/08/15 07:31:23 bjarne | ||
216 | * Introduced two new members to the e100_serial struct. | ||
217 | * configured - Will be set to 1 if the port has been configured in .config | ||
218 | * uses_dma - Should be set to 1 if the port uses DMA. Currently it is set | ||
219 | * to 1 | ||
220 | * when a port is opened. This is used to limit the DMA interrupt | ||
221 | * routines to only manipulate DMA channels actually used by the | ||
222 | * serial driver. | ||
223 | * | ||
224 | * Revision 1.13.2.2 2001/10/17 13:57:13 starvik | ||
225 | * Receiver was broken by the break fixes | ||
226 | * | ||
227 | * Revision 1.13.2.1 2001/07/20 13:57:39 ronny | ||
228 | * Merge with new stuff from etrax100ser.c. Works but haven't checked stuff | ||
229 | * like break handling. | ||
230 | * | ||
231 | * Revision 1.13 2001/05/09 12:40:31 johana | ||
232 | * Use DMA_NBR and IRQ_NBR defines from dma.h and irq.h | ||
233 | * | ||
234 | * Revision 1.12 2001/04/19 12:23:07 bjornw | ||
235 | * CONFIG_RS485 -> CONFIG_ETRAX_RS485 | ||
236 | * | ||
237 | * Revision 1.11 2001/04/05 14:29:48 markusl | ||
238 | * Updated according to review remarks i.e. | ||
239 | * -Use correct types in port structure to avoid compiler warnings | ||
240 | * -Try to use IO_* macros whenever possible | ||
241 | * -Open should never return -EBUSY | ||
242 | * | ||
243 | * Revision 1.10 2001/03/05 13:14:07 bjornw | ||
244 | * Another spelling fix | ||
245 | * | ||
246 | * Revision 1.9 2001/02/23 13:46:38 bjornw | ||
247 | * Spellling check | ||
248 | * | ||
249 | * Revision 1.8 2001/01/23 14:56:35 markusl | ||
250 | * Made use of ser1 optional | ||
251 | * Needed by USB | ||
252 | * | ||
253 | * Revision 1.7 2001/01/19 16:14:48 perf | ||
254 | * Added kernel options for serial ports 234. | ||
255 | * Changed option names from CONFIG_ETRAX100_XYZ to CONFIG_ETRAX_XYZ. | ||
256 | * | ||
257 | * Revision 1.6 2000/11/22 16:36:09 bjornw | ||
258 | * Please marketing by using the correct case when spelling Etrax. | ||
259 | * | ||
260 | * Revision 1.5 2000/11/21 16:43:37 bjornw | ||
261 | * Fixed so it compiles under CONFIG_SVINTO_SIM | ||
262 | * | ||
263 | * Revision 1.4 2000/11/15 17:34:12 bjornw | ||
264 | * Added a timeout timer for flushing input channels. The interrupt-based | ||
265 | * fast flush system should be easy to merge with this later (works the same | ||
266 | * way, only with an irq instead of a system timer_list) | ||
267 | * | ||
268 | * Revision 1.3 2000/11/13 17:19:57 bjornw | ||
269 | * * Incredibly, this almost complete rewrite of serial.c worked (at least | ||
270 | * for output) the first time. | ||
271 | * | ||
272 | * Items worth noticing: | ||
273 | * | ||
274 | * No Etrax100 port 1 workarounds (does only compile on 2.4 anyway now) | ||
275 | * RS485 is not ported (why can't it be done in userspace as on x86 ?) | ||
276 | * Statistics done through async_icount - if any more stats are needed, | ||
277 | * that's the place to put them or in an arch-dep version of it. | ||
278 | * timeout_interrupt and the other fast timeout stuff not ported yet | ||
279 | * There be dragons in this 3k+ line driver | ||
280 | * | ||
281 | * Revision 1.2 2000/11/10 16:50:28 bjornw | ||
282 | * First shot at a 2.4 port, does not compile totally yet | ||
283 | * | ||
284 | * Revision 1.1 2000/11/10 16:47:32 bjornw | ||
285 | * Added verbatim copy of rev 1.49 etrax100ser.c from elinux | ||
286 | * | ||
287 | * Revision 1.49 2000/10/30 15:47:14 tobiasa | ||
288 | * Changed version number. | ||
289 | * | ||
290 | * Revision 1.48 2000/10/25 11:02:43 johana | ||
291 | * Changed %ul to %lu in printf's | ||
292 | * | ||
293 | * Revision 1.47 2000/10/18 15:06:53 pkj | ||
294 | * Compile correctly with CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST and | ||
295 | * CONFIG_ETRAX_SERIAL_PROC_ENTRY together. | ||
296 | * Some clean-up of the /proc/serial file. | ||
297 | * | ||
298 | * Revision 1.46 2000/10/16 12:59:40 johana | ||
299 | * Added CONFIG_ETRAX_SERIAL_PROC_ENTRY for statistics and debug info. | ||
300 | * | ||
301 | * Revision 1.45 2000/10/13 17:10:59 pkj | ||
302 | * Do not flush DMAs while flipping TTY buffers. | ||
303 | * | ||
304 | * Revision 1.44 2000/10/13 16:34:29 pkj | ||
305 | * Added a delay in ser_interrupt() for 2.3ms when an error is detected. | ||
306 | * We do not know why this delay is required yet, but without it the | ||
307 | * irmaflash program does not work (this was the program that needed | ||
308 | * the ser_interrupt() to be needed in the first place). This should not | ||
309 | * affect normal use of the serial ports. | ||
310 | * | ||
311 | * Revision 1.43 2000/10/13 16:30:44 pkj | ||
312 | * New version of the fast flush of serial buffers code. This time | ||
313 | * it is localized to the serial driver and uses a fast timer to | ||
314 | * do the work. | ||
315 | * | ||
316 | * Revision 1.42 2000/10/13 14:54:26 bennyo | ||
317 | * Fix for switching RTS when using rs485 | ||
318 | * | ||
319 | * Revision 1.41 2000/10/12 11:43:44 pkj | ||
320 | * Cleaned up a number of comments. | ||
321 | * | ||
322 | * Revision 1.40 2000/10/10 11:58:39 johana | ||
323 | * Made RS485 support generic for all ports. | ||
324 | * Toggle rts in interrupt if no delay wanted. | ||
325 | * WARNING: No true transmitter empty check?? | ||
326 | * Set d_wait bit when sending data so interrupt is delayed until | ||
327 | * fifo flushed. (Fix tcdrain() problem) | ||
328 | * | ||
329 | * Revision 1.39 2000/10/04 16:08:02 bjornw | ||
330 | * * Use virt_to_phys etc. for DMA addresses | ||
331 | * * Removed CONFIG_FLUSH_DMA_FAST hacks | ||
332 | * * Indentation fix | ||
333 | * | ||
334 | * Revision 1.38 2000/10/02 12:27:10 mattias | ||
335 | * * added variable used when using fast flush on serial dma. | ||
336 | * (CONFIG_FLUSH_DMA_FAST) | ||
337 | * | ||
338 | * Revision 1.37 2000/09/27 09:44:24 pkj | ||
339 | * Uncomment definition of SERIAL_HANDLE_EARLY_ERRORS. | ||
340 | * | ||
341 | * Revision 1.36 2000/09/20 13:12:52 johana | ||
342 | * Support for CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS: | ||
343 | * Number of timer ticks between flush of receive fifo (1 tick = 10ms). | ||
344 | * Try 0-3 for low latency applications. Approx 5 for high load | ||
345 | * applications (e.g. PPP). Maybe this should be more adaptive some day... | ||
346 | * | ||
347 | * Revision 1.35 2000/09/20 10:36:08 johana | ||
348 | * Typo in get_lsr_info() | ||
349 | * | ||
350 | * Revision 1.34 2000/09/20 10:29:59 johana | ||
351 | * Let rs_chars_in_buffer() check fifo content as well. | ||
352 | * get_lsr_info() might work now (not tested). | ||
353 | * Easier to change the port to debug. | ||
354 | * | ||
355 | * Revision 1.33 2000/09/13 07:52:11 torbjore | ||
356 | * Support RS485 | ||
357 | * | ||
358 | * Revision 1.32 2000/08/31 14:45:37 bjornw | ||
359 | * After sending a break we need to reset the transmit DMA channel | ||
360 | * | ||
361 | * Revision 1.31 2000/06/21 12:13:29 johana | ||
362 | * Fixed wait for all chars sent when closing port. | ||
363 | * (Used to always take 1 second!) | ||
364 | * Added shadows for directions of status/ctrl signals. | ||
365 | * | ||
366 | * Revision 1.30 2000/05/29 16:27:55 bjornw | ||
367 | * Simulator ifdef moved a bit | ||
368 | * | ||
369 | * Revision 1.29 2000/05/09 09:40:30 mattias | ||
370 | * * Added description of dma registers used in timeout_interrupt | ||
371 | * * Removed old code | ||
372 | * | ||
373 | * Revision 1.28 2000/05/08 16:38:58 mattias | ||
374 | * * Bugfix for flushing fifo in timeout_interrupt | ||
375 | * Problem occurs when bluetooth stack waits for a small number of bytes | ||
376 | * containing an event acknowledging free buffers in bluetooth HW | ||
377 | * As before, data was stuck in fifo until more data came on uart and | ||
378 | * flushed it up to the stack. | ||
379 | * | ||
380 | * Revision 1.27 2000/05/02 09:52:28 jonasd | ||
381 | * Added fix for peculiar etrax behaviour when eop is forced on an empty | ||
382 | * fifo. This is used when flashing the IRMA chip. Disabled by default. | ||
383 | * | ||
384 | * Revision 1.26 2000/03/29 15:32:02 bjornw | ||
385 | * 2.0.34 updates | ||
386 | * | ||
387 | * Revision 1.25 2000/02/16 16:59:36 bjornw | ||
388 | * * Receive DMA directly into the flip-buffer, eliminating an intermediary | ||
389 | * receive buffer and a memcpy. Will avoid some overruns. | ||
390 | * * Error message on debug port if an overrun or flip buffer overrun occurs. | ||
391 | * * Just use the first byte in the flag flip buffer for errors. | ||
392 | * * Check for timeout on the serial ports only each 5/100 s, not 1/100. | ||
393 | * | ||
394 | * Revision 1.24 2000/02/09 18:02:28 bjornw | ||
395 | * * Clear serial errors (overrun, framing, parity) correctly. Before, the | ||
396 | * receiver would get stuck if an error occurred and we did not restart | ||
397 | * the input DMA. | ||
398 | * * Cosmetics (indentation, some code made into inlines) | ||
399 | * * Some more debug options | ||
400 | * * Actually shut down the serial port (DMA irq, DMA reset, receiver stop) | ||
401 | * when the last open is closed. Corresponding fixes in startup(). | ||
402 | * * rs_close() "tx FIFO wait" code moved into right place, bug & -> && fixed | ||
403 | * and make a special case out of port 1 (R_DMA_CHx_STATUS is broken for that) | ||
404 | * * e100_disable_rx/enable_rx just disables/enables the receiver, not RTS | ||
405 | * | ||
406 | * Revision 1.23 2000/01/24 17:46:19 johana | ||
407 | * Wait for flush of DMA/FIFO when closing port. | ||
408 | * | ||
409 | * Revision 1.22 2000/01/20 18:10:23 johana | ||
410 | * Added TIOCMGET ioctl to return modem status. | ||
411 | * Implemented modem status/control that works with the extra signals | ||
412 | * (DTR, DSR, RI,CD) as well. | ||
413 | * 3 different modes supported: | ||
414 | * ser0 on PB (Bundy), ser1 on PB (Lisa) and ser2 on PA (Bundy) | ||
415 | * Fixed DEF_TX value that caused the serial transmitter pin (txd) to go to 0 when | ||
416 | * closing the last filehandle, NASTY!. | ||
417 | * Added break generation, not tested though! | ||
418 | * Use IRQF_SHARED when request_irq() for ser2 and ser3 (shared with) par0 and par1. | ||
419 | * You can't use them at the same time (yet..), but you can hopefully switch | ||
420 | * between ser2/par0, ser3/par1 with the same kernel config. | ||
421 | * Replaced some magic constants with defines | ||
422 | * | ||
423 | * | ||
424 | */ | 8 | */ |
425 | 9 | ||
426 | static char *serial_version = "$Revision: 1.25 $"; | 10 | static char *serial_version = "$Revision: 1.25 $"; |
@@ -446,6 +30,7 @@ static char *serial_version = "$Revision: 1.25 $"; | |||
446 | 30 | ||
447 | #include <asm/io.h> | 31 | #include <asm/io.h> |
448 | #include <asm/irq.h> | 32 | #include <asm/irq.h> |
33 | #include <asm/dma.h> | ||
449 | #include <asm/system.h> | 34 | #include <asm/system.h> |
450 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
451 | 36 | ||
@@ -454,8 +39,9 @@ static char *serial_version = "$Revision: 1.25 $"; | |||
454 | /* non-arch dependent serial structures are in linux/serial.h */ | 39 | /* non-arch dependent serial structures are in linux/serial.h */ |
455 | #include <linux/serial.h> | 40 | #include <linux/serial.h> |
456 | /* while we keep our own stuff (struct e100_serial) in a local .h file */ | 41 | /* while we keep our own stuff (struct e100_serial) in a local .h file */ |
457 | #include "serial.h" | 42 | #include "crisv10.h" |
458 | #include <asm/fasttimer.h> | 43 | #include <asm/fasttimer.h> |
44 | #include <asm/arch/io_interface_mux.h> | ||
459 | 45 | ||
460 | #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER | 46 | #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER |
461 | #ifndef CONFIG_ETRAX_FAST_TIMER | 47 | #ifndef CONFIG_ETRAX_FAST_TIMER |
@@ -504,18 +90,6 @@ struct tty_driver *serial_driver; | |||
504 | from eLinux */ | 90 | from eLinux */ |
505 | #define SERIAL_HANDLE_EARLY_ERRORS | 91 | #define SERIAL_HANDLE_EARLY_ERRORS |
506 | 92 | ||
507 | /* Defined and used in n_tty.c, but we need it here as well */ | ||
508 | #define TTY_THRESHOLD_THROTTLE 128 | ||
509 | |||
510 | /* Due to buffersizes and threshold values, our SERIAL_DESCR_BUF_SIZE | ||
511 | * must not be to high or flow control won't work if we leave it to the tty | ||
512 | * layer so we have our own throttling in flush_to_flip | ||
513 | * TTY_FLIPBUF_SIZE=512, | ||
514 | * TTY_THRESHOLD_THROTTLE/UNTHROTTLE=128 | ||
515 | * BUF_SIZE can't be > 128 | ||
516 | */ | ||
517 | #define CRIS_BUF_SIZE 512 | ||
518 | |||
519 | /* Currently 16 descriptors x 128 bytes = 2048 bytes */ | 93 | /* Currently 16 descriptors x 128 bytes = 2048 bytes */ |
520 | #define SERIAL_DESCR_BUF_SIZE 256 | 94 | #define SERIAL_DESCR_BUF_SIZE 256 |
521 | 95 | ||
@@ -588,13 +162,13 @@ unsigned long timer_data_to_ns(unsigned long timer_data); | |||
588 | static void change_speed(struct e100_serial *info); | 162 | static void change_speed(struct e100_serial *info); |
589 | static void rs_throttle(struct tty_struct * tty); | 163 | static void rs_throttle(struct tty_struct * tty); |
590 | static void rs_wait_until_sent(struct tty_struct *tty, int timeout); | 164 | static void rs_wait_until_sent(struct tty_struct *tty, int timeout); |
591 | static int rs_write(struct tty_struct * tty, int from_user, | 165 | static int rs_write(struct tty_struct *tty, |
592 | const unsigned char *buf, int count); | 166 | const unsigned char *buf, int count); |
593 | #ifdef CONFIG_ETRAX_RS485 | 167 | #ifdef CONFIG_ETRAX_RS485 |
594 | static int e100_write_rs485(struct tty_struct * tty, int from_user, | 168 | static int e100_write_rs485(struct tty_struct *tty, |
595 | const unsigned char *buf, int count); | 169 | const unsigned char *buf, int count); |
596 | #endif | 170 | #endif |
597 | static int get_lsr_info(struct e100_serial * info, unsigned int *value); | 171 | static int get_lsr_info(struct e100_serial *info, unsigned int *value); |
598 | 172 | ||
599 | 173 | ||
600 | #define DEF_BAUD 115200 /* 115.2 kbit/s */ | 174 | #define DEF_BAUD 115200 /* 115.2 kbit/s */ |
@@ -679,20 +253,39 @@ static struct e100_serial rs_table[] = { | |||
679 | .rx_ctrl = DEF_RX, | 253 | .rx_ctrl = DEF_RX, |
680 | .tx_ctrl = DEF_TX, | 254 | .tx_ctrl = DEF_TX, |
681 | .iseteop = 2, | 255 | .iseteop = 2, |
256 | .dma_owner = dma_ser0, | ||
257 | .io_if = if_serial_0, | ||
682 | #ifdef CONFIG_ETRAX_SERIAL_PORT0 | 258 | #ifdef CONFIG_ETRAX_SERIAL_PORT0 |
683 | .enabled = 1, | 259 | .enabled = 1, |
684 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT | 260 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT |
685 | .dma_out_enabled = 1, | 261 | .dma_out_enabled = 1, |
262 | .dma_out_nbr = SER0_TX_DMA_NBR, | ||
263 | .dma_out_irq_nbr = SER0_DMA_TX_IRQ_NBR, | ||
264 | .dma_out_irq_flags = IRQF_DISABLED, | ||
265 | .dma_out_irq_description = "serial 0 dma tr", | ||
686 | #else | 266 | #else |
687 | .dma_out_enabled = 0, | 267 | .dma_out_enabled = 0, |
268 | .dma_out_nbr = UINT_MAX, | ||
269 | .dma_out_irq_nbr = 0, | ||
270 | .dma_out_irq_flags = 0, | ||
271 | .dma_out_irq_description = NULL, | ||
688 | #endif | 272 | #endif |
689 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN | 273 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN |
690 | .dma_in_enabled = 1, | 274 | .dma_in_enabled = 1, |
275 | .dma_in_nbr = SER0_RX_DMA_NBR, | ||
276 | .dma_in_irq_nbr = SER0_DMA_RX_IRQ_NBR, | ||
277 | .dma_in_irq_flags = IRQF_DISABLED, | ||
278 | .dma_in_irq_description = "serial 0 dma rec", | ||
691 | #else | 279 | #else |
692 | .dma_in_enabled = 0 | 280 | .dma_in_enabled = 0, |
281 | .dma_in_nbr = UINT_MAX, | ||
282 | .dma_in_irq_nbr = 0, | ||
283 | .dma_in_irq_flags = 0, | ||
284 | .dma_in_irq_description = NULL, | ||
693 | #endif | 285 | #endif |
694 | #else | 286 | #else |
695 | .enabled = 0, | 287 | .enabled = 0, |
288 | .io_if_description = NULL, | ||
696 | .dma_out_enabled = 0, | 289 | .dma_out_enabled = 0, |
697 | .dma_in_enabled = 0 | 290 | .dma_in_enabled = 0 |
698 | #endif | 291 | #endif |
@@ -714,20 +307,42 @@ static struct e100_serial rs_table[] = { | |||
714 | .rx_ctrl = DEF_RX, | 307 | .rx_ctrl = DEF_RX, |
715 | .tx_ctrl = DEF_TX, | 308 | .tx_ctrl = DEF_TX, |
716 | .iseteop = 3, | 309 | .iseteop = 3, |
310 | .dma_owner = dma_ser1, | ||
311 | .io_if = if_serial_1, | ||
717 | #ifdef CONFIG_ETRAX_SERIAL_PORT1 | 312 | #ifdef CONFIG_ETRAX_SERIAL_PORT1 |
718 | .enabled = 1, | 313 | .enabled = 1, |
314 | .io_if_description = "ser1", | ||
719 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT | 315 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT |
720 | .dma_out_enabled = 1, | 316 | .dma_out_enabled = 1, |
317 | .dma_out_nbr = SER1_TX_DMA_NBR, | ||
318 | .dma_out_irq_nbr = SER1_DMA_TX_IRQ_NBR, | ||
319 | .dma_out_irq_flags = IRQF_DISABLED, | ||
320 | .dma_out_irq_description = "serial 1 dma tr", | ||
721 | #else | 321 | #else |
722 | .dma_out_enabled = 0, | 322 | .dma_out_enabled = 0, |
323 | .dma_out_nbr = UINT_MAX, | ||
324 | .dma_out_irq_nbr = 0, | ||
325 | .dma_out_irq_flags = 0, | ||
326 | .dma_out_irq_description = NULL, | ||
723 | #endif | 327 | #endif |
724 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN | 328 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN |
725 | .dma_in_enabled = 1, | 329 | .dma_in_enabled = 1, |
330 | .dma_in_nbr = SER1_RX_DMA_NBR, | ||
331 | .dma_in_irq_nbr = SER1_DMA_RX_IRQ_NBR, | ||
332 | .dma_in_irq_flags = IRQF_DISABLED, | ||
333 | .dma_in_irq_description = "serial 1 dma rec", | ||
726 | #else | 334 | #else |
727 | .dma_in_enabled = 0 | 335 | .dma_in_enabled = 0, |
336 | .dma_in_enabled = 0, | ||
337 | .dma_in_nbr = UINT_MAX, | ||
338 | .dma_in_irq_nbr = 0, | ||
339 | .dma_in_irq_flags = 0, | ||
340 | .dma_in_irq_description = NULL, | ||
728 | #endif | 341 | #endif |
729 | #else | 342 | #else |
730 | .enabled = 0, | 343 | .enabled = 0, |
344 | .io_if_description = NULL, | ||
345 | .dma_in_irq_nbr = 0, | ||
731 | .dma_out_enabled = 0, | 346 | .dma_out_enabled = 0, |
732 | .dma_in_enabled = 0 | 347 | .dma_in_enabled = 0 |
733 | #endif | 348 | #endif |
@@ -748,20 +363,40 @@ static struct e100_serial rs_table[] = { | |||
748 | .rx_ctrl = DEF_RX, | 363 | .rx_ctrl = DEF_RX, |
749 | .tx_ctrl = DEF_TX, | 364 | .tx_ctrl = DEF_TX, |
750 | .iseteop = 0, | 365 | .iseteop = 0, |
366 | .dma_owner = dma_ser2, | ||
367 | .io_if = if_serial_2, | ||
751 | #ifdef CONFIG_ETRAX_SERIAL_PORT2 | 368 | #ifdef CONFIG_ETRAX_SERIAL_PORT2 |
752 | .enabled = 1, | 369 | .enabled = 1, |
370 | .io_if_description = "ser2", | ||
753 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT | 371 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT |
754 | .dma_out_enabled = 1, | 372 | .dma_out_enabled = 1, |
373 | .dma_out_nbr = SER2_TX_DMA_NBR, | ||
374 | .dma_out_irq_nbr = SER2_DMA_TX_IRQ_NBR, | ||
375 | .dma_out_irq_flags = IRQF_DISABLED, | ||
376 | .dma_out_irq_description = "serial 2 dma tr", | ||
755 | #else | 377 | #else |
756 | .dma_out_enabled = 0, | 378 | .dma_out_enabled = 0, |
379 | .dma_out_nbr = UINT_MAX, | ||
380 | .dma_out_irq_nbr = 0, | ||
381 | .dma_out_irq_flags = 0, | ||
382 | .dma_out_irq_description = NULL, | ||
757 | #endif | 383 | #endif |
758 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN | 384 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN |
759 | .dma_in_enabled = 1, | 385 | .dma_in_enabled = 1, |
386 | .dma_in_nbr = SER2_RX_DMA_NBR, | ||
387 | .dma_in_irq_nbr = SER2_DMA_RX_IRQ_NBR, | ||
388 | .dma_in_irq_flags = IRQF_DISABLED, | ||
389 | .dma_in_irq_description = "serial 2 dma rec", | ||
760 | #else | 390 | #else |
761 | .dma_in_enabled = 0 | 391 | .dma_in_enabled = 0, |
392 | .dma_in_nbr = UINT_MAX, | ||
393 | .dma_in_irq_nbr = 0, | ||
394 | .dma_in_irq_flags = 0, | ||
395 | .dma_in_irq_description = NULL, | ||
762 | #endif | 396 | #endif |
763 | #else | 397 | #else |
764 | .enabled = 0, | 398 | .enabled = 0, |
399 | .io_if_description = NULL, | ||
765 | .dma_out_enabled = 0, | 400 | .dma_out_enabled = 0, |
766 | .dma_in_enabled = 0 | 401 | .dma_in_enabled = 0 |
767 | #endif | 402 | #endif |
@@ -782,20 +417,40 @@ static struct e100_serial rs_table[] = { | |||
782 | .rx_ctrl = DEF_RX, | 417 | .rx_ctrl = DEF_RX, |
783 | .tx_ctrl = DEF_TX, | 418 | .tx_ctrl = DEF_TX, |
784 | .iseteop = 1, | 419 | .iseteop = 1, |
420 | .dma_owner = dma_ser3, | ||
421 | .io_if = if_serial_3, | ||
785 | #ifdef CONFIG_ETRAX_SERIAL_PORT3 | 422 | #ifdef CONFIG_ETRAX_SERIAL_PORT3 |
786 | .enabled = 1, | 423 | .enabled = 1, |
424 | .io_if_description = "ser3", | ||
787 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT | 425 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT |
788 | .dma_out_enabled = 1, | 426 | .dma_out_enabled = 1, |
427 | .dma_out_nbr = SER3_TX_DMA_NBR, | ||
428 | .dma_out_irq_nbr = SER3_DMA_TX_IRQ_NBR, | ||
429 | .dma_out_irq_flags = IRQF_DISABLED, | ||
430 | .dma_out_irq_description = "serial 3 dma tr", | ||
789 | #else | 431 | #else |
790 | .dma_out_enabled = 0, | 432 | .dma_out_enabled = 0, |
433 | .dma_out_nbr = UINT_MAX, | ||
434 | .dma_out_irq_nbr = 0, | ||
435 | .dma_out_irq_flags = 0, | ||
436 | .dma_out_irq_description = NULL, | ||
791 | #endif | 437 | #endif |
792 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN | 438 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN |
793 | .dma_in_enabled = 1, | 439 | .dma_in_enabled = 1, |
440 | .dma_in_nbr = SER3_RX_DMA_NBR, | ||
441 | .dma_in_irq_nbr = SER3_DMA_RX_IRQ_NBR, | ||
442 | .dma_in_irq_flags = IRQF_DISABLED, | ||
443 | .dma_in_irq_description = "serial 3 dma rec", | ||
794 | #else | 444 | #else |
795 | .dma_in_enabled = 0 | 445 | .dma_in_enabled = 0, |
446 | .dma_in_nbr = UINT_MAX, | ||
447 | .dma_in_irq_nbr = 0, | ||
448 | .dma_in_irq_flags = 0, | ||
449 | .dma_in_irq_description = NULL | ||
796 | #endif | 450 | #endif |
797 | #else | 451 | #else |
798 | .enabled = 0, | 452 | .enabled = 0, |
453 | .io_if_description = NULL, | ||
799 | .dma_out_enabled = 0, | 454 | .dma_out_enabled = 0, |
800 | .dma_in_enabled = 0 | 455 | .dma_in_enabled = 0 |
801 | #endif | 456 | #endif |
@@ -1416,12 +1071,11 @@ e100_dtr(struct e100_serial *info, int set) | |||
1416 | { | 1071 | { |
1417 | unsigned long flags; | 1072 | unsigned long flags; |
1418 | 1073 | ||
1419 | save_flags(flags); | 1074 | local_irq_save(flags); |
1420 | cli(); | ||
1421 | *e100_modem_pins[info->line].dtr_shadow &= ~mask; | 1075 | *e100_modem_pins[info->line].dtr_shadow &= ~mask; |
1422 | *e100_modem_pins[info->line].dtr_shadow |= (set ? 0 : mask); | 1076 | *e100_modem_pins[info->line].dtr_shadow |= (set ? 0 : mask); |
1423 | *e100_modem_pins[info->line].dtr_port = *e100_modem_pins[info->line].dtr_shadow; | 1077 | *e100_modem_pins[info->line].dtr_port = *e100_modem_pins[info->line].dtr_shadow; |
1424 | restore_flags(flags); | 1078 | local_irq_restore(flags); |
1425 | } | 1079 | } |
1426 | 1080 | ||
1427 | #ifdef SERIAL_DEBUG_IO | 1081 | #ifdef SERIAL_DEBUG_IO |
@@ -1440,12 +1094,11 @@ e100_rts(struct e100_serial *info, int set) | |||
1440 | { | 1094 | { |
1441 | #ifndef CONFIG_SVINTO_SIM | 1095 | #ifndef CONFIG_SVINTO_SIM |
1442 | unsigned long flags; | 1096 | unsigned long flags; |
1443 | save_flags(flags); | 1097 | local_irq_save(flags); |
1444 | cli(); | ||
1445 | info->rx_ctrl &= ~E100_RTS_MASK; | 1098 | info->rx_ctrl &= ~E100_RTS_MASK; |
1446 | info->rx_ctrl |= (set ? 0 : E100_RTS_MASK); /* RTS is active low */ | 1099 | info->rx_ctrl |= (set ? 0 : E100_RTS_MASK); /* RTS is active low */ |
1447 | info->port[REG_REC_CTRL] = info->rx_ctrl; | 1100 | info->port[REG_REC_CTRL] = info->rx_ctrl; |
1448 | restore_flags(flags); | 1101 | local_irq_restore(flags); |
1449 | #ifdef SERIAL_DEBUG_IO | 1102 | #ifdef SERIAL_DEBUG_IO |
1450 | printk("ser%i rts %i\n", info->line, set); | 1103 | printk("ser%i rts %i\n", info->line, set); |
1451 | #endif | 1104 | #endif |
@@ -1463,12 +1116,11 @@ e100_ri_out(struct e100_serial *info, int set) | |||
1463 | unsigned char mask = e100_modem_pins[info->line].ri_mask; | 1116 | unsigned char mask = e100_modem_pins[info->line].ri_mask; |
1464 | unsigned long flags; | 1117 | unsigned long flags; |
1465 | 1118 | ||
1466 | save_flags(flags); | 1119 | local_irq_save(flags); |
1467 | cli(); | ||
1468 | *e100_modem_pins[info->line].ri_shadow &= ~mask; | 1120 | *e100_modem_pins[info->line].ri_shadow &= ~mask; |
1469 | *e100_modem_pins[info->line].ri_shadow |= (set ? 0 : mask); | 1121 | *e100_modem_pins[info->line].ri_shadow |= (set ? 0 : mask); |
1470 | *e100_modem_pins[info->line].ri_port = *e100_modem_pins[info->line].ri_shadow; | 1122 | *e100_modem_pins[info->line].ri_port = *e100_modem_pins[info->line].ri_shadow; |
1471 | restore_flags(flags); | 1123 | local_irq_restore(flags); |
1472 | } | 1124 | } |
1473 | #endif | 1125 | #endif |
1474 | } | 1126 | } |
@@ -1481,12 +1133,11 @@ e100_cd_out(struct e100_serial *info, int set) | |||
1481 | unsigned char mask = e100_modem_pins[info->line].cd_mask; | 1133 | unsigned char mask = e100_modem_pins[info->line].cd_mask; |
1482 | unsigned long flags; | 1134 | unsigned long flags; |
1483 | 1135 | ||
1484 | save_flags(flags); | 1136 | local_irq_save(flags); |
1485 | cli(); | ||
1486 | *e100_modem_pins[info->line].cd_shadow &= ~mask; | 1137 | *e100_modem_pins[info->line].cd_shadow &= ~mask; |
1487 | *e100_modem_pins[info->line].cd_shadow |= (set ? 0 : mask); | 1138 | *e100_modem_pins[info->line].cd_shadow |= (set ? 0 : mask); |
1488 | *e100_modem_pins[info->line].cd_port = *e100_modem_pins[info->line].cd_shadow; | 1139 | *e100_modem_pins[info->line].cd_port = *e100_modem_pins[info->line].cd_shadow; |
1489 | restore_flags(flags); | 1140 | local_irq_restore(flags); |
1490 | } | 1141 | } |
1491 | #endif | 1142 | #endif |
1492 | } | 1143 | } |
@@ -1560,8 +1211,7 @@ static void e100_disable_txdma_channel(struct e100_serial *info) | |||
1560 | /* Disable output DMA channel for the serial port in question | 1211 | /* Disable output DMA channel for the serial port in question |
1561 | * ( set to something other then serialX) | 1212 | * ( set to something other then serialX) |
1562 | */ | 1213 | */ |
1563 | save_flags(flags); | 1214 | local_irq_save(flags); |
1564 | cli(); | ||
1565 | DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line)); | 1215 | DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line)); |
1566 | if (info->line == 0) { | 1216 | if (info->line == 0) { |
1567 | if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma6)) == | 1217 | if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma6)) == |
@@ -1589,7 +1239,7 @@ static void e100_disable_txdma_channel(struct e100_serial *info) | |||
1589 | } | 1239 | } |
1590 | } | 1240 | } |
1591 | *R_GEN_CONFIG = genconfig_shadow; | 1241 | *R_GEN_CONFIG = genconfig_shadow; |
1592 | restore_flags(flags); | 1242 | local_irq_restore(flags); |
1593 | } | 1243 | } |
1594 | 1244 | ||
1595 | 1245 | ||
@@ -1597,8 +1247,7 @@ static void e100_enable_txdma_channel(struct e100_serial *info) | |||
1597 | { | 1247 | { |
1598 | unsigned long flags; | 1248 | unsigned long flags; |
1599 | 1249 | ||
1600 | save_flags(flags); | 1250 | local_irq_save(flags); |
1601 | cli(); | ||
1602 | DFLOW(DEBUG_LOG(info->line, "enable_txdma_channel %i\n", info->line)); | 1251 | DFLOW(DEBUG_LOG(info->line, "enable_txdma_channel %i\n", info->line)); |
1603 | /* Enable output DMA channel for the serial port in question */ | 1252 | /* Enable output DMA channel for the serial port in question */ |
1604 | if (info->line == 0) { | 1253 | if (info->line == 0) { |
@@ -1615,7 +1264,7 @@ static void e100_enable_txdma_channel(struct e100_serial *info) | |||
1615 | genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, serial3); | 1264 | genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, serial3); |
1616 | } | 1265 | } |
1617 | *R_GEN_CONFIG = genconfig_shadow; | 1266 | *R_GEN_CONFIG = genconfig_shadow; |
1618 | restore_flags(flags); | 1267 | local_irq_restore(flags); |
1619 | } | 1268 | } |
1620 | 1269 | ||
1621 | static void e100_disable_rxdma_channel(struct e100_serial *info) | 1270 | static void e100_disable_rxdma_channel(struct e100_serial *info) |
@@ -1625,8 +1274,7 @@ static void e100_disable_rxdma_channel(struct e100_serial *info) | |||
1625 | /* Disable input DMA channel for the serial port in question | 1274 | /* Disable input DMA channel for the serial port in question |
1626 | * ( set to something other then serialX) | 1275 | * ( set to something other then serialX) |
1627 | */ | 1276 | */ |
1628 | save_flags(flags); | 1277 | local_irq_save(flags); |
1629 | cli(); | ||
1630 | if (info->line == 0) { | 1278 | if (info->line == 0) { |
1631 | if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma7)) == | 1279 | if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma7)) == |
1632 | IO_STATE(R_GEN_CONFIG, dma7, serial0)) { | 1280 | IO_STATE(R_GEN_CONFIG, dma7, serial0)) { |
@@ -1653,7 +1301,7 @@ static void e100_disable_rxdma_channel(struct e100_serial *info) | |||
1653 | } | 1301 | } |
1654 | } | 1302 | } |
1655 | *R_GEN_CONFIG = genconfig_shadow; | 1303 | *R_GEN_CONFIG = genconfig_shadow; |
1656 | restore_flags(flags); | 1304 | local_irq_restore(flags); |
1657 | } | 1305 | } |
1658 | 1306 | ||
1659 | 1307 | ||
@@ -1661,8 +1309,7 @@ static void e100_enable_rxdma_channel(struct e100_serial *info) | |||
1661 | { | 1309 | { |
1662 | unsigned long flags; | 1310 | unsigned long flags; |
1663 | 1311 | ||
1664 | save_flags(flags); | 1312 | local_irq_save(flags); |
1665 | cli(); | ||
1666 | /* Enable input DMA channel for the serial port in question */ | 1313 | /* Enable input DMA channel for the serial port in question */ |
1667 | if (info->line == 0) { | 1314 | if (info->line == 0) { |
1668 | genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma7); | 1315 | genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma7); |
@@ -1678,7 +1325,7 @@ static void e100_enable_rxdma_channel(struct e100_serial *info) | |||
1678 | genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, serial3); | 1325 | genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, serial3); |
1679 | } | 1326 | } |
1680 | *R_GEN_CONFIG = genconfig_shadow; | 1327 | *R_GEN_CONFIG = genconfig_shadow; |
1681 | restore_flags(flags); | 1328 | local_irq_restore(flags); |
1682 | } | 1329 | } |
1683 | 1330 | ||
1684 | #ifdef SERIAL_HANDLE_EARLY_ERRORS | 1331 | #ifdef SERIAL_HANDLE_EARLY_ERRORS |
@@ -1785,7 +1432,7 @@ e100_enable_rs485(struct tty_struct *tty,struct rs485_control *r) | |||
1785 | } | 1432 | } |
1786 | 1433 | ||
1787 | static int | 1434 | static int |
1788 | e100_write_rs485(struct tty_struct *tty, int from_user, | 1435 | e100_write_rs485(struct tty_struct *tty, |
1789 | const unsigned char *buf, int count) | 1436 | const unsigned char *buf, int count) |
1790 | { | 1437 | { |
1791 | struct e100_serial * info = (struct e100_serial *)tty->driver_data; | 1438 | struct e100_serial * info = (struct e100_serial *)tty->driver_data; |
@@ -1798,7 +1445,7 @@ e100_write_rs485(struct tty_struct *tty, int from_user, | |||
1798 | */ | 1445 | */ |
1799 | info->rs485.enabled = 1; | 1446 | info->rs485.enabled = 1; |
1800 | /* rs_write now deals with RS485 if enabled */ | 1447 | /* rs_write now deals with RS485 if enabled */ |
1801 | count = rs_write(tty, from_user, buf, count); | 1448 | count = rs_write(tty, buf, count); |
1802 | info->rs485.enabled = old_enabled; | 1449 | info->rs485.enabled = old_enabled; |
1803 | return count; | 1450 | return count; |
1804 | } | 1451 | } |
@@ -1836,7 +1483,7 @@ rs_stop(struct tty_struct *tty) | |||
1836 | unsigned long flags; | 1483 | unsigned long flags; |
1837 | unsigned long xoff; | 1484 | unsigned long xoff; |
1838 | 1485 | ||
1839 | save_flags(flags); cli(); | 1486 | local_irq_save(flags); |
1840 | DFLOW(DEBUG_LOG(info->line, "XOFF rs_stop xmit %i\n", | 1487 | DFLOW(DEBUG_LOG(info->line, "XOFF rs_stop xmit %i\n", |
1841 | CIRC_CNT(info->xmit.head, | 1488 | CIRC_CNT(info->xmit.head, |
1842 | info->xmit.tail,SERIAL_XMIT_SIZE))); | 1489 | info->xmit.tail,SERIAL_XMIT_SIZE))); |
@@ -1848,7 +1495,7 @@ rs_stop(struct tty_struct *tty) | |||
1848 | } | 1495 | } |
1849 | 1496 | ||
1850 | *((unsigned long *)&info->port[REG_XOFF]) = xoff; | 1497 | *((unsigned long *)&info->port[REG_XOFF]) = xoff; |
1851 | restore_flags(flags); | 1498 | local_irq_restore(flags); |
1852 | } | 1499 | } |
1853 | } | 1500 | } |
1854 | 1501 | ||
@@ -1860,7 +1507,7 @@ rs_start(struct tty_struct *tty) | |||
1860 | unsigned long flags; | 1507 | unsigned long flags; |
1861 | unsigned long xoff; | 1508 | unsigned long xoff; |
1862 | 1509 | ||
1863 | save_flags(flags); cli(); | 1510 | local_irq_save(flags); |
1864 | DFLOW(DEBUG_LOG(info->line, "XOFF rs_start xmit %i\n", | 1511 | DFLOW(DEBUG_LOG(info->line, "XOFF rs_start xmit %i\n", |
1865 | CIRC_CNT(info->xmit.head, | 1512 | CIRC_CNT(info->xmit.head, |
1866 | info->xmit.tail,SERIAL_XMIT_SIZE))); | 1513 | info->xmit.tail,SERIAL_XMIT_SIZE))); |
@@ -1875,7 +1522,7 @@ rs_start(struct tty_struct *tty) | |||
1875 | info->xmit.head != info->xmit.tail && info->xmit.buf) | 1522 | info->xmit.head != info->xmit.tail && info->xmit.buf) |
1876 | e100_enable_serial_tx_ready_irq(info); | 1523 | e100_enable_serial_tx_ready_irq(info); |
1877 | 1524 | ||
1878 | restore_flags(flags); | 1525 | local_irq_restore(flags); |
1879 | } | 1526 | } |
1880 | } | 1527 | } |
1881 | 1528 | ||
@@ -2055,8 +1702,7 @@ static int serial_fast_timer_expired = 0; | |||
2055 | static void flush_timeout_function(unsigned long data); | 1702 | static void flush_timeout_function(unsigned long data); |
2056 | #define START_FLUSH_FAST_TIMER_TIME(info, string, usec) {\ | 1703 | #define START_FLUSH_FAST_TIMER_TIME(info, string, usec) {\ |
2057 | unsigned long timer_flags; \ | 1704 | unsigned long timer_flags; \ |
2058 | save_flags(timer_flags); \ | 1705 | local_irq_save(timer_flags); \ |
2059 | cli(); \ | ||
2060 | if (fast_timers[info->line].function == NULL) { \ | 1706 | if (fast_timers[info->line].function == NULL) { \ |
2061 | serial_fast_timer_started++; \ | 1707 | serial_fast_timer_started++; \ |
2062 | TIMERD(DEBUG_LOG(info->line, "start_timer %i ", info->line)); \ | 1708 | TIMERD(DEBUG_LOG(info->line, "start_timer %i ", info->line)); \ |
@@ -2070,7 +1716,7 @@ static void flush_timeout_function(unsigned long data); | |||
2070 | else { \ | 1716 | else { \ |
2071 | TIMERD(DEBUG_LOG(info->line, "timer %i already running\n", info->line)); \ | 1717 | TIMERD(DEBUG_LOG(info->line, "timer %i already running\n", info->line)); \ |
2072 | } \ | 1718 | } \ |
2073 | restore_flags(timer_flags); \ | 1719 | local_irq_restore(timer_flags); \ |
2074 | } | 1720 | } |
2075 | #define START_FLUSH_FAST_TIMER(info, string) START_FLUSH_FAST_TIMER_TIME(info, string, info->flush_time_usec) | 1721 | #define START_FLUSH_FAST_TIMER(info, string) START_FLUSH_FAST_TIMER_TIME(info, string, info->flush_time_usec) |
2076 | 1722 | ||
@@ -2099,8 +1745,7 @@ append_recv_buffer(struct e100_serial *info, struct etrax_recv_buffer *buffer) | |||
2099 | { | 1745 | { |
2100 | unsigned long flags; | 1746 | unsigned long flags; |
2101 | 1747 | ||
2102 | save_flags(flags); | 1748 | local_irq_save(flags); |
2103 | cli(); | ||
2104 | 1749 | ||
2105 | if (!info->first_recv_buffer) | 1750 | if (!info->first_recv_buffer) |
2106 | info->first_recv_buffer = buffer; | 1751 | info->first_recv_buffer = buffer; |
@@ -2113,7 +1758,7 @@ append_recv_buffer(struct e100_serial *info, struct etrax_recv_buffer *buffer) | |||
2113 | if (info->recv_cnt > info->max_recv_cnt) | 1758 | if (info->recv_cnt > info->max_recv_cnt) |
2114 | info->max_recv_cnt = info->recv_cnt; | 1759 | info->max_recv_cnt = info->recv_cnt; |
2115 | 1760 | ||
2116 | restore_flags(flags); | 1761 | local_irq_restore(flags); |
2117 | } | 1762 | } |
2118 | 1763 | ||
2119 | static int | 1764 | static int |
@@ -2133,11 +1778,7 @@ add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char fl | |||
2133 | info->icount.rx++; | 1778 | info->icount.rx++; |
2134 | } else { | 1779 | } else { |
2135 | struct tty_struct *tty = info->tty; | 1780 | struct tty_struct *tty = info->tty; |
2136 | *tty->flip.char_buf_ptr = data; | 1781 | tty_insert_flip_char(tty, data, flag); |
2137 | *tty->flip.flag_buf_ptr = flag; | ||
2138 | tty->flip.flag_buf_ptr++; | ||
2139 | tty->flip.char_buf_ptr++; | ||
2140 | tty->flip.count++; | ||
2141 | info->icount.rx++; | 1782 | info->icount.rx++; |
2142 | } | 1783 | } |
2143 | 1784 | ||
@@ -2322,7 +1963,6 @@ start_receive(struct e100_serial *info) | |||
2322 | */ | 1963 | */ |
2323 | return; | 1964 | return; |
2324 | #endif | 1965 | #endif |
2325 | info->tty->flip.count = 0; | ||
2326 | if (info->uses_dma_in) { | 1966 | if (info->uses_dma_in) { |
2327 | /* reset the input dma channel to be sure it works */ | 1967 | /* reset the input dma channel to be sure it works */ |
2328 | 1968 | ||
@@ -2484,32 +2124,20 @@ static void flush_to_flip_buffer(struct e100_serial *info) | |||
2484 | { | 2124 | { |
2485 | struct tty_struct *tty; | 2125 | struct tty_struct *tty; |
2486 | struct etrax_recv_buffer *buffer; | 2126 | struct etrax_recv_buffer *buffer; |
2487 | unsigned int length; | ||
2488 | unsigned long flags; | 2127 | unsigned long flags; |
2489 | int max_flip_size; | ||
2490 | |||
2491 | if (!info->first_recv_buffer) | ||
2492 | return; | ||
2493 | 2128 | ||
2494 | save_flags(flags); | 2129 | local_irq_save(flags); |
2495 | cli(); | 2130 | tty = info->tty; |
2496 | 2131 | ||
2497 | if (!(tty = info->tty)) { | 2132 | if (!tty) { |
2498 | restore_flags(flags); | 2133 | local_irq_restore(flags); |
2499 | return; | 2134 | return; |
2500 | } | 2135 | } |
2501 | 2136 | ||
2502 | while ((buffer = info->first_recv_buffer) != NULL) { | 2137 | while ((buffer = info->first_recv_buffer) != NULL) { |
2503 | unsigned int count = buffer->length; | 2138 | unsigned int count = buffer->length; |
2504 | 2139 | ||
2505 | count = tty_buffer_request_room(tty, count); | 2140 | tty_insert_flip_string(tty, buffer->buffer, count); |
2506 | if (count == 0) /* Throttle ?? */ | ||
2507 | break; | ||
2508 | |||
2509 | if (count > 1) | ||
2510 | tty_insert_flip_strings(tty, buffer->buffer, count - 1); | ||
2511 | tty_insert_flip_char(tty, buffer->buffer[count-1], buffer->error); | ||
2512 | |||
2513 | info->recv_cnt -= count; | 2141 | info->recv_cnt -= count; |
2514 | 2142 | ||
2515 | if (count == buffer->length) { | 2143 | if (count == buffer->length) { |
@@ -2525,18 +2153,9 @@ static void flush_to_flip_buffer(struct e100_serial *info) | |||
2525 | if (!info->first_recv_buffer) | 2153 | if (!info->first_recv_buffer) |
2526 | info->last_recv_buffer = NULL; | 2154 | info->last_recv_buffer = NULL; |
2527 | 2155 | ||
2528 | restore_flags(flags); | 2156 | local_irq_restore(flags); |
2529 | |||
2530 | DFLIP( | ||
2531 | if (1) { | ||
2532 | DEBUG_LOG(info->line, "*** rxtot %i\n", info->icount.rx); | ||
2533 | DEBUG_LOG(info->line, "ldisc %lu\n", tty->ldisc.chars_in_buffer(tty)); | ||
2534 | DEBUG_LOG(info->line, "room %lu\n", tty->ldisc.receive_room(tty)); | ||
2535 | } | ||
2536 | 2157 | ||
2537 | ); | 2158 | /* This includes a check for low-latency */ |
2538 | |||
2539 | /* this includes a check for low-latency */ | ||
2540 | tty_flip_buffer_push(tty); | 2159 | tty_flip_buffer_push(tty); |
2541 | } | 2160 | } |
2542 | 2161 | ||
@@ -2679,21 +2298,7 @@ struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info) | |||
2679 | printk("!NO TTY!\n"); | 2298 | printk("!NO TTY!\n"); |
2680 | return info; | 2299 | return info; |
2681 | } | 2300 | } |
2682 | if (tty->flip.count >= CRIS_BUF_SIZE - TTY_THRESHOLD_THROTTLE) { | 2301 | |
2683 | /* check TTY_THROTTLED first so it indicates our state */ | ||
2684 | if (!test_and_set_bit(TTY_THROTTLED, &tty->flags)) { | ||
2685 | DFLOW(DEBUG_LOG(info->line, "rs_throttle flip.count: %i\n", tty->flip.count)); | ||
2686 | rs_throttle(tty); | ||
2687 | } | ||
2688 | } | ||
2689 | if (tty->flip.count >= CRIS_BUF_SIZE) { | ||
2690 | DEBUG_LOG(info->line, "force FLIP! %i\n", tty->flip.count); | ||
2691 | tty->flip.work.func((void *) tty); | ||
2692 | if (tty->flip.count >= CRIS_BUF_SIZE) { | ||
2693 | DEBUG_LOG(info->line, "FLIP FULL! %i\n", tty->flip.count); | ||
2694 | return info; /* if TTY_DONT_FLIP is set */ | ||
2695 | } | ||
2696 | } | ||
2697 | /* Read data and status at the same time */ | 2302 | /* Read data and status at the same time */ |
2698 | data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); | 2303 | data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); |
2699 | more_data: | 2304 | more_data: |
@@ -2746,27 +2351,26 @@ more_data: | |||
2746 | DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt); | 2351 | DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt); |
2747 | info->errorcode = ERRCODE_INSERT_BREAK; | 2352 | info->errorcode = ERRCODE_INSERT_BREAK; |
2748 | } else { | 2353 | } else { |
2354 | unsigned char data = IO_EXTRACT(R_SERIAL0_READ, | ||
2355 | data_in, data_read); | ||
2356 | char flag = TTY_NORMAL; | ||
2749 | if (info->errorcode == ERRCODE_INSERT_BREAK) { | 2357 | if (info->errorcode == ERRCODE_INSERT_BREAK) { |
2750 | info->icount.brk++; | 2358 | struct tty_struct *tty = info->tty; |
2751 | *tty->flip.char_buf_ptr = 0; | 2359 | tty_insert_flip_char(tty, 0, flag); |
2752 | *tty->flip.flag_buf_ptr = TTY_BREAK; | ||
2753 | tty->flip.flag_buf_ptr++; | ||
2754 | tty->flip.char_buf_ptr++; | ||
2755 | tty->flip.count++; | ||
2756 | info->icount.rx++; | 2360 | info->icount.rx++; |
2757 | } | 2361 | } |
2758 | *tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read); | ||
2759 | 2362 | ||
2760 | if (data_read & IO_MASK(R_SERIAL0_READ, par_err)) { | 2363 | if (data_read & IO_MASK(R_SERIAL0_READ, par_err)) { |
2761 | info->icount.parity++; | 2364 | info->icount.parity++; |
2762 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 2365 | flag = TTY_PARITY; |
2763 | } else if (data_read & IO_MASK(R_SERIAL0_READ, overrun)) { | 2366 | } else if (data_read & IO_MASK(R_SERIAL0_READ, overrun)) { |
2764 | info->icount.overrun++; | 2367 | info->icount.overrun++; |
2765 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | 2368 | flag = TTY_OVERRUN; |
2766 | } else if (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) { | 2369 | } else if (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) { |
2767 | info->icount.frame++; | 2370 | info->icount.frame++; |
2768 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 2371 | flag = TTY_FRAME; |
2769 | } | 2372 | } |
2373 | tty_insert_flip_char(tty, data, flag); | ||
2770 | info->errorcode = 0; | 2374 | info->errorcode = 0; |
2771 | } | 2375 | } |
2772 | info->break_detected_cnt = 0; | 2376 | info->break_detected_cnt = 0; |
@@ -2782,16 +2386,14 @@ more_data: | |||
2782 | log_int(rdpc(), 0, 0); | 2386 | log_int(rdpc(), 0, 0); |
2783 | } | 2387 | } |
2784 | ); | 2388 | ); |
2785 | *tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read); | 2389 | tty_insert_flip_char(tty, |
2786 | *tty->flip.flag_buf_ptr = 0; | 2390 | IO_EXTRACT(R_SERIAL0_READ, data_in, data_read), |
2391 | TTY_NORMAL); | ||
2787 | } else { | 2392 | } else { |
2788 | DEBUG_LOG(info->line, "ser_rx int but no data_avail %08lX\n", data_read); | 2393 | DEBUG_LOG(info->line, "ser_rx int but no data_avail %08lX\n", data_read); |
2789 | } | 2394 | } |
2790 | 2395 | ||
2791 | 2396 | ||
2792 | tty->flip.flag_buf_ptr++; | ||
2793 | tty->flip.char_buf_ptr++; | ||
2794 | tty->flip.count++; | ||
2795 | info->icount.rx++; | 2397 | info->icount.rx++; |
2796 | data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); | 2398 | data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); |
2797 | if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) { | 2399 | if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) { |
@@ -2929,7 +2531,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2929 | if (info->x_char) { | 2531 | if (info->x_char) { |
2930 | unsigned char rstat; | 2532 | unsigned char rstat; |
2931 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char)); | 2533 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char)); |
2932 | save_flags(flags); cli(); | 2534 | local_irq_save(flags); |
2933 | rstat = info->port[REG_STATUS]; | 2535 | rstat = info->port[REG_STATUS]; |
2934 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); | 2536 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); |
2935 | 2537 | ||
@@ -2938,7 +2540,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2938 | info->x_char = 0; | 2540 | info->x_char = 0; |
2939 | /* We must enable since it is disabled in ser_interrupt */ | 2541 | /* We must enable since it is disabled in ser_interrupt */ |
2940 | e100_enable_serial_tx_ready_irq(info); | 2542 | e100_enable_serial_tx_ready_irq(info); |
2941 | restore_flags(flags); | 2543 | local_irq_restore(flags); |
2942 | return; | 2544 | return; |
2943 | } | 2545 | } |
2944 | if (info->uses_dma_out) { | 2546 | if (info->uses_dma_out) { |
@@ -2946,7 +2548,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2946 | int i; | 2548 | int i; |
2947 | /* We only use normal tx interrupt when sending x_char */ | 2549 | /* We only use normal tx interrupt when sending x_char */ |
2948 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0)); | 2550 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0)); |
2949 | save_flags(flags); cli(); | 2551 | local_irq_save(flags); |
2950 | rstat = info->port[REG_STATUS]; | 2552 | rstat = info->port[REG_STATUS]; |
2951 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); | 2553 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); |
2952 | e100_disable_serial_tx_ready_irq(info); | 2554 | e100_disable_serial_tx_ready_irq(info); |
@@ -2959,7 +2561,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2959 | nop(); | 2561 | nop(); |
2960 | 2562 | ||
2961 | *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, continue); | 2563 | *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, continue); |
2962 | restore_flags(flags); | 2564 | local_irq_restore(flags); |
2963 | return; | 2565 | return; |
2964 | } | 2566 | } |
2965 | /* Normal char-by-char interrupt */ | 2567 | /* Normal char-by-char interrupt */ |
@@ -2973,7 +2575,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2973 | } | 2575 | } |
2974 | DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail])); | 2576 | DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail])); |
2975 | /* Send a byte, rs485 timing is critical so turn of ints */ | 2577 | /* Send a byte, rs485 timing is critical so turn of ints */ |
2976 | save_flags(flags); cli(); | 2578 | local_irq_save(flags); |
2977 | info->port[REG_TR_DATA] = info->xmit.buf[info->xmit.tail]; | 2579 | info->port[REG_TR_DATA] = info->xmit.buf[info->xmit.tail]; |
2978 | info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); | 2580 | info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); |
2979 | info->icount.tx++; | 2581 | info->icount.tx++; |
@@ -2997,7 +2599,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2997 | /* We must enable since it is disabled in ser_interrupt */ | 2599 | /* We must enable since it is disabled in ser_interrupt */ |
2998 | e100_enable_serial_tx_ready_irq(info); | 2600 | e100_enable_serial_tx_ready_irq(info); |
2999 | } | 2601 | } |
3000 | restore_flags(flags); | 2602 | local_irq_restore(flags); |
3001 | 2603 | ||
3002 | if (CIRC_CNT(info->xmit.head, | 2604 | if (CIRC_CNT(info->xmit.head, |
3003 | info->xmit.tail, | 2605 | info->xmit.tail, |
@@ -3022,7 +2624,7 @@ ser_interrupt(int irq, void *dev_id) | |||
3022 | int handled = 0; | 2624 | int handled = 0; |
3023 | static volatile unsigned long reentered_ready_mask = 0; | 2625 | static volatile unsigned long reentered_ready_mask = 0; |
3024 | 2626 | ||
3025 | save_flags(flags); cli(); | 2627 | local_irq_save(flags); |
3026 | irq_mask1_rd = *R_IRQ_MASK1_RD; | 2628 | irq_mask1_rd = *R_IRQ_MASK1_RD; |
3027 | /* First handle all rx interrupts with ints disabled */ | 2629 | /* First handle all rx interrupts with ints disabled */ |
3028 | info = rs_table; | 2630 | info = rs_table; |
@@ -3067,7 +2669,7 @@ ser_interrupt(int irq, void *dev_id) | |||
3067 | /* Unblock the serial interrupt */ | 2669 | /* Unblock the serial interrupt */ |
3068 | *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set); | 2670 | *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set); |
3069 | 2671 | ||
3070 | sti(); | 2672 | local_irq_enable(); |
3071 | ready_mask = (1 << (8+1+2*0)); /* ser0 tr_ready */ | 2673 | ready_mask = (1 << (8+1+2*0)); /* ser0 tr_ready */ |
3072 | info = rs_table; | 2674 | info = rs_table; |
3073 | for (i = 0; i < NR_PORTS; i++) { | 2675 | for (i = 0; i < NR_PORTS; i++) { |
@@ -3080,11 +2682,11 @@ ser_interrupt(int irq, void *dev_id) | |||
3080 | ready_mask <<= 2; | 2682 | ready_mask <<= 2; |
3081 | } | 2683 | } |
3082 | /* handle_ser_tx_interrupt enables tr_ready interrupts */ | 2684 | /* handle_ser_tx_interrupt enables tr_ready interrupts */ |
3083 | cli(); | 2685 | local_irq_disable(); |
3084 | /* Handle reentered TX interrupt */ | 2686 | /* Handle reentered TX interrupt */ |
3085 | irq_mask1_rd = reentered_ready_mask; | 2687 | irq_mask1_rd = reentered_ready_mask; |
3086 | } | 2688 | } |
3087 | cli(); | 2689 | local_irq_disable(); |
3088 | tx_started = 0; | 2690 | tx_started = 0; |
3089 | } else { | 2691 | } else { |
3090 | unsigned long ready_mask; | 2692 | unsigned long ready_mask; |
@@ -3100,7 +2702,7 @@ ser_interrupt(int irq, void *dev_id) | |||
3100 | } | 2702 | } |
3101 | } | 2703 | } |
3102 | 2704 | ||
3103 | restore_flags(flags); | 2705 | local_irq_restore(flags); |
3104 | return IRQ_RETVAL(handled); | 2706 | return IRQ_RETVAL(handled); |
3105 | } /* ser_interrupt */ | 2707 | } /* ser_interrupt */ |
3106 | #endif | 2708 | #endif |
@@ -3121,11 +2723,13 @@ ser_interrupt(int irq, void *dev_id) | |||
3121 | * them using rs_sched_event(), and they get done here. | 2723 | * them using rs_sched_event(), and they get done here. |
3122 | */ | 2724 | */ |
3123 | static void | 2725 | static void |
3124 | do_softint(void *private_) | 2726 | do_softint(struct work_struct *work) |
3125 | { | 2727 | { |
3126 | struct e100_serial *info = (struct e100_serial *) private_; | 2728 | struct e100_serial *info; |
3127 | struct tty_struct *tty; | 2729 | struct tty_struct *tty; |
3128 | 2730 | ||
2731 | info = container_of(work, struct e100_serial, work); | ||
2732 | |||
3129 | tty = info->tty; | 2733 | tty = info->tty; |
3130 | if (!tty) | 2734 | if (!tty) |
3131 | return; | 2735 | return; |
@@ -3145,13 +2749,12 @@ startup(struct e100_serial * info) | |||
3145 | if (!xmit_page) | 2749 | if (!xmit_page) |
3146 | return -ENOMEM; | 2750 | return -ENOMEM; |
3147 | 2751 | ||
3148 | save_flags(flags); | 2752 | local_irq_save(flags); |
3149 | cli(); | ||
3150 | 2753 | ||
3151 | /* if it was already initialized, skip this */ | 2754 | /* if it was already initialized, skip this */ |
3152 | 2755 | ||
3153 | if (info->flags & ASYNC_INITIALIZED) { | 2756 | if (info->flags & ASYNC_INITIALIZED) { |
3154 | restore_flags(flags); | 2757 | local_irq_restore(flags); |
3155 | free_page(xmit_page); | 2758 | free_page(xmit_page); |
3156 | return 0; | 2759 | return 0; |
3157 | } | 2760 | } |
@@ -3277,7 +2880,7 @@ startup(struct e100_serial * info) | |||
3277 | 2880 | ||
3278 | info->flags |= ASYNC_INITIALIZED; | 2881 | info->flags |= ASYNC_INITIALIZED; |
3279 | 2882 | ||
3280 | restore_flags(flags); | 2883 | local_irq_restore(flags); |
3281 | return 0; | 2884 | return 0; |
3282 | } | 2885 | } |
3283 | 2886 | ||
@@ -3328,8 +2931,7 @@ shutdown(struct e100_serial * info) | |||
3328 | info->irq); | 2931 | info->irq); |
3329 | #endif | 2932 | #endif |
3330 | 2933 | ||
3331 | save_flags(flags); | 2934 | local_irq_save(flags); |
3332 | cli(); /* Disable interrupts */ | ||
3333 | 2935 | ||
3334 | if (info->xmit.buf) { | 2936 | if (info->xmit.buf) { |
3335 | free_page((unsigned long)info->xmit.buf); | 2937 | free_page((unsigned long)info->xmit.buf); |
@@ -3353,7 +2955,7 @@ shutdown(struct e100_serial * info) | |||
3353 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2955 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
3354 | 2956 | ||
3355 | info->flags &= ~ASYNC_INITIALIZED; | 2957 | info->flags &= ~ASYNC_INITIALIZED; |
3356 | restore_flags(flags); | 2958 | local_irq_restore(flags); |
3357 | } | 2959 | } |
3358 | 2960 | ||
3359 | 2961 | ||
@@ -3411,7 +3013,6 @@ change_speed(struct e100_serial *info) | |||
3411 | DBAUD(printk("using external baudrate: %lu\n", CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8)); | 3013 | DBAUD(printk("using external baudrate: %lu\n", CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8)); |
3412 | info->baud = CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8; | 3014 | info->baud = CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8; |
3413 | } | 3015 | } |
3414 | } | ||
3415 | #endif | 3016 | #endif |
3416 | else | 3017 | else |
3417 | { | 3018 | { |
@@ -3445,8 +3046,7 @@ change_speed(struct e100_serial *info) | |||
3445 | 3046 | ||
3446 | #ifndef CONFIG_SVINTO_SIM | 3047 | #ifndef CONFIG_SVINTO_SIM |
3447 | /* start with default settings and then fill in changes */ | 3048 | /* start with default settings and then fill in changes */ |
3448 | save_flags(flags); | 3049 | local_irq_save(flags); |
3449 | cli(); | ||
3450 | /* 8 bit, no/even parity */ | 3050 | /* 8 bit, no/even parity */ |
3451 | info->rx_ctrl &= ~(IO_MASK(R_SERIAL0_REC_CTRL, rec_bitnr) | | 3051 | info->rx_ctrl &= ~(IO_MASK(R_SERIAL0_REC_CTRL, rec_bitnr) | |
3452 | IO_MASK(R_SERIAL0_REC_CTRL, rec_par_en) | | 3052 | IO_MASK(R_SERIAL0_REC_CTRL, rec_par_en) | |
@@ -3510,7 +3110,7 @@ change_speed(struct e100_serial *info) | |||
3510 | } | 3110 | } |
3511 | 3111 | ||
3512 | *((unsigned long *)&info->port[REG_XOFF]) = xoff; | 3112 | *((unsigned long *)&info->port[REG_XOFF]) = xoff; |
3513 | restore_flags(flags); | 3113 | local_irq_restore(flags); |
3514 | #endif /* !CONFIG_SVINTO_SIM */ | 3114 | #endif /* !CONFIG_SVINTO_SIM */ |
3515 | 3115 | ||
3516 | update_char_time(info); | 3116 | update_char_time(info); |
@@ -3538,13 +3138,12 @@ rs_flush_chars(struct tty_struct *tty) | |||
3538 | 3138 | ||
3539 | /* this protection might not exactly be necessary here */ | 3139 | /* this protection might not exactly be necessary here */ |
3540 | 3140 | ||
3541 | save_flags(flags); | 3141 | local_irq_save(flags); |
3542 | cli(); | ||
3543 | start_transmit(info); | 3142 | start_transmit(info); |
3544 | restore_flags(flags); | 3143 | local_irq_restore(flags); |
3545 | } | 3144 | } |
3546 | 3145 | ||
3547 | static int rs_raw_write(struct tty_struct * tty, int from_user, | 3146 | static int rs_raw_write(struct tty_struct *tty, |
3548 | const unsigned char *buf, int count) | 3147 | const unsigned char *buf, int count) |
3549 | { | 3148 | { |
3550 | int c, ret = 0; | 3149 | int c, ret = 0; |
@@ -3567,53 +3166,19 @@ static int rs_raw_write(struct tty_struct * tty, int from_user, | |||
3567 | SIMCOUT(buf, count); | 3166 | SIMCOUT(buf, count); |
3568 | return count; | 3167 | return count; |
3569 | #endif | 3168 | #endif |
3570 | save_flags(flags); | 3169 | local_save_flags(flags); |
3571 | DFLOW(DEBUG_LOG(info->line, "write count %i ", count)); | 3170 | DFLOW(DEBUG_LOG(info->line, "write count %i ", count)); |
3572 | DFLOW(DEBUG_LOG(info->line, "ldisc %i\n", tty->ldisc.chars_in_buffer(tty))); | 3171 | DFLOW(DEBUG_LOG(info->line, "ldisc %i\n", tty->ldisc.chars_in_buffer(tty))); |
3573 | 3172 | ||
3574 | 3173 | ||
3575 | /* the cli/restore_flags pairs below are needed because the | 3174 | /* The local_irq_disable/restore_flags pairs below are needed |
3576 | * DMA interrupt handler moves the info->xmit values. the memcpy | 3175 | * because the DMA interrupt handler moves the info->xmit values. |
3577 | * needs to be in the critical region unfortunately, because we | 3176 | * the memcpy needs to be in the critical region unfortunately, |
3578 | * need to read xmit values, memcpy, write xmit values in one | 3177 | * because we need to read xmit values, memcpy, write xmit values |
3579 | * atomic operation... this could perhaps be avoided by more clever | 3178 | * in one atomic operation... this could perhaps be avoided by |
3580 | * design. | 3179 | * more clever design. |
3581 | */ | 3180 | */ |
3582 | if (from_user) { | 3181 | local_irq_disable(); |
3583 | mutex_lock(&tmp_buf_mutex); | ||
3584 | while (1) { | ||
3585 | int c1; | ||
3586 | c = CIRC_SPACE_TO_END(info->xmit.head, | ||
3587 | info->xmit.tail, | ||
3588 | SERIAL_XMIT_SIZE); | ||
3589 | if (count < c) | ||
3590 | c = count; | ||
3591 | if (c <= 0) | ||
3592 | break; | ||
3593 | |||
3594 | c -= copy_from_user(tmp_buf, buf, c); | ||
3595 | if (!c) { | ||
3596 | if (!ret) | ||
3597 | ret = -EFAULT; | ||
3598 | break; | ||
3599 | } | ||
3600 | cli(); | ||
3601 | c1 = CIRC_SPACE_TO_END(info->xmit.head, | ||
3602 | info->xmit.tail, | ||
3603 | SERIAL_XMIT_SIZE); | ||
3604 | if (c1 < c) | ||
3605 | c = c1; | ||
3606 | memcpy(info->xmit.buf + info->xmit.head, tmp_buf, c); | ||
3607 | info->xmit.head = ((info->xmit.head + c) & | ||
3608 | (SERIAL_XMIT_SIZE-1)); | ||
3609 | restore_flags(flags); | ||
3610 | buf += c; | ||
3611 | count -= c; | ||
3612 | ret += c; | ||
3613 | } | ||
3614 | mutex_unlock(&tmp_buf_mutex); | ||
3615 | } else { | ||
3616 | cli(); | ||
3617 | while (count) { | 3182 | while (count) { |
3618 | c = CIRC_SPACE_TO_END(info->xmit.head, | 3183 | c = CIRC_SPACE_TO_END(info->xmit.head, |
3619 | info->xmit.tail, | 3184 | info->xmit.tail, |
@@ -3631,8 +3196,7 @@ static int rs_raw_write(struct tty_struct * tty, int from_user, | |||
3631 | count -= c; | 3196 | count -= c; |
3632 | ret += c; | 3197 | ret += c; |
3633 | } | 3198 | } |
3634 | restore_flags(flags); | 3199 | local_irq_restore(flags); |
3635 | } | ||
3636 | 3200 | ||
3637 | /* enable transmitter if not running, unless the tty is stopped | 3201 | /* enable transmitter if not running, unless the tty is stopped |
3638 | * this does not need IRQ protection since if tr_running == 0 | 3202 | * this does not need IRQ protection since if tr_running == 0 |
@@ -3651,7 +3215,7 @@ static int rs_raw_write(struct tty_struct * tty, int from_user, | |||
3651 | } /* raw_raw_write() */ | 3215 | } /* raw_raw_write() */ |
3652 | 3216 | ||
3653 | static int | 3217 | static int |
3654 | rs_write(struct tty_struct * tty, int from_user, | 3218 | rs_write(struct tty_struct *tty, |
3655 | const unsigned char *buf, int count) | 3219 | const unsigned char *buf, int count) |
3656 | { | 3220 | { |
3657 | #if defined(CONFIG_ETRAX_RS485) | 3221 | #if defined(CONFIG_ETRAX_RS485) |
@@ -3678,7 +3242,7 @@ rs_write(struct tty_struct * tty, int from_user, | |||
3678 | } | 3242 | } |
3679 | #endif /* CONFIG_ETRAX_RS485 */ | 3243 | #endif /* CONFIG_ETRAX_RS485 */ |
3680 | 3244 | ||
3681 | count = rs_raw_write(tty, from_user, buf, count); | 3245 | count = rs_raw_write(tty, buf, count); |
3682 | 3246 | ||
3683 | #if defined(CONFIG_ETRAX_RS485) | 3247 | #if defined(CONFIG_ETRAX_RS485) |
3684 | if (info->rs485.enabled) | 3248 | if (info->rs485.enabled) |
@@ -3746,10 +3310,9 @@ rs_flush_buffer(struct tty_struct *tty) | |||
3746 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | 3310 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
3747 | unsigned long flags; | 3311 | unsigned long flags; |
3748 | 3312 | ||
3749 | save_flags(flags); | 3313 | local_irq_save(flags); |
3750 | cli(); | ||
3751 | info->xmit.head = info->xmit.tail = 0; | 3314 | info->xmit.head = info->xmit.tail = 0; |
3752 | restore_flags(flags); | 3315 | local_irq_restore(flags); |
3753 | 3316 | ||
3754 | tty_wakeup(tty); | 3317 | tty_wakeup(tty); |
3755 | } | 3318 | } |
@@ -3767,7 +3330,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch) | |||
3767 | { | 3330 | { |
3768 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | 3331 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
3769 | unsigned long flags; | 3332 | unsigned long flags; |
3770 | save_flags(flags); cli(); | 3333 | local_irq_save(flags); |
3771 | if (info->uses_dma_out) { | 3334 | if (info->uses_dma_out) { |
3772 | /* Put the DMA on hold and disable the channel */ | 3335 | /* Put the DMA on hold and disable the channel */ |
3773 | *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, hold); | 3336 | *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, hold); |
@@ -3784,7 +3347,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch) | |||
3784 | DFLOW(DEBUG_LOG(info->line, "rs_send_xchar 0x%02X\n", ch)); | 3347 | DFLOW(DEBUG_LOG(info->line, "rs_send_xchar 0x%02X\n", ch)); |
3785 | info->x_char = ch; | 3348 | info->x_char = ch; |
3786 | e100_enable_serial_tx_ready_irq(info); | 3349 | e100_enable_serial_tx_ready_irq(info); |
3787 | restore_flags(flags); | 3350 | local_irq_restore(flags); |
3788 | } | 3351 | } |
3789 | 3352 | ||
3790 | /* | 3353 | /* |
@@ -3996,21 +3559,61 @@ char *get_control_state_str(int MLines, char *s) | |||
3996 | } | 3559 | } |
3997 | #endif | 3560 | #endif |
3998 | 3561 | ||
3562 | static void | ||
3563 | rs_break(struct tty_struct *tty, int break_state) | ||
3564 | { | ||
3565 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | ||
3566 | unsigned long flags; | ||
3567 | |||
3568 | if (!info->port) | ||
3569 | return; | ||
3570 | |||
3571 | local_irq_save(flags); | ||
3572 | if (break_state == -1) { | ||
3573 | /* Go to manual mode and set the txd pin to 0 */ | ||
3574 | /* Clear bit 7 (txd) and 6 (tr_enable) */ | ||
3575 | info->tx_ctrl &= 0x3F; | ||
3576 | } else { | ||
3577 | /* Set bit 7 (txd) and 6 (tr_enable) */ | ||
3578 | info->tx_ctrl |= (0x80 | 0x40); | ||
3579 | } | ||
3580 | info->port[REG_TR_CTRL] = info->tx_ctrl; | ||
3581 | local_irq_restore(flags); | ||
3582 | } | ||
3583 | |||
3999 | static int | 3584 | static int |
4000 | get_modem_info(struct e100_serial * info, unsigned int *value) | 3585 | rs_tiocmset(struct tty_struct *tty, struct file *file, |
3586 | unsigned int set, unsigned int clear) | ||
4001 | { | 3587 | { |
4002 | unsigned int result; | 3588 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
4003 | /* Polarity isn't verified */ | ||
4004 | #if 0 /*def SERIAL_DEBUG_IO */ | ||
4005 | 3589 | ||
4006 | printk("get_modem_info: RTS: %i DTR: %i CD: %i RI: %i DSR: %i CTS: %i\n", | 3590 | if (clear & TIOCM_RTS) |
4007 | E100_RTS_GET(info), | 3591 | e100_rts(info, 0); |
4008 | E100_DTR_GET(info), | 3592 | if (clear & TIOCM_DTR) |
4009 | E100_CD_GET(info), | 3593 | e100_dtr(info, 0); |
4010 | E100_RI_GET(info), | 3594 | /* Handle FEMALE behaviour */ |
4011 | E100_DSR_GET(info), | 3595 | if (clear & TIOCM_RI) |
4012 | E100_CTS_GET(info)); | 3596 | e100_ri_out(info, 0); |
4013 | #endif | 3597 | if (clear & TIOCM_CD) |
3598 | e100_cd_out(info, 0); | ||
3599 | |||
3600 | if (set & TIOCM_RTS) | ||
3601 | e100_rts(info, 1); | ||
3602 | if (set & TIOCM_DTR) | ||
3603 | e100_dtr(info, 1); | ||
3604 | /* Handle FEMALE behaviour */ | ||
3605 | if (set & TIOCM_RI) | ||
3606 | e100_ri_out(info, 1); | ||
3607 | if (set & TIOCM_CD) | ||
3608 | e100_cd_out(info, 1); | ||
3609 | return 0; | ||
3610 | } | ||
3611 | |||
3612 | static int | ||
3613 | rs_tiocmget(struct tty_struct *tty, struct file *file) | ||
3614 | { | ||
3615 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | ||
3616 | unsigned int result; | ||
4014 | 3617 | ||
4015 | result = | 3618 | result = |
4016 | (!E100_RTS_GET(info) ? TIOCM_RTS : 0) | 3619 | (!E100_RTS_GET(info) ? TIOCM_RTS : 0) |
@@ -4021,95 +3624,20 @@ get_modem_info(struct e100_serial * info, unsigned int *value) | |||
4021 | | (!E100_CTS_GET(info) ? TIOCM_CTS : 0); | 3624 | | (!E100_CTS_GET(info) ? TIOCM_CTS : 0); |
4022 | 3625 | ||
4023 | #ifdef SERIAL_DEBUG_IO | 3626 | #ifdef SERIAL_DEBUG_IO |
4024 | printk("e100ser: modem state: %i 0x%08X\n", result, result); | 3627 | printk(KERN_DEBUG "ser%i: modem state: %i 0x%08X\n", |
3628 | info->line, result, result); | ||
4025 | { | 3629 | { |
4026 | char s[100]; | 3630 | char s[100]; |
4027 | 3631 | ||
4028 | get_control_state_str(result, s); | 3632 | get_control_state_str(result, s); |
4029 | printk("state: %s\n", s); | 3633 | printk(KERN_DEBUG "state: %s\n", s); |
4030 | } | 3634 | } |
4031 | #endif | 3635 | #endif |
4032 | if (copy_to_user(value, &result, sizeof(int))) | 3636 | return result; |
4033 | return -EFAULT; | ||
4034 | return 0; | ||
4035 | } | ||
4036 | 3637 | ||
4037 | |||
4038 | static int | ||
4039 | set_modem_info(struct e100_serial * info, unsigned int cmd, | ||
4040 | unsigned int *value) | ||
4041 | { | ||
4042 | unsigned int arg; | ||
4043 | |||
4044 | if (copy_from_user(&arg, value, sizeof(int))) | ||
4045 | return -EFAULT; | ||
4046 | |||
4047 | switch (cmd) { | ||
4048 | case TIOCMBIS: | ||
4049 | if (arg & TIOCM_RTS) { | ||
4050 | e100_rts(info, 1); | ||
4051 | } | ||
4052 | if (arg & TIOCM_DTR) { | ||
4053 | e100_dtr(info, 1); | ||
4054 | } | ||
4055 | /* Handle FEMALE behaviour */ | ||
4056 | if (arg & TIOCM_RI) { | ||
4057 | e100_ri_out(info, 1); | ||
4058 | } | ||
4059 | if (arg & TIOCM_CD) { | ||
4060 | e100_cd_out(info, 1); | ||
4061 | } | ||
4062 | break; | ||
4063 | case TIOCMBIC: | ||
4064 | if (arg & TIOCM_RTS) { | ||
4065 | e100_rts(info, 0); | ||
4066 | } | ||
4067 | if (arg & TIOCM_DTR) { | ||
4068 | e100_dtr(info, 0); | ||
4069 | } | ||
4070 | /* Handle FEMALE behaviour */ | ||
4071 | if (arg & TIOCM_RI) { | ||
4072 | e100_ri_out(info, 0); | ||
4073 | } | ||
4074 | if (arg & TIOCM_CD) { | ||
4075 | e100_cd_out(info, 0); | ||
4076 | } | ||
4077 | break; | ||
4078 | case TIOCMSET: | ||
4079 | e100_rts(info, arg & TIOCM_RTS); | ||
4080 | e100_dtr(info, arg & TIOCM_DTR); | ||
4081 | /* Handle FEMALE behaviour */ | ||
4082 | e100_ri_out(info, arg & TIOCM_RI); | ||
4083 | e100_cd_out(info, arg & TIOCM_CD); | ||
4084 | break; | ||
4085 | default: | ||
4086 | return -EINVAL; | ||
4087 | } | ||
4088 | return 0; | ||
4089 | } | 3638 | } |
4090 | 3639 | ||
4091 | 3640 | ||
4092 | static void | ||
4093 | rs_break(struct tty_struct *tty, int break_state) | ||
4094 | { | ||
4095 | struct e100_serial * info = (struct e100_serial *)tty->driver_data; | ||
4096 | unsigned long flags; | ||
4097 | |||
4098 | if (!info->port) | ||
4099 | return; | ||
4100 | |||
4101 | save_flags(flags); | ||
4102 | cli(); | ||
4103 | if (break_state == -1) { | ||
4104 | /* Go to manual mode and set the txd pin to 0 */ | ||
4105 | info->tx_ctrl &= 0x3F; /* Clear bit 7 (txd) and 6 (tr_enable) */ | ||
4106 | } else { | ||
4107 | info->tx_ctrl |= (0x80 | 0x40); /* Set bit 7 (txd) and 6 (tr_enable) */ | ||
4108 | } | ||
4109 | info->port[REG_TR_CTRL] = info->tx_ctrl; | ||
4110 | restore_flags(flags); | ||
4111 | } | ||
4112 | |||
4113 | static int | 3641 | static int |
4114 | rs_ioctl(struct tty_struct *tty, struct file * file, | 3642 | rs_ioctl(struct tty_struct *tty, struct file * file, |
4115 | unsigned int cmd, unsigned long arg) | 3643 | unsigned int cmd, unsigned long arg) |
@@ -4124,49 +3652,45 @@ rs_ioctl(struct tty_struct *tty, struct file * file, | |||
4124 | } | 3652 | } |
4125 | 3653 | ||
4126 | switch (cmd) { | 3654 | switch (cmd) { |
4127 | case TIOCMGET: | 3655 | case TIOCGSERIAL: |
4128 | return get_modem_info(info, (unsigned int *) arg); | 3656 | return get_serial_info(info, |
4129 | case TIOCMBIS: | 3657 | (struct serial_struct *) arg); |
4130 | case TIOCMBIC: | 3658 | case TIOCSSERIAL: |
4131 | case TIOCMSET: | 3659 | return set_serial_info(info, |
4132 | return set_modem_info(info, cmd, (unsigned int *) arg); | 3660 | (struct serial_struct *) arg); |
4133 | case TIOCGSERIAL: | 3661 | case TIOCSERGETLSR: /* Get line status register */ |
4134 | return get_serial_info(info, | 3662 | return get_lsr_info(info, (unsigned int *) arg); |
4135 | (struct serial_struct *) arg); | 3663 | |
4136 | case TIOCSSERIAL: | 3664 | case TIOCSERGSTRUCT: |
4137 | return set_serial_info(info, | 3665 | if (copy_to_user((struct e100_serial *) arg, |
4138 | (struct serial_struct *) arg); | 3666 | info, sizeof(struct e100_serial))) |
4139 | case TIOCSERGETLSR: /* Get line status register */ | 3667 | return -EFAULT; |
4140 | return get_lsr_info(info, (unsigned int *) arg); | 3668 | return 0; |
4141 | |||
4142 | case TIOCSERGSTRUCT: | ||
4143 | if (copy_to_user((struct e100_serial *) arg, | ||
4144 | info, sizeof(struct e100_serial))) | ||
4145 | return -EFAULT; | ||
4146 | return 0; | ||
4147 | 3669 | ||
4148 | #if defined(CONFIG_ETRAX_RS485) | 3670 | #if defined(CONFIG_ETRAX_RS485) |
4149 | case TIOCSERSETRS485: | 3671 | case TIOCSERSETRS485: |
4150 | { | 3672 | { |
4151 | struct rs485_control rs485ctrl; | 3673 | struct rs485_control rs485ctrl; |
4152 | if (copy_from_user(&rs485ctrl, (struct rs485_control*)arg, sizeof(rs485ctrl))) | 3674 | if (copy_from_user(&rs485ctrl, (struct rs485_control *)arg, |
4153 | return -EFAULT; | 3675 | sizeof(rs485ctrl))) |
3676 | return -EFAULT; | ||
4154 | 3677 | ||
4155 | return e100_enable_rs485(tty, &rs485ctrl); | 3678 | return e100_enable_rs485(tty, &rs485ctrl); |
4156 | } | 3679 | } |
4157 | 3680 | ||
4158 | case TIOCSERWRRS485: | 3681 | case TIOCSERWRRS485: |
4159 | { | 3682 | { |
4160 | struct rs485_write rs485wr; | 3683 | struct rs485_write rs485wr; |
4161 | if (copy_from_user(&rs485wr, (struct rs485_write*)arg, sizeof(rs485wr))) | 3684 | if (copy_from_user(&rs485wr, (struct rs485_write *)arg, |
4162 | return -EFAULT; | 3685 | sizeof(rs485wr))) |
3686 | return -EFAULT; | ||
4163 | 3687 | ||
4164 | return e100_write_rs485(tty, 1, rs485wr.outc, rs485wr.outc_size); | 3688 | return e100_write_rs485(tty, rs485wr.outc, rs485wr.outc_size); |
4165 | } | 3689 | } |
4166 | #endif | 3690 | #endif |
4167 | 3691 | ||
4168 | default: | 3692 | default: |
4169 | return -ENOIOCTLCMD; | 3693 | return -ENOIOCTLCMD; |
4170 | } | 3694 | } |
4171 | return 0; | 3695 | return 0; |
4172 | } | 3696 | } |
@@ -4191,46 +3715,6 @@ rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
4191 | 3715 | ||
4192 | } | 3716 | } |
4193 | 3717 | ||
4194 | /* In debugport.c - register a console write function that uses the normal | ||
4195 | * serial driver | ||
4196 | */ | ||
4197 | typedef int (*debugport_write_function)(int i, const char *buf, unsigned int len); | ||
4198 | |||
4199 | extern debugport_write_function debug_write_function; | ||
4200 | |||
4201 | static int rs_debug_write_function(int i, const char *buf, unsigned int len) | ||
4202 | { | ||
4203 | int cnt; | ||
4204 | int written = 0; | ||
4205 | struct tty_struct *tty; | ||
4206 | static int recurse_cnt = 0; | ||
4207 | |||
4208 | tty = rs_table[i].tty; | ||
4209 | if (tty) { | ||
4210 | unsigned long flags; | ||
4211 | if (recurse_cnt > 5) /* We skip this debug output */ | ||
4212 | return 1; | ||
4213 | |||
4214 | local_irq_save(flags); | ||
4215 | recurse_cnt++; | ||
4216 | local_irq_restore(flags); | ||
4217 | do { | ||
4218 | cnt = rs_write(tty, 0, buf + written, len); | ||
4219 | if (cnt >= 0) { | ||
4220 | written += cnt; | ||
4221 | buf += cnt; | ||
4222 | len -= cnt; | ||
4223 | } else | ||
4224 | len = cnt; | ||
4225 | } while(len > 0); | ||
4226 | local_irq_save(flags); | ||
4227 | recurse_cnt--; | ||
4228 | local_irq_restore(flags); | ||
4229 | return 1; | ||
4230 | } | ||
4231 | return 0; | ||
4232 | } | ||
4233 | |||
4234 | /* | 3718 | /* |
4235 | * ------------------------------------------------------------ | 3719 | * ------------------------------------------------------------ |
4236 | * rs_close() | 3720 | * rs_close() |
@@ -4252,11 +3736,10 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
4252 | 3736 | ||
4253 | /* interrupts are disabled for this entire function */ | 3737 | /* interrupts are disabled for this entire function */ |
4254 | 3738 | ||
4255 | save_flags(flags); | 3739 | local_irq_save(flags); |
4256 | cli(); | ||
4257 | 3740 | ||
4258 | if (tty_hung_up_p(filp)) { | 3741 | if (tty_hung_up_p(filp)) { |
4259 | restore_flags(flags); | 3742 | local_irq_restore(flags); |
4260 | return; | 3743 | return; |
4261 | } | 3744 | } |
4262 | 3745 | ||
@@ -4283,7 +3766,7 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
4283 | info->count = 0; | 3766 | info->count = 0; |
4284 | } | 3767 | } |
4285 | if (info->count) { | 3768 | if (info->count) { |
4286 | restore_flags(flags); | 3769 | local_irq_restore(flags); |
4287 | return; | 3770 | return; |
4288 | } | 3771 | } |
4289 | info->flags |= ASYNC_CLOSING; | 3772 | info->flags |= ASYNC_CLOSING; |
@@ -4337,7 +3820,7 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
4337 | } | 3820 | } |
4338 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 3821 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
4339 | wake_up_interruptible(&info->close_wait); | 3822 | wake_up_interruptible(&info->close_wait); |
4340 | restore_flags(flags); | 3823 | local_irq_restore(flags); |
4341 | 3824 | ||
4342 | /* port closed */ | 3825 | /* port closed */ |
4343 | 3826 | ||
@@ -4359,6 +3842,28 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
4359 | #endif | 3842 | #endif |
4360 | } | 3843 | } |
4361 | #endif | 3844 | #endif |
3845 | |||
3846 | /* | ||
3847 | * Release any allocated DMA irq's. | ||
3848 | */ | ||
3849 | if (info->dma_in_enabled) { | ||
3850 | free_irq(info->dma_in_irq_nbr, info); | ||
3851 | cris_free_dma(info->dma_in_nbr, info->dma_in_irq_description); | ||
3852 | info->uses_dma_in = 0; | ||
3853 | #ifdef SERIAL_DEBUG_OPEN | ||
3854 | printk(KERN_DEBUG "DMA irq '%s' freed\n", | ||
3855 | info->dma_in_irq_description); | ||
3856 | #endif | ||
3857 | } | ||
3858 | if (info->dma_out_enabled) { | ||
3859 | free_irq(info->dma_out_irq_nbr, info); | ||
3860 | cris_free_dma(info->dma_out_nbr, info->dma_out_irq_description); | ||
3861 | info->uses_dma_out = 0; | ||
3862 | #ifdef SERIAL_DEBUG_OPEN | ||
3863 | printk(KERN_DEBUG "DMA irq '%s' freed\n", | ||
3864 | info->dma_out_irq_description); | ||
3865 | #endif | ||
3866 | } | ||
4362 | } | 3867 | } |
4363 | 3868 | ||
4364 | /* | 3869 | /* |
@@ -4433,8 +3938,8 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
4433 | */ | 3938 | */ |
4434 | if (tty_hung_up_p(filp) || | 3939 | if (tty_hung_up_p(filp) || |
4435 | (info->flags & ASYNC_CLOSING)) { | 3940 | (info->flags & ASYNC_CLOSING)) { |
4436 | if (info->flags & ASYNC_CLOSING) | 3941 | wait_event_interruptible(info->close_wait, |
4437 | interruptible_sleep_on(&info->close_wait); | 3942 | !(info->flags & ASYNC_CLOSING)); |
4438 | #ifdef SERIAL_DO_RESTART | 3943 | #ifdef SERIAL_DO_RESTART |
4439 | if (info->flags & ASYNC_HUP_NOTIFY) | 3944 | if (info->flags & ASYNC_HUP_NOTIFY) |
4440 | return -EAGAIN; | 3945 | return -EAGAIN; |
@@ -4472,21 +3977,19 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
4472 | printk("block_til_ready before block: ttyS%d, count = %d\n", | 3977 | printk("block_til_ready before block: ttyS%d, count = %d\n", |
4473 | info->line, info->count); | 3978 | info->line, info->count); |
4474 | #endif | 3979 | #endif |
4475 | save_flags(flags); | 3980 | local_irq_save(flags); |
4476 | cli(); | ||
4477 | if (!tty_hung_up_p(filp)) { | 3981 | if (!tty_hung_up_p(filp)) { |
4478 | extra_count++; | 3982 | extra_count++; |
4479 | info->count--; | 3983 | info->count--; |
4480 | } | 3984 | } |
4481 | restore_flags(flags); | 3985 | local_irq_restore(flags); |
4482 | info->blocked_open++; | 3986 | info->blocked_open++; |
4483 | while (1) { | 3987 | while (1) { |
4484 | save_flags(flags); | 3988 | local_irq_save(flags); |
4485 | cli(); | ||
4486 | /* assert RTS and DTR */ | 3989 | /* assert RTS and DTR */ |
4487 | e100_rts(info, 1); | 3990 | e100_rts(info, 1); |
4488 | e100_dtr(info, 1); | 3991 | e100_dtr(info, 1); |
4489 | restore_flags(flags); | 3992 | local_irq_restore(flags); |
4490 | set_current_state(TASK_INTERRUPTIBLE); | 3993 | set_current_state(TASK_INTERRUPTIBLE); |
4491 | if (tty_hung_up_p(filp) || | 3994 | if (tty_hung_up_p(filp) || |
4492 | !(info->flags & ASYNC_INITIALIZED)) { | 3995 | !(info->flags & ASYNC_INITIALIZED)) { |
@@ -4528,6 +4031,19 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
4528 | return 0; | 4031 | return 0; |
4529 | } | 4032 | } |
4530 | 4033 | ||
4034 | static void | ||
4035 | deinit_port(struct e100_serial *info) | ||
4036 | { | ||
4037 | if (info->dma_out_enabled) { | ||
4038 | cris_free_dma(info->dma_out_nbr, info->dma_out_irq_description); | ||
4039 | free_irq(info->dma_out_irq_nbr, info); | ||
4040 | } | ||
4041 | if (info->dma_in_enabled) { | ||
4042 | cris_free_dma(info->dma_in_nbr, info->dma_in_irq_description); | ||
4043 | free_irq(info->dma_in_irq_nbr, info); | ||
4044 | } | ||
4045 | } | ||
4046 | |||
4531 | /* | 4047 | /* |
4532 | * This routine is called whenever a serial port is opened. | 4048 | * This routine is called whenever a serial port is opened. |
4533 | * It performs the serial-specific initialization for the tty structure. | 4049 | * It performs the serial-specific initialization for the tty structure. |
@@ -4538,9 +4054,9 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4538 | struct e100_serial *info; | 4054 | struct e100_serial *info; |
4539 | int retval, line; | 4055 | int retval, line; |
4540 | unsigned long page; | 4056 | unsigned long page; |
4057 | int allocated_resources = 0; | ||
4541 | 4058 | ||
4542 | /* find which port we want to open */ | 4059 | /* find which port we want to open */ |
4543 | |||
4544 | line = tty->index; | 4060 | line = tty->index; |
4545 | 4061 | ||
4546 | if (line < 0 || line >= NR_PORTS) | 4062 | if (line < 0 || line >= NR_PORTS) |
@@ -4580,8 +4096,8 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4580 | */ | 4096 | */ |
4581 | if (tty_hung_up_p(filp) || | 4097 | if (tty_hung_up_p(filp) || |
4582 | (info->flags & ASYNC_CLOSING)) { | 4098 | (info->flags & ASYNC_CLOSING)) { |
4583 | if (info->flags & ASYNC_CLOSING) | 4099 | wait_event_interruptible(info->close_wait, |
4584 | interruptible_sleep_on(&info->close_wait); | 4100 | !(info->flags & ASYNC_CLOSING)); |
4585 | #ifdef SERIAL_DO_RESTART | 4101 | #ifdef SERIAL_DO_RESTART |
4586 | return ((info->flags & ASYNC_HUP_NOTIFY) ? | 4102 | return ((info->flags & ASYNC_HUP_NOTIFY) ? |
4587 | -EAGAIN : -ERESTARTSYS); | 4103 | -EAGAIN : -ERESTARTSYS); |
@@ -4591,12 +4107,85 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4591 | } | 4107 | } |
4592 | 4108 | ||
4593 | /* | 4109 | /* |
4110 | * If DMA is enabled try to allocate the irq's. | ||
4111 | */ | ||
4112 | if (info->count == 1) { | ||
4113 | allocated_resources = 1; | ||
4114 | if (info->dma_in_enabled) { | ||
4115 | if (request_irq(info->dma_in_irq_nbr, | ||
4116 | rec_interrupt, | ||
4117 | info->dma_in_irq_flags, | ||
4118 | info->dma_in_irq_description, | ||
4119 | info)) { | ||
4120 | printk(KERN_WARNING "DMA irq '%s' busy; " | ||
4121 | "falling back to non-DMA mode\n", | ||
4122 | info->dma_in_irq_description); | ||
4123 | /* Make sure we never try to use DMA in */ | ||
4124 | /* for the port again. */ | ||
4125 | info->dma_in_enabled = 0; | ||
4126 | } else if (cris_request_dma(info->dma_in_nbr, | ||
4127 | info->dma_in_irq_description, | ||
4128 | DMA_VERBOSE_ON_ERROR, | ||
4129 | info->dma_owner)) { | ||
4130 | free_irq(info->dma_in_irq_nbr, info); | ||
4131 | printk(KERN_WARNING "DMA '%s' busy; " | ||
4132 | "falling back to non-DMA mode\n", | ||
4133 | info->dma_in_irq_description); | ||
4134 | /* Make sure we never try to use DMA in */ | ||
4135 | /* for the port again. */ | ||
4136 | info->dma_in_enabled = 0; | ||
4137 | } | ||
4138 | #ifdef SERIAL_DEBUG_OPEN | ||
4139 | else | ||
4140 | printk(KERN_DEBUG "DMA irq '%s' allocated\n", | ||
4141 | info->dma_in_irq_description); | ||
4142 | #endif | ||
4143 | } | ||
4144 | if (info->dma_out_enabled) { | ||
4145 | if (request_irq(info->dma_out_irq_nbr, | ||
4146 | tr_interrupt, | ||
4147 | info->dma_out_irq_flags, | ||
4148 | info->dma_out_irq_description, | ||
4149 | info)) { | ||
4150 | printk(KERN_WARNING "DMA irq '%s' busy; " | ||
4151 | "falling back to non-DMA mode\n", | ||
4152 | info->dma_out_irq_description); | ||
4153 | /* Make sure we never try to use DMA out */ | ||
4154 | /* for the port again. */ | ||
4155 | info->dma_out_enabled = 0; | ||
4156 | } else if (cris_request_dma(info->dma_out_nbr, | ||
4157 | info->dma_out_irq_description, | ||
4158 | DMA_VERBOSE_ON_ERROR, | ||
4159 | info->dma_owner)) { | ||
4160 | free_irq(info->dma_out_irq_nbr, info); | ||
4161 | printk(KERN_WARNING "DMA '%s' busy; " | ||
4162 | "falling back to non-DMA mode\n", | ||
4163 | info->dma_out_irq_description); | ||
4164 | /* Make sure we never try to use DMA out */ | ||
4165 | /* for the port again. */ | ||
4166 | info->dma_out_enabled = 0; | ||
4167 | } | ||
4168 | #ifdef SERIAL_DEBUG_OPEN | ||
4169 | else | ||
4170 | printk(KERN_DEBUG "DMA irq '%s' allocated\n", | ||
4171 | info->dma_out_irq_description); | ||
4172 | #endif | ||
4173 | } | ||
4174 | } | ||
4175 | |||
4176 | /* | ||
4594 | * Start up the serial port | 4177 | * Start up the serial port |
4595 | */ | 4178 | */ |
4596 | 4179 | ||
4597 | retval = startup(info); | 4180 | retval = startup(info); |
4598 | if (retval) | 4181 | if (retval) { |
4182 | if (allocated_resources) | ||
4183 | deinit_port(info); | ||
4184 | |||
4185 | /* FIXME Decrease count info->count here too? */ | ||
4599 | return retval; | 4186 | return retval; |
4187 | } | ||
4188 | |||
4600 | 4189 | ||
4601 | retval = block_til_ready(tty, filp, info); | 4190 | retval = block_til_ready(tty, filp, info); |
4602 | if (retval) { | 4191 | if (retval) { |
@@ -4604,6 +4193,9 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4604 | printk("rs_open returning after block_til_ready with %d\n", | 4193 | printk("rs_open returning after block_til_ready with %d\n", |
4605 | retval); | 4194 | retval); |
4606 | #endif | 4195 | #endif |
4196 | if (allocated_resources) | ||
4197 | deinit_port(info); | ||
4198 | |||
4607 | return retval; | 4199 | return retval; |
4608 | } | 4200 | } |
4609 | 4201 | ||
@@ -4793,6 +4385,8 @@ static const struct tty_operations rs_ops = { | |||
4793 | .send_xchar = rs_send_xchar, | 4385 | .send_xchar = rs_send_xchar, |
4794 | .wait_until_sent = rs_wait_until_sent, | 4386 | .wait_until_sent = rs_wait_until_sent, |
4795 | .read_proc = rs_read_proc, | 4387 | .read_proc = rs_read_proc, |
4388 | .tiocmget = rs_tiocmget, | ||
4389 | .tiocmset = rs_tiocmset | ||
4796 | }; | 4390 | }; |
4797 | 4391 | ||
4798 | static int __init | 4392 | static int __init |
@@ -4810,9 +4404,27 @@ rs_init(void) | |||
4810 | /* Setup the timed flush handler system */ | 4404 | /* Setup the timed flush handler system */ |
4811 | 4405 | ||
4812 | #if !defined(CONFIG_ETRAX_SERIAL_FAST_TIMER) | 4406 | #if !defined(CONFIG_ETRAX_SERIAL_FAST_TIMER) |
4813 | init_timer(&flush_timer); | 4407 | setup_timer(&flush_timer, timed_flush_handler, 0); |
4814 | flush_timer.function = timed_flush_handler; | 4408 | mod_timer(&flush_timer, jiffies + 5); |
4815 | mod_timer(&flush_timer, jiffies + CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS); | 4409 | #endif |
4410 | |||
4411 | #if defined(CONFIG_ETRAX_RS485) | ||
4412 | #if defined(CONFIG_ETRAX_RS485_ON_PA) | ||
4413 | if (cris_io_interface_allocate_pins(if_ser0, 'a', rs485_pa_bit, | ||
4414 | rs485_pa_bit)) { | ||
4415 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " | ||
4416 | "RS485 pin\n"); | ||
4417 | return -EBUSY; | ||
4418 | } | ||
4419 | #endif | ||
4420 | #if defined(CONFIG_ETRAX_RS485_ON_PORT_G) | ||
4421 | if (cris_io_interface_allocate_pins(if_ser0, 'g', rs485_pa_bit, | ||
4422 | rs485_port_g_bit)) { | ||
4423 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " | ||
4424 | "RS485 pin\n"); | ||
4425 | return -EBUSY; | ||
4426 | } | ||
4427 | #endif | ||
4816 | #endif | 4428 | #endif |
4817 | 4429 | ||
4818 | /* Initialize the tty_driver structure */ | 4430 | /* Initialize the tty_driver structure */ |
@@ -4839,6 +4451,16 @@ rs_init(void) | |||
4839 | /* do some initializing for the separate ports */ | 4451 | /* do some initializing for the separate ports */ |
4840 | 4452 | ||
4841 | for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) { | 4453 | for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) { |
4454 | if (info->enabled) { | ||
4455 | if (cris_request_io_interface(info->io_if, | ||
4456 | info->io_if_description)) { | ||
4457 | printk(KERN_CRIT "ETRAX100LX async serial: " | ||
4458 | "Could not allocate IO pins for " | ||
4459 | "%s, port %d\n", | ||
4460 | info->io_if_description, i); | ||
4461 | info->enabled = 0; | ||
4462 | } | ||
4463 | } | ||
4842 | info->uses_dma_in = 0; | 4464 | info->uses_dma_in = 0; |
4843 | info->uses_dma_out = 0; | 4465 | info->uses_dma_out = 0; |
4844 | info->line = i; | 4466 | info->line = i; |
@@ -4872,7 +4494,7 @@ rs_init(void) | |||
4872 | info->rs485.delay_rts_before_send = 0; | 4494 | info->rs485.delay_rts_before_send = 0; |
4873 | info->rs485.enabled = 0; | 4495 | info->rs485.enabled = 0; |
4874 | #endif | 4496 | #endif |
4875 | INIT_WORK(&info->work, do_softint, info); | 4497 | INIT_WORK(&info->work, do_softint); |
4876 | 4498 | ||
4877 | if (info->enabled) { | 4499 | if (info->enabled) { |
4878 | printk(KERN_INFO "%s%d at 0x%x is a builtin UART with DMA\n", | 4500 | printk(KERN_INFO "%s%d at 0x%x is a builtin UART with DMA\n", |
@@ -4890,64 +4512,17 @@ rs_init(void) | |||
4890 | #endif | 4512 | #endif |
4891 | 4513 | ||
4892 | #ifndef CONFIG_SVINTO_SIM | 4514 | #ifndef CONFIG_SVINTO_SIM |
4515 | #ifndef CONFIG_ETRAX_KGDB | ||
4893 | /* Not needed in simulator. May only complicate stuff. */ | 4516 | /* Not needed in simulator. May only complicate stuff. */ |
4894 | /* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */ | 4517 | /* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */ |
4895 | 4518 | ||
4896 | if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial ", NULL)) | 4519 | if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, |
4897 | panic("irq8"); | 4520 | IRQF_SHARED | IRQF_DISABLED, "serial ", driver)) |
4898 | 4521 | panic("%s: Failed to request irq8", __FUNCTION__); | |
4899 | #ifdef CONFIG_ETRAX_SERIAL_PORT0 | ||
4900 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT | ||
4901 | if (request_irq(SER0_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_DISABLED, "serial 0 dma tr", NULL)) | ||
4902 | panic("irq22"); | ||
4903 | #endif | ||
4904 | #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN | ||
4905 | if (request_irq(SER0_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_DISABLED, "serial 0 dma rec", NULL)) | ||
4906 | panic("irq23"); | ||
4907 | #endif | ||
4908 | #endif | ||
4909 | |||
4910 | #ifdef CONFIG_ETRAX_SERIAL_PORT1 | ||
4911 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT | ||
4912 | if (request_irq(SER1_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_DISABLED, "serial 1 dma tr", NULL)) | ||
4913 | panic("irq24"); | ||
4914 | #endif | ||
4915 | #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN | ||
4916 | if (request_irq(SER1_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_DISABLED, "serial 1 dma rec", NULL)) | ||
4917 | panic("irq25"); | ||
4918 | #endif | ||
4919 | #endif | ||
4920 | #ifdef CONFIG_ETRAX_SERIAL_PORT2 | ||
4921 | /* DMA Shared with par0 (and SCSI0 and ATA) */ | ||
4922 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT | ||
4923 | if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 2 dma tr", NULL)) | ||
4924 | panic("irq18"); | ||
4925 | #endif | ||
4926 | #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN | ||
4927 | if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 2 dma rec", NULL)) | ||
4928 | panic("irq19"); | ||
4929 | #endif | ||
4930 | #endif | ||
4931 | #ifdef CONFIG_ETRAX_SERIAL_PORT3 | ||
4932 | /* DMA Shared with par1 (and SCSI1 and Extern DMA 0) */ | ||
4933 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT | ||
4934 | if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 3 dma tr", NULL)) | ||
4935 | panic("irq20"); | ||
4936 | #endif | ||
4937 | #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN | ||
4938 | if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 3 dma rec", NULL)) | ||
4939 | panic("irq21"); | ||
4940 | #endif | ||
4941 | #endif | ||
4942 | 4522 | ||
4943 | #ifdef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST | ||
4944 | if (request_irq(TIMER1_IRQ_NBR, timeout_interrupt, IRQF_SHARED | IRQF_DISABLED, | ||
4945 | "fast serial dma timeout", NULL)) { | ||
4946 | printk(KERN_CRIT "err: timer1 irq\n"); | ||
4947 | } | ||
4948 | #endif | 4523 | #endif |
4949 | #endif /* CONFIG_SVINTO_SIM */ | 4524 | #endif /* CONFIG_SVINTO_SIM */ |
4950 | debug_write_function = rs_debug_write_function; | 4525 | |
4951 | return 0; | 4526 | return 0; |
4952 | } | 4527 | } |
4953 | 4528 | ||
diff --git a/drivers/serial/crisv10.h b/drivers/serial/crisv10.h new file mode 100644 index 000000000000..ccd0f32b7372 --- /dev/null +++ b/drivers/serial/crisv10.h | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | * serial.h: Arch-dep definitions for the Etrax100 serial driver. | ||
3 | * | ||
4 | * Copyright (C) 1998-2007 Axis Communications AB | ||
5 | */ | ||
6 | |||
7 | #ifndef _ETRAX_SERIAL_H | ||
8 | #define _ETRAX_SERIAL_H | ||
9 | |||
10 | #include <linux/circ_buf.h> | ||
11 | #include <asm/termios.h> | ||
12 | #include <asm/dma.h> | ||
13 | #include <asm/arch/io_interface_mux.h> | ||
14 | |||
15 | /* Software state per channel */ | ||
16 | |||
17 | #ifdef __KERNEL__ | ||
18 | /* | ||
19 | * This is our internal structure for each serial port's state. | ||
20 | * | ||
21 | * Many fields are paralleled by the structure used by the serial_struct | ||
22 | * structure. | ||
23 | * | ||
24 | * For definitions of the flags field, see tty.h | ||
25 | */ | ||
26 | |||
27 | #define SERIAL_RECV_DESCRIPTORS 8 | ||
28 | |||
29 | struct etrax_recv_buffer { | ||
30 | struct etrax_recv_buffer *next; | ||
31 | unsigned short length; | ||
32 | unsigned char error; | ||
33 | unsigned char pad; | ||
34 | |||
35 | unsigned char buffer[0]; | ||
36 | }; | ||
37 | |||
38 | struct e100_serial { | ||
39 | int baud; | ||
40 | volatile u8 *port; /* R_SERIALx_CTRL */ | ||
41 | u32 irq; /* bitnr in R_IRQ_MASK2 for dmaX_descr */ | ||
42 | |||
43 | /* Output registers */ | ||
44 | volatile u8 *oclrintradr; /* adr to R_DMA_CHx_CLR_INTR */ | ||
45 | volatile u32 *ofirstadr; /* adr to R_DMA_CHx_FIRST */ | ||
46 | volatile u8 *ocmdadr; /* adr to R_DMA_CHx_CMD */ | ||
47 | const volatile u8 *ostatusadr; /* adr to R_DMA_CHx_STATUS */ | ||
48 | |||
49 | /* Input registers */ | ||
50 | volatile u8 *iclrintradr; /* adr to R_DMA_CHx_CLR_INTR */ | ||
51 | volatile u32 *ifirstadr; /* adr to R_DMA_CHx_FIRST */ | ||
52 | volatile u8 *icmdadr; /* adr to R_DMA_CHx_CMD */ | ||
53 | volatile u32 *idescradr; /* adr to R_DMA_CHx_DESCR */ | ||
54 | |||
55 | int flags; /* defined in tty.h */ | ||
56 | |||
57 | u8 rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */ | ||
58 | u8 tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */ | ||
59 | u8 iseteop; /* bit number for R_SET_EOP for the input dma */ | ||
60 | int enabled; /* Set to 1 if the port is enabled in HW config */ | ||
61 | |||
62 | u8 dma_out_enabled; /* Set to 1 if DMA should be used */ | ||
63 | u8 dma_in_enabled; /* Set to 1 if DMA should be used */ | ||
64 | |||
65 | /* end of fields defined in rs_table[] in .c-file */ | ||
66 | int dma_owner; | ||
67 | unsigned int dma_in_nbr; | ||
68 | unsigned int dma_out_nbr; | ||
69 | unsigned int dma_in_irq_nbr; | ||
70 | unsigned int dma_out_irq_nbr; | ||
71 | unsigned long dma_in_irq_flags; | ||
72 | unsigned long dma_out_irq_flags; | ||
73 | char *dma_in_irq_description; | ||
74 | char *dma_out_irq_description; | ||
75 | |||
76 | enum cris_io_interface io_if; | ||
77 | char *io_if_description; | ||
78 | |||
79 | u8 uses_dma_in; /* Set to 1 if DMA is used */ | ||
80 | u8 uses_dma_out; /* Set to 1 if DMA is used */ | ||
81 | u8 forced_eop; /* a fifo eop has been forced */ | ||
82 | int baud_base; /* For special baudrates */ | ||
83 | int custom_divisor; /* For special baudrates */ | ||
84 | struct etrax_dma_descr tr_descr; | ||
85 | struct etrax_dma_descr rec_descr[SERIAL_RECV_DESCRIPTORS]; | ||
86 | int cur_rec_descr; | ||
87 | |||
88 | volatile int tr_running; /* 1 if output is running */ | ||
89 | |||
90 | struct tty_struct *tty; | ||
91 | int read_status_mask; | ||
92 | int ignore_status_mask; | ||
93 | int x_char; /* xon/xoff character */ | ||
94 | int close_delay; | ||
95 | unsigned short closing_wait; | ||
96 | unsigned short closing_wait2; | ||
97 | unsigned long event; | ||
98 | unsigned long last_active; | ||
99 | int line; | ||
100 | int type; /* PORT_ETRAX */ | ||
101 | int count; /* # of fd on device */ | ||
102 | int blocked_open; /* # of blocked opens */ | ||
103 | struct circ_buf xmit; | ||
104 | struct etrax_recv_buffer *first_recv_buffer; | ||
105 | struct etrax_recv_buffer *last_recv_buffer; | ||
106 | unsigned int recv_cnt; | ||
107 | unsigned int max_recv_cnt; | ||
108 | |||
109 | struct work_struct work; | ||
110 | struct async_icount icount; /* error-statistics etc.*/ | ||
111 | struct ktermios normal_termios; | ||
112 | struct ktermios callout_termios; | ||
113 | wait_queue_head_t open_wait; | ||
114 | wait_queue_head_t close_wait; | ||
115 | |||
116 | unsigned long char_time_usec; /* The time for 1 char, in usecs */ | ||
117 | unsigned long flush_time_usec; /* How often we should flush */ | ||
118 | unsigned long last_tx_active_usec; /* Last tx usec in the jiffies */ | ||
119 | unsigned long last_tx_active; /* Last tx time in jiffies */ | ||
120 | unsigned long last_rx_active_usec; /* Last rx usec in the jiffies */ | ||
121 | unsigned long last_rx_active; /* Last rx time in jiffies */ | ||
122 | |||
123 | int break_detected_cnt; | ||
124 | int errorcode; | ||
125 | |||
126 | #ifdef CONFIG_ETRAX_RS485 | ||
127 | struct rs485_control rs485; /* RS-485 support */ | ||
128 | #endif | ||
129 | }; | ||
130 | |||
131 | /* this PORT is not in the standard serial.h. it's not actually used for | ||
132 | * anything since we only have one type of async serial-port anyway in this | ||
133 | * system. | ||
134 | */ | ||
135 | |||
136 | #define PORT_ETRAX 1 | ||
137 | |||
138 | /* | ||
139 | * Events are used to schedule things to happen at timer-interrupt | ||
140 | * time, instead of at rs interrupt time. | ||
141 | */ | ||
142 | #define RS_EVENT_WRITE_WAKEUP 0 | ||
143 | |||
144 | #endif /* __KERNEL__ */ | ||
145 | |||
146 | #endif /* !_ETRAX_SERIAL_H */ | ||
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 5afcb2fa7cd3..d8b660061c13 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -345,7 +345,7 @@ static int serial_probe(struct pcmcia_device *link) | |||
345 | 345 | ||
346 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 346 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
347 | link->io.NumPorts1 = 8; | 347 | link->io.NumPorts1 = 8; |
348 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 348 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
349 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 349 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; |
350 | link->conf.Attributes = CONF_ENABLE_IRQ; | 350 | link->conf.Attributes = CONF_ENABLE_IRQ; |
351 | if (do_sound) { | 351 | if (do_sound) { |
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c index 6846a6c38b6d..7ad21925869a 100644 --- a/drivers/serial/serial_txx9.c +++ b/drivers/serial/serial_txx9.c | |||
@@ -657,7 +657,15 @@ static void | |||
657 | serial_txx9_pm(struct uart_port *port, unsigned int state, | 657 | serial_txx9_pm(struct uart_port *port, unsigned int state, |
658 | unsigned int oldstate) | 658 | unsigned int oldstate) |
659 | { | 659 | { |
660 | if (state == 0) | 660 | /* |
661 | * If oldstate was -1 this is called from | ||
662 | * uart_configure_port(). In this case do not initialize the | ||
663 | * port now, because the port was already initialized (for | ||
664 | * non-console port) or should not be initialized here (for | ||
665 | * console port). If we initialized the port here we lose | ||
666 | * serial console settings. | ||
667 | */ | ||
668 | if (state == 0 && oldstate != -1) | ||
661 | serial_txx9_initialize(port); | 669 | serial_txx9_initialize(port); |
662 | } | 670 | } |
663 | 671 | ||
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index e89ae29645d6..d24621ce799a 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -77,7 +77,6 @@ | |||
77 | # define SCIF_ONLY | 77 | # define SCIF_ONLY |
78 | #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) | 78 | #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) |
79 | # define SCSPTR0 0xA4400000 /* 16 bit SCIF */ | 79 | # define SCSPTR0 0xA4400000 /* 16 bit SCIF */ |
80 | # define SCI_NPORTS 2 | ||
81 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 80 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
82 | # define PACR 0xa4050100 | 81 | # define PACR 0xa4050100 |
83 | # define PBCR 0xa4050102 | 82 | # define PBCR 0xa4050102 |
@@ -102,12 +101,6 @@ | |||
102 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 101 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
103 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 102 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
104 | # define SCIF_ONLY | 103 | # define SCIF_ONLY |
105 | #elif defined(CONFIG_CPU_SUBTYPE_ST40STB1) | ||
106 | # define SCSPTR1 0xffe00020 /* 16 bit SCIF */ | ||
107 | # define SCSPTR2 0xffe80020 /* 16 bit SCIF */ | ||
108 | # define SCIF_ORER 0x0001 /* overrun error bit */ | ||
109 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
110 | # define SCIF_ONLY | ||
111 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) | 104 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) |
112 | # include <asm/hardware.h> | 105 | # include <asm/hardware.h> |
113 | # define SCIF_BASE_ADDR 0x01030000 | 106 | # define SCIF_BASE_ADDR 0x01030000 |
@@ -116,8 +109,7 @@ | |||
116 | # define SCIF_LSR2_OFFS 0x0000024 | 109 | # define SCIF_LSR2_OFFS 0x0000024 |
117 | # define SCSPTR2 ((port->mapbase)+SCIF_PTR2_OFFS) /* 16 bit SCIF */ | 110 | # define SCSPTR2 ((port->mapbase)+SCIF_PTR2_OFFS) /* 16 bit SCIF */ |
118 | # define SCLSR2 ((port->mapbase)+SCIF_LSR2_OFFS) /* 16 bit SCIF */ | 111 | # define SCLSR2 ((port->mapbase)+SCIF_LSR2_OFFS) /* 16 bit SCIF */ |
119 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0, | 112 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0, TE=1,RE=1,REIE=1 */ |
120 | TE=1,RE=1,REIE=1 */ | ||
121 | # define SCIF_ONLY | 113 | # define SCIF_ONLY |
122 | #elif defined(CONFIG_H83007) || defined(CONFIG_H83068) | 114 | #elif defined(CONFIG_H83007) || defined(CONFIG_H83068) |
123 | # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ | 115 | # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ |
@@ -577,15 +569,6 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
577 | return ctrl_inb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */ | 569 | return ctrl_inb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */ |
578 | return 1; | 570 | return 1; |
579 | } | 571 | } |
580 | #elif defined(CONFIG_CPU_SUBTYPE_ST40STB1) | ||
581 | static inline int sci_rxd_in(struct uart_port *port) | ||
582 | { | ||
583 | if (port->mapbase == 0xffe00000) | ||
584 | return ctrl_inw(SCSPTR1)&0x0001 ? 1 : 0; /* SCIF */ | ||
585 | else | ||
586 | return ctrl_inw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */ | ||
587 | |||
588 | } | ||
589 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) | 572 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) |
590 | static inline int sci_rxd_in(struct uart_port *port) | 573 | static inline int sci_rxd_in(struct uart_port *port) |
591 | { | 574 | { |
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c index dfef83f14960..a85f2d31a686 100644 --- a/drivers/serial/uartlite.c +++ b/drivers/serial/uartlite.c | |||
@@ -329,12 +329,14 @@ static struct uart_ops ulite_ops = { | |||
329 | static void ulite_console_wait_tx(struct uart_port *port) | 329 | static void ulite_console_wait_tx(struct uart_port *port) |
330 | { | 330 | { |
331 | int i; | 331 | int i; |
332 | u8 val; | ||
332 | 333 | ||
333 | /* wait up to 10ms for the character(s) to be sent */ | 334 | /* Spin waiting for TX fifo to have space available */ |
334 | for (i = 0; i < 10000; i++) { | 335 | for (i = 0; i < 100000; i++) { |
335 | if (readb(port->membase + ULITE_STATUS) & ULITE_STATUS_TXEMPTY) | 336 | val = readb(port->membase + ULITE_STATUS); |
337 | if ((val & ULITE_STATUS_TXFULL) == 0) | ||
336 | break; | 338 | break; |
337 | udelay(1); | 339 | cpu_relax(); |
338 | } | 340 | } |
339 | } | 341 | } |
340 | 342 | ||
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c index 161d1021b7eb..e52a6296ca46 100644 --- a/drivers/sh/maple/maple.c +++ b/drivers/sh/maple/maple.c | |||
@@ -601,8 +601,7 @@ static int match_maple_bus_driver(struct device *devptr, | |||
601 | return 0; | 601 | return 0; |
602 | } | 602 | } |
603 | 603 | ||
604 | static int maple_bus_uevent(struct device *dev, char **envp, | 604 | static int maple_bus_uevent(struct device *dev, struct kobj_uevent_env *env) |
605 | int num_envp, char *buffer, int buffer_size) | ||
606 | { | 605 | { |
607 | return 0; | 606 | return 0; |
608 | } | 607 | } |
diff --git a/drivers/sh/superhyway/superhyway.c b/drivers/sh/superhyway/superhyway.c index 7d873b3b0513..4d0282b821b5 100644 --- a/drivers/sh/superhyway/superhyway.c +++ b/drivers/sh/superhyway/superhyway.c | |||
@@ -107,16 +107,17 @@ int superhyway_add_devices(struct superhyway_bus *bus, | |||
107 | static int __init superhyway_init(void) | 107 | static int __init superhyway_init(void) |
108 | { | 108 | { |
109 | struct superhyway_bus *bus; | 109 | struct superhyway_bus *bus; |
110 | int ret = 0; | 110 | int ret; |
111 | 111 | ||
112 | device_register(&superhyway_bus_device); | 112 | ret = device_register(&superhyway_bus_device); |
113 | if (unlikely(ret)) | ||
114 | return ret; | ||
113 | 115 | ||
114 | for (bus = superhyway_channels; bus->ops; bus++) | 116 | for (bus = superhyway_channels; bus->ops; bus++) |
115 | ret |= superhyway_scan_bus(bus); | 117 | ret |= superhyway_scan_bus(bus); |
116 | 118 | ||
117 | return ret; | 119 | return ret; |
118 | } | 120 | } |
119 | |||
120 | postcore_initcall(superhyway_init); | 121 | postcore_initcall(superhyway_init); |
121 | 122 | ||
122 | static const struct superhyway_device_id * | 123 | static const struct superhyway_device_id * |
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/spi.c b/drivers/spi/spi.c index 89769ce16f88..b31f4431849b 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -457,10 +457,11 @@ done: | |||
457 | EXPORT_SYMBOL_GPL(spi_register_master); | 457 | EXPORT_SYMBOL_GPL(spi_register_master); |
458 | 458 | ||
459 | 459 | ||
460 | static int __unregister(struct device *dev, void *unused) | 460 | static int __unregister(struct device *dev, void *master_dev) |
461 | { | 461 | { |
462 | /* note: before about 2.6.14-rc1 this would corrupt memory: */ | 462 | /* note: before about 2.6.14-rc1 this would corrupt memory: */ |
463 | spi_unregister_device(to_spi_device(dev)); | 463 | if (dev != master_dev) |
464 | spi_unregister_device(to_spi_device(dev)); | ||
464 | return 0; | 465 | return 0; |
465 | } | 466 | } |
466 | 467 | ||
@@ -478,7 +479,8 @@ void spi_unregister_master(struct spi_master *master) | |||
478 | { | 479 | { |
479 | int dummy; | 480 | int dummy; |
480 | 481 | ||
481 | dummy = device_for_each_child(master->dev.parent, NULL, __unregister); | 482 | dummy = device_for_each_child(master->dev.parent, &master->dev, |
483 | __unregister); | ||
482 | device_unregister(&master->dev); | 484 | device_unregister(&master->dev); |
483 | } | 485 | } |
484 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 486 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
diff --git a/drivers/spi/spi_txx9.c b/drivers/spi/spi_txx9.c index cc5094f37dd3..363ac8e68821 100644 --- a/drivers/spi/spi_txx9.c +++ b/drivers/spi/spi_txx9.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/io.h> | ||
27 | #include <asm/gpio.h> | 28 | #include <asm/gpio.h> |
28 | 29 | ||
29 | 30 | ||
@@ -74,7 +75,6 @@ struct txx9spi { | |||
74 | struct list_head queue; | 75 | struct list_head queue; |
75 | wait_queue_head_t waitq; | 76 | wait_queue_head_t waitq; |
76 | void __iomem *membase; | 77 | void __iomem *membase; |
77 | int irq; | ||
78 | int baseclk; | 78 | int baseclk; |
79 | struct clk *clk; | 79 | struct clk *clk; |
80 | u32 max_speed_hz, min_speed_hz; | 80 | u32 max_speed_hz, min_speed_hz; |
@@ -350,12 +350,12 @@ static int __init txx9spi_probe(struct platform_device *dev) | |||
350 | struct resource *res; | 350 | struct resource *res; |
351 | int ret = -ENODEV; | 351 | int ret = -ENODEV; |
352 | u32 mcr; | 352 | u32 mcr; |
353 | int irq; | ||
353 | 354 | ||
354 | master = spi_alloc_master(&dev->dev, sizeof(*c)); | 355 | master = spi_alloc_master(&dev->dev, sizeof(*c)); |
355 | if (!master) | 356 | if (!master) |
356 | return ret; | 357 | return ret; |
357 | c = spi_master_get_devdata(master); | 358 | c = spi_master_get_devdata(master); |
358 | c->irq = -1; | ||
359 | platform_set_drvdata(dev, master); | 359 | platform_set_drvdata(dev, master); |
360 | 360 | ||
361 | INIT_WORK(&c->work, txx9spi_work); | 361 | INIT_WORK(&c->work, txx9spi_work); |
@@ -381,32 +381,36 @@ static int __init txx9spi_probe(struct platform_device *dev) | |||
381 | 381 | ||
382 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | 382 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
383 | if (!res) | 383 | if (!res) |
384 | goto exit; | 384 | goto exit_busy; |
385 | c->membase = ioremap(res->start, res->end - res->start + 1); | 385 | if (!devm_request_mem_region(&dev->dev, |
386 | res->start, res->end - res->start + 1, | ||
387 | "spi_txx9")) | ||
388 | goto exit_busy; | ||
389 | c->membase = devm_ioremap(&dev->dev, | ||
390 | res->start, res->end - res->start + 1); | ||
386 | if (!c->membase) | 391 | if (!c->membase) |
387 | goto exit; | 392 | goto exit_busy; |
388 | 393 | ||
389 | /* enter config mode */ | 394 | /* enter config mode */ |
390 | mcr = txx9spi_rd(c, TXx9_SPMCR); | 395 | mcr = txx9spi_rd(c, TXx9_SPMCR); |
391 | mcr &= ~(TXx9_SPMCR_OPMODE | TXx9_SPMCR_SPSTP | TXx9_SPMCR_BCLR); | 396 | mcr &= ~(TXx9_SPMCR_OPMODE | TXx9_SPMCR_SPSTP | TXx9_SPMCR_BCLR); |
392 | txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, TXx9_SPMCR); | 397 | txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, TXx9_SPMCR); |
393 | 398 | ||
394 | c->irq = platform_get_irq(dev, 0); | 399 | irq = platform_get_irq(dev, 0); |
395 | if (c->irq < 0) | 400 | if (irq < 0) |
396 | goto exit; | 401 | goto exit_busy; |
397 | ret = request_irq(c->irq, txx9spi_interrupt, 0, dev->name, c); | 402 | ret = devm_request_irq(&dev->dev, irq, txx9spi_interrupt, 0, |
398 | if (ret) { | 403 | "spi_txx9", c); |
399 | c->irq = -1; | 404 | if (ret) |
400 | goto exit; | 405 | goto exit; |
401 | } | ||
402 | 406 | ||
403 | c->workqueue = create_singlethread_workqueue(master->dev.parent->bus_id); | 407 | c->workqueue = create_singlethread_workqueue(master->dev.parent->bus_id); |
404 | if (!c->workqueue) | 408 | if (!c->workqueue) |
405 | goto exit; | 409 | goto exit_busy; |
406 | c->last_chipselect = -1; | 410 | c->last_chipselect = -1; |
407 | 411 | ||
408 | dev_info(&dev->dev, "at %#llx, irq %d, %dMHz\n", | 412 | dev_info(&dev->dev, "at %#llx, irq %d, %dMHz\n", |
409 | (unsigned long long)res->start, c->irq, | 413 | (unsigned long long)res->start, irq, |
410 | (c->baseclk + 500000) / 1000000); | 414 | (c->baseclk + 500000) / 1000000); |
411 | 415 | ||
412 | master->bus_num = dev->id; | 416 | master->bus_num = dev->id; |
@@ -418,13 +422,11 @@ static int __init txx9spi_probe(struct platform_device *dev) | |||
418 | if (ret) | 422 | if (ret) |
419 | goto exit; | 423 | goto exit; |
420 | return 0; | 424 | return 0; |
425 | exit_busy: | ||
426 | ret = -EBUSY; | ||
421 | exit: | 427 | exit: |
422 | if (c->workqueue) | 428 | if (c->workqueue) |
423 | destroy_workqueue(c->workqueue); | 429 | destroy_workqueue(c->workqueue); |
424 | if (c->irq >= 0) | ||
425 | free_irq(c->irq, c); | ||
426 | if (c->membase) | ||
427 | iounmap(c->membase); | ||
428 | if (c->clk) { | 430 | if (c->clk) { |
429 | clk_disable(c->clk); | 431 | clk_disable(c->clk); |
430 | clk_put(c->clk); | 432 | clk_put(c->clk); |
@@ -442,8 +444,6 @@ static int __exit txx9spi_remove(struct platform_device *dev) | |||
442 | spi_unregister_master(master); | 444 | spi_unregister_master(master); |
443 | platform_set_drvdata(dev, NULL); | 445 | platform_set_drvdata(dev, NULL); |
444 | destroy_workqueue(c->workqueue); | 446 | destroy_workqueue(c->workqueue); |
445 | free_irq(c->irq, c); | ||
446 | iounmap(c->membase); | ||
447 | clk_disable(c->clk); | 447 | clk_disable(c->clk); |
448 | clk_put(c->clk); | 448 | clk_put(c->clk); |
449 | spi_master_put(master); | 449 | spi_master_put(master); |
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index c55459c592b8..b3518ca9f04e 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
@@ -184,14 +184,14 @@ static int spidev_message(struct spidev_data *spidev, | |||
184 | if (u_tmp->rx_buf) { | 184 | if (u_tmp->rx_buf) { |
185 | k_tmp->rx_buf = buf; | 185 | k_tmp->rx_buf = buf; |
186 | if (!access_ok(VERIFY_WRITE, (u8 __user *) | 186 | if (!access_ok(VERIFY_WRITE, (u8 __user *) |
187 | (ptrdiff_t) u_tmp->rx_buf, | 187 | (uintptr_t) u_tmp->rx_buf, |
188 | u_tmp->len)) | 188 | u_tmp->len)) |
189 | goto done; | 189 | goto done; |
190 | } | 190 | } |
191 | if (u_tmp->tx_buf) { | 191 | if (u_tmp->tx_buf) { |
192 | k_tmp->tx_buf = buf; | 192 | k_tmp->tx_buf = buf; |
193 | if (copy_from_user(buf, (const u8 __user *) | 193 | if (copy_from_user(buf, (const u8 __user *) |
194 | (ptrdiff_t) u_tmp->tx_buf, | 194 | (uintptr_t) u_tmp->tx_buf, |
195 | u_tmp->len)) | 195 | u_tmp->len)) |
196 | goto done; | 196 | goto done; |
197 | } | 197 | } |
@@ -224,7 +224,7 @@ static int spidev_message(struct spidev_data *spidev, | |||
224 | for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { | 224 | for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { |
225 | if (u_tmp->rx_buf) { | 225 | if (u_tmp->rx_buf) { |
226 | if (__copy_to_user((u8 __user *) | 226 | if (__copy_to_user((u8 __user *) |
227 | (ptrdiff_t) u_tmp->rx_buf, buf, | 227 | (uintptr_t) u_tmp->rx_buf, buf, |
228 | u_tmp->len)) { | 228 | u_tmp->len)) { |
229 | status = -EFAULT; | 229 | status = -EFAULT; |
230 | goto done; | 230 | goto done; |
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/tle62x0.c index 6da58ca48b33..455991fbe28f 100644 --- a/drivers/spi/tle62x0.c +++ b/drivers/spi/tle62x0.c | |||
@@ -107,8 +107,11 @@ static ssize_t tle62x0_status_show(struct device *dev, | |||
107 | 107 | ||
108 | mutex_lock(&st->lock); | 108 | mutex_lock(&st->lock); |
109 | ret = tle62x0_read(st); | 109 | ret = tle62x0_read(st); |
110 | |||
111 | dev_dbg(dev, "tle62x0_read() returned %d\n", ret); | 110 | dev_dbg(dev, "tle62x0_read() returned %d\n", ret); |
111 | if (ret < 0) { | ||
112 | mutex_unlock(&st->lock); | ||
113 | return ret; | ||
114 | } | ||
112 | 115 | ||
113 | for (ptr = 0; ptr < (st->nr_gpio * 2)/8; ptr += 1) { | 116 | for (ptr = 0; ptr < (st->nr_gpio * 2)/8; ptr += 1) { |
114 | fault <<= 8; | 117 | fault <<= 8; |
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index c12a741b5574..85a20546e827 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c | |||
@@ -440,6 +440,7 @@ static int ssb_devices_register(struct ssb_bus *bus) | |||
440 | break; | 440 | break; |
441 | case SSB_BUSTYPE_PCMCIA: | 441 | case SSB_BUSTYPE_PCMCIA: |
442 | #ifdef CONFIG_SSB_PCMCIAHOST | 442 | #ifdef CONFIG_SSB_PCMCIAHOST |
443 | sdev->irq = bus->host_pcmcia->irq.AssignedIRQ; | ||
443 | dev->parent = &bus->host_pcmcia->dev; | 444 | dev->parent = &bus->host_pcmcia->dev; |
444 | #endif | 445 | #endif |
445 | break; | 446 | break; |
@@ -1147,7 +1148,10 @@ static int __init ssb_modinit(void) | |||
1147 | 1148 | ||
1148 | return err; | 1149 | return err; |
1149 | } | 1150 | } |
1150 | subsys_initcall(ssb_modinit); | 1151 | /* ssb must be initialized after PCI but before the ssb drivers. |
1152 | * That means we must use some initcall between subsys_initcall | ||
1153 | * and device_initcall. */ | ||
1154 | fs_initcall(ssb_modinit); | ||
1151 | 1155 | ||
1152 | static void __exit ssb_modexit(void) | 1156 | static void __exit ssb_modexit(void) |
1153 | { | 1157 | { |
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index b6abee846f02..bb44a76b3eb5 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c | |||
@@ -63,17 +63,17 @@ int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus, | |||
63 | err = pcmcia_access_configuration_register(pdev, ®); | 63 | err = pcmcia_access_configuration_register(pdev, ®); |
64 | if (err != CS_SUCCESS) | 64 | if (err != CS_SUCCESS) |
65 | goto error; | 65 | goto error; |
66 | read_addr |= (reg.Value & 0xF) << 12; | 66 | read_addr |= ((u32)(reg.Value & 0x0F)) << 12; |
67 | reg.Offset = 0x30; | 67 | reg.Offset = 0x30; |
68 | err = pcmcia_access_configuration_register(pdev, ®); | 68 | err = pcmcia_access_configuration_register(pdev, ®); |
69 | if (err != CS_SUCCESS) | 69 | if (err != CS_SUCCESS) |
70 | goto error; | 70 | goto error; |
71 | read_addr |= reg.Value << 16; | 71 | read_addr |= ((u32)reg.Value) << 16; |
72 | reg.Offset = 0x32; | 72 | reg.Offset = 0x32; |
73 | err = pcmcia_access_configuration_register(pdev, ®); | 73 | err = pcmcia_access_configuration_register(pdev, ®); |
74 | if (err != CS_SUCCESS) | 74 | if (err != CS_SUCCESS) |
75 | goto error; | 75 | goto error; |
76 | read_addr |= reg.Value << 24; | 76 | read_addr |= ((u32)reg.Value) << 24; |
77 | 77 | ||
78 | cur_core = (read_addr - SSB_ENUM_BASE) / SSB_CORE_SIZE; | 78 | cur_core = (read_addr - SSB_ENUM_BASE) / SSB_CORE_SIZE; |
79 | if (cur_core == coreidx) | 79 | if (cur_core == coreidx) |
@@ -152,28 +152,29 @@ error: | |||
152 | goto out_unlock; | 152 | goto out_unlock; |
153 | } | 153 | } |
154 | 154 | ||
155 | /* These are the main device register access functions. | 155 | static int select_core_and_segment(struct ssb_device *dev, |
156 | * do_select_core is inline to have the likely hotpath inline. | 156 | u16 *offset) |
157 | * All unlikely codepaths are out-of-line. */ | ||
158 | static inline int do_select_core(struct ssb_bus *bus, | ||
159 | struct ssb_device *dev, | ||
160 | u16 *offset) | ||
161 | { | 157 | { |
158 | struct ssb_bus *bus = dev->bus; | ||
162 | int err; | 159 | int err; |
163 | u8 need_seg = (*offset >= 0x800) ? 1 : 0; | 160 | u8 need_segment; |
161 | |||
162 | if (*offset >= 0x800) { | ||
163 | *offset -= 0x800; | ||
164 | need_segment = 1; | ||
165 | } else | ||
166 | need_segment = 0; | ||
164 | 167 | ||
165 | if (unlikely(dev != bus->mapped_device)) { | 168 | if (unlikely(dev != bus->mapped_device)) { |
166 | err = ssb_pcmcia_switch_core(bus, dev); | 169 | err = ssb_pcmcia_switch_core(bus, dev); |
167 | if (unlikely(err)) | 170 | if (unlikely(err)) |
168 | return err; | 171 | return err; |
169 | } | 172 | } |
170 | if (unlikely(need_seg != bus->mapped_pcmcia_seg)) { | 173 | if (unlikely(need_segment != bus->mapped_pcmcia_seg)) { |
171 | err = ssb_pcmcia_switch_segment(bus, need_seg); | 174 | err = ssb_pcmcia_switch_segment(bus, need_segment); |
172 | if (unlikely(err)) | 175 | if (unlikely(err)) |
173 | return err; | 176 | return err; |
174 | } | 177 | } |
175 | if (need_seg == 1) | ||
176 | *offset -= 0x800; | ||
177 | 178 | ||
178 | return 0; | 179 | return 0; |
179 | } | 180 | } |
@@ -181,32 +182,31 @@ static inline int do_select_core(struct ssb_bus *bus, | |||
181 | static u16 ssb_pcmcia_read16(struct ssb_device *dev, u16 offset) | 182 | static u16 ssb_pcmcia_read16(struct ssb_device *dev, u16 offset) |
182 | { | 183 | { |
183 | struct ssb_bus *bus = dev->bus; | 184 | struct ssb_bus *bus = dev->bus; |
184 | u16 x; | ||
185 | 185 | ||
186 | if (unlikely(do_select_core(bus, dev, &offset))) | 186 | if (unlikely(select_core_and_segment(dev, &offset))) |
187 | return 0xFFFF; | 187 | return 0xFFFF; |
188 | x = readw(bus->mmio + offset); | ||
189 | 188 | ||
190 | return x; | 189 | return readw(bus->mmio + offset); |
191 | } | 190 | } |
192 | 191 | ||
193 | static u32 ssb_pcmcia_read32(struct ssb_device *dev, u16 offset) | 192 | static u32 ssb_pcmcia_read32(struct ssb_device *dev, u16 offset) |
194 | { | 193 | { |
195 | struct ssb_bus *bus = dev->bus; | 194 | struct ssb_bus *bus = dev->bus; |
196 | u32 x; | 195 | u32 lo, hi; |
197 | 196 | ||
198 | if (unlikely(do_select_core(bus, dev, &offset))) | 197 | if (unlikely(select_core_and_segment(dev, &offset))) |
199 | return 0xFFFFFFFF; | 198 | return 0xFFFFFFFF; |
200 | x = readl(bus->mmio + offset); | 199 | lo = readw(bus->mmio + offset); |
200 | hi = readw(bus->mmio + offset + 2); | ||
201 | 201 | ||
202 | return x; | 202 | return (lo | (hi << 16)); |
203 | } | 203 | } |
204 | 204 | ||
205 | static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value) | 205 | static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value) |
206 | { | 206 | { |
207 | struct ssb_bus *bus = dev->bus; | 207 | struct ssb_bus *bus = dev->bus; |
208 | 208 | ||
209 | if (unlikely(do_select_core(bus, dev, &offset))) | 209 | if (unlikely(select_core_and_segment(dev, &offset))) |
210 | return; | 210 | return; |
211 | writew(value, bus->mmio + offset); | 211 | writew(value, bus->mmio + offset); |
212 | } | 212 | } |
@@ -215,12 +215,12 @@ static void ssb_pcmcia_write32(struct ssb_device *dev, u16 offset, u32 value) | |||
215 | { | 215 | { |
216 | struct ssb_bus *bus = dev->bus; | 216 | struct ssb_bus *bus = dev->bus; |
217 | 217 | ||
218 | if (unlikely(do_select_core(bus, dev, &offset))) | 218 | if (unlikely(select_core_and_segment(dev, &offset))) |
219 | return; | 219 | return; |
220 | readw(bus->mmio + offset); | 220 | writeb((value & 0xFF000000) >> 24, bus->mmio + offset + 3); |
221 | writew(value >> 16, bus->mmio + offset + 2); | 221 | writeb((value & 0x00FF0000) >> 16, bus->mmio + offset + 2); |
222 | readw(bus->mmio + offset); | 222 | writeb((value & 0x0000FF00) >> 8, bus->mmio + offset + 1); |
223 | writew(value, bus->mmio + offset); | 223 | writeb((value & 0x000000FF) >> 0, bus->mmio + offset + 0); |
224 | } | 224 | } |
225 | 225 | ||
226 | /* Not "static", as it's used in main.c */ | 226 | /* Not "static", as it's used in main.c */ |
diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c index 4d8c2a5b3297..bcea8d9b718c 100644 --- a/drivers/telephony/phonedev.c +++ b/drivers/telephony/phonedev.c | |||
@@ -120,9 +120,8 @@ int phone_register_device(struct phone_device *p, int unit) | |||
120 | void phone_unregister_device(struct phone_device *pfd) | 120 | void phone_unregister_device(struct phone_device *pfd) |
121 | { | 121 | { |
122 | mutex_lock(&phone_lock); | 122 | mutex_lock(&phone_lock); |
123 | if (phone_device[pfd->minor] != pfd) | 123 | if (likely(phone_device[pfd->minor] == pfd)) |
124 | panic("phone: bad unregister"); | 124 | phone_device[pfd->minor] = NULL; |
125 | phone_device[pfd->minor] = NULL; | ||
126 | mutex_unlock(&phone_lock); | 125 | mutex_unlock(&phone_lock); |
127 | } | 126 | } |
128 | 127 | ||
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index ead2475406b8..28d4972f7ad5 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/device.h> | 11 | #include <linux/device.h> |
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
14 | #include <asm/scatterlist.h> | ||
15 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
16 | #include <linux/dmapool.h> | 15 | #include <linux/dmapool.h> |
17 | #include <linux/usb.h> | 16 | #include <linux/usb.h> |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 3dd997df8505..fea8256a18d6 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/utsname.h> | 30 | #include <linux/utsname.h> |
31 | #include <linux/mm.h> | 31 | #include <linux/mm.h> |
32 | #include <asm/io.h> | 32 | #include <asm/io.h> |
33 | #include <asm/scatterlist.h> | ||
34 | #include <linux/device.h> | 33 | #include <linux/device.h> |
35 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
36 | #include <linux/mutex.h> | 35 | #include <linux/mutex.h> |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index eb4ac47612a5..316a746e0080 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -434,7 +434,7 @@ int usb_sg_init ( | |||
434 | if (dma) { | 434 | if (dma) { |
435 | io->urbs [i]->transfer_dma = sg_dma_address (sg + i); | 435 | io->urbs [i]->transfer_dma = sg_dma_address (sg + i); |
436 | len = sg_dma_len (sg + i); | 436 | len = sg_dma_len (sg + i); |
437 | #if defined(CONFIG_HIGHMEM) || defined(CONFIG_IOMMU) | 437 | #if defined(CONFIG_HIGHMEM) || defined(CONFIG_GART_IOMMU) |
438 | io->urbs[i]->transfer_buffer = NULL; | 438 | io->urbs[i]->transfer_buffer = NULL; |
439 | #else | 439 | #else |
440 | io->urbs[i]->transfer_buffer = sg_virt(&sg[i]); | 440 | io->urbs[i]->transfer_buffer = sg_virt(&sg[i]); |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 69aa68287d3f..c4a6f1095b8b 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
37 | 37 | ||
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | #include <asm/scatterlist.h> | 39 | #include <linux/scatterlist.h> |
40 | #include <linux/mm.h> | 40 | #include <linux/mm.h> |
41 | #include <linux/dma-mapping.h> | 41 | #include <linux/dma-mapping.h> |
42 | 42 | ||
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 6bfdba6a213f..1f7ab15df36d 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -1215,20 +1215,18 @@ 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; | ||
1224 | struct urb *urb; | 1223 | struct urb *urb; |
1225 | unsigned int cflag; | ||
1226 | 1224 | ||
1227 | s_priv = usb_get_serial_data(serial); | 1225 | s_priv = usb_get_serial_data(serial); |
1228 | p_priv = usb_get_serial_port_data(port); | 1226 | p_priv = usb_get_serial_port_data(port); |
1229 | d_details = p_priv->device_details; | 1227 | d_details = p_priv->device_details; |
1230 | 1228 | ||
1231 | dbg("%s - port%d.", __FUNCTION__, port->number); | 1229 | dbg("%s - port%d.", __FUNCTION__, port->number); |
1232 | 1230 | ||
1233 | /* Set some sane defaults */ | 1231 | /* Set some sane defaults */ |
1234 | p_priv->rts_state = 1; | 1232 | p_priv->rts_state = 1; |
@@ -1249,7 +1247,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) | |||
1249 | urb->dev = serial->dev; | 1247 | urb->dev = serial->dev; |
1250 | 1248 | ||
1251 | /* make sure endpoint data toggle is synchronized with the device */ | 1249 | /* make sure endpoint data toggle is synchronized with the device */ |
1252 | 1250 | ||
1253 | usb_clear_halt(urb->dev, urb->pipe); | 1251 | usb_clear_halt(urb->dev, urb->pipe); |
1254 | 1252 | ||
1255 | if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { | 1253 | if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { |
@@ -1265,30 +1263,6 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) | |||
1265 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ | 1263 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ |
1266 | } | 1264 | } |
1267 | 1265 | ||
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 | |||
1292 | return (0); | 1266 | return (0); |
1293 | } | 1267 | } |
1294 | 1268 | ||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index fb9d8d0b2c04..7d86e9eae915 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -503,7 +503,7 @@ config FB_VALKYRIE | |||
503 | 503 | ||
504 | config FB_CT65550 | 504 | config FB_CT65550 |
505 | bool "Chips 65550 display support" | 505 | bool "Chips 65550 display support" |
506 | depends on (FB = y) && PPC32 | 506 | depends on (FB = y) && PPC32 && PCI |
507 | select FB_CFB_FILLRECT | 507 | select FB_CFB_FILLRECT |
508 | select FB_CFB_COPYAREA | 508 | select FB_CFB_COPYAREA |
509 | select FB_CFB_IMAGEBLIT | 509 | select FB_CFB_IMAGEBLIT |
@@ -1509,7 +1509,7 @@ config FB_VOODOO1 | |||
1509 | 1509 | ||
1510 | WARNING: Do not use any application that uses the 3D engine | 1510 | WARNING: Do not use any application that uses the 3D engine |
1511 | (namely glide) while using this driver. | 1511 | (namely glide) while using this driver. |
1512 | Please read the <file:Documentation/fb/README-sstfb.txt> for supported | 1512 | Please read the <file:Documentation/fb/sstfb.txt> for supported |
1513 | options and other important info support. | 1513 | options and other important info support. |
1514 | 1514 | ||
1515 | config FB_VT8623 | 1515 | config FB_VT8623 |
@@ -1807,7 +1807,7 @@ config FB_SM501 | |||
1807 | This driver is also available as a module ( = code which can be | 1807 | This driver is also available as a module ( = code which can be |
1808 | inserted and removed from the running kernel whenever you want). The | 1808 | inserted and removed from the running kernel whenever you want). The |
1809 | module will be called sm501fb. If you want to compile it as a module, | 1809 | module will be called sm501fb. If you want to compile it as a module, |
1810 | say M here and read <file:Documentation/modules.txt>. | 1810 | say M here and read <file:Documentation/kbuild/modules.txt>. |
1811 | 1811 | ||
1812 | If unsure, say N. | 1812 | If unsure, say N. |
1813 | 1813 | ||
@@ -1892,9 +1892,7 @@ config FB_VIRTUAL | |||
1892 | 1892 | ||
1893 | If unsure, say N. | 1893 | If unsure, say N. |
1894 | 1894 | ||
1895 | if ARCH_OMAP | 1895 | source "drivers/video/omap/Kconfig" |
1896 | source "drivers/video/omap/Kconfig" | ||
1897 | endif | ||
1898 | 1896 | ||
1899 | source "drivers/video/backlight/Kconfig" | 1897 | source "drivers/video/backlight/Kconfig" |
1900 | source "drivers/video/display/Kconfig" | 1898 | source "drivers/video/display/Kconfig" |
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/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index be1d57bf9dc8..83ee3e75386c 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
@@ -27,8 +27,6 @@ | |||
27 | 27 | ||
28 | #include "ati_ids.h" | 28 | #include "ati_ids.h" |
29 | 29 | ||
30 | static void radeon_reinitialize_M10(struct radeonfb_info *rinfo); | ||
31 | |||
32 | /* | 30 | /* |
33 | * Workarounds for bugs in PC laptops: | 31 | * Workarounds for bugs in PC laptops: |
34 | * - enable D2 sleep in some IBM Thinkpads | 32 | * - enable D2 sleep in some IBM Thinkpads |
@@ -39,6 +37,8 @@ static void radeon_reinitialize_M10(struct radeonfb_info *rinfo); | |||
39 | */ | 37 | */ |
40 | 38 | ||
41 | #if defined(CONFIG_PM) && defined(CONFIG_X86) | 39 | #if defined(CONFIG_PM) && defined(CONFIG_X86) |
40 | static void radeon_reinitialize_M10(struct radeonfb_info *rinfo); | ||
41 | |||
42 | struct radeon_device_id { | 42 | struct radeon_device_id { |
43 | const char *ident; /* (arbitrary) Name */ | 43 | const char *ident; /* (arbitrary) Name */ |
44 | const unsigned short subsystem_vendor; /* Subsystem Vendor ID */ | 44 | const unsigned short subsystem_vendor; /* Subsystem Vendor ID */ |
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index f99cb77e7b42..f7e2d5add831 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c | |||
@@ -2509,8 +2509,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z, | |||
2509 | cinfo = info->par; | 2509 | cinfo = info->par; |
2510 | cinfo->btype = btype; | 2510 | cinfo->btype = btype; |
2511 | 2511 | ||
2512 | assert(z > 0); | 2512 | assert(z); |
2513 | assert(z2 >= 0); | ||
2514 | assert(btype != BT_NONE); | 2513 | assert(btype != BT_NONE); |
2515 | 2514 | ||
2516 | cinfo->zdev = z; | 2515 | cinfo->zdev = z; |
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/cyber2000fb.c b/drivers/video/cyber2000fb.c index 5fb8675e0d6b..d0e4cb618269 100644 --- a/drivers/video/cyber2000fb.c +++ b/drivers/video/cyber2000fb.c | |||
@@ -874,6 +874,8 @@ static int cyber2000fb_set_par(struct fb_info *info) | |||
874 | default: | 874 | default: |
875 | BUG(); | 875 | BUG(); |
876 | } | 876 | } |
877 | break; | ||
878 | |||
877 | case 24:/* TRUECOLOUR, 16m */ | 879 | case 24:/* TRUECOLOUR, 16m */ |
878 | hw.co_pixfmt = CO_PIXFMT_24BPP; | 880 | hw.co_pixfmt = CO_PIXFMT_24BPP; |
879 | hw.width *= 3; | 881 | hw.width *= 3; |
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index b9b572b293d4..2e552d5bbb5d 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
@@ -183,8 +183,8 @@ static struct fb_videomode default_mode_LCD __initdata = { | |||
183 | .vmode = FB_VMODE_NONINTERLACED, | 183 | .vmode = FB_VMODE_NONINTERLACED, |
184 | }; | 184 | }; |
185 | 185 | ||
186 | struct fb_videomode *default_mode = &default_mode_CRT; | 186 | struct fb_videomode *default_mode __initdata = &default_mode_CRT; |
187 | struct fb_var_screeninfo *default_var = &default_var_CRT; | 187 | struct fb_var_screeninfo *default_var __initdata = &default_var_CRT; |
188 | 188 | ||
189 | static int flat_panel_enabled = 0; | 189 | static int flat_panel_enabled = 0; |
190 | 190 | ||
diff --git a/drivers/video/geode/lxfb.h b/drivers/video/geode/lxfb.h index 6c227f9592a5..ca13c48d19b0 100644 --- a/drivers/video/geode/lxfb.h +++ b/drivers/video/geode/lxfb.h | |||
@@ -33,7 +33,7 @@ void lx_set_palette_reg(struct fb_info *, unsigned int, unsigned int, | |||
33 | 33 | ||
34 | #define MSR_LX_GLD_CONFIG 0x48002001 | 34 | #define MSR_LX_GLD_CONFIG 0x48002001 |
35 | #define MSR_LX_GLCP_DOTPLL 0x4c000015 | 35 | #define MSR_LX_GLCP_DOTPLL 0x4c000015 |
36 | #define MSR_LX_DF_PADSEL 0x48000011 | 36 | #define MSR_LX_DF_PADSEL 0x48002011 |
37 | #define MSR_LX_DC_SPARE 0x80000011 | 37 | #define MSR_LX_DC_SPARE 0x80000011 |
38 | #define MSR_LX_DF_GLCONFIG 0x48002001 | 38 | #define MSR_LX_DF_GLCONFIG 0x48002001 |
39 | 39 | ||
diff --git a/drivers/video/omap/Kconfig b/drivers/video/omap/Kconfig index f4fcf11b290d..44408850e2eb 100644 --- a/drivers/video/omap/Kconfig +++ b/drivers/video/omap/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config FB_OMAP | 1 | config FB_OMAP |
2 | tristate "OMAP frame buffer support (EXPERIMENTAL)" | 2 | tristate "OMAP frame buffer support (EXPERIMENTAL)" |
3 | depends on FB | 3 | depends on FB && ARCH_OMAP |
4 | select FB_CFB_FILLRECT | 4 | select FB_CFB_FILLRECT |
5 | select FB_CFB_COPYAREA | 5 | select FB_CFB_COPYAREA |
6 | select FB_CFB_IMAGEBLIT | 6 | select FB_CFB_IMAGEBLIT |
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index b3463ddcfd60..75836aa83191 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -727,7 +727,7 @@ static int ps3fb_blank(int blank, struct fb_info *info) | |||
727 | 727 | ||
728 | static int ps3fb_get_vblank(struct fb_vblank *vblank) | 728 | static int ps3fb_get_vblank(struct fb_vblank *vblank) |
729 | { | 729 | { |
730 | memset(vblank, 0, sizeof(&vblank)); | 730 | memset(vblank, 0, sizeof(*vblank)); |
731 | vblank->flags = FB_VBLANK_HAVE_VSYNC; | 731 | vblank->flags = FB_VBLANK_HAVE_VSYNC; |
732 | return 0; | 732 | return 0; |
733 | } | 733 | } |
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c index a5333c190789..b829dc7c5edf 100644 --- a/drivers/video/s1d13xxxfb.c +++ b/drivers/video/s1d13xxxfb.c | |||
@@ -540,7 +540,7 @@ s1d13xxxfb_probe(struct platform_device *pdev) | |||
540 | int ret = 0; | 540 | int ret = 0; |
541 | u8 revision; | 541 | u8 revision; |
542 | 542 | ||
543 | dbg("probe called: device is %p\n", dev); | 543 | dbg("probe called: device is %p\n", pdev); |
544 | 544 | ||
545 | printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); | 545 | printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); |
546 | 546 | ||
@@ -753,8 +753,11 @@ static struct platform_driver s1d13xxxfb_driver = { | |||
753 | static int __init | 753 | static int __init |
754 | s1d13xxxfb_init(void) | 754 | s1d13xxxfb_init(void) |
755 | { | 755 | { |
756 | |||
757 | #ifndef MODULE | ||
756 | if (fb_get_options("s1d13xxxfb", NULL)) | 758 | if (fb_get_options("s1d13xxxfb", NULL)) |
757 | return -ENODEV; | 759 | return -ENODEV; |
760 | #endif | ||
758 | 761 | ||
759 | return platform_driver_register(&s1d13xxxfb_driver); | 762 | return platform_driver_register(&s1d13xxxfb_driver); |
760 | } | 763 | } |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index bc7d23683735..37bd24b8d83b 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -1248,7 +1248,6 @@ sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive, struct fb_info *in | |||
1248 | if(found_mode) { | 1248 | if(found_mode) { |
1249 | ivideo->sisfb_mode_idx = sisfb_validate_mode(ivideo, | 1249 | ivideo->sisfb_mode_idx = sisfb_validate_mode(ivideo, |
1250 | ivideo->sisfb_mode_idx, ivideo->currentvbflags); | 1250 | ivideo->sisfb_mode_idx, ivideo->currentvbflags); |
1251 | ivideo->mode_no = sisbios_mode[ivideo->sisfb_mode_idx].mode_no[ivideo->mni]; | ||
1252 | } else { | 1251 | } else { |
1253 | ivideo->sisfb_mode_idx = -1; | 1252 | ivideo->sisfb_mode_idx = -1; |
1254 | } | 1253 | } |
@@ -1260,6 +1259,8 @@ sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive, struct fb_info *in | |||
1260 | return -EINVAL; | 1259 | return -EINVAL; |
1261 | } | 1260 | } |
1262 | 1261 | ||
1262 | ivideo->mode_no = sisbios_mode[ivideo->sisfb_mode_idx].mode_no[ivideo->mni]; | ||
1263 | |||
1263 | if(sisfb_search_refresh_rate(ivideo, ivideo->refresh_rate, ivideo->sisfb_mode_idx) == 0) { | 1264 | if(sisfb_search_refresh_rate(ivideo, ivideo->refresh_rate, ivideo->sisfb_mode_idx) == 0) { |
1264 | ivideo->rate_idx = sisbios_mode[ivideo->sisfb_mode_idx].rate_idx; | 1265 | ivideo->rate_idx = sisbios_mode[ivideo->sisfb_mode_idx].rate_idx; |
1265 | ivideo->refresh_rate = 60; | 1266 | ivideo->refresh_rate = 60; |
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index b983d262ab78..d1d6c0facd54 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
@@ -926,8 +926,10 @@ static int uvesafb_setpalette(struct uvesafb_pal_entry *entries, int count, | |||
926 | int start, struct fb_info *info) | 926 | int start, struct fb_info *info) |
927 | { | 927 | { |
928 | struct uvesafb_ktask *task; | 928 | struct uvesafb_ktask *task; |
929 | #ifdef CONFIG_X86 | ||
929 | struct uvesafb_par *par = info->par; | 930 | struct uvesafb_par *par = info->par; |
930 | int i = par->mode_idx; | 931 | int i = par->mode_idx; |
932 | #endif | ||
931 | int err = 0; | 933 | int err = 0; |
932 | 934 | ||
933 | /* | 935 | /* |
@@ -1103,11 +1105,11 @@ static int uvesafb_pan_display(struct fb_var_screeninfo *var, | |||
1103 | 1105 | ||
1104 | static int uvesafb_blank(int blank, struct fb_info *info) | 1106 | static int uvesafb_blank(int blank, struct fb_info *info) |
1105 | { | 1107 | { |
1106 | struct uvesafb_par *par = info->par; | ||
1107 | struct uvesafb_ktask *task; | 1108 | struct uvesafb_ktask *task; |
1108 | int err = 1; | 1109 | int err = 1; |
1109 | |||
1110 | #ifdef CONFIG_X86 | 1110 | #ifdef CONFIG_X86 |
1111 | struct uvesafb_par *par = info->par; | ||
1112 | |||
1111 | if (par->vbe_ib.capabilities & VBE_CAP_VGACOMPAT) { | 1113 | if (par->vbe_ib.capabilities & VBE_CAP_VGACOMPAT) { |
1112 | int loop = 10000; | 1114 | int loop = 10000; |
1113 | u8 seq = 0, crtc17 = 0; | 1115 | u8 seq = 0, crtc17 = 0; |
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/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 0e4baca21b8f..1dc04b6684e6 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -53,7 +53,7 @@ struct vring_virtqueue | |||
53 | unsigned int num_added; | 53 | unsigned int num_added; |
54 | 54 | ||
55 | /* Last used index we've seen. */ | 55 | /* Last used index we've seen. */ |
56 | unsigned int last_used_idx; | 56 | u16 last_used_idx; |
57 | 57 | ||
58 | /* How to notify other side. FIXME: commonalize hcalls! */ | 58 | /* How to notify other side. FIXME: commonalize hcalls! */ |
59 | void (*notify)(struct virtqueue *vq); | 59 | void (*notify)(struct virtqueue *vq); |
@@ -277,11 +277,17 @@ struct virtqueue *vring_new_virtqueue(unsigned int num, | |||
277 | struct vring_virtqueue *vq; | 277 | struct vring_virtqueue *vq; |
278 | unsigned int i; | 278 | unsigned int i; |
279 | 279 | ||
280 | /* We assume num is a power of 2. */ | ||
281 | if (num & (num - 1)) { | ||
282 | dev_warn(&vdev->dev, "Bad virtqueue length %u\n", num); | ||
283 | return NULL; | ||
284 | } | ||
285 | |||
280 | vq = kmalloc(sizeof(*vq) + sizeof(void *)*num, GFP_KERNEL); | 286 | vq = kmalloc(sizeof(*vq) + sizeof(void *)*num, GFP_KERNEL); |
281 | if (!vq) | 287 | if (!vq) |
282 | return NULL; | 288 | return NULL; |
283 | 289 | ||
284 | vring_init(&vq->vring, num, pages); | 290 | vring_init(&vq->vring, num, pages, PAGE_SIZE); |
285 | vq->vq.callback = callback; | 291 | vq->vq.callback = callback; |
286 | vq->vq.vdev = vdev; | 292 | vq->vq.vdev = vdev; |
287 | vq->vq.vq_ops = &vring_vq_ops; | 293 | vq->vq.vq_ops = &vring_vq_ops; |
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig index 6854fd6b9714..9adbb4f90479 100644 --- a/drivers/w1/Kconfig +++ b/drivers/w1/Kconfig | |||
@@ -17,7 +17,8 @@ config W1_CON | |||
17 | bool "Userspace communication over connector" | 17 | bool "Userspace communication over connector" |
18 | default y | 18 | default y |
19 | --- help --- | 19 | --- help --- |
20 | This allows to communicate with userspace using connector [Documentation/connector]. | 20 | This allows to communicate with userspace using connector. For more |
21 | information see <file:Documentation/connector/connector.txt>. | ||
21 | There are three types of messages between w1 core and userspace: | 22 | There are three types of messages between w1 core and userspace: |
22 | 1. Events. They are generated each time new master or slave device found | 23 | 1. Events. They are generated each time new master or slave device found |
23 | either due to automatic or requested search. | 24 | either due to automatic or requested search. |
diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c index 299e274d241a..b63b5e044a4c 100644 --- a/drivers/w1/masters/ds2490.c +++ b/drivers/w1/masters/ds2490.c | |||
@@ -233,7 +233,7 @@ static int ds_recv_status_nodump(struct ds_device *dev, struct ds_status *st, | |||
233 | { | 233 | { |
234 | int count, err; | 234 | int count, err; |
235 | 235 | ||
236 | memset(st, 0, sizeof(st)); | 236 | memset(st, 0, sizeof(*st)); |
237 | 237 | ||
238 | count = 0; | 238 | count = 0; |
239 | err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_STATUS]), buf, size, &count, 100); | 239 | err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_STATUS]), buf, size, &count, 100); |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 81db48f07ca1..2792bc1a7269 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -15,8 +15,8 @@ menuconfig WATCHDOG | |||
15 | implementation entirely in software (which can sometimes fail to | 15 | implementation entirely in software (which can sometimes fail to |
16 | reboot the machine) and a driver for hardware watchdog boards, which | 16 | reboot the machine) and a driver for hardware watchdog boards, which |
17 | are more robust and can also keep track of the temperature inside | 17 | are more robust and can also keep track of the temperature inside |
18 | your computer. For details, read <file:Documentation/watchdog/watchdog.txt> | 18 | your computer. For details, read |
19 | in the kernel source. | 19 | <file:Documentation/watchdog/watchdog-api.txt> in the kernel source. |
20 | 20 | ||
21 | The watchdog is usually used together with the watchdog daemon | 21 | The watchdog is usually used together with the watchdog daemon |
22 | which is available from | 22 | which is available from |
diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c index c404fc69e7e6..b481cc0e32e4 100644 --- a/drivers/watchdog/alim1535_wdt.c +++ b/drivers/watchdog/alim1535_wdt.c | |||
@@ -31,7 +31,7 @@ static unsigned long ali_is_open; | |||
31 | static char ali_expect_release; | 31 | static char ali_expect_release; |
32 | static struct pci_dev *ali_pci; | 32 | static struct pci_dev *ali_pci; |
33 | static u32 ali_timeout_bits; /* stores the computed timeout */ | 33 | static u32 ali_timeout_bits; /* stores the computed timeout */ |
34 | static spinlock_t ali_lock; /* Guards the hardware */ | 34 | static DEFINE_SPINLOCK(ali_lock); /* Guards the hardware */ |
35 | 35 | ||
36 | /* module parameters */ | 36 | /* module parameters */ |
37 | static int timeout = WATCHDOG_TIMEOUT; | 37 | static int timeout = WATCHDOG_TIMEOUT; |
@@ -398,8 +398,6 @@ static int __init watchdog_init(void) | |||
398 | { | 398 | { |
399 | int ret; | 399 | int ret; |
400 | 400 | ||
401 | spin_lock_init(&ali_lock); | ||
402 | |||
403 | /* Check whether or not the hardware watchdog is there */ | 401 | /* Check whether or not the hardware watchdog is there */ |
404 | if (ali_find_watchdog() != 0) { | 402 | if (ali_find_watchdog() != 0) { |
405 | return -ENODEV; | 403 | return -ENODEV; |
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c index 19db5302ba6e..a61cbd48dc07 100644 --- a/drivers/watchdog/davinci_wdt.c +++ b/drivers/watchdog/davinci_wdt.c | |||
@@ -61,7 +61,7 @@ | |||
61 | 61 | ||
62 | static int heartbeat = DEFAULT_HEARTBEAT; | 62 | static int heartbeat = DEFAULT_HEARTBEAT; |
63 | 63 | ||
64 | static spinlock_t io_lock; | 64 | static DEFINE_SPINLOCK(io_lock); |
65 | static unsigned long wdt_status; | 65 | static unsigned long wdt_status; |
66 | #define WDT_IN_USE 0 | 66 | #define WDT_IN_USE 0 |
67 | #define WDT_OK_TO_CLOSE 1 | 67 | #define WDT_OK_TO_CLOSE 1 |
@@ -200,8 +200,6 @@ static int davinci_wdt_probe(struct platform_device *pdev) | |||
200 | int ret = 0, size; | 200 | int ret = 0, size; |
201 | struct resource *res; | 201 | struct resource *res; |
202 | 202 | ||
203 | spin_lock_init(&io_lock); | ||
204 | |||
205 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) | 203 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) |
206 | heartbeat = DEFAULT_HEARTBEAT; | 204 | heartbeat = DEFAULT_HEARTBEAT; |
207 | 205 | ||
@@ -262,7 +260,7 @@ static int __init davinci_wdt_init(void) | |||
262 | 260 | ||
263 | static void __exit davinci_wdt_exit(void) | 261 | static void __exit davinci_wdt_exit(void) |
264 | { | 262 | { |
265 | return platform_driver_unregister(&platform_wdt_driver); | 263 | platform_driver_unregister(&platform_wdt_driver); |
266 | } | 264 | } |
267 | 265 | ||
268 | module_init(davinci_wdt_init); | 266 | module_init(davinci_wdt_init); |
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c index f236954d2536..ca44fd9b19bb 100644 --- a/drivers/watchdog/i6300esb.c +++ b/drivers/watchdog/i6300esb.c | |||
@@ -77,7 +77,7 @@ | |||
77 | 77 | ||
78 | /* internal variables */ | 78 | /* internal variables */ |
79 | static void __iomem *BASEADDR; | 79 | static void __iomem *BASEADDR; |
80 | static spinlock_t esb_lock; /* Guards the hardware */ | 80 | static DEFINE_SPINLOCK(esb_lock); /* Guards the hardware */ |
81 | static unsigned long timer_alive; | 81 | static unsigned long timer_alive; |
82 | static struct pci_dev *esb_pci; | 82 | static struct pci_dev *esb_pci; |
83 | static unsigned short triggered; /* The status of the watchdog upon boot */ | 83 | static unsigned short triggered; /* The status of the watchdog upon boot */ |
@@ -456,8 +456,6 @@ static int __init watchdog_init (void) | |||
456 | { | 456 | { |
457 | int ret; | 457 | int ret; |
458 | 458 | ||
459 | spin_lock_init(&esb_lock); | ||
460 | |||
461 | /* Check whether or not the hardware watchdog is there */ | 459 | /* Check whether or not the hardware watchdog is there */ |
462 | if (!esb_getdevice () || esb_pci == NULL) | 460 | if (!esb_getdevice () || esb_pci == NULL) |
463 | return -ENODEV; | 461 | return -ENODEV; |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index cd5a565bc3a0..a0e6809e369f 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -35,10 +35,12 @@ | |||
35 | * 82801GDH (ICH7DH) : document number 307013-002, 307014-009, | 35 | * 82801GDH (ICH7DH) : document number 307013-002, 307014-009, |
36 | * 82801GBM (ICH7-M) : document number 307013-002, 307014-009, | 36 | * 82801GBM (ICH7-M) : document number 307013-002, 307014-009, |
37 | * 82801GHM (ICH7-M DH) : document number 307013-002, 307014-009, | 37 | * 82801GHM (ICH7-M DH) : document number 307013-002, 307014-009, |
38 | * 82801HB (ICH8) : document number 313056-002, 313057-004, | 38 | * 82801HB (ICH8) : document number 313056-003, 313057-009, |
39 | * 82801HR (ICH8R) : document number 313056-002, 313057-004, | 39 | * 82801HR (ICH8R) : document number 313056-003, 313057-009, |
40 | * 82801HH (ICH8DH) : document number 313056-002, 313057-004, | 40 | * 82801HBM (ICH8M) : document number 313056-003, 313057-009, |
41 | * 82801HO (ICH8DO) : document number 313056-002, 313057-004, | 41 | * 82801HH (ICH8DH) : document number 313056-003, 313057-009, |
42 | * 82801HO (ICH8DO) : document number 313056-003, 313057-009, | ||
43 | * 82801HEM (ICH8M-E) : document number 313056-003, 313057-009, | ||
42 | * 82801IB (ICH9) : document number 316972-001, 316973-001, | 44 | * 82801IB (ICH9) : document number 316972-001, 316973-001, |
43 | * 82801IR (ICH9R) : document number 316972-001, 316973-001, | 45 | * 82801IR (ICH9R) : document number 316972-001, 316973-001, |
44 | * 82801IH (ICH9DH) : document number 316972-001, 316973-001, | 46 | * 82801IH (ICH9DH) : document number 316972-001, 316973-001, |
@@ -95,8 +97,10 @@ enum iTCO_chipsets { | |||
95 | TCO_ICH7M, /* ICH7-M */ | 97 | TCO_ICH7M, /* ICH7-M */ |
96 | TCO_ICH7MDH, /* ICH7-M DH */ | 98 | TCO_ICH7MDH, /* ICH7-M DH */ |
97 | TCO_ICH8, /* ICH8 & ICH8R */ | 99 | TCO_ICH8, /* ICH8 & ICH8R */ |
100 | TCO_ICH8ME, /* ICH8M-E */ | ||
98 | TCO_ICH8DH, /* ICH8DH */ | 101 | TCO_ICH8DH, /* ICH8DH */ |
99 | TCO_ICH8DO, /* ICH8DO */ | 102 | TCO_ICH8DO, /* ICH8DO */ |
103 | TCO_ICH8M, /* ICH8M */ | ||
100 | TCO_ICH9, /* ICH9 */ | 104 | TCO_ICH9, /* ICH9 */ |
101 | TCO_ICH9R, /* ICH9R */ | 105 | TCO_ICH9R, /* ICH9R */ |
102 | TCO_ICH9DH, /* ICH9DH */ | 106 | TCO_ICH9DH, /* ICH9DH */ |
@@ -125,8 +129,10 @@ static struct { | |||
125 | {"ICH7-M", 2}, | 129 | {"ICH7-M", 2}, |
126 | {"ICH7-M DH", 2}, | 130 | {"ICH7-M DH", 2}, |
127 | {"ICH8 or ICH8R", 2}, | 131 | {"ICH8 or ICH8R", 2}, |
132 | {"ICH8M-E", 2}, | ||
128 | {"ICH8DH", 2}, | 133 | {"ICH8DH", 2}, |
129 | {"ICH8DO", 2}, | 134 | {"ICH8DO", 2}, |
135 | {"ICH8M", 2}, | ||
130 | {"ICH9", 2}, | 136 | {"ICH9", 2}, |
131 | {"ICH9R", 2}, | 137 | {"ICH9R", 2}, |
132 | {"ICH9DH", 2}, | 138 | {"ICH9DH", 2}, |
@@ -134,6 +140,15 @@ static struct { | |||
134 | {NULL,0} | 140 | {NULL,0} |
135 | }; | 141 | }; |
136 | 142 | ||
143 | #define ITCO_PCI_DEVICE(dev, data) \ | ||
144 | .vendor = PCI_VENDOR_ID_INTEL, \ | ||
145 | .device = dev, \ | ||
146 | .subvendor = PCI_ANY_ID, \ | ||
147 | .subdevice = PCI_ANY_ID, \ | ||
148 | .class = 0, \ | ||
149 | .class_mask = 0, \ | ||
150 | .driver_data = data | ||
151 | |||
137 | /* | 152 | /* |
138 | * This data only exists for exporting the supported PCI ids | 153 | * This data only exists for exporting the supported PCI ids |
139 | * via MODULE_DEVICE_TABLE. We do not actually register a | 154 | * via MODULE_DEVICE_TABLE. We do not actually register a |
@@ -141,45 +156,47 @@ static struct { | |||
141 | * functions that probably will be registered by other drivers. | 156 | * functions that probably will be registered by other drivers. |
142 | */ | 157 | */ |
143 | static struct pci_device_id iTCO_wdt_pci_tbl[] = { | 158 | static struct pci_device_id iTCO_wdt_pci_tbl[] = { |
144 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH }, | 159 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AA_0, TCO_ICH )}, |
145 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH0 }, | 160 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AB_0, TCO_ICH0 )}, |
146 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH2 }, | 161 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_0, TCO_ICH2 )}, |
147 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH2M }, | 162 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_10, TCO_ICH2M )}, |
148 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH3 }, | 163 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_0, TCO_ICH3 )}, |
149 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH3M }, | 164 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_12, TCO_ICH3M )}, |
150 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH4 }, | 165 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_0, TCO_ICH4 )}, |
151 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH4M }, | 166 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_12, TCO_ICH4M )}, |
152 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_CICH }, | 167 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801E_0, TCO_CICH )}, |
153 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH5 }, | 168 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801EB_0, TCO_ICH5 )}, |
154 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_6300ESB }, | 169 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB_1, TCO_6300ESB)}, |
155 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6 }, | 170 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_0, TCO_ICH6 )}, |
156 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6M }, | 171 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_1, TCO_ICH6M )}, |
157 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6W }, | 172 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_2, TCO_ICH6W )}, |
158 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7 }, | 173 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_0, TCO_ICH7 )}, |
159 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7M }, | 174 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_1, TCO_ICH7M )}, |
160 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7MDH }, | 175 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_31, TCO_ICH7MDH)}, |
161 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8 }, | 176 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_0, TCO_ICH8 )}, |
162 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DH }, | 177 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_1, TCO_ICH8ME )}, |
163 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DO }, | 178 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_2, TCO_ICH8DH )}, |
164 | { PCI_VENDOR_ID_INTEL, 0x2918, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9 }, | 179 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_3, TCO_ICH8DO )}, |
165 | { PCI_VENDOR_ID_INTEL, 0x2916, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9R }, | 180 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_4, TCO_ICH8M )}, |
166 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9DH }, | 181 | { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )}, |
167 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 182 | { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )}, |
168 | { PCI_VENDOR_ID_INTEL, 0x2671, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 183 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )}, |
169 | { PCI_VENDOR_ID_INTEL, 0x2672, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 184 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)}, |
170 | { PCI_VENDOR_ID_INTEL, 0x2673, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 185 | { ITCO_PCI_DEVICE(0x2671, TCO_631XESB)}, |
171 | { PCI_VENDOR_ID_INTEL, 0x2674, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 186 | { ITCO_PCI_DEVICE(0x2672, TCO_631XESB)}, |
172 | { PCI_VENDOR_ID_INTEL, 0x2675, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 187 | { ITCO_PCI_DEVICE(0x2673, TCO_631XESB)}, |
173 | { PCI_VENDOR_ID_INTEL, 0x2676, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 188 | { ITCO_PCI_DEVICE(0x2674, TCO_631XESB)}, |
174 | { PCI_VENDOR_ID_INTEL, 0x2677, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 189 | { ITCO_PCI_DEVICE(0x2675, TCO_631XESB)}, |
175 | { PCI_VENDOR_ID_INTEL, 0x2678, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 190 | { ITCO_PCI_DEVICE(0x2676, TCO_631XESB)}, |
176 | { PCI_VENDOR_ID_INTEL, 0x2679, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 191 | { ITCO_PCI_DEVICE(0x2677, TCO_631XESB)}, |
177 | { PCI_VENDOR_ID_INTEL, 0x267a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 192 | { ITCO_PCI_DEVICE(0x2678, TCO_631XESB)}, |
178 | { PCI_VENDOR_ID_INTEL, 0x267b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 193 | { ITCO_PCI_DEVICE(0x2679, TCO_631XESB)}, |
179 | { PCI_VENDOR_ID_INTEL, 0x267c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 194 | { ITCO_PCI_DEVICE(0x267a, TCO_631XESB)}, |
180 | { PCI_VENDOR_ID_INTEL, 0x267d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 195 | { ITCO_PCI_DEVICE(0x267b, TCO_631XESB)}, |
181 | { PCI_VENDOR_ID_INTEL, 0x267e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 196 | { ITCO_PCI_DEVICE(0x267c, TCO_631XESB)}, |
182 | { PCI_VENDOR_ID_INTEL, 0x267f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | 197 | { ITCO_PCI_DEVICE(0x267d, TCO_631XESB)}, |
198 | { ITCO_PCI_DEVICE(0x267e, TCO_631XESB)}, | ||
199 | { ITCO_PCI_DEVICE(0x267f, TCO_631XESB)}, | ||
183 | { 0, }, /* End of list */ | 200 | { 0, }, /* End of list */ |
184 | }; | 201 | }; |
185 | MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl); | 202 | MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl); |
@@ -300,6 +317,7 @@ static int iTCO_wdt_start(void) | |||
300 | 317 | ||
301 | /* disable chipset's NO_REBOOT bit */ | 318 | /* disable chipset's NO_REBOOT bit */ |
302 | if (iTCO_wdt_unset_NO_REBOOT_bit()) { | 319 | if (iTCO_wdt_unset_NO_REBOOT_bit()) { |
320 | spin_unlock(&iTCO_wdt_private.io_lock); | ||
303 | printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); | 321 | printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); |
304 | return -EIO; | 322 | return -EIO; |
305 | } | 323 | } |
@@ -590,7 +608,7 @@ static struct miscdevice iTCO_wdt_miscdev = { | |||
590 | * Init & exit routines | 608 | * Init & exit routines |
591 | */ | 609 | */ |
592 | 610 | ||
593 | static int iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device_id *ent, struct platform_device *dev) | 611 | static int __devinit iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device_id *ent, struct platform_device *dev) |
594 | { | 612 | { |
595 | int ret; | 613 | int ret; |
596 | u32 base_address; | 614 | u32 base_address; |
@@ -694,7 +712,7 @@ out: | |||
694 | return ret; | 712 | return ret; |
695 | } | 713 | } |
696 | 714 | ||
697 | static void iTCO_wdt_cleanup(void) | 715 | static void __devexit iTCO_wdt_cleanup(void) |
698 | { | 716 | { |
699 | /* Stop the timer before we leave */ | 717 | /* Stop the timer before we leave */ |
700 | if (!nowayout) | 718 | if (!nowayout) |
@@ -709,7 +727,7 @@ static void iTCO_wdt_cleanup(void) | |||
709 | iTCO_wdt_private.ACPIBASE = 0; | 727 | iTCO_wdt_private.ACPIBASE = 0; |
710 | } | 728 | } |
711 | 729 | ||
712 | static int iTCO_wdt_probe(struct platform_device *dev) | 730 | static int __devinit iTCO_wdt_probe(struct platform_device *dev) |
713 | { | 731 | { |
714 | int found = 0; | 732 | int found = 0; |
715 | struct pci_dev *pdev = NULL; | 733 | struct pci_dev *pdev = NULL; |
@@ -735,7 +753,7 @@ static int iTCO_wdt_probe(struct platform_device *dev) | |||
735 | return 0; | 753 | return 0; |
736 | } | 754 | } |
737 | 755 | ||
738 | static int iTCO_wdt_remove(struct platform_device *dev) | 756 | static int __devexit iTCO_wdt_remove(struct platform_device *dev) |
739 | { | 757 | { |
740 | if (iTCO_wdt_private.ACPIBASE) | 758 | if (iTCO_wdt_private.ACPIBASE) |
741 | iTCO_wdt_cleanup(); | 759 | iTCO_wdt_cleanup(); |
@@ -753,7 +771,7 @@ static void iTCO_wdt_shutdown(struct platform_device *dev) | |||
753 | 771 | ||
754 | static struct platform_driver iTCO_wdt_driver = { | 772 | static struct platform_driver iTCO_wdt_driver = { |
755 | .probe = iTCO_wdt_probe, | 773 | .probe = iTCO_wdt_probe, |
756 | .remove = iTCO_wdt_remove, | 774 | .remove = __devexit_p(iTCO_wdt_remove), |
757 | .shutdown = iTCO_wdt_shutdown, | 775 | .shutdown = iTCO_wdt_shutdown, |
758 | .suspend = iTCO_wdt_suspend, | 776 | .suspend = iTCO_wdt_suspend, |
759 | .resume = iTCO_wdt_resume, | 777 | .resume = iTCO_wdt_resume, |
diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c index c3a60f52ccb9..4b89f401691a 100644 --- a/drivers/watchdog/ib700wdt.c +++ b/drivers/watchdog/ib700wdt.c | |||
@@ -48,7 +48,7 @@ | |||
48 | 48 | ||
49 | static struct platform_device *ibwdt_platform_device; | 49 | static struct platform_device *ibwdt_platform_device; |
50 | static unsigned long ibwdt_is_open; | 50 | static unsigned long ibwdt_is_open; |
51 | static spinlock_t ibwdt_lock; | 51 | static DEFINE_SPINLOCK(ibwdt_lock); |
52 | static char expect_close; | 52 | static char expect_close; |
53 | 53 | ||
54 | /* Module information */ | 54 | /* Module information */ |
@@ -308,8 +308,6 @@ static int __devinit ibwdt_probe(struct platform_device *dev) | |||
308 | { | 308 | { |
309 | int res; | 309 | int res; |
310 | 310 | ||
311 | spin_lock_init(&ibwdt_lock); | ||
312 | |||
313 | #if WDT_START != WDT_STOP | 311 | #if WDT_START != WDT_STOP |
314 | if (!request_region(WDT_STOP, 1, "IB700 WDT")) { | 312 | if (!request_region(WDT_STOP, 1, "IB700 WDT")) { |
315 | printk (KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP); | 313 | printk (KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP); |
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c index 6d35bb112a5f..e6e07b4575eb 100644 --- a/drivers/watchdog/machzwd.c +++ b/drivers/watchdog/machzwd.c | |||
@@ -123,8 +123,8 @@ static void zf_ping(unsigned long data); | |||
123 | static int zf_action = GEN_RESET; | 123 | static int zf_action = GEN_RESET; |
124 | static unsigned long zf_is_open; | 124 | static unsigned long zf_is_open; |
125 | static char zf_expect_close; | 125 | static char zf_expect_close; |
126 | static spinlock_t zf_lock; | 126 | static DEFINE_SPINLOCK(zf_lock); |
127 | static spinlock_t zf_port_lock; | 127 | static DEFINE_SPINLOCK(zf_port_lock); |
128 | static DEFINE_TIMER(zf_timer, zf_ping, 0, 0); | 128 | static DEFINE_TIMER(zf_timer, zf_ping, 0, 0); |
129 | static unsigned long next_heartbeat = 0; | 129 | static unsigned long next_heartbeat = 0; |
130 | 130 | ||
@@ -438,9 +438,6 @@ static int __init zf_init(void) | |||
438 | 438 | ||
439 | zf_show_action(action); | 439 | zf_show_action(action); |
440 | 440 | ||
441 | spin_lock_init(&zf_lock); | ||
442 | spin_lock_init(&zf_port_lock); | ||
443 | |||
444 | if(!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")){ | 441 | if(!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")){ |
445 | printk(KERN_ERR "cannot reserve I/O ports at %d\n", | 442 | printk(KERN_ERR "cannot reserve I/O ports at %d\n", |
446 | ZF_IOBASE); | 443 | ZF_IOBASE); |
diff --git a/drivers/watchdog/mpc83xx_wdt.c b/drivers/watchdog/mpc83xx_wdt.c index a0bf95fb9763..6369f569517f 100644 --- a/drivers/watchdog/mpc83xx_wdt.c +++ b/drivers/watchdog/mpc83xx_wdt.c | |||
@@ -56,7 +56,7 @@ static int prescale = 1; | |||
56 | static unsigned int timeout_sec; | 56 | static unsigned int timeout_sec; |
57 | 57 | ||
58 | static unsigned long wdt_is_open; | 58 | static unsigned long wdt_is_open; |
59 | static spinlock_t wdt_spinlock; | 59 | static DEFINE_SPINLOCK(wdt_spinlock); |
60 | 60 | ||
61 | static void mpc83xx_wdt_keepalive(void) | 61 | static void mpc83xx_wdt_keepalive(void) |
62 | { | 62 | { |
@@ -185,9 +185,6 @@ static int __devinit mpc83xx_wdt_probe(struct platform_device *dev) | |||
185 | printk(KERN_INFO "WDT driver for MPC83xx initialized. " | 185 | printk(KERN_INFO "WDT driver for MPC83xx initialized. " |
186 | "mode:%s timeout=%d (%d seconds)\n", | 186 | "mode:%s timeout=%d (%d seconds)\n", |
187 | reset ? "reset":"interrupt", timeout, timeout_sec); | 187 | reset ? "reset":"interrupt", timeout, timeout_sec); |
188 | |||
189 | spin_lock_init(&wdt_spinlock); | ||
190 | |||
191 | return 0; | 188 | return 0; |
192 | 189 | ||
193 | err_unmap: | 190 | err_unmap: |
diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c index 3d3deae0d64b..15e4f8887a9e 100644 --- a/drivers/watchdog/pc87413_wdt.c +++ b/drivers/watchdog/pc87413_wdt.c | |||
@@ -61,7 +61,7 @@ static unsigned long timer_enabled = 0; /* is the timer enabled? */ | |||
61 | 61 | ||
62 | static char expect_close; /* is the close expected? */ | 62 | static char expect_close; /* is the close expected? */ |
63 | 63 | ||
64 | static spinlock_t io_lock; /* to guard the watchdog from io races */ | 64 | static DEFINE_SPINLOCK(io_lock);/* to guard the watchdog from io races */ |
65 | 65 | ||
66 | static int nowayout = WATCHDOG_NOWAYOUT; | 66 | static int nowayout = WATCHDOG_NOWAYOUT; |
67 | 67 | ||
@@ -561,8 +561,6 @@ static int __init pc87413_init(void) | |||
561 | { | 561 | { |
562 | int ret; | 562 | int ret; |
563 | 563 | ||
564 | spin_lock_init(&io_lock); | ||
565 | |||
566 | printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n", WDT_INDEX_IO_PORT); | 564 | printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n", WDT_INDEX_IO_PORT); |
567 | 565 | ||
568 | /* request_region(io, 2, "pc87413"); */ | 566 | /* request_region(io, 2, "pc87413"); */ |
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index 22f8873dd092..b04aa096a10a 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c | |||
@@ -80,7 +80,7 @@ | |||
80 | static int nowayout = WATCHDOG_NOWAYOUT; | 80 | static int nowayout = WATCHDOG_NOWAYOUT; |
81 | static int heartbeat = DEFAULT_HEARTBEAT; | 81 | static int heartbeat = DEFAULT_HEARTBEAT; |
82 | 82 | ||
83 | static spinlock_t io_lock; | 83 | static DEFINE_SPINLOCK(io_lock); |
84 | static unsigned long wdt_status; | 84 | static unsigned long wdt_status; |
85 | #define WDT_IN_USE 0 | 85 | #define WDT_IN_USE 0 |
86 | #define WDT_OK_TO_CLOSE 1 | 86 | #define WDT_OK_TO_CLOSE 1 |
@@ -254,8 +254,6 @@ static int pnx4008_wdt_probe(struct platform_device *pdev) | |||
254 | int ret = 0, size; | 254 | int ret = 0, size; |
255 | struct resource *res; | 255 | struct resource *res; |
256 | 256 | ||
257 | spin_lock_init(&io_lock); | ||
258 | |||
259 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) | 257 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) |
260 | heartbeat = DEFAULT_HEARTBEAT; | 258 | heartbeat = DEFAULT_HEARTBEAT; |
261 | 259 | ||
@@ -335,7 +333,7 @@ static int __init pnx4008_wdt_init(void) | |||
335 | 333 | ||
336 | static void __exit pnx4008_wdt_exit(void) | 334 | static void __exit pnx4008_wdt_exit(void) |
337 | { | 335 | { |
338 | return platform_driver_unregister(&platform_wdt_driver); | 336 | platform_driver_unregister(&platform_wdt_driver); |
339 | } | 337 | } |
340 | 338 | ||
341 | module_init(pnx4008_wdt_init); | 339 | module_init(pnx4008_wdt_init); |
diff --git a/drivers/watchdog/sbc8360.c b/drivers/watchdog/sbc8360.c index 285d85289532..2ee2677f3648 100644 --- a/drivers/watchdog/sbc8360.c +++ b/drivers/watchdog/sbc8360.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #include <asm/system.h> | 54 | #include <asm/system.h> |
55 | 55 | ||
56 | static unsigned long sbc8360_is_open; | 56 | static unsigned long sbc8360_is_open; |
57 | static spinlock_t sbc8360_lock; | 57 | static DEFINE_SPINLOCK(sbc8360_lock); |
58 | static char expect_close; | 58 | static char expect_close; |
59 | 59 | ||
60 | #define PFX "sbc8360: " | 60 | #define PFX "sbc8360: " |
@@ -359,7 +359,6 @@ static int __init sbc8360_init(void) | |||
359 | goto out_noreboot; | 359 | goto out_noreboot; |
360 | } | 360 | } |
361 | 361 | ||
362 | spin_lock_init(&sbc8360_lock); | ||
363 | res = misc_register(&sbc8360_miscdev); | 362 | res = misc_register(&sbc8360_miscdev); |
364 | if (res) { | 363 | if (res) { |
365 | printk(KERN_ERR PFX "failed to register misc device\n"); | 364 | printk(KERN_ERR PFX "failed to register misc device\n"); |
diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c index 9670d47190d0..32ccd7c89c7d 100644 --- a/drivers/watchdog/sc1200wdt.c +++ b/drivers/watchdog/sc1200wdt.c | |||
@@ -74,7 +74,7 @@ static int io = -1; | |||
74 | static int io_len = 2; /* for non plug and play */ | 74 | static int io_len = 2; /* for non plug and play */ |
75 | static struct semaphore open_sem; | 75 | static struct semaphore open_sem; |
76 | static char expect_close; | 76 | static char expect_close; |
77 | static spinlock_t sc1200wdt_lock; /* io port access serialisation */ | 77 | static DEFINE_SPINLOCK(sc1200wdt_lock); /* io port access serialisation */ |
78 | 78 | ||
79 | #if defined CONFIG_PNP | 79 | #if defined CONFIG_PNP |
80 | static int isapnp = 1; | 80 | static int isapnp = 1; |
@@ -375,7 +375,6 @@ static int __init sc1200wdt_init(void) | |||
375 | 375 | ||
376 | printk("%s\n", banner); | 376 | printk("%s\n", banner); |
377 | 377 | ||
378 | spin_lock_init(&sc1200wdt_lock); | ||
379 | sema_init(&open_sem, 1); | 378 | sema_init(&open_sem, 1); |
380 | 379 | ||
381 | #if defined CONFIG_PNP | 380 | #if defined CONFIG_PNP |
diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c index e8594c64d1e6..2847324a2be2 100644 --- a/drivers/watchdog/sc520_wdt.c +++ b/drivers/watchdog/sc520_wdt.c | |||
@@ -125,7 +125,7 @@ static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0); | |||
125 | static unsigned long next_heartbeat; | 125 | static unsigned long next_heartbeat; |
126 | static unsigned long wdt_is_open; | 126 | static unsigned long wdt_is_open; |
127 | static char wdt_expect_close; | 127 | static char wdt_expect_close; |
128 | static spinlock_t wdt_spinlock; | 128 | static DEFINE_SPINLOCK(wdt_spinlock); |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * Whack the dog | 131 | * Whack the dog |
@@ -383,8 +383,6 @@ static int __init sc520_wdt_init(void) | |||
383 | { | 383 | { |
384 | int rc = -EBUSY; | 384 | int rc = -EBUSY; |
385 | 385 | ||
386 | spin_lock_init(&wdt_spinlock); | ||
387 | |||
388 | /* Check that the timeout value is within it's range ; if not reset to the default */ | 386 | /* Check that the timeout value is within it's range ; if not reset to the default */ |
389 | if (wdt_set_heartbeat(timeout)) { | 387 | if (wdt_set_heartbeat(timeout)) { |
390 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | 388 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); |
diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c index d3cb0a766020..5d2b5ba61414 100644 --- a/drivers/watchdog/smsc37b787_wdt.c +++ b/drivers/watchdog/smsc37b787_wdt.c | |||
@@ -83,7 +83,7 @@ static unsigned long timer_enabled = 0; /* is the timer enabled? */ | |||
83 | 83 | ||
84 | static char expect_close; /* is the close expected? */ | 84 | static char expect_close; /* is the close expected? */ |
85 | 85 | ||
86 | static spinlock_t io_lock; /* to guard the watchdog from io races */ | 86 | static DEFINE_SPINLOCK(io_lock);/* to guard the watchdog from io races */ |
87 | 87 | ||
88 | static int nowayout = WATCHDOG_NOWAYOUT; | 88 | static int nowayout = WATCHDOG_NOWAYOUT; |
89 | 89 | ||
@@ -540,8 +540,6 @@ static int __init wb_smsc_wdt_init(void) | |||
540 | { | 540 | { |
541 | int ret; | 541 | int ret; |
542 | 542 | ||
543 | spin_lock_init(&io_lock); | ||
544 | |||
545 | printk("SMsC 37B787 watchdog component driver " VERSION " initialising...\n"); | 543 | printk("SMsC 37B787 watchdog component driver " VERSION " initialising...\n"); |
546 | 544 | ||
547 | if (!request_region(IOPORT, IOPORT_SIZE, "SMsC 37B787 watchdog")) { | 545 | if (!request_region(IOPORT, IOPORT_SIZE, "SMsC 37B787 watchdog")) { |
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c index df33b3b5a53c..386492821fc2 100644 --- a/drivers/watchdog/w83627hf_wdt.c +++ b/drivers/watchdog/w83627hf_wdt.c | |||
@@ -48,7 +48,7 @@ | |||
48 | 48 | ||
49 | static unsigned long wdt_is_open; | 49 | static unsigned long wdt_is_open; |
50 | static char expect_close; | 50 | static char expect_close; |
51 | static spinlock_t io_lock; | 51 | static DEFINE_SPINLOCK(io_lock); |
52 | 52 | ||
53 | /* You must set this - there is no sane way to probe for this board. */ | 53 | /* You must set this - there is no sane way to probe for this board. */ |
54 | static int wdt_io = 0x2E; | 54 | static int wdt_io = 0x2E; |
@@ -328,8 +328,6 @@ wdt_init(void) | |||
328 | { | 328 | { |
329 | int ret; | 329 | int ret; |
330 | 330 | ||
331 | spin_lock_init(&io_lock); | ||
332 | |||
333 | printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.\n"); | 331 | printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.\n"); |
334 | 332 | ||
335 | if (wdt_set_heartbeat(timeout)) { | 333 | if (wdt_set_heartbeat(timeout)) { |
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c index 51826c216d6d..c622a0e6c9ae 100644 --- a/drivers/watchdog/w83697hf_wdt.c +++ b/drivers/watchdog/w83697hf_wdt.c | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | static unsigned long wdt_is_open; | 48 | static unsigned long wdt_is_open; |
49 | static char expect_close; | 49 | static char expect_close; |
50 | static spinlock_t io_lock; | 50 | static DEFINE_SPINLOCK(io_lock); |
51 | 51 | ||
52 | /* You must set this - there is no sane way to probe for this board. */ | 52 | /* You must set this - there is no sane way to probe for this board. */ |
53 | static int wdt_io = 0x2e; | 53 | static int wdt_io = 0x2e; |
@@ -376,8 +376,6 @@ wdt_init(void) | |||
376 | { | 376 | { |
377 | int ret, i, found = 0; | 377 | int ret, i, found = 0; |
378 | 378 | ||
379 | spin_lock_init(&io_lock); | ||
380 | |||
381 | printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n"); | 379 | printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n"); |
382 | 380 | ||
383 | if (wdt_io == 0) { | 381 | if (wdt_io == 0) { |
diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c index 3c88fe18f4f4..bcc9d48955de 100644 --- a/drivers/watchdog/w83877f_wdt.c +++ b/drivers/watchdog/w83877f_wdt.c | |||
@@ -94,7 +94,7 @@ static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0); | |||
94 | static unsigned long next_heartbeat; | 94 | static unsigned long next_heartbeat; |
95 | static unsigned long wdt_is_open; | 95 | static unsigned long wdt_is_open; |
96 | static char wdt_expect_close; | 96 | static char wdt_expect_close; |
97 | static spinlock_t wdt_spinlock; | 97 | static DEFINE_SPINLOCK(wdt_spinlock); |
98 | 98 | ||
99 | /* | 99 | /* |
100 | * Whack the dog | 100 | * Whack the dog |
@@ -350,8 +350,6 @@ static int __init w83877f_wdt_init(void) | |||
350 | { | 350 | { |
351 | int rc = -EBUSY; | 351 | int rc = -EBUSY; |
352 | 352 | ||
353 | spin_lock_init(&wdt_spinlock); | ||
354 | |||
355 | if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */ | 353 | if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */ |
356 | { | 354 | { |
357 | timeout = WATCHDOG_TIMEOUT; | 355 | timeout = WATCHDOG_TIMEOUT; |
diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c index 157968442891..b475529d2475 100644 --- a/drivers/watchdog/w83977f_wdt.c +++ b/drivers/watchdog/w83977f_wdt.c | |||
@@ -50,7 +50,7 @@ static int timeoutW; /* timeout in watchdog counter units */ | |||
50 | static unsigned long timer_alive; | 50 | static unsigned long timer_alive; |
51 | static int testmode; | 51 | static int testmode; |
52 | static char expect_close; | 52 | static char expect_close; |
53 | static spinlock_t spinlock; | 53 | static DEFINE_SPINLOCK(spinlock); |
54 | 54 | ||
55 | module_param(timeout, int, 0); | 55 | module_param(timeout, int, 0); |
56 | MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (15..7635), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")"); | 56 | MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (15..7635), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")"); |
@@ -476,8 +476,6 @@ static int __init w83977f_wdt_init(void) | |||
476 | 476 | ||
477 | printk(KERN_INFO PFX DRIVER_VERSION); | 477 | printk(KERN_INFO PFX DRIVER_VERSION); |
478 | 478 | ||
479 | spin_lock_init(&spinlock); | ||
480 | |||
481 | /* | 479 | /* |
482 | * Check that the timeout value is within it's range ; | 480 | * Check that the timeout value is within it's range ; |
483 | * if not reset to the default | 481 | * if not reset to the default |
diff --git a/drivers/watchdog/wafer5823wdt.c b/drivers/watchdog/wafer5823wdt.c index 950905d3c39f..9e368091f799 100644 --- a/drivers/watchdog/wafer5823wdt.c +++ b/drivers/watchdog/wafer5823wdt.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | static unsigned long wafwdt_is_open; | 46 | static unsigned long wafwdt_is_open; |
47 | static char expect_close; | 47 | static char expect_close; |
48 | static spinlock_t wafwdt_lock; | 48 | static DEFINE_SPINLOCK(wafwdt_lock); |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * You must set these - there is no sane way to probe for this board. | 51 | * You must set these - there is no sane way to probe for this board. |
@@ -252,8 +252,6 @@ static int __init wafwdt_init(void) | |||
252 | 252 | ||
253 | printk(KERN_INFO "WDT driver for Wafer 5823 single board computer initialising.\n"); | 253 | printk(KERN_INFO "WDT driver for Wafer 5823 single board computer initialising.\n"); |
254 | 254 | ||
255 | spin_lock_init(&wafwdt_lock); | ||
256 | |||
257 | if (timeout < 1 || timeout > 255) { | 255 | if (timeout < 1 || timeout > 255) { |
258 | timeout = WD_TIMO; | 256 | timeout = WD_TIMO; |
259 | printk (KERN_INFO PFX "timeout value must be 1<=x<=255, using %d\n", | 257 | printk (KERN_INFO PFX "timeout value must be 1<=x<=255, using %d\n", |
diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c index 0a3de6a02442..53d0bb410df8 100644 --- a/drivers/watchdog/wdt.c +++ b/drivers/watchdog/wdt.c | |||
@@ -253,7 +253,7 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id) | |||
253 | printk(KERN_CRIT "Possible fan fault.\n"); | 253 | printk(KERN_CRIT "Possible fan fault.\n"); |
254 | } | 254 | } |
255 | #endif /* CONFIG_WDT_501 */ | 255 | #endif /* CONFIG_WDT_501 */ |
256 | if (!(status & WDC_SR_WCCR)) | 256 | if (!(status & WDC_SR_WCCR)) { |
257 | #ifdef SOFTWARE_REBOOT | 257 | #ifdef SOFTWARE_REBOOT |
258 | #ifdef ONLY_TESTING | 258 | #ifdef ONLY_TESTING |
259 | printk(KERN_CRIT "Would Reboot.\n"); | 259 | printk(KERN_CRIT "Would Reboot.\n"); |
@@ -264,6 +264,7 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id) | |||
264 | #else | 264 | #else |
265 | printk(KERN_CRIT "Reset in 5ms.\n"); | 265 | printk(KERN_CRIT "Reset in 5ms.\n"); |
266 | #endif | 266 | #endif |
267 | } | ||
267 | return IRQ_HANDLED; | 268 | return IRQ_HANDLED; |
268 | } | 269 | } |
269 | 270 | ||
diff --git a/drivers/watchdog/wdt977.c b/drivers/watchdog/wdt977.c index 7d300ff7ab07..9b7f6b6edef6 100644 --- a/drivers/watchdog/wdt977.c +++ b/drivers/watchdog/wdt977.c | |||
@@ -59,7 +59,7 @@ static int timeoutM; /* timeout in minutes */ | |||
59 | static unsigned long timer_alive; | 59 | static unsigned long timer_alive; |
60 | static int testmode; | 60 | static int testmode; |
61 | static char expect_close; | 61 | static char expect_close; |
62 | static spinlock_t spinlock; | 62 | static DEFINE_SPINLOCK(spinlock); |
63 | 63 | ||
64 | module_param(timeout, int, 0); | 64 | module_param(timeout, int, 0); |
65 | MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (60..15300), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")"); | 65 | MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (60..15300), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")"); |
@@ -448,8 +448,6 @@ static int __init wd977_init(void) | |||
448 | 448 | ||
449 | printk(KERN_INFO PFX DRIVER_VERSION); | 449 | printk(KERN_INFO PFX DRIVER_VERSION); |
450 | 450 | ||
451 | spin_lock_init(&spinlock); | ||
452 | |||
453 | /* Check that the timeout value is within it's range ; if not reset to the default */ | 451 | /* Check that the timeout value is within it's range ; if not reset to the default */ |
454 | if (wdt977_set_timeout(timeout)) | 452 | if (wdt977_set_timeout(timeout)) |
455 | { | 453 | { |
diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c index 6baf4ae42c9d..1355608683e4 100644 --- a/drivers/watchdog/wdt_pci.c +++ b/drivers/watchdog/wdt_pci.c | |||
@@ -74,7 +74,7 @@ | |||
74 | static int dev_count; | 74 | static int dev_count; |
75 | 75 | ||
76 | static struct semaphore open_sem; | 76 | static struct semaphore open_sem; |
77 | static spinlock_t wdtpci_lock; | 77 | static DEFINE_SPINLOCK(wdtpci_lock); |
78 | static char expect_close; | 78 | static char expect_close; |
79 | 79 | ||
80 | static int io; | 80 | static int io; |
@@ -298,7 +298,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id) | |||
298 | printk(KERN_CRIT PFX "Possible fan fault.\n"); | 298 | printk(KERN_CRIT PFX "Possible fan fault.\n"); |
299 | } | 299 | } |
300 | #endif /* CONFIG_WDT_501_PCI */ | 300 | #endif /* CONFIG_WDT_501_PCI */ |
301 | if (!(status&WDC_SR_WCCR)) | 301 | if (!(status&WDC_SR_WCCR)) { |
302 | #ifdef SOFTWARE_REBOOT | 302 | #ifdef SOFTWARE_REBOOT |
303 | #ifdef ONLY_TESTING | 303 | #ifdef ONLY_TESTING |
304 | printk(KERN_CRIT PFX "Would Reboot.\n"); | 304 | printk(KERN_CRIT PFX "Would Reboot.\n"); |
@@ -309,6 +309,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id) | |||
309 | #else | 309 | #else |
310 | printk(KERN_CRIT PFX "Reset in 5ms.\n"); | 310 | printk(KERN_CRIT PFX "Reset in 5ms.\n"); |
311 | #endif | 311 | #endif |
312 | } | ||
312 | return IRQ_HANDLED; | 313 | return IRQ_HANDLED; |
313 | } | 314 | } |
314 | 315 | ||
@@ -606,7 +607,6 @@ static int __devinit wdtpci_init_one (struct pci_dev *dev, | |||
606 | } | 607 | } |
607 | 608 | ||
608 | sema_init(&open_sem, 1); | 609 | sema_init(&open_sem, 1); |
609 | spin_lock_init(&wdtpci_lock); | ||
610 | 610 | ||
611 | irq = dev->irq; | 611 | irq = dev->irq; |
612 | io = pci_resource_start (dev, 2); | 612 | io = pci_resource_start (dev, 2); |
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 | ||