diff options
Diffstat (limited to 'drivers')
171 files changed, 3708 insertions, 1607 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 5d0e26a5c34c..da3a08fa9e4f 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 |
@@ -88,7 +88,8 @@ config ACPI_PROC_EVENT | |||
88 | 88 | ||
89 | config ACPI_AC | 89 | config ACPI_AC |
90 | tristate "AC Adapter" | 90 | tristate "AC Adapter" |
91 | depends on X86 && POWER_SUPPLY | 91 | depends on X86 |
92 | select POWER_SUPPLY | ||
92 | default y | 93 | default y |
93 | help | 94 | help |
94 | This driver adds support for the AC Adapter object, which indicates | 95 | This driver adds support for the AC Adapter object, which indicates |
@@ -97,7 +98,8 @@ config ACPI_AC | |||
97 | 98 | ||
98 | config ACPI_BATTERY | 99 | config ACPI_BATTERY |
99 | tristate "Battery" | 100 | tristate "Battery" |
100 | depends on X86 && POWER_SUPPLY | 101 | depends on X86 |
102 | select POWER_SUPPLY | ||
101 | default y | 103 | default y |
102 | help | 104 | help |
103 | This driver adds support for battery information through | 105 | This driver adds support for battery information through |
@@ -352,7 +354,7 @@ config ACPI_HOTPLUG_MEMORY | |||
352 | config ACPI_SBS | 354 | config ACPI_SBS |
353 | tristate "Smart Battery System" | 355 | tristate "Smart Battery System" |
354 | depends on X86 | 356 | depends on X86 |
355 | depends on POWER_SUPPLY | 357 | select POWER_SUPPLY |
356 | help | 358 | help |
357 | This driver adds support for the Smart Battery System, another | 359 | This driver adds support for the Smart Battery System, another |
358 | type of access to battery information, found on some laptops. | 360 | type of access to battery information, found on some laptops. |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 681e26b56b11..c2ce0ad21693 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -125,11 +125,15 @@ 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_update(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) |
@@ -139,6 +143,7 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
139 | if ((!acpi_battery_present(battery)) && | 143 | if ((!acpi_battery_present(battery)) && |
140 | psp != POWER_SUPPLY_PROP_PRESENT) | 144 | psp != POWER_SUPPLY_PROP_PRESENT) |
141 | return -ENODEV; | 145 | return -ENODEV; |
146 | acpi_battery_update(battery); | ||
142 | switch (psp) { | 147 | switch (psp) { |
143 | case POWER_SUPPLY_PROP_STATUS: | 148 | case POWER_SUPPLY_PROP_STATUS: |
144 | if (battery->state & 0x01) | 149 | if (battery->state & 0x01) |
@@ -257,7 +262,7 @@ static int extract_package(struct acpi_battery *battery, | |||
257 | union acpi_object *package, | 262 | union acpi_object *package, |
258 | struct acpi_offsets *offsets, int num) | 263 | struct acpi_offsets *offsets, int num) |
259 | { | 264 | { |
260 | int i, *x; | 265 | int i; |
261 | union acpi_object *element; | 266 | union acpi_object *element; |
262 | if (package->type != ACPI_TYPE_PACKAGE) | 267 | if (package->type != ACPI_TYPE_PACKAGE) |
263 | return -EFAULT; | 268 | return -EFAULT; |
@@ -266,16 +271,21 @@ static int extract_package(struct acpi_battery *battery, | |||
266 | return -EFAULT; | 271 | return -EFAULT; |
267 | element = &package->package.elements[i]; | 272 | element = &package->package.elements[i]; |
268 | if (offsets[i].mode) { | 273 | if (offsets[i].mode) { |
269 | if (element->type != ACPI_TYPE_STRING && | 274 | u8 *ptr = (u8 *)battery + offsets[i].offset; |
270 | element->type != ACPI_TYPE_BUFFER) | 275 | if (element->type == ACPI_TYPE_STRING || |
271 | return -EFAULT; | 276 | element->type == ACPI_TYPE_BUFFER) |
272 | strncpy((u8 *)battery + offsets[i].offset, | 277 | strncpy(ptr, element->string.pointer, 32); |
273 | element->string.pointer, 32); | 278 | else if (element->type == ACPI_TYPE_INTEGER) { |
279 | strncpy(ptr, (u8 *)&element->integer.value, | ||
280 | sizeof(acpi_integer)); | ||
281 | ptr[sizeof(acpi_integer)] = 0; | ||
282 | } else return -EFAULT; | ||
274 | } else { | 283 | } else { |
275 | if (element->type != ACPI_TYPE_INTEGER) | 284 | if (element->type == ACPI_TYPE_INTEGER) { |
276 | return -EFAULT; | 285 | int *x = (int *)((u8 *)battery + |
277 | x = (int *)((u8 *)battery + offsets[i].offset); | 286 | offsets[i].offset); |
278 | *x = element->integer.value; | 287 | *x = element->integer.value; |
288 | } else return -EFAULT; | ||
279 | } | 289 | } |
280 | } | 290 | } |
281 | return 0; | 291 | return 0; |
@@ -385,29 +395,81 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery) | |||
385 | return acpi_battery_set_alarm(battery); | 395 | return acpi_battery_set_alarm(battery); |
386 | } | 396 | } |
387 | 397 | ||
398 | static ssize_t acpi_battery_alarm_show(struct device *dev, | ||
399 | struct device_attribute *attr, | ||
400 | char *buf) | ||
401 | { | ||
402 | struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); | ||
403 | return sprintf(buf, "%d\n", battery->alarm * 1000); | ||
404 | } | ||
405 | |||
406 | static ssize_t acpi_battery_alarm_store(struct device *dev, | ||
407 | struct device_attribute *attr, | ||
408 | const char *buf, size_t count) | ||
409 | { | ||
410 | unsigned long x; | ||
411 | struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); | ||
412 | if (sscanf(buf, "%ld\n", &x) == 1) | ||
413 | battery->alarm = x/1000; | ||
414 | if (acpi_battery_present(battery)) | ||
415 | acpi_battery_set_alarm(battery); | ||
416 | return count; | ||
417 | } | ||
418 | |||
419 | static struct device_attribute alarm_attr = { | ||
420 | .attr = {.name = "alarm", .mode = 0644, .owner = THIS_MODULE}, | ||
421 | .show = acpi_battery_alarm_show, | ||
422 | .store = acpi_battery_alarm_store, | ||
423 | }; | ||
424 | |||
425 | static int sysfs_add_battery(struct acpi_battery *battery) | ||
426 | { | ||
427 | int result; | ||
428 | |||
429 | battery->update_time = 0; | ||
430 | result = acpi_battery_get_info(battery); | ||
431 | acpi_battery_init_alarm(battery); | ||
432 | if (result) | ||
433 | return result; | ||
434 | if (battery->power_unit) { | ||
435 | battery->bat.properties = charge_battery_props; | ||
436 | battery->bat.num_properties = | ||
437 | ARRAY_SIZE(charge_battery_props); | ||
438 | } else { | ||
439 | battery->bat.properties = energy_battery_props; | ||
440 | battery->bat.num_properties = | ||
441 | ARRAY_SIZE(energy_battery_props); | ||
442 | } | ||
443 | |||
444 | battery->bat.name = acpi_device_bid(battery->device); | ||
445 | battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; | ||
446 | battery->bat.get_property = acpi_battery_get_property; | ||
447 | |||
448 | result = power_supply_register(&battery->device->dev, &battery->bat); | ||
449 | if (result) | ||
450 | return result; | ||
451 | return device_create_file(battery->bat.dev, &alarm_attr); | ||
452 | } | ||
453 | |||
454 | static void sysfs_remove_battery(struct acpi_battery *battery) | ||
455 | { | ||
456 | if (!battery->bat.dev) | ||
457 | return; | ||
458 | device_remove_file(battery->bat.dev, &alarm_attr); | ||
459 | power_supply_unregister(&battery->bat); | ||
460 | } | ||
461 | |||
388 | static int acpi_battery_update(struct acpi_battery *battery) | 462 | static int acpi_battery_update(struct acpi_battery *battery) |
389 | { | 463 | { |
390 | int saved_present = acpi_battery_present(battery); | ||
391 | int result = acpi_battery_get_status(battery); | 464 | int result = acpi_battery_get_status(battery); |
392 | if (result || !acpi_battery_present(battery)) | 465 | if (result) |
393 | return result; | 466 | return result; |
394 | if (saved_present != acpi_battery_present(battery) || | 467 | if (!acpi_battery_present(battery)) { |
395 | !battery->update_time) { | 468 | sysfs_remove_battery(battery); |
396 | battery->update_time = 0; | 469 | 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 | } | 470 | } |
471 | if (!battery->bat.dev) | ||
472 | sysfs_add_battery(battery); | ||
411 | return acpi_battery_get_state(battery); | 473 | return acpi_battery_get_state(battery); |
412 | } | 474 | } |
413 | 475 | ||
@@ -554,10 +616,6 @@ static ssize_t acpi_battery_write_alarm(struct file *file, | |||
554 | 616 | ||
555 | if (!battery || (count > sizeof(alarm_string) - 1)) | 617 | if (!battery || (count > sizeof(alarm_string) - 1)) |
556 | return -EINVAL; | 618 | return -EINVAL; |
557 | if (result) { | ||
558 | result = -ENODEV; | ||
559 | goto end; | ||
560 | } | ||
561 | if (!acpi_battery_present(battery)) { | 619 | if (!acpi_battery_present(battery)) { |
562 | result = -ENODEV; | 620 | result = -ENODEV; |
563 | goto end; | 621 | goto end; |
@@ -688,33 +746,6 @@ static void acpi_battery_remove_fs(struct acpi_device *device) | |||
688 | 746 | ||
689 | #endif | 747 | #endif |
690 | 748 | ||
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 | /* -------------------------------------------------------------------------- | 749 | /* -------------------------------------------------------------------------- |
719 | Driver Interface | 750 | Driver Interface |
720 | -------------------------------------------------------------------------- */ | 751 | -------------------------------------------------------------------------- */ |
@@ -732,7 +763,9 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) | |||
732 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 763 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
733 | device->dev.bus_id, event, | 764 | device->dev.bus_id, event, |
734 | acpi_battery_present(battery)); | 765 | acpi_battery_present(battery)); |
735 | kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); | 766 | /* acpi_batter_update could remove power_supply object */ |
767 | if (battery->bat.dev) | ||
768 | kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); | ||
736 | } | 769 | } |
737 | 770 | ||
738 | static int acpi_battery_add(struct acpi_device *device) | 771 | static int acpi_battery_add(struct acpi_device *device) |
@@ -756,11 +789,6 @@ static int acpi_battery_add(struct acpi_device *device) | |||
756 | if (result) | 789 | if (result) |
757 | goto end; | 790 | goto end; |
758 | #endif | 791 | #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, | 792 | status = acpi_install_notify_handler(device->handle, |
765 | ACPI_ALL_NOTIFY, | 793 | ACPI_ALL_NOTIFY, |
766 | acpi_battery_notify, battery); | 794 | acpi_battery_notify, battery); |
@@ -796,10 +824,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
796 | #ifdef CONFIG_ACPI_PROCFS | 824 | #ifdef CONFIG_ACPI_PROCFS |
797 | acpi_battery_remove_fs(device); | 825 | acpi_battery_remove_fs(device); |
798 | #endif | 826 | #endif |
799 | if (battery->bat.dev) { | 827 | 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); | 828 | mutex_destroy(&battery->lock); |
804 | kfree(battery); | 829 | kfree(battery); |
805 | return 0; | 830 | return 0; |
@@ -813,6 +838,7 @@ static int acpi_battery_resume(struct acpi_device *device) | |||
813 | return -EINVAL; | 838 | return -EINVAL; |
814 | battery = acpi_driver_data(device); | 839 | battery = acpi_driver_data(device); |
815 | battery->update_time = 0; | 840 | battery->update_time = 0; |
841 | acpi_battery_update(battery); | ||
816 | return 0; | 842 | return 0; |
817 | } | 843 | } |
818 | 844 | ||
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..06b78e5e33a1 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -65,16 +65,18 @@ enum ec_command { | |||
65 | /* EC events */ | 65 | /* EC events */ |
66 | enum ec_event { | 66 | enum ec_event { |
67 | ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ | 67 | ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ |
68 | ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ | 68 | ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ |
69 | }; | 69 | }; |
70 | 70 | ||
71 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ | 71 | #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 */ | 72 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
73 | 73 | ||
74 | static enum ec_mode { | 74 | enum { |
75 | EC_INTR = 1, /* Output buffer full */ | 75 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ |
76 | EC_POLL, /* Input buffer empty */ | 76 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
77 | } acpi_ec_mode = EC_INTR; | 77 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ |
78 | EC_FLAGS_ONLY_IBF_GPE, /* Expect GPE only for IBF = 0 event */ | ||
79 | }; | ||
78 | 80 | ||
79 | static int acpi_ec_remove(struct acpi_device *device, int type); | 81 | static int acpi_ec_remove(struct acpi_device *device, int type); |
80 | static int acpi_ec_start(struct acpi_device *device); | 82 | static int acpi_ec_start(struct acpi_device *device); |
@@ -116,9 +118,8 @@ static struct acpi_ec { | |||
116 | unsigned long command_addr; | 118 | unsigned long command_addr; |
117 | unsigned long data_addr; | 119 | unsigned long data_addr; |
118 | unsigned long global_lock; | 120 | unsigned long global_lock; |
121 | unsigned long flags; | ||
119 | struct mutex lock; | 122 | struct mutex lock; |
120 | atomic_t query_pending; | ||
121 | atomic_t event_count; | ||
122 | wait_queue_head_t wait; | 123 | wait_queue_head_t wait; |
123 | struct list_head list; | 124 | struct list_head list; |
124 | u8 handlers_installed; | 125 | u8 handlers_installed; |
@@ -148,45 +149,54 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) | |||
148 | outb(data, ec->data_addr); | 149 | outb(data, ec->data_addr); |
149 | } | 150 | } |
150 | 151 | ||
151 | static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event, | 152 | static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) |
152 | unsigned old_count) | ||
153 | { | 153 | { |
154 | u8 status = acpi_ec_read_status(ec); | 154 | if (test_bit(EC_FLAGS_WAIT_GPE, &ec->flags)) |
155 | if (old_count == atomic_read(&ec->event_count)) | ||
156 | return 0; | 155 | return 0; |
157 | if (event == ACPI_EC_EVENT_OBF_1) { | 156 | if (event == ACPI_EC_EVENT_OBF_1) { |
158 | if (status & ACPI_EC_FLAG_OBF) | 157 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF) |
159 | return 1; | 158 | return 1; |
160 | } else if (event == ACPI_EC_EVENT_IBF_0) { | 159 | } else if (event == ACPI_EC_EVENT_IBF_0) { |
161 | if (!(status & ACPI_EC_FLAG_IBF)) | 160 | if (!(acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF)) |
162 | return 1; | 161 | return 1; |
163 | } | 162 | } |
164 | 163 | ||
165 | return 0; | 164 | return 0; |
166 | } | 165 | } |
167 | 166 | ||
168 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, | 167 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) |
169 | unsigned count, int force_poll) | ||
170 | { | 168 | { |
171 | if (unlikely(force_poll) || acpi_ec_mode == EC_POLL) { | 169 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && |
170 | likely(!force_poll)) { | ||
171 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), | ||
172 | msecs_to_jiffies(ACPI_EC_DELAY))) | ||
173 | return 0; | ||
174 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | ||
175 | if (acpi_ec_check_status(ec, event)) { | ||
176 | if (event == ACPI_EC_EVENT_OBF_1) { | ||
177 | /* miss OBF = 1 GPE, don't expect it anymore */ | ||
178 | printk(KERN_INFO PREFIX "missing OBF_1 confirmation," | ||
179 | "switching to degraded mode.\n"); | ||
180 | set_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags); | ||
181 | } else { | ||
182 | /* missing GPEs, switch back to poll mode */ | ||
183 | printk(KERN_INFO PREFIX "missing IBF_1 confirmations," | ||
184 | "switch off interrupt mode.\n"); | ||
185 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
186 | } | ||
187 | return 0; | ||
188 | } | ||
189 | } else { | ||
172 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 190 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
191 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | ||
173 | while (time_before(jiffies, delay)) { | 192 | while (time_before(jiffies, delay)) { |
174 | if (acpi_ec_check_status(ec, event, 0)) | 193 | if (acpi_ec_check_status(ec, event)) |
175 | return 0; | 194 | return 0; |
176 | } | 195 | } |
177 | } else { | 196 | } |
178 | if (wait_event_timeout(ec->wait, | 197 | printk(KERN_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", | 198 | " status = %d, expect_event = %d\n", |
186 | acpi_ec_read_status(ec), event); | 199 | acpi_ec_read_status(ec), event); |
187 | } | ||
188 | } | ||
189 | |||
190 | return -ETIME; | 200 | return -ETIME; |
191 | } | 201 | } |
192 | 202 | ||
@@ -196,39 +206,42 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
196 | int force_poll) | 206 | int force_poll) |
197 | { | 207 | { |
198 | int result = 0; | 208 | int result = 0; |
199 | unsigned count = atomic_read(&ec->event_count); | 209 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
200 | acpi_ec_write_cmd(ec, command); | 210 | acpi_ec_write_cmd(ec, command); |
201 | 211 | ||
202 | for (; wdata_len > 0; --wdata_len) { | 212 | for (; wdata_len > 0; --wdata_len) { |
203 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll); | 213 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); |
204 | if (result) { | 214 | if (result) { |
205 | printk(KERN_ERR PREFIX | 215 | printk(KERN_ERR PREFIX |
206 | "write_cmd timeout, command = %d\n", command); | 216 | "write_cmd timeout, command = %d\n", command); |
207 | goto end; | 217 | goto end; |
208 | } | 218 | } |
209 | count = atomic_read(&ec->event_count); | 219 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
210 | acpi_ec_write_data(ec, *(wdata++)); | 220 | acpi_ec_write_data(ec, *(wdata++)); |
211 | } | 221 | } |
212 | 222 | ||
213 | if (!rdata_len) { | 223 | if (!rdata_len) { |
214 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll); | 224 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); |
215 | if (result) { | 225 | if (result) { |
216 | printk(KERN_ERR PREFIX | 226 | printk(KERN_ERR PREFIX |
217 | "finish-write timeout, command = %d\n", command); | 227 | "finish-write timeout, command = %d\n", command); |
218 | goto end; | 228 | goto end; |
219 | } | 229 | } |
220 | } else if (command == ACPI_EC_COMMAND_QUERY) { | 230 | } else if (command == ACPI_EC_COMMAND_QUERY) |
221 | atomic_set(&ec->query_pending, 0); | 231 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
222 | } | ||
223 | 232 | ||
224 | for (; rdata_len > 0; --rdata_len) { | 233 | for (; rdata_len > 0; --rdata_len) { |
225 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count, force_poll); | 234 | if (test_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags)) |
235 | force_poll = 1; | ||
236 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll); | ||
226 | if (result) { | 237 | if (result) { |
227 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", | 238 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", |
228 | command); | 239 | command); |
229 | goto end; | 240 | goto end; |
230 | } | 241 | } |
231 | count = atomic_read(&ec->event_count); | 242 | /* Don't expect GPE after last read */ |
243 | if (rdata_len > 1) | ||
244 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | ||
232 | *(rdata++) = acpi_ec_read_data(ec); | 245 | *(rdata++) = acpi_ec_read_data(ec); |
233 | } | 246 | } |
234 | end: | 247 | end: |
@@ -258,10 +271,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | |||
258 | } | 271 | } |
259 | } | 272 | } |
260 | 273 | ||
261 | /* Make sure GPE is enabled before doing transaction */ | 274 | 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) { | 275 | if (status) { |
266 | printk(KERN_ERR PREFIX | 276 | printk(KERN_ERR PREFIX |
267 | "input buffer is not empty, aborting transaction\n"); | 277 | "input buffer is not empty, aborting transaction\n"); |
@@ -435,9 +445,9 @@ EXPORT_SYMBOL_GPL(acpi_ec_add_query_handler); | |||
435 | 445 | ||
436 | void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) | 446 | void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) |
437 | { | 447 | { |
438 | struct acpi_ec_query_handler *handler; | 448 | struct acpi_ec_query_handler *handler, *tmp; |
439 | mutex_lock(&ec->lock); | 449 | mutex_lock(&ec->lock); |
440 | list_for_each_entry(handler, &ec->list, node) { | 450 | list_for_each_entry_safe(handler, tmp, &ec->list, node) { |
441 | if (query_bit == handler->query_bit) { | 451 | if (query_bit == handler->query_bit) { |
442 | list_del(&handler->node); | 452 | list_del(&handler->node); |
443 | kfree(handler); | 453 | kfree(handler); |
@@ -476,23 +486,24 @@ static void acpi_ec_gpe_query(void *ec_cxt) | |||
476 | static u32 acpi_ec_gpe_handler(void *data) | 486 | static u32 acpi_ec_gpe_handler(void *data) |
477 | { | 487 | { |
478 | acpi_status status = AE_OK; | 488 | acpi_status status = AE_OK; |
479 | u8 value; | ||
480 | struct acpi_ec *ec = data; | 489 | struct acpi_ec *ec = data; |
481 | 490 | ||
482 | atomic_inc(&ec->event_count); | 491 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
483 | 492 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) | |
484 | if (acpi_ec_mode == EC_INTR) { | ||
485 | wake_up(&ec->wait); | 493 | wake_up(&ec->wait); |
486 | } | ||
487 | 494 | ||
488 | value = acpi_ec_read_status(ec); | 495 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) { |
489 | if ((value & ACPI_EC_FLAG_SCI) && !atomic_read(&ec->query_pending)) { | 496 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) |
490 | atomic_set(&ec->query_pending, 1); | 497 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, |
491 | status = | 498 | acpi_ec_gpe_query, ec); |
492 | acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec); | 499 | } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) { |
500 | /* this is non-query, must be confirmation */ | ||
501 | printk(KERN_INFO PREFIX "non-query interrupt received," | ||
502 | " switching to interrupt mode\n"); | ||
503 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
493 | } | 504 | } |
494 | 505 | ||
495 | return status == AE_OK ? | 506 | return ACPI_SUCCESS(status) ? |
496 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | 507 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; |
497 | } | 508 | } |
498 | 509 | ||
@@ -641,13 +652,10 @@ static struct acpi_ec *make_acpi_ec(void) | |||
641 | struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL); | 652 | struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL); |
642 | if (!ec) | 653 | if (!ec) |
643 | return NULL; | 654 | return NULL; |
644 | 655 | 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); | 656 | mutex_init(&ec->lock); |
648 | init_waitqueue_head(&ec->wait); | 657 | init_waitqueue_head(&ec->wait); |
649 | INIT_LIST_HEAD(&ec->list); | 658 | INIT_LIST_HEAD(&ec->list); |
650 | |||
651 | return ec; | 659 | return ec; |
652 | } | 660 | } |
653 | 661 | ||
@@ -741,6 +749,8 @@ static int acpi_ec_add(struct acpi_device *device) | |||
741 | acpi_ec_add_fs(device); | 749 | acpi_ec_add_fs(device); |
742 | printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", | 750 | printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", |
743 | ec->gpe, ec->command_addr, ec->data_addr); | 751 | ec->gpe, ec->command_addr, ec->data_addr); |
752 | printk(KERN_INFO PREFIX "driver started in %s mode\n", | ||
753 | (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll"); | ||
744 | return 0; | 754 | return 0; |
745 | } | 755 | } |
746 | 756 | ||
@@ -833,7 +843,7 @@ static int acpi_ec_start(struct acpi_device *device) | |||
833 | ret = ec_install_handlers(ec); | 843 | ret = ec_install_handlers(ec); |
834 | 844 | ||
835 | /* EC is fully operational, allow queries */ | 845 | /* EC is fully operational, allow queries */ |
836 | atomic_set(&ec->query_pending, 0); | 846 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
837 | return ret; | 847 | return ret; |
838 | } | 848 | } |
839 | 849 | ||
@@ -924,20 +934,4 @@ static void __exit acpi_ec_exit(void) | |||
924 | 934 | ||
925 | return; | 935 | return; |
926 | } | 936 | } |
927 | #endif /* 0 */ | 937 | #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/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/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/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/libata-core.c b/drivers/ata/libata-core.c index 081e3dfb64d4..63035d71a61a 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -620,6 +620,177 @@ void ata_dev_disable(struct ata_device *dev) | |||
620 | } | 620 | } |
621 | } | 621 | } |
622 | 622 | ||
623 | static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy) | ||
624 | { | ||
625 | struct ata_link *link = dev->link; | ||
626 | struct ata_port *ap = link->ap; | ||
627 | u32 scontrol; | ||
628 | unsigned int err_mask; | ||
629 | int rc; | ||
630 | |||
631 | /* | ||
632 | * disallow DIPM for drivers which haven't set | ||
633 | * ATA_FLAG_IPM. This is because when DIPM is enabled, | ||
634 | * phy ready will be set in the interrupt status on | ||
635 | * state changes, which will cause some drivers to | ||
636 | * think there are errors - additionally drivers will | ||
637 | * need to disable hot plug. | ||
638 | */ | ||
639 | if (!(ap->flags & ATA_FLAG_IPM) || !ata_dev_enabled(dev)) { | ||
640 | ap->pm_policy = NOT_AVAILABLE; | ||
641 | return -EINVAL; | ||
642 | } | ||
643 | |||
644 | /* | ||
645 | * For DIPM, we will only enable it for the | ||
646 | * min_power setting. | ||
647 | * | ||
648 | * Why? Because Disks are too stupid to know that | ||
649 | * If the host rejects a request to go to SLUMBER | ||
650 | * they should retry at PARTIAL, and instead it | ||
651 | * just would give up. So, for medium_power to | ||
652 | * work at all, we need to only allow HIPM. | ||
653 | */ | ||
654 | rc = sata_scr_read(link, SCR_CONTROL, &scontrol); | ||
655 | if (rc) | ||
656 | return rc; | ||
657 | |||
658 | switch (policy) { | ||
659 | case MIN_POWER: | ||
660 | /* no restrictions on IPM transitions */ | ||
661 | scontrol &= ~(0x3 << 8); | ||
662 | rc = sata_scr_write(link, SCR_CONTROL, scontrol); | ||
663 | if (rc) | ||
664 | return rc; | ||
665 | |||
666 | /* enable DIPM */ | ||
667 | if (dev->flags & ATA_DFLAG_DIPM) | ||
668 | err_mask = ata_dev_set_feature(dev, | ||
669 | SETFEATURES_SATA_ENABLE, SATA_DIPM); | ||
670 | break; | ||
671 | case MEDIUM_POWER: | ||
672 | /* allow IPM to PARTIAL */ | ||
673 | scontrol &= ~(0x1 << 8); | ||
674 | scontrol |= (0x2 << 8); | ||
675 | rc = sata_scr_write(link, SCR_CONTROL, scontrol); | ||
676 | if (rc) | ||
677 | return rc; | ||
678 | |||
679 | /* disable DIPM */ | ||
680 | if (ata_dev_enabled(dev) && (dev->flags & ATA_DFLAG_DIPM)) | ||
681 | err_mask = ata_dev_set_feature(dev, | ||
682 | SETFEATURES_SATA_DISABLE, SATA_DIPM); | ||
683 | break; | ||
684 | case NOT_AVAILABLE: | ||
685 | case MAX_PERFORMANCE: | ||
686 | /* disable all IPM transitions */ | ||
687 | scontrol |= (0x3 << 8); | ||
688 | rc = sata_scr_write(link, SCR_CONTROL, scontrol); | ||
689 | if (rc) | ||
690 | return rc; | ||
691 | |||
692 | /* disable DIPM */ | ||
693 | if (ata_dev_enabled(dev) && (dev->flags & ATA_DFLAG_DIPM)) | ||
694 | err_mask = ata_dev_set_feature(dev, | ||
695 | SETFEATURES_SATA_DISABLE, SATA_DIPM); | ||
696 | break; | ||
697 | } | ||
698 | |||
699 | /* FIXME: handle SET FEATURES failure */ | ||
700 | (void) err_mask; | ||
701 | |||
702 | return 0; | ||
703 | } | ||
704 | |||
705 | /** | ||
706 | * ata_dev_enable_pm - enable SATA interface power management | ||
707 | * @device - device to enable ipm for | ||
708 | * @policy - the link power management policy | ||
709 | * | ||
710 | * Enable SATA Interface power management. This will enable | ||
711 | * Device Interface Power Management (DIPM) for min_power | ||
712 | * policy, and then call driver specific callbacks for | ||
713 | * enabling Host Initiated Power management. | ||
714 | * | ||
715 | * Locking: Caller. | ||
716 | * Returns: -EINVAL if IPM is not supported, 0 otherwise. | ||
717 | */ | ||
718 | void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy) | ||
719 | { | ||
720 | int rc = 0; | ||
721 | struct ata_port *ap = dev->link->ap; | ||
722 | |||
723 | /* set HIPM first, then DIPM */ | ||
724 | if (ap->ops->enable_pm) | ||
725 | rc = ap->ops->enable_pm(ap, policy); | ||
726 | if (rc) | ||
727 | goto enable_pm_out; | ||
728 | rc = ata_dev_set_dipm(dev, policy); | ||
729 | |||
730 | enable_pm_out: | ||
731 | if (rc) | ||
732 | ap->pm_policy = MAX_PERFORMANCE; | ||
733 | else | ||
734 | ap->pm_policy = policy; | ||
735 | return /* rc */; /* hopefully we can use 'rc' eventually */ | ||
736 | } | ||
737 | |||
738 | /** | ||
739 | * ata_dev_disable_pm - disable SATA interface power management | ||
740 | * @device - device to enable ipm for | ||
741 | * | ||
742 | * Disable SATA Interface power management. This will disable | ||
743 | * Device Interface Power Management (DIPM) without changing | ||
744 | * policy, call driver specific callbacks for disabling Host | ||
745 | * Initiated Power management. | ||
746 | * | ||
747 | * Locking: Caller. | ||
748 | * Returns: void | ||
749 | */ | ||
750 | static void ata_dev_disable_pm(struct ata_device *dev) | ||
751 | { | ||
752 | struct ata_port *ap = dev->link->ap; | ||
753 | |||
754 | ata_dev_set_dipm(dev, MAX_PERFORMANCE); | ||
755 | if (ap->ops->disable_pm) | ||
756 | ap->ops->disable_pm(ap); | ||
757 | } | ||
758 | |||
759 | void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy) | ||
760 | { | ||
761 | ap->pm_policy = policy; | ||
762 | ap->link.eh_info.action |= ATA_EHI_LPM; | ||
763 | ap->link.eh_info.flags |= ATA_EHI_NO_AUTOPSY; | ||
764 | ata_port_schedule_eh(ap); | ||
765 | } | ||
766 | |||
767 | static void ata_lpm_enable(struct ata_host *host) | ||
768 | { | ||
769 | struct ata_link *link; | ||
770 | struct ata_port *ap; | ||
771 | struct ata_device *dev; | ||
772 | int i; | ||
773 | |||
774 | for (i = 0; i < host->n_ports; i++) { | ||
775 | ap = host->ports[i]; | ||
776 | ata_port_for_each_link(link, ap) { | ||
777 | ata_link_for_each_dev(dev, link) | ||
778 | ata_dev_disable_pm(dev); | ||
779 | } | ||
780 | } | ||
781 | } | ||
782 | |||
783 | static void ata_lpm_disable(struct ata_host *host) | ||
784 | { | ||
785 | int i; | ||
786 | |||
787 | for (i = 0; i < host->n_ports; i++) { | ||
788 | struct ata_port *ap = host->ports[i]; | ||
789 | ata_lpm_schedule(ap, ap->pm_policy); | ||
790 | } | ||
791 | } | ||
792 | |||
793 | |||
623 | /** | 794 | /** |
624 | * ata_devchk - PATA device presence detection | 795 | * ata_devchk - PATA device presence detection |
625 | * @ap: ATA channel to examine | 796 | * @ap: ATA channel to examine |
@@ -2101,6 +2272,13 @@ int ata_dev_configure(struct ata_device *dev) | |||
2101 | if (dev->flags & ATA_DFLAG_LBA48) | 2272 | if (dev->flags & ATA_DFLAG_LBA48) |
2102 | dev->max_sectors = ATA_MAX_SECTORS_LBA48; | 2273 | dev->max_sectors = ATA_MAX_SECTORS_LBA48; |
2103 | 2274 | ||
2275 | if (!(dev->horkage & ATA_HORKAGE_IPM)) { | ||
2276 | if (ata_id_has_hipm(dev->id)) | ||
2277 | dev->flags |= ATA_DFLAG_HIPM; | ||
2278 | if (ata_id_has_dipm(dev->id)) | ||
2279 | dev->flags |= ATA_DFLAG_DIPM; | ||
2280 | } | ||
2281 | |||
2104 | if (dev->horkage & ATA_HORKAGE_DIAGNOSTIC) { | 2282 | if (dev->horkage & ATA_HORKAGE_DIAGNOSTIC) { |
2105 | /* Let the user know. We don't want to disallow opens for | 2283 | /* Let the user know. We don't want to disallow opens for |
2106 | rescue purposes, or in case the vendor is just a blithering | 2284 | rescue purposes, or in case the vendor is just a blithering |
@@ -2126,6 +2304,13 @@ int ata_dev_configure(struct ata_device *dev) | |||
2126 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, | 2304 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, |
2127 | dev->max_sectors); | 2305 | dev->max_sectors); |
2128 | 2306 | ||
2307 | if (ata_dev_blacklisted(dev) & ATA_HORKAGE_IPM) { | ||
2308 | dev->horkage |= ATA_HORKAGE_IPM; | ||
2309 | |||
2310 | /* reset link pm_policy for this port to no pm */ | ||
2311 | ap->pm_policy = MAX_PERFORMANCE; | ||
2312 | } | ||
2313 | |||
2129 | if (ap->ops->dev_config) | 2314 | if (ap->ops->dev_config) |
2130 | ap->ops->dev_config(dev); | 2315 | ap->ops->dev_config(dev); |
2131 | 2316 | ||
@@ -2219,6 +2404,25 @@ int ata_bus_probe(struct ata_port *ap) | |||
2219 | tries[dev->devno] = ATA_PROBE_MAX_TRIES; | 2404 | tries[dev->devno] = ATA_PROBE_MAX_TRIES; |
2220 | 2405 | ||
2221 | retry: | 2406 | retry: |
2407 | ata_link_for_each_dev(dev, &ap->link) { | ||
2408 | /* If we issue an SRST then an ATA drive (not ATAPI) | ||
2409 | * may change configuration and be in PIO0 timing. If | ||
2410 | * we do a hard reset (or are coming from power on) | ||
2411 | * this is true for ATA or ATAPI. Until we've set a | ||
2412 | * suitable controller mode we should not touch the | ||
2413 | * bus as we may be talking too fast. | ||
2414 | */ | ||
2415 | dev->pio_mode = XFER_PIO_0; | ||
2416 | |||
2417 | /* If the controller has a pio mode setup function | ||
2418 | * then use it to set the chipset to rights. Don't | ||
2419 | * touch the DMA setup as that will be dealt with when | ||
2420 | * configuring devices. | ||
2421 | */ | ||
2422 | if (ap->ops->set_piomode) | ||
2423 | ap->ops->set_piomode(ap, dev); | ||
2424 | } | ||
2425 | |||
2222 | /* reset and determine device classes */ | 2426 | /* reset and determine device classes */ |
2223 | ap->ops->phy_reset(ap); | 2427 | ap->ops->phy_reset(ap); |
2224 | 2428 | ||
@@ -2234,12 +2438,6 @@ int ata_bus_probe(struct ata_port *ap) | |||
2234 | 2438 | ||
2235 | ata_port_probe(ap); | 2439 | ata_port_probe(ap); |
2236 | 2440 | ||
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 | 2441 | /* read IDENTIFY page and configure devices. We have to do the identify |
2244 | specific sequence bass-ackwards so that PDIAG- is released by | 2442 | specific sequence bass-ackwards so that PDIAG- is released by |
2245 | the slave device */ | 2443 | the slave device */ |
@@ -3118,6 +3316,55 @@ int ata_busy_sleep(struct ata_port *ap, | |||
3118 | } | 3316 | } |
3119 | 3317 | ||
3120 | /** | 3318 | /** |
3319 | * ata_wait_after_reset - wait before checking status after reset | ||
3320 | * @ap: port containing status register to be polled | ||
3321 | * @deadline: deadline jiffies for the operation | ||
3322 | * | ||
3323 | * After reset, we need to pause a while before reading status. | ||
3324 | * Also, certain combination of controller and device report 0xff | ||
3325 | * for some duration (e.g. until SATA PHY is up and running) | ||
3326 | * which is interpreted as empty port in ATA world. This | ||
3327 | * function also waits for such devices to get out of 0xff | ||
3328 | * status. | ||
3329 | * | ||
3330 | * LOCKING: | ||
3331 | * Kernel thread context (may sleep). | ||
3332 | */ | ||
3333 | void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline) | ||
3334 | { | ||
3335 | unsigned long until = jiffies + ATA_TMOUT_FF_WAIT; | ||
3336 | |||
3337 | if (time_before(until, deadline)) | ||
3338 | deadline = until; | ||
3339 | |||
3340 | /* Spec mandates ">= 2ms" before checking status. We wait | ||
3341 | * 150ms, because that was the magic delay used for ATAPI | ||
3342 | * devices in Hale Landis's ATADRVR, for the period of time | ||
3343 | * between when the ATA command register is written, and then | ||
3344 | * status is checked. Because waiting for "a while" before | ||
3345 | * checking status is fine, post SRST, we perform this magic | ||
3346 | * delay here as well. | ||
3347 | * | ||
3348 | * Old drivers/ide uses the 2mS rule and then waits for ready. | ||
3349 | */ | ||
3350 | msleep(150); | ||
3351 | |||
3352 | /* Wait for 0xff to clear. Some SATA devices take a long time | ||
3353 | * to clear 0xff after reset. For example, HHD424020F7SV00 | ||
3354 | * iVDR needs >= 800ms while. Quantum GoVault needs even more | ||
3355 | * than that. | ||
3356 | */ | ||
3357 | while (1) { | ||
3358 | u8 status = ata_chk_status(ap); | ||
3359 | |||
3360 | if (status != 0xff || time_after(jiffies, deadline)) | ||
3361 | return; | ||
3362 | |||
3363 | msleep(50); | ||
3364 | } | ||
3365 | } | ||
3366 | |||
3367 | /** | ||
3121 | * ata_wait_ready - sleep until BSY clears, or timeout | 3368 | * ata_wait_ready - sleep until BSY clears, or timeout |
3122 | * @ap: port containing status register to be polled | 3369 | * @ap: port containing status register to be polled |
3123 | * @deadline: deadline jiffies for the operation | 3370 | * @deadline: deadline jiffies for the operation |
@@ -3223,8 +3470,6 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, | |||
3223 | unsigned long deadline) | 3470 | unsigned long deadline) |
3224 | { | 3471 | { |
3225 | struct ata_ioports *ioaddr = &ap->ioaddr; | 3472 | struct ata_ioports *ioaddr = &ap->ioaddr; |
3226 | struct ata_device *dev; | ||
3227 | int i = 0; | ||
3228 | 3473 | ||
3229 | DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); | 3474 | DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); |
3230 | 3475 | ||
@@ -3235,36 +3480,8 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, | |||
3235 | udelay(20); /* FIXME: flush */ | 3480 | udelay(20); /* FIXME: flush */ |
3236 | iowrite8(ap->ctl, ioaddr->ctl_addr); | 3481 | iowrite8(ap->ctl, ioaddr->ctl_addr); |
3237 | 3482 | ||
3238 | /* If we issued an SRST then an ATA drive (not ATAPI) | 3483 | /* wait a while before checking status */ |
3239 | * may have changed configuration and be in PIO0 timing. If | 3484 | 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 | 3485 | ||
3269 | /* Before we perform post reset processing we want to see if | 3486 | /* Before we perform post reset processing we want to see if |
3270 | * the bus shows 0xFF because the odd clown forgets the D7 | 3487 | * the bus shows 0xFF because the odd clown forgets the D7 |
@@ -3691,8 +3908,8 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class, | |||
3691 | return 0; | 3908 | return 0; |
3692 | } | 3909 | } |
3693 | 3910 | ||
3694 | /* wait a while before checking status, see SRST for more info */ | 3911 | /* wait a while before checking status */ |
3695 | msleep(150); | 3912 | ata_wait_after_reset(ap, deadline); |
3696 | 3913 | ||
3697 | /* If PMP is supported, we have to do follow-up SRST. Note | 3914 | /* 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 | 3915 | * that some PMPs don't send D2H Reg FIS after hardreset at |
@@ -3992,6 +4209,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
3992 | { "ST3160812AS", "3.ADJ", ATA_HORKAGE_NONCQ, }, | 4209 | { "ST3160812AS", "3.ADJ", ATA_HORKAGE_NONCQ, }, |
3993 | { "ST980813AS", "3.ADB", ATA_HORKAGE_NONCQ, }, | 4210 | { "ST980813AS", "3.ADB", ATA_HORKAGE_NONCQ, }, |
3994 | { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, }, | 4211 | { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, }, |
4212 | { "Maxtor 7V300F0", "VA111900", ATA_HORKAGE_NONCQ, }, | ||
3995 | 4213 | ||
3996 | /* devices which puke on READ_NATIVE_MAX */ | 4214 | /* devices which puke on READ_NATIVE_MAX */ |
3997 | { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, | 4215 | { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, |
@@ -4689,6 +4907,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) | |||
4689 | * data in this function or read data in ata_sg_clean. | 4907 | * data in this function or read data in ata_sg_clean. |
4690 | */ | 4908 | */ |
4691 | offset = lsg->offset + lsg->length - qc->pad_len; | 4909 | offset = lsg->offset + lsg->length - qc->pad_len; |
4910 | sg_init_table(psg, 1); | ||
4692 | sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT), | 4911 | sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT), |
4693 | qc->pad_len, offset_in_page(offset)); | 4912 | qc->pad_len, offset_in_page(offset)); |
4694 | 4913 | ||
@@ -5594,6 +5813,9 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
5594 | * taken care of. | 5813 | * taken care of. |
5595 | */ | 5814 | */ |
5596 | if (ap->ops->error_handler) { | 5815 | if (ap->ops->error_handler) { |
5816 | struct ata_device *dev = qc->dev; | ||
5817 | struct ata_eh_info *ehi = &dev->link->eh_info; | ||
5818 | |||
5597 | WARN_ON(ap->pflags & ATA_PFLAG_FROZEN); | 5819 | WARN_ON(ap->pflags & ATA_PFLAG_FROZEN); |
5598 | 5820 | ||
5599 | if (unlikely(qc->err_mask)) | 5821 | if (unlikely(qc->err_mask)) |
@@ -5612,6 +5834,27 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
5612 | if (qc->flags & ATA_QCFLAG_RESULT_TF) | 5834 | if (qc->flags & ATA_QCFLAG_RESULT_TF) |
5613 | fill_result_tf(qc); | 5835 | fill_result_tf(qc); |
5614 | 5836 | ||
5837 | /* Some commands need post-processing after successful | ||
5838 | * completion. | ||
5839 | */ | ||
5840 | switch (qc->tf.command) { | ||
5841 | case ATA_CMD_SET_FEATURES: | ||
5842 | if (qc->tf.feature != SETFEATURES_WC_ON && | ||
5843 | qc->tf.feature != SETFEATURES_WC_OFF) | ||
5844 | break; | ||
5845 | /* fall through */ | ||
5846 | case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */ | ||
5847 | case ATA_CMD_SET_MULTI: /* multi_count changed */ | ||
5848 | /* revalidate device */ | ||
5849 | ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE; | ||
5850 | ata_port_schedule_eh(ap); | ||
5851 | break; | ||
5852 | |||
5853 | case ATA_CMD_SLEEP: | ||
5854 | dev->flags |= ATA_DFLAG_SLEEPING; | ||
5855 | break; | ||
5856 | } | ||
5857 | |||
5615 | __ata_qc_complete(qc); | 5858 | __ata_qc_complete(qc); |
5616 | } else { | 5859 | } else { |
5617 | if (qc->flags & ATA_QCFLAG_EH_SCHEDULED) | 5860 | if (qc->flags & ATA_QCFLAG_EH_SCHEDULED) |
@@ -5749,6 +5992,14 @@ void ata_qc_issue(struct ata_queued_cmd *qc) | |||
5749 | qc->flags &= ~ATA_QCFLAG_DMAMAP; | 5992 | qc->flags &= ~ATA_QCFLAG_DMAMAP; |
5750 | } | 5993 | } |
5751 | 5994 | ||
5995 | /* if device is sleeping, schedule softreset and abort the link */ | ||
5996 | if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) { | ||
5997 | link->eh_info.action |= ATA_EH_SOFTRESET; | ||
5998 | ata_ehi_push_desc(&link->eh_info, "waking up from sleep"); | ||
5999 | ata_link_abort(link); | ||
6000 | return; | ||
6001 | } | ||
6002 | |||
5752 | ap->ops->qc_prep(qc); | 6003 | ap->ops->qc_prep(qc); |
5753 | 6004 | ||
5754 | qc->err_mask |= ap->ops->qc_issue(qc); | 6005 | qc->err_mask |= ap->ops->qc_issue(qc); |
@@ -6296,6 +6547,12 @@ int ata_host_suspend(struct ata_host *host, pm_message_t mesg) | |||
6296 | { | 6547 | { |
6297 | int rc; | 6548 | int rc; |
6298 | 6549 | ||
6550 | /* | ||
6551 | * disable link pm on all ports before requesting | ||
6552 | * any pm activity | ||
6553 | */ | ||
6554 | ata_lpm_enable(host); | ||
6555 | |||
6299 | rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1); | 6556 | rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1); |
6300 | if (rc == 0) | 6557 | if (rc == 0) |
6301 | host->dev->power.power_state = mesg; | 6558 | host->dev->power.power_state = mesg; |
@@ -6318,6 +6575,9 @@ void ata_host_resume(struct ata_host *host) | |||
6318 | ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET, | 6575 | ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET, |
6319 | ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); | 6576 | ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); |
6320 | host->dev->power.power_state = PMSG_ON; | 6577 | host->dev->power.power_state = PMSG_ON; |
6578 | |||
6579 | /* reenable link pm */ | ||
6580 | ata_lpm_disable(host); | ||
6321 | } | 6581 | } |
6322 | #endif | 6582 | #endif |
6323 | 6583 | ||
@@ -6860,6 +7120,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6860 | struct ata_port *ap = host->ports[i]; | 7120 | struct ata_port *ap = host->ports[i]; |
6861 | 7121 | ||
6862 | ata_scsi_scan_host(ap, 1); | 7122 | ata_scsi_scan_host(ap, 1); |
7123 | ata_lpm_schedule(ap, ap->pm_policy); | ||
6863 | } | 7124 | } |
6864 | 7125 | ||
6865 | return 0; | 7126 | return 0; |
@@ -7256,7 +7517,6 @@ const struct ata_port_info ata_dummy_port_info = { | |||
7256 | * likely to change as new drivers are added and updated. | 7517 | * likely to change as new drivers are added and updated. |
7257 | * Do not depend on ABI/API stability. | 7518 | * Do not depend on ABI/API stability. |
7258 | */ | 7519 | */ |
7259 | |||
7260 | EXPORT_SYMBOL_GPL(sata_deb_timing_normal); | 7520 | EXPORT_SYMBOL_GPL(sata_deb_timing_normal); |
7261 | EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug); | 7521 | EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug); |
7262 | EXPORT_SYMBOL_GPL(sata_deb_timing_long); | 7522 | EXPORT_SYMBOL_GPL(sata_deb_timing_long); |
@@ -7326,6 +7586,7 @@ EXPORT_SYMBOL_GPL(ata_port_disable); | |||
7326 | EXPORT_SYMBOL_GPL(ata_ratelimit); | 7586 | EXPORT_SYMBOL_GPL(ata_ratelimit); |
7327 | EXPORT_SYMBOL_GPL(ata_wait_register); | 7587 | EXPORT_SYMBOL_GPL(ata_wait_register); |
7328 | EXPORT_SYMBOL_GPL(ata_busy_sleep); | 7588 | EXPORT_SYMBOL_GPL(ata_busy_sleep); |
7589 | EXPORT_SYMBOL_GPL(ata_wait_after_reset); | ||
7329 | EXPORT_SYMBOL_GPL(ata_wait_ready); | 7590 | EXPORT_SYMBOL_GPL(ata_wait_ready); |
7330 | EXPORT_SYMBOL_GPL(ata_port_queue_task); | 7591 | EXPORT_SYMBOL_GPL(ata_port_queue_task); |
7331 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); | 7592 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 8cb35bb87605..8d64f8fd8f1d 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1800,10 +1800,8 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
1800 | qc->err_mask &= ~AC_ERR_OTHER; | 1800 | qc->err_mask &= ~AC_ERR_OTHER; |
1801 | 1801 | ||
1802 | /* SENSE_VALID trumps dev/unknown error and revalidation */ | 1802 | /* SENSE_VALID trumps dev/unknown error and revalidation */ |
1803 | if (qc->flags & ATA_QCFLAG_SENSE_VALID) { | 1803 | if (qc->flags & ATA_QCFLAG_SENSE_VALID) |
1804 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); | 1804 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); |
1805 | ehc->i.action &= ~ATA_EH_REVALIDATE; | ||
1806 | } | ||
1807 | 1805 | ||
1808 | /* accumulate error info */ | 1806 | /* accumulate error info */ |
1809 | ehc->i.dev = qc->dev; | 1807 | ehc->i.dev = qc->dev; |
@@ -1816,7 +1814,8 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
1816 | if (ap->pflags & ATA_PFLAG_FROZEN || | 1814 | if (ap->pflags & ATA_PFLAG_FROZEN || |
1817 | all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) | 1815 | all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) |
1818 | ehc->i.action |= ATA_EH_SOFTRESET; | 1816 | ehc->i.action |= ATA_EH_SOFTRESET; |
1819 | else if (all_err_mask) | 1817 | else if ((is_io && all_err_mask) || |
1818 | (!is_io && (all_err_mask & ~AC_ERR_DEV))) | ||
1820 | ehc->i.action |= ATA_EH_REVALIDATE; | 1819 | ehc->i.action |= ATA_EH_REVALIDATE; |
1821 | 1820 | ||
1822 | /* if we have offending qcs and the associated failed device */ | 1821 | /* if we have offending qcs and the associated failed device */ |
@@ -1879,7 +1878,9 @@ static void ata_eh_link_report(struct ata_link *link) | |||
1879 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { | 1878 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { |
1880 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); | 1879 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); |
1881 | 1880 | ||
1882 | if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link) | 1881 | if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link || |
1882 | ((qc->flags & ATA_QCFLAG_QUIET) && | ||
1883 | qc->err_mask == AC_ERR_DEV)) | ||
1883 | continue; | 1884 | continue; |
1884 | if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) | 1885 | if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) |
1885 | continue; | 1886 | continue; |
@@ -2083,6 +2084,25 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2083 | 2084 | ||
2084 | ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); | 2085 | ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); |
2085 | 2086 | ||
2087 | ata_link_for_each_dev(dev, link) { | ||
2088 | /* If we issue an SRST then an ATA drive (not ATAPI) | ||
2089 | * may change configuration and be in PIO0 timing. If | ||
2090 | * we do a hard reset (or are coming from power on) | ||
2091 | * this is true for ATA or ATAPI. Until we've set a | ||
2092 | * suitable controller mode we should not touch the | ||
2093 | * bus as we may be talking too fast. | ||
2094 | */ | ||
2095 | dev->pio_mode = XFER_PIO_0; | ||
2096 | |||
2097 | /* If the controller has a pio mode setup function | ||
2098 | * then use it to set the chipset to rights. Don't | ||
2099 | * touch the DMA setup as that will be dealt with when | ||
2100 | * configuring devices. | ||
2101 | */ | ||
2102 | if (ap->ops->set_piomode) | ||
2103 | ap->ops->set_piomode(ap, dev); | ||
2104 | } | ||
2105 | |||
2086 | /* Determine which reset to use and record in ehc->i.action. | 2106 | /* Determine which reset to use and record in ehc->i.action. |
2087 | * prereset() may examine and modify it. | 2107 | * prereset() may examine and modify it. |
2088 | */ | 2108 | */ |
@@ -2208,9 +2228,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2208 | ata_link_for_each_dev(dev, link) { | 2228 | ata_link_for_each_dev(dev, link) { |
2209 | /* After the reset, the device state is PIO 0 | 2229 | /* After the reset, the device state is PIO 0 |
2210 | * and the controller state is undefined. | 2230 | * and the controller state is undefined. |
2211 | * Record the mode. | 2231 | * Reset also wakes up drives from sleeping |
2232 | * mode. | ||
2212 | */ | 2233 | */ |
2213 | dev->pio_mode = XFER_PIO_0; | 2234 | dev->pio_mode = XFER_PIO_0; |
2235 | dev->flags &= ~ATA_DFLAG_SLEEPING; | ||
2214 | 2236 | ||
2215 | if (ata_link_offline(link)) | 2237 | if (ata_link_offline(link)) |
2216 | continue; | 2238 | continue; |
@@ -2416,7 +2438,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
2416 | /* give it just one more chance */ | 2438 | /* give it just one more chance */ |
2417 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); | 2439 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); |
2418 | case -EIO: | 2440 | case -EIO: |
2419 | if (ehc->tries[dev->devno] == 1) { | 2441 | if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) { |
2420 | /* This is the last chance, better to slow | 2442 | /* This is the last chance, better to slow |
2421 | * down than lose it. | 2443 | * down than lose it. |
2422 | */ | 2444 | */ |
@@ -2607,6 +2629,10 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2607 | ehc->i.flags &= ~ATA_EHI_SETMODE; | 2629 | ehc->i.flags &= ~ATA_EHI_SETMODE; |
2608 | } | 2630 | } |
2609 | 2631 | ||
2632 | if (ehc->i.action & ATA_EHI_LPM) | ||
2633 | ata_link_for_each_dev(dev, link) | ||
2634 | ata_dev_enable_pm(dev, ap->pm_policy); | ||
2635 | |||
2610 | /* this link is okay now */ | 2636 | /* this link is okay now */ |
2611 | ehc->i.flags = 0; | 2637 | ehc->i.flags = 0; |
2612 | continue; | 2638 | continue; |
@@ -2672,8 +2698,15 @@ void ata_eh_finish(struct ata_port *ap) | |||
2672 | /* FIXME: Once EH migration is complete, | 2698 | /* FIXME: Once EH migration is complete, |
2673 | * generate sense data in this function, | 2699 | * generate sense data in this function, |
2674 | * considering both err_mask and tf. | 2700 | * considering both err_mask and tf. |
2701 | * | ||
2702 | * There's no point in retrying invalid | ||
2703 | * (detected by libata) and non-IO device | ||
2704 | * errors (rejected by device). Finish them | ||
2705 | * immediately. | ||
2675 | */ | 2706 | */ |
2676 | if (qc->err_mask & AC_ERR_INVALID) | 2707 | if ((qc->err_mask & AC_ERR_INVALID) || |
2708 | (!(qc->flags & ATA_QCFLAG_IO) && | ||
2709 | qc->err_mask == AC_ERR_DEV)) | ||
2677 | ata_eh_qc_complete(qc); | 2710 | ata_eh_qc_complete(qc); |
2678 | else | 2711 | else |
2679 | ata_eh_qc_retry(qc); | 2712 | ata_eh_qc_retry(qc); |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index f5d5420a1ba2..fc89590d3772 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 | 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 | { |
@@ -1040,6 +1108,9 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc) | |||
1040 | else | 1108 | else |
1041 | tf->command = ATA_CMD_FLUSH; | 1109 | tf->command = ATA_CMD_FLUSH; |
1042 | 1110 | ||
1111 | /* flush is critical for IO integrity, consider it an IO command */ | ||
1112 | qc->flags |= ATA_QCFLAG_IO; | ||
1113 | |||
1043 | return 0; | 1114 | return 0; |
1044 | } | 1115 | } |
1045 | 1116 | ||
@@ -1361,33 +1432,10 @@ nothing_to_do: | |||
1361 | static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) | 1432 | static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) |
1362 | { | 1433 | { |
1363 | struct ata_port *ap = qc->ap; | 1434 | struct ata_port *ap = qc->ap; |
1364 | struct ata_eh_info *ehi = &qc->dev->link->eh_info; | ||
1365 | struct scsi_cmnd *cmd = qc->scsicmd; | 1435 | struct scsi_cmnd *cmd = qc->scsicmd; |
1366 | u8 *cdb = cmd->cmnd; | 1436 | u8 *cdb = cmd->cmnd; |
1367 | int need_sense = (qc->err_mask != 0); | 1437 | int need_sense = (qc->err_mask != 0); |
1368 | 1438 | ||
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 | 1439 | /* 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 | 1440 | * user mandated it or if there's an error. Note that if we |
1393 | * generate because the user forced us to, a check condition | 1441 | * generate because the user forced us to, a check condition |
@@ -2719,8 +2767,8 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) | |||
2719 | */ | 2767 | */ |
2720 | qc->nbytes = scsi_bufflen(scmd); | 2768 | qc->nbytes = scsi_bufflen(scmd); |
2721 | 2769 | ||
2722 | /* request result TF */ | 2770 | /* request result TF and be quiet about device error */ |
2723 | qc->flags |= ATA_QCFLAG_RESULT_TF; | 2771 | qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET; |
2724 | 2772 | ||
2725 | return 0; | 2773 | return 0; |
2726 | 2774 | ||
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_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_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_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_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..35b2df297527 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 | } |
@@ -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..825e717bcef9 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(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..6d43ba79e154 100644 --- a/drivers/ata/sata_qstor.c +++ b/drivers/ata/sata_qstor.c | |||
@@ -113,7 +113,7 @@ 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); | 119 | static void qs_phy_reset(struct ata_port *ap); |
@@ -135,7 +135,6 @@ static struct scsi_host_template qs_ata_sht = { | |||
135 | .sg_tablesize = QS_MAX_PRD, | 135 | .sg_tablesize = QS_MAX_PRD, |
136 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | 136 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, |
137 | .emulated = ATA_SHT_EMULATED, | 137 | .emulated = ATA_SHT_EMULATED, |
138 | //FIXME .use_clustering = ATA_SHT_USE_CLUSTERING, | ||
139 | .use_clustering = ENABLE_CLUSTERING, | 138 | .use_clustering = ENABLE_CLUSTERING, |
140 | .proc_name = DRV_NAME, | 139 | .proc_name = DRV_NAME, |
141 | .dma_boundary = QS_DMA_BOUNDARY, | 140 | .dma_boundary = QS_DMA_BOUNDARY, |
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..187dcb02c681 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -265,11 +265,11 @@ static struct sil24_cerr_info { | |||
265 | unsigned int err_mask, action; | 265 | unsigned int err_mask, action; |
266 | const char *desc; | 266 | const char *desc; |
267 | } sil24_cerr_db[] = { | 267 | } sil24_cerr_db[] = { |
268 | [0] = { AC_ERR_DEV, ATA_EH_REVALIDATE, | 268 | [0] = { AC_ERR_DEV, 0, |
269 | "device error" }, | 269 | "device error" }, |
270 | [PORT_CERR_DEV] = { AC_ERR_DEV, ATA_EH_REVALIDATE, | 270 | [PORT_CERR_DEV] = { AC_ERR_DEV, 0, |
271 | "device error via D2H FIS" }, | 271 | "device error via D2H FIS" }, |
272 | [PORT_CERR_SDB] = { AC_ERR_DEV, ATA_EH_REVALIDATE, | 272 | [PORT_CERR_SDB] = { AC_ERR_DEV, 0, |
273 | "device error via SDB FIS" }, | 273 | "device error via SDB FIS" }, |
274 | [PORT_CERR_DATA] = { AC_ERR_ATA_BUS, ATA_EH_SOFTRESET, | 274 | [PORT_CERR_DATA] = { AC_ERR_ATA_BUS, ATA_EH_SOFTRESET, |
275 | "error in data FIS" }, | 275 | "error in data FIS" }, |
@@ -674,7 +674,7 @@ static int sil24_do_softreset(struct ata_link *link, unsigned int *class, | |||
674 | 674 | ||
675 | /* put the port into known state */ | 675 | /* put the port into known state */ |
676 | if (sil24_init_port(ap)) { | 676 | if (sil24_init_port(ap)) { |
677 | reason ="port not ready"; | 677 | reason = "port not ready"; |
678 | goto err; | 678 | goto err; |
679 | } | 679 | } |
680 | 680 | ||
@@ -756,7 +756,8 @@ static int sil24_hardreset(struct ata_link *link, unsigned int *class, | |||
756 | 756 | ||
757 | writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT); | 757 | writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT); |
758 | tmp = ata_wait_register(port + PORT_CTRL_STAT, | 758 | tmp = ata_wait_register(port + PORT_CTRL_STAT, |
759 | PORT_CS_DEV_RST, PORT_CS_DEV_RST, 10, tout_msec); | 759 | PORT_CS_DEV_RST, PORT_CS_DEV_RST, 10, |
760 | tout_msec); | ||
760 | 761 | ||
761 | /* SStatus oscillates between zero and valid status after | 762 | /* SStatus oscillates between zero and valid status after |
762 | * DEV_RST, debounce it. | 763 | * DEV_RST, debounce it. |
@@ -1270,7 +1271,7 @@ static void sil24_init_controller(struct ata_host *host) | |||
1270 | PORT_CS_PORT_RST, 10, 100); | 1271 | PORT_CS_PORT_RST, 10, 100); |
1271 | if (tmp & PORT_CS_PORT_RST) | 1272 | if (tmp & PORT_CS_PORT_RST) |
1272 | dev_printk(KERN_ERR, host->dev, | 1273 | dev_printk(KERN_ERR, host->dev, |
1273 | "failed to clear port RST\n"); | 1274 | "failed to clear port RST\n"); |
1274 | } | 1275 | } |
1275 | 1276 | ||
1276 | /* configure port */ | 1277 | /* configure port */ |
@@ -1283,7 +1284,7 @@ static void sil24_init_controller(struct ata_host *host) | |||
1283 | 1284 | ||
1284 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 1285 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1285 | { | 1286 | { |
1286 | static int printed_version = 0; | 1287 | static int printed_version; |
1287 | struct ata_port_info pi = sil24_port_info[ent->driver_data]; | 1288 | struct ata_port_info pi = sil24_port_info[ent->driver_data]; |
1288 | const struct ata_port_info *ppi[] = { &pi, NULL }; | 1289 | const struct ata_port_info *ppi[] = { &pi, NULL }; |
1289 | void __iomem * const *iomap; | 1290 | void __iomem * const *iomap; |
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/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/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/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/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/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/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/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/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/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/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/ide-iops.c b/drivers/ide/ide-iops.c index 95168833d069..dcda0f109df5 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -582,9 +582,12 @@ EXPORT_SYMBOL_GPL(ide_in_drive_list); | |||
582 | /* | 582 | /* |
583 | * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid. | 583 | * 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. | 584 | * We list them here and depend on the device side cable detection for them. |
585 | * | ||
586 | * Some optical devices with the buggy firmwares have the same problem. | ||
585 | */ | 587 | */ |
586 | static const struct drive_list_entry ivb_list[] = { | 588 | static const struct drive_list_entry ivb_list[] = { |
587 | { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, | 589 | { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, |
590 | { "TSSTcorp CDDVDW SH-S202J" , "SB00" }, | ||
588 | { NULL , NULL } | 591 | { NULL , NULL } |
589 | }; | 592 | }; |
590 | 593 | ||
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/sc1200.c b/drivers/ide/pci/sc1200.c index d2c8b5524f28..0a7b3202066d 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -324,17 +324,18 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state) | |||
324 | 324 | ||
325 | pci_disable_device(dev); | 325 | pci_disable_device(dev); |
326 | pci_set_power_state(dev, pci_choose_state(dev, state)); | 326 | pci_set_power_state(dev, pci_choose_state(dev, state)); |
327 | dev->current_state = state.event; | ||
328 | return 0; | 327 | return 0; |
329 | } | 328 | } |
330 | 329 | ||
331 | static int sc1200_resume (struct pci_dev *dev) | 330 | static int sc1200_resume (struct pci_dev *dev) |
332 | { | 331 | { |
333 | ide_hwif_t *hwif = NULL; | 332 | ide_hwif_t *hwif = NULL; |
333 | int i; | ||
334 | |||
335 | i = pci_enable_device(dev); | ||
336 | if (i) | ||
337 | return i; | ||
334 | 338 | ||
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 | // | 339 | // |
339 | // loop over all interfaces that are part of this pci device: | 340 | // loop over all interfaces that are part of this pci device: |
340 | // | 341 | // |
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/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/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_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/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/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/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/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/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/net/Kconfig b/drivers/net/Kconfig index 86b8641b4664..5f800a6dd978 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -166,13 +166,14 @@ config NET_SB1000 | |||
166 | If you don't have this card, of course say N. | 166 | If you don't have this card, of course say N. |
167 | 167 | ||
168 | config IP1000 | 168 | config IP1000 |
169 | tristate "IP1000 Gigabit Ethernet support" | 169 | tristate "IP1000 Gigabit Ethernet support" |
170 | depends on PCI && EXPERIMENTAL | 170 | depends on PCI && EXPERIMENTAL |
171 | ---help--- | 171 | select MII |
172 | This driver supports IP1000 gigabit Ethernet cards. | 172 | ---help--- |
173 | This driver supports IP1000 gigabit Ethernet cards. | ||
173 | 174 | ||
174 | To compile this driver as a module, choose M here: the module | 175 | To compile this driver as a module, choose M here: the module |
175 | will be called ipg. This is recommended. | 176 | will be called ipg. This is recommended. |
176 | 177 | ||
177 | source "drivers/net/arcnet/Kconfig" | 178 | source "drivers/net/arcnet/Kconfig" |
178 | 179 | ||
@@ -1880,6 +1881,28 @@ config FEC2 | |||
1880 | Say Y here if you want to use the second built-in 10/100 Fast | 1881 | Say Y here if you want to use the second built-in 10/100 Fast |
1881 | ethernet controller on some Motorola ColdFire processors. | 1882 | ethernet controller on some Motorola ColdFire processors. |
1882 | 1883 | ||
1884 | config FEC_MPC52xx | ||
1885 | tristate "MPC52xx FEC driver" | ||
1886 | depends on PPC_MERGE && PPC_MPC52xx && PPC_BESTCOMM_FEC | ||
1887 | select CRC32 | ||
1888 | select PHYLIB | ||
1889 | ---help--- | ||
1890 | This option enables support for the MPC5200's on-chip | ||
1891 | Fast Ethernet Controller | ||
1892 | If compiled as module, it will be called 'fec_mpc52xx.ko'. | ||
1893 | |||
1894 | config FEC_MPC52xx_MDIO | ||
1895 | bool "MPC52xx FEC MDIO bus driver" | ||
1896 | depends on FEC_MPC52xx | ||
1897 | default y | ||
1898 | ---help--- | ||
1899 | The MPC5200's FEC can connect to the Ethernet either with | ||
1900 | an external MII PHY chip or 10 Mbps 7-wire interface | ||
1901 | (Motorola? industry standard). | ||
1902 | If your board uses an external PHY connected to FEC, enable this. | ||
1903 | If not sure, enable. | ||
1904 | If compiled as module, it will be called 'fec_mpc52xx_phy.ko'. | ||
1905 | |||
1883 | config NE_H8300 | 1906 | config NE_H8300 |
1884 | tristate "NE2000 compatible support for H8/300" | 1907 | tristate "NE2000 compatible support for H8/300" |
1885 | depends on H8300 | 1908 | depends on H8300 |
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/bfin_mac.c b/drivers/net/bfin_mac.c index 53fe7ded5d50..084acfd6fc5f 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; |
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..72deff0d4d90 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); |
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/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/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/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/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/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..f8904fd92369 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -1416,7 +1416,7 @@ static int pppol2tp_create(struct net *net, struct socket *sock) | |||
1416 | int error = -ENOMEM; | 1416 | int error = -ENOMEM; |
1417 | struct sock *sk; | 1417 | struct sock *sk; |
1418 | 1418 | ||
1419 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto, 1); | 1419 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto); |
1420 | if (!sk) | 1420 | if (!sk) |
1421 | goto out; | 1421 | goto out; |
1422 | 1422 | ||
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index e8960f294a6e..b94fa7ef1955 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -392,7 +392,9 @@ struct rtl8169_private { | |||
392 | void __iomem *mmio_addr; /* memory map physical address */ | 392 | void __iomem *mmio_addr; /* memory map physical address */ |
393 | struct pci_dev *pci_dev; /* Index of PCI device */ | 393 | struct pci_dev *pci_dev; /* Index of PCI device */ |
394 | struct net_device *dev; | 394 | struct net_device *dev; |
395 | #ifdef CONFIG_R8169_NAPI | ||
395 | struct napi_struct napi; | 396 | struct napi_struct napi; |
397 | #endif | ||
396 | spinlock_t lock; /* spin lock flag */ | 398 | spinlock_t lock; /* spin lock flag */ |
397 | u32 msg_enable; | 399 | u32 msg_enable; |
398 | int chipset; | 400 | int chipset; |
@@ -2989,13 +2991,16 @@ static void rtl8169_down(struct net_device *dev) | |||
2989 | { | 2991 | { |
2990 | struct rtl8169_private *tp = netdev_priv(dev); | 2992 | struct rtl8169_private *tp = netdev_priv(dev); |
2991 | void __iomem *ioaddr = tp->mmio_addr; | 2993 | void __iomem *ioaddr = tp->mmio_addr; |
2992 | unsigned int poll_locked = 0; | ||
2993 | unsigned int intrmask; | 2994 | unsigned int intrmask; |
2994 | 2995 | ||
2995 | rtl8169_delete_timer(dev); | 2996 | rtl8169_delete_timer(dev); |
2996 | 2997 | ||
2997 | netif_stop_queue(dev); | 2998 | netif_stop_queue(dev); |
2998 | 2999 | ||
3000 | #ifdef CONFIG_R8169_NAPI | ||
3001 | napi_disable(&tp->napi); | ||
3002 | #endif | ||
3003 | |||
2999 | core_down: | 3004 | core_down: |
3000 | spin_lock_irq(&tp->lock); | 3005 | spin_lock_irq(&tp->lock); |
3001 | 3006 | ||
@@ -3009,11 +3014,6 @@ core_down: | |||
3009 | 3014 | ||
3010 | synchronize_irq(dev->irq); | 3015 | synchronize_irq(dev->irq); |
3011 | 3016 | ||
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. */ | 3017 | /* Give a racing hard_start_xmit a few cycles to complete. */ |
3018 | synchronize_sched(); /* FIXME: should this be synchronize_irq()? */ | 3018 | synchronize_sched(); /* FIXME: should this be synchronize_irq()? */ |
3019 | 3019 | ||
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/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/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/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 9d9ff76a9bc6..5058e60e5703 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); |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index d09479e816cd..f0e56dfc9ecf 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: |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index a6c7904de282..8d53d08b9691 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -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-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..4f22a7174caf 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -6478,8 +6478,9 @@ static void iwl_bg_scan_check(struct work_struct *data) | |||
6478 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, | 6478 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, |
6479 | "Scan completion watchdog resetting adapter (%dms)\n", | 6479 | "Scan completion watchdog resetting adapter (%dms)\n", |
6480 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); | 6480 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); |
6481 | |||
6481 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) | 6482 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6482 | queue_work(priv->workqueue, &priv->restart); | 6483 | iwl_send_scan_abort(priv); |
6483 | } | 6484 | } |
6484 | mutex_unlock(&priv->mutex); | 6485 | mutex_unlock(&priv->mutex); |
6485 | } | 6486 | } |
@@ -6575,7 +6576,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
6575 | spin_unlock_irqrestore(&priv->lock, flags); | 6576 | spin_unlock_irqrestore(&priv->lock, flags); |
6576 | 6577 | ||
6577 | scan->suspend_time = 0; | 6578 | scan->suspend_time = 0; |
6578 | scan->max_out_time = cpu_to_le32(600 * 1024); | 6579 | scan->max_out_time = cpu_to_le32(200 * 1024); |
6579 | if (!interval) | 6580 | if (!interval) |
6580 | interval = suspend_time; | 6581 | interval = suspend_time; |
6581 | /* | 6582 | /* |
@@ -6605,7 +6606,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
6605 | memcpy(scan->direct_scan[0].ssid, | 6606 | memcpy(scan->direct_scan[0].ssid, |
6606 | priv->direct_ssid, priv->direct_ssid_len); | 6607 | priv->direct_ssid, priv->direct_ssid_len); |
6607 | direct_mask = 1; | 6608 | direct_mask = 1; |
6608 | } else if (!iwl_is_associated(priv)) { | 6609 | } else if (!iwl_is_associated(priv) && priv->essid_len) { |
6609 | scan->direct_scan[0].id = WLAN_EID_SSID; | 6610 | scan->direct_scan[0].id = WLAN_EID_SSID; |
6610 | scan->direct_scan[0].len = priv->essid_len; | 6611 | scan->direct_scan[0].len = priv->essid_len; |
6611 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | 6612 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); |
@@ -6744,6 +6745,12 @@ static void iwl_bg_post_associate(struct work_struct *data) | |||
6744 | 6745 | ||
6745 | mutex_lock(&priv->mutex); | 6746 | mutex_lock(&priv->mutex); |
6746 | 6747 | ||
6748 | if (!priv->interface_id || !priv->is_open) { | ||
6749 | mutex_unlock(&priv->mutex); | ||
6750 | return; | ||
6751 | } | ||
6752 | iwl_scan_cancel_timeout(priv, 200); | ||
6753 | |||
6747 | conf = ieee80211_get_hw_conf(priv->hw); | 6754 | conf = ieee80211_get_hw_conf(priv->hw); |
6748 | 6755 | ||
6749 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 6756 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
@@ -6882,9 +6889,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw) | |||
6882 | struct iwl_priv *priv = hw->priv; | 6889 | struct iwl_priv *priv = hw->priv; |
6883 | 6890 | ||
6884 | IWL_DEBUG_MAC80211("enter\n"); | 6891 | IWL_DEBUG_MAC80211("enter\n"); |
6892 | |||
6893 | |||
6894 | mutex_lock(&priv->mutex); | ||
6895 | /* stop mac, cancel any scan request and clear | ||
6896 | * RXON_FILTER_ASSOC_MSK BIT | ||
6897 | */ | ||
6885 | priv->is_open = 0; | 6898 | priv->is_open = 0; |
6886 | /*netif_stop_queue(dev); */ | 6899 | iwl_scan_cancel_timeout(priv, 100); |
6887 | flush_workqueue(priv->workqueue); | 6900 | cancel_delayed_work(&priv->post_associate); |
6901 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
6902 | iwl_commit_rxon(priv); | ||
6903 | mutex_unlock(&priv->mutex); | ||
6904 | |||
6888 | IWL_DEBUG_MAC80211("leave\n"); | 6905 | IWL_DEBUG_MAC80211("leave\n"); |
6889 | } | 6906 | } |
6890 | 6907 | ||
@@ -7169,8 +7186,6 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7169 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 7186 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) |
7170 | iwl_config_ap(priv); | 7187 | iwl_config_ap(priv); |
7171 | else { | 7188 | else { |
7172 | priv->staging_rxon.filter_flags |= | ||
7173 | RXON_FILTER_ASSOC_MSK; | ||
7174 | rc = iwl_commit_rxon(priv); | 7189 | rc = iwl_commit_rxon(priv); |
7175 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) | 7190 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) |
7176 | iwl_add_station(priv, | 7191 | iwl_add_station(priv, |
@@ -7178,6 +7193,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7178 | } | 7193 | } |
7179 | 7194 | ||
7180 | } else { | 7195 | } else { |
7196 | iwl_scan_cancel_timeout(priv, 100); | ||
7181 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7197 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
7182 | iwl_commit_rxon(priv); | 7198 | iwl_commit_rxon(priv); |
7183 | } | 7199 | } |
@@ -7217,6 +7233,12 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw, | |||
7217 | IWL_DEBUG_MAC80211("enter\n"); | 7233 | IWL_DEBUG_MAC80211("enter\n"); |
7218 | 7234 | ||
7219 | mutex_lock(&priv->mutex); | 7235 | mutex_lock(&priv->mutex); |
7236 | |||
7237 | iwl_scan_cancel_timeout(priv, 100); | ||
7238 | cancel_delayed_work(&priv->post_associate); | ||
7239 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
7240 | iwl_commit_rxon(priv); | ||
7241 | |||
7220 | if (priv->interface_id == conf->if_id) { | 7242 | if (priv->interface_id == conf->if_id) { |
7221 | priv->interface_id = 0; | 7243 | priv->interface_id = 0; |
7222 | memset(priv->bssid, 0, ETH_ALEN); | 7244 | memset(priv->bssid, 0, ETH_ALEN); |
@@ -7238,6 +7260,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7238 | 7260 | ||
7239 | IWL_DEBUG_MAC80211("enter\n"); | 7261 | IWL_DEBUG_MAC80211("enter\n"); |
7240 | 7262 | ||
7263 | mutex_lock(&priv->mutex); | ||
7241 | spin_lock_irqsave(&priv->lock, flags); | 7264 | spin_lock_irqsave(&priv->lock, flags); |
7242 | 7265 | ||
7243 | if (!iwl_is_ready_rf(priv)) { | 7266 | if (!iwl_is_ready_rf(priv)) { |
@@ -7268,7 +7291,8 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7268 | priv->direct_ssid_len = (u8) | 7291 | priv->direct_ssid_len = (u8) |
7269 | min((u8) len, (u8) IW_ESSID_MAX_SIZE); | 7292 | min((u8) len, (u8) IW_ESSID_MAX_SIZE); |
7270 | memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); | 7293 | memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); |
7271 | } | 7294 | } else |
7295 | priv->one_direct_scan = 0; | ||
7272 | 7296 | ||
7273 | rc = iwl_scan_initiate(priv); | 7297 | rc = iwl_scan_initiate(priv); |
7274 | 7298 | ||
@@ -7276,6 +7300,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7276 | 7300 | ||
7277 | out_unlock: | 7301 | out_unlock: |
7278 | spin_unlock_irqrestore(&priv->lock, flags); | 7302 | spin_unlock_irqrestore(&priv->lock, flags); |
7303 | mutex_unlock(&priv->mutex); | ||
7279 | 7304 | ||
7280 | return rc; | 7305 | return rc; |
7281 | } | 7306 | } |
@@ -7310,6 +7335,8 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
7310 | 7335 | ||
7311 | mutex_lock(&priv->mutex); | 7336 | mutex_lock(&priv->mutex); |
7312 | 7337 | ||
7338 | iwl_scan_cancel_timeout(priv, 100); | ||
7339 | |||
7313 | switch (cmd) { | 7340 | switch (cmd) { |
7314 | case SET_KEY: | 7341 | case SET_KEY: |
7315 | rc = iwl_update_sta_key_info(priv, key, sta_id); | 7342 | rc = iwl_update_sta_key_info(priv, key, sta_id); |
@@ -7479,8 +7506,18 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7479 | 7506 | ||
7480 | spin_unlock_irqrestore(&priv->lock, flags); | 7507 | spin_unlock_irqrestore(&priv->lock, flags); |
7481 | 7508 | ||
7509 | /* we are restarting association process | ||
7510 | * clear RXON_FILTER_ASSOC_MSK bit | ||
7511 | */ | ||
7512 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | ||
7513 | iwl_scan_cancel_timeout(priv, 100); | ||
7514 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
7515 | iwl_commit_rxon(priv); | ||
7516 | } | ||
7517 | |||
7482 | /* Per mac80211.h: This is only used in IBSS mode... */ | 7518 | /* Per mac80211.h: This is only used in IBSS mode... */ |
7483 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 7519 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { |
7520 | |||
7484 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); | 7521 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); |
7485 | mutex_unlock(&priv->mutex); | 7522 | mutex_unlock(&priv->mutex); |
7486 | return; | 7523 | return; |
@@ -8558,6 +8595,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) | |||
8558 | iwl_rate_control_unregister(priv->hw); | 8595 | iwl_rate_control_unregister(priv->hw); |
8559 | } | 8596 | } |
8560 | 8597 | ||
8598 | /*netif_stop_queue(dev); */ | ||
8599 | flush_workqueue(priv->workqueue); | ||
8600 | |||
8561 | /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes | 8601 | /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes |
8562 | * priv->workqueue... so we can't take down the workqueue | 8602 | * priv->workqueue... so we can't take down the workqueue |
8563 | * until now... */ | 8603 | * until now... */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 5e1279263b22..d60adcb9bd4a 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -6845,8 +6845,9 @@ static void iwl_bg_scan_check(struct work_struct *data) | |||
6845 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, | 6845 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, |
6846 | "Scan completion watchdog resetting adapter (%dms)\n", | 6846 | "Scan completion watchdog resetting adapter (%dms)\n", |
6847 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); | 6847 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); |
6848 | |||
6848 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) | 6849 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6849 | queue_work(priv->workqueue, &priv->restart); | 6850 | iwl_send_scan_abort(priv); |
6850 | } | 6851 | } |
6851 | mutex_unlock(&priv->mutex); | 6852 | mutex_unlock(&priv->mutex); |
6852 | } | 6853 | } |
@@ -6942,7 +6943,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
6942 | spin_unlock_irqrestore(&priv->lock, flags); | 6943 | spin_unlock_irqrestore(&priv->lock, flags); |
6943 | 6944 | ||
6944 | scan->suspend_time = 0; | 6945 | scan->suspend_time = 0; |
6945 | scan->max_out_time = cpu_to_le32(600 * 1024); | 6946 | scan->max_out_time = cpu_to_le32(200 * 1024); |
6946 | if (!interval) | 6947 | if (!interval) |
6947 | interval = suspend_time; | 6948 | interval = suspend_time; |
6948 | 6949 | ||
@@ -6965,7 +6966,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
6965 | memcpy(scan->direct_scan[0].ssid, | 6966 | memcpy(scan->direct_scan[0].ssid, |
6966 | priv->direct_ssid, priv->direct_ssid_len); | 6967 | priv->direct_ssid, priv->direct_ssid_len); |
6967 | direct_mask = 1; | 6968 | direct_mask = 1; |
6968 | } else if (!iwl_is_associated(priv)) { | 6969 | } else if (!iwl_is_associated(priv) && priv->essid_len) { |
6969 | scan->direct_scan[0].id = WLAN_EID_SSID; | 6970 | scan->direct_scan[0].id = WLAN_EID_SSID; |
6970 | scan->direct_scan[0].len = priv->essid_len; | 6971 | scan->direct_scan[0].len = priv->essid_len; |
6971 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | 6972 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); |
@@ -7118,6 +7119,12 @@ static void iwl_bg_post_associate(struct work_struct *data) | |||
7118 | 7119 | ||
7119 | mutex_lock(&priv->mutex); | 7120 | mutex_lock(&priv->mutex); |
7120 | 7121 | ||
7122 | if (!priv->interface_id || !priv->is_open) { | ||
7123 | mutex_unlock(&priv->mutex); | ||
7124 | return; | ||
7125 | } | ||
7126 | iwl_scan_cancel_timeout(priv, 200); | ||
7127 | |||
7121 | conf = ieee80211_get_hw_conf(priv->hw); | 7128 | conf = ieee80211_get_hw_conf(priv->hw); |
7122 | 7129 | ||
7123 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7130 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
@@ -7271,9 +7278,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw) | |||
7271 | struct iwl_priv *priv = hw->priv; | 7278 | struct iwl_priv *priv = hw->priv; |
7272 | 7279 | ||
7273 | IWL_DEBUG_MAC80211("enter\n"); | 7280 | IWL_DEBUG_MAC80211("enter\n"); |
7281 | |||
7282 | |||
7283 | mutex_lock(&priv->mutex); | ||
7284 | /* stop mac, cancel any scan request and clear | ||
7285 | * RXON_FILTER_ASSOC_MSK BIT | ||
7286 | */ | ||
7274 | priv->is_open = 0; | 7287 | priv->is_open = 0; |
7275 | /*netif_stop_queue(dev); */ | 7288 | iwl_scan_cancel_timeout(priv, 100); |
7276 | flush_workqueue(priv->workqueue); | 7289 | cancel_delayed_work(&priv->post_associate); |
7290 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
7291 | iwl_commit_rxon(priv); | ||
7292 | mutex_unlock(&priv->mutex); | ||
7293 | |||
7277 | IWL_DEBUG_MAC80211("leave\n"); | 7294 | IWL_DEBUG_MAC80211("leave\n"); |
7278 | } | 7295 | } |
7279 | 7296 | ||
@@ -7573,8 +7590,6 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7573 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 7590 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) |
7574 | iwl_config_ap(priv); | 7591 | iwl_config_ap(priv); |
7575 | else { | 7592 | else { |
7576 | priv->staging_rxon.filter_flags |= | ||
7577 | RXON_FILTER_ASSOC_MSK; | ||
7578 | rc = iwl_commit_rxon(priv); | 7593 | rc = iwl_commit_rxon(priv); |
7579 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) | 7594 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) |
7580 | iwl_rxon_add_station( | 7595 | iwl_rxon_add_station( |
@@ -7582,6 +7597,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7582 | } | 7597 | } |
7583 | 7598 | ||
7584 | } else { | 7599 | } else { |
7600 | iwl_scan_cancel_timeout(priv, 100); | ||
7585 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7601 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
7586 | iwl_commit_rxon(priv); | 7602 | iwl_commit_rxon(priv); |
7587 | } | 7603 | } |
@@ -7621,6 +7637,12 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw, | |||
7621 | IWL_DEBUG_MAC80211("enter\n"); | 7637 | IWL_DEBUG_MAC80211("enter\n"); |
7622 | 7638 | ||
7623 | mutex_lock(&priv->mutex); | 7639 | mutex_lock(&priv->mutex); |
7640 | |||
7641 | iwl_scan_cancel_timeout(priv, 100); | ||
7642 | cancel_delayed_work(&priv->post_associate); | ||
7643 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
7644 | iwl_commit_rxon(priv); | ||
7645 | |||
7624 | if (priv->interface_id == conf->if_id) { | 7646 | if (priv->interface_id == conf->if_id) { |
7625 | priv->interface_id = 0; | 7647 | priv->interface_id = 0; |
7626 | memset(priv->bssid, 0, ETH_ALEN); | 7648 | memset(priv->bssid, 0, ETH_ALEN); |
@@ -7642,6 +7664,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7642 | 7664 | ||
7643 | IWL_DEBUG_MAC80211("enter\n"); | 7665 | IWL_DEBUG_MAC80211("enter\n"); |
7644 | 7666 | ||
7667 | mutex_lock(&priv->mutex); | ||
7645 | spin_lock_irqsave(&priv->lock, flags); | 7668 | spin_lock_irqsave(&priv->lock, flags); |
7646 | 7669 | ||
7647 | if (!iwl_is_ready_rf(priv)) { | 7670 | if (!iwl_is_ready_rf(priv)) { |
@@ -7672,7 +7695,8 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7672 | priv->direct_ssid_len = (u8) | 7695 | priv->direct_ssid_len = (u8) |
7673 | min((u8) len, (u8) IW_ESSID_MAX_SIZE); | 7696 | min((u8) len, (u8) IW_ESSID_MAX_SIZE); |
7674 | memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); | 7697 | memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); |
7675 | } | 7698 | } else |
7699 | priv->one_direct_scan = 0; | ||
7676 | 7700 | ||
7677 | rc = iwl_scan_initiate(priv); | 7701 | rc = iwl_scan_initiate(priv); |
7678 | 7702 | ||
@@ -7680,6 +7704,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7680 | 7704 | ||
7681 | out_unlock: | 7705 | out_unlock: |
7682 | spin_unlock_irqrestore(&priv->lock, flags); | 7706 | spin_unlock_irqrestore(&priv->lock, flags); |
7707 | mutex_unlock(&priv->mutex); | ||
7683 | 7708 | ||
7684 | return rc; | 7709 | return rc; |
7685 | } | 7710 | } |
@@ -7713,6 +7738,8 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
7713 | 7738 | ||
7714 | mutex_lock(&priv->mutex); | 7739 | mutex_lock(&priv->mutex); |
7715 | 7740 | ||
7741 | iwl_scan_cancel_timeout(priv, 100); | ||
7742 | |||
7716 | switch (cmd) { | 7743 | switch (cmd) { |
7717 | case SET_KEY: | 7744 | case SET_KEY: |
7718 | rc = iwl_update_sta_key_info(priv, key, sta_id); | 7745 | rc = iwl_update_sta_key_info(priv, key, sta_id); |
@@ -7903,8 +7930,18 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7903 | 7930 | ||
7904 | spin_unlock_irqrestore(&priv->lock, flags); | 7931 | spin_unlock_irqrestore(&priv->lock, flags); |
7905 | 7932 | ||
7933 | /* we are restarting association process | ||
7934 | * clear RXON_FILTER_ASSOC_MSK bit | ||
7935 | */ | ||
7936 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | ||
7937 | iwl_scan_cancel_timeout(priv, 100); | ||
7938 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
7939 | iwl_commit_rxon(priv); | ||
7940 | } | ||
7941 | |||
7906 | /* Per mac80211.h: This is only used in IBSS mode... */ | 7942 | /* Per mac80211.h: This is only used in IBSS mode... */ |
7907 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 7943 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { |
7944 | |||
7908 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); | 7945 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); |
7909 | mutex_unlock(&priv->mutex); | 7946 | mutex_unlock(&priv->mutex); |
7910 | return; | 7947 | return; |
@@ -9152,6 +9189,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) | |||
9152 | iwl_rate_control_unregister(priv->hw); | 9189 | iwl_rate_control_unregister(priv->hw); |
9153 | } | 9190 | } |
9154 | 9191 | ||
9192 | /*netif_stop_queue(dev); */ | ||
9193 | flush_workqueue(priv->workqueue); | ||
9194 | |||
9155 | /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes | 9195 | /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes |
9156 | * priv->workqueue... so we can't take down the workqueue | 9196 | * priv->workqueue... so we can't take down the workqueue |
9157 | * until now... */ | 9197 | * until now... */ |
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/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/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/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/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..86cf10efb0c1 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 | ||
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/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/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/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/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/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/video/Kconfig b/drivers/video/Kconfig index fb9d8d0b2c04..cc4b60f899ca 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -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_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/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/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/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); |