diff options
Diffstat (limited to 'drivers')
245 files changed, 5006 insertions, 4079 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index 9c4bd220c44f..86fd142f4bf3 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -1192,6 +1192,7 @@ static int asus_hotk_get_info(void) | |||
1192 | break; | 1192 | break; |
1193 | default: | 1193 | default: |
1194 | kfree(model); | 1194 | kfree(model); |
1195 | model = NULL; | ||
1195 | break; | 1196 | break; |
1196 | } | 1197 | } |
1197 | } | 1198 | } |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 81651032791b..d7b499fe0cd9 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -113,7 +113,7 @@ struct acpi_battery_info { | |||
113 | acpi_string oem_info; | 113 | acpi_string oem_info; |
114 | }; | 114 | }; |
115 | 115 | ||
116 | enum acpi_battery_files{ | 116 | enum acpi_battery_files { |
117 | ACPI_BATTERY_INFO = 0, | 117 | ACPI_BATTERY_INFO = 0, |
118 | ACPI_BATTERY_STATE, | 118 | ACPI_BATTERY_STATE, |
119 | ACPI_BATTERY_ALARM, | 119 | ACPI_BATTERY_ALARM, |
@@ -129,13 +129,14 @@ struct acpi_battery_flags { | |||
129 | }; | 129 | }; |
130 | 130 | ||
131 | struct acpi_battery { | 131 | struct acpi_battery { |
132 | struct mutex mutex; | ||
133 | struct acpi_device *device; | 132 | struct acpi_device *device; |
134 | struct acpi_battery_flags flags; | 133 | struct acpi_battery_flags flags; |
135 | struct acpi_buffer bif_data; | 134 | struct acpi_buffer bif_data; |
136 | struct acpi_buffer bst_data; | 135 | struct acpi_buffer bst_data; |
136 | struct mutex lock; | ||
137 | unsigned long alarm; | 137 | unsigned long alarm; |
138 | unsigned long update_time[ACPI_BATTERY_NUMFILES]; | 138 | unsigned long update_time[ACPI_BATTERY_NUMFILES]; |
139 | |||
139 | }; | 140 | }; |
140 | 141 | ||
141 | inline int acpi_battery_present(struct acpi_battery *battery) | 142 | inline int acpi_battery_present(struct acpi_battery *battery) |
@@ -235,10 +236,10 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
235 | return 0; | 236 | return 0; |
236 | 237 | ||
237 | /* Evaluate _BIF */ | 238 | /* Evaluate _BIF */ |
238 | 239 | mutex_lock(&battery->lock); | |
239 | status = | 240 | status = acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", |
240 | acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL, | 241 | NULL, &buffer); |
241 | &buffer); | 242 | mutex_unlock(&battery->lock); |
242 | if (ACPI_FAILURE(status)) { | 243 | if (ACPI_FAILURE(status)) { |
243 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); | 244 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); |
244 | return -ENODEV; | 245 | return -ENODEV; |
@@ -285,10 +286,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
285 | return 0; | 286 | return 0; |
286 | 287 | ||
287 | /* Evaluate _BST */ | 288 | /* Evaluate _BST */ |
288 | 289 | mutex_lock(&battery->lock); | |
289 | status = | 290 | status = acpi_evaluate_object(acpi_battery_handle(battery), "_BST", |
290 | acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL, | 291 | NULL, &buffer); |
291 | &buffer); | 292 | mutex_unlock(&battery->lock); |
292 | if (ACPI_FAILURE(status)) { | 293 | if (ACPI_FAILURE(status)) { |
293 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); | 294 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); |
294 | return -ENODEV; | 295 | return -ENODEV; |
@@ -336,9 +337,10 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery, | |||
336 | 337 | ||
337 | arg0.integer.value = alarm; | 338 | arg0.integer.value = alarm; |
338 | 339 | ||
339 | status = | 340 | mutex_lock(&battery->lock); |
340 | acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", | 341 | status = acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", |
341 | &arg_list, NULL); | 342 | &arg_list, NULL); |
343 | mutex_unlock(&battery->lock); | ||
342 | if (ACPI_FAILURE(status)) | 344 | if (ACPI_FAILURE(status)) |
343 | return -ENODEV; | 345 | return -ENODEV; |
344 | 346 | ||
@@ -658,8 +660,6 @@ acpi_battery_write_alarm(struct file *file, | |||
658 | if (!battery || (count > sizeof(alarm_string) - 1)) | 660 | if (!battery || (count > sizeof(alarm_string) - 1)) |
659 | return -EINVAL; | 661 | return -EINVAL; |
660 | 662 | ||
661 | mutex_lock(&battery->mutex); | ||
662 | |||
663 | result = acpi_battery_update(battery, 1, &update_result); | 663 | result = acpi_battery_update(battery, 1, &update_result); |
664 | if (result) { | 664 | if (result) { |
665 | result = -ENODEV; | 665 | result = -ENODEV; |
@@ -688,9 +688,7 @@ acpi_battery_write_alarm(struct file *file, | |||
688 | acpi_battery_check_result(battery, result); | 688 | acpi_battery_check_result(battery, result); |
689 | 689 | ||
690 | if (!result) | 690 | if (!result) |
691 | result = count; | 691 | return count; |
692 | |||
693 | mutex_unlock(&battery->mutex); | ||
694 | 692 | ||
695 | return result; | 693 | return result; |
696 | } | 694 | } |
@@ -714,8 +712,6 @@ static int acpi_battery_read(int fid, struct seq_file *seq) | |||
714 | int update_result = ACPI_BATTERY_NONE_UPDATE; | 712 | int update_result = ACPI_BATTERY_NONE_UPDATE; |
715 | int update = 0; | 713 | int update = 0; |
716 | 714 | ||
717 | mutex_lock(&battery->mutex); | ||
718 | |||
719 | update = (get_seconds() - battery->update_time[fid] >= update_time); | 715 | update = (get_seconds() - battery->update_time[fid] >= update_time); |
720 | update = (update | battery->flags.update[fid]); | 716 | update = (update | battery->flags.update[fid]); |
721 | 717 | ||
@@ -733,7 +729,6 @@ static int acpi_battery_read(int fid, struct seq_file *seq) | |||
733 | result = acpi_read_funcs[fid].print(seq, result); | 729 | result = acpi_read_funcs[fid].print(seq, result); |
734 | acpi_battery_check_result(battery, result); | 730 | acpi_battery_check_result(battery, result); |
735 | battery->flags.update[fid] = result; | 731 | battery->flags.update[fid] = result; |
736 | mutex_unlock(&battery->mutex); | ||
737 | return result; | 732 | return result; |
738 | } | 733 | } |
739 | 734 | ||
@@ -897,10 +892,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
897 | if (!battery) | 892 | if (!battery) |
898 | return -ENOMEM; | 893 | return -ENOMEM; |
899 | 894 | ||
900 | mutex_init(&battery->mutex); | 895 | mutex_init(&battery->lock); |
901 | |||
902 | mutex_lock(&battery->mutex); | ||
903 | |||
904 | battery->device = device; | 896 | battery->device = device; |
905 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); | 897 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); |
906 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); | 898 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); |
@@ -936,7 +928,6 @@ static int acpi_battery_add(struct acpi_device *device) | |||
936 | kfree(battery); | 928 | kfree(battery); |
937 | } | 929 | } |
938 | 930 | ||
939 | mutex_unlock(&battery->mutex); | ||
940 | 931 | ||
941 | return result; | 932 | return result; |
942 | } | 933 | } |
@@ -951,8 +942,6 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
951 | 942 | ||
952 | battery = acpi_driver_data(device); | 943 | battery = acpi_driver_data(device); |
953 | 944 | ||
954 | mutex_lock(&battery->mutex); | ||
955 | |||
956 | status = acpi_remove_notify_handler(device->handle, | 945 | status = acpi_remove_notify_handler(device->handle, |
957 | ACPI_ALL_NOTIFY, | 946 | ACPI_ALL_NOTIFY, |
958 | acpi_battery_notify); | 947 | acpi_battery_notify); |
@@ -963,9 +952,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
963 | 952 | ||
964 | kfree(battery->bst_data.pointer); | 953 | kfree(battery->bst_data.pointer); |
965 | 954 | ||
966 | mutex_unlock(&battery->mutex); | 955 | mutex_destroy(&battery->lock); |
967 | |||
968 | mutex_destroy(&battery->mutex); | ||
969 | 956 | ||
970 | kfree(battery); | 957 | kfree(battery); |
971 | 958 | ||
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c index 56a5b3fffeb3..6daf6088ac88 100644 --- a/drivers/acpi/bay.c +++ b/drivers/acpi/bay.c | |||
@@ -337,7 +337,7 @@ static void bay_notify(acpi_handle handle, u32 event, void *data) | |||
337 | char *envp[] = { event_string, NULL }; | 337 | char *envp[] = { event_string, NULL }; |
338 | 338 | ||
339 | bay_dprintk(handle, "Bay event"); | 339 | bay_dprintk(handle, "Bay event"); |
340 | sprintf(event_string, "BAY_EVENT=%d\n", event); | 340 | sprintf(event_string, "BAY_EVENT=%d", event); |
341 | kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); | 341 | kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); |
342 | } | 342 | } |
343 | 343 | ||
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 6192c8be66df..1dabdf4c07b3 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -336,13 +336,13 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event) | |||
336 | static void dock_event(struct dock_station *ds, u32 event, int num) | 336 | static void dock_event(struct dock_station *ds, u32 event, int num) |
337 | { | 337 | { |
338 | struct device *dev = &dock_device->dev; | 338 | struct device *dev = &dock_device->dev; |
339 | char event_string[7]; | 339 | char event_string[13]; |
340 | char *envp[] = { event_string, NULL }; | 340 | char *envp[] = { event_string, NULL }; |
341 | 341 | ||
342 | if (num == UNDOCK_EVENT) | 342 | if (num == UNDOCK_EVENT) |
343 | sprintf(event_string, "UNDOCK"); | 343 | sprintf(event_string, "EVENT=undock"); |
344 | else | 344 | else |
345 | sprintf(event_string, "DOCK"); | 345 | sprintf(event_string, "EVENT=dock"); |
346 | 346 | ||
347 | /* | 347 | /* |
348 | * Indicate that the status of the dock station has | 348 | * Indicate that the status of the dock station has |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 469f3f57f881..56bee9e065cf 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -471,7 +471,6 @@ static void acpi_ec_gpe_query(void *ec_cxt) | |||
471 | } | 471 | } |
472 | } | 472 | } |
473 | mutex_unlock(&ec->lock); | 473 | mutex_unlock(&ec->lock); |
474 | printk(KERN_ERR PREFIX "Handler for query 0x%x is not found!\n", value); | ||
475 | } | 474 | } |
476 | 475 | ||
477 | static u32 acpi_ec_gpe_handler(void *data) | 476 | static u32 acpi_ec_gpe_handler(void *data) |
@@ -665,30 +664,44 @@ acpi_ec_register_query_methods(acpi_handle handle, u32 level, | |||
665 | return AE_OK; | 664 | return AE_OK; |
666 | } | 665 | } |
667 | 666 | ||
668 | static int ec_parse_device(struct acpi_ec *ec, acpi_handle handle) | 667 | static acpi_status |
668 | ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) | ||
669 | { | 669 | { |
670 | if (ACPI_FAILURE(acpi_walk_resources(handle, METHOD_NAME__CRS, | 670 | acpi_status status; |
671 | ec_parse_io_ports, ec))) | 671 | |
672 | return -EINVAL; | 672 | struct acpi_ec *ec = context; |
673 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | ||
674 | ec_parse_io_ports, ec); | ||
675 | if (ACPI_FAILURE(status)) | ||
676 | return status; | ||
673 | 677 | ||
674 | /* Get GPE bit assignment (EC events). */ | 678 | /* Get GPE bit assignment (EC events). */ |
675 | /* TODO: Add support for _GPE returning a package */ | 679 | /* TODO: Add support for _GPE returning a package */ |
676 | if (ACPI_FAILURE(acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe))) | 680 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe); |
677 | return -EINVAL; | 681 | if (ACPI_FAILURE(status)) |
678 | 682 | return status; | |
679 | /* Use the global lock for all EC transactions? */ | ||
680 | acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); | ||
681 | 683 | ||
682 | /* Find and register all query methods */ | 684 | /* Find and register all query methods */ |
683 | acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1, | 685 | acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1, |
684 | acpi_ec_register_query_methods, ec, NULL); | 686 | acpi_ec_register_query_methods, ec, NULL); |
685 | 687 | ||
688 | /* Use the global lock for all EC transactions? */ | ||
689 | acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); | ||
690 | |||
686 | ec->handle = handle; | 691 | ec->handle = handle; |
687 | 692 | ||
688 | printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx", | 693 | printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", |
689 | ec->gpe, ec->command_addr, ec->data_addr); | 694 | ec->gpe, ec->command_addr, ec->data_addr); |
690 | 695 | ||
691 | return 0; | 696 | return AE_CTRL_TERMINATE; |
697 | } | ||
698 | |||
699 | static void ec_remove_handlers(struct acpi_ec *ec) | ||
700 | { | ||
701 | acpi_remove_address_space_handler(ec->handle, | ||
702 | ACPI_ADR_SPACE_EC, | ||
703 | &acpi_ec_space_handler); | ||
704 | acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); | ||
692 | } | 705 | } |
693 | 706 | ||
694 | static int acpi_ec_add(struct acpi_device *device) | 707 | static int acpi_ec_add(struct acpi_device *device) |
@@ -705,7 +718,8 @@ static int acpi_ec_add(struct acpi_device *device) | |||
705 | if (!ec) | 718 | if (!ec) |
706 | return -ENOMEM; | 719 | return -ENOMEM; |
707 | 720 | ||
708 | if (ec_parse_device(ec, device->handle)) { | 721 | if (ec_parse_device(device->handle, 0, ec, NULL) != |
722 | AE_CTRL_TERMINATE) { | ||
709 | kfree(ec); | 723 | kfree(ec); |
710 | return -EINVAL; | 724 | return -EINVAL; |
711 | } | 725 | } |
@@ -713,16 +727,13 @@ static int acpi_ec_add(struct acpi_device *device) | |||
713 | /* Check if we found the boot EC */ | 727 | /* Check if we found the boot EC */ |
714 | if (boot_ec) { | 728 | if (boot_ec) { |
715 | if (boot_ec->gpe == ec->gpe) { | 729 | if (boot_ec->gpe == ec->gpe) { |
716 | /* We might have incorrect info for GL at boot time */ | 730 | ec_remove_handlers(boot_ec); |
717 | mutex_lock(&boot_ec->lock); | 731 | mutex_destroy(&boot_ec->lock); |
718 | boot_ec->global_lock = ec->global_lock; | 732 | kfree(boot_ec); |
719 | /* Copy handlers from new ec into boot ec */ | 733 | first_ec = boot_ec = NULL; |
720 | list_splice(&ec->list, &boot_ec->list); | ||
721 | mutex_unlock(&boot_ec->lock); | ||
722 | kfree(ec); | ||
723 | ec = boot_ec; | ||
724 | } | 734 | } |
725 | } else | 735 | } |
736 | if (!first_ec) | ||
726 | first_ec = ec; | 737 | first_ec = ec; |
727 | ec->handle = device->handle; | 738 | ec->handle = device->handle; |
728 | acpi_driver_data(device) = ec; | 739 | acpi_driver_data(device) = ec; |
@@ -734,14 +745,14 @@ static int acpi_ec_add(struct acpi_device *device) | |||
734 | static int acpi_ec_remove(struct acpi_device *device, int type) | 745 | static int acpi_ec_remove(struct acpi_device *device, int type) |
735 | { | 746 | { |
736 | struct acpi_ec *ec; | 747 | struct acpi_ec *ec; |
737 | struct acpi_ec_query_handler *handler; | 748 | struct acpi_ec_query_handler *handler, *tmp; |
738 | 749 | ||
739 | if (!device) | 750 | if (!device) |
740 | return -EINVAL; | 751 | return -EINVAL; |
741 | 752 | ||
742 | ec = acpi_driver_data(device); | 753 | ec = acpi_driver_data(device); |
743 | mutex_lock(&ec->lock); | 754 | mutex_lock(&ec->lock); |
744 | list_for_each_entry(handler, &ec->list, node) { | 755 | list_for_each_entry_safe(handler, tmp, &ec->list, node) { |
745 | list_del(&handler->node); | 756 | list_del(&handler->node); |
746 | kfree(handler); | 757 | kfree(handler); |
747 | } | 758 | } |
@@ -751,9 +762,6 @@ static int acpi_ec_remove(struct acpi_device *device, int type) | |||
751 | if (ec == first_ec) | 762 | if (ec == first_ec) |
752 | first_ec = NULL; | 763 | first_ec = NULL; |
753 | 764 | ||
754 | /* Don't touch boot EC */ | ||
755 | if (boot_ec != ec) | ||
756 | kfree(ec); | ||
757 | return 0; | 765 | return 0; |
758 | } | 766 | } |
759 | 767 | ||
@@ -817,9 +825,7 @@ static int acpi_ec_start(struct acpi_device *device) | |||
817 | if (!ec) | 825 | if (!ec) |
818 | return -EINVAL; | 826 | return -EINVAL; |
819 | 827 | ||
820 | /* Boot EC is already working */ | 828 | ret = ec_install_handlers(ec); |
821 | if (ec != boot_ec) | ||
822 | ret = ec_install_handlers(ec); | ||
823 | 829 | ||
824 | /* EC is fully operational, allow queries */ | 830 | /* EC is fully operational, allow queries */ |
825 | atomic_set(&ec->query_pending, 0); | 831 | atomic_set(&ec->query_pending, 0); |
@@ -829,7 +835,6 @@ static int acpi_ec_start(struct acpi_device *device) | |||
829 | 835 | ||
830 | static int acpi_ec_stop(struct acpi_device *device, int type) | 836 | static int acpi_ec_stop(struct acpi_device *device, int type) |
831 | { | 837 | { |
832 | acpi_status status; | ||
833 | struct acpi_ec *ec; | 838 | struct acpi_ec *ec; |
834 | 839 | ||
835 | if (!device) | 840 | if (!device) |
@@ -838,21 +843,7 @@ static int acpi_ec_stop(struct acpi_device *device, int type) | |||
838 | ec = acpi_driver_data(device); | 843 | ec = acpi_driver_data(device); |
839 | if (!ec) | 844 | if (!ec) |
840 | return -EINVAL; | 845 | return -EINVAL; |
841 | 846 | ec_remove_handlers(ec); | |
842 | /* Don't touch boot EC */ | ||
843 | if (ec == boot_ec) | ||
844 | return 0; | ||
845 | |||
846 | status = acpi_remove_address_space_handler(ec->handle, | ||
847 | ACPI_ADR_SPACE_EC, | ||
848 | &acpi_ec_space_handler); | ||
849 | if (ACPI_FAILURE(status)) | ||
850 | return -ENODEV; | ||
851 | |||
852 | status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); | ||
853 | if (ACPI_FAILURE(status)) | ||
854 | return -ENODEV; | ||
855 | |||
856 | return 0; | 847 | return 0; |
857 | } | 848 | } |
858 | 849 | ||
@@ -868,18 +859,21 @@ int __init acpi_ec_ecdt_probe(void) | |||
868 | /* | 859 | /* |
869 | * Generate a boot ec context | 860 | * Generate a boot ec context |
870 | */ | 861 | */ |
871 | |||
872 | status = acpi_get_table(ACPI_SIG_ECDT, 1, | 862 | status = acpi_get_table(ACPI_SIG_ECDT, 1, |
873 | (struct acpi_table_header **)&ecdt_ptr); | 863 | (struct acpi_table_header **)&ecdt_ptr); |
874 | if (ACPI_FAILURE(status)) | 864 | if (ACPI_SUCCESS(status)) { |
875 | goto error; | 865 | printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n\n"); |
876 | 866 | boot_ec->command_addr = ecdt_ptr->control.address; | |
877 | printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n"); | 867 | boot_ec->data_addr = ecdt_ptr->data.address; |
878 | 868 | boot_ec->gpe = ecdt_ptr->gpe; | |
879 | boot_ec->command_addr = ecdt_ptr->control.address; | 869 | boot_ec->handle = ACPI_ROOT_OBJECT; |
880 | boot_ec->data_addr = ecdt_ptr->data.address; | 870 | } else { |
881 | boot_ec->gpe = ecdt_ptr->gpe; | 871 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); |
882 | boot_ec->handle = ACPI_ROOT_OBJECT; | 872 | status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, |
873 | boot_ec, NULL); | ||
874 | if (ACPI_FAILURE(status)) | ||
875 | goto error; | ||
876 | } | ||
883 | 877 | ||
884 | ret = ec_install_handlers(boot_ec); | 878 | ret = ec_install_handlers(boot_ec); |
885 | if (!ret) { | 879 | if (!ret) { |
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index dfa5853b17f0..95637a4ff782 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c | |||
@@ -108,7 +108,7 @@ static const struct file_operations acpi_system_event_ops = { | |||
108 | }; | 108 | }; |
109 | 109 | ||
110 | #ifdef CONFIG_NET | 110 | #ifdef CONFIG_NET |
111 | unsigned int acpi_event_seqnum; | 111 | static unsigned int acpi_event_seqnum; |
112 | struct acpi_genl_event { | 112 | struct acpi_genl_event { |
113 | acpi_device_class device_class; | 113 | acpi_device_class device_class; |
114 | char bus_id[15]; | 114 | char bus_id[15]; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index a898991f77cb..a8634a0655fc 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -969,11 +969,17 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
969 | } | 969 | } |
970 | 970 | ||
971 | if (pr->flags.bm_check) { | 971 | if (pr->flags.bm_check) { |
972 | /* bus mastering control is necessary */ | ||
973 | if (!pr->flags.bm_control) { | 972 | if (!pr->flags.bm_control) { |
974 | /* In this case we enter C3 without bus mastering */ | 973 | if (pr->flags.has_cst != 1) { |
975 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 974 | /* bus mastering control is necessary */ |
976 | "C3 support without bus mastering control\n")); | 975 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
976 | "C3 support requires BM control\n")); | ||
977 | return; | ||
978 | } else { | ||
979 | /* Here we enter C3 without bus mastering */ | ||
980 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
981 | "C3 support without BM control\n")); | ||
982 | } | ||
977 | } | 983 | } |
978 | } else { | 984 | } else { |
979 | /* | 985 | /* |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index c4efc0c17f8f..463b0247cbc5 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -539,7 +539,7 @@ end: | |||
539 | } | 539 | } |
540 | 540 | ||
541 | int acpi_processor_preregister_performance( | 541 | int acpi_processor_preregister_performance( |
542 | struct acpi_processor_performance **performance) | 542 | struct acpi_processor_performance *performance) |
543 | { | 543 | { |
544 | int count, count_target; | 544 | int count, count_target; |
545 | int retval = 0; | 545 | int retval = 0; |
@@ -567,12 +567,12 @@ int acpi_processor_preregister_performance( | |||
567 | continue; | 567 | continue; |
568 | } | 568 | } |
569 | 569 | ||
570 | if (!performance || !performance[i]) { | 570 | if (!performance || !percpu_ptr(performance, i)) { |
571 | retval = -EINVAL; | 571 | retval = -EINVAL; |
572 | continue; | 572 | continue; |
573 | } | 573 | } |
574 | 574 | ||
575 | pr->performance = performance[i]; | 575 | pr->performance = percpu_ptr(performance, i); |
576 | cpu_set(i, pr->performance->shared_cpu_map); | 576 | cpu_set(i, pr->performance->shared_cpu_map); |
577 | if (acpi_processor_get_psd(pr)) { | 577 | if (acpi_processor_get_psd(pr)) { |
578 | retval = -EINVAL; | 578 | retval = -EINVAL; |
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index f63813a358c5..4c3fd4cdaf73 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c | |||
@@ -474,8 +474,6 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) | |||
474 | return (AE_CTRL_TERMINATE); | 474 | return (AE_CTRL_TERMINATE); |
475 | } | 475 | } |
476 | 476 | ||
477 | ACPI_EXPORT_SYMBOL(acpi_rs_match_vendor_resource) | ||
478 | |||
479 | /******************************************************************************* | 477 | /******************************************************************************* |
480 | * | 478 | * |
481 | * FUNCTION: acpi_walk_resources | 479 | * FUNCTION: acpi_walk_resources |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 7d8e78ea13a5..82c3a550016d 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -1415,7 +1415,7 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) | |||
1415 | char dir_name[32]; | 1415 | char dir_name[32]; |
1416 | int do_battery_init = 0, do_ac_init = 0; | 1416 | int do_battery_init = 0, do_ac_init = 0; |
1417 | int old_remaining_capacity = 0; | 1417 | int old_remaining_capacity = 0; |
1418 | int update_ac = 1, update_battery = 1; | 1418 | int update_battery = 1; |
1419 | int up_tm = update_time; | 1419 | int up_tm = update_time; |
1420 | 1420 | ||
1421 | if (sbs_zombie(sbs)) { | 1421 | if (sbs_zombie(sbs)) { |
@@ -1435,10 +1435,6 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) | |||
1435 | 1435 | ||
1436 | sbs->run_cnt++; | 1436 | sbs->run_cnt++; |
1437 | 1437 | ||
1438 | if (!update_ac && !update_battery) { | ||
1439 | goto end; | ||
1440 | } | ||
1441 | |||
1442 | old_ac_present = sbs->ac.ac_present; | 1438 | old_ac_present = sbs->ac.ac_present; |
1443 | 1439 | ||
1444 | result = acpi_ac_get_present(sbs); | 1440 | result = acpi_ac_get_present(sbs); |
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 5b302c4e293f..a9e3331fee5d 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -52,6 +52,8 @@ ACPI_MODULE_NAME("tbxface") | |||
52 | /* Local prototypes */ | 52 | /* Local prototypes */ |
53 | static acpi_status acpi_tb_load_namespace(void); | 53 | static acpi_status acpi_tb_load_namespace(void); |
54 | 54 | ||
55 | static int no_auto_ssdt; | ||
56 | |||
55 | /******************************************************************************* | 57 | /******************************************************************************* |
56 | * | 58 | * |
57 | * FUNCTION: acpi_allocate_root_table | 59 | * FUNCTION: acpi_allocate_root_table |
@@ -536,6 +538,10 @@ static acpi_status acpi_tb_load_namespace(void) | |||
536 | 538 | ||
537 | ACPI_INFO((AE_INFO, "Table DSDT replaced by host OS")); | 539 | ACPI_INFO((AE_INFO, "Table DSDT replaced by host OS")); |
538 | acpi_tb_print_table_header(0, table); | 540 | acpi_tb_print_table_header(0, table); |
541 | |||
542 | if (no_auto_ssdt == 0) { | ||
543 | printk(KERN_WARNING "ACPI: DSDT override uses original SSDTs unless \"acpi_no_auto_ssdt\""); | ||
544 | } | ||
539 | } | 545 | } |
540 | 546 | ||
541 | status = | 547 | status = |
@@ -577,6 +583,11 @@ static acpi_status acpi_tb_load_namespace(void) | |||
577 | continue; | 583 | continue; |
578 | } | 584 | } |
579 | 585 | ||
586 | if (no_auto_ssdt) { | ||
587 | printk(KERN_WARNING "ACPI: SSDT ignored due to \"acpi_no_auto_ssdt\"\n"); | ||
588 | continue; | ||
589 | } | ||
590 | |||
580 | /* Ignore errors while loading tables, get as many as possible */ | 591 | /* Ignore errors while loading tables, get as many as possible */ |
581 | 592 | ||
582 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | 593 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
@@ -622,3 +633,15 @@ acpi_status acpi_load_tables(void) | |||
622 | } | 633 | } |
623 | 634 | ||
624 | ACPI_EXPORT_SYMBOL(acpi_load_tables) | 635 | ACPI_EXPORT_SYMBOL(acpi_load_tables) |
636 | |||
637 | |||
638 | static int __init acpi_no_auto_ssdt_setup(char *s) { | ||
639 | |||
640 | printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n"); | ||
641 | |||
642 | no_auto_ssdt = 1; | ||
643 | |||
644 | return 1; | ||
645 | } | ||
646 | |||
647 | __setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup); | ||
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 5a62de1b7f2a..1e06159fd9c4 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/dmi.h> | ||
36 | #include <linux/init.h> | 37 | #include <linux/init.h> |
37 | #include <linux/types.h> | 38 | #include <linux/types.h> |
38 | #include <linux/proc_fs.h> | 39 | #include <linux/proc_fs.h> |
@@ -74,10 +75,26 @@ MODULE_AUTHOR("Paul Diefenbaugh"); | |||
74 | MODULE_DESCRIPTION("ACPI Thermal Zone Driver"); | 75 | MODULE_DESCRIPTION("ACPI Thermal Zone Driver"); |
75 | MODULE_LICENSE("GPL"); | 76 | MODULE_LICENSE("GPL"); |
76 | 77 | ||
78 | static int act; | ||
79 | module_param(act, int, 0644); | ||
80 | MODULE_PARM_DESC(act, "Disable or override all lowest active trip points.\n"); | ||
81 | |||
77 | static int tzp; | 82 | static int tzp; |
78 | module_param(tzp, int, 0); | 83 | module_param(tzp, int, 0444); |
79 | MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n"); | 84 | MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n"); |
80 | 85 | ||
86 | static int nocrt; | ||
87 | module_param(nocrt, int, 0); | ||
88 | MODULE_PARM_DESC(nocrt, "Set to disable action on ACPI thermal zone critical and hot trips.\n"); | ||
89 | |||
90 | static int off; | ||
91 | module_param(off, int, 0); | ||
92 | MODULE_PARM_DESC(off, "Set to disable ACPI thermal support.\n"); | ||
93 | |||
94 | static int psv; | ||
95 | module_param(psv, int, 0644); | ||
96 | MODULE_PARM_DESC(psv, "Disable or override all passive trip points.\n"); | ||
97 | |||
81 | static int acpi_thermal_add(struct acpi_device *device); | 98 | static int acpi_thermal_add(struct acpi_device *device); |
82 | static int acpi_thermal_remove(struct acpi_device *device, int type); | 99 | static int acpi_thermal_remove(struct acpi_device *device, int type); |
83 | static int acpi_thermal_resume(struct acpi_device *device); | 100 | static int acpi_thermal_resume(struct acpi_device *device); |
@@ -339,9 +356,16 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | |||
339 | 356 | ||
340 | /* Passive: Processors (optional) */ | 357 | /* Passive: Processors (optional) */ |
341 | 358 | ||
342 | status = | 359 | if (psv == -1) { |
343 | acpi_evaluate_integer(tz->device->handle, "_PSV", NULL, | 360 | status = AE_SUPPORT; |
344 | &tz->trips.passive.temperature); | 361 | } else if (psv > 0) { |
362 | tz->trips.passive.temperature = CELSIUS_TO_KELVIN(psv); | ||
363 | status = AE_OK; | ||
364 | } else { | ||
365 | status = acpi_evaluate_integer(tz->device->handle, | ||
366 | "_PSV", NULL, &tz->trips.passive.temperature); | ||
367 | } | ||
368 | |||
345 | if (ACPI_FAILURE(status)) { | 369 | if (ACPI_FAILURE(status)) { |
346 | tz->trips.passive.flags.valid = 0; | 370 | tz->trips.passive.flags.valid = 0; |
347 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No passive threshold\n")); | 371 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No passive threshold\n")); |
@@ -386,11 +410,33 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | |||
386 | 410 | ||
387 | char name[5] = { '_', 'A', 'C', ('0' + i), '\0' }; | 411 | char name[5] = { '_', 'A', 'C', ('0' + i), '\0' }; |
388 | 412 | ||
389 | status = | 413 | if (act == -1) |
390 | acpi_evaluate_integer(tz->device->handle, name, NULL, | 414 | break; /* disable all active trip points */ |
391 | &tz->trips.active[i].temperature); | 415 | |
392 | if (ACPI_FAILURE(status)) | 416 | status = acpi_evaluate_integer(tz->device->handle, |
417 | name, NULL, &tz->trips.active[i].temperature); | ||
418 | |||
419 | if (ACPI_FAILURE(status)) { | ||
420 | if (i == 0) /* no active trip points */ | ||
421 | break; | ||
422 | if (act <= 0) /* no override requested */ | ||
423 | break; | ||
424 | if (i == 1) { /* 1 trip point */ | ||
425 | tz->trips.active[0].temperature = | ||
426 | CELSIUS_TO_KELVIN(act); | ||
427 | } else { /* multiple trips */ | ||
428 | /* | ||
429 | * Don't allow override higher than | ||
430 | * the next higher trip point | ||
431 | */ | ||
432 | tz->trips.active[i - 1].temperature = | ||
433 | (tz->trips.active[i - 2].temperature < | ||
434 | CELSIUS_TO_KELVIN(act) ? | ||
435 | tz->trips.active[i - 2].temperature : | ||
436 | CELSIUS_TO_KELVIN(act)); | ||
437 | } | ||
393 | break; | 438 | break; |
439 | } | ||
394 | 440 | ||
395 | name[2] = 'L'; | 441 | name[2] = 'L'; |
396 | status = | 442 | status = |
@@ -427,7 +473,7 @@ static int acpi_thermal_get_devices(struct acpi_thermal *tz) | |||
427 | 473 | ||
428 | static int acpi_thermal_critical(struct acpi_thermal *tz) | 474 | static int acpi_thermal_critical(struct acpi_thermal *tz) |
429 | { | 475 | { |
430 | if (!tz || !tz->trips.critical.flags.valid) | 476 | if (!tz || !tz->trips.critical.flags.valid || nocrt) |
431 | return -EINVAL; | 477 | return -EINVAL; |
432 | 478 | ||
433 | if (tz->temperature >= tz->trips.critical.temperature) { | 479 | if (tz->temperature >= tz->trips.critical.temperature) { |
@@ -449,7 +495,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
449 | 495 | ||
450 | static int acpi_thermal_hot(struct acpi_thermal *tz) | 496 | static int acpi_thermal_hot(struct acpi_thermal *tz) |
451 | { | 497 | { |
452 | if (!tz || !tz->trips.hot.flags.valid) | 498 | if (!tz || !tz->trips.hot.flags.valid || nocrt) |
453 | return -EINVAL; | 499 | return -EINVAL; |
454 | 500 | ||
455 | if (tz->temperature >= tz->trips.hot.temperature) { | 501 | if (tz->temperature >= tz->trips.hot.temperature) { |
@@ -824,12 +870,14 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) | |||
824 | goto end; | 870 | goto end; |
825 | 871 | ||
826 | if (tz->trips.critical.flags.valid) | 872 | if (tz->trips.critical.flags.valid) |
827 | seq_printf(seq, "critical (S5): %ld C\n", | 873 | seq_printf(seq, "critical (S5): %ld C%s", |
828 | KELVIN_TO_CELSIUS(tz->trips.critical.temperature)); | 874 | KELVIN_TO_CELSIUS(tz->trips.critical.temperature), |
875 | nocrt ? " <disabled>\n" : "\n"); | ||
829 | 876 | ||
830 | if (tz->trips.hot.flags.valid) | 877 | if (tz->trips.hot.flags.valid) |
831 | seq_printf(seq, "hot (S4): %ld C\n", | 878 | seq_printf(seq, "hot (S4): %ld C%s", |
832 | KELVIN_TO_CELSIUS(tz->trips.hot.temperature)); | 879 | KELVIN_TO_CELSIUS(tz->trips.hot.temperature), |
880 | nocrt ? " <disabled>\n" : "\n"); | ||
833 | 881 | ||
834 | if (tz->trips.passive.flags.valid) { | 882 | if (tz->trips.passive.flags.valid) { |
835 | seq_printf(seq, | 883 | seq_printf(seq, |
@@ -1281,11 +1329,78 @@ static int acpi_thermal_resume(struct acpi_device *device) | |||
1281 | return AE_OK; | 1329 | return AE_OK; |
1282 | } | 1330 | } |
1283 | 1331 | ||
1332 | #ifdef CONFIG_DMI | ||
1333 | static int thermal_act(struct dmi_system_id *d) { | ||
1334 | |||
1335 | if (act == 0) { | ||
1336 | printk(KERN_NOTICE "ACPI: %s detected: " | ||
1337 | "disabling all active thermal trip points\n", d->ident); | ||
1338 | act = -1; | ||
1339 | } | ||
1340 | return 0; | ||
1341 | } | ||
1342 | static int thermal_tzp(struct dmi_system_id *d) { | ||
1343 | |||
1344 | if (tzp == 0) { | ||
1345 | printk(KERN_NOTICE "ACPI: %s detected: " | ||
1346 | "enabling thermal zone polling\n", d->ident); | ||
1347 | tzp = 300; /* 300 dS = 30 Seconds */ | ||
1348 | } | ||
1349 | return 0; | ||
1350 | } | ||
1351 | static int thermal_psv(struct dmi_system_id *d) { | ||
1352 | |||
1353 | if (psv == 0) { | ||
1354 | printk(KERN_NOTICE "ACPI: %s detected: " | ||
1355 | "disabling all passive thermal trip points\n", d->ident); | ||
1356 | psv = -1; | ||
1357 | } | ||
1358 | return 0; | ||
1359 | } | ||
1360 | |||
1361 | static struct dmi_system_id thermal_dmi_table[] __initdata = { | ||
1362 | /* | ||
1363 | * Award BIOS on this AOpen makes thermal control almost worthless. | ||
1364 | * http://bugzilla.kernel.org/show_bug.cgi?id=8842 | ||
1365 | */ | ||
1366 | { | ||
1367 | .callback = thermal_act, | ||
1368 | .ident = "AOpen i915GMm-HFS", | ||
1369 | .matches = { | ||
1370 | DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"), | ||
1371 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), | ||
1372 | }, | ||
1373 | }, | ||
1374 | { | ||
1375 | .callback = thermal_psv, | ||
1376 | .ident = "AOpen i915GMm-HFS", | ||
1377 | .matches = { | ||
1378 | DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"), | ||
1379 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), | ||
1380 | }, | ||
1381 | }, | ||
1382 | { | ||
1383 | .callback = thermal_tzp, | ||
1384 | .ident = "AOpen i915GMm-HFS", | ||
1385 | .matches = { | ||
1386 | DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"), | ||
1387 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), | ||
1388 | }, | ||
1389 | }, | ||
1390 | {} | ||
1391 | }; | ||
1392 | #endif /* CONFIG_DMI */ | ||
1393 | |||
1284 | static int __init acpi_thermal_init(void) | 1394 | static int __init acpi_thermal_init(void) |
1285 | { | 1395 | { |
1286 | int result = 0; | 1396 | int result = 0; |
1287 | 1397 | ||
1398 | dmi_check_system(thermal_dmi_table); | ||
1288 | 1399 | ||
1400 | if (off) { | ||
1401 | printk(KERN_NOTICE "ACPI: thermal control disabled\n"); | ||
1402 | return -ENODEV; | ||
1403 | } | ||
1289 | acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); | 1404 | acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); |
1290 | if (!acpi_thermal_dir) | 1405 | if (!acpi_thermal_dir) |
1291 | return -ENODEV; | 1406 | return -ENODEV; |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index a78832ea81fa..071d274afaab 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -436,7 +436,7 @@ static const struct piix_map_db ich8_map_db = { | |||
436 | /* PM PS SM SS MAP */ | 436 | /* PM PS SM SS MAP */ |
437 | { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */ | 437 | { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */ |
438 | { RV, RV, RV, RV }, | 438 | { RV, RV, RV, RV }, |
439 | { IDE, IDE, NA, NA }, /* 10b (IDE mode) */ | 439 | { P0, P2, IDE, IDE }, /* 10b (IDE mode) */ |
440 | { RV, RV, RV, RV }, | 440 | { RV, RV, RV, RV }, |
441 | }, | 441 | }, |
442 | }; | 442 | }; |
@@ -901,6 +901,13 @@ static int piix_broken_suspend(void) | |||
901 | }, | 901 | }, |
902 | }, | 902 | }, |
903 | { | 903 | { |
904 | .ident = "TECRA M7", | ||
905 | .matches = { | ||
906 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
907 | DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M7"), | ||
908 | }, | ||
909 | }, | ||
910 | { | ||
904 | .ident = "Satellite U205", | 911 | .ident = "Satellite U205", |
905 | .matches = { | 912 | .matches = { |
906 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 913 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 60e78bef469f..99d4fbffb0df 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1723,7 +1723,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1723 | tf.protocol = ATA_PROT_NODATA; | 1723 | tf.protocol = ATA_PROT_NODATA; |
1724 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; | 1724 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; |
1725 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); | 1725 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); |
1726 | if (err_mask) { | 1726 | if (err_mask && id[2] != 0x738c) { |
1727 | rc = -EIO; | 1727 | rc = -EIO; |
1728 | reason = "SPINUP failed"; | 1728 | reason = "SPINUP failed"; |
1729 | goto err_out; | 1729 | goto err_out; |
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c index ce589d96ca42..b5352ebecef9 100644 --- a/drivers/ata/pata_artop.c +++ b/drivers/ata/pata_artop.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * pata_artop.c - ARTOP ATA controller driver | 2 | * pata_artop.c - ARTOP ATA controller driver |
3 | * | 3 | * |
4 | * (C) 2006 Red Hat <alan@redhat.com> | 4 | * (C) 2006 Red Hat <alan@redhat.com> |
5 | * (C) 2007 Bartlomiej Zolnierkiewicz | ||
5 | * | 6 | * |
6 | * Based in part on drivers/ide/pci/aec62xx.c | 7 | * Based in part on drivers/ide/pci/aec62xx.c |
7 | * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> | 8 | * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> |
@@ -28,7 +29,7 @@ | |||
28 | #include <linux/ata.h> | 29 | #include <linux/ata.h> |
29 | 30 | ||
30 | #define DRV_NAME "pata_artop" | 31 | #define DRV_NAME "pata_artop" |
31 | #define DRV_VERSION "0.4.3" | 32 | #define DRV_VERSION "0.4.4" |
32 | 33 | ||
33 | /* | 34 | /* |
34 | * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we | 35 | * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we |
@@ -430,7 +431,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
430 | .udma_mask = ATA_UDMA4, | 431 | .udma_mask = ATA_UDMA4, |
431 | .port_ops = &artop6260_ops, | 432 | .port_ops = &artop6260_ops, |
432 | }; | 433 | }; |
433 | static const struct ata_port_info info_626x_fast = { | 434 | static const struct ata_port_info info_628x = { |
434 | .sht = &artop_sht, | 435 | .sht = &artop_sht, |
435 | .flags = ATA_FLAG_SLAVE_POSS, | 436 | .flags = ATA_FLAG_SLAVE_POSS, |
436 | .pio_mask = 0x1f, /* pio0-4 */ | 437 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -438,6 +439,14 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
438 | .udma_mask = ATA_UDMA5, | 439 | .udma_mask = ATA_UDMA5, |
439 | .port_ops = &artop6260_ops, | 440 | .port_ops = &artop6260_ops, |
440 | }; | 441 | }; |
442 | static const struct ata_port_info info_628x_fast = { | ||
443 | .sht = &artop_sht, | ||
444 | .flags = ATA_FLAG_SLAVE_POSS, | ||
445 | .pio_mask = 0x1f, /* pio0-4 */ | ||
446 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
447 | .udma_mask = ATA_UDMA6, | ||
448 | .port_ops = &artop6260_ops, | ||
449 | }; | ||
441 | const struct ata_port_info *ppi[] = { NULL, NULL }; | 450 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
442 | 451 | ||
443 | if (!printed_version++) | 452 | if (!printed_version++) |
@@ -455,13 +464,13 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
455 | } | 464 | } |
456 | else if (id->driver_data == 1) /* 6260 */ | 465 | else if (id->driver_data == 1) /* 6260 */ |
457 | ppi[0] = &info_626x; | 466 | ppi[0] = &info_626x; |
458 | else if (id->driver_data == 2) { /* 6260 or 6260 + fast */ | 467 | else if (id->driver_data == 2) { /* 6280 or 6280 + fast */ |
459 | unsigned long io = pci_resource_start(pdev, 4); | 468 | unsigned long io = pci_resource_start(pdev, 4); |
460 | u8 reg; | 469 | u8 reg; |
461 | 470 | ||
462 | ppi[0] = &info_626x; | 471 | ppi[0] = &info_628x; |
463 | if (inb(io) & 0x10) | 472 | if (inb(io) & 0x10) |
464 | ppi[0] = &info_626x_fast; | 473 | ppi[0] = &info_628x_fast; |
465 | /* Mac systems come up with some registers not set as we | 474 | /* Mac systems come up with some registers not set as we |
466 | will need them */ | 475 | will need them */ |
467 | 476 | ||
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 84d9c5568567..c5ddd937dbf2 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -8,12 +8,10 @@ | |||
8 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> | 8 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> |
9 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. | 9 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. |
10 | * Portions Copyright (C) 2003 Red Hat Inc | 10 | * Portions Copyright (C) 2003 Red Hat Inc |
11 | * Portions Copyright (C) 2005-2006 MontaVista Software, Inc. | 11 | * Portions Copyright (C) 2005-2007 MontaVista Software, Inc. |
12 | * | 12 | * |
13 | * TODO | 13 | * TODO |
14 | * PLL mode | 14 | * Look into engine reset on timeout errors. Should not be required. |
15 | * Look into engine reset on timeout errors. Should not be | ||
16 | * required. | ||
17 | */ | 15 | */ |
18 | 16 | ||
19 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
@@ -26,7 +24,7 @@ | |||
26 | #include <linux/libata.h> | 24 | #include <linux/libata.h> |
27 | 25 | ||
28 | #define DRV_NAME "pata_hpt37x" | 26 | #define DRV_NAME "pata_hpt37x" |
29 | #define DRV_VERSION "0.6.7" | 27 | #define DRV_VERSION "0.6.9" |
30 | 28 | ||
31 | struct hpt_clock { | 29 | struct hpt_clock { |
32 | u8 xfer_speed; | 30 | u8 xfer_speed; |
@@ -1092,9 +1090,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1092 | int dpll, adjust; | 1090 | int dpll, adjust; |
1093 | 1091 | ||
1094 | /* Compute DPLL */ | 1092 | /* Compute DPLL */ |
1095 | dpll = 2; | 1093 | dpll = (port->udma_mask & 0xC0) ? 3 : 2; |
1096 | if (port->udma_mask & 0xE0) | ||
1097 | dpll = 3; | ||
1098 | 1094 | ||
1099 | f_low = (MHz[clock_slot] * 48) / MHz[dpll]; | 1095 | f_low = (MHz[clock_slot] * 48) / MHz[dpll]; |
1100 | f_high = f_low + 2; | 1096 | f_high = f_low + 2; |
@@ -1116,7 +1112,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1116 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100); | 1112 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100); |
1117 | } | 1113 | } |
1118 | if (adjust == 8) { | 1114 | if (adjust == 8) { |
1119 | printk(KERN_WARNING "hpt37x: DPLL did not stabilize.\n"); | 1115 | printk(KERN_ERR "pata_hpt37x: DPLL did not stabilize!\n"); |
1120 | return -ENODEV; | 1116 | return -ENODEV; |
1121 | } | 1117 | } |
1122 | if (dpll == 3) | 1118 | if (dpll == 3) |
@@ -1124,7 +1120,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1124 | else | 1120 | else |
1125 | private_data = (void *)hpt37x_timings_50; | 1121 | private_data = (void *)hpt37x_timings_50; |
1126 | 1122 | ||
1127 | printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[dpll]); | 1123 | printk(KERN_INFO "pata_hpt37x: bus clock %dMHz, using %dMHz DPLL.\n", |
1124 | MHz[clock_slot], MHz[dpll]); | ||
1128 | } else { | 1125 | } else { |
1129 | private_data = (void *)chip_table->clocks[clock_slot]; | 1126 | private_data = (void *)chip_table->clocks[clock_slot]; |
1130 | /* | 1127 | /* |
@@ -1137,7 +1134,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1137 | port = &info_hpt370_33; | 1134 | port = &info_hpt370_33; |
1138 | if (clock_slot < 2 && port == &info_hpt370a) | 1135 | if (clock_slot < 2 && port == &info_hpt370a) |
1139 | port = &info_hpt370a_33; | 1136 | port = &info_hpt370a_33; |
1140 | printk(KERN_INFO "hpt37x: %s: Bus clock %dMHz.\n", chip_table->name, MHz[clock_slot]); | 1137 | printk(KERN_INFO "pata_hpt37x: %s using %dMHz bus clock.\n", |
1138 | chip_table->name, MHz[clock_slot]); | ||
1141 | } | 1139 | } |
1142 | 1140 | ||
1143 | /* Now kick off ATA set up */ | 1141 | /* Now kick off ATA set up */ |
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index aa29cde09f8b..f8f234bfc8ce 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> | 8 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> |
9 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. | 9 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. |
10 | * Portions Copyright (C) 2003 Red Hat Inc | 10 | * Portions Copyright (C) 2003 Red Hat Inc |
11 | * Portions Copyright (C) 2005-2006 MontaVista Software, Inc. | 11 | * Portions Copyright (C) 2005-2007 MontaVista Software, Inc. |
12 | * | 12 | * |
13 | * | 13 | * |
14 | * TODO | 14 | * TODO |
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/libata.h> | 25 | #include <linux/libata.h> |
26 | 26 | ||
27 | #define DRV_NAME "pata_hpt3x2n" | 27 | #define DRV_NAME "pata_hpt3x2n" |
28 | #define DRV_VERSION "0.3.3" | 28 | #define DRV_VERSION "0.3.4" |
29 | 29 | ||
30 | enum { | 30 | enum { |
31 | HPT_PCI_FAST = (1 << 31), | 31 | HPT_PCI_FAST = (1 << 31), |
@@ -579,10 +579,12 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
579 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); | 579 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); |
580 | } | 580 | } |
581 | if (adjust == 8) { | 581 | if (adjust == 8) { |
582 | printk(KERN_WARNING "hpt3x2n: DPLL did not stabilize.\n"); | 582 | printk(KERN_ERR "pata_hpt3x2n: DPLL did not stabilize!\n"); |
583 | return -ENODEV; | 583 | return -ENODEV; |
584 | } | 584 | } |
585 | 585 | ||
586 | printk(KERN_INFO "pata_hpt37x: bus clock %dMHz, using 66MHz DPLL.\n", | ||
587 | pci_mhz); | ||
586 | /* Set our private data up. We only need a few flags so we use | 588 | /* Set our private data up. We only need a few flags so we use |
587 | it directly */ | 589 | it directly */ |
588 | port.private_data = NULL; | 590 | port.private_data = NULL; |
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c index 321d98b0bed2..64a711776c45 100644 --- a/drivers/ata/pata_icside.c +++ b/drivers/ata/pata_icside.c | |||
@@ -330,17 +330,12 @@ static void ata_dummy_noret(struct ata_port *port) | |||
330 | { | 330 | { |
331 | } | 331 | } |
332 | 332 | ||
333 | /* | 333 | static void pata_icside_postreset(struct ata_port *ap, unsigned int *classes) |
334 | * We need to shut down unused ports to prevent spurious interrupts. | ||
335 | * FIXME: the libata core doesn't call this function for PATA interfaces. | ||
336 | */ | ||
337 | static void pata_icside_port_disable(struct ata_port *ap) | ||
338 | { | 334 | { |
339 | struct pata_icside_state *state = ap->host->private_data; | 335 | struct pata_icside_state *state = ap->host->private_data; |
340 | 336 | ||
341 | ata_port_printk(ap, KERN_ERR, "disabling icside port\n"); | 337 | if (classes[0] != ATA_DEV_NONE || classes[1] != ATA_DEV_NONE) |
342 | 338 | return ata_std_postreset(ap, classes); | |
343 | ata_port_disable(ap); | ||
344 | 339 | ||
345 | state->port[ap->port_no].disabled = 1; | 340 | state->port[ap->port_no].disabled = 1; |
346 | 341 | ||
@@ -356,6 +351,12 @@ static void pata_icside_port_disable(struct ata_port *ap) | |||
356 | } | 351 | } |
357 | } | 352 | } |
358 | 353 | ||
354 | static void pata_icside_error_handler(struct ata_port *ap) | ||
355 | { | ||
356 | ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, NULL, | ||
357 | pata_icside_postreset); | ||
358 | } | ||
359 | |||
359 | static u8 pata_icside_irq_ack(struct ata_port *ap, unsigned int chk_drq) | 360 | static u8 pata_icside_irq_ack(struct ata_port *ap, unsigned int chk_drq) |
360 | { | 361 | { |
361 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; | 362 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; |
@@ -374,7 +375,7 @@ static u8 pata_icside_irq_ack(struct ata_port *ap, unsigned int chk_drq) | |||
374 | } | 375 | } |
375 | 376 | ||
376 | static struct ata_port_operations pata_icside_port_ops = { | 377 | static struct ata_port_operations pata_icside_port_ops = { |
377 | .port_disable = pata_icside_port_disable, | 378 | .port_disable = ata_port_disable, |
378 | 379 | ||
379 | .set_dmamode = pata_icside_set_dmamode, | 380 | .set_dmamode = pata_icside_set_dmamode, |
380 | 381 | ||
@@ -397,7 +398,7 @@ static struct ata_port_operations pata_icside_port_ops = { | |||
397 | 398 | ||
398 | .freeze = ata_bmdma_freeze, | 399 | .freeze = ata_bmdma_freeze, |
399 | .thaw = ata_bmdma_thaw, | 400 | .thaw = ata_bmdma_thaw, |
400 | .error_handler = ata_bmdma_error_handler, | 401 | .error_handler = pata_icside_error_handler, |
401 | .post_internal_cmd = pata_icside_bmdma_stop, | 402 | .post_internal_cmd = pata_icside_bmdma_stop, |
402 | 403 | ||
403 | .irq_clear = ata_dummy_noret, | 404 | .irq_clear = ata_dummy_noret, |
@@ -484,13 +485,6 @@ static int __devinit pata_icside_register_v6(struct pata_icside_info *info) | |||
484 | state->port[0].port_sel = sel; | 485 | state->port[0].port_sel = sel; |
485 | state->port[1].port_sel = sel | 1; | 486 | state->port[1].port_sel = sel | 1; |
486 | 487 | ||
487 | /* | ||
488 | * FIXME: work around libata's aversion to calling port_disable. | ||
489 | * This permanently disables interrupts on port 0 - bad luck if | ||
490 | * you have a drive on that port. | ||
491 | */ | ||
492 | state->port[0].disabled = 1; | ||
493 | |||
494 | info->base = easi_base; | 488 | info->base = easi_base; |
495 | info->irqops = &pata_icside_ops_arcin_v6; | 489 | info->irqops = &pata_icside_ops_arcin_v6; |
496 | info->nr_ports = 2; | 490 | info->nr_ports = 2; |
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c index 5525518204e6..91a396fa5b20 100644 --- a/drivers/ata/pata_isapnp.c +++ b/drivers/ata/pata_isapnp.c | |||
@@ -139,6 +139,8 @@ static struct pnp_device_id isapnp_devices[] = { | |||
139 | {.id = ""} | 139 | {.id = ""} |
140 | }; | 140 | }; |
141 | 141 | ||
142 | MODULE_DEVICE_TABLE(pnp, isapnp_devices); | ||
143 | |||
142 | static struct pnp_driver isapnp_driver = { | 144 | static struct pnp_driver isapnp_driver = { |
143 | .name = DRV_NAME, | 145 | .name = DRV_NAME, |
144 | .id_table = isapnp_devices, | 146 | .id_table = isapnp_devices, |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 8ec520885b95..3acf65e75eb2 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -621,6 +621,9 @@ static const struct pci_device_id mv_pci_tbl[] = { | |||
621 | { PCI_VDEVICE(MARVELL, 0x5041), chip_504x }, | 621 | { PCI_VDEVICE(MARVELL, 0x5041), chip_504x }, |
622 | { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 }, | 622 | { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 }, |
623 | { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, | 623 | { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, |
624 | /* RocketRAID 1740/174x have different identifiers */ | ||
625 | { PCI_VDEVICE(TTI, 0x1740), chip_508x }, | ||
626 | { PCI_VDEVICE(TTI, 0x1742), chip_508x }, | ||
624 | 627 | ||
625 | { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, | 628 | { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, |
626 | { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, | 629 | { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, |
diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig index bed9f58c2d5a..b554edac1ced 100644 --- a/drivers/atm/Kconfig +++ b/drivers/atm/Kconfig | |||
@@ -6,6 +6,11 @@ menuconfig ATM_DRIVERS | |||
6 | bool "ATM drivers" | 6 | bool "ATM drivers" |
7 | depends on NETDEVICES && ATM | 7 | depends on NETDEVICES && ATM |
8 | default y | 8 | default y |
9 | ---help--- | ||
10 | Say Y here to get to see options for Asynchronous Transfer Mode | ||
11 | device drivers. This option alone does not add any kernel code. | ||
12 | |||
13 | If you say N, all options in this submenu will be skipped and disabled. | ||
9 | 14 | ||
10 | if ATM_DRIVERS && NETDEVICES && ATM | 15 | if ATM_DRIVERS && NETDEVICES && ATM |
11 | 16 | ||
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 405ee5e09221..8b12925fe7a4 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
@@ -2435,7 +2435,7 @@ fore200e_init_cmd_queue(struct fore200e* fore200e) | |||
2435 | } | 2435 | } |
2436 | 2436 | ||
2437 | 2437 | ||
2438 | static void __init | 2438 | static void __devinit |
2439 | fore200e_param_bs_queue(struct fore200e* fore200e, | 2439 | fore200e_param_bs_queue(struct fore200e* fore200e, |
2440 | enum buffer_scheme scheme, enum buffer_magn magn, | 2440 | enum buffer_scheme scheme, enum buffer_magn magn, |
2441 | int queue_length, int pool_size, int supply_blksize) | 2441 | int queue_length, int pool_size, int supply_blksize) |
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index a3b605a0ca17..ef52452640e0 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c | |||
@@ -1601,14 +1601,14 @@ static int rx_init(struct atm_dev *dev) | |||
1601 | 1601 | ||
1602 | skb_queue_head_init(&iadev->rx_dma_q); | 1602 | skb_queue_head_init(&iadev->rx_dma_q); |
1603 | iadev->rx_free_desc_qhead = NULL; | 1603 | iadev->rx_free_desc_qhead = NULL; |
1604 | iadev->rx_open = kmalloc(4*iadev->num_vc,GFP_KERNEL); | 1604 | |
1605 | if (!iadev->rx_open) | 1605 | iadev->rx_open = kzalloc(4 * iadev->num_vc, GFP_KERNEL); |
1606 | { | 1606 | if (!iadev->rx_open) { |
1607 | printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n", | 1607 | printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n", |
1608 | dev->number); | 1608 | dev->number); |
1609 | goto err_free_dle; | 1609 | goto err_free_dle; |
1610 | } | 1610 | } |
1611 | memset(iadev->rx_open, 0, 4*iadev->num_vc); | 1611 | |
1612 | iadev->rxing = 1; | 1612 | iadev->rxing = 1; |
1613 | iadev->rx_pkt_cnt = 0; | 1613 | iadev->rx_pkt_cnt = 0; |
1614 | /* Mode Register */ | 1614 | /* Mode Register */ |
@@ -3171,12 +3171,12 @@ static int __devinit ia_init_one(struct pci_dev *pdev, | |||
3171 | unsigned long flags; | 3171 | unsigned long flags; |
3172 | int ret; | 3172 | int ret; |
3173 | 3173 | ||
3174 | iadev = kmalloc(sizeof(*iadev), GFP_KERNEL); | 3174 | iadev = kzalloc(sizeof(*iadev), GFP_KERNEL); |
3175 | if (!iadev) { | 3175 | if (!iadev) { |
3176 | ret = -ENOMEM; | 3176 | ret = -ENOMEM; |
3177 | goto err_out; | 3177 | goto err_out; |
3178 | } | 3178 | } |
3179 | memset(iadev, 0, sizeof(*iadev)); | 3179 | |
3180 | iadev->pci = pdev; | 3180 | iadev->pci = pdev; |
3181 | 3181 | ||
3182 | IF_INIT(printk("ia detected at bus:%d dev: %d function:%d\n", | 3182 | IF_INIT(printk("ia detected at bus:%d dev: %d function:%d\n", |
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c index 55fd1b4543fd..144a49f15220 100644 --- a/drivers/atm/lanai.c +++ b/drivers/atm/lanai.c | |||
@@ -65,7 +65,6 @@ | |||
65 | #include <linux/init.h> | 65 | #include <linux/init.h> |
66 | #include <linux/delay.h> | 66 | #include <linux/delay.h> |
67 | #include <linux/interrupt.h> | 67 | #include <linux/interrupt.h> |
68 | #include <linux/dma-mapping.h> | ||
69 | 68 | ||
70 | /* -------------------- TUNABLE PARAMATERS: */ | 69 | /* -------------------- TUNABLE PARAMATERS: */ |
71 | 70 | ||
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig index de2fcce10ba5..043353bd0600 100644 --- a/drivers/auxdisplay/Kconfig +++ b/drivers/auxdisplay/Kconfig | |||
@@ -8,6 +8,11 @@ | |||
8 | menuconfig AUXDISPLAY | 8 | menuconfig AUXDISPLAY |
9 | depends on PARPORT | 9 | depends on PARPORT |
10 | bool "Auxiliary Display support" | 10 | bool "Auxiliary Display support" |
11 | ---help--- | ||
12 | Say Y here to get to see options for auxiliary display drivers. | ||
13 | This option alone does not add any kernel code. | ||
14 | |||
15 | If you say N, all options in this submenu will be skipped and disabled. | ||
11 | 16 | ||
12 | if AUXDISPLAY && PARPORT | 17 | if AUXDISPLAY && PARPORT |
13 | 18 | ||
diff --git a/drivers/auxdisplay/cfag12864b.c b/drivers/auxdisplay/cfag12864b.c index cb44cb4f6a47..80bb06105387 100644 --- a/drivers/auxdisplay/cfag12864b.c +++ b/drivers/auxdisplay/cfag12864b.c | |||
@@ -355,7 +355,7 @@ static int __init cfag12864b_init(void) | |||
355 | 355 | ||
356 | cfag12864b_cache = kmalloc(sizeof(unsigned char) * | 356 | cfag12864b_cache = kmalloc(sizeof(unsigned char) * |
357 | CFAG12864B_SIZE, GFP_KERNEL); | 357 | CFAG12864B_SIZE, GFP_KERNEL); |
358 | if (cfag12864b_buffer == NULL) { | 358 | if (cfag12864b_cache == NULL) { |
359 | printk(KERN_ERR CFAG12864B_NAME ": ERROR: " | 359 | printk(KERN_ERR CFAG12864B_NAME ": ERROR: " |
360 | "can't alloc cache buffer (%i bytes)\n", | 360 | "can't alloc cache buffer (%i bytes)\n", |
361 | CFAG12864B_SIZE); | 361 | CFAG12864B_SIZE); |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index a4a311992408..4245b7f80a49 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -6,6 +6,12 @@ menuconfig BLK_DEV | |||
6 | bool "Block devices" | 6 | bool "Block devices" |
7 | depends on BLOCK | 7 | depends on BLOCK |
8 | default y | 8 | default y |
9 | ---help--- | ||
10 | Say Y here to get to see options for various different block device | ||
11 | drivers. This option alone does not add any kernel code. | ||
12 | |||
13 | If you say N, all options in this submenu will be skipped and disabled; | ||
14 | only do this if you know what you are doing. | ||
9 | 15 | ||
10 | if BLK_DEV | 16 | if BLK_DEV |
11 | 17 | ||
@@ -62,6 +68,7 @@ config AMIGA_Z2RAM | |||
62 | config BLK_DEV_XD | 68 | config BLK_DEV_XD |
63 | tristate "XT hard disk support" | 69 | tristate "XT hard disk support" |
64 | depends on ISA && ISA_DMA_API | 70 | depends on ISA && ISA_DMA_API |
71 | select CHECK_SIGNATURE | ||
65 | help | 72 | help |
66 | Very old 8 bit hard disk controllers used in the IBM XT computer | 73 | Very old 8 bit hard disk controllers used in the IBM XT computer |
67 | will be supported if you say Y here. | 74 | will be supported if you say Y here. |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index a11b2bd54bbe..084358a828e9 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -1977,12 +1977,13 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size, | |||
1977 | { | 1977 | { |
1978 | ReadCapdata_struct *buf; | 1978 | ReadCapdata_struct *buf; |
1979 | int return_code; | 1979 | int return_code; |
1980 | buf = kmalloc(sizeof(ReadCapdata_struct), GFP_KERNEL); | 1980 | |
1981 | if (buf == NULL) { | 1981 | buf = kzalloc(sizeof(ReadCapdata_struct), GFP_KERNEL); |
1982 | if (!buf) { | ||
1982 | printk(KERN_WARNING "cciss: out of memory\n"); | 1983 | printk(KERN_WARNING "cciss: out of memory\n"); |
1983 | return; | 1984 | return; |
1984 | } | 1985 | } |
1985 | memset(buf, 0, sizeof(ReadCapdata_struct)); | 1986 | |
1986 | if (withirq) | 1987 | if (withirq) |
1987 | return_code = sendcmd_withirq(CCISS_READ_CAPACITY, | 1988 | return_code = sendcmd_withirq(CCISS_READ_CAPACITY, |
1988 | ctlr, buf, sizeof(ReadCapdata_struct), | 1989 | ctlr, buf, sizeof(ReadCapdata_struct), |
@@ -2003,7 +2004,6 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size, | |||
2003 | printk(KERN_INFO " blocks= %llu block_size= %d\n", | 2004 | printk(KERN_INFO " blocks= %llu block_size= %d\n", |
2004 | (unsigned long long)*total_size+1, *block_size); | 2005 | (unsigned long long)*total_size+1, *block_size); |
2005 | kfree(buf); | 2006 | kfree(buf); |
2006 | return; | ||
2007 | } | 2007 | } |
2008 | 2008 | ||
2009 | static void | 2009 | static void |
@@ -2011,12 +2011,13 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size, | |||
2011 | { | 2011 | { |
2012 | ReadCapdata_struct_16 *buf; | 2012 | ReadCapdata_struct_16 *buf; |
2013 | int return_code; | 2013 | int return_code; |
2014 | buf = kmalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL); | 2014 | |
2015 | if (buf == NULL) { | 2015 | buf = kzalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL); |
2016 | if (!buf) { | ||
2016 | printk(KERN_WARNING "cciss: out of memory\n"); | 2017 | printk(KERN_WARNING "cciss: out of memory\n"); |
2017 | return; | 2018 | return; |
2018 | } | 2019 | } |
2019 | memset(buf, 0, sizeof(ReadCapdata_struct_16)); | 2020 | |
2020 | if (withirq) { | 2021 | if (withirq) { |
2021 | return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16, | 2022 | return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16, |
2022 | ctlr, buf, sizeof(ReadCapdata_struct_16), | 2023 | ctlr, buf, sizeof(ReadCapdata_struct_16), |
@@ -2038,7 +2039,6 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size, | |||
2038 | printk(KERN_INFO " blocks= %llu block_size= %d\n", | 2039 | printk(KERN_INFO " blocks= %llu block_size= %d\n", |
2039 | (unsigned long long)*total_size+1, *block_size); | 2040 | (unsigned long long)*total_size+1, *block_size); |
2040 | kfree(buf); | 2041 | kfree(buf); |
2041 | return; | ||
2042 | } | 2042 | } |
2043 | 2043 | ||
2044 | static int cciss_revalidate(struct gendisk *disk) | 2044 | static int cciss_revalidate(struct gendisk *disk) |
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index be4e3477d83b..eb9799acf65b 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
@@ -420,18 +420,17 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev) | |||
420 | goto Enomem2; | 420 | goto Enomem2; |
421 | } | 421 | } |
422 | 422 | ||
423 | hba[i]->cmd_pool = (cmdlist_t *)pci_alloc_consistent( | 423 | hba[i]->cmd_pool = pci_alloc_consistent( |
424 | hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t), | 424 | hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t), |
425 | &(hba[i]->cmd_pool_dhandle)); | 425 | &(hba[i]->cmd_pool_dhandle)); |
426 | hba[i]->cmd_pool_bits = kmalloc( | 426 | hba[i]->cmd_pool_bits = kcalloc( |
427 | ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long), | 427 | (NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG, sizeof(unsigned long), |
428 | GFP_KERNEL); | 428 | GFP_KERNEL); |
429 | 429 | ||
430 | if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) | 430 | if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) |
431 | goto Enomem1; | 431 | goto Enomem1; |
432 | 432 | ||
433 | memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t)); | 433 | memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t)); |
434 | memset(hba[i]->cmd_pool_bits, 0, ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long)); | ||
435 | printk(KERN_INFO "cpqarray: Finding drives on %s", | 434 | printk(KERN_INFO "cpqarray: Finding drives on %s", |
436 | hba[i]->devname); | 435 | hba[i]->devname); |
437 | 436 | ||
@@ -1660,45 +1659,30 @@ static void getgeometry(int ctlr) | |||
1660 | 1659 | ||
1661 | info_p->log_drv_map = 0; | 1660 | info_p->log_drv_map = 0; |
1662 | 1661 | ||
1663 | id_ldrive = kmalloc(sizeof(id_log_drv_t), GFP_KERNEL); | 1662 | id_ldrive = kzalloc(sizeof(id_log_drv_t), GFP_KERNEL); |
1664 | if(id_ldrive == NULL) | 1663 | if (!id_ldrive) { |
1665 | { | ||
1666 | printk( KERN_ERR "cpqarray: out of memory.\n"); | 1664 | printk( KERN_ERR "cpqarray: out of memory.\n"); |
1667 | return; | 1665 | goto err_0; |
1668 | } | 1666 | } |
1669 | 1667 | ||
1670 | id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL); | 1668 | id_ctlr_buf = kzalloc(sizeof(id_ctlr_t), GFP_KERNEL); |
1671 | if(id_ctlr_buf == NULL) | 1669 | if (!id_ctlr_buf) { |
1672 | { | ||
1673 | kfree(id_ldrive); | ||
1674 | printk( KERN_ERR "cpqarray: out of memory.\n"); | 1670 | printk( KERN_ERR "cpqarray: out of memory.\n"); |
1675 | return; | 1671 | goto err_1; |
1676 | } | 1672 | } |
1677 | 1673 | ||
1678 | id_lstatus_buf = kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); | 1674 | id_lstatus_buf = kzalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); |
1679 | if(id_lstatus_buf == NULL) | 1675 | if (!id_lstatus_buf) { |
1680 | { | ||
1681 | kfree(id_ctlr_buf); | ||
1682 | kfree(id_ldrive); | ||
1683 | printk( KERN_ERR "cpqarray: out of memory.\n"); | 1676 | printk( KERN_ERR "cpqarray: out of memory.\n"); |
1684 | return; | 1677 | goto err_2; |
1685 | } | 1678 | } |
1686 | 1679 | ||
1687 | sense_config_buf = kmalloc(sizeof(config_t), GFP_KERNEL); | 1680 | sense_config_buf = kzalloc(sizeof(config_t), GFP_KERNEL); |
1688 | if(sense_config_buf == NULL) | 1681 | if (!sense_config_buf) { |
1689 | { | ||
1690 | kfree(id_lstatus_buf); | ||
1691 | kfree(id_ctlr_buf); | ||
1692 | kfree(id_ldrive); | ||
1693 | printk( KERN_ERR "cpqarray: out of memory.\n"); | 1682 | printk( KERN_ERR "cpqarray: out of memory.\n"); |
1694 | return; | 1683 | goto err_3; |
1695 | } | 1684 | } |
1696 | 1685 | ||
1697 | memset(id_ldrive, 0, sizeof(id_log_drv_t)); | ||
1698 | memset(id_ctlr_buf, 0, sizeof(id_ctlr_t)); | ||
1699 | memset(id_lstatus_buf, 0, sizeof(sense_log_drv_stat_t)); | ||
1700 | memset(sense_config_buf, 0, sizeof(config_t)); | ||
1701 | |||
1702 | info_p->phys_drives = 0; | 1686 | info_p->phys_drives = 0; |
1703 | info_p->log_drv_map = 0; | 1687 | info_p->log_drv_map = 0; |
1704 | info_p->drv_assign_map = 0; | 1688 | info_p->drv_assign_map = 0; |
@@ -1712,13 +1696,8 @@ static void getgeometry(int ctlr) | |||
1712 | * so the idastubopen will fail on all logical drives | 1696 | * so the idastubopen will fail on all logical drives |
1713 | * on the controller. | 1697 | * on the controller. |
1714 | */ | 1698 | */ |
1715 | /* Free all the buffers and return */ | ||
1716 | printk(KERN_ERR "cpqarray: error sending ID controller\n"); | 1699 | printk(KERN_ERR "cpqarray: error sending ID controller\n"); |
1717 | kfree(sense_config_buf); | 1700 | goto err_4; |
1718 | kfree(id_lstatus_buf); | ||
1719 | kfree(id_ctlr_buf); | ||
1720 | kfree(id_ldrive); | ||
1721 | return; | ||
1722 | } | 1701 | } |
1723 | 1702 | ||
1724 | info_p->log_drives = id_ctlr_buf->nr_drvs; | 1703 | info_p->log_drives = id_ctlr_buf->nr_drvs; |
@@ -1764,12 +1743,7 @@ static void getgeometry(int ctlr) | |||
1764 | " failed to report status of logical drive %d\n" | 1743 | " failed to report status of logical drive %d\n" |
1765 | "Access to this controller has been disabled\n", | 1744 | "Access to this controller has been disabled\n", |
1766 | ctlr, log_unit); | 1745 | ctlr, log_unit); |
1767 | /* Free all the buffers and return */ | 1746 | goto err_4; |
1768 | kfree(sense_config_buf); | ||
1769 | kfree(id_lstatus_buf); | ||
1770 | kfree(id_ctlr_buf); | ||
1771 | kfree(id_ldrive); | ||
1772 | return; | ||
1773 | } | 1747 | } |
1774 | /* | 1748 | /* |
1775 | Make sure the logical drive is configured | 1749 | Make sure the logical drive is configured |
@@ -1798,14 +1772,8 @@ static void getgeometry(int ctlr) | |||
1798 | sizeof(config_t), 0, 0, log_unit); | 1772 | sizeof(config_t), 0, 0, log_unit); |
1799 | if (ret_code == IO_ERROR) { | 1773 | if (ret_code == IO_ERROR) { |
1800 | info_p->log_drv_map = 0; | 1774 | info_p->log_drv_map = 0; |
1801 | /* Free all the buffers and return */ | ||
1802 | printk(KERN_ERR "cpqarray: error sending sense config\n"); | 1775 | printk(KERN_ERR "cpqarray: error sending sense config\n"); |
1803 | kfree(sense_config_buf); | 1776 | goto err_4; |
1804 | kfree(id_lstatus_buf); | ||
1805 | kfree(id_ctlr_buf); | ||
1806 | kfree(id_ldrive); | ||
1807 | return; | ||
1808 | |||
1809 | } | 1777 | } |
1810 | 1778 | ||
1811 | info_p->phys_drives = | 1779 | info_p->phys_drives = |
@@ -1820,12 +1788,18 @@ static void getgeometry(int ctlr) | |||
1820 | log_index = log_index + 1; | 1788 | log_index = log_index + 1; |
1821 | } /* end of if logical drive configured */ | 1789 | } /* end of if logical drive configured */ |
1822 | } /* end of for log_unit */ | 1790 | } /* end of for log_unit */ |
1791 | |||
1792 | /* Free all the buffers and return */ | ||
1793 | err_4: | ||
1823 | kfree(sense_config_buf); | 1794 | kfree(sense_config_buf); |
1824 | kfree(id_ldrive); | 1795 | err_3: |
1825 | kfree(id_lstatus_buf); | 1796 | kfree(id_lstatus_buf); |
1797 | err_2: | ||
1826 | kfree(id_ctlr_buf); | 1798 | kfree(id_ctlr_buf); |
1799 | err_1: | ||
1800 | kfree(id_ldrive); | ||
1801 | err_0: | ||
1827 | return; | 1802 | return; |
1828 | |||
1829 | } | 1803 | } |
1830 | 1804 | ||
1831 | static void __exit cpqarray_exit(void) | 1805 | static void __exit cpqarray_exit(void) |
diff --git a/drivers/block/lguest_blk.c b/drivers/block/lguest_blk.c index 93e3c4001bf5..160cf14431ac 100644 --- a/drivers/block/lguest_blk.c +++ b/drivers/block/lguest_blk.c | |||
@@ -308,9 +308,12 @@ static int lguestblk_probe(struct lguest_device *lgdev) | |||
308 | } | 308 | } |
309 | 309 | ||
310 | /* This allocates a "struct gendisk" where we pack all the information | 310 | /* This allocates a "struct gendisk" where we pack all the information |
311 | * about the disk which the rest of Linux sees. We ask for one minor | 311 | * about the disk which the rest of Linux sees. The argument is the |
312 | * number; I do wonder if we should be asking for more. */ | 312 | * number of minor devices desired: we need one minor for the main |
313 | bd->disk = alloc_disk(1); | 313 | * disk, and one for each partition. Of course, we can't possibly know |
314 | * how many partitions are on the disk (add_disk does that). | ||
315 | */ | ||
316 | bd->disk = alloc_disk(16); | ||
314 | if (!bd->disk) { | 317 | if (!bd->disk) { |
315 | err = -ENOMEM; | 318 | err = -ENOMEM; |
316 | goto out_unregister_blkdev; | 319 | goto out_unregister_blkdev; |
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index 85916e2665d4..af3969a9c963 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <linux/dma-mapping.h> | 41 | #include <linux/dma-mapping.h> |
42 | #include <linux/completion.h> | 42 | #include <linux/completion.h> |
43 | #include <linux/device.h> | 43 | #include <linux/device.h> |
44 | #include <linux/kernel.h> | ||
45 | 44 | ||
46 | #include <asm/uaccess.h> | 45 | #include <asm/uaccess.h> |
47 | #include <asm/vio.h> | 46 | #include <asm/vio.h> |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index cb27e8863d7c..3ede0b63da13 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -902,26 +902,17 @@ static int ace_release(struct inode *inode, struct file *filp) | |||
902 | return 0; | 902 | return 0; |
903 | } | 903 | } |
904 | 904 | ||
905 | static int ace_ioctl(struct inode *inode, struct file *filp, | 905 | static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
906 | unsigned int cmd, unsigned long arg) | ||
907 | { | 906 | { |
908 | struct ace_device *ace = inode->i_bdev->bd_disk->private_data; | 907 | struct ace_device *ace = bdev->bd_disk->private_data; |
909 | struct hd_geometry __user *geo = (struct hd_geometry __user *)arg; | ||
910 | struct hd_geometry g; | ||
911 | dev_dbg(ace->dev, "ace_ioctl()\n"); | ||
912 | |||
913 | switch (cmd) { | ||
914 | case HDIO_GETGEO: | ||
915 | g.heads = ace->cf_id.heads; | ||
916 | g.sectors = ace->cf_id.sectors; | ||
917 | g.cylinders = ace->cf_id.cyls; | ||
918 | g.start = 0; | ||
919 | return copy_to_user(geo, &g, sizeof(g)) ? -EFAULT : 0; | ||
920 | 908 | ||
921 | default: | 909 | dev_dbg(ace->dev, "ace_getgeo()\n"); |
922 | return -ENOTTY; | 910 | |
923 | } | 911 | geo->heads = ace->cf_id.heads; |
924 | return -ENOTTY; | 912 | geo->sectors = ace->cf_id.sectors; |
913 | geo->cylinders = ace->cf_id.cyls; | ||
914 | |||
915 | return 0; | ||
925 | } | 916 | } |
926 | 917 | ||
927 | static struct block_device_operations ace_fops = { | 918 | static struct block_device_operations ace_fops = { |
@@ -930,7 +921,7 @@ static struct block_device_operations ace_fops = { | |||
930 | .release = ace_release, | 921 | .release = ace_release, |
931 | .media_changed = ace_media_changed, | 922 | .media_changed = ace_media_changed, |
932 | .revalidate_disk = ace_revalidate_disk, | 923 | .revalidate_disk = ace_revalidate_disk, |
933 | .ioctl = ace_ioctl, | 924 | .getgeo = ace_getgeo, |
934 | }; | 925 | }; |
935 | 926 | ||
936 | /* -------------------------------------------------------------------- | 927 | /* -------------------------------------------------------------------- |
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index 3359cc2b9736..8e7d713a5a15 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c | |||
@@ -184,6 +184,8 @@ static int i915_initialize(struct drm_device * dev, | |||
184 | * private backbuffer/depthbuffer usage. | 184 | * private backbuffer/depthbuffer usage. |
185 | */ | 185 | */ |
186 | dev_priv->use_mi_batchbuffer_start = 0; | 186 | dev_priv->use_mi_batchbuffer_start = 0; |
187 | if (IS_I965G(dev)) /* 965 doesn't support older method */ | ||
188 | dev_priv->use_mi_batchbuffer_start = 1; | ||
187 | 189 | ||
188 | /* Allow hardware batchbuffers unless told otherwise. | 190 | /* Allow hardware batchbuffers unless told otherwise. |
189 | */ | 191 | */ |
@@ -517,8 +519,13 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev, | |||
517 | 519 | ||
518 | if (dev_priv->use_mi_batchbuffer_start) { | 520 | if (dev_priv->use_mi_batchbuffer_start) { |
519 | BEGIN_LP_RING(2); | 521 | BEGIN_LP_RING(2); |
520 | OUT_RING(MI_BATCH_BUFFER_START | (2 << 6)); | 522 | if (IS_I965G(dev)) { |
521 | OUT_RING(batch->start | MI_BATCH_NON_SECURE); | 523 | OUT_RING(MI_BATCH_BUFFER_START | (2 << 6) | MI_BATCH_NON_SECURE_I965); |
524 | OUT_RING(batch->start); | ||
525 | } else { | ||
526 | OUT_RING(MI_BATCH_BUFFER_START | (2 << 6)); | ||
527 | OUT_RING(batch->start | MI_BATCH_NON_SECURE); | ||
528 | } | ||
522 | ADVANCE_LP_RING(); | 529 | ADVANCE_LP_RING(); |
523 | } else { | 530 | } else { |
524 | BEGIN_LP_RING(4); | 531 | BEGIN_LP_RING(4); |
@@ -735,7 +742,8 @@ static int i915_setparam(DRM_IOCTL_ARGS) | |||
735 | 742 | ||
736 | switch (param.param) { | 743 | switch (param.param) { |
737 | case I915_SETPARAM_USE_MI_BATCHBUFFER_START: | 744 | case I915_SETPARAM_USE_MI_BATCHBUFFER_START: |
738 | dev_priv->use_mi_batchbuffer_start = param.value; | 745 | if (!IS_I965G(dev)) |
746 | dev_priv->use_mi_batchbuffer_start = param.value; | ||
739 | break; | 747 | break; |
740 | case I915_SETPARAM_TEX_LRU_LOG_GRANULARITY: | 748 | case I915_SETPARAM_TEX_LRU_LOG_GRANULARITY: |
741 | dev_priv->tex_lru_log_granularity = param.value; | 749 | dev_priv->tex_lru_log_granularity = param.value; |
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h index fd918565f4e5..737088bd0780 100644 --- a/drivers/char/drm/i915_drv.h +++ b/drivers/char/drm/i915_drv.h | |||
@@ -282,6 +282,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
282 | #define MI_BATCH_BUFFER_START (0x31<<23) | 282 | #define MI_BATCH_BUFFER_START (0x31<<23) |
283 | #define MI_BATCH_BUFFER_END (0xA<<23) | 283 | #define MI_BATCH_BUFFER_END (0xA<<23) |
284 | #define MI_BATCH_NON_SECURE (1) | 284 | #define MI_BATCH_NON_SECURE (1) |
285 | #define MI_BATCH_NON_SECURE_I965 (1<<8) | ||
285 | 286 | ||
286 | #define MI_WAIT_FOR_EVENT ((0x3<<23)) | 287 | #define MI_WAIT_FOR_EVENT ((0x3<<23)) |
287 | #define MI_WAIT_FOR_PLANE_A_FLIP (1<<2) | 288 | #define MI_WAIT_FOR_PLANE_A_FLIP (1<<2) |
diff --git a/drivers/char/hvc_lguest.c b/drivers/char/hvc_lguest.c index feeccbaec438..3d6bd0baa56d 100644 --- a/drivers/char/hvc_lguest.c +++ b/drivers/char/hvc_lguest.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/err.h> | 35 | #include <linux/err.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/lguest_bus.h> | 37 | #include <linux/lguest_bus.h> |
38 | #include <asm/paravirt.h> | ||
38 | #include "hvc_console.h" | 39 | #include "hvc_console.h" |
39 | 40 | ||
40 | /*D:340 This is our single console input buffer, with associated "struct | 41 | /*D:340 This is our single console input buffer, with associated "struct |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 96d2f9ee42d6..9b07f7851061 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -2292,7 +2292,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev, | |||
2292 | info->irq = irq_of_parse_and_map(dev->node, 0); | 2292 | info->irq = irq_of_parse_and_map(dev->node, 0); |
2293 | info->dev = &dev->dev; | 2293 | info->dev = &dev->dev; |
2294 | 2294 | ||
2295 | dev_dbg(&dev->dev, "addr 0x%lx regsize %ld spacing %ld irq %x\n", | 2295 | dev_dbg(&dev->dev, "addr 0x%lx regsize %d spacing %d irq %x\n", |
2296 | info->io.addr_data, info->io.regsize, info->io.regspacing, | 2296 | info->io.addr_data, info->io.regsize, info->io.regspacing, |
2297 | info->irq); | 2297 | info->irq); |
2298 | 2298 | ||
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 2ce0af1bd588..d95f316afb5a 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -1022,10 +1022,6 @@ static const unsigned short x86_keycodes[256] = | |||
1022 | 308,310,313,314,315,317,318,319,320,357,322,323,324,325,276,330, | 1022 | 308,310,313,314,315,317,318,319,320,357,322,323,324,325,276,330, |
1023 | 332,340,365,342,343,344,345,346,356,270,341,368,369,370,371,372 }; | 1023 | 332,340,365,342,343,344,345,346,356,270,341,368,369,370,371,372 }; |
1024 | 1024 | ||
1025 | #ifdef CONFIG_MAC_EMUMOUSEBTN | ||
1026 | extern int mac_hid_mouse_emulate_buttons(int, int, int); | ||
1027 | #endif /* CONFIG_MAC_EMUMOUSEBTN */ | ||
1028 | |||
1029 | #ifdef CONFIG_SPARC | 1025 | #ifdef CONFIG_SPARC |
1030 | static int sparc_l1_a_state = 0; | 1026 | static int sparc_l1_a_state = 0; |
1031 | extern void sun_do_break(void); | 1027 | extern void sun_do_break(void); |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index fee58e03dbe2..4177f6db83e9 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -1629,7 +1629,7 @@ static int cmm_open(struct inode *inode, struct file *filp) | |||
1629 | { | 1629 | { |
1630 | struct cm4000_dev *dev; | 1630 | struct cm4000_dev *dev; |
1631 | struct pcmcia_device *link; | 1631 | struct pcmcia_device *link; |
1632 | int rc, minor = iminor(inode); | 1632 | int minor = iminor(inode); |
1633 | 1633 | ||
1634 | if (minor >= CM4000_MAX_DEV) | 1634 | if (minor >= CM4000_MAX_DEV) |
1635 | return -ENODEV; | 1635 | return -ENODEV; |
@@ -1668,7 +1668,6 @@ static int cmm_open(struct inode *inode, struct file *filp) | |||
1668 | start_monitor(dev); | 1668 | start_monitor(dev); |
1669 | 1669 | ||
1670 | link->open = 1; /* only one open per device */ | 1670 | link->open = 1; /* only one open per device */ |
1671 | rc = 0; | ||
1672 | 1671 | ||
1673 | DEBUGP(2, dev, "<- cmm_open\n"); | 1672 | DEBUGP(2, dev, "<- cmm_open\n"); |
1674 | return nonseekable_open(inode, filp); | 1673 | return nonseekable_open(inode, filp); |
@@ -1824,7 +1823,7 @@ static int cm4000_resume(struct pcmcia_device *link) | |||
1824 | 1823 | ||
1825 | static void cm4000_release(struct pcmcia_device *link) | 1824 | static void cm4000_release(struct pcmcia_device *link) |
1826 | { | 1825 | { |
1827 | cmm_cm4000_release(link->priv); /* delay release until device closed */ | 1826 | cmm_cm4000_release(link); /* delay release until device closed */ |
1828 | pcmcia_disable_device(link); | 1827 | pcmcia_disable_device(link); |
1829 | } | 1828 | } |
1830 | 1829 | ||
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index af88181a17f4..b24a3e7bbb9f 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -599,7 +599,7 @@ cs_release: | |||
599 | 599 | ||
600 | static void reader_release(struct pcmcia_device *link) | 600 | static void reader_release(struct pcmcia_device *link) |
601 | { | 601 | { |
602 | cm4040_reader_release(link->priv); | 602 | cm4040_reader_release(link); |
603 | pcmcia_disable_device(link); | 603 | pcmcia_disable_device(link); |
604 | } | 604 | } |
605 | 605 | ||
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 73037a4d3c50..aeec67e27264 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -1147,10 +1147,15 @@ static int sonypi_acpi_remove(struct acpi_device *device, int type) | |||
1147 | return 0; | 1147 | return 0; |
1148 | } | 1148 | } |
1149 | 1149 | ||
1150 | const static struct acpi_device_id sonypi_device_ids[] = { | ||
1151 | {"SNY6001", 0}, | ||
1152 | {"", 0}, | ||
1153 | }; | ||
1154 | |||
1150 | static struct acpi_driver sonypi_acpi_driver = { | 1155 | static struct acpi_driver sonypi_acpi_driver = { |
1151 | .name = "sonypi", | 1156 | .name = "sonypi", |
1152 | .class = "hkey", | 1157 | .class = "hkey", |
1153 | .ids = "SNY6001", | 1158 | .ids = sonypi_device_ids, |
1154 | .ops = { | 1159 | .ops = { |
1155 | .add = sonypi_acpi_add, | 1160 | .add = sonypi_acpi_add, |
1156 | .remove = sonypi_acpi_remove, | 1161 | .remove = sonypi_acpi_remove, |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index bbb7f1292665..2f97d2f8f916 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -1565,6 +1565,9 @@ static int hdlcdev_open(struct net_device *dev) | |||
1565 | int rc; | 1565 | int rc; |
1566 | unsigned long flags; | 1566 | unsigned long flags; |
1567 | 1567 | ||
1568 | if (!try_module_get(THIS_MODULE)) | ||
1569 | return -EBUSY; | ||
1570 | |||
1568 | DBGINFO(("%s hdlcdev_open\n", dev->name)); | 1571 | DBGINFO(("%s hdlcdev_open\n", dev->name)); |
1569 | 1572 | ||
1570 | /* generic HDLC layer open processing */ | 1573 | /* generic HDLC layer open processing */ |
@@ -1634,6 +1637,7 @@ static int hdlcdev_close(struct net_device *dev) | |||
1634 | info->netcount=0; | 1637 | info->netcount=0; |
1635 | spin_unlock_irqrestore(&info->netlock, flags); | 1638 | spin_unlock_irqrestore(&info->netlock, flags); |
1636 | 1639 | ||
1640 | module_put(THIS_MODULE); | ||
1637 | return 0; | 1641 | return 0; |
1638 | } | 1642 | } |
1639 | 1643 | ||
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 9bb542913b86..39564b76d4a3 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * Reiner Sailer <sailer@watson.ibm.com> | 7 | * Reiner Sailer <sailer@watson.ibm.com> |
8 | * Kylene Hall <kjhall@us.ibm.com> | 8 | * Kylene Hall <kjhall@us.ibm.com> |
9 | * | 9 | * |
10 | * Maintained by: <tpmdd_devel@lists.sourceforge.net> | 10 | * Maintained by: <tpmdd-devel@lists.sourceforge.net> |
11 | * | 11 | * |
12 | * Device driver for TCG/TCPA TPM (trusted platform module). | 12 | * Device driver for TCG/TCPA TPM (trusted platform module). |
13 | * Specifications at www.trustedcomputinggroup.org | 13 | * Specifications at www.trustedcomputinggroup.org |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index b2e2b002a1bb..d15ccddc92eb 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * Reiner Sailer <sailer@watson.ibm.com> | 7 | * Reiner Sailer <sailer@watson.ibm.com> |
8 | * Kylene Hall <kjhall@us.ibm.com> | 8 | * Kylene Hall <kjhall@us.ibm.com> |
9 | * | 9 | * |
10 | * Maintained by: <tpmdd_devel@lists.sourceforge.net> | 10 | * Maintained by: <tpmdd-devel@lists.sourceforge.net> |
11 | * | 11 | * |
12 | * Device driver for TCG/TCPA TPM (trusted platform module). | 12 | * Device driver for TCG/TCPA TPM (trusted platform module). |
13 | * Specifications at www.trustedcomputinggroup.org | 13 | * Specifications at www.trustedcomputinggroup.org |
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index 1ab0896070be..d0e7926eb486 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * Reiner Sailer <sailer@watson.ibm.com> | 7 | * Reiner Sailer <sailer@watson.ibm.com> |
8 | * Kylene Hall <kjhall@us.ibm.com> | 8 | * Kylene Hall <kjhall@us.ibm.com> |
9 | * | 9 | * |
10 | * Maintained by: <tpmdd_devel@lists.sourceforge.net> | 10 | * Maintained by: <tpmdd-devel@lists.sourceforge.net> |
11 | * | 11 | * |
12 | * Device driver for TCG/TCPA TPM (trusted platform module). | 12 | * Device driver for TCG/TCPA TPM (trusted platform module). |
13 | * Specifications at www.trustedcomputinggroup.org | 13 | * Specifications at www.trustedcomputinggroup.org |
diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h index 9363bcf0a402..6c831f9466b7 100644 --- a/drivers/char/tpm/tpm_atmel.h +++ b/drivers/char/tpm/tpm_atmel.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Authors: | 4 | * Authors: |
5 | * Kylene Hall <kjhall@us.ibm.com> | 5 | * Kylene Hall <kjhall@us.ibm.com> |
6 | * | 6 | * |
7 | * Maintained by: <tpmdd_devel@lists.sourceforge.net> | 7 | * Maintained by: <tpmdd-devel@lists.sourceforge.net> |
8 | * | 8 | * |
9 | * Device driver for TCG/TCPA TPM (trusted platform module). | 9 | * Device driver for TCG/TCPA TPM (trusted platform module). |
10 | * Specifications at www.trustedcomputinggroup.org | 10 | * Specifications at www.trustedcomputinggroup.org |
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c index 8677fc6a545e..60a2d2630e36 100644 --- a/drivers/char/tpm/tpm_bios.c +++ b/drivers/char/tpm/tpm_bios.c | |||
@@ -7,6 +7,8 @@ | |||
7 | * Reiner Sailer <sailer@watson.ibm.com> | 7 | * Reiner Sailer <sailer@watson.ibm.com> |
8 | * Kylene Hall <kjhall@us.ibm.com> | 8 | * Kylene Hall <kjhall@us.ibm.com> |
9 | * | 9 | * |
10 | * Maintained by: <tpmdd-devel@lists.sourceforge.net> | ||
11 | * | ||
10 | * Access to the eventlog extended by the TCG BIOS of PC platform | 12 | * Access to the eventlog extended by the TCG BIOS of PC platform |
11 | * | 13 | * |
12 | * This program is free software; you can redistribute it and/or | 14 | * This program is free software; you can redistribute it and/or |
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c index 608f73071bef..6313326bc41f 100644 --- a/drivers/char/tpm/tpm_nsc.c +++ b/drivers/char/tpm/tpm_nsc.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * Reiner Sailer <sailer@watson.ibm.com> | 7 | * Reiner Sailer <sailer@watson.ibm.com> |
8 | * Kylene Hall <kjhall@us.ibm.com> | 8 | * Kylene Hall <kjhall@us.ibm.com> |
9 | * | 9 | * |
10 | * Maintained by: <tpmdd_devel@lists.sourceforge.net> | 10 | * Maintained by: <tpmdd-devel@lists.sourceforge.net> |
11 | * | 11 | * |
12 | * Device driver for TCG/TCPA TPM (trusted platform module). | 12 | * Device driver for TCG/TCPA TPM (trusted platform module). |
13 | * Specifications at www.trustedcomputinggroup.org | 13 | * Specifications at www.trustedcomputinggroup.org |
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 483f3f60013c..23fa18a6654c 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -5,6 +5,8 @@ | |||
5 | * Leendert van Doorn <leendert@watson.ibm.com> | 5 | * Leendert van Doorn <leendert@watson.ibm.com> |
6 | * Kylene Hall <kjhall@us.ibm.com> | 6 | * Kylene Hall <kjhall@us.ibm.com> |
7 | * | 7 | * |
8 | * Maintained by: <tpmdd-devel@lists.sourceforge.net> | ||
9 | * | ||
8 | * Device driver for TCG/TCPA TPM (trusted platform module). | 10 | * Device driver for TCG/TCPA TPM (trusted platform module). |
9 | * Specifications at www.trustedcomputinggroup.org | 11 | * Specifications at www.trustedcomputinggroup.org |
10 | * | 12 | * |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index de37ebc3a4cf..51ea93cab6c4 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -369,25 +369,54 @@ static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b) | |||
369 | } | 369 | } |
370 | 370 | ||
371 | /** | 371 | /** |
372 | * tty_buffer_flush - flush full tty buffers | 372 | * __tty_buffer_flush - flush full tty buffers |
373 | * @tty: tty to flush | 373 | * @tty: tty to flush |
374 | * | 374 | * |
375 | * flush all the buffers containing receive data | 375 | * flush all the buffers containing receive data. Caller must |
376 | * hold the buffer lock and must have ensured no parallel flush to | ||
377 | * ldisc is running. | ||
376 | * | 378 | * |
377 | * Locking: none | 379 | * Locking: Caller must hold tty->buf.lock |
378 | */ | 380 | */ |
379 | 381 | ||
380 | static void tty_buffer_flush(struct tty_struct *tty) | 382 | static void __tty_buffer_flush(struct tty_struct *tty) |
381 | { | 383 | { |
382 | struct tty_buffer *thead; | 384 | struct tty_buffer *thead; |
383 | unsigned long flags; | ||
384 | 385 | ||
385 | spin_lock_irqsave(&tty->buf.lock, flags); | ||
386 | while((thead = tty->buf.head) != NULL) { | 386 | while((thead = tty->buf.head) != NULL) { |
387 | tty->buf.head = thead->next; | 387 | tty->buf.head = thead->next; |
388 | tty_buffer_free(tty, thead); | 388 | tty_buffer_free(tty, thead); |
389 | } | 389 | } |
390 | tty->buf.tail = NULL; | 390 | tty->buf.tail = NULL; |
391 | } | ||
392 | |||
393 | /** | ||
394 | * tty_buffer_flush - flush full tty buffers | ||
395 | * @tty: tty to flush | ||
396 | * | ||
397 | * flush all the buffers containing receive data. If the buffer is | ||
398 | * being processed by flush_to_ldisc then we defer the processing | ||
399 | * to that function | ||
400 | * | ||
401 | * Locking: none | ||
402 | */ | ||
403 | |||
404 | static void tty_buffer_flush(struct tty_struct *tty) | ||
405 | { | ||
406 | unsigned long flags; | ||
407 | spin_lock_irqsave(&tty->buf.lock, flags); | ||
408 | |||
409 | /* If the data is being pushed to the tty layer then we can't | ||
410 | process it here. Instead set a flag and the flush_to_ldisc | ||
411 | path will process the flush request before it exits */ | ||
412 | if (test_bit(TTY_FLUSHING, &tty->flags)) { | ||
413 | set_bit(TTY_FLUSHPENDING, &tty->flags); | ||
414 | spin_unlock_irqrestore(&tty->buf.lock, flags); | ||
415 | wait_event(tty->read_wait, | ||
416 | test_bit(TTY_FLUSHPENDING, &tty->flags) == 0); | ||
417 | return; | ||
418 | } else | ||
419 | __tty_buffer_flush(tty); | ||
391 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 420 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
392 | } | 421 | } |
393 | 422 | ||
@@ -3594,6 +3623,7 @@ static void flush_to_ldisc(struct work_struct *work) | |||
3594 | return; | 3623 | return; |
3595 | 3624 | ||
3596 | spin_lock_irqsave(&tty->buf.lock, flags); | 3625 | spin_lock_irqsave(&tty->buf.lock, flags); |
3626 | set_bit(TTY_FLUSHING, &tty->flags); /* So we know a flush is running */ | ||
3597 | head = tty->buf.head; | 3627 | head = tty->buf.head; |
3598 | if (head != NULL) { | 3628 | if (head != NULL) { |
3599 | tty->buf.head = NULL; | 3629 | tty->buf.head = NULL; |
@@ -3607,6 +3637,11 @@ static void flush_to_ldisc(struct work_struct *work) | |||
3607 | tty_buffer_free(tty, tbuf); | 3637 | tty_buffer_free(tty, tbuf); |
3608 | continue; | 3638 | continue; |
3609 | } | 3639 | } |
3640 | /* Ldisc or user is trying to flush the buffers | ||
3641 | we are feeding to the ldisc, stop feeding the | ||
3642 | line discipline as we want to empty the queue */ | ||
3643 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) | ||
3644 | break; | ||
3610 | if (!tty->receive_room) { | 3645 | if (!tty->receive_room) { |
3611 | schedule_delayed_work(&tty->buf.work, 1); | 3646 | schedule_delayed_work(&tty->buf.work, 1); |
3612 | break; | 3647 | break; |
@@ -3620,8 +3655,17 @@ static void flush_to_ldisc(struct work_struct *work) | |||
3620 | disc->receive_buf(tty, char_buf, flag_buf, count); | 3655 | disc->receive_buf(tty, char_buf, flag_buf, count); |
3621 | spin_lock_irqsave(&tty->buf.lock, flags); | 3656 | spin_lock_irqsave(&tty->buf.lock, flags); |
3622 | } | 3657 | } |
3658 | /* Restore the queue head */ | ||
3623 | tty->buf.head = head; | 3659 | tty->buf.head = head; |
3624 | } | 3660 | } |
3661 | /* We may have a deferred request to flush the input buffer, | ||
3662 | if so pull the chain under the lock and empty the queue */ | ||
3663 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) { | ||
3664 | __tty_buffer_flush(tty); | ||
3665 | clear_bit(TTY_FLUSHPENDING, &tty->flags); | ||
3666 | wake_up(&tty->read_wait); | ||
3667 | } | ||
3668 | clear_bit(TTY_FLUSHING, &tty->flags); | ||
3625 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 3669 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
3626 | 3670 | ||
3627 | tty_ldisc_deref(disc); | 3671 | tty_ldisc_deref(disc); |
diff --git a/drivers/char/watchdog/alim1535_wdt.c b/drivers/char/watchdog/alim1535_wdt.c index e3f6a7d0c83d..c404fc69e7e6 100644 --- a/drivers/char/watchdog/alim1535_wdt.c +++ b/drivers/char/watchdog/alim1535_wdt.c | |||
@@ -312,6 +312,7 @@ static int ali_notify_sys(struct notifier_block *this, unsigned long code, void | |||
312 | */ | 312 | */ |
313 | 313 | ||
314 | static struct pci_device_id ali_pci_tbl[] = { | 314 | static struct pci_device_id ali_pci_tbl[] = { |
315 | { PCI_VENDOR_ID_AL, 0x1533, PCI_ANY_ID, PCI_ANY_ID,}, | ||
315 | { PCI_VENDOR_ID_AL, 0x1535, PCI_ANY_ID, PCI_ANY_ID,}, | 316 | { PCI_VENDOR_ID_AL, 0x1535, PCI_ANY_ID, PCI_ANY_ID,}, |
316 | { 0, }, | 317 | { 0, }, |
317 | }; | 318 | }; |
@@ -329,9 +330,11 @@ static int __init ali_find_watchdog(void) | |||
329 | struct pci_dev *pdev; | 330 | struct pci_dev *pdev; |
330 | u32 wdog; | 331 | u32 wdog; |
331 | 332 | ||
332 | /* Check for a 1535 series bridge */ | 333 | /* Check for a 1533/1535 series bridge */ |
333 | pdev = pci_get_device(PCI_VENDOR_ID_AL, 0x1535, NULL); | 334 | pdev = pci_get_device(PCI_VENDOR_ID_AL, 0x1535, NULL); |
334 | if(pdev == NULL) | 335 | if (pdev == NULL) |
336 | pdev = pci_get_device(PCI_VENDOR_ID_AL, 0x1533, NULL); | ||
337 | if (pdev == NULL) | ||
335 | return -ENODEV; | 338 | return -ENODEV; |
336 | pci_dev_put(pdev); | 339 | pci_dev_put(pdev); |
337 | 340 | ||
diff --git a/drivers/char/watchdog/eurotechwdt.c b/drivers/char/watchdog/eurotechwdt.c index b070324e27a6..b14e9d1f164d 100644 --- a/drivers/char/watchdog/eurotechwdt.c +++ b/drivers/char/watchdog/eurotechwdt.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Eurotech CPU-1220/1410 on board WDT driver | 2 | * Eurotech CPU-1220/1410/1420 on board WDT driver |
3 | * | 3 | * |
4 | * (c) Copyright 2001 Ascensit <support@ascensit.com> | 4 | * (c) Copyright 2001 Ascensit <support@ascensit.com> |
5 | * (c) Copyright 2001 Rodolfo Giometti <giometti@ascensit.com> | 5 | * (c) Copyright 2001 Rodolfo Giometti <giometti@ascensit.com> |
@@ -25,6 +25,9 @@ | |||
25 | 25 | ||
26 | /* Changelog: | 26 | /* Changelog: |
27 | * | 27 | * |
28 | * 2001 - Rodolfo Giometti | ||
29 | * Initial release | ||
30 | * | ||
28 | * 2002/04/25 - Rob Radez | 31 | * 2002/04/25 - Rob Radez |
29 | * clean up #includes | 32 | * clean up #includes |
30 | * clean up locking | 33 | * clean up locking |
@@ -33,13 +36,15 @@ | |||
33 | * add WDIOC_GETSTATUS and WDIOC_SETOPTIONS ioctls | 36 | * add WDIOC_GETSTATUS and WDIOC_SETOPTIONS ioctls |
34 | * add expect_close support | 37 | * add expect_close support |
35 | * | 38 | * |
36 | * 2001 - Rodolfo Giometti | ||
37 | * Initial release | ||
38 | * | ||
39 | * 2002.05.30 - Joel Becker <joel.becker@oracle.com> | 39 | * 2002.05.30 - Joel Becker <joel.becker@oracle.com> |
40 | * Added Matt Domsch's nowayout module option. | 40 | * Added Matt Domsch's nowayout module option. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | /* | ||
44 | * The eurotech CPU-1220/1410/1420's watchdog is a part | ||
45 | * of the on-board SUPER I/O device SMSC FDC 37B782. | ||
46 | */ | ||
47 | |||
43 | #include <linux/interrupt.h> | 48 | #include <linux/interrupt.h> |
44 | #include <linux/module.h> | 49 | #include <linux/module.h> |
45 | #include <linux/moduleparam.h> | 50 | #include <linux/moduleparam.h> |
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 84ebfcc1ffb4..c0fc4aeb8596 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig | |||
@@ -2,6 +2,11 @@ | |||
2 | menuconfig CRYPTO_HW | 2 | menuconfig CRYPTO_HW |
3 | bool "Hardware crypto devices" | 3 | bool "Hardware crypto devices" |
4 | default y | 4 | default y |
5 | ---help--- | ||
6 | Say Y here to get to see options for hardware crypto devices and | ||
7 | processors. This option alone does not add any kernel code. | ||
8 | |||
9 | If you say N, all options in this submenu will be skipped and disabled. | ||
5 | 10 | ||
6 | if CRYPTO_HW | 11 | if CRYPTO_HW |
7 | 12 | ||
diff --git a/drivers/dma/ioatdma.c b/drivers/dma/ioatdma.c index 5fbe56b5cea0..2d1f17865b64 100644 --- a/drivers/dma/ioatdma.c +++ b/drivers/dma/ioatdma.c | |||
@@ -347,8 +347,7 @@ ioat_dma_prep_memcpy(struct dma_chan *chan, size_t len, int int_en) | |||
347 | new->async_tx.ack = 0; /* client is in control of this ack */ | 347 | new->async_tx.ack = 0; /* client is in control of this ack */ |
348 | new->async_tx.cookie = -EBUSY; | 348 | new->async_tx.cookie = -EBUSY; |
349 | 349 | ||
350 | pci_unmap_len_set(new, src_len, orig_len); | 350 | pci_unmap_len_set(new, len, orig_len); |
351 | pci_unmap_len_set(new, dst_len, orig_len); | ||
352 | spin_unlock_bh(&ioat_chan->desc_lock); | 351 | spin_unlock_bh(&ioat_chan->desc_lock); |
353 | 352 | ||
354 | return new ? &new->async_tx : NULL; | 353 | return new ? &new->async_tx : NULL; |
@@ -423,11 +422,11 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *chan) | |||
423 | */ | 422 | */ |
424 | pci_unmap_page(chan->device->pdev, | 423 | pci_unmap_page(chan->device->pdev, |
425 | pci_unmap_addr(desc, dst), | 424 | pci_unmap_addr(desc, dst), |
426 | pci_unmap_len(desc, dst_len), | 425 | pci_unmap_len(desc, len), |
427 | PCI_DMA_FROMDEVICE); | 426 | PCI_DMA_FROMDEVICE); |
428 | pci_unmap_page(chan->device->pdev, | 427 | pci_unmap_page(chan->device->pdev, |
429 | pci_unmap_addr(desc, src), | 428 | pci_unmap_addr(desc, src), |
430 | pci_unmap_len(desc, src_len), | 429 | pci_unmap_len(desc, len), |
431 | PCI_DMA_TODEVICE); | 430 | PCI_DMA_TODEVICE); |
432 | } | 431 | } |
433 | 432 | ||
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h index d3726478031a..bf4dad70e0f5 100644 --- a/drivers/dma/ioatdma.h +++ b/drivers/dma/ioatdma.h | |||
@@ -111,10 +111,9 @@ struct ioat_desc_sw { | |||
111 | struct ioat_dma_descriptor *hw; | 111 | struct ioat_dma_descriptor *hw; |
112 | struct list_head node; | 112 | struct list_head node; |
113 | int tx_cnt; | 113 | int tx_cnt; |
114 | DECLARE_PCI_UNMAP_LEN(len) | ||
114 | DECLARE_PCI_UNMAP_ADDR(src) | 115 | DECLARE_PCI_UNMAP_ADDR(src) |
115 | DECLARE_PCI_UNMAP_LEN(src_len) | ||
116 | DECLARE_PCI_UNMAP_ADDR(dst) | 116 | DECLARE_PCI_UNMAP_ADDR(dst) |
117 | DECLARE_PCI_UNMAP_LEN(dst_len) | ||
118 | struct dma_async_tx_descriptor async_tx; | 117 | struct dma_async_tx_descriptor async_tx; |
119 | }; | 118 | }; |
120 | 119 | ||
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index db703758db98..7e427b4c74b5 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c | |||
@@ -907,6 +907,8 @@ static void bus_reset_tasklet(unsigned long data) | |||
907 | int self_id_count, i, j, reg; | 907 | int self_id_count, i, j, reg; |
908 | int generation, new_generation; | 908 | int generation, new_generation; |
909 | unsigned long flags; | 909 | unsigned long flags; |
910 | void *free_rom = NULL; | ||
911 | dma_addr_t free_rom_bus = 0; | ||
910 | 912 | ||
911 | reg = reg_read(ohci, OHCI1394_NodeID); | 913 | reg = reg_read(ohci, OHCI1394_NodeID); |
912 | if (!(reg & OHCI1394_NodeID_idValid)) { | 914 | if (!(reg & OHCI1394_NodeID_idValid)) { |
@@ -970,8 +972,8 @@ static void bus_reset_tasklet(unsigned long data) | |||
970 | */ | 972 | */ |
971 | 973 | ||
972 | if (ohci->next_config_rom != NULL) { | 974 | if (ohci->next_config_rom != NULL) { |
973 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | 975 | free_rom = ohci->config_rom; |
974 | ohci->config_rom, ohci->config_rom_bus); | 976 | free_rom_bus = ohci->config_rom_bus; |
975 | ohci->config_rom = ohci->next_config_rom; | 977 | ohci->config_rom = ohci->next_config_rom; |
976 | ohci->config_rom_bus = ohci->next_config_rom_bus; | 978 | ohci->config_rom_bus = ohci->next_config_rom_bus; |
977 | ohci->next_config_rom = NULL; | 979 | ohci->next_config_rom = NULL; |
@@ -990,6 +992,10 @@ static void bus_reset_tasklet(unsigned long data) | |||
990 | 992 | ||
991 | spin_unlock_irqrestore(&ohci->lock, flags); | 993 | spin_unlock_irqrestore(&ohci->lock, flags); |
992 | 994 | ||
995 | if (free_rom) | ||
996 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
997 | free_rom, free_rom_bus); | ||
998 | |||
993 | fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation, | 999 | fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation, |
994 | self_id_count, ohci->self_id_buffer); | 1000 | self_id_count, ohci->self_id_buffer); |
995 | } | 1001 | } |
@@ -1186,7 +1192,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length) | |||
1186 | { | 1192 | { |
1187 | struct fw_ohci *ohci; | 1193 | struct fw_ohci *ohci; |
1188 | unsigned long flags; | 1194 | unsigned long flags; |
1189 | int retval = 0; | 1195 | int retval = -EBUSY; |
1190 | __be32 *next_config_rom; | 1196 | __be32 *next_config_rom; |
1191 | dma_addr_t next_config_rom_bus; | 1197 | dma_addr_t next_config_rom_bus; |
1192 | 1198 | ||
@@ -1240,10 +1246,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length) | |||
1240 | 1246 | ||
1241 | reg_write(ohci, OHCI1394_ConfigROMmap, | 1247 | reg_write(ohci, OHCI1394_ConfigROMmap, |
1242 | ohci->next_config_rom_bus); | 1248 | ohci->next_config_rom_bus); |
1243 | } else { | 1249 | retval = 0; |
1244 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
1245 | next_config_rom, next_config_rom_bus); | ||
1246 | retval = -EBUSY; | ||
1247 | } | 1250 | } |
1248 | 1251 | ||
1249 | spin_unlock_irqrestore(&ohci->lock, flags); | 1252 | spin_unlock_irqrestore(&ohci->lock, flags); |
@@ -1257,6 +1260,9 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length) | |||
1257 | */ | 1260 | */ |
1258 | if (retval == 0) | 1261 | if (retval == 0) |
1259 | fw_core_initiate_bus_reset(&ohci->card, 1); | 1262 | fw_core_initiate_bus_reset(&ohci->card, 1); |
1263 | else | ||
1264 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
1265 | next_config_rom, next_config_rom_bus); | ||
1260 | 1266 | ||
1261 | return retval; | 1267 | return retval; |
1262 | } | 1268 | } |
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 3e4a369d0057..ba816ef6def1 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -984,6 +984,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) | |||
984 | struct fw_unit *unit = sd->unit; | 984 | struct fw_unit *unit = sd->unit; |
985 | struct fw_device *device = fw_device(unit->device.parent); | 985 | struct fw_device *device = fw_device(unit->device.parent); |
986 | struct sbp2_command_orb *orb; | 986 | struct sbp2_command_orb *orb; |
987 | unsigned max_payload; | ||
987 | 988 | ||
988 | /* | 989 | /* |
989 | * Bidirectional commands are not yet implemented, and unknown | 990 | * Bidirectional commands are not yet implemented, and unknown |
@@ -1017,8 +1018,10 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) | |||
1017 | * specifies the max payload size as 2 ^ (max_payload + 2), so | 1018 | * specifies the max payload size as 2 ^ (max_payload + 2), so |
1018 | * if we set this to max_speed + 7, we get the right value. | 1019 | * if we set this to max_speed + 7, we get the right value. |
1019 | */ | 1020 | */ |
1021 | max_payload = min(device->max_speed + 7, | ||
1022 | device->card->max_receive - 1); | ||
1020 | orb->request.misc = | 1023 | orb->request.misc = |
1021 | COMMAND_ORB_MAX_PAYLOAD(device->max_speed + 7) | | 1024 | COMMAND_ORB_MAX_PAYLOAD(max_payload) | |
1022 | COMMAND_ORB_SPEED(device->max_speed) | | 1025 | COMMAND_ORB_SPEED(device->max_speed) | |
1023 | COMMAND_ORB_NOTIFY; | 1026 | COMMAND_ORB_NOTIFY; |
1024 | 1027 | ||
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c index 3ce8e2fbe15f..3e1cb12e43cd 100644 --- a/drivers/firewire/fw-transaction.c +++ b/drivers/firewire/fw-transaction.c | |||
@@ -734,7 +734,7 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p) | |||
734 | } | 734 | } |
735 | EXPORT_SYMBOL(fw_core_handle_response); | 735 | EXPORT_SYMBOL(fw_core_handle_response); |
736 | 736 | ||
737 | const struct fw_address_region topology_map_region = | 737 | static const struct fw_address_region topology_map_region = |
738 | { .start = 0xfffff0001000ull, .end = 0xfffff0001400ull, }; | 738 | { .start = 0xfffff0001000ull, .end = 0xfffff0001400ull, }; |
739 | 739 | ||
740 | static void | 740 | static void |
@@ -772,7 +772,7 @@ static struct fw_address_handler topology_map = { | |||
772 | .address_callback = handle_topology_map, | 772 | .address_callback = handle_topology_map, |
773 | }; | 773 | }; |
774 | 774 | ||
775 | const struct fw_address_region registers_region = | 775 | static const struct fw_address_region registers_region = |
776 | { .start = 0xfffff0000000ull, .end = 0xfffff0000400ull, }; | 776 | { .start = 0xfffff0000000ull, .end = 0xfffff0000400ull, }; |
777 | 777 | ||
778 | static void | 778 | static void |
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 5ceaccd10564..fa7967b57408 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h | |||
@@ -231,7 +231,7 @@ struct fw_card { | |||
231 | unsigned long reset_jiffies; | 231 | unsigned long reset_jiffies; |
232 | 232 | ||
233 | unsigned long long guid; | 233 | unsigned long long guid; |
234 | int max_receive; | 234 | unsigned max_receive; |
235 | int link_speed; | 235 | int link_speed; |
236 | int config_rom_generation; | 236 | int config_rom_generation; |
237 | 237 | ||
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 3b63b0b78122..19667fcc722a 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -5,6 +5,11 @@ menuconfig HID_SUPPORT | |||
5 | bool "HID Devices" | 5 | bool "HID Devices" |
6 | depends on INPUT | 6 | depends on INPUT |
7 | default y | 7 | default y |
8 | ---help--- | ||
9 | Say Y here to get to see options for various computer-human interface | ||
10 | device drivers. This option alone does not add any kernel code. | ||
11 | |||
12 | If you say N, all options in this submenu will be skipped and disabled. | ||
8 | 13 | ||
9 | if HID_SUPPORT | 14 | if HID_SUPPORT |
10 | 15 | ||
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 338ee4f54614..d3181967f167 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -585,6 +585,8 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev) | |||
585 | 585 | ||
586 | if ((err = device_create_file(dev, &dev_attr_alarms))) | 586 | if ((err = device_create_file(dev, &dev_attr_alarms))) |
587 | goto error_remove_files; | 587 | goto error_remove_files; |
588 | if ((err = device_create_file(dev, &dev_attr_name))) | ||
589 | goto error_remove_files; | ||
588 | 590 | ||
589 | data->class_dev = hwmon_device_register(dev); | 591 | data->class_dev = hwmon_device_register(dev); |
590 | if (IS_ERR(data->class_dev)) { | 592 | if (IS_ERR(data->class_dev)) { |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index c51ae2e17758..d9a9ec7dd84a 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -309,18 +309,16 @@ static inline int is_word_sized(u16 reg) | |||
309 | || (reg & 0x00ff) == 0x55)); | 309 | || (reg & 0x00ff) == 0x55)); |
310 | } | 310 | } |
311 | 311 | ||
312 | /* We assume that the default bank is 0, thus the following two functions do | 312 | /* Registers 0x50-0x5f are banked */ |
313 | nothing for registers which live in bank 0. For others, they respectively | ||
314 | set the bank register to the correct value (before the register is | ||
315 | accessed), and back to 0 (afterwards). */ | ||
316 | static inline void w83627ehf_set_bank(struct w83627ehf_data *data, u16 reg) | 313 | static inline void w83627ehf_set_bank(struct w83627ehf_data *data, u16 reg) |
317 | { | 314 | { |
318 | if (reg & 0xff00) { | 315 | if ((reg & 0x00f0) == 0x50) { |
319 | outb_p(W83627EHF_REG_BANK, data->addr + ADDR_REG_OFFSET); | 316 | outb_p(W83627EHF_REG_BANK, data->addr + ADDR_REG_OFFSET); |
320 | outb_p(reg >> 8, data->addr + DATA_REG_OFFSET); | 317 | outb_p(reg >> 8, data->addr + DATA_REG_OFFSET); |
321 | } | 318 | } |
322 | } | 319 | } |
323 | 320 | ||
321 | /* Not strictly necessary, but play it safe for now */ | ||
324 | static inline void w83627ehf_reset_bank(struct w83627ehf_data *data, u16 reg) | 322 | static inline void w83627ehf_reset_bank(struct w83627ehf_data *data, u16 reg) |
325 | { | 323 | { |
326 | if (reg & 0xff00) { | 324 | if (reg & 0xff00) { |
@@ -421,6 +419,31 @@ static void w83627ehf_write_fan_div(struct w83627ehf_data *data, int nr) | |||
421 | } | 419 | } |
422 | } | 420 | } |
423 | 421 | ||
422 | static void w83627ehf_update_fan_div(struct w83627ehf_data *data) | ||
423 | { | ||
424 | int i; | ||
425 | |||
426 | i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV1); | ||
427 | data->fan_div[0] = (i >> 4) & 0x03; | ||
428 | data->fan_div[1] = (i >> 6) & 0x03; | ||
429 | i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV2); | ||
430 | data->fan_div[2] = (i >> 6) & 0x03; | ||
431 | i = w83627ehf_read_value(data, W83627EHF_REG_VBAT); | ||
432 | data->fan_div[0] |= (i >> 3) & 0x04; | ||
433 | data->fan_div[1] |= (i >> 4) & 0x04; | ||
434 | data->fan_div[2] |= (i >> 5) & 0x04; | ||
435 | if (data->has_fan & ((1 << 3) | (1 << 4))) { | ||
436 | i = w83627ehf_read_value(data, W83627EHF_REG_DIODE); | ||
437 | data->fan_div[3] = i & 0x03; | ||
438 | data->fan_div[4] = ((i >> 2) & 0x03) | ||
439 | | ((i >> 5) & 0x04); | ||
440 | } | ||
441 | if (data->has_fan & (1 << 3)) { | ||
442 | i = w83627ehf_read_value(data, W83627EHF_REG_SMI_OVT); | ||
443 | data->fan_div[3] |= (i >> 5) & 0x04; | ||
444 | } | ||
445 | } | ||
446 | |||
424 | static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) | 447 | static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) |
425 | { | 448 | { |
426 | struct w83627ehf_data *data = dev_get_drvdata(dev); | 449 | struct w83627ehf_data *data = dev_get_drvdata(dev); |
@@ -432,25 +455,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) | |||
432 | if (time_after(jiffies, data->last_updated + HZ + HZ/2) | 455 | if (time_after(jiffies, data->last_updated + HZ + HZ/2) |
433 | || !data->valid) { | 456 | || !data->valid) { |
434 | /* Fan clock dividers */ | 457 | /* Fan clock dividers */ |
435 | i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV1); | 458 | w83627ehf_update_fan_div(data); |
436 | data->fan_div[0] = (i >> 4) & 0x03; | ||
437 | data->fan_div[1] = (i >> 6) & 0x03; | ||
438 | i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV2); | ||
439 | data->fan_div[2] = (i >> 6) & 0x03; | ||
440 | i = w83627ehf_read_value(data, W83627EHF_REG_VBAT); | ||
441 | data->fan_div[0] |= (i >> 3) & 0x04; | ||
442 | data->fan_div[1] |= (i >> 4) & 0x04; | ||
443 | data->fan_div[2] |= (i >> 5) & 0x04; | ||
444 | if (data->has_fan & ((1 << 3) | (1 << 4))) { | ||
445 | i = w83627ehf_read_value(data, W83627EHF_REG_DIODE); | ||
446 | data->fan_div[3] = i & 0x03; | ||
447 | data->fan_div[4] = ((i >> 2) & 0x03) | ||
448 | | ((i >> 5) & 0x04); | ||
449 | } | ||
450 | if (data->has_fan & (1 << 3)) { | ||
451 | i = w83627ehf_read_value(data, W83627EHF_REG_SMI_OVT); | ||
452 | data->fan_div[3] |= (i >> 5) & 0x04; | ||
453 | } | ||
454 | 459 | ||
455 | /* Measured voltages and limits */ | 460 | /* Measured voltages and limits */ |
456 | for (i = 0; i < data->in_num; i++) { | 461 | for (i = 0; i < data->in_num; i++) { |
@@ -1312,6 +1317,9 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
1312 | if (!(i & (1 << 1)) && (!fan5pin)) | 1317 | if (!(i & (1 << 1)) && (!fan5pin)) |
1313 | data->has_fan |= (1 << 4); | 1318 | data->has_fan |= (1 << 4); |
1314 | 1319 | ||
1320 | /* Read fan clock dividers immediately */ | ||
1321 | w83627ehf_update_fan_div(data); | ||
1322 | |||
1315 | /* Register sysfs hooks */ | 1323 | /* Register sysfs hooks */ |
1316 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays); i++) | 1324 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays); i++) |
1317 | if ((err = device_create_file(dev, | 1325 | if ((err = device_create_file(dev, |
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index f85b48fea1c4..c95909cc1d21 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
@@ -740,9 +740,9 @@ store_sensor(struct device *dev, struct device_attribute *da, | |||
740 | static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO | S_IWUSR, | 740 | static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO | S_IWUSR, |
741 | show_sensor, store_sensor, 0); | 741 | show_sensor, store_sensor, 0); |
742 | static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO | S_IWUSR, | 742 | static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO | S_IWUSR, |
743 | show_sensor, store_sensor, 0); | 743 | show_sensor, store_sensor, 1); |
744 | static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO | S_IWUSR, | 744 | static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO | S_IWUSR, |
745 | show_sensor, store_sensor, 0); | 745 | show_sensor, store_sensor, 2); |
746 | 746 | ||
747 | /* I2C devices get this name attribute automatically, but for ISA devices | 747 | /* I2C devices get this name attribute automatically, but for ISA devices |
748 | we must create it by ourselves. */ | 748 | we must create it by ourselves. */ |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 8f5c686123b8..289816db52ae 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -272,11 +272,11 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data, | |||
272 | /* Make sure the SMBus host is ready to start transmitting */ | 272 | /* Make sure the SMBus host is ready to start transmitting */ |
273 | temp = inb_p(SMBHSTSTS); | 273 | temp = inb_p(SMBHSTSTS); |
274 | if (i == 1) { | 274 | if (i == 1) { |
275 | /* Erronenous conditions before transaction: | 275 | /* Erroneous conditions before transaction: |
276 | * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ | 276 | * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ |
277 | errmask = 0x9f; | 277 | errmask = 0x9f; |
278 | } else { | 278 | } else { |
279 | /* Erronenous conditions during transaction: | 279 | /* Erroneous conditions during transaction: |
280 | * Failed, Bus_Err, Dev_Err, Intr */ | 280 | * Failed, Bus_Err, Dev_Err, Intr */ |
281 | errmask = 0x1e; | 281 | errmask = 0x1e; |
282 | } | 282 | } |
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c index 440342bc62e1..ace644e21b14 100644 --- a/drivers/i2c/busses/i2c-iop3xx.c +++ b/drivers/i2c/busses/i2c-iop3xx.c | |||
@@ -490,6 +490,7 @@ iop3xx_i2c_probe(struct platform_device *pdev) | |||
490 | memcpy(new_adapter->name, pdev->name, strlen(pdev->name)); | 490 | memcpy(new_adapter->name, pdev->name, strlen(pdev->name)); |
491 | new_adapter->id = I2C_HW_IOP3XX; | 491 | new_adapter->id = I2C_HW_IOP3XX; |
492 | new_adapter->owner = THIS_MODULE; | 492 | new_adapter->owner = THIS_MODULE; |
493 | new_adapter->class = I2C_CLASS_HWMON; | ||
493 | new_adapter->dev.parent = &pdev->dev; | 494 | new_adapter->dev.parent = &pdev->dev; |
494 | new_adapter->nr = pdev->id; | 495 | new_adapter->nr = pdev->id; |
495 | 496 | ||
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 851c3ed513d0..d8de4ac88b7d 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -105,6 +105,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) | |||
105 | schedule(); | 105 | schedule(); |
106 | if (time_after(jiffies, orig_jiffies + timeout)) { | 106 | if (time_after(jiffies, orig_jiffies + timeout)) { |
107 | pr_debug("I2C: timeout\n"); | 107 | pr_debug("I2C: timeout\n"); |
108 | writeccr(i2c, 0); | ||
108 | result = -EIO; | 109 | result = -EIO; |
109 | break; | 110 | break; |
110 | } | 111 | } |
@@ -116,10 +117,12 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) | |||
116 | result = wait_event_interruptible_timeout(i2c->queue, | 117 | result = wait_event_interruptible_timeout(i2c->queue, |
117 | (i2c->interrupt & CSR_MIF), timeout * HZ); | 118 | (i2c->interrupt & CSR_MIF), timeout * HZ); |
118 | 119 | ||
119 | if (unlikely(result < 0)) | 120 | if (unlikely(result < 0)) { |
120 | pr_debug("I2C: wait interrupted\n"); | 121 | pr_debug("I2C: wait interrupted\n"); |
121 | else if (unlikely(!(i2c->interrupt & CSR_MIF))) { | 122 | writeccr(i2c, 0); |
123 | } else if (unlikely(!(i2c->interrupt & CSR_MIF))) { | ||
122 | pr_debug("I2C: wait timeout\n"); | 124 | pr_debug("I2C: wait timeout\n"); |
125 | writeccr(i2c, 0); | ||
123 | result = -ETIMEDOUT; | 126 | result = -ETIMEDOUT; |
124 | } | 127 | } |
125 | 128 | ||
@@ -172,7 +175,6 @@ static void mpc_i2c_start(struct mpc_i2c *i2c) | |||
172 | static void mpc_i2c_stop(struct mpc_i2c *i2c) | 175 | static void mpc_i2c_stop(struct mpc_i2c *i2c) |
173 | { | 176 | { |
174 | writeccr(i2c, CCR_MEN); | 177 | writeccr(i2c, CCR_MEN); |
175 | writeccr(i2c, 0); | ||
176 | } | 178 | } |
177 | 179 | ||
178 | static int mpc_write(struct mpc_i2c *i2c, int target, | 180 | static int mpc_write(struct mpc_i2c *i2c, int target, |
@@ -261,6 +263,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
261 | while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) { | 263 | while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) { |
262 | if (signal_pending(current)) { | 264 | if (signal_pending(current)) { |
263 | pr_debug("I2C: Interrupted\n"); | 265 | pr_debug("I2C: Interrupted\n"); |
266 | writeccr(i2c, 0); | ||
264 | return -EINTR; | 267 | return -EINTR; |
265 | } | 268 | } |
266 | if (time_after(jiffies, orig_jiffies + HZ)) { | 269 | if (time_after(jiffies, orig_jiffies + HZ)) { |
@@ -362,7 +365,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) | |||
362 | 365 | ||
363 | fail_add: | 366 | fail_add: |
364 | if (i2c->irq != 0) | 367 | if (i2c->irq != 0) |
365 | free_irq(i2c->irq, NULL); | 368 | free_irq(i2c->irq, i2c); |
366 | fail_irq: | 369 | fail_irq: |
367 | iounmap(i2c->base); | 370 | iounmap(i2c->base); |
368 | fail_map: | 371 | fail_map: |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 251154ae5d97..bb7bf68a7fb6 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -107,6 +107,21 @@ struct mv64xxx_i2c_data { | |||
107 | * | 107 | * |
108 | ***************************************************************************** | 108 | ***************************************************************************** |
109 | */ | 109 | */ |
110 | |||
111 | /* Reset hardware and initialize FSM */ | ||
112 | static void | ||
113 | mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data) | ||
114 | { | ||
115 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SOFT_RESET); | ||
116 | writel((((drv_data->freq_m & 0xf) << 3) | (drv_data->freq_n & 0x7)), | ||
117 | drv_data->reg_base + MV64XXX_I2C_REG_BAUD); | ||
118 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SLAVE_ADDR); | ||
119 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_EXT_SLAVE_ADDR); | ||
120 | writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP, | ||
121 | drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); | ||
122 | drv_data->state = MV64XXX_I2C_STATE_IDLE; | ||
123 | } | ||
124 | |||
110 | static void | 125 | static void |
111 | mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) | 126 | mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) |
112 | { | 127 | { |
@@ -203,7 +218,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) | |||
203 | drv_data->state, status, drv_data->msg->addr, | 218 | drv_data->state, status, drv_data->msg->addr, |
204 | drv_data->msg->flags); | 219 | drv_data->msg->flags); |
205 | drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; | 220 | drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; |
206 | drv_data->state = MV64XXX_I2C_STATE_IDLE; | 221 | mv64xxx_i2c_hw_init(drv_data); |
207 | drv_data->rc = -EIO; | 222 | drv_data->rc = -EIO; |
208 | } | 223 | } |
209 | } | 224 | } |
@@ -367,6 +382,7 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data) | |||
367 | "mv64xxx: I2C bus locked, block: %d, " | 382 | "mv64xxx: I2C bus locked, block: %d, " |
368 | "time_left: %d\n", drv_data->block, | 383 | "time_left: %d\n", drv_data->block, |
369 | (int)time_left); | 384 | (int)time_left); |
385 | mv64xxx_i2c_hw_init(drv_data); | ||
370 | } | 386 | } |
371 | } else | 387 | } else |
372 | spin_unlock_irqrestore(&drv_data->lock, flags); | 388 | spin_unlock_irqrestore(&drv_data->lock, flags); |
@@ -443,19 +459,6 @@ static const struct i2c_algorithm mv64xxx_i2c_algo = { | |||
443 | * | 459 | * |
444 | ***************************************************************************** | 460 | ***************************************************************************** |
445 | */ | 461 | */ |
446 | static void __devinit | ||
447 | mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data) | ||
448 | { | ||
449 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SOFT_RESET); | ||
450 | writel((((drv_data->freq_m & 0xf) << 3) | (drv_data->freq_n & 0x7)), | ||
451 | drv_data->reg_base + MV64XXX_I2C_REG_BAUD); | ||
452 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SLAVE_ADDR); | ||
453 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_EXT_SLAVE_ADDR); | ||
454 | writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP, | ||
455 | drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); | ||
456 | drv_data->state = MV64XXX_I2C_STATE_IDLE; | ||
457 | } | ||
458 | |||
459 | static int __devinit | 462 | static int __devinit |
460 | mv64xxx_i2c_map_regs(struct platform_device *pd, | 463 | mv64xxx_i2c_map_regs(struct platform_device *pd, |
461 | struct mv64xxx_i2c_data *drv_data) | 464 | struct mv64xxx_i2c_data *drv_data) |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index e4540fcf6476..c44ada5f4292 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -39,8 +39,8 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | 40 | ||
41 | #include <asm/arch/regs-gpio.h> | 41 | #include <asm/arch/regs-gpio.h> |
42 | #include <asm/arch/regs-iic.h> | 42 | #include <asm/plat-s3c/regs-iic.h> |
43 | #include <asm/arch/iic.h> | 43 | #include <asm/plat-s3c/iic.h> |
44 | 44 | ||
45 | /* i2c controller state */ | 45 | /* i2c controller state */ |
46 | 46 | ||
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c index 9fafadb92510..fe04e46991aa 100644 --- a/drivers/i2c/chips/isp1301_omap.c +++ b/drivers/i2c/chips/isp1301_omap.c | |||
@@ -18,8 +18,6 @@ | |||
18 | * along with this program; if not, write to the Free Software | 18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 20 | */ |
21 | #undef DEBUG | ||
22 | #undef VERBOSE | ||
23 | 21 | ||
24 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
25 | #include <linux/module.h> | 23 | #include <linux/module.h> |
@@ -44,7 +42,7 @@ | |||
44 | 42 | ||
45 | 43 | ||
46 | #define DRIVER_VERSION "24 August 2004" | 44 | #define DRIVER_VERSION "24 August 2004" |
47 | #define DRIVER_NAME (isp1301_driver.name) | 45 | #define DRIVER_NAME (isp1301_driver.driver.name) |
48 | 46 | ||
49 | MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver"); | 47 | MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver"); |
50 | MODULE_LICENSE("GPL"); | 48 | MODULE_LICENSE("GPL"); |
@@ -55,6 +53,7 @@ struct isp1301 { | |||
55 | void (*i2c_release)(struct device *dev); | 53 | void (*i2c_release)(struct device *dev); |
56 | 54 | ||
57 | int irq; | 55 | int irq; |
56 | int irq_type; | ||
58 | 57 | ||
59 | u32 last_otg_ctrl; | 58 | u32 last_otg_ctrl; |
60 | unsigned working:1; | 59 | unsigned working:1; |
@@ -63,7 +62,7 @@ struct isp1301 { | |||
63 | 62 | ||
64 | /* use keventd context to change the state for us */ | 63 | /* use keventd context to change the state for us */ |
65 | struct work_struct work; | 64 | struct work_struct work; |
66 | 65 | ||
67 | unsigned long todo; | 66 | unsigned long todo; |
68 | # define WORK_UPDATE_ISP 0 /* update ISP from OTG */ | 67 | # define WORK_UPDATE_ISP 0 /* update ISP from OTG */ |
69 | # define WORK_UPDATE_OTG 1 /* update OTG from ISP */ | 68 | # define WORK_UPDATE_OTG 1 /* update OTG from ISP */ |
@@ -94,7 +93,7 @@ struct isp1301 { | |||
94 | 93 | ||
95 | /* board-specific PM hooks */ | 94 | /* board-specific PM hooks */ |
96 | 95 | ||
97 | #include <asm/arch/gpio.h> | 96 | #include <asm/gpio.h> |
98 | #include <asm/arch/mux.h> | 97 | #include <asm/arch/mux.h> |
99 | #include <asm/mach-types.h> | 98 | #include <asm/mach-types.h> |
100 | 99 | ||
@@ -291,7 +290,7 @@ static void power_up(struct isp1301 *isp) | |||
291 | { | 290 | { |
292 | // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); | 291 | // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); |
293 | isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG); | 292 | isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG); |
294 | 293 | ||
295 | /* do this only when cpu is driving transceiver, | 294 | /* do this only when cpu is driving transceiver, |
296 | * so host won't see a low speed device... | 295 | * so host won't see a low speed device... |
297 | */ | 296 | */ |
@@ -799,7 +798,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
799 | /* role is host */ | 798 | /* role is host */ |
800 | } else { | 799 | } else { |
801 | if (!(otg_ctrl & OTG_ID)) { | 800 | if (!(otg_ctrl & OTG_ID)) { |
802 | otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; | 801 | otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; |
803 | OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ; | 802 | OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ; |
804 | } | 803 | } |
805 | 804 | ||
@@ -1100,9 +1099,9 @@ static u8 isp1301_clear_latch(struct isp1301 *isp) | |||
1100 | } | 1099 | } |
1101 | 1100 | ||
1102 | static void | 1101 | static void |
1103 | isp1301_work(void *data) | 1102 | isp1301_work(struct work_struct *work) |
1104 | { | 1103 | { |
1105 | struct isp1301 *isp = data; | 1104 | struct isp1301 *isp = container_of(work, struct isp1301, work); |
1106 | int stop; | 1105 | int stop; |
1107 | 1106 | ||
1108 | /* implicit lock: we're the only task using this device */ | 1107 | /* implicit lock: we're the only task using this device */ |
@@ -1244,7 +1243,7 @@ static int isp1301_detach_client(struct i2c_client *i2c) | |||
1244 | * - DEVICE mode, for when there's a B/Mini-B (device) connector | 1243 | * - DEVICE mode, for when there's a B/Mini-B (device) connector |
1245 | * | 1244 | * |
1246 | * As a rule, you won't have an isp1301 chip unless it's there to | 1245 | * As a rule, you won't have an isp1301 chip unless it's there to |
1247 | * support the OTG mode. Other modes help testing USB controllers | 1246 | * support the OTG mode. Other modes help testing USB controllers |
1248 | * in isolation from (full) OTG support, or maybe so later board | 1247 | * in isolation from (full) OTG support, or maybe so later board |
1249 | * revisions can help to support those feature. | 1248 | * revisions can help to support those feature. |
1250 | */ | 1249 | */ |
@@ -1260,9 +1259,9 @@ static int isp1301_otg_enable(struct isp1301 *isp) | |||
1260 | * a few more interrupts than are strictly needed. | 1259 | * a few more interrupts than are strictly needed. |
1261 | */ | 1260 | */ |
1262 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, | 1261 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, |
1263 | INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); | 1262 | INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); |
1264 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, | 1263 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, |
1265 | INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); | 1264 | INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); |
1266 | 1265 | ||
1267 | dev_info(&isp->client.dev, "ready for dual-role USB ...\n"); | 1266 | dev_info(&isp->client.dev, "ready for dual-role USB ...\n"); |
1268 | 1267 | ||
@@ -1306,9 +1305,9 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host) | |||
1306 | 1305 | ||
1307 | dev_info(&isp->client.dev, "A-Host sessions ok\n"); | 1306 | dev_info(&isp->client.dev, "A-Host sessions ok\n"); |
1308 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, | 1307 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, |
1309 | INTR_ID_GND); | 1308 | INTR_ID_GND); |
1310 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, | 1309 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, |
1311 | INTR_ID_GND); | 1310 | INTR_ID_GND); |
1312 | 1311 | ||
1313 | /* If this has a Mini-AB connector, this mode is highly | 1312 | /* If this has a Mini-AB connector, this mode is highly |
1314 | * nonstandard ... but can be handy for testing, especially with | 1313 | * nonstandard ... but can be handy for testing, especially with |
@@ -1368,9 +1367,9 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) | |||
1368 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); | 1367 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); |
1369 | 1368 | ||
1370 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, | 1369 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, |
1371 | INTR_SESS_VLD); | 1370 | INTR_SESS_VLD); |
1372 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, | 1371 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, |
1373 | INTR_VBUS_VLD); | 1372 | INTR_VBUS_VLD); |
1374 | dev_info(&isp->client.dev, "B-Peripheral sessions ok\n"); | 1373 | dev_info(&isp->client.dev, "B-Peripheral sessions ok\n"); |
1375 | dump_regs(isp, __FUNCTION__); | 1374 | dump_regs(isp, __FUNCTION__); |
1376 | 1375 | ||
@@ -1494,7 +1493,7 @@ static int isp1301_probe(struct i2c_adapter *bus, int address, int kind) | |||
1494 | if (!isp) | 1493 | if (!isp) |
1495 | return 0; | 1494 | return 0; |
1496 | 1495 | ||
1497 | INIT_WORK(&isp->work, isp1301_work, isp); | 1496 | INIT_WORK(&isp->work, isp1301_work); |
1498 | init_timer(&isp->timer); | 1497 | init_timer(&isp->timer); |
1499 | isp->timer.function = isp1301_timer; | 1498 | isp->timer.function = isp1301_timer; |
1500 | isp->timer.data = (unsigned long) isp; | 1499 | isp->timer.data = (unsigned long) isp; |
@@ -1572,13 +1571,14 @@ fail1: | |||
1572 | /* IRQ wired at M14 */ | 1571 | /* IRQ wired at M14 */ |
1573 | omap_cfg_reg(M14_1510_GPIO2); | 1572 | omap_cfg_reg(M14_1510_GPIO2); |
1574 | isp->irq = OMAP_GPIO_IRQ(2); | 1573 | isp->irq = OMAP_GPIO_IRQ(2); |
1575 | omap_request_gpio(2); | 1574 | if (gpio_request(2, "isp1301") == 0) |
1576 | omap_set_gpio_direction(2, 1); | 1575 | gpio_direction_input(2); |
1577 | omap_set_gpio_edge_ctrl(2, OMAP_GPIO_FALLING_EDGE); | 1576 | isp->irq_type = IRQF_TRIGGER_FALLING; |
1578 | } | 1577 | } |
1579 | 1578 | ||
1579 | isp->irq_type |= IRQF_SAMPLE_RANDOM; | ||
1580 | status = request_irq(isp->irq, isp1301_irq, | 1580 | status = request_irq(isp->irq, isp1301_irq, |
1581 | IRQF_SAMPLE_RANDOM, DRIVER_NAME, isp); | 1581 | isp->irq_type, DRIVER_NAME, isp); |
1582 | if (status < 0) { | 1582 | if (status < 0) { |
1583 | dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n", | 1583 | dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n", |
1584 | isp->irq, status); | 1584 | isp->irq, status); |
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c index 48a7e2f0bdd3..d9c92c5e0077 100644 --- a/drivers/i2c/chips/menelaus.c +++ b/drivers/i2c/chips/menelaus.c | |||
@@ -1,4 +1,3 @@ | |||
1 | #define DEBUG | ||
2 | /* | 1 | /* |
3 | * Copyright (C) 2004 Texas Instruments, Inc. | 2 | * Copyright (C) 2004 Texas Instruments, Inc. |
4 | * | 3 | * |
@@ -933,7 +932,7 @@ static int menelaus_set_time(struct device *dev, struct rtc_time *t) | |||
933 | return status; | 932 | return status; |
934 | status = menelaus_write_reg(MENELAUS_RTC_WKDAY, BIN2BCD(t->tm_wday)); | 933 | status = menelaus_write_reg(MENELAUS_RTC_WKDAY, BIN2BCD(t->tm_wday)); |
935 | if (status < 0) { | 934 | if (status < 0) { |
936 | dev_err(&the_menelaus->client->dev, "rtc write reg %02x", | 935 | dev_err(&the_menelaus->client->dev, "rtc write reg %02x " |
937 | "err %d\n", MENELAUS_RTC_WKDAY, status); | 936 | "err %d\n", MENELAUS_RTC_WKDAY, status); |
938 | return status; | 937 | return status; |
939 | } | 938 | } |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index e049f65bc3a2..7adb61bad6ad 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -304,9 +304,9 @@ comment "IDE chipset support/bugfixes" | |||
304 | 304 | ||
305 | config IDE_GENERIC | 305 | config IDE_GENERIC |
306 | tristate "generic/default IDE chipset support" | 306 | tristate "generic/default IDE chipset support" |
307 | default y | 307 | default H8300 |
308 | help | 308 | help |
309 | If unsure, say Y. | 309 | If unsure, say N. |
310 | 310 | ||
311 | config BLK_DEV_CMD640 | 311 | config BLK_DEV_CMD640 |
312 | bool "CMD640 chipset bugfix/support" | 312 | bool "CMD640 chipset bugfix/support" |
@@ -345,6 +345,7 @@ config BLK_DEV_CMD640_ENHANCED | |||
345 | config BLK_DEV_IDEPNP | 345 | config BLK_DEV_IDEPNP |
346 | bool "PNP EIDE support" | 346 | bool "PNP EIDE support" |
347 | depends on PNP | 347 | depends on PNP |
348 | select IDE_GENERIC | ||
348 | help | 349 | help |
349 | If you have a PnP (Plug and Play) compatible EIDE card and | 350 | If you have a PnP (Plug and Play) compatible EIDE card and |
350 | would like the kernel to automatically detect and activate | 351 | would like the kernel to automatically detect and activate |
@@ -834,6 +835,7 @@ config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ | |||
834 | 835 | ||
835 | config IDE_ARM | 836 | config IDE_ARM |
836 | def_bool ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK) | 837 | def_bool ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK) |
838 | select IDE_GENERIC | ||
837 | 839 | ||
838 | config BLK_DEV_IDE_ICSIDE | 840 | config BLK_DEV_IDE_ICSIDE |
839 | tristate "ICS IDE interface support" | 841 | tristate "ICS IDE interface support" |
@@ -867,6 +869,7 @@ config BLK_DEV_IDE_BAST | |||
867 | config BLK_DEV_GAYLE | 869 | config BLK_DEV_GAYLE |
868 | bool "Amiga Gayle IDE interface support" | 870 | bool "Amiga Gayle IDE interface support" |
869 | depends on AMIGA | 871 | depends on AMIGA |
872 | select IDE_GENERIC | ||
870 | help | 873 | help |
871 | This is the IDE driver for the Amiga Gayle IDE interface. It supports | 874 | This is the IDE driver for the Amiga Gayle IDE interface. It supports |
872 | both the `A1200 style' and `A4000 style' of the Gayle IDE interface, | 875 | both the `A1200 style' and `A4000 style' of the Gayle IDE interface, |
@@ -898,6 +901,7 @@ config BLK_DEV_IDEDOUBLER | |||
898 | config BLK_DEV_BUDDHA | 901 | config BLK_DEV_BUDDHA |
899 | bool "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)" | 902 | bool "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)" |
900 | depends on ZORRO && EXPERIMENTAL | 903 | depends on ZORRO && EXPERIMENTAL |
904 | select IDE_GENERIC | ||
901 | help | 905 | help |
902 | This is the IDE driver for the IDE interfaces on the Buddha, | 906 | This is the IDE driver for the IDE interfaces on the Buddha, |
903 | Catweasel and X-Surf expansion boards. It supports up to two interfaces | 907 | Catweasel and X-Surf expansion boards. It supports up to two interfaces |
@@ -910,6 +914,7 @@ config BLK_DEV_BUDDHA | |||
910 | config BLK_DEV_FALCON_IDE | 914 | config BLK_DEV_FALCON_IDE |
911 | bool "Falcon IDE interface support" | 915 | bool "Falcon IDE interface support" |
912 | depends on ATARI | 916 | depends on ATARI |
917 | select IDE_GENERIC | ||
913 | help | 918 | help |
914 | This is the IDE driver for the builtin IDE interface on the Atari | 919 | This is the IDE driver for the builtin IDE interface on the Atari |
915 | Falcon. Say Y if you have a Falcon and want to use IDE devices (hard | 920 | Falcon. Say Y if you have a Falcon and want to use IDE devices (hard |
@@ -919,6 +924,7 @@ config BLK_DEV_FALCON_IDE | |||
919 | config BLK_DEV_MAC_IDE | 924 | config BLK_DEV_MAC_IDE |
920 | bool "Macintosh Quadra/Powerbook IDE interface support" | 925 | bool "Macintosh Quadra/Powerbook IDE interface support" |
921 | depends on MAC | 926 | depends on MAC |
927 | select IDE_GENERIC | ||
922 | help | 928 | help |
923 | This is the IDE driver for the builtin IDE interface on some m68k | 929 | This is the IDE driver for the builtin IDE interface on some m68k |
924 | Macintosh models. It supports both the `Quadra style' (used in | 930 | Macintosh models. It supports both the `Quadra style' (used in |
@@ -932,6 +938,7 @@ config BLK_DEV_MAC_IDE | |||
932 | config BLK_DEV_Q40IDE | 938 | config BLK_DEV_Q40IDE |
933 | bool "Q40/Q60 IDE interface support" | 939 | bool "Q40/Q60 IDE interface support" |
934 | depends on Q40 | 940 | depends on Q40 |
941 | select IDE_GENERIC | ||
935 | help | 942 | help |
936 | Enable the on-board IDE controller in the Q40/Q60. This should | 943 | Enable the on-board IDE controller in the Q40/Q60. This should |
937 | normally be on; disable it only if you are running a custom hard | 944 | normally be on; disable it only if you are running a custom hard |
@@ -940,6 +947,7 @@ config BLK_DEV_Q40IDE | |||
940 | config BLK_DEV_MPC8xx_IDE | 947 | config BLK_DEV_MPC8xx_IDE |
941 | bool "MPC8xx IDE support" | 948 | bool "MPC8xx IDE support" |
942 | depends on 8xx && IDE=y && BLK_DEV_IDE=y | 949 | depends on 8xx && IDE=y && BLK_DEV_IDE=y |
950 | select IDE_GENERIC | ||
943 | help | 951 | help |
944 | This option provides support for IDE on Motorola MPC8xx Systems. | 952 | This option provides support for IDE on Motorola MPC8xx Systems. |
945 | Please see 'Type of MPC8xx IDE interface' for details. | 953 | Please see 'Type of MPC8xx IDE interface' for details. |
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index fbfea46a34f2..04636f7eaae7 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
@@ -718,6 +718,8 @@ static void tune_cris_ide(ide_drive_t *drive, u8 pio) | |||
718 | } | 718 | } |
719 | 719 | ||
720 | cris_ide_set_speed(TYPE_PIO, setup, strobe, hold); | 720 | cris_ide_set_speed(TYPE_PIO, setup, strobe, hold); |
721 | |||
722 | (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); | ||
721 | } | 723 | } |
722 | 724 | ||
723 | static int speed_cris_ide(ide_drive_t *drive, u8 speed) | 725 | static int speed_cris_ide(ide_drive_t *drive, u8 speed) |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 5ce4216f72a2..eba1adbc1b6a 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -481,6 +481,15 @@ static inline int idedisk_supports_lba48(const struct hd_driveid *id) | |||
481 | && id->lba_capacity_2; | 481 | && id->lba_capacity_2; |
482 | } | 482 | } |
483 | 483 | ||
484 | /* | ||
485 | * Some disks report total number of sectors instead of | ||
486 | * maximum sector address. We list them here. | ||
487 | */ | ||
488 | static const struct drive_list_entry hpa_list[] = { | ||
489 | { "ST340823A", NULL }, | ||
490 | { NULL, NULL } | ||
491 | }; | ||
492 | |||
484 | static void idedisk_check_hpa(ide_drive_t *drive) | 493 | static void idedisk_check_hpa(ide_drive_t *drive) |
485 | { | 494 | { |
486 | unsigned long long capacity, set_max; | 495 | unsigned long long capacity, set_max; |
@@ -492,6 +501,15 @@ static void idedisk_check_hpa(ide_drive_t *drive) | |||
492 | else | 501 | else |
493 | set_max = idedisk_read_native_max_address(drive); | 502 | set_max = idedisk_read_native_max_address(drive); |
494 | 503 | ||
504 | if (ide_in_drive_list(drive->id, hpa_list)) { | ||
505 | /* | ||
506 | * Since we are inclusive wrt to firmware revisions do this | ||
507 | * extra check and apply the workaround only when needed. | ||
508 | */ | ||
509 | if (set_max == capacity + 1) | ||
510 | set_max--; | ||
511 | } | ||
512 | |||
495 | if (set_max <= capacity) | 513 | if (set_max <= capacity) |
496 | return; | 514 | return; |
497 | 515 | ||
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 5fe1d72ab451..ff644a5e12cd 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -135,25 +135,6 @@ static const struct drive_list_entry drive_blacklist [] = { | |||
135 | }; | 135 | }; |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * ide_in_drive_list - look for drive in black/white list | ||
139 | * @id: drive identifier | ||
140 | * @drive_table: list to inspect | ||
141 | * | ||
142 | * Look for a drive in the blacklist and the whitelist tables | ||
143 | * Returns 1 if the drive is found in the table. | ||
144 | */ | ||
145 | |||
146 | int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) | ||
147 | { | ||
148 | for ( ; drive_table->id_model ; drive_table++) | ||
149 | if ((!strcmp(drive_table->id_model, id->model)) && | ||
150 | (!drive_table->id_firmware || | ||
151 | strstr(id->fw_rev, drive_table->id_firmware))) | ||
152 | return 1; | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | /** | ||
157 | * ide_dma_intr - IDE DMA interrupt handler | 138 | * ide_dma_intr - IDE DMA interrupt handler |
158 | * @drive: the drive the interrupt is for | 139 | * @drive: the drive the interrupt is for |
159 | * | 140 | * |
@@ -349,9 +330,17 @@ EXPORT_SYMBOL_GPL(ide_destroy_dmatable); | |||
349 | 330 | ||
350 | static int config_drive_for_dma (ide_drive_t *drive) | 331 | static int config_drive_for_dma (ide_drive_t *drive) |
351 | { | 332 | { |
333 | ide_hwif_t *hwif = drive->hwif; | ||
352 | struct hd_driveid *id = drive->id; | 334 | struct hd_driveid *id = drive->id; |
353 | 335 | ||
354 | if ((id->capability & 1) && drive->hwif->autodma) { | 336 | /* consult the list of known "bad" drives */ |
337 | if (__ide_dma_bad_drive(drive)) | ||
338 | return -1; | ||
339 | |||
340 | if (drive->media != ide_disk && hwif->atapi_dma == 0) | ||
341 | return -1; | ||
342 | |||
343 | if ((id->capability & 1) && drive->autodma) { | ||
355 | /* | 344 | /* |
356 | * Enable DMA on any drive that has | 345 | * Enable DMA on any drive that has |
357 | * UltraDMA (mode 0/1/2/3/4/5/6) enabled | 346 | * UltraDMA (mode 0/1/2/3/4/5/6) enabled |
@@ -514,20 +503,6 @@ int __ide_dma_on (ide_drive_t *drive) | |||
514 | EXPORT_SYMBOL(__ide_dma_on); | 503 | EXPORT_SYMBOL(__ide_dma_on); |
515 | 504 | ||
516 | /** | 505 | /** |
517 | * __ide_dma_check - check DMA setup | ||
518 | * @drive: drive to check | ||
519 | * | ||
520 | * Don't use - due for extermination | ||
521 | */ | ||
522 | |||
523 | int __ide_dma_check (ide_drive_t *drive) | ||
524 | { | ||
525 | return config_drive_for_dma(drive); | ||
526 | } | ||
527 | |||
528 | EXPORT_SYMBOL(__ide_dma_check); | ||
529 | |||
530 | /** | ||
531 | * ide_dma_setup - begin a DMA phase | 506 | * ide_dma_setup - begin a DMA phase |
532 | * @drive: target device | 507 | * @drive: target device |
533 | * | 508 | * |
@@ -1021,7 +996,7 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p | |||
1021 | if (!hwif->dma_host_on) | 996 | if (!hwif->dma_host_on) |
1022 | hwif->dma_host_on = &ide_dma_host_on; | 997 | hwif->dma_host_on = &ide_dma_host_on; |
1023 | if (!hwif->ide_dma_check) | 998 | if (!hwif->ide_dma_check) |
1024 | hwif->ide_dma_check = &__ide_dma_check; | 999 | hwif->ide_dma_check = &config_drive_for_dma; |
1025 | if (!hwif->dma_setup) | 1000 | if (!hwif->dma_setup) |
1026 | hwif->dma_setup = &ide_dma_setup; | 1001 | hwif->dma_setup = &ide_dma_setup; |
1027 | if (!hwif->dma_exec_cmd) | 1002 | if (!hwif->dma_exec_cmd) |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 92578b6832e9..f4cd2700cae5 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -565,6 +565,36 @@ int ide_wait_stat (ide_startstop_t *startstop, ide_drive_t *drive, u8 good, u8 b | |||
565 | 565 | ||
566 | EXPORT_SYMBOL(ide_wait_stat); | 566 | EXPORT_SYMBOL(ide_wait_stat); |
567 | 567 | ||
568 | /** | ||
569 | * ide_in_drive_list - look for drive in black/white list | ||
570 | * @id: drive identifier | ||
571 | * @drive_table: list to inspect | ||
572 | * | ||
573 | * Look for a drive in the blacklist and the whitelist tables | ||
574 | * Returns 1 if the drive is found in the table. | ||
575 | */ | ||
576 | |||
577 | int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) | ||
578 | { | ||
579 | for ( ; drive_table->id_model; drive_table++) | ||
580 | if ((!strcmp(drive_table->id_model, id->model)) && | ||
581 | (!drive_table->id_firmware || | ||
582 | strstr(id->fw_rev, drive_table->id_firmware))) | ||
583 | return 1; | ||
584 | return 0; | ||
585 | } | ||
586 | |||
587 | EXPORT_SYMBOL_GPL(ide_in_drive_list); | ||
588 | |||
589 | /* | ||
590 | * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid. | ||
591 | * We list them here and depend on the device side cable detection for them. | ||
592 | */ | ||
593 | static const struct drive_list_entry ivb_list[] = { | ||
594 | { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, | ||
595 | { NULL , NULL } | ||
596 | }; | ||
597 | |||
568 | /* | 598 | /* |
569 | * All hosts that use the 80c ribbon must use! | 599 | * All hosts that use the 80c ribbon must use! |
570 | * The name is derived from upper byte of word 93 and the 80c ribbon. | 600 | * The name is derived from upper byte of word 93 and the 80c ribbon. |
@@ -573,11 +603,16 @@ u8 eighty_ninty_three (ide_drive_t *drive) | |||
573 | { | 603 | { |
574 | ide_hwif_t *hwif = drive->hwif; | 604 | ide_hwif_t *hwif = drive->hwif; |
575 | struct hd_driveid *id = drive->id; | 605 | struct hd_driveid *id = drive->id; |
606 | int ivb = ide_in_drive_list(id, ivb_list); | ||
576 | 607 | ||
577 | if (hwif->cbl == ATA_CBL_PATA40_SHORT) | 608 | if (hwif->cbl == ATA_CBL_PATA40_SHORT) |
578 | return 1; | 609 | return 1; |
579 | 610 | ||
580 | if (hwif->cbl != ATA_CBL_PATA80) | 611 | if (ivb) |
612 | printk(KERN_DEBUG "%s: skipping word 93 validity check\n", | ||
613 | drive->name); | ||
614 | |||
615 | if (hwif->cbl != ATA_CBL_PATA80 && !ivb) | ||
581 | goto no_80w; | 616 | goto no_80w; |
582 | 617 | ||
583 | /* Check for SATA but only if we are ATA5 or higher */ | 618 | /* Check for SATA but only if we are ATA5 or higher */ |
@@ -587,11 +622,11 @@ u8 eighty_ninty_three (ide_drive_t *drive) | |||
587 | /* | 622 | /* |
588 | * FIXME: | 623 | * FIXME: |
589 | * - change master/slave IDENTIFY order | 624 | * - change master/slave IDENTIFY order |
590 | * - force bit13 (80c cable present) check | 625 | * - force bit13 (80c cable present) check also for !ivb devices |
591 | * (unless the slave device is pre-ATA3) | 626 | * (unless the slave device is pre-ATA3) |
592 | */ | 627 | */ |
593 | #ifndef CONFIG_IDEDMA_IVB | 628 | #ifndef CONFIG_IDEDMA_IVB |
594 | if (id->hw_config & 0x4000) | 629 | if ((id->hw_config & 0x4000) || (ivb && (id->hw_config & 0x2000))) |
595 | #else | 630 | #else |
596 | if (id->hw_config & 0x6000) | 631 | if (id->hw_config & 0x6000) |
597 | #endif | 632 | #endif |
@@ -795,7 +830,7 @@ int ide_config_drive_speed (ide_drive_t *drive, u8 speed) | |||
795 | hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG); | 830 | hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG); |
796 | hwif->OUTB(speed, IDE_NSECTOR_REG); | 831 | hwif->OUTB(speed, IDE_NSECTOR_REG); |
797 | hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); | 832 | hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); |
798 | hwif->OUTB(WIN_SETFEATURES, IDE_COMMAND_REG); | 833 | hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG); |
799 | if ((IDE_CONTROL_REG) && (drive->quirk_list == 2)) | 834 | if ((IDE_CONTROL_REG) && (drive->quirk_list == 2)) |
800 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); | 835 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); |
801 | udelay(1); | 836 | udelay(1); |
@@ -822,7 +857,7 @@ int ide_config_drive_speed (ide_drive_t *drive, u8 speed) | |||
822 | */ | 857 | */ |
823 | for (i = 0; i < 10; i++) { | 858 | for (i = 0; i < 10; i++) { |
824 | udelay(1); | 859 | udelay(1); |
825 | if (OK_STAT((stat = hwif->INB(IDE_STATUS_REG)), DRIVE_READY, BUSY_STAT|DRQ_STAT|ERR_STAT)) { | 860 | if (OK_STAT((stat = hwif->INB(IDE_STATUS_REG)), drive->ready_stat, BUSY_STAT|DRQ_STAT|ERR_STAT)) { |
826 | error = 0; | 861 | error = 0; |
827 | break; | 862 | break; |
828 | } | 863 | } |
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index acaf71fd4c09..e5949b1d3fb0 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cs5530.c Version 0.73 Mar 10 2007 | 2 | * linux/drivers/ide/pci/cs5530.c Version 0.74 Jul 28 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2000 Mark Lord <mlord@pobox.com> | 5 | * Copyright (C) 2000 Mark Lord <mlord@pobox.com> |
@@ -207,6 +207,9 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch | |||
207 | struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; | 207 | struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; |
208 | unsigned long flags; | 208 | unsigned long flags; |
209 | 209 | ||
210 | if (pci_resource_start(dev, 4) == 0) | ||
211 | return -EFAULT; | ||
212 | |||
210 | dev = NULL; | 213 | dev = NULL; |
211 | while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) { | 214 | while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) { |
212 | switch (dev->device) { | 215 | switch (dev->device) { |
@@ -325,6 +328,9 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif) | |||
325 | /* needs autotuning later */ | 328 | /* needs autotuning later */ |
326 | } | 329 | } |
327 | 330 | ||
331 | if (hwif->dma_base == 0) | ||
332 | return; | ||
333 | |||
328 | hwif->atapi_dma = 1; | 334 | hwif->atapi_dma = 1; |
329 | hwif->ultra_mask = 0x07; | 335 | hwif->ultra_mask = 0x07; |
330 | hwif->mwdma_mask = 0x07; | 336 | hwif->mwdma_mask = 0x07; |
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index 19778c5fe711..cb8fe5643d3b 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c | |||
@@ -89,11 +89,7 @@ static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive) | |||
89 | drive->init_speed = 0; | 89 | drive->init_speed = 0; |
90 | 90 | ||
91 | if (ide_tune_dma(drive)) | 91 | if (ide_tune_dma(drive)) |
92 | #ifndef CONFIG_HPT34X_AUTODMA | ||
93 | return -1; | 92 | return -1; |
94 | #else | ||
95 | return 0; | ||
96 | #endif | ||
97 | 93 | ||
98 | if (ide_use_fast_pio(drive)) | 94 | if (ide_use_fast_pio(drive)) |
99 | hpt34x_tune_drive(drive, 255); | 95 | hpt34x_tune_drive(drive, 255); |
@@ -160,9 +156,11 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif) | |||
160 | if (!hwif->dma_base) | 156 | if (!hwif->dma_base) |
161 | return; | 157 | return; |
162 | 158 | ||
159 | #ifdef CONFIG_HPT34X_AUTODMA | ||
163 | hwif->ultra_mask = 0x07; | 160 | hwif->ultra_mask = 0x07; |
164 | hwif->mwdma_mask = 0x07; | 161 | hwif->mwdma_mask = 0x07; |
165 | hwif->swdma_mask = 0x07; | 162 | hwif->swdma_mask = 0x07; |
163 | #endif | ||
166 | 164 | ||
167 | hwif->ide_dma_check = &hpt34x_config_drive_xfer_rate; | 165 | hwif->ide_dma_check = &hpt34x_config_drive_xfer_rate; |
168 | if (!noautodma) | 166 | if (!noautodma) |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index 09941f37d635..465c935fdf25 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
@@ -187,14 +187,6 @@ static int ns87415_ide_dma_setup(ide_drive_t *drive) | |||
187 | return 1; | 187 | return 1; |
188 | } | 188 | } |
189 | 189 | ||
190 | static int ns87415_ide_dma_check (ide_drive_t *drive) | ||
191 | { | ||
192 | if (drive->media != ide_disk) | ||
193 | return -1; | ||
194 | |||
195 | return __ide_dma_check(drive); | ||
196 | } | ||
197 | |||
198 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) | 190 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) |
199 | { | 191 | { |
200 | struct pci_dev *dev = hwif->pci_dev; | 192 | struct pci_dev *dev = hwif->pci_dev; |
@@ -266,7 +258,6 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) | |||
266 | 258 | ||
267 | outb(0x60, hwif->dma_status); | 259 | outb(0x60, hwif->dma_status); |
268 | hwif->dma_setup = &ns87415_ide_dma_setup; | 260 | hwif->dma_setup = &ns87415_ide_dma_setup; |
269 | hwif->ide_dma_check = &ns87415_ide_dma_check; | ||
270 | hwif->ide_dma_end = &ns87415_ide_dma_end; | 261 | hwif->ide_dma_end = &ns87415_ide_dma_end; |
271 | 262 | ||
272 | if (!noautodma) | 263 | if (!noautodma) |
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 8a66a2871b3a..f6db2f37efad 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
@@ -378,6 +378,9 @@ static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const cha | |||
378 | int f, r; | 378 | int f, r; |
379 | u8 pll_ctl0, pll_ctl1; | 379 | u8 pll_ctl0, pll_ctl1; |
380 | 380 | ||
381 | if (dma_base == 0) | ||
382 | return -EFAULT; | ||
383 | |||
381 | #ifdef CONFIG_PPC_PMAC | 384 | #ifdef CONFIG_PPC_PMAC |
382 | apple_kiwi_init(dev); | 385 | apple_kiwi_init(dev); |
383 | #endif | 386 | #endif |
@@ -494,15 +497,18 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif) | |||
494 | hwif->speedproc = &pdcnew_tune_chipset; | 497 | hwif->speedproc = &pdcnew_tune_chipset; |
495 | hwif->resetproc = &pdcnew_reset; | 498 | hwif->resetproc = &pdcnew_reset; |
496 | 499 | ||
500 | hwif->err_stops_fifo = 1; | ||
501 | |||
497 | hwif->drives[0].autotune = hwif->drives[1].autotune = 1; | 502 | hwif->drives[0].autotune = hwif->drives[1].autotune = 1; |
498 | 503 | ||
504 | if (hwif->dma_base == 0) | ||
505 | return; | ||
506 | |||
499 | hwif->atapi_dma = 1; | 507 | hwif->atapi_dma = 1; |
500 | 508 | ||
501 | hwif->ultra_mask = hwif->cds->udma_mask; | 509 | hwif->ultra_mask = hwif->cds->udma_mask; |
502 | hwif->mwdma_mask = 0x07; | 510 | hwif->mwdma_mask = 0x07; |
503 | 511 | ||
504 | hwif->err_stops_fifo = 1; | ||
505 | |||
506 | hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate; | 512 | hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate; |
507 | 513 | ||
508 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 514 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index fbcb0bb9c956..e19a891171cb 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/pdc202xx_old.c Version 0.50 Mar 3, 2007 | 2 | * linux/drivers/ide/pci/pdc202xx_old.c Version 0.51 Jul 27, 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2006-2007 MontaVista Software, Inc. | 5 | * Copyright (C) 2006-2007 MontaVista Software, Inc. |
@@ -337,15 +337,18 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) | |||
337 | 337 | ||
338 | hwif->speedproc = &pdc202xx_tune_chipset; | 338 | hwif->speedproc = &pdc202xx_tune_chipset; |
339 | 339 | ||
340 | hwif->err_stops_fifo = 1; | ||
341 | |||
340 | hwif->drives[0].autotune = hwif->drives[1].autotune = 1; | 342 | hwif->drives[0].autotune = hwif->drives[1].autotune = 1; |
341 | 343 | ||
344 | if (hwif->dma_base == 0) | ||
345 | return; | ||
346 | |||
342 | hwif->ultra_mask = hwif->cds->udma_mask; | 347 | hwif->ultra_mask = hwif->cds->udma_mask; |
343 | hwif->mwdma_mask = 0x07; | 348 | hwif->mwdma_mask = 0x07; |
344 | hwif->swdma_mask = 0x07; | 349 | hwif->swdma_mask = 0x07; |
345 | hwif->atapi_dma = 1; | 350 | hwif->atapi_dma = 1; |
346 | 351 | ||
347 | hwif->err_stops_fifo = 1; | ||
348 | |||
349 | hwif->ide_dma_check = &pdc202xx_config_drive_xfer_rate; | 352 | hwif->ide_dma_check = &pdc202xx_config_drive_xfer_rate; |
350 | hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; | 353 | hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; |
351 | hwif->dma_timeout = &pdc202xx_dma_timeout; | 354 | hwif->dma_timeout = &pdc202xx_dma_timeout; |
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index 024bbfae0429..098692a6d615 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c | |||
@@ -115,6 +115,9 @@ static void __devinit init_hwif_triflex(ide_hwif_t *hwif) | |||
115 | hwif->tuneproc = &triflex_tune_drive; | 115 | hwif->tuneproc = &triflex_tune_drive; |
116 | hwif->speedproc = &triflex_tune_chipset; | 116 | hwif->speedproc = &triflex_tune_chipset; |
117 | 117 | ||
118 | if (hwif->dma_base == 0) | ||
119 | return; | ||
120 | |||
118 | hwif->atapi_dma = 1; | 121 | hwif->atapi_dma = 1; |
119 | hwif->mwdma_mask = 0x07; | 122 | hwif->mwdma_mask = 0x07; |
120 | hwif->swdma_mask = 0x07; | 123 | hwif->swdma_mask = 0x07; |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 33630ad3e794..4b13cd9a027d 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -604,6 +604,9 @@ out: | |||
604 | drive->id->dma_1word |= 0x0101; break; | 604 | drive->id->dma_1word |= 0x0101; break; |
605 | default: break; | 605 | default: break; |
606 | } | 606 | } |
607 | if (!drive->init_speed) | ||
608 | drive->init_speed = command; | ||
609 | drive->current_speed = command; | ||
607 | } | 610 | } |
608 | enable_irq(hwif->irq); | 611 | enable_irq(hwif->irq); |
609 | return result; | 612 | return result; |
@@ -986,7 +989,6 @@ pmac_ide_tune_chipset (ide_drive_t *drive, byte speed) | |||
986 | return ret; | 989 | return ret; |
987 | 990 | ||
988 | pmac_ide_do_update_timings(drive); | 991 | pmac_ide_do_update_timings(drive); |
989 | drive->current_speed = speed; | ||
990 | 992 | ||
991 | return 0; | 993 | return 0; |
992 | } | 994 | } |
@@ -1737,11 +1739,6 @@ pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode) | |||
1737 | /* Apply timings to controller */ | 1739 | /* Apply timings to controller */ |
1738 | *timings = timing_local[0]; | 1740 | *timings = timing_local[0]; |
1739 | *timings2 = timing_local[1]; | 1741 | *timings2 = timing_local[1]; |
1740 | |||
1741 | /* Set speed info in drive */ | ||
1742 | drive->current_speed = mode; | ||
1743 | if (!drive->init_speed) | ||
1744 | drive->init_speed = mode; | ||
1745 | 1742 | ||
1746 | return 1; | 1743 | return 1; |
1747 | } | 1744 | } |
@@ -1793,11 +1790,6 @@ pmac_ide_udma_enable(ide_drive_t *drive, u16 mode) | |||
1793 | *timings = timing_local[0]; | 1790 | *timings = timing_local[0]; |
1794 | *timings2 = timing_local[1]; | 1791 | *timings2 = timing_local[1]; |
1795 | 1792 | ||
1796 | /* Set speed info in drive */ | ||
1797 | drive->current_speed = mode; | ||
1798 | if (!drive->init_speed) | ||
1799 | drive->init_speed = mode; | ||
1800 | |||
1801 | return 1; | 1793 | return 1; |
1802 | } | 1794 | } |
1803 | 1795 | ||
diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig index 8012b3b0ce75..545663ef820b 100644 --- a/drivers/ieee1394/Kconfig +++ b/drivers/ieee1394/Kconfig | |||
@@ -97,7 +97,7 @@ config IEEE1394_SBP2 | |||
97 | 97 | ||
98 | config IEEE1394_SBP2_PHYS_DMA | 98 | config IEEE1394_SBP2_PHYS_DMA |
99 | bool "Enable replacement for physical DMA in SBP2" | 99 | bool "Enable replacement for physical DMA in SBP2" |
100 | depends on IEEE1394 && IEEE1394_SBP2 && EXPERIMENTAL && (X86_32 || PPC_32) | 100 | depends on IEEE1394_SBP2 && VIRT_TO_BUS && EXPERIMENTAL |
101 | help | 101 | help |
102 | This builds sbp2 for use with non-OHCI host adapters which do not | 102 | This builds sbp2 for use with non-OHCI host adapters which do not |
103 | support physical DMA or for when ohci1394 is run with phys_dma=0. | 103 | support physical DMA or for when ohci1394 is run with phys_dma=0. |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index e882cb951b47..47dbe8f17e82 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -773,11 +773,6 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud) | |||
773 | SBP2_ERR("failed to register lower 4GB address range"); | 773 | SBP2_ERR("failed to register lower 4GB address range"); |
774 | goto failed_alloc; | 774 | goto failed_alloc; |
775 | } | 775 | } |
776 | #else | ||
777 | if (dma_set_mask(hi->host->device.parent, DMA_32BIT_MASK)) { | ||
778 | SBP2_ERR("failed to set 4GB DMA mask"); | ||
779 | goto failed_alloc; | ||
780 | } | ||
781 | #endif | 776 | #endif |
782 | } | 777 | } |
783 | 778 | ||
diff --git a/drivers/infiniband/core/agent.c b/drivers/infiniband/core/agent.c index db2633e4aae6..ae7c2880e624 100644 --- a/drivers/infiniband/core/agent.c +++ b/drivers/infiniband/core/agent.c | |||
@@ -78,15 +78,14 @@ ib_get_agent_port(struct ib_device *device, int port_num) | |||
78 | return entry; | 78 | return entry; |
79 | } | 79 | } |
80 | 80 | ||
81 | int agent_send_response(struct ib_mad *mad, struct ib_grh *grh, | 81 | void agent_send_response(struct ib_mad *mad, struct ib_grh *grh, |
82 | struct ib_wc *wc, struct ib_device *device, | 82 | struct ib_wc *wc, struct ib_device *device, |
83 | int port_num, int qpn) | 83 | int port_num, int qpn) |
84 | { | 84 | { |
85 | struct ib_agent_port_private *port_priv; | 85 | struct ib_agent_port_private *port_priv; |
86 | struct ib_mad_agent *agent; | 86 | struct ib_mad_agent *agent; |
87 | struct ib_mad_send_buf *send_buf; | 87 | struct ib_mad_send_buf *send_buf; |
88 | struct ib_ah *ah; | 88 | struct ib_ah *ah; |
89 | int ret; | ||
90 | struct ib_mad_send_wr_private *mad_send_wr; | 89 | struct ib_mad_send_wr_private *mad_send_wr; |
91 | 90 | ||
92 | if (device->node_type == RDMA_NODE_IB_SWITCH) | 91 | if (device->node_type == RDMA_NODE_IB_SWITCH) |
@@ -96,23 +95,21 @@ int agent_send_response(struct ib_mad *mad, struct ib_grh *grh, | |||
96 | 95 | ||
97 | if (!port_priv) { | 96 | if (!port_priv) { |
98 | printk(KERN_ERR SPFX "Unable to find port agent\n"); | 97 | printk(KERN_ERR SPFX "Unable to find port agent\n"); |
99 | return -ENODEV; | 98 | return; |
100 | } | 99 | } |
101 | 100 | ||
102 | agent = port_priv->agent[qpn]; | 101 | agent = port_priv->agent[qpn]; |
103 | ah = ib_create_ah_from_wc(agent->qp->pd, wc, grh, port_num); | 102 | ah = ib_create_ah_from_wc(agent->qp->pd, wc, grh, port_num); |
104 | if (IS_ERR(ah)) { | 103 | if (IS_ERR(ah)) { |
105 | ret = PTR_ERR(ah); | 104 | printk(KERN_ERR SPFX "ib_create_ah_from_wc error\n"); |
106 | printk(KERN_ERR SPFX "ib_create_ah_from_wc error:%d\n", ret); | 105 | return; |
107 | return ret; | ||
108 | } | 106 | } |
109 | 107 | ||
110 | send_buf = ib_create_send_mad(agent, wc->src_qp, wc->pkey_index, 0, | 108 | send_buf = ib_create_send_mad(agent, wc->src_qp, wc->pkey_index, 0, |
111 | IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, | 109 | IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, |
112 | GFP_KERNEL); | 110 | GFP_KERNEL); |
113 | if (IS_ERR(send_buf)) { | 111 | if (IS_ERR(send_buf)) { |
114 | ret = PTR_ERR(send_buf); | 112 | printk(KERN_ERR SPFX "ib_create_send_mad error\n"); |
115 | printk(KERN_ERR SPFX "ib_create_send_mad error:%d\n", ret); | ||
116 | goto err1; | 113 | goto err1; |
117 | } | 114 | } |
118 | 115 | ||
@@ -126,16 +123,15 @@ int agent_send_response(struct ib_mad *mad, struct ib_grh *grh, | |||
126 | mad_send_wr->send_wr.wr.ud.port_num = port_num; | 123 | mad_send_wr->send_wr.wr.ud.port_num = port_num; |
127 | } | 124 | } |
128 | 125 | ||
129 | if ((ret = ib_post_send_mad(send_buf, NULL))) { | 126 | if (ib_post_send_mad(send_buf, NULL)) { |
130 | printk(KERN_ERR SPFX "ib_post_send_mad error:%d\n", ret); | 127 | printk(KERN_ERR SPFX "ib_post_send_mad error\n"); |
131 | goto err2; | 128 | goto err2; |
132 | } | 129 | } |
133 | return 0; | 130 | return; |
134 | err2: | 131 | err2: |
135 | ib_free_send_mad(send_buf); | 132 | ib_free_send_mad(send_buf); |
136 | err1: | 133 | err1: |
137 | ib_destroy_ah(ah); | 134 | ib_destroy_ah(ah); |
138 | return ret; | ||
139 | } | 135 | } |
140 | 136 | ||
141 | static void agent_send_handler(struct ib_mad_agent *mad_agent, | 137 | static void agent_send_handler(struct ib_mad_agent *mad_agent, |
diff --git a/drivers/infiniband/core/agent.h b/drivers/infiniband/core/agent.h index 86d72fab37b0..fb9ed1489f95 100644 --- a/drivers/infiniband/core/agent.h +++ b/drivers/infiniband/core/agent.h | |||
@@ -46,8 +46,8 @@ extern int ib_agent_port_open(struct ib_device *device, int port_num); | |||
46 | 46 | ||
47 | extern int ib_agent_port_close(struct ib_device *device, int port_num); | 47 | extern int ib_agent_port_close(struct ib_device *device, int port_num); |
48 | 48 | ||
49 | extern int agent_send_response(struct ib_mad *mad, struct ib_grh *grh, | 49 | extern void agent_send_response(struct ib_mad *mad, struct ib_grh *grh, |
50 | struct ib_wc *wc, struct ib_device *device, | 50 | struct ib_wc *wc, struct ib_device *device, |
51 | int port_num, int qpn); | 51 | int port_num, int qpn); |
52 | 52 | ||
53 | #endif /* __AGENT_H_ */ | 53 | #endif /* __AGENT_H_ */ |
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 3ada17c0f239..2506c43ba041 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c | |||
@@ -702,7 +702,7 @@ int ib_find_pkey(struct ib_device *device, | |||
702 | if (ret) | 702 | if (ret) |
703 | return ret; | 703 | return ret; |
704 | 704 | ||
705 | if (pkey == tmp_pkey) { | 705 | if ((pkey & 0x7fff) == (tmp_pkey & 0x7fff)) { |
706 | *index = i; | 706 | *index = i; |
707 | return 0; | 707 | return 0; |
708 | } | 708 | } |
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index bc547f1d34ba..6f4287716ab1 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -1842,16 +1842,11 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, | |||
1842 | { | 1842 | { |
1843 | struct ib_mad_qp_info *qp_info; | 1843 | struct ib_mad_qp_info *qp_info; |
1844 | struct ib_mad_private_header *mad_priv_hdr; | 1844 | struct ib_mad_private_header *mad_priv_hdr; |
1845 | struct ib_mad_private *recv, *response; | 1845 | struct ib_mad_private *recv, *response = NULL; |
1846 | struct ib_mad_list_head *mad_list; | 1846 | struct ib_mad_list_head *mad_list; |
1847 | struct ib_mad_agent_private *mad_agent; | 1847 | struct ib_mad_agent_private *mad_agent; |
1848 | int port_num; | 1848 | int port_num; |
1849 | 1849 | ||
1850 | response = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL); | ||
1851 | if (!response) | ||
1852 | printk(KERN_ERR PFX "ib_mad_recv_done_handler no memory " | ||
1853 | "for response buffer\n"); | ||
1854 | |||
1855 | mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id; | 1850 | mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id; |
1856 | qp_info = mad_list->mad_queue->qp_info; | 1851 | qp_info = mad_list->mad_queue->qp_info; |
1857 | dequeue_mad(mad_list); | 1852 | dequeue_mad(mad_list); |
@@ -1879,6 +1874,13 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, | |||
1879 | if (!validate_mad(&recv->mad.mad, qp_info->qp->qp_num)) | 1874 | if (!validate_mad(&recv->mad.mad, qp_info->qp->qp_num)) |
1880 | goto out; | 1875 | goto out; |
1881 | 1876 | ||
1877 | response = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL); | ||
1878 | if (!response) { | ||
1879 | printk(KERN_ERR PFX "ib_mad_recv_done_handler no memory " | ||
1880 | "for response buffer\n"); | ||
1881 | goto out; | ||
1882 | } | ||
1883 | |||
1882 | if (port_priv->device->node_type == RDMA_NODE_IB_SWITCH) | 1884 | if (port_priv->device->node_type == RDMA_NODE_IB_SWITCH) |
1883 | port_num = wc->port_num; | 1885 | port_num = wc->port_num; |
1884 | else | 1886 | else |
@@ -1914,12 +1916,11 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, | |||
1914 | response->header.recv_wc.recv_buf.mad = &response->mad.mad; | 1916 | response->header.recv_wc.recv_buf.mad = &response->mad.mad; |
1915 | response->header.recv_wc.recv_buf.grh = &response->grh; | 1917 | response->header.recv_wc.recv_buf.grh = &response->grh; |
1916 | 1918 | ||
1917 | if (!agent_send_response(&response->mad.mad, | 1919 | agent_send_response(&response->mad.mad, |
1918 | &response->grh, wc, | 1920 | &response->grh, wc, |
1919 | port_priv->device, | 1921 | port_priv->device, |
1920 | smi_get_fwd_port(&recv->mad.smp), | 1922 | smi_get_fwd_port(&recv->mad.smp), |
1921 | qp_info->qp->qp_num)) | 1923 | qp_info->qp->qp_num); |
1922 | response = NULL; | ||
1923 | 1924 | ||
1924 | goto out; | 1925 | goto out; |
1925 | } | 1926 | } |
diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c index 3663fd7022be..d43bc62005b3 100644 --- a/drivers/infiniband/core/mad_rmpp.c +++ b/drivers/infiniband/core/mad_rmpp.c | |||
@@ -163,8 +163,10 @@ static struct ib_mad_send_buf *alloc_response_msg(struct ib_mad_agent *agent, | |||
163 | hdr_len, 0, GFP_KERNEL); | 163 | hdr_len, 0, GFP_KERNEL); |
164 | if (IS_ERR(msg)) | 164 | if (IS_ERR(msg)) |
165 | ib_destroy_ah(ah); | 165 | ib_destroy_ah(ah); |
166 | else | 166 | else { |
167 | msg->ah = ah; | 167 | msg->ah = ah; |
168 | msg->context[0] = ah; | ||
169 | } | ||
168 | 170 | ||
169 | return msg; | 171 | return msg; |
170 | } | 172 | } |
@@ -197,9 +199,7 @@ static void ack_ds_ack(struct ib_mad_agent_private *agent, | |||
197 | 199 | ||
198 | void ib_rmpp_send_handler(struct ib_mad_send_wc *mad_send_wc) | 200 | void ib_rmpp_send_handler(struct ib_mad_send_wc *mad_send_wc) |
199 | { | 201 | { |
200 | struct ib_rmpp_mad *rmpp_mad = mad_send_wc->send_buf->mad; | 202 | if (mad_send_wc->send_buf->context[0] == mad_send_wc->send_buf->ah) |
201 | |||
202 | if (rmpp_mad->rmpp_hdr.rmpp_type != IB_MGMT_RMPP_TYPE_ACK) | ||
203 | ib_destroy_ah(mad_send_wc->send_buf->ah); | 203 | ib_destroy_ah(mad_send_wc->send_buf->ah); |
204 | ib_free_send_mad(mad_send_wc->send_buf); | 204 | ib_free_send_mad(mad_send_wc->send_buf); |
205 | } | 205 | } |
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 20ab6b3e484d..d271bd715c12 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
@@ -385,9 +385,7 @@ static void update_sm_ah(struct work_struct *work) | |||
385 | 385 | ||
386 | new_ah->pkey_index = 0; | 386 | new_ah->pkey_index = 0; |
387 | if (ib_find_pkey(port->agent->device, port->port_num, | 387 | if (ib_find_pkey(port->agent->device, port->port_num, |
388 | IB_DEFAULT_PKEY_FULL, &new_ah->pkey_index) && | 388 | IB_DEFAULT_PKEY_FULL, &new_ah->pkey_index)) |
389 | ib_find_pkey(port->agent->device, port->port_num, | ||
390 | IB_DEFAULT_PKEY_PARTIAL, &new_ah->pkey_index)) | ||
391 | printk(KERN_ERR "Couldn't find index for default PKey\n"); | 389 | printk(KERN_ERR "Couldn't find index for default PKey\n"); |
392 | 390 | ||
393 | memset(&ah_attr, 0, sizeof ah_attr); | 391 | memset(&ah_attr, 0, sizeof ah_attr); |
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 26d0470eef6e..664d2faa9e74 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c | |||
@@ -40,6 +40,11 @@ | |||
40 | 40 | ||
41 | #include "uverbs.h" | 41 | #include "uverbs.h" |
42 | 42 | ||
43 | #define IB_UMEM_MAX_PAGE_CHUNK \ | ||
44 | ((PAGE_SIZE - offsetof(struct ib_umem_chunk, page_list)) / \ | ||
45 | ((void *) &((struct ib_umem_chunk *) 0)->page_list[1] - \ | ||
46 | (void *) &((struct ib_umem_chunk *) 0)->page_list[0])) | ||
47 | |||
43 | static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int dirty) | 48 | static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int dirty) |
44 | { | 49 | { |
45 | struct ib_umem_chunk *chunk, *tmp; | 50 | struct ib_umem_chunk *chunk, *tmp; |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index 9574088f0d4e..1cdfcd43b0bc 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
@@ -139,7 +139,7 @@ static void release_tid(struct t3cdev *tdev, u32 hwtid, struct sk_buff *skb) | |||
139 | req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); | 139 | req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); |
140 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, hwtid)); | 140 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, hwtid)); |
141 | skb->priority = CPL_PRIORITY_SETUP; | 141 | skb->priority = CPL_PRIORITY_SETUP; |
142 | tdev->send(tdev, skb); | 142 | cxgb3_ofld_send(tdev, skb); |
143 | return; | 143 | return; |
144 | } | 144 | } |
145 | 145 | ||
@@ -161,7 +161,7 @@ int iwch_quiesce_tid(struct iwch_ep *ep) | |||
161 | req->val = cpu_to_be64(1 << S_TCB_RX_QUIESCE); | 161 | req->val = cpu_to_be64(1 << S_TCB_RX_QUIESCE); |
162 | 162 | ||
163 | skb->priority = CPL_PRIORITY_DATA; | 163 | skb->priority = CPL_PRIORITY_DATA; |
164 | ep->com.tdev->send(ep->com.tdev, skb); | 164 | cxgb3_ofld_send(ep->com.tdev, skb); |
165 | return 0; | 165 | return 0; |
166 | } | 166 | } |
167 | 167 | ||
@@ -183,7 +183,7 @@ int iwch_resume_tid(struct iwch_ep *ep) | |||
183 | req->val = 0; | 183 | req->val = 0; |
184 | 184 | ||
185 | skb->priority = CPL_PRIORITY_DATA; | 185 | skb->priority = CPL_PRIORITY_DATA; |
186 | ep->com.tdev->send(ep->com.tdev, skb); | 186 | cxgb3_ofld_send(ep->com.tdev, skb); |
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | 189 | ||
@@ -784,7 +784,7 @@ static int update_rx_credits(struct iwch_ep *ep, u32 credits) | |||
784 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RX_DATA_ACK, ep->hwtid)); | 784 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RX_DATA_ACK, ep->hwtid)); |
785 | req->credit_dack = htonl(V_RX_CREDITS(credits) | V_RX_FORCE_ACK(1)); | 785 | req->credit_dack = htonl(V_RX_CREDITS(credits) | V_RX_FORCE_ACK(1)); |
786 | skb->priority = CPL_PRIORITY_ACK; | 786 | skb->priority = CPL_PRIORITY_ACK; |
787 | ep->com.tdev->send(ep->com.tdev, skb); | 787 | cxgb3_ofld_send(ep->com.tdev, skb); |
788 | return credits; | 788 | return credits; |
789 | } | 789 | } |
790 | 790 | ||
@@ -1152,7 +1152,7 @@ static int listen_start(struct iwch_listen_ep *ep) | |||
1152 | req->opt1 = htonl(V_CONN_POLICY(CPL_CONN_POLICY_ASK)); | 1152 | req->opt1 = htonl(V_CONN_POLICY(CPL_CONN_POLICY_ASK)); |
1153 | 1153 | ||
1154 | skb->priority = 1; | 1154 | skb->priority = 1; |
1155 | ep->com.tdev->send(ep->com.tdev, skb); | 1155 | cxgb3_ofld_send(ep->com.tdev, skb); |
1156 | return 0; | 1156 | return 0; |
1157 | } | 1157 | } |
1158 | 1158 | ||
@@ -1186,7 +1186,7 @@ static int listen_stop(struct iwch_listen_ep *ep) | |||
1186 | req->cpu_idx = 0; | 1186 | req->cpu_idx = 0; |
1187 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, ep->stid)); | 1187 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, ep->stid)); |
1188 | skb->priority = 1; | 1188 | skb->priority = 1; |
1189 | ep->com.tdev->send(ep->com.tdev, skb); | 1189 | cxgb3_ofld_send(ep->com.tdev, skb); |
1190 | return 0; | 1190 | return 0; |
1191 | } | 1191 | } |
1192 | 1192 | ||
@@ -1264,7 +1264,7 @@ static void reject_cr(struct t3cdev *tdev, u32 hwtid, __be32 peer_ip, | |||
1264 | rpl->opt0l_status = htonl(CPL_PASS_OPEN_REJECT); | 1264 | rpl->opt0l_status = htonl(CPL_PASS_OPEN_REJECT); |
1265 | rpl->opt2 = 0; | 1265 | rpl->opt2 = 0; |
1266 | rpl->rsvd = rpl->opt2; | 1266 | rpl->rsvd = rpl->opt2; |
1267 | tdev->send(tdev, skb); | 1267 | cxgb3_ofld_send(tdev, skb); |
1268 | } | 1268 | } |
1269 | } | 1269 | } |
1270 | 1270 | ||
@@ -1557,7 +1557,7 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1557 | rpl->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); | 1557 | rpl->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); |
1558 | OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, ep->hwtid)); | 1558 | OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, ep->hwtid)); |
1559 | rpl->cmd = CPL_ABORT_NO_RST; | 1559 | rpl->cmd = CPL_ABORT_NO_RST; |
1560 | ep->com.tdev->send(ep->com.tdev, rpl_skb); | 1560 | cxgb3_ofld_send(ep->com.tdev, rpl_skb); |
1561 | if (state != ABORTING) { | 1561 | if (state != ABORTING) { |
1562 | state_set(&ep->com, DEAD); | 1562 | state_set(&ep->com, DEAD); |
1563 | release_ep_resources(ep); | 1563 | release_ep_resources(ep); |
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index 660b27aecae5..8bf44daf45ec 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
@@ -389,7 +389,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, | |||
389 | wc->opcode = IB_WC_SEND; | 389 | wc->opcode = IB_WC_SEND; |
390 | break; | 390 | break; |
391 | case MLX4_OPCODE_RDMA_READ: | 391 | case MLX4_OPCODE_RDMA_READ: |
392 | wc->opcode = IB_WC_SEND; | 392 | wc->opcode = IB_WC_RDMA_READ; |
393 | wc->byte_len = be32_to_cpu(cqe->byte_cnt); | 393 | wc->byte_len = be32_to_cpu(cqe->byte_cnt); |
394 | break; | 394 | break; |
395 | case MLX4_OPCODE_ATOMIC_CS: | 395 | case MLX4_OPCODE_ATOMIC_CS: |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 333091787c5f..0ed02b7834da 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -109,7 +109,7 @@ int mlx4_MAD_IFC(struct mlx4_ib_dev *dev, int ignore_mkey, int ignore_bkey, | |||
109 | in_modifier, op_modifier, | 109 | in_modifier, op_modifier, |
110 | MLX4_CMD_MAD_IFC, MLX4_CMD_TIME_CLASS_C); | 110 | MLX4_CMD_MAD_IFC, MLX4_CMD_TIME_CLASS_C); |
111 | 111 | ||
112 | if (!err); | 112 | if (!err) |
113 | memcpy(response_mad, outmailbox->buf, 256); | 113 | memcpy(response_mad, outmailbox->buf, 256); |
114 | 114 | ||
115 | mlx4_free_cmd_mailbox(dev->dev, inmailbox); | 115 | mlx4_free_cmd_mailbox(dev->dev, inmailbox); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c index 982eb88e27ec..563aeacf9e14 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c | |||
@@ -211,6 +211,7 @@ out_free_cq: | |||
211 | 211 | ||
212 | out_free_mr: | 212 | out_free_mr: |
213 | ib_dereg_mr(priv->mr); | 213 | ib_dereg_mr(priv->mr); |
214 | ipoib_cm_dev_cleanup(dev); | ||
214 | 215 | ||
215 | out_free_pd: | 216 | out_free_pd: |
216 | ib_dealloc_pd(priv->pd); | 217 | ib_dealloc_pd(priv->pd); |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index f01ca182f226..f6a051428144 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -75,16 +75,12 @@ module_param(topspin_workarounds, int, 0444); | |||
75 | MODULE_PARM_DESC(topspin_workarounds, | 75 | MODULE_PARM_DESC(topspin_workarounds, |
76 | "Enable workarounds for Topspin/Cisco SRP target bugs if != 0"); | 76 | "Enable workarounds for Topspin/Cisco SRP target bugs if != 0"); |
77 | 77 | ||
78 | static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad }; | ||
79 | |||
80 | static int mellanox_workarounds = 1; | 78 | static int mellanox_workarounds = 1; |
81 | 79 | ||
82 | module_param(mellanox_workarounds, int, 0444); | 80 | module_param(mellanox_workarounds, int, 0444); |
83 | MODULE_PARM_DESC(mellanox_workarounds, | 81 | MODULE_PARM_DESC(mellanox_workarounds, |
84 | "Enable workarounds for Mellanox SRP target bugs if != 0"); | 82 | "Enable workarounds for Mellanox SRP target bugs if != 0"); |
85 | 83 | ||
86 | static const u8 mellanox_oui[3] = { 0x00, 0x02, 0xc9 }; | ||
87 | |||
88 | static void srp_add_one(struct ib_device *device); | 84 | static void srp_add_one(struct ib_device *device); |
89 | static void srp_remove_one(struct ib_device *device); | 85 | static void srp_remove_one(struct ib_device *device); |
90 | static void srp_completion(struct ib_cq *cq, void *target_ptr); | 86 | static void srp_completion(struct ib_cq *cq, void *target_ptr); |
@@ -108,6 +104,24 @@ static const char *srp_target_info(struct Scsi_Host *host) | |||
108 | return host_to_target(host)->target_name; | 104 | return host_to_target(host)->target_name; |
109 | } | 105 | } |
110 | 106 | ||
107 | static int srp_target_is_topspin(struct srp_target_port *target) | ||
108 | { | ||
109 | static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad }; | ||
110 | static const u8 cisco_oui[3] = { 0x00, 0x1b, 0x0d }; | ||
111 | |||
112 | return topspin_workarounds && | ||
113 | (!memcmp(&target->ioc_guid, topspin_oui, sizeof topspin_oui) || | ||
114 | !memcmp(&target->ioc_guid, cisco_oui, sizeof cisco_oui)); | ||
115 | } | ||
116 | |||
117 | static int srp_target_is_mellanox(struct srp_target_port *target) | ||
118 | { | ||
119 | static const u8 mellanox_oui[3] = { 0x00, 0x02, 0xc9 }; | ||
120 | |||
121 | return mellanox_workarounds && | ||
122 | !memcmp(&target->ioc_guid, mellanox_oui, sizeof mellanox_oui); | ||
123 | } | ||
124 | |||
111 | static struct srp_iu *srp_alloc_iu(struct srp_host *host, size_t size, | 125 | static struct srp_iu *srp_alloc_iu(struct srp_host *host, size_t size, |
112 | gfp_t gfp_mask, | 126 | gfp_t gfp_mask, |
113 | enum dma_data_direction direction) | 127 | enum dma_data_direction direction) |
@@ -360,7 +374,7 @@ static int srp_send_req(struct srp_target_port *target) | |||
360 | * zero out the first 8 bytes of our initiator port ID and set | 374 | * zero out the first 8 bytes of our initiator port ID and set |
361 | * the second 8 bytes to the local node GUID. | 375 | * the second 8 bytes to the local node GUID. |
362 | */ | 376 | */ |
363 | if (topspin_workarounds && !memcmp(&target->ioc_guid, topspin_oui, 3)) { | 377 | if (srp_target_is_topspin(target)) { |
364 | printk(KERN_DEBUG PFX "Topspin/Cisco initiator port ID workaround " | 378 | printk(KERN_DEBUG PFX "Topspin/Cisco initiator port ID workaround " |
365 | "activated for target GUID %016llx\n", | 379 | "activated for target GUID %016llx\n", |
366 | (unsigned long long) be64_to_cpu(target->ioc_guid)); | 380 | (unsigned long long) be64_to_cpu(target->ioc_guid)); |
@@ -585,8 +599,8 @@ static int srp_map_fmr(struct srp_target_port *target, struct scatterlist *scat, | |||
585 | if (!dev->fmr_pool) | 599 | if (!dev->fmr_pool) |
586 | return -ENODEV; | 600 | return -ENODEV; |
587 | 601 | ||
588 | if ((ib_sg_dma_address(ibdev, &scat[0]) & ~dev->fmr_page_mask) && | 602 | if (srp_target_is_mellanox(target) && |
589 | mellanox_workarounds && !memcmp(&target->ioc_guid, mellanox_oui, 3)) | 603 | (ib_sg_dma_address(ibdev, &scat[0]) & ~dev->fmr_page_mask)) |
590 | return -EINVAL; | 604 | return -EINVAL; |
591 | 605 | ||
592 | len = page_cnt = 0; | 606 | len = page_cnt = 0; |
@@ -1087,8 +1101,7 @@ static void srp_cm_rej_handler(struct ib_cm_id *cm_id, | |||
1087 | break; | 1101 | break; |
1088 | 1102 | ||
1089 | case IB_CM_REJ_PORT_REDIRECT: | 1103 | case IB_CM_REJ_PORT_REDIRECT: |
1090 | if (topspin_workarounds && | 1104 | if (srp_target_is_topspin(target)) { |
1091 | !memcmp(&target->ioc_guid, topspin_oui, 3)) { | ||
1092 | /* | 1105 | /* |
1093 | * Topspin/Cisco SRP gateways incorrectly send | 1106 | * Topspin/Cisco SRP gateways incorrectly send |
1094 | * reject reason code 25 when they mean 24 | 1107 | * reject reason code 25 when they mean 24 |
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 9b26574f1466..d602b8fa7d46 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -68,6 +68,7 @@ config INPUT_WISTRON_BTNS | |||
68 | select INPUT_POLLDEV | 68 | select INPUT_POLLDEV |
69 | select NEW_LEDS | 69 | select NEW_LEDS |
70 | select LEDS_CLASS | 70 | select LEDS_CLASS |
71 | select CHECK_SIGNATURE | ||
71 | help | 72 | help |
72 | Say Y here for support of Winstron laptop button interface, used on | 73 | Say Y here for support of Winstron laptop button interface, used on |
73 | laptops of various brands, including Acer and Fujitsu-Siemens. If | 74 | laptops of various brands, including Acer and Fujitsu-Siemens. If |
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c index b1a26e02df02..60843b3f3b6f 100644 --- a/drivers/isdn/hisax/hfc_usb.c +++ b/drivers/isdn/hisax/hfc_usb.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * hfc_usb.c | 2 | * hfc_usb.c |
3 | * | 3 | * |
4 | * $Id: hfc_usb.c,v 2.3.2.13 2006/02/17 17:17:22 mbachem Exp $ | 4 | * $Id: hfc_usb.c,v 2.3.2.20 2007/08/20 14:07:54 mbachem Exp $ |
5 | * | 5 | * |
6 | * modular HiSax ISDN driver for Colognechip HFC-S USB chip | 6 | * modular HiSax ISDN driver for Colognechip HFC-S USB chip |
7 | * | 7 | * |
8 | * Authors : Peter Sprenger (sprenger@moving-bytes.de) | 8 | * Authors : Peter Sprenger (sprenger@moving-bytes.de) |
9 | * Martin Bachem (info@colognechip.com) | 9 | * Martin Bachem (m.bachem@gmx.de, info@colognechip.com) |
10 | * | 10 | * |
11 | * based on the first hfc_usb driver of | 11 | * based on the first hfc_usb driver of |
12 | * Werner Cornelius (werner@isdn-development.de) | 12 | * Werner Cornelius (werner@isdn-development.de) |
@@ -37,24 +37,25 @@ | |||
37 | #include <linux/kernel_stat.h> | 37 | #include <linux/kernel_stat.h> |
38 | #include <linux/usb.h> | 38 | #include <linux/usb.h> |
39 | #include <linux/kernel.h> | 39 | #include <linux/kernel.h> |
40 | #include <linux/smp_lock.h> | ||
41 | #include <linux/sched.h> | ||
42 | #include <linux/moduleparam.h> | ||
40 | #include "hisax.h" | 43 | #include "hisax.h" |
41 | #include "hisax_if.h" | 44 | #include "hisax_if.h" |
42 | #include "hfc_usb.h" | 45 | #include "hfc_usb.h" |
43 | 46 | ||
44 | static const char *hfcusb_revision = | 47 | static const char *hfcusb_revision = |
45 | "$Revision: 2.3.2.13 $ $Date: 2006/02/17 17:17:22 $ "; | 48 | "$Revision: 2.3.2.20 $ $Date: 2007/08/20 14:07:54 $ "; |
46 | 49 | ||
47 | /* Hisax debug support | 50 | /* Hisax debug support |
48 | * use "modprobe debug=x" where x is bitfield of USB_DBG & ISDN_DBG | 51 | * debug flags defined in hfc_usb.h as HFCUSB_DBG_[*] |
49 | */ | 52 | */ |
50 | #ifdef CONFIG_HISAX_DEBUG | ||
51 | #include <linux/moduleparam.h> | ||
52 | #define __debug_variable hfc_debug | 53 | #define __debug_variable hfc_debug |
53 | #include "hisax_debug.h" | 54 | #include "hisax_debug.h" |
54 | static u_int debug; | 55 | static u_int debug; |
55 | module_param(debug, uint, 0); | 56 | module_param(debug, uint, 0); |
56 | static int hfc_debug; | 57 | static int hfc_debug; |
57 | #endif | 58 | |
58 | 59 | ||
59 | /* private vendor specific data */ | 60 | /* private vendor specific data */ |
60 | typedef struct { | 61 | typedef struct { |
@@ -63,9 +64,7 @@ typedef struct { | |||
63 | char *vend_name; // device name | 64 | char *vend_name; // device name |
64 | } hfcsusb_vdata; | 65 | } hfcsusb_vdata; |
65 | 66 | ||
66 | /****************************************/ | 67 | /* VID/PID device list */ |
67 | /* data defining the devices to be used */ | ||
68 | /****************************************/ | ||
69 | static struct usb_device_id hfcusb_idtab[] = { | 68 | static struct usb_device_id hfcusb_idtab[] = { |
70 | { | 69 | { |
71 | USB_DEVICE(0x0959, 0x2bd0), | 70 | USB_DEVICE(0x0959, 0x2bd0), |
@@ -90,49 +89,47 @@ static struct usb_device_id hfcusb_idtab[] = { | |||
90 | .driver_info = (unsigned long) &((hfcsusb_vdata) | 89 | .driver_info = (unsigned long) &((hfcsusb_vdata) |
91 | {LED_SCHEME1, {4, 0, 2, 1}, | 90 | {LED_SCHEME1, {4, 0, 2, 1}, |
92 | "Stollmann USB TA"}), | 91 | "Stollmann USB TA"}), |
93 | }, | 92 | }, |
94 | { | 93 | { |
95 | USB_DEVICE(0x0742, 0x2009), | 94 | USB_DEVICE(0x0742, 0x2009), |
96 | .driver_info = (unsigned long) &((hfcsusb_vdata) | 95 | .driver_info = (unsigned long) &((hfcsusb_vdata) |
97 | {LED_SCHEME1, {4, 0, 2, 1}, | 96 | {LED_SCHEME1, {4, 0, 2, 1}, |
98 | "Aceex USB ISDN TA"}), | 97 | "Aceex USB ISDN TA"}), |
99 | }, | 98 | }, |
100 | { | 99 | { |
101 | USB_DEVICE(0x0742, 0x200A), | 100 | USB_DEVICE(0x0742, 0x200A), |
102 | .driver_info = (unsigned long) &((hfcsusb_vdata) | 101 | .driver_info = (unsigned long) &((hfcsusb_vdata) |
103 | {LED_SCHEME1, {4, 0, 2, 1}, | 102 | {LED_SCHEME1, {4, 0, 2, 1}, |
104 | "OEM USB ISDN TA"}), | 103 | "OEM USB ISDN TA"}), |
105 | }, | 104 | }, |
106 | { | 105 | { |
107 | USB_DEVICE(0x08e3, 0x0301), | 106 | USB_DEVICE(0x08e3, 0x0301), |
108 | .driver_info = (unsigned long) &((hfcsusb_vdata) | 107 | .driver_info = (unsigned long) &((hfcsusb_vdata) |
109 | {LED_SCHEME1, {2, 0, 1, 4}, | 108 | {LED_SCHEME1, {2, 0, 1, 4}, |
110 | "Olitec USB RNIS"}), | 109 | "Olitec USB RNIS"}), |
111 | }, | 110 | }, |
112 | { | 111 | { |
113 | USB_DEVICE(0x07fa, 0x0846), | 112 | USB_DEVICE(0x07fa, 0x0846), |
114 | .driver_info = (unsigned long) &((hfcsusb_vdata) | 113 | .driver_info = (unsigned long) &((hfcsusb_vdata) |
115 | {LED_SCHEME1, {0x80, -64, -32, -16}, | 114 | {LED_SCHEME1, {0x80, -64, -32, -16}, |
116 | "Bewan Modem RNIS USB"}), | 115 | "Bewan Modem RNIS USB"}), |
117 | }, | 116 | }, |
118 | { | 117 | { |
119 | USB_DEVICE(0x07fa, 0x0847), | 118 | USB_DEVICE(0x07fa, 0x0847), |
120 | .driver_info = (unsigned long) &((hfcsusb_vdata) | 119 | .driver_info = (unsigned long) &((hfcsusb_vdata) |
121 | {LED_SCHEME1, {0x80, -64, -32, -16}, | 120 | {LED_SCHEME1, {0x80, -64, -32, -16}, |
122 | "Djinn Numeris USB"}), | 121 | "Djinn Numeris USB"}), |
123 | }, | 122 | }, |
124 | { | 123 | { |
125 | USB_DEVICE(0x07b0, 0x0006), | 124 | USB_DEVICE(0x07b0, 0x0006), |
126 | .driver_info = (unsigned long) &((hfcsusb_vdata) | 125 | .driver_info = (unsigned long) &((hfcsusb_vdata) |
127 | {LED_SCHEME1, {0x80, -64, -32, -16}, | 126 | {LED_SCHEME1, {0x80, -64, -32, -16}, |
128 | "Twister ISDN TA"}), | 127 | "Twister ISDN TA"}), |
129 | }, | 128 | }, |
130 | { } | 129 | { } |
131 | }; | 130 | }; |
132 | 131 | ||
133 | /***************************************************************/ | ||
134 | /* structure defining input+output fifos (interrupt/bulk mode) */ | 132 | /* structure defining input+output fifos (interrupt/bulk mode) */ |
135 | /***************************************************************/ | ||
136 | struct usb_fifo; /* forward definition */ | 133 | struct usb_fifo; /* forward definition */ |
137 | typedef struct iso_urb_struct { | 134 | typedef struct iso_urb_struct { |
138 | struct urb *purb; | 135 | struct urb *purb; |
@@ -140,8 +137,8 @@ typedef struct iso_urb_struct { | |||
140 | struct usb_fifo *owner_fifo; /* pointer to owner fifo */ | 137 | struct usb_fifo *owner_fifo; /* pointer to owner fifo */ |
141 | } iso_urb_struct; | 138 | } iso_urb_struct; |
142 | 139 | ||
143 | |||
144 | struct hfcusb_data; /* forward definition */ | 140 | struct hfcusb_data; /* forward definition */ |
141 | |||
145 | typedef struct usb_fifo { | 142 | typedef struct usb_fifo { |
146 | int fifonum; /* fifo index attached to this structure */ | 143 | int fifonum; /* fifo index attached to this structure */ |
147 | int active; /* fifo is currently active */ | 144 | int active; /* fifo is currently active */ |
@@ -160,15 +157,12 @@ typedef struct usb_fifo { | |||
160 | struct hisax_if *hif; /* hisax interface */ | 157 | struct hisax_if *hif; /* hisax interface */ |
161 | int delete_flg; /* only delete skbuff once */ | 158 | int delete_flg; /* only delete skbuff once */ |
162 | int last_urblen; /* remember length of last packet */ | 159 | int last_urblen; /* remember length of last packet */ |
163 | |||
164 | } usb_fifo; | 160 | } usb_fifo; |
165 | 161 | ||
166 | /*********************************************/ | ||
167 | /* structure holding all data for one device */ | 162 | /* structure holding all data for one device */ |
168 | /*********************************************/ | ||
169 | typedef struct hfcusb_data { | 163 | typedef struct hfcusb_data { |
170 | /* HiSax Interface for loadable Layer1 drivers */ | 164 | /* HiSax Interface for loadable Layer1 drivers */ |
171 | struct hisax_d_if d_if; /* see hisax_if.h */ | 165 | struct hisax_d_if d_if; /* see hisax_if.h */ |
172 | struct hisax_b_if b_if[2]; /* see hisax_if.h */ | 166 | struct hisax_b_if b_if[2]; /* see hisax_if.h */ |
173 | int protocol; | 167 | int protocol; |
174 | 168 | ||
@@ -176,12 +170,13 @@ typedef struct hfcusb_data { | |||
176 | int if_used; /* used interface number */ | 170 | int if_used; /* used interface number */ |
177 | int alt_used; /* used alternate config */ | 171 | int alt_used; /* used alternate config */ |
178 | int ctrl_paksize; /* control pipe packet size */ | 172 | int ctrl_paksize; /* control pipe packet size */ |
179 | int ctrl_in_pipe, ctrl_out_pipe; /* handles for control pipe */ | 173 | int ctrl_in_pipe, /* handles for control pipe */ |
174 | ctrl_out_pipe; | ||
180 | int cfg_used; /* configuration index used */ | 175 | int cfg_used; /* configuration index used */ |
181 | int vend_idx; /* vendor found */ | 176 | int vend_idx; /* vendor found */ |
182 | int b_mode[2]; /* B-channel mode */ | 177 | int b_mode[2]; /* B-channel mode */ |
183 | int l1_activated; /* layer 1 activated */ | 178 | int l1_activated; /* layer 1 activated */ |
184 | int disc_flag; /* 'true' if device was disonnected to avoid some USB actions */ | 179 | int disc_flag; /* TRUE if device was disonnected to avoid some USB actions */ |
185 | int packet_size, iso_packet_size; | 180 | int packet_size, iso_packet_size; |
186 | 181 | ||
187 | /* control pipe background handling */ | 182 | /* control pipe background handling */ |
@@ -208,7 +203,6 @@ typedef struct hfcusb_data { | |||
208 | static void collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, | 203 | static void collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, |
209 | int finish); | 204 | int finish); |
210 | 205 | ||
211 | |||
212 | static inline const char * | 206 | static inline const char * |
213 | symbolic(struct hfcusb_symbolic_list list[], const int num) | 207 | symbolic(struct hfcusb_symbolic_list list[], const int num) |
214 | { | 208 | { |
@@ -219,10 +213,6 @@ symbolic(struct hfcusb_symbolic_list list[], const int num) | |||
219 | return "<unknown ERROR>"; | 213 | return "<unknown ERROR>"; |
220 | } | 214 | } |
221 | 215 | ||
222 | |||
223 | /******************************************************/ | ||
224 | /* start next background transfer for control channel */ | ||
225 | /******************************************************/ | ||
226 | static void | 216 | static void |
227 | ctrl_start_transfer(hfcusb_data * hfc) | 217 | ctrl_start_transfer(hfcusb_data * hfc) |
228 | { | 218 | { |
@@ -240,10 +230,6 @@ ctrl_start_transfer(hfcusb_data * hfc) | |||
240 | } | 230 | } |
241 | } /* ctrl_start_transfer */ | 231 | } /* ctrl_start_transfer */ |
242 | 232 | ||
243 | /************************************/ | ||
244 | /* queue a control transfer request */ | ||
245 | /* return 0 on success. */ | ||
246 | /************************************/ | ||
247 | static int | 233 | static int |
248 | queue_control_request(hfcusb_data * hfc, __u8 reg, __u8 val, int action) | 234 | queue_control_request(hfcusb_data * hfc, __u8 reg, __u8 val, int action) |
249 | { | 235 | { |
@@ -260,19 +246,8 @@ queue_control_request(hfcusb_data * hfc, __u8 reg, __u8 val, int action) | |||
260 | if (++hfc->ctrl_cnt == 1) | 246 | if (++hfc->ctrl_cnt == 1) |
261 | ctrl_start_transfer(hfc); | 247 | ctrl_start_transfer(hfc); |
262 | return (0); | 248 | return (0); |
263 | } /* queue_control_request */ | ||
264 | |||
265 | static int | ||
266 | control_action_handler(hfcusb_data * hfc, int reg, int val, int action) | ||
267 | { | ||
268 | if (!action) | ||
269 | return (1); /* no action defined */ | ||
270 | return (0); | ||
271 | } | 249 | } |
272 | 250 | ||
273 | /***************************************************************/ | ||
274 | /* control completion routine handling background control cmds */ | ||
275 | /***************************************************************/ | ||
276 | static void | 251 | static void |
277 | ctrl_complete(struct urb *urb) | 252 | ctrl_complete(struct urb *urb) |
278 | { | 253 | { |
@@ -282,9 +257,6 @@ ctrl_complete(struct urb *urb) | |||
282 | urb->dev = hfc->dev; | 257 | urb->dev = hfc->dev; |
283 | if (hfc->ctrl_cnt) { | 258 | if (hfc->ctrl_cnt) { |
284 | buf = &hfc->ctrl_buff[hfc->ctrl_out_idx]; | 259 | buf = &hfc->ctrl_buff[hfc->ctrl_out_idx]; |
285 | control_action_handler(hfc, buf->hfc_reg, buf->reg_val, | ||
286 | buf->action); | ||
287 | |||
288 | hfc->ctrl_cnt--; /* decrement actual count */ | 260 | hfc->ctrl_cnt--; /* decrement actual count */ |
289 | if (++hfc->ctrl_out_idx >= HFC_CTRL_BUFSIZE) | 261 | if (++hfc->ctrl_out_idx >= HFC_CTRL_BUFSIZE) |
290 | hfc->ctrl_out_idx = 0; /* pointer wrap */ | 262 | hfc->ctrl_out_idx = 0; /* pointer wrap */ |
@@ -293,9 +265,7 @@ ctrl_complete(struct urb *urb) | |||
293 | } | 265 | } |
294 | } /* ctrl_complete */ | 266 | } /* ctrl_complete */ |
295 | 267 | ||
296 | /***************************************************/ | ||
297 | /* write led data to auxport & invert if necessary */ | 268 | /* write led data to auxport & invert if necessary */ |
298 | /***************************************************/ | ||
299 | static void | 269 | static void |
300 | write_led(hfcusb_data * hfc, __u8 led_state) | 270 | write_led(hfcusb_data * hfc, __u8 led_state) |
301 | { | 271 | { |
@@ -305,9 +275,6 @@ write_led(hfcusb_data * hfc, __u8 led_state) | |||
305 | } | 275 | } |
306 | } | 276 | } |
307 | 277 | ||
308 | /**************************/ | ||
309 | /* handle LED bits */ | ||
310 | /**************************/ | ||
311 | static void | 278 | static void |
312 | set_led_bit(hfcusb_data * hfc, signed short led_bits, int unset) | 279 | set_led_bit(hfcusb_data * hfc, signed short led_bits, int unset) |
313 | { | 280 | { |
@@ -324,9 +291,7 @@ set_led_bit(hfcusb_data * hfc, signed short led_bits, int unset) | |||
324 | } | 291 | } |
325 | } | 292 | } |
326 | 293 | ||
327 | /**************************/ | 294 | /* handle LED requests */ |
328 | /* handle LED requests */ | ||
329 | /**************************/ | ||
330 | static void | 295 | static void |
331 | handle_led(hfcusb_data * hfc, int event) | 296 | handle_led(hfcusb_data * hfc, int event) |
332 | { | 297 | { |
@@ -339,85 +304,73 @@ handle_led(hfcusb_data * hfc, int event) | |||
339 | 304 | ||
340 | switch (event) { | 305 | switch (event) { |
341 | case LED_POWER_ON: | 306 | case LED_POWER_ON: |
342 | set_led_bit(hfc, driver_info->led_bits[0], | 307 | set_led_bit(hfc, driver_info->led_bits[0], 0); |
343 | 0); | 308 | set_led_bit(hfc, driver_info->led_bits[1], 1); |
344 | set_led_bit(hfc, driver_info->led_bits[1], | 309 | set_led_bit(hfc, driver_info->led_bits[2], 1); |
345 | 1); | 310 | set_led_bit(hfc, driver_info->led_bits[3], 1); |
346 | set_led_bit(hfc, driver_info->led_bits[2], | ||
347 | 1); | ||
348 | set_led_bit(hfc, driver_info->led_bits[3], | ||
349 | 1); | ||
350 | break; | 311 | break; |
351 | case LED_POWER_OFF: /* no Power off handling */ | 312 | case LED_POWER_OFF: |
313 | set_led_bit(hfc, driver_info->led_bits[0], 1); | ||
314 | set_led_bit(hfc, driver_info->led_bits[1], 1); | ||
315 | set_led_bit(hfc, driver_info->led_bits[2], 1); | ||
316 | set_led_bit(hfc, driver_info->led_bits[3], 1); | ||
352 | break; | 317 | break; |
353 | case LED_S0_ON: | 318 | case LED_S0_ON: |
354 | set_led_bit(hfc, driver_info->led_bits[1], | 319 | set_led_bit(hfc, driver_info->led_bits[1], 0); |
355 | 0); | ||
356 | break; | 320 | break; |
357 | case LED_S0_OFF: | 321 | case LED_S0_OFF: |
358 | set_led_bit(hfc, driver_info->led_bits[1], | 322 | set_led_bit(hfc, driver_info->led_bits[1], 1); |
359 | 1); | ||
360 | break; | 323 | break; |
361 | case LED_B1_ON: | 324 | case LED_B1_ON: |
362 | set_led_bit(hfc, driver_info->led_bits[2], | 325 | set_led_bit(hfc, driver_info->led_bits[2], 0); |
363 | 0); | ||
364 | break; | 326 | break; |
365 | case LED_B1_OFF: | 327 | case LED_B1_OFF: |
366 | set_led_bit(hfc, driver_info->led_bits[2], | 328 | set_led_bit(hfc, driver_info->led_bits[2], 1); |
367 | 1); | ||
368 | break; | 329 | break; |
369 | case LED_B2_ON: | 330 | case LED_B2_ON: |
370 | set_led_bit(hfc, driver_info->led_bits[3], | 331 | set_led_bit(hfc, driver_info->led_bits[3], 0); |
371 | 0); | ||
372 | break; | 332 | break; |
373 | case LED_B2_OFF: | 333 | case LED_B2_OFF: |
374 | set_led_bit(hfc, driver_info->led_bits[3], | 334 | set_led_bit(hfc, driver_info->led_bits[3], 1); |
375 | 1); | ||
376 | break; | 335 | break; |
377 | } | 336 | } |
378 | write_led(hfc, hfc->led_state); | 337 | write_led(hfc, hfc->led_state); |
379 | } | 338 | } |
380 | 339 | ||
381 | /********************************/ | 340 | /* ISDN l1 timer T3 expires */ |
382 | /* called when timer t3 expires */ | ||
383 | /********************************/ | ||
384 | static void | 341 | static void |
385 | l1_timer_expire_t3(hfcusb_data * hfc) | 342 | l1_timer_expire_t3(hfcusb_data * hfc) |
386 | { | 343 | { |
387 | hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION, | 344 | hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION, |
388 | NULL); | 345 | NULL); |
389 | #ifdef CONFIG_HISAX_DEBUG | 346 | |
390 | DBG(ISDN_DBG, | 347 | DBG(HFCUSB_DBG_STATES, |
391 | "HFC-S USB: PH_DEACTIVATE | INDICATION sent (T3 expire)"); | 348 | "HFC-S USB: PH_DEACTIVATE | INDICATION sent (T3 expire)"); |
392 | #endif | 349 | |
393 | hfc->l1_activated = false; | 350 | hfc->l1_activated = 0; |
394 | handle_led(hfc, LED_S0_OFF); | 351 | handle_led(hfc, LED_S0_OFF); |
395 | /* deactivate : */ | 352 | /* deactivate : */ |
396 | queue_control_request(hfc, HFCUSB_STATES, 0x10, 1); | 353 | queue_control_request(hfc, HFCUSB_STATES, 0x10, 1); |
397 | queue_control_request(hfc, HFCUSB_STATES, 3, 1); | 354 | queue_control_request(hfc, HFCUSB_STATES, 3, 1); |
398 | } | 355 | } |
399 | 356 | ||
400 | /********************************/ | 357 | /* ISDN l1 timer T4 expires */ |
401 | /* called when timer t4 expires */ | ||
402 | /********************************/ | ||
403 | static void | 358 | static void |
404 | l1_timer_expire_t4(hfcusb_data * hfc) | 359 | l1_timer_expire_t4(hfcusb_data * hfc) |
405 | { | 360 | { |
406 | hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION, | 361 | hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION, |
407 | NULL); | 362 | NULL); |
408 | #ifdef CONFIG_HISAX_DEBUG | 363 | |
409 | DBG(ISDN_DBG, | 364 | DBG(HFCUSB_DBG_STATES, |
410 | "HFC-S USB: PH_DEACTIVATE | INDICATION sent (T4 expire)"); | 365 | "HFC-S USB: PH_DEACTIVATE | INDICATION sent (T4 expire)"); |
411 | #endif | 366 | |
412 | hfc->l1_activated = false; | 367 | hfc->l1_activated = 0; |
413 | handle_led(hfc, LED_S0_OFF); | 368 | handle_led(hfc, LED_S0_OFF); |
414 | } | 369 | } |
415 | 370 | ||
416 | /*****************************/ | 371 | /* S0 state changed */ |
417 | /* handle S0 state changes */ | ||
418 | /*****************************/ | ||
419 | static void | 372 | static void |
420 | state_handler(hfcusb_data * hfc, __u8 state) | 373 | s0_state_handler(hfcusb_data * hfc, __u8 state) |
421 | { | 374 | { |
422 | __u8 old_state; | 375 | __u8 old_state; |
423 | 376 | ||
@@ -425,38 +378,29 @@ state_handler(hfcusb_data * hfc, __u8 state) | |||
425 | if (state == old_state || state < 1 || state > 8) | 378 | if (state == old_state || state < 1 || state > 8) |
426 | return; | 379 | return; |
427 | 380 | ||
428 | #ifdef CONFIG_HISAX_DEBUG | 381 | DBG(HFCUSB_DBG_STATES, "HFC-S USB: S0 statechange(%d -> %d)", |
429 | DBG(ISDN_DBG, "HFC-S USB: new S0 state:%d old_state:%d", state, | 382 | old_state, state); |
430 | old_state); | 383 | |
431 | #endif | ||
432 | if (state < 4 || state == 7 || state == 8) { | 384 | if (state < 4 || state == 7 || state == 8) { |
433 | if (timer_pending(&hfc->t3_timer)) | 385 | if (timer_pending(&hfc->t3_timer)) |
434 | del_timer(&hfc->t3_timer); | 386 | del_timer(&hfc->t3_timer); |
435 | #ifdef CONFIG_HISAX_DEBUG | 387 | DBG(HFCUSB_DBG_STATES, "HFC-S USB: T3 deactivated"); |
436 | DBG(ISDN_DBG, "HFC-S USB: T3 deactivated"); | ||
437 | #endif | ||
438 | } | 388 | } |
439 | if (state >= 7) { | 389 | if (state >= 7) { |
440 | if (timer_pending(&hfc->t4_timer)) | 390 | if (timer_pending(&hfc->t4_timer)) |
441 | del_timer(&hfc->t4_timer); | 391 | del_timer(&hfc->t4_timer); |
442 | #ifdef CONFIG_HISAX_DEBUG | 392 | DBG(HFCUSB_DBG_STATES, "HFC-S USB: T4 deactivated"); |
443 | DBG(ISDN_DBG, "HFC-S USB: T4 deactivated"); | ||
444 | #endif | ||
445 | } | 393 | } |
446 | 394 | ||
447 | if (state == 7 && !hfc->l1_activated) { | 395 | if (state == 7 && !hfc->l1_activated) { |
448 | hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, | 396 | hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, |
449 | PH_ACTIVATE | INDICATION, NULL); | 397 | PH_ACTIVATE | INDICATION, NULL); |
450 | #ifdef CONFIG_HISAX_DEBUG | 398 | DBG(HFCUSB_DBG_STATES, "HFC-S USB: PH_ACTIVATE | INDICATION sent"); |
451 | DBG(ISDN_DBG, "HFC-S USB: PH_ACTIVATE | INDICATION sent"); | 399 | hfc->l1_activated = 1; |
452 | #endif | ||
453 | hfc->l1_activated = true; | ||
454 | handle_led(hfc, LED_S0_ON); | 400 | handle_led(hfc, LED_S0_ON); |
455 | } else if (state <= 3 /* && activated */ ) { | 401 | } else if (state <= 3 /* && activated */ ) { |
456 | if (old_state == 7 || old_state == 8) { | 402 | if (old_state == 7 || old_state == 8) { |
457 | #ifdef CONFIG_HISAX_DEBUG | 403 | DBG(HFCUSB_DBG_STATES, "HFC-S USB: T4 activated"); |
458 | DBG(ISDN_DBG, "HFC-S USB: T4 activated"); | ||
459 | #endif | ||
460 | if (!timer_pending(&hfc->t4_timer)) { | 404 | if (!timer_pending(&hfc->t4_timer)) { |
461 | hfc->t4_timer.expires = | 405 | hfc->t4_timer.expires = |
462 | jiffies + (HFC_TIMER_T4 * HZ) / 1000; | 406 | jiffies + (HFC_TIMER_T4 * HZ) / 1000; |
@@ -466,18 +410,15 @@ state_handler(hfcusb_data * hfc, __u8 state) | |||
466 | hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, | 410 | hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, |
467 | PH_DEACTIVATE | INDICATION, | 411 | PH_DEACTIVATE | INDICATION, |
468 | NULL); | 412 | NULL); |
469 | #ifdef CONFIG_HISAX_DEBUG | 413 | DBG(HFCUSB_DBG_STATES, |
470 | DBG(ISDN_DBG, | ||
471 | "HFC-S USB: PH_DEACTIVATE | INDICATION sent"); | 414 | "HFC-S USB: PH_DEACTIVATE | INDICATION sent"); |
472 | #endif | 415 | hfc->l1_activated = 0; |
473 | hfc->l1_activated = false; | ||
474 | handle_led(hfc, LED_S0_OFF); | 416 | handle_led(hfc, LED_S0_OFF); |
475 | } | 417 | } |
476 | } | 418 | } |
477 | hfc->l1_state = state; | 419 | hfc->l1_state = state; |
478 | } | 420 | } |
479 | 421 | ||
480 | /* prepare iso urb */ | ||
481 | static void | 422 | static void |
482 | fill_isoc_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe, | 423 | fill_isoc_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe, |
483 | void *buf, int num_packets, int packet_size, int interval, | 424 | void *buf, int num_packets, int packet_size, int interval, |
@@ -503,15 +444,16 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe, | |||
503 | } | 444 | } |
504 | 445 | ||
505 | /* allocs urbs and start isoc transfer with two pending urbs to avoid | 446 | /* allocs urbs and start isoc transfer with two pending urbs to avoid |
506 | gaps in the transfer chain */ | 447 | * gaps in the transfer chain |
448 | */ | ||
507 | static int | 449 | static int |
508 | start_isoc_chain(usb_fifo * fifo, int num_packets_per_urb, | 450 | start_isoc_chain(usb_fifo * fifo, int num_packets_per_urb, |
509 | usb_complete_t complete, int packet_size) | 451 | usb_complete_t complete, int packet_size) |
510 | { | 452 | { |
511 | int i, k, errcode; | 453 | int i, k, errcode; |
512 | 454 | ||
513 | printk(KERN_INFO "HFC-S USB: starting ISO-chain for Fifo %i\n", | 455 | DBG(HFCUSB_DBG_INIT, "HFC-S USB: starting ISO-URBs for fifo:%d\n", |
514 | fifo->fifonum); | 456 | fifo->fifonum); |
515 | 457 | ||
516 | /* allocate Memory for Iso out Urbs */ | 458 | /* allocate Memory for Iso out Urbs */ |
517 | for (i = 0; i < 2; i++) { | 459 | for (i = 0; i < 2; i++) { |
@@ -556,10 +498,9 @@ start_isoc_chain(usb_fifo * fifo, int num_packets_per_urb, | |||
556 | 498 | ||
557 | errcode = usb_submit_urb(fifo->iso[i].purb, GFP_KERNEL); | 499 | errcode = usb_submit_urb(fifo->iso[i].purb, GFP_KERNEL); |
558 | fifo->active = (errcode >= 0) ? 1 : 0; | 500 | fifo->active = (errcode >= 0) ? 1 : 0; |
559 | if (errcode < 0) { | 501 | if (errcode < 0) |
560 | printk(KERN_INFO "HFC-S USB: %s URB nr:%d\n", | 502 | printk(KERN_INFO "HFC-S USB: usb_submit_urb URB nr:%d, error(%i): '%s'\n", |
561 | symbolic(urb_errlist, errcode), i); | 503 | i, errcode, symbolic(urb_errlist, errcode)); |
562 | }; | ||
563 | } | 504 | } |
564 | return (fifo->active); | 505 | return (fifo->active); |
565 | } | 506 | } |
@@ -572,16 +513,15 @@ stop_isoc_chain(usb_fifo * fifo) | |||
572 | 513 | ||
573 | for (i = 0; i < 2; i++) { | 514 | for (i = 0; i < 2; i++) { |
574 | if (fifo->iso[i].purb) { | 515 | if (fifo->iso[i].purb) { |
575 | #ifdef CONFIG_HISAX_DEBUG | 516 | DBG(HFCUSB_DBG_INIT, |
576 | DBG(USB_DBG, | ||
577 | "HFC-S USB: Stopping iso chain for fifo %i.%i", | 517 | "HFC-S USB: Stopping iso chain for fifo %i.%i", |
578 | fifo->fifonum, i); | 518 | fifo->fifonum, i); |
579 | #endif | ||
580 | usb_kill_urb(fifo->iso[i].purb); | 519 | usb_kill_urb(fifo->iso[i].purb); |
581 | usb_free_urb(fifo->iso[i].purb); | 520 | usb_free_urb(fifo->iso[i].purb); |
582 | fifo->iso[i].purb = NULL; | 521 | fifo->iso[i].purb = NULL; |
583 | } | 522 | } |
584 | } | 523 | } |
524 | |||
585 | usb_kill_urb(fifo->urb); | 525 | usb_kill_urb(fifo->urb); |
586 | usb_free_urb(fifo->urb); | 526 | usb_free_urb(fifo->urb); |
587 | fifo->urb = NULL; | 527 | fifo->urb = NULL; |
@@ -594,9 +534,6 @@ static int iso_packets[8] = | |||
594 | ISOC_PACKETS_D, ISOC_PACKETS_D, ISOC_PACKETS_D, ISOC_PACKETS_D | 534 | ISOC_PACKETS_D, ISOC_PACKETS_D, ISOC_PACKETS_D, ISOC_PACKETS_D |
595 | }; | 535 | }; |
596 | 536 | ||
597 | /*****************************************************/ | ||
598 | /* transmit completion routine for all ISO tx fifos */ | ||
599 | /*****************************************************/ | ||
600 | static void | 537 | static void |
601 | tx_iso_complete(struct urb *urb) | 538 | tx_iso_complete(struct urb *urb) |
602 | { | 539 | { |
@@ -607,20 +544,38 @@ tx_iso_complete(struct urb *urb) | |||
607 | errcode; | 544 | errcode; |
608 | int frame_complete, transp_mode, fifon, status; | 545 | int frame_complete, transp_mode, fifon, status; |
609 | __u8 threshbit; | 546 | __u8 threshbit; |
610 | __u8 threshtable[8] = { 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80 }; | ||
611 | 547 | ||
612 | fifon = fifo->fifonum; | 548 | fifon = fifo->fifonum; |
613 | status = urb->status; | 549 | status = urb->status; |
614 | 550 | ||
615 | tx_offset = 0; | 551 | tx_offset = 0; |
616 | 552 | ||
553 | /* ISO transfer only partially completed, | ||
554 | look at individual frame status for details */ | ||
555 | if (status == -EXDEV) { | ||
556 | DBG(HFCUSB_DBG_VERBOSE_USB, "HFC-S USB: tx_iso_complete with -EXDEV" | ||
557 | ", urb->status %d, fifonum %d\n", | ||
558 | status, fifon); | ||
559 | |||
560 | for (k = 0; k < iso_packets[fifon]; ++k) { | ||
561 | errcode = urb->iso_frame_desc[k].status; | ||
562 | if (errcode) | ||
563 | DBG(HFCUSB_DBG_VERBOSE_USB, "HFC-S USB: tx_iso_complete " | ||
564 | "packet %i, status: %i\n", | ||
565 | k, errcode); | ||
566 | } | ||
567 | |||
568 | // clear status, so go on with ISO transfers | ||
569 | status = 0; | ||
570 | } | ||
571 | |||
617 | if (fifo->active && !status) { | 572 | if (fifo->active && !status) { |
618 | transp_mode = 0; | 573 | transp_mode = 0; |
619 | if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS) | 574 | if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS) |
620 | transp_mode = true; | 575 | transp_mode = 1; |
621 | 576 | ||
622 | /* is FifoFull-threshold set for our channel? */ | 577 | /* is FifoFull-threshold set for our channel? */ |
623 | threshbit = threshtable[fifon] & hfc->threshold_mask; | 578 | threshbit = (hfc->threshold_mask & (1 << fifon)); |
624 | num_isoc_packets = iso_packets[fifon]; | 579 | num_isoc_packets = iso_packets[fifon]; |
625 | 580 | ||
626 | /* predict dataflow to avoid fifo overflow */ | 581 | /* predict dataflow to avoid fifo overflow */ |
@@ -635,8 +590,9 @@ tx_iso_complete(struct urb *urb) | |||
635 | tx_iso_complete, urb->context); | 590 | tx_iso_complete, urb->context); |
636 | memset(context_iso_urb->buffer, 0, | 591 | memset(context_iso_urb->buffer, 0, |
637 | sizeof(context_iso_urb->buffer)); | 592 | sizeof(context_iso_urb->buffer)); |
638 | frame_complete = false; | 593 | frame_complete = 0; |
639 | /* Generate next Iso Packets */ | 594 | |
595 | /* Generate next ISO Packets */ | ||
640 | for (k = 0; k < num_isoc_packets; ++k) { | 596 | for (k = 0; k < num_isoc_packets; ++k) { |
641 | if (fifo->skbuff) { | 597 | if (fifo->skbuff) { |
642 | len = fifo->skbuff->len; | 598 | len = fifo->skbuff->len; |
@@ -661,7 +617,7 @@ tx_iso_complete(struct urb *urb) | |||
661 | /* add 2 byte flags and 16bit CRC at end of ISDN frame */ | 617 | /* add 2 byte flags and 16bit CRC at end of ISDN frame */ |
662 | fifo->bit_line += 32; | 618 | fifo->bit_line += 32; |
663 | } | 619 | } |
664 | frame_complete = true; | 620 | frame_complete = 1; |
665 | } | 621 | } |
666 | 622 | ||
667 | memcpy(context_iso_urb->buffer + | 623 | memcpy(context_iso_urb->buffer + |
@@ -688,7 +644,7 @@ tx_iso_complete(struct urb *urb) | |||
688 | } | 644 | } |
689 | 645 | ||
690 | if (frame_complete) { | 646 | if (frame_complete) { |
691 | fifo->delete_flg = true; | 647 | fifo->delete_flg = 1; |
692 | fifo->hif->l1l2(fifo->hif, | 648 | fifo->hif->l1l2(fifo->hif, |
693 | PH_DATA | CONFIRM, | 649 | PH_DATA | CONFIRM, |
694 | (void *) (unsigned long) fifo->skbuff-> | 650 | (void *) (unsigned long) fifo->skbuff-> |
@@ -696,30 +652,26 @@ tx_iso_complete(struct urb *urb) | |||
696 | if (fifo->skbuff && fifo->delete_flg) { | 652 | if (fifo->skbuff && fifo->delete_flg) { |
697 | dev_kfree_skb_any(fifo->skbuff); | 653 | dev_kfree_skb_any(fifo->skbuff); |
698 | fifo->skbuff = NULL; | 654 | fifo->skbuff = NULL; |
699 | fifo->delete_flg = false; | 655 | fifo->delete_flg = 0; |
700 | } | 656 | } |
701 | frame_complete = false; | 657 | frame_complete = 0; |
702 | } | 658 | } |
703 | } | 659 | } |
704 | errcode = usb_submit_urb(urb, GFP_ATOMIC); | 660 | errcode = usb_submit_urb(urb, GFP_ATOMIC); |
705 | if (errcode < 0) { | 661 | if (errcode < 0) { |
706 | printk(KERN_INFO | 662 | printk(KERN_INFO |
707 | "HFC-S USB: error submitting ISO URB: %d \n", | 663 | "HFC-S USB: error submitting ISO URB: %d\n", |
708 | errcode); | 664 | errcode); |
709 | } | 665 | } |
710 | } else { | 666 | } else { |
711 | if (status && !hfc->disc_flag) { | 667 | if (status && !hfc->disc_flag) { |
712 | printk(KERN_INFO | 668 | printk(KERN_INFO |
713 | "HFC-S USB: tx_iso_complete : urb->status %s (%i), fifonum=%d\n", | 669 | "HFC-S USB: tx_iso_complete: error(%i): '%s', fifonum=%d\n", |
714 | symbolic(urb_errlist, status), status, | 670 | status, symbolic(urb_errlist, status), fifon); |
715 | fifon); | ||
716 | } | 671 | } |
717 | } | 672 | } |
718 | } /* tx_iso_complete */ | 673 | } |
719 | 674 | ||
720 | /*****************************************************/ | ||
721 | /* receive completion routine for all ISO tx fifos */ | ||
722 | /*****************************************************/ | ||
723 | static void | 675 | static void |
724 | rx_iso_complete(struct urb *urb) | 676 | rx_iso_complete(struct urb *urb) |
725 | { | 677 | { |
@@ -731,21 +683,25 @@ rx_iso_complete(struct urb *urb) | |||
731 | unsigned int iso_status; | 683 | unsigned int iso_status; |
732 | __u8 *buf; | 684 | __u8 *buf; |
733 | static __u8 eof[8]; | 685 | static __u8 eof[8]; |
734 | #ifdef CONFIG_HISAX_DEBUG | ||
735 | __u8 i; | ||
736 | #endif | ||
737 | 686 | ||
738 | fifon = fifo->fifonum; | 687 | fifon = fifo->fifonum; |
739 | status = urb->status; | 688 | status = urb->status; |
740 | 689 | ||
741 | if (urb->status == -EOVERFLOW) { | 690 | if (urb->status == -EOVERFLOW) { |
742 | #ifdef CONFIG_HISAX_DEBUG | 691 | DBG(HFCUSB_DBG_VERBOSE_USB, |
743 | DBG(USB_DBG, | 692 | "HFC-USB: ignoring USB DATAOVERRUN fifo(%i)", fifon); |
744 | "HFC-USB: ignoring USB DATAOVERRUN for fifo %i \n", | 693 | status = 0; |
745 | fifon); | 694 | } |
746 | #endif | 695 | |
696 | /* ISO transfer only partially completed, | ||
697 | look at individual frame status for details */ | ||
698 | if (status == -EXDEV) { | ||
699 | DBG(HFCUSB_DBG_VERBOSE_USB, "HFC-S USB: rx_iso_complete with -EXDEV " | ||
700 | "urb->status %d, fifonum %d\n", | ||
701 | status, fifon); | ||
747 | status = 0; | 702 | status = 0; |
748 | } | 703 | } |
704 | |||
749 | if (fifo->active && !status) { | 705 | if (fifo->active && !status) { |
750 | num_isoc_packets = iso_packets[fifon]; | 706 | num_isoc_packets = iso_packets[fifon]; |
751 | maxlen = fifo->usb_packet_maxlen; | 707 | maxlen = fifo->usb_packet_maxlen; |
@@ -754,40 +710,38 @@ rx_iso_complete(struct urb *urb) | |||
754 | offset = urb->iso_frame_desc[k].offset; | 710 | offset = urb->iso_frame_desc[k].offset; |
755 | buf = context_iso_urb->buffer + offset; | 711 | buf = context_iso_urb->buffer + offset; |
756 | iso_status = urb->iso_frame_desc[k].status; | 712 | iso_status = urb->iso_frame_desc[k].status; |
757 | #ifdef CONFIG_HISAX_DEBUG | 713 | |
758 | if (iso_status && !hfc->disc_flag) | 714 | if (iso_status && !hfc->disc_flag) |
759 | DBG(USB_DBG, | 715 | DBG(HFCUSB_DBG_VERBOSE_USB, |
760 | "HFC-S USB: ISO packet failure - status:%x", | 716 | "HFC-S USB: rx_iso_complete " |
761 | iso_status); | 717 | "ISO packet %i, status: %i\n", |
718 | k, iso_status); | ||
762 | 719 | ||
763 | if ((fifon == 5) && (debug > 1)) { | 720 | if (fifon == HFCUSB_D_RX) { |
764 | printk(KERN_INFO | 721 | DBG(HFCUSB_DBG_VERBOSE_USB, |
765 | "HFC-S USB: ISO-D-RX lst_urblen:%2d " | 722 | "HFC-S USB: ISO-D-RX lst_urblen:%2d " |
766 | "act_urblen:%2d max-urblen:%2d " | 723 | "act_urblen:%2d max-urblen:%2d EOF:0x%0x", |
767 | "EOF:0x%0x DATA: ", | ||
768 | fifo->last_urblen, len, maxlen, | 724 | fifo->last_urblen, len, maxlen, |
769 | eof[5]); | 725 | eof[5]); |
770 | for (i = 0; i < len; i++) | 726 | |
771 | printk("%.2x ", buf[i]); | 727 | DBG_PACKET(HFCUSB_DBG_VERBOSE_USB, buf, len); |
772 | printk("\n"); | ||
773 | } | 728 | } |
774 | #endif | 729 | |
775 | if (fifo->last_urblen != maxlen) { | 730 | if (fifo->last_urblen != maxlen) { |
776 | /* the threshold mask is in the 2nd status byte */ | 731 | /* the threshold mask is in the 2nd status byte */ |
777 | hfc->threshold_mask = buf[1]; | 732 | hfc->threshold_mask = buf[1]; |
778 | /* care for L1 state only for D-Channel | 733 | /* care for L1 state only for D-Channel |
779 | to avoid overlapped iso completions */ | 734 | to avoid overlapped iso completions */ |
780 | if (fifon == 5) { | 735 | if (fifon == HFCUSB_D_RX) { |
781 | /* the S0 state is in the upper half | 736 | /* the S0 state is in the upper half |
782 | of the 1st status byte */ | 737 | of the 1st status byte */ |
783 | state_handler(hfc, buf[0] >> 4); | 738 | s0_state_handler(hfc, buf[0] >> 4); |
784 | } | 739 | } |
785 | eof[fifon] = buf[0] & 1; | 740 | eof[fifon] = buf[0] & 1; |
786 | if (len > 2) | 741 | if (len > 2) |
787 | collect_rx_frame(fifo, buf + 2, | 742 | collect_rx_frame(fifo, buf + 2, |
788 | len - 2, | 743 | len - 2, |
789 | (len < | 744 | (len < maxlen) ? |
790 | maxlen) ? | ||
791 | eof[fifon] : 0); | 745 | eof[fifon] : 0); |
792 | } else { | 746 | } else { |
793 | collect_rx_frame(fifo, buf, len, | 747 | collect_rx_frame(fifo, buf, len, |
@@ -804,41 +758,37 @@ rx_iso_complete(struct urb *urb) | |||
804 | rx_iso_complete, urb->context); | 758 | rx_iso_complete, urb->context); |
805 | errcode = usb_submit_urb(urb, GFP_ATOMIC); | 759 | errcode = usb_submit_urb(urb, GFP_ATOMIC); |
806 | if (errcode < 0) { | 760 | if (errcode < 0) { |
807 | printk(KERN_INFO | 761 | printk(KERN_ERR |
808 | "HFC-S USB: error submitting ISO URB: %d \n", | 762 | "HFC-S USB: error submitting ISO URB: %d\n", |
809 | errcode); | 763 | errcode); |
810 | } | 764 | } |
811 | } else { | 765 | } else { |
812 | if (status && !hfc->disc_flag) { | 766 | if (status && !hfc->disc_flag) { |
813 | printk(KERN_INFO | 767 | printk(KERN_ERR |
814 | "HFC-S USB: rx_iso_complete : " | 768 | "HFC-S USB: rx_iso_complete : " |
815 | "urb->status %d, fifonum %d\n", | 769 | "urb->status %d, fifonum %d\n", |
816 | status, fifon); | 770 | status, fifon); |
817 | } | 771 | } |
818 | } | 772 | } |
819 | } /* rx_iso_complete */ | 773 | } |
820 | 774 | ||
821 | /*****************************************************/ | 775 | /* collect rx data from INT- and ISO-URBs */ |
822 | /* collect data from interrupt or isochron in */ | ||
823 | /*****************************************************/ | ||
824 | static void | 776 | static void |
825 | collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish) | 777 | collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish) |
826 | { | 778 | { |
827 | hfcusb_data *hfc = fifo->hfc; | 779 | hfcusb_data *hfc = fifo->hfc; |
828 | int transp_mode, fifon; | 780 | int transp_mode, fifon; |
829 | #ifdef CONFIG_HISAX_DEBUG | 781 | |
830 | int i; | ||
831 | #endif | ||
832 | fifon = fifo->fifonum; | 782 | fifon = fifo->fifonum; |
833 | transp_mode = 0; | 783 | transp_mode = 0; |
834 | if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS) | 784 | if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS) |
835 | transp_mode = true; | 785 | transp_mode = 1; |
836 | 786 | ||
837 | if (!fifo->skbuff) { | 787 | if (!fifo->skbuff) { |
838 | fifo->skbuff = dev_alloc_skb(fifo->max_size + 3); | 788 | fifo->skbuff = dev_alloc_skb(fifo->max_size + 3); |
839 | if (!fifo->skbuff) { | 789 | if (!fifo->skbuff) { |
840 | printk(KERN_INFO | 790 | printk(KERN_ERR |
841 | "HFC-S USB: cannot allocate buffer (dev_alloc_skb) fifo:%d\n", | 791 | "HFC-S USB: cannot allocate buffer for fifo(%d)\n", |
842 | fifon); | 792 | fifon); |
843 | return; | 793 | return; |
844 | } | 794 | } |
@@ -847,17 +797,11 @@ collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish) | |||
847 | if (fifo->skbuff->len + len < fifo->max_size) { | 797 | if (fifo->skbuff->len + len < fifo->max_size) { |
848 | memcpy(skb_put(fifo->skbuff, len), data, len); | 798 | memcpy(skb_put(fifo->skbuff, len), data, len); |
849 | } else { | 799 | } else { |
850 | #ifdef CONFIG_HISAX_DEBUG | 800 | DBG(HFCUSB_DBG_FIFO_ERR, |
851 | printk(KERN_INFO "HFC-S USB: "); | 801 | "HCF-USB: got frame exceeded fifo->max_size(%d) fifo(%d)", |
852 | for (i = 0; i < 15; i++) | ||
853 | printk("%.2x ", | ||
854 | fifo->skbuff->data[fifo->skbuff-> | ||
855 | len - 15 + i]); | ||
856 | printk("\n"); | ||
857 | #endif | ||
858 | printk(KERN_INFO | ||
859 | "HCF-USB: got frame exceeded fifo->max_size:%d on fifo:%d\n", | ||
860 | fifo->max_size, fifon); | 802 | fifo->max_size, fifon); |
803 | DBG_SKB(HFCUSB_DBG_VERBOSE_USB, fifo->skbuff); | ||
804 | skb_trim(fifo->skbuff, 0); | ||
861 | } | 805 | } |
862 | } | 806 | } |
863 | if (transp_mode && fifo->skbuff->len >= 128) { | 807 | if (transp_mode && fifo->skbuff->len >= 128) { |
@@ -870,6 +814,13 @@ collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish) | |||
870 | if (finish) { | 814 | if (finish) { |
871 | if ((!fifo->skbuff->data[fifo->skbuff->len - 1]) | 815 | if ((!fifo->skbuff->data[fifo->skbuff->len - 1]) |
872 | && (fifo->skbuff->len > 3)) { | 816 | && (fifo->skbuff->len > 3)) { |
817 | |||
818 | if (fifon == HFCUSB_D_RX) { | ||
819 | DBG(HFCUSB_DBG_DCHANNEL, | ||
820 | "HFC-S USB: D-RX len(%d)", fifo->skbuff->len); | ||
821 | DBG_SKB(HFCUSB_DBG_DCHANNEL, fifo->skbuff); | ||
822 | } | ||
823 | |||
873 | /* remove CRC & status */ | 824 | /* remove CRC & status */ |
874 | skb_trim(fifo->skbuff, fifo->skbuff->len - 3); | 825 | skb_trim(fifo->skbuff, fifo->skbuff->len - 3); |
875 | if (fifon == HFCUSB_PCM_RX) { | 826 | if (fifon == HFCUSB_PCM_RX) { |
@@ -882,39 +833,17 @@ collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish) | |||
882 | fifo->skbuff); | 833 | fifo->skbuff); |
883 | fifo->skbuff = NULL; /* buffer was freed from upper layer */ | 834 | fifo->skbuff = NULL; /* buffer was freed from upper layer */ |
884 | } else { | 835 | } else { |
885 | if (fifo->skbuff->len > 3) { | 836 | DBG(HFCUSB_DBG_FIFO_ERR, |
886 | printk(KERN_INFO | 837 | "HFC-S USB: ERROR frame len(%d) fifo(%d)", |
887 | "HFC-S USB: got frame %d bytes but CRC ERROR on fifo:%d!!!\n", | 838 | fifo->skbuff->len, fifon); |
888 | fifo->skbuff->len, fifon); | 839 | DBG_SKB(HFCUSB_DBG_VERBOSE_USB, fifo->skbuff); |
889 | #ifdef CONFIG_HISAX_DEBUG | ||
890 | if (debug > 1) { | ||
891 | printk(KERN_INFO "HFC-S USB: "); | ||
892 | for (i = 0; i < 15; i++) | ||
893 | printk("%.2x ", | ||
894 | fifo->skbuff-> | ||
895 | data[fifo->skbuff-> | ||
896 | len - 15 + i]); | ||
897 | printk("\n"); | ||
898 | } | ||
899 | #endif | ||
900 | } | ||
901 | #ifdef CONFIG_HISAX_DEBUG | ||
902 | else { | ||
903 | printk(KERN_INFO | ||
904 | "HFC-S USB: frame to small (%d bytes)!!!\n", | ||
905 | fifo->skbuff->len); | ||
906 | } | ||
907 | #endif | ||
908 | skb_trim(fifo->skbuff, 0); | 840 | skb_trim(fifo->skbuff, 0); |
909 | } | 841 | } |
910 | } | 842 | } |
911 | } | 843 | } |
912 | 844 | ||
913 | /***********************************************/ | ||
914 | /* receive completion routine for all rx fifos */ | ||
915 | /***********************************************/ | ||
916 | static void | 845 | static void |
917 | rx_complete(struct urb *urb) | 846 | rx_int_complete(struct urb *urb) |
918 | { | 847 | { |
919 | int len; | 848 | int len; |
920 | int status; | 849 | int status; |
@@ -922,18 +851,14 @@ rx_complete(struct urb *urb) | |||
922 | usb_fifo *fifo = (usb_fifo *) urb->context; | 851 | usb_fifo *fifo = (usb_fifo *) urb->context; |
923 | hfcusb_data *hfc = fifo->hfc; | 852 | hfcusb_data *hfc = fifo->hfc; |
924 | static __u8 eof[8]; | 853 | static __u8 eof[8]; |
925 | #ifdef CONFIG_HISAX_DEBUG | ||
926 | __u8 i; | ||
927 | #endif | ||
928 | 854 | ||
929 | urb->dev = hfc->dev; /* security init */ | 855 | urb->dev = hfc->dev; /* security init */ |
930 | 856 | ||
931 | fifon = fifo->fifonum; | 857 | fifon = fifo->fifonum; |
932 | if ((!fifo->active) || (urb->status)) { | 858 | if ((!fifo->active) || (urb->status)) { |
933 | #ifdef CONFIG_HISAX_DEBUG | 859 | DBG(HFCUSB_DBG_INIT, "HFC-S USB: RX-Fifo %i is going down (%i)", |
934 | DBG(USB_DBG, "HFC-S USB: RX-Fifo %i is going down (%i)", | ||
935 | fifon, urb->status); | 860 | fifon, urb->status); |
936 | #endif | 861 | |
937 | fifo->urb->interval = 0; /* cancel automatic rescheduling */ | 862 | fifo->urb->interval = 0; /* cancel automatic rescheduling */ |
938 | if (fifo->skbuff) { | 863 | if (fifo->skbuff) { |
939 | dev_kfree_skb_any(fifo->skbuff); | 864 | dev_kfree_skb_any(fifo->skbuff); |
@@ -945,22 +870,20 @@ rx_complete(struct urb *urb) | |||
945 | buf = fifo->buffer; | 870 | buf = fifo->buffer; |
946 | maxlen = fifo->usb_packet_maxlen; | 871 | maxlen = fifo->usb_packet_maxlen; |
947 | 872 | ||
948 | #ifdef CONFIG_HISAX_DEBUG | 873 | if (fifon == HFCUSB_D_RX) { |
949 | if ((fifon == 5) && (debug > 1)) { | 874 | DBG(HFCUSB_DBG_VERBOSE_USB, |
950 | printk(KERN_INFO | 875 | "HFC-S USB: INT-D-RX lst_urblen:%2d " |
951 | "HFC-S USB: INT-D-RX lst_urblen:%2d act_urblen:%2d max-urblen:%2d EOF:0x%0x DATA: ", | 876 | "act_urblen:%2d max-urblen:%2d EOF:0x%0x", |
952 | fifo->last_urblen, len, maxlen, eof[5]); | 877 | fifo->last_urblen, len, maxlen, |
953 | for (i = 0; i < len; i++) | 878 | eof[5]); |
954 | printk("%.2x ", buf[i]); | 879 | DBG_PACKET(HFCUSB_DBG_VERBOSE_USB, buf, len); |
955 | printk("\n"); | ||
956 | } | 880 | } |
957 | #endif | ||
958 | 881 | ||
959 | if (fifo->last_urblen != fifo->usb_packet_maxlen) { | 882 | if (fifo->last_urblen != fifo->usb_packet_maxlen) { |
960 | /* the threshold mask is in the 2nd status byte */ | 883 | /* the threshold mask is in the 2nd status byte */ |
961 | hfc->threshold_mask = buf[1]; | 884 | hfc->threshold_mask = buf[1]; |
962 | /* the S0 state is in the upper half of the 1st status byte */ | 885 | /* the S0 state is in the upper half of the 1st status byte */ |
963 | state_handler(hfc, buf[0] >> 4); | 886 | s0_state_handler(hfc, buf[0] >> 4); |
964 | eof[fifon] = buf[0] & 1; | 887 | eof[fifon] = buf[0] & 1; |
965 | /* if we have more than the 2 status bytes -> collect data */ | 888 | /* if we have more than the 2 status bytes -> collect data */ |
966 | if (len > 2) | 889 | if (len > 2) |
@@ -975,20 +898,19 @@ rx_complete(struct urb *urb) | |||
975 | status = usb_submit_urb(urb, GFP_ATOMIC); | 898 | status = usb_submit_urb(urb, GFP_ATOMIC); |
976 | if (status) { | 899 | if (status) { |
977 | printk(KERN_INFO | 900 | printk(KERN_INFO |
978 | "HFC-S USB: error resubmitting URN at rx_complete...\n"); | 901 | "HFC-S USB: %s error resubmitting URB fifo(%d)\n", |
902 | __FUNCTION__, fifon); | ||
979 | } | 903 | } |
980 | } /* rx_complete */ | 904 | } |
981 | 905 | ||
982 | /***************************************************/ | 906 | /* start initial INT-URB for certain fifo */ |
983 | /* start the interrupt transfer for the given fifo */ | ||
984 | /***************************************************/ | ||
985 | static void | 907 | static void |
986 | start_int_fifo(usb_fifo * fifo) | 908 | start_int_fifo(usb_fifo * fifo) |
987 | { | 909 | { |
988 | int errcode; | 910 | int errcode; |
989 | 911 | ||
990 | printk(KERN_INFO "HFC-S USB: starting intr IN fifo:%d\n", | 912 | DBG(HFCUSB_DBG_INIT, "HFC-S USB: starting RX INT-URB for fifo:%d\n", |
991 | fifo->fifonum); | 913 | fifo->fifonum); |
992 | 914 | ||
993 | if (!fifo->urb) { | 915 | if (!fifo->urb) { |
994 | fifo->urb = usb_alloc_urb(0, GFP_KERNEL); | 916 | fifo->urb = usb_alloc_urb(0, GFP_KERNEL); |
@@ -997,33 +919,28 @@ start_int_fifo(usb_fifo * fifo) | |||
997 | } | 919 | } |
998 | usb_fill_int_urb(fifo->urb, fifo->hfc->dev, fifo->pipe, | 920 | usb_fill_int_urb(fifo->urb, fifo->hfc->dev, fifo->pipe, |
999 | fifo->buffer, fifo->usb_packet_maxlen, | 921 | fifo->buffer, fifo->usb_packet_maxlen, |
1000 | rx_complete, fifo, fifo->intervall); | 922 | rx_int_complete, fifo, fifo->intervall); |
1001 | fifo->active = 1; /* must be marked active */ | 923 | fifo->active = 1; /* must be marked active */ |
1002 | errcode = usb_submit_urb(fifo->urb, GFP_KERNEL); | 924 | errcode = usb_submit_urb(fifo->urb, GFP_KERNEL); |
1003 | if (errcode) { | 925 | if (errcode) { |
1004 | printk(KERN_INFO | 926 | printk(KERN_ERR |
1005 | "HFC-S USB: submit URB error(start_int_info): status:%i\n", | 927 | "HFC-S USB: submit URB error(start_int_info): status:%i\n", |
1006 | errcode); | 928 | errcode); |
1007 | fifo->active = 0; | 929 | fifo->active = 0; |
1008 | fifo->skbuff = NULL; | 930 | fifo->skbuff = NULL; |
1009 | } | 931 | } |
1010 | } /* start_int_fifo */ | 932 | } |
1011 | 933 | ||
1012 | /*****************************/ | ||
1013 | /* set the B-channel mode */ | ||
1014 | /*****************************/ | ||
1015 | static void | 934 | static void |
1016 | set_hfcmode(hfcusb_data * hfc, int channel, int mode) | 935 | setup_bchannel(hfcusb_data * hfc, int channel, int mode) |
1017 | { | 936 | { |
1018 | __u8 val, idx_table[2] = { 0, 2 }; | 937 | __u8 val, idx_table[2] = { 0, 2 }; |
1019 | 938 | ||
1020 | if (hfc->disc_flag) { | 939 | if (hfc->disc_flag) { |
1021 | return; | 940 | return; |
1022 | } | 941 | } |
1023 | #ifdef CONFIG_HISAX_DEBUG | 942 | DBG(HFCUSB_DBG_STATES, "HFC-S USB: setting channel %d to mode %d", |
1024 | DBG(ISDN_DBG, "HFC-S USB: setting channel %d to mode %d", channel, | 943 | channel, mode); |
1025 | mode); | ||
1026 | #endif | ||
1027 | hfc->b_mode[channel] = mode; | 944 | hfc->b_mode[channel] = mode; |
1028 | 945 | ||
1029 | /* setup CON_HDLC */ | 946 | /* setup CON_HDLC */ |
@@ -1080,20 +997,17 @@ hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg) | |||
1080 | switch (pr) { | 997 | switch (pr) { |
1081 | case PH_ACTIVATE | REQUEST: | 998 | case PH_ACTIVATE | REQUEST: |
1082 | if (fifo->fifonum == HFCUSB_D_TX) { | 999 | if (fifo->fifonum == HFCUSB_D_TX) { |
1083 | #ifdef CONFIG_HISAX_DEBUG | 1000 | DBG(HFCUSB_DBG_STATES, |
1084 | DBG(ISDN_DBG, | ||
1085 | "HFC_USB: hfc_usb_d_l2l1 D-chan: PH_ACTIVATE | REQUEST"); | 1001 | "HFC_USB: hfc_usb_d_l2l1 D-chan: PH_ACTIVATE | REQUEST"); |
1086 | #endif | 1002 | |
1087 | if (hfc->l1_state != 3 | 1003 | if (hfc->l1_state != 3 |
1088 | && hfc->l1_state != 7) { | 1004 | && hfc->l1_state != 7) { |
1089 | hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, | 1005 | hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, |
1090 | PH_DEACTIVATE | | 1006 | PH_DEACTIVATE | |
1091 | INDICATION, | 1007 | INDICATION, |
1092 | NULL); | 1008 | NULL); |
1093 | #ifdef CONFIG_HISAX_DEBUG | 1009 | DBG(HFCUSB_DBG_STATES, |
1094 | DBG(ISDN_DBG, | ||
1095 | "HFC-S USB: PH_DEACTIVATE | INDICATION sent (not state 3 or 7)"); | 1010 | "HFC-S USB: PH_DEACTIVATE | INDICATION sent (not state 3 or 7)"); |
1096 | #endif | ||
1097 | } else { | 1011 | } else { |
1098 | if (hfc->l1_state == 7) { /* l1 already active */ | 1012 | if (hfc->l1_state == 7) { /* l1 already active */ |
1099 | hfc->d_if.ifc.l1l2(&hfc-> | 1013 | hfc->d_if.ifc.l1l2(&hfc-> |
@@ -1103,10 +1017,8 @@ hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg) | |||
1103 | | | 1017 | | |
1104 | INDICATION, | 1018 | INDICATION, |
1105 | NULL); | 1019 | NULL); |
1106 | #ifdef CONFIG_HISAX_DEBUG | 1020 | DBG(HFCUSB_DBG_STATES, |
1107 | DBG(ISDN_DBG, | ||
1108 | "HFC-S USB: PH_ACTIVATE | INDICATION sent again ;)"); | 1021 | "HFC-S USB: PH_ACTIVATE | INDICATION sent again ;)"); |
1109 | #endif | ||
1110 | } else { | 1022 | } else { |
1111 | /* force sending sending INFO1 */ | 1023 | /* force sending sending INFO1 */ |
1112 | queue_control_request(hfc, | 1024 | queue_control_request(hfc, |
@@ -1132,11 +1044,9 @@ hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg) | |||
1132 | } | 1044 | } |
1133 | } | 1045 | } |
1134 | } else { | 1046 | } else { |
1135 | #ifdef CONFIG_HISAX_DEBUG | 1047 | DBG(HFCUSB_DBG_STATES, |
1136 | DBG(ISDN_DBG, | 1048 | "HFC_USB: hfc_usb_d_l2l1 B-chan: PH_ACTIVATE | REQUEST"); |
1137 | "HFC_USB: hfc_usb_d_l2l1 Bx-chan: PH_ACTIVATE | REQUEST"); | 1049 | setup_bchannel(hfc, |
1138 | #endif | ||
1139 | set_hfcmode(hfc, | ||
1140 | (fifo->fifonum == | 1050 | (fifo->fifonum == |
1141 | HFCUSB_B1_TX) ? 0 : 1, | 1051 | HFCUSB_B1_TX) ? 0 : 1, |
1142 | (long) arg); | 1052 | (long) arg); |
@@ -1147,18 +1057,12 @@ hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg) | |||
1147 | break; | 1057 | break; |
1148 | case PH_DEACTIVATE | REQUEST: | 1058 | case PH_DEACTIVATE | REQUEST: |
1149 | if (fifo->fifonum == HFCUSB_D_TX) { | 1059 | if (fifo->fifonum == HFCUSB_D_TX) { |
1150 | #ifdef CONFIG_HISAX_DEBUG | 1060 | DBG(HFCUSB_DBG_STATES, |
1151 | DBG(ISDN_DBG, | ||
1152 | "HFC_USB: hfc_usb_d_l2l1 D-chan: PH_DEACTIVATE | REQUEST"); | 1061 | "HFC_USB: hfc_usb_d_l2l1 D-chan: PH_DEACTIVATE | REQUEST"); |
1153 | #endif | ||
1154 | printk(KERN_INFO | ||
1155 | "HFC-S USB: ISDN TE device should not deativate...\n"); | ||
1156 | } else { | 1062 | } else { |
1157 | #ifdef CONFIG_HISAX_DEBUG | 1063 | DBG(HFCUSB_DBG_STATES, |
1158 | DBG(ISDN_DBG, | ||
1159 | "HFC_USB: hfc_usb_d_l2l1 Bx-chan: PH_DEACTIVATE | REQUEST"); | 1064 | "HFC_USB: hfc_usb_d_l2l1 Bx-chan: PH_DEACTIVATE | REQUEST"); |
1160 | #endif | 1065 | setup_bchannel(hfc, |
1161 | set_hfcmode(hfc, | ||
1162 | (fifo->fifonum == | 1066 | (fifo->fifonum == |
1163 | HFCUSB_B1_TX) ? 0 : 1, | 1067 | HFCUSB_B1_TX) ? 0 : 1, |
1164 | (int) L1_MODE_NULL); | 1068 | (int) L1_MODE_NULL); |
@@ -1171,25 +1075,20 @@ hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg) | |||
1171 | if (fifo->skbuff && fifo->delete_flg) { | 1075 | if (fifo->skbuff && fifo->delete_flg) { |
1172 | dev_kfree_skb_any(fifo->skbuff); | 1076 | dev_kfree_skb_any(fifo->skbuff); |
1173 | fifo->skbuff = NULL; | 1077 | fifo->skbuff = NULL; |
1174 | fifo->delete_flg = false; | 1078 | fifo->delete_flg = 0; |
1175 | } | 1079 | } |
1176 | fifo->skbuff = arg; /* we have a new buffer */ | 1080 | fifo->skbuff = arg; /* we have a new buffer */ |
1177 | break; | 1081 | break; |
1178 | default: | 1082 | default: |
1179 | printk(KERN_INFO | 1083 | DBG(HFCUSB_DBG_STATES, |
1180 | "HFC_USB: hfc_usb_d_l2l1: unkown state : %#x\n", | 1084 | "HFC_USB: hfc_usb_d_l2l1: unkown state : %#x", pr); |
1181 | pr); | ||
1182 | break; | 1085 | break; |
1183 | } | 1086 | } |
1184 | } | 1087 | } |
1185 | 1088 | ||
1186 | /***************************************************************************/ | 1089 | /* initial init HFC-S USB chip registers, HiSax interface, USB URBs */ |
1187 | /* usb_init is called once when a new matching device is detected to setup */ | ||
1188 | /* main parameters. It registers the driver at the main hisax module. */ | ||
1189 | /* on success 0 is returned. */ | ||
1190 | /***************************************************************************/ | ||
1191 | static int | 1090 | static int |
1192 | usb_init(hfcusb_data * hfc) | 1091 | hfc_usb_init(hfcusb_data * hfc) |
1193 | { | 1092 | { |
1194 | usb_fifo *fifo; | 1093 | usb_fifo *fifo; |
1195 | int i, err; | 1094 | int i, err; |
@@ -1214,11 +1113,11 @@ usb_init(hfcusb_data * hfc) | |||
1214 | /* aux = output, reset off */ | 1113 | /* aux = output, reset off */ |
1215 | write_usb(hfc, HFCUSB_CIRM, 0x10); | 1114 | write_usb(hfc, HFCUSB_CIRM, 0x10); |
1216 | 1115 | ||
1217 | /* set USB_SIZE to match the wMaxPacketSize for INT or BULK transfers */ | 1116 | /* set USB_SIZE to match wMaxPacketSize for INT or BULK transfers */ |
1218 | write_usb(hfc, HFCUSB_USB_SIZE, | 1117 | write_usb(hfc, HFCUSB_USB_SIZE, |
1219 | (hfc->packet_size / 8) | ((hfc->packet_size / 8) << 4)); | 1118 | (hfc->packet_size / 8) | ((hfc->packet_size / 8) << 4)); |
1220 | 1119 | ||
1221 | /* set USB_SIZE_I to match the wMaxPacketSize for ISO transfers */ | 1120 | /* set USB_SIZE_I to match wMaxPacketSize for ISO transfers */ |
1222 | write_usb(hfc, HFCUSB_USB_SIZE_I, hfc->iso_packet_size); | 1121 | write_usb(hfc, HFCUSB_USB_SIZE_I, hfc->iso_packet_size); |
1223 | 1122 | ||
1224 | /* enable PCM/GCI master mode */ | 1123 | /* enable PCM/GCI master mode */ |
@@ -1257,8 +1156,8 @@ usb_init(hfcusb_data * hfc) | |||
1257 | hfc->b_mode[0] = L1_MODE_NULL; | 1156 | hfc->b_mode[0] = L1_MODE_NULL; |
1258 | hfc->b_mode[1] = L1_MODE_NULL; | 1157 | hfc->b_mode[1] = L1_MODE_NULL; |
1259 | 1158 | ||
1260 | hfc->l1_activated = false; | 1159 | hfc->l1_activated = 0; |
1261 | hfc->disc_flag = false; | 1160 | hfc->disc_flag = 0; |
1262 | hfc->led_state = 0; | 1161 | hfc->led_state = 0; |
1263 | hfc->led_new_data = 0; | 1162 | hfc->led_new_data = 0; |
1264 | hfc->old_led_state = 0; | 1163 | hfc->old_led_state = 0; |
@@ -1349,11 +1248,9 @@ usb_init(hfcusb_data * hfc) | |||
1349 | handle_led(hfc, LED_POWER_ON); | 1248 | handle_led(hfc, LED_POWER_ON); |
1350 | 1249 | ||
1351 | return (0); | 1250 | return (0); |
1352 | } /* usb_init */ | 1251 | } |
1353 | 1252 | ||
1354 | /*************************************************/ | 1253 | /* initial callback for each plugged USB device */ |
1355 | /* function called to probe a new plugged device */ | ||
1356 | /*************************************************/ | ||
1357 | static int | 1254 | static int |
1358 | hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | 1255 | hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) |
1359 | { | 1256 | { |
@@ -1378,11 +1275,6 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1378 | } | 1275 | } |
1379 | } | 1276 | } |
1380 | 1277 | ||
1381 | #ifdef CONFIG_HISAX_DEBUG | ||
1382 | DBG(USB_DBG, | ||
1383 | "HFC-USB: probing interface(%d) actalt(%d) minor(%d)\n", ifnum, | ||
1384 | iface->desc.bAlternateSetting, intf->minor); | ||
1385 | #endif | ||
1386 | printk(KERN_INFO | 1278 | printk(KERN_INFO |
1387 | "HFC-S USB: probing interface(%d) actalt(%d) minor(%d)\n", | 1279 | "HFC-S USB: probing interface(%d) actalt(%d) minor(%d)\n", |
1388 | ifnum, iface->desc.bAlternateSetting, intf->minor); | 1280 | ifnum, iface->desc.bAlternateSetting, intf->minor); |
@@ -1403,15 +1295,11 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1403 | 1295 | ||
1404 | /* check for config EOL element */ | 1296 | /* check for config EOL element */ |
1405 | while (validconf[cfg_used][0]) { | 1297 | while (validconf[cfg_used][0]) { |
1406 | cfg_found = true; | 1298 | cfg_found = 1; |
1407 | vcf = validconf[cfg_used]; | 1299 | vcf = validconf[cfg_used]; |
1408 | /* first endpoint descriptor */ | 1300 | /* first endpoint descriptor */ |
1409 | ep = iface->endpoint; | 1301 | ep = iface->endpoint; |
1410 | #ifdef CONFIG_HISAX_DEBUG | 1302 | |
1411 | DBG(USB_DBG, | ||
1412 | "HFC-S USB: (if=%d alt=%d cfg_used=%d)\n", | ||
1413 | ifnum, probe_alt_setting, cfg_used); | ||
1414 | #endif | ||
1415 | memcpy(cmptbl, vcf, 16 * sizeof(int)); | 1303 | memcpy(cmptbl, vcf, 16 * sizeof(int)); |
1416 | 1304 | ||
1417 | /* check for all endpoints in this alternate setting */ | 1305 | /* check for all endpoints in this alternate setting */ |
@@ -1425,7 +1313,7 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1425 | idx++; | 1313 | idx++; |
1426 | attr = ep->desc.bmAttributes; | 1314 | attr = ep->desc.bmAttributes; |
1427 | if (cmptbl[idx] == EP_NUL) { | 1315 | if (cmptbl[idx] == EP_NUL) { |
1428 | cfg_found = false; | 1316 | cfg_found = 0; |
1429 | } | 1317 | } |
1430 | if (attr == USB_ENDPOINT_XFER_INT | 1318 | if (attr == USB_ENDPOINT_XFER_INT |
1431 | && cmptbl[idx] == EP_INT) | 1319 | && cmptbl[idx] == EP_INT) |
@@ -1438,16 +1326,9 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1438 | cmptbl[idx] = EP_NUL; | 1326 | cmptbl[idx] = EP_NUL; |
1439 | 1327 | ||
1440 | /* check if all INT endpoints match minimum interval */ | 1328 | /* check if all INT endpoints match minimum interval */ |
1441 | if (attr == USB_ENDPOINT_XFER_INT | 1329 | if ((attr == USB_ENDPOINT_XFER_INT) |
1442 | && ep->desc.bInterval < | 1330 | && (ep->desc.bInterval < vcf[17])) { |
1443 | vcf[17]) { | 1331 | cfg_found = 0; |
1444 | #ifdef CONFIG_HISAX_DEBUG | ||
1445 | if (cfg_found) | ||
1446 | DBG(USB_DBG, | ||
1447 | "HFC-S USB: Interrupt Endpoint interval < %d found - skipping config", | ||
1448 | vcf[17]); | ||
1449 | #endif | ||
1450 | cfg_found = false; | ||
1451 | } | 1332 | } |
1452 | ep++; | 1333 | ep++; |
1453 | } | 1334 | } |
@@ -1455,7 +1336,7 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1455 | /* all entries must be EP_NOP or EP_NUL for a valid config */ | 1336 | /* all entries must be EP_NOP or EP_NUL for a valid config */ |
1456 | if (cmptbl[i] != EP_NOP | 1337 | if (cmptbl[i] != EP_NOP |
1457 | && cmptbl[i] != EP_NUL) | 1338 | && cmptbl[i] != EP_NUL) |
1458 | cfg_found = false; | 1339 | cfg_found = 0; |
1459 | } | 1340 | } |
1460 | if (cfg_found) { | 1341 | if (cfg_found) { |
1461 | if (cfg_used < small_match) { | 1342 | if (cfg_used < small_match) { |
@@ -1464,23 +1345,16 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1464 | probe_alt_setting; | 1345 | probe_alt_setting; |
1465 | iface_used = iface; | 1346 | iface_used = iface; |
1466 | } | 1347 | } |
1467 | #ifdef CONFIG_HISAX_DEBUG | ||
1468 | DBG(USB_DBG, | ||
1469 | "HFC-USB: small_match=%x %x\n", | ||
1470 | small_match, alt_used); | ||
1471 | #endif | ||
1472 | } | 1348 | } |
1473 | cfg_used++; | 1349 | cfg_used++; |
1474 | } | 1350 | } |
1475 | alt_idx++; | 1351 | alt_idx++; |
1476 | } /* (alt_idx < intf->num_altsetting) */ | 1352 | } /* (alt_idx < intf->num_altsetting) */ |
1477 | 1353 | ||
1478 | /* found a valid USB Ta Endpint config */ | 1354 | /* found a valid USB Ta Endpint config */ |
1479 | if (small_match != 0xffff) { | 1355 | if (small_match != 0xffff) { |
1480 | iface = iface_used; | 1356 | iface = iface_used; |
1481 | if (! | 1357 | if (!(context = kzalloc(sizeof(hfcusb_data), GFP_KERNEL))) |
1482 | (context = | ||
1483 | kzalloc(sizeof(hfcusb_data), GFP_KERNEL))) | ||
1484 | return (-ENOMEM); /* got no mem */ | 1358 | return (-ENOMEM); /* got no mem */ |
1485 | 1359 | ||
1486 | ep = iface->endpoint; | 1360 | ep = iface->endpoint; |
@@ -1613,20 +1487,15 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1613 | driver_info; | 1487 | driver_info; |
1614 | printk(KERN_INFO "HFC-S USB: detected \"%s\"\n", | 1488 | printk(KERN_INFO "HFC-S USB: detected \"%s\"\n", |
1615 | driver_info->vend_name); | 1489 | driver_info->vend_name); |
1616 | #ifdef CONFIG_HISAX_DEBUG | 1490 | |
1617 | DBG(USB_DBG, | 1491 | DBG(HFCUSB_DBG_INIT, |
1618 | "HFC-S USB: Endpoint-Config: %s (if=%d alt=%d)\n", | 1492 | "HFC-S USB: Endpoint-Config: %s (if=%d alt=%d), E-Channel(%d)", |
1619 | conf_str[small_match], context->if_used, | 1493 | conf_str[small_match], context->if_used, |
1620 | context->alt_used); | 1494 | context->alt_used, |
1621 | printk(KERN_INFO | 1495 | validconf[small_match][18]); |
1622 | "HFC-S USB: E-channel (\"ECHO:\") logging "); | 1496 | |
1623 | if (validconf[small_match][18]) | ||
1624 | printk(" possible\n"); | ||
1625 | else | ||
1626 | printk("NOT possible\n"); | ||
1627 | #endif | ||
1628 | /* init the chip and register the driver */ | 1497 | /* init the chip and register the driver */ |
1629 | if (usb_init(context)) { | 1498 | if (hfc_usb_init(context)) { |
1630 | usb_kill_urb(context->ctrl_urb); | 1499 | usb_kill_urb(context->ctrl_urb); |
1631 | usb_free_urb(context->ctrl_urb); | 1500 | usb_free_urb(context->ctrl_urb); |
1632 | context->ctrl_urb = NULL; | 1501 | context->ctrl_urb = NULL; |
@@ -1643,17 +1512,19 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1643 | return (-EIO); | 1512 | return (-EIO); |
1644 | } | 1513 | } |
1645 | 1514 | ||
1646 | /****************************************************/ | 1515 | /* callback for unplugged USB device */ |
1647 | /* function called when an active device is removed */ | ||
1648 | /****************************************************/ | ||
1649 | static void | 1516 | static void |
1650 | hfc_usb_disconnect(struct usb_interface | 1517 | hfc_usb_disconnect(struct usb_interface |
1651 | *intf) | 1518 | *intf) |
1652 | { | 1519 | { |
1653 | hfcusb_data *context = usb_get_intfdata(intf); | 1520 | hfcusb_data *context = usb_get_intfdata(intf); |
1654 | int i; | 1521 | int i; |
1522 | |||
1523 | handle_led(context, LED_POWER_OFF); | ||
1524 | schedule_timeout((10 * HZ) / 1000); | ||
1525 | |||
1655 | printk(KERN_INFO "HFC-S USB: device disconnect\n"); | 1526 | printk(KERN_INFO "HFC-S USB: device disconnect\n"); |
1656 | context->disc_flag = true; | 1527 | context->disc_flag = 1; |
1657 | usb_set_intfdata(intf, NULL); | 1528 | usb_set_intfdata(intf, NULL); |
1658 | if (!context) | 1529 | if (!context) |
1659 | return; | 1530 | return; |
@@ -1661,25 +1532,22 @@ hfc_usb_disconnect(struct usb_interface | |||
1661 | del_timer(&context->t3_timer); | 1532 | del_timer(&context->t3_timer); |
1662 | if (timer_pending(&context->t4_timer)) | 1533 | if (timer_pending(&context->t4_timer)) |
1663 | del_timer(&context->t4_timer); | 1534 | del_timer(&context->t4_timer); |
1535 | |||
1664 | /* tell all fifos to terminate */ | 1536 | /* tell all fifos to terminate */ |
1665 | for (i = 0; i < HFCUSB_NUM_FIFOS; i++) { | 1537 | for (i = 0; i < HFCUSB_NUM_FIFOS; i++) { |
1666 | if (context->fifos[i].usb_transfer_mode == USB_ISOC) { | 1538 | if (context->fifos[i].usb_transfer_mode == USB_ISOC) { |
1667 | if (context->fifos[i].active > 0) { | 1539 | if (context->fifos[i].active > 0) { |
1668 | stop_isoc_chain(&context->fifos[i]); | 1540 | stop_isoc_chain(&context->fifos[i]); |
1669 | #ifdef CONFIG_HISAX_DEBUG | 1541 | DBG(HFCUSB_DBG_INIT, |
1670 | DBG(USB_DBG, | 1542 | "HFC-S USB: %s stopping ISOC chain Fifo(%i)", |
1671 | "HFC-S USB: hfc_usb_disconnect: stopping ISOC chain Fifo no %i", | 1543 | __FUNCTION__, i); |
1672 | i); | ||
1673 | #endif | ||
1674 | } | 1544 | } |
1675 | } else { | 1545 | } else { |
1676 | if (context->fifos[i].active > 0) { | 1546 | if (context->fifos[i].active > 0) { |
1677 | context->fifos[i].active = 0; | 1547 | context->fifos[i].active = 0; |
1678 | #ifdef CONFIG_HISAX_DEBUG | 1548 | DBG(HFCUSB_DBG_INIT, |
1679 | DBG(USB_DBG, | 1549 | "HFC-S USB: %s unlinking URB for Fifo(%i)", |
1680 | "HFC-S USB: hfc_usb_disconnect: unlinking URB for Fifo no %i", | 1550 | __FUNCTION__, i); |
1681 | i); | ||
1682 | #endif | ||
1683 | } | 1551 | } |
1684 | usb_kill_urb(context->fifos[i].urb); | 1552 | usb_kill_urb(context->fifos[i].urb); |
1685 | usb_free_urb(context->fifos[i].urb); | 1553 | usb_free_urb(context->fifos[i].urb); |
@@ -1692,34 +1560,29 @@ hfc_usb_disconnect(struct usb_interface | |||
1692 | context->ctrl_urb = NULL; | 1560 | context->ctrl_urb = NULL; |
1693 | hisax_unregister(&context->d_if); | 1561 | hisax_unregister(&context->d_if); |
1694 | kfree(context); /* free our structure again */ | 1562 | kfree(context); /* free our structure again */ |
1695 | } /* hfc_usb_disconnect */ | 1563 | } |
1696 | 1564 | ||
1697 | /************************************/ | ||
1698 | /* our driver information structure */ | ||
1699 | /************************************/ | ||
1700 | static struct usb_driver hfc_drv = { | 1565 | static struct usb_driver hfc_drv = { |
1701 | .name = "hfc_usb", | 1566 | .name = "hfc_usb", |
1702 | .id_table = hfcusb_idtab, | 1567 | .id_table = hfcusb_idtab, |
1703 | .probe = hfc_usb_probe, | 1568 | .probe = hfc_usb_probe, |
1704 | .disconnect = hfc_usb_disconnect, | 1569 | .disconnect = hfc_usb_disconnect, |
1705 | }; | 1570 | }; |
1571 | |||
1706 | static void __exit | 1572 | static void __exit |
1707 | hfc_usb_exit(void) | 1573 | hfc_usb_mod_exit(void) |
1708 | { | 1574 | { |
1709 | #ifdef CONFIG_HISAX_DEBUG | 1575 | usb_deregister(&hfc_drv); /* release our driver */ |
1710 | DBG(USB_DBG, "HFC-S USB: calling \"hfc_usb_exit\" ..."); | ||
1711 | #endif | ||
1712 | usb_deregister(&hfc_drv); /* release our driver */ | ||
1713 | printk(KERN_INFO "HFC-S USB: module removed\n"); | 1576 | printk(KERN_INFO "HFC-S USB: module removed\n"); |
1714 | } | 1577 | } |
1715 | 1578 | ||
1716 | static int __init | 1579 | static int __init |
1717 | hfc_usb_init(void) | 1580 | hfc_usb_mod_init(void) |
1718 | { | 1581 | { |
1582 | char revstr[30], datestr[30], dummy[30]; | ||
1719 | #ifndef CONFIG_HISAX_DEBUG | 1583 | #ifndef CONFIG_HISAX_DEBUG |
1720 | unsigned int debug = -1; | 1584 | hfc_debug = debug; |
1721 | #endif | 1585 | #endif |
1722 | char revstr[30], datestr[30], dummy[30]; | ||
1723 | sscanf(hfcusb_revision, | 1586 | sscanf(hfcusb_revision, |
1724 | "%s %s $ %s %s %s $ ", dummy, revstr, | 1587 | "%s %s $ %s %s %s $ ", dummy, revstr, |
1725 | dummy, datestr, dummy); | 1588 | dummy, datestr, dummy); |
@@ -1734,8 +1597,8 @@ hfc_usb_init(void) | |||
1734 | return (0); | 1597 | return (0); |
1735 | } | 1598 | } |
1736 | 1599 | ||
1737 | module_init(hfc_usb_init); | 1600 | module_init(hfc_usb_mod_init); |
1738 | module_exit(hfc_usb_exit); | 1601 | module_exit(hfc_usb_mod_exit); |
1739 | MODULE_AUTHOR(DRIVER_AUTHOR); | 1602 | MODULE_AUTHOR(DRIVER_AUTHOR); |
1740 | MODULE_DESCRIPTION(DRIVER_DESC); | 1603 | MODULE_DESCRIPTION(DRIVER_DESC); |
1741 | MODULE_LICENSE("GPL"); | 1604 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/isdn/hisax/hfc_usb.h b/drivers/isdn/hisax/hfc_usb.h index 471f2354dfde..e79f56568d30 100644 --- a/drivers/isdn/hisax/hfc_usb.h +++ b/drivers/isdn/hisax/hfc_usb.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * hfc_usb.h | 2 | * hfc_usb.h |
3 | * | 3 | * |
4 | * $Id: hfc_usb.h,v 4.2 2005/04/07 15:27:17 martinb1 Exp $ | 4 | * $Id: hfc_usb.h,v 1.1.2.5 2007/08/20 14:36:03 mbachem Exp $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __HFC_USB_H__ | 7 | #ifndef __HFC_USB_H__ |
8 | #define __HFC_USB_H__ | 8 | #define __HFC_USB_H__ |
@@ -10,25 +10,20 @@ | |||
10 | #define DRIVER_AUTHOR "Peter Sprenger (sprenger@moving-byters.de)" | 10 | #define DRIVER_AUTHOR "Peter Sprenger (sprenger@moving-byters.de)" |
11 | #define DRIVER_DESC "HFC-S USB based HiSAX ISDN driver" | 11 | #define DRIVER_DESC "HFC-S USB based HiSAX ISDN driver" |
12 | 12 | ||
13 | #define VERBOSE_USB_DEBUG | ||
14 | 13 | ||
14 | #define HFC_CTRL_TIMEOUT 20 /* 5ms timeout writing/reading regs */ | ||
15 | #define HFC_TIMER_T3 8000 /* timeout for l1 activation timer */ | ||
16 | #define HFC_TIMER_T4 500 /* time for state change interval */ | ||
15 | 17 | ||
16 | /***********/ | 18 | #define HFCUSB_L1_STATECHANGE 0 /* L1 state changed */ |
17 | /* defines */ | 19 | #define HFCUSB_L1_DRX 1 /* D-frame received */ |
18 | /***********/ | 20 | #define HFCUSB_L1_ERX 2 /* E-frame received */ |
19 | #define HFC_CTRL_TIMEOUT 20 /* 5ms timeout writing/reading regs */ | 21 | #define HFCUSB_L1_DTX 4 /* D-frames completed */ |
20 | #define HFC_TIMER_T3 8000 /* timeout for l1 activation timer */ | ||
21 | #define HFC_TIMER_T4 500 /* time for state change interval */ | ||
22 | 22 | ||
23 | #define HFCUSB_L1_STATECHANGE 0 /* L1 state changed */ | 23 | #define MAX_BCH_SIZE 2048 /* allowed B-channel packet size */ |
24 | #define HFCUSB_L1_DRX 1 /* D-frame received */ | ||
25 | #define HFCUSB_L1_ERX 2 /* E-frame received */ | ||
26 | #define HFCUSB_L1_DTX 4 /* D-frames completed */ | ||
27 | 24 | ||
28 | #define MAX_BCH_SIZE 2048 /* allowed B-channel packet size */ | 25 | #define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */ |
29 | 26 | #define HFCUSB_TX_THRESHOLD 64 /* threshold for fifo report bit tx */ | |
30 | #define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */ | ||
31 | #define HFCUSB_TX_THRESHOLD 64 /* threshold for fifo report bit tx */ | ||
32 | 27 | ||
33 | #define HFCUSB_CHIP_ID 0x16 /* Chip ID register index */ | 28 | #define HFCUSB_CHIP_ID 0x16 /* Chip ID register index */ |
34 | #define HFCUSB_CIRM 0x00 /* cirm register index */ | 29 | #define HFCUSB_CIRM 0x00 /* cirm register index */ |
@@ -52,9 +47,8 @@ | |||
52 | 47 | ||
53 | #define HFCUSB_CHIPID 0x40 /* ID value of HFC-S USB */ | 48 | #define HFCUSB_CHIPID 0x40 /* ID value of HFC-S USB */ |
54 | 49 | ||
55 | /******************/ | 50 | |
56 | /* fifo registers */ | 51 | /* fifo registers */ |
57 | /******************/ | ||
58 | #define HFCUSB_NUM_FIFOS 8 /* maximum number of fifos */ | 52 | #define HFCUSB_NUM_FIFOS 8 /* maximum number of fifos */ |
59 | #define HFCUSB_B1_TX 0 /* index for B1 transmit bulk/int */ | 53 | #define HFCUSB_B1_TX 0 /* index for B1 transmit bulk/int */ |
60 | #define HFCUSB_B1_RX 1 /* index for B1 receive bulk/int */ | 54 | #define HFCUSB_B1_RX 1 /* index for B1 receive bulk/int */ |
@@ -66,9 +60,9 @@ | |||
66 | #define HFCUSB_PCM_RX 7 | 60 | #define HFCUSB_PCM_RX 7 |
67 | 61 | ||
68 | /* | 62 | /* |
69 | * used to switch snd_transfer_mode for different TA modes e.g. the Billion USB TA just | 63 | * used to switch snd_transfer_mode for different TA modes e.g. the Billion USB TA just |
70 | * supports ISO out, while the Cologne Chip EVAL TA just supports BULK out | 64 | * supports ISO out, while the Cologne Chip EVAL TA just supports BULK out |
71 | */ | 65 | */ |
72 | #define USB_INT 0 | 66 | #define USB_INT 0 |
73 | #define USB_BULK 1 | 67 | #define USB_BULK 1 |
74 | #define USB_ISOC 2 | 68 | #define USB_ISOC 2 |
@@ -77,49 +71,36 @@ | |||
77 | #define ISOC_PACKETS_B 8 | 71 | #define ISOC_PACKETS_B 8 |
78 | #define ISO_BUFFER_SIZE 128 | 72 | #define ISO_BUFFER_SIZE 128 |
79 | 73 | ||
80 | // ISO send definitions | 74 | /* Fifo flow Control for TX ISO */ |
81 | #define SINK_MAX 68 | 75 | #define SINK_MAX 68 |
82 | #define SINK_MIN 48 | 76 | #define SINK_MIN 48 |
83 | #define SINK_DMIN 12 | 77 | #define SINK_DMIN 12 |
84 | #define SINK_DMAX 18 | 78 | #define SINK_DMAX 18 |
85 | #define BITLINE_INF (-64*8) | 79 | #define BITLINE_INF (-64*8) |
86 | 80 | ||
87 | 81 | /* HFC-S USB register access by Control-URSs */ | |
88 | /**********/ | ||
89 | /* macros */ | ||
90 | /**********/ | ||
91 | #define write_usb(a,b,c)usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),NULL,0,HFC_CTRL_TIMEOUT) | 82 | #define write_usb(a,b,c)usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),NULL,0,HFC_CTRL_TIMEOUT) |
92 | #define read_usb(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT) | 83 | #define read_usb(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT) |
93 | |||
94 | |||
95 | /*******************/ | ||
96 | /* Debugging Flags */ | ||
97 | /*******************/ | ||
98 | #define USB_DBG 1 | ||
99 | #define ISDN_DBG 2 | ||
100 | |||
101 | |||
102 | /* *********************/ | ||
103 | /* USB related defines */ | ||
104 | /***********************/ | ||
105 | #define HFC_CTRL_BUFSIZE 32 | 84 | #define HFC_CTRL_BUFSIZE 32 |
106 | 85 | ||
107 | |||
108 | |||
109 | /*************************************************/ | ||
110 | /* entry and size of output/input control buffer */ | 86 | /* entry and size of output/input control buffer */ |
111 | /*************************************************/ | ||
112 | typedef struct { | 87 | typedef struct { |
113 | __u8 hfc_reg; /* register number */ | 88 | __u8 hfc_reg; /* register number */ |
114 | __u8 reg_val; /* value to be written (or read) */ | 89 | __u8 reg_val; /* value to be written (or read) */ |
115 | int action; /* data for action handler */ | 90 | int action; /* data for action handler */ |
116 | } ctrl_buft; | 91 | } ctrl_buft; |
117 | 92 | ||
93 | /* Debugging Flags */ | ||
94 | #define HFCUSB_DBG_INIT 0x0001 | ||
95 | #define HFCUSB_DBG_STATES 0x0002 | ||
96 | #define HFCUSB_DBG_DCHANNEL 0x0080 | ||
97 | #define HFCUSB_DBG_FIFO_ERR 0x4000 | ||
98 | #define HFCUSB_DBG_VERBOSE_USB 0x8000 | ||
118 | 99 | ||
119 | /********************/ | 100 | /* |
120 | /* URB error codes: */ | 101 | * URB error codes: |
121 | /********************/ | 102 | * Used to represent a list of values and their respective symbolic names |
122 | /* Used to represent a list of values and their respective symbolic names */ | 103 | */ |
123 | struct hfcusb_symbolic_list { | 104 | struct hfcusb_symbolic_list { |
124 | const int num; | 105 | const int num; |
125 | const char *name; | 106 | const char *name; |
@@ -134,20 +115,20 @@ static struct hfcusb_symbolic_list urb_errlist[] = { | |||
134 | {-ENXIO, "URB already queued"}, | 115 | {-ENXIO, "URB already queued"}, |
135 | {-EFBIG, "Too much ISO frames requested"}, | 116 | {-EFBIG, "Too much ISO frames requested"}, |
136 | {-ENOSR, "Buffer error (overrun)"}, | 117 | {-ENOSR, "Buffer error (overrun)"}, |
137 | {-EPIPE, "Specified endpoint is stalled"}, | 118 | {-EPIPE, "Specified endpoint is stalled (device not responding)"}, |
138 | {-EOVERFLOW, "Babble (bad cable?)"}, | 119 | {-EOVERFLOW, "Babble (bad cable?)"}, |
139 | {-EPROTO, "Bit-stuff error (bad cable?)"}, | 120 | {-EPROTO, "Bit-stuff error (bad cable?)"}, |
140 | {-EILSEQ, "CRC or missing token"}, | 121 | {-EILSEQ, "CRC/Timeout"}, |
141 | {-ETIME, "Device did not respond"}, | 122 | {-ETIMEDOUT, "NAK (device does not respond)"}, |
142 | {-ESHUTDOWN, "Device unplugged"}, | 123 | {-ESHUTDOWN, "Device unplugged"}, |
143 | {-1, NULL} | 124 | {-1, NULL} |
144 | }; | 125 | }; |
145 | 126 | ||
146 | 127 | ||
147 | /*****************************************************/ | 128 | /* |
148 | /* device dependant information to support different */ | 129 | * device dependant information to support different |
149 | /* ISDN Ta's using the HFC-S USB chip */ | 130 | * ISDN Ta's using the HFC-S USB chip |
150 | /*****************************************************/ | 131 | */ |
151 | 132 | ||
152 | /* USB descriptor need to contain one of the following EndPoint combination: */ | 133 | /* USB descriptor need to contain one of the following EndPoint combination: */ |
153 | #define CNF_4INT3ISO 1 // 4 INT IN, 3 ISO OUT | 134 | #define CNF_4INT3ISO 1 // 4 INT IN, 3 ISO OUT |
@@ -155,16 +136,19 @@ static struct hfcusb_symbolic_list urb_errlist[] = { | |||
155 | #define CNF_4ISO3ISO 3 // 4 ISO IN, 3 ISO OUT | 136 | #define CNF_4ISO3ISO 3 // 4 ISO IN, 3 ISO OUT |
156 | #define CNF_3ISO3ISO 4 // 3 ISO IN, 3 ISO OUT | 137 | #define CNF_3ISO3ISO 4 // 3 ISO IN, 3 ISO OUT |
157 | 138 | ||
158 | #define EP_NUL 1 // Endpoint at this position not allowed | 139 | #define EP_NUL 1 // Endpoint at this position not allowed |
159 | #define EP_NOP 2 // all type of endpoints allowed at this position | 140 | #define EP_NOP 2 // all type of endpoints allowed at this position |
160 | #define EP_ISO 3 // Isochron endpoint mandatory at this position | 141 | #define EP_ISO 3 // Isochron endpoint mandatory at this position |
161 | #define EP_BLK 4 // Bulk endpoint mandatory at this position | 142 | #define EP_BLK 4 // Bulk endpoint mandatory at this position |
162 | #define EP_INT 5 // Interrupt endpoint mandatory at this position | 143 | #define EP_INT 5 // Interrupt endpoint mandatory at this position |
163 | 144 | ||
164 | /* this array represents all endpoints possible in the HCF-USB the last | 145 | /* |
165 | * 3 entries are the configuration number, the minimum interval for | 146 | * List of all supported endpoint configuration sets, used to find the |
166 | * Interrupt endpoints & boolean if E-channel logging possible | 147 | * best matching endpoint configuration within a devices' USB descriptor. |
167 | */ | 148 | * We need at least 3 RX endpoints, and 3 TX endpoints, either |
149 | * INT-in and ISO-out, or ISO-in and ISO-out) | ||
150 | * with 4 RX endpoints even E-Channel logging is possible | ||
151 | */ | ||
168 | static int validconf[][19] = { | 152 | static int validconf[][19] = { |
169 | // INT in, ISO out config | 153 | // INT in, ISO out config |
170 | {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT, | 154 | {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT, |
@@ -193,7 +177,6 @@ static char *conf_str[] = { | |||
193 | }; | 177 | }; |
194 | #endif | 178 | #endif |
195 | 179 | ||
196 | |||
197 | typedef struct { | 180 | typedef struct { |
198 | int vendor; // vendor id | 181 | int vendor; // vendor id |
199 | int prod_id; // product id | 182 | int prod_id; // product id |
@@ -202,9 +185,9 @@ typedef struct { | |||
202 | signed short led_bits[8]; // array of 8 possible LED bitmask settings | 185 | signed short led_bits[8]; // array of 8 possible LED bitmask settings |
203 | } vendor_data; | 186 | } vendor_data; |
204 | 187 | ||
205 | #define LED_OFF 0 // no LED support | 188 | #define LED_OFF 0 // no LED support |
206 | #define LED_SCHEME1 1 // LED standard scheme | 189 | #define LED_SCHEME1 1 // LED standard scheme |
207 | #define LED_SCHEME2 2 // not used yet... | 190 | #define LED_SCHEME2 2 // not used yet... |
208 | 191 | ||
209 | #define LED_POWER_ON 1 | 192 | #define LED_POWER_ON 1 |
210 | #define LED_POWER_OFF 2 | 193 | #define LED_POWER_OFF 2 |
@@ -217,11 +200,8 @@ typedef struct { | |||
217 | #define LED_B2_OFF 9 | 200 | #define LED_B2_OFF 9 |
218 | #define LED_B2_DATA 10 | 201 | #define LED_B2_DATA 10 |
219 | 202 | ||
220 | #define LED_NORMAL 0 // LEDs are normal | 203 | #define LED_NORMAL 0 // LEDs are normal |
221 | #define LED_INVERTED 1 // LEDs are inverted | 204 | #define LED_INVERTED 1 // LEDs are inverted |
222 | |||
223 | /* time in ms to perform a Flashing LED when B-Channel has traffic */ | ||
224 | #define LED_TIME 250 | ||
225 | 205 | ||
226 | 206 | ||
227 | #endif // __HFC_USB_H__ | 207 | #endif // __HFC_USB_H__ |
diff --git a/drivers/kvm/Kconfig b/drivers/kvm/Kconfig index 6cecc396e040..7b64fd4aa2f3 100644 --- a/drivers/kvm/Kconfig +++ b/drivers/kvm/Kconfig | |||
@@ -5,6 +5,11 @@ menuconfig VIRTUALIZATION | |||
5 | bool "Virtualization" | 5 | bool "Virtualization" |
6 | depends on X86 | 6 | depends on X86 |
7 | default y | 7 | default y |
8 | ---help--- | ||
9 | Say Y here to get to see options for virtualization guest drivers. | ||
10 | This option alone does not add any kernel code. | ||
11 | |||
12 | If you say N, all options in this submenu will be skipped and disabled. | ||
8 | 13 | ||
9 | if VIRTUALIZATION | 14 | if VIRTUALIZATION |
10 | 15 | ||
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 96856097d15b..cd0557954e50 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -2974,6 +2974,10 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val, | |||
2974 | switch (val) { | 2974 | switch (val) { |
2975 | case CPU_DYING: | 2975 | case CPU_DYING: |
2976 | case CPU_DYING_FROZEN: | 2976 | case CPU_DYING_FROZEN: |
2977 | printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n", | ||
2978 | cpu); | ||
2979 | hardware_disable(NULL); | ||
2980 | break; | ||
2977 | case CPU_UP_CANCELED: | 2981 | case CPU_UP_CANCELED: |
2978 | case CPU_UP_CANCELED_FROZEN: | 2982 | case CPU_UP_CANCELED_FROZEN: |
2979 | printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n", | 2983 | printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n", |
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index 1f979cb0df31..4b8a0cc9665e 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c | |||
@@ -1217,11 +1217,13 @@ twobyte_insn: | |||
1217 | } | 1217 | } |
1218 | break; | 1218 | break; |
1219 | case 0x21: /* mov from dr to reg */ | 1219 | case 0x21: /* mov from dr to reg */ |
1220 | no_wb = 1; | ||
1220 | if (modrm_mod != 3) | 1221 | if (modrm_mod != 3) |
1221 | goto cannot_emulate; | 1222 | goto cannot_emulate; |
1222 | rc = emulator_get_dr(ctxt, modrm_reg, &_regs[modrm_rm]); | 1223 | rc = emulator_get_dr(ctxt, modrm_reg, &_regs[modrm_rm]); |
1223 | break; | 1224 | break; |
1224 | case 0x23: /* mov from reg to dr */ | 1225 | case 0x23: /* mov from reg to dr */ |
1226 | no_wb = 1; | ||
1225 | if (modrm_mod != 3) | 1227 | if (modrm_mod != 3) |
1226 | goto cannot_emulate; | 1228 | goto cannot_emulate; |
1227 | rc = emulator_set_dr(ctxt, modrm_reg, _regs[modrm_rm]); | 1229 | rc = emulator_set_dr(ctxt, modrm_reg, _regs[modrm_rm]); |
diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig index 888205c3f76b..fd6925f41647 100644 --- a/drivers/lguest/Kconfig +++ b/drivers/lguest/Kconfig | |||
@@ -21,8 +21,10 @@ config LGUEST_GUEST | |||
21 | 21 | ||
22 | config LGUEST_NET | 22 | config LGUEST_NET |
23 | tristate | 23 | tristate |
24 | default y | ||
24 | depends on LGUEST_GUEST && NET | 25 | depends on LGUEST_GUEST && NET |
25 | 26 | ||
26 | config LGUEST_BLOCK | 27 | config LGUEST_BLOCK |
27 | tristate | 28 | tristate |
29 | default y | ||
28 | depends on LGUEST_GUEST && BLOCK | 30 | depends on LGUEST_GUEST && BLOCK |
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c index 0a46e8837d9a..4a315f08a567 100644 --- a/drivers/lguest/core.c +++ b/drivers/lguest/core.c | |||
@@ -453,6 +453,11 @@ static void run_guest_once(struct lguest *lg, struct lguest_pages *pages) | |||
453 | * lguest_pages". */ | 453 | * lguest_pages". */ |
454 | copy_in_guest_info(lg, pages); | 454 | copy_in_guest_info(lg, pages); |
455 | 455 | ||
456 | /* Set the trap number to 256 (impossible value). If we fault while | ||
457 | * switching to the Guest (bad segment registers or bug), this will | ||
458 | * cause us to abort the Guest. */ | ||
459 | lg->regs->trapnum = 256; | ||
460 | |||
456 | /* Now: we push the "eflags" register on the stack, then do an "lcall". | 461 | /* Now: we push the "eflags" register on the stack, then do an "lcall". |
457 | * This is how we change from using the kernel code segment to using | 462 | * This is how we change from using the kernel code segment to using |
458 | * the dedicated lguest code segment, as well as jumping into the | 463 | * the dedicated lguest code segment, as well as jumping into the |
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c index 49787e964a0d..49aa55577d0d 100644 --- a/drivers/lguest/interrupts_and_traps.c +++ b/drivers/lguest/interrupts_and_traps.c | |||
@@ -195,13 +195,16 @@ static int has_err(unsigned int trap) | |||
195 | /* deliver_trap() returns true if it could deliver the trap. */ | 195 | /* deliver_trap() returns true if it could deliver the trap. */ |
196 | int deliver_trap(struct lguest *lg, unsigned int num) | 196 | int deliver_trap(struct lguest *lg, unsigned int num) |
197 | { | 197 | { |
198 | u32 lo = lg->idt[num].a, hi = lg->idt[num].b; | 198 | /* Trap numbers are always 8 bit, but we set an impossible trap number |
199 | * for traps inside the Switcher, so check that here. */ | ||
200 | if (num >= ARRAY_SIZE(lg->idt)) | ||
201 | return 0; | ||
199 | 202 | ||
200 | /* Early on the Guest hasn't set the IDT entries (or maybe it put a | 203 | /* Early on the Guest hasn't set the IDT entries (or maybe it put a |
201 | * bogus one in): if we fail here, the Guest will be killed. */ | 204 | * bogus one in): if we fail here, the Guest will be killed. */ |
202 | if (!idt_present(lo, hi)) | 205 | if (!idt_present(lg->idt[num].a, lg->idt[num].b)) |
203 | return 0; | 206 | return 0; |
204 | set_guest_interrupt(lg, lo, hi, has_err(num)); | 207 | set_guest_interrupt(lg, lg->idt[num].a, lg->idt[num].b, has_err(num)); |
205 | return 1; | 208 | return 1; |
206 | } | 209 | } |
207 | 210 | ||
diff --git a/drivers/lguest/lguest.c b/drivers/lguest/lguest.c index 1bc1546c7fd0..6e135ac0834f 100644 --- a/drivers/lguest/lguest.c +++ b/drivers/lguest/lguest.c | |||
@@ -323,9 +323,12 @@ static void lguest_write_gdt_entry(struct desc_struct *dt, | |||
323 | * __thread variables). So we have a hypercall specifically for this case. */ | 323 | * __thread variables). So we have a hypercall specifically for this case. */ |
324 | static void lguest_load_tls(struct thread_struct *t, unsigned int cpu) | 324 | static void lguest_load_tls(struct thread_struct *t, unsigned int cpu) |
325 | { | 325 | { |
326 | /* There's one problem which normal hardware doesn't have: the Host | ||
327 | * can't handle us removing entries we're currently using. So we clear | ||
328 | * the GS register here: if it's needed it'll be reloaded anyway. */ | ||
329 | loadsegment(gs, 0); | ||
326 | lazy_hcall(LHCALL_LOAD_TLS, __pa(&t->tls_array), cpu, 0); | 330 | lazy_hcall(LHCALL_LOAD_TLS, __pa(&t->tls_array), cpu, 0); |
327 | } | 331 | } |
328 | /*:*/ | ||
329 | 332 | ||
330 | /*G:038 That's enough excitement for now, back to ploughing through each of | 333 | /*G:038 That's enough excitement for now, back to ploughing through each of |
331 | * the paravirt_ops (we're about 1/3 of the way through). | 334 | * the paravirt_ops (we're about 1/3 of the way through). |
@@ -687,7 +690,8 @@ static struct clocksource lguest_clock = { | |||
687 | .rating = 400, | 690 | .rating = 400, |
688 | .read = lguest_clock_read, | 691 | .read = lguest_clock_read, |
689 | .mask = CLOCKSOURCE_MASK(64), | 692 | .mask = CLOCKSOURCE_MASK(64), |
690 | .mult = 1, | 693 | .mult = 1 << 22, |
694 | .shift = 22, | ||
691 | }; | 695 | }; |
692 | 696 | ||
693 | /* The "scheduler clock" is just our real clock, adjusted to start at zero */ | 697 | /* The "scheduler clock" is just our real clock, adjusted to start at zero */ |
@@ -770,7 +774,6 @@ static void lguest_time_init(void) | |||
770 | * way, the "rating" is initialized so high that it's always chosen | 774 | * way, the "rating" is initialized so high that it's always chosen |
771 | * over any other clocksource. */ | 775 | * over any other clocksource. */ |
772 | if (lguest_data.tsc_khz) { | 776 | if (lguest_data.tsc_khz) { |
773 | lguest_clock.shift = 22; | ||
774 | lguest_clock.mult = clocksource_khz2mult(lguest_data.tsc_khz, | 777 | lguest_clock.mult = clocksource_khz2mult(lguest_data.tsc_khz, |
775 | lguest_clock.shift); | 778 | lguest_clock.shift); |
776 | lguest_clock.flags = CLOCK_SOURCE_IS_CONTINUOUS; | 779 | lguest_clock.flags = CLOCK_SOURCE_IS_CONTINUOUS; |
@@ -933,23 +936,24 @@ static const struct lguest_insns | |||
933 | /* Now our patch routine is fairly simple (based on the native one in | 936 | /* Now our patch routine is fairly simple (based on the native one in |
934 | * paravirt.c). If we have a replacement, we copy it in and return how much of | 937 | * paravirt.c). If we have a replacement, we copy it in and return how much of |
935 | * the available space we used. */ | 938 | * the available space we used. */ |
936 | static unsigned lguest_patch(u8 type, u16 clobber, void *insns, unsigned len) | 939 | static unsigned lguest_patch(u8 type, u16 clobber, void *ibuf, |
940 | unsigned long addr, unsigned len) | ||
937 | { | 941 | { |
938 | unsigned int insn_len; | 942 | unsigned int insn_len; |
939 | 943 | ||
940 | /* Don't do anything special if we don't have a replacement */ | 944 | /* Don't do anything special if we don't have a replacement */ |
941 | if (type >= ARRAY_SIZE(lguest_insns) || !lguest_insns[type].start) | 945 | if (type >= ARRAY_SIZE(lguest_insns) || !lguest_insns[type].start) |
942 | return paravirt_patch_default(type, clobber, insns, len); | 946 | return paravirt_patch_default(type, clobber, ibuf, addr, len); |
943 | 947 | ||
944 | insn_len = lguest_insns[type].end - lguest_insns[type].start; | 948 | insn_len = lguest_insns[type].end - lguest_insns[type].start; |
945 | 949 | ||
946 | /* Similarly if we can't fit replacement (shouldn't happen, but let's | 950 | /* Similarly if we can't fit replacement (shouldn't happen, but let's |
947 | * be thorough). */ | 951 | * be thorough). */ |
948 | if (len < insn_len) | 952 | if (len < insn_len) |
949 | return paravirt_patch_default(type, clobber, insns, len); | 953 | return paravirt_patch_default(type, clobber, ibuf, addr, len); |
950 | 954 | ||
951 | /* Copy in our instructions. */ | 955 | /* Copy in our instructions. */ |
952 | memcpy(insns, lguest_insns[type].start, insn_len); | 956 | memcpy(ibuf, lguest_insns[type].start, insn_len); |
953 | return insn_len; | 957 | return insn_len; |
954 | } | 958 | } |
955 | 959 | ||
diff --git a/drivers/lguest/lguest_bus.c b/drivers/lguest/lguest_bus.c index 55a7940ca732..9e7752cc8002 100644 --- a/drivers/lguest/lguest_bus.c +++ b/drivers/lguest/lguest_bus.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/bootmem.h> | 5 | #include <linux/bootmem.h> |
6 | #include <linux/lguest_bus.h> | 6 | #include <linux/lguest_bus.h> |
7 | #include <asm/io.h> | 7 | #include <asm/io.h> |
8 | #include <asm/paravirt.h> | ||
8 | 9 | ||
9 | static ssize_t type_show(struct device *_dev, | 10 | static ssize_t type_show(struct device *_dev, |
10 | struct device_attribute *attr, char *buf) | 11 | struct device_attribute *attr, char *buf) |
diff --git a/drivers/lguest/segments.c b/drivers/lguest/segments.c index f675a41a80da..9b81119f46e9 100644 --- a/drivers/lguest/segments.c +++ b/drivers/lguest/segments.c | |||
@@ -43,22 +43,6 @@ | |||
43 | * begin. | 43 | * begin. |
44 | */ | 44 | */ |
45 | 45 | ||
46 | /* Is the descriptor the Guest wants us to put in OK? | ||
47 | * | ||
48 | * The flag which Intel says must be zero: must be zero. The descriptor must | ||
49 | * be present, (this is actually checked earlier but is here for thorougness), | ||
50 | * and the descriptor type must be 1 (a memory segment). */ | ||
51 | static int desc_ok(const struct desc_struct *gdt) | ||
52 | { | ||
53 | return ((gdt->b & 0x00209000) == 0x00009000); | ||
54 | } | ||
55 | |||
56 | /* Is the segment present? (Otherwise it can't be used by the Guest). */ | ||
57 | static int segment_present(const struct desc_struct *gdt) | ||
58 | { | ||
59 | return gdt->b & 0x8000; | ||
60 | } | ||
61 | |||
62 | /* There are several entries we don't let the Guest set. The TSS entry is the | 46 | /* There are several entries we don't let the Guest set. The TSS entry is the |
63 | * "Task State Segment" which controls all kinds of delicate things. The | 47 | * "Task State Segment" which controls all kinds of delicate things. The |
64 | * LGUEST_CS and LGUEST_DS entries are reserved for the Switcher, and the | 48 | * LGUEST_CS and LGUEST_DS entries are reserved for the Switcher, and the |
@@ -71,37 +55,11 @@ static int ignored_gdt(unsigned int num) | |||
71 | || num == GDT_ENTRY_DOUBLEFAULT_TSS); | 55 | || num == GDT_ENTRY_DOUBLEFAULT_TSS); |
72 | } | 56 | } |
73 | 57 | ||
74 | /* If the Guest asks us to remove an entry from the GDT, we have to be careful. | 58 | /*H:610 Once the GDT has been changed, we fix the new entries up a little. We |
75 | * If one of the segment registers is pointing at that entry the Switcher will | 59 | * don't care if they're invalid: the worst that can happen is a General |
76 | * crash when it tries to reload the segment registers for the Guest. | 60 | * Protection Fault in the Switcher when it restores a Guest segment register |
77 | * | 61 | * which tries to use that entry. Then we kill the Guest for causing such a |
78 | * It doesn't make much sense for the Guest to try to remove its own code, data | 62 | * mess: the message will be "unhandled trap 256". */ |
79 | * or stack segments while they're in use: assume that's a Guest bug. If it's | ||
80 | * one of the lesser segment registers using the removed entry, we simply set | ||
81 | * that register to 0 (unusable). */ | ||
82 | static void check_segment_use(struct lguest *lg, unsigned int desc) | ||
83 | { | ||
84 | /* GDT entries are 8 bytes long, so we divide to get the index and | ||
85 | * ignore the bottom bits. */ | ||
86 | if (lg->regs->gs / 8 == desc) | ||
87 | lg->regs->gs = 0; | ||
88 | if (lg->regs->fs / 8 == desc) | ||
89 | lg->regs->fs = 0; | ||
90 | if (lg->regs->es / 8 == desc) | ||
91 | lg->regs->es = 0; | ||
92 | if (lg->regs->ds / 8 == desc | ||
93 | || lg->regs->cs / 8 == desc | ||
94 | || lg->regs->ss / 8 == desc) | ||
95 | kill_guest(lg, "Removed live GDT entry %u", desc); | ||
96 | } | ||
97 | /*:*/ | ||
98 | /*M:009 We wouldn't need to check for removal of in-use segments if we handled | ||
99 | * faults in the Switcher. However, it's probably not a worthwhile | ||
100 | * optimization. :*/ | ||
101 | |||
102 | /*H:610 Once the GDT has been changed, we look through the changed entries and | ||
103 | * see if they're OK. If not, we'll call kill_guest() and the Guest will never | ||
104 | * get to use the invalid entries. */ | ||
105 | static void fixup_gdt_table(struct lguest *lg, unsigned start, unsigned end) | 63 | static void fixup_gdt_table(struct lguest *lg, unsigned start, unsigned end) |
106 | { | 64 | { |
107 | unsigned int i; | 65 | unsigned int i; |
@@ -112,16 +70,6 @@ static void fixup_gdt_table(struct lguest *lg, unsigned start, unsigned end) | |||
112 | if (ignored_gdt(i)) | 70 | if (ignored_gdt(i)) |
113 | continue; | 71 | continue; |
114 | 72 | ||
115 | /* We could fault in switch_to_guest if they are using | ||
116 | * a removed segment. */ | ||
117 | if (!segment_present(&lg->gdt[i])) { | ||
118 | check_segment_use(lg, i); | ||
119 | continue; | ||
120 | } | ||
121 | |||
122 | if (!desc_ok(&lg->gdt[i])) | ||
123 | kill_guest(lg, "Bad GDT descriptor %i", i); | ||
124 | |||
125 | /* Segment descriptors contain a privilege level: the Guest is | 73 | /* Segment descriptors contain a privilege level: the Guest is |
126 | * sometimes careless and leaves this as 0, even though it's | 74 | * sometimes careless and leaves this as 0, even though it's |
127 | * running at privilege level 1. If so, we fix it here. */ | 75 | * running at privilege level 1. If so, we fix it here. */ |
diff --git a/drivers/lguest/switcher.S b/drivers/lguest/switcher.S index d418179ea6b5..7c9c230cc845 100644 --- a/drivers/lguest/switcher.S +++ b/drivers/lguest/switcher.S | |||
@@ -47,6 +47,7 @@ | |||
47 | // Down here in the depths of assembler code. | 47 | // Down here in the depths of assembler code. |
48 | #include <linux/linkage.h> | 48 | #include <linux/linkage.h> |
49 | #include <asm/asm-offsets.h> | 49 | #include <asm/asm-offsets.h> |
50 | #include <asm/page.h> | ||
50 | #include "lg.h" | 51 | #include "lg.h" |
51 | 52 | ||
52 | // We mark the start of the code to copy | 53 | // We mark the start of the code to copy |
@@ -182,13 +183,15 @@ ENTRY(switch_to_guest) | |||
182 | movl $(LGUEST_DS), %eax; \ | 183 | movl $(LGUEST_DS), %eax; \ |
183 | movl %eax, %ds; \ | 184 | movl %eax, %ds; \ |
184 | /* So where are we? Which CPU, which struct? \ | 185 | /* So where are we? Which CPU, which struct? \ |
185 | * The stack is our clue: our TSS sets \ | 186 | * The stack is our clue: our TSS starts \ |
186 | * It at the end of "struct lguest_pages" \ | 187 | * It at the end of "struct lguest_pages". \ |
187 | * And we then pushed and pushed and pushed Guest regs: \ | 188 | * Or we may have stumbled while restoring \ |
188 | * Now stack points atop the "struct lguest_regs". \ | 189 | * Our Guest segment regs while in switch_to_guest, \ |
189 | * Subtract that offset, and we find our struct. */ \ | 190 | * The fault pushed atop that part-unwound stack. \ |
191 | * If we round the stack down to the page start \ | ||
192 | * We're at the start of "struct lguest_pages". */ \ | ||
190 | movl %esp, %eax; \ | 193 | movl %esp, %eax; \ |
191 | subl $LGUEST_PAGES_regs, %eax; \ | 194 | andl $(~(1 << PAGE_SHIFT - 1)), %eax; \ |
192 | /* Save our trap number: the switch will obscure it \ | 195 | /* Save our trap number: the switch will obscure it \ |
193 | * (The Guest regs are not mapped here in the Host) \ | 196 | * (The Guest regs are not mapped here in the Host) \ |
194 | * %ebx holds it safe for deliver_to_host */ \ | 197 | * %ebx holds it safe for deliver_to_host */ \ |
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index dbe96268866e..56cd8998fe4b 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig | |||
@@ -3,6 +3,11 @@ menuconfig MACINTOSH_DRIVERS | |||
3 | bool "Macintosh device drivers" | 3 | bool "Macintosh device drivers" |
4 | depends on PPC || MAC || X86 | 4 | depends on PPC || MAC || X86 |
5 | default y if (PPC_PMAC || MAC) | 5 | default y if (PPC_PMAC || MAC) |
6 | ---help--- | ||
7 | Say Y here to get to see options for devices used with Macintosh | ||
8 | computers. This option alone does not add any kernel code. | ||
9 | |||
10 | If you say N, all options in this submenu will be skipped and disabled. | ||
6 | 11 | ||
7 | if MACINTOSH_DRIVERS | 12 | if MACINTOSH_DRIVERS |
8 | 13 | ||
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c index 76c1e8e4a487..33dee3a773ed 100644 --- a/drivers/macintosh/mac_hid.c +++ b/drivers/macintosh/mac_hid.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/sysctl.h> | 13 | #include <linux/sysctl.h> |
14 | #include <linux/input.h> | 14 | #include <linux/input.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/kbd_kern.h> | ||
16 | 17 | ||
17 | 18 | ||
18 | static struct input_dev *emumousebtn; | 19 | static struct input_dev *emumousebtn; |
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c index dfdf11c1eec4..e2f84da09e7c 100644 --- a/drivers/macintosh/via-pmu68k.c +++ b/drivers/macintosh/via-pmu68k.c | |||
@@ -818,243 +818,3 @@ pmu_present(void) | |||
818 | { | 818 | { |
819 | return (pmu_kind != PMU_UNKNOWN); | 819 | return (pmu_kind != PMU_UNKNOWN); |
820 | } | 820 | } |
821 | |||
822 | #if 0 /* needs some work for 68K */ | ||
823 | |||
824 | /* | ||
825 | * This struct is used to store config register values for | ||
826 | * PCI devices which may get powered off when we sleep. | ||
827 | */ | ||
828 | static struct pci_save { | ||
829 | u16 command; | ||
830 | u16 cache_lat; | ||
831 | u16 intr; | ||
832 | } *pbook_pci_saves; | ||
833 | static int n_pbook_pci_saves; | ||
834 | |||
835 | static inline void | ||
836 | pbook_pci_save(void) | ||
837 | { | ||
838 | int npci; | ||
839 | struct pci_dev *pd = NULL; | ||
840 | struct pci_save *ps; | ||
841 | |||
842 | npci = 0; | ||
843 | while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) | ||
844 | ++npci; | ||
845 | n_pbook_pci_saves = npci; | ||
846 | if (npci == 0) | ||
847 | return; | ||
848 | ps = kmalloc(npci * sizeof(*ps), GFP_KERNEL); | ||
849 | pbook_pci_saves = ps; | ||
850 | if (ps == NULL) | ||
851 | return; | ||
852 | |||
853 | pd = NULL; | ||
854 | while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { | ||
855 | pci_read_config_word(pd, PCI_COMMAND, &ps->command); | ||
856 | pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat); | ||
857 | pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr); | ||
858 | ++ps; | ||
859 | --npci; | ||
860 | } | ||
861 | } | ||
862 | |||
863 | static inline void | ||
864 | pbook_pci_restore(void) | ||
865 | { | ||
866 | u16 cmd; | ||
867 | struct pci_save *ps = pbook_pci_saves; | ||
868 | struct pci_dev *pd = NULL; | ||
869 | int j; | ||
870 | |||
871 | while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { | ||
872 | if (ps->command == 0) | ||
873 | continue; | ||
874 | pci_read_config_word(pd, PCI_COMMAND, &cmd); | ||
875 | if ((ps->command & ~cmd) == 0) | ||
876 | continue; | ||
877 | switch (pd->hdr_type) { | ||
878 | case PCI_HEADER_TYPE_NORMAL: | ||
879 | for (j = 0; j < 6; ++j) | ||
880 | pci_write_config_dword(pd, | ||
881 | PCI_BASE_ADDRESS_0 + j*4, | ||
882 | pd->resource[j].start); | ||
883 | pci_write_config_dword(pd, PCI_ROM_ADDRESS, | ||
884 | pd->resource[PCI_ROM_RESOURCE].start); | ||
885 | pci_write_config_word(pd, PCI_CACHE_LINE_SIZE, | ||
886 | ps->cache_lat); | ||
887 | pci_write_config_word(pd, PCI_INTERRUPT_LINE, | ||
888 | ps->intr); | ||
889 | pci_write_config_word(pd, PCI_COMMAND, ps->command); | ||
890 | break; | ||
891 | /* other header types not restored at present */ | ||
892 | } | ||
893 | } | ||
894 | } | ||
895 | |||
896 | /* | ||
897 | * Put the powerbook to sleep. | ||
898 | */ | ||
899 | #define IRQ_ENABLE ((unsigned int *)0xf3000024) | ||
900 | #define MEM_CTRL ((unsigned int *)0xf8000070) | ||
901 | |||
902 | int powerbook_sleep(void) | ||
903 | { | ||
904 | int ret, i, x; | ||
905 | static int save_backlight; | ||
906 | static unsigned int save_irqen; | ||
907 | unsigned long msr; | ||
908 | unsigned int hid0; | ||
909 | unsigned long p, wait; | ||
910 | struct adb_request sleep_req; | ||
911 | |||
912 | /* Notify device drivers */ | ||
913 | ret = blocking_notifier_call_chain(&sleep_notifier_list, | ||
914 | PBOOK_SLEEP, NULL); | ||
915 | if (ret & NOTIFY_STOP_MASK) | ||
916 | return -EBUSY; | ||
917 | |||
918 | /* Sync the disks. */ | ||
919 | /* XXX It would be nice to have some way to ensure that | ||
920 | * nobody is dirtying any new buffers while we wait. */ | ||
921 | sys_sync(); | ||
922 | |||
923 | /* Turn off the display backlight */ | ||
924 | save_backlight = backlight_enabled; | ||
925 | if (save_backlight) | ||
926 | pmu_enable_backlight(0); | ||
927 | |||
928 | /* Give the disks a little time to actually finish writing */ | ||
929 | for (wait = jiffies + (HZ/4); time_before(jiffies, wait); ) | ||
930 | mb(); | ||
931 | |||
932 | /* Disable all interrupts except pmu */ | ||
933 | save_irqen = in_le32(IRQ_ENABLE); | ||
934 | for (i = 0; i < 32; ++i) | ||
935 | if (i != vias->intrs[0].line && (save_irqen & (1 << i))) | ||
936 | disable_irq(i); | ||
937 | asm volatile("mtdec %0" : : "r" (0x7fffffff)); | ||
938 | |||
939 | /* Save the state of PCI config space for some slots */ | ||
940 | pbook_pci_save(); | ||
941 | |||
942 | /* Set the memory controller to keep the memory refreshed | ||
943 | while we're asleep */ | ||
944 | for (i = 0x403f; i >= 0x4000; --i) { | ||
945 | out_be32(MEM_CTRL, i); | ||
946 | do { | ||
947 | x = (in_be32(MEM_CTRL) >> 16) & 0x3ff; | ||
948 | } while (x == 0); | ||
949 | if (x >= 0x100) | ||
950 | break; | ||
951 | } | ||
952 | |||
953 | /* Ask the PMU to put us to sleep */ | ||
954 | pmu_request(&sleep_req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T'); | ||
955 | while (!sleep_req.complete) | ||
956 | mb(); | ||
957 | /* displacement-flush the L2 cache - necessary? */ | ||
958 | for (p = KERNELBASE; p < KERNELBASE + 0x100000; p += 0x1000) | ||
959 | i = *(volatile int *)p; | ||
960 | asleep = 1; | ||
961 | |||
962 | /* Put the CPU into sleep mode */ | ||
963 | asm volatile("mfspr %0,1008" : "=r" (hid0) :); | ||
964 | hid0 = (hid0 & ~(HID0_NAP | HID0_DOZE)) | HID0_SLEEP; | ||
965 | asm volatile("mtspr 1008,%0" : : "r" (hid0)); | ||
966 | local_save_flags(msr); | ||
967 | msr |= MSR_POW | MSR_EE; | ||
968 | local_irq_restore(msr); | ||
969 | udelay(10); | ||
970 | |||
971 | /* OK, we're awake again, start restoring things */ | ||
972 | out_be32(MEM_CTRL, 0x3f); | ||
973 | pbook_pci_restore(); | ||
974 | |||
975 | /* wait for the PMU interrupt sequence to complete */ | ||
976 | while (asleep) | ||
977 | mb(); | ||
978 | |||
979 | /* reenable interrupts */ | ||
980 | for (i = 0; i < 32; ++i) | ||
981 | if (i != vias->intrs[0].line && (save_irqen & (1 << i))) | ||
982 | enable_irq(i); | ||
983 | |||
984 | /* Notify drivers */ | ||
985 | blocking_notifier_call_chain(&sleep_notifier_list, PBOOK_WAKE, NULL); | ||
986 | |||
987 | /* reenable ADB autopoll */ | ||
988 | pmu_adb_autopoll(adb_dev_map); | ||
989 | |||
990 | /* Turn on the screen backlight, if it was on before */ | ||
991 | if (save_backlight) | ||
992 | pmu_enable_backlight(1); | ||
993 | |||
994 | /* Wait for the hard disk to spin up */ | ||
995 | |||
996 | return 0; | ||
997 | } | ||
998 | |||
999 | /* | ||
1000 | * Support for /dev/pmu device | ||
1001 | */ | ||
1002 | static int pmu_open(struct inode *inode, struct file *file) | ||
1003 | { | ||
1004 | return 0; | ||
1005 | } | ||
1006 | |||
1007 | static ssize_t pmu_read(struct file *file, char *buf, | ||
1008 | size_t count, loff_t *ppos) | ||
1009 | { | ||
1010 | return 0; | ||
1011 | } | ||
1012 | |||
1013 | static ssize_t pmu_write(struct file *file, const char *buf, | ||
1014 | size_t count, loff_t *ppos) | ||
1015 | { | ||
1016 | return 0; | ||
1017 | } | ||
1018 | |||
1019 | static int pmu_ioctl(struct inode * inode, struct file *filp, | ||
1020 | u_int cmd, u_long arg) | ||
1021 | { | ||
1022 | int error; | ||
1023 | __u32 value; | ||
1024 | |||
1025 | switch (cmd) { | ||
1026 | case PMU_IOC_SLEEP: | ||
1027 | return -ENOSYS; | ||
1028 | case PMU_IOC_GET_BACKLIGHT: | ||
1029 | return put_user(backlight_level, (__u32 *)arg); | ||
1030 | case PMU_IOC_SET_BACKLIGHT: | ||
1031 | error = get_user(value, (__u32 *)arg); | ||
1032 | if (!error) | ||
1033 | pmu_set_brightness(value); | ||
1034 | return error; | ||
1035 | case PMU_IOC_GET_MODEL: | ||
1036 | return put_user(pmu_kind, (__u32 *)arg); | ||
1037 | } | ||
1038 | return -EINVAL; | ||
1039 | } | ||
1040 | |||
1041 | static const struct file_operations pmu_device_fops = { | ||
1042 | .read = pmu_read, | ||
1043 | .write = pmu_write, | ||
1044 | .ioctl = pmu_ioctl, | ||
1045 | .open = pmu_open, | ||
1046 | }; | ||
1047 | |||
1048 | static struct miscdevice pmu_device = { | ||
1049 | PMU_MINOR, "pmu", &pmu_device_fops | ||
1050 | }; | ||
1051 | |||
1052 | void pmu_device_init(void) | ||
1053 | { | ||
1054 | if (!via) | ||
1055 | return; | ||
1056 | if (misc_register(&pmu_device) < 0) | ||
1057 | printk(KERN_ERR "via-pmu68k: cannot register misc device.\n"); | ||
1058 | } | ||
1059 | #endif /* CONFIG_PMAC_PBOOK */ | ||
1060 | |||
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 141ff9fa296e..2120155929a6 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -580,8 +580,8 @@ static void __map_bio(struct dm_target *ti, struct bio *clone, | |||
580 | /* the bio has been remapped so dispatch it */ | 580 | /* the bio has been remapped so dispatch it */ |
581 | 581 | ||
582 | blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, | 582 | blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, |
583 | tio->io->bio->bi_bdev->bd_dev, sector, | 583 | tio->io->bio->bi_bdev->bd_dev, |
584 | clone->bi_sector); | 584 | clone->bi_sector, sector); |
585 | 585 | ||
586 | generic_make_request(clone); | 586 | generic_make_request(clone); |
587 | } else if (r < 0 || r == DM_MAPIO_REQUEUE) { | 587 | } else if (r < 0 || r == DM_MAPIO_REQUEUE) { |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 650991bddd8e..f33a729960ca 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1972,7 +1972,8 @@ static int run(mddev_t *mddev) | |||
1972 | !test_bit(In_sync, &disk->rdev->flags)) { | 1972 | !test_bit(In_sync, &disk->rdev->flags)) { |
1973 | disk->head_position = 0; | 1973 | disk->head_position = 0; |
1974 | mddev->degraded++; | 1974 | mddev->degraded++; |
1975 | conf->fullsync = 1; | 1975 | if (disk->rdev) |
1976 | conf->fullsync = 1; | ||
1976 | } | 1977 | } |
1977 | } | 1978 | } |
1978 | if (mddev->degraded == conf->raid_disks) { | 1979 | if (mddev->degraded == conf->raid_disks) { |
@@ -2153,11 +2154,25 @@ static int raid1_reshape(mddev_t *mddev) | |||
2153 | oldpool = conf->r1bio_pool; | 2154 | oldpool = conf->r1bio_pool; |
2154 | conf->r1bio_pool = newpool; | 2155 | conf->r1bio_pool = newpool; |
2155 | 2156 | ||
2156 | for (d=d2=0; d < conf->raid_disks; d++) | 2157 | for (d = d2 = 0; d < conf->raid_disks; d++) { |
2157 | if (conf->mirrors[d].rdev) { | 2158 | mdk_rdev_t *rdev = conf->mirrors[d].rdev; |
2158 | conf->mirrors[d].rdev->raid_disk = d2; | 2159 | if (rdev && rdev->raid_disk != d2) { |
2159 | newmirrors[d2++].rdev = conf->mirrors[d].rdev; | 2160 | char nm[20]; |
2161 | sprintf(nm, "rd%d", rdev->raid_disk); | ||
2162 | sysfs_remove_link(&mddev->kobj, nm); | ||
2163 | rdev->raid_disk = d2; | ||
2164 | sprintf(nm, "rd%d", rdev->raid_disk); | ||
2165 | sysfs_remove_link(&mddev->kobj, nm); | ||
2166 | if (sysfs_create_link(&mddev->kobj, | ||
2167 | &rdev->kobj, nm)) | ||
2168 | printk(KERN_WARNING | ||
2169 | "md/raid1: cannot register " | ||
2170 | "%s for %s\n", | ||
2171 | nm, mdname(mddev)); | ||
2160 | } | 2172 | } |
2173 | if (rdev) | ||
2174 | newmirrors[d2++].rdev = rdev; | ||
2175 | } | ||
2161 | kfree(conf->mirrors); | 2176 | kfree(conf->mirrors); |
2162 | conf->mirrors = newmirrors; | 2177 | conf->mirrors = newmirrors; |
2163 | kfree(conf->poolinfo); | 2178 | kfree(conf->poolinfo); |
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index ca99e439c97c..11f7d5939bd9 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -784,7 +784,7 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, | |||
784 | strncpy(fe->ops.tuner_ops.info.name, desc->name, | 784 | strncpy(fe->ops.tuner_ops.info.name, desc->name, |
785 | sizeof(fe->ops.tuner_ops.info.name)); | 785 | sizeof(fe->ops.tuner_ops.info.name)); |
786 | fe->ops.tuner_ops.info.frequency_min = desc->min; | 786 | fe->ops.tuner_ops.info.frequency_min = desc->min; |
787 | fe->ops.tuner_ops.info.frequency_min = desc->max; | 787 | fe->ops.tuner_ops.info.frequency_max = desc->max; |
788 | if (!desc->initdata) | 788 | if (!desc->initdata) |
789 | fe->ops.tuner_ops.init = NULL; | 789 | fe->ops.tuner_ops.init = NULL; |
790 | if (!desc->sleepdata) | 790 | if (!desc->sleepdata) |
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index c08f650df423..ef5361824f87 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -356,6 +356,7 @@ static int cafe_smbus_write_data(struct cafe_camera *cam, | |||
356 | { | 356 | { |
357 | unsigned int rval; | 357 | unsigned int rval; |
358 | unsigned long flags; | 358 | unsigned long flags; |
359 | DEFINE_WAIT(the_wait); | ||
359 | 360 | ||
360 | spin_lock_irqsave(&cam->dev_lock, flags); | 361 | spin_lock_irqsave(&cam->dev_lock, flags); |
361 | rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); | 362 | rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); |
@@ -369,10 +370,29 @@ static int cafe_smbus_write_data(struct cafe_camera *cam, | |||
369 | rval = value | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); | 370 | rval = value | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); |
370 | cafe_reg_write(cam, REG_TWSIC1, rval); | 371 | cafe_reg_write(cam, REG_TWSIC1, rval); |
371 | spin_unlock_irqrestore(&cam->dev_lock, flags); | 372 | spin_unlock_irqrestore(&cam->dev_lock, flags); |
372 | msleep(2); /* Required or things flake */ | ||
373 | 373 | ||
374 | /* | ||
375 | * Time to wait for the write to complete. THIS IS A RACY | ||
376 | * WAY TO DO IT, but the sad fact is that reading the TWSIC1 | ||
377 | * register too quickly after starting the operation sends | ||
378 | * the device into a place that may be kinder and better, but | ||
379 | * which is absolutely useless for controlling the sensor. In | ||
380 | * practice we have plenty of time to get into our sleep state | ||
381 | * before the interrupt hits, and the worst case is that we | ||
382 | * time out and then see that things completed, so this seems | ||
383 | * the best way for now. | ||
384 | */ | ||
385 | do { | ||
386 | prepare_to_wait(&cam->smbus_wait, &the_wait, | ||
387 | TASK_UNINTERRUPTIBLE); | ||
388 | schedule_timeout(1); /* even 1 jiffy is too long */ | ||
389 | finish_wait(&cam->smbus_wait, &the_wait); | ||
390 | } while (!cafe_smbus_write_done(cam)); | ||
391 | |||
392 | #ifdef IF_THE_CAFE_HARDWARE_WORKED_RIGHT | ||
374 | wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(cam), | 393 | wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(cam), |
375 | CAFE_SMBUS_TIMEOUT); | 394 | CAFE_SMBUS_TIMEOUT); |
395 | #endif | ||
376 | spin_lock_irqsave(&cam->dev_lock, flags); | 396 | spin_lock_irqsave(&cam->dev_lock, flags); |
377 | rval = cafe_reg_read(cam, REG_TWSIC1); | 397 | rval = cafe_reg_read(cam, REG_TWSIC1); |
378 | spin_unlock_irqrestore(&cam->dev_lock, flags); | 398 | spin_unlock_irqrestore(&cam->dev_lock, flags); |
@@ -710,7 +730,7 @@ static void cafe_ctlr_init(struct cafe_camera *cam) | |||
710 | * Here we must wait a bit for the controller to come around. | 730 | * Here we must wait a bit for the controller to come around. |
711 | */ | 731 | */ |
712 | spin_unlock_irqrestore(&cam->dev_lock, flags); | 732 | spin_unlock_irqrestore(&cam->dev_lock, flags); |
713 | mdelay(5); /* FIXME revisit this */ | 733 | msleep(5); |
714 | spin_lock_irqsave(&cam->dev_lock, flags); | 734 | spin_lock_irqsave(&cam->dev_lock, flags); |
715 | 735 | ||
716 | cafe_reg_write(cam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC); | 736 | cafe_reg_write(cam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC); |
@@ -2233,12 +2253,21 @@ static int cafe_pci_resume(struct pci_dev *pdev) | |||
2233 | if (ret) | 2253 | if (ret) |
2234 | return ret; | 2254 | return ret; |
2235 | ret = pci_enable_device(pdev); | 2255 | ret = pci_enable_device(pdev); |
2256 | |||
2236 | if (ret) { | 2257 | if (ret) { |
2237 | cam_warn(cam, "Unable to re-enable device on resume!\n"); | 2258 | cam_warn(cam, "Unable to re-enable device on resume!\n"); |
2238 | return ret; | 2259 | return ret; |
2239 | } | 2260 | } |
2240 | cafe_ctlr_init(cam); | 2261 | cafe_ctlr_init(cam); |
2241 | cafe_ctlr_power_up(cam); | 2262 | cafe_ctlr_power_down(cam); |
2263 | |||
2264 | mutex_lock(&cam->s_mutex); | ||
2265 | if (cam->users > 0) { | ||
2266 | cafe_ctlr_power_up(cam); | ||
2267 | __cafe_cam_reset(cam); | ||
2268 | } | ||
2269 | mutex_unlock(&cam->s_mutex); | ||
2270 | |||
2242 | set_bit(CF_CONFIG_NEEDED, &cam->flags); | 2271 | set_bit(CF_CONFIG_NEEDED, &cam->flags); |
2243 | if (cam->state == S_SPECREAD) | 2272 | if (cam->state == S_SPECREAD) |
2244 | cam->state = S_IDLE; /* Don't bother restarting */ | 2273 | cam->state = S_IDLE; /* Don't bother restarting */ |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 047624b9e271..5977a79619c2 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -1190,6 +1190,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
1190 | itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0; | 1190 | itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0; |
1191 | itv->osd_local_alpha_state = (fb->flags & V4L2_FBUF_FLAG_LOCAL_ALPHA) != 0; | 1191 | itv->osd_local_alpha_state = (fb->flags & V4L2_FBUF_FLAG_LOCAL_ALPHA) != 0; |
1192 | itv->osd_color_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0; | 1192 | itv->osd_color_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0; |
1193 | ivtv_set_osd_alpha(itv); | ||
1193 | break; | 1194 | break; |
1194 | } | 1195 | } |
1195 | 1196 | ||
@@ -1234,7 +1235,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
1234 | IVTV_INFO("Tuner: %s\n", | 1235 | IVTV_INFO("Tuner: %s\n", |
1235 | test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV"); | 1236 | test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV"); |
1236 | cx2341x_log_status(&itv->params, itv->name); | 1237 | cx2341x_log_status(&itv->params, itv->name); |
1237 | IVTV_INFO("Status flags: 0x%08lx\n", itv->i_flags); | 1238 | IVTV_INFO("Version: %s Status flags: 0x%08lx\n", IVTV_VERSION, itv->i_flags); |
1238 | for (i = 0; i < IVTV_MAX_STREAMS; i++) { | 1239 | for (i = 0; i < IVTV_MAX_STREAMS; i++) { |
1239 | struct ivtv_stream *s = &itv->streams[i]; | 1240 | struct ivtv_stream *s = &itv->streams[i]; |
1240 | 1241 | ||
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index f8f21ddd9843..c4c5bd67f795 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c | |||
@@ -416,7 +416,10 @@ static int ov7670_read(struct i2c_client *c, unsigned char reg, | |||
416 | static int ov7670_write(struct i2c_client *c, unsigned char reg, | 416 | static int ov7670_write(struct i2c_client *c, unsigned char reg, |
417 | unsigned char value) | 417 | unsigned char value) |
418 | { | 418 | { |
419 | return i2c_smbus_write_byte_data(c, reg, value); | 419 | int ret = i2c_smbus_write_byte_data(c, reg, value); |
420 | if (reg == REG_COM7 && (value & COM7_RESET)) | ||
421 | msleep(2); /* Wait for reset to run */ | ||
422 | return ret; | ||
420 | } | 423 | } |
421 | 424 | ||
422 | 425 | ||
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index e866dacde7e5..414c109f4cf5 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -88,7 +88,9 @@ module_param(mpt_channel_mapping, int, 0); | |||
88 | MODULE_PARM_DESC(mpt_channel_mapping, " Mapping id's to channels (default=0)"); | 88 | MODULE_PARM_DESC(mpt_channel_mapping, " Mapping id's to channels (default=0)"); |
89 | 89 | ||
90 | static int mpt_debug_level; | 90 | static int mpt_debug_level; |
91 | module_param(mpt_debug_level, int, 0); | 91 | static int mpt_set_debug_level(const char *val, struct kernel_param *kp); |
92 | module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int, | ||
93 | &mpt_debug_level, 0600); | ||
92 | MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)"); | 94 | MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)"); |
93 | 95 | ||
94 | #ifdef MFCNT | 96 | #ifdef MFCNT |
@@ -220,6 +222,19 @@ pci_enable_io_access(struct pci_dev *pdev) | |||
220 | pci_write_config_word(pdev, PCI_COMMAND, command_reg); | 222 | pci_write_config_word(pdev, PCI_COMMAND, command_reg); |
221 | } | 223 | } |
222 | 224 | ||
225 | static int mpt_set_debug_level(const char *val, struct kernel_param *kp) | ||
226 | { | ||
227 | int ret = param_set_int(val, kp); | ||
228 | MPT_ADAPTER *ioc; | ||
229 | |||
230 | if (ret) | ||
231 | return ret; | ||
232 | |||
233 | list_for_each_entry(ioc, &ioc_list, list) | ||
234 | ioc->debug_level = mpt_debug_level; | ||
235 | return 0; | ||
236 | } | ||
237 | |||
223 | /* | 238 | /* |
224 | * Process turbo (context) reply... | 239 | * Process turbo (context) reply... |
225 | */ | 240 | */ |
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 29add83da588..b9c69bff218c 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -1312,11 +1312,137 @@ mptsas_get_bay_identifier(struct sas_rphy *rphy) | |||
1312 | return rc; | 1312 | return rc; |
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | ||
1316 | struct request *req) | ||
1317 | { | ||
1318 | MPT_ADAPTER *ioc = ((MPT_SCSI_HOST *) shost->hostdata)->ioc; | ||
1319 | MPT_FRAME_HDR *mf; | ||
1320 | SmpPassthroughRequest_t *smpreq; | ||
1321 | struct request *rsp = req->next_rq; | ||
1322 | int ret; | ||
1323 | int flagsLength; | ||
1324 | unsigned long timeleft; | ||
1325 | char *psge; | ||
1326 | dma_addr_t dma_addr_in = 0; | ||
1327 | dma_addr_t dma_addr_out = 0; | ||
1328 | u64 sas_address = 0; | ||
1329 | |||
1330 | if (!rsp) { | ||
1331 | printk(KERN_ERR "%s: the smp response space is missing\n", | ||
1332 | __FUNCTION__); | ||
1333 | return -EINVAL; | ||
1334 | } | ||
1335 | |||
1336 | /* do we need to support multiple segments? */ | ||
1337 | if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { | ||
1338 | printk(KERN_ERR "%s: multiple segments req %u %u, rsp %u %u\n", | ||
1339 | __FUNCTION__, req->bio->bi_vcnt, req->data_len, | ||
1340 | rsp->bio->bi_vcnt, rsp->data_len); | ||
1341 | return -EINVAL; | ||
1342 | } | ||
1343 | |||
1344 | ret = mutex_lock_interruptible(&ioc->sas_mgmt.mutex); | ||
1345 | if (ret) | ||
1346 | goto out; | ||
1347 | |||
1348 | mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc); | ||
1349 | if (!mf) { | ||
1350 | ret = -ENOMEM; | ||
1351 | goto out_unlock; | ||
1352 | } | ||
1353 | |||
1354 | smpreq = (SmpPassthroughRequest_t *)mf; | ||
1355 | memset(smpreq, 0, sizeof(*smpreq)); | ||
1356 | |||
1357 | smpreq->RequestDataLength = cpu_to_le16(req->data_len - 4); | ||
1358 | smpreq->Function = MPI_FUNCTION_SMP_PASSTHROUGH; | ||
1359 | |||
1360 | if (rphy) | ||
1361 | sas_address = rphy->identify.sas_address; | ||
1362 | else { | ||
1363 | struct mptsas_portinfo *port_info; | ||
1364 | |||
1365 | mutex_lock(&ioc->sas_topology_mutex); | ||
1366 | port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle); | ||
1367 | if (port_info && port_info->phy_info) | ||
1368 | sas_address = | ||
1369 | port_info->phy_info[0].phy->identify.sas_address; | ||
1370 | mutex_unlock(&ioc->sas_topology_mutex); | ||
1371 | } | ||
1372 | |||
1373 | *((u64 *)&smpreq->SASAddress) = cpu_to_le64(sas_address); | ||
1374 | |||
1375 | psge = (char *) | ||
1376 | (((int *) mf) + (offsetof(SmpPassthroughRequest_t, SGL) / 4)); | ||
1377 | |||
1378 | /* request */ | ||
1379 | flagsLength = (MPI_SGE_FLAGS_SIMPLE_ELEMENT | | ||
1380 | MPI_SGE_FLAGS_END_OF_BUFFER | | ||
1381 | MPI_SGE_FLAGS_DIRECTION | | ||
1382 | mpt_addr_size()) << MPI_SGE_FLAGS_SHIFT; | ||
1383 | flagsLength |= (req->data_len - 4); | ||
1384 | |||
1385 | dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio), | ||
1386 | req->data_len, PCI_DMA_BIDIRECTIONAL); | ||
1387 | if (!dma_addr_out) | ||
1388 | goto put_mf; | ||
1389 | mpt_add_sge(psge, flagsLength, dma_addr_out); | ||
1390 | psge += (sizeof(u32) + sizeof(dma_addr_t)); | ||
1391 | |||
1392 | /* response */ | ||
1393 | flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ; | ||
1394 | flagsLength |= rsp->data_len + 4; | ||
1395 | dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio), | ||
1396 | rsp->data_len, PCI_DMA_BIDIRECTIONAL); | ||
1397 | if (!dma_addr_in) | ||
1398 | goto unmap; | ||
1399 | mpt_add_sge(psge, flagsLength, dma_addr_in); | ||
1400 | |||
1401 | mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf); | ||
1402 | |||
1403 | timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ); | ||
1404 | if (!timeleft) { | ||
1405 | printk(KERN_ERR "%s: smp timeout!\n", __FUNCTION__); | ||
1406 | /* On timeout reset the board */ | ||
1407 | mpt_HardResetHandler(ioc, CAN_SLEEP); | ||
1408 | ret = -ETIMEDOUT; | ||
1409 | goto unmap; | ||
1410 | } | ||
1411 | mf = NULL; | ||
1412 | |||
1413 | if (ioc->sas_mgmt.status & MPT_IOCTL_STATUS_RF_VALID) { | ||
1414 | SmpPassthroughReply_t *smprep; | ||
1415 | |||
1416 | smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply; | ||
1417 | memcpy(req->sense, smprep, sizeof(*smprep)); | ||
1418 | req->sense_len = sizeof(*smprep); | ||
1419 | } else { | ||
1420 | printk(KERN_ERR "%s: smp passthru reply failed to be returned\n", | ||
1421 | __FUNCTION__); | ||
1422 | ret = -ENXIO; | ||
1423 | } | ||
1424 | unmap: | ||
1425 | if (dma_addr_out) | ||
1426 | pci_unmap_single(ioc->pcidev, dma_addr_out, req->data_len, | ||
1427 | PCI_DMA_BIDIRECTIONAL); | ||
1428 | if (dma_addr_in) | ||
1429 | pci_unmap_single(ioc->pcidev, dma_addr_in, rsp->data_len, | ||
1430 | PCI_DMA_BIDIRECTIONAL); | ||
1431 | put_mf: | ||
1432 | if (mf) | ||
1433 | mpt_free_msg_frame(ioc, mf); | ||
1434 | out_unlock: | ||
1435 | mutex_unlock(&ioc->sas_mgmt.mutex); | ||
1436 | out: | ||
1437 | return ret; | ||
1438 | } | ||
1439 | |||
1315 | static struct sas_function_template mptsas_transport_functions = { | 1440 | static struct sas_function_template mptsas_transport_functions = { |
1316 | .get_linkerrors = mptsas_get_linkerrors, | 1441 | .get_linkerrors = mptsas_get_linkerrors, |
1317 | .get_enclosure_identifier = mptsas_get_enclosure_identifier, | 1442 | .get_enclosure_identifier = mptsas_get_enclosure_identifier, |
1318 | .get_bay_identifier = mptsas_get_bay_identifier, | 1443 | .get_bay_identifier = mptsas_get_bay_identifier, |
1319 | .phy_reset = mptsas_phy_reset, | 1444 | .phy_reset = mptsas_phy_reset, |
1445 | .smp_handler = mptsas_smp_handler, | ||
1320 | }; | 1446 | }; |
1321 | 1447 | ||
1322 | static struct scsi_transport_template *mptsas_transport_template; | 1448 | static struct scsi_transport_template *mptsas_transport_template; |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index aaaa61ea4217..a26655881e6a 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -5,6 +5,11 @@ | |||
5 | menuconfig MISC_DEVICES | 5 | menuconfig MISC_DEVICES |
6 | bool "Misc devices" | 6 | bool "Misc devices" |
7 | default y | 7 | default y |
8 | ---help--- | ||
9 | Say Y here to get to see options for device drivers from various | ||
10 | different categories. This option alone does not add any kernel code. | ||
11 | |||
12 | If you say N, all options in this submenu will be skipped and disabled. | ||
8 | 13 | ||
9 | if MISC_DEVICES | 14 | if MISC_DEVICES |
10 | 15 | ||
@@ -200,14 +205,22 @@ config THINKPAD_ACPI_BAY | |||
200 | config THINKPAD_ACPI_INPUT_ENABLED | 205 | config THINKPAD_ACPI_INPUT_ENABLED |
201 | bool "Enable input layer support by default" | 206 | bool "Enable input layer support by default" |
202 | depends on THINKPAD_ACPI | 207 | depends on THINKPAD_ACPI |
203 | default y | 208 | default n |
204 | ---help--- | 209 | ---help--- |
205 | Enables hot key handling over the input layer by default. If unset, | 210 | This option enables thinkpad-acpi hot key handling over the input |
206 | the driver does not enable any hot key handling by default, and also | 211 | layer at driver load time. When it is unset, the driver does not |
207 | starts up with a mostly empty keymap. | 212 | enable hot key handling by default, and also starts up with a mostly |
208 | 213 | empty keymap. | |
209 | If you are not sure, say Y here. Say N to retain the deprecated | 214 | |
210 | behavior of ibm-acpi, and thinkpad-acpi for kernels up to 2.6.21. | 215 | This option should be enabled if you have a new enough HAL or other |
216 | userspace support that properly handles the thinkpad-acpi event | ||
217 | device. It auto-tunes the hot key support to those reported by the | ||
218 | firmware and enables it automatically. | ||
219 | |||
220 | If unsure, say N here to retain the old behaviour of ibm-acpi, and | ||
221 | thinkpad-acpi up to kernel 2.6.21: userspace will have to enable and | ||
222 | set up the thinkpad-acpi hot key handling using the sysfs interace | ||
223 | after loading the driver. | ||
211 | 224 | ||
212 | 225 | ||
213 | endif # MISC_DEVICES | 226 | endif # MISC_DEVICES |
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 14ee06c8f127..91da6880ae93 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c | |||
@@ -845,7 +845,7 @@ static struct sony_nc_event sony_C_events[] = { | |||
845 | }; | 845 | }; |
846 | 846 | ||
847 | /* SNC-only model map */ | 847 | /* SNC-only model map */ |
848 | struct dmi_system_id sony_nc_ids[] = { | 848 | static struct dmi_system_id sony_nc_ids[] = { |
849 | { | 849 | { |
850 | .ident = "Sony Vaio FE Series", | 850 | .ident = "Sony Vaio FE Series", |
851 | .callback = sony_nc_C_enable, | 851 | .callback = sony_nc_C_enable, |
@@ -942,6 +942,11 @@ static int sony_nc_resume(struct acpi_device *device) | |||
942 | } | 942 | } |
943 | } | 943 | } |
944 | 944 | ||
945 | /* set the last requested brightness level */ | ||
946 | if (sony_backlight_device && | ||
947 | !sony_backlight_update_status(sony_backlight_device)) | ||
948 | printk(KERN_WARNING DRV_PFX "unable to restore brightness level"); | ||
949 | |||
945 | /* re-initialize models with specific requirements */ | 950 | /* re-initialize models with specific requirements */ |
946 | dmi_check_system(sony_nc_ids); | 951 | dmi_check_system(sony_nc_ids); |
947 | 952 | ||
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index fa80f355e522..f6cd34a3dbac 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -4668,12 +4668,15 @@ static int __init thinkpad_acpi_module_init(void) | |||
4668 | thinkpad_acpi_module_exit(); | 4668 | thinkpad_acpi_module_exit(); |
4669 | return ret; | 4669 | return ret; |
4670 | } | 4670 | } |
4671 | tp_features.platform_drv_registered = 1; | ||
4672 | |||
4671 | ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver); | 4673 | ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver); |
4672 | if (ret) { | 4674 | if (ret) { |
4673 | printk(IBM_ERR "unable to create sysfs driver attributes\n"); | 4675 | printk(IBM_ERR "unable to create sysfs driver attributes\n"); |
4674 | thinkpad_acpi_module_exit(); | 4676 | thinkpad_acpi_module_exit(); |
4675 | return ret; | 4677 | return ret; |
4676 | } | 4678 | } |
4679 | tp_features.platform_drv_attrs_registered = 1; | ||
4677 | 4680 | ||
4678 | 4681 | ||
4679 | /* Device initialization */ | 4682 | /* Device initialization */ |
@@ -4756,8 +4759,11 @@ static void thinkpad_acpi_module_exit(void) | |||
4756 | if (tpacpi_pdev) | 4759 | if (tpacpi_pdev) |
4757 | platform_device_unregister(tpacpi_pdev); | 4760 | platform_device_unregister(tpacpi_pdev); |
4758 | 4761 | ||
4759 | tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver); | 4762 | if (tp_features.platform_drv_attrs_registered) |
4760 | platform_driver_unregister(&tpacpi_pdriver); | 4763 | tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver); |
4764 | |||
4765 | if (tp_features.platform_drv_registered) | ||
4766 | platform_driver_unregister(&tpacpi_pdriver); | ||
4761 | 4767 | ||
4762 | if (proc_dir) | 4768 | if (proc_dir) |
4763 | remove_proc_entry(IBM_PROC_DIR, acpi_root_dir); | 4769 | remove_proc_entry(IBM_PROC_DIR, acpi_root_dir); |
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h index 88af089d6494..eee8809a50d9 100644 --- a/drivers/misc/thinkpad_acpi.h +++ b/drivers/misc/thinkpad_acpi.h | |||
@@ -246,6 +246,8 @@ static struct { | |||
246 | u16 wan:1; | 246 | u16 wan:1; |
247 | u16 fan_ctrl_status_undef:1; | 247 | u16 fan_ctrl_status_undef:1; |
248 | u16 input_device_registered:1; | 248 | u16 input_device_registered:1; |
249 | u16 platform_drv_registered:1; | ||
250 | u16 platform_drv_attrs_registered:1; | ||
249 | } tp_features; | 251 | } tp_features; |
250 | 252 | ||
251 | struct thinkpad_id_data { | 253 | struct thinkpad_id_data { |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index c9a289c6c139..b0abc7d92805 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -117,7 +117,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
117 | struct mmc_host *host = card->host; | 117 | struct mmc_host *host = card->host; |
118 | u64 limit = BLK_BOUNCE_HIGH; | 118 | u64 limit = BLK_BOUNCE_HIGH; |
119 | int ret; | 119 | int ret; |
120 | unsigned int bouncesz; | ||
121 | 120 | ||
122 | if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask) | 121 | if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask) |
123 | limit = *mmc_dev(host)->dma_mask; | 122 | limit = *mmc_dev(host)->dma_mask; |
@@ -134,6 +133,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
134 | 133 | ||
135 | #ifdef CONFIG_MMC_BLOCK_BOUNCE | 134 | #ifdef CONFIG_MMC_BLOCK_BOUNCE |
136 | if (host->max_hw_segs == 1) { | 135 | if (host->max_hw_segs == 1) { |
136 | unsigned int bouncesz; | ||
137 | |||
137 | bouncesz = MMC_QUEUE_BOUNCESZ; | 138 | bouncesz = MMC_QUEUE_BOUNCESZ; |
138 | 139 | ||
139 | if (bouncesz > host->max_req_size) | 140 | if (bouncesz > host->max_req_size) |
@@ -156,14 +157,14 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
156 | GFP_KERNEL); | 157 | GFP_KERNEL); |
157 | if (!mq->sg) { | 158 | if (!mq->sg) { |
158 | ret = -ENOMEM; | 159 | ret = -ENOMEM; |
159 | goto free_bounce_buf; | 160 | goto cleanup_queue; |
160 | } | 161 | } |
161 | 162 | ||
162 | mq->bounce_sg = kmalloc(sizeof(struct scatterlist) * | 163 | mq->bounce_sg = kmalloc(sizeof(struct scatterlist) * |
163 | bouncesz / 512, GFP_KERNEL); | 164 | bouncesz / 512, GFP_KERNEL); |
164 | if (!mq->bounce_sg) { | 165 | if (!mq->bounce_sg) { |
165 | ret = -ENOMEM; | 166 | ret = -ENOMEM; |
166 | goto free_sg; | 167 | goto cleanup_queue; |
167 | } | 168 | } |
168 | } | 169 | } |
169 | } | 170 | } |
@@ -197,14 +198,13 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
197 | if (mq->bounce_sg) | 198 | if (mq->bounce_sg) |
198 | kfree(mq->bounce_sg); | 199 | kfree(mq->bounce_sg); |
199 | mq->bounce_sg = NULL; | 200 | mq->bounce_sg = NULL; |
200 | free_sg: | 201 | cleanup_queue: |
201 | kfree(mq->sg); | 202 | if (mq->sg) |
203 | kfree(mq->sg); | ||
202 | mq->sg = NULL; | 204 | mq->sg = NULL; |
203 | free_bounce_buf: | ||
204 | if (mq->bounce_buf) | 205 | if (mq->bounce_buf) |
205 | kfree(mq->bounce_buf); | 206 | kfree(mq->bounce_buf); |
206 | mq->bounce_buf = NULL; | 207 | mq->bounce_buf = NULL; |
207 | cleanup_queue: | ||
208 | blk_cleanup_queue(mq->queue); | 208 | blk_cleanup_queue(mq->queue); |
209 | return ret; | 209 | return ret; |
210 | } | 210 | } |
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index 62564ccde03a..bfebd2fa7ada 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -83,7 +83,7 @@ | |||
83 | 83 | ||
84 | #define AT91_MCI_ERRORS (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE \ | 84 | #define AT91_MCI_ERRORS (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE \ |
85 | | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE \ | 85 | | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE \ |
86 | | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE) | 86 | | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE) |
87 | 87 | ||
88 | #define at91_mci_read(host, reg) __raw_readl((host)->baseaddr + (reg)) | 88 | #define at91_mci_read(host, reg) __raw_readl((host)->baseaddr + (reg)) |
89 | #define at91_mci_write(host, reg, val) __raw_writel((val), (host)->baseaddr + (reg)) | 89 | #define at91_mci_write(host, reg, val) __raw_writel((val), (host)->baseaddr + (reg)) |
@@ -676,15 +676,15 @@ static irqreturn_t at91_mci_irq(int irq, void *devid) | |||
676 | 676 | ||
677 | int_status = at91_mci_read(host, AT91_MCI_SR); | 677 | int_status = at91_mci_read(host, AT91_MCI_SR); |
678 | int_mask = at91_mci_read(host, AT91_MCI_IMR); | 678 | int_mask = at91_mci_read(host, AT91_MCI_IMR); |
679 | 679 | ||
680 | pr_debug("MCI irq: status = %08X, %08X, %08X\n", int_status, int_mask, | 680 | pr_debug("MCI irq: status = %08X, %08X, %08X\n", int_status, int_mask, |
681 | int_status & int_mask); | 681 | int_status & int_mask); |
682 | 682 | ||
683 | int_status = int_status & int_mask; | 683 | int_status = int_status & int_mask; |
684 | 684 | ||
685 | if (int_status & AT91_MCI_ERRORS) { | 685 | if (int_status & AT91_MCI_ERRORS) { |
686 | completed = 1; | 686 | completed = 1; |
687 | 687 | ||
688 | if (int_status & AT91_MCI_UNRE) | 688 | if (int_status & AT91_MCI_UNRE) |
689 | pr_debug("MMC: Underrun error\n"); | 689 | pr_debug("MMC: Underrun error\n"); |
690 | if (int_status & AT91_MCI_OVRE) | 690 | if (int_status & AT91_MCI_OVRE) |
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c index e0c9808fd424..9bf2a877113b 100644 --- a/drivers/mmc/host/wbsd.c +++ b/drivers/mmc/host/wbsd.c | |||
@@ -1266,7 +1266,7 @@ static int __devinit wbsd_alloc_mmc(struct device *dev) | |||
1266 | return 0; | 1266 | return 0; |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | static void __devexit wbsd_free_mmc(struct device *dev) | 1269 | static void wbsd_free_mmc(struct device *dev) |
1270 | { | 1270 | { |
1271 | struct mmc_host *mmc; | 1271 | struct mmc_host *mmc; |
1272 | struct wbsd_host *host; | 1272 | struct wbsd_host *host; |
@@ -1358,7 +1358,7 @@ static int __devinit wbsd_request_region(struct wbsd_host *host, int base) | |||
1358 | return 0; | 1358 | return 0; |
1359 | } | 1359 | } |
1360 | 1360 | ||
1361 | static void __devexit wbsd_release_regions(struct wbsd_host *host) | 1361 | static void wbsd_release_regions(struct wbsd_host *host) |
1362 | { | 1362 | { |
1363 | if (host->base) | 1363 | if (host->base) |
1364 | release_region(host->base, 8); | 1364 | release_region(host->base, 8); |
@@ -1434,7 +1434,7 @@ err: | |||
1434 | "Falling back on FIFO.\n", dma); | 1434 | "Falling back on FIFO.\n", dma); |
1435 | } | 1435 | } |
1436 | 1436 | ||
1437 | static void __devexit wbsd_release_dma(struct wbsd_host *host) | 1437 | static void wbsd_release_dma(struct wbsd_host *host) |
1438 | { | 1438 | { |
1439 | if (host->dma_addr) { | 1439 | if (host->dma_addr) { |
1440 | dma_unmap_single(mmc_dev(host->mmc), host->dma_addr, | 1440 | dma_unmap_single(mmc_dev(host->mmc), host->dma_addr, |
@@ -1484,7 +1484,7 @@ static int __devinit wbsd_request_irq(struct wbsd_host *host, int irq) | |||
1484 | return 0; | 1484 | return 0; |
1485 | } | 1485 | } |
1486 | 1486 | ||
1487 | static void __devexit wbsd_release_irq(struct wbsd_host *host) | 1487 | static void wbsd_release_irq(struct wbsd_host *host) |
1488 | { | 1488 | { |
1489 | if (!host->irq) | 1489 | if (!host->irq) |
1490 | return; | 1490 | return; |
@@ -1535,7 +1535,7 @@ static int __devinit wbsd_request_resources(struct wbsd_host *host, | |||
1535 | * Release all resources for the host. | 1535 | * Release all resources for the host. |
1536 | */ | 1536 | */ |
1537 | 1537 | ||
1538 | static void __devexit wbsd_release_resources(struct wbsd_host *host) | 1538 | static void wbsd_release_resources(struct wbsd_host *host) |
1539 | { | 1539 | { |
1540 | wbsd_release_dma(host); | 1540 | wbsd_release_dma(host); |
1541 | wbsd_release_irq(host); | 1541 | wbsd_release_irq(host); |
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile index 024d0e5e3e5d..7f0b04b4caa7 100644 --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile | |||
@@ -3,9 +3,9 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | # Core functionality. | 5 | # Core functionality. |
6 | obj-$(CONFIG_MTD) += mtd.o | ||
6 | mtd-y := mtdcore.o mtdsuper.o | 7 | mtd-y := mtdcore.o mtdsuper.o |
7 | mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o | 8 | mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o |
8 | obj-$(CONFIG_MTD) += $(mtd-y) | ||
9 | 9 | ||
10 | obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o | 10 | obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o |
11 | obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o | 11 | obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 942c88ec5b6a..22ed96c4b7bd 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/device.h> | 8 | #include <linux/device.h> |
9 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
10 | #include <linux/mm.h> | ||
10 | #include <linux/err.h> | 11 | #include <linux/err.h> |
11 | #include <linux/init.h> | 12 | #include <linux/init.h> |
12 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 9c6236852942..6174a97d7902 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -560,7 +560,3 @@ int parse_mtd_partitions(struct mtd_info *master, const char **types, | |||
560 | EXPORT_SYMBOL_GPL(parse_mtd_partitions); | 560 | EXPORT_SYMBOL_GPL(parse_mtd_partitions); |
561 | EXPORT_SYMBOL_GPL(register_mtd_parser); | 561 | EXPORT_SYMBOL_GPL(register_mtd_parser); |
562 | EXPORT_SYMBOL_GPL(deregister_mtd_parser); | 562 | EXPORT_SYMBOL_GPL(deregister_mtd_parser); |
563 | |||
564 | MODULE_LICENSE("GPL"); | ||
565 | MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>"); | ||
566 | MODULE_DESCRIPTION("Generic support for partitioning of MTD devices"); | ||
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 001c66dd3a94..a8c0f436cdd2 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -1555,6 +1555,7 @@ vortex_up(struct net_device *dev) | |||
1555 | mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR); | 1555 | mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR); |
1556 | mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA); | 1556 | mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA); |
1557 | vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0); | 1557 | vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0); |
1558 | vp->mii.full_duplex = vp->full_duplex; | ||
1558 | 1559 | ||
1559 | vortex_check_media(dev, 1); | 1560 | vortex_check_media(dev, 1); |
1560 | } | 1561 | } |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 81ef81c9a584..5b9e17bf1749 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1968,6 +1968,16 @@ menuconfig NETDEV_1000 | |||
1968 | bool "Ethernet (1000 Mbit)" | 1968 | bool "Ethernet (1000 Mbit)" |
1969 | depends on !UML | 1969 | depends on !UML |
1970 | default y | 1970 | default y |
1971 | ---help--- | ||
1972 | Ethernet (also called IEEE 802.3 or ISO 8802-2) is the most common | ||
1973 | type of Local Area Network (LAN) in universities and companies. | ||
1974 | |||
1975 | Say Y here to get to see options for Gigabit Ethernet drivers. | ||
1976 | This option alone does not add any kernel code. | ||
1977 | Note that drivers supporting both 100 and 1000 MBit may be listed | ||
1978 | under "Ethernet (10 or 100MBit)" instead. | ||
1979 | |||
1980 | If you say N, all options in this submenu will be skipped and disabled. | ||
1971 | 1981 | ||
1972 | if NETDEV_1000 | 1982 | if NETDEV_1000 |
1973 | 1983 | ||
@@ -2339,6 +2349,11 @@ menuconfig NETDEV_10000 | |||
2339 | bool "Ethernet (10000 Mbit)" | 2349 | bool "Ethernet (10000 Mbit)" |
2340 | depends on !UML | 2350 | depends on !UML |
2341 | default y | 2351 | default y |
2352 | ---help--- | ||
2353 | Say Y here to get to see options for 10 Gigabit Ethernet drivers. | ||
2354 | This option alone does not add any kernel code. | ||
2355 | |||
2356 | If you say N, all options in this submenu will be skipped and disabled. | ||
2342 | 2357 | ||
2343 | if NETDEV_10000 | 2358 | if NETDEV_10000 |
2344 | 2359 | ||
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 56f6389a300e..3c1984ecf36c 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
@@ -1704,10 +1704,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1704 | } | 1704 | } |
1705 | } | 1705 | } |
1706 | 1706 | ||
1707 | local_irq_save(flags); | 1707 | if (!spin_trylock_irqsave(&adapter->lock, flags)) { |
1708 | if (!spin_trylock(&adapter->lock)) { | ||
1709 | /* Can't get lock - tell upper layer to requeue */ | 1708 | /* Can't get lock - tell upper layer to requeue */ |
1710 | local_irq_restore(flags); | ||
1711 | dev_printk(KERN_DEBUG, &adapter->pdev->dev, "tx locked\n"); | 1709 | dev_printk(KERN_DEBUG, &adapter->pdev->dev, "tx locked\n"); |
1712 | return NETDEV_TX_LOCKED; | 1710 | return NETDEV_TX_LOCKED; |
1713 | } | 1711 | } |
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c index 83da1770bafb..90e0734e6037 100644 --- a/drivers/net/ax88796.c +++ b/drivers/net/ax88796.c | |||
@@ -821,8 +821,9 @@ static int ax_probe(struct platform_device *pdev) | |||
821 | dev->base_addr = (unsigned long)ei_status.mem; | 821 | dev->base_addr = (unsigned long)ei_status.mem; |
822 | 822 | ||
823 | if (ei_status.mem == NULL) { | 823 | if (ei_status.mem == NULL) { |
824 | dev_err(&pdev->dev, "Cannot ioremap area (%08zx,%08zx)\n", | 824 | dev_err(&pdev->dev, "Cannot ioremap area (%08llx,%08llx)\n", |
825 | res->start, res->end); | 825 | (unsigned long long)res->start, |
826 | (unsigned long long)res->end); | ||
826 | 827 | ||
827 | ret = -ENXIO; | 828 | ret = -ENXIO; |
828 | goto exit_req; | 829 | goto exit_req; |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index d53dfc5bbae0..24e7f9ab3f5a 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -54,8 +54,8 @@ | |||
54 | 54 | ||
55 | #define DRV_MODULE_NAME "bnx2" | 55 | #define DRV_MODULE_NAME "bnx2" |
56 | #define PFX DRV_MODULE_NAME ": " | 56 | #define PFX DRV_MODULE_NAME ": " |
57 | #define DRV_MODULE_VERSION "1.6.3" | 57 | #define DRV_MODULE_VERSION "1.6.4" |
58 | #define DRV_MODULE_RELDATE "July 16, 2007" | 58 | #define DRV_MODULE_RELDATE "August 3, 2007" |
59 | 59 | ||
60 | #define RUN_AT(x) (jiffies + (x)) | 60 | #define RUN_AT(x) (jiffies + (x)) |
61 | 61 | ||
@@ -6937,6 +6937,11 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state) | |||
6937 | struct bnx2 *bp = netdev_priv(dev); | 6937 | struct bnx2 *bp = netdev_priv(dev); |
6938 | u32 reset_code; | 6938 | u32 reset_code; |
6939 | 6939 | ||
6940 | /* PCI register 4 needs to be saved whether netif_running() or not. | ||
6941 | * MSI address and data need to be saved if using MSI and | ||
6942 | * netif_running(). | ||
6943 | */ | ||
6944 | pci_save_state(pdev); | ||
6940 | if (!netif_running(dev)) | 6945 | if (!netif_running(dev)) |
6941 | return 0; | 6946 | return 0; |
6942 | 6947 | ||
@@ -6952,7 +6957,6 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state) | |||
6952 | reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; | 6957 | reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; |
6953 | bnx2_reset_chip(bp, reset_code); | 6958 | bnx2_reset_chip(bp, reset_code); |
6954 | bnx2_free_skbs(bp); | 6959 | bnx2_free_skbs(bp); |
6955 | pci_save_state(pdev); | ||
6956 | bnx2_set_power_state(bp, pci_choose_state(pdev, state)); | 6960 | bnx2_set_power_state(bp, pci_choose_state(pdev, state)); |
6957 | return 0; | 6961 | return 0; |
6958 | } | 6962 | } |
@@ -6963,10 +6967,10 @@ bnx2_resume(struct pci_dev *pdev) | |||
6963 | struct net_device *dev = pci_get_drvdata(pdev); | 6967 | struct net_device *dev = pci_get_drvdata(pdev); |
6964 | struct bnx2 *bp = netdev_priv(dev); | 6968 | struct bnx2 *bp = netdev_priv(dev); |
6965 | 6969 | ||
6970 | pci_restore_state(pdev); | ||
6966 | if (!netif_running(dev)) | 6971 | if (!netif_running(dev)) |
6967 | return 0; | 6972 | return 0; |
6968 | 6973 | ||
6969 | pci_restore_state(pdev); | ||
6970 | bnx2_set_power_state(bp, PCI_D0); | 6974 | bnx2_set_power_state(bp, PCI_D0); |
6971 | netif_device_attach(dev); | 6975 | netif_device_attach(dev); |
6972 | bnx2_init_nic(bp); | 6976 | bnx2_init_nic(bp); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 070b78d959cc..1afda3230def 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1202,43 +1202,35 @@ static int bond_sethwaddr(struct net_device *bond_dev, | |||
1202 | return 0; | 1202 | return 0; |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | #define BOND_INTERSECT_FEATURES \ | 1205 | #define BOND_VLAN_FEATURES \ |
1206 | (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_TSO | NETIF_F_UFO) | 1206 | (NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX | \ |
1207 | NETIF_F_HW_VLAN_FILTER) | ||
1207 | 1208 | ||
1208 | /* | 1209 | /* |
1209 | * Compute the common dev->feature set available to all slaves. Some | 1210 | * Compute the common dev->feature set available to all slaves. Some |
1210 | * feature bits are managed elsewhere, so preserve feature bits set on | 1211 | * feature bits are managed elsewhere, so preserve those feature bits |
1211 | * master device that are not part of the examined set. | 1212 | * on the master device. |
1212 | */ | 1213 | */ |
1213 | static int bond_compute_features(struct bonding *bond) | 1214 | static int bond_compute_features(struct bonding *bond) |
1214 | { | 1215 | { |
1215 | unsigned long features = BOND_INTERSECT_FEATURES; | ||
1216 | struct slave *slave; | 1216 | struct slave *slave; |
1217 | struct net_device *bond_dev = bond->dev; | 1217 | struct net_device *bond_dev = bond->dev; |
1218 | unsigned long features = bond_dev->features; | ||
1218 | unsigned short max_hard_header_len = ETH_HLEN; | 1219 | unsigned short max_hard_header_len = ETH_HLEN; |
1219 | int i; | 1220 | int i; |
1220 | 1221 | ||
1222 | features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES); | ||
1223 | features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | | ||
1224 | NETIF_F_GSO_MASK | NETIF_F_NO_CSUM; | ||
1225 | |||
1221 | bond_for_each_slave(bond, slave, i) { | 1226 | bond_for_each_slave(bond, slave, i) { |
1222 | features &= (slave->dev->features & BOND_INTERSECT_FEATURES); | 1227 | features = netdev_compute_features(features, |
1228 | slave->dev->features); | ||
1223 | if (slave->dev->hard_header_len > max_hard_header_len) | 1229 | if (slave->dev->hard_header_len > max_hard_header_len) |
1224 | max_hard_header_len = slave->dev->hard_header_len; | 1230 | max_hard_header_len = slave->dev->hard_header_len; |
1225 | } | 1231 | } |
1226 | 1232 | ||
1227 | if ((features & NETIF_F_SG) && | 1233 | features |= (bond_dev->features & BOND_VLAN_FEATURES); |
1228 | !(features & NETIF_F_ALL_CSUM)) | ||
1229 | features &= ~NETIF_F_SG; | ||
1230 | |||
1231 | /* | ||
1232 | * features will include NETIF_F_TSO (NETIF_F_UFO) iff all | ||
1233 | * slave devices support NETIF_F_TSO (NETIF_F_UFO), which | ||
1234 | * implies that all slaves also support scatter-gather | ||
1235 | * (NETIF_F_SG), which implies that features also includes | ||
1236 | * NETIF_F_SG. So no need to check whether we have an | ||
1237 | * illegal combination of NETIF_F_{TSO,UFO} and | ||
1238 | * !NETIF_F_SG | ||
1239 | */ | ||
1240 | |||
1241 | features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES); | ||
1242 | bond_dev->features = features; | 1234 | bond_dev->features = features; |
1243 | bond_dev->hard_header_len = max_hard_header_len; | 1235 | bond_dev->hard_header_len = max_hard_header_len; |
1244 | 1236 | ||
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index c90c92e72d2a..4c3785c9d4b8 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -1706,6 +1706,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol | |||
1706 | case E1000_DEV_ID_82545EM_COPPER: | 1706 | case E1000_DEV_ID_82545EM_COPPER: |
1707 | case E1000_DEV_ID_82546GB_QUAD_COPPER: | 1707 | case E1000_DEV_ID_82546GB_QUAD_COPPER: |
1708 | case E1000_DEV_ID_82546GB_PCIE: | 1708 | case E1000_DEV_ID_82546GB_PCIE: |
1709 | case E1000_DEV_ID_82571EB_SERDES_QUAD: | ||
1709 | /* these don't support WoL at all */ | 1710 | /* these don't support WoL at all */ |
1710 | wol->supported = 0; | 1711 | wol->supported = 0; |
1711 | break; | 1712 | break; |
@@ -1723,6 +1724,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol | |||
1723 | retval = 0; | 1724 | retval = 0; |
1724 | break; | 1725 | break; |
1725 | case E1000_DEV_ID_82571EB_QUAD_COPPER: | 1726 | case E1000_DEV_ID_82571EB_QUAD_COPPER: |
1727 | case E1000_DEV_ID_82571EB_QUAD_FIBER: | ||
1726 | case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: | 1728 | case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: |
1727 | case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: | 1729 | case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: |
1728 | /* quad port adapters only support WoL on port A */ | 1730 | /* quad port adapters only support WoL on port A */ |
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 9be44699300b..ba120f7fb0be 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -384,7 +384,10 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
384 | case E1000_DEV_ID_82571EB_COPPER: | 384 | case E1000_DEV_ID_82571EB_COPPER: |
385 | case E1000_DEV_ID_82571EB_FIBER: | 385 | case E1000_DEV_ID_82571EB_FIBER: |
386 | case E1000_DEV_ID_82571EB_SERDES: | 386 | case E1000_DEV_ID_82571EB_SERDES: |
387 | case E1000_DEV_ID_82571EB_SERDES_DUAL: | ||
388 | case E1000_DEV_ID_82571EB_SERDES_QUAD: | ||
387 | case E1000_DEV_ID_82571EB_QUAD_COPPER: | 389 | case E1000_DEV_ID_82571EB_QUAD_COPPER: |
390 | case E1000_DEV_ID_82571EB_QUAD_FIBER: | ||
388 | case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: | 391 | case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: |
389 | hw->mac_type = e1000_82571; | 392 | hw->mac_type = e1000_82571; |
390 | break; | 393 | break; |
@@ -485,6 +488,8 @@ e1000_set_media_type(struct e1000_hw *hw) | |||
485 | case E1000_DEV_ID_82545GM_SERDES: | 488 | case E1000_DEV_ID_82545GM_SERDES: |
486 | case E1000_DEV_ID_82546GB_SERDES: | 489 | case E1000_DEV_ID_82546GB_SERDES: |
487 | case E1000_DEV_ID_82571EB_SERDES: | 490 | case E1000_DEV_ID_82571EB_SERDES: |
491 | case E1000_DEV_ID_82571EB_SERDES_DUAL: | ||
492 | case E1000_DEV_ID_82571EB_SERDES_QUAD: | ||
488 | case E1000_DEV_ID_82572EI_SERDES: | 493 | case E1000_DEV_ID_82572EI_SERDES: |
489 | case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: | 494 | case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: |
490 | hw->media_type = e1000_media_type_internal_serdes; | 495 | hw->media_type = e1000_media_type_internal_serdes; |
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index bd000b802ee7..fe8714655c90 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h | |||
@@ -475,7 +475,10 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); | |||
475 | #define E1000_DEV_ID_82571EB_FIBER 0x105F | 475 | #define E1000_DEV_ID_82571EB_FIBER 0x105F |
476 | #define E1000_DEV_ID_82571EB_SERDES 0x1060 | 476 | #define E1000_DEV_ID_82571EB_SERDES 0x1060 |
477 | #define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4 | 477 | #define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4 |
478 | #define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5 | ||
478 | #define E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE 0x10BC | 479 | #define E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE 0x10BC |
480 | #define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9 | ||
481 | #define E1000_DEV_ID_82571EB_SERDES_QUAD 0x10DA | ||
479 | #define E1000_DEV_ID_82572EI_COPPER 0x107D | 482 | #define E1000_DEV_ID_82572EI_COPPER 0x107D |
480 | #define E1000_DEV_ID_82572EI_FIBER 0x107E | 483 | #define E1000_DEV_ID_82572EI_FIBER 0x107E |
481 | #define E1000_DEV_ID_82572EI_SERDES 0x107F | 484 | #define E1000_DEV_ID_82572EI_SERDES 0x107F |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index f48b659e0c2b..4a225950fb43 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -100,6 +100,7 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
100 | INTEL_E1000_ETHERNET_DEVICE(0x1099), | 100 | INTEL_E1000_ETHERNET_DEVICE(0x1099), |
101 | INTEL_E1000_ETHERNET_DEVICE(0x109A), | 101 | INTEL_E1000_ETHERNET_DEVICE(0x109A), |
102 | INTEL_E1000_ETHERNET_DEVICE(0x10A4), | 102 | INTEL_E1000_ETHERNET_DEVICE(0x10A4), |
103 | INTEL_E1000_ETHERNET_DEVICE(0x10A5), | ||
103 | INTEL_E1000_ETHERNET_DEVICE(0x10B5), | 104 | INTEL_E1000_ETHERNET_DEVICE(0x10B5), |
104 | INTEL_E1000_ETHERNET_DEVICE(0x10B9), | 105 | INTEL_E1000_ETHERNET_DEVICE(0x10B9), |
105 | INTEL_E1000_ETHERNET_DEVICE(0x10BA), | 106 | INTEL_E1000_ETHERNET_DEVICE(0x10BA), |
@@ -107,6 +108,8 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
107 | INTEL_E1000_ETHERNET_DEVICE(0x10BC), | 108 | INTEL_E1000_ETHERNET_DEVICE(0x10BC), |
108 | INTEL_E1000_ETHERNET_DEVICE(0x10C4), | 109 | INTEL_E1000_ETHERNET_DEVICE(0x10C4), |
109 | INTEL_E1000_ETHERNET_DEVICE(0x10C5), | 110 | INTEL_E1000_ETHERNET_DEVICE(0x10C5), |
111 | INTEL_E1000_ETHERNET_DEVICE(0x10D9), | ||
112 | INTEL_E1000_ETHERNET_DEVICE(0x10DA), | ||
110 | /* required last entry */ | 113 | /* required last entry */ |
111 | {0,} | 114 | {0,} |
112 | }; | 115 | }; |
@@ -1096,6 +1099,7 @@ e1000_probe(struct pci_dev *pdev, | |||
1096 | break; | 1099 | break; |
1097 | case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: | 1100 | case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: |
1098 | case E1000_DEV_ID_82571EB_QUAD_COPPER: | 1101 | case E1000_DEV_ID_82571EB_QUAD_COPPER: |
1102 | case E1000_DEV_ID_82571EB_QUAD_FIBER: | ||
1099 | case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: | 1103 | case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: |
1100 | /* if quad port adapter, disable WoL on all but port A */ | 1104 | /* if quad port adapter, disable WoL on all but port A */ |
1101 | if (global_quad_port_a != 0) | 1105 | if (global_quad_port_a != 0) |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 8ee2c2c86b42..d67f97bfa3a4 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | 40 | ||
41 | #define DRV_NAME "ehea" | 41 | #define DRV_NAME "ehea" |
42 | #define DRV_VERSION "EHEA_0072" | 42 | #define DRV_VERSION "EHEA_0073" |
43 | 43 | ||
44 | /* eHEA capability flags */ | 44 | /* eHEA capability flags */ |
45 | #define DLPAR_PORT_ADD_REM 1 | 45 | #define DLPAR_PORT_ADD_REM 1 |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 58702f54c3fb..9756211e83ce 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -1326,7 +1326,6 @@ static void write_swqe2_TSO(struct sk_buff *skb, | |||
1326 | u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0]; | 1326 | u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0]; |
1327 | int skb_data_size = skb->len - skb->data_len; | 1327 | int skb_data_size = skb->len - skb->data_len; |
1328 | int headersize; | 1328 | int headersize; |
1329 | u64 tmp_addr; | ||
1330 | 1329 | ||
1331 | /* Packet is TCP with TSO enabled */ | 1330 | /* Packet is TCP with TSO enabled */ |
1332 | swqe->tx_control |= EHEA_SWQE_TSO; | 1331 | swqe->tx_control |= EHEA_SWQE_TSO; |
@@ -1347,9 +1346,8 @@ static void write_swqe2_TSO(struct sk_buff *skb, | |||
1347 | /* set sg1entry data */ | 1346 | /* set sg1entry data */ |
1348 | sg1entry->l_key = lkey; | 1347 | sg1entry->l_key = lkey; |
1349 | sg1entry->len = skb_data_size - headersize; | 1348 | sg1entry->len = skb_data_size - headersize; |
1350 | 1349 | sg1entry->vaddr = | |
1351 | tmp_addr = (u64)(skb->data + headersize); | 1350 | ehea_map_vaddr(skb->data + headersize); |
1352 | sg1entry->vaddr = ehea_map_vaddr(tmp_addr); | ||
1353 | swqe->descriptors++; | 1351 | swqe->descriptors++; |
1354 | } | 1352 | } |
1355 | } else | 1353 | } else |
@@ -1362,7 +1360,6 @@ static void write_swqe2_nonTSO(struct sk_buff *skb, | |||
1362 | int skb_data_size = skb->len - skb->data_len; | 1360 | int skb_data_size = skb->len - skb->data_len; |
1363 | u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0]; | 1361 | u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0]; |
1364 | struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry; | 1362 | struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry; |
1365 | u64 tmp_addr; | ||
1366 | 1363 | ||
1367 | /* Packet is any nonTSO type | 1364 | /* Packet is any nonTSO type |
1368 | * | 1365 | * |
@@ -1379,8 +1376,8 @@ static void write_swqe2_nonTSO(struct sk_buff *skb, | |||
1379 | /* copy sg1entry data */ | 1376 | /* copy sg1entry data */ |
1380 | sg1entry->l_key = lkey; | 1377 | sg1entry->l_key = lkey; |
1381 | sg1entry->len = skb_data_size - SWQE2_MAX_IMM; | 1378 | sg1entry->len = skb_data_size - SWQE2_MAX_IMM; |
1382 | tmp_addr = (u64)(skb->data + SWQE2_MAX_IMM); | 1379 | sg1entry->vaddr = |
1383 | sg1entry->vaddr = ehea_map_vaddr(tmp_addr); | 1380 | ehea_map_vaddr(skb->data + SWQE2_MAX_IMM); |
1384 | swqe->descriptors++; | 1381 | swqe->descriptors++; |
1385 | } | 1382 | } |
1386 | } else { | 1383 | } else { |
@@ -1395,7 +1392,6 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev, | |||
1395 | struct ehea_vsgentry *sg_list, *sg1entry, *sgentry; | 1392 | struct ehea_vsgentry *sg_list, *sg1entry, *sgentry; |
1396 | skb_frag_t *frag; | 1393 | skb_frag_t *frag; |
1397 | int nfrags, sg1entry_contains_frag_data, i; | 1394 | int nfrags, sg1entry_contains_frag_data, i; |
1398 | u64 tmp_addr; | ||
1399 | 1395 | ||
1400 | nfrags = skb_shinfo(skb)->nr_frags; | 1396 | nfrags = skb_shinfo(skb)->nr_frags; |
1401 | sg1entry = &swqe->u.immdata_desc.sg_entry; | 1397 | sg1entry = &swqe->u.immdata_desc.sg_entry; |
@@ -1417,9 +1413,9 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev, | |||
1417 | /* copy sg1entry data */ | 1413 | /* copy sg1entry data */ |
1418 | sg1entry->l_key = lkey; | 1414 | sg1entry->l_key = lkey; |
1419 | sg1entry->len = frag->size; | 1415 | sg1entry->len = frag->size; |
1420 | tmp_addr = (u64)(page_address(frag->page) | 1416 | sg1entry->vaddr = |
1421 | + frag->page_offset); | 1417 | ehea_map_vaddr(page_address(frag->page) |
1422 | sg1entry->vaddr = ehea_map_vaddr(tmp_addr); | 1418 | + frag->page_offset); |
1423 | swqe->descriptors++; | 1419 | swqe->descriptors++; |
1424 | sg1entry_contains_frag_data = 1; | 1420 | sg1entry_contains_frag_data = 1; |
1425 | } | 1421 | } |
@@ -1431,10 +1427,9 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev, | |||
1431 | 1427 | ||
1432 | sgentry->l_key = lkey; | 1428 | sgentry->l_key = lkey; |
1433 | sgentry->len = frag->size; | 1429 | sgentry->len = frag->size; |
1434 | 1430 | sgentry->vaddr = | |
1435 | tmp_addr = (u64)(page_address(frag->page) | 1431 | ehea_map_vaddr(page_address(frag->page) |
1436 | + frag->page_offset); | 1432 | + frag->page_offset); |
1437 | sgentry->vaddr = ehea_map_vaddr(tmp_addr); | ||
1438 | swqe->descriptors++; | 1433 | swqe->descriptors++; |
1439 | } | 1434 | } |
1440 | } | 1435 | } |
@@ -2165,24 +2160,18 @@ static int ehea_clean_all_portres(struct ehea_port *port) | |||
2165 | return ret; | 2160 | return ret; |
2166 | } | 2161 | } |
2167 | 2162 | ||
2168 | static void ehea_remove_adapter_mr (struct ehea_adapter *adapter) | 2163 | static void ehea_remove_adapter_mr(struct ehea_adapter *adapter) |
2169 | { | 2164 | { |
2170 | int i; | 2165 | if (adapter->active_ports) |
2171 | 2166 | return; | |
2172 | for (i=0; i < EHEA_MAX_PORTS; i++) | ||
2173 | if (adapter->port[i]) | ||
2174 | return; | ||
2175 | 2167 | ||
2176 | ehea_rem_mr(&adapter->mr); | 2168 | ehea_rem_mr(&adapter->mr); |
2177 | } | 2169 | } |
2178 | 2170 | ||
2179 | static int ehea_add_adapter_mr (struct ehea_adapter *adapter) | 2171 | static int ehea_add_adapter_mr(struct ehea_adapter *adapter) |
2180 | { | 2172 | { |
2181 | int i; | 2173 | if (adapter->active_ports) |
2182 | 2174 | return 0; | |
2183 | for (i=0; i < EHEA_MAX_PORTS; i++) | ||
2184 | if (adapter->port[i]) | ||
2185 | return 0; | ||
2186 | 2175 | ||
2187 | return ehea_reg_kernel_mr(adapter, &adapter->mr); | 2176 | return ehea_reg_kernel_mr(adapter, &adapter->mr); |
2188 | } | 2177 | } |
@@ -3099,6 +3088,7 @@ out: | |||
3099 | 3088 | ||
3100 | static void __exit ehea_module_exit(void) | 3089 | static void __exit ehea_module_exit(void) |
3101 | { | 3090 | { |
3091 | destroy_workqueue(ehea_driver_wq); | ||
3102 | driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); | 3092 | driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); |
3103 | ibmebus_unregister_driver(&ehea_driver); | 3093 | ibmebus_unregister_driver(&ehea_driver); |
3104 | ehea_destroy_busmap(); | 3094 | ehea_destroy_busmap(); |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 69f5f365239a..10f4e3b55168 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -3068,8 +3068,8 @@ static irqreturn_t nv_nic_irq(int foo, void *data) | |||
3068 | np->nic_poll_irq = np->irqmask; | 3068 | np->nic_poll_irq = np->irqmask; |
3069 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); | 3069 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
3070 | } | 3070 | } |
3071 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i); | ||
3072 | spin_unlock(&np->lock); | 3071 | spin_unlock(&np->lock); |
3072 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i); | ||
3073 | break; | 3073 | break; |
3074 | } | 3074 | } |
3075 | 3075 | ||
@@ -3186,8 +3186,8 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data) | |||
3186 | np->nic_poll_irq = np->irqmask; | 3186 | np->nic_poll_irq = np->irqmask; |
3187 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); | 3187 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
3188 | } | 3188 | } |
3189 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i); | ||
3190 | spin_unlock(&np->lock); | 3189 | spin_unlock(&np->lock); |
3190 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i); | ||
3191 | break; | 3191 | break; |
3192 | } | 3192 | } |
3193 | 3193 | ||
@@ -3233,8 +3233,8 @@ static irqreturn_t nv_nic_irq_tx(int foo, void *data) | |||
3233 | np->nic_poll_irq |= NVREG_IRQ_TX_ALL; | 3233 | np->nic_poll_irq |= NVREG_IRQ_TX_ALL; |
3234 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); | 3234 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
3235 | } | 3235 | } |
3236 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_tx.\n", dev->name, i); | ||
3237 | spin_unlock_irqrestore(&np->lock, flags); | 3236 | spin_unlock_irqrestore(&np->lock, flags); |
3237 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_tx.\n", dev->name, i); | ||
3238 | break; | 3238 | break; |
3239 | } | 3239 | } |
3240 | 3240 | ||
@@ -3348,8 +3348,8 @@ static irqreturn_t nv_nic_irq_rx(int foo, void *data) | |||
3348 | np->nic_poll_irq |= NVREG_IRQ_RX_ALL; | 3348 | np->nic_poll_irq |= NVREG_IRQ_RX_ALL; |
3349 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); | 3349 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
3350 | } | 3350 | } |
3351 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_rx.\n", dev->name, i); | ||
3352 | spin_unlock_irqrestore(&np->lock, flags); | 3351 | spin_unlock_irqrestore(&np->lock, flags); |
3352 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_rx.\n", dev->name, i); | ||
3353 | break; | 3353 | break; |
3354 | } | 3354 | } |
3355 | } | 3355 | } |
@@ -3421,8 +3421,8 @@ static irqreturn_t nv_nic_irq_other(int foo, void *data) | |||
3421 | np->nic_poll_irq |= NVREG_IRQ_OTHER; | 3421 | np->nic_poll_irq |= NVREG_IRQ_OTHER; |
3422 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); | 3422 | mod_timer(&np->nic_poll, jiffies + POLL_WAIT); |
3423 | } | 3423 | } |
3424 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_other.\n", dev->name, i); | ||
3425 | spin_unlock_irqrestore(&np->lock, flags); | 3424 | spin_unlock_irqrestore(&np->lock, flags); |
3425 | printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_other.\n", dev->name, i); | ||
3426 | break; | 3426 | break; |
3427 | } | 3427 | } |
3428 | 3428 | ||
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index d96eb7229548..acba90f1638e 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -963,7 +963,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_ | |||
963 | { | 963 | { |
964 | int rc, i; | 964 | int rc, i; |
965 | struct net_device *netdev; | 965 | struct net_device *netdev; |
966 | struct ibmveth_adapter *adapter = NULL; | 966 | struct ibmveth_adapter *adapter; |
967 | 967 | ||
968 | unsigned char *mac_addr_p; | 968 | unsigned char *mac_addr_p; |
969 | unsigned int *mcastFilterSize_p; | 969 | unsigned int *mcastFilterSize_p; |
@@ -997,7 +997,6 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_ | |||
997 | SET_MODULE_OWNER(netdev); | 997 | SET_MODULE_OWNER(netdev); |
998 | 998 | ||
999 | adapter = netdev->priv; | 999 | adapter = netdev->priv; |
1000 | memset(adapter, 0, sizeof(adapter)); | ||
1001 | dev->dev.driver_data = netdev; | 1000 | dev->dev.driver_data = netdev; |
1002 | 1001 | ||
1003 | adapter->vdev = dev; | 1002 | adapter->vdev = dev; |
@@ -1280,24 +1279,28 @@ const char * buf, size_t count) | |||
1280 | int i; | 1279 | int i; |
1281 | /* Make sure there is a buffer pool with buffers that | 1280 | /* Make sure there is a buffer pool with buffers that |
1282 | can hold a packet of the size of the MTU */ | 1281 | can hold a packet of the size of the MTU */ |
1283 | for(i = 0; i<IbmVethNumBufferPools; i++) { | 1282 | for (i = 0; i < IbmVethNumBufferPools; i++) { |
1284 | if (pool == &adapter->rx_buff_pool[i]) | 1283 | if (pool == &adapter->rx_buff_pool[i]) |
1285 | continue; | 1284 | continue; |
1286 | if (!adapter->rx_buff_pool[i].active) | 1285 | if (!adapter->rx_buff_pool[i].active) |
1287 | continue; | 1286 | continue; |
1288 | if (mtu < adapter->rx_buff_pool[i].buff_size) { | 1287 | if (mtu <= adapter->rx_buff_pool[i].buff_size) |
1289 | pool->active = 0; | 1288 | break; |
1290 | h_free_logical_lan_buffer(adapter-> | ||
1291 | vdev-> | ||
1292 | unit_address, | ||
1293 | pool-> | ||
1294 | buff_size); | ||
1295 | } | ||
1296 | } | 1289 | } |
1297 | if (pool->active) { | 1290 | |
1291 | if (i == IbmVethNumBufferPools) { | ||
1298 | ibmveth_error_printk("no active pool >= MTU\n"); | 1292 | ibmveth_error_printk("no active pool >= MTU\n"); |
1299 | return -EPERM; | 1293 | return -EPERM; |
1300 | } | 1294 | } |
1295 | |||
1296 | pool->active = 0; | ||
1297 | if (netif_running(netdev)) { | ||
1298 | adapter->pool_config = 1; | ||
1299 | ibmveth_close(netdev); | ||
1300 | adapter->pool_config = 0; | ||
1301 | if ((rc = ibmveth_open(netdev))) | ||
1302 | return rc; | ||
1303 | } | ||
1301 | } | 1304 | } |
1302 | } else if (attr == &veth_num_attr) { | 1305 | } else if (attr == &veth_num_attr) { |
1303 | if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT) | 1306 | if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT) |
diff --git a/drivers/net/ibmveth.h b/drivers/net/ibmveth.h index bb69ccae8ace..72cc15a6cab7 100644 --- a/drivers/net/ibmveth.h +++ b/drivers/net/ibmveth.h | |||
@@ -73,9 +73,6 @@ static inline long h_send_logical_lan(unsigned long unit_address, | |||
73 | #define h_change_logical_lan_mac(ua, mac) \ | 73 | #define h_change_logical_lan_mac(ua, mac) \ |
74 | plpar_hcall_norets(H_CHANGE_LOGICAL_LAN_MAC, ua, mac) | 74 | plpar_hcall_norets(H_CHANGE_LOGICAL_LAN_MAC, ua, mac) |
75 | 75 | ||
76 | #define h_free_logical_lan_buffer(ua, bufsize) \ | ||
77 | plpar_hcall_norets(H_FREE_LOGICAL_LAN_BUFFER, ua, bufsize) | ||
78 | |||
79 | #define IbmVethNumBufferPools 5 | 76 | #define IbmVethNumBufferPools 5 |
80 | #define IBMVETH_BUFF_OH 22 /* Overhead: 14 ethernet header + 8 opaque handle */ | 77 | #define IBMVETH_BUFF_OH 22 /* Overhead: 14 ethernet header + 8 opaque handle */ |
81 | #define IBMVETH_MAX_MTU 68 | 78 | #define IBMVETH_MAX_MTU 68 |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 0ac240ca905b..3b0fd83fa266 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -1561,10 +1561,9 @@ static inline struct irda_class_desc *irda_usb_find_class_desc(struct usb_interf | |||
1561 | struct irda_class_desc *desc; | 1561 | struct irda_class_desc *desc; |
1562 | int ret; | 1562 | int ret; |
1563 | 1563 | ||
1564 | desc = kmalloc(sizeof (*desc), GFP_KERNEL); | 1564 | desc = kzalloc(sizeof(*desc), GFP_KERNEL); |
1565 | if (desc == NULL) | 1565 | if (!desc) |
1566 | return NULL; | 1566 | return NULL; |
1567 | memset(desc, 0, sizeof(*desc)); | ||
1568 | 1567 | ||
1569 | /* USB-IrDA class spec 1.0: | 1568 | /* USB-IrDA class spec 1.0: |
1570 | * 6.1.3: Standard "Get Descriptor" Device Request is not | 1569 | * 6.1.3: Standard "Get Descriptor" Device Request is not |
@@ -1617,7 +1616,7 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
1617 | { | 1616 | { |
1618 | struct net_device *net; | 1617 | struct net_device *net; |
1619 | struct usb_device *dev = interface_to_usbdev(intf); | 1618 | struct usb_device *dev = interface_to_usbdev(intf); |
1620 | struct irda_usb_cb *self = NULL; | 1619 | struct irda_usb_cb *self; |
1621 | struct usb_host_interface *interface; | 1620 | struct usb_host_interface *interface; |
1622 | struct irda_class_desc *irda_desc; | 1621 | struct irda_class_desc *irda_desc; |
1623 | int ret = -ENOMEM; | 1622 | int ret = -ENOMEM; |
@@ -1655,7 +1654,7 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
1655 | self->header_length = USB_IRDA_HEADER; | 1654 | self->header_length = USB_IRDA_HEADER; |
1656 | } | 1655 | } |
1657 | 1656 | ||
1658 | self->rx_urb = kzalloc(self->max_rx_urb * sizeof(struct urb *), | 1657 | self->rx_urb = kcalloc(self->max_rx_urb, sizeof(struct urb *), |
1659 | GFP_KERNEL); | 1658 | GFP_KERNEL); |
1660 | 1659 | ||
1661 | for (i = 0; i < self->max_rx_urb; i++) { | 1660 | for (i = 0; i < self->max_rx_urb; i++) { |
@@ -1715,7 +1714,7 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
1715 | /* Find IrDA class descriptor */ | 1714 | /* Find IrDA class descriptor */ |
1716 | irda_desc = irda_usb_find_class_desc(intf); | 1715 | irda_desc = irda_usb_find_class_desc(intf); |
1717 | ret = -ENODEV; | 1716 | ret = -ENODEV; |
1718 | if (irda_desc == NULL) | 1717 | if (!irda_desc) |
1719 | goto err_out_3; | 1718 | goto err_out_3; |
1720 | 1719 | ||
1721 | if (self->needspatch) { | 1720 | if (self->needspatch) { |
@@ -1738,15 +1737,13 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
1738 | /* Don't change this buffer size and allocation without doing | 1737 | /* Don't change this buffer size and allocation without doing |
1739 | * some heavy and complete testing. Don't ask why :-( | 1738 | * some heavy and complete testing. Don't ask why :-( |
1740 | * Jean II */ | 1739 | * Jean II */ |
1741 | self->speed_buff = kmalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); | 1740 | self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); |
1742 | if (self->speed_buff == NULL) | 1741 | if (!self->speed_buff) |
1743 | goto err_out_3; | 1742 | goto err_out_3; |
1744 | 1743 | ||
1745 | memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU); | ||
1746 | |||
1747 | self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length, | 1744 | self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length, |
1748 | GFP_KERNEL); | 1745 | GFP_KERNEL); |
1749 | if (self->tx_buff == NULL) | 1746 | if (!self->tx_buff) |
1750 | goto err_out_4; | 1747 | goto err_out_4; |
1751 | 1748 | ||
1752 | ret = irda_usb_open(self); | 1749 | ret = irda_usb_open(self); |
@@ -1767,12 +1764,11 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
1767 | 1764 | ||
1768 | /* replace IrDA class descriptor with what patched device is now reporting */ | 1765 | /* replace IrDA class descriptor with what patched device is now reporting */ |
1769 | irda_desc = irda_usb_find_class_desc (self->usbintf); | 1766 | irda_desc = irda_usb_find_class_desc (self->usbintf); |
1770 | if (irda_desc == NULL) { | 1767 | if (!irda_desc) { |
1771 | ret = -ENODEV; | 1768 | ret = -ENODEV; |
1772 | goto err_out_6; | 1769 | goto err_out_6; |
1773 | } | 1770 | } |
1774 | if (self->irda_desc) | 1771 | kfree(self->irda_desc); |
1775 | kfree (self->irda_desc); | ||
1776 | self->irda_desc = irda_desc; | 1772 | self->irda_desc = irda_desc; |
1777 | irda_usb_init_qos(self); | 1773 | irda_usb_init_qos(self); |
1778 | } | 1774 | } |
diff --git a/drivers/net/mlx4/reset.c b/drivers/net/mlx4/reset.c index e4dfd4b11a4a..e199715fabd0 100644 --- a/drivers/net/mlx4/reset.c +++ b/drivers/net/mlx4/reset.c | |||
@@ -119,6 +119,9 @@ int mlx4_reset(struct mlx4_dev *dev) | |||
119 | writel(MLX4_RESET_VALUE, reset + MLX4_RESET_OFFSET); | 119 | writel(MLX4_RESET_VALUE, reset + MLX4_RESET_OFFSET); |
120 | iounmap(reset); | 120 | iounmap(reset); |
121 | 121 | ||
122 | /* Docs say to wait one second before accessing device */ | ||
123 | msleep(1000); | ||
124 | |||
122 | end = jiffies + MLX4_RESET_TIMEOUT_JIFFIES; | 125 | end = jiffies + MLX4_RESET_TIMEOUT_JIFFIES; |
123 | do { | 126 | do { |
124 | if (!pci_read_config_word(dev->pdev, PCI_VENDOR_ID, &vendor) && | 127 | if (!pci_read_config_word(dev->pdev, PCI_VENDOR_ID, &vendor) && |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index deca65330b0f..ae9bb7b7fd67 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -191,6 +191,7 @@ struct myri10ge_priv { | |||
191 | struct timer_list watchdog_timer; | 191 | struct timer_list watchdog_timer; |
192 | int watchdog_tx_done; | 192 | int watchdog_tx_done; |
193 | int watchdog_tx_req; | 193 | int watchdog_tx_req; |
194 | int watchdog_pause; | ||
194 | int watchdog_resets; | 195 | int watchdog_resets; |
195 | int tx_linearized; | 196 | int tx_linearized; |
196 | int pause; | 197 | int pause; |
@@ -2800,6 +2801,7 @@ static void myri10ge_watchdog(struct work_struct *work) | |||
2800 | static void myri10ge_watchdog_timer(unsigned long arg) | 2801 | static void myri10ge_watchdog_timer(unsigned long arg) |
2801 | { | 2802 | { |
2802 | struct myri10ge_priv *mgp; | 2803 | struct myri10ge_priv *mgp; |
2804 | u32 rx_pause_cnt; | ||
2803 | 2805 | ||
2804 | mgp = (struct myri10ge_priv *)arg; | 2806 | mgp = (struct myri10ge_priv *)arg; |
2805 | 2807 | ||
@@ -2816,19 +2818,28 @@ static void myri10ge_watchdog_timer(unsigned long arg) | |||
2816 | myri10ge_fill_thresh) | 2818 | myri10ge_fill_thresh) |
2817 | mgp->rx_big.watchdog_needed = 0; | 2819 | mgp->rx_big.watchdog_needed = 0; |
2818 | } | 2820 | } |
2821 | rx_pause_cnt = ntohl(mgp->fw_stats->dropped_pause); | ||
2819 | 2822 | ||
2820 | if (mgp->tx.req != mgp->tx.done && | 2823 | if (mgp->tx.req != mgp->tx.done && |
2821 | mgp->tx.done == mgp->watchdog_tx_done && | 2824 | mgp->tx.done == mgp->watchdog_tx_done && |
2822 | mgp->watchdog_tx_req != mgp->watchdog_tx_done) | 2825 | mgp->watchdog_tx_req != mgp->watchdog_tx_done) { |
2823 | /* nic seems like it might be stuck.. */ | 2826 | /* nic seems like it might be stuck.. */ |
2824 | schedule_work(&mgp->watchdog_work); | 2827 | if (rx_pause_cnt != mgp->watchdog_pause) { |
2825 | else | 2828 | if (net_ratelimit()) |
2826 | /* rearm timer */ | 2829 | printk(KERN_WARNING "myri10ge %s:" |
2827 | mod_timer(&mgp->watchdog_timer, | 2830 | "TX paused, check link partner\n", |
2828 | jiffies + myri10ge_watchdog_timeout * HZ); | 2831 | mgp->dev->name); |
2829 | 2832 | } else { | |
2833 | schedule_work(&mgp->watchdog_work); | ||
2834 | return; | ||
2835 | } | ||
2836 | } | ||
2837 | /* rearm timer */ | ||
2838 | mod_timer(&mgp->watchdog_timer, | ||
2839 | jiffies + myri10ge_watchdog_timeout * HZ); | ||
2830 | mgp->watchdog_tx_done = mgp->tx.done; | 2840 | mgp->watchdog_tx_done = mgp->tx.done; |
2831 | mgp->watchdog_tx_req = mgp->tx.req; | 2841 | mgp->watchdog_tx_req = mgp->tx.req; |
2842 | mgp->watchdog_pause = rx_pause_cnt; | ||
2832 | } | 2843 | } |
2833 | 2844 | ||
2834 | static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 2845 | static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 6bb48ba80964..b47a12d684f9 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -2438,13 +2438,16 @@ static void netdev_error(struct net_device *dev, int intr_status) | |||
2438 | dev->name); | 2438 | dev->name); |
2439 | } | 2439 | } |
2440 | np->stats.rx_fifo_errors++; | 2440 | np->stats.rx_fifo_errors++; |
2441 | np->stats.rx_errors++; | ||
2441 | } | 2442 | } |
2442 | /* Hmmmmm, it's not clear how to recover from PCI faults. */ | 2443 | /* Hmmmmm, it's not clear how to recover from PCI faults. */ |
2443 | if (intr_status & IntrPCIErr) { | 2444 | if (intr_status & IntrPCIErr) { |
2444 | printk(KERN_NOTICE "%s: PCI error %#08x\n", dev->name, | 2445 | printk(KERN_NOTICE "%s: PCI error %#08x\n", dev->name, |
2445 | intr_status & IntrPCIErr); | 2446 | intr_status & IntrPCIErr); |
2446 | np->stats.tx_fifo_errors++; | 2447 | np->stats.tx_fifo_errors++; |
2448 | np->stats.tx_errors++; | ||
2447 | np->stats.rx_fifo_errors++; | 2449 | np->stats.rx_fifo_errors++; |
2450 | np->stats.rx_errors++; | ||
2448 | } | 2451 | } |
2449 | spin_unlock(&np->lock); | 2452 | spin_unlock(&np->lock); |
2450 | } | 2453 | } |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index f71dab347667..e323efd4ed18 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -261,7 +261,7 @@ void phy_sanitize_settings(struct phy_device *phydev) | |||
261 | 261 | ||
262 | /* Sanitize settings based on PHY capabilities */ | 262 | /* Sanitize settings based on PHY capabilities */ |
263 | if ((features & SUPPORTED_Autoneg) == 0) | 263 | if ((features & SUPPORTED_Autoneg) == 0) |
264 | phydev->autoneg = 0; | 264 | phydev->autoneg = AUTONEG_DISABLE; |
265 | 265 | ||
266 | idx = phy_find_valid(phy_find_setting(phydev->speed, phydev->duplex), | 266 | idx = phy_find_valid(phy_find_setting(phydev->speed, phydev->duplex), |
267 | features); | 267 | features); |
@@ -374,7 +374,7 @@ int phy_mii_ioctl(struct phy_device *phydev, | |||
374 | if (mii_data->phy_id == phydev->addr) { | 374 | if (mii_data->phy_id == phydev->addr) { |
375 | switch(mii_data->reg_num) { | 375 | switch(mii_data->reg_num) { |
376 | case MII_BMCR: | 376 | case MII_BMCR: |
377 | if (val & (BMCR_RESET|BMCR_ANENABLE)) | 377 | if ((val & (BMCR_RESET|BMCR_ANENABLE)) == 0) |
378 | phydev->autoneg = AUTONEG_DISABLE; | 378 | phydev->autoneg = AUTONEG_DISABLE; |
379 | else | 379 | else |
380 | phydev->autoneg = AUTONEG_ENABLE; | 380 | phydev->autoneg = AUTONEG_ENABLE; |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index ef3325b69233..9293c82ef2af 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -1726,7 +1726,7 @@ ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1726 | } | 1726 | } |
1727 | /* the decompressor still expects the A/C bytes in the hdr */ | 1727 | /* the decompressor still expects the A/C bytes in the hdr */ |
1728 | len = ppp->rcomp->decompress(ppp->rc_state, skb->data - 2, | 1728 | len = ppp->rcomp->decompress(ppp->rc_state, skb->data - 2, |
1729 | skb->len + 2, ns->data, ppp->mru + PPP_HDRLEN); | 1729 | skb->len + 2, ns->data, obuff_size); |
1730 | if (len < 0) { | 1730 | if (len < 0) { |
1731 | /* Pass the compressed frame to pppd as an | 1731 | /* Pass the compressed frame to pppd as an |
1732 | error indication. */ | 1732 | error indication. */ |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index c9333b9dd51a..b85ab4a8f2a3 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -725,6 +725,12 @@ static int rtl8169_set_speed_xmii(struct net_device *dev, | |||
725 | 725 | ||
726 | auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; | 726 | auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; |
727 | 727 | ||
728 | if (tp->mac_version == RTL_GIGA_MAC_VER_12) { | ||
729 | /* Vendor specific (0x1f) and reserved (0x0e) MII registers. */ | ||
730 | mdio_write(ioaddr, 0x1f, 0x0000); | ||
731 | mdio_write(ioaddr, 0x0e, 0x0000); | ||
732 | } | ||
733 | |||
728 | tp->phy_auto_nego_reg = auto_nego; | 734 | tp->phy_auto_nego_reg = auto_nego; |
729 | tp->phy_1000_ctrl_reg = giga_ctrl; | 735 | tp->phy_1000_ctrl_reg = giga_ctrl; |
730 | 736 | ||
@@ -2760,14 +2766,16 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) | |||
2760 | rtl8169_check_link_status(dev, tp, ioaddr); | 2766 | rtl8169_check_link_status(dev, tp, ioaddr); |
2761 | 2767 | ||
2762 | #ifdef CONFIG_R8169_NAPI | 2768 | #ifdef CONFIG_R8169_NAPI |
2763 | RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event); | 2769 | if (status & tp->napi_event) { |
2764 | tp->intr_mask = ~tp->napi_event; | 2770 | RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event); |
2765 | 2771 | tp->intr_mask = ~tp->napi_event; | |
2766 | if (likely(netif_rx_schedule_prep(dev))) | 2772 | |
2767 | __netif_rx_schedule(dev); | 2773 | if (likely(netif_rx_schedule_prep(dev))) |
2768 | else if (netif_msg_intr(tp)) { | 2774 | __netif_rx_schedule(dev); |
2769 | printk(KERN_INFO "%s: interrupt %04x taken in poll\n", | 2775 | else if (netif_msg_intr(tp)) { |
2770 | dev->name, status); | 2776 | printk(KERN_INFO "%s: interrupt %04x in poll\n", |
2777 | dev->name, status); | ||
2778 | } | ||
2771 | } | 2779 | } |
2772 | break; | 2780 | break; |
2773 | #else | 2781 | #else |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 2be0a0f1b48f..24feb00600ee 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -2430,7 +2430,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2430 | (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) { | 2430 | (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) { |
2431 | pci_unmap_single | 2431 | pci_unmap_single |
2432 | (nic->pdev, | 2432 | (nic->pdev, |
2433 | (dma_addr_t)skb->data, | 2433 | (dma_addr_t)rxdp3->Buffer2_ptr, |
2434 | dev->mtu + 4, | 2434 | dev->mtu + 4, |
2435 | PCI_DMA_FROMDEVICE); | 2435 | PCI_DMA_FROMDEVICE); |
2436 | goto pci_map_failed; | 2436 | goto pci_map_failed; |
@@ -6211,7 +6211,7 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp, | |||
6211 | if( (rxdp3->Buffer0_ptr == 0) || | 6211 | if( (rxdp3->Buffer0_ptr == 0) || |
6212 | (rxdp3->Buffer0_ptr == DMA_ERROR_CODE)) { | 6212 | (rxdp3->Buffer0_ptr == DMA_ERROR_CODE)) { |
6213 | pci_unmap_single (sp->pdev, | 6213 | pci_unmap_single (sp->pdev, |
6214 | (dma_addr_t)(*skb)->data, | 6214 | (dma_addr_t)rxdp3->Buffer2_ptr, |
6215 | dev->mtu + 4, PCI_DMA_FROMDEVICE); | 6215 | dev->mtu + 4, PCI_DMA_FROMDEVICE); |
6216 | goto memalloc_failed; | 6216 | goto memalloc_failed; |
6217 | } | 6217 | } |
@@ -6224,7 +6224,10 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp, | |||
6224 | if( (rxdp3->Buffer1_ptr == 0) || | 6224 | if( (rxdp3->Buffer1_ptr == 0) || |
6225 | (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) { | 6225 | (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) { |
6226 | pci_unmap_single (sp->pdev, | 6226 | pci_unmap_single (sp->pdev, |
6227 | (dma_addr_t)(*skb)->data, | 6227 | (dma_addr_t)rxdp3->Buffer0_ptr, |
6228 | BUF0_LEN, PCI_DMA_FROMDEVICE); | ||
6229 | pci_unmap_single (sp->pdev, | ||
6230 | (dma_addr_t)rxdp3->Buffer2_ptr, | ||
6228 | dev->mtu + 4, PCI_DMA_FROMDEVICE); | 6231 | dev->mtu + 4, PCI_DMA_FROMDEVICE); |
6229 | goto memalloc_failed; | 6232 | goto memalloc_failed; |
6230 | } | 6233 | } |
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index ec2ad9f0efa2..d470b19c0810 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c | |||
@@ -1593,6 +1593,9 @@ static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev, | |||
1593 | pci_name(pdev)); | 1593 | pci_name(pdev)); |
1594 | 1594 | ||
1595 | isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0965, NULL); | 1595 | isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0965, NULL); |
1596 | if (!isa_bridge) | ||
1597 | isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0966, NULL); | ||
1598 | |||
1596 | if (!isa_bridge) { | 1599 | if (!isa_bridge) { |
1597 | net_probe(tp, KERN_INFO "%s: Can not find ISA bridge.\n", | 1600 | net_probe(tp, KERN_INFO "%s: Can not find ISA bridge.\n", |
1598 | pci_name(pdev)); | 1601 | pci_name(pdev)); |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index e7a2eadcc3b0..757592436390 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -696,8 +696,8 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) | |||
696 | int i; | 696 | int i; |
697 | const u8 *addr = hw->dev[port]->dev_addr; | 697 | const u8 *addr = hw->dev[port]->dev_addr; |
698 | 698 | ||
699 | sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); | 699 | sky2_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); |
700 | sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR); | 700 | sky2_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR); |
701 | 701 | ||
702 | sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR); | 702 | sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR); |
703 | 703 | ||
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index f8429449dc1e..6ff3a1627af8 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -299,7 +299,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
299 | 299 | ||
300 | #define SMC_CAN_USE_8BIT 1 | 300 | #define SMC_CAN_USE_8BIT 1 |
301 | #define SMC_CAN_USE_16BIT 1 | 301 | #define SMC_CAN_USE_16BIT 1 |
302 | #define SMC_CAN_USE_32BIT 1 | 302 | #define SMC_CAN_USE_32BIT 0 |
303 | 303 | ||
304 | #define SMC_inb(a, r) inb((a) + (r)) | 304 | #define SMC_inb(a, r) inb((a) + (r)) |
305 | #define SMC_inw(a, r) inw((a) + (r)) | 305 | #define SMC_inw(a, r) inw((a) + (r)) |
@@ -310,8 +310,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
310 | 310 | ||
311 | #endif /* BOARDS */ | 311 | #endif /* BOARDS */ |
312 | 312 | ||
313 | #define set_irq_type(irq, type) do {} while (0) | ||
314 | |||
315 | #elif defined(CONFIG_M32R) | 313 | #elif defined(CONFIG_M32R) |
316 | 314 | ||
317 | #define SMC_CAN_USE_8BIT 0 | 315 | #define SMC_CAN_USE_8BIT 0 |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index dc41c055ebb5..58740428dd07 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -64,8 +64,8 @@ | |||
64 | 64 | ||
65 | #define DRV_MODULE_NAME "tg3" | 65 | #define DRV_MODULE_NAME "tg3" |
66 | #define PFX DRV_MODULE_NAME ": " | 66 | #define PFX DRV_MODULE_NAME ": " |
67 | #define DRV_MODULE_VERSION "3.79" | 67 | #define DRV_MODULE_VERSION "3.80" |
68 | #define DRV_MODULE_RELDATE "July 18, 2007" | 68 | #define DRV_MODULE_RELDATE "August 2, 2007" |
69 | 69 | ||
70 | #define TG3_DEF_MAC_MODE 0 | 70 | #define TG3_DEF_MAC_MODE 0 |
71 | #define TG3_DEF_RX_MODE 0 | 71 | #define TG3_DEF_RX_MODE 0 |
@@ -12111,6 +12111,12 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state) | |||
12111 | struct tg3 *tp = netdev_priv(dev); | 12111 | struct tg3 *tp = netdev_priv(dev); |
12112 | int err; | 12112 | int err; |
12113 | 12113 | ||
12114 | /* PCI register 4 needs to be saved whether netif_running() or not. | ||
12115 | * MSI address and data need to be saved if using MSI and | ||
12116 | * netif_running(). | ||
12117 | */ | ||
12118 | pci_save_state(pdev); | ||
12119 | |||
12114 | if (!netif_running(dev)) | 12120 | if (!netif_running(dev)) |
12115 | return 0; | 12121 | return 0; |
12116 | 12122 | ||
@@ -12130,9 +12136,6 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state) | |||
12130 | tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; | 12136 | tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; |
12131 | tg3_full_unlock(tp); | 12137 | tg3_full_unlock(tp); |
12132 | 12138 | ||
12133 | /* Save MSI address and data for resume. */ | ||
12134 | pci_save_state(pdev); | ||
12135 | |||
12136 | err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); | 12139 | err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); |
12137 | if (err) { | 12140 | if (err) { |
12138 | tg3_full_lock(tp, 0); | 12141 | tg3_full_lock(tp, 0); |
@@ -12160,11 +12163,11 @@ static int tg3_resume(struct pci_dev *pdev) | |||
12160 | struct tg3 *tp = netdev_priv(dev); | 12163 | struct tg3 *tp = netdev_priv(dev); |
12161 | int err; | 12164 | int err; |
12162 | 12165 | ||
12166 | pci_restore_state(tp->pdev); | ||
12167 | |||
12163 | if (!netif_running(dev)) | 12168 | if (!netif_running(dev)) |
12164 | return 0; | 12169 | return 0; |
12165 | 12170 | ||
12166 | pci_restore_state(tp->pdev); | ||
12167 | |||
12168 | err = tg3_set_power_state(tp, PCI_D0); | 12171 | err = tg3_set_power_state(tp, PCI_D0); |
12169 | if (err) | 12172 | if (err) |
12170 | return err; | 12173 | return err; |
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c index a8994c7b8583..64bef7c12365 100644 --- a/drivers/net/ucc_geth_ethtool.c +++ b/drivers/net/ucc_geth_ethtool.c | |||
@@ -379,7 +379,6 @@ static const struct ethtool_ops uec_ethtool_ops = { | |||
379 | .get_stats_count = uec_get_stats_count, | 379 | .get_stats_count = uec_get_stats_count, |
380 | .get_strings = uec_get_strings, | 380 | .get_strings = uec_get_strings, |
381 | .get_ethtool_stats = uec_get_ethtool_stats, | 381 | .get_ethtool_stats = uec_get_ethtool_stats, |
382 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
383 | }; | 382 | }; |
384 | 383 | ||
385 | void uec_set_ethtool_ops(struct net_device *netdev) | 384 | void uec_set_ethtool_ops(struct net_device *netdev) |
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c index 5f8c2d30a328..6c257b88ce51 100644 --- a/drivers/net/ucc_geth_mii.c +++ b/drivers/net/ucc_geth_mii.c | |||
@@ -272,7 +272,8 @@ int __init uec_mdio_init(void) | |||
272 | return of_register_platform_driver(&uec_mdio_driver); | 272 | return of_register_platform_driver(&uec_mdio_driver); |
273 | } | 273 | } |
274 | 274 | ||
275 | void __exit uec_mdio_exit(void) | 275 | /* called from __init ucc_geth_init, therefore can not be __exit */ |
276 | void uec_mdio_exit(void) | ||
276 | { | 277 | { |
277 | of_unregister_platform_driver(&uec_mdio_driver); | 278 | of_unregister_platform_driver(&uec_mdio_driver); |
278 | } | 279 | } |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index c3fe230695a0..b56dff26772d 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -42,7 +42,13 @@ static int max_interrupt_work = 20; | |||
42 | 42 | ||
43 | /* Set the copy breakpoint for the copy-only-tiny-frames scheme. | 43 | /* Set the copy breakpoint for the copy-only-tiny-frames scheme. |
44 | Setting to > 1518 effectively disables this feature. */ | 44 | Setting to > 1518 effectively disables this feature. */ |
45 | #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ | ||
46 | || defined(CONFIG_SPARC) || defined(__ia64__) \ | ||
47 | || defined(__sh__) || defined(__mips__) | ||
48 | static int rx_copybreak = 1518; | ||
49 | #else | ||
45 | static int rx_copybreak; | 50 | static int rx_copybreak; |
51 | #endif | ||
46 | 52 | ||
47 | /* Work-around for broken BIOSes: they are unable to get the chip back out of | 53 | /* Work-around for broken BIOSes: they are unable to get the chip back out of |
48 | power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */ | 54 | power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */ |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index 15b6e07a4382..071a64cacd5c 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -212,14 +212,13 @@ static pvc_device* add_pvc(struct net_device *dev, u16 dlci) | |||
212 | pvc_p = &(*pvc_p)->next; | 212 | pvc_p = &(*pvc_p)->next; |
213 | } | 213 | } |
214 | 214 | ||
215 | pvc = kmalloc(sizeof(pvc_device), GFP_ATOMIC); | 215 | pvc = kzalloc(sizeof(pvc_device), GFP_ATOMIC); |
216 | #ifdef DEBUG_PVC | 216 | #ifdef DEBUG_PVC |
217 | printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); | 217 | printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); |
218 | #endif | 218 | #endif |
219 | if (!pvc) | 219 | if (!pvc) |
220 | return NULL; | 220 | return NULL; |
221 | 221 | ||
222 | memset(pvc, 0, sizeof(pvc_device)); | ||
223 | pvc->dlci = dlci; | 222 | pvc->dlci = dlci; |
224 | pvc->frad = dev; | 223 | pvc->frad = dev; |
225 | pvc->next = *pvc_p; /* Put it in the chain */ | 224 | pvc->next = *pvc_p; /* Put it in the chain */ |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index d779199c30d0..b37f1e348700 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c | |||
@@ -1638,7 +1638,7 @@ void bcm43xx_phy_set_baseband_attenuation(struct bcm43xx_private *bcm, | |||
1638 | return; | 1638 | return; |
1639 | } | 1639 | } |
1640 | 1640 | ||
1641 | if (phy->analog == 1) { | 1641 | if (phy->analog > 1) { |
1642 | value = bcm43xx_phy_read(bcm, 0x0060) & ~0x003C; | 1642 | value = bcm43xx_phy_read(bcm, 0x0060) & ~0x003C; |
1643 | value |= (baseband_attenuation << 2) & 0x003C; | 1643 | value |= (baseband_attenuation << 2) & 0x003C; |
1644 | } else { | 1644 | } else { |
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index cea85894b7f2..e61c6d5ba1a9 100644 --- a/drivers/net/wireless/rtl8187_dev.c +++ b/drivers/net/wireless/rtl8187_dev.c | |||
@@ -466,7 +466,7 @@ static int rtl8187_add_interface(struct ieee80211_hw *dev, | |||
466 | return -EOPNOTSUPP; | 466 | return -EOPNOTSUPP; |
467 | } | 467 | } |
468 | 468 | ||
469 | priv->hwaddr = conf->mac_addr; | 469 | priv->hwaddr = conf->mac_addr ? conf->mac_addr : dev->wiphy->perm_addr; |
470 | 470 | ||
471 | return 0; | 471 | return 0; |
472 | } | 472 | } |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index f6c487aa8246..26869d107e52 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -822,7 +822,7 @@ static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs, | |||
822 | cs->control |= ZD_CS_MULTICAST; | 822 | cs->control |= ZD_CS_MULTICAST; |
823 | 823 | ||
824 | /* PS-POLL */ | 824 | /* PS-POLL */ |
825 | if (stype == IEEE80211_STYPE_PSPOLL) | 825 | if (ftype == IEEE80211_FTYPE_CTL && stype == IEEE80211_STYPE_PSPOLL) |
826 | cs->control |= ZD_CS_PS_POLL_FRAME; | 826 | cs->control |= ZD_CS_PS_POLL_FRAME; |
827 | 827 | ||
828 | /* Unicast data frames over the threshold should have RTS */ | 828 | /* Unicast data frames over the threshold should have RTS */ |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 489f69c5d6ca..4445810335a8 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -566,6 +566,10 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
566 | if (notify) | 566 | if (notify) |
567 | notify_remote_via_irq(np->netdev->irq); | 567 | notify_remote_via_irq(np->netdev->irq); |
568 | 568 | ||
569 | np->stats.tx_bytes += skb->len; | ||
570 | np->stats.tx_packets++; | ||
571 | |||
572 | /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */ | ||
569 | xennet_tx_buf_gc(dev); | 573 | xennet_tx_buf_gc(dev); |
570 | 574 | ||
571 | if (!netfront_tx_slot_available(np)) | 575 | if (!netfront_tx_slot_available(np)) |
@@ -573,9 +577,6 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
573 | 577 | ||
574 | spin_unlock_irq(&np->tx_lock); | 578 | spin_unlock_irq(&np->tx_lock); |
575 | 579 | ||
576 | np->stats.tx_bytes += skb->len; | ||
577 | np->stats.tx_packets++; | ||
578 | |||
579 | return 0; | 580 | return 0; |
580 | 581 | ||
581 | drop: | 582 | drop: |
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index 3f6e176e6ea1..58c806e9c58a 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig | |||
@@ -38,7 +38,7 @@ config BATTERY_DS2760 | |||
38 | 38 | ||
39 | config BATTERY_PMU | 39 | config BATTERY_PMU |
40 | tristate "Apple PMU battery" | 40 | tristate "Apple PMU battery" |
41 | depends on ADB_PMU | 41 | depends on PPC32 && ADB_PMU |
42 | help | 42 | help |
43 | Say Y here to expose battery information on Apple machines | 43 | Say Y here to expose battery information on Apple machines |
44 | through the generic battery class. | 44 | through the generic battery class. |
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index 80c4a8463065..1cb33cac1237 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
@@ -892,7 +892,7 @@ static int m41t80_remove(struct i2c_client *client) | |||
892 | 892 | ||
893 | static struct i2c_driver m41t80_driver = { | 893 | static struct i2c_driver m41t80_driver = { |
894 | .driver = { | 894 | .driver = { |
895 | .name = "m41t80", | 895 | .name = "rtc-m41t80", |
896 | }, | 896 | }, |
897 | .probe = m41t80_probe, | 897 | .probe = m41t80_probe, |
898 | .remove = m41t80_remove, | 898 | .remove = m41t80_remove, |
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index d94170728075..3e183cfee10f 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c | |||
@@ -13,7 +13,7 @@ | |||
13 | * | 13 | * |
14 | * 24-May-2006: Raphael Assenat <raph@8d.com> | 14 | * 24-May-2006: Raphael Assenat <raph@8d.com> |
15 | * - Major rework | 15 | * - Major rework |
16 | * Converted to rtc_device and uses the SPI layer. | 16 | * Converted to rtc_device and uses the SPI layer. |
17 | * | 17 | * |
18 | * ??-???-2005: Someone at Compulab | 18 | * ??-???-2005: Someone at Compulab |
19 | * - Initial driver creation. | 19 | * - Initial driver creation. |
@@ -259,11 +259,11 @@ static int __devexit max6902_remove(struct spi_device *spi) | |||
259 | 259 | ||
260 | static struct spi_driver max6902_driver = { | 260 | static struct spi_driver max6902_driver = { |
261 | .driver = { | 261 | .driver = { |
262 | .name = "max6902", | 262 | .name = "rtc-max6902", |
263 | .bus = &spi_bus_type, | 263 | .bus = &spi_bus_type, |
264 | .owner = THIS_MODULE, | 264 | .owner = THIS_MODULE, |
265 | }, | 265 | }, |
266 | .probe = max6902_probe, | 266 | .probe = max6902_probe, |
267 | .remove = __devexit_p(max6902_remove), | 267 | .remove = __devexit_p(max6902_remove), |
268 | }; | 268 | }; |
269 | 269 | ||
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index eccac1c3b71b..d32c60dbdd82 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/s390_ext.h> | 24 | #include <asm/s390_ext.h> |
25 | #include <asm/todclk.h> | 25 | #include <asm/todclk.h> |
26 | #include <asm/vtoc.h> | 26 | #include <asm/vtoc.h> |
27 | #include <asm/diag.h> | ||
27 | 28 | ||
28 | #include "dasd_int.h" | 29 | #include "dasd_int.h" |
29 | #include "dasd_diag.h" | 30 | #include "dasd_diag.h" |
diff --git a/drivers/s390/char/monwriter.c b/drivers/s390/char/monwriter.c index 268598ef3efe..20442fbf9346 100644 --- a/drivers/s390/char/monwriter.c +++ b/drivers/s390/char/monwriter.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/miscdevice.h> | 17 | #include <linux/miscdevice.h> |
18 | #include <linux/ctype.h> | 18 | #include <linux/ctype.h> |
19 | #include <linux/poll.h> | 19 | #include <linux/poll.h> |
20 | #include <linux/mutex.h> | ||
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
21 | #include <asm/ebcdic.h> | 22 | #include <asm/ebcdic.h> |
22 | #include <asm/io.h> | 23 | #include <asm/io.h> |
@@ -41,6 +42,7 @@ struct mon_private { | |||
41 | size_t hdr_to_read; | 42 | size_t hdr_to_read; |
42 | size_t data_to_read; | 43 | size_t data_to_read; |
43 | struct mon_buf *current_buf; | 44 | struct mon_buf *current_buf; |
45 | struct mutex thread_mutex; | ||
44 | }; | 46 | }; |
45 | 47 | ||
46 | /* | 48 | /* |
@@ -179,6 +181,7 @@ static int monwrite_open(struct inode *inode, struct file *filp) | |||
179 | return -ENOMEM; | 181 | return -ENOMEM; |
180 | INIT_LIST_HEAD(&monpriv->list); | 182 | INIT_LIST_HEAD(&monpriv->list); |
181 | monpriv->hdr_to_read = sizeof(monpriv->hdr); | 183 | monpriv->hdr_to_read = sizeof(monpriv->hdr); |
184 | mutex_init(&monpriv->thread_mutex); | ||
182 | filp->private_data = monpriv; | 185 | filp->private_data = monpriv; |
183 | return nonseekable_open(inode, filp); | 186 | return nonseekable_open(inode, filp); |
184 | } | 187 | } |
@@ -209,6 +212,7 @@ static ssize_t monwrite_write(struct file *filp, const char __user *data, | |||
209 | void *to; | 212 | void *to; |
210 | int rc; | 213 | int rc; |
211 | 214 | ||
215 | mutex_lock(&monpriv->thread_mutex); | ||
212 | for (written = 0; written < count; ) { | 216 | for (written = 0; written < count; ) { |
213 | if (monpriv->hdr_to_read) { | 217 | if (monpriv->hdr_to_read) { |
214 | len = min(count - written, monpriv->hdr_to_read); | 218 | len = min(count - written, monpriv->hdr_to_read); |
@@ -247,11 +251,13 @@ static ssize_t monwrite_write(struct file *filp, const char __user *data, | |||
247 | } | 251 | } |
248 | monpriv->hdr_to_read = sizeof(monpriv->hdr); | 252 | monpriv->hdr_to_read = sizeof(monpriv->hdr); |
249 | } | 253 | } |
254 | mutex_unlock(&monpriv->thread_mutex); | ||
250 | return written; | 255 | return written; |
251 | 256 | ||
252 | out_error: | 257 | out_error: |
253 | monpriv->data_to_read = 0; | 258 | monpriv->data_to_read = 0; |
254 | monpriv->hdr_to_read = sizeof(struct monwrite_hdr); | 259 | monpriv->hdr_to_read = sizeof(struct monwrite_hdr); |
260 | mutex_unlock(&monpriv->thread_mutex); | ||
255 | return rc; | 261 | return rc; |
256 | } | 262 | } |
257 | 263 | ||
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index 4f2f81b16cfa..2edd5fb6d3dc 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/ccwdev.h> | 21 | #include <asm/ccwdev.h> |
22 | #include <asm/cio.h> | 22 | #include <asm/cio.h> |
23 | #include <asm/ebcdic.h> | 23 | #include <asm/ebcdic.h> |
24 | #include <asm/diag.h> | ||
24 | 25 | ||
25 | #include "raw3270.h" | 26 | #include "raw3270.h" |
26 | 27 | ||
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c index 161867cebd8c..d70a6e65bf14 100644 --- a/drivers/s390/char/vmur.c +++ b/drivers/s390/char/vmur.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/cio.h> | 14 | #include <asm/cio.h> |
15 | #include <asm/ccwdev.h> | 15 | #include <asm/ccwdev.h> |
16 | #include <asm/debug.h> | 16 | #include <asm/debug.h> |
17 | #include <asm/diag.h> | ||
17 | 18 | ||
18 | #include "vmur.h" | 19 | #include "vmur.h" |
19 | 20 | ||
@@ -68,8 +69,26 @@ static struct ccw_driver ur_driver = { | |||
68 | .set_offline = ur_set_offline, | 69 | .set_offline = ur_set_offline, |
69 | }; | 70 | }; |
70 | 71 | ||
72 | static DEFINE_MUTEX(vmur_mutex); | ||
73 | |||
71 | /* | 74 | /* |
72 | * Allocation, freeing, getting and putting of urdev structures | 75 | * Allocation, freeing, getting and putting of urdev structures |
76 | * | ||
77 | * Each ur device (urd) contains a reference to its corresponding ccw device | ||
78 | * (cdev) using the urd->cdev pointer. Each ccw device has a reference to the | ||
79 | * ur device using the cdev->dev.driver_data pointer. | ||
80 | * | ||
81 | * urd references: | ||
82 | * - ur_probe gets a urd reference, ur_remove drops the reference | ||
83 | * (cdev->dev.driver_data) | ||
84 | * - ur_open gets a urd reference, ur_relase drops the reference | ||
85 | * (urf->urd) | ||
86 | * | ||
87 | * cdev references: | ||
88 | * - urdev_alloc get a cdev reference (urd->cdev) | ||
89 | * - urdev_free drops the cdev reference (urd->cdev) | ||
90 | * | ||
91 | * Setting and clearing of cdev->dev.driver_data is protected by the ccwdev lock | ||
73 | */ | 92 | */ |
74 | static struct urdev *urdev_alloc(struct ccw_device *cdev) | 93 | static struct urdev *urdev_alloc(struct ccw_device *cdev) |
75 | { | 94 | { |
@@ -78,51 +97,72 @@ static struct urdev *urdev_alloc(struct ccw_device *cdev) | |||
78 | urd = kzalloc(sizeof(struct urdev), GFP_KERNEL); | 97 | urd = kzalloc(sizeof(struct urdev), GFP_KERNEL); |
79 | if (!urd) | 98 | if (!urd) |
80 | return NULL; | 99 | return NULL; |
81 | urd->cdev = cdev; | ||
82 | urd->reclen = cdev->id.driver_info; | 100 | urd->reclen = cdev->id.driver_info; |
83 | ccw_device_get_id(cdev, &urd->dev_id); | 101 | ccw_device_get_id(cdev, &urd->dev_id); |
84 | mutex_init(&urd->io_mutex); | 102 | mutex_init(&urd->io_mutex); |
85 | mutex_init(&urd->open_mutex); | 103 | mutex_init(&urd->open_mutex); |
104 | atomic_set(&urd->ref_count, 1); | ||
105 | urd->cdev = cdev; | ||
106 | get_device(&cdev->dev); | ||
86 | return urd; | 107 | return urd; |
87 | } | 108 | } |
88 | 109 | ||
89 | static void urdev_free(struct urdev *urd) | 110 | static void urdev_free(struct urdev *urd) |
90 | { | 111 | { |
112 | TRACE("urdev_free: %p\n", urd); | ||
113 | if (urd->cdev) | ||
114 | put_device(&urd->cdev->dev); | ||
91 | kfree(urd); | 115 | kfree(urd); |
92 | } | 116 | } |
93 | 117 | ||
94 | /* | 118 | static void urdev_get(struct urdev *urd) |
95 | * This is how the character device driver gets a reference to a | 119 | { |
96 | * ur device. When this call returns successfully, a reference has | 120 | atomic_inc(&urd->ref_count); |
97 | * been taken (by get_device) on the underlying kobject. The recipient | 121 | } |
98 | * of this urdev pointer must eventually drop it with urdev_put(urd) | 122 | |
99 | * which does the corresponding put_device(). | 123 | static struct urdev *urdev_get_from_cdev(struct ccw_device *cdev) |
100 | */ | 124 | { |
125 | struct urdev *urd; | ||
126 | unsigned long flags; | ||
127 | |||
128 | spin_lock_irqsave(get_ccwdev_lock(cdev), flags); | ||
129 | urd = cdev->dev.driver_data; | ||
130 | if (urd) | ||
131 | urdev_get(urd); | ||
132 | spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags); | ||
133 | return urd; | ||
134 | } | ||
135 | |||
101 | static struct urdev *urdev_get_from_devno(u16 devno) | 136 | static struct urdev *urdev_get_from_devno(u16 devno) |
102 | { | 137 | { |
103 | char bus_id[16]; | 138 | char bus_id[16]; |
104 | struct ccw_device *cdev; | 139 | struct ccw_device *cdev; |
140 | struct urdev *urd; | ||
105 | 141 | ||
106 | sprintf(bus_id, "0.0.%04x", devno); | 142 | sprintf(bus_id, "0.0.%04x", devno); |
107 | cdev = get_ccwdev_by_busid(&ur_driver, bus_id); | 143 | cdev = get_ccwdev_by_busid(&ur_driver, bus_id); |
108 | if (!cdev) | 144 | if (!cdev) |
109 | return NULL; | 145 | return NULL; |
110 | 146 | urd = urdev_get_from_cdev(cdev); | |
111 | return cdev->dev.driver_data; | 147 | put_device(&cdev->dev); |
148 | return urd; | ||
112 | } | 149 | } |
113 | 150 | ||
114 | static void urdev_put(struct urdev *urd) | 151 | static void urdev_put(struct urdev *urd) |
115 | { | 152 | { |
116 | put_device(&urd->cdev->dev); | 153 | if (atomic_dec_and_test(&urd->ref_count)) |
154 | urdev_free(urd); | ||
117 | } | 155 | } |
118 | 156 | ||
119 | /* | 157 | /* |
120 | * Low-level functions to do I/O to a ur device. | 158 | * Low-level functions to do I/O to a ur device. |
121 | * alloc_chan_prog | 159 | * alloc_chan_prog |
160 | * free_chan_prog | ||
122 | * do_ur_io | 161 | * do_ur_io |
123 | * ur_int_handler | 162 | * ur_int_handler |
124 | * | 163 | * |
125 | * alloc_chan_prog allocates and builds the channel program | 164 | * alloc_chan_prog allocates and builds the channel program |
165 | * free_chan_prog frees memory of the channel program | ||
126 | * | 166 | * |
127 | * do_ur_io issues the channel program to the device and blocks waiting | 167 | * do_ur_io issues the channel program to the device and blocks waiting |
128 | * on a completion event it publishes at urd->io_done. The function | 168 | * on a completion event it publishes at urd->io_done. The function |
@@ -137,6 +177,16 @@ static void urdev_put(struct urdev *urd) | |||
137 | * address pointer that alloc_chan_prog returned. | 177 | * address pointer that alloc_chan_prog returned. |
138 | */ | 178 | */ |
139 | 179 | ||
180 | static void free_chan_prog(struct ccw1 *cpa) | ||
181 | { | ||
182 | struct ccw1 *ptr = cpa; | ||
183 | |||
184 | while (ptr->cda) { | ||
185 | kfree((void *)(addr_t) ptr->cda); | ||
186 | ptr++; | ||
187 | } | ||
188 | kfree(cpa); | ||
189 | } | ||
140 | 190 | ||
141 | /* | 191 | /* |
142 | * alloc_chan_prog | 192 | * alloc_chan_prog |
@@ -144,44 +194,45 @@ static void urdev_put(struct urdev *urd) | |||
144 | * with a final NOP CCW command-chained on (which ensures that CE and DE | 194 | * with a final NOP CCW command-chained on (which ensures that CE and DE |
145 | * are presented together in a single interrupt instead of as separate | 195 | * are presented together in a single interrupt instead of as separate |
146 | * interrupts unless an incorrect length indication kicks in first). The | 196 | * interrupts unless an incorrect length indication kicks in first). The |
147 | * data length in each CCW is reclen. The caller must ensure that count | 197 | * data length in each CCW is reclen. |
148 | * is an integral multiple of reclen. | ||
149 | * The channel program pointer returned by this function must be freed | ||
150 | * with kfree. The caller is responsible for checking that | ||
151 | * count/reclen is not ridiculously large. | ||
152 | */ | 198 | */ |
153 | static struct ccw1 *alloc_chan_prog(char *buf, size_t count, size_t reclen) | 199 | static struct ccw1 *alloc_chan_prog(const char __user *ubuf, int rec_count, |
200 | int reclen) | ||
154 | { | 201 | { |
155 | size_t num_ccws; | ||
156 | struct ccw1 *cpa; | 202 | struct ccw1 *cpa; |
203 | void *kbuf; | ||
157 | int i; | 204 | int i; |
158 | 205 | ||
159 | TRACE("alloc_chan_prog(%p, %zu, %zu)\n", buf, count, reclen); | 206 | TRACE("alloc_chan_prog(%p, %i, %i)\n", ubuf, rec_count, reclen); |
160 | 207 | ||
161 | /* | 208 | /* |
162 | * We chain a NOP onto the writes to force CE+DE together. | 209 | * We chain a NOP onto the writes to force CE+DE together. |
163 | * That means we allocate room for CCWs to cover count/reclen | 210 | * That means we allocate room for CCWs to cover count/reclen |
164 | * records plus a NOP. | 211 | * records plus a NOP. |
165 | */ | 212 | */ |
166 | num_ccws = count / reclen + 1; | 213 | cpa = kzalloc((rec_count + 1) * sizeof(struct ccw1), |
167 | cpa = kmalloc(num_ccws * sizeof(struct ccw1), GFP_KERNEL | GFP_DMA); | 214 | GFP_KERNEL | GFP_DMA); |
168 | if (!cpa) | 215 | if (!cpa) |
169 | return NULL; | 216 | return ERR_PTR(-ENOMEM); |
170 | 217 | ||
171 | for (i = 0; count; i++) { | 218 | for (i = 0; i < rec_count; i++) { |
172 | cpa[i].cmd_code = WRITE_CCW_CMD; | 219 | cpa[i].cmd_code = WRITE_CCW_CMD; |
173 | cpa[i].flags = CCW_FLAG_CC | CCW_FLAG_SLI; | 220 | cpa[i].flags = CCW_FLAG_CC | CCW_FLAG_SLI; |
174 | cpa[i].count = reclen; | 221 | cpa[i].count = reclen; |
175 | cpa[i].cda = __pa(buf); | 222 | kbuf = kmalloc(reclen, GFP_KERNEL | GFP_DMA); |
176 | buf += reclen; | 223 | if (!kbuf) { |
177 | count -= reclen; | 224 | free_chan_prog(cpa); |
225 | return ERR_PTR(-ENOMEM); | ||
226 | } | ||
227 | cpa[i].cda = (u32)(addr_t) kbuf; | ||
228 | if (copy_from_user(kbuf, ubuf, reclen)) { | ||
229 | free_chan_prog(cpa); | ||
230 | return ERR_PTR(-EFAULT); | ||
231 | } | ||
232 | ubuf += reclen; | ||
178 | } | 233 | } |
179 | /* The following NOP CCW forces CE+DE to be presented together */ | 234 | /* The following NOP CCW forces CE+DE to be presented together */ |
180 | cpa[i].cmd_code = CCW_CMD_NOOP; | 235 | cpa[i].cmd_code = CCW_CMD_NOOP; |
181 | cpa[i].flags = 0; | ||
182 | cpa[i].count = 0; | ||
183 | cpa[i].cda = 0; | ||
184 | |||
185 | return cpa; | 236 | return cpa; |
186 | } | 237 | } |
187 | 238 | ||
@@ -189,7 +240,7 @@ static int do_ur_io(struct urdev *urd, struct ccw1 *cpa) | |||
189 | { | 240 | { |
190 | int rc; | 241 | int rc; |
191 | struct ccw_device *cdev = urd->cdev; | 242 | struct ccw_device *cdev = urd->cdev; |
192 | DECLARE_COMPLETION(event); | 243 | DECLARE_COMPLETION_ONSTACK(event); |
193 | 244 | ||
194 | TRACE("do_ur_io: cpa=%p\n", cpa); | 245 | TRACE("do_ur_io: cpa=%p\n", cpa); |
195 | 246 | ||
@@ -232,6 +283,7 @@ static void ur_int_handler(struct ccw_device *cdev, unsigned long intparm, | |||
232 | return; | 283 | return; |
233 | } | 284 | } |
234 | urd = cdev->dev.driver_data; | 285 | urd = cdev->dev.driver_data; |
286 | BUG_ON(!urd); | ||
235 | /* On special conditions irb is an error pointer */ | 287 | /* On special conditions irb is an error pointer */ |
236 | if (IS_ERR(irb)) | 288 | if (IS_ERR(irb)) |
237 | urd->io_request_rc = PTR_ERR(irb); | 289 | urd->io_request_rc = PTR_ERR(irb); |
@@ -249,9 +301,15 @@ static void ur_int_handler(struct ccw_device *cdev, unsigned long intparm, | |||
249 | static ssize_t ur_attr_reclen_show(struct device *dev, | 301 | static ssize_t ur_attr_reclen_show(struct device *dev, |
250 | struct device_attribute *attr, char *buf) | 302 | struct device_attribute *attr, char *buf) |
251 | { | 303 | { |
252 | struct urdev *urd = dev->driver_data; | 304 | struct urdev *urd; |
305 | int rc; | ||
253 | 306 | ||
254 | return sprintf(buf, "%zu\n", urd->reclen); | 307 | urd = urdev_get_from_cdev(to_ccwdev(dev)); |
308 | if (!urd) | ||
309 | return -ENODEV; | ||
310 | rc = sprintf(buf, "%zu\n", urd->reclen); | ||
311 | urdev_put(urd); | ||
312 | return rc; | ||
255 | } | 313 | } |
256 | 314 | ||
257 | static DEVICE_ATTR(reclen, 0444, ur_attr_reclen_show, NULL); | 315 | static DEVICE_ATTR(reclen, 0444, ur_attr_reclen_show, NULL); |
@@ -325,24 +383,11 @@ static ssize_t do_write(struct urdev *urd, const char __user *udata, | |||
325 | size_t count, size_t reclen, loff_t *ppos) | 383 | size_t count, size_t reclen, loff_t *ppos) |
326 | { | 384 | { |
327 | struct ccw1 *cpa; | 385 | struct ccw1 *cpa; |
328 | char *buf; | ||
329 | int rc; | 386 | int rc; |
330 | 387 | ||
331 | /* Data buffer must be under 2GB line for fmt1 CCWs: hence GFP_DMA */ | 388 | cpa = alloc_chan_prog(udata, count / reclen, reclen); |
332 | buf = kmalloc(count, GFP_KERNEL | GFP_DMA); | 389 | if (IS_ERR(cpa)) |
333 | if (!buf) | 390 | return PTR_ERR(cpa); |
334 | return -ENOMEM; | ||
335 | |||
336 | if (copy_from_user(buf, udata, count)) { | ||
337 | rc = -EFAULT; | ||
338 | goto fail_kfree_buf; | ||
339 | } | ||
340 | |||
341 | cpa = alloc_chan_prog(buf, count, reclen); | ||
342 | if (!cpa) { | ||
343 | rc = -ENOMEM; | ||
344 | goto fail_kfree_buf; | ||
345 | } | ||
346 | 391 | ||
347 | rc = do_ur_io(urd, cpa); | 392 | rc = do_ur_io(urd, cpa); |
348 | if (rc) | 393 | if (rc) |
@@ -354,10 +399,9 @@ static ssize_t do_write(struct urdev *urd, const char __user *udata, | |||
354 | } | 399 | } |
355 | *ppos += count; | 400 | *ppos += count; |
356 | rc = count; | 401 | rc = count; |
402 | |||
357 | fail_kfree_cpa: | 403 | fail_kfree_cpa: |
358 | kfree(cpa); | 404 | free_chan_prog(cpa); |
359 | fail_kfree_buf: | ||
360 | kfree(buf); | ||
361 | return rc; | 405 | return rc; |
362 | } | 406 | } |
363 | 407 | ||
@@ -380,31 +424,6 @@ static ssize_t ur_write(struct file *file, const char __user *udata, | |||
380 | return do_write(urf->urd, udata, count, urf->dev_reclen, ppos); | 424 | return do_write(urf->urd, udata, count, urf->dev_reclen, ppos); |
381 | } | 425 | } |
382 | 426 | ||
383 | static int do_diag_14(unsigned long rx, unsigned long ry1, | ||
384 | unsigned long subcode) | ||
385 | { | ||
386 | register unsigned long _ry1 asm("2") = ry1; | ||
387 | register unsigned long _ry2 asm("3") = subcode; | ||
388 | int rc = 0; | ||
389 | |||
390 | asm volatile( | ||
391 | #ifdef CONFIG_64BIT | ||
392 | " sam31\n" | ||
393 | " diag %2,2,0x14\n" | ||
394 | " sam64\n" | ||
395 | #else | ||
396 | " diag %2,2,0x14\n" | ||
397 | #endif | ||
398 | " ipm %0\n" | ||
399 | " srl %0,28\n" | ||
400 | : "=d" (rc), "+d" (_ry2) | ||
401 | : "d" (rx), "d" (_ry1) | ||
402 | : "cc"); | ||
403 | |||
404 | TRACE("diag 14: subcode=0x%lx, cc=%i\n", subcode, rc); | ||
405 | return rc; | ||
406 | } | ||
407 | |||
408 | /* | 427 | /* |
409 | * diagnose code 0x14 subcode 0x0028 - position spool file to designated | 428 | * diagnose code 0x14 subcode 0x0028 - position spool file to designated |
410 | * record | 429 | * record |
@@ -416,7 +435,7 @@ static int diag_position_to_record(int devno, int record) | |||
416 | { | 435 | { |
417 | int cc; | 436 | int cc; |
418 | 437 | ||
419 | cc = do_diag_14(record, devno, 0x28); | 438 | cc = diag14(record, devno, 0x28); |
420 | switch (cc) { | 439 | switch (cc) { |
421 | case 0: | 440 | case 0: |
422 | return 0; | 441 | return 0; |
@@ -441,7 +460,7 @@ static int diag_read_file(int devno, char *buf) | |||
441 | { | 460 | { |
442 | int cc; | 461 | int cc; |
443 | 462 | ||
444 | cc = do_diag_14((unsigned long) buf, devno, 0x00); | 463 | cc = diag14((unsigned long) buf, devno, 0x00); |
445 | switch (cc) { | 464 | switch (cc) { |
446 | case 0: | 465 | case 0: |
447 | return 0; | 466 | return 0; |
@@ -473,7 +492,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count, | |||
473 | return rc; | 492 | return rc; |
474 | 493 | ||
475 | len = min((size_t) PAGE_SIZE, count); | 494 | len = min((size_t) PAGE_SIZE, count); |
476 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | 495 | buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA); |
477 | if (!buf) | 496 | if (!buf) |
478 | return -ENOMEM; | 497 | return -ENOMEM; |
479 | 498 | ||
@@ -500,7 +519,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count, | |||
500 | *offs += copied; | 519 | *offs += copied; |
501 | rc = copied; | 520 | rc = copied; |
502 | fail: | 521 | fail: |
503 | kfree(buf); | 522 | free_page((unsigned long) buf); |
504 | return rc; | 523 | return rc; |
505 | } | 524 | } |
506 | 525 | ||
@@ -534,7 +553,7 @@ static int diag_read_next_file_info(struct file_control_block *buf, int spid) | |||
534 | { | 553 | { |
535 | int cc; | 554 | int cc; |
536 | 555 | ||
537 | cc = do_diag_14((unsigned long) buf, spid, 0xfff); | 556 | cc = diag14((unsigned long) buf, spid, 0xfff); |
538 | switch (cc) { | 557 | switch (cc) { |
539 | case 0: | 558 | case 0: |
540 | return 0; | 559 | return 0; |
@@ -543,56 +562,97 @@ static int diag_read_next_file_info(struct file_control_block *buf, int spid) | |||
543 | } | 562 | } |
544 | } | 563 | } |
545 | 564 | ||
546 | static int verify_device(struct urdev *urd) | 565 | static int verify_uri_device(struct urdev *urd) |
547 | { | 566 | { |
548 | struct file_control_block fcb; | 567 | struct file_control_block *fcb; |
549 | char *buf; | 568 | char *buf; |
550 | int rc; | 569 | int rc; |
551 | 570 | ||
571 | fcb = kmalloc(sizeof(*fcb), GFP_KERNEL | GFP_DMA); | ||
572 | if (!fcb) | ||
573 | return -ENOMEM; | ||
574 | |||
575 | /* check for empty reader device (beginning of chain) */ | ||
576 | rc = diag_read_next_file_info(fcb, 0); | ||
577 | if (rc) | ||
578 | goto fail_free_fcb; | ||
579 | |||
580 | /* if file is in hold status, we do not read it */ | ||
581 | if (fcb->file_stat & (FLG_SYSTEM_HOLD | FLG_USER_HOLD)) { | ||
582 | rc = -EPERM; | ||
583 | goto fail_free_fcb; | ||
584 | } | ||
585 | |||
586 | /* open file on virtual reader */ | ||
587 | buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA); | ||
588 | if (!buf) { | ||
589 | rc = -ENOMEM; | ||
590 | goto fail_free_fcb; | ||
591 | } | ||
592 | rc = diag_read_file(urd->dev_id.devno, buf); | ||
593 | if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */ | ||
594 | goto fail_free_buf; | ||
595 | |||
596 | /* check if the file on top of the queue is open now */ | ||
597 | rc = diag_read_next_file_info(fcb, 0); | ||
598 | if (rc) | ||
599 | goto fail_free_buf; | ||
600 | if (!(fcb->file_stat & FLG_IN_USE)) { | ||
601 | rc = -EMFILE; | ||
602 | goto fail_free_buf; | ||
603 | } | ||
604 | rc = 0; | ||
605 | |||
606 | fail_free_buf: | ||
607 | free_page((unsigned long) buf); | ||
608 | fail_free_fcb: | ||
609 | kfree(fcb); | ||
610 | return rc; | ||
611 | } | ||
612 | |||
613 | static int verify_device(struct urdev *urd) | ||
614 | { | ||
552 | switch (urd->class) { | 615 | switch (urd->class) { |
553 | case DEV_CLASS_UR_O: | 616 | case DEV_CLASS_UR_O: |
554 | return 0; /* no check needed here */ | 617 | return 0; /* no check needed here */ |
555 | case DEV_CLASS_UR_I: | 618 | case DEV_CLASS_UR_I: |
556 | /* check for empty reader device (beginning of chain) */ | 619 | return verify_uri_device(urd); |
557 | rc = diag_read_next_file_info(&fcb, 0); | ||
558 | if (rc) | ||
559 | return rc; | ||
560 | |||
561 | /* open file on virtual reader */ | ||
562 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
563 | if (!buf) | ||
564 | return -ENOMEM; | ||
565 | rc = diag_read_file(urd->dev_id.devno, buf); | ||
566 | kfree(buf); | ||
567 | |||
568 | if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */ | ||
569 | return rc; | ||
570 | return 0; | ||
571 | default: | 620 | default: |
572 | return -ENOTSUPP; | 621 | return -ENOTSUPP; |
573 | } | 622 | } |
574 | } | 623 | } |
575 | 624 | ||
576 | static int get_file_reclen(struct urdev *urd) | 625 | static int get_uri_file_reclen(struct urdev *urd) |
577 | { | 626 | { |
578 | struct file_control_block fcb; | 627 | struct file_control_block *fcb; |
579 | int rc; | 628 | int rc; |
580 | 629 | ||
630 | fcb = kmalloc(sizeof(*fcb), GFP_KERNEL | GFP_DMA); | ||
631 | if (!fcb) | ||
632 | return -ENOMEM; | ||
633 | rc = diag_read_next_file_info(fcb, 0); | ||
634 | if (rc) | ||
635 | goto fail_free; | ||
636 | if (fcb->file_stat & FLG_CP_DUMP) | ||
637 | rc = 0; | ||
638 | else | ||
639 | rc = fcb->rec_len; | ||
640 | |||
641 | fail_free: | ||
642 | kfree(fcb); | ||
643 | return rc; | ||
644 | } | ||
645 | |||
646 | static int get_file_reclen(struct urdev *urd) | ||
647 | { | ||
581 | switch (urd->class) { | 648 | switch (urd->class) { |
582 | case DEV_CLASS_UR_O: | 649 | case DEV_CLASS_UR_O: |
583 | return 0; | 650 | return 0; |
584 | case DEV_CLASS_UR_I: | 651 | case DEV_CLASS_UR_I: |
585 | rc = diag_read_next_file_info(&fcb, 0); | 652 | return get_uri_file_reclen(urd); |
586 | if (rc) | ||
587 | return rc; | ||
588 | break; | ||
589 | default: | 653 | default: |
590 | return -ENOTSUPP; | 654 | return -ENOTSUPP; |
591 | } | 655 | } |
592 | if (fcb.file_stat & FLG_CP_DUMP) | ||
593 | return 0; | ||
594 | |||
595 | return fcb.rec_len; | ||
596 | } | 656 | } |
597 | 657 | ||
598 | static int ur_open(struct inode *inode, struct file *file) | 658 | static int ur_open(struct inode *inode, struct file *file) |
@@ -710,64 +770,63 @@ static struct file_operations ur_fops = { | |||
710 | 770 | ||
711 | /* | 771 | /* |
712 | * ccw_device infrastructure: | 772 | * ccw_device infrastructure: |
713 | * ur_probe gets its own ref to the device (i.e. get_device), | 773 | * ur_probe creates the struct urdev (with refcount = 1), the device |
714 | * creates the struct urdev, the device attributes, sets up | 774 | * attributes, sets up the interrupt handler and validates the virtual |
715 | * the interrupt handler and validates the virtual unit record device. | 775 | * unit record device. |
716 | * ur_remove removes the device attributes, frees the struct urdev | 776 | * ur_remove removes the device attributes and drops the reference to |
717 | * and drops (put_device) the ref to the device we got in ur_probe. | 777 | * struct urdev. |
778 | * | ||
779 | * ur_probe, ur_remove, ur_set_online and ur_set_offline are serialized | ||
780 | * by the vmur_mutex lock. | ||
781 | * | ||
782 | * urd->char_device is used as indication that the online function has | ||
783 | * been completed successfully. | ||
718 | */ | 784 | */ |
719 | static int ur_probe(struct ccw_device *cdev) | 785 | static int ur_probe(struct ccw_device *cdev) |
720 | { | 786 | { |
721 | struct urdev *urd; | 787 | struct urdev *urd; |
722 | int rc; | 788 | int rc; |
723 | 789 | ||
724 | TRACE("ur_probe: cdev=%p state=%d\n", cdev, *(int *) cdev->private); | 790 | TRACE("ur_probe: cdev=%p\n", cdev); |
725 | |||
726 | if (!get_device(&cdev->dev)) | ||
727 | return -ENODEV; | ||
728 | 791 | ||
792 | mutex_lock(&vmur_mutex); | ||
729 | urd = urdev_alloc(cdev); | 793 | urd = urdev_alloc(cdev); |
730 | if (!urd) { | 794 | if (!urd) { |
731 | rc = -ENOMEM; | 795 | rc = -ENOMEM; |
732 | goto fail; | 796 | goto fail_unlock; |
733 | } | 797 | } |
798 | |||
734 | rc = ur_create_attributes(&cdev->dev); | 799 | rc = ur_create_attributes(&cdev->dev); |
735 | if (rc) { | 800 | if (rc) { |
736 | rc = -ENOMEM; | 801 | rc = -ENOMEM; |
737 | goto fail; | 802 | goto fail_urdev_put; |
738 | } | 803 | } |
739 | cdev->dev.driver_data = urd; | ||
740 | cdev->handler = ur_int_handler; | 804 | cdev->handler = ur_int_handler; |
741 | 805 | ||
742 | /* validate virtual unit record device */ | 806 | /* validate virtual unit record device */ |
743 | urd->class = get_urd_class(urd); | 807 | urd->class = get_urd_class(urd); |
744 | if (urd->class < 0) { | 808 | if (urd->class < 0) { |
745 | rc = urd->class; | 809 | rc = urd->class; |
746 | goto fail; | 810 | goto fail_remove_attr; |
747 | } | 811 | } |
748 | if ((urd->class != DEV_CLASS_UR_I) && (urd->class != DEV_CLASS_UR_O)) { | 812 | if ((urd->class != DEV_CLASS_UR_I) && (urd->class != DEV_CLASS_UR_O)) { |
749 | rc = -ENOTSUPP; | 813 | rc = -ENOTSUPP; |
750 | goto fail; | 814 | goto fail_remove_attr; |
751 | } | 815 | } |
816 | spin_lock_irq(get_ccwdev_lock(cdev)); | ||
817 | cdev->dev.driver_data = urd; | ||
818 | spin_unlock_irq(get_ccwdev_lock(cdev)); | ||
752 | 819 | ||
820 | mutex_unlock(&vmur_mutex); | ||
753 | return 0; | 821 | return 0; |
754 | 822 | ||
755 | fail: | 823 | fail_remove_attr: |
756 | urdev_free(urd); | ||
757 | put_device(&cdev->dev); | ||
758 | return rc; | ||
759 | } | ||
760 | |||
761 | static void ur_remove(struct ccw_device *cdev) | ||
762 | { | ||
763 | struct urdev *urd = cdev->dev.driver_data; | ||
764 | |||
765 | TRACE("ur_remove\n"); | ||
766 | if (cdev->online) | ||
767 | ur_set_offline(cdev); | ||
768 | ur_remove_attributes(&cdev->dev); | 824 | ur_remove_attributes(&cdev->dev); |
769 | urdev_free(urd); | 825 | fail_urdev_put: |
770 | put_device(&cdev->dev); | 826 | urdev_put(urd); |
827 | fail_unlock: | ||
828 | mutex_unlock(&vmur_mutex); | ||
829 | return rc; | ||
771 | } | 830 | } |
772 | 831 | ||
773 | static int ur_set_online(struct ccw_device *cdev) | 832 | static int ur_set_online(struct ccw_device *cdev) |
@@ -776,20 +835,29 @@ static int ur_set_online(struct ccw_device *cdev) | |||
776 | int minor, major, rc; | 835 | int minor, major, rc; |
777 | char node_id[16]; | 836 | char node_id[16]; |
778 | 837 | ||
779 | TRACE("ur_set_online: cdev=%p state=%d\n", cdev, | 838 | TRACE("ur_set_online: cdev=%p\n", cdev); |
780 | *(int *) cdev->private); | ||
781 | 839 | ||
782 | if (!try_module_get(ur_driver.owner)) | 840 | mutex_lock(&vmur_mutex); |
783 | return -EINVAL; | 841 | urd = urdev_get_from_cdev(cdev); |
842 | if (!urd) { | ||
843 | /* ur_remove already deleted our urd */ | ||
844 | rc = -ENODEV; | ||
845 | goto fail_unlock; | ||
846 | } | ||
847 | |||
848 | if (urd->char_device) { | ||
849 | /* Another ur_set_online was faster */ | ||
850 | rc = -EBUSY; | ||
851 | goto fail_urdev_put; | ||
852 | } | ||
784 | 853 | ||
785 | urd = (struct urdev *) cdev->dev.driver_data; | ||
786 | minor = urd->dev_id.devno; | 854 | minor = urd->dev_id.devno; |
787 | major = MAJOR(ur_first_dev_maj_min); | 855 | major = MAJOR(ur_first_dev_maj_min); |
788 | 856 | ||
789 | urd->char_device = cdev_alloc(); | 857 | urd->char_device = cdev_alloc(); |
790 | if (!urd->char_device) { | 858 | if (!urd->char_device) { |
791 | rc = -ENOMEM; | 859 | rc = -ENOMEM; |
792 | goto fail_module_put; | 860 | goto fail_urdev_put; |
793 | } | 861 | } |
794 | 862 | ||
795 | cdev_init(urd->char_device, &ur_fops); | 863 | cdev_init(urd->char_device, &ur_fops); |
@@ -818,29 +886,79 @@ static int ur_set_online(struct ccw_device *cdev) | |||
818 | TRACE("ur_set_online: device_create rc=%d\n", rc); | 886 | TRACE("ur_set_online: device_create rc=%d\n", rc); |
819 | goto fail_free_cdev; | 887 | goto fail_free_cdev; |
820 | } | 888 | } |
821 | 889 | urdev_put(urd); | |
890 | mutex_unlock(&vmur_mutex); | ||
822 | return 0; | 891 | return 0; |
823 | 892 | ||
824 | fail_free_cdev: | 893 | fail_free_cdev: |
825 | cdev_del(urd->char_device); | 894 | cdev_del(urd->char_device); |
826 | fail_module_put: | 895 | urd->char_device = NULL; |
827 | module_put(ur_driver.owner); | 896 | fail_urdev_put: |
828 | 897 | urdev_put(urd); | |
898 | fail_unlock: | ||
899 | mutex_unlock(&vmur_mutex); | ||
829 | return rc; | 900 | return rc; |
830 | } | 901 | } |
831 | 902 | ||
832 | static int ur_set_offline(struct ccw_device *cdev) | 903 | static int ur_set_offline_force(struct ccw_device *cdev, int force) |
833 | { | 904 | { |
834 | struct urdev *urd; | 905 | struct urdev *urd; |
906 | int rc; | ||
835 | 907 | ||
836 | TRACE("ur_set_offline: cdev=%p cdev->private=%p state=%d\n", | 908 | TRACE("ur_set_offline: cdev=%p\n", cdev); |
837 | cdev, cdev->private, *(int *) cdev->private); | 909 | urd = urdev_get_from_cdev(cdev); |
838 | urd = (struct urdev *) cdev->dev.driver_data; | 910 | if (!urd) |
911 | /* ur_remove already deleted our urd */ | ||
912 | return -ENODEV; | ||
913 | if (!urd->char_device) { | ||
914 | /* Another ur_set_offline was faster */ | ||
915 | rc = -EBUSY; | ||
916 | goto fail_urdev_put; | ||
917 | } | ||
918 | if (!force && (atomic_read(&urd->ref_count) > 2)) { | ||
919 | /* There is still a user of urd (e.g. ur_open) */ | ||
920 | TRACE("ur_set_offline: BUSY\n"); | ||
921 | rc = -EBUSY; | ||
922 | goto fail_urdev_put; | ||
923 | } | ||
839 | device_destroy(vmur_class, urd->char_device->dev); | 924 | device_destroy(vmur_class, urd->char_device->dev); |
840 | cdev_del(urd->char_device); | 925 | cdev_del(urd->char_device); |
841 | module_put(ur_driver.owner); | 926 | urd->char_device = NULL; |
927 | rc = 0; | ||
842 | 928 | ||
843 | return 0; | 929 | fail_urdev_put: |
930 | urdev_put(urd); | ||
931 | return rc; | ||
932 | } | ||
933 | |||
934 | static int ur_set_offline(struct ccw_device *cdev) | ||
935 | { | ||
936 | int rc; | ||
937 | |||
938 | mutex_lock(&vmur_mutex); | ||
939 | rc = ur_set_offline_force(cdev, 0); | ||
940 | mutex_unlock(&vmur_mutex); | ||
941 | return rc; | ||
942 | } | ||
943 | |||
944 | static void ur_remove(struct ccw_device *cdev) | ||
945 | { | ||
946 | unsigned long flags; | ||
947 | |||
948 | TRACE("ur_remove\n"); | ||
949 | |||
950 | mutex_lock(&vmur_mutex); | ||
951 | |||
952 | if (cdev->online) | ||
953 | ur_set_offline_force(cdev, 1); | ||
954 | ur_remove_attributes(&cdev->dev); | ||
955 | |||
956 | spin_lock_irqsave(get_ccwdev_lock(cdev), flags); | ||
957 | urdev_put(cdev->dev.driver_data); | ||
958 | cdev->dev.driver_data = NULL; | ||
959 | spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags); | ||
960 | |||
961 | mutex_unlock(&vmur_mutex); | ||
844 | } | 962 | } |
845 | 963 | ||
846 | /* | 964 | /* |
diff --git a/drivers/s390/char/vmur.h b/drivers/s390/char/vmur.h index 16d0a4e38e40..fa959644735a 100644 --- a/drivers/s390/char/vmur.h +++ b/drivers/s390/char/vmur.h | |||
@@ -50,7 +50,10 @@ struct file_control_block { | |||
50 | char rest[200]; | 50 | char rest[200]; |
51 | } __attribute__ ((packed)); | 51 | } __attribute__ ((packed)); |
52 | 52 | ||
53 | #define FLG_CP_DUMP 0x10 | 53 | #define FLG_SYSTEM_HOLD 0x04 |
54 | #define FLG_CP_DUMP 0x10 | ||
55 | #define FLG_USER_HOLD 0x20 | ||
56 | #define FLG_IN_USE 0x80 | ||
54 | 57 | ||
55 | /* | 58 | /* |
56 | * A struct urdev is created for each ur device that is made available | 59 | * A struct urdev is created for each ur device that is made available |
@@ -67,6 +70,7 @@ struct urdev { | |||
67 | size_t reclen; /* Record length for *write* CCWs */ | 70 | size_t reclen; /* Record length for *write* CCWs */ |
68 | int class; /* VM device class */ | 71 | int class; /* VM device class */ |
69 | int io_request_rc; /* return code from I/O request */ | 72 | int io_request_rc; /* return code from I/O request */ |
73 | atomic_t ref_count; /* reference counter */ | ||
70 | }; | 74 | }; |
71 | 75 | ||
72 | /* | 76 | /* |
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c index 02fd00b55e1b..34a796913b06 100644 --- a/drivers/s390/cio/cmf.c +++ b/drivers/s390/cio/cmf.c | |||
@@ -594,6 +594,9 @@ alloc_cmb (struct ccw_device *cdev) | |||
594 | free_pages((unsigned long)mem, get_order(size)); | 594 | free_pages((unsigned long)mem, get_order(size)); |
595 | } else if (!mem) { | 595 | } else if (!mem) { |
596 | /* no luck */ | 596 | /* no luck */ |
597 | printk(KERN_WARNING "cio: failed to allocate area " | ||
598 | "for measuring %d subchannels\n", | ||
599 | cmb_area.num_channels); | ||
597 | ret = -ENOMEM; | 600 | ret = -ENOMEM; |
598 | goto out; | 601 | goto out; |
599 | } else { | 602 | } else { |
@@ -1279,13 +1282,6 @@ init_cmf(void) | |||
1279 | case CMF_BASIC: | 1282 | case CMF_BASIC: |
1280 | format_string = "basic"; | 1283 | format_string = "basic"; |
1281 | cmbops = &cmbops_basic; | 1284 | cmbops = &cmbops_basic; |
1282 | if (cmb_area.num_channels > 4096 || cmb_area.num_channels < 1) { | ||
1283 | printk(KERN_ERR "cio: Basic channel measurement " | ||
1284 | "facility can only use 1 to 4096 devices\n" | ||
1285 | KERN_ERR "when the cmf driver is built" | ||
1286 | " as a loadable module\n"); | ||
1287 | return 1; | ||
1288 | } | ||
1289 | break; | 1285 | break; |
1290 | case CMF_EXTENDED: | 1286 | case CMF_EXTENDED: |
1291 | format_string = "extended"; | 1287 | format_string = "extended"; |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 1c27a5a06b49..5635e656c1a3 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -79,6 +79,7 @@ css_alloc_subchannel(struct subchannel_id schid) | |||
79 | sch->schib.pmcw.intparm = (__u32)(unsigned long)sch; | 79 | sch->schib.pmcw.intparm = (__u32)(unsigned long)sch; |
80 | ret = cio_modify(sch); | 80 | ret = cio_modify(sch); |
81 | if (ret) { | 81 | if (ret) { |
82 | kfree(sch->lock); | ||
82 | kfree(sch); | 83 | kfree(sch); |
83 | return ERR_PTR(ret); | 84 | return ERR_PTR(ret); |
84 | } | 85 | } |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 297659fa0e26..e44d92eac8e9 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -117,7 +117,10 @@ static int ccw_uevent(struct device *dev, char **envp, int num_envp, | |||
117 | snprint_alias(modalias_buf, sizeof(modalias_buf), id, ""); | 117 | snprint_alias(modalias_buf, sizeof(modalias_buf), id, ""); |
118 | ret = add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len, | 118 | ret = add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len, |
119 | "MODALIAS=%s", modalias_buf); | 119 | "MODALIAS=%s", modalias_buf); |
120 | return ret; | 120 | if (ret) |
121 | return ret; | ||
122 | envp[i] = NULL; | ||
123 | return 0; | ||
121 | } | 124 | } |
122 | 125 | ||
123 | struct bus_type ccw_bus_type; | 126 | struct bus_type ccw_bus_type; |
diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c index 60b9347f7c92..f232832f2b22 100644 --- a/drivers/s390/cio/device_id.c +++ b/drivers/s390/cio/device_id.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/delay.h> | 17 | #include <asm/delay.h> |
18 | #include <asm/cio.h> | 18 | #include <asm/cio.h> |
19 | #include <asm/lowcore.h> | 19 | #include <asm/lowcore.h> |
20 | #include <asm/diag.h> | ||
20 | 21 | ||
21 | #include "cio.h" | 22 | #include "cio.h" |
22 | #include "cio_debug.h" | 23 | #include "cio_debug.h" |
@@ -25,51 +26,6 @@ | |||
25 | #include "ioasm.h" | 26 | #include "ioasm.h" |
26 | 27 | ||
27 | /* | 28 | /* |
28 | * diag210 is used under VM to get information about a virtual device | ||
29 | */ | ||
30 | int | ||
31 | diag210(struct diag210 * addr) | ||
32 | { | ||
33 | /* | ||
34 | * diag 210 needs its data below the 2GB border, so we | ||
35 | * use a static data area to be sure | ||
36 | */ | ||
37 | static struct diag210 diag210_tmp; | ||
38 | static DEFINE_SPINLOCK(diag210_lock); | ||
39 | unsigned long flags; | ||
40 | int ccode; | ||
41 | |||
42 | spin_lock_irqsave(&diag210_lock, flags); | ||
43 | diag210_tmp = *addr; | ||
44 | |||
45 | #ifdef CONFIG_64BIT | ||
46 | asm volatile( | ||
47 | " lhi %0,-1\n" | ||
48 | " sam31\n" | ||
49 | " diag %1,0,0x210\n" | ||
50 | "0: ipm %0\n" | ||
51 | " srl %0,28\n" | ||
52 | "1: sam64\n" | ||
53 | EX_TABLE(0b,1b) | ||
54 | : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory"); | ||
55 | #else | ||
56 | asm volatile( | ||
57 | " lhi %0,-1\n" | ||
58 | " diag %1,0,0x210\n" | ||
59 | "0: ipm %0\n" | ||
60 | " srl %0,28\n" | ||
61 | "1:\n" | ||
62 | EX_TABLE(0b,1b) | ||
63 | : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory"); | ||
64 | #endif | ||
65 | |||
66 | *addr = diag210_tmp; | ||
67 | spin_unlock_irqrestore(&diag210_lock, flags); | ||
68 | |||
69 | return ccode; | ||
70 | } | ||
71 | |||
72 | /* | ||
73 | * Input : | 29 | * Input : |
74 | * devno - device number | 30 | * devno - device number |
75 | * ps - pointer to sense ID data area | 31 | * ps - pointer to sense ID data area |
@@ -349,5 +305,3 @@ ccw_device_sense_id_irq(struct ccw_device *cdev, enum dev_event dev_event) | |||
349 | break; | 305 | break; |
350 | } | 306 | } |
351 | } | 307 | } |
352 | |||
353 | EXPORT_SYMBOL(diag210); | ||
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index ed026a1dc324..d8d479876ec7 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c | |||
@@ -81,6 +81,7 @@ static __u32 volatile spare_indicator; | |||
81 | static atomic_t spare_indicator_usecount; | 81 | static atomic_t spare_indicator_usecount; |
82 | #define QDIO_MEMPOOL_SCSSC_ELEMENTS 2 | 82 | #define QDIO_MEMPOOL_SCSSC_ELEMENTS 2 |
83 | static mempool_t *qdio_mempool_scssc; | 83 | static mempool_t *qdio_mempool_scssc; |
84 | static struct kmem_cache *qdio_q_cache; | ||
84 | 85 | ||
85 | static debug_info_t *qdio_dbf_setup; | 86 | static debug_info_t *qdio_dbf_setup; |
86 | static debug_info_t *qdio_dbf_sbal; | 87 | static debug_info_t *qdio_dbf_sbal; |
@@ -194,6 +195,8 @@ qdio_do_eqbs(struct qdio_q *q, unsigned char *state, | |||
194 | again: | 195 | again: |
195 | ccq = do_eqbs(irq->sch_token, state, q_no, start, cnt); | 196 | ccq = do_eqbs(irq->sch_token, state, q_no, start, cnt); |
196 | rc = qdio_check_ccq(q, ccq); | 197 | rc = qdio_check_ccq(q, ccq); |
198 | if ((ccq == 96) && (tmp_cnt != *cnt)) | ||
199 | rc = 0; | ||
197 | if (rc == 1) { | 200 | if (rc == 1) { |
198 | QDIO_DBF_TEXT5(1,trace,"eqAGAIN"); | 201 | QDIO_DBF_TEXT5(1,trace,"eqAGAIN"); |
199 | goto again; | 202 | goto again; |
@@ -739,7 +742,8 @@ qdio_get_outbound_buffer_frontier(struct qdio_q *q) | |||
739 | first_not_to_check=f+qdio_min(atomic_read(&q->number_of_buffers_used), | 742 | first_not_to_check=f+qdio_min(atomic_read(&q->number_of_buffers_used), |
740 | (QDIO_MAX_BUFFERS_PER_Q-1)); | 743 | (QDIO_MAX_BUFFERS_PER_Q-1)); |
741 | 744 | ||
742 | if ((!q->is_iqdio_q)&&(!q->hydra_gives_outbound_pcis)) | 745 | if (((!q->is_iqdio_q) && (!q->hydra_gives_outbound_pcis)) || |
746 | (q->queue_type == QDIO_IQDIO_QFMT_ASYNCH)) | ||
743 | SYNC_MEMORY; | 747 | SYNC_MEMORY; |
744 | 748 | ||
745 | check_next: | 749 | check_next: |
@@ -1617,23 +1621,21 @@ static void | |||
1617 | qdio_release_irq_memory(struct qdio_irq *irq_ptr) | 1621 | qdio_release_irq_memory(struct qdio_irq *irq_ptr) |
1618 | { | 1622 | { |
1619 | int i; | 1623 | int i; |
1624 | struct qdio_q *q; | ||
1620 | 1625 | ||
1621 | for (i=0;i<QDIO_MAX_QUEUES_PER_IRQ;i++) { | 1626 | for (i = 0; i < QDIO_MAX_QUEUES_PER_IRQ; i++) { |
1622 | if (!irq_ptr->input_qs[i]) | 1627 | q = irq_ptr->input_qs[i]; |
1623 | goto next; | 1628 | if (q) { |
1624 | 1629 | free_page((unsigned long) q->slib); | |
1625 | kfree(irq_ptr->input_qs[i]->slib); | 1630 | kmem_cache_free(qdio_q_cache, q); |
1626 | kfree(irq_ptr->input_qs[i]); | 1631 | } |
1627 | 1632 | q = irq_ptr->output_qs[i]; | |
1628 | next: | 1633 | if (q) { |
1629 | if (!irq_ptr->output_qs[i]) | 1634 | free_page((unsigned long) q->slib); |
1630 | continue; | 1635 | kmem_cache_free(qdio_q_cache, q); |
1631 | 1636 | } | |
1632 | kfree(irq_ptr->output_qs[i]->slib); | ||
1633 | kfree(irq_ptr->output_qs[i]); | ||
1634 | |||
1635 | } | 1637 | } |
1636 | kfree(irq_ptr->qdr); | 1638 | free_page((unsigned long) irq_ptr->qdr); |
1637 | free_page((unsigned long) irq_ptr); | 1639 | free_page((unsigned long) irq_ptr); |
1638 | } | 1640 | } |
1639 | 1641 | ||
@@ -1680,44 +1682,35 @@ qdio_alloc_qs(struct qdio_irq *irq_ptr, | |||
1680 | { | 1682 | { |
1681 | int i; | 1683 | int i; |
1682 | struct qdio_q *q; | 1684 | struct qdio_q *q; |
1683 | int result=-ENOMEM; | ||
1684 | |||
1685 | for (i=0;i<no_input_qs;i++) { | ||
1686 | q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL); | ||
1687 | 1685 | ||
1688 | if (!q) { | 1686 | for (i = 0; i < no_input_qs; i++) { |
1689 | QDIO_PRINT_ERR("kmalloc of q failed!\n"); | 1687 | q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL); |
1690 | goto out; | 1688 | if (!q) |
1691 | } | 1689 | return -ENOMEM; |
1690 | memset(q, 0, sizeof(*q)); | ||
1692 | 1691 | ||
1693 | q->slib = kmalloc(PAGE_SIZE, GFP_KERNEL); | 1692 | q->slib = (struct slib *) __get_free_page(GFP_KERNEL); |
1694 | if (!q->slib) { | 1693 | if (!q->slib) { |
1695 | QDIO_PRINT_ERR("kmalloc of slib failed!\n"); | 1694 | kmem_cache_free(qdio_q_cache, q); |
1696 | goto out; | 1695 | return -ENOMEM; |
1697 | } | 1696 | } |
1698 | |||
1699 | irq_ptr->input_qs[i]=q; | 1697 | irq_ptr->input_qs[i]=q; |
1700 | } | 1698 | } |
1701 | 1699 | ||
1702 | for (i=0;i<no_output_qs;i++) { | 1700 | for (i = 0; i < no_output_qs; i++) { |
1703 | q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL); | 1701 | q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL); |
1704 | 1702 | if (!q) | |
1705 | if (!q) { | 1703 | return -ENOMEM; |
1706 | goto out; | 1704 | memset(q, 0, sizeof(*q)); |
1707 | } | ||
1708 | 1705 | ||
1709 | q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL); | 1706 | q->slib = (struct slib *) __get_free_page(GFP_KERNEL); |
1710 | if (!q->slib) { | 1707 | if (!q->slib) { |
1711 | QDIO_PRINT_ERR("kmalloc of slib failed!\n"); | 1708 | kmem_cache_free(qdio_q_cache, q); |
1712 | goto out; | 1709 | return -ENOMEM; |
1713 | } | 1710 | } |
1714 | |||
1715 | irq_ptr->output_qs[i]=q; | 1711 | irq_ptr->output_qs[i]=q; |
1716 | } | 1712 | } |
1717 | 1713 | return 0; | |
1718 | result=0; | ||
1719 | out: | ||
1720 | return result; | ||
1721 | } | 1714 | } |
1722 | 1715 | ||
1723 | static void | 1716 | static void |
@@ -2985,17 +2978,17 @@ qdio_allocate(struct qdio_initialize *init_data) | |||
2985 | QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*)); | 2978 | QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*)); |
2986 | 2979 | ||
2987 | if (!irq_ptr) { | 2980 | if (!irq_ptr) { |
2988 | QDIO_PRINT_ERR("kmalloc of irq_ptr failed!\n"); | 2981 | QDIO_PRINT_ERR("allocation of irq_ptr failed!\n"); |
2989 | return -ENOMEM; | 2982 | return -ENOMEM; |
2990 | } | 2983 | } |
2991 | 2984 | ||
2992 | init_MUTEX(&irq_ptr->setting_up_sema); | 2985 | init_MUTEX(&irq_ptr->setting_up_sema); |
2993 | 2986 | ||
2994 | /* QDR must be in DMA area since CCW data address is only 32 bit */ | 2987 | /* QDR must be in DMA area since CCW data address is only 32 bit */ |
2995 | irq_ptr->qdr=kmalloc(sizeof(struct qdr), GFP_KERNEL | GFP_DMA); | 2988 | irq_ptr->qdr = (struct qdr *) __get_free_page(GFP_KERNEL | GFP_DMA); |
2996 | if (!(irq_ptr->qdr)) { | 2989 | if (!(irq_ptr->qdr)) { |
2997 | free_page((unsigned long) irq_ptr); | 2990 | free_page((unsigned long) irq_ptr); |
2998 | QDIO_PRINT_ERR("kmalloc of irq_ptr->qdr failed!\n"); | 2991 | QDIO_PRINT_ERR("allocation of irq_ptr->qdr failed!\n"); |
2999 | return -ENOMEM; | 2992 | return -ENOMEM; |
3000 | } | 2993 | } |
3001 | QDIO_DBF_TEXT0(0,setup,"qdr:"); | 2994 | QDIO_DBF_TEXT0(0,setup,"qdr:"); |
@@ -3004,6 +2997,7 @@ qdio_allocate(struct qdio_initialize *init_data) | |||
3004 | if (qdio_alloc_qs(irq_ptr, | 2997 | if (qdio_alloc_qs(irq_ptr, |
3005 | init_data->no_input_qs, | 2998 | init_data->no_input_qs, |
3006 | init_data->no_output_qs)) { | 2999 | init_data->no_output_qs)) { |
3000 | QDIO_PRINT_ERR("queue allocation failed!\n"); | ||
3007 | qdio_release_irq_memory(irq_ptr); | 3001 | qdio_release_irq_memory(irq_ptr); |
3008 | return -ENOMEM; | 3002 | return -ENOMEM; |
3009 | } | 3003 | } |
@@ -3895,9 +3889,19 @@ init_QDIO(void) | |||
3895 | if (res) | 3889 | if (res) |
3896 | return res; | 3890 | return res; |
3897 | 3891 | ||
3892 | qdio_q_cache = kmem_cache_create("qdio_q", sizeof(struct qdio_q), | ||
3893 | 256, 0, NULL); | ||
3894 | if (!qdio_q_cache) { | ||
3895 | qdio_release_qdio_memory(); | ||
3896 | return -ENOMEM; | ||
3897 | } | ||
3898 | |||
3898 | res = qdio_register_dbf_views(); | 3899 | res = qdio_register_dbf_views(); |
3899 | if (res) | 3900 | if (res) { |
3901 | kmem_cache_destroy(qdio_q_cache); | ||
3902 | qdio_release_qdio_memory(); | ||
3900 | return res; | 3903 | return res; |
3904 | } | ||
3901 | 3905 | ||
3902 | QDIO_DBF_TEXT0(0,setup,"initQDIO"); | 3906 | QDIO_DBF_TEXT0(0,setup,"initQDIO"); |
3903 | res = bus_create_file(&ccw_bus_type, &bus_attr_qdio_performance_stats); | 3907 | res = bus_create_file(&ccw_bus_type, &bus_attr_qdio_performance_stats); |
@@ -3929,6 +3933,7 @@ cleanup_QDIO(void) | |||
3929 | qdio_release_qdio_memory(); | 3933 | qdio_release_qdio_memory(); |
3930 | qdio_unregister_dbf_views(); | 3934 | qdio_unregister_dbf_views(); |
3931 | mempool_destroy(qdio_mempool_scssc); | 3935 | mempool_destroy(qdio_mempool_scssc); |
3936 | kmem_cache_destroy(qdio_q_cache); | ||
3932 | bus_remove_file(&ccw_bus_type, &bus_attr_qdio_performance_stats); | 3937 | bus_remove_file(&ccw_bus_type, &bus_attr_qdio_performance_stats); |
3933 | printk("qdio: %s: module removed\n",version); | 3938 | printk("qdio: %s: module removed\n",version); |
3934 | } | 3939 | } |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index b240800b78d7..99299976e891 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -4154,8 +4154,9 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req) | |||
4154 | fcp_rsp_iu->fcp_resid, | 4154 | fcp_rsp_iu->fcp_resid, |
4155 | (int) zfcp_get_fcp_dl(fcp_cmnd_iu)); | 4155 | (int) zfcp_get_fcp_dl(fcp_cmnd_iu)); |
4156 | 4156 | ||
4157 | scpnt->resid = fcp_rsp_iu->fcp_resid; | 4157 | scsi_set_resid(scpnt, fcp_rsp_iu->fcp_resid); |
4158 | if (scpnt->request_bufflen - scpnt->resid < scpnt->underflow) | 4158 | if (scsi_bufflen(scpnt) - scsi_get_resid(scpnt) < |
4159 | scpnt->underflow) | ||
4159 | set_host_byte(&scpnt->result, DID_ERROR); | 4160 | set_host_byte(&scpnt->result, DID_ERROR); |
4160 | } | 4161 | } |
4161 | 4162 | ||
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c index c408badd2ae9..81daa8204bfe 100644 --- a/drivers/s390/scsi/zfcp_qdio.c +++ b/drivers/s390/scsi/zfcp_qdio.c | |||
@@ -36,8 +36,6 @@ static void zfcp_qdio_sbale_fill | |||
36 | (struct zfcp_fsf_req *, unsigned long, void *, int); | 36 | (struct zfcp_fsf_req *, unsigned long, void *, int); |
37 | static int zfcp_qdio_sbals_from_segment | 37 | static int zfcp_qdio_sbals_from_segment |
38 | (struct zfcp_fsf_req *, unsigned long, void *, unsigned long); | 38 | (struct zfcp_fsf_req *, unsigned long, void *, unsigned long); |
39 | static int zfcp_qdio_sbals_from_buffer | ||
40 | (struct zfcp_fsf_req *, unsigned long, void *, unsigned long, int); | ||
41 | 39 | ||
42 | static qdio_handler_t zfcp_qdio_request_handler; | 40 | static qdio_handler_t zfcp_qdio_request_handler; |
43 | static qdio_handler_t zfcp_qdio_response_handler; | 41 | static qdio_handler_t zfcp_qdio_response_handler; |
@@ -632,28 +630,6 @@ out: | |||
632 | 630 | ||
633 | 631 | ||
634 | /** | 632 | /** |
635 | * zfcp_qdio_sbals_from_buffer - fill SBALs from buffer | ||
636 | * @fsf_req: request to be processed | ||
637 | * @sbtype: SBALE flags | ||
638 | * @buffer: data buffer | ||
639 | * @length: length of buffer | ||
640 | * @max_sbals: upper bound for number of SBALs to be used | ||
641 | */ | ||
642 | static int | ||
643 | zfcp_qdio_sbals_from_buffer(struct zfcp_fsf_req *fsf_req, unsigned long sbtype, | ||
644 | void *buffer, unsigned long length, int max_sbals) | ||
645 | { | ||
646 | struct scatterlist sg_segment; | ||
647 | |||
648 | zfcp_address_to_sg(buffer, &sg_segment); | ||
649 | sg_segment.length = length; | ||
650 | |||
651 | return zfcp_qdio_sbals_from_sg(fsf_req, sbtype, &sg_segment, 1, | ||
652 | max_sbals); | ||
653 | } | ||
654 | |||
655 | |||
656 | /** | ||
657 | * zfcp_qdio_sbals_from_scsicmnd - fill SBALs from scsi command | 633 | * zfcp_qdio_sbals_from_scsicmnd - fill SBALs from scsi command |
658 | * @fsf_req: request to be processed | 634 | * @fsf_req: request to be processed |
659 | * @sbtype: SBALE flags | 635 | * @sbtype: SBALE flags |
@@ -664,18 +640,13 @@ int | |||
664 | zfcp_qdio_sbals_from_scsicmnd(struct zfcp_fsf_req *fsf_req, | 640 | zfcp_qdio_sbals_from_scsicmnd(struct zfcp_fsf_req *fsf_req, |
665 | unsigned long sbtype, struct scsi_cmnd *scsi_cmnd) | 641 | unsigned long sbtype, struct scsi_cmnd *scsi_cmnd) |
666 | { | 642 | { |
667 | if (scsi_cmnd->use_sg) { | 643 | if (scsi_sg_count(scsi_cmnd)) |
668 | return zfcp_qdio_sbals_from_sg(fsf_req, sbtype, | 644 | return zfcp_qdio_sbals_from_sg(fsf_req, sbtype, |
669 | (struct scatterlist *) | 645 | scsi_sglist(scsi_cmnd), |
670 | scsi_cmnd->request_buffer, | 646 | scsi_sg_count(scsi_cmnd), |
671 | scsi_cmnd->use_sg, | 647 | ZFCP_MAX_SBALS_PER_REQ); |
672 | ZFCP_MAX_SBALS_PER_REQ); | 648 | else |
673 | } else { | 649 | return 0; |
674 | return zfcp_qdio_sbals_from_buffer(fsf_req, sbtype, | ||
675 | scsi_cmnd->request_buffer, | ||
676 | scsi_cmnd->request_bufflen, | ||
677 | ZFCP_MAX_SBALS_PER_REQ); | ||
678 | } | ||
679 | } | 650 | } |
680 | 651 | ||
681 | /** | 652 | /** |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index d2b3898b750a..6f2c71ef47ee 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -367,6 +367,7 @@ config SCSI_3W_9XXX | |||
367 | config SCSI_7000FASST | 367 | config SCSI_7000FASST |
368 | tristate "7000FASST SCSI support" | 368 | tristate "7000FASST SCSI support" |
369 | depends on ISA && SCSI && ISA_DMA_API | 369 | depends on ISA && SCSI && ISA_DMA_API |
370 | select CHECK_SIGNATURE | ||
370 | help | 371 | help |
371 | This driver supports the Western Digital 7000 SCSI host adapter | 372 | This driver supports the Western Digital 7000 SCSI host adapter |
372 | family. Some information is in the source: | 373 | family. Some information is in the source: |
@@ -388,6 +389,7 @@ config SCSI_AHA152X | |||
388 | tristate "Adaptec AHA152X/2825 support" | 389 | tristate "Adaptec AHA152X/2825 support" |
389 | depends on ISA && SCSI && !64BIT | 390 | depends on ISA && SCSI && !64BIT |
390 | select SCSI_SPI_ATTRS | 391 | select SCSI_SPI_ATTRS |
392 | select CHECK_SIGNATURE | ||
391 | ---help--- | 393 | ---help--- |
392 | This is a driver for the AHA-1510, AHA-1520, AHA-1522, and AHA-2825 | 394 | This is a driver for the AHA-1510, AHA-1520, AHA-1522, and AHA-2825 |
393 | SCSI host adapters. It also works for the AVA-1505, but the IRQ etc. | 395 | SCSI host adapters. It also works for the AVA-1505, but the IRQ etc. |
@@ -583,6 +585,7 @@ config SCSI_DTC3280 | |||
583 | tristate "DTC3180/3280 SCSI support" | 585 | tristate "DTC3180/3280 SCSI support" |
584 | depends on ISA && SCSI | 586 | depends on ISA && SCSI |
585 | select SCSI_SPI_ATTRS | 587 | select SCSI_SPI_ATTRS |
588 | select CHECK_SIGNATURE | ||
586 | help | 589 | help |
587 | This is support for DTC 3180/3280 SCSI Host Adapters. Please read | 590 | This is support for DTC 3180/3280 SCSI Host Adapters. Please read |
588 | the SCSI-HOWTO, available from | 591 | the SCSI-HOWTO, available from |
@@ -657,6 +660,7 @@ config SCSI_EATA_PIO | |||
657 | config SCSI_FUTURE_DOMAIN | 660 | config SCSI_FUTURE_DOMAIN |
658 | tristate "Future Domain 16xx SCSI/AHA-2920A support" | 661 | tristate "Future Domain 16xx SCSI/AHA-2920A support" |
659 | depends on (ISA || PCI) && SCSI | 662 | depends on (ISA || PCI) && SCSI |
663 | select CHECK_SIGNATURE | ||
660 | ---help--- | 664 | ---help--- |
661 | This is support for Future Domain's 16-bit SCSI host adapters | 665 | This is support for Future Domain's 16-bit SCSI host adapters |
662 | (TMC-1660/1680, TMC-1650/1670, TMC-3260, TMC-1610M/MER/MEX) and | 666 | (TMC-1660/1680, TMC-1650/1670, TMC-3260, TMC-1610M/MER/MEX) and |
@@ -1324,6 +1328,7 @@ config SCSI_LPFC | |||
1324 | config SCSI_SEAGATE | 1328 | config SCSI_SEAGATE |
1325 | tristate "Seagate ST-02 and Future Domain TMC-8xx SCSI support" | 1329 | tristate "Seagate ST-02 and Future Domain TMC-8xx SCSI support" |
1326 | depends on X86 && ISA && SCSI | 1330 | depends on X86 && ISA && SCSI |
1331 | select CHECK_SIGNATURE | ||
1327 | ---help--- | 1332 | ---help--- |
1328 | These are 8-bit SCSI controllers; the ST-01 is also supported by | 1333 | These are 8-bit SCSI controllers; the ST-01 is also supported by |
1329 | this driver. It is explained in section 3.9 of the SCSI-HOWTO, | 1334 | this driver. It is explained in section 3.9 of the SCSI-HOWTO, |
@@ -1397,6 +1402,7 @@ config SCSI_T128 | |||
1397 | tristate "Trantor T128/T128F/T228 SCSI support" | 1402 | tristate "Trantor T128/T128F/T228 SCSI support" |
1398 | depends on ISA && SCSI | 1403 | depends on ISA && SCSI |
1399 | select SCSI_SPI_ATTRS | 1404 | select SCSI_SPI_ATTRS |
1405 | select CHECK_SIGNATURE | ||
1400 | ---help--- | 1406 | ---help--- |
1401 | This is support for a SCSI host adapter. It is explained in section | 1407 | This is support for a SCSI host adapter. It is explained in section |
1402 | 3.11 of the SCSI-HOWTO, available from | 1408 | 3.11 of the SCSI-HOWTO, available from |
@@ -1561,7 +1567,7 @@ config A3000_SCSI | |||
1561 | built-in SCSI controller, say Y. Otherwise, say N. | 1567 | built-in SCSI controller, say Y. Otherwise, say N. |
1562 | 1568 | ||
1563 | To compile this driver as a module, choose M here: the | 1569 | To compile this driver as a module, choose M here: the |
1564 | module will be called wd33c93. | 1570 | module will be called a3000. |
1565 | 1571 | ||
1566 | config A2091_SCSI | 1572 | config A2091_SCSI |
1567 | tristate "A2091/A590 WD33C93A support" | 1573 | tristate "A2091/A590 WD33C93A support" |
@@ -1571,7 +1577,7 @@ config A2091_SCSI | |||
1571 | say N. | 1577 | say N. |
1572 | 1578 | ||
1573 | To compile this driver as a module, choose M here: the | 1579 | To compile this driver as a module, choose M here: the |
1574 | module will be called wd33c93. | 1580 | module will be called a2091. |
1575 | 1581 | ||
1576 | config GVP11_SCSI | 1582 | config GVP11_SCSI |
1577 | tristate "GVP Series II WD33C93A support" | 1583 | tristate "GVP Series II WD33C93A support" |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 813556c60007..a7f42a17b5c7 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -1110,7 +1110,9 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
1110 | __aac_shutdown(aac); | 1110 | __aac_shutdown(aac); |
1111 | out_unmap: | 1111 | out_unmap: |
1112 | aac_fib_map_free(aac); | 1112 | aac_fib_map_free(aac); |
1113 | pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys); | 1113 | if (aac->comm_addr) |
1114 | pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, | ||
1115 | aac->comm_phys); | ||
1114 | kfree(aac->queues); | 1116 | kfree(aac->queues); |
1115 | aac_adapter_ioremap(aac, 0); | 1117 | aac_adapter_ioremap(aac, 0); |
1116 | kfree(aac->fibs); | 1118 | kfree(aac->fibs); |
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index 85f2394ffc3e..d30a30786dda 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -289,18 +289,18 @@ static LIST_HEAD(aha152x_host_list); | |||
289 | if(spin_is_locked(&QLOCK)) { \ | 289 | if(spin_is_locked(&QLOCK)) { \ |
290 | DPRINTK(debug_intr, DEBUG_LEAD "(%s:%d) already locked at %s:%d\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \ | 290 | DPRINTK(debug_intr, DEBUG_LEAD "(%s:%d) already locked at %s:%d\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \ |
291 | } \ | 291 | } \ |
292 | DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) locking\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \ | 292 | DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locking\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \ |
293 | spin_lock_irqsave(&QLOCK,flags); \ | 293 | spin_lock_irqsave(&QLOCK,flags); \ |
294 | DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) locked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \ | 294 | DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \ |
295 | QLOCKER=__FUNCTION__; \ | 295 | QLOCKER=__FUNCTION__; \ |
296 | QLOCKERL=__LINE__; \ | 296 | QLOCKERL=__LINE__; \ |
297 | } while(0) | 297 | } while(0) |
298 | 298 | ||
299 | #define DO_UNLOCK(flags) \ | 299 | #define DO_UNLOCK(flags) \ |
300 | do { \ | 300 | do { \ |
301 | DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) unlocking (locked at %s:%d)\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \ | 301 | DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocking (locked at %s:%d)\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \ |
302 | spin_unlock_irqrestore(&QLOCK,flags); \ | 302 | spin_unlock_irqrestore(&QLOCK,flags); \ |
303 | DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) unlocked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \ | 303 | DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \ |
304 | QLOCKER="(not locked)"; \ | 304 | QLOCKER="(not locked)"; \ |
305 | QLOCKERL=0; \ | 305 | QLOCKERL=0; \ |
306 | } while(0) | 306 | } while(0) |
@@ -322,6 +322,12 @@ static LIST_HEAD(aha152x_host_list); | |||
322 | (cmd) ? ((cmd)->device->id & 0x0f) : -1, \ | 322 | (cmd) ? ((cmd)->device->id & 0x0f) : -1, \ |
323 | (cmd) ? ((cmd)->device->lun & 0x07) : -1 | 323 | (cmd) ? ((cmd)->device->lun & 0x07) : -1 |
324 | 324 | ||
325 | static inline void | ||
326 | CMD_INC_RESID(struct scsi_cmnd *cmd, int inc) | ||
327 | { | ||
328 | scsi_set_resid(cmd, scsi_get_resid(cmd) + inc); | ||
329 | } | ||
330 | |||
325 | #define DELAY_DEFAULT 1000 | 331 | #define DELAY_DEFAULT 1000 |
326 | 332 | ||
327 | #if defined(PCMCIA) | 333 | #if defined(PCMCIA) |
@@ -552,14 +558,11 @@ struct aha152x_hostdata { | |||
552 | struct aha152x_scdata { | 558 | struct aha152x_scdata { |
553 | Scsi_Cmnd *next; /* next sc in queue */ | 559 | Scsi_Cmnd *next; /* next sc in queue */ |
554 | struct completion *done;/* semaphore to block on */ | 560 | struct completion *done;/* semaphore to block on */ |
555 | unsigned char cmd_len; | 561 | unsigned char aha_orig_cmd_len; |
556 | unsigned char cmnd[MAX_COMMAND_SIZE]; | 562 | unsigned char aha_orig_cmnd[MAX_COMMAND_SIZE]; |
557 | unsigned short use_sg; | 563 | int aha_orig_resid; |
558 | unsigned request_bufflen; | ||
559 | void *request_buffer; | ||
560 | }; | 564 | }; |
561 | 565 | ||
562 | |||
563 | /* access macros for hostdata */ | 566 | /* access macros for hostdata */ |
564 | 567 | ||
565 | #define HOSTDATA(shpnt) ((struct aha152x_hostdata *) &shpnt->hostdata) | 568 | #define HOSTDATA(shpnt) ((struct aha152x_hostdata *) &shpnt->hostdata) |
@@ -978,15 +981,15 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete, | |||
978 | #if defined(AHA152X_DEBUG) | 981 | #if defined(AHA152X_DEBUG) |
979 | if (HOSTDATA(shpnt)->debug & debug_queue) { | 982 | if (HOSTDATA(shpnt)->debug & debug_queue) { |
980 | printk(INFO_LEAD "queue: %p; cmd_len=%d pieces=%d size=%u cmnd=", | 983 | printk(INFO_LEAD "queue: %p; cmd_len=%d pieces=%d size=%u cmnd=", |
981 | CMDINFO(SCpnt), SCpnt, SCpnt->cmd_len, SCpnt->use_sg, SCpnt->request_bufflen); | 984 | CMDINFO(SCpnt), SCpnt, SCpnt->cmd_len, |
985 | scsi_sg_count(SCpnt), scsi_bufflen(SCpnt)); | ||
982 | __scsi_print_command(SCpnt->cmnd); | 986 | __scsi_print_command(SCpnt->cmnd); |
983 | } | 987 | } |
984 | #endif | 988 | #endif |
985 | 989 | ||
986 | SCpnt->scsi_done = done; | 990 | SCpnt->scsi_done = done; |
987 | SCpnt->resid = SCpnt->request_bufflen; | ||
988 | SCpnt->SCp.phase = not_issued | phase; | 991 | SCpnt->SCp.phase = not_issued | phase; |
989 | SCpnt->SCp.Status = CHECK_CONDITION; | 992 | SCpnt->SCp.Status = 0x1; /* Ilegal status by SCSI standard */ |
990 | SCpnt->SCp.Message = 0; | 993 | SCpnt->SCp.Message = 0; |
991 | SCpnt->SCp.have_data_in = 0; | 994 | SCpnt->SCp.have_data_in = 0; |
992 | SCpnt->SCp.sent_command = 0; | 995 | SCpnt->SCp.sent_command = 0; |
@@ -997,20 +1000,11 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete, | |||
997 | return FAILED; | 1000 | return FAILED; |
998 | } | 1001 | } |
999 | } else { | 1002 | } else { |
1000 | struct aha152x_scdata *sc; | ||
1001 | |||
1002 | SCpnt->host_scribble = kmalloc(sizeof(struct aha152x_scdata), GFP_ATOMIC); | 1003 | SCpnt->host_scribble = kmalloc(sizeof(struct aha152x_scdata), GFP_ATOMIC); |
1003 | if(SCpnt->host_scribble==0) { | 1004 | if(SCpnt->host_scribble==0) { |
1004 | printk(ERR_LEAD "allocation failed\n", CMDINFO(SCpnt)); | 1005 | printk(ERR_LEAD "allocation failed\n", CMDINFO(SCpnt)); |
1005 | return FAILED; | 1006 | return FAILED; |
1006 | } | 1007 | } |
1007 | |||
1008 | sc = SCDATA(SCpnt); | ||
1009 | memcpy(sc->cmnd, SCpnt->cmnd, sizeof(sc->cmnd)); | ||
1010 | sc->request_buffer = SCpnt->request_buffer; | ||
1011 | sc->request_bufflen = SCpnt->request_bufflen; | ||
1012 | sc->use_sg = SCpnt->use_sg; | ||
1013 | sc->cmd_len = SCpnt->cmd_len; | ||
1014 | } | 1008 | } |
1015 | 1009 | ||
1016 | SCNEXT(SCpnt) = NULL; | 1010 | SCNEXT(SCpnt) = NULL; |
@@ -1022,16 +1016,25 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete, | |||
1022 | SCp.buffer : next buffer | 1016 | SCp.buffer : next buffer |
1023 | SCp.buffers_residual : left buffers in list | 1017 | SCp.buffers_residual : left buffers in list |
1024 | SCp.phase : current state of the command */ | 1018 | SCp.phase : current state of the command */ |
1025 | if (SCpnt->use_sg) { | 1019 | |
1026 | SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; | 1020 | if ((phase & (check_condition|resetting)) || !scsi_sglist(SCpnt)) { |
1027 | SCpnt->SCp.ptr = SG_ADDRESS(SCpnt->SCp.buffer); | 1021 | if (phase & check_condition) { |
1028 | SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; | 1022 | SCpnt->SCp.ptr = SCpnt->sense_buffer; |
1029 | SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; | 1023 | SCpnt->SCp.this_residual = sizeof(SCpnt->sense_buffer); |
1030 | } else { | 1024 | scsi_set_resid(SCpnt, sizeof(SCpnt->sense_buffer)); |
1031 | SCpnt->SCp.ptr = (char *) SCpnt->request_buffer; | 1025 | } else { |
1032 | SCpnt->SCp.this_residual = SCpnt->request_bufflen; | 1026 | SCpnt->SCp.ptr = NULL; |
1027 | SCpnt->SCp.this_residual = 0; | ||
1028 | scsi_set_resid(SCpnt, 0); | ||
1029 | } | ||
1033 | SCpnt->SCp.buffer = NULL; | 1030 | SCpnt->SCp.buffer = NULL; |
1034 | SCpnt->SCp.buffers_residual = 0; | 1031 | SCpnt->SCp.buffers_residual = 0; |
1032 | } else { | ||
1033 | scsi_set_resid(SCpnt, scsi_bufflen(SCpnt)); | ||
1034 | SCpnt->SCp.buffer = scsi_sglist(SCpnt); | ||
1035 | SCpnt->SCp.ptr = SG_ADDRESS(SCpnt->SCp.buffer); | ||
1036 | SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; | ||
1037 | SCpnt->SCp.buffers_residual = scsi_sg_count(SCpnt) - 1; | ||
1035 | } | 1038 | } |
1036 | 1039 | ||
1037 | DO_LOCK(flags); | 1040 | DO_LOCK(flags); |
@@ -1150,9 +1153,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt) | |||
1150 | DECLARE_COMPLETION(done); | 1153 | DECLARE_COMPLETION(done); |
1151 | int ret, issued, disconnected; | 1154 | int ret, issued, disconnected; |
1152 | unsigned char old_cmd_len = SCpnt->cmd_len; | 1155 | unsigned char old_cmd_len = SCpnt->cmd_len; |
1153 | unsigned short old_use_sg = SCpnt->use_sg; | ||
1154 | void *old_buffer = SCpnt->request_buffer; | ||
1155 | unsigned old_bufflen = SCpnt->request_bufflen; | ||
1156 | unsigned long flags; | 1156 | unsigned long flags; |
1157 | unsigned long timeleft; | 1157 | unsigned long timeleft; |
1158 | 1158 | ||
@@ -1174,9 +1174,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt) | |||
1174 | DO_UNLOCK(flags); | 1174 | DO_UNLOCK(flags); |
1175 | 1175 | ||
1176 | SCpnt->cmd_len = 0; | 1176 | SCpnt->cmd_len = 0; |
1177 | SCpnt->use_sg = 0; | ||
1178 | SCpnt->request_buffer = NULL; | ||
1179 | SCpnt->request_bufflen = 0; | ||
1180 | 1177 | ||
1181 | aha152x_internal_queue(SCpnt, &done, resetting, reset_done); | 1178 | aha152x_internal_queue(SCpnt, &done, resetting, reset_done); |
1182 | 1179 | ||
@@ -1189,9 +1186,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt) | |||
1189 | } | 1186 | } |
1190 | 1187 | ||
1191 | SCpnt->cmd_len = old_cmd_len; | 1188 | SCpnt->cmd_len = old_cmd_len; |
1192 | SCpnt->use_sg = old_use_sg; | ||
1193 | SCpnt->request_buffer = old_buffer; | ||
1194 | SCpnt->request_bufflen = old_bufflen; | ||
1195 | 1189 | ||
1196 | DO_LOCK(flags); | 1190 | DO_LOCK(flags); |
1197 | 1191 | ||
@@ -1531,8 +1525,8 @@ static void busfree_run(struct Scsi_Host *shpnt) | |||
1531 | /* target sent DISCONNECT */ | 1525 | /* target sent DISCONNECT */ |
1532 | DPRINTK(debug_selection, DEBUG_LEAD "target disconnected at %d/%d\n", | 1526 | DPRINTK(debug_selection, DEBUG_LEAD "target disconnected at %d/%d\n", |
1533 | CMDINFO(CURRENT_SC), | 1527 | CMDINFO(CURRENT_SC), |
1534 | CURRENT_SC->resid, | 1528 | scsi_get_resid(CURRENT_SC), |
1535 | CURRENT_SC->request_bufflen); | 1529 | scsi_bufflen(CURRENT_SC)); |
1536 | #if defined(AHA152X_STAT) | 1530 | #if defined(AHA152X_STAT) |
1537 | HOSTDATA(shpnt)->disconnections++; | 1531 | HOSTDATA(shpnt)->disconnections++; |
1538 | #endif | 1532 | #endif |
@@ -1568,18 +1562,16 @@ static void busfree_run(struct Scsi_Host *shpnt) | |||
1568 | #endif | 1562 | #endif |
1569 | 1563 | ||
1570 | /* restore old command */ | 1564 | /* restore old command */ |
1571 | memcpy(cmd->cmnd, sc->cmnd, sizeof(sc->cmnd)); | 1565 | memcpy(cmd->cmnd, sc->aha_orig_cmnd, sizeof(cmd->cmnd)); |
1572 | cmd->request_buffer = sc->request_buffer; | 1566 | cmd->cmd_len = sc->aha_orig_cmd_len; |
1573 | cmd->request_bufflen = sc->request_bufflen; | 1567 | scsi_set_resid(cmd, sc->aha_orig_resid); |
1574 | cmd->use_sg = sc->use_sg; | ||
1575 | cmd->cmd_len = sc->cmd_len; | ||
1576 | 1568 | ||
1577 | cmd->SCp.Status = 0x02; | 1569 | cmd->SCp.Status = SAM_STAT_CHECK_CONDITION; |
1578 | 1570 | ||
1579 | HOSTDATA(shpnt)->commands--; | 1571 | HOSTDATA(shpnt)->commands--; |
1580 | if (!HOSTDATA(shpnt)->commands) | 1572 | if (!HOSTDATA(shpnt)->commands) |
1581 | SETPORT(PORTA, 0); /* turn led off */ | 1573 | SETPORT(PORTA, 0); /* turn led off */ |
1582 | } else if(DONE_SC->SCp.Status==0x02) { | 1574 | } else if(DONE_SC->SCp.Status==SAM_STAT_CHECK_CONDITION) { |
1583 | #if defined(AHA152X_STAT) | 1575 | #if defined(AHA152X_STAT) |
1584 | HOSTDATA(shpnt)->busfree_with_check_condition++; | 1576 | HOSTDATA(shpnt)->busfree_with_check_condition++; |
1585 | #endif | 1577 | #endif |
@@ -1587,13 +1579,23 @@ static void busfree_run(struct Scsi_Host *shpnt) | |||
1587 | DPRINTK(debug_eh, ERR_LEAD "CHECK CONDITION found\n", CMDINFO(DONE_SC)); | 1579 | DPRINTK(debug_eh, ERR_LEAD "CHECK CONDITION found\n", CMDINFO(DONE_SC)); |
1588 | #endif | 1580 | #endif |
1589 | 1581 | ||
1590 | if(!(DONE_SC->SCp.Status & not_issued)) { | 1582 | if(!(DONE_SC->SCp.phase & not_issued)) { |
1583 | struct aha152x_scdata *sc; | ||
1591 | Scsi_Cmnd *ptr = DONE_SC; | 1584 | Scsi_Cmnd *ptr = DONE_SC; |
1592 | DONE_SC=NULL; | 1585 | DONE_SC=NULL; |
1593 | #if 0 | 1586 | #if 0 |
1594 | DPRINTK(debug_eh, ERR_LEAD "requesting sense\n", CMDINFO(ptr)); | 1587 | DPRINTK(debug_eh, ERR_LEAD "requesting sense\n", CMDINFO(ptr)); |
1595 | #endif | 1588 | #endif |
1596 | 1589 | ||
1590 | /* save old command */ | ||
1591 | sc = SCDATA(ptr); | ||
1592 | /* It was allocated in aha152x_internal_queue? */ | ||
1593 | BUG_ON(!sc); | ||
1594 | memcpy(sc->aha_orig_cmnd, ptr->cmnd, | ||
1595 | sizeof(ptr->cmnd)); | ||
1596 | sc->aha_orig_cmd_len = ptr->cmd_len; | ||
1597 | sc->aha_orig_resid = scsi_get_resid(ptr); | ||
1598 | |||
1597 | ptr->cmnd[0] = REQUEST_SENSE; | 1599 | ptr->cmnd[0] = REQUEST_SENSE; |
1598 | ptr->cmnd[1] = 0; | 1600 | ptr->cmnd[1] = 0; |
1599 | ptr->cmnd[2] = 0; | 1601 | ptr->cmnd[2] = 0; |
@@ -1601,10 +1603,7 @@ static void busfree_run(struct Scsi_Host *shpnt) | |||
1601 | ptr->cmnd[4] = sizeof(ptr->sense_buffer); | 1603 | ptr->cmnd[4] = sizeof(ptr->sense_buffer); |
1602 | ptr->cmnd[5] = 0; | 1604 | ptr->cmnd[5] = 0; |
1603 | ptr->cmd_len = 6; | 1605 | ptr->cmd_len = 6; |
1604 | ptr->use_sg = 0; | 1606 | |
1605 | ptr->request_buffer = ptr->sense_buffer; | ||
1606 | ptr->request_bufflen = sizeof(ptr->sense_buffer); | ||
1607 | |||
1608 | DO_UNLOCK(flags); | 1607 | DO_UNLOCK(flags); |
1609 | aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done); | 1608 | aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done); |
1610 | DO_LOCK(flags); | 1609 | DO_LOCK(flags); |
@@ -2180,7 +2179,8 @@ static void datai_init(struct Scsi_Host *shpnt) | |||
2180 | DATA_LEN=0; | 2179 | DATA_LEN=0; |
2181 | DPRINTK(debug_datai, | 2180 | DPRINTK(debug_datai, |
2182 | DEBUG_LEAD "datai_init: request_bufflen=%d resid=%d\n", | 2181 | DEBUG_LEAD "datai_init: request_bufflen=%d resid=%d\n", |
2183 | CMDINFO(CURRENT_SC), CURRENT_SC->request_bufflen, CURRENT_SC->resid); | 2182 | CMDINFO(CURRENT_SC), scsi_bufflen(CURRENT_SC), |
2183 | scsi_get_resid(CURRENT_SC)); | ||
2184 | } | 2184 | } |
2185 | 2185 | ||
2186 | static void datai_run(struct Scsi_Host *shpnt) | 2186 | static void datai_run(struct Scsi_Host *shpnt) |
@@ -2293,11 +2293,12 @@ static void datai_run(struct Scsi_Host *shpnt) | |||
2293 | 2293 | ||
2294 | static void datai_end(struct Scsi_Host *shpnt) | 2294 | static void datai_end(struct Scsi_Host *shpnt) |
2295 | { | 2295 | { |
2296 | CURRENT_SC->resid -= GETSTCNT(); | 2296 | CMD_INC_RESID(CURRENT_SC, -GETSTCNT()); |
2297 | 2297 | ||
2298 | DPRINTK(debug_datai, | 2298 | DPRINTK(debug_datai, |
2299 | DEBUG_LEAD "datai_end: request_bufflen=%d resid=%d stcnt=%d\n", | 2299 | DEBUG_LEAD "datai_end: request_bufflen=%d resid=%d stcnt=%d\n", |
2300 | CMDINFO(CURRENT_SC), CURRENT_SC->request_bufflen, CURRENT_SC->resid, GETSTCNT()); | 2300 | CMDINFO(CURRENT_SC), scsi_bufflen(CURRENT_SC), |
2301 | scsi_get_resid(CURRENT_SC), GETSTCNT()); | ||
2301 | 2302 | ||
2302 | SETPORT(SXFRCTL0, CH1|CLRSTCNT); | 2303 | SETPORT(SXFRCTL0, CH1|CLRSTCNT); |
2303 | SETPORT(DMACNTRL0, 0); | 2304 | SETPORT(DMACNTRL0, 0); |
@@ -2318,11 +2319,12 @@ static void datao_init(struct Scsi_Host *shpnt) | |||
2318 | SETPORT(SIMODE0, 0); | 2319 | SETPORT(SIMODE0, 0); |
2319 | SETPORT(SIMODE1, ENSCSIPERR | ENSCSIRST | ENPHASEMIS | ENBUSFREE ); | 2320 | SETPORT(SIMODE1, ENSCSIPERR | ENSCSIRST | ENPHASEMIS | ENBUSFREE ); |
2320 | 2321 | ||
2321 | DATA_LEN = CURRENT_SC->resid; | 2322 | DATA_LEN = scsi_get_resid(CURRENT_SC); |
2322 | 2323 | ||
2323 | DPRINTK(debug_datao, | 2324 | DPRINTK(debug_datao, |
2324 | DEBUG_LEAD "datao_init: request_bufflen=%d; resid=%d\n", | 2325 | DEBUG_LEAD "datao_init: request_bufflen=%d; resid=%d\n", |
2325 | CMDINFO(CURRENT_SC), CURRENT_SC->request_bufflen, CURRENT_SC->resid); | 2326 | CMDINFO(CURRENT_SC), scsi_bufflen(CURRENT_SC), |
2327 | scsi_get_resid(CURRENT_SC)); | ||
2326 | } | 2328 | } |
2327 | 2329 | ||
2328 | static void datao_run(struct Scsi_Host *shpnt) | 2330 | static void datao_run(struct Scsi_Host *shpnt) |
@@ -2346,7 +2348,7 @@ static void datao_run(struct Scsi_Host *shpnt) | |||
2346 | SETPORT(DMACNTRL0,WRITE_READ|ENDMA|_8BIT); | 2348 | SETPORT(DMACNTRL0,WRITE_READ|ENDMA|_8BIT); |
2347 | SETPORT(DATAPORT, *CURRENT_SC->SCp.ptr++); | 2349 | SETPORT(DATAPORT, *CURRENT_SC->SCp.ptr++); |
2348 | CURRENT_SC->SCp.this_residual--; | 2350 | CURRENT_SC->SCp.this_residual--; |
2349 | CURRENT_SC->resid--; | 2351 | CMD_INC_RESID(CURRENT_SC, -1); |
2350 | SETPORT(DMACNTRL0,WRITE_READ|ENDMA); | 2352 | SETPORT(DMACNTRL0,WRITE_READ|ENDMA); |
2351 | } | 2353 | } |
2352 | 2354 | ||
@@ -2355,7 +2357,7 @@ static void datao_run(struct Scsi_Host *shpnt) | |||
2355 | outsw(DATAPORT, CURRENT_SC->SCp.ptr, data_count); | 2357 | outsw(DATAPORT, CURRENT_SC->SCp.ptr, data_count); |
2356 | CURRENT_SC->SCp.ptr += 2 * data_count; | 2358 | CURRENT_SC->SCp.ptr += 2 * data_count; |
2357 | CURRENT_SC->SCp.this_residual -= 2 * data_count; | 2359 | CURRENT_SC->SCp.this_residual -= 2 * data_count; |
2358 | CURRENT_SC->resid -= 2 * data_count; | 2360 | CMD_INC_RESID(CURRENT_SC, -2 * data_count); |
2359 | } | 2361 | } |
2360 | 2362 | ||
2361 | if(CURRENT_SC->SCp.this_residual==0 && CURRENT_SC->SCp.buffers_residual>0) { | 2363 | if(CURRENT_SC->SCp.this_residual==0 && CURRENT_SC->SCp.buffers_residual>0) { |
@@ -2381,35 +2383,34 @@ static void datao_run(struct Scsi_Host *shpnt) | |||
2381 | static void datao_end(struct Scsi_Host *shpnt) | 2383 | static void datao_end(struct Scsi_Host *shpnt) |
2382 | { | 2384 | { |
2383 | if(TESTLO(DMASTAT, DFIFOEMP)) { | 2385 | if(TESTLO(DMASTAT, DFIFOEMP)) { |
2384 | int data_count = (DATA_LEN - CURRENT_SC->resid) - GETSTCNT(); | 2386 | int data_count = (DATA_LEN - scsi_get_resid(CURRENT_SC)) - |
2387 | GETSTCNT(); | ||
2385 | 2388 | ||
2386 | DPRINTK(debug_datao, DEBUG_LEAD "datao: %d bytes to resend (%d written, %d transferred)\n", | 2389 | DPRINTK(debug_datao, DEBUG_LEAD "datao: %d bytes to resend (%d written, %d transferred)\n", |
2387 | CMDINFO(CURRENT_SC), | 2390 | CMDINFO(CURRENT_SC), |
2388 | data_count, | 2391 | data_count, |
2389 | DATA_LEN-CURRENT_SC->resid, | 2392 | DATA_LEN - scsi_get_resid(CURRENT_SC), |
2390 | GETSTCNT()); | 2393 | GETSTCNT()); |
2391 | 2394 | ||
2392 | CURRENT_SC->resid += data_count; | 2395 | CMD_INC_RESID(CURRENT_SC, data_count); |
2393 | 2396 | ||
2394 | if(CURRENT_SC->use_sg) { | 2397 | data_count -= CURRENT_SC->SCp.ptr - |
2395 | data_count -= CURRENT_SC->SCp.ptr - SG_ADDRESS(CURRENT_SC->SCp.buffer); | 2398 | SG_ADDRESS(CURRENT_SC->SCp.buffer); |
2396 | while(data_count>0) { | 2399 | while(data_count>0) { |
2397 | CURRENT_SC->SCp.buffer--; | 2400 | CURRENT_SC->SCp.buffer--; |
2398 | CURRENT_SC->SCp.buffers_residual++; | 2401 | CURRENT_SC->SCp.buffers_residual++; |
2399 | data_count -= CURRENT_SC->SCp.buffer->length; | 2402 | data_count -= CURRENT_SC->SCp.buffer->length; |
2400 | } | ||
2401 | CURRENT_SC->SCp.ptr = SG_ADDRESS(CURRENT_SC->SCp.buffer) - data_count; | ||
2402 | CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length + data_count; | ||
2403 | } else { | ||
2404 | CURRENT_SC->SCp.ptr -= data_count; | ||
2405 | CURRENT_SC->SCp.this_residual += data_count; | ||
2406 | } | 2403 | } |
2404 | CURRENT_SC->SCp.ptr = SG_ADDRESS(CURRENT_SC->SCp.buffer) - | ||
2405 | data_count; | ||
2406 | CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length + | ||
2407 | data_count; | ||
2407 | } | 2408 | } |
2408 | 2409 | ||
2409 | DPRINTK(debug_datao, DEBUG_LEAD "datao_end: request_bufflen=%d; resid=%d; stcnt=%d\n", | 2410 | DPRINTK(debug_datao, DEBUG_LEAD "datao_end: request_bufflen=%d; resid=%d; stcnt=%d\n", |
2410 | CMDINFO(CURRENT_SC), | 2411 | CMDINFO(CURRENT_SC), |
2411 | CURRENT_SC->request_bufflen, | 2412 | scsi_bufflen(CURRENT_SC), |
2412 | CURRENT_SC->resid, | 2413 | scsi_get_resid(CURRENT_SC), |
2413 | GETSTCNT()); | 2414 | GETSTCNT()); |
2414 | 2415 | ||
2415 | SETPORT(SXFRCTL0, CH1|CLRCH1|CLRSTCNT); | 2416 | SETPORT(SXFRCTL0, CH1|CLRCH1|CLRSTCNT); |
@@ -2936,7 +2937,7 @@ static void show_command(Scsi_Cmnd *ptr) | |||
2936 | __scsi_print_command(ptr->cmnd); | 2937 | __scsi_print_command(ptr->cmnd); |
2937 | 2938 | ||
2938 | printk(KERN_DEBUG "); request_bufflen=%d; resid=%d; phase |", | 2939 | printk(KERN_DEBUG "); request_bufflen=%d; resid=%d; phase |", |
2939 | ptr->request_bufflen, ptr->resid); | 2940 | scsi_bufflen(ptr), scsi_get_resid(ptr)); |
2940 | 2941 | ||
2941 | if (ptr->SCp.phase & not_issued) | 2942 | if (ptr->SCp.phase & not_issued) |
2942 | printk("not issued|"); | 2943 | printk("not issued|"); |
@@ -3006,7 +3007,8 @@ static int get_command(char *pos, Scsi_Cmnd * ptr) | |||
3006 | SPRINTF("0x%02x ", ptr->cmnd[i]); | 3007 | SPRINTF("0x%02x ", ptr->cmnd[i]); |
3007 | 3008 | ||
3008 | SPRINTF("); resid=%d; residual=%d; buffers=%d; phase |", | 3009 | SPRINTF("); resid=%d; residual=%d; buffers=%d; phase |", |
3009 | ptr->resid, ptr->SCp.this_residual, ptr->SCp.buffers_residual); | 3010 | scsi_get_resid(ptr), ptr->SCp.this_residual, |
3011 | ptr->SCp.buffers_residual); | ||
3010 | 3012 | ||
3011 | if (ptr->SCp.phase & not_issued) | 3013 | if (ptr->SCp.phase & not_issued) |
3012 | SPRINTF("not issued|"); | 3014 | SPRINTF("not issued|"); |
@@ -3395,7 +3397,7 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start | |||
3395 | PDEBUG(debug_datai, "data in"); | 3397 | PDEBUG(debug_datai, "data in"); |
3396 | PDEBUG(debug_datao, "data out"); | 3398 | PDEBUG(debug_datao, "data out"); |
3397 | PDEBUG(debug_eh, "eh"); | 3399 | PDEBUG(debug_eh, "eh"); |
3398 | PDEBUG(debug_locks, "locks"); | 3400 | PDEBUG(debug_locking, "locks"); |
3399 | PDEBUG(debug_phases, "phases"); | 3401 | PDEBUG(debug_phases, "phases"); |
3400 | 3402 | ||
3401 | SPRINTF("\n"); | 3403 | SPRINTF("\n"); |
@@ -3474,6 +3476,12 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start | |||
3474 | return thislength < length ? thislength : length; | 3476 | return thislength < length ? thislength : length; |
3475 | } | 3477 | } |
3476 | 3478 | ||
3479 | static int aha152x_adjust_queue(struct scsi_device *device) | ||
3480 | { | ||
3481 | blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH); | ||
3482 | return 0; | ||
3483 | } | ||
3484 | |||
3477 | static struct scsi_host_template aha152x_driver_template = { | 3485 | static struct scsi_host_template aha152x_driver_template = { |
3478 | .module = THIS_MODULE, | 3486 | .module = THIS_MODULE, |
3479 | .name = AHA152X_REVID, | 3487 | .name = AHA152X_REVID, |
@@ -3490,6 +3498,7 @@ static struct scsi_host_template aha152x_driver_template = { | |||
3490 | .sg_tablesize = SG_ALL, | 3498 | .sg_tablesize = SG_ALL, |
3491 | .cmd_per_lun = 1, | 3499 | .cmd_per_lun = 1, |
3492 | .use_clustering = DISABLE_CLUSTERING, | 3500 | .use_clustering = DISABLE_CLUSTERING, |
3501 | .slave_alloc = aha152x_adjust_queue, | ||
3493 | }; | 3502 | }; |
3494 | 3503 | ||
3495 | #if !defined(PCMCIA) | 3504 | #if !defined(PCMCIA) |
diff --git a/drivers/scsi/aha152x.h b/drivers/scsi/aha152x.h index d2add24d02a3..ac4bfa438bf2 100644 --- a/drivers/scsi/aha152x.h +++ b/drivers/scsi/aha152x.h | |||
@@ -298,7 +298,7 @@ typedef union { | |||
298 | enum { | 298 | enum { |
299 | debug_procinfo = 0x0001, | 299 | debug_procinfo = 0x0001, |
300 | debug_queue = 0x0002, | 300 | debug_queue = 0x0002, |
301 | debug_locks = 0x0004, | 301 | debug_locking = 0x0004, |
302 | debug_intr = 0x0008, | 302 | debug_intr = 0x0008, |
303 | debug_selection = 0x0010, | 303 | debug_selection = 0x0010, |
304 | debug_msgo = 0x0020, | 304 | debug_msgo = 0x0020, |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index 75733b09f27a..f350b5e89e76 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c | |||
@@ -1701,7 +1701,16 @@ ahc_find_syncrate(struct ahc_softc *ahc, u_int *period, | |||
1701 | if ((*ppr_options & MSG_EXT_PPR_DT_REQ) == 0 | 1701 | if ((*ppr_options & MSG_EXT_PPR_DT_REQ) == 0 |
1702 | && maxsync < AHC_SYNCRATE_ULTRA2) | 1702 | && maxsync < AHC_SYNCRATE_ULTRA2) |
1703 | maxsync = AHC_SYNCRATE_ULTRA2; | 1703 | maxsync = AHC_SYNCRATE_ULTRA2; |
1704 | 1704 | ||
1705 | /* Now set the maxsync based on the card capabilities | ||
1706 | * DT is already done above */ | ||
1707 | if ((ahc->features & (AHC_DT | AHC_ULTRA2)) == 0 | ||
1708 | && maxsync < AHC_SYNCRATE_ULTRA) | ||
1709 | maxsync = AHC_SYNCRATE_ULTRA; | ||
1710 | if ((ahc->features & (AHC_DT | AHC_ULTRA2 | AHC_ULTRA)) == 0 | ||
1711 | && maxsync < AHC_SYNCRATE_FAST) | ||
1712 | maxsync = AHC_SYNCRATE_FAST; | ||
1713 | |||
1705 | for (syncrate = &ahc_syncrates[maxsync]; | 1714 | for (syncrate = &ahc_syncrates[maxsync]; |
1706 | syncrate->rate != NULL; | 1715 | syncrate->rate != NULL; |
1707 | syncrate++) { | 1716 | syncrate++) { |
@@ -1765,6 +1774,17 @@ ahc_find_period(struct ahc_softc *ahc, u_int scsirate, u_int maxsync) | |||
1765 | else | 1774 | else |
1766 | scsirate &= SXFR; | 1775 | scsirate &= SXFR; |
1767 | 1776 | ||
1777 | /* now set maxsync based on card capabilities */ | ||
1778 | if ((ahc->features & AHC_DT) == 0 && maxsync < AHC_SYNCRATE_ULTRA2) | ||
1779 | maxsync = AHC_SYNCRATE_ULTRA2; | ||
1780 | if ((ahc->features & (AHC_DT | AHC_ULTRA2)) == 0 | ||
1781 | && maxsync < AHC_SYNCRATE_ULTRA) | ||
1782 | maxsync = AHC_SYNCRATE_ULTRA; | ||
1783 | if ((ahc->features & (AHC_DT | AHC_ULTRA2 | AHC_ULTRA)) == 0 | ||
1784 | && maxsync < AHC_SYNCRATE_FAST) | ||
1785 | maxsync = AHC_SYNCRATE_FAST; | ||
1786 | |||
1787 | |||
1768 | syncrate = &ahc_syncrates[maxsync]; | 1788 | syncrate = &ahc_syncrates[maxsync]; |
1769 | while (syncrate->rate != NULL) { | 1789 | while (syncrate->rate != NULL) { |
1770 | 1790 | ||
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 2e2362d787ca..502732ac270d 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -173,20 +173,20 @@ static struct pci_device_id dptids[] = { | |||
173 | }; | 173 | }; |
174 | MODULE_DEVICE_TABLE(pci,dptids); | 174 | MODULE_DEVICE_TABLE(pci,dptids); |
175 | 175 | ||
176 | static int adpt_detect(struct scsi_host_template* sht) | 176 | static void adpt_exit(void); |
177 | |||
178 | static int adpt_detect(void) | ||
177 | { | 179 | { |
178 | struct pci_dev *pDev = NULL; | 180 | struct pci_dev *pDev = NULL; |
179 | adpt_hba* pHba; | 181 | adpt_hba* pHba; |
180 | 182 | ||
181 | adpt_init(); | ||
182 | |||
183 | PINFO("Detecting Adaptec I2O RAID controllers...\n"); | 183 | PINFO("Detecting Adaptec I2O RAID controllers...\n"); |
184 | 184 | ||
185 | /* search for all Adatpec I2O RAID cards */ | 185 | /* search for all Adatpec I2O RAID cards */ |
186 | while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) { | 186 | while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) { |
187 | if(pDev->device == PCI_DPT_DEVICE_ID || | 187 | if(pDev->device == PCI_DPT_DEVICE_ID || |
188 | pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){ | 188 | pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){ |
189 | if(adpt_install_hba(sht, pDev) ){ | 189 | if(adpt_install_hba(pDev) ){ |
190 | PERROR("Could not Init an I2O RAID device\n"); | 190 | PERROR("Could not Init an I2O RAID device\n"); |
191 | PERROR("Will not try to detect others.\n"); | 191 | PERROR("Will not try to detect others.\n"); |
192 | return hba_count-1; | 192 | return hba_count-1; |
@@ -248,34 +248,33 @@ rebuild_sys_tab: | |||
248 | } | 248 | } |
249 | 249 | ||
250 | for (pHba = hba_chain; pHba; pHba = pHba->next) { | 250 | for (pHba = hba_chain; pHba; pHba = pHba->next) { |
251 | if( adpt_scsi_register(pHba,sht) < 0){ | 251 | if (adpt_scsi_register(pHba) < 0) { |
252 | adpt_i2o_delete_hba(pHba); | 252 | adpt_i2o_delete_hba(pHba); |
253 | continue; | 253 | continue; |
254 | } | 254 | } |
255 | pHba->initialized = TRUE; | 255 | pHba->initialized = TRUE; |
256 | pHba->state &= ~DPTI_STATE_RESET; | 256 | pHba->state &= ~DPTI_STATE_RESET; |
257 | scsi_scan_host(pHba->host); | ||
257 | } | 258 | } |
258 | 259 | ||
259 | // Register our control device node | 260 | // Register our control device node |
260 | // nodes will need to be created in /dev to access this | 261 | // nodes will need to be created in /dev to access this |
261 | // the nodes can not be created from within the driver | 262 | // the nodes can not be created from within the driver |
262 | if (hba_count && register_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER, &adpt_fops)) { | 263 | if (hba_count && register_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER, &adpt_fops)) { |
263 | adpt_i2o_sys_shutdown(); | 264 | adpt_exit(); |
264 | return 0; | 265 | return 0; |
265 | } | 266 | } |
266 | return hba_count; | 267 | return hba_count; |
267 | } | 268 | } |
268 | 269 | ||
269 | 270 | ||
270 | /* | 271 | static int adpt_release(adpt_hba *pHba) |
271 | * scsi_unregister will be called AFTER we return. | ||
272 | */ | ||
273 | static int adpt_release(struct Scsi_Host *host) | ||
274 | { | 272 | { |
275 | adpt_hba* pHba = (adpt_hba*) host->hostdata[0]; | 273 | struct Scsi_Host *shost = pHba->host; |
274 | scsi_remove_host(shost); | ||
276 | // adpt_i2o_quiesce_hba(pHba); | 275 | // adpt_i2o_quiesce_hba(pHba); |
277 | adpt_i2o_delete_hba(pHba); | 276 | adpt_i2o_delete_hba(pHba); |
278 | scsi_unregister(host); | 277 | scsi_host_put(shost); |
279 | return 0; | 278 | return 0; |
280 | } | 279 | } |
281 | 280 | ||
@@ -882,7 +881,7 @@ static int adpt_reboot_event(struct notifier_block *n, ulong code, void *p) | |||
882 | #endif | 881 | #endif |
883 | 882 | ||
884 | 883 | ||
885 | static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) | 884 | static int adpt_install_hba(struct pci_dev* pDev) |
886 | { | 885 | { |
887 | 886 | ||
888 | adpt_hba* pHba = NULL; | 887 | adpt_hba* pHba = NULL; |
@@ -1031,8 +1030,6 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba) | |||
1031 | 1030 | ||
1032 | 1031 | ||
1033 | mutex_lock(&adpt_configuration_lock); | 1032 | mutex_lock(&adpt_configuration_lock); |
1034 | // scsi_unregister calls our adpt_release which | ||
1035 | // does a quiese | ||
1036 | if(pHba->host){ | 1033 | if(pHba->host){ |
1037 | free_irq(pHba->host->irq, pHba); | 1034 | free_irq(pHba->host->irq, pHba); |
1038 | } | 1035 | } |
@@ -1084,17 +1081,6 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba) | |||
1084 | } | 1081 | } |
1085 | 1082 | ||
1086 | 1083 | ||
1087 | static int adpt_init(void) | ||
1088 | { | ||
1089 | printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n"); | ||
1090 | #ifdef REBOOT_NOTIFIER | ||
1091 | register_reboot_notifier(&adpt_reboot_notifier); | ||
1092 | #endif | ||
1093 | |||
1094 | return 0; | ||
1095 | } | ||
1096 | |||
1097 | |||
1098 | static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun) | 1084 | static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun) |
1099 | { | 1085 | { |
1100 | struct adpt_device* d; | 1086 | struct adpt_device* d; |
@@ -2180,37 +2166,6 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d | |||
2180 | } | 2166 | } |
2181 | 2167 | ||
2182 | 2168 | ||
2183 | static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht) | ||
2184 | { | ||
2185 | struct Scsi_Host *host = NULL; | ||
2186 | |||
2187 | host = scsi_register(sht, sizeof(adpt_hba*)); | ||
2188 | if (host == NULL) { | ||
2189 | printk ("%s: scsi_register returned NULL\n",pHba->name); | ||
2190 | return -1; | ||
2191 | } | ||
2192 | host->hostdata[0] = (unsigned long)pHba; | ||
2193 | pHba->host = host; | ||
2194 | |||
2195 | host->irq = pHba->pDev->irq; | ||
2196 | /* no IO ports, so don't have to set host->io_port and | ||
2197 | * host->n_io_port | ||
2198 | */ | ||
2199 | host->io_port = 0; | ||
2200 | host->n_io_port = 0; | ||
2201 | /* see comments in scsi_host.h */ | ||
2202 | host->max_id = 16; | ||
2203 | host->max_lun = 256; | ||
2204 | host->max_channel = pHba->top_scsi_channel + 1; | ||
2205 | host->cmd_per_lun = 1; | ||
2206 | host->unique_id = (uint) pHba; | ||
2207 | host->sg_tablesize = pHba->sg_tablesize; | ||
2208 | host->can_queue = pHba->post_fifo_size; | ||
2209 | |||
2210 | return 0; | ||
2211 | } | ||
2212 | |||
2213 | |||
2214 | static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd) | 2169 | static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd) |
2215 | { | 2170 | { |
2216 | adpt_hba* pHba; | 2171 | adpt_hba* pHba; |
@@ -3329,12 +3284,10 @@ static static void adpt_delay(int millisec) | |||
3329 | 3284 | ||
3330 | #endif | 3285 | #endif |
3331 | 3286 | ||
3332 | static struct scsi_host_template driver_template = { | 3287 | static struct scsi_host_template adpt_template = { |
3333 | .name = "dpt_i2o", | 3288 | .name = "dpt_i2o", |
3334 | .proc_name = "dpt_i2o", | 3289 | .proc_name = "dpt_i2o", |
3335 | .proc_info = adpt_proc_info, | 3290 | .proc_info = adpt_proc_info, |
3336 | .detect = adpt_detect, | ||
3337 | .release = adpt_release, | ||
3338 | .info = adpt_info, | 3291 | .info = adpt_info, |
3339 | .queuecommand = adpt_queue, | 3292 | .queuecommand = adpt_queue, |
3340 | .eh_abort_handler = adpt_abort, | 3293 | .eh_abort_handler = adpt_abort, |
@@ -3348,5 +3301,62 @@ static struct scsi_host_template driver_template = { | |||
3348 | .cmd_per_lun = 1, | 3301 | .cmd_per_lun = 1, |
3349 | .use_clustering = ENABLE_CLUSTERING, | 3302 | .use_clustering = ENABLE_CLUSTERING, |
3350 | }; | 3303 | }; |
3351 | #include "scsi_module.c" | 3304 | |
3305 | static s32 adpt_scsi_register(adpt_hba* pHba) | ||
3306 | { | ||
3307 | struct Scsi_Host *host; | ||
3308 | |||
3309 | host = scsi_host_alloc(&adpt_template, sizeof(adpt_hba*)); | ||
3310 | if (host == NULL) { | ||
3311 | printk ("%s: scsi_host_alloc returned NULL\n",pHba->name); | ||
3312 | return -1; | ||
3313 | } | ||
3314 | host->hostdata[0] = (unsigned long)pHba; | ||
3315 | pHba->host = host; | ||
3316 | |||
3317 | host->irq = pHba->pDev->irq; | ||
3318 | /* no IO ports, so don't have to set host->io_port and | ||
3319 | * host->n_io_port | ||
3320 | */ | ||
3321 | host->io_port = 0; | ||
3322 | host->n_io_port = 0; | ||
3323 | /* see comments in scsi_host.h */ | ||
3324 | host->max_id = 16; | ||
3325 | host->max_lun = 256; | ||
3326 | host->max_channel = pHba->top_scsi_channel + 1; | ||
3327 | host->cmd_per_lun = 1; | ||
3328 | host->unique_id = (uint) pHba; | ||
3329 | host->sg_tablesize = pHba->sg_tablesize; | ||
3330 | host->can_queue = pHba->post_fifo_size; | ||
3331 | |||
3332 | if (scsi_add_host(host, &pHba->pDev->dev)) { | ||
3333 | scsi_host_put(host); | ||
3334 | return -1; | ||
3335 | } | ||
3336 | |||
3337 | return 0; | ||
3338 | } | ||
3339 | |||
3340 | static int __init adpt_init(void) | ||
3341 | { | ||
3342 | int count; | ||
3343 | |||
3344 | printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n"); | ||
3345 | #ifdef REBOOT_NOTIFIER | ||
3346 | register_reboot_notifier(&adpt_reboot_notifier); | ||
3347 | #endif | ||
3348 | |||
3349 | count = adpt_detect(); | ||
3350 | |||
3351 | return count > 0 ? 0 : -ENODEV; | ||
3352 | } | ||
3353 | |||
3354 | static void __exit adpt_exit(void) | ||
3355 | { | ||
3356 | while (hba_chain) | ||
3357 | adpt_release(hba_chain); | ||
3358 | } | ||
3359 | |||
3360 | module_init(adpt_init); | ||
3361 | module_exit(adpt_exit); | ||
3352 | MODULE_LICENSE("GPL"); | 3362 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h index fd79068c5869..0892f6c70319 100644 --- a/drivers/scsi/dpti.h +++ b/drivers/scsi/dpti.h | |||
@@ -28,11 +28,9 @@ | |||
28 | * SCSI interface function Prototypes | 28 | * SCSI interface function Prototypes |
29 | */ | 29 | */ |
30 | 30 | ||
31 | static int adpt_detect(struct scsi_host_template * sht); | ||
32 | static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *)); | 31 | static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *)); |
33 | static int adpt_abort(struct scsi_cmnd * cmd); | 32 | static int adpt_abort(struct scsi_cmnd * cmd); |
34 | static int adpt_reset(struct scsi_cmnd* cmd); | 33 | static int adpt_reset(struct scsi_cmnd* cmd); |
35 | static int adpt_release(struct Scsi_Host *host); | ||
36 | static int adpt_slave_configure(struct scsi_device *); | 34 | static int adpt_slave_configure(struct scsi_device *); |
37 | 35 | ||
38 | static const char *adpt_info(struct Scsi_Host *pSHost); | 36 | static const char *adpt_info(struct Scsi_Host *pSHost); |
@@ -49,8 +47,6 @@ static int adpt_device_reset(struct scsi_cmnd* cmd); | |||
49 | 47 | ||
50 | #define DPT_DRIVER_NAME "Adaptec I2O RAID" | 48 | #define DPT_DRIVER_NAME "Adaptec I2O RAID" |
51 | 49 | ||
52 | #ifndef HOSTS_C | ||
53 | |||
54 | #include "dpt/sys_info.h" | 50 | #include "dpt/sys_info.h" |
55 | #include <linux/wait.h> | 51 | #include <linux/wait.h> |
56 | #include "dpt/dpti_i2o.h" | 52 | #include "dpt/dpti_i2o.h" |
@@ -289,7 +285,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba); | |||
289 | static s32 adpt_i2o_hrt_get(adpt_hba* pHba); | 285 | static s32 adpt_i2o_hrt_get(adpt_hba* pHba); |
290 | static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice); | 286 | static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice); |
291 | static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd); | 287 | static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd); |
292 | static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht); | 288 | static s32 adpt_scsi_register(adpt_hba* pHba); |
293 | static s32 adpt_hba_reset(adpt_hba* pHba); | 289 | static s32 adpt_hba_reset(adpt_hba* pHba); |
294 | static s32 adpt_i2o_reset_hba(adpt_hba* pHba); | 290 | static s32 adpt_i2o_reset_hba(adpt_hba* pHba); |
295 | static s32 adpt_rescan(adpt_hba* pHba); | 291 | static s32 adpt_rescan(adpt_hba* pHba); |
@@ -299,7 +295,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba); | |||
299 | static void adpt_inquiry(adpt_hba* pHba); | 295 | static void adpt_inquiry(adpt_hba* pHba); |
300 | static void adpt_fail_posted_scbs(adpt_hba* pHba); | 296 | static void adpt_fail_posted_scbs(adpt_hba* pHba); |
301 | static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun); | 297 | static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun); |
302 | static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) ; | 298 | static int adpt_install_hba(struct pci_dev* pDev) ; |
303 | static int adpt_i2o_online_hba(adpt_hba* pHba); | 299 | static int adpt_i2o_online_hba(adpt_hba* pHba); |
304 | static void adpt_i2o_post_wait_complete(u32, int); | 300 | static void adpt_i2o_post_wait_complete(u32, int); |
305 | static int adpt_i2o_systab_send(adpt_hba* pHba); | 301 | static int adpt_i2o_systab_send(adpt_hba* pHba); |
@@ -343,5 +339,4 @@ static void adpt_i386_info(sysInfo_S* si); | |||
343 | #define FW_DEBUG_BLED_OFFSET 8 | 339 | #define FW_DEBUG_BLED_OFFSET 8 |
344 | 340 | ||
345 | #define FW_DEBUG_FLAGS_NO_HEADERS_B 0x01 | 341 | #define FW_DEBUG_FLAGS_NO_HEADERS_B 0x01 |
346 | #endif /* !HOSTS_C */ | ||
347 | #endif /* _DPT_H */ | 342 | #endif /* _DPT_H */ |
diff --git a/drivers/scsi/esp_scsi.h b/drivers/scsi/esp_scsi.h index 856e38b14861..d5576d54ce76 100644 --- a/drivers/scsi/esp_scsi.h +++ b/drivers/scsi/esp_scsi.h | |||
@@ -220,7 +220,7 @@ | |||
220 | #define ESP_BUSID_RESELID 0x10 | 220 | #define ESP_BUSID_RESELID 0x10 |
221 | #define ESP_BUSID_CTR32BIT 0x40 | 221 | #define ESP_BUSID_CTR32BIT 0x40 |
222 | 222 | ||
223 | #define ESP_BUS_TIMEOUT 275 /* In milli-seconds */ | 223 | #define ESP_BUS_TIMEOUT 250 /* In milli-seconds */ |
224 | #define ESP_TIMEO_CONST 8192 | 224 | #define ESP_TIMEO_CONST 8192 |
225 | #define ESP_NEG_DEFP(mhz, cfact) \ | 225 | #define ESP_NEG_DEFP(mhz, cfact) \ |
226 | ((ESP_BUS_TIMEOUT * ((mhz) / 1000)) / (8192 * (cfact))) | 226 | ((ESP_BUS_TIMEOUT * ((mhz) / 1000)) / (8192 * (cfact))) |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index d0b95ce0ba00..55e4d2dc2bbe 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -902,11 +902,6 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt, | |||
902 | return; | 902 | return; |
903 | /* GDT PCI controller found, resources are already in pdev */ | 903 | /* GDT PCI controller found, resources are already in pdev */ |
904 | pcistr[*cnt].pdev = pdev; | 904 | pcistr[*cnt].pdev = pdev; |
905 | pcistr[*cnt].vendor_id = vendor; | ||
906 | pcistr[*cnt].device_id = device; | ||
907 | pcistr[*cnt].subdevice_id = pdev->subsystem_device; | ||
908 | pcistr[*cnt].bus = pdev->bus->number; | ||
909 | pcistr[*cnt].device_fn = pdev->devfn; | ||
910 | pcistr[*cnt].irq = pdev->irq; | 905 | pcistr[*cnt].irq = pdev->irq; |
911 | base0 = pci_resource_flags(pdev, 0); | 906 | base0 = pci_resource_flags(pdev, 0); |
912 | base1 = pci_resource_flags(pdev, 1); | 907 | base1 = pci_resource_flags(pdev, 1); |
@@ -926,7 +921,8 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt, | |||
926 | pcistr[*cnt].io = pci_resource_start(pdev, 1); | 921 | pcistr[*cnt].io = pci_resource_start(pdev, 1); |
927 | } | 922 | } |
928 | TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n", | 923 | TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n", |
929 | pcistr[*cnt].bus, PCI_SLOT(pcistr[*cnt].device_fn), | 924 | pcistr[*cnt].pdev->bus->number, |
925 | PCI_SLOT(pcistr[*cnt].pdev->devfn), | ||
930 | pcistr[*cnt].irq, pcistr[*cnt].dpmem)); | 926 | pcistr[*cnt].irq, pcistr[*cnt].dpmem)); |
931 | (*cnt)++; | 927 | (*cnt)++; |
932 | } | 928 | } |
@@ -946,20 +942,20 @@ static void __init gdth_sort_pci(gdth_pci_str *pcistr, int cnt) | |||
946 | changed = FALSE; | 942 | changed = FALSE; |
947 | for (i = 0; i < cnt-1; ++i) { | 943 | for (i = 0; i < cnt-1; ++i) { |
948 | if (!reverse_scan) { | 944 | if (!reverse_scan) { |
949 | if ((pcistr[i].bus > pcistr[i+1].bus) || | 945 | if ((pcistr[i].pdev->bus->number > pcistr[i+1].pdev->bus->number) || |
950 | (pcistr[i].bus == pcistr[i+1].bus && | 946 | (pcistr[i].pdev->bus->number == pcistr[i+1].pdev->bus->number && |
951 | PCI_SLOT(pcistr[i].device_fn) > | 947 | PCI_SLOT(pcistr[i].pdev->devfn) > |
952 | PCI_SLOT(pcistr[i+1].device_fn))) { | 948 | PCI_SLOT(pcistr[i+1].pdev->devfn))) { |
953 | temp = pcistr[i]; | 949 | temp = pcistr[i]; |
954 | pcistr[i] = pcistr[i+1]; | 950 | pcistr[i] = pcistr[i+1]; |
955 | pcistr[i+1] = temp; | 951 | pcistr[i+1] = temp; |
956 | changed = TRUE; | 952 | changed = TRUE; |
957 | } | 953 | } |
958 | } else { | 954 | } else { |
959 | if ((pcistr[i].bus < pcistr[i+1].bus) || | 955 | if ((pcistr[i].pdev->bus->number < pcistr[i+1].pdev->bus->number) || |
960 | (pcistr[i].bus == pcistr[i+1].bus && | 956 | (pcistr[i].pdev->bus->number == pcistr[i+1].pdev->bus->number && |
961 | PCI_SLOT(pcistr[i].device_fn) < | 957 | PCI_SLOT(pcistr[i].pdev->devfn) < |
962 | PCI_SLOT(pcistr[i+1].device_fn))) { | 958 | PCI_SLOT(pcistr[i+1].pdev->devfn))) { |
963 | temp = pcistr[i]; | 959 | temp = pcistr[i]; |
964 | pcistr[i] = pcistr[i+1]; | 960 | pcistr[i] = pcistr[i+1]; |
965 | pcistr[i+1] = temp; | 961 | pcistr[i+1] = temp; |
@@ -1176,17 +1172,16 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha) | |||
1176 | 1172 | ||
1177 | TRACE(("gdth_init_pci()\n")); | 1173 | TRACE(("gdth_init_pci()\n")); |
1178 | 1174 | ||
1179 | if (pcistr->vendor_id == PCI_VENDOR_ID_INTEL) | 1175 | if (pcistr->pdev->vendor == PCI_VENDOR_ID_INTEL) |
1180 | ha->oem_id = OEM_ID_INTEL; | 1176 | ha->oem_id = OEM_ID_INTEL; |
1181 | else | 1177 | else |
1182 | ha->oem_id = OEM_ID_ICP; | 1178 | ha->oem_id = OEM_ID_ICP; |
1183 | ha->brd_phys = (pcistr->bus << 8) | (pcistr->device_fn & 0xf8); | 1179 | ha->brd_phys = (pcistr->pdev->bus->number << 8) | (pcistr->pdev->devfn & 0xf8); |
1184 | ha->stype = (ulong32)pcistr->device_id; | 1180 | ha->stype = (ulong32)pcistr->pdev->device; |
1185 | ha->subdevice_id = pcistr->subdevice_id; | ||
1186 | ha->irq = pcistr->irq; | 1181 | ha->irq = pcistr->irq; |
1187 | ha->pdev = pcistr->pdev; | 1182 | ha->pdev = pcistr->pdev; |
1188 | 1183 | ||
1189 | if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */ | 1184 | if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */ |
1190 | TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); | 1185 | TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); |
1191 | ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str)); | 1186 | ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str)); |
1192 | if (ha->brd == NULL) { | 1187 | if (ha->brd == NULL) { |
@@ -1293,7 +1288,7 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha) | |||
1293 | 1288 | ||
1294 | ha->dma64_support = 0; | 1289 | ha->dma64_support = 0; |
1295 | 1290 | ||
1296 | } else if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */ | 1291 | } else if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */ |
1297 | ha->plx = (gdt6c_plx_regs *)pcistr->io; | 1292 | ha->plx = (gdt6c_plx_regs *)pcistr->io; |
1298 | TRACE2(("init_pci_new() dpmem %lx irq %d\n", | 1293 | TRACE2(("init_pci_new() dpmem %lx irq %d\n", |
1299 | pcistr->dpmem,ha->irq)); | 1294 | pcistr->dpmem,ha->irq)); |
@@ -4601,7 +4596,8 @@ static int __init gdth_detect(Scsi_Host_Template *shtp) | |||
4601 | } | 4596 | } |
4602 | /* controller found and initialized */ | 4597 | /* controller found and initialized */ |
4603 | printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n", | 4598 | printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n", |
4604 | pcistr[ctr].bus,PCI_SLOT(pcistr[ctr].device_fn),ha->irq); | 4599 | pcistr[ctr].pdev->bus->number, |
4600 | PCI_SLOT(pcistr[ctr].pdev->devfn), ha->irq); | ||
4605 | 4601 | ||
4606 | if (request_irq(ha->irq, gdth_interrupt, | 4602 | if (request_irq(ha->irq, gdth_interrupt, |
4607 | IRQF_DISABLED|IRQF_SHARED, "gdth", ha)) | 4603 | IRQF_DISABLED|IRQF_SHARED, "gdth", ha)) |
@@ -4637,7 +4633,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp) | |||
4637 | #endif | 4633 | #endif |
4638 | ha->scratch_busy = FALSE; | 4634 | ha->scratch_busy = FALSE; |
4639 | ha->req_first = NULL; | 4635 | ha->req_first = NULL; |
4640 | ha->tid_cnt = pcistr[ctr].device_id >= 0x200 ? MAXID : MAX_HDRIVES; | 4636 | ha->tid_cnt = pcistr[ctr].pdev->device >= 0x200 ? MAXID : MAX_HDRIVES; |
4641 | if (max_ids > 0 && max_ids < ha->tid_cnt) | 4637 | if (max_ids > 0 && max_ids < ha->tid_cnt) |
4642 | ha->tid_cnt = max_ids; | 4638 | ha->tid_cnt = max_ids; |
4643 | for (i=0; i<GDTH_MAXCMDS; ++i) | 4639 | for (i=0; i<GDTH_MAXCMDS; ++i) |
@@ -4810,7 +4806,7 @@ static const char *gdth_ctr_name(int hanum) | |||
4810 | } else if (ha->type == GDT_ISA) { | 4806 | } else if (ha->type == GDT_ISA) { |
4811 | return("GDT2000/2020"); | 4807 | return("GDT2000/2020"); |
4812 | } else if (ha->type == GDT_PCI) { | 4808 | } else if (ha->type == GDT_PCI) { |
4813 | switch (ha->stype) { | 4809 | switch (ha->pdev->device) { |
4814 | case PCI_DEVICE_ID_VORTEX_GDT60x0: | 4810 | case PCI_DEVICE_ID_VORTEX_GDT60x0: |
4815 | return("GDT6000/6020/6050"); | 4811 | return("GDT6000/6020/6050"); |
4816 | case PCI_DEVICE_ID_VORTEX_GDT6000B: | 4812 | case PCI_DEVICE_ID_VORTEX_GDT6000B: |
@@ -5448,12 +5444,12 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, | |||
5448 | ctrt.type = | 5444 | ctrt.type = |
5449 | (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe); | 5445 | (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe); |
5450 | if (ha->stype >= 0x300) | 5446 | if (ha->stype >= 0x300) |
5451 | ctrt.ext_type = 0x6000 | ha->subdevice_id; | 5447 | ctrt.ext_type = 0x6000 | ha->pdev->subsystem_device; |
5452 | else | 5448 | else |
5453 | ctrt.ext_type = 0x6000 | ha->stype; | 5449 | ctrt.ext_type = 0x6000 | ha->stype; |
5454 | } | 5450 | } |
5455 | ctrt.device_id = ha->stype; | 5451 | ctrt.device_id = ha->pdev->device; |
5456 | ctrt.sub_device_id = ha->subdevice_id; | 5452 | ctrt.sub_device_id = ha->pdev->subsystem_device; |
5457 | } | 5453 | } |
5458 | ctrt.info = ha->brd_phys; | 5454 | ctrt.info = ha->brd_phys; |
5459 | ctrt.oem_id = ha->oem_id; | 5455 | ctrt.oem_id = ha->oem_id; |
diff --git a/drivers/scsi/gdth.h b/drivers/scsi/gdth.h index 8c29eafd51c5..37423300592e 100644 --- a/drivers/scsi/gdth.h +++ b/drivers/scsi/gdth.h | |||
@@ -845,11 +845,6 @@ typedef struct { | |||
845 | /* PCI resources */ | 845 | /* PCI resources */ |
846 | typedef struct { | 846 | typedef struct { |
847 | struct pci_dev *pdev; | 847 | struct pci_dev *pdev; |
848 | ushort vendor_id; /* vendor (ICP, Intel, ..) */ | ||
849 | ushort device_id; /* device ID (0,..,9) */ | ||
850 | ushort subdevice_id; /* sub device ID */ | ||
851 | unchar bus; /* PCI bus */ | ||
852 | unchar device_fn; /* PCI device/function no. */ | ||
853 | ulong dpmem; /* DPRAM address */ | 848 | ulong dpmem; /* DPRAM address */ |
854 | ulong io; /* IO address */ | 849 | ulong io; /* IO address */ |
855 | ulong io_mm; /* IO address mem. mapped */ | 850 | ulong io_mm; /* IO address mem. mapped */ |
@@ -862,7 +857,6 @@ typedef struct { | |||
862 | ushort oem_id; /* OEM */ | 857 | ushort oem_id; /* OEM */ |
863 | ushort type; /* controller class */ | 858 | ushort type; /* controller class */ |
864 | ulong32 stype; /* subtype (PCI: device ID) */ | 859 | ulong32 stype; /* subtype (PCI: device ID) */ |
865 | ushort subdevice_id; /* sub device ID (PCI) */ | ||
866 | ushort fw_vers; /* firmware version */ | 860 | ushort fw_vers; /* firmware version */ |
867 | ushort cache_feat; /* feat. cache serv. (s/g,..)*/ | 861 | ushort cache_feat; /* feat. cache serv. (s/g,..)*/ |
868 | ushort raw_feat; /* feat. raw service (s/g,..)*/ | 862 | ushort raw_feat; /* feat. raw service (s/g,..)*/ |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index bd8e7f323c69..96bc31266c98 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -220,7 +220,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev) | |||
220 | get_device(&shost->shost_gendev); | 220 | get_device(&shost->shost_gendev); |
221 | 221 | ||
222 | if (shost->transportt->host_size && | 222 | if (shost->transportt->host_size && |
223 | (shost->shost_data = kmalloc(shost->transportt->host_size, | 223 | (shost->shost_data = kzalloc(shost->transportt->host_size, |
224 | GFP_KERNEL)) == NULL) | 224 | GFP_KERNEL)) == NULL) |
225 | goto out_del_classdev; | 225 | goto out_del_classdev; |
226 | 226 | ||
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 5870866abc99..5ecc63d1b436 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -393,12 +393,6 @@ static int map_sg_data(struct scsi_cmnd *cmd, | |||
393 | return 1; | 393 | return 1; |
394 | else if (sg_mapped < 0) | 394 | else if (sg_mapped < 0) |
395 | return 0; | 395 | return 0; |
396 | else if (sg_mapped > SG_ALL) { | ||
397 | printk(KERN_ERR | ||
398 | "ibmvscsi: More than %d mapped sg entries, got %d\n", | ||
399 | SG_ALL, sg_mapped); | ||
400 | return 0; | ||
401 | } | ||
402 | 396 | ||
403 | set_srp_direction(cmd, srp_cmd, sg_mapped); | 397 | set_srp_direction(cmd, srp_cmd, sg_mapped); |
404 | 398 | ||
@@ -708,8 +702,7 @@ static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd, | |||
708 | struct srp_cmd *srp_cmd; | 702 | struct srp_cmd *srp_cmd; |
709 | struct srp_event_struct *evt_struct; | 703 | struct srp_event_struct *evt_struct; |
710 | struct srp_indirect_buf *indirect; | 704 | struct srp_indirect_buf *indirect; |
711 | struct ibmvscsi_host_data *hostdata = | 705 | struct ibmvscsi_host_data *hostdata = shost_priv(cmnd->device->host); |
712 | (struct ibmvscsi_host_data *)&cmnd->device->host->hostdata; | ||
713 | u16 lun = lun_from_dev(cmnd->device); | 706 | u16 lun = lun_from_dev(cmnd->device); |
714 | u8 out_fmt, in_fmt; | 707 | u8 out_fmt, in_fmt; |
715 | 708 | ||
@@ -960,8 +953,7 @@ static void sync_completion(struct srp_event_struct *evt_struct) | |||
960 | */ | 953 | */ |
961 | static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd) | 954 | static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd) |
962 | { | 955 | { |
963 | struct ibmvscsi_host_data *hostdata = | 956 | struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host); |
964 | (struct ibmvscsi_host_data *)cmd->device->host->hostdata; | ||
965 | struct srp_tsk_mgmt *tsk_mgmt; | 957 | struct srp_tsk_mgmt *tsk_mgmt; |
966 | struct srp_event_struct *evt; | 958 | struct srp_event_struct *evt; |
967 | struct srp_event_struct *tmp_evt, *found_evt; | 959 | struct srp_event_struct *tmp_evt, *found_evt; |
@@ -1084,9 +1076,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd) | |||
1084 | */ | 1076 | */ |
1085 | static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd) | 1077 | static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd) |
1086 | { | 1078 | { |
1087 | struct ibmvscsi_host_data *hostdata = | 1079 | struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host); |
1088 | (struct ibmvscsi_host_data *)cmd->device->host->hostdata; | ||
1089 | |||
1090 | struct srp_tsk_mgmt *tsk_mgmt; | 1080 | struct srp_tsk_mgmt *tsk_mgmt; |
1091 | struct srp_event_struct *evt; | 1081 | struct srp_event_struct *evt; |
1092 | struct srp_event_struct *tmp_evt, *pos; | 1082 | struct srp_event_struct *tmp_evt, *pos; |
@@ -1183,8 +1173,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd) | |||
1183 | static int ibmvscsi_eh_host_reset_handler(struct scsi_cmnd *cmd) | 1173 | static int ibmvscsi_eh_host_reset_handler(struct scsi_cmnd *cmd) |
1184 | { | 1174 | { |
1185 | unsigned long wait_switch = 0; | 1175 | unsigned long wait_switch = 0; |
1186 | struct ibmvscsi_host_data *hostdata = | 1176 | struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host); |
1187 | (struct ibmvscsi_host_data *)cmd->device->host->hostdata; | ||
1188 | 1177 | ||
1189 | dev_err(hostdata->dev, "Resetting connection due to error recovery\n"); | 1178 | dev_err(hostdata->dev, "Resetting connection due to error recovery\n"); |
1190 | 1179 | ||
@@ -1412,8 +1401,7 @@ static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth) | |||
1412 | static ssize_t show_host_srp_version(struct class_device *class_dev, char *buf) | 1401 | static ssize_t show_host_srp_version(struct class_device *class_dev, char *buf) |
1413 | { | 1402 | { |
1414 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1403 | struct Scsi_Host *shost = class_to_shost(class_dev); |
1415 | struct ibmvscsi_host_data *hostdata = | 1404 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1416 | (struct ibmvscsi_host_data *)shost->hostdata; | ||
1417 | int len; | 1405 | int len; |
1418 | 1406 | ||
1419 | len = snprintf(buf, PAGE_SIZE, "%s\n", | 1407 | len = snprintf(buf, PAGE_SIZE, "%s\n", |
@@ -1433,8 +1421,7 @@ static ssize_t show_host_partition_name(struct class_device *class_dev, | |||
1433 | char *buf) | 1421 | char *buf) |
1434 | { | 1422 | { |
1435 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1423 | struct Scsi_Host *shost = class_to_shost(class_dev); |
1436 | struct ibmvscsi_host_data *hostdata = | 1424 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1437 | (struct ibmvscsi_host_data *)shost->hostdata; | ||
1438 | int len; | 1425 | int len; |
1439 | 1426 | ||
1440 | len = snprintf(buf, PAGE_SIZE, "%s\n", | 1427 | len = snprintf(buf, PAGE_SIZE, "%s\n", |
@@ -1454,8 +1441,7 @@ static ssize_t show_host_partition_number(struct class_device *class_dev, | |||
1454 | char *buf) | 1441 | char *buf) |
1455 | { | 1442 | { |
1456 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1443 | struct Scsi_Host *shost = class_to_shost(class_dev); |
1457 | struct ibmvscsi_host_data *hostdata = | 1444 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1458 | (struct ibmvscsi_host_data *)shost->hostdata; | ||
1459 | int len; | 1445 | int len; |
1460 | 1446 | ||
1461 | len = snprintf(buf, PAGE_SIZE, "%d\n", | 1447 | len = snprintf(buf, PAGE_SIZE, "%d\n", |
@@ -1474,8 +1460,7 @@ static struct class_device_attribute ibmvscsi_host_partition_number = { | |||
1474 | static ssize_t show_host_mad_version(struct class_device *class_dev, char *buf) | 1460 | static ssize_t show_host_mad_version(struct class_device *class_dev, char *buf) |
1475 | { | 1461 | { |
1476 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1462 | struct Scsi_Host *shost = class_to_shost(class_dev); |
1477 | struct ibmvscsi_host_data *hostdata = | 1463 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1478 | (struct ibmvscsi_host_data *)shost->hostdata; | ||
1479 | int len; | 1464 | int len; |
1480 | 1465 | ||
1481 | len = snprintf(buf, PAGE_SIZE, "%d\n", | 1466 | len = snprintf(buf, PAGE_SIZE, "%d\n", |
@@ -1494,8 +1479,7 @@ static struct class_device_attribute ibmvscsi_host_mad_version = { | |||
1494 | static ssize_t show_host_os_type(struct class_device *class_dev, char *buf) | 1479 | static ssize_t show_host_os_type(struct class_device *class_dev, char *buf) |
1495 | { | 1480 | { |
1496 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1481 | struct Scsi_Host *shost = class_to_shost(class_dev); |
1497 | struct ibmvscsi_host_data *hostdata = | 1482 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1498 | (struct ibmvscsi_host_data *)shost->hostdata; | ||
1499 | int len; | 1483 | int len; |
1500 | 1484 | ||
1501 | len = snprintf(buf, PAGE_SIZE, "%d\n", hostdata->madapter_info.os_type); | 1485 | len = snprintf(buf, PAGE_SIZE, "%d\n", hostdata->madapter_info.os_type); |
@@ -1513,8 +1497,7 @@ static struct class_device_attribute ibmvscsi_host_os_type = { | |||
1513 | static ssize_t show_host_config(struct class_device *class_dev, char *buf) | 1497 | static ssize_t show_host_config(struct class_device *class_dev, char *buf) |
1514 | { | 1498 | { |
1515 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1499 | struct Scsi_Host *shost = class_to_shost(class_dev); |
1516 | struct ibmvscsi_host_data *hostdata = | 1500 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1517 | (struct ibmvscsi_host_data *)shost->hostdata; | ||
1518 | 1501 | ||
1519 | /* returns null-terminated host config data */ | 1502 | /* returns null-terminated host config data */ |
1520 | if (ibmvscsi_do_host_config(hostdata, buf, PAGE_SIZE) == 0) | 1503 | if (ibmvscsi_do_host_config(hostdata, buf, PAGE_SIZE) == 0) |
@@ -1582,7 +1565,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
1582 | goto scsi_host_alloc_failed; | 1565 | goto scsi_host_alloc_failed; |
1583 | } | 1566 | } |
1584 | 1567 | ||
1585 | hostdata = (struct ibmvscsi_host_data *)host->hostdata; | 1568 | hostdata = shost_priv(host); |
1586 | memset(hostdata, 0x00, sizeof(*hostdata)); | 1569 | memset(hostdata, 0x00, sizeof(*hostdata)); |
1587 | INIT_LIST_HEAD(&hostdata->sent); | 1570 | INIT_LIST_HEAD(&hostdata->sent); |
1588 | hostdata->host = host; | 1571 | hostdata->host = host; |
diff --git a/drivers/scsi/libsas/Kconfig b/drivers/scsi/libsas/Kconfig index 3a3c1ac9c6cd..c01a40d321d4 100644 --- a/drivers/scsi/libsas/Kconfig +++ b/drivers/scsi/libsas/Kconfig | |||
@@ -32,7 +32,8 @@ config SCSI_SAS_LIBSAS | |||
32 | 32 | ||
33 | config SCSI_SAS_ATA | 33 | config SCSI_SAS_ATA |
34 | bool "ATA support for libsas (requires libata)" | 34 | bool "ATA support for libsas (requires libata)" |
35 | depends on SCSI_SAS_LIBSAS && ATA | 35 | depends on SCSI_SAS_LIBSAS |
36 | depends on ATA = y || ATA = SCSI_SAS_LIBSAS | ||
36 | help | 37 | help |
37 | Builds in ATA support into libsas. Will necessitate | 38 | Builds in ATA support into libsas. Will necessitate |
38 | the loading of libata along with libsas. | 39 | the loading of libata along with libsas. |
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index f8f64d6485cd..ba3ecab9baf3 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -45,7 +45,7 @@ struct lpfc_sli2_slim; | |||
45 | #define LPFC_DISC_IOCB_BUFF_COUNT 20 | 45 | #define LPFC_DISC_IOCB_BUFF_COUNT 20 |
46 | 46 | ||
47 | #define LPFC_HB_MBOX_INTERVAL 5 /* Heart beat interval in seconds. */ | 47 | #define LPFC_HB_MBOX_INTERVAL 5 /* Heart beat interval in seconds. */ |
48 | #define LPFC_HB_MBOX_TIMEOUT 30 /* Heart beat timeout in seconds. */ | 48 | #define LPFC_HB_MBOX_TIMEOUT 30 /* Heart beat timeout in seconds. */ |
49 | 49 | ||
50 | /* Define macros for 64 bit support */ | 50 | /* Define macros for 64 bit support */ |
51 | #define putPaddrLow(addr) ((uint32_t) (0xffffffff & (u64)(addr))) | 51 | #define putPaddrLow(addr) ((uint32_t) (0xffffffff & (u64)(addr))) |
@@ -78,6 +78,7 @@ struct lpfc_dma_pool { | |||
78 | 78 | ||
79 | struct hbq_dmabuf { | 79 | struct hbq_dmabuf { |
80 | struct lpfc_dmabuf dbuf; | 80 | struct lpfc_dmabuf dbuf; |
81 | uint32_t size; | ||
81 | uint32_t tag; | 82 | uint32_t tag; |
82 | }; | 83 | }; |
83 | 84 | ||
@@ -329,13 +330,30 @@ struct lpfc_vport { | |||
329 | #define FC_LOADING 0x1 /* HBA in process of loading drvr */ | 330 | #define FC_LOADING 0x1 /* HBA in process of loading drvr */ |
330 | #define FC_UNLOADING 0x2 /* HBA in process of unloading drvr */ | 331 | #define FC_UNLOADING 0x2 /* HBA in process of unloading drvr */ |
331 | char *vname; /* Application assigned name */ | 332 | char *vname; /* Application assigned name */ |
333 | |||
334 | /* Vport Config Parameters */ | ||
335 | uint32_t cfg_scan_down; | ||
336 | uint32_t cfg_lun_queue_depth; | ||
337 | uint32_t cfg_nodev_tmo; | ||
338 | uint32_t cfg_devloss_tmo; | ||
339 | uint32_t cfg_restrict_login; | ||
340 | uint32_t cfg_peer_port_login; | ||
341 | uint32_t cfg_fcp_class; | ||
342 | uint32_t cfg_use_adisc; | ||
343 | uint32_t cfg_fdmi_on; | ||
344 | uint32_t cfg_discovery_threads; | ||
345 | uint32_t cfg_log_verbose; | ||
346 | uint32_t cfg_max_luns; | ||
347 | |||
348 | uint32_t dev_loss_tmo_changed; | ||
349 | |||
332 | struct fc_vport *fc_vport; | 350 | struct fc_vport *fc_vport; |
333 | 351 | ||
334 | #ifdef CONFIG_LPFC_DEBUG_FS | 352 | #ifdef CONFIG_LPFC_DEBUG_FS |
335 | struct dentry *debug_disc_trc; | 353 | struct dentry *debug_disc_trc; |
336 | struct dentry *debug_nodelist; | 354 | struct dentry *debug_nodelist; |
337 | struct dentry *vport_debugfs_root; | 355 | struct dentry *vport_debugfs_root; |
338 | struct lpfc_disc_trc *disc_trc; | 356 | struct lpfc_debugfs_trc *disc_trc; |
339 | atomic_t disc_trc_cnt; | 357 | atomic_t disc_trc_cnt; |
340 | #endif | 358 | #endif |
341 | }; | 359 | }; |
@@ -345,17 +363,25 @@ struct hbq_s { | |||
345 | uint32_t next_hbqPutIdx; /* Index to next HBQ slot to use */ | 363 | uint32_t next_hbqPutIdx; /* Index to next HBQ slot to use */ |
346 | uint32_t hbqPutIdx; /* HBQ slot to use */ | 364 | uint32_t hbqPutIdx; /* HBQ slot to use */ |
347 | uint32_t local_hbqGetIdx; /* Local copy of Get index from Port */ | 365 | uint32_t local_hbqGetIdx; /* Local copy of Get index from Port */ |
366 | void *hbq_virt; /* Virtual ptr to this hbq */ | ||
367 | struct list_head hbq_buffer_list; /* buffers assigned to this HBQ */ | ||
368 | /* Callback for HBQ buffer allocation */ | ||
369 | struct hbq_dmabuf *(*hbq_alloc_buffer) (struct lpfc_hba *); | ||
370 | /* Callback for HBQ buffer free */ | ||
371 | void (*hbq_free_buffer) (struct lpfc_hba *, | ||
372 | struct hbq_dmabuf *); | ||
348 | }; | 373 | }; |
349 | 374 | ||
350 | #define LPFC_MAX_HBQS 16 | 375 | #define LPFC_MAX_HBQS 4 |
351 | /* this matches the possition in the lpfc_hbq_defs array */ | 376 | /* this matches the position in the lpfc_hbq_defs array */ |
352 | #define LPFC_ELS_HBQ 0 | 377 | #define LPFC_ELS_HBQ 0 |
378 | #define LPFC_EXTRA_HBQ 1 | ||
353 | 379 | ||
354 | struct lpfc_hba { | 380 | struct lpfc_hba { |
355 | struct lpfc_sli sli; | 381 | struct lpfc_sli sli; |
356 | uint32_t sli_rev; /* SLI2 or SLI3 */ | 382 | uint32_t sli_rev; /* SLI2 or SLI3 */ |
357 | uint32_t sli3_options; /* Mask of enabled SLI3 options */ | 383 | uint32_t sli3_options; /* Mask of enabled SLI3 options */ |
358 | #define LPFC_SLI3_ENABLED 0x01 | 384 | #define LPFC_SLI3_ENABLED 0x01 |
359 | #define LPFC_SLI3_HBQ_ENABLED 0x02 | 385 | #define LPFC_SLI3_HBQ_ENABLED 0x02 |
360 | #define LPFC_SLI3_NPIV_ENABLED 0x04 | 386 | #define LPFC_SLI3_NPIV_ENABLED 0x04 |
361 | #define LPFC_SLI3_VPORT_TEARDOWN 0x08 | 387 | #define LPFC_SLI3_VPORT_TEARDOWN 0x08 |
@@ -364,7 +390,7 @@ struct lpfc_hba { | |||
364 | 390 | ||
365 | enum hba_state link_state; | 391 | enum hba_state link_state; |
366 | uint32_t link_flag; /* link state flags */ | 392 | uint32_t link_flag; /* link state flags */ |
367 | #define LS_LOOPBACK_MODE 0x1 /* NPort is in Loopback mode */ | 393 | #define LS_LOOPBACK_MODE 0x1 /* NPort is in Loopback mode */ |
368 | /* This flag is set while issuing */ | 394 | /* This flag is set while issuing */ |
369 | /* INIT_LINK mailbox command */ | 395 | /* INIT_LINK mailbox command */ |
370 | #define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */ | 396 | #define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */ |
@@ -413,28 +439,16 @@ struct lpfc_hba { | |||
413 | uint8_t wwpn[8]; | 439 | uint8_t wwpn[8]; |
414 | uint32_t RandomData[7]; | 440 | uint32_t RandomData[7]; |
415 | 441 | ||
416 | uint32_t cfg_log_verbose; | 442 | /* HBA Config Parameters */ |
417 | uint32_t cfg_lun_queue_depth; | ||
418 | uint32_t cfg_nodev_tmo; | ||
419 | uint32_t cfg_devloss_tmo; | ||
420 | uint32_t cfg_hba_queue_depth; | ||
421 | uint32_t cfg_peer_port_login; | ||
422 | uint32_t cfg_vport_restrict_login; | ||
423 | uint32_t cfg_npiv_enable; | ||
424 | uint32_t cfg_fcp_class; | ||
425 | uint32_t cfg_use_adisc; | ||
426 | uint32_t cfg_ack0; | 443 | uint32_t cfg_ack0; |
444 | uint32_t cfg_enable_npiv; | ||
427 | uint32_t cfg_topology; | 445 | uint32_t cfg_topology; |
428 | uint32_t cfg_scan_down; | ||
429 | uint32_t cfg_link_speed; | 446 | uint32_t cfg_link_speed; |
430 | uint32_t cfg_cr_delay; | 447 | uint32_t cfg_cr_delay; |
431 | uint32_t cfg_cr_count; | 448 | uint32_t cfg_cr_count; |
432 | uint32_t cfg_multi_ring_support; | 449 | uint32_t cfg_multi_ring_support; |
433 | uint32_t cfg_multi_ring_rctl; | 450 | uint32_t cfg_multi_ring_rctl; |
434 | uint32_t cfg_multi_ring_type; | 451 | uint32_t cfg_multi_ring_type; |
435 | uint32_t cfg_fdmi_on; | ||
436 | uint32_t cfg_discovery_threads; | ||
437 | uint32_t cfg_max_luns; | ||
438 | uint32_t cfg_poll; | 452 | uint32_t cfg_poll; |
439 | uint32_t cfg_poll_tmo; | 453 | uint32_t cfg_poll_tmo; |
440 | uint32_t cfg_use_msi; | 454 | uint32_t cfg_use_msi; |
@@ -442,8 +456,8 @@ struct lpfc_hba { | |||
442 | uint32_t cfg_sg_dma_buf_size; | 456 | uint32_t cfg_sg_dma_buf_size; |
443 | uint64_t cfg_soft_wwnn; | 457 | uint64_t cfg_soft_wwnn; |
444 | uint64_t cfg_soft_wwpn; | 458 | uint64_t cfg_soft_wwpn; |
459 | uint32_t cfg_hba_queue_depth; | ||
445 | 460 | ||
446 | uint32_t dev_loss_tmo_changed; | ||
447 | 461 | ||
448 | lpfc_vpd_t vpd; /* vital product data */ | 462 | lpfc_vpd_t vpd; /* vital product data */ |
449 | 463 | ||
@@ -457,7 +471,6 @@ struct lpfc_hba { | |||
457 | wait_queue_head_t *work_wait; | 471 | wait_queue_head_t *work_wait; |
458 | struct task_struct *worker_thread; | 472 | struct task_struct *worker_thread; |
459 | 473 | ||
460 | struct list_head hbq_buffer_list; | ||
461 | uint32_t hbq_count; /* Count of configured HBQs */ | 474 | uint32_t hbq_count; /* Count of configured HBQs */ |
462 | struct hbq_s hbqs[LPFC_MAX_HBQS]; /* local copy of hbq indicies */ | 475 | struct hbq_s hbqs[LPFC_MAX_HBQS]; /* local copy of hbq indicies */ |
463 | 476 | ||
@@ -526,12 +539,14 @@ struct lpfc_hba { | |||
526 | mempool_t *nlp_mem_pool; | 539 | mempool_t *nlp_mem_pool; |
527 | 540 | ||
528 | struct fc_host_statistics link_stats; | 541 | struct fc_host_statistics link_stats; |
542 | uint8_t using_msi; | ||
529 | 543 | ||
530 | struct list_head port_list; | 544 | struct list_head port_list; |
531 | struct lpfc_vport *pport; /* physical lpfc_vport pointer */ | 545 | struct lpfc_vport *pport; /* physical lpfc_vport pointer */ |
532 | uint16_t max_vpi; /* Maximum virtual nports */ | 546 | uint16_t max_vpi; /* Maximum virtual nports */ |
533 | #define LPFC_MAX_VPI 100 /* Max number of VPorts supported */ | 547 | #define LPFC_MAX_VPI 100 /* Max number of VPI supported */ |
534 | unsigned long *vpi_bmask; /* vpi allocation table */ | 548 | #define LPFC_MAX_VPORTS (LPFC_MAX_VPI+1)/* Max number of VPorts supported */ |
549 | unsigned long *vpi_bmask; /* vpi allocation table */ | ||
535 | 550 | ||
536 | /* Data structure used by fabric iocb scheduler */ | 551 | /* Data structure used by fabric iocb scheduler */ |
537 | struct list_head fabric_iocb_list; | 552 | struct list_head fabric_iocb_list; |
@@ -547,6 +562,11 @@ struct lpfc_hba { | |||
547 | #ifdef CONFIG_LPFC_DEBUG_FS | 562 | #ifdef CONFIG_LPFC_DEBUG_FS |
548 | struct dentry *hba_debugfs_root; | 563 | struct dentry *hba_debugfs_root; |
549 | atomic_t debugfs_vport_count; | 564 | atomic_t debugfs_vport_count; |
565 | struct dentry *debug_hbqinfo; | ||
566 | struct dentry *debug_dumpslim; | ||
567 | struct dentry *debug_slow_ring_trc; | ||
568 | struct lpfc_debugfs_trc *slow_ring_trc; | ||
569 | atomic_t slow_ring_trc_cnt; | ||
550 | #endif | 570 | #endif |
551 | 571 | ||
552 | /* Fields used for heart beat. */ | 572 | /* Fields used for heart beat. */ |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 860a52c090f4..80a11218b9bb 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -68,12 +68,6 @@ lpfc_drvr_version_show(struct class_device *cdev, char *buf) | |||
68 | } | 68 | } |
69 | 69 | ||
70 | static ssize_t | 70 | static ssize_t |
71 | management_version_show(struct class_device *cdev, char *buf) | ||
72 | { | ||
73 | return snprintf(buf, PAGE_SIZE, DFC_API_VERSION "\n"); | ||
74 | } | ||
75 | |||
76 | static ssize_t | ||
77 | lpfc_info_show(struct class_device *cdev, char *buf) | 71 | lpfc_info_show(struct class_device *cdev, char *buf) |
78 | { | 72 | { |
79 | struct Scsi_Host *host = class_to_shost(cdev); | 73 | struct Scsi_Host *host = class_to_shost(cdev); |
@@ -319,9 +313,8 @@ lpfc_do_offline(struct lpfc_hba *phba, uint32_t type) | |||
319 | if (cnt++ > 3000) { | 313 | if (cnt++ > 3000) { |
320 | lpfc_printf_log(phba, | 314 | lpfc_printf_log(phba, |
321 | KERN_WARNING, LOG_INIT, | 315 | KERN_WARNING, LOG_INIT, |
322 | "%d:0466 Outstanding IO when " | 316 | "0466 Outstanding IO when " |
323 | "bringing Adapter offline\n", | 317 | "bringing Adapter offline\n"); |
324 | phba->brd_no); | ||
325 | break; | 318 | break; |
326 | } | 319 | } |
327 | } | 320 | } |
@@ -437,7 +430,7 @@ lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count) | |||
437 | return -EIO; | 430 | return -EIO; |
438 | } | 431 | } |
439 | 432 | ||
440 | int | 433 | static int |
441 | lpfc_get_hba_info(struct lpfc_hba *phba, | 434 | lpfc_get_hba_info(struct lpfc_hba *phba, |
442 | uint32_t *mxri, uint32_t *axri, | 435 | uint32_t *mxri, uint32_t *axri, |
443 | uint32_t *mrpi, uint32_t *arpi, | 436 | uint32_t *mrpi, uint32_t *arpi, |
@@ -694,9 +687,8 @@ lpfc_##attr##_init(struct lpfc_hba *phba, int val) \ | |||
694 | return 0;\ | 687 | return 0;\ |
695 | }\ | 688 | }\ |
696 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ | 689 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ |
697 | "%d:0449 lpfc_"#attr" attribute cannot be set to %d, "\ | 690 | "0449 lpfc_"#attr" attribute cannot be set to %d, "\ |
698 | "allowed range is ["#minval", "#maxval"]\n", \ | 691 | "allowed range is ["#minval", "#maxval"]\n", val); \ |
699 | phba->brd_no, val); \ | ||
700 | phba->cfg_##attr = default;\ | 692 | phba->cfg_##attr = default;\ |
701 | return -EINVAL;\ | 693 | return -EINVAL;\ |
702 | } | 694 | } |
@@ -710,9 +702,8 @@ lpfc_##attr##_set(struct lpfc_hba *phba, int val) \ | |||
710 | return 0;\ | 702 | return 0;\ |
711 | }\ | 703 | }\ |
712 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ | 704 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ |
713 | "%d:0450 lpfc_"#attr" attribute cannot be set to %d, "\ | 705 | "0450 lpfc_"#attr" attribute cannot be set to %d, "\ |
714 | "allowed range is ["#minval", "#maxval"]\n", \ | 706 | "allowed range is ["#minval", "#maxval"]\n", val); \ |
715 | phba->brd_no, val); \ | ||
716 | return -EINVAL;\ | 707 | return -EINVAL;\ |
717 | } | 708 | } |
718 | 709 | ||
@@ -734,6 +725,75 @@ lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ | |||
734 | return -EINVAL;\ | 725 | return -EINVAL;\ |
735 | } | 726 | } |
736 | 727 | ||
728 | #define lpfc_vport_param_show(attr) \ | ||
729 | static ssize_t \ | ||
730 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | ||
731 | { \ | ||
732 | struct Scsi_Host *shost = class_to_shost(cdev);\ | ||
733 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | ||
734 | int val = 0;\ | ||
735 | val = vport->cfg_##attr;\ | ||
736 | return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\ | ||
737 | } | ||
738 | |||
739 | #define lpfc_vport_param_hex_show(attr) \ | ||
740 | static ssize_t \ | ||
741 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | ||
742 | { \ | ||
743 | struct Scsi_Host *shost = class_to_shost(cdev);\ | ||
744 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | ||
745 | int val = 0;\ | ||
746 | val = vport->cfg_##attr;\ | ||
747 | return snprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\ | ||
748 | } | ||
749 | |||
750 | #define lpfc_vport_param_init(attr, default, minval, maxval) \ | ||
751 | static int \ | ||
752 | lpfc_##attr##_init(struct lpfc_vport *vport, int val) \ | ||
753 | { \ | ||
754 | if (val >= minval && val <= maxval) {\ | ||
755 | vport->cfg_##attr = val;\ | ||
756 | return 0;\ | ||
757 | }\ | ||
758 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \ | ||
759 | "0449 lpfc_"#attr" attribute cannot be set to %d, "\ | ||
760 | "allowed range is ["#minval", "#maxval"]\n", val); \ | ||
761 | vport->cfg_##attr = default;\ | ||
762 | return -EINVAL;\ | ||
763 | } | ||
764 | |||
765 | #define lpfc_vport_param_set(attr, default, minval, maxval) \ | ||
766 | static int \ | ||
767 | lpfc_##attr##_set(struct lpfc_vport *vport, int val) \ | ||
768 | { \ | ||
769 | if (val >= minval && val <= maxval) {\ | ||
770 | vport->cfg_##attr = val;\ | ||
771 | return 0;\ | ||
772 | }\ | ||
773 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \ | ||
774 | "0450 lpfc_"#attr" attribute cannot be set to %d, "\ | ||
775 | "allowed range is ["#minval", "#maxval"]\n", val); \ | ||
776 | return -EINVAL;\ | ||
777 | } | ||
778 | |||
779 | #define lpfc_vport_param_store(attr) \ | ||
780 | static ssize_t \ | ||
781 | lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ | ||
782 | { \ | ||
783 | struct Scsi_Host *shost = class_to_shost(cdev);\ | ||
784 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | ||
785 | int val=0;\ | ||
786 | if (!isdigit(buf[0]))\ | ||
787 | return -EINVAL;\ | ||
788 | if (sscanf(buf, "%i", &val) != 1)\ | ||
789 | return -EINVAL;\ | ||
790 | if (lpfc_##attr##_set(vport, val) == 0) \ | ||
791 | return strlen(buf);\ | ||
792 | else \ | ||
793 | return -EINVAL;\ | ||
794 | } | ||
795 | |||
796 | |||
737 | #define LPFC_ATTR(name, defval, minval, maxval, desc) \ | 797 | #define LPFC_ATTR(name, defval, minval, maxval, desc) \ |
738 | static int lpfc_##name = defval;\ | 798 | static int lpfc_##name = defval;\ |
739 | module_param(lpfc_##name, int, 0);\ | 799 | module_param(lpfc_##name, int, 0);\ |
@@ -778,6 +838,50 @@ lpfc_param_store(name)\ | |||
778 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ | 838 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ |
779 | lpfc_##name##_show, lpfc_##name##_store) | 839 | lpfc_##name##_show, lpfc_##name##_store) |
780 | 840 | ||
841 | #define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \ | ||
842 | static int lpfc_##name = defval;\ | ||
843 | module_param(lpfc_##name, int, 0);\ | ||
844 | MODULE_PARM_DESC(lpfc_##name, desc);\ | ||
845 | lpfc_vport_param_init(name, defval, minval, maxval) | ||
846 | |||
847 | #define LPFC_VPORT_ATTR_R(name, defval, minval, maxval, desc) \ | ||
848 | static int lpfc_##name = defval;\ | ||
849 | module_param(lpfc_##name, int, 0);\ | ||
850 | MODULE_PARM_DESC(lpfc_##name, desc);\ | ||
851 | lpfc_vport_param_show(name)\ | ||
852 | lpfc_vport_param_init(name, defval, minval, maxval)\ | ||
853 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) | ||
854 | |||
855 | #define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \ | ||
856 | static int lpfc_##name = defval;\ | ||
857 | module_param(lpfc_##name, int, 0);\ | ||
858 | MODULE_PARM_DESC(lpfc_##name, desc);\ | ||
859 | lpfc_vport_param_show(name)\ | ||
860 | lpfc_vport_param_init(name, defval, minval, maxval)\ | ||
861 | lpfc_vport_param_set(name, defval, minval, maxval)\ | ||
862 | lpfc_vport_param_store(name)\ | ||
863 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ | ||
864 | lpfc_##name##_show, lpfc_##name##_store) | ||
865 | |||
866 | #define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \ | ||
867 | static int lpfc_##name = defval;\ | ||
868 | module_param(lpfc_##name, int, 0);\ | ||
869 | MODULE_PARM_DESC(lpfc_##name, desc);\ | ||
870 | lpfc_vport_param_hex_show(name)\ | ||
871 | lpfc_vport_param_init(name, defval, minval, maxval)\ | ||
872 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) | ||
873 | |||
874 | #define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ | ||
875 | static int lpfc_##name = defval;\ | ||
876 | module_param(lpfc_##name, int, 0);\ | ||
877 | MODULE_PARM_DESC(lpfc_##name, desc);\ | ||
878 | lpfc_vport_param_hex_show(name)\ | ||
879 | lpfc_vport_param_init(name, defval, minval, maxval)\ | ||
880 | lpfc_vport_param_set(name, defval, minval, maxval)\ | ||
881 | lpfc_vport_param_store(name)\ | ||
882 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ | ||
883 | lpfc_##name##_show, lpfc_##name##_store) | ||
884 | |||
781 | static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); | 885 | static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); |
782 | static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); | 886 | static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); |
783 | static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); | 887 | static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); |
@@ -794,8 +898,6 @@ static CLASS_DEVICE_ATTR(num_discovered_ports, S_IRUGO, | |||
794 | static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); | 898 | static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); |
795 | static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, | 899 | static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, |
796 | NULL); | 900 | NULL); |
797 | static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show, | ||
798 | NULL); | ||
799 | static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, | 901 | static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, |
800 | lpfc_board_mode_show, lpfc_board_mode_store); | 902 | lpfc_board_mode_show, lpfc_board_mode_store); |
801 | static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); | 903 | static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); |
@@ -908,17 +1010,15 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count) | |||
908 | stat1 = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); | 1010 | stat1 = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); |
909 | if (stat1) | 1011 | if (stat1) |
910 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1012 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
911 | "%d:0463 lpfc_soft_wwpn attribute set failed to reinit " | 1013 | "0463 lpfc_soft_wwpn attribute set failed to " |
912 | "adapter - %d\n", phba->brd_no, stat1); | 1014 | "reinit adapter - %d\n", stat1); |
913 | |||
914 | init_completion(&online_compl); | 1015 | init_completion(&online_compl); |
915 | lpfc_workq_post_event(phba, &stat2, &online_compl, LPFC_EVT_ONLINE); | 1016 | lpfc_workq_post_event(phba, &stat2, &online_compl, LPFC_EVT_ONLINE); |
916 | wait_for_completion(&online_compl); | 1017 | wait_for_completion(&online_compl); |
917 | if (stat2) | 1018 | if (stat2) |
918 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1019 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
919 | "%d:0464 lpfc_soft_wwpn attribute set failed to reinit " | 1020 | "0464 lpfc_soft_wwpn attribute set failed to " |
920 | "adapter - %d\n", phba->brd_no, stat2); | 1021 | "reinit adapter - %d\n", stat2); |
921 | |||
922 | return (stat1 || stat2) ? -EIO : count; | 1022 | return (stat1 || stat2) ? -EIO : count; |
923 | } | 1023 | } |
924 | static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ | 1024 | static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ |
@@ -927,8 +1027,8 @@ static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ | |||
927 | static ssize_t | 1027 | static ssize_t |
928 | lpfc_soft_wwnn_show(struct class_device *cdev, char *buf) | 1028 | lpfc_soft_wwnn_show(struct class_device *cdev, char *buf) |
929 | { | 1029 | { |
930 | struct Scsi_Host *host = class_to_shost(cdev); | 1030 | struct Scsi_Host *shost = class_to_shost(cdev); |
931 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; | 1031 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
932 | return snprintf(buf, PAGE_SIZE, "0x%llx\n", | 1032 | return snprintf(buf, PAGE_SIZE, "0x%llx\n", |
933 | (unsigned long long)phba->cfg_soft_wwnn); | 1033 | (unsigned long long)phba->cfg_soft_wwnn); |
934 | } | 1034 | } |
@@ -937,8 +1037,8 @@ lpfc_soft_wwnn_show(struct class_device *cdev, char *buf) | |||
937 | static ssize_t | 1037 | static ssize_t |
938 | lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count) | 1038 | lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count) |
939 | { | 1039 | { |
940 | struct Scsi_Host *host = class_to_shost(cdev); | 1040 | struct Scsi_Host *shost = class_to_shost(cdev); |
941 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; | 1041 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
942 | unsigned int i, j, cnt=count; | 1042 | unsigned int i, j, cnt=count; |
943 | u8 wwnn[8]; | 1043 | u8 wwnn[8]; |
944 | 1044 | ||
@@ -1002,7 +1102,7 @@ MODULE_PARM_DESC(lpfc_sli_mode, "SLI mode selector:" | |||
1002 | " 2 - select SLI-2 even on SLI-3 capable HBAs," | 1102 | " 2 - select SLI-2 even on SLI-3 capable HBAs," |
1003 | " 3 - select SLI-3"); | 1103 | " 3 - select SLI-3"); |
1004 | 1104 | ||
1005 | LPFC_ATTR_R(npiv_enable, 0, 0, 1, "Enable NPIV functionality"); | 1105 | LPFC_ATTR_R(enable_npiv, 0, 0, 1, "Enable NPIV functionality"); |
1006 | 1106 | ||
1007 | /* | 1107 | /* |
1008 | # lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear | 1108 | # lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear |
@@ -1019,90 +1119,75 @@ lpfc_nodev_tmo_show(struct class_device *cdev, char *buf) | |||
1019 | { | 1119 | { |
1020 | struct Scsi_Host *shost = class_to_shost(cdev); | 1120 | struct Scsi_Host *shost = class_to_shost(cdev); |
1021 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 1121 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1022 | struct lpfc_hba *phba = vport->phba; | ||
1023 | int val = 0; | 1122 | int val = 0; |
1024 | val = phba->cfg_devloss_tmo; | 1123 | val = vport->cfg_devloss_tmo; |
1025 | return snprintf(buf, PAGE_SIZE, "%d\n", | 1124 | return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); |
1026 | phba->cfg_devloss_tmo); | ||
1027 | } | 1125 | } |
1028 | 1126 | ||
1029 | static int | 1127 | static int |
1030 | lpfc_nodev_tmo_init(struct lpfc_hba *phba, int val) | 1128 | lpfc_nodev_tmo_init(struct lpfc_vport *vport, int val) |
1031 | { | 1129 | { |
1032 | static int warned; | 1130 | if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { |
1033 | if (phba->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { | 1131 | vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; |
1034 | phba->cfg_nodev_tmo = phba->cfg_devloss_tmo; | 1132 | if (val != LPFC_DEF_DEVLOSS_TMO) |
1035 | if (!warned && val != LPFC_DEF_DEVLOSS_TMO) { | 1133 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
1036 | warned = 1; | 1134 | "0402 Ignoring nodev_tmo module " |
1037 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1135 | "parameter because devloss_tmo is " |
1038 | "%d:0402 Ignoring nodev_tmo module " | 1136 | "set.\n"); |
1039 | "parameter because devloss_tmo is" | ||
1040 | " set.\n", | ||
1041 | phba->brd_no); | ||
1042 | } | ||
1043 | return 0; | 1137 | return 0; |
1044 | } | 1138 | } |
1045 | 1139 | ||
1046 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { | 1140 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { |
1047 | phba->cfg_nodev_tmo = val; | 1141 | vport->cfg_nodev_tmo = val; |
1048 | phba->cfg_devloss_tmo = val; | 1142 | vport->cfg_devloss_tmo = val; |
1049 | return 0; | 1143 | return 0; |
1050 | } | 1144 | } |
1051 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1145 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
1052 | "%d:0400 lpfc_nodev_tmo attribute cannot be set to %d, " | 1146 | "0400 lpfc_nodev_tmo attribute cannot be set to" |
1053 | "allowed range is [%d, %d]\n", | 1147 | " %d, allowed range is [%d, %d]\n", |
1054 | phba->brd_no, val, | 1148 | val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); |
1055 | LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); | 1149 | vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; |
1056 | phba->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; | ||
1057 | return -EINVAL; | 1150 | return -EINVAL; |
1058 | } | 1151 | } |
1059 | 1152 | ||
1060 | static void | 1153 | static void |
1061 | lpfc_update_rport_devloss_tmo(struct lpfc_hba *phba) | 1154 | lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) |
1062 | { | 1155 | { |
1063 | struct lpfc_vport *vport; | ||
1064 | struct Scsi_Host *shost; | 1156 | struct Scsi_Host *shost; |
1065 | struct lpfc_nodelist *ndlp; | 1157 | struct lpfc_nodelist *ndlp; |
1066 | 1158 | ||
1067 | list_for_each_entry(vport, &phba->port_list, listentry) { | 1159 | shost = lpfc_shost_from_vport(vport); |
1068 | shost = lpfc_shost_from_vport(vport); | 1160 | spin_lock_irq(shost->host_lock); |
1069 | spin_lock_irq(shost->host_lock); | 1161 | list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) |
1070 | list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) | 1162 | if (ndlp->rport) |
1071 | if (ndlp->rport) | 1163 | ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; |
1072 | ndlp->rport->dev_loss_tmo = | 1164 | spin_unlock_irq(shost->host_lock); |
1073 | phba->cfg_devloss_tmo; | ||
1074 | spin_unlock_irq(shost->host_lock); | ||
1075 | } | ||
1076 | } | 1165 | } |
1077 | 1166 | ||
1078 | static int | 1167 | static int |
1079 | lpfc_nodev_tmo_set(struct lpfc_hba *phba, int val) | 1168 | lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val) |
1080 | { | 1169 | { |
1081 | if (phba->dev_loss_tmo_changed || | 1170 | if (vport->dev_loss_tmo_changed || |
1082 | (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) { | 1171 | (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) { |
1083 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1172 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
1084 | "%d:0401 Ignoring change to nodev_tmo " | 1173 | "0401 Ignoring change to nodev_tmo " |
1085 | "because devloss_tmo is set.\n", | 1174 | "because devloss_tmo is set.\n"); |
1086 | phba->brd_no); | ||
1087 | return 0; | 1175 | return 0; |
1088 | } | 1176 | } |
1089 | |||
1090 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { | 1177 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { |
1091 | phba->cfg_nodev_tmo = val; | 1178 | vport->cfg_nodev_tmo = val; |
1092 | phba->cfg_devloss_tmo = val; | 1179 | vport->cfg_devloss_tmo = val; |
1093 | lpfc_update_rport_devloss_tmo(phba); | 1180 | lpfc_update_rport_devloss_tmo(vport); |
1094 | return 0; | 1181 | return 0; |
1095 | } | 1182 | } |
1096 | 1183 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | |
1097 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1184 | "0403 lpfc_nodev_tmo attribute cannot be set to" |
1098 | "%d:0403 lpfc_nodev_tmo attribute cannot be set to %d, " | 1185 | "%d, allowed range is [%d, %d]\n", |
1099 | "allowed range is [%d, %d]\n", | 1186 | val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); |
1100 | phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO, | ||
1101 | LPFC_MAX_DEVLOSS_TMO); | ||
1102 | return -EINVAL; | 1187 | return -EINVAL; |
1103 | } | 1188 | } |
1104 | 1189 | ||
1105 | lpfc_param_store(nodev_tmo) | 1190 | lpfc_vport_param_store(nodev_tmo) |
1106 | 1191 | ||
1107 | static CLASS_DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, | 1192 | static CLASS_DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, |
1108 | lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); | 1193 | lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); |
@@ -1116,29 +1201,28 @@ module_param(lpfc_devloss_tmo, int, 0); | |||
1116 | MODULE_PARM_DESC(lpfc_devloss_tmo, | 1201 | MODULE_PARM_DESC(lpfc_devloss_tmo, |
1117 | "Seconds driver will hold I/O waiting " | 1202 | "Seconds driver will hold I/O waiting " |
1118 | "for a device to come back"); | 1203 | "for a device to come back"); |
1119 | lpfc_param_init(devloss_tmo, LPFC_DEF_DEVLOSS_TMO, | 1204 | lpfc_vport_param_init(devloss_tmo, LPFC_DEF_DEVLOSS_TMO, |
1120 | LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO) | 1205 | LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO) |
1121 | lpfc_param_show(devloss_tmo) | 1206 | lpfc_vport_param_show(devloss_tmo) |
1122 | static int | 1207 | static int |
1123 | lpfc_devloss_tmo_set(struct lpfc_hba *phba, int val) | 1208 | lpfc_devloss_tmo_set(struct lpfc_vport *vport, int val) |
1124 | { | 1209 | { |
1125 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { | 1210 | if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) { |
1126 | phba->cfg_nodev_tmo = val; | 1211 | vport->cfg_nodev_tmo = val; |
1127 | phba->cfg_devloss_tmo = val; | 1212 | vport->cfg_devloss_tmo = val; |
1128 | phba->dev_loss_tmo_changed = 1; | 1213 | vport->dev_loss_tmo_changed = 1; |
1129 | lpfc_update_rport_devloss_tmo(phba); | 1214 | lpfc_update_rport_devloss_tmo(vport); |
1130 | return 0; | 1215 | return 0; |
1131 | } | 1216 | } |
1132 | 1217 | ||
1133 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1218 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
1134 | "%d:0404 lpfc_devloss_tmo attribute cannot be set to" | 1219 | "0404 lpfc_devloss_tmo attribute cannot be set to" |
1135 | " %d, allowed range is [%d, %d]\n", | 1220 | " %d, allowed range is [%d, %d]\n", |
1136 | phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO, | 1221 | val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO); |
1137 | LPFC_MAX_DEVLOSS_TMO); | ||
1138 | return -EINVAL; | 1222 | return -EINVAL; |
1139 | } | 1223 | } |
1140 | 1224 | ||
1141 | lpfc_param_store(devloss_tmo) | 1225 | lpfc_vport_param_store(devloss_tmo) |
1142 | static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, | 1226 | static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, |
1143 | lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); | 1227 | lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); |
1144 | 1228 | ||
@@ -1160,14 +1244,15 @@ static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, | |||
1160 | # LOG_LIBDFC 0x2000 LIBDFC events | 1244 | # LOG_LIBDFC 0x2000 LIBDFC events |
1161 | # LOG_ALL_MSG 0xffff LOG all messages | 1245 | # LOG_ALL_MSG 0xffff LOG all messages |
1162 | */ | 1246 | */ |
1163 | LPFC_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff, "Verbose logging bit-mask"); | 1247 | LPFC_VPORT_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff, |
1248 | "Verbose logging bit-mask"); | ||
1164 | 1249 | ||
1165 | /* | 1250 | /* |
1166 | # lun_queue_depth: This parameter is used to limit the number of outstanding | 1251 | # lun_queue_depth: This parameter is used to limit the number of outstanding |
1167 | # commands per FCP LUN. Value range is [1,128]. Default value is 30. | 1252 | # commands per FCP LUN. Value range is [1,128]. Default value is 30. |
1168 | */ | 1253 | */ |
1169 | LPFC_ATTR_R(lun_queue_depth, 30, 1, 128, | 1254 | LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 128, |
1170 | "Max number of FCP commands we can queue to a specific LUN"); | 1255 | "Max number of FCP commands we can queue to a specific LUN"); |
1171 | 1256 | ||
1172 | /* | 1257 | /* |
1173 | # hba_queue_depth: This parameter is used to limit the number of outstanding | 1258 | # hba_queue_depth: This parameter is used to limit the number of outstanding |
@@ -1188,12 +1273,12 @@ LPFC_ATTR_R(hba_queue_depth, 8192, 32, 8192, | |||
1188 | # are allowed to login to each other. | 1273 | # are allowed to login to each other. |
1189 | # Default value of this parameter is 0. | 1274 | # Default value of this parameter is 0. |
1190 | */ | 1275 | */ |
1191 | LPFC_ATTR_R(peer_port_login, 0, 0, 1, | 1276 | LPFC_VPORT_ATTR_R(peer_port_login, 0, 0, 1, |
1192 | "Allow peer ports on the same physical port to login to each " | 1277 | "Allow peer ports on the same physical port to login to each " |
1193 | "other."); | 1278 | "other."); |
1194 | 1279 | ||
1195 | /* | 1280 | /* |
1196 | # vport_restrict_login: This parameter allows/prevents logins | 1281 | # restrict_login: This parameter allows/prevents logins |
1197 | # between Virtual Ports and remote initiators. | 1282 | # between Virtual Ports and remote initiators. |
1198 | # When this parameter is not set (0) Virtual Ports will accept PLOGIs from | 1283 | # When this parameter is not set (0) Virtual Ports will accept PLOGIs from |
1199 | # other initiators and will attempt to PLOGI all remote ports. | 1284 | # other initiators and will attempt to PLOGI all remote ports. |
@@ -1203,8 +1288,55 @@ LPFC_ATTR_R(peer_port_login, 0, 0, 1, | |||
1203 | # This parameter does not restrict logins to Fabric resident remote ports. | 1288 | # This parameter does not restrict logins to Fabric resident remote ports. |
1204 | # Default value of this parameter is 1. | 1289 | # Default value of this parameter is 1. |
1205 | */ | 1290 | */ |
1206 | LPFC_ATTR_RW(vport_restrict_login, 1, 0, 1, | 1291 | static int lpfc_restrict_login = 1; |
1207 | "Restrict virtual ports login to remote initiators."); | 1292 | module_param(lpfc_restrict_login, int, 0); |
1293 | MODULE_PARM_DESC(lpfc_restrict_login, | ||
1294 | "Restrict virtual ports login to remote initiators."); | ||
1295 | lpfc_vport_param_show(restrict_login); | ||
1296 | |||
1297 | static int | ||
1298 | lpfc_restrict_login_init(struct lpfc_vport *vport, int val) | ||
1299 | { | ||
1300 | if (val < 0 || val > 1) { | ||
1301 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
1302 | "0449 lpfc_restrict_login attribute cannot " | ||
1303 | "be set to %d, allowed range is [0, 1]\n", | ||
1304 | val); | ||
1305 | vport->cfg_restrict_login = 1; | ||
1306 | return -EINVAL; | ||
1307 | } | ||
1308 | if (vport->port_type == LPFC_PHYSICAL_PORT) { | ||
1309 | vport->cfg_restrict_login = 0; | ||
1310 | return 0; | ||
1311 | } | ||
1312 | vport->cfg_restrict_login = val; | ||
1313 | return 0; | ||
1314 | } | ||
1315 | |||
1316 | static int | ||
1317 | lpfc_restrict_login_set(struct lpfc_vport *vport, int val) | ||
1318 | { | ||
1319 | if (val < 0 || val > 1) { | ||
1320 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
1321 | "0450 lpfc_restrict_login attribute cannot " | ||
1322 | "be set to %d, allowed range is [0, 1]\n", | ||
1323 | val); | ||
1324 | vport->cfg_restrict_login = 1; | ||
1325 | return -EINVAL; | ||
1326 | } | ||
1327 | if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { | ||
1328 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
1329 | "0468 lpfc_restrict_login must be 0 for " | ||
1330 | "Physical ports.\n"); | ||
1331 | vport->cfg_restrict_login = 0; | ||
1332 | return 0; | ||
1333 | } | ||
1334 | vport->cfg_restrict_login = val; | ||
1335 | return 0; | ||
1336 | } | ||
1337 | lpfc_vport_param_store(restrict_login); | ||
1338 | static CLASS_DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR, | ||
1339 | lpfc_restrict_login_show, lpfc_restrict_login_store); | ||
1208 | 1340 | ||
1209 | /* | 1341 | /* |
1210 | # Some disk devices have a "select ID" or "select Target" capability. | 1342 | # Some disk devices have a "select ID" or "select Target" capability. |
@@ -1223,8 +1355,8 @@ LPFC_ATTR_RW(vport_restrict_login, 1, 0, 1, | |||
1223 | # and will not work across a fabric. Also this parameter will take | 1355 | # and will not work across a fabric. Also this parameter will take |
1224 | # effect only in the case when ALPA map is not available.) | 1356 | # effect only in the case when ALPA map is not available.) |
1225 | */ | 1357 | */ |
1226 | LPFC_ATTR_R(scan_down, 1, 0, 1, | 1358 | LPFC_VPORT_ATTR_R(scan_down, 1, 0, 1, |
1227 | "Start scanning for devices from highest ALPA to lowest"); | 1359 | "Start scanning for devices from highest ALPA to lowest"); |
1228 | 1360 | ||
1229 | /* | 1361 | /* |
1230 | # lpfc_topology: link topology for init link | 1362 | # lpfc_topology: link topology for init link |
@@ -1255,15 +1387,15 @@ LPFC_ATTR_R(link_speed, 0, 0, 8, "Select link speed"); | |||
1255 | # lpfc_fcp_class: Determines FC class to use for the FCP protocol. | 1387 | # lpfc_fcp_class: Determines FC class to use for the FCP protocol. |
1256 | # Value range is [2,3]. Default value is 3. | 1388 | # Value range is [2,3]. Default value is 3. |
1257 | */ | 1389 | */ |
1258 | LPFC_ATTR_R(fcp_class, 3, 2, 3, | 1390 | LPFC_VPORT_ATTR_R(fcp_class, 3, 2, 3, |
1259 | "Select Fibre Channel class of service for FCP sequences"); | 1391 | "Select Fibre Channel class of service for FCP sequences"); |
1260 | 1392 | ||
1261 | /* | 1393 | /* |
1262 | # lpfc_use_adisc: Use ADISC for FCP rediscovery instead of PLOGI. Value range | 1394 | # lpfc_use_adisc: Use ADISC for FCP rediscovery instead of PLOGI. Value range |
1263 | # is [0,1]. Default value is 0. | 1395 | # is [0,1]. Default value is 0. |
1264 | */ | 1396 | */ |
1265 | LPFC_ATTR_RW(use_adisc, 0, 0, 1, | 1397 | LPFC_VPORT_ATTR_RW(use_adisc, 0, 0, 1, |
1266 | "Use ADISC on rediscovery to authenticate FCP devices"); | 1398 | "Use ADISC on rediscovery to authenticate FCP devices"); |
1267 | 1399 | ||
1268 | /* | 1400 | /* |
1269 | # lpfc_ack0: Use ACK0, instead of ACK1 for class 2 acknowledgement. Value | 1401 | # lpfc_ack0: Use ACK0, instead of ACK1 for class 2 acknowledgement. Value |
@@ -1315,13 +1447,13 @@ LPFC_ATTR_R(multi_ring_type, FC_LLC_SNAP, 1, | |||
1315 | # 2 = support FDMI with attribute of hostname | 1447 | # 2 = support FDMI with attribute of hostname |
1316 | # Value range [0,2]. Default value is 0. | 1448 | # Value range [0,2]. Default value is 0. |
1317 | */ | 1449 | */ |
1318 | LPFC_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support"); | 1450 | LPFC_VPORT_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support"); |
1319 | 1451 | ||
1320 | /* | 1452 | /* |
1321 | # Specifies the maximum number of ELS cmds we can have outstanding (for | 1453 | # Specifies the maximum number of ELS cmds we can have outstanding (for |
1322 | # discovery). Value range is [1,64]. Default value = 32. | 1454 | # discovery). Value range is [1,64]. Default value = 32. |
1323 | */ | 1455 | */ |
1324 | LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " | 1456 | LPFC_VPORT_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " |
1325 | "during discovery"); | 1457 | "during discovery"); |
1326 | 1458 | ||
1327 | /* | 1459 | /* |
@@ -1329,8 +1461,7 @@ LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " | |||
1329 | # Value range is [0,65535]. Default value is 255. | 1461 | # Value range is [0,65535]. Default value is 255. |
1330 | # NOTE: The SCSI layer might probe all allowed LUN on some old targets. | 1462 | # NOTE: The SCSI layer might probe all allowed LUN on some old targets. |
1331 | */ | 1463 | */ |
1332 | LPFC_ATTR_R(max_luns, 255, 0, 65535, | 1464 | LPFC_VPORT_ATTR_R(max_luns, 255, 0, 65535, "Maximum allowed LUN"); |
1333 | "Maximum allowed LUN"); | ||
1334 | 1465 | ||
1335 | /* | 1466 | /* |
1336 | # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. | 1467 | # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. |
@@ -1367,7 +1498,6 @@ struct class_device_attribute *lpfc_hba_attrs[] = { | |||
1367 | &class_device_attr_lpfc_lun_queue_depth, | 1498 | &class_device_attr_lpfc_lun_queue_depth, |
1368 | &class_device_attr_lpfc_hba_queue_depth, | 1499 | &class_device_attr_lpfc_hba_queue_depth, |
1369 | &class_device_attr_lpfc_peer_port_login, | 1500 | &class_device_attr_lpfc_peer_port_login, |
1370 | &class_device_attr_lpfc_vport_restrict_login, | ||
1371 | &class_device_attr_lpfc_nodev_tmo, | 1501 | &class_device_attr_lpfc_nodev_tmo, |
1372 | &class_device_attr_lpfc_devloss_tmo, | 1502 | &class_device_attr_lpfc_devloss_tmo, |
1373 | &class_device_attr_lpfc_fcp_class, | 1503 | &class_device_attr_lpfc_fcp_class, |
@@ -1383,9 +1513,8 @@ struct class_device_attribute *lpfc_hba_attrs[] = { | |||
1383 | &class_device_attr_lpfc_multi_ring_type, | 1513 | &class_device_attr_lpfc_multi_ring_type, |
1384 | &class_device_attr_lpfc_fdmi_on, | 1514 | &class_device_attr_lpfc_fdmi_on, |
1385 | &class_device_attr_lpfc_max_luns, | 1515 | &class_device_attr_lpfc_max_luns, |
1386 | &class_device_attr_lpfc_npiv_enable, | 1516 | &class_device_attr_lpfc_enable_npiv, |
1387 | &class_device_attr_nport_evt_cnt, | 1517 | &class_device_attr_nport_evt_cnt, |
1388 | &class_device_attr_management_version, | ||
1389 | &class_device_attr_board_mode, | 1518 | &class_device_attr_board_mode, |
1390 | &class_device_attr_max_vpi, | 1519 | &class_device_attr_max_vpi, |
1391 | &class_device_attr_used_vpi, | 1520 | &class_device_attr_used_vpi, |
@@ -1404,6 +1533,28 @@ struct class_device_attribute *lpfc_hba_attrs[] = { | |||
1404 | NULL, | 1533 | NULL, |
1405 | }; | 1534 | }; |
1406 | 1535 | ||
1536 | struct class_device_attribute *lpfc_vport_attrs[] = { | ||
1537 | &class_device_attr_info, | ||
1538 | &class_device_attr_state, | ||
1539 | &class_device_attr_num_discovered_ports, | ||
1540 | &class_device_attr_lpfc_drvr_version, | ||
1541 | |||
1542 | &class_device_attr_lpfc_log_verbose, | ||
1543 | &class_device_attr_lpfc_lun_queue_depth, | ||
1544 | &class_device_attr_lpfc_nodev_tmo, | ||
1545 | &class_device_attr_lpfc_devloss_tmo, | ||
1546 | &class_device_attr_lpfc_hba_queue_depth, | ||
1547 | &class_device_attr_lpfc_peer_port_login, | ||
1548 | &class_device_attr_lpfc_restrict_login, | ||
1549 | &class_device_attr_lpfc_fcp_class, | ||
1550 | &class_device_attr_lpfc_use_adisc, | ||
1551 | &class_device_attr_lpfc_fdmi_on, | ||
1552 | &class_device_attr_lpfc_max_luns, | ||
1553 | &class_device_attr_nport_evt_cnt, | ||
1554 | &class_device_attr_npiv_info, | ||
1555 | NULL, | ||
1556 | }; | ||
1557 | |||
1407 | static ssize_t | 1558 | static ssize_t |
1408 | sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr, | 1559 | sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr, |
1409 | char *buf, loff_t off, size_t count) | 1560 | char *buf, loff_t off, size_t count) |
@@ -2243,7 +2394,6 @@ struct fc_function_template lpfc_vport_transport_functions = { | |||
2243 | .get_starget_port_name = lpfc_get_starget_port_name, | 2394 | .get_starget_port_name = lpfc_get_starget_port_name, |
2244 | .show_starget_port_name = 1, | 2395 | .show_starget_port_name = 1, |
2245 | 2396 | ||
2246 | .issue_fc_host_lip = lpfc_issue_lip, | ||
2247 | .dev_loss_tmo_callbk = lpfc_dev_loss_tmo_callbk, | 2397 | .dev_loss_tmo_callbk = lpfc_dev_loss_tmo_callbk, |
2248 | .terminate_rport_io = lpfc_terminate_rport_io, | 2398 | .terminate_rport_io = lpfc_terminate_rport_io, |
2249 | 2399 | ||
@@ -2253,39 +2403,25 @@ struct fc_function_template lpfc_vport_transport_functions = { | |||
2253 | void | 2403 | void |
2254 | lpfc_get_cfgparam(struct lpfc_hba *phba) | 2404 | lpfc_get_cfgparam(struct lpfc_hba *phba) |
2255 | { | 2405 | { |
2256 | lpfc_log_verbose_init(phba, lpfc_log_verbose); | ||
2257 | lpfc_cr_delay_init(phba, lpfc_cr_delay); | 2406 | lpfc_cr_delay_init(phba, lpfc_cr_delay); |
2258 | lpfc_cr_count_init(phba, lpfc_cr_count); | 2407 | lpfc_cr_count_init(phba, lpfc_cr_count); |
2259 | lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); | 2408 | lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); |
2260 | lpfc_multi_ring_rctl_init(phba, lpfc_multi_ring_rctl); | 2409 | lpfc_multi_ring_rctl_init(phba, lpfc_multi_ring_rctl); |
2261 | lpfc_multi_ring_type_init(phba, lpfc_multi_ring_type); | 2410 | lpfc_multi_ring_type_init(phba, lpfc_multi_ring_type); |
2262 | lpfc_lun_queue_depth_init(phba, lpfc_lun_queue_depth); | ||
2263 | lpfc_fcp_class_init(phba, lpfc_fcp_class); | ||
2264 | lpfc_use_adisc_init(phba, lpfc_use_adisc); | ||
2265 | lpfc_ack0_init(phba, lpfc_ack0); | 2411 | lpfc_ack0_init(phba, lpfc_ack0); |
2266 | lpfc_topology_init(phba, lpfc_topology); | 2412 | lpfc_topology_init(phba, lpfc_topology); |
2267 | lpfc_scan_down_init(phba, lpfc_scan_down); | ||
2268 | lpfc_link_speed_init(phba, lpfc_link_speed); | 2413 | lpfc_link_speed_init(phba, lpfc_link_speed); |
2269 | lpfc_fdmi_on_init(phba, lpfc_fdmi_on); | ||
2270 | lpfc_discovery_threads_init(phba, lpfc_discovery_threads); | ||
2271 | lpfc_max_luns_init(phba, lpfc_max_luns); | ||
2272 | lpfc_poll_tmo_init(phba, lpfc_poll_tmo); | 2414 | lpfc_poll_tmo_init(phba, lpfc_poll_tmo); |
2273 | lpfc_peer_port_login_init(phba, lpfc_peer_port_login); | 2415 | lpfc_enable_npiv_init(phba, lpfc_enable_npiv); |
2274 | lpfc_npiv_enable_init(phba, lpfc_npiv_enable); | ||
2275 | lpfc_vport_restrict_login_init(phba, lpfc_vport_restrict_login); | ||
2276 | lpfc_use_msi_init(phba, lpfc_use_msi); | 2416 | lpfc_use_msi_init(phba, lpfc_use_msi); |
2277 | lpfc_devloss_tmo_init(phba, lpfc_devloss_tmo); | ||
2278 | lpfc_nodev_tmo_init(phba, lpfc_nodev_tmo); | ||
2279 | phba->cfg_poll = lpfc_poll; | 2417 | phba->cfg_poll = lpfc_poll; |
2280 | phba->cfg_soft_wwnn = 0L; | 2418 | phba->cfg_soft_wwnn = 0L; |
2281 | phba->cfg_soft_wwpn = 0L; | 2419 | phba->cfg_soft_wwpn = 0L; |
2282 | |||
2283 | /* | 2420 | /* |
2284 | * The total number of segments is the configuration value plus 2 | 2421 | * The total number of segments is the configuration value plus 2 |
2285 | * since the IOCB need a command and response bde. | 2422 | * since the IOCB need a command and response bde. |
2286 | */ | 2423 | */ |
2287 | phba->cfg_sg_seg_cnt = LPFC_SG_SEG_CNT + 2; | 2424 | phba->cfg_sg_seg_cnt = LPFC_SG_SEG_CNT + 2; |
2288 | |||
2289 | /* | 2425 | /* |
2290 | * Since the sg_tablesize is module parameter, the sg_dma_buf_size | 2426 | * Since the sg_tablesize is module parameter, the sg_dma_buf_size |
2291 | * used to create the sg_dma_buf_pool must be dynamically calculated | 2427 | * used to create the sg_dma_buf_pool must be dynamically calculated |
@@ -2293,9 +2429,24 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) | |||
2293 | phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + | 2429 | phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + |
2294 | sizeof(struct fcp_rsp) + | 2430 | sizeof(struct fcp_rsp) + |
2295 | (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); | 2431 | (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64)); |
2296 | |||
2297 | |||
2298 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); | 2432 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); |
2433 | return; | ||
2434 | } | ||
2299 | 2435 | ||
2436 | void | ||
2437 | lpfc_get_vport_cfgparam(struct lpfc_vport *vport) | ||
2438 | { | ||
2439 | lpfc_log_verbose_init(vport, lpfc_log_verbose); | ||
2440 | lpfc_lun_queue_depth_init(vport, lpfc_lun_queue_depth); | ||
2441 | lpfc_devloss_tmo_init(vport, lpfc_devloss_tmo); | ||
2442 | lpfc_nodev_tmo_init(vport, lpfc_nodev_tmo); | ||
2443 | lpfc_peer_port_login_init(vport, lpfc_peer_port_login); | ||
2444 | lpfc_restrict_login_init(vport, lpfc_restrict_login); | ||
2445 | lpfc_fcp_class_init(vport, lpfc_fcp_class); | ||
2446 | lpfc_use_adisc_init(vport, lpfc_use_adisc); | ||
2447 | lpfc_fdmi_on_init(vport, lpfc_fdmi_on); | ||
2448 | lpfc_discovery_threads_init(vport, lpfc_discovery_threads); | ||
2449 | lpfc_max_luns_init(vport, lpfc_max_luns); | ||
2450 | lpfc_scan_down_init(vport, lpfc_scan_down); | ||
2300 | return; | 2451 | return; |
2301 | } | 2452 | } |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index e19d1a746586..a599e1510710 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -40,6 +40,7 @@ void lpfc_reg_vpi(struct lpfc_hba *, uint16_t, uint32_t, LPFC_MBOXQ_t *); | |||
40 | void lpfc_unreg_vpi(struct lpfc_hba *, uint16_t, LPFC_MBOXQ_t *); | 40 | void lpfc_unreg_vpi(struct lpfc_hba *, uint16_t, LPFC_MBOXQ_t *); |
41 | void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t); | 41 | void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t); |
42 | 42 | ||
43 | struct lpfc_vport *lpfc_find_vport_by_did(struct lpfc_hba *, uint32_t); | ||
43 | void lpfc_cleanup_rpis(struct lpfc_vport *vport, int remove); | 44 | void lpfc_cleanup_rpis(struct lpfc_vport *vport, int remove); |
44 | int lpfc_linkdown(struct lpfc_hba *); | 45 | int lpfc_linkdown(struct lpfc_hba *); |
45 | void lpfc_mbx_cmpl_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *); | 46 | void lpfc_mbx_cmpl_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *); |
@@ -101,7 +102,7 @@ int lpfc_issue_els_scr(struct lpfc_vport *, uint32_t, uint8_t); | |||
101 | int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *); | 102 | int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *); |
102 | int lpfc_ct_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *); | 103 | int lpfc_ct_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *); |
103 | int lpfc_els_rsp_acc(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *, | 104 | int lpfc_els_rsp_acc(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *, |
104 | struct lpfc_nodelist *, LPFC_MBOXQ_t *, uint8_t); | 105 | struct lpfc_nodelist *, LPFC_MBOXQ_t *); |
105 | int lpfc_els_rsp_reject(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *, | 106 | int lpfc_els_rsp_reject(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *, |
106 | struct lpfc_nodelist *, LPFC_MBOXQ_t *); | 107 | struct lpfc_nodelist *, LPFC_MBOXQ_t *); |
107 | int lpfc_els_rsp_adisc_acc(struct lpfc_vport *, struct lpfc_iocbq *, | 108 | int lpfc_els_rsp_adisc_acc(struct lpfc_vport *, struct lpfc_iocbq *, |
@@ -117,6 +118,7 @@ void lpfc_els_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *, | |||
117 | int lpfc_els_handle_rscn(struct lpfc_vport *); | 118 | int lpfc_els_handle_rscn(struct lpfc_vport *); |
118 | void lpfc_els_flush_rscn(struct lpfc_vport *); | 119 | void lpfc_els_flush_rscn(struct lpfc_vport *); |
119 | int lpfc_rscn_payload_check(struct lpfc_vport *, uint32_t); | 120 | int lpfc_rscn_payload_check(struct lpfc_vport *, uint32_t); |
121 | void lpfc_els_flush_all_cmd(struct lpfc_hba *); | ||
120 | void lpfc_els_flush_cmd(struct lpfc_vport *); | 122 | void lpfc_els_flush_cmd(struct lpfc_vport *); |
121 | int lpfc_els_disc_adisc(struct lpfc_vport *); | 123 | int lpfc_els_disc_adisc(struct lpfc_vport *); |
122 | int lpfc_els_disc_plogi(struct lpfc_vport *); | 124 | int lpfc_els_disc_plogi(struct lpfc_vport *); |
@@ -161,9 +163,11 @@ LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *); | |||
161 | void lpfc_mbox_cmpl_put(struct lpfc_hba *, LPFC_MBOXQ_t *); | 163 | void lpfc_mbox_cmpl_put(struct lpfc_hba *, LPFC_MBOXQ_t *); |
162 | int lpfc_mbox_tmo_val(struct lpfc_hba *, int); | 164 | int lpfc_mbox_tmo_val(struct lpfc_hba *, int); |
163 | 165 | ||
164 | void lpfc_config_hbq(struct lpfc_hba *, struct lpfc_hbq_init *, uint32_t , | 166 | void lpfc_config_hbq(struct lpfc_hba *, uint32_t, struct lpfc_hbq_init *, |
165 | LPFC_MBOXQ_t *); | 167 | uint32_t , LPFC_MBOXQ_t *); |
166 | struct lpfc_hbq_entry * lpfc_sli_next_hbq_slot(struct lpfc_hba *, uint32_t); | 168 | struct lpfc_hbq_entry * lpfc_sli_next_hbq_slot(struct lpfc_hba *, uint32_t); |
169 | struct hbq_dmabuf *lpfc_els_hbq_alloc(struct lpfc_hba *); | ||
170 | void lpfc_els_hbq_free(struct lpfc_hba *, struct hbq_dmabuf *); | ||
167 | 171 | ||
168 | int lpfc_mem_alloc(struct lpfc_hba *); | 172 | int lpfc_mem_alloc(struct lpfc_hba *); |
169 | void lpfc_mem_free(struct lpfc_hba *); | 173 | void lpfc_mem_free(struct lpfc_hba *); |
@@ -200,6 +204,7 @@ int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *, | |||
200 | struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *, | 204 | struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *, |
201 | struct lpfc_sli_ring *, | 205 | struct lpfc_sli_ring *, |
202 | dma_addr_t); | 206 | dma_addr_t); |
207 | int lpfc_sli_hbq_count(void); | ||
203 | int lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *, uint32_t); | 208 | int lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *, uint32_t); |
204 | int lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *, uint32_t); | 209 | int lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *, uint32_t); |
205 | void lpfc_sli_hbqbuf_free_all(struct lpfc_hba *); | 210 | void lpfc_sli_hbqbuf_free_all(struct lpfc_hba *); |
@@ -207,10 +212,9 @@ struct hbq_dmabuf *lpfc_sli_hbqbuf_find(struct lpfc_hba *, uint32_t); | |||
207 | int lpfc_sli_hbq_size(void); | 212 | int lpfc_sli_hbq_size(void); |
208 | int lpfc_sli_issue_abort_iotag(struct lpfc_hba *, struct lpfc_sli_ring *, | 213 | int lpfc_sli_issue_abort_iotag(struct lpfc_hba *, struct lpfc_sli_ring *, |
209 | struct lpfc_iocbq *); | 214 | struct lpfc_iocbq *); |
210 | int lpfc_sli_sum_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, | 215 | int lpfc_sli_sum_iocb(struct lpfc_vport *, uint16_t, uint64_t, lpfc_ctx_cmd); |
211 | uint64_t, lpfc_ctx_cmd); | 216 | int lpfc_sli_abort_iocb(struct lpfc_vport *, struct lpfc_sli_ring *, uint16_t, |
212 | int lpfc_sli_abort_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, | 217 | uint64_t, lpfc_ctx_cmd); |
213 | uint64_t, uint32_t, lpfc_ctx_cmd); | ||
214 | 218 | ||
215 | void lpfc_mbox_timeout(unsigned long); | 219 | void lpfc_mbox_timeout(unsigned long); |
216 | void lpfc_mbox_timeout_handler(struct lpfc_hba *); | 220 | void lpfc_mbox_timeout_handler(struct lpfc_hba *); |
@@ -234,8 +238,6 @@ void lpfc_sli_abort_fcp_cmpl(struct lpfc_hba * phba, | |||
234 | struct lpfc_iocbq * cmdiocb, | 238 | struct lpfc_iocbq * cmdiocb, |
235 | struct lpfc_iocbq * rspiocb); | 239 | struct lpfc_iocbq * rspiocb); |
236 | 240 | ||
237 | void *lpfc_hbq_alloc(struct lpfc_hba *, int, dma_addr_t *); | ||
238 | void lpfc_hbq_free(struct lpfc_hba *, void *, dma_addr_t); | ||
239 | void lpfc_sli_free_hbq(struct lpfc_hba *, struct hbq_dmabuf *); | 241 | void lpfc_sli_free_hbq(struct lpfc_hba *, struct hbq_dmabuf *); |
240 | 242 | ||
241 | void *lpfc_mbuf_alloc(struct lpfc_hba *, int, dma_addr_t *); | 243 | void *lpfc_mbuf_alloc(struct lpfc_hba *, int, dma_addr_t *); |
@@ -248,10 +250,13 @@ const char* lpfc_info(struct Scsi_Host *); | |||
248 | int lpfc_scan_finished(struct Scsi_Host *, unsigned long); | 250 | int lpfc_scan_finished(struct Scsi_Host *, unsigned long); |
249 | 251 | ||
250 | void lpfc_get_cfgparam(struct lpfc_hba *); | 252 | void lpfc_get_cfgparam(struct lpfc_hba *); |
253 | void lpfc_get_vport_cfgparam(struct lpfc_vport *); | ||
251 | int lpfc_alloc_sysfs_attr(struct lpfc_vport *); | 254 | int lpfc_alloc_sysfs_attr(struct lpfc_vport *); |
252 | void lpfc_free_sysfs_attr(struct lpfc_vport *); | 255 | void lpfc_free_sysfs_attr(struct lpfc_vport *); |
253 | extern struct class_device_attribute *lpfc_hba_attrs[]; | 256 | extern struct class_device_attribute *lpfc_hba_attrs[]; |
257 | extern struct class_device_attribute *lpfc_vport_attrs[]; | ||
254 | extern struct scsi_host_template lpfc_template; | 258 | extern struct scsi_host_template lpfc_template; |
259 | extern struct scsi_host_template lpfc_vport_template; | ||
255 | extern struct fc_function_template lpfc_transport_functions; | 260 | extern struct fc_function_template lpfc_transport_functions; |
256 | extern struct fc_function_template lpfc_vport_transport_functions; | 261 | extern struct fc_function_template lpfc_vport_transport_functions; |
257 | extern int lpfc_sli_mode; | 262 | extern int lpfc_sli_mode; |
@@ -260,7 +265,7 @@ int lpfc_vport_symbolic_node_name(struct lpfc_vport *, char *, size_t); | |||
260 | void lpfc_terminate_rport_io(struct fc_rport *); | 265 | void lpfc_terminate_rport_io(struct fc_rport *); |
261 | void lpfc_dev_loss_tmo_callbk(struct fc_rport *rport); | 266 | void lpfc_dev_loss_tmo_callbk(struct fc_rport *rport); |
262 | 267 | ||
263 | struct lpfc_vport *lpfc_create_port(struct lpfc_hba *, int, struct fc_vport *); | 268 | struct lpfc_vport *lpfc_create_port(struct lpfc_hba *, int, struct device *); |
264 | int lpfc_vport_disable(struct fc_vport *fc_vport, bool disable); | 269 | int lpfc_vport_disable(struct fc_vport *fc_vport, bool disable); |
265 | void lpfc_mbx_unreg_vpi(struct lpfc_vport *); | 270 | void lpfc_mbx_unreg_vpi(struct lpfc_vport *); |
266 | void destroy_port(struct lpfc_vport *); | 271 | void destroy_port(struct lpfc_vport *); |
@@ -271,6 +276,9 @@ extern void lpfc_debugfs_initialize(struct lpfc_vport *); | |||
271 | extern void lpfc_debugfs_terminate(struct lpfc_vport *); | 276 | extern void lpfc_debugfs_terminate(struct lpfc_vport *); |
272 | extern void lpfc_debugfs_disc_trc(struct lpfc_vport *, int, char *, uint32_t, | 277 | extern void lpfc_debugfs_disc_trc(struct lpfc_vport *, int, char *, uint32_t, |
273 | uint32_t, uint32_t); | 278 | uint32_t, uint32_t); |
279 | extern void lpfc_debugfs_slow_ring_trc(struct lpfc_hba *, char *, uint32_t, | ||
280 | uint32_t, uint32_t); | ||
281 | extern struct lpfc_hbq_init *lpfc_hbq_defs[]; | ||
274 | 282 | ||
275 | /* Interface exported by fabric iocb scheduler */ | 283 | /* Interface exported by fabric iocb scheduler */ |
276 | int lpfc_issue_fabric_iocb(struct lpfc_hba *, struct lpfc_iocbq *); | 284 | int lpfc_issue_fabric_iocb(struct lpfc_hba *, struct lpfc_iocbq *); |
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index ae9d6f385a6c..c701e4d611a9 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -257,6 +257,10 @@ lpfc_ct_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *ctiocb) | |||
257 | { | 257 | { |
258 | struct lpfc_dmabuf *buf_ptr; | 258 | struct lpfc_dmabuf *buf_ptr; |
259 | 259 | ||
260 | if (ctiocb->context_un.ndlp) { | ||
261 | lpfc_nlp_put(ctiocb->context_un.ndlp); | ||
262 | ctiocb->context_un.ndlp = NULL; | ||
263 | } | ||
260 | if (ctiocb->context1) { | 264 | if (ctiocb->context1) { |
261 | buf_ptr = (struct lpfc_dmabuf *) ctiocb->context1; | 265 | buf_ptr = (struct lpfc_dmabuf *) ctiocb->context1; |
262 | lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); | 266 | lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); |
@@ -314,6 +318,7 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, | |||
314 | /* Save for completion so we can release these resources */ | 318 | /* Save for completion so we can release these resources */ |
315 | geniocb->context1 = (uint8_t *) inp; | 319 | geniocb->context1 = (uint8_t *) inp; |
316 | geniocb->context2 = (uint8_t *) outp; | 320 | geniocb->context2 = (uint8_t *) outp; |
321 | geniocb->context_un.ndlp = ndlp; | ||
317 | 322 | ||
318 | /* Fill in payload, bp points to frame payload */ | 323 | /* Fill in payload, bp points to frame payload */ |
319 | icmd->ulpCommand = CMD_GEN_REQUEST64_CR; | 324 | icmd->ulpCommand = CMD_GEN_REQUEST64_CR; |
@@ -341,11 +346,11 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, | |||
341 | } | 346 | } |
342 | 347 | ||
343 | /* Issue GEN REQ IOCB for NPORT <did> */ | 348 | /* Issue GEN REQ IOCB for NPORT <did> */ |
344 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 349 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
345 | "%d (%d):0119 Issue GEN REQ IOCB to NPORT x%x " | 350 | "0119 Issue GEN REQ IOCB to NPORT x%x " |
346 | "Data: x%x x%x\n", phba->brd_no, vport->vpi, | 351 | "Data: x%x x%x\n", |
347 | ndlp->nlp_DID, icmd->ulpIoTag, | 352 | ndlp->nlp_DID, icmd->ulpIoTag, |
348 | vport->port_state); | 353 | vport->port_state); |
349 | geniocb->iocb_cmpl = cmpl; | 354 | geniocb->iocb_cmpl = cmpl; |
350 | geniocb->drvrTimeout = icmd->ulpTimeout + LPFC_DRVR_TIMEOUT; | 355 | geniocb->drvrTimeout = icmd->ulpTimeout + LPFC_DRVR_TIMEOUT; |
351 | geniocb->vport = vport; | 356 | geniocb->vport = vport; |
@@ -390,17 +395,19 @@ lpfc_ct_cmd(struct lpfc_vport *vport, struct lpfc_dmabuf *inmp, | |||
390 | return 0; | 395 | return 0; |
391 | } | 396 | } |
392 | 397 | ||
393 | static struct lpfc_vport * | 398 | struct lpfc_vport * |
394 | lpfc_find_vport_by_did(struct lpfc_hba *phba, uint32_t did) { | 399 | lpfc_find_vport_by_did(struct lpfc_hba *phba, uint32_t did) { |
395 | |||
396 | struct lpfc_vport *vport_curr; | 400 | struct lpfc_vport *vport_curr; |
401 | unsigned long flags; | ||
397 | 402 | ||
403 | spin_lock_irqsave(&phba->hbalock, flags); | ||
398 | list_for_each_entry(vport_curr, &phba->port_list, listentry) { | 404 | list_for_each_entry(vport_curr, &phba->port_list, listentry) { |
399 | if ((vport_curr->fc_myDID) && | 405 | if ((vport_curr->fc_myDID) && (vport_curr->fc_myDID == did)) { |
400 | (vport_curr->fc_myDID == did)) | 406 | spin_unlock_irqrestore(&phba->hbalock, flags); |
401 | return vport_curr; | 407 | return vport_curr; |
408 | } | ||
402 | } | 409 | } |
403 | 410 | spin_unlock_irqrestore(&phba->hbalock, flags); | |
404 | return NULL; | 411 | return NULL; |
405 | } | 412 | } |
406 | 413 | ||
@@ -449,10 +456,10 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
449 | */ | 456 | */ |
450 | if ((Did != vport->fc_myDID) && | 457 | if ((Did != vport->fc_myDID) && |
451 | ((lpfc_find_vport_by_did(phba, Did) == NULL) || | 458 | ((lpfc_find_vport_by_did(phba, Did) == NULL) || |
452 | phba->cfg_peer_port_login)) { | 459 | vport->cfg_peer_port_login)) { |
453 | if ((vport->port_type != LPFC_NPIV_PORT) || | 460 | if ((vport->port_type != LPFC_NPIV_PORT) || |
454 | (vport->fc_flag & FC_RFF_NOT_SUPPORTED) || | 461 | (vport->fc_flag & FC_RFF_NOT_SUPPORTED) || |
455 | (!phba->cfg_vport_restrict_login)) { | 462 | (!vport->cfg_restrict_login)) { |
456 | ndlp = lpfc_setup_disc_node(vport, Did); | 463 | ndlp = lpfc_setup_disc_node(vport, Did); |
457 | if (ndlp) { | 464 | if (ndlp) { |
458 | lpfc_debugfs_disc_trc(vport, | 465 | lpfc_debugfs_disc_trc(vport, |
@@ -462,14 +469,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
462 | Did, ndlp->nlp_flag, | 469 | Did, ndlp->nlp_flag, |
463 | vport->fc_flag); | 470 | vport->fc_flag); |
464 | 471 | ||
465 | lpfc_printf_log(phba, KERN_INFO, | 472 | lpfc_printf_vlog(vport, |
473 | KERN_INFO, | ||
466 | LOG_DISCOVERY, | 474 | LOG_DISCOVERY, |
467 | "%d (%d):0238 Process " | 475 | "0238 Process " |
468 | "x%x NameServer Rsp" | 476 | "x%x NameServer Rsp" |
469 | "Data: x%x x%x x%x\n", | 477 | "Data: x%x x%x x%x\n", |
470 | phba->brd_no, | 478 | Did, ndlp->nlp_flag, |
471 | vport->vpi, Did, | ||
472 | ndlp->nlp_flag, | ||
473 | vport->fc_flag, | 479 | vport->fc_flag, |
474 | vport->fc_rscn_id_cnt); | 480 | vport->fc_rscn_id_cnt); |
475 | } else { | 481 | } else { |
@@ -480,14 +486,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
480 | Did, vport->fc_flag, | 486 | Did, vport->fc_flag, |
481 | vport->fc_rscn_id_cnt); | 487 | vport->fc_rscn_id_cnt); |
482 | 488 | ||
483 | lpfc_printf_log(phba, KERN_INFO, | 489 | lpfc_printf_vlog(vport, |
490 | KERN_INFO, | ||
484 | LOG_DISCOVERY, | 491 | LOG_DISCOVERY, |
485 | "%d (%d):0239 Skip x%x " | 492 | "0239 Skip x%x " |
486 | "NameServer Rsp Data: " | 493 | "NameServer Rsp Data: " |
487 | "x%x x%x\n", | 494 | "x%x x%x\n", |
488 | phba->brd_no, | 495 | Did, vport->fc_flag, |
489 | vport->vpi, Did, | ||
490 | vport->fc_flag, | ||
491 | vport->fc_rscn_id_cnt); | 496 | vport->fc_rscn_id_cnt); |
492 | } | 497 | } |
493 | 498 | ||
@@ -514,14 +519,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
514 | Did, vport->fc_flag, | 519 | Did, vport->fc_flag, |
515 | vport->fc_rscn_id_cnt); | 520 | vport->fc_rscn_id_cnt); |
516 | 521 | ||
517 | lpfc_printf_log(phba, KERN_INFO, | 522 | lpfc_printf_vlog(vport, |
523 | KERN_INFO, | ||
518 | LOG_DISCOVERY, | 524 | LOG_DISCOVERY, |
519 | "%d (%d):0245 Skip x%x " | 525 | "0245 Skip x%x " |
520 | "NameServer Rsp Data: " | 526 | "NameServer Rsp Data: " |
521 | "x%x x%x\n", | 527 | "x%x x%x\n", |
522 | phba->brd_no, | 528 | Did, vport->fc_flag, |
523 | vport->vpi, Did, | ||
524 | vport->fc_flag, | ||
525 | vport->fc_rscn_id_cnt); | 529 | vport->fc_rscn_id_cnt); |
526 | } | 530 | } |
527 | } | 531 | } |
@@ -549,8 +553,12 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
549 | struct lpfc_dmabuf *bmp; | 553 | struct lpfc_dmabuf *bmp; |
550 | struct lpfc_dmabuf *outp; | 554 | struct lpfc_dmabuf *outp; |
551 | struct lpfc_sli_ct_request *CTrsp; | 555 | struct lpfc_sli_ct_request *CTrsp; |
556 | struct lpfc_nodelist *ndlp; | ||
552 | int rc; | 557 | int rc; |
553 | 558 | ||
559 | /* First save ndlp, before we overwrite it */ | ||
560 | ndlp = cmdiocb->context_un.ndlp; | ||
561 | |||
554 | /* we pass cmdiocb to state machine which needs rspiocb as well */ | 562 | /* we pass cmdiocb to state machine which needs rspiocb as well */ |
555 | cmdiocb->context_un.rsp_iocb = rspiocb; | 563 | cmdiocb->context_un.rsp_iocb = rspiocb; |
556 | 564 | ||
@@ -568,9 +576,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
568 | 576 | ||
569 | 577 | ||
570 | if (lpfc_els_chk_latt(vport) || lpfc_error_lost_link(irsp)) { | 578 | if (lpfc_els_chk_latt(vport) || lpfc_error_lost_link(irsp)) { |
571 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 579 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
572 | "%d (%d):0216 Link event during NS query\n", | 580 | "0216 Link event during NS query\n"); |
573 | phba->brd_no, vport->vpi); | ||
574 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 581 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
575 | goto out; | 582 | goto out; |
576 | } | 583 | } |
@@ -588,46 +595,61 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
588 | goto out; | 595 | goto out; |
589 | } | 596 | } |
590 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 597 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
591 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 598 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
592 | "%d (%d):0257 GID_FT Query error: 0x%x 0x%x\n", | 599 | "0257 GID_FT Query error: 0x%x 0x%x\n", |
593 | phba->brd_no, vport->vpi, irsp->ulpStatus, | 600 | irsp->ulpStatus, vport->fc_ns_retry); |
594 | vport->fc_ns_retry); | ||
595 | } else { | 601 | } else { |
596 | /* Good status, continue checking */ | 602 | /* Good status, continue checking */ |
597 | CTrsp = (struct lpfc_sli_ct_request *) outp->virt; | 603 | CTrsp = (struct lpfc_sli_ct_request *) outp->virt; |
598 | if (CTrsp->CommandResponse.bits.CmdRsp == | 604 | if (CTrsp->CommandResponse.bits.CmdRsp == |
599 | be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { | 605 | be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { |
600 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 606 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
601 | "%d (%d):0208 NameServer Rsp " | 607 | "0208 NameServer Rsp Data: x%x\n", |
602 | "Data: x%x\n", | 608 | vport->fc_flag); |
603 | phba->brd_no, vport->vpi, | ||
604 | vport->fc_flag); | ||
605 | lpfc_ns_rsp(vport, outp, | 609 | lpfc_ns_rsp(vport, outp, |
606 | (uint32_t) (irsp->un.genreq64.bdl.bdeSize)); | 610 | (uint32_t) (irsp->un.genreq64.bdl.bdeSize)); |
607 | } else if (CTrsp->CommandResponse.bits.CmdRsp == | 611 | } else if (CTrsp->CommandResponse.bits.CmdRsp == |
608 | be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { | 612 | be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { |
609 | /* NameServer Rsp Error */ | 613 | /* NameServer Rsp Error */ |
610 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 614 | if ((CTrsp->ReasonCode == SLI_CT_UNABLE_TO_PERFORM_REQ) |
611 | "%d (%d):0240 NameServer Rsp Error " | 615 | && (CTrsp->Explanation == SLI_CT_NO_FC4_TYPES)) { |
616 | lpfc_printf_vlog(vport, KERN_INFO, | ||
617 | LOG_DISCOVERY, | ||
618 | "0269 No NameServer Entries " | ||
612 | "Data: x%x x%x x%x x%x\n", | 619 | "Data: x%x x%x x%x x%x\n", |
613 | phba->brd_no, vport->vpi, | ||
614 | CTrsp->CommandResponse.bits.CmdRsp, | 620 | CTrsp->CommandResponse.bits.CmdRsp, |
615 | (uint32_t) CTrsp->ReasonCode, | 621 | (uint32_t) CTrsp->ReasonCode, |
616 | (uint32_t) CTrsp->Explanation, | 622 | (uint32_t) CTrsp->Explanation, |
617 | vport->fc_flag); | 623 | vport->fc_flag); |
618 | 624 | ||
619 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | 625 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, |
626 | "GID_FT no entry cmd:x%x rsn:x%x exp:x%x", | ||
627 | (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, | ||
628 | (uint32_t) CTrsp->ReasonCode, | ||
629 | (uint32_t) CTrsp->Explanation); | ||
630 | } else { | ||
631 | lpfc_printf_vlog(vport, KERN_INFO, | ||
632 | LOG_DISCOVERY, | ||
633 | "0240 NameServer Rsp Error " | ||
634 | "Data: x%x x%x x%x x%x\n", | ||
635 | CTrsp->CommandResponse.bits.CmdRsp, | ||
636 | (uint32_t) CTrsp->ReasonCode, | ||
637 | (uint32_t) CTrsp->Explanation, | ||
638 | vport->fc_flag); | ||
639 | |||
640 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | ||
620 | "GID_FT rsp err1 cmd:x%x rsn:x%x exp:x%x", | 641 | "GID_FT rsp err1 cmd:x%x rsn:x%x exp:x%x", |
621 | (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, | 642 | (uint32_t)CTrsp->CommandResponse.bits.CmdRsp, |
622 | (uint32_t) CTrsp->ReasonCode, | 643 | (uint32_t) CTrsp->ReasonCode, |
623 | (uint32_t) CTrsp->Explanation); | 644 | (uint32_t) CTrsp->Explanation); |
645 | } | ||
646 | |||
624 | 647 | ||
625 | } else { | 648 | } else { |
626 | /* NameServer Rsp Error */ | 649 | /* NameServer Rsp Error */ |
627 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 650 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
628 | "%d (%d):0241 NameServer Rsp Error " | 651 | "0241 NameServer Rsp Error " |
629 | "Data: x%x x%x x%x x%x\n", | 652 | "Data: x%x x%x x%x x%x\n", |
630 | phba->brd_no, vport->vpi, | ||
631 | CTrsp->CommandResponse.bits.CmdRsp, | 653 | CTrsp->CommandResponse.bits.CmdRsp, |
632 | (uint32_t) CTrsp->ReasonCode, | 654 | (uint32_t) CTrsp->ReasonCode, |
633 | (uint32_t) CTrsp->Explanation, | 655 | (uint32_t) CTrsp->Explanation, |
@@ -661,11 +683,12 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
661 | lpfc_disc_start(vport); | 683 | lpfc_disc_start(vport); |
662 | } | 684 | } |
663 | out: | 685 | out: |
686 | cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */ | ||
664 | lpfc_ct_free_iocb(phba, cmdiocb); | 687 | lpfc_ct_free_iocb(phba, cmdiocb); |
665 | return; | 688 | return; |
666 | } | 689 | } |
667 | 690 | ||
668 | void | 691 | static void |
669 | lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | 692 | lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
670 | struct lpfc_iocbq *rspiocb) | 693 | struct lpfc_iocbq *rspiocb) |
671 | { | 694 | { |
@@ -695,40 +718,37 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
695 | be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { | 718 | be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) { |
696 | if ((fbits & FC4_FEATURE_INIT) && | 719 | if ((fbits & FC4_FEATURE_INIT) && |
697 | !(fbits & FC4_FEATURE_TARGET)) { | 720 | !(fbits & FC4_FEATURE_TARGET)) { |
698 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 721 | lpfc_printf_vlog(vport, KERN_INFO, |
699 | "%d (%d):0245 Skip x%x GFF " | 722 | LOG_DISCOVERY, |
700 | "NameServer Rsp Data: (init) " | 723 | "0270 Skip x%x GFF " |
701 | "x%x x%x\n", phba->brd_no, | 724 | "NameServer Rsp Data: (init) " |
702 | vport->vpi, did, fbits, | 725 | "x%x x%x\n", did, fbits, |
703 | vport->fc_rscn_id_cnt); | 726 | vport->fc_rscn_id_cnt); |
704 | goto out; | 727 | goto out; |
705 | } | 728 | } |
706 | } | 729 | } |
707 | } | 730 | } |
708 | else { | 731 | else { |
709 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 732 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
710 | "%d (%d):0267 NameServer GFF Rsp" | 733 | "0267 NameServer GFF Rsp " |
711 | " x%x Error (%d %d) Data: x%x x%x\n", | 734 | "x%x Error (%d %d) Data: x%x x%x\n", |
712 | phba->brd_no, vport->vpi, did, | 735 | did, irsp->ulpStatus, irsp->un.ulpWord[4], |
713 | irsp->ulpStatus, irsp->un.ulpWord[4], | 736 | vport->fc_flag, vport->fc_rscn_id_cnt) |
714 | vport->fc_flag, vport->fc_rscn_id_cnt) | ||
715 | } | 737 | } |
716 | 738 | ||
717 | /* This is a target port, unregistered port, or the GFF_ID failed */ | 739 | /* This is a target port, unregistered port, or the GFF_ID failed */ |
718 | ndlp = lpfc_setup_disc_node(vport, did); | 740 | ndlp = lpfc_setup_disc_node(vport, did); |
719 | if (ndlp) { | 741 | if (ndlp) { |
720 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 742 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
721 | "%d (%d):0242 Process x%x GFF " | 743 | "0242 Process x%x GFF " |
722 | "NameServer Rsp Data: x%x x%x x%x\n", | 744 | "NameServer Rsp Data: x%x x%x x%x\n", |
723 | phba->brd_no, vport->vpi, | 745 | did, ndlp->nlp_flag, vport->fc_flag, |
724 | did, ndlp->nlp_flag, vport->fc_flag, | 746 | vport->fc_rscn_id_cnt); |
725 | vport->fc_rscn_id_cnt); | ||
726 | } else { | 747 | } else { |
727 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 748 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
728 | "%d (%d):0243 Skip x%x GFF " | 749 | "0243 Skip x%x GFF " |
729 | "NameServer Rsp Data: x%x x%x\n", | 750 | "NameServer Rsp Data: x%x x%x\n", did, |
730 | phba->brd_no, vport->vpi, did, | 751 | vport->fc_flag, vport->fc_rscn_id_cnt); |
731 | vport->fc_flag, vport->fc_rscn_id_cnt); | ||
732 | } | 752 | } |
733 | out: | 753 | out: |
734 | /* Link up / RSCN discovery */ | 754 | /* Link up / RSCN discovery */ |
@@ -766,10 +786,14 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
766 | struct lpfc_dmabuf *outp; | 786 | struct lpfc_dmabuf *outp; |
767 | IOCB_t *irsp; | 787 | IOCB_t *irsp; |
768 | struct lpfc_sli_ct_request *CTrsp; | 788 | struct lpfc_sli_ct_request *CTrsp; |
789 | struct lpfc_nodelist *ndlp; | ||
769 | int cmdcode, rc; | 790 | int cmdcode, rc; |
770 | uint8_t retry; | 791 | uint8_t retry; |
771 | uint32_t latt; | 792 | uint32_t latt; |
772 | 793 | ||
794 | /* First save ndlp, before we overwrite it */ | ||
795 | ndlp = cmdiocb->context_un.ndlp; | ||
796 | |||
773 | /* we pass cmdiocb to state machine which needs rspiocb as well */ | 797 | /* we pass cmdiocb to state machine which needs rspiocb as well */ |
774 | cmdiocb->context_un.rsp_iocb = rspiocb; | 798 | cmdiocb->context_un.rsp_iocb = rspiocb; |
775 | 799 | ||
@@ -784,22 +808,21 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
784 | latt = lpfc_els_chk_latt(vport); | 808 | latt = lpfc_els_chk_latt(vport); |
785 | 809 | ||
786 | /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */ | 810 | /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */ |
787 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 811 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
788 | "%d (%d):0209 RFT request completes, latt %d, " | 812 | "0209 RFT request completes, latt %d, " |
789 | "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n", | 813 | "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n", |
790 | phba->brd_no, vport->vpi, latt, irsp->ulpStatus, | 814 | latt, irsp->ulpStatus, |
791 | CTrsp->CommandResponse.bits.CmdRsp, | 815 | CTrsp->CommandResponse.bits.CmdRsp, |
792 | cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag); | 816 | cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag); |
793 | 817 | ||
794 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, | 818 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, |
795 | "CT cmd cmpl: status:x%x/x%x cmd:x%x", | 819 | "CT cmd cmpl: status:x%x/x%x cmd:x%x", |
796 | irsp->ulpStatus, irsp->un.ulpWord[4], cmdcode); | 820 | irsp->ulpStatus, irsp->un.ulpWord[4], cmdcode); |
797 | 821 | ||
798 | if (irsp->ulpStatus) { | 822 | if (irsp->ulpStatus) { |
799 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 823 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
800 | "%d (%d):0268 NS cmd %x Error (%d %d)\n", | 824 | "0268 NS cmd %x Error (%d %d)\n", |
801 | phba->brd_no, vport->vpi, cmdcode, | 825 | cmdcode, irsp->ulpStatus, irsp->un.ulpWord[4]); |
802 | irsp->ulpStatus, irsp->un.ulpWord[4]); | ||
803 | 826 | ||
804 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && | 827 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && |
805 | ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) || | 828 | ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) || |
@@ -811,15 +834,15 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
811 | goto out; | 834 | goto out; |
812 | 835 | ||
813 | retry++; | 836 | retry++; |
814 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 837 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
815 | "%d (%d):0216 Retrying NS cmd %x\n", | 838 | "0216 Retrying NS cmd %x\n", cmdcode); |
816 | phba->brd_no, vport->vpi, cmdcode); | ||
817 | rc = lpfc_ns_cmd(vport, cmdcode, retry, 0); | 839 | rc = lpfc_ns_cmd(vport, cmdcode, retry, 0); |
818 | if (rc == 0) | 840 | if (rc == 0) |
819 | goto out; | 841 | goto out; |
820 | } | 842 | } |
821 | 843 | ||
822 | out: | 844 | out: |
845 | cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */ | ||
823 | lpfc_ct_free_iocb(phba, cmdiocb); | 846 | lpfc_ct_free_iocb(phba, cmdiocb); |
824 | return; | 847 | return; |
825 | } | 848 | } |
@@ -862,7 +885,7 @@ lpfc_cmpl_ct_cmd_rff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
862 | return; | 885 | return; |
863 | } | 886 | } |
864 | 887 | ||
865 | int | 888 | static int |
866 | lpfc_vport_symbolic_port_name(struct lpfc_vport *vport, char *symbol, | 889 | lpfc_vport_symbolic_port_name(struct lpfc_vport *vport, char *symbol, |
867 | size_t size) | 890 | size_t size) |
868 | { | 891 | { |
@@ -957,10 +980,9 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, | |||
957 | } | 980 | } |
958 | 981 | ||
959 | /* NameServer Req */ | 982 | /* NameServer Req */ |
960 | lpfc_printf_log(phba, KERN_INFO ,LOG_DISCOVERY, | 983 | lpfc_printf_vlog(vport, KERN_INFO ,LOG_DISCOVERY, |
961 | "%d (%d):0236 NameServer Req Data: x%x x%x x%x\n", | 984 | "0236 NameServer Req Data: x%x x%x x%x\n", |
962 | phba->brd_no, vport->vpi, cmdcode, vport->fc_flag, | 985 | cmdcode, vport->fc_flag, vport->fc_rscn_id_cnt); |
963 | vport->fc_rscn_id_cnt); | ||
964 | 986 | ||
965 | bpl = (struct ulp_bde64 *) bmp->virt; | 987 | bpl = (struct ulp_bde64 *) bmp->virt; |
966 | memset(bpl, 0, sizeof(struct ulp_bde64)); | 988 | memset(bpl, 0, sizeof(struct ulp_bde64)); |
@@ -1059,6 +1081,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, | |||
1059 | cmpl = lpfc_cmpl_ct_cmd_rff_id; | 1081 | cmpl = lpfc_cmpl_ct_cmd_rff_id; |
1060 | break; | 1082 | break; |
1061 | } | 1083 | } |
1084 | lpfc_nlp_get(ndlp); | ||
1062 | 1085 | ||
1063 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) { | 1086 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) { |
1064 | /* On success, The cmpl function will free the buffers */ | 1087 | /* On success, The cmpl function will free the buffers */ |
@@ -1069,6 +1092,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, | |||
1069 | } | 1092 | } |
1070 | 1093 | ||
1071 | rc=6; | 1094 | rc=6; |
1095 | lpfc_nlp_put(ndlp); | ||
1072 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | 1096 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); |
1073 | ns_cmd_free_bmp: | 1097 | ns_cmd_free_bmp: |
1074 | kfree(bmp); | 1098 | kfree(bmp); |
@@ -1077,10 +1101,9 @@ ns_cmd_free_mpvirt: | |||
1077 | ns_cmd_free_mp: | 1101 | ns_cmd_free_mp: |
1078 | kfree(mp); | 1102 | kfree(mp); |
1079 | ns_cmd_exit: | 1103 | ns_cmd_exit: |
1080 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 1104 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
1081 | "%d (%d):0266 Issue NameServer Req x%x err %d Data: x%x x%x\n", | 1105 | "0266 Issue NameServer Req x%x err %d Data: x%x x%x\n", |
1082 | phba->brd_no, vport->vpi, cmdcode, rc, vport->fc_flag, | 1106 | cmdcode, rc, vport->fc_flag, vport->fc_rscn_id_cnt); |
1083 | vport->fc_rscn_id_cnt); | ||
1084 | return 1; | 1107 | return 1; |
1085 | } | 1108 | } |
1086 | 1109 | ||
@@ -1106,12 +1129,11 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1106 | irsp->ulpStatus, irsp->un.ulpWord[4], latt); | 1129 | irsp->ulpStatus, irsp->un.ulpWord[4], latt); |
1107 | 1130 | ||
1108 | if (latt || irsp->ulpStatus) { | 1131 | if (latt || irsp->ulpStatus) { |
1109 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 1132 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
1110 | "%d (%d):0229 FDMI cmd %04x failed, latt = %d " | 1133 | "0229 FDMI cmd %04x failed, latt = %d " |
1111 | "ulpStatus: x%x, rid x%x\n", | 1134 | "ulpStatus: x%x, rid x%x\n", |
1112 | phba->brd_no, vport->vpi, | 1135 | be16_to_cpu(fdmi_cmd), latt, irsp->ulpStatus, |
1113 | be16_to_cpu(fdmi_cmd), latt, irsp->ulpStatus, | 1136 | irsp->un.ulpWord[4]); |
1114 | irsp->un.ulpWord[4]); | ||
1115 | lpfc_ct_free_iocb(phba, cmdiocb); | 1137 | lpfc_ct_free_iocb(phba, cmdiocb); |
1116 | return; | 1138 | return; |
1117 | } | 1139 | } |
@@ -1119,10 +1141,9 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1119 | ndlp = lpfc_findnode_did(vport, FDMI_DID); | 1141 | ndlp = lpfc_findnode_did(vport, FDMI_DID); |
1120 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { | 1142 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { |
1121 | /* FDMI rsp failed */ | 1143 | /* FDMI rsp failed */ |
1122 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 1144 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
1123 | "%d (%d):0220 FDMI rsp failed Data: x%x\n", | 1145 | "0220 FDMI rsp failed Data: x%x\n", |
1124 | phba->brd_no, vport->vpi, | 1146 | be16_to_cpu(fdmi_cmd)); |
1125 | be16_to_cpu(fdmi_cmd)); | ||
1126 | } | 1147 | } |
1127 | 1148 | ||
1128 | switch (be16_to_cpu(fdmi_cmd)) { | 1149 | switch (be16_to_cpu(fdmi_cmd)) { |
@@ -1185,11 +1206,9 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) | |||
1185 | INIT_LIST_HEAD(&bmp->list); | 1206 | INIT_LIST_HEAD(&bmp->list); |
1186 | 1207 | ||
1187 | /* FDMI request */ | 1208 | /* FDMI request */ |
1188 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 1209 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
1189 | "%d (%d):0218 FDMI Request Data: x%x x%x x%x\n", | 1210 | "0218 FDMI Request Data: x%x x%x x%x\n", |
1190 | phba->brd_no, vport->vpi, vport->fc_flag, | 1211 | vport->fc_flag, vport->port_state, cmdcode); |
1191 | vport->port_state, cmdcode); | ||
1192 | |||
1193 | CtReq = (struct lpfc_sli_ct_request *) mp->virt; | 1212 | CtReq = (struct lpfc_sli_ct_request *) mp->virt; |
1194 | 1213 | ||
1195 | memset(CtReq, 0, sizeof(struct lpfc_sli_ct_request)); | 1214 | memset(CtReq, 0, sizeof(struct lpfc_sli_ct_request)); |
@@ -1449,7 +1468,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) | |||
1449 | pab->ab.EntryCnt++; | 1468 | pab->ab.EntryCnt++; |
1450 | size += FOURBYTES + len; | 1469 | size += FOURBYTES + len; |
1451 | 1470 | ||
1452 | if (phba->cfg_fdmi_on == 2) { | 1471 | if (vport->cfg_fdmi_on == 2) { |
1453 | /* #6 Port attribute entry */ | 1472 | /* #6 Port attribute entry */ |
1454 | ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab + | 1473 | ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab + |
1455 | size); | 1474 | size); |
@@ -1499,10 +1518,12 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) | |||
1499 | bpl->tus.w = le32_to_cpu(bpl->tus.w); | 1518 | bpl->tus.w = le32_to_cpu(bpl->tus.w); |
1500 | 1519 | ||
1501 | cmpl = lpfc_cmpl_ct_cmd_fdmi; | 1520 | cmpl = lpfc_cmpl_ct_cmd_fdmi; |
1521 | lpfc_nlp_get(ndlp); | ||
1502 | 1522 | ||
1503 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0)) | 1523 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0)) |
1504 | return 0; | 1524 | return 0; |
1505 | 1525 | ||
1526 | lpfc_nlp_put(ndlp); | ||
1506 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | 1527 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); |
1507 | fdmi_cmd_free_bmp: | 1528 | fdmi_cmd_free_bmp: |
1508 | kfree(bmp); | 1529 | kfree(bmp); |
@@ -1512,9 +1533,9 @@ fdmi_cmd_free_mp: | |||
1512 | kfree(mp); | 1533 | kfree(mp); |
1513 | fdmi_cmd_exit: | 1534 | fdmi_cmd_exit: |
1514 | /* Issue FDMI request failed */ | 1535 | /* Issue FDMI request failed */ |
1515 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 1536 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
1516 | "%d (%d):0244 Issue FDMI request failed Data: x%x\n", | 1537 | "0244 Issue FDMI request failed Data: x%x\n", |
1517 | phba->brd_no, vport->vpi, cmdcode); | 1538 | cmdcode); |
1518 | return 1; | 1539 | return 1; |
1519 | } | 1540 | } |
1520 | 1541 | ||
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 673cfe11cc2b..2e3c01bebed6 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
@@ -71,15 +71,22 @@ | |||
71 | * lpfc_debugfs_mask_disc_trc=Y Where Y is an event mask as defined in | 71 | * lpfc_debugfs_mask_disc_trc=Y Where Y is an event mask as defined in |
72 | * lpfc_debugfs.h . | 72 | * lpfc_debugfs.h . |
73 | */ | 73 | */ |
74 | static int lpfc_debugfs_enable = 0; | 74 | static int lpfc_debugfs_enable = 1; |
75 | module_param(lpfc_debugfs_enable, int, 0); | 75 | module_param(lpfc_debugfs_enable, int, 0); |
76 | MODULE_PARM_DESC(lpfc_debugfs_enable, "Enable debugfs services"); | 76 | MODULE_PARM_DESC(lpfc_debugfs_enable, "Enable debugfs services"); |
77 | 77 | ||
78 | static int lpfc_debugfs_max_disc_trc = 0; /* This MUST be a power of 2 */ | 78 | /* This MUST be a power of 2 */ |
79 | static int lpfc_debugfs_max_disc_trc = 0; | ||
79 | module_param(lpfc_debugfs_max_disc_trc, int, 0); | 80 | module_param(lpfc_debugfs_max_disc_trc, int, 0); |
80 | MODULE_PARM_DESC(lpfc_debugfs_max_disc_trc, | 81 | MODULE_PARM_DESC(lpfc_debugfs_max_disc_trc, |
81 | "Set debugfs discovery trace depth"); | 82 | "Set debugfs discovery trace depth"); |
82 | 83 | ||
84 | /* This MUST be a power of 2 */ | ||
85 | static int lpfc_debugfs_max_slow_ring_trc = 0; | ||
86 | module_param(lpfc_debugfs_max_slow_ring_trc, int, 0); | ||
87 | MODULE_PARM_DESC(lpfc_debugfs_max_slow_ring_trc, | ||
88 | "Set debugfs slow ring trace depth"); | ||
89 | |||
83 | static int lpfc_debugfs_mask_disc_trc = 0; | 90 | static int lpfc_debugfs_mask_disc_trc = 0; |
84 | module_param(lpfc_debugfs_mask_disc_trc, int, 0); | 91 | module_param(lpfc_debugfs_mask_disc_trc, int, 0); |
85 | MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, | 92 | MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, |
@@ -87,28 +94,34 @@ MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, | |||
87 | 94 | ||
88 | #include <linux/debugfs.h> | 95 | #include <linux/debugfs.h> |
89 | 96 | ||
90 | /* size of discovery_trace output line */ | 97 | /* size of output line, for discovery_trace and slow_ring_trace */ |
91 | #define LPFC_DISC_TRC_ENTRY_SIZE 80 | 98 | #define LPFC_DEBUG_TRC_ENTRY_SIZE 100 |
92 | 99 | ||
93 | /* nodelist output buffer size */ | 100 | /* nodelist output buffer size */ |
94 | #define LPFC_NODELIST_SIZE 8192 | 101 | #define LPFC_NODELIST_SIZE 8192 |
95 | #define LPFC_NODELIST_ENTRY_SIZE 120 | 102 | #define LPFC_NODELIST_ENTRY_SIZE 120 |
96 | 103 | ||
104 | /* dumpslim output buffer size */ | ||
105 | #define LPFC_DUMPSLIM_SIZE 4096 | ||
106 | |||
107 | /* hbqinfo output buffer size */ | ||
108 | #define LPFC_HBQINFO_SIZE 8192 | ||
109 | |||
97 | struct lpfc_debug { | 110 | struct lpfc_debug { |
98 | char *buffer; | 111 | char *buffer; |
99 | int len; | 112 | int len; |
100 | }; | 113 | }; |
101 | 114 | ||
102 | atomic_t lpfc_debugfs_disc_trc_cnt = ATOMIC_INIT(0); | 115 | static atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0); |
103 | unsigned long lpfc_debugfs_start_time = 0L; | 116 | static unsigned long lpfc_debugfs_start_time = 0L; |
104 | 117 | ||
105 | static int | 118 | static int |
106 | lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) | 119 | lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) |
107 | { | 120 | { |
108 | int i, index, len, enable; | 121 | int i, index, len, enable; |
109 | uint32_t ms; | 122 | uint32_t ms; |
110 | struct lpfc_disc_trc *dtp; | 123 | struct lpfc_debugfs_trc *dtp; |
111 | char buffer[80]; | 124 | char buffer[LPFC_DEBUG_TRC_ENTRY_SIZE]; |
112 | 125 | ||
113 | 126 | ||
114 | enable = lpfc_debugfs_enable; | 127 | enable = lpfc_debugfs_enable; |
@@ -122,7 +135,8 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) | |||
122 | if (!dtp->fmt) | 135 | if (!dtp->fmt) |
123 | continue; | 136 | continue; |
124 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); | 137 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); |
125 | snprintf(buffer, 80, "%010d:%010d ms:%s\n", | 138 | snprintf(buffer, |
139 | LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", | ||
126 | dtp->seq_cnt, ms, dtp->fmt); | 140 | dtp->seq_cnt, ms, dtp->fmt); |
127 | len += snprintf(buf+len, size-len, buffer, | 141 | len += snprintf(buf+len, size-len, buffer, |
128 | dtp->data1, dtp->data2, dtp->data3); | 142 | dtp->data1, dtp->data2, dtp->data3); |
@@ -132,7 +146,8 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) | |||
132 | if (!dtp->fmt) | 146 | if (!dtp->fmt) |
133 | continue; | 147 | continue; |
134 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); | 148 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); |
135 | snprintf(buffer, 80, "%010d:%010d ms:%s\n", | 149 | snprintf(buffer, |
150 | LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", | ||
136 | dtp->seq_cnt, ms, dtp->fmt); | 151 | dtp->seq_cnt, ms, dtp->fmt); |
137 | len += snprintf(buf+len, size-len, buffer, | 152 | len += snprintf(buf+len, size-len, buffer, |
138 | dtp->data1, dtp->data2, dtp->data3); | 153 | dtp->data1, dtp->data2, dtp->data3); |
@@ -143,6 +158,236 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) | |||
143 | } | 158 | } |
144 | 159 | ||
145 | static int | 160 | static int |
161 | lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size) | ||
162 | { | ||
163 | int i, index, len, enable; | ||
164 | uint32_t ms; | ||
165 | struct lpfc_debugfs_trc *dtp; | ||
166 | char buffer[LPFC_DEBUG_TRC_ENTRY_SIZE]; | ||
167 | |||
168 | |||
169 | enable = lpfc_debugfs_enable; | ||
170 | lpfc_debugfs_enable = 0; | ||
171 | |||
172 | len = 0; | ||
173 | index = (atomic_read(&phba->slow_ring_trc_cnt) + 1) & | ||
174 | (lpfc_debugfs_max_slow_ring_trc - 1); | ||
175 | for (i = index; i < lpfc_debugfs_max_slow_ring_trc; i++) { | ||
176 | dtp = phba->slow_ring_trc + i; | ||
177 | if (!dtp->fmt) | ||
178 | continue; | ||
179 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); | ||
180 | snprintf(buffer, | ||
181 | LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", | ||
182 | dtp->seq_cnt, ms, dtp->fmt); | ||
183 | len += snprintf(buf+len, size-len, buffer, | ||
184 | dtp->data1, dtp->data2, dtp->data3); | ||
185 | } | ||
186 | for (i = 0; i < index; i++) { | ||
187 | dtp = phba->slow_ring_trc + i; | ||
188 | if (!dtp->fmt) | ||
189 | continue; | ||
190 | ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time); | ||
191 | snprintf(buffer, | ||
192 | LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", | ||
193 | dtp->seq_cnt, ms, dtp->fmt); | ||
194 | len += snprintf(buf+len, size-len, buffer, | ||
195 | dtp->data1, dtp->data2, dtp->data3); | ||
196 | } | ||
197 | |||
198 | lpfc_debugfs_enable = enable; | ||
199 | return len; | ||
200 | } | ||
201 | |||
202 | static int lpfc_debugfs_last_hbq = -1; | ||
203 | |||
204 | static int | ||
205 | lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) | ||
206 | { | ||
207 | int len = 0; | ||
208 | int cnt, i, j, found, posted, low; | ||
209 | uint32_t phys, raw_index, getidx; | ||
210 | struct lpfc_hbq_init *hip; | ||
211 | struct hbq_s *hbqs; | ||
212 | struct lpfc_hbq_entry *hbqe; | ||
213 | struct lpfc_dmabuf *d_buf; | ||
214 | struct hbq_dmabuf *hbq_buf; | ||
215 | |||
216 | cnt = LPFC_HBQINFO_SIZE; | ||
217 | spin_lock_irq(&phba->hbalock); | ||
218 | |||
219 | /* toggle between multiple hbqs, if any */ | ||
220 | i = lpfc_sli_hbq_count(); | ||
221 | if (i > 1) { | ||
222 | lpfc_debugfs_last_hbq++; | ||
223 | if (lpfc_debugfs_last_hbq >= i) | ||
224 | lpfc_debugfs_last_hbq = 0; | ||
225 | } | ||
226 | else | ||
227 | lpfc_debugfs_last_hbq = 0; | ||
228 | |||
229 | i = lpfc_debugfs_last_hbq; | ||
230 | |||
231 | len += snprintf(buf+len, size-len, "HBQ %d Info\n", i); | ||
232 | |||
233 | hbqs = &phba->hbqs[i]; | ||
234 | posted = 0; | ||
235 | list_for_each_entry(d_buf, &hbqs->hbq_buffer_list, list) | ||
236 | posted++; | ||
237 | |||
238 | hip = lpfc_hbq_defs[i]; | ||
239 | len += snprintf(buf+len, size-len, | ||
240 | "idx:%d prof:%d rn:%d bufcnt:%d icnt:%d acnt:%d posted %d\n", | ||
241 | hip->hbq_index, hip->profile, hip->rn, | ||
242 | hip->buffer_count, hip->init_count, hip->add_count, posted); | ||
243 | |||
244 | raw_index = phba->hbq_get[i]; | ||
245 | getidx = le32_to_cpu(raw_index); | ||
246 | len += snprintf(buf+len, size-len, | ||
247 | "entrys:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n", | ||
248 | hbqs->entry_count, hbqs->hbqPutIdx, hbqs->next_hbqPutIdx, | ||
249 | hbqs->local_hbqGetIdx, getidx); | ||
250 | |||
251 | hbqe = (struct lpfc_hbq_entry *) phba->hbqs[i].hbq_virt; | ||
252 | for (j=0; j<hbqs->entry_count; j++) { | ||
253 | len += snprintf(buf+len, size-len, | ||
254 | "%03d: %08x %04x %05x ", j, | ||
255 | hbqe->bde.addrLow, hbqe->bde.tus.w, hbqe->buffer_tag); | ||
256 | |||
257 | i = 0; | ||
258 | found = 0; | ||
259 | |||
260 | /* First calculate if slot has an associated posted buffer */ | ||
261 | low = hbqs->hbqPutIdx - posted; | ||
262 | if (low >= 0) { | ||
263 | if ((j >= hbqs->hbqPutIdx) || (j < low)) { | ||
264 | len += snprintf(buf+len, size-len, "Unused\n"); | ||
265 | goto skipit; | ||
266 | } | ||
267 | } | ||
268 | else { | ||
269 | if ((j >= hbqs->hbqPutIdx) && | ||
270 | (j < (hbqs->entry_count+low))) { | ||
271 | len += snprintf(buf+len, size-len, "Unused\n"); | ||
272 | goto skipit; | ||
273 | } | ||
274 | } | ||
275 | |||
276 | /* Get the Buffer info for the posted buffer */ | ||
277 | list_for_each_entry(d_buf, &hbqs->hbq_buffer_list, list) { | ||
278 | hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); | ||
279 | phys = ((uint64_t)hbq_buf->dbuf.phys & 0xffffffff); | ||
280 | if (phys == hbqe->bde.addrLow) { | ||
281 | len += snprintf(buf+len, size-len, | ||
282 | "Buf%d: %p %06x\n", i, | ||
283 | hbq_buf->dbuf.virt, hbq_buf->tag); | ||
284 | found = 1; | ||
285 | break; | ||
286 | } | ||
287 | i++; | ||
288 | } | ||
289 | if (!found) { | ||
290 | len += snprintf(buf+len, size-len, "No DMAinfo?\n"); | ||
291 | } | ||
292 | skipit: | ||
293 | hbqe++; | ||
294 | if (len > LPFC_HBQINFO_SIZE - 54) | ||
295 | break; | ||
296 | } | ||
297 | spin_unlock_irq(&phba->hbalock); | ||
298 | return len; | ||
299 | } | ||
300 | |||
301 | static int | ||
302 | lpfc_debugfs_dumpslim_data(struct lpfc_hba *phba, char *buf, int size) | ||
303 | { | ||
304 | int len = 0; | ||
305 | int cnt, i, off; | ||
306 | uint32_t word0, word1, word2, word3; | ||
307 | uint32_t *ptr; | ||
308 | struct lpfc_pgp *pgpp; | ||
309 | struct lpfc_sli *psli = &phba->sli; | ||
310 | struct lpfc_sli_ring *pring; | ||
311 | |||
312 | cnt = LPFC_DUMPSLIM_SIZE; | ||
313 | off = 0; | ||
314 | spin_lock_irq(&phba->hbalock); | ||
315 | |||
316 | len += snprintf(buf+len, size-len, "SLIM Mailbox\n"); | ||
317 | ptr = (uint32_t *)phba->slim2p; | ||
318 | i = sizeof(MAILBOX_t); | ||
319 | while (i > 0) { | ||
320 | len += snprintf(buf+len, size-len, | ||
321 | "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n", | ||
322 | off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), | ||
323 | *(ptr+5), *(ptr+6), *(ptr+7)); | ||
324 | ptr += 8; | ||
325 | i -= (8 * sizeof(uint32_t)); | ||
326 | off += (8 * sizeof(uint32_t)); | ||
327 | } | ||
328 | |||
329 | len += snprintf(buf+len, size-len, "SLIM PCB\n"); | ||
330 | ptr = (uint32_t *)&phba->slim2p->pcb; | ||
331 | i = sizeof(PCB_t); | ||
332 | while (i > 0) { | ||
333 | len += snprintf(buf+len, size-len, | ||
334 | "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n", | ||
335 | off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), | ||
336 | *(ptr+5), *(ptr+6), *(ptr+7)); | ||
337 | ptr += 8; | ||
338 | i -= (8 * sizeof(uint32_t)); | ||
339 | off += (8 * sizeof(uint32_t)); | ||
340 | } | ||
341 | |||
342 | pgpp = (struct lpfc_pgp *)&phba->slim2p->mbx.us.s3_pgp.port; | ||
343 | pring = &psli->ring[0]; | ||
344 | len += snprintf(buf+len, size-len, | ||
345 | "Ring 0: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) " | ||
346 | "RSP PutInx:%d Max:%d\n", | ||
347 | pgpp->cmdGetInx, pring->numCiocb, | ||
348 | pring->next_cmdidx, pring->local_getidx, pring->flag, | ||
349 | pgpp->rspPutInx, pring->numRiocb); | ||
350 | pgpp++; | ||
351 | |||
352 | pring = &psli->ring[1]; | ||
353 | len += snprintf(buf+len, size-len, | ||
354 | "Ring 1: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) " | ||
355 | "RSP PutInx:%d Max:%d\n", | ||
356 | pgpp->cmdGetInx, pring->numCiocb, | ||
357 | pring->next_cmdidx, pring->local_getidx, pring->flag, | ||
358 | pgpp->rspPutInx, pring->numRiocb); | ||
359 | pgpp++; | ||
360 | |||
361 | pring = &psli->ring[2]; | ||
362 | len += snprintf(buf+len, size-len, | ||
363 | "Ring 2: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) " | ||
364 | "RSP PutInx:%d Max:%d\n", | ||
365 | pgpp->cmdGetInx, pring->numCiocb, | ||
366 | pring->next_cmdidx, pring->local_getidx, pring->flag, | ||
367 | pgpp->rspPutInx, pring->numRiocb); | ||
368 | pgpp++; | ||
369 | |||
370 | pring = &psli->ring[3]; | ||
371 | len += snprintf(buf+len, size-len, | ||
372 | "Ring 3: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) " | ||
373 | "RSP PutInx:%d Max:%d\n", | ||
374 | pgpp->cmdGetInx, pring->numCiocb, | ||
375 | pring->next_cmdidx, pring->local_getidx, pring->flag, | ||
376 | pgpp->rspPutInx, pring->numRiocb); | ||
377 | |||
378 | |||
379 | ptr = (uint32_t *)&phba->slim2p->mbx.us.s3_pgp.hbq_get; | ||
380 | word0 = readl(phba->HAregaddr); | ||
381 | word1 = readl(phba->CAregaddr); | ||
382 | word2 = readl(phba->HSregaddr); | ||
383 | word3 = readl(phba->HCregaddr); | ||
384 | len += snprintf(buf+len, size-len, "HA:%08x CA:%08x HS:%08x HC:%08x\n", | ||
385 | word0, word1, word2, word3); | ||
386 | spin_unlock_irq(&phba->hbalock); | ||
387 | return len; | ||
388 | } | ||
389 | |||
390 | static int | ||
146 | lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) | 391 | lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) |
147 | { | 392 | { |
148 | int len = 0; | 393 | int len = 0; |
@@ -204,7 +449,7 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) | |||
204 | len += snprintf(buf+len, size-len, "RPI:%03d flag:x%08x ", | 449 | len += snprintf(buf+len, size-len, "RPI:%03d flag:x%08x ", |
205 | ndlp->nlp_rpi, ndlp->nlp_flag); | 450 | ndlp->nlp_rpi, ndlp->nlp_flag); |
206 | if (!ndlp->nlp_type) | 451 | if (!ndlp->nlp_type) |
207 | len += snprintf(buf+len, size-len, "UNKNOWN_TYPE"); | 452 | len += snprintf(buf+len, size-len, "UNKNOWN_TYPE "); |
208 | if (ndlp->nlp_type & NLP_FC_NODE) | 453 | if (ndlp->nlp_type & NLP_FC_NODE) |
209 | len += snprintf(buf+len, size-len, "FC_NODE "); | 454 | len += snprintf(buf+len, size-len, "FC_NODE "); |
210 | if (ndlp->nlp_type & NLP_FABRIC) | 455 | if (ndlp->nlp_type & NLP_FABRIC) |
@@ -213,7 +458,9 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) | |||
213 | len += snprintf(buf+len, size-len, "FCP_TGT sid:%d ", | 458 | len += snprintf(buf+len, size-len, "FCP_TGT sid:%d ", |
214 | ndlp->nlp_sid); | 459 | ndlp->nlp_sid); |
215 | if (ndlp->nlp_type & NLP_FCP_INITIATOR) | 460 | if (ndlp->nlp_type & NLP_FCP_INITIATOR) |
216 | len += snprintf(buf+len, size-len, "FCP_INITIATOR"); | 461 | len += snprintf(buf+len, size-len, "FCP_INITIATOR "); |
462 | len += snprintf(buf+len, size-len, "refcnt:%x", | ||
463 | atomic_read(&ndlp->kref.refcount)); | ||
217 | len += snprintf(buf+len, size-len, "\n"); | 464 | len += snprintf(buf+len, size-len, "\n"); |
218 | } | 465 | } |
219 | spin_unlock_irq(shost->host_lock); | 466 | spin_unlock_irq(shost->host_lock); |
@@ -227,7 +474,7 @@ lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt, | |||
227 | uint32_t data1, uint32_t data2, uint32_t data3) | 474 | uint32_t data1, uint32_t data2, uint32_t data3) |
228 | { | 475 | { |
229 | #ifdef CONFIG_LPFC_DEBUG_FS | 476 | #ifdef CONFIG_LPFC_DEBUG_FS |
230 | struct lpfc_disc_trc *dtp; | 477 | struct lpfc_debugfs_trc *dtp; |
231 | int index; | 478 | int index; |
232 | 479 | ||
233 | if (!(lpfc_debugfs_mask_disc_trc & mask)) | 480 | if (!(lpfc_debugfs_mask_disc_trc & mask)) |
@@ -244,7 +491,32 @@ lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt, | |||
244 | dtp->data1 = data1; | 491 | dtp->data1 = data1; |
245 | dtp->data2 = data2; | 492 | dtp->data2 = data2; |
246 | dtp->data3 = data3; | 493 | dtp->data3 = data3; |
247 | dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_disc_trc_cnt); | 494 | dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_seq_trc_cnt); |
495 | dtp->jif = jiffies; | ||
496 | #endif | ||
497 | return; | ||
498 | } | ||
499 | |||
500 | inline void | ||
501 | lpfc_debugfs_slow_ring_trc(struct lpfc_hba *phba, char *fmt, | ||
502 | uint32_t data1, uint32_t data2, uint32_t data3) | ||
503 | { | ||
504 | #ifdef CONFIG_LPFC_DEBUG_FS | ||
505 | struct lpfc_debugfs_trc *dtp; | ||
506 | int index; | ||
507 | |||
508 | if (!lpfc_debugfs_enable || !lpfc_debugfs_max_slow_ring_trc || | ||
509 | !phba || !phba->slow_ring_trc) | ||
510 | return; | ||
511 | |||
512 | index = atomic_inc_return(&phba->slow_ring_trc_cnt) & | ||
513 | (lpfc_debugfs_max_slow_ring_trc - 1); | ||
514 | dtp = phba->slow_ring_trc + index; | ||
515 | dtp->fmt = fmt; | ||
516 | dtp->data1 = data1; | ||
517 | dtp->data2 = data2; | ||
518 | dtp->data3 = data3; | ||
519 | dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_seq_trc_cnt); | ||
248 | dtp->jif = jiffies; | 520 | dtp->jif = jiffies; |
249 | #endif | 521 | #endif |
250 | return; | 522 | return; |
@@ -269,7 +541,7 @@ lpfc_debugfs_disc_trc_open(struct inode *inode, struct file *file) | |||
269 | goto out; | 541 | goto out; |
270 | 542 | ||
271 | /* Round to page boundry */ | 543 | /* Round to page boundry */ |
272 | size = (lpfc_debugfs_max_disc_trc * LPFC_DISC_TRC_ENTRY_SIZE); | 544 | size = (lpfc_debugfs_max_disc_trc * LPFC_DEBUG_TRC_ENTRY_SIZE); |
273 | size = PAGE_ALIGN(size); | 545 | size = PAGE_ALIGN(size); |
274 | 546 | ||
275 | debug->buffer = kmalloc(size, GFP_KERNEL); | 547 | debug->buffer = kmalloc(size, GFP_KERNEL); |
@@ -287,6 +559,95 @@ out: | |||
287 | } | 559 | } |
288 | 560 | ||
289 | static int | 561 | static int |
562 | lpfc_debugfs_slow_ring_trc_open(struct inode *inode, struct file *file) | ||
563 | { | ||
564 | struct lpfc_hba *phba = inode->i_private; | ||
565 | struct lpfc_debug *debug; | ||
566 | int size; | ||
567 | int rc = -ENOMEM; | ||
568 | |||
569 | if (!lpfc_debugfs_max_slow_ring_trc) { | ||
570 | rc = -ENOSPC; | ||
571 | goto out; | ||
572 | } | ||
573 | |||
574 | debug = kmalloc(sizeof(*debug), GFP_KERNEL); | ||
575 | if (!debug) | ||
576 | goto out; | ||
577 | |||
578 | /* Round to page boundry */ | ||
579 | size = (lpfc_debugfs_max_slow_ring_trc * LPFC_DEBUG_TRC_ENTRY_SIZE); | ||
580 | size = PAGE_ALIGN(size); | ||
581 | |||
582 | debug->buffer = kmalloc(size, GFP_KERNEL); | ||
583 | if (!debug->buffer) { | ||
584 | kfree(debug); | ||
585 | goto out; | ||
586 | } | ||
587 | |||
588 | debug->len = lpfc_debugfs_slow_ring_trc_data(phba, debug->buffer, size); | ||
589 | file->private_data = debug; | ||
590 | |||
591 | rc = 0; | ||
592 | out: | ||
593 | return rc; | ||
594 | } | ||
595 | |||
596 | static int | ||
597 | lpfc_debugfs_hbqinfo_open(struct inode *inode, struct file *file) | ||
598 | { | ||
599 | struct lpfc_hba *phba = inode->i_private; | ||
600 | struct lpfc_debug *debug; | ||
601 | int rc = -ENOMEM; | ||
602 | |||
603 | debug = kmalloc(sizeof(*debug), GFP_KERNEL); | ||
604 | if (!debug) | ||
605 | goto out; | ||
606 | |||
607 | /* Round to page boundry */ | ||
608 | debug->buffer = kmalloc(LPFC_HBQINFO_SIZE, GFP_KERNEL); | ||
609 | if (!debug->buffer) { | ||
610 | kfree(debug); | ||
611 | goto out; | ||
612 | } | ||
613 | |||
614 | debug->len = lpfc_debugfs_hbqinfo_data(phba, debug->buffer, | ||
615 | LPFC_HBQINFO_SIZE); | ||
616 | file->private_data = debug; | ||
617 | |||
618 | rc = 0; | ||
619 | out: | ||
620 | return rc; | ||
621 | } | ||
622 | |||
623 | static int | ||
624 | lpfc_debugfs_dumpslim_open(struct inode *inode, struct file *file) | ||
625 | { | ||
626 | struct lpfc_hba *phba = inode->i_private; | ||
627 | struct lpfc_debug *debug; | ||
628 | int rc = -ENOMEM; | ||
629 | |||
630 | debug = kmalloc(sizeof(*debug), GFP_KERNEL); | ||
631 | if (!debug) | ||
632 | goto out; | ||
633 | |||
634 | /* Round to page boundry */ | ||
635 | debug->buffer = kmalloc(LPFC_DUMPSLIM_SIZE, GFP_KERNEL); | ||
636 | if (!debug->buffer) { | ||
637 | kfree(debug); | ||
638 | goto out; | ||
639 | } | ||
640 | |||
641 | debug->len = lpfc_debugfs_dumpslim_data(phba, debug->buffer, | ||
642 | LPFC_DUMPSLIM_SIZE); | ||
643 | file->private_data = debug; | ||
644 | |||
645 | rc = 0; | ||
646 | out: | ||
647 | return rc; | ||
648 | } | ||
649 | |||
650 | static int | ||
290 | lpfc_debugfs_nodelist_open(struct inode *inode, struct file *file) | 651 | lpfc_debugfs_nodelist_open(struct inode *inode, struct file *file) |
291 | { | 652 | { |
292 | struct lpfc_vport *vport = inode->i_private; | 653 | struct lpfc_vport *vport = inode->i_private; |
@@ -372,6 +733,33 @@ static struct file_operations lpfc_debugfs_op_nodelist = { | |||
372 | .release = lpfc_debugfs_release, | 733 | .release = lpfc_debugfs_release, |
373 | }; | 734 | }; |
374 | 735 | ||
736 | #undef lpfc_debugfs_op_hbqinfo | ||
737 | static struct file_operations lpfc_debugfs_op_hbqinfo = { | ||
738 | .owner = THIS_MODULE, | ||
739 | .open = lpfc_debugfs_hbqinfo_open, | ||
740 | .llseek = lpfc_debugfs_lseek, | ||
741 | .read = lpfc_debugfs_read, | ||
742 | .release = lpfc_debugfs_release, | ||
743 | }; | ||
744 | |||
745 | #undef lpfc_debugfs_op_dumpslim | ||
746 | static struct file_operations lpfc_debugfs_op_dumpslim = { | ||
747 | .owner = THIS_MODULE, | ||
748 | .open = lpfc_debugfs_dumpslim_open, | ||
749 | .llseek = lpfc_debugfs_lseek, | ||
750 | .read = lpfc_debugfs_read, | ||
751 | .release = lpfc_debugfs_release, | ||
752 | }; | ||
753 | |||
754 | #undef lpfc_debugfs_op_slow_ring_trc | ||
755 | static struct file_operations lpfc_debugfs_op_slow_ring_trc = { | ||
756 | .owner = THIS_MODULE, | ||
757 | .open = lpfc_debugfs_slow_ring_trc_open, | ||
758 | .llseek = lpfc_debugfs_lseek, | ||
759 | .read = lpfc_debugfs_read, | ||
760 | .release = lpfc_debugfs_release, | ||
761 | }; | ||
762 | |||
375 | static struct dentry *lpfc_debugfs_root = NULL; | 763 | static struct dentry *lpfc_debugfs_root = NULL; |
376 | static atomic_t lpfc_debugfs_hba_count; | 764 | static atomic_t lpfc_debugfs_hba_count; |
377 | #endif | 765 | #endif |
@@ -387,60 +775,146 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) | |||
387 | if (!lpfc_debugfs_enable) | 775 | if (!lpfc_debugfs_enable) |
388 | return; | 776 | return; |
389 | 777 | ||
390 | if (lpfc_debugfs_max_disc_trc) { | 778 | /* Setup lpfc root directory */ |
391 | num = lpfc_debugfs_max_disc_trc - 1; | ||
392 | if (num & lpfc_debugfs_max_disc_trc) { | ||
393 | /* Change to be a power of 2 */ | ||
394 | num = lpfc_debugfs_max_disc_trc; | ||
395 | i = 0; | ||
396 | while (num > 1) { | ||
397 | num = num >> 1; | ||
398 | i++; | ||
399 | } | ||
400 | lpfc_debugfs_max_disc_trc = (1 << i); | ||
401 | printk(KERN_ERR | ||
402 | "lpfc_debugfs_max_disc_trc changed to %d\n", | ||
403 | lpfc_debugfs_max_disc_trc); | ||
404 | } | ||
405 | } | ||
406 | |||
407 | if (!lpfc_debugfs_root) { | 779 | if (!lpfc_debugfs_root) { |
408 | lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL); | 780 | lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL); |
409 | atomic_set(&lpfc_debugfs_hba_count, 0); | 781 | atomic_set(&lpfc_debugfs_hba_count, 0); |
410 | if (!lpfc_debugfs_root) | 782 | if (!lpfc_debugfs_root) { |
783 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
784 | "0409 Cannot create debugfs root\n"); | ||
411 | goto debug_failed; | 785 | goto debug_failed; |
786 | } | ||
412 | } | 787 | } |
788 | if (!lpfc_debugfs_start_time) | ||
789 | lpfc_debugfs_start_time = jiffies; | ||
413 | 790 | ||
791 | /* Setup lpfcX directory for specific HBA */ | ||
414 | snprintf(name, sizeof(name), "lpfc%d", phba->brd_no); | 792 | snprintf(name, sizeof(name), "lpfc%d", phba->brd_no); |
415 | if (!phba->hba_debugfs_root) { | 793 | if (!phba->hba_debugfs_root) { |
416 | phba->hba_debugfs_root = | 794 | phba->hba_debugfs_root = |
417 | debugfs_create_dir(name, lpfc_debugfs_root); | 795 | debugfs_create_dir(name, lpfc_debugfs_root); |
418 | if (!phba->hba_debugfs_root) | 796 | if (!phba->hba_debugfs_root) { |
797 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
798 | "0409 Cannot create debugfs hba\n"); | ||
419 | goto debug_failed; | 799 | goto debug_failed; |
800 | } | ||
420 | atomic_inc(&lpfc_debugfs_hba_count); | 801 | atomic_inc(&lpfc_debugfs_hba_count); |
421 | atomic_set(&phba->debugfs_vport_count, 0); | 802 | atomic_set(&phba->debugfs_vport_count, 0); |
803 | |||
804 | /* Setup hbqinfo */ | ||
805 | snprintf(name, sizeof(name), "hbqinfo"); | ||
806 | phba->debug_hbqinfo = | ||
807 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
808 | phba->hba_debugfs_root, | ||
809 | phba, &lpfc_debugfs_op_hbqinfo); | ||
810 | if (!phba->debug_hbqinfo) { | ||
811 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
812 | "0409 Cannot create debugfs hbqinfo\n"); | ||
813 | goto debug_failed; | ||
814 | } | ||
815 | |||
816 | /* Setup dumpslim */ | ||
817 | snprintf(name, sizeof(name), "dumpslim"); | ||
818 | phba->debug_dumpslim = | ||
819 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
820 | phba->hba_debugfs_root, | ||
821 | phba, &lpfc_debugfs_op_dumpslim); | ||
822 | if (!phba->debug_dumpslim) { | ||
823 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
824 | "0409 Cannot create debugfs dumpslim\n"); | ||
825 | goto debug_failed; | ||
826 | } | ||
827 | |||
828 | /* Setup slow ring trace */ | ||
829 | if (lpfc_debugfs_max_slow_ring_trc) { | ||
830 | num = lpfc_debugfs_max_slow_ring_trc - 1; | ||
831 | if (num & lpfc_debugfs_max_slow_ring_trc) { | ||
832 | /* Change to be a power of 2 */ | ||
833 | num = lpfc_debugfs_max_slow_ring_trc; | ||
834 | i = 0; | ||
835 | while (num > 1) { | ||
836 | num = num >> 1; | ||
837 | i++; | ||
838 | } | ||
839 | lpfc_debugfs_max_slow_ring_trc = (1 << i); | ||
840 | printk(KERN_ERR | ||
841 | "lpfc_debugfs_max_disc_trc changed to " | ||
842 | "%d\n", lpfc_debugfs_max_disc_trc); | ||
843 | } | ||
844 | } | ||
845 | |||
846 | |||
847 | snprintf(name, sizeof(name), "slow_ring_trace"); | ||
848 | phba->debug_slow_ring_trc = | ||
849 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
850 | phba->hba_debugfs_root, | ||
851 | phba, &lpfc_debugfs_op_slow_ring_trc); | ||
852 | if (!phba->debug_slow_ring_trc) { | ||
853 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
854 | "0409 Cannot create debugfs " | ||
855 | "slow_ring_trace\n"); | ||
856 | goto debug_failed; | ||
857 | } | ||
858 | if (!phba->slow_ring_trc) { | ||
859 | phba->slow_ring_trc = kmalloc( | ||
860 | (sizeof(struct lpfc_debugfs_trc) * | ||
861 | lpfc_debugfs_max_slow_ring_trc), | ||
862 | GFP_KERNEL); | ||
863 | if (!phba->slow_ring_trc) { | ||
864 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
865 | "0409 Cannot create debugfs " | ||
866 | "slow_ring buffer\n"); | ||
867 | goto debug_failed; | ||
868 | } | ||
869 | atomic_set(&phba->slow_ring_trc_cnt, 0); | ||
870 | memset(phba->slow_ring_trc, 0, | ||
871 | (sizeof(struct lpfc_debugfs_trc) * | ||
872 | lpfc_debugfs_max_slow_ring_trc)); | ||
873 | } | ||
422 | } | 874 | } |
423 | 875 | ||
424 | snprintf(name, sizeof(name), "vport%d", vport->vpi); | 876 | snprintf(name, sizeof(name), "vport%d", vport->vpi); |
425 | if (!vport->vport_debugfs_root) { | 877 | if (!vport->vport_debugfs_root) { |
426 | vport->vport_debugfs_root = | 878 | vport->vport_debugfs_root = |
427 | debugfs_create_dir(name, phba->hba_debugfs_root); | 879 | debugfs_create_dir(name, phba->hba_debugfs_root); |
428 | if (!vport->vport_debugfs_root) | 880 | if (!vport->vport_debugfs_root) { |
881 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
882 | "0409 Cant create debugfs"); | ||
429 | goto debug_failed; | 883 | goto debug_failed; |
884 | } | ||
430 | atomic_inc(&phba->debugfs_vport_count); | 885 | atomic_inc(&phba->debugfs_vport_count); |
431 | } | 886 | } |
432 | 887 | ||
433 | if (!lpfc_debugfs_start_time) | 888 | if (lpfc_debugfs_max_disc_trc) { |
434 | lpfc_debugfs_start_time = jiffies; | 889 | num = lpfc_debugfs_max_disc_trc - 1; |
890 | if (num & lpfc_debugfs_max_disc_trc) { | ||
891 | /* Change to be a power of 2 */ | ||
892 | num = lpfc_debugfs_max_disc_trc; | ||
893 | i = 0; | ||
894 | while (num > 1) { | ||
895 | num = num >> 1; | ||
896 | i++; | ||
897 | } | ||
898 | lpfc_debugfs_max_disc_trc = (1 << i); | ||
899 | printk(KERN_ERR | ||
900 | "lpfc_debugfs_max_disc_trc changed to %d\n", | ||
901 | lpfc_debugfs_max_disc_trc); | ||
902 | } | ||
903 | } | ||
435 | 904 | ||
436 | vport->disc_trc = kmalloc( | 905 | vport->disc_trc = kmalloc( |
437 | (sizeof(struct lpfc_disc_trc) * lpfc_debugfs_max_disc_trc), | 906 | (sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc), |
438 | GFP_KERNEL); | 907 | GFP_KERNEL); |
439 | 908 | ||
440 | if (!vport->disc_trc) | 909 | if (!vport->disc_trc) { |
910 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
911 | "0409 Cannot create debugfs disc trace " | ||
912 | "buffer\n"); | ||
441 | goto debug_failed; | 913 | goto debug_failed; |
914 | } | ||
915 | atomic_set(&vport->disc_trc_cnt, 0); | ||
442 | memset(vport->disc_trc, 0, | 916 | memset(vport->disc_trc, 0, |
443 | (sizeof(struct lpfc_disc_trc) * lpfc_debugfs_max_disc_trc)); | 917 | (sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc)); |
444 | 918 | ||
445 | snprintf(name, sizeof(name), "discovery_trace"); | 919 | snprintf(name, sizeof(name), "discovery_trace"); |
446 | vport->debug_disc_trc = | 920 | vport->debug_disc_trc = |
@@ -448,9 +922,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) | |||
448 | vport->vport_debugfs_root, | 922 | vport->vport_debugfs_root, |
449 | vport, &lpfc_debugfs_op_disc_trc); | 923 | vport, &lpfc_debugfs_op_disc_trc); |
450 | if (!vport->debug_disc_trc) { | 924 | if (!vport->debug_disc_trc) { |
451 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 925 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
452 | "%d:0409 Cannot create debugfs", | 926 | "0409 Cannot create debugfs " |
453 | phba->brd_no); | 927 | "discovery_trace\n"); |
454 | goto debug_failed; | 928 | goto debug_failed; |
455 | } | 929 | } |
456 | snprintf(name, sizeof(name), "nodelist"); | 930 | snprintf(name, sizeof(name), "nodelist"); |
@@ -459,9 +933,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) | |||
459 | vport->vport_debugfs_root, | 933 | vport->vport_debugfs_root, |
460 | vport, &lpfc_debugfs_op_nodelist); | 934 | vport, &lpfc_debugfs_op_nodelist); |
461 | if (!vport->debug_nodelist) { | 935 | if (!vport->debug_nodelist) { |
462 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 936 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
463 | "%d:0409 Cannot create debugfs", | 937 | "0409 Cant create debugfs nodelist"); |
464 | phba->brd_no); | ||
465 | goto debug_failed; | 938 | goto debug_failed; |
466 | } | 939 | } |
467 | debug_failed: | 940 | debug_failed: |
@@ -488,21 +961,45 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport) | |||
488 | debugfs_remove(vport->debug_nodelist); /* nodelist */ | 961 | debugfs_remove(vport->debug_nodelist); /* nodelist */ |
489 | vport->debug_nodelist = NULL; | 962 | vport->debug_nodelist = NULL; |
490 | } | 963 | } |
964 | |||
491 | if (vport->vport_debugfs_root) { | 965 | if (vport->vport_debugfs_root) { |
492 | debugfs_remove(vport->vport_debugfs_root); /* vportX */ | 966 | debugfs_remove(vport->vport_debugfs_root); /* vportX */ |
493 | vport->vport_debugfs_root = NULL; | 967 | vport->vport_debugfs_root = NULL; |
494 | atomic_dec(&phba->debugfs_vport_count); | 968 | atomic_dec(&phba->debugfs_vport_count); |
495 | } | 969 | } |
496 | if (atomic_read(&phba->debugfs_vport_count) == 0) { | 970 | if (atomic_read(&phba->debugfs_vport_count) == 0) { |
497 | debugfs_remove(vport->phba->hba_debugfs_root); /* lpfcX */ | 971 | |
498 | vport->phba->hba_debugfs_root = NULL; | 972 | if (phba->debug_hbqinfo) { |
499 | atomic_dec(&lpfc_debugfs_hba_count); | 973 | debugfs_remove(phba->debug_hbqinfo); /* hbqinfo */ |
974 | phba->debug_hbqinfo = NULL; | ||
975 | } | ||
976 | if (phba->debug_dumpslim) { | ||
977 | debugfs_remove(phba->debug_dumpslim); /* dumpslim */ | ||
978 | phba->debug_dumpslim = NULL; | ||
979 | } | ||
980 | if (phba->slow_ring_trc) { | ||
981 | kfree(phba->slow_ring_trc); | ||
982 | phba->slow_ring_trc = NULL; | ||
983 | } | ||
984 | if (phba->debug_slow_ring_trc) { | ||
985 | /* slow_ring_trace */ | ||
986 | debugfs_remove(phba->debug_slow_ring_trc); | ||
987 | phba->debug_slow_ring_trc = NULL; | ||
988 | } | ||
989 | |||
990 | if (phba->hba_debugfs_root) { | ||
991 | debugfs_remove(phba->hba_debugfs_root); /* lpfcX */ | ||
992 | phba->hba_debugfs_root = NULL; | ||
993 | atomic_dec(&lpfc_debugfs_hba_count); | ||
994 | } | ||
995 | |||
500 | if (atomic_read(&lpfc_debugfs_hba_count) == 0) { | 996 | if (atomic_read(&lpfc_debugfs_hba_count) == 0) { |
501 | debugfs_remove(lpfc_debugfs_root); /* lpfc */ | 997 | debugfs_remove(lpfc_debugfs_root); /* lpfc */ |
502 | lpfc_debugfs_root = NULL; | 998 | lpfc_debugfs_root = NULL; |
503 | } | 999 | } |
504 | } | 1000 | } |
505 | #endif | 1001 | #endif |
1002 | return; | ||
506 | } | 1003 | } |
507 | 1004 | ||
508 | 1005 | ||
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h index fffb678426a4..31e86a55391d 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.h +++ b/drivers/scsi/lpfc/lpfc_debugfs.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #define _H_LPFC_DEBUG_FS | 22 | #define _H_LPFC_DEBUG_FS |
23 | 23 | ||
24 | #ifdef CONFIG_LPFC_DEBUG_FS | 24 | #ifdef CONFIG_LPFC_DEBUG_FS |
25 | struct lpfc_disc_trc { | 25 | struct lpfc_debugfs_trc { |
26 | char *fmt; | 26 | char *fmt; |
27 | uint32_t data1; | 27 | uint32_t data1; |
28 | uint32_t data2; | 28 | uint32_t data2; |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 33fbc1666946..8085900635d4 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -63,10 +63,10 @@ lpfc_els_chk_latt(struct lpfc_vport *vport) | |||
63 | return 0; | 63 | return 0; |
64 | 64 | ||
65 | /* Pending Link Event during Discovery */ | 65 | /* Pending Link Event during Discovery */ |
66 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 66 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
67 | "%d (%d):0237 Pending Link Event during " | 67 | "0237 Pending Link Event during " |
68 | "Discovery: State x%x\n", | 68 | "Discovery: State x%x\n", |
69 | phba->brd_no, vport->vpi, phba->pport->port_state); | 69 | phba->pport->port_state); |
70 | 70 | ||
71 | /* CLEAR_LA should re-enable link attention events and | 71 | /* CLEAR_LA should re-enable link attention events and |
72 | * we should then imediately take a LATT event. The | 72 | * we should then imediately take a LATT event. The |
@@ -196,9 +196,7 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp, | |||
196 | bpl->tus.w = le32_to_cpu(bpl->tus.w); | 196 | bpl->tus.w = le32_to_cpu(bpl->tus.w); |
197 | } | 197 | } |
198 | 198 | ||
199 | /* Save for completion so we can release these resources */ | 199 | elsiocb->context1 = lpfc_nlp_get(ndlp); |
200 | if (elscmd != ELS_CMD_LS_RJT) | ||
201 | elsiocb->context1 = lpfc_nlp_get(ndlp); | ||
202 | elsiocb->context2 = pcmd; | 200 | elsiocb->context2 = pcmd; |
203 | elsiocb->context3 = pbuflist; | 201 | elsiocb->context3 = pbuflist; |
204 | elsiocb->retry = retry; | 202 | elsiocb->retry = retry; |
@@ -208,23 +206,21 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp, | |||
208 | if (prsp) { | 206 | if (prsp) { |
209 | list_add(&prsp->list, &pcmd->list); | 207 | list_add(&prsp->list, &pcmd->list); |
210 | } | 208 | } |
211 | |||
212 | if (expectRsp) { | 209 | if (expectRsp) { |
213 | /* Xmit ELS command <elsCmd> to remote NPORT <did> */ | 210 | /* Xmit ELS command <elsCmd> to remote NPORT <did> */ |
214 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 211 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
215 | "%d (%d):0116 Xmit ELS command x%x to remote " | 212 | "0116 Xmit ELS command x%x to remote " |
216 | "NPORT x%x I/O tag: x%x, port state: x%x\n", | 213 | "NPORT x%x I/O tag: x%x, port state: x%x\n", |
217 | phba->brd_no, vport->vpi, elscmd, did, | 214 | elscmd, did, elsiocb->iotag, |
218 | elsiocb->iotag, vport->port_state); | 215 | vport->port_state); |
219 | } else { | 216 | } else { |
220 | /* Xmit ELS response <elsCmd> to remote NPORT <did> */ | 217 | /* Xmit ELS response <elsCmd> to remote NPORT <did> */ |
221 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 218 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
222 | "%d (%d):0117 Xmit ELS response x%x to remote " | 219 | "0117 Xmit ELS response x%x to remote " |
223 | "NPORT x%x I/O tag: x%x, size: x%x\n", | 220 | "NPORT x%x I/O tag: x%x, size: x%x\n", |
224 | phba->brd_no, vport->vpi, elscmd, | 221 | elscmd, ndlp->nlp_DID, elsiocb->iotag, |
225 | ndlp->nlp_DID, elsiocb->iotag, cmdSize); | 222 | cmdSize); |
226 | } | 223 | } |
227 | |||
228 | return elsiocb; | 224 | return elsiocb; |
229 | } | 225 | } |
230 | 226 | ||
@@ -285,9 +281,8 @@ fail_free_mbox: | |||
285 | 281 | ||
286 | fail: | 282 | fail: |
287 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 283 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
288 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 284 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
289 | "%d (%d):0249 Cannot issue Register Fabric login\n", | 285 | "0249 Cannot issue Register Fabric login\n"); |
290 | phba->brd_no, vport->vpi); | ||
291 | return -ENXIO; | 286 | return -ENXIO; |
292 | } | 287 | } |
293 | 288 | ||
@@ -340,20 +335,19 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
340 | 335 | ||
341 | if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) { | 336 | if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) { |
342 | if (sp->cmn.response_multiple_NPort) { | 337 | if (sp->cmn.response_multiple_NPort) { |
343 | lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_VPORT, | 338 | lpfc_printf_vlog(vport, KERN_WARNING, |
344 | "%d:1816 FLOGI NPIV supported, " | 339 | LOG_ELS | LOG_VPORT, |
345 | "response data 0x%x\n", | 340 | "1816 FLOGI NPIV supported, " |
346 | phba->brd_no, | 341 | "response data 0x%x\n", |
347 | sp->cmn.response_multiple_NPort); | 342 | sp->cmn.response_multiple_NPort); |
348 | phba->link_flag |= LS_NPIV_FAB_SUPPORTED; | 343 | phba->link_flag |= LS_NPIV_FAB_SUPPORTED; |
349 | |||
350 | } else { | 344 | } else { |
351 | /* Because we asked f/w for NPIV it still expects us | 345 | /* Because we asked f/w for NPIV it still expects us |
352 | to call reg_vnpid atleast for the physcial host */ | 346 | to call reg_vnpid atleast for the physcial host */ |
353 | lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_VPORT, | 347 | lpfc_printf_vlog(vport, KERN_WARNING, |
354 | "%d:1817 Fabric does not support NPIV " | 348 | LOG_ELS | LOG_VPORT, |
355 | "- configuring single port mode.\n", | 349 | "1817 Fabric does not support NPIV " |
356 | phba->brd_no); | 350 | "- configuring single port mode.\n"); |
357 | phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED; | 351 | phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED; |
358 | } | 352 | } |
359 | } | 353 | } |
@@ -518,16 +512,15 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
518 | * alpa map would take too long otherwise. | 512 | * alpa map would take too long otherwise. |
519 | */ | 513 | */ |
520 | if (phba->alpa_map[0] == 0) { | 514 | if (phba->alpa_map[0] == 0) { |
521 | phba->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; | 515 | vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; |
522 | } | 516 | } |
523 | 517 | ||
524 | /* FLOGI failure */ | 518 | /* FLOGI failure */ |
525 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 519 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
526 | "%d (%d):0100 FLOGI failure Data: x%x x%x " | 520 | "0100 FLOGI failure Data: x%x x%x " |
527 | "x%x\n", | 521 | "x%x\n", |
528 | phba->brd_no, vport->vpi, | 522 | irsp->ulpStatus, irsp->un.ulpWord[4], |
529 | irsp->ulpStatus, irsp->un.ulpWord[4], | 523 | irsp->ulpTimeout); |
530 | irsp->ulpTimeout); | ||
531 | goto flogifail; | 524 | goto flogifail; |
532 | } | 525 | } |
533 | 526 | ||
@@ -540,12 +533,11 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
540 | sp = prsp->virt + sizeof(uint32_t); | 533 | sp = prsp->virt + sizeof(uint32_t); |
541 | 534 | ||
542 | /* FLOGI completes successfully */ | 535 | /* FLOGI completes successfully */ |
543 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 536 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
544 | "%d (%d):0101 FLOGI completes sucessfully " | 537 | "0101 FLOGI completes sucessfully " |
545 | "Data: x%x x%x x%x x%x\n", | 538 | "Data: x%x x%x x%x x%x\n", |
546 | phba->brd_no, vport->vpi, | 539 | irsp->un.ulpWord[4], sp->cmn.e_d_tov, |
547 | irsp->un.ulpWord[4], sp->cmn.e_d_tov, | 540 | sp->cmn.w2.r_a_tov, sp->cmn.edtovResolution); |
548 | sp->cmn.w2.r_a_tov, sp->cmn.edtovResolution); | ||
549 | 541 | ||
550 | if (vport->port_state == LPFC_FLOGI) { | 542 | if (vport->port_state == LPFC_FLOGI) { |
551 | /* | 543 | /* |
@@ -662,8 +654,8 @@ lpfc_els_abort_flogi(struct lpfc_hba *phba) | |||
662 | 654 | ||
663 | /* Abort outstanding I/O on NPort <nlp_DID> */ | 655 | /* Abort outstanding I/O on NPort <nlp_DID> */ |
664 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 656 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
665 | "%d:0201 Abort outstanding I/O on NPort x%x\n", | 657 | "0201 Abort outstanding I/O on NPort x%x\n", |
666 | phba->brd_no, Fabric_DID); | 658 | Fabric_DID); |
667 | 659 | ||
668 | pring = &phba->sli.ring[LPFC_ELS_RING]; | 660 | pring = &phba->sli.ring[LPFC_ELS_RING]; |
669 | 661 | ||
@@ -736,18 +728,16 @@ static void | |||
736 | lpfc_more_plogi(struct lpfc_vport *vport) | 728 | lpfc_more_plogi(struct lpfc_vport *vport) |
737 | { | 729 | { |
738 | int sentplogi; | 730 | int sentplogi; |
739 | struct lpfc_hba *phba = vport->phba; | ||
740 | 731 | ||
741 | if (vport->num_disc_nodes) | 732 | if (vport->num_disc_nodes) |
742 | vport->num_disc_nodes--; | 733 | vport->num_disc_nodes--; |
743 | 734 | ||
744 | /* Continue discovery with <num_disc_nodes> PLOGIs to go */ | 735 | /* Continue discovery with <num_disc_nodes> PLOGIs to go */ |
745 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 736 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
746 | "%d (%d):0232 Continue discovery with %d PLOGIs to go " | 737 | "0232 Continue discovery with %d PLOGIs to go " |
747 | "Data: x%x x%x x%x\n", | 738 | "Data: x%x x%x x%x\n", |
748 | phba->brd_no, vport->vpi, vport->num_disc_nodes, | 739 | vport->num_disc_nodes, vport->fc_plogi_cnt, |
749 | vport->fc_plogi_cnt, vport->fc_flag, vport->port_state); | 740 | vport->fc_flag, vport->port_state); |
750 | |||
751 | /* Check to see if there are more PLOGIs to be sent */ | 741 | /* Check to see if there are more PLOGIs to be sent */ |
752 | if (vport->fc_flag & FC_NLP_MORE) | 742 | if (vport->fc_flag & FC_NLP_MORE) |
753 | /* go thru NPR nodes and issue any remaining ELS PLOGIs */ | 743 | /* go thru NPR nodes and issue any remaining ELS PLOGIs */ |
@@ -833,11 +823,12 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
833 | 823 | ||
834 | ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID); | 824 | ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID); |
835 | if (!ndlp) { | 825 | if (!ndlp) { |
836 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 826 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
837 | "%d (%d):0136 PLOGI completes to NPort x%x " | 827 | "0136 PLOGI completes to NPort x%x " |
838 | "with no ndlp. Data: x%x x%x x%x\n", | 828 | "with no ndlp. Data: x%x x%x x%x\n", |
839 | phba->brd_no, vport->vpi, irsp->un.elsreq64.remoteID, | 829 | irsp->un.elsreq64.remoteID, |
840 | irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpIoTag); | 830 | irsp->ulpStatus, irsp->un.ulpWord[4], |
831 | irsp->ulpIoTag); | ||
841 | goto out; | 832 | goto out; |
842 | } | 833 | } |
843 | 834 | ||
@@ -851,13 +842,11 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
851 | rc = 0; | 842 | rc = 0; |
852 | 843 | ||
853 | /* PLOGI completes to NPort <nlp_DID> */ | 844 | /* PLOGI completes to NPort <nlp_DID> */ |
854 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 845 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
855 | "%d (%d):0102 PLOGI completes to NPort x%x " | 846 | "0102 PLOGI completes to NPort x%x " |
856 | "Data: x%x x%x x%x x%x x%x\n", | 847 | "Data: x%x x%x x%x x%x x%x\n", |
857 | phba->brd_no, vport->vpi, ndlp->nlp_DID, | 848 | ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4], |
858 | irsp->ulpStatus, irsp->un.ulpWord[4], | 849 | irsp->ulpTimeout, disc, vport->num_disc_nodes); |
859 | irsp->ulpTimeout, disc, vport->num_disc_nodes); | ||
860 | |||
861 | /* Check to see if link went down during discovery */ | 850 | /* Check to see if link went down during discovery */ |
862 | if (lpfc_els_chk_latt(vport)) { | 851 | if (lpfc_els_chk_latt(vport)) { |
863 | spin_lock_irq(shost->host_lock); | 852 | spin_lock_irq(shost->host_lock); |
@@ -881,17 +870,14 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
881 | } | 870 | } |
882 | goto out; | 871 | goto out; |
883 | } | 872 | } |
884 | |||
885 | /* PLOGI failed */ | 873 | /* PLOGI failed */ |
886 | if (ndlp->nlp_DID == NameServer_DID) { | 874 | if (ndlp->nlp_DID == NameServer_DID) { |
887 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 875 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
888 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 876 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
889 | "%d (%d):0250 Nameserver login error: " | 877 | "0250 Nameserver login error: " |
890 | "0x%x / 0x%x\n", | 878 | "0x%x / 0x%x\n", |
891 | phba->brd_no, vport->vpi, | 879 | irsp->ulpStatus, irsp->un.ulpWord[4]); |
892 | irsp->ulpStatus, irsp->un.ulpWord[4]); | ||
893 | } | 880 | } |
894 | |||
895 | /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ | 881 | /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ |
896 | if (lpfc_error_lost_link(irsp)) { | 882 | if (lpfc_error_lost_link(irsp)) { |
897 | rc = NLP_STE_FREED_NODE; | 883 | rc = NLP_STE_FREED_NODE; |
@@ -1017,14 +1003,12 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1017 | "PRLI cmpl: status:x%x/x%x did:x%x", | 1003 | "PRLI cmpl: status:x%x/x%x did:x%x", |
1018 | irsp->ulpStatus, irsp->un.ulpWord[4], | 1004 | irsp->ulpStatus, irsp->un.ulpWord[4], |
1019 | ndlp->nlp_DID); | 1005 | ndlp->nlp_DID); |
1020 | |||
1021 | /* PRLI completes to NPort <nlp_DID> */ | 1006 | /* PRLI completes to NPort <nlp_DID> */ |
1022 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 1007 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
1023 | "%d (%d):0103 PRLI completes to NPort x%x " | 1008 | "0103 PRLI completes to NPort x%x " |
1024 | "Data: x%x x%x x%x x%x\n", | 1009 | "Data: x%x x%x x%x x%x\n", |
1025 | phba->brd_no, vport->vpi, ndlp->nlp_DID, | 1010 | ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4], |
1026 | irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout, | 1011 | irsp->ulpTimeout, vport->num_disc_nodes); |
1027 | vport->num_disc_nodes); | ||
1028 | 1012 | ||
1029 | vport->fc_prli_sent--; | 1013 | vport->fc_prli_sent--; |
1030 | /* Check to see if link went down during discovery */ | 1014 | /* Check to see if link went down during discovery */ |
@@ -1129,18 +1113,15 @@ static void | |||
1129 | lpfc_more_adisc(struct lpfc_vport *vport) | 1113 | lpfc_more_adisc(struct lpfc_vport *vport) |
1130 | { | 1114 | { |
1131 | int sentadisc; | 1115 | int sentadisc; |
1132 | struct lpfc_hba *phba = vport->phba; | ||
1133 | 1116 | ||
1134 | if (vport->num_disc_nodes) | 1117 | if (vport->num_disc_nodes) |
1135 | vport->num_disc_nodes--; | 1118 | vport->num_disc_nodes--; |
1136 | |||
1137 | /* Continue discovery with <num_disc_nodes> ADISCs to go */ | 1119 | /* Continue discovery with <num_disc_nodes> ADISCs to go */ |
1138 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 1120 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
1139 | "%d (%d):0210 Continue discovery with %d ADISCs to go " | 1121 | "0210 Continue discovery with %d ADISCs to go " |
1140 | "Data: x%x x%x x%x\n", | 1122 | "Data: x%x x%x x%x\n", |
1141 | phba->brd_no, vport->vpi, vport->num_disc_nodes, | 1123 | vport->num_disc_nodes, vport->fc_adisc_cnt, |
1142 | vport->fc_adisc_cnt, vport->fc_flag, vport->port_state); | 1124 | vport->fc_flag, vport->port_state); |
1143 | |||
1144 | /* Check to see if there are more ADISCs to be sent */ | 1125 | /* Check to see if there are more ADISCs to be sent */ |
1145 | if (vport->fc_flag & FC_NLP_MORE) { | 1126 | if (vport->fc_flag & FC_NLP_MORE) { |
1146 | lpfc_set_disctmo(vport); | 1127 | lpfc_set_disctmo(vport); |
@@ -1206,15 +1187,12 @@ lpfc_cmpl_els_adisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1206 | disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC); | 1187 | disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC); |
1207 | ndlp->nlp_flag &= ~(NLP_ADISC_SND | NLP_NPR_2B_DISC); | 1188 | ndlp->nlp_flag &= ~(NLP_ADISC_SND | NLP_NPR_2B_DISC); |
1208 | spin_unlock_irq(shost->host_lock); | 1189 | spin_unlock_irq(shost->host_lock); |
1209 | |||
1210 | /* ADISC completes to NPort <nlp_DID> */ | 1190 | /* ADISC completes to NPort <nlp_DID> */ |
1211 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 1191 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
1212 | "%d (%d):0104 ADISC completes to NPort x%x " | 1192 | "0104 ADISC completes to NPort x%x " |
1213 | "Data: x%x x%x x%x x%x x%x\n", | 1193 | "Data: x%x x%x x%x x%x x%x\n", |
1214 | phba->brd_no, vport->vpi, ndlp->nlp_DID, | 1194 | ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4], |
1215 | irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout, | 1195 | irsp->ulpTimeout, disc, vport->num_disc_nodes); |
1216 | disc, vport->num_disc_nodes); | ||
1217 | |||
1218 | /* Check to see if link went down during discovery */ | 1196 | /* Check to see if link went down during discovery */ |
1219 | if (lpfc_els_chk_latt(vport)) { | 1197 | if (lpfc_els_chk_latt(vport)) { |
1220 | spin_lock_irq(shost->host_lock); | 1198 | spin_lock_irq(shost->host_lock); |
@@ -1374,15 +1352,12 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1374 | "LOGO cmpl: status:x%x/x%x did:x%x", | 1352 | "LOGO cmpl: status:x%x/x%x did:x%x", |
1375 | irsp->ulpStatus, irsp->un.ulpWord[4], | 1353 | irsp->ulpStatus, irsp->un.ulpWord[4], |
1376 | ndlp->nlp_DID); | 1354 | ndlp->nlp_DID); |
1377 | |||
1378 | /* LOGO completes to NPort <nlp_DID> */ | 1355 | /* LOGO completes to NPort <nlp_DID> */ |
1379 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 1356 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
1380 | "%d (%d):0105 LOGO completes to NPort x%x " | 1357 | "0105 LOGO completes to NPort x%x " |
1381 | "Data: x%x x%x x%x x%x\n", | 1358 | "Data: x%x x%x x%x x%x\n", |
1382 | phba->brd_no, vport->vpi, ndlp->nlp_DID, | 1359 | ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4], |
1383 | irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout, | 1360 | irsp->ulpTimeout, vport->num_disc_nodes); |
1384 | vport->num_disc_nodes); | ||
1385 | |||
1386 | /* Check to see if link went down during discovery */ | 1361 | /* Check to see if link went down during discovery */ |
1387 | if (lpfc_els_chk_latt(vport)) | 1362 | if (lpfc_els_chk_latt(vport)) |
1388 | goto out; | 1363 | goto out; |
@@ -1488,15 +1463,11 @@ lpfc_cmpl_els_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1488 | "ELS cmd cmpl: status:x%x/x%x did:x%x", | 1463 | "ELS cmd cmpl: status:x%x/x%x did:x%x", |
1489 | irsp->ulpStatus, irsp->un.ulpWord[4], | 1464 | irsp->ulpStatus, irsp->un.ulpWord[4], |
1490 | irsp->un.elsreq64.remoteID); | 1465 | irsp->un.elsreq64.remoteID); |
1491 | |||
1492 | /* ELS cmd tag <ulpIoTag> completes */ | 1466 | /* ELS cmd tag <ulpIoTag> completes */ |
1493 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 1467 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
1494 | "%d (%d):0106 ELS cmd tag x%x completes Data: x%x x%x " | 1468 | "0106 ELS cmd tag x%x completes Data: x%x x%x x%x\n", |
1495 | "x%x\n", | 1469 | irsp->ulpIoTag, irsp->ulpStatus, |
1496 | phba->brd_no, vport->vpi, | 1470 | irsp->un.ulpWord[4], irsp->ulpTimeout); |
1497 | irsp->ulpIoTag, irsp->ulpStatus, | ||
1498 | irsp->un.ulpWord[4], irsp->ulpTimeout); | ||
1499 | |||
1500 | /* Check to see if link went down during discovery */ | 1471 | /* Check to see if link went down during discovery */ |
1501 | lpfc_els_chk_latt(vport); | 1472 | lpfc_els_chk_latt(vport); |
1502 | lpfc_els_free_iocb(phba, cmdiocb); | 1473 | lpfc_els_free_iocb(phba, cmdiocb); |
@@ -1831,13 +1802,15 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1831 | case IOERR_ILLEGAL_COMMAND: | 1802 | case IOERR_ILLEGAL_COMMAND: |
1832 | if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) && | 1803 | if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) && |
1833 | (cmd == ELS_CMD_FDISC)) { | 1804 | (cmd == ELS_CMD_FDISC)) { |
1834 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 1805 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
1835 | "%d (%d):0124 FDISC failed (3/6) retrying...\n", | 1806 | "0124 FDISC failed (3/6) " |
1836 | phba->brd_no, vport->vpi); | 1807 | "retrying...\n"); |
1837 | lpfc_mbx_unreg_vpi(vport); | 1808 | lpfc_mbx_unreg_vpi(vport); |
1838 | retry = 1; | 1809 | retry = 1; |
1839 | /* Always retry for this case */ | 1810 | /* FDISC retry policy */ |
1840 | cmdiocb->retry = 0; | 1811 | maxretry = 48; |
1812 | if (cmdiocb->retry >= 32) | ||
1813 | delay = 1000; | ||
1841 | } | 1814 | } |
1842 | break; | 1815 | break; |
1843 | 1816 | ||
@@ -1898,10 +1871,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1898 | if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && | 1871 | if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && |
1899 | (cmd == ELS_CMD_FDISC) && | 1872 | (cmd == ELS_CMD_FDISC) && |
1900 | (stat.un.b.lsRjtRsnCodeExp == LSEXP_OUT_OF_RESOURCE)){ | 1873 | (stat.un.b.lsRjtRsnCodeExp == LSEXP_OUT_OF_RESOURCE)){ |
1901 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 1874 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
1902 | "%d (%d):0125 FDISC Failed (x%x)." | 1875 | "0125 FDISC Failed (x%x). " |
1903 | " Fabric out of resources\n", | 1876 | "Fabric out of resources\n", |
1904 | phba->brd_no, vport->vpi, stat.un.lsRjtError); | 1877 | stat.un.lsRjtError); |
1905 | lpfc_vport_set_state(vport, | 1878 | lpfc_vport_set_state(vport, |
1906 | FC_VPORT_NO_FABRIC_RSCS); | 1879 | FC_VPORT_NO_FABRIC_RSCS); |
1907 | } | 1880 | } |
@@ -1913,8 +1886,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1913 | delay = 1000; | 1886 | delay = 1000; |
1914 | maxretry = 48; | 1887 | maxretry = 48; |
1915 | } else if (cmd == ELS_CMD_FDISC) { | 1888 | } else if (cmd == ELS_CMD_FDISC) { |
1916 | /* Always retry for this case */ | 1889 | /* FDISC retry policy */ |
1917 | cmdiocb->retry = 0; | 1890 | maxretry = 48; |
1891 | if (cmdiocb->retry >= 32) | ||
1892 | delay = 1000; | ||
1918 | } | 1893 | } |
1919 | retry = 1; | 1894 | retry = 1; |
1920 | break; | 1895 | break; |
@@ -1926,10 +1901,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1926 | ((stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_PNAME) || | 1901 | ((stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_PNAME) || |
1927 | (stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_NPORT_ID)) | 1902 | (stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_NPORT_ID)) |
1928 | ) { | 1903 | ) { |
1929 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 1904 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
1930 | "%d (%d):0123 FDISC Failed (x%x)." | 1905 | "0123 FDISC Failed (x%x). " |
1931 | " Fabric Detected Bad WWN\n", | 1906 | "Fabric Detected Bad WWN\n", |
1932 | phba->brd_no, vport->vpi, stat.un.lsRjtError); | 1907 | stat.un.lsRjtError); |
1933 | lpfc_vport_set_state(vport, | 1908 | lpfc_vport_set_state(vport, |
1934 | FC_VPORT_FABRIC_REJ_WWN); | 1909 | FC_VPORT_FABRIC_REJ_WWN); |
1935 | } | 1910 | } |
@@ -1959,11 +1934,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1959 | if (retry) { | 1934 | if (retry) { |
1960 | 1935 | ||
1961 | /* Retry ELS command <elsCmd> to remote NPORT <did> */ | 1936 | /* Retry ELS command <elsCmd> to remote NPORT <did> */ |
1962 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 1937 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
1963 | "%d (%d):0107 Retry ELS command x%x to remote " | 1938 | "0107 Retry ELS command x%x to remote " |
1964 | "NPORT x%x Data: x%x x%x\n", | 1939 | "NPORT x%x Data: x%x x%x\n", |
1965 | phba->brd_no, vport->vpi, | 1940 | cmd, did, cmdiocb->retry, delay); |
1966 | cmd, did, cmdiocb->retry, delay); | ||
1967 | 1941 | ||
1968 | if (((cmd == ELS_CMD_PLOGI) || (cmd == ELS_CMD_ADISC)) && | 1942 | if (((cmd == ELS_CMD_PLOGI) || (cmd == ELS_CMD_ADISC)) && |
1969 | ((irsp->ulpStatus != IOSTAT_LOCAL_REJECT) || | 1943 | ((irsp->ulpStatus != IOSTAT_LOCAL_REJECT) || |
@@ -2031,14 +2005,12 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
2031 | return 1; | 2005 | return 1; |
2032 | } | 2006 | } |
2033 | } | 2007 | } |
2034 | |||
2035 | /* No retry ELS command <elsCmd> to remote NPORT <did> */ | 2008 | /* No retry ELS command <elsCmd> to remote NPORT <did> */ |
2036 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2009 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
2037 | "%d (%d):0108 No retry ELS command x%x to remote " | 2010 | "0108 No retry ELS command x%x to remote " |
2038 | "NPORT x%x Data: x%x\n", | 2011 | "NPORT x%x Retried:%d Error:x%x/%x\n", |
2039 | phba->brd_no, vport->vpi, | 2012 | cmd, did, cmdiocb->retry, irsp->ulpStatus, |
2040 | cmd, did, cmdiocb->retry); | 2013 | irsp->un.ulpWord[4]); |
2041 | |||
2042 | return 0; | 2014 | return 0; |
2043 | } | 2015 | } |
2044 | 2016 | ||
@@ -2087,14 +2059,12 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
2087 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, | 2059 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, |
2088 | "ACC LOGO cmpl: status:x%x/x%x did:x%x", | 2060 | "ACC LOGO cmpl: status:x%x/x%x did:x%x", |
2089 | irsp->ulpStatus, irsp->un.ulpWord[4], ndlp->nlp_DID); | 2061 | irsp->ulpStatus, irsp->un.ulpWord[4], ndlp->nlp_DID); |
2090 | |||
2091 | /* ACC to LOGO completes to NPort <nlp_DID> */ | 2062 | /* ACC to LOGO completes to NPort <nlp_DID> */ |
2092 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2063 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
2093 | "%d (%d):0109 ACC to LOGO completes to NPort x%x " | 2064 | "0109 ACC to LOGO completes to NPort x%x " |
2094 | "Data: x%x x%x x%x\n", | 2065 | "Data: x%x x%x x%x\n", |
2095 | phba->brd_no, vport->vpi, ndlp->nlp_DID, | 2066 | ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, |
2096 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2067 | ndlp->nlp_rpi); |
2097 | |||
2098 | switch (ndlp->nlp_state) { | 2068 | switch (ndlp->nlp_state) { |
2099 | case NLP_STE_UNUSED_NODE: /* node is just allocated */ | 2069 | case NLP_STE_UNUSED_NODE: /* node is just allocated */ |
2100 | lpfc_drop_node(vport, ndlp); | 2070 | lpfc_drop_node(vport, ndlp); |
@@ -2153,20 +2123,17 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
2153 | } | 2123 | } |
2154 | 2124 | ||
2155 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, | 2125 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, |
2156 | "ACC cmpl: status:x%x/x%x did:x%x", | 2126 | "ELS rsp cmpl: status:x%x/x%x did:x%x", |
2157 | irsp->ulpStatus, irsp->un.ulpWord[4], | 2127 | irsp->ulpStatus, irsp->un.ulpWord[4], |
2158 | irsp->un.rcvels.remoteID); | 2128 | cmdiocb->iocb.un.elsreq64.remoteID); |
2159 | |||
2160 | /* ELS response tag <ulpIoTag> completes */ | 2129 | /* ELS response tag <ulpIoTag> completes */ |
2161 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2130 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
2162 | "%d (%d):0110 ELS response tag x%x completes " | 2131 | "0110 ELS response tag x%x completes " |
2163 | "Data: x%x x%x x%x x%x x%x x%x x%x\n", | 2132 | "Data: x%x x%x x%x x%x x%x x%x x%x\n", |
2164 | phba->brd_no, vport->vpi, | 2133 | cmdiocb->iocb.ulpIoTag, rspiocb->iocb.ulpStatus, |
2165 | cmdiocb->iocb.ulpIoTag, rspiocb->iocb.ulpStatus, | 2134 | rspiocb->iocb.un.ulpWord[4], rspiocb->iocb.ulpTimeout, |
2166 | rspiocb->iocb.un.ulpWord[4], rspiocb->iocb.ulpTimeout, | 2135 | ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, |
2167 | ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, | 2136 | ndlp->nlp_rpi); |
2168 | ndlp->nlp_rpi); | ||
2169 | |||
2170 | if (mbox) { | 2137 | if (mbox) { |
2171 | if ((rspiocb->iocb.ulpStatus == 0) | 2138 | if ((rspiocb->iocb.ulpStatus == 0) |
2172 | && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { | 2139 | && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { |
@@ -2219,7 +2186,7 @@ out: | |||
2219 | int | 2186 | int |
2220 | lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag, | 2187 | lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag, |
2221 | struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp, | 2188 | struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp, |
2222 | LPFC_MBOXQ_t *mbox, uint8_t newnode) | 2189 | LPFC_MBOXQ_t *mbox) |
2223 | { | 2190 | { |
2224 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 2191 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
2225 | struct lpfc_hba *phba = vport->phba; | 2192 | struct lpfc_hba *phba = vport->phba; |
@@ -2305,20 +2272,13 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag, | |||
2305 | default: | 2272 | default: |
2306 | return 1; | 2273 | return 1; |
2307 | } | 2274 | } |
2308 | |||
2309 | if (newnode) { | ||
2310 | lpfc_nlp_put(ndlp); | ||
2311 | elsiocb->context1 = NULL; | ||
2312 | } | ||
2313 | |||
2314 | /* Xmit ELS ACC response tag <ulpIoTag> */ | 2275 | /* Xmit ELS ACC response tag <ulpIoTag> */ |
2315 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2276 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
2316 | "%d (%d):0128 Xmit ELS ACC response tag x%x, XRI: x%x, " | 2277 | "0128 Xmit ELS ACC response tag x%x, XRI: x%x, " |
2317 | "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x\n", | 2278 | "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x\n", |
2318 | phba->brd_no, vport->vpi, elsiocb->iotag, | 2279 | elsiocb->iotag, elsiocb->iocb.ulpContext, |
2319 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2280 | ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, |
2320 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2281 | ndlp->nlp_rpi); |
2321 | |||
2322 | if (ndlp->nlp_flag & NLP_LOGO_ACC) { | 2282 | if (ndlp->nlp_flag & NLP_LOGO_ACC) { |
2323 | spin_lock_irq(shost->host_lock); | 2283 | spin_lock_irq(shost->host_lock); |
2324 | ndlp->nlp_flag &= ~NLP_LOGO_ACC; | 2284 | ndlp->nlp_flag &= ~NLP_LOGO_ACC; |
@@ -2370,20 +2330,17 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_t rejectError, | |||
2370 | pcmd += sizeof(uint32_t); | 2330 | pcmd += sizeof(uint32_t); |
2371 | *((uint32_t *) (pcmd)) = rejectError; | 2331 | *((uint32_t *) (pcmd)) = rejectError; |
2372 | 2332 | ||
2373 | if (mbox) { | 2333 | if (mbox) |
2374 | elsiocb->context_un.mbox = mbox; | 2334 | elsiocb->context_un.mbox = mbox; |
2375 | elsiocb->context1 = lpfc_nlp_get(ndlp); | ||
2376 | } | ||
2377 | 2335 | ||
2378 | /* Xmit ELS RJT <err> response tag <ulpIoTag> */ | 2336 | /* Xmit ELS RJT <err> response tag <ulpIoTag> */ |
2379 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2337 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
2380 | "%d (%d):0129 Xmit ELS RJT x%x response tag x%x " | 2338 | "0129 Xmit ELS RJT x%x response tag x%x " |
2381 | "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " | 2339 | "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " |
2382 | "rpi x%x\n", | 2340 | "rpi x%x\n", |
2383 | phba->brd_no, vport->vpi, rejectError, elsiocb->iotag, | 2341 | rejectError, elsiocb->iotag, |
2384 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2342 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2385 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2343 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2386 | |||
2387 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, | 2344 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, |
2388 | "Issue LS_RJT: did:x%x flg:x%x err:x%x", | 2345 | "Issue LS_RJT: did:x%x flg:x%x err:x%x", |
2389 | ndlp->nlp_DID, ndlp->nlp_flag, rejectError); | 2346 | ndlp->nlp_DID, ndlp->nlp_flag, rejectError); |
@@ -2391,6 +2348,15 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_t rejectError, | |||
2391 | phba->fc_stat.elsXmitLSRJT++; | 2348 | phba->fc_stat.elsXmitLSRJT++; |
2392 | elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; | 2349 | elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; |
2393 | rc = lpfc_sli_issue_iocb(phba, pring, elsiocb, 0); | 2350 | rc = lpfc_sli_issue_iocb(phba, pring, elsiocb, 0); |
2351 | |||
2352 | /* If the node is in the UNUSED state, and we are sending | ||
2353 | * a reject, we are done with it. Release driver reference | ||
2354 | * count here. The outstanding els will release its reference on | ||
2355 | * completion and the node can be freed then. | ||
2356 | */ | ||
2357 | if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) | ||
2358 | lpfc_nlp_put(ndlp); | ||
2359 | |||
2394 | if (rc == IOCB_ERROR) { | 2360 | if (rc == IOCB_ERROR) { |
2395 | lpfc_els_free_iocb(phba, elsiocb); | 2361 | lpfc_els_free_iocb(phba, elsiocb); |
2396 | return 1; | 2362 | return 1; |
@@ -2423,13 +2389,12 @@ lpfc_els_rsp_adisc_acc(struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb, | |||
2423 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | 2389 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ |
2424 | 2390 | ||
2425 | /* Xmit ADISC ACC response tag <ulpIoTag> */ | 2391 | /* Xmit ADISC ACC response tag <ulpIoTag> */ |
2426 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2392 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
2427 | "%d (%d):0130 Xmit ADISC ACC response iotag x%x xri: " | 2393 | "0130 Xmit ADISC ACC response iotag x%x xri: " |
2428 | "x%x, did x%x, nlp_flag x%x, nlp_state x%x rpi x%x\n", | 2394 | "x%x, did x%x, nlp_flag x%x, nlp_state x%x rpi x%x\n", |
2429 | phba->brd_no, vport->vpi, elsiocb->iotag, | 2395 | elsiocb->iotag, elsiocb->iocb.ulpContext, |
2430 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2396 | ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, |
2431 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2397 | ndlp->nlp_rpi); |
2432 | |||
2433 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); | 2398 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); |
2434 | 2399 | ||
2435 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; | 2400 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; |
@@ -2483,15 +2448,13 @@ lpfc_els_rsp_prli_acc(struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb, | |||
2483 | icmd = &elsiocb->iocb; | 2448 | icmd = &elsiocb->iocb; |
2484 | oldcmd = &oldiocb->iocb; | 2449 | oldcmd = &oldiocb->iocb; |
2485 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | 2450 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ |
2486 | |||
2487 | /* Xmit PRLI ACC response tag <ulpIoTag> */ | 2451 | /* Xmit PRLI ACC response tag <ulpIoTag> */ |
2488 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2452 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
2489 | "%d (%d):0131 Xmit PRLI ACC response tag x%x xri x%x, " | 2453 | "0131 Xmit PRLI ACC response tag x%x xri x%x, " |
2490 | "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", | 2454 | "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", |
2491 | phba->brd_no, vport->vpi, elsiocb->iotag, | 2455 | elsiocb->iotag, elsiocb->iocb.ulpContext, |
2492 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2456 | ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, |
2493 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2457 | ndlp->nlp_rpi); |
2494 | |||
2495 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); | 2458 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); |
2496 | 2459 | ||
2497 | *((uint32_t *) (pcmd)) = (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK)); | 2460 | *((uint32_t *) (pcmd)) = (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK)); |
@@ -2565,16 +2528,11 @@ lpfc_els_rsp_rnid_acc(struct lpfc_vport *vport, uint8_t format, | |||
2565 | icmd = &elsiocb->iocb; | 2528 | icmd = &elsiocb->iocb; |
2566 | oldcmd = &oldiocb->iocb; | 2529 | oldcmd = &oldiocb->iocb; |
2567 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | 2530 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ |
2568 | |||
2569 | /* Xmit RNID ACC response tag <ulpIoTag> */ | 2531 | /* Xmit RNID ACC response tag <ulpIoTag> */ |
2570 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2532 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
2571 | "%d (%d):0132 Xmit RNID ACC response tag x%x " | 2533 | "0132 Xmit RNID ACC response tag x%x xri x%x\n", |
2572 | "xri x%x\n", | 2534 | elsiocb->iotag, elsiocb->iocb.ulpContext); |
2573 | phba->brd_no, vport->vpi, elsiocb->iotag, | ||
2574 | elsiocb->iocb.ulpContext); | ||
2575 | |||
2576 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); | 2535 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); |
2577 | |||
2578 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; | 2536 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; |
2579 | pcmd += sizeof(uint32_t); | 2537 | pcmd += sizeof(uint32_t); |
2580 | 2538 | ||
@@ -2641,7 +2599,7 @@ lpfc_els_disc_adisc(struct lpfc_vport *vport) | |||
2641 | sentadisc++; | 2599 | sentadisc++; |
2642 | vport->num_disc_nodes++; | 2600 | vport->num_disc_nodes++; |
2643 | if (vport->num_disc_nodes >= | 2601 | if (vport->num_disc_nodes >= |
2644 | vport->phba->cfg_discovery_threads) { | 2602 | vport->cfg_discovery_threads) { |
2645 | spin_lock_irq(shost->host_lock); | 2603 | spin_lock_irq(shost->host_lock); |
2646 | vport->fc_flag |= FC_NLP_MORE; | 2604 | vport->fc_flag |= FC_NLP_MORE; |
2647 | spin_unlock_irq(shost->host_lock); | 2605 | spin_unlock_irq(shost->host_lock); |
@@ -2676,7 +2634,7 @@ lpfc_els_disc_plogi(struct lpfc_vport *vport) | |||
2676 | sentplogi++; | 2634 | sentplogi++; |
2677 | vport->num_disc_nodes++; | 2635 | vport->num_disc_nodes++; |
2678 | if (vport->num_disc_nodes >= | 2636 | if (vport->num_disc_nodes >= |
2679 | vport->phba->cfg_discovery_threads) { | 2637 | vport->cfg_discovery_threads) { |
2680 | spin_lock_irq(shost->host_lock); | 2638 | spin_lock_irq(shost->host_lock); |
2681 | vport->fc_flag |= FC_NLP_MORE; | 2639 | vport->fc_flag |= FC_NLP_MORE; |
2682 | spin_unlock_irq(shost->host_lock); | 2640 | spin_unlock_irq(shost->host_lock); |
@@ -2717,7 +2675,6 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did) | |||
2717 | D_ID rscn_did; | 2675 | D_ID rscn_did; |
2718 | uint32_t *lp; | 2676 | uint32_t *lp; |
2719 | uint32_t payload_len, i; | 2677 | uint32_t payload_len, i; |
2720 | struct lpfc_hba *phba = vport->phba; | ||
2721 | 2678 | ||
2722 | ns_did.un.word = did; | 2679 | ns_did.un.word = did; |
2723 | 2680 | ||
@@ -2752,12 +2709,10 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did) | |||
2752 | break; | 2709 | break; |
2753 | default: | 2710 | default: |
2754 | /* Unknown Identifier in RSCN node */ | 2711 | /* Unknown Identifier in RSCN node */ |
2755 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 2712 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
2756 | "%d (%d):0217 Unknown " | 2713 | "0217 Unknown Identifier in " |
2757 | "Identifier in RSCN payload " | 2714 | "RSCN payload Data: x%x\n", |
2758 | "Data: x%x\n", | 2715 | rscn_did.un.word); |
2759 | phba->brd_no, vport->vpi, | ||
2760 | rscn_did.un.word); | ||
2761 | case 3: /* Whole Fabric effected */ | 2716 | case 3: /* Whole Fabric effected */ |
2762 | return did; | 2717 | return did; |
2763 | } | 2718 | } |
@@ -2796,12 +2751,11 @@ lpfc_rscn_recovery_check(struct lpfc_vport *vport) | |||
2796 | 2751 | ||
2797 | static int | 2752 | static int |
2798 | lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | 2753 | lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, |
2799 | struct lpfc_nodelist *ndlp, uint8_t newnode) | 2754 | struct lpfc_nodelist *ndlp) |
2800 | { | 2755 | { |
2801 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 2756 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
2802 | struct lpfc_hba *phba = vport->phba; | 2757 | struct lpfc_hba *phba = vport->phba; |
2803 | struct lpfc_dmabuf *pcmd; | 2758 | struct lpfc_dmabuf *pcmd; |
2804 | struct lpfc_vport *next_vport; | ||
2805 | uint32_t *lp, *datap; | 2759 | uint32_t *lp, *datap; |
2806 | IOCB_t *icmd; | 2760 | IOCB_t *icmd; |
2807 | uint32_t payload_len, length, nportid, *cmd; | 2761 | uint32_t payload_len, length, nportid, *cmd; |
@@ -2815,13 +2769,10 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
2815 | 2769 | ||
2816 | payload_len = be32_to_cpu(*lp++ & ~ELS_CMD_MASK); | 2770 | payload_len = be32_to_cpu(*lp++ & ~ELS_CMD_MASK); |
2817 | payload_len -= sizeof(uint32_t); /* take off word 0 */ | 2771 | payload_len -= sizeof(uint32_t); /* take off word 0 */ |
2818 | |||
2819 | /* RSCN received */ | 2772 | /* RSCN received */ |
2820 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 2773 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
2821 | "%d (%d):0214 RSCN received Data: x%x x%x x%x x%x\n", | 2774 | "0214 RSCN received Data: x%x x%x x%x x%x\n", |
2822 | phba->brd_no, vport->vpi, vport->fc_flag, payload_len, | 2775 | vport->fc_flag, payload_len, *lp, rscn_cnt); |
2823 | *lp, rscn_cnt); | ||
2824 | |||
2825 | for (i = 0; i < payload_len/sizeof(uint32_t); i++) | 2776 | for (i = 0; i < payload_len/sizeof(uint32_t); i++) |
2826 | fc_host_post_event(shost, fc_get_event_number(), | 2777 | fc_host_post_event(shost, fc_get_event_number(), |
2827 | FCH_EVT_RSCN, lp[i]); | 2778 | FCH_EVT_RSCN, lp[i]); |
@@ -2834,8 +2785,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
2834 | "RCV RSCN ignore: did:x%x/ste:x%x flg:x%x", | 2785 | "RCV RSCN ignore: did:x%x/ste:x%x flg:x%x", |
2835 | ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag); | 2786 | ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag); |
2836 | 2787 | ||
2837 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, | 2788 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); |
2838 | newnode); | ||
2839 | return 0; | 2789 | return 0; |
2840 | } | 2790 | } |
2841 | 2791 | ||
@@ -2843,7 +2793,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
2843 | * just ACC and ignore it. | 2793 | * just ACC and ignore it. |
2844 | */ | 2794 | */ |
2845 | if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && | 2795 | if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && |
2846 | !(phba->cfg_peer_port_login)) { | 2796 | !(vport->cfg_peer_port_login)) { |
2847 | i = payload_len; | 2797 | i = payload_len; |
2848 | datap = lp; | 2798 | datap = lp; |
2849 | while (i > 0) { | 2799 | while (i > 0) { |
@@ -2851,28 +2801,23 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
2851 | nportid = ((be32_to_cpu(nportid)) & Mask_DID); | 2801 | nportid = ((be32_to_cpu(nportid)) & Mask_DID); |
2852 | i -= sizeof(uint32_t); | 2802 | i -= sizeof(uint32_t); |
2853 | rscn_id++; | 2803 | rscn_id++; |
2854 | list_for_each_entry(next_vport, &phba->port_list, | 2804 | if (lpfc_find_vport_by_did(phba, nportid)) |
2855 | listentry) { | 2805 | hba_id++; |
2856 | if (nportid == next_vport->fc_myDID) { | ||
2857 | hba_id++; | ||
2858 | break; | ||
2859 | } | ||
2860 | } | ||
2861 | } | 2806 | } |
2862 | if (rscn_id == hba_id) { | 2807 | if (rscn_id == hba_id) { |
2863 | /* ALL NPortIDs in RSCN are on HBA */ | 2808 | /* ALL NPortIDs in RSCN are on HBA */ |
2864 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 2809 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
2865 | "%d (%d):0214 Ignore RSCN Data: x%x x%x x%x x%x\n", | 2810 | "0214 Ignore RSCN " |
2866 | phba->brd_no, vport->vpi, vport->fc_flag, payload_len, | 2811 | "Data: x%x x%x x%x x%x\n", |
2867 | *lp, rscn_cnt); | 2812 | vport->fc_flag, payload_len, |
2868 | 2813 | *lp, rscn_cnt); | |
2869 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, | 2814 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, |
2870 | "RCV RSCN vport: did:x%x/ste:x%x flg:x%x", | 2815 | "RCV RSCN vport: did:x%x/ste:x%x flg:x%x", |
2871 | ndlp->nlp_DID, vport->port_state, | 2816 | ndlp->nlp_DID, vport->port_state, |
2872 | ndlp->nlp_flag); | 2817 | ndlp->nlp_flag); |
2873 | 2818 | ||
2874 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, | 2819 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, |
2875 | ndlp, NULL, newnode); | 2820 | ndlp, NULL); |
2876 | return 0; | 2821 | return 0; |
2877 | } | 2822 | } |
2878 | } | 2823 | } |
@@ -2911,27 +2856,24 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
2911 | } | 2856 | } |
2912 | 2857 | ||
2913 | /* Deferred RSCN */ | 2858 | /* Deferred RSCN */ |
2914 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 2859 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
2915 | "%d (%d):0235 Deferred RSCN " | 2860 | "0235 Deferred RSCN " |
2916 | "Data: x%x x%x x%x\n", | 2861 | "Data: x%x x%x x%x\n", |
2917 | phba->brd_no, vport->vpi, | 2862 | vport->fc_rscn_id_cnt, vport->fc_flag, |
2918 | vport->fc_rscn_id_cnt, vport->fc_flag, | 2863 | vport->port_state); |
2919 | vport->port_state); | ||
2920 | } else { | 2864 | } else { |
2921 | spin_lock_irq(shost->host_lock); | 2865 | spin_lock_irq(shost->host_lock); |
2922 | vport->fc_flag |= FC_RSCN_DISCOVERY; | 2866 | vport->fc_flag |= FC_RSCN_DISCOVERY; |
2923 | spin_unlock_irq(shost->host_lock); | 2867 | spin_unlock_irq(shost->host_lock); |
2924 | /* ReDiscovery RSCN */ | 2868 | /* ReDiscovery RSCN */ |
2925 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 2869 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
2926 | "%d (%d):0234 ReDiscovery RSCN " | 2870 | "0234 ReDiscovery RSCN " |
2927 | "Data: x%x x%x x%x\n", | 2871 | "Data: x%x x%x x%x\n", |
2928 | phba->brd_no, vport->vpi, | 2872 | vport->fc_rscn_id_cnt, vport->fc_flag, |
2929 | vport->fc_rscn_id_cnt, vport->fc_flag, | 2873 | vport->port_state); |
2930 | vport->port_state); | ||
2931 | } | 2874 | } |
2932 | /* Send back ACC */ | 2875 | /* Send back ACC */ |
2933 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, | 2876 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); |
2934 | newnode); | ||
2935 | 2877 | ||
2936 | /* send RECOVERY event for ALL nodes that match RSCN payload */ | 2878 | /* send RECOVERY event for ALL nodes that match RSCN payload */ |
2937 | lpfc_rscn_recovery_check(vport); | 2879 | lpfc_rscn_recovery_check(vport); |
@@ -2956,7 +2898,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
2956 | lpfc_set_disctmo(vport); | 2898 | lpfc_set_disctmo(vport); |
2957 | 2899 | ||
2958 | /* Send back ACC */ | 2900 | /* Send back ACC */ |
2959 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, newnode); | 2901 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); |
2960 | 2902 | ||
2961 | /* send RECOVERY event for ALL nodes that match RSCN payload */ | 2903 | /* send RECOVERY event for ALL nodes that match RSCN payload */ |
2962 | lpfc_rscn_recovery_check(vport); | 2904 | lpfc_rscn_recovery_check(vport); |
@@ -2980,11 +2922,10 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport) | |||
2980 | lpfc_set_disctmo(vport); | 2922 | lpfc_set_disctmo(vport); |
2981 | 2923 | ||
2982 | /* RSCN processed */ | 2924 | /* RSCN processed */ |
2983 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 2925 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
2984 | "%d (%d):0215 RSCN processed Data: x%x x%x x%x x%x\n", | 2926 | "0215 RSCN processed Data: x%x x%x x%x x%x\n", |
2985 | phba->brd_no, vport->vpi, | 2927 | vport->fc_flag, 0, vport->fc_rscn_id_cnt, |
2986 | vport->fc_flag, 0, vport->fc_rscn_id_cnt, | 2928 | vport->port_state); |
2987 | vport->port_state); | ||
2988 | 2929 | ||
2989 | /* To process RSCN, first compare RSCN data with NameServer */ | 2930 | /* To process RSCN, first compare RSCN data with NameServer */ |
2990 | vport->fc_ns_retry = 0; | 2931 | vport->fc_ns_retry = 0; |
@@ -3026,7 +2967,7 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport) | |||
3026 | 2967 | ||
3027 | static int | 2968 | static int |
3028 | lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | 2969 | lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, |
3029 | struct lpfc_nodelist *ndlp, uint8_t newnode) | 2970 | struct lpfc_nodelist *ndlp) |
3030 | { | 2971 | { |
3031 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 2972 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
3032 | struct lpfc_hba *phba = vport->phba; | 2973 | struct lpfc_hba *phba = vport->phba; |
@@ -3052,10 +2993,10 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
3052 | 2993 | ||
3053 | /* An FLOGI ELS command <elsCmd> was received from DID <did> in | 2994 | /* An FLOGI ELS command <elsCmd> was received from DID <did> in |
3054 | Loop Mode */ | 2995 | Loop Mode */ |
3055 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 2996 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
3056 | "%d (%d):0113 An FLOGI ELS command x%x was " | 2997 | "0113 An FLOGI ELS command x%x was " |
3057 | "received from DID x%x in Loop Mode\n", | 2998 | "received from DID x%x in Loop Mode\n", |
3058 | phba->brd_no, vport->vpi, cmd, did); | 2999 | cmd, did); |
3059 | return 1; | 3000 | return 1; |
3060 | } | 3001 | } |
3061 | 3002 | ||
@@ -3109,7 +3050,7 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
3109 | } | 3050 | } |
3110 | 3051 | ||
3111 | /* Send back ACC */ | 3052 | /* Send back ACC */ |
3112 | lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, newnode); | 3053 | lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL); |
3113 | 3054 | ||
3114 | return 0; | 3055 | return 0; |
3115 | } | 3056 | } |
@@ -3226,16 +3167,13 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
3226 | rps_rsp->primSeqErrCnt = be32_to_cpu(mb->un.varRdLnk.primSeqErrCnt); | 3167 | rps_rsp->primSeqErrCnt = be32_to_cpu(mb->un.varRdLnk.primSeqErrCnt); |
3227 | rps_rsp->invalidXmitWord = be32_to_cpu(mb->un.varRdLnk.invalidXmitWord); | 3168 | rps_rsp->invalidXmitWord = be32_to_cpu(mb->un.varRdLnk.invalidXmitWord); |
3228 | rps_rsp->crcCnt = be32_to_cpu(mb->un.varRdLnk.crcCnt); | 3169 | rps_rsp->crcCnt = be32_to_cpu(mb->un.varRdLnk.crcCnt); |
3229 | |||
3230 | /* Xmit ELS RPS ACC response tag <ulpIoTag> */ | 3170 | /* Xmit ELS RPS ACC response tag <ulpIoTag> */ |
3231 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 3171 | lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_ELS, |
3232 | "%d (%d):0118 Xmit ELS RPS ACC response tag x%x " | 3172 | "0118 Xmit ELS RPS ACC response tag x%x xri x%x, " |
3233 | "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " | 3173 | "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", |
3234 | "rpi x%x\n", | 3174 | elsiocb->iotag, elsiocb->iocb.ulpContext, |
3235 | phba->brd_no, ndlp->vport->vpi, elsiocb->iotag, | 3175 | ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, |
3236 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 3176 | ndlp->nlp_rpi); |
3237 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | ||
3238 | |||
3239 | elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; | 3177 | elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; |
3240 | phba->fc_stat.elsXmitACC++; | 3178 | phba->fc_stat.elsXmitACC++; |
3241 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) | 3179 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) |
@@ -3337,21 +3275,16 @@ lpfc_els_rsp_rpl_acc(struct lpfc_vport *vport, uint16_t cmdsize, | |||
3337 | rpl_rsp.port_num_blk.portID = be32_to_cpu(vport->fc_myDID); | 3275 | rpl_rsp.port_num_blk.portID = be32_to_cpu(vport->fc_myDID); |
3338 | memcpy(&rpl_rsp.port_num_blk.portName, &vport->fc_portname, | 3276 | memcpy(&rpl_rsp.port_num_blk.portName, &vport->fc_portname, |
3339 | sizeof(struct lpfc_name)); | 3277 | sizeof(struct lpfc_name)); |
3340 | |||
3341 | memcpy(pcmd, &rpl_rsp, cmdsize - sizeof(uint32_t)); | 3278 | memcpy(pcmd, &rpl_rsp, cmdsize - sizeof(uint32_t)); |
3342 | |||
3343 | |||
3344 | /* Xmit ELS RPL ACC response tag <ulpIoTag> */ | 3279 | /* Xmit ELS RPL ACC response tag <ulpIoTag> */ |
3345 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 3280 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
3346 | "%d (%d):0120 Xmit ELS RPL ACC response tag x%x " | 3281 | "0120 Xmit ELS RPL ACC response tag x%x " |
3347 | "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " | 3282 | "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " |
3348 | "rpi x%x\n", | 3283 | "rpi x%x\n", |
3349 | phba->brd_no, vport->vpi, elsiocb->iotag, | 3284 | elsiocb->iotag, elsiocb->iocb.ulpContext, |
3350 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 3285 | ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, |
3351 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 3286 | ndlp->nlp_rpi); |
3352 | |||
3353 | elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; | 3287 | elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp; |
3354 | |||
3355 | phba->fc_stat.elsXmitACC++; | 3288 | phba->fc_stat.elsXmitACC++; |
3356 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { | 3289 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { |
3357 | lpfc_els_free_iocb(phba, elsiocb); | 3290 | lpfc_els_free_iocb(phba, elsiocb); |
@@ -3404,7 +3337,6 @@ static int | |||
3404 | lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | 3337 | lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, |
3405 | struct lpfc_nodelist *ndlp) | 3338 | struct lpfc_nodelist *ndlp) |
3406 | { | 3339 | { |
3407 | struct lpfc_hba *phba = vport->phba; | ||
3408 | struct lpfc_dmabuf *pcmd; | 3340 | struct lpfc_dmabuf *pcmd; |
3409 | uint32_t *lp; | 3341 | uint32_t *lp; |
3410 | IOCB_t *icmd; | 3342 | IOCB_t *icmd; |
@@ -3418,12 +3350,9 @@ lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
3418 | 3350 | ||
3419 | cmd = *lp++; | 3351 | cmd = *lp++; |
3420 | fp = (FARP *) lp; | 3352 | fp = (FARP *) lp; |
3421 | |||
3422 | /* FARP-REQ received from DID <did> */ | 3353 | /* FARP-REQ received from DID <did> */ |
3423 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 3354 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
3424 | "%d (%d):0601 FARP-REQ received from DID x%x\n", | 3355 | "0601 FARP-REQ received from DID x%x\n", did); |
3425 | phba->brd_no, vport->vpi, did); | ||
3426 | |||
3427 | /* We will only support match on WWPN or WWNN */ | 3356 | /* We will only support match on WWPN or WWNN */ |
3428 | if (fp->Mflags & ~(FARP_MATCH_NODE | FARP_MATCH_PORT)) { | 3357 | if (fp->Mflags & ~(FARP_MATCH_NODE | FARP_MATCH_PORT)) { |
3429 | return 0; | 3358 | return 0; |
@@ -3471,7 +3400,6 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
3471 | uint32_t *lp; | 3400 | uint32_t *lp; |
3472 | IOCB_t *icmd; | 3401 | IOCB_t *icmd; |
3473 | uint32_t cmd, did; | 3402 | uint32_t cmd, did; |
3474 | struct lpfc_hba *phba = vport->phba; | ||
3475 | 3403 | ||
3476 | icmd = &cmdiocb->iocb; | 3404 | icmd = &cmdiocb->iocb; |
3477 | did = icmd->un.elsreq64.remoteID; | 3405 | did = icmd->un.elsreq64.remoteID; |
@@ -3480,11 +3408,10 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
3480 | 3408 | ||
3481 | cmd = *lp++; | 3409 | cmd = *lp++; |
3482 | /* FARP-RSP received from DID <did> */ | 3410 | /* FARP-RSP received from DID <did> */ |
3483 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 3411 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
3484 | "%d (%d):0600 FARP-RSP received from DID x%x\n", | 3412 | "0600 FARP-RSP received from DID x%x\n", did); |
3485 | phba->brd_no, vport->vpi, did); | ||
3486 | /* ACCEPT the Farp resp request */ | 3413 | /* ACCEPT the Farp resp request */ |
3487 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 3414 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); |
3488 | 3415 | ||
3489 | return 0; | 3416 | return 0; |
3490 | } | 3417 | } |
@@ -3502,10 +3429,8 @@ lpfc_els_rcv_fan(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
3502 | struct lpfc_hba *phba = vport->phba; | 3429 | struct lpfc_hba *phba = vport->phba; |
3503 | 3430 | ||
3504 | /* FAN received */ | 3431 | /* FAN received */ |
3505 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 3432 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
3506 | "%d (%d):0265 FAN received\n", | 3433 | "0265 FAN received\n"); |
3507 | phba->brd_no, vport->vpi); | ||
3508 | |||
3509 | icmd = &cmdiocb->iocb; | 3434 | icmd = &cmdiocb->iocb; |
3510 | did = icmd->un.elsreq64.remoteID; | 3435 | did = icmd->un.elsreq64.remoteID; |
3511 | pcmd = (struct lpfc_dmabuf *)cmdiocb->context2; | 3436 | pcmd = (struct lpfc_dmabuf *)cmdiocb->context2; |
@@ -3664,13 +3589,10 @@ lpfc_els_timeout_handler(struct lpfc_vport *vport) | |||
3664 | if (ndlp) | 3589 | if (ndlp) |
3665 | remote_ID = ndlp->nlp_DID; | 3590 | remote_ID = ndlp->nlp_DID; |
3666 | } | 3591 | } |
3667 | 3592 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, | |
3668 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 3593 | "0127 ELS timeout Data: x%x x%x x%x " |
3669 | "%d (%d):0127 ELS timeout Data: x%x x%x x%x " | 3594 | "x%x\n", els_command, |
3670 | "x%x\n", | 3595 | remote_ID, cmd->ulpCommand, cmd->ulpIoTag); |
3671 | phba->brd_no, vport->vpi, els_command, | ||
3672 | remote_ID, cmd->ulpCommand, cmd->ulpIoTag); | ||
3673 | |||
3674 | lpfc_sli_issue_abort_iotag(phba, pring, piocb); | 3596 | lpfc_sli_issue_abort_iotag(phba, pring, piocb); |
3675 | } | 3597 | } |
3676 | spin_unlock_irq(&phba->hbalock); | 3598 | spin_unlock_irq(&phba->hbalock); |
@@ -3741,6 +3663,50 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport) | |||
3741 | return; | 3663 | return; |
3742 | } | 3664 | } |
3743 | 3665 | ||
3666 | void | ||
3667 | lpfc_els_flush_all_cmd(struct lpfc_hba *phba) | ||
3668 | { | ||
3669 | LIST_HEAD(completions); | ||
3670 | struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; | ||
3671 | struct lpfc_iocbq *tmp_iocb, *piocb; | ||
3672 | IOCB_t *cmd = NULL; | ||
3673 | |||
3674 | lpfc_fabric_abort_hba(phba); | ||
3675 | spin_lock_irq(&phba->hbalock); | ||
3676 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txq, list) { | ||
3677 | cmd = &piocb->iocb; | ||
3678 | if (piocb->iocb_flag & LPFC_IO_LIBDFC) | ||
3679 | continue; | ||
3680 | /* Do not flush out the QUE_RING and ABORT/CLOSE iocbs */ | ||
3681 | if (cmd->ulpCommand == CMD_QUE_RING_BUF_CN || | ||
3682 | cmd->ulpCommand == CMD_QUE_RING_BUF64_CN || | ||
3683 | cmd->ulpCommand == CMD_CLOSE_XRI_CN || | ||
3684 | cmd->ulpCommand == CMD_ABORT_XRI_CN) | ||
3685 | continue; | ||
3686 | list_move_tail(&piocb->list, &completions); | ||
3687 | pring->txq_cnt--; | ||
3688 | } | ||
3689 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { | ||
3690 | if (piocb->iocb_flag & LPFC_IO_LIBDFC) | ||
3691 | continue; | ||
3692 | lpfc_sli_issue_abort_iotag(phba, pring, piocb); | ||
3693 | } | ||
3694 | spin_unlock_irq(&phba->hbalock); | ||
3695 | while (!list_empty(&completions)) { | ||
3696 | piocb = list_get_first(&completions, struct lpfc_iocbq, list); | ||
3697 | cmd = &piocb->iocb; | ||
3698 | list_del_init(&piocb->list); | ||
3699 | if (!piocb->iocb_cmpl) | ||
3700 | lpfc_sli_release_iocbq(phba, piocb); | ||
3701 | else { | ||
3702 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
3703 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
3704 | (piocb->iocb_cmpl) (phba, piocb, piocb); | ||
3705 | } | ||
3706 | } | ||
3707 | return; | ||
3708 | } | ||
3709 | |||
3744 | static void | 3710 | static void |
3745 | lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | 3711 | lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, |
3746 | struct lpfc_vport *vport, struct lpfc_iocbq *elsiocb) | 3712 | struct lpfc_vport *vport, struct lpfc_iocbq *elsiocb) |
@@ -3801,11 +3767,9 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3801 | cmd &= ELS_CMD_MASK; | 3767 | cmd &= ELS_CMD_MASK; |
3802 | } | 3768 | } |
3803 | /* ELS command <elsCmd> received from NPORT <did> */ | 3769 | /* ELS command <elsCmd> received from NPORT <did> */ |
3804 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 3770 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
3805 | "%d (%d):0112 ELS command x%x received from NPORT x%x " | 3771 | "0112 ELS command x%x received from NPORT x%x " |
3806 | "Data: x%x\n", phba->brd_no, vport->vpi, cmd, did, | 3772 | "Data: x%x\n", cmd, did, vport->port_state); |
3807 | vport->port_state); | ||
3808 | |||
3809 | switch (cmd) { | 3773 | switch (cmd) { |
3810 | case ELS_CMD_PLOGI: | 3774 | case ELS_CMD_PLOGI: |
3811 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, | 3775 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, |
@@ -3829,7 +3793,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3829 | did, vport->port_state, ndlp->nlp_flag); | 3793 | did, vport->port_state, ndlp->nlp_flag); |
3830 | 3794 | ||
3831 | phba->fc_stat.elsRcvFLOGI++; | 3795 | phba->fc_stat.elsRcvFLOGI++; |
3832 | lpfc_els_rcv_flogi(vport, elsiocb, ndlp, newnode); | 3796 | lpfc_els_rcv_flogi(vport, elsiocb, ndlp); |
3833 | if (newnode) | 3797 | if (newnode) |
3834 | lpfc_drop_node(vport, ndlp); | 3798 | lpfc_drop_node(vport, ndlp); |
3835 | break; | 3799 | break; |
@@ -3859,7 +3823,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3859 | break; | 3823 | break; |
3860 | case ELS_CMD_RSCN: | 3824 | case ELS_CMD_RSCN: |
3861 | phba->fc_stat.elsRcvRSCN++; | 3825 | phba->fc_stat.elsRcvRSCN++; |
3862 | lpfc_els_rcv_rscn(vport, elsiocb, ndlp, newnode); | 3826 | lpfc_els_rcv_rscn(vport, elsiocb, ndlp); |
3863 | if (newnode) | 3827 | if (newnode) |
3864 | lpfc_drop_node(vport, ndlp); | 3828 | lpfc_drop_node(vport, ndlp); |
3865 | break; | 3829 | break; |
@@ -3974,10 +3938,9 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3974 | rjt_err = LSRJT_INVALID_CMD; | 3938 | rjt_err = LSRJT_INVALID_CMD; |
3975 | 3939 | ||
3976 | /* Unknown ELS command <elsCmd> received from NPORT <did> */ | 3940 | /* Unknown ELS command <elsCmd> received from NPORT <did> */ |
3977 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 3941 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
3978 | "%d (%d):0115 Unknown ELS command x%x " | 3942 | "0115 Unknown ELS command x%x " |
3979 | "received from NPORT x%x\n", | 3943 | "received from NPORT x%x\n", cmd, did); |
3980 | phba->brd_no, vport->vpi, cmd, did); | ||
3981 | if (newnode) | 3944 | if (newnode) |
3982 | lpfc_drop_node(vport, ndlp); | 3945 | lpfc_drop_node(vport, ndlp); |
3983 | break; | 3946 | break; |
@@ -3990,19 +3953,16 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3990 | stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE; | 3953 | stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE; |
3991 | lpfc_els_rsp_reject(vport, stat.un.lsRjtError, elsiocb, ndlp, | 3954 | lpfc_els_rsp_reject(vport, stat.un.lsRjtError, elsiocb, ndlp, |
3992 | NULL); | 3955 | NULL); |
3993 | if (newnode) | ||
3994 | lpfc_drop_node(vport, ndlp); | ||
3995 | } | 3956 | } |
3996 | 3957 | ||
3997 | return; | 3958 | return; |
3998 | 3959 | ||
3999 | dropit: | 3960 | dropit: |
4000 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 3961 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, |
4001 | "%d (%d):0111 Dropping received ELS cmd " | 3962 | "(%d):0111 Dropping received ELS cmd " |
4002 | "Data: x%x x%x x%x\n", | 3963 | "Data: x%x x%x x%x\n", |
4003 | phba->brd_no, vport ? vport->vpi : 0xffff, | 3964 | vport ? vport->vpi : 0xffff, icmd->ulpStatus, |
4004 | icmd->ulpStatus, icmd->un.ulpWord[4], | 3965 | icmd->un.ulpWord[4], icmd->ulpTimeout); |
4005 | icmd->ulpTimeout); | ||
4006 | phba->fc_stat.elsRcvDrop++; | 3966 | phba->fc_stat.elsRcvDrop++; |
4007 | } | 3967 | } |
4008 | 3968 | ||
@@ -4010,11 +3970,16 @@ static struct lpfc_vport * | |||
4010 | lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi) | 3970 | lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi) |
4011 | { | 3971 | { |
4012 | struct lpfc_vport *vport; | 3972 | struct lpfc_vport *vport; |
3973 | unsigned long flags; | ||
4013 | 3974 | ||
3975 | spin_lock_irqsave(&phba->hbalock, flags); | ||
4014 | list_for_each_entry(vport, &phba->port_list, listentry) { | 3976 | list_for_each_entry(vport, &phba->port_list, listentry) { |
4015 | if (vport->vpi == vpi) | 3977 | if (vport->vpi == vpi) { |
3978 | spin_unlock_irqrestore(&phba->hbalock, flags); | ||
4016 | return vport; | 3979 | return vport; |
3980 | } | ||
4017 | } | 3981 | } |
3982 | spin_unlock_irqrestore(&phba->hbalock, flags); | ||
4018 | return NULL; | 3983 | return NULL; |
4019 | } | 3984 | } |
4020 | 3985 | ||
@@ -4109,9 +4074,8 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport) | |||
4109 | return; | 4074 | return; |
4110 | } | 4075 | } |
4111 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 4076 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
4112 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 4077 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
4113 | "%d (%d):0251 NameServer login: no memory\n", | 4078 | "0251 NameServer login: no memory\n"); |
4114 | phba->brd_no, vport->vpi); | ||
4115 | return; | 4079 | return; |
4116 | } | 4080 | } |
4117 | lpfc_nlp_init(vport, ndlp, NameServer_DID); | 4081 | lpfc_nlp_init(vport, ndlp, NameServer_DID); |
@@ -4122,13 +4086,12 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport) | |||
4122 | 4086 | ||
4123 | if (lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0)) { | 4087 | if (lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0)) { |
4124 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 4088 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
4125 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 4089 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
4126 | "%d (%d):0252 Cannot issue NameServer login\n", | 4090 | "0252 Cannot issue NameServer login\n"); |
4127 | phba->brd_no, vport->vpi); | ||
4128 | return; | 4091 | return; |
4129 | } | 4092 | } |
4130 | 4093 | ||
4131 | if (phba->cfg_fdmi_on) { | 4094 | if (vport->cfg_fdmi_on) { |
4132 | ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool, | 4095 | ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool, |
4133 | GFP_KERNEL); | 4096 | GFP_KERNEL); |
4134 | if (ndlp_fdmi) { | 4097 | if (ndlp_fdmi) { |
@@ -4155,9 +4118,9 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
4155 | lpfc_nlp_put(ndlp); | 4118 | lpfc_nlp_put(ndlp); |
4156 | 4119 | ||
4157 | if (mb->mbxStatus) { | 4120 | if (mb->mbxStatus) { |
4158 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | 4121 | lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, |
4159 | "%d (%d):0915 Register VPI failed: 0x%x\n", | 4122 | "0915 Register VPI failed: 0x%x\n", |
4160 | phba->brd_no, vport->vpi, mb->mbxStatus); | 4123 | mb->mbxStatus); |
4161 | 4124 | ||
4162 | switch (mb->mbxStatus) { | 4125 | switch (mb->mbxStatus) { |
4163 | case 0x11: /* unsupported feature */ | 4126 | case 0x11: /* unsupported feature */ |
@@ -4206,17 +4169,14 @@ lpfc_register_new_vport(struct lpfc_hba *phba, struct lpfc_vport *vport, | |||
4206 | vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI; | 4169 | vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI; |
4207 | 4170 | ||
4208 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 4171 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
4209 | 4172 | lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, | |
4210 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | 4173 | "0253 Register VPI: Can't send mbox\n"); |
4211 | "%d (%d):0253 Register VPI: Cannot send mbox\n", | ||
4212 | phba->brd_no, vport->vpi); | ||
4213 | } | 4174 | } |
4214 | } else { | 4175 | } else { |
4215 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 4176 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
4216 | 4177 | ||
4217 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | 4178 | lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, |
4218 | "%d (%d):0254 Register VPI: no memory\n", | 4179 | "0254 Register VPI: no memory\n"); |
4219 | phba->brd_no, vport->vpi); | ||
4220 | 4180 | ||
4221 | vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI; | 4181 | vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI; |
4222 | lpfc_nlp_put(ndlp); | 4182 | lpfc_nlp_put(ndlp); |
@@ -4235,11 +4195,10 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
4235 | IOCB_t *irsp = &rspiocb->iocb; | 4195 | IOCB_t *irsp = &rspiocb->iocb; |
4236 | struct lpfc_iocbq *piocb; | 4196 | struct lpfc_iocbq *piocb; |
4237 | 4197 | ||
4238 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 4198 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
4239 | "%d (%d):0123 FDISC completes. x%x/x%x prevDID: x%x\n", | 4199 | "0123 FDISC completes. x%x/x%x prevDID: x%x\n", |
4240 | phba->brd_no, vport->vpi, | 4200 | irsp->ulpStatus, irsp->un.ulpWord[4], |
4241 | irsp->ulpStatus, irsp->un.ulpWord[4], vport->fc_prevDID); | 4201 | vport->fc_prevDID); |
4242 | |||
4243 | /* Since all FDISCs are being single threaded, we | 4202 | /* Since all FDISCs are being single threaded, we |
4244 | * must reset the discovery timer for ALL vports | 4203 | * must reset the discovery timer for ALL vports |
4245 | * waiting to send FDISC when one completes. | 4204 | * waiting to send FDISC when one completes. |
@@ -4256,13 +4215,10 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
4256 | /* Check for retry */ | 4215 | /* Check for retry */ |
4257 | if (lpfc_els_retry(phba, cmdiocb, rspiocb)) | 4216 | if (lpfc_els_retry(phba, cmdiocb, rspiocb)) |
4258 | goto out; | 4217 | goto out; |
4259 | |||
4260 | /* FDISC failed */ | 4218 | /* FDISC failed */ |
4261 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 4219 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
4262 | "%d (%d):0124 FDISC failed. (%d/%d)\n", | 4220 | "0124 FDISC failed. (%d/%d)\n", |
4263 | phba->brd_no, vport->vpi, | 4221 | irsp->ulpStatus, irsp->un.ulpWord[4]); |
4264 | irsp->ulpStatus, irsp->un.ulpWord[4]); | ||
4265 | |||
4266 | if (vport->fc_vport->vport_state == FC_VPORT_INITIALIZING) | 4222 | if (vport->fc_vport->vport_state == FC_VPORT_INITIALIZING) |
4267 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 4223 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
4268 | 4224 | ||
@@ -4328,10 +4284,8 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
4328 | ELS_CMD_FDISC); | 4284 | ELS_CMD_FDISC); |
4329 | if (!elsiocb) { | 4285 | if (!elsiocb) { |
4330 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 4286 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
4331 | 4287 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, | |
4332 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 4288 | "0255 Issue FDISC: no IOCB\n"); |
4333 | "%d (%d):0255 Issue FDISC: no IOCB\n", | ||
4334 | phba->brd_no, vport->vpi); | ||
4335 | return 1; | 4289 | return 1; |
4336 | } | 4290 | } |
4337 | 4291 | ||
@@ -4377,11 +4331,8 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
4377 | if (rc == IOCB_ERROR) { | 4331 | if (rc == IOCB_ERROR) { |
4378 | lpfc_els_free_iocb(phba, elsiocb); | 4332 | lpfc_els_free_iocb(phba, elsiocb); |
4379 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 4333 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
4380 | 4334 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, | |
4381 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 4335 | "0256 Issue FDISC: Cannot send IOCB\n"); |
4382 | "%d (%d):0256 Issue FDISC: Cannot send IOCB\n", | ||
4383 | phba->brd_no, vport->vpi); | ||
4384 | |||
4385 | return 1; | 4336 | return 1; |
4386 | } | 4337 | } |
4387 | lpfc_vport_set_state(vport, FC_VPORT_INITIALIZING); | 4338 | lpfc_vport_set_state(vport, FC_VPORT_INITIALIZING); |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index f2f4639eab59..c81c2b3228d6 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -83,10 +83,17 @@ lpfc_terminate_rport_io(struct fc_rport *rport) | |||
83 | ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); | 83 | ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); |
84 | 84 | ||
85 | if (ndlp->nlp_sid != NLP_NO_SID) { | 85 | if (ndlp->nlp_sid != NLP_NO_SID) { |
86 | lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], | 86 | lpfc_sli_abort_iocb(ndlp->vport, |
87 | ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT); | 87 | &phba->sli.ring[phba->sli.fcp_ring], |
88 | ndlp->nlp_sid, 0, LPFC_CTX_TGT); | ||
88 | } | 89 | } |
89 | 90 | ||
91 | /* | ||
92 | * A device is normally blocked for rediscovery and unblocked when | ||
93 | * devloss timeout happens. In case a vport is removed or driver | ||
94 | * unloaded before devloss timeout happens, we need to unblock here. | ||
95 | */ | ||
96 | scsi_target_unblock(&rport->dev); | ||
90 | return; | 97 | return; |
91 | } | 98 | } |
92 | 99 | ||
@@ -194,32 +201,30 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) | |||
194 | if (ndlp->nlp_sid != NLP_NO_SID) { | 201 | if (ndlp->nlp_sid != NLP_NO_SID) { |
195 | warn_on = 1; | 202 | warn_on = 1; |
196 | /* flush the target */ | 203 | /* flush the target */ |
197 | lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], | 204 | lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring], |
198 | ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT); | 205 | ndlp->nlp_sid, 0, LPFC_CTX_TGT); |
199 | } | 206 | } |
200 | if (vport->load_flag & FC_UNLOADING) | 207 | if (vport->load_flag & FC_UNLOADING) |
201 | warn_on = 0; | 208 | warn_on = 0; |
202 | 209 | ||
203 | if (warn_on) { | 210 | if (warn_on) { |
204 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 211 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
205 | "%d (%d):0203 Devloss timeout on " | 212 | "0203 Devloss timeout on " |
206 | "WWPN %x:%x:%x:%x:%x:%x:%x:%x " | 213 | "WWPN %x:%x:%x:%x:%x:%x:%x:%x " |
207 | "NPort x%x Data: x%x x%x x%x\n", | 214 | "NPort x%x Data: x%x x%x x%x\n", |
208 | phba->brd_no, vport->vpi, | 215 | *name, *(name+1), *(name+2), *(name+3), |
209 | *name, *(name+1), *(name+2), *(name+3), | 216 | *(name+4), *(name+5), *(name+6), *(name+7), |
210 | *(name+4), *(name+5), *(name+6), *(name+7), | 217 | ndlp->nlp_DID, ndlp->nlp_flag, |
211 | ndlp->nlp_DID, ndlp->nlp_flag, | 218 | ndlp->nlp_state, ndlp->nlp_rpi); |
212 | ndlp->nlp_state, ndlp->nlp_rpi); | ||
213 | } else { | 219 | } else { |
214 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 220 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
215 | "%d (%d):0204 Devloss timeout on " | 221 | "0204 Devloss timeout on " |
216 | "WWPN %x:%x:%x:%x:%x:%x:%x:%x " | 222 | "WWPN %x:%x:%x:%x:%x:%x:%x:%x " |
217 | "NPort x%x Data: x%x x%x x%x\n", | 223 | "NPort x%x Data: x%x x%x x%x\n", |
218 | phba->brd_no, vport->vpi, | 224 | *name, *(name+1), *(name+2), *(name+3), |
219 | *name, *(name+1), *(name+2), *(name+3), | 225 | *(name+4), *(name+5), *(name+6), *(name+7), |
220 | *(name+4), *(name+5), *(name+6), *(name+7), | 226 | ndlp->nlp_DID, ndlp->nlp_flag, |
221 | ndlp->nlp_DID, ndlp->nlp_flag, | 227 | ndlp->nlp_state, ndlp->nlp_rpi); |
222 | ndlp->nlp_state, ndlp->nlp_rpi); | ||
223 | } | 228 | } |
224 | 229 | ||
225 | if (!(vport->load_flag & FC_UNLOADING) && | 230 | if (!(vport->load_flag & FC_UNLOADING) && |
@@ -344,12 +349,14 @@ lpfc_work_list_done(struct lpfc_hba *phba) | |||
344 | 349 | ||
345 | } | 350 | } |
346 | 351 | ||
347 | void | 352 | static void |
348 | lpfc_work_done(struct lpfc_hba *phba) | 353 | lpfc_work_done(struct lpfc_hba *phba) |
349 | { | 354 | { |
350 | struct lpfc_sli_ring *pring; | 355 | struct lpfc_sli_ring *pring; |
351 | uint32_t ha_copy, status, control, work_port_events; | 356 | uint32_t ha_copy, status, control, work_port_events; |
357 | struct lpfc_vport **vports; | ||
352 | struct lpfc_vport *vport; | 358 | struct lpfc_vport *vport; |
359 | int i; | ||
353 | 360 | ||
354 | spin_lock_irq(&phba->hbalock); | 361 | spin_lock_irq(&phba->hbalock); |
355 | ha_copy = phba->work_ha; | 362 | ha_copy = phba->work_ha; |
@@ -364,48 +371,41 @@ lpfc_work_done(struct lpfc_hba *phba) | |||
364 | 371 | ||
365 | if (ha_copy & HA_LATT) | 372 | if (ha_copy & HA_LATT) |
366 | lpfc_handle_latt(phba); | 373 | lpfc_handle_latt(phba); |
367 | 374 | vports = lpfc_create_vport_work_array(phba); | |
368 | spin_lock_irq(&phba->hbalock); | 375 | if (vports != NULL) |
369 | list_for_each_entry(vport, &phba->port_list, listentry) { | 376 | for(i = 0; i < LPFC_MAX_VPORTS; i++) { |
370 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 377 | /* |
371 | 378 | * We could have no vports in array if unloading, so if | |
372 | if (!scsi_host_get(shost)) { | 379 | * this happens then just use the pport |
373 | continue; | 380 | */ |
381 | if (vports[i] == NULL && i == 0) | ||
382 | vport = phba->pport; | ||
383 | else | ||
384 | vport = vports[i]; | ||
385 | if (vport == NULL) | ||
386 | break; | ||
387 | work_port_events = vport->work_port_events; | ||
388 | if (work_port_events & WORKER_DISC_TMO) | ||
389 | lpfc_disc_timeout_handler(vport); | ||
390 | if (work_port_events & WORKER_ELS_TMO) | ||
391 | lpfc_els_timeout_handler(vport); | ||
392 | if (work_port_events & WORKER_HB_TMO) | ||
393 | lpfc_hb_timeout_handler(phba); | ||
394 | if (work_port_events & WORKER_MBOX_TMO) | ||
395 | lpfc_mbox_timeout_handler(phba); | ||
396 | if (work_port_events & WORKER_FABRIC_BLOCK_TMO) | ||
397 | lpfc_unblock_fabric_iocbs(phba); | ||
398 | if (work_port_events & WORKER_FDMI_TMO) | ||
399 | lpfc_fdmi_timeout_handler(vport); | ||
400 | if (work_port_events & WORKER_RAMP_DOWN_QUEUE) | ||
401 | lpfc_ramp_down_queue_handler(phba); | ||
402 | if (work_port_events & WORKER_RAMP_UP_QUEUE) | ||
403 | lpfc_ramp_up_queue_handler(phba); | ||
404 | spin_lock_irq(&vport->work_port_lock); | ||
405 | vport->work_port_events &= ~work_port_events; | ||
406 | spin_unlock_irq(&vport->work_port_lock); | ||
374 | } | 407 | } |
375 | spin_unlock_irq(&phba->hbalock); | 408 | lpfc_destroy_vport_work_array(vports); |
376 | work_port_events = vport->work_port_events; | ||
377 | |||
378 | if (work_port_events & WORKER_DISC_TMO) | ||
379 | lpfc_disc_timeout_handler(vport); | ||
380 | |||
381 | if (work_port_events & WORKER_ELS_TMO) | ||
382 | lpfc_els_timeout_handler(vport); | ||
383 | |||
384 | if (work_port_events & WORKER_HB_TMO) | ||
385 | lpfc_hb_timeout_handler(phba); | ||
386 | |||
387 | if (work_port_events & WORKER_MBOX_TMO) | ||
388 | lpfc_mbox_timeout_handler(phba); | ||
389 | |||
390 | if (work_port_events & WORKER_FABRIC_BLOCK_TMO) | ||
391 | lpfc_unblock_fabric_iocbs(phba); | ||
392 | |||
393 | if (work_port_events & WORKER_FDMI_TMO) | ||
394 | lpfc_fdmi_timeout_handler(vport); | ||
395 | |||
396 | if (work_port_events & WORKER_RAMP_DOWN_QUEUE) | ||
397 | lpfc_ramp_down_queue_handler(phba); | ||
398 | |||
399 | if (work_port_events & WORKER_RAMP_UP_QUEUE) | ||
400 | lpfc_ramp_up_queue_handler(phba); | ||
401 | |||
402 | spin_lock_irq(&vport->work_port_lock); | ||
403 | vport->work_port_events &= ~work_port_events; | ||
404 | spin_unlock_irq(&vport->work_port_lock); | ||
405 | scsi_host_put(shost); | ||
406 | spin_lock_irq(&phba->hbalock); | ||
407 | } | ||
408 | spin_unlock_irq(&phba->hbalock); | ||
409 | 409 | ||
410 | pring = &phba->sli.ring[LPFC_ELS_RING]; | 410 | pring = &phba->sli.ring[LPFC_ELS_RING]; |
411 | status = (ha_copy & (HA_RXMASK << (4*LPFC_ELS_RING))); | 411 | status = (ha_copy & (HA_RXMASK << (4*LPFC_ELS_RING))); |
@@ -426,10 +426,19 @@ lpfc_work_done(struct lpfc_hba *phba) | |||
426 | spin_lock_irq(&phba->hbalock); | 426 | spin_lock_irq(&phba->hbalock); |
427 | control = readl(phba->HCregaddr); | 427 | control = readl(phba->HCregaddr); |
428 | if (!(control & (HC_R0INT_ENA << LPFC_ELS_RING))) { | 428 | if (!(control & (HC_R0INT_ENA << LPFC_ELS_RING))) { |
429 | lpfc_debugfs_slow_ring_trc(phba, | ||
430 | "WRK Enable ring: cntl:x%x hacopy:x%x", | ||
431 | control, ha_copy, 0); | ||
432 | |||
429 | control |= (HC_R0INT_ENA << LPFC_ELS_RING); | 433 | control |= (HC_R0INT_ENA << LPFC_ELS_RING); |
430 | writel(control, phba->HCregaddr); | 434 | writel(control, phba->HCregaddr); |
431 | readl(phba->HCregaddr); /* flush */ | 435 | readl(phba->HCregaddr); /* flush */ |
432 | } | 436 | } |
437 | else { | ||
438 | lpfc_debugfs_slow_ring_trc(phba, | ||
439 | "WRK Ring ok: cntl:x%x hacopy:x%x", | ||
440 | control, ha_copy, 0); | ||
441 | } | ||
433 | spin_unlock_irq(&phba->hbalock); | 442 | spin_unlock_irq(&phba->hbalock); |
434 | } | 443 | } |
435 | lpfc_work_list_done(phba); | 444 | lpfc_work_list_done(phba); |
@@ -439,32 +448,22 @@ static int | |||
439 | check_work_wait_done(struct lpfc_hba *phba) | 448 | check_work_wait_done(struct lpfc_hba *phba) |
440 | { | 449 | { |
441 | struct lpfc_vport *vport; | 450 | struct lpfc_vport *vport; |
442 | struct lpfc_sli_ring *pring; | 451 | struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; |
443 | int rc = 0; | 452 | int rc = 0; |
444 | 453 | ||
445 | spin_lock_irq(&phba->hbalock); | 454 | spin_lock_irq(&phba->hbalock); |
446 | list_for_each_entry(vport, &phba->port_list, listentry) { | 455 | list_for_each_entry(vport, &phba->port_list, listentry) { |
447 | if (vport->work_port_events) { | 456 | if (vport->work_port_events) { |
448 | rc = 1; | 457 | rc = 1; |
449 | goto exit; | 458 | break; |
450 | } | 459 | } |
451 | } | 460 | } |
452 | 461 | if (rc || phba->work_ha || (!list_empty(&phba->work_list)) || | |
453 | if (phba->work_ha || (!list_empty(&phba->work_list)) || | 462 | kthread_should_stop() || pring->flag & LPFC_DEFERRED_RING_EVENT) { |
454 | kthread_should_stop()) { | ||
455 | rc = 1; | ||
456 | goto exit; | ||
457 | } | ||
458 | |||
459 | pring = &phba->sli.ring[LPFC_ELS_RING]; | ||
460 | if (pring->flag & LPFC_DEFERRED_RING_EVENT) | ||
461 | rc = 1; | 463 | rc = 1; |
462 | exit: | ||
463 | if (rc) | ||
464 | phba->work_found++; | 464 | phba->work_found++; |
465 | else | 465 | } else |
466 | phba->work_found = 0; | 466 | phba->work_found = 0; |
467 | |||
468 | spin_unlock_irq(&phba->hbalock); | 467 | spin_unlock_irq(&phba->hbalock); |
469 | return rc; | 468 | return rc; |
470 | } | 469 | } |
@@ -592,7 +591,6 @@ lpfc_linkdown_port(struct lpfc_vport *vport) | |||
592 | 591 | ||
593 | /* free any ndlp's on unused list */ | 592 | /* free any ndlp's on unused list */ |
594 | list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) | 593 | list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) |
595 | /* free any ndlp's in unused state */ | ||
596 | if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) | 594 | if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) |
597 | lpfc_drop_node(vport, ndlp); | 595 | lpfc_drop_node(vport, ndlp); |
598 | 596 | ||
@@ -605,8 +603,9 @@ lpfc_linkdown(struct lpfc_hba *phba) | |||
605 | { | 603 | { |
606 | struct lpfc_vport *vport = phba->pport; | 604 | struct lpfc_vport *vport = phba->pport; |
607 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 605 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
608 | struct lpfc_vport *port_iterator; | 606 | struct lpfc_vport **vports; |
609 | LPFC_MBOXQ_t *mb; | 607 | LPFC_MBOXQ_t *mb; |
608 | int i; | ||
610 | 609 | ||
611 | if (phba->link_state == LPFC_LINK_DOWN) { | 610 | if (phba->link_state == LPFC_LINK_DOWN) { |
612 | return 0; | 611 | return 0; |
@@ -617,13 +616,13 @@ lpfc_linkdown(struct lpfc_hba *phba) | |||
617 | phba->pport->fc_flag &= ~FC_LBIT; | 616 | phba->pport->fc_flag &= ~FC_LBIT; |
618 | } | 617 | } |
619 | spin_unlock_irq(&phba->hbalock); | 618 | spin_unlock_irq(&phba->hbalock); |
620 | 619 | vports = lpfc_create_vport_work_array(phba); | |
621 | list_for_each_entry(port_iterator, &phba->port_list, listentry) { | 620 | if (vports != NULL) |
622 | 621 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { | |
623 | /* Issue a LINK DOWN event to all nodes */ | 622 | /* Issue a LINK DOWN event to all nodes */ |
624 | lpfc_linkdown_port(port_iterator); | 623 | lpfc_linkdown_port(vports[i]); |
625 | } | 624 | } |
626 | 625 | lpfc_destroy_vport_work_array(vports); | |
627 | /* Clean up any firmware default rpi's */ | 626 | /* Clean up any firmware default rpi's */ |
628 | mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 627 | mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
629 | if (mb) { | 628 | if (mb) { |
@@ -724,7 +723,8 @@ lpfc_linkup_port(struct lpfc_vport *vport) | |||
724 | static int | 723 | static int |
725 | lpfc_linkup(struct lpfc_hba *phba) | 724 | lpfc_linkup(struct lpfc_hba *phba) |
726 | { | 725 | { |
727 | struct lpfc_vport *vport; | 726 | struct lpfc_vport **vports; |
727 | int i; | ||
728 | 728 | ||
729 | phba->link_state = LPFC_LINK_UP; | 729 | phba->link_state = LPFC_LINK_UP; |
730 | 730 | ||
@@ -732,9 +732,11 @@ lpfc_linkup(struct lpfc_hba *phba) | |||
732 | clear_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags); | 732 | clear_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags); |
733 | del_timer_sync(&phba->fabric_block_timer); | 733 | del_timer_sync(&phba->fabric_block_timer); |
734 | 734 | ||
735 | list_for_each_entry(vport, &phba->port_list, listentry) { | 735 | vports = lpfc_create_vport_work_array(phba); |
736 | lpfc_linkup_port(vport); | 736 | if (vports != NULL) |
737 | } | 737 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) |
738 | lpfc_linkup_port(vports[i]); | ||
739 | lpfc_destroy_vport_work_array(vports); | ||
738 | if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) | 740 | if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) |
739 | lpfc_issue_clear_la(phba, phba->pport); | 741 | lpfc_issue_clear_la(phba, phba->pport); |
740 | 742 | ||
@@ -764,12 +766,10 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
764 | /* Check for error */ | 766 | /* Check for error */ |
765 | if ((mb->mbxStatus) && (mb->mbxStatus != 0x1601)) { | 767 | if ((mb->mbxStatus) && (mb->mbxStatus != 0x1601)) { |
766 | /* CLEAR_LA mbox error <mbxStatus> state <hba_state> */ | 768 | /* CLEAR_LA mbox error <mbxStatus> state <hba_state> */ |
767 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | 769 | lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, |
768 | "%d (%d):0320 CLEAR_LA mbxStatus error x%x hba " | 770 | "0320 CLEAR_LA mbxStatus error x%x hba " |
769 | "state x%x\n", | 771 | "state x%x\n", |
770 | phba->brd_no, vport->vpi, mb->mbxStatus, | 772 | mb->mbxStatus, vport->port_state); |
771 | vport->port_state); | ||
772 | |||
773 | phba->link_state = LPFC_HBA_ERROR; | 773 | phba->link_state = LPFC_HBA_ERROR; |
774 | goto out; | 774 | goto out; |
775 | } | 775 | } |
@@ -801,10 +801,8 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
801 | 801 | ||
802 | out: | 802 | out: |
803 | /* Device Discovery completes */ | 803 | /* Device Discovery completes */ |
804 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 804 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
805 | "%d (%d):0225 Device Discovery completes\n", | 805 | "0225 Device Discovery completes\n"); |
806 | phba->brd_no, vport->vpi); | ||
807 | |||
808 | mempool_free(pmb, phba->mbox_mem_pool); | 806 | mempool_free(pmb, phba->mbox_mem_pool); |
809 | 807 | ||
810 | spin_lock_irq(shost->host_lock); | 808 | spin_lock_irq(shost->host_lock); |
@@ -861,19 +859,17 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
861 | return; | 859 | return; |
862 | 860 | ||
863 | out: | 861 | out: |
864 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | 862 | lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, |
865 | "%d (%d):0306 CONFIG_LINK mbxStatus error x%x " | 863 | "0306 CONFIG_LINK mbxStatus error x%x " |
866 | "HBA state x%x\n", | 864 | "HBA state x%x\n", |
867 | phba->brd_no, vport->vpi, pmb->mb.mbxStatus, | 865 | pmb->mb.mbxStatus, vport->port_state); |
868 | vport->port_state); | ||
869 | |||
870 | mempool_free(pmb, phba->mbox_mem_pool); | 866 | mempool_free(pmb, phba->mbox_mem_pool); |
871 | 867 | ||
872 | lpfc_linkdown(phba); | 868 | lpfc_linkdown(phba); |
873 | 869 | ||
874 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 870 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
875 | "%d (%d):0200 CONFIG_LINK bad hba state x%x\n", | 871 | "0200 CONFIG_LINK bad hba state x%x\n", |
876 | phba->brd_no, vport->vpi, vport->port_state); | 872 | vport->port_state); |
877 | 873 | ||
878 | lpfc_issue_clear_la(phba, vport); | 874 | lpfc_issue_clear_la(phba, vport); |
879 | return; | 875 | return; |
@@ -890,12 +886,10 @@ lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
890 | /* Check for error */ | 886 | /* Check for error */ |
891 | if (mb->mbxStatus) { | 887 | if (mb->mbxStatus) { |
892 | /* READ_SPARAM mbox error <mbxStatus> state <hba_state> */ | 888 | /* READ_SPARAM mbox error <mbxStatus> state <hba_state> */ |
893 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | 889 | lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, |
894 | "%d (%d):0319 READ_SPARAM mbxStatus error x%x " | 890 | "0319 READ_SPARAM mbxStatus error x%x " |
895 | "hba state x%x>\n", | 891 | "hba state x%x>\n", |
896 | phba->brd_no, vport->vpi, mb->mbxStatus, | 892 | mb->mbxStatus, vport->port_state); |
897 | vport->port_state); | ||
898 | |||
899 | lpfc_linkdown(phba); | 893 | lpfc_linkdown(phba); |
900 | goto out; | 894 | goto out; |
901 | } | 895 | } |
@@ -978,7 +972,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) | |||
978 | if (i == 0) { | 972 | if (i == 0) { |
979 | phba->alpa_map[0] = 0; | 973 | phba->alpa_map[0] = 0; |
980 | } else { | 974 | } else { |
981 | if (phba->cfg_log_verbose & LOG_LINK_EVENT) { | 975 | if (vport->cfg_log_verbose & LOG_LINK_EVENT) { |
982 | int numalpa, j, k; | 976 | int numalpa, j, k; |
983 | union { | 977 | union { |
984 | uint8_t pamap[16]; | 978 | uint8_t pamap[16]; |
@@ -1004,10 +998,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) | |||
1004 | lpfc_printf_log(phba, | 998 | lpfc_printf_log(phba, |
1005 | KERN_WARNING, | 999 | KERN_WARNING, |
1006 | LOG_LINK_EVENT, | 1000 | LOG_LINK_EVENT, |
1007 | "%d:1304 Link Up Event " | 1001 | "1304 Link Up Event " |
1008 | "ALPA map Data: x%x " | 1002 | "ALPA map Data: x%x " |
1009 | "x%x x%x x%x\n", | 1003 | "x%x x%x x%x\n", |
1010 | phba->brd_no, | ||
1011 | un.pa.wd1, un.pa.wd2, | 1004 | un.pa.wd1, un.pa.wd2, |
1012 | un.pa.wd3, un.pa.wd4); | 1005 | un.pa.wd3, un.pa.wd4); |
1013 | } | 1006 | } |
@@ -1015,7 +1008,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) | |||
1015 | } | 1008 | } |
1016 | } else { | 1009 | } else { |
1017 | if (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { | 1010 | if (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { |
1018 | if (phba->max_vpi && phba->cfg_npiv_enable && | 1011 | if (phba->max_vpi && phba->cfg_enable_npiv && |
1019 | (phba->sli_rev == 3)) | 1012 | (phba->sli_rev == 3)) |
1020 | phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED; | 1013 | phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED; |
1021 | } | 1014 | } |
@@ -1055,11 +1048,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) | |||
1055 | } | 1048 | } |
1056 | out: | 1049 | out: |
1057 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 1050 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
1058 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | 1051 | lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, |
1059 | "%d (%d):0263 Discovery Mailbox error: state: 0x%x : %p %p\n", | 1052 | "0263 Discovery Mailbox error: state: 0x%x : %p %p\n", |
1060 | phba->brd_no, vport->vpi, | 1053 | vport->port_state, sparam_mbox, cfglink_mbox); |
1061 | vport->port_state, sparam_mbox, cfglink_mbox); | ||
1062 | |||
1063 | lpfc_issue_clear_la(phba, vport); | 1054 | lpfc_issue_clear_la(phba, vport); |
1064 | return; | 1055 | return; |
1065 | } | 1056 | } |
@@ -1100,8 +1091,8 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
1100 | /* Check for error */ | 1091 | /* Check for error */ |
1101 | if (mb->mbxStatus) { | 1092 | if (mb->mbxStatus) { |
1102 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, | 1093 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, |
1103 | "%d:1307 READ_LA mbox error x%x state x%x\n", | 1094 | "1307 READ_LA mbox error x%x state x%x\n", |
1104 | phba->brd_no, mb->mbxStatus, vport->port_state); | 1095 | mb->mbxStatus, vport->port_state); |
1105 | lpfc_mbx_issue_link_down(phba); | 1096 | lpfc_mbx_issue_link_down(phba); |
1106 | phba->link_state = LPFC_HBA_ERROR; | 1097 | phba->link_state = LPFC_HBA_ERROR; |
1107 | goto lpfc_mbx_cmpl_read_la_free_mbuf; | 1098 | goto lpfc_mbx_cmpl_read_la_free_mbuf; |
@@ -1132,26 +1123,26 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
1132 | phba->fc_stat.LinkUp++; | 1123 | phba->fc_stat.LinkUp++; |
1133 | if (phba->link_flag & LS_LOOPBACK_MODE) { | 1124 | if (phba->link_flag & LS_LOOPBACK_MODE) { |
1134 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, | 1125 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, |
1135 | "%d:1306 Link Up Event in loop back mode " | 1126 | "1306 Link Up Event in loop back mode " |
1136 | "x%x received Data: x%x x%x x%x x%x\n", | 1127 | "x%x received Data: x%x x%x x%x x%x\n", |
1137 | phba->brd_no, la->eventTag, phba->fc_eventTag, | 1128 | la->eventTag, phba->fc_eventTag, |
1138 | la->granted_AL_PA, la->UlnkSpeed, | 1129 | la->granted_AL_PA, la->UlnkSpeed, |
1139 | phba->alpa_map[0]); | 1130 | phba->alpa_map[0]); |
1140 | } else { | 1131 | } else { |
1141 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | 1132 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, |
1142 | "%d:1303 Link Up Event x%x received " | 1133 | "1303 Link Up Event x%x received " |
1143 | "Data: x%x x%x x%x x%x\n", | 1134 | "Data: x%x x%x x%x x%x\n", |
1144 | phba->brd_no, la->eventTag, phba->fc_eventTag, | 1135 | la->eventTag, phba->fc_eventTag, |
1145 | la->granted_AL_PA, la->UlnkSpeed, | 1136 | la->granted_AL_PA, la->UlnkSpeed, |
1146 | phba->alpa_map[0]); | 1137 | phba->alpa_map[0]); |
1147 | } | 1138 | } |
1148 | lpfc_mbx_process_link_up(phba, la); | 1139 | lpfc_mbx_process_link_up(phba, la); |
1149 | } else { | 1140 | } else { |
1150 | phba->fc_stat.LinkDown++; | 1141 | phba->fc_stat.LinkDown++; |
1151 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | 1142 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, |
1152 | "%d:1305 Link Down Event x%x received " | 1143 | "1305 Link Down Event x%x received " |
1153 | "Data: x%x x%x x%x\n", | 1144 | "Data: x%x x%x x%x\n", |
1154 | phba->brd_no, la->eventTag, phba->fc_eventTag, | 1145 | la->eventTag, phba->fc_eventTag, |
1155 | phba->pport->port_state, vport->fc_flag); | 1146 | phba->pport->port_state, vport->fc_flag); |
1156 | lpfc_mbx_issue_link_down(phba); | 1147 | lpfc_mbx_issue_link_down(phba); |
1157 | } | 1148 | } |
@@ -1199,10 +1190,9 @@ lpfc_mbx_cmpl_unreg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
1199 | case 0x0011: | 1190 | case 0x0011: |
1200 | case 0x0020: | 1191 | case 0x0020: |
1201 | case 0x9700: | 1192 | case 0x9700: |
1202 | lpfc_printf_log(phba, KERN_INFO, LOG_NODE, | 1193 | lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, |
1203 | "%d (%d):0911 cmpl_unreg_vpi, " | 1194 | "0911 cmpl_unreg_vpi, mb status = 0x%x\n", |
1204 | "mb status = 0x%x\n", | 1195 | mb->mbxStatus); |
1205 | phba->brd_no, vport->vpi, mb->mbxStatus); | ||
1206 | break; | 1196 | break; |
1207 | } | 1197 | } |
1208 | vport->unreg_vpi_cmpl = VPORT_OK; | 1198 | vport->unreg_vpi_cmpl = VPORT_OK; |
@@ -1231,9 +1221,8 @@ lpfc_mbx_unreg_vpi(struct lpfc_vport *vport) | |||
1231 | mbox->mbox_cmpl = lpfc_mbx_cmpl_unreg_vpi; | 1221 | mbox->mbox_cmpl = lpfc_mbx_cmpl_unreg_vpi; |
1232 | rc = lpfc_sli_issue_mbox(phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); | 1222 | rc = lpfc_sli_issue_mbox(phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); |
1233 | if (rc == MBX_NOT_FINISHED) { | 1223 | if (rc == MBX_NOT_FINISHED) { |
1234 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_VPORT, | 1224 | lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT, |
1235 | "%d (%d):1800 Could not issue unreg_vpi\n", | 1225 | "1800 Could not issue unreg_vpi\n"); |
1236 | phba->brd_no, vport->vpi); | ||
1237 | mempool_free(mbox, phba->mbox_mem_pool); | 1226 | mempool_free(mbox, phba->mbox_mem_pool); |
1238 | vport->unreg_vpi_cmpl = VPORT_ERROR; | 1227 | vport->unreg_vpi_cmpl = VPORT_ERROR; |
1239 | } | 1228 | } |
@@ -1250,9 +1239,9 @@ lpfc_mbx_cmpl_reg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
1250 | case 0x0011: | 1239 | case 0x0011: |
1251 | case 0x9601: | 1240 | case 0x9601: |
1252 | case 0x9602: | 1241 | case 0x9602: |
1253 | lpfc_printf_log(phba, KERN_INFO, LOG_NODE, | 1242 | lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, |
1254 | "%d (%d):0912 cmpl_reg_vpi, mb status = 0x%x\n", | 1243 | "0912 cmpl_reg_vpi, mb status = 0x%x\n", |
1255 | phba->brd_no, vport->vpi, mb->mbxStatus); | 1244 | mb->mbxStatus); |
1256 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 1245 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
1257 | spin_lock_irq(shost->host_lock); | 1246 | spin_lock_irq(shost->host_lock); |
1258 | vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); | 1247 | vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); |
@@ -1289,15 +1278,15 @@ void | |||
1289 | lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | 1278 | lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
1290 | { | 1279 | { |
1291 | struct lpfc_vport *vport = pmb->vport; | 1280 | struct lpfc_vport *vport = pmb->vport; |
1292 | struct lpfc_vport *next_vport; | ||
1293 | MAILBOX_t *mb = &pmb->mb; | 1281 | MAILBOX_t *mb = &pmb->mb; |
1294 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1); | 1282 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1); |
1295 | struct lpfc_nodelist *ndlp; | 1283 | struct lpfc_nodelist *ndlp; |
1296 | ndlp = (struct lpfc_nodelist *) pmb->context2; | 1284 | struct lpfc_vport **vports; |
1285 | int i; | ||
1297 | 1286 | ||
1287 | ndlp = (struct lpfc_nodelist *) pmb->context2; | ||
1298 | pmb->context1 = NULL; | 1288 | pmb->context1 = NULL; |
1299 | pmb->context2 = NULL; | 1289 | pmb->context2 = NULL; |
1300 | |||
1301 | if (mb->mbxStatus) { | 1290 | if (mb->mbxStatus) { |
1302 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 1291 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
1303 | kfree(mp); | 1292 | kfree(mp); |
@@ -1314,10 +1303,9 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
1314 | } | 1303 | } |
1315 | 1304 | ||
1316 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 1305 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
1317 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | 1306 | lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, |
1318 | "%d (%d):0258 Register Fabric login error: 0x%x\n", | 1307 | "0258 Register Fabric login error: 0x%x\n", |
1319 | phba->brd_no, vport->vpi, mb->mbxStatus); | 1308 | mb->mbxStatus); |
1320 | |||
1321 | return; | 1309 | return; |
1322 | } | 1310 | } |
1323 | 1311 | ||
@@ -1328,21 +1316,26 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
1328 | lpfc_nlp_put(ndlp); /* Drop the reference from the mbox */ | 1316 | lpfc_nlp_put(ndlp); /* Drop the reference from the mbox */ |
1329 | 1317 | ||
1330 | if (vport->port_state == LPFC_FABRIC_CFG_LINK) { | 1318 | if (vport->port_state == LPFC_FABRIC_CFG_LINK) { |
1331 | list_for_each_entry(next_vport, &phba->port_list, listentry) { | 1319 | vports = lpfc_create_vport_work_array(phba); |
1332 | if (next_vport->port_type == LPFC_PHYSICAL_PORT) | 1320 | if (vports != NULL) |
1333 | continue; | 1321 | for(i = 0; |
1334 | 1322 | i < LPFC_MAX_VPORTS && vports[i] != NULL; | |
1335 | if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) | 1323 | i++) { |
1336 | lpfc_initial_fdisc(next_vport); | 1324 | if (vports[i]->port_type == LPFC_PHYSICAL_PORT) |
1337 | else if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) { | 1325 | continue; |
1338 | lpfc_vport_set_state(vport, | 1326 | if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) |
1339 | FC_VPORT_NO_FABRIC_SUPP); | 1327 | lpfc_initial_fdisc(vports[i]); |
1340 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 1328 | else if (phba->sli3_options & |
1341 | "%d (%d):0259 No NPIV Fabric " | 1329 | LPFC_SLI3_NPIV_ENABLED) { |
1342 | "support\n", | 1330 | lpfc_vport_set_state(vports[i], |
1343 | phba->brd_no, vport->vpi); | 1331 | FC_VPORT_NO_FABRIC_SUPP); |
1332 | lpfc_printf_vlog(vport, KERN_ERR, | ||
1333 | LOG_ELS, | ||
1334 | "0259 No NPIV " | ||
1335 | "Fabric support\n"); | ||
1336 | } | ||
1344 | } | 1337 | } |
1345 | } | 1338 | lpfc_destroy_vport_work_array(vports); |
1346 | lpfc_do_scr_ns_plogi(phba, vport); | 1339 | lpfc_do_scr_ns_plogi(phba, vport); |
1347 | } | 1340 | } |
1348 | 1341 | ||
@@ -1386,9 +1379,9 @@ out: | |||
1386 | return; | 1379 | return; |
1387 | } | 1380 | } |
1388 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 1381 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
1389 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 1382 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
1390 | "%d (%d):0260 Register NameServer error: 0x%x\n", | 1383 | "0260 Register NameServer error: 0x%x\n", |
1391 | phba->brd_no, vport->vpi, mb->mbxStatus); | 1384 | mb->mbxStatus); |
1392 | return; | 1385 | return; |
1393 | } | 1386 | } |
1394 | 1387 | ||
@@ -1598,7 +1591,7 @@ lpfc_nlp_state_name(char *buffer, size_t size, int state) | |||
1598 | [NLP_STE_NPR_NODE] = "NPR", | 1591 | [NLP_STE_NPR_NODE] = "NPR", |
1599 | }; | 1592 | }; |
1600 | 1593 | ||
1601 | if (state < ARRAY_SIZE(states) && states[state]) | 1594 | if (state < NLP_STE_MAX_STATE && states[state]) |
1602 | strlcpy(buffer, states[state], size); | 1595 | strlcpy(buffer, states[state], size); |
1603 | else | 1596 | else |
1604 | snprintf(buffer, size, "unknown (%d)", state); | 1597 | snprintf(buffer, size, "unknown (%d)", state); |
@@ -1613,12 +1606,11 @@ lpfc_nlp_set_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1613 | int old_state = ndlp->nlp_state; | 1606 | int old_state = ndlp->nlp_state; |
1614 | char name1[16], name2[16]; | 1607 | char name1[16], name2[16]; |
1615 | 1608 | ||
1616 | lpfc_printf_log(vport->phba, KERN_INFO, LOG_NODE, | 1609 | lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, |
1617 | "%d (%d):0904 NPort state transition x%06x, %s -> %s\n", | 1610 | "0904 NPort state transition x%06x, %s -> %s\n", |
1618 | vport->phba->brd_no, vport->vpi, | 1611 | ndlp->nlp_DID, |
1619 | ndlp->nlp_DID, | 1612 | lpfc_nlp_state_name(name1, sizeof(name1), old_state), |
1620 | lpfc_nlp_state_name(name1, sizeof(name1), old_state), | 1613 | lpfc_nlp_state_name(name2, sizeof(name2), state)); |
1621 | lpfc_nlp_state_name(name2, sizeof(name2), state)); | ||
1622 | 1614 | ||
1623 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE, | 1615 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE, |
1624 | "node statechg did:x%x old:%d ste:%d", | 1616 | "node statechg did:x%x old:%d ste:%d", |
@@ -1664,16 +1656,7 @@ lpfc_dequeue_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
1664 | void | 1656 | void |
1665 | lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | 1657 | lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
1666 | { | 1658 | { |
1667 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 1659 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE); |
1668 | |||
1669 | if ((ndlp->nlp_flag & NLP_DELAY_TMO) != 0) | ||
1670 | lpfc_cancel_retry_delay_tmo(vport, ndlp); | ||
1671 | if (ndlp->nlp_state && !list_empty(&ndlp->nlp_listp)) | ||
1672 | lpfc_nlp_counters(vport, ndlp->nlp_state, -1); | ||
1673 | spin_lock_irq(shost->host_lock); | ||
1674 | list_del_init(&ndlp->nlp_listp); | ||
1675 | ndlp->nlp_flag &= ~NLP_TARGET_REMOVE; | ||
1676 | spin_unlock_irq(shost->host_lock); | ||
1677 | lpfc_nlp_put(ndlp); | 1660 | lpfc_nlp_put(ndlp); |
1678 | } | 1661 | } |
1679 | 1662 | ||
@@ -1710,12 +1693,12 @@ lpfc_set_disctmo(struct lpfc_vport *vport) | |||
1710 | spin_unlock_irq(shost->host_lock); | 1693 | spin_unlock_irq(shost->host_lock); |
1711 | 1694 | ||
1712 | /* Start Discovery Timer state <hba_state> */ | 1695 | /* Start Discovery Timer state <hba_state> */ |
1713 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 1696 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
1714 | "%d (%d):0247 Start Discovery Timer state x%x " | 1697 | "0247 Start Discovery Timer state x%x " |
1715 | "Data: x%x x%lx x%x x%x\n", | 1698 | "Data: x%x x%lx x%x x%x\n", |
1716 | phba->brd_no, vport->vpi, vport->port_state, tmo, | 1699 | vport->port_state, tmo, |
1717 | (unsigned long)&vport->fc_disctmo, vport->fc_plogi_cnt, | 1700 | (unsigned long)&vport->fc_disctmo, vport->fc_plogi_cnt, |
1718 | vport->fc_adisc_cnt); | 1701 | vport->fc_adisc_cnt); |
1719 | 1702 | ||
1720 | return; | 1703 | return; |
1721 | } | 1704 | } |
@@ -1727,7 +1710,6 @@ int | |||
1727 | lpfc_can_disctmo(struct lpfc_vport *vport) | 1710 | lpfc_can_disctmo(struct lpfc_vport *vport) |
1728 | { | 1711 | { |
1729 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 1712 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
1730 | struct lpfc_hba *phba = vport->phba; | ||
1731 | unsigned long iflags; | 1713 | unsigned long iflags; |
1732 | 1714 | ||
1733 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, | 1715 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, |
@@ -1746,13 +1728,11 @@ lpfc_can_disctmo(struct lpfc_vport *vport) | |||
1746 | } | 1728 | } |
1747 | 1729 | ||
1748 | /* Cancel Discovery Timer state <hba_state> */ | 1730 | /* Cancel Discovery Timer state <hba_state> */ |
1749 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 1731 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
1750 | "%d (%d):0248 Cancel Discovery Timer state x%x " | 1732 | "0248 Cancel Discovery Timer state x%x " |
1751 | "Data: x%x x%x x%x\n", | 1733 | "Data: x%x x%x x%x\n", |
1752 | phba->brd_no, vport->vpi, vport->port_state, | 1734 | vport->port_state, vport->fc_flag, |
1753 | vport->fc_flag, vport->fc_plogi_cnt, | 1735 | vport->fc_plogi_cnt, vport->fc_adisc_cnt); |
1754 | vport->fc_adisc_cnt); | ||
1755 | |||
1756 | return 0; | 1736 | return 0; |
1757 | } | 1737 | } |
1758 | 1738 | ||
@@ -1935,10 +1915,9 @@ lpfc_unreg_default_rpis(struct lpfc_vport *vport) | |||
1935 | rc = lpfc_sli_issue_mbox(phba, mbox, | 1915 | rc = lpfc_sli_issue_mbox(phba, mbox, |
1936 | (MBX_NOWAIT | MBX_STOP_IOCB)); | 1916 | (MBX_NOWAIT | MBX_STOP_IOCB)); |
1937 | if (rc == MBX_NOT_FINISHED) { | 1917 | if (rc == MBX_NOT_FINISHED) { |
1938 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_VPORT, | 1918 | lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT, |
1939 | "%d (%d):1815 Could not issue " | 1919 | "1815 Could not issue " |
1940 | "unreg_did (default rpis)\n", | 1920 | "unreg_did (default rpis)\n"); |
1941 | phba->brd_no, vport->vpi); | ||
1942 | mempool_free(mbox, phba->mbox_mem_pool); | 1921 | mempool_free(mbox, phba->mbox_mem_pool); |
1943 | } | 1922 | } |
1944 | } | 1923 | } |
@@ -1957,12 +1936,11 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
1957 | struct lpfc_dmabuf *mp; | 1936 | struct lpfc_dmabuf *mp; |
1958 | 1937 | ||
1959 | /* Cleanup node for NPort <nlp_DID> */ | 1938 | /* Cleanup node for NPort <nlp_DID> */ |
1960 | lpfc_printf_log(phba, KERN_INFO, LOG_NODE, | 1939 | lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, |
1961 | "%d (%d):0900 Cleanup node for NPort x%x " | 1940 | "0900 Cleanup node for NPort x%x " |
1962 | "Data: x%x x%x x%x\n", | 1941 | "Data: x%x x%x x%x\n", |
1963 | phba->brd_no, vport->vpi, ndlp->nlp_DID, ndlp->nlp_flag, | 1942 | ndlp->nlp_DID, ndlp->nlp_flag, |
1964 | ndlp->nlp_state, ndlp->nlp_rpi); | 1943 | ndlp->nlp_state, ndlp->nlp_rpi); |
1965 | |||
1966 | lpfc_dequeue_node(vport, ndlp); | 1944 | lpfc_dequeue_node(vport, ndlp); |
1967 | 1945 | ||
1968 | /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ | 1946 | /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ |
@@ -2094,7 +2072,6 @@ lpfc_matchdid(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
2094 | static struct lpfc_nodelist * | 2072 | static struct lpfc_nodelist * |
2095 | __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) | 2073 | __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) |
2096 | { | 2074 | { |
2097 | struct lpfc_hba *phba = vport->phba; | ||
2098 | struct lpfc_nodelist *ndlp; | 2075 | struct lpfc_nodelist *ndlp; |
2099 | uint32_t data1; | 2076 | uint32_t data1; |
2100 | 2077 | ||
@@ -2104,20 +2081,18 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) | |||
2104 | ((uint32_t) ndlp->nlp_xri << 16) | | 2081 | ((uint32_t) ndlp->nlp_xri << 16) | |
2105 | ((uint32_t) ndlp->nlp_type << 8) | | 2082 | ((uint32_t) ndlp->nlp_type << 8) | |
2106 | ((uint32_t) ndlp->nlp_rpi & 0xff)); | 2083 | ((uint32_t) ndlp->nlp_rpi & 0xff)); |
2107 | lpfc_printf_log(phba, KERN_INFO, LOG_NODE, | 2084 | lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, |
2108 | "%d (%d):0929 FIND node DID " | 2085 | "0929 FIND node DID " |
2109 | " Data: x%p x%x x%x x%x\n", | 2086 | "Data: x%p x%x x%x x%x\n", |
2110 | phba->brd_no, vport->vpi, | 2087 | ndlp, ndlp->nlp_DID, |
2111 | ndlp, ndlp->nlp_DID, | 2088 | ndlp->nlp_flag, data1); |
2112 | ndlp->nlp_flag, data1); | ||
2113 | return ndlp; | 2089 | return ndlp; |
2114 | } | 2090 | } |
2115 | } | 2091 | } |
2116 | 2092 | ||
2117 | /* FIND node did <did> NOT FOUND */ | 2093 | /* FIND node did <did> NOT FOUND */ |
2118 | lpfc_printf_log(phba, KERN_INFO, LOG_NODE, | 2094 | lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, |
2119 | "%d (%d):0932 FIND node did x%x NOT FOUND.\n", | 2095 | "0932 FIND node did x%x NOT FOUND.\n", did); |
2120 | phba->brd_no, vport->vpi, did); | ||
2121 | return NULL; | 2096 | return NULL; |
2122 | } | 2097 | } |
2123 | 2098 | ||
@@ -2208,7 +2183,7 @@ lpfc_disc_list_loopmap(struct lpfc_vport *vport) | |||
2208 | /* If cfg_scan_down is set, start from highest | 2183 | /* If cfg_scan_down is set, start from highest |
2209 | * ALPA (0xef) to lowest (0x1). | 2184 | * ALPA (0xef) to lowest (0x1). |
2210 | */ | 2185 | */ |
2211 | if (phba->cfg_scan_down) | 2186 | if (vport->cfg_scan_down) |
2212 | index = j; | 2187 | index = j; |
2213 | else | 2188 | else |
2214 | index = FC_MAXLOOP - j - 1; | 2189 | index = FC_MAXLOOP - j - 1; |
@@ -2309,12 +2284,11 @@ lpfc_disc_start(struct lpfc_vport *vport) | |||
2309 | vport->num_disc_nodes = 0; | 2284 | vport->num_disc_nodes = 0; |
2310 | 2285 | ||
2311 | /* Start Discovery state <hba_state> */ | 2286 | /* Start Discovery state <hba_state> */ |
2312 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 2287 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
2313 | "%d (%d):0202 Start Discovery hba state x%x " | 2288 | "0202 Start Discovery hba state x%x " |
2314 | "Data: x%x x%x x%x\n", | 2289 | "Data: x%x x%x x%x\n", |
2315 | phba->brd_no, vport->vpi, vport->port_state, | 2290 | vport->port_state, vport->fc_flag, vport->fc_plogi_cnt, |
2316 | vport->fc_flag, vport->fc_plogi_cnt, | 2291 | vport->fc_adisc_cnt); |
2317 | vport->fc_adisc_cnt); | ||
2318 | 2292 | ||
2319 | /* First do ADISCs - if any */ | 2293 | /* First do ADISCs - if any */ |
2320 | num_sent = lpfc_els_disc_adisc(vport); | 2294 | num_sent = lpfc_els_disc_adisc(vport); |
@@ -2532,10 +2506,8 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2532 | * FAN | 2506 | * FAN |
2533 | */ | 2507 | */ |
2534 | /* FAN timeout */ | 2508 | /* FAN timeout */ |
2535 | lpfc_printf_log(phba, KERN_WARNING, LOG_DISCOVERY, | 2509 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY, |
2536 | "%d (%d):0221 FAN timeout\n", | 2510 | "0221 FAN timeout\n"); |
2537 | phba->brd_no, vport->vpi); | ||
2538 | |||
2539 | /* Start discovery by sending FLOGI, clean up old rpis */ | 2511 | /* Start discovery by sending FLOGI, clean up old rpis */ |
2540 | list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, | 2512 | list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, |
2541 | nlp_listp) { | 2513 | nlp_listp) { |
@@ -2562,10 +2534,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2562 | case LPFC_FLOGI: | 2534 | case LPFC_FLOGI: |
2563 | /* port_state is identically LPFC_FLOGI while waiting for FLOGI cmpl */ | 2535 | /* port_state is identically LPFC_FLOGI while waiting for FLOGI cmpl */ |
2564 | /* Initial FLOGI timeout */ | 2536 | /* Initial FLOGI timeout */ |
2565 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 2537 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
2566 | "%d (%d):0222 Initial %s timeout\n", | 2538 | "0222 Initial %s timeout\n", |
2567 | phba->brd_no, vport->vpi, | 2539 | vport->vpi ? "FLOGI" : "FDISC"); |
2568 | vport->vpi ? "FLOGI" : "FDISC"); | ||
2569 | 2540 | ||
2570 | /* Assume no Fabric and go on with discovery. | 2541 | /* Assume no Fabric and go on with discovery. |
2571 | * Check for outstanding ELS FLOGI to abort. | 2542 | * Check for outstanding ELS FLOGI to abort. |
@@ -2581,11 +2552,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2581 | case LPFC_FABRIC_CFG_LINK: | 2552 | case LPFC_FABRIC_CFG_LINK: |
2582 | /* hba_state is identically LPFC_FABRIC_CFG_LINK while waiting for | 2553 | /* hba_state is identically LPFC_FABRIC_CFG_LINK while waiting for |
2583 | NameServer login */ | 2554 | NameServer login */ |
2584 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 2555 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
2585 | "%d (%d):0223 Timeout while waiting for " | 2556 | "0223 Timeout while waiting for " |
2586 | "NameServer login\n", | 2557 | "NameServer login\n"); |
2587 | phba->brd_no, vport->vpi); | ||
2588 | |||
2589 | /* Next look for NameServer ndlp */ | 2558 | /* Next look for NameServer ndlp */ |
2590 | ndlp = lpfc_findnode_did(vport, NameServer_DID); | 2559 | ndlp = lpfc_findnode_did(vport, NameServer_DID); |
2591 | if (ndlp) | 2560 | if (ndlp) |
@@ -2596,11 +2565,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2596 | 2565 | ||
2597 | case LPFC_NS_QRY: | 2566 | case LPFC_NS_QRY: |
2598 | /* Check for wait for NameServer Rsp timeout */ | 2567 | /* Check for wait for NameServer Rsp timeout */ |
2599 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 2568 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
2600 | "%d (%d):0224 NameServer Query timeout " | 2569 | "0224 NameServer Query timeout " |
2601 | "Data: x%x x%x\n", | 2570 | "Data: x%x x%x\n", |
2602 | phba->brd_no, vport->vpi, | 2571 | vport->fc_ns_retry, LPFC_MAX_NS_RETRY); |
2603 | vport->fc_ns_retry, LPFC_MAX_NS_RETRY); | ||
2604 | 2572 | ||
2605 | if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { | 2573 | if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { |
2606 | /* Try it one more time */ | 2574 | /* Try it one more time */ |
@@ -2627,10 +2595,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2627 | /* Setup and issue mailbox INITIALIZE LINK command */ | 2595 | /* Setup and issue mailbox INITIALIZE LINK command */ |
2628 | initlinkmbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 2596 | initlinkmbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
2629 | if (!initlinkmbox) { | 2597 | if (!initlinkmbox) { |
2630 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 2598 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
2631 | "%d (%d):0206 Device Discovery " | 2599 | "0206 Device Discovery " |
2632 | "completion error\n", | 2600 | "completion error\n"); |
2633 | phba->brd_no, vport->vpi); | ||
2634 | phba->link_state = LPFC_HBA_ERROR; | 2601 | phba->link_state = LPFC_HBA_ERROR; |
2635 | break; | 2602 | break; |
2636 | } | 2603 | } |
@@ -2651,9 +2618,8 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2651 | 2618 | ||
2652 | case LPFC_DISC_AUTH: | 2619 | case LPFC_DISC_AUTH: |
2653 | /* Node Authentication timeout */ | 2620 | /* Node Authentication timeout */ |
2654 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 2621 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
2655 | "%d (%d):0227 Node Authentication timeout\n", | 2622 | "0227 Node Authentication timeout\n"); |
2656 | phba->brd_no, vport->vpi); | ||
2657 | lpfc_disc_flush_list(vport); | 2623 | lpfc_disc_flush_list(vport); |
2658 | 2624 | ||
2659 | /* | 2625 | /* |
@@ -2670,11 +2636,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2670 | 2636 | ||
2671 | case LPFC_VPORT_READY: | 2637 | case LPFC_VPORT_READY: |
2672 | if (vport->fc_flag & FC_RSCN_MODE) { | 2638 | if (vport->fc_flag & FC_RSCN_MODE) { |
2673 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 2639 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
2674 | "%d (%d):0231 RSCN timeout Data: x%x " | 2640 | "0231 RSCN timeout Data: x%x " |
2675 | "x%x\n", | 2641 | "x%x\n", |
2676 | phba->brd_no, vport->vpi, | 2642 | vport->fc_ns_retry, LPFC_MAX_NS_RETRY); |
2677 | vport->fc_ns_retry, LPFC_MAX_NS_RETRY); | ||
2678 | 2643 | ||
2679 | /* Cleanup any outstanding ELS commands */ | 2644 | /* Cleanup any outstanding ELS commands */ |
2680 | lpfc_els_flush_cmd(vport); | 2645 | lpfc_els_flush_cmd(vport); |
@@ -2685,20 +2650,17 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2685 | break; | 2650 | break; |
2686 | 2651 | ||
2687 | default: | 2652 | default: |
2688 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 2653 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
2689 | "%d (%d):0229 Unexpected discovery timeout, " | 2654 | "0229 Unexpected discovery timeout, " |
2690 | "vport State x%x\n", | 2655 | "vport State x%x\n", vport->port_state); |
2691 | phba->brd_no, vport->vpi, vport->port_state); | ||
2692 | |||
2693 | break; | 2656 | break; |
2694 | } | 2657 | } |
2695 | 2658 | ||
2696 | switch (phba->link_state) { | 2659 | switch (phba->link_state) { |
2697 | case LPFC_CLEAR_LA: | 2660 | case LPFC_CLEAR_LA: |
2698 | /* CLEAR LA timeout */ | 2661 | /* CLEAR LA timeout */ |
2699 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 2662 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
2700 | "%d (%d):0228 CLEAR LA timeout\n", | 2663 | "0228 CLEAR LA timeout\n"); |
2701 | phba->brd_no, vport->vpi); | ||
2702 | clrlaerr = 1; | 2664 | clrlaerr = 1; |
2703 | break; | 2665 | break; |
2704 | 2666 | ||
@@ -2709,10 +2671,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2709 | case LPFC_LINK_DOWN: | 2671 | case LPFC_LINK_DOWN: |
2710 | case LPFC_LINK_UP: | 2672 | case LPFC_LINK_UP: |
2711 | case LPFC_HBA_ERROR: | 2673 | case LPFC_HBA_ERROR: |
2712 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 2674 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
2713 | "%d (%d):0230 Unexpected timeout, hba link " | 2675 | "0230 Unexpected timeout, hba link " |
2714 | "state x%x\n", | 2676 | "state x%x\n", phba->link_state); |
2715 | phba->brd_no, vport->vpi, phba->link_state); | ||
2716 | clrlaerr = 1; | 2677 | clrlaerr = 1; |
2717 | break; | 2678 | break; |
2718 | 2679 | ||
@@ -2757,7 +2718,7 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
2757 | * fdmi-on=2 (supporting RPA/hostnmae) | 2718 | * fdmi-on=2 (supporting RPA/hostnmae) |
2758 | */ | 2719 | */ |
2759 | 2720 | ||
2760 | if (phba->cfg_fdmi_on == 1) | 2721 | if (vport->cfg_fdmi_on == 1) |
2761 | lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA); | 2722 | lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA); |
2762 | else | 2723 | else |
2763 | mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60); | 2724 | mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60); |
@@ -2854,32 +2815,6 @@ lpfc_findnode_wwpn(struct lpfc_vport *vport, struct lpfc_name *wwpn) | |||
2854 | } | 2815 | } |
2855 | 2816 | ||
2856 | void | 2817 | void |
2857 | lpfc_dev_loss_delay(unsigned long ptr) | ||
2858 | { | ||
2859 | struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) ptr; | ||
2860 | struct lpfc_vport *vport = ndlp->vport; | ||
2861 | struct lpfc_hba *phba = vport->phba; | ||
2862 | struct lpfc_work_evt *evtp = &ndlp->dev_loss_evt; | ||
2863 | unsigned long flags; | ||
2864 | |||
2865 | evtp = &ndlp->dev_loss_evt; | ||
2866 | |||
2867 | spin_lock_irqsave(&phba->hbalock, flags); | ||
2868 | if (!list_empty(&evtp->evt_listp)) { | ||
2869 | spin_unlock_irqrestore(&phba->hbalock, flags); | ||
2870 | return; | ||
2871 | } | ||
2872 | |||
2873 | evtp->evt_arg1 = ndlp; | ||
2874 | evtp->evt = LPFC_EVT_DEV_LOSS_DELAY; | ||
2875 | list_add_tail(&evtp->evt_listp, &phba->work_list); | ||
2876 | if (phba->work_wait) | ||
2877 | lpfc_worker_wake_up(phba); | ||
2878 | spin_unlock_irqrestore(&phba->hbalock, flags); | ||
2879 | return; | ||
2880 | } | ||
2881 | |||
2882 | void | ||
2883 | lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | 2818 | lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
2884 | uint32_t did) | 2819 | uint32_t did) |
2885 | { | 2820 | { |
@@ -2902,7 +2837,7 @@ lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
2902 | return; | 2837 | return; |
2903 | } | 2838 | } |
2904 | 2839 | ||
2905 | void | 2840 | static void |
2906 | lpfc_nlp_release(struct kref *kref) | 2841 | lpfc_nlp_release(struct kref *kref) |
2907 | { | 2842 | { |
2908 | struct lpfc_nodelist *ndlp = container_of(kref, struct lpfc_nodelist, | 2843 | struct lpfc_nodelist *ndlp = container_of(kref, struct lpfc_nodelist, |
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index c2fb59f595f3..451accd5564b 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h | |||
@@ -150,7 +150,11 @@ struct lpfc_sli_ct_request { | |||
150 | struct gff_acc { | 150 | struct gff_acc { |
151 | uint8_t fbits[128]; | 151 | uint8_t fbits[128]; |
152 | } gff_acc; | 152 | } gff_acc; |
153 | #ifdef __BIG_ENDIAN_BITFIELD | ||
154 | #define FCP_TYPE_FEATURE_OFFSET 7 | ||
155 | #else /* __LITTLE_ENDIAN_BITFIELD */ | ||
153 | #define FCP_TYPE_FEATURE_OFFSET 4 | 156 | #define FCP_TYPE_FEATURE_OFFSET 4 |
157 | #endif | ||
154 | struct rff { | 158 | struct rff { |
155 | uint32_t PortId; | 159 | uint32_t PortId; |
156 | uint8_t reserved[2]; | 160 | uint8_t reserved[2]; |
@@ -805,7 +809,7 @@ typedef struct _RNID { /* Structure is in Big Endian format */ | |||
805 | } un; | 809 | } un; |
806 | } RNID; | 810 | } RNID; |
807 | 811 | ||
808 | typedef struct _RPS { /* Structure is in Big Endian format */ | 812 | typedef struct _RPS { /* Structure is in Big Endian format */ |
809 | union { | 813 | union { |
810 | uint32_t portNum; | 814 | uint32_t portNum; |
811 | struct lpfc_name portName; | 815 | struct lpfc_name portName; |
@@ -823,7 +827,7 @@ typedef struct _RPS_RSP { /* Structure is in Big Endian format */ | |||
823 | uint32_t crcCnt; | 827 | uint32_t crcCnt; |
824 | } RPS_RSP; | 828 | } RPS_RSP; |
825 | 829 | ||
826 | typedef struct _RPL { /* Structure is in Big Endian format */ | 830 | typedef struct _RPL { /* Structure is in Big Endian format */ |
827 | uint32_t maxsize; | 831 | uint32_t maxsize; |
828 | uint32_t index; | 832 | uint32_t index; |
829 | } RPL; | 833 | } RPL; |
@@ -834,7 +838,7 @@ typedef struct _PORT_NUM_BLK { | |||
834 | struct lpfc_name portName; | 838 | struct lpfc_name portName; |
835 | } PORT_NUM_BLK; | 839 | } PORT_NUM_BLK; |
836 | 840 | ||
837 | typedef struct _RPL_RSP { /* Structure is in Big Endian format */ | 841 | typedef struct _RPL_RSP { /* Structure is in Big Endian format */ |
838 | uint32_t listLen; | 842 | uint32_t listLen; |
839 | uint32_t index; | 843 | uint32_t index; |
840 | PORT_NUM_BLK port_num_blk; | 844 | PORT_NUM_BLK port_num_blk; |
@@ -2613,8 +2617,8 @@ typedef union { | |||
2613 | LOAD_SM_VAR varLdSM; /* cmd = 1 (LOAD_SM) */ | 2617 | LOAD_SM_VAR varLdSM; /* cmd = 1 (LOAD_SM) */ |
2614 | READ_NV_VAR varRDnvp; /* cmd = 2 (READ_NVPARMS) */ | 2618 | READ_NV_VAR varRDnvp; /* cmd = 2 (READ_NVPARMS) */ |
2615 | WRITE_NV_VAR varWTnvp; /* cmd = 3 (WRITE_NVPARMS) */ | 2619 | WRITE_NV_VAR varWTnvp; /* cmd = 3 (WRITE_NVPARMS) */ |
2616 | BIU_DIAG_VAR varBIUdiag; /* cmd = 4 (RUN_BIU_DIAG) */ | 2620 | BIU_DIAG_VAR varBIUdiag; /* cmd = 4 (RUN_BIU_DIAG) */ |
2617 | INIT_LINK_VAR varInitLnk; /* cmd = 5 (INIT_LINK) */ | 2621 | INIT_LINK_VAR varInitLnk; /* cmd = 5 (INIT_LINK) */ |
2618 | DOWN_LINK_VAR varDwnLnk; /* cmd = 6 (DOWN_LINK) */ | 2622 | DOWN_LINK_VAR varDwnLnk; /* cmd = 6 (DOWN_LINK) */ |
2619 | CONFIG_LINK varCfgLnk; /* cmd = 7 (CONFIG_LINK) */ | 2623 | CONFIG_LINK varCfgLnk; /* cmd = 7 (CONFIG_LINK) */ |
2620 | PART_SLIM_VAR varSlim; /* cmd = 8 (PART_SLIM) */ | 2624 | PART_SLIM_VAR varSlim; /* cmd = 8 (PART_SLIM) */ |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 07bd0dcdf0d6..414350ab584e 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -53,8 +53,6 @@ static struct scsi_transport_template *lpfc_transport_template = NULL; | |||
53 | static struct scsi_transport_template *lpfc_vport_transport_template = NULL; | 53 | static struct scsi_transport_template *lpfc_vport_transport_template = NULL; |
54 | static DEFINE_IDR(lpfc_hba_index); | 54 | static DEFINE_IDR(lpfc_hba_index); |
55 | 55 | ||
56 | |||
57 | |||
58 | /************************************************************************/ | 56 | /************************************************************************/ |
59 | /* */ | 57 | /* */ |
60 | /* lpfc_config_port_prep */ | 58 | /* lpfc_config_port_prep */ |
@@ -107,10 +105,9 @@ lpfc_config_port_prep(struct lpfc_hba *phba) | |||
107 | 105 | ||
108 | if (rc != MBX_SUCCESS) { | 106 | if (rc != MBX_SUCCESS) { |
109 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | 107 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, |
110 | "%d:0324 Config Port initialization " | 108 | "0324 Config Port initialization " |
111 | "error, mbxCmd x%x READ_NVPARM, " | 109 | "error, mbxCmd x%x READ_NVPARM, " |
112 | "mbxStatus x%x\n", | 110 | "mbxStatus x%x\n", |
113 | phba->brd_no, | ||
114 | mb->mbxCommand, mb->mbxStatus); | 111 | mb->mbxCommand, mb->mbxStatus); |
115 | mempool_free(pmb, phba->mbox_mem_pool); | 112 | mempool_free(pmb, phba->mbox_mem_pool); |
116 | return -ERESTART; | 113 | return -ERESTART; |
@@ -128,9 +125,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba) | |||
128 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 125 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
129 | if (rc != MBX_SUCCESS) { | 126 | if (rc != MBX_SUCCESS) { |
130 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 127 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
131 | "%d:0439 Adapter failed to init, mbxCmd x%x " | 128 | "0439 Adapter failed to init, mbxCmd x%x " |
132 | "READ_REV, mbxStatus x%x\n", | 129 | "READ_REV, mbxStatus x%x\n", |
133 | phba->brd_no, | ||
134 | mb->mbxCommand, mb->mbxStatus); | 130 | mb->mbxCommand, mb->mbxStatus); |
135 | mempool_free( pmb, phba->mbox_mem_pool); | 131 | mempool_free( pmb, phba->mbox_mem_pool); |
136 | return -ERESTART; | 132 | return -ERESTART; |
@@ -144,9 +140,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba) | |||
144 | if (mb->un.varRdRev.rr == 0) { | 140 | if (mb->un.varRdRev.rr == 0) { |
145 | vp->rev.rBit = 0; | 141 | vp->rev.rBit = 0; |
146 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 142 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
147 | "%d:0440 Adapter failed to init, READ_REV has " | 143 | "0440 Adapter failed to init, READ_REV has " |
148 | "missing revision information.\n", | 144 | "missing revision information.\n"); |
149 | phba->brd_no); | ||
150 | mempool_free(pmb, phba->mbox_mem_pool); | 145 | mempool_free(pmb, phba->mbox_mem_pool); |
151 | return -ERESTART; | 146 | return -ERESTART; |
152 | } | 147 | } |
@@ -197,9 +192,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba) | |||
197 | 192 | ||
198 | if (rc != MBX_SUCCESS) { | 193 | if (rc != MBX_SUCCESS) { |
199 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 194 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
200 | "%d:0441 VPD not present on adapter, " | 195 | "0441 VPD not present on adapter, " |
201 | "mbxCmd x%x DUMP VPD, mbxStatus x%x\n", | 196 | "mbxCmd x%x DUMP VPD, mbxStatus x%x\n", |
202 | phba->brd_no, | ||
203 | mb->mbxCommand, mb->mbxStatus); | 197 | mb->mbxCommand, mb->mbxStatus); |
204 | mb->un.varDmp.word_cnt = 0; | 198 | mb->un.varDmp.word_cnt = 0; |
205 | } | 199 | } |
@@ -253,9 +247,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
253 | pmb->vport = vport; | 247 | pmb->vport = vport; |
254 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | 248 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { |
255 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 249 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
256 | "%d:0448 Adapter failed init, mbxCmd x%x " | 250 | "0448 Adapter failed init, mbxCmd x%x " |
257 | "READ_SPARM mbxStatus x%x\n", | 251 | "READ_SPARM mbxStatus x%x\n", |
258 | phba->brd_no, | ||
259 | mb->mbxCommand, mb->mbxStatus); | 252 | mb->mbxCommand, mb->mbxStatus); |
260 | phba->link_state = LPFC_HBA_ERROR; | 253 | phba->link_state = LPFC_HBA_ERROR; |
261 | mp = (struct lpfc_dmabuf *) pmb->context1; | 254 | mp = (struct lpfc_dmabuf *) pmb->context1; |
@@ -312,9 +305,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
312 | pmb->vport = vport; | 305 | pmb->vport = vport; |
313 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | 306 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { |
314 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 307 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
315 | "%d:0453 Adapter failed to init, mbxCmd x%x " | 308 | "0453 Adapter failed to init, mbxCmd x%x " |
316 | "READ_CONFIG, mbxStatus x%x\n", | 309 | "READ_CONFIG, mbxStatus x%x\n", |
317 | phba->brd_no, | ||
318 | mb->mbxCommand, mb->mbxStatus); | 310 | mb->mbxCommand, mb->mbxStatus); |
319 | phba->link_state = LPFC_HBA_ERROR; | 311 | phba->link_state = LPFC_HBA_ERROR; |
320 | mempool_free( pmb, phba->mbox_mem_pool); | 312 | mempool_free( pmb, phba->mbox_mem_pool); |
@@ -344,9 +336,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
344 | && !(phba->lmt & LMT_10Gb))) { | 336 | && !(phba->lmt & LMT_10Gb))) { |
345 | /* Reset link speed to auto */ | 337 | /* Reset link speed to auto */ |
346 | lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT, | 338 | lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT, |
347 | "%d:1302 Invalid speed for this board: " | 339 | "1302 Invalid speed for this board: " |
348 | "Reset link speed to auto: x%x\n", | 340 | "Reset link speed to auto: x%x\n", |
349 | phba->brd_no, | ||
350 | phba->cfg_link_speed); | 341 | phba->cfg_link_speed); |
351 | phba->cfg_link_speed = LINK_SPEED_AUTO; | 342 | phba->cfg_link_speed = LINK_SPEED_AUTO; |
352 | } | 343 | } |
@@ -402,9 +393,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
402 | lpfc_set_loopback_flag(phba); | 393 | lpfc_set_loopback_flag(phba); |
403 | if (rc != MBX_SUCCESS) { | 394 | if (rc != MBX_SUCCESS) { |
404 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 395 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
405 | "%d:0454 Adapter failed to init, mbxCmd x%x " | 396 | "0454 Adapter failed to init, mbxCmd x%x " |
406 | "INIT_LINK, mbxStatus x%x\n", | 397 | "INIT_LINK, mbxStatus x%x\n", |
407 | phba->brd_no, | ||
408 | mb->mbxCommand, mb->mbxStatus); | 398 | mb->mbxCommand, mb->mbxStatus); |
409 | 399 | ||
410 | /* Clear all interrupt enable conditions */ | 400 | /* Clear all interrupt enable conditions */ |
@@ -437,16 +427,11 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
437 | int | 427 | int |
438 | lpfc_hba_down_prep(struct lpfc_hba *phba) | 428 | lpfc_hba_down_prep(struct lpfc_hba *phba) |
439 | { | 429 | { |
440 | struct lpfc_vport *vport = phba->pport; | ||
441 | |||
442 | /* Disable interrupts */ | 430 | /* Disable interrupts */ |
443 | writel(0, phba->HCregaddr); | 431 | writel(0, phba->HCregaddr); |
444 | readl(phba->HCregaddr); /* flush */ | 432 | readl(phba->HCregaddr); /* flush */ |
445 | 433 | ||
446 | list_for_each_entry(vport, &phba->port_list, listentry) { | 434 | lpfc_cleanup_discovery_resources(phba->pport); |
447 | lpfc_cleanup_discovery_resources(vport); | ||
448 | } | ||
449 | |||
450 | return 0; | 435 | return 0; |
451 | } | 436 | } |
452 | 437 | ||
@@ -518,7 +503,7 @@ lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq) | |||
518 | mempool_free(pmboxq, phba->mbox_mem_pool); | 503 | mempool_free(pmboxq, phba->mbox_mem_pool); |
519 | if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && | 504 | if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) && |
520 | !(phba->link_state == LPFC_HBA_ERROR) && | 505 | !(phba->link_state == LPFC_HBA_ERROR) && |
521 | !(phba->pport->fc_flag & FC_UNLOADING)) | 506 | !(phba->pport->load_flag & FC_UNLOADING)) |
522 | mod_timer(&phba->hb_tmofunc, | 507 | mod_timer(&phba->hb_tmofunc, |
523 | jiffies + HZ * LPFC_HB_MBOX_INTERVAL); | 508 | jiffies + HZ * LPFC_HB_MBOX_INTERVAL); |
524 | return; | 509 | return; |
@@ -532,7 +517,7 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba) | |||
532 | struct lpfc_sli *psli = &phba->sli; | 517 | struct lpfc_sli *psli = &phba->sli; |
533 | 518 | ||
534 | if ((phba->link_state == LPFC_HBA_ERROR) || | 519 | if ((phba->link_state == LPFC_HBA_ERROR) || |
535 | (phba->pport->fc_flag & FC_UNLOADING) || | 520 | (phba->pport->load_flag & FC_UNLOADING) || |
536 | (phba->pport->fc_flag & FC_OFFLINE_MODE)) | 521 | (phba->pport->fc_flag & FC_OFFLINE_MODE)) |
537 | return; | 522 | return; |
538 | 523 | ||
@@ -586,8 +571,8 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba) | |||
586 | * need to take the HBA offline. | 571 | * need to take the HBA offline. |
587 | */ | 572 | */ |
588 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 573 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
589 | "%d:0459 Adapter heartbeat failure, taking " | 574 | "0459 Adapter heartbeat failure, taking " |
590 | "this port offline.\n", phba->brd_no); | 575 | "this port offline.\n"); |
591 | 576 | ||
592 | spin_lock_irq(&phba->hbalock); | 577 | spin_lock_irq(&phba->hbalock); |
593 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; | 578 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; |
@@ -615,9 +600,10 @@ lpfc_handle_eratt(struct lpfc_hba *phba) | |||
615 | struct lpfc_vport *vport = phba->pport; | 600 | struct lpfc_vport *vport = phba->pport; |
616 | struct lpfc_sli *psli = &phba->sli; | 601 | struct lpfc_sli *psli = &phba->sli; |
617 | struct lpfc_sli_ring *pring; | 602 | struct lpfc_sli_ring *pring; |
618 | struct lpfc_vport *port_iterator; | 603 | struct lpfc_vport **vports; |
619 | uint32_t event_data; | 604 | uint32_t event_data; |
620 | struct Scsi_Host *shost; | 605 | struct Scsi_Host *shost; |
606 | int i; | ||
621 | 607 | ||
622 | /* If the pci channel is offline, ignore possible errors, | 608 | /* If the pci channel is offline, ignore possible errors, |
623 | * since we cannot communicate with the pci card anyway. */ | 609 | * since we cannot communicate with the pci card anyway. */ |
@@ -628,18 +614,21 @@ lpfc_handle_eratt(struct lpfc_hba *phba) | |||
628 | phba->work_hs & HS_FFER5) { | 614 | phba->work_hs & HS_FFER5) { |
629 | /* Re-establishing Link */ | 615 | /* Re-establishing Link */ |
630 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, | 616 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, |
631 | "%d:1301 Re-establishing Link " | 617 | "1301 Re-establishing Link " |
632 | "Data: x%x x%x x%x\n", | 618 | "Data: x%x x%x x%x\n", |
633 | phba->brd_no, phba->work_hs, | 619 | phba->work_hs, |
634 | phba->work_status[0], phba->work_status[1]); | 620 | phba->work_status[0], phba->work_status[1]); |
635 | list_for_each_entry(port_iterator, &phba->port_list, | 621 | vports = lpfc_create_vport_work_array(phba); |
636 | listentry) { | 622 | if (vports != NULL) |
637 | shost = lpfc_shost_from_vport(port_iterator); | 623 | for(i = 0; |
638 | 624 | i < LPFC_MAX_VPORTS && vports[i] != NULL; | |
639 | spin_lock_irq(shost->host_lock); | 625 | i++){ |
640 | port_iterator->fc_flag |= FC_ESTABLISH_LINK; | 626 | shost = lpfc_shost_from_vport(vports[i]); |
641 | spin_unlock_irq(shost->host_lock); | 627 | spin_lock_irq(shost->host_lock); |
642 | } | 628 | vports[i]->fc_flag |= FC_ESTABLISH_LINK; |
629 | spin_unlock_irq(shost->host_lock); | ||
630 | } | ||
631 | lpfc_destroy_vport_work_array(vports); | ||
643 | spin_lock_irq(&phba->hbalock); | 632 | spin_lock_irq(&phba->hbalock); |
644 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; | 633 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; |
645 | spin_unlock_irq(&phba->hbalock); | 634 | spin_unlock_irq(&phba->hbalock); |
@@ -673,9 +662,9 @@ lpfc_handle_eratt(struct lpfc_hba *phba) | |||
673 | * twice. This is the adapter hardware error path. | 662 | * twice. This is the adapter hardware error path. |
674 | */ | 663 | */ |
675 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 664 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
676 | "%d:0457 Adapter Hardware Error " | 665 | "0457 Adapter Hardware Error " |
677 | "Data: x%x x%x x%x\n", | 666 | "Data: x%x x%x x%x\n", |
678 | phba->brd_no, phba->work_hs, | 667 | phba->work_hs, |
679 | phba->work_status[0], phba->work_status[1]); | 668 | phba->work_status[0], phba->work_status[1]); |
680 | 669 | ||
681 | event_data = FC_REG_DUMP_EVENT; | 670 | event_data = FC_REG_DUMP_EVENT; |
@@ -708,7 +697,6 @@ lpfc_handle_latt(struct lpfc_hba *phba) | |||
708 | { | 697 | { |
709 | struct lpfc_vport *vport = phba->pport; | 698 | struct lpfc_vport *vport = phba->pport; |
710 | struct lpfc_sli *psli = &phba->sli; | 699 | struct lpfc_sli *psli = &phba->sli; |
711 | struct lpfc_vport *port_iterator; | ||
712 | LPFC_MBOXQ_t *pmb; | 700 | LPFC_MBOXQ_t *pmb; |
713 | volatile uint32_t control; | 701 | volatile uint32_t control; |
714 | struct lpfc_dmabuf *mp; | 702 | struct lpfc_dmabuf *mp; |
@@ -729,8 +717,7 @@ lpfc_handle_latt(struct lpfc_hba *phba) | |||
729 | rc = -EIO; | 717 | rc = -EIO; |
730 | 718 | ||
731 | /* Cleanup any outstanding ELS commands */ | 719 | /* Cleanup any outstanding ELS commands */ |
732 | list_for_each_entry(port_iterator, &phba->port_list, listentry) | 720 | lpfc_els_flush_all_cmd(phba); |
733 | lpfc_els_flush_cmd(port_iterator); | ||
734 | 721 | ||
735 | psli->slistat.link_event++; | 722 | psli->slistat.link_event++; |
736 | lpfc_read_la(phba, pmb, mp); | 723 | lpfc_read_la(phba, pmb, mp); |
@@ -773,8 +760,7 @@ lpfc_handle_latt_err_exit: | |||
773 | /* The other case is an error from issue_mbox */ | 760 | /* The other case is an error from issue_mbox */ |
774 | if (rc == -ENOMEM) | 761 | if (rc == -ENOMEM) |
775 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, | 762 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, |
776 | "%d:0300 READ_LA: no buffers\n", | 763 | "0300 READ_LA: no buffers\n"); |
777 | phba->brd_no); | ||
778 | 764 | ||
779 | return; | 765 | return; |
780 | } | 766 | } |
@@ -799,8 +785,7 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) | |||
799 | 785 | ||
800 | /* Vital Product */ | 786 | /* Vital Product */ |
801 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 787 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
802 | "%d:0455 Vital Product Data: x%x x%x x%x x%x\n", | 788 | "0455 Vital Product Data: x%x x%x x%x x%x\n", |
803 | phba->brd_no, | ||
804 | (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], | 789 | (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], |
805 | (uint32_t) vpd[3]); | 790 | (uint32_t) vpd[3]); |
806 | while (!finished && (index < (len - 4))) { | 791 | while (!finished && (index < (len - 4))) { |
@@ -1313,22 +1298,25 @@ static void | |||
1313 | lpfc_establish_link_tmo(unsigned long ptr) | 1298 | lpfc_establish_link_tmo(unsigned long ptr) |
1314 | { | 1299 | { |
1315 | struct lpfc_hba *phba = (struct lpfc_hba *) ptr; | 1300 | struct lpfc_hba *phba = (struct lpfc_hba *) ptr; |
1316 | struct lpfc_vport *vport = phba->pport; | 1301 | struct lpfc_vport **vports; |
1317 | unsigned long iflag; | 1302 | unsigned long iflag; |
1303 | int i; | ||
1318 | 1304 | ||
1319 | /* Re-establishing Link, timer expired */ | 1305 | /* Re-establishing Link, timer expired */ |
1320 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | 1306 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, |
1321 | "%d:1300 Re-establishing Link, timer expired " | 1307 | "1300 Re-establishing Link, timer expired " |
1322 | "Data: x%x x%x\n", | 1308 | "Data: x%x x%x\n", |
1323 | phba->brd_no, vport->fc_flag, | 1309 | phba->pport->fc_flag, phba->pport->port_state); |
1324 | vport->port_state); | 1310 | vports = lpfc_create_vport_work_array(phba); |
1325 | list_for_each_entry(vport, &phba->port_list, listentry) { | 1311 | if (vports != NULL) |
1326 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 1312 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { |
1327 | 1313 | struct Scsi_Host *shost; | |
1328 | spin_lock_irqsave(shost->host_lock, iflag); | 1314 | shost = lpfc_shost_from_vport(vports[i]); |
1329 | vport->fc_flag &= ~FC_ESTABLISH_LINK; | 1315 | spin_lock_irqsave(shost->host_lock, iflag); |
1330 | spin_unlock_irqrestore(shost->host_lock, iflag); | 1316 | vports[i]->fc_flag &= ~FC_ESTABLISH_LINK; |
1331 | } | 1317 | spin_unlock_irqrestore(shost->host_lock, iflag); |
1318 | } | ||
1319 | lpfc_destroy_vport_work_array(vports); | ||
1332 | } | 1320 | } |
1333 | 1321 | ||
1334 | void | 1322 | void |
@@ -1343,12 +1331,9 @@ lpfc_stop_vport_timers(struct lpfc_vport *vport) | |||
1343 | static void | 1331 | static void |
1344 | lpfc_stop_phba_timers(struct lpfc_hba *phba) | 1332 | lpfc_stop_phba_timers(struct lpfc_hba *phba) |
1345 | { | 1333 | { |
1346 | struct lpfc_vport *vport; | ||
1347 | |||
1348 | del_timer_sync(&phba->fcp_poll_timer); | 1334 | del_timer_sync(&phba->fcp_poll_timer); |
1349 | del_timer_sync(&phba->fc_estabtmo); | 1335 | del_timer_sync(&phba->fc_estabtmo); |
1350 | list_for_each_entry(vport, &phba->port_list, listentry) | 1336 | lpfc_stop_vport_timers(phba->pport); |
1351 | lpfc_stop_vport_timers(vport); | ||
1352 | del_timer_sync(&phba->sli.mbox_tmo); | 1337 | del_timer_sync(&phba->sli.mbox_tmo); |
1353 | del_timer_sync(&phba->fabric_block_timer); | 1338 | del_timer_sync(&phba->fabric_block_timer); |
1354 | phba->hb_outstanding = 0; | 1339 | phba->hb_outstanding = 0; |
@@ -1360,6 +1345,8 @@ int | |||
1360 | lpfc_online(struct lpfc_hba *phba) | 1345 | lpfc_online(struct lpfc_hba *phba) |
1361 | { | 1346 | { |
1362 | struct lpfc_vport *vport = phba->pport; | 1347 | struct lpfc_vport *vport = phba->pport; |
1348 | struct lpfc_vport **vports; | ||
1349 | int i; | ||
1363 | 1350 | ||
1364 | if (!phba) | 1351 | if (!phba) |
1365 | return 0; | 1352 | return 0; |
@@ -1368,8 +1355,7 @@ lpfc_online(struct lpfc_hba *phba) | |||
1368 | return 0; | 1355 | return 0; |
1369 | 1356 | ||
1370 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | 1357 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, |
1371 | "%d:0458 Bring Adapter online\n", | 1358 | "0458 Bring Adapter online\n"); |
1372 | phba->brd_no); | ||
1373 | 1359 | ||
1374 | lpfc_block_mgmt_io(phba); | 1360 | lpfc_block_mgmt_io(phba); |
1375 | 1361 | ||
@@ -1383,14 +1369,18 @@ lpfc_online(struct lpfc_hba *phba) | |||
1383 | return 1; | 1369 | return 1; |
1384 | } | 1370 | } |
1385 | 1371 | ||
1386 | list_for_each_entry(vport, &phba->port_list, listentry) { | 1372 | vports = lpfc_create_vport_work_array(phba); |
1387 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 1373 | if (vports != NULL) |
1388 | spin_lock_irq(shost->host_lock); | 1374 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { |
1389 | vport->fc_flag &= ~FC_OFFLINE_MODE; | 1375 | struct Scsi_Host *shost; |
1390 | if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) | 1376 | shost = lpfc_shost_from_vport(vports[i]); |
1391 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; | 1377 | spin_lock_irq(shost->host_lock); |
1392 | spin_unlock_irq(shost->host_lock); | 1378 | vports[i]->fc_flag &= ~FC_OFFLINE_MODE; |
1393 | } | 1379 | if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) |
1380 | vports[i]->fc_flag |= FC_VPORT_NEEDS_REG_VPI; | ||
1381 | spin_unlock_irq(shost->host_lock); | ||
1382 | } | ||
1383 | lpfc_destroy_vport_work_array(vports); | ||
1394 | 1384 | ||
1395 | lpfc_unblock_mgmt_io(phba); | 1385 | lpfc_unblock_mgmt_io(phba); |
1396 | return 0; | 1386 | return 0; |
@@ -1440,39 +1430,39 @@ lpfc_offline_prep(struct lpfc_hba * phba) | |||
1440 | void | 1430 | void |
1441 | lpfc_offline(struct lpfc_hba *phba) | 1431 | lpfc_offline(struct lpfc_hba *phba) |
1442 | { | 1432 | { |
1443 | struct lpfc_vport *vport = phba->pport; | 1433 | struct Scsi_Host *shost; |
1444 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 1434 | struct lpfc_vport **vports; |
1445 | struct lpfc_vport *port_iterator; | 1435 | int i; |
1446 | 1436 | ||
1447 | if (vport->fc_flag & FC_OFFLINE_MODE) | 1437 | if (phba->pport->fc_flag & FC_OFFLINE_MODE) |
1448 | return; | 1438 | return; |
1449 | 1439 | ||
1450 | /* stop all timers associated with this hba */ | 1440 | /* stop all timers associated with this hba */ |
1451 | lpfc_stop_phba_timers(phba); | 1441 | lpfc_stop_phba_timers(phba); |
1452 | list_for_each_entry(port_iterator, &phba->port_list, listentry) { | 1442 | vports = lpfc_create_vport_work_array(phba); |
1453 | port_iterator->work_port_events = 0; | 1443 | if (vports != NULL) |
1454 | } | 1444 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) |
1455 | 1445 | lpfc_stop_vport_timers(vports[i]); | |
1446 | lpfc_destroy_vport_work_array(vports); | ||
1456 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | 1447 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, |
1457 | "%d:0460 Bring Adapter offline\n", | 1448 | "0460 Bring Adapter offline\n"); |
1458 | phba->brd_no); | ||
1459 | |||
1460 | /* Bring down the SLI Layer and cleanup. The HBA is offline | 1449 | /* Bring down the SLI Layer and cleanup. The HBA is offline |
1461 | now. */ | 1450 | now. */ |
1462 | lpfc_sli_hba_down(phba); | 1451 | lpfc_sli_hba_down(phba); |
1463 | spin_lock_irq(&phba->hbalock); | 1452 | spin_lock_irq(&phba->hbalock); |
1464 | phba->work_ha = 0; | 1453 | phba->work_ha = 0; |
1465 | vport->fc_flag |= FC_OFFLINE_MODE; | ||
1466 | spin_unlock_irq(&phba->hbalock); | 1454 | spin_unlock_irq(&phba->hbalock); |
1467 | list_for_each_entry(port_iterator, &phba->port_list, listentry) { | 1455 | vports = lpfc_create_vport_work_array(phba); |
1468 | shost = lpfc_shost_from_vport(port_iterator); | 1456 | if (vports != NULL) |
1469 | 1457 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { | |
1470 | lpfc_cleanup(port_iterator); | 1458 | shost = lpfc_shost_from_vport(vports[i]); |
1471 | spin_lock_irq(shost->host_lock); | 1459 | lpfc_cleanup(vports[i]); |
1472 | vport->work_port_events = 0; | 1460 | spin_lock_irq(shost->host_lock); |
1473 | vport->fc_flag |= FC_OFFLINE_MODE; | 1461 | vports[i]->work_port_events = 0; |
1474 | spin_unlock_irq(shost->host_lock); | 1462 | vports[i]->fc_flag |= FC_OFFLINE_MODE; |
1475 | } | 1463 | spin_unlock_irq(shost->host_lock); |
1464 | } | ||
1465 | lpfc_destroy_vport_work_array(vports); | ||
1476 | } | 1466 | } |
1477 | 1467 | ||
1478 | /****************************************************************************** | 1468 | /****************************************************************************** |
@@ -1509,15 +1499,19 @@ lpfc_scsi_free(struct lpfc_hba *phba) | |||
1509 | return 0; | 1499 | return 0; |
1510 | } | 1500 | } |
1511 | 1501 | ||
1512 | |||
1513 | struct lpfc_vport * | 1502 | struct lpfc_vport * |
1514 | lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | 1503 | lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) |
1515 | { | 1504 | { |
1516 | struct lpfc_vport *vport; | 1505 | struct lpfc_vport *vport; |
1517 | struct Scsi_Host *shost; | 1506 | struct Scsi_Host *shost; |
1518 | int error = 0; | 1507 | int error = 0; |
1519 | 1508 | ||
1520 | shost = scsi_host_alloc(&lpfc_template, sizeof(struct lpfc_vport)); | 1509 | if (dev != &phba->pcidev->dev) |
1510 | shost = scsi_host_alloc(&lpfc_vport_template, | ||
1511 | sizeof(struct lpfc_vport)); | ||
1512 | else | ||
1513 | shost = scsi_host_alloc(&lpfc_template, | ||
1514 | sizeof(struct lpfc_vport)); | ||
1521 | if (!shost) | 1515 | if (!shost) |
1522 | goto out; | 1516 | goto out; |
1523 | 1517 | ||
@@ -1527,9 +1521,10 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | |||
1527 | vport->load_flag |= FC_LOADING; | 1521 | vport->load_flag |= FC_LOADING; |
1528 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; | 1522 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; |
1529 | 1523 | ||
1524 | lpfc_get_vport_cfgparam(vport); | ||
1530 | shost->unique_id = instance; | 1525 | shost->unique_id = instance; |
1531 | shost->max_id = LPFC_MAX_TARGET; | 1526 | shost->max_id = LPFC_MAX_TARGET; |
1532 | shost->max_lun = phba->cfg_max_luns; | 1527 | shost->max_lun = vport->cfg_max_luns; |
1533 | shost->this_id = -1; | 1528 | shost->this_id = -1; |
1534 | shost->max_cmd_len = 16; | 1529 | shost->max_cmd_len = 16; |
1535 | /* | 1530 | /* |
@@ -1538,7 +1533,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | |||
1538 | * max xri value determined in hba setup. | 1533 | * max xri value determined in hba setup. |
1539 | */ | 1534 | */ |
1540 | shost->can_queue = phba->cfg_hba_queue_depth - 10; | 1535 | shost->can_queue = phba->cfg_hba_queue_depth - 10; |
1541 | if (fc_vport != NULL) { | 1536 | if (dev != &phba->pcidev->dev) { |
1542 | shost->transportt = lpfc_vport_transport_template; | 1537 | shost->transportt = lpfc_vport_transport_template; |
1543 | vport->port_type = LPFC_NPIV_PORT; | 1538 | vport->port_type = LPFC_NPIV_PORT; |
1544 | } else { | 1539 | } else { |
@@ -1562,15 +1557,13 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) | |||
1562 | vport->els_tmofunc.function = lpfc_els_timeout; | 1557 | vport->els_tmofunc.function = lpfc_els_timeout; |
1563 | vport->els_tmofunc.data = (unsigned long)vport; | 1558 | vport->els_tmofunc.data = (unsigned long)vport; |
1564 | 1559 | ||
1565 | if (fc_vport != NULL) { | 1560 | error = scsi_add_host(shost, dev); |
1566 | error = scsi_add_host(shost, &fc_vport->dev); | ||
1567 | } else { | ||
1568 | error = scsi_add_host(shost, &phba->pcidev->dev); | ||
1569 | } | ||
1570 | if (error) | 1561 | if (error) |
1571 | goto out_put_shost; | 1562 | goto out_put_shost; |
1572 | 1563 | ||
1564 | spin_lock_irq(&phba->hbalock); | ||
1573 | list_add_tail(&vport->listentry, &phba->port_list); | 1565 | list_add_tail(&vport->listentry, &phba->port_list); |
1566 | spin_unlock_irq(&phba->hbalock); | ||
1574 | return vport; | 1567 | return vport; |
1575 | 1568 | ||
1576 | out_put_shost: | 1569 | out_put_shost: |
@@ -1625,23 +1618,21 @@ int lpfc_scan_finished(struct Scsi_Host *shost, unsigned long time) | |||
1625 | 1618 | ||
1626 | spin_lock_irq(shost->host_lock); | 1619 | spin_lock_irq(shost->host_lock); |
1627 | 1620 | ||
1628 | if (vport->fc_flag & FC_UNLOADING) { | 1621 | if (vport->load_flag & FC_UNLOADING) { |
1629 | stat = 1; | 1622 | stat = 1; |
1630 | goto finished; | 1623 | goto finished; |
1631 | } | 1624 | } |
1632 | if (time >= 30 * HZ) { | 1625 | if (time >= 30 * HZ) { |
1633 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 1626 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
1634 | "%d:0461 Scanning longer than 30 " | 1627 | "0461 Scanning longer than 30 " |
1635 | "seconds. Continuing initialization\n", | 1628 | "seconds. Continuing initialization\n"); |
1636 | phba->brd_no); | ||
1637 | stat = 1; | 1629 | stat = 1; |
1638 | goto finished; | 1630 | goto finished; |
1639 | } | 1631 | } |
1640 | if (time >= 15 * HZ && phba->link_state <= LPFC_LINK_DOWN) { | 1632 | if (time >= 15 * HZ && phba->link_state <= LPFC_LINK_DOWN) { |
1641 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 1633 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
1642 | "%d:0465 Link down longer than 15 " | 1634 | "0465 Link down longer than 15 " |
1643 | "seconds. Continuing initialization\n", | 1635 | "seconds. Continuing initialization\n"); |
1644 | phba->brd_no); | ||
1645 | stat = 1; | 1636 | stat = 1; |
1646 | goto finished; | 1637 | goto finished; |
1647 | } | 1638 | } |
@@ -1704,7 +1695,7 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost) | |||
1704 | 1695 | ||
1705 | fc_host_max_npiv_vports(shost) = phba->max_vpi; | 1696 | fc_host_max_npiv_vports(shost) = phba->max_vpi; |
1706 | spin_lock_irq(shost->host_lock); | 1697 | spin_lock_irq(shost->host_lock); |
1707 | vport->fc_flag &= ~FC_LOADING; | 1698 | vport->load_flag &= ~FC_LOADING; |
1708 | spin_unlock_irq(shost->host_lock); | 1699 | spin_unlock_irq(shost->host_lock); |
1709 | } | 1700 | } |
1710 | 1701 | ||
@@ -1716,9 +1707,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1716 | struct lpfc_sli *psli; | 1707 | struct lpfc_sli *psli; |
1717 | struct lpfc_iocbq *iocbq_entry = NULL, *iocbq_next = NULL; | 1708 | struct lpfc_iocbq *iocbq_entry = NULL, *iocbq_next = NULL; |
1718 | struct Scsi_Host *shost = NULL; | 1709 | struct Scsi_Host *shost = NULL; |
1710 | void *ptr; | ||
1719 | unsigned long bar0map_len, bar2map_len; | 1711 | unsigned long bar0map_len, bar2map_len; |
1720 | int error = -ENODEV; | 1712 | int error = -ENODEV; |
1721 | int i; | 1713 | int i, hbq_count; |
1722 | uint16_t iotag; | 1714 | uint16_t iotag; |
1723 | 1715 | ||
1724 | if (pci_enable_device(pdev)) | 1716 | if (pci_enable_device(pdev)) |
@@ -1739,7 +1731,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1739 | goto out_free_phba; | 1731 | goto out_free_phba; |
1740 | 1732 | ||
1741 | INIT_LIST_HEAD(&phba->port_list); | 1733 | INIT_LIST_HEAD(&phba->port_list); |
1742 | INIT_LIST_HEAD(&phba->hbq_buffer_list); | ||
1743 | /* | 1734 | /* |
1744 | * Get all the module params for configuring this host and then | 1735 | * Get all the module params for configuring this host and then |
1745 | * establish the host. | 1736 | * establish the host. |
@@ -1817,6 +1808,17 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1817 | if (!phba->hbqslimp.virt) | 1808 | if (!phba->hbqslimp.virt) |
1818 | goto out_free_slim; | 1809 | goto out_free_slim; |
1819 | 1810 | ||
1811 | hbq_count = lpfc_sli_hbq_count(); | ||
1812 | ptr = phba->hbqslimp.virt; | ||
1813 | for (i = 0; i < hbq_count; ++i) { | ||
1814 | phba->hbqs[i].hbq_virt = ptr; | ||
1815 | INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list); | ||
1816 | ptr += (lpfc_hbq_defs[i]->entry_count * | ||
1817 | sizeof(struct lpfc_hbq_entry)); | ||
1818 | } | ||
1819 | phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc; | ||
1820 | phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer = lpfc_els_hbq_free; | ||
1821 | |||
1820 | memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); | 1822 | memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); |
1821 | 1823 | ||
1822 | /* Initialize the SLI Layer to run with lpfc HBAs. */ | 1824 | /* Initialize the SLI Layer to run with lpfc HBAs. */ |
@@ -1880,7 +1882,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1880 | /* Initialize list of fabric iocbs */ | 1882 | /* Initialize list of fabric iocbs */ |
1881 | INIT_LIST_HEAD(&phba->fabric_iocb_list); | 1883 | INIT_LIST_HEAD(&phba->fabric_iocb_list); |
1882 | 1884 | ||
1883 | vport = lpfc_create_port(phba, phba->brd_no, NULL); | 1885 | vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev); |
1884 | if (!vport) | 1886 | if (!vport) |
1885 | goto out_kthread_stop; | 1887 | goto out_kthread_stop; |
1886 | 1888 | ||
@@ -1892,18 +1894,19 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1892 | 1894 | ||
1893 | if (phba->cfg_use_msi) { | 1895 | if (phba->cfg_use_msi) { |
1894 | error = pci_enable_msi(phba->pcidev); | 1896 | error = pci_enable_msi(phba->pcidev); |
1895 | if (error) | 1897 | if (!error) |
1896 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "%d:0452 " | 1898 | phba->using_msi = 1; |
1897 | "Enable MSI failed, continuing with " | 1899 | else |
1898 | "IRQ\n", phba->brd_no); | 1900 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
1901 | "0452 Enable MSI failed, continuing " | ||
1902 | "with IRQ\n"); | ||
1899 | } | 1903 | } |
1900 | 1904 | ||
1901 | error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED, | 1905 | error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED, |
1902 | LPFC_DRIVER_NAME, phba); | 1906 | LPFC_DRIVER_NAME, phba); |
1903 | if (error) { | 1907 | if (error) { |
1904 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1908 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
1905 | "%d:0451 Enable interrupt handler failed\n", | 1909 | "0451 Enable interrupt handler failed\n"); |
1906 | phba->brd_no); | ||
1907 | goto out_disable_msi; | 1910 | goto out_disable_msi; |
1908 | } | 1911 | } |
1909 | 1912 | ||
@@ -1940,14 +1943,15 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1940 | out_remove_device: | 1943 | out_remove_device: |
1941 | lpfc_free_sysfs_attr(vport); | 1944 | lpfc_free_sysfs_attr(vport); |
1942 | spin_lock_irq(shost->host_lock); | 1945 | spin_lock_irq(shost->host_lock); |
1943 | vport->fc_flag |= FC_UNLOADING; | 1946 | vport->load_flag |= FC_UNLOADING; |
1944 | spin_unlock_irq(shost->host_lock); | 1947 | spin_unlock_irq(shost->host_lock); |
1945 | out_free_irq: | 1948 | out_free_irq: |
1946 | lpfc_stop_phba_timers(phba); | 1949 | lpfc_stop_phba_timers(phba); |
1947 | phba->pport->work_port_events = 0; | 1950 | phba->pport->work_port_events = 0; |
1948 | free_irq(phba->pcidev->irq, phba); | 1951 | free_irq(phba->pcidev->irq, phba); |
1949 | out_disable_msi: | 1952 | out_disable_msi: |
1950 | pci_disable_msi(phba->pcidev); | 1953 | if (phba->using_msi) |
1954 | pci_disable_msi(phba->pcidev); | ||
1951 | destroy_port(vport); | 1955 | destroy_port(vport); |
1952 | out_kthread_stop: | 1956 | out_kthread_stop: |
1953 | kthread_stop(phba->worker_thread); | 1957 | kthread_stop(phba->worker_thread); |
@@ -1989,16 +1993,15 @@ lpfc_pci_remove_one(struct pci_dev *pdev) | |||
1989 | struct Scsi_Host *shost = pci_get_drvdata(pdev); | 1993 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
1990 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 1994 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1991 | struct lpfc_hba *phba = vport->phba; | 1995 | struct lpfc_hba *phba = vport->phba; |
1992 | struct lpfc_vport *port_iterator; | 1996 | spin_lock_irq(&phba->hbalock); |
1993 | list_for_each_entry(port_iterator, &phba->port_list, listentry) | 1997 | vport->load_flag |= FC_UNLOADING; |
1994 | port_iterator->load_flag |= FC_UNLOADING; | 1998 | spin_unlock_irq(&phba->hbalock); |
1995 | 1999 | ||
1996 | kfree(vport->vname); | 2000 | kfree(vport->vname); |
1997 | lpfc_free_sysfs_attr(vport); | 2001 | lpfc_free_sysfs_attr(vport); |
1998 | 2002 | ||
1999 | fc_remove_host(shost); | 2003 | fc_remove_host(shost); |
2000 | scsi_remove_host(shost); | 2004 | scsi_remove_host(shost); |
2001 | |||
2002 | /* | 2005 | /* |
2003 | * Bring down the SLI Layer. This step disable all interrupts, | 2006 | * Bring down the SLI Layer. This step disable all interrupts, |
2004 | * clears the rings, discards all mailbox commands, and resets | 2007 | * clears the rings, discards all mailbox commands, and resets |
@@ -2012,7 +2015,6 @@ lpfc_pci_remove_one(struct pci_dev *pdev) | |||
2012 | list_del_init(&vport->listentry); | 2015 | list_del_init(&vport->listentry); |
2013 | spin_unlock_irq(&phba->hbalock); | 2016 | spin_unlock_irq(&phba->hbalock); |
2014 | 2017 | ||
2015 | |||
2016 | lpfc_debugfs_terminate(vport); | 2018 | lpfc_debugfs_terminate(vport); |
2017 | lpfc_cleanup(vport); | 2019 | lpfc_cleanup(vport); |
2018 | 2020 | ||
@@ -2020,7 +2022,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev) | |||
2020 | 2022 | ||
2021 | /* Release the irq reservation */ | 2023 | /* Release the irq reservation */ |
2022 | free_irq(phba->pcidev->irq, phba); | 2024 | free_irq(phba->pcidev->irq, phba); |
2023 | pci_disable_msi(phba->pcidev); | 2025 | if (phba->using_msi) |
2026 | pci_disable_msi(phba->pcidev); | ||
2024 | 2027 | ||
2025 | pci_set_drvdata(pdev, NULL); | 2028 | pci_set_drvdata(pdev, NULL); |
2026 | scsi_host_put(shost); | 2029 | scsi_host_put(shost); |
@@ -2062,8 +2065,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev) | |||
2062 | static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, | 2065 | static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, |
2063 | pci_channel_state_t state) | 2066 | pci_channel_state_t state) |
2064 | { | 2067 | { |
2065 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 2068 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
2066 | struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; | 2069 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
2067 | struct lpfc_sli *psli = &phba->sli; | 2070 | struct lpfc_sli *psli = &phba->sli; |
2068 | struct lpfc_sli_ring *pring; | 2071 | struct lpfc_sli_ring *pring; |
2069 | 2072 | ||
@@ -2079,6 +2082,11 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, | |||
2079 | pring = &psli->ring[psli->fcp_ring]; | 2082 | pring = &psli->ring[psli->fcp_ring]; |
2080 | lpfc_sli_abort_iocb_ring(phba, pring); | 2083 | lpfc_sli_abort_iocb_ring(phba, pring); |
2081 | 2084 | ||
2085 | /* Release the irq reservation */ | ||
2086 | free_irq(phba->pcidev->irq, phba); | ||
2087 | if (phba->using_msi) | ||
2088 | pci_disable_msi(phba->pcidev); | ||
2089 | |||
2082 | /* Request a slot reset. */ | 2090 | /* Request a slot reset. */ |
2083 | return PCI_ERS_RESULT_NEED_RESET; | 2091 | return PCI_ERS_RESULT_NEED_RESET; |
2084 | } | 2092 | } |
@@ -2091,8 +2099,8 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, | |||
2091 | */ | 2099 | */ |
2092 | static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) | 2100 | static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) |
2093 | { | 2101 | { |
2094 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 2102 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
2095 | struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; | 2103 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
2096 | struct lpfc_sli *psli = &phba->sli; | 2104 | struct lpfc_sli *psli = &phba->sli; |
2097 | int bars = pci_select_bars(pdev, IORESOURCE_MEM); | 2105 | int bars = pci_select_bars(pdev, IORESOURCE_MEM); |
2098 | 2106 | ||
@@ -2106,9 +2114,9 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) | |||
2106 | pci_set_master(pdev); | 2114 | pci_set_master(pdev); |
2107 | 2115 | ||
2108 | /* Re-establishing Link */ | 2116 | /* Re-establishing Link */ |
2109 | spin_lock_irq(host->host_lock); | 2117 | spin_lock_irq(shost->host_lock); |
2110 | phba->pport->fc_flag |= FC_ESTABLISH_LINK; | 2118 | phba->pport->fc_flag |= FC_ESTABLISH_LINK; |
2111 | spin_unlock_irq(host->host_lock); | 2119 | spin_unlock_irq(shost->host_lock); |
2112 | 2120 | ||
2113 | spin_lock_irq(&phba->hbalock); | 2121 | spin_lock_irq(&phba->hbalock); |
2114 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; | 2122 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; |
@@ -2131,8 +2139,8 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev) | |||
2131 | */ | 2139 | */ |
2132 | static void lpfc_io_resume(struct pci_dev *pdev) | 2140 | static void lpfc_io_resume(struct pci_dev *pdev) |
2133 | { | 2141 | { |
2134 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 2142 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
2135 | struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; | 2143 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
2136 | 2144 | ||
2137 | if (lpfc_online(phba) == 0) { | 2145 | if (lpfc_online(phba) == 0) { |
2138 | mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); | 2146 | mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); |
diff --git a/drivers/scsi/lpfc/lpfc_logmsg.h b/drivers/scsi/lpfc/lpfc_logmsg.h index 8a6ceffeabcf..626e4d878725 100644 --- a/drivers/scsi/lpfc/lpfc_logmsg.h +++ b/drivers/scsi/lpfc/lpfc_logmsg.h | |||
@@ -33,6 +33,12 @@ | |||
33 | #define LOG_VPORT 0x4000 /* NPIV events */ | 33 | #define LOG_VPORT 0x4000 /* NPIV events */ |
34 | #define LOG_ALL_MSG 0xffff /* LOG all messages */ | 34 | #define LOG_ALL_MSG 0xffff /* LOG all messages */ |
35 | 35 | ||
36 | #define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \ | ||
37 | { if (((mask) &(vport)->cfg_log_verbose) || (level[1] <= '3')) \ | ||
38 | dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \ | ||
39 | fmt, (vport)->phba->brd_no, vport->vpi, ##arg); } | ||
40 | |||
36 | #define lpfc_printf_log(phba, level, mask, fmt, arg...) \ | 41 | #define lpfc_printf_log(phba, level, mask, fmt, arg...) \ |
37 | { if (((mask) &(phba)->cfg_log_verbose) || (level[1] <= '3')) \ | 42 | { if (((mask) &(phba)->pport->cfg_log_verbose) || (level[1] <= '3')) \ |
38 | dev_printk(level, &((phba)->pcidev)->dev, fmt, ##arg); } | 43 | dev_printk(level, &((phba)->pcidev)->dev, "%d:" \ |
44 | fmt, phba->brd_no, ##arg); } | ||
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index 8f42fbfdd29e..a592733664e9 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -275,11 +275,8 @@ lpfc_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, int vpi) | |||
275 | kfree(mp); | 275 | kfree(mp); |
276 | mb->mbxCommand = MBX_READ_SPARM64; | 276 | mb->mbxCommand = MBX_READ_SPARM64; |
277 | /* READ_SPARAM: no buffers */ | 277 | /* READ_SPARAM: no buffers */ |
278 | lpfc_printf_log(phba, | 278 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, |
279 | KERN_WARNING, | 279 | "0301 READ_SPARAM: no buffers\n"); |
280 | LOG_MBOX, | ||
281 | "%d:0301 READ_SPARAM: no buffers\n", | ||
282 | phba->brd_no); | ||
283 | return (1); | 280 | return (1); |
284 | } | 281 | } |
285 | INIT_LIST_HEAD(&mp->list); | 282 | INIT_LIST_HEAD(&mp->list); |
@@ -378,9 +375,8 @@ lpfc_reg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t did, | |||
378 | mb->mbxCommand = MBX_REG_LOGIN64; | 375 | mb->mbxCommand = MBX_REG_LOGIN64; |
379 | /* REG_LOGIN: no buffers */ | 376 | /* REG_LOGIN: no buffers */ |
380 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, | 377 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, |
381 | "%d (%d):0302 REG_LOGIN: no buffers, DID x%x, " | 378 | "0302 REG_LOGIN: no buffers, VPI:%d DID:x%x, " |
382 | "flag x%x\n", | 379 | "flag x%x\n", vpi, did, flag); |
383 | phba->brd_no, vpi, did, flag); | ||
384 | return (1); | 380 | return (1); |
385 | } | 381 | } |
386 | INIT_LIST_HEAD(&mp->list); | 382 | INIT_LIST_HEAD(&mp->list); |
@@ -564,7 +560,8 @@ lpfc_build_hbq_profile5(struct config_hbq_var *hbqmb, | |||
564 | } | 560 | } |
565 | 561 | ||
566 | void | 562 | void |
567 | lpfc_config_hbq(struct lpfc_hba *phba, struct lpfc_hbq_init *hbq_desc, | 563 | lpfc_config_hbq(struct lpfc_hba *phba, uint32_t id, |
564 | struct lpfc_hbq_init *hbq_desc, | ||
568 | uint32_t hbq_entry_index, LPFC_MBOXQ_t *pmb) | 565 | uint32_t hbq_entry_index, LPFC_MBOXQ_t *pmb) |
569 | { | 566 | { |
570 | int i; | 567 | int i; |
@@ -572,6 +569,7 @@ lpfc_config_hbq(struct lpfc_hba *phba, struct lpfc_hbq_init *hbq_desc, | |||
572 | struct config_hbq_var *hbqmb = &mb->un.varCfgHbq; | 569 | struct config_hbq_var *hbqmb = &mb->un.varCfgHbq; |
573 | 570 | ||
574 | memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); | 571 | memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); |
572 | hbqmb->hbqId = id; | ||
575 | hbqmb->entry_count = hbq_desc->entry_count; /* # entries in HBQ */ | 573 | hbqmb->entry_count = hbq_desc->entry_count; /* # entries in HBQ */ |
576 | hbqmb->recvNotify = hbq_desc->rn; /* Receive | 574 | hbqmb->recvNotify = hbq_desc->rn; /* Receive |
577 | * Notification */ | 575 | * Notification */ |
@@ -691,8 +689,8 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
691 | 689 | ||
692 | if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) { | 690 | if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) { |
693 | mb->un.varCfgPort.cerbm = 1; /* Request HBQs */ | 691 | mb->un.varCfgPort.cerbm = 1; /* Request HBQs */ |
694 | mb->un.varCfgPort.max_hbq = 1; /* Requesting 2 HBQs */ | 692 | mb->un.varCfgPort.max_hbq = lpfc_sli_hbq_count(); |
695 | if (phba->max_vpi && phba->cfg_npiv_enable && | 693 | if (phba->max_vpi && phba->cfg_enable_npiv && |
696 | phba->vpd.sli3Feat.cmv) { | 694 | phba->vpd.sli3Feat.cmv) { |
697 | mb->un.varCfgPort.max_vpi = phba->max_vpi; | 695 | mb->un.varCfgPort.max_vpi = phba->max_vpi; |
698 | mb->un.varCfgPort.cmv = 1; | 696 | mb->un.varCfgPort.cmv = 1; |
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c index 3594c469494f..43c3b8a0d76a 100644 --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c | |||
@@ -231,21 +231,34 @@ lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma) | |||
231 | return; | 231 | return; |
232 | } | 232 | } |
233 | 233 | ||
234 | void * | 234 | struct hbq_dmabuf * |
235 | lpfc_hbq_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle) | 235 | lpfc_els_hbq_alloc(struct lpfc_hba *phba) |
236 | { | 236 | { |
237 | void *ret; | 237 | struct hbq_dmabuf *hbqbp; |
238 | ret = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_ATOMIC, handle); | 238 | |
239 | return ret; | 239 | hbqbp = kmalloc(sizeof(struct hbq_dmabuf), GFP_KERNEL); |
240 | if (!hbqbp) | ||
241 | return NULL; | ||
242 | |||
243 | hbqbp->dbuf.virt = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL, | ||
244 | &hbqbp->dbuf.phys); | ||
245 | if (!hbqbp->dbuf.virt) { | ||
246 | kfree(hbqbp); | ||
247 | return NULL; | ||
248 | } | ||
249 | hbqbp->size = LPFC_BPL_SIZE; | ||
250 | return hbqbp; | ||
240 | } | 251 | } |
241 | 252 | ||
242 | void | 253 | void |
243 | lpfc_hbq_free(struct lpfc_hba *phba, void *virt, dma_addr_t dma) | 254 | lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp) |
244 | { | 255 | { |
245 | pci_pool_free(phba->lpfc_hbq_pool, virt, dma); | 256 | pci_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys); |
257 | kfree(hbqbp); | ||
246 | return; | 258 | return; |
247 | } | 259 | } |
248 | 260 | ||
261 | /* This is ONLY called for the LPFC_ELS_HBQ */ | ||
249 | void | 262 | void |
250 | lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) | 263 | lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) |
251 | { | 264 | { |
@@ -254,9 +267,8 @@ lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) | |||
254 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { | 267 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { |
255 | hbq_entry = container_of(mp, struct hbq_dmabuf, dbuf); | 268 | hbq_entry = container_of(mp, struct hbq_dmabuf, dbuf); |
256 | if (hbq_entry->tag == -1) { | 269 | if (hbq_entry->tag == -1) { |
257 | lpfc_hbq_free(phba, hbq_entry->dbuf.virt, | 270 | (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer) |
258 | hbq_entry->dbuf.phys); | 271 | (phba, hbq_entry); |
259 | kfree(hbq_entry); | ||
260 | } else { | 272 | } else { |
261 | lpfc_sli_free_hbq(phba, hbq_entry); | 273 | lpfc_sli_free_hbq(phba, hbq_entry); |
262 | } | 274 | } |
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index bca2f5c9b4ba..880af0cd463d 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c | |||
@@ -133,15 +133,15 @@ lpfc_check_sparm(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
133 | memcpy(&ndlp->nlp_portname, &sp->portName, sizeof (struct lpfc_name)); | 133 | memcpy(&ndlp->nlp_portname, &sp->portName, sizeof (struct lpfc_name)); |
134 | return 1; | 134 | return 1; |
135 | bad_service_param: | 135 | bad_service_param: |
136 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_DISCOVERY, | 136 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
137 | "%d (%d):0207 Device %x " | 137 | "0207 Device %x " |
138 | "(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x) sent " | 138 | "(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x) sent " |
139 | "invalid service parameters. Ignoring device.\n", | 139 | "invalid service parameters. Ignoring device.\n", |
140 | vport->phba->brd_no, ndlp->vport->vpi, ndlp->nlp_DID, | 140 | ndlp->nlp_DID, |
141 | sp->nodeName.u.wwn[0], sp->nodeName.u.wwn[1], | 141 | sp->nodeName.u.wwn[0], sp->nodeName.u.wwn[1], |
142 | sp->nodeName.u.wwn[2], sp->nodeName.u.wwn[3], | 142 | sp->nodeName.u.wwn[2], sp->nodeName.u.wwn[3], |
143 | sp->nodeName.u.wwn[4], sp->nodeName.u.wwn[5], | 143 | sp->nodeName.u.wwn[4], sp->nodeName.u.wwn[5], |
144 | sp->nodeName.u.wwn[6], sp->nodeName.u.wwn[7]); | 144 | sp->nodeName.u.wwn[6], sp->nodeName.u.wwn[7]); |
145 | return 0; | 145 | return 0; |
146 | } | 146 | } |
147 | 147 | ||
@@ -194,11 +194,11 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | |||
194 | IOCB_t *cmd; | 194 | IOCB_t *cmd; |
195 | 195 | ||
196 | /* Abort outstanding I/O on NPort <nlp_DID> */ | 196 | /* Abort outstanding I/O on NPort <nlp_DID> */ |
197 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 197 | lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_DISCOVERY, |
198 | "%d (%d):0205 Abort outstanding I/O on NPort x%x " | 198 | "0205 Abort outstanding I/O on NPort x%x " |
199 | "Data: x%x x%x x%x\n", | 199 | "Data: x%x x%x x%x\n", |
200 | phba->brd_no, ndlp->vport->vpi, ndlp->nlp_DID, | 200 | ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, |
201 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 201 | ndlp->nlp_rpi); |
202 | 202 | ||
203 | lpfc_fabric_abort_nport(ndlp); | 203 | lpfc_fabric_abort_nport(ndlp); |
204 | 204 | ||
@@ -298,13 +298,12 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
298 | icmd = &cmdiocb->iocb; | 298 | icmd = &cmdiocb->iocb; |
299 | 299 | ||
300 | /* PLOGI chkparm OK */ | 300 | /* PLOGI chkparm OK */ |
301 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 301 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
302 | "%d (%d):0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", | 302 | "0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", |
303 | phba->brd_no, vport->vpi, | 303 | ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, |
304 | ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, | 304 | ndlp->nlp_rpi); |
305 | ndlp->nlp_rpi); | ||
306 | 305 | ||
307 | if (phba->cfg_fcp_class == 2 && sp->cls2.classValid) | 306 | if (vport->cfg_fcp_class == 2 && sp->cls2.classValid) |
308 | ndlp->nlp_fcp_info |= CLASS2; | 307 | ndlp->nlp_fcp_info |= CLASS2; |
309 | else | 308 | else |
310 | ndlp->nlp_fcp_info |= CLASS3; | 309 | ndlp->nlp_fcp_info |= CLASS3; |
@@ -330,7 +329,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
330 | case NLP_STE_PRLI_ISSUE: | 329 | case NLP_STE_PRLI_ISSUE: |
331 | case NLP_STE_UNMAPPED_NODE: | 330 | case NLP_STE_UNMAPPED_NODE: |
332 | case NLP_STE_MAPPED_NODE: | 331 | case NLP_STE_MAPPED_NODE: |
333 | lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, 0); | 332 | lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL); |
334 | return 1; | 333 | return 1; |
335 | } | 334 | } |
336 | 335 | ||
@@ -392,7 +391,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
392 | } | 391 | } |
393 | 392 | ||
394 | if ((vport->port_type == LPFC_NPIV_PORT && | 393 | if ((vport->port_type == LPFC_NPIV_PORT && |
395 | phba->cfg_vport_restrict_login)) { | 394 | vport->cfg_restrict_login)) { |
396 | 395 | ||
397 | /* In order to preserve RPIs, we want to cleanup | 396 | /* In order to preserve RPIs, we want to cleanup |
398 | * the default RPI the firmware created to rcv | 397 | * the default RPI the firmware created to rcv |
@@ -408,7 +407,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
408 | ndlp, mbox); | 407 | ndlp, mbox); |
409 | return 1; | 408 | return 1; |
410 | } | 409 | } |
411 | lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0); | 410 | lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox); |
412 | return 1; | 411 | return 1; |
413 | 412 | ||
414 | out: | 413 | out: |
@@ -452,7 +451,7 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
452 | lpfc_els_rsp_adisc_acc(vport, cmdiocb, ndlp); | 451 | lpfc_els_rsp_adisc_acc(vport, cmdiocb, ndlp); |
453 | } else { | 452 | } else { |
454 | lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, | 453 | lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, |
455 | NULL, 0); | 454 | NULL); |
456 | } | 455 | } |
457 | return 1; | 456 | return 1; |
458 | } | 457 | } |
@@ -489,9 +488,9 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
489 | ndlp->nlp_flag |= NLP_LOGO_ACC; | 488 | ndlp->nlp_flag |= NLP_LOGO_ACC; |
490 | spin_unlock_irq(shost->host_lock); | 489 | spin_unlock_irq(shost->host_lock); |
491 | if (els_cmd == ELS_CMD_PRLO) | 490 | if (els_cmd == ELS_CMD_PRLO) |
492 | lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); | 491 | lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); |
493 | else | 492 | else |
494 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 493 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); |
495 | 494 | ||
496 | if (!(ndlp->nlp_type & NLP_FABRIC) || | 495 | if (!(ndlp->nlp_type & NLP_FABRIC) || |
497 | (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) { | 496 | (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) { |
@@ -564,10 +563,14 @@ static uint32_t | |||
564 | lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | 563 | lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
565 | { | 564 | { |
566 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 565 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
567 | struct lpfc_hba *phba = vport->phba; | 566 | |
567 | if (!ndlp->nlp_rpi) { | ||
568 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; | ||
569 | return 0; | ||
570 | } | ||
568 | 571 | ||
569 | /* Check config parameter use-adisc or FCP-2 */ | 572 | /* Check config parameter use-adisc or FCP-2 */ |
570 | if ((phba->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) || | 573 | if ((vport->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) || |
571 | ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) { | 574 | ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) { |
572 | spin_lock_irq(shost->host_lock); | 575 | spin_lock_irq(shost->host_lock); |
573 | ndlp->nlp_flag |= NLP_NPR_ADISC; | 576 | ndlp->nlp_flag |= NLP_NPR_ADISC; |
@@ -583,12 +586,11 @@ static uint32_t | |||
583 | lpfc_disc_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | 586 | lpfc_disc_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
584 | void *arg, uint32_t evt) | 587 | void *arg, uint32_t evt) |
585 | { | 588 | { |
586 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_DISCOVERY, | 589 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
587 | "%d (%d):0253 Illegal State Transition: node x%x " | 590 | "0253 Illegal State Transition: node x%x " |
588 | "event x%x, state x%x Data: x%x x%x\n", | 591 | "event x%x, state x%x Data: x%x x%x\n", |
589 | vport->phba->brd_no, vport->vpi, | 592 | ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi, |
590 | ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi, | 593 | ndlp->nlp_flag); |
591 | ndlp->nlp_flag); | ||
592 | return ndlp->nlp_state; | 594 | return ndlp->nlp_state; |
593 | } | 595 | } |
594 | 596 | ||
@@ -630,7 +632,7 @@ lpfc_rcv_logo_unused_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
630 | spin_lock_irq(shost->host_lock); | 632 | spin_lock_irq(shost->host_lock); |
631 | ndlp->nlp_flag |= NLP_LOGO_ACC; | 633 | ndlp->nlp_flag |= NLP_LOGO_ACC; |
632 | spin_unlock_irq(shost->host_lock); | 634 | spin_unlock_irq(shost->host_lock); |
633 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 635 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); |
634 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE); | 636 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE); |
635 | 637 | ||
636 | return ndlp->nlp_state; | 638 | return ndlp->nlp_state; |
@@ -726,7 +728,7 @@ lpfc_rcv_els_plogi_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
726 | lpfc_els_abort(phba, ndlp); | 728 | lpfc_els_abort(phba, ndlp); |
727 | 729 | ||
728 | if (evt == NLP_EVT_RCV_LOGO) { | 730 | if (evt == NLP_EVT_RCV_LOGO) { |
729 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 731 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); |
730 | } else { | 732 | } else { |
731 | lpfc_issue_els_logo(vport, ndlp, 0); | 733 | lpfc_issue_els_logo(vport, ndlp, 0); |
732 | } | 734 | } |
@@ -778,16 +780,12 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, | |||
778 | sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); | 780 | sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); |
779 | if (!lpfc_check_sparm(vport, ndlp, sp, CLASS3)) | 781 | if (!lpfc_check_sparm(vport, ndlp, sp, CLASS3)) |
780 | goto out; | 782 | goto out; |
781 | |||
782 | /* PLOGI chkparm OK */ | 783 | /* PLOGI chkparm OK */ |
783 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 784 | lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, |
784 | "%d (%d):0121 PLOGI chkparm OK " | 785 | "0121 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", |
785 | "Data: x%x x%x x%x x%x\n", | 786 | ndlp->nlp_DID, ndlp->nlp_state, |
786 | phba->brd_no, vport->vpi, | 787 | ndlp->nlp_flag, ndlp->nlp_rpi); |
787 | ndlp->nlp_DID, ndlp->nlp_state, | 788 | if (vport->cfg_fcp_class == 2 && (sp->cls2.classValid)) |
788 | ndlp->nlp_flag, ndlp->nlp_rpi); | ||
789 | |||
790 | if (phba->cfg_fcp_class == 2 && (sp->cls2.classValid)) | ||
791 | ndlp->nlp_fcp_info |= CLASS2; | 789 | ndlp->nlp_fcp_info |= CLASS2; |
792 | else | 790 | else |
793 | ndlp->nlp_fcp_info |= CLASS3; | 791 | ndlp->nlp_fcp_info |= CLASS3; |
@@ -806,10 +804,9 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, | |||
806 | 804 | ||
807 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 805 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
808 | if (!mbox) { | 806 | if (!mbox) { |
809 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 807 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
810 | "%d (%d):0133 PLOGI: no memory for reg_login " | 808 | "0133 PLOGI: no memory for reg_login " |
811 | "Data: x%x x%x x%x x%x\n", | 809 | "Data: x%x x%x x%x x%x\n", |
812 | phba->brd_no, vport->vpi, | ||
813 | ndlp->nlp_DID, ndlp->nlp_state, | 810 | ndlp->nlp_DID, ndlp->nlp_state, |
814 | ndlp->nlp_flag, ndlp->nlp_rpi); | 811 | ndlp->nlp_flag, ndlp->nlp_rpi); |
815 | goto out; | 812 | goto out; |
@@ -844,30 +841,27 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, | |||
844 | kfree(mp); | 841 | kfree(mp); |
845 | mempool_free(mbox, phba->mbox_mem_pool); | 842 | mempool_free(mbox, phba->mbox_mem_pool); |
846 | 843 | ||
847 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 844 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
848 | "%d (%d):0134 PLOGI: cannot issue reg_login " | 845 | "0134 PLOGI: cannot issue reg_login " |
849 | "Data: x%x x%x x%x x%x\n", | 846 | "Data: x%x x%x x%x x%x\n", |
850 | phba->brd_no, vport->vpi, | 847 | ndlp->nlp_DID, ndlp->nlp_state, |
851 | ndlp->nlp_DID, ndlp->nlp_state, | 848 | ndlp->nlp_flag, ndlp->nlp_rpi); |
852 | ndlp->nlp_flag, ndlp->nlp_rpi); | ||
853 | } else { | 849 | } else { |
854 | mempool_free(mbox, phba->mbox_mem_pool); | 850 | mempool_free(mbox, phba->mbox_mem_pool); |
855 | 851 | ||
856 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 852 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
857 | "%d (%d):0135 PLOGI: cannot format reg_login " | 853 | "0135 PLOGI: cannot format reg_login " |
858 | "Data: x%x x%x x%x x%x\n", | 854 | "Data: x%x x%x x%x x%x\n", |
859 | phba->brd_no, vport->vpi, | 855 | ndlp->nlp_DID, ndlp->nlp_state, |
860 | ndlp->nlp_DID, ndlp->nlp_state, | 856 | ndlp->nlp_flag, ndlp->nlp_rpi); |
861 | ndlp->nlp_flag, ndlp->nlp_rpi); | ||
862 | } | 857 | } |
863 | 858 | ||
864 | 859 | ||
865 | out: | 860 | out: |
866 | if (ndlp->nlp_DID == NameServer_DID) { | 861 | if (ndlp->nlp_DID == NameServer_DID) { |
867 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 862 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
868 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 863 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
869 | "%d (%d):0261 Cannot Register NameServer login\n", | 864 | "0261 Cannot Register NameServer login\n"); |
870 | phba->brd_no, vport->vpi); | ||
871 | } | 865 | } |
872 | 866 | ||
873 | /* Free this node since the driver cannot login or has the wrong | 867 | /* Free this node since the driver cannot login or has the wrong |
@@ -1178,7 +1172,7 @@ lpfc_rcv_prlo_reglogin_issue(struct lpfc_vport *vport, | |||
1178 | struct lpfc_iocbq *cmdiocb; | 1172 | struct lpfc_iocbq *cmdiocb; |
1179 | 1173 | ||
1180 | cmdiocb = (struct lpfc_iocbq *) arg; | 1174 | cmdiocb = (struct lpfc_iocbq *) arg; |
1181 | lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); | 1175 | lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); |
1182 | return ndlp->nlp_state; | 1176 | return ndlp->nlp_state; |
1183 | } | 1177 | } |
1184 | 1178 | ||
@@ -1189,19 +1183,15 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport, | |||
1189 | uint32_t evt) | 1183 | uint32_t evt) |
1190 | { | 1184 | { |
1191 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 1185 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
1192 | struct lpfc_hba *phba = vport->phba; | ||
1193 | LPFC_MBOXQ_t *pmb = (LPFC_MBOXQ_t *) arg; | 1186 | LPFC_MBOXQ_t *pmb = (LPFC_MBOXQ_t *) arg; |
1194 | MAILBOX_t *mb = &pmb->mb; | 1187 | MAILBOX_t *mb = &pmb->mb; |
1195 | uint32_t did = mb->un.varWords[1]; | 1188 | uint32_t did = mb->un.varWords[1]; |
1196 | 1189 | ||
1197 | if (mb->mbxStatus) { | 1190 | if (mb->mbxStatus) { |
1198 | /* RegLogin failed */ | 1191 | /* RegLogin failed */ |
1199 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, | 1192 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
1200 | "%d (%d):0246 RegLogin failed Data: x%x x%x " | 1193 | "0246 RegLogin failed Data: x%x x%x x%x\n", |
1201 | "x%x\n", | ||
1202 | phba->brd_no, vport->vpi, | ||
1203 | did, mb->mbxStatus, vport->port_state); | 1194 | did, mb->mbxStatus, vport->port_state); |
1204 | |||
1205 | /* | 1195 | /* |
1206 | * If RegLogin failed due to lack of HBA resources do not | 1196 | * If RegLogin failed due to lack of HBA resources do not |
1207 | * retry discovery. | 1197 | * retry discovery. |
@@ -1337,7 +1327,7 @@ lpfc_rcv_prlo_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1337 | { | 1327 | { |
1338 | struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; | 1328 | struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; |
1339 | 1329 | ||
1340 | lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); | 1330 | lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); |
1341 | return ndlp->nlp_state; | 1331 | return ndlp->nlp_state; |
1342 | } | 1332 | } |
1343 | 1333 | ||
@@ -1358,7 +1348,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1358 | irsp = &rspiocb->iocb; | 1348 | irsp = &rspiocb->iocb; |
1359 | if (irsp->ulpStatus) { | 1349 | if (irsp->ulpStatus) { |
1360 | if ((vport->port_type == LPFC_NPIV_PORT) && | 1350 | if ((vport->port_type == LPFC_NPIV_PORT) && |
1361 | phba->cfg_vport_restrict_login) { | 1351 | vport->cfg_restrict_login) { |
1362 | goto out; | 1352 | goto out; |
1363 | } | 1353 | } |
1364 | ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; | 1354 | ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; |
@@ -1380,7 +1370,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1380 | } | 1370 | } |
1381 | if (!(ndlp->nlp_type & NLP_FCP_TARGET) && | 1371 | if (!(ndlp->nlp_type & NLP_FCP_TARGET) && |
1382 | (vport->port_type == LPFC_NPIV_PORT) && | 1372 | (vport->port_type == LPFC_NPIV_PORT) && |
1383 | phba->cfg_vport_restrict_login) { | 1373 | vport->cfg_restrict_login) { |
1384 | out: | 1374 | out: |
1385 | spin_lock_irq(shost->host_lock); | 1375 | spin_lock_irq(shost->host_lock); |
1386 | ndlp->nlp_flag |= NLP_TARGET_REMOVE; | 1376 | ndlp->nlp_flag |= NLP_TARGET_REMOVE; |
@@ -1529,7 +1519,7 @@ lpfc_rcv_prlo_unmap_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1529 | { | 1519 | { |
1530 | struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; | 1520 | struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; |
1531 | 1521 | ||
1532 | lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); | 1522 | lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); |
1533 | return ndlp->nlp_state; | 1523 | return ndlp->nlp_state; |
1534 | } | 1524 | } |
1535 | 1525 | ||
@@ -1600,8 +1590,8 @@ lpfc_rcv_prlo_mapped_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1600 | struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; | 1590 | struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; |
1601 | 1591 | ||
1602 | /* flush the target */ | 1592 | /* flush the target */ |
1603 | lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], | 1593 | lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring], |
1604 | ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT); | 1594 | ndlp->nlp_sid, 0, LPFC_CTX_TGT); |
1605 | 1595 | ||
1606 | /* Treat like rcv logo */ | 1596 | /* Treat like rcv logo */ |
1607 | lpfc_rcv_logo(vport, ndlp, cmdiocb, ELS_CMD_PRLO); | 1597 | lpfc_rcv_logo(vport, ndlp, cmdiocb, ELS_CMD_PRLO); |
@@ -1734,7 +1724,7 @@ lpfc_rcv_prlo_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1734 | ndlp->nlp_flag |= NLP_LOGO_ACC; | 1724 | ndlp->nlp_flag |= NLP_LOGO_ACC; |
1735 | spin_unlock_irq(shost->host_lock); | 1725 | spin_unlock_irq(shost->host_lock); |
1736 | 1726 | ||
1737 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 1727 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); |
1738 | 1728 | ||
1739 | if ((ndlp->nlp_flag & NLP_DELAY_TMO) == 0) { | 1729 | if ((ndlp->nlp_flag & NLP_DELAY_TMO) == 0) { |
1740 | mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1); | 1730 | mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1); |
@@ -2047,7 +2037,6 @@ int | |||
2047 | lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | 2037 | lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
2048 | void *arg, uint32_t evt) | 2038 | void *arg, uint32_t evt) |
2049 | { | 2039 | { |
2050 | struct lpfc_hba *phba = vport->phba; | ||
2051 | uint32_t cur_state, rc; | 2040 | uint32_t cur_state, rc; |
2052 | uint32_t(*func) (struct lpfc_vport *, struct lpfc_nodelist *, void *, | 2041 | uint32_t(*func) (struct lpfc_vport *, struct lpfc_nodelist *, void *, |
2053 | uint32_t); | 2042 | uint32_t); |
@@ -2056,11 +2045,10 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
2056 | cur_state = ndlp->nlp_state; | 2045 | cur_state = ndlp->nlp_state; |
2057 | 2046 | ||
2058 | /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ | 2047 | /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ |
2059 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 2048 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
2060 | "%d (%d):0211 DSM in event x%x on NPort x%x in " | 2049 | "0211 DSM in event x%x on NPort x%x in " |
2061 | "state %d Data: x%x\n", | 2050 | "state %d Data: x%x\n", |
2062 | phba->brd_no, vport->vpi, | 2051 | evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag); |
2063 | evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag); | ||
2064 | 2052 | ||
2065 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, | 2053 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, |
2066 | "DSM in: evt:%d ste:%d did:x%x", | 2054 | "DSM in: evt:%d ste:%d did:x%x", |
@@ -2070,11 +2058,9 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
2070 | rc = (func) (vport, ndlp, arg, evt); | 2058 | rc = (func) (vport, ndlp, arg, evt); |
2071 | 2059 | ||
2072 | /* DSM out state <rc> on NPort <nlp_DID> */ | 2060 | /* DSM out state <rc> on NPort <nlp_DID> */ |
2073 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 2061 | lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, |
2074 | "%d (%d):0212 DSM out state %d on NPort x%x " | 2062 | "0212 DSM out state %d on NPort x%x Data: x%x\n", |
2075 | "Data: x%x\n", | 2063 | rc, ndlp->nlp_DID, ndlp->nlp_flag); |
2076 | phba->brd_no, vport->vpi, | ||
2077 | rc, ndlp->nlp_DID, ndlp->nlp_flag); | ||
2078 | 2064 | ||
2079 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, | 2065 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, |
2080 | "DSM out: ste:%d did:x%x flg:x%x", | 2066 | "DSM out: ste:%d did:x%x flg:x%x", |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 8f45bbc42126..17d7dc05149b 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -84,22 +84,21 @@ lpfc_adjust_queue_depth(struct lpfc_hba *phba) | |||
84 | * SCSI command completion. | 84 | * SCSI command completion. |
85 | */ | 85 | */ |
86 | static inline void | 86 | static inline void |
87 | lpfc_rampup_queue_depth(struct lpfc_hba *phba, | 87 | lpfc_rampup_queue_depth(struct lpfc_vport *vport, |
88 | struct scsi_device *sdev) | 88 | struct scsi_device *sdev) |
89 | { | 89 | { |
90 | unsigned long flags; | 90 | unsigned long flags; |
91 | struct lpfc_hba *phba = vport->phba; | ||
91 | atomic_inc(&phba->num_cmd_success); | 92 | atomic_inc(&phba->num_cmd_success); |
92 | 93 | ||
93 | if (phba->cfg_lun_queue_depth <= sdev->queue_depth) | 94 | if (vport->cfg_lun_queue_depth <= sdev->queue_depth) |
94 | return; | 95 | return; |
95 | |||
96 | spin_lock_irqsave(&phba->hbalock, flags); | 96 | spin_lock_irqsave(&phba->hbalock, flags); |
97 | if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) || | 97 | if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) || |
98 | ((phba->last_rsrc_error_time + QUEUE_RAMP_UP_INTERVAL ) > jiffies)) { | 98 | ((phba->last_rsrc_error_time + QUEUE_RAMP_UP_INTERVAL ) > jiffies)) { |
99 | spin_unlock_irqrestore(&phba->hbalock, flags); | 99 | spin_unlock_irqrestore(&phba->hbalock, flags); |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | |||
103 | phba->last_ramp_up_time = jiffies; | 102 | phba->last_ramp_up_time = jiffies; |
104 | spin_unlock_irqrestore(&phba->hbalock, flags); | 103 | spin_unlock_irqrestore(&phba->hbalock, flags); |
105 | 104 | ||
@@ -119,43 +118,40 @@ lpfc_rampup_queue_depth(struct lpfc_hba *phba, | |||
119 | void | 118 | void |
120 | lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) | 119 | lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) |
121 | { | 120 | { |
122 | struct lpfc_vport *vport; | 121 | struct lpfc_vport **vports; |
123 | struct Scsi_Host *host; | 122 | struct Scsi_Host *shost; |
124 | struct scsi_device *sdev; | 123 | struct scsi_device *sdev; |
125 | unsigned long new_queue_depth; | 124 | unsigned long new_queue_depth; |
126 | unsigned long num_rsrc_err, num_cmd_success; | 125 | unsigned long num_rsrc_err, num_cmd_success; |
126 | int i; | ||
127 | 127 | ||
128 | num_rsrc_err = atomic_read(&phba->num_rsrc_err); | 128 | num_rsrc_err = atomic_read(&phba->num_rsrc_err); |
129 | num_cmd_success = atomic_read(&phba->num_cmd_success); | 129 | num_cmd_success = atomic_read(&phba->num_cmd_success); |
130 | 130 | ||
131 | spin_lock_irq(&phba->hbalock); | 131 | vports = lpfc_create_vport_work_array(phba); |
132 | list_for_each_entry(vport, &phba->port_list, listentry) { | 132 | if (vports != NULL) |
133 | host = lpfc_shost_from_vport(vport); | 133 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { |
134 | if (!scsi_host_get(host)) | 134 | shost = lpfc_shost_from_vport(vports[i]); |
135 | continue; | 135 | shost_for_each_device(sdev, shost) { |
136 | |||
137 | spin_unlock_irq(&phba->hbalock); | ||
138 | |||
139 | shost_for_each_device(sdev, host) { | ||
140 | new_queue_depth = sdev->queue_depth * num_rsrc_err / | ||
141 | (num_rsrc_err + num_cmd_success); | ||
142 | if (!new_queue_depth) | ||
143 | new_queue_depth = sdev->queue_depth - 1; | ||
144 | else | ||
145 | new_queue_depth = | 136 | new_queue_depth = |
146 | sdev->queue_depth - new_queue_depth; | 137 | sdev->queue_depth * num_rsrc_err / |
147 | 138 | (num_rsrc_err + num_cmd_success); | |
148 | if (sdev->ordered_tags) | 139 | if (!new_queue_depth) |
149 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, | 140 | new_queue_depth = sdev->queue_depth - 1; |
150 | new_queue_depth); | 141 | else |
151 | else | 142 | new_queue_depth = sdev->queue_depth - |
152 | scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, | 143 | new_queue_depth; |
153 | new_queue_depth); | 144 | if (sdev->ordered_tags) |
145 | scsi_adjust_queue_depth(sdev, | ||
146 | MSG_ORDERED_TAG, | ||
147 | new_queue_depth); | ||
148 | else | ||
149 | scsi_adjust_queue_depth(sdev, | ||
150 | MSG_SIMPLE_TAG, | ||
151 | new_queue_depth); | ||
152 | } | ||
154 | } | 153 | } |
155 | spin_lock_irq(&phba->hbalock); | 154 | lpfc_destroy_vport_work_array(vports); |
156 | scsi_host_put(host); | ||
157 | } | ||
158 | spin_unlock_irq(&phba->hbalock); | ||
159 | atomic_set(&phba->num_rsrc_err, 0); | 155 | atomic_set(&phba->num_rsrc_err, 0); |
160 | atomic_set(&phba->num_cmd_success, 0); | 156 | atomic_set(&phba->num_cmd_success, 0); |
161 | } | 157 | } |
@@ -163,29 +159,27 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) | |||
163 | void | 159 | void |
164 | lpfc_ramp_up_queue_handler(struct lpfc_hba *phba) | 160 | lpfc_ramp_up_queue_handler(struct lpfc_hba *phba) |
165 | { | 161 | { |
166 | struct lpfc_vport *vport; | 162 | struct lpfc_vport **vports; |
167 | struct Scsi_Host *host; | 163 | struct Scsi_Host *shost; |
168 | struct scsi_device *sdev; | 164 | struct scsi_device *sdev; |
169 | 165 | int i; | |
170 | spin_lock_irq(&phba->hbalock); | 166 | |
171 | list_for_each_entry(vport, &phba->port_list, listentry) { | 167 | vports = lpfc_create_vport_work_array(phba); |
172 | host = lpfc_shost_from_vport(vport); | 168 | if (vports != NULL) |
173 | if (!scsi_host_get(host)) | 169 | for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) { |
174 | continue; | 170 | shost = lpfc_shost_from_vport(vports[i]); |
175 | 171 | shost_for_each_device(sdev, shost) { | |
176 | spin_unlock_irq(&phba->hbalock); | 172 | if (sdev->ordered_tags) |
177 | shost_for_each_device(sdev, host) { | 173 | scsi_adjust_queue_depth(sdev, |
178 | if (sdev->ordered_tags) | 174 | MSG_ORDERED_TAG, |
179 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, | 175 | sdev->queue_depth+1); |
180 | sdev->queue_depth+1); | 176 | else |
181 | else | 177 | scsi_adjust_queue_depth(sdev, |
182 | scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, | 178 | MSG_SIMPLE_TAG, |
183 | sdev->queue_depth+1); | 179 | sdev->queue_depth+1); |
180 | } | ||
184 | } | 181 | } |
185 | spin_lock_irq(&phba->hbalock); | 182 | lpfc_destroy_vport_work_array(vports); |
186 | scsi_host_put(host); | ||
187 | } | ||
188 | spin_unlock_irq(&phba->hbalock); | ||
189 | atomic_set(&phba->num_rsrc_err, 0); | 183 | atomic_set(&phba->num_rsrc_err, 0); |
190 | atomic_set(&phba->num_cmd_success, 0); | 184 | atomic_set(&phba->num_cmd_success, 0); |
191 | } | 185 | } |
@@ -411,9 +405,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
411 | struct scsi_cmnd *cmnd = lpfc_cmd->pCmd; | 405 | struct scsi_cmnd *cmnd = lpfc_cmd->pCmd; |
412 | struct fcp_cmnd *fcpcmd = lpfc_cmd->fcp_cmnd; | 406 | struct fcp_cmnd *fcpcmd = lpfc_cmd->fcp_cmnd; |
413 | struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp; | 407 | struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp; |
414 | struct lpfc_hba *phba = vport->phba; | ||
415 | uint32_t fcpi_parm = rsp_iocb->iocb.un.fcpi.fcpi_parm; | 408 | uint32_t fcpi_parm = rsp_iocb->iocb.un.fcpi.fcpi_parm; |
416 | uint32_t vpi = vport->vpi; | ||
417 | uint32_t resp_info = fcprsp->rspStatus2; | 409 | uint32_t resp_info = fcprsp->rspStatus2; |
418 | uint32_t scsi_status = fcprsp->rspStatus3; | 410 | uint32_t scsi_status = fcprsp->rspStatus3; |
419 | uint32_t *lp; | 411 | uint32_t *lp; |
@@ -445,15 +437,15 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
445 | if (!scsi_status && (resp_info & RESID_UNDER)) | 437 | if (!scsi_status && (resp_info & RESID_UNDER)) |
446 | logit = LOG_FCP; | 438 | logit = LOG_FCP; |
447 | 439 | ||
448 | lpfc_printf_log(phba, KERN_WARNING, logit, | 440 | lpfc_printf_vlog(vport, KERN_WARNING, logit, |
449 | "%d (%d):0730 FCP command x%x failed: x%x SNS x%x x%x " | 441 | "0730 FCP command x%x failed: x%x SNS x%x x%x " |
450 | "Data: x%x x%x x%x x%x x%x\n", | 442 | "Data: x%x x%x x%x x%x x%x\n", |
451 | phba->brd_no, vpi, cmnd->cmnd[0], scsi_status, | 443 | cmnd->cmnd[0], scsi_status, |
452 | be32_to_cpu(*lp), be32_to_cpu(*(lp + 3)), resp_info, | 444 | be32_to_cpu(*lp), be32_to_cpu(*(lp + 3)), resp_info, |
453 | be32_to_cpu(fcprsp->rspResId), | 445 | be32_to_cpu(fcprsp->rspResId), |
454 | be32_to_cpu(fcprsp->rspSnsLen), | 446 | be32_to_cpu(fcprsp->rspSnsLen), |
455 | be32_to_cpu(fcprsp->rspRspLen), | 447 | be32_to_cpu(fcprsp->rspRspLen), |
456 | fcprsp->rspInfo3); | 448 | fcprsp->rspInfo3); |
457 | 449 | ||
458 | if (resp_info & RSP_LEN_VALID) { | 450 | if (resp_info & RSP_LEN_VALID) { |
459 | rsplen = be32_to_cpu(fcprsp->rspRspLen); | 451 | rsplen = be32_to_cpu(fcprsp->rspRspLen); |
@@ -468,12 +460,12 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
468 | if (resp_info & RESID_UNDER) { | 460 | if (resp_info & RESID_UNDER) { |
469 | scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId)); | 461 | scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId)); |
470 | 462 | ||
471 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | 463 | lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, |
472 | "%d (%d):0716 FCP Read Underrun, expected %d, " | 464 | "0716 FCP Read Underrun, expected %d, " |
473 | "residual %d Data: x%x x%x x%x\n", | 465 | "residual %d Data: x%x x%x x%x\n", |
474 | phba->brd_no, vpi, be32_to_cpu(fcpcmd->fcpDl), | 466 | be32_to_cpu(fcpcmd->fcpDl), |
475 | scsi_get_resid(cmnd), fcpi_parm, cmnd->cmnd[0], | 467 | scsi_get_resid(cmnd), fcpi_parm, cmnd->cmnd[0], |
476 | cmnd->underflow); | 468 | cmnd->underflow); |
477 | 469 | ||
478 | /* | 470 | /* |
479 | * If there is an under run check if under run reported by | 471 | * If there is an under run check if under run reported by |
@@ -483,14 +475,13 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
483 | if ((cmnd->sc_data_direction == DMA_FROM_DEVICE) && | 475 | if ((cmnd->sc_data_direction == DMA_FROM_DEVICE) && |
484 | fcpi_parm && | 476 | fcpi_parm && |
485 | (scsi_get_resid(cmnd) != fcpi_parm)) { | 477 | (scsi_get_resid(cmnd) != fcpi_parm)) { |
486 | lpfc_printf_log(phba, KERN_WARNING, | 478 | lpfc_printf_vlog(vport, KERN_WARNING, |
487 | LOG_FCP | LOG_FCP_ERROR, | 479 | LOG_FCP | LOG_FCP_ERROR, |
488 | "%d (%d):0735 FCP Read Check Error " | 480 | "0735 FCP Read Check Error " |
489 | "and Underrun Data: x%x x%x x%x x%x\n", | 481 | "and Underrun Data: x%x x%x x%x x%x\n", |
490 | phba->brd_no, vpi, | 482 | be32_to_cpu(fcpcmd->fcpDl), |
491 | be32_to_cpu(fcpcmd->fcpDl), | 483 | scsi_get_resid(cmnd), fcpi_parm, |
492 | scsi_get_resid(cmnd), fcpi_parm, | 484 | cmnd->cmnd[0]); |
493 | cmnd->cmnd[0]); | ||
494 | scsi_set_resid(cmnd, scsi_bufflen(cmnd)); | 485 | scsi_set_resid(cmnd, scsi_bufflen(cmnd)); |
495 | host_status = DID_ERROR; | 486 | host_status = DID_ERROR; |
496 | } | 487 | } |
@@ -504,21 +495,19 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
504 | (scsi_status == SAM_STAT_GOOD) && | 495 | (scsi_status == SAM_STAT_GOOD) && |
505 | (scsi_bufflen(cmnd) - scsi_get_resid(cmnd) | 496 | (scsi_bufflen(cmnd) - scsi_get_resid(cmnd) |
506 | < cmnd->underflow)) { | 497 | < cmnd->underflow)) { |
507 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | 498 | lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, |
508 | "%d (%d):0717 FCP command x%x residual " | 499 | "0717 FCP command x%x residual " |
509 | "underrun converted to error " | 500 | "underrun converted to error " |
510 | "Data: x%x x%x x%x\n", | 501 | "Data: x%x x%x x%x\n", |
511 | phba->brd_no, vpi, cmnd->cmnd[0], | 502 | cmnd->cmnd[0], scsi_bufflen(cmnd), |
512 | scsi_bufflen(cmnd), | 503 | scsi_get_resid(cmnd), cmnd->underflow); |
513 | scsi_get_resid(cmnd), cmnd->underflow); | ||
514 | host_status = DID_ERROR; | 504 | host_status = DID_ERROR; |
515 | } | 505 | } |
516 | } else if (resp_info & RESID_OVER) { | 506 | } else if (resp_info & RESID_OVER) { |
517 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, | 507 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, |
518 | "%d (%d):0720 FCP command x%x residual " | 508 | "0720 FCP command x%x residual overrun error. " |
519 | "overrun error. Data: x%x x%x \n", | 509 | "Data: x%x x%x \n", cmnd->cmnd[0], |
520 | phba->brd_no, vpi, cmnd->cmnd[0], | 510 | scsi_bufflen(cmnd), scsi_get_resid(cmnd)); |
521 | scsi_bufflen(cmnd), scsi_get_resid(cmnd)); | ||
522 | host_status = DID_ERROR; | 511 | host_status = DID_ERROR; |
523 | 512 | ||
524 | /* | 513 | /* |
@@ -527,13 +516,12 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
527 | */ | 516 | */ |
528 | } else if ((scsi_status == SAM_STAT_GOOD) && fcpi_parm && | 517 | } else if ((scsi_status == SAM_STAT_GOOD) && fcpi_parm && |
529 | (cmnd->sc_data_direction == DMA_FROM_DEVICE)) { | 518 | (cmnd->sc_data_direction == DMA_FROM_DEVICE)) { |
530 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR, | 519 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR, |
531 | "%d (%d):0734 FCP Read Check Error Data: " | 520 | "0734 FCP Read Check Error Data: " |
532 | "x%x x%x x%x x%x\n", | 521 | "x%x x%x x%x x%x\n", |
533 | phba->brd_no, vpi, | 522 | be32_to_cpu(fcpcmd->fcpDl), |
534 | be32_to_cpu(fcpcmd->fcpDl), | 523 | be32_to_cpu(fcprsp->rspResId), |
535 | be32_to_cpu(fcprsp->rspResId), | 524 | fcpi_parm, cmnd->cmnd[0]); |
536 | fcpi_parm, cmnd->cmnd[0]); | ||
537 | host_status = DID_ERROR; | 525 | host_status = DID_ERROR; |
538 | scsi_set_resid(cmnd, scsi_bufflen(cmnd)); | 526 | scsi_set_resid(cmnd, scsi_bufflen(cmnd)); |
539 | } | 527 | } |
@@ -552,9 +540,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
552 | struct lpfc_rport_data *rdata = lpfc_cmd->rdata; | 540 | struct lpfc_rport_data *rdata = lpfc_cmd->rdata; |
553 | struct lpfc_nodelist *pnode = rdata->pnode; | 541 | struct lpfc_nodelist *pnode = rdata->pnode; |
554 | struct scsi_cmnd *cmd = lpfc_cmd->pCmd; | 542 | struct scsi_cmnd *cmd = lpfc_cmd->pCmd; |
555 | uint32_t vpi = (lpfc_cmd->cur_iocbq.vport | ||
556 | ? lpfc_cmd->cur_iocbq.vport->vpi | ||
557 | : 0); | ||
558 | int result; | 543 | int result; |
559 | struct scsi_device *sdev, *tmp_sdev; | 544 | struct scsi_device *sdev, *tmp_sdev; |
560 | int depth = 0; | 545 | int depth = 0; |
@@ -569,15 +554,15 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
569 | else if (lpfc_cmd->status >= IOSTAT_CNT) | 554 | else if (lpfc_cmd->status >= IOSTAT_CNT) |
570 | lpfc_cmd->status = IOSTAT_DEFAULT; | 555 | lpfc_cmd->status = IOSTAT_DEFAULT; |
571 | 556 | ||
572 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, | 557 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, |
573 | "%d (%d):0729 FCP cmd x%x failed <%d/%d> " | 558 | "0729 FCP cmd x%x failed <%d/%d> " |
574 | "status: x%x result: x%x Data: x%x x%x\n", | 559 | "status: x%x result: x%x Data: x%x x%x\n", |
575 | phba->brd_no, vpi, cmd->cmnd[0], | 560 | cmd->cmnd[0], |
576 | cmd->device ? cmd->device->id : 0xffff, | 561 | cmd->device ? cmd->device->id : 0xffff, |
577 | cmd->device ? cmd->device->lun : 0xffff, | 562 | cmd->device ? cmd->device->lun : 0xffff, |
578 | lpfc_cmd->status, lpfc_cmd->result, | 563 | lpfc_cmd->status, lpfc_cmd->result, |
579 | pIocbOut->iocb.ulpContext, | 564 | pIocbOut->iocb.ulpContext, |
580 | lpfc_cmd->cur_iocbq.iocb.ulpIoTag); | 565 | lpfc_cmd->cur_iocbq.iocb.ulpIoTag); |
581 | 566 | ||
582 | switch (lpfc_cmd->status) { | 567 | switch (lpfc_cmd->status) { |
583 | case IOSTAT_FCP_RSP_ERROR: | 568 | case IOSTAT_FCP_RSP_ERROR: |
@@ -610,13 +595,12 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
610 | if (cmd->result || lpfc_cmd->fcp_rsp->rspSnsLen) { | 595 | if (cmd->result || lpfc_cmd->fcp_rsp->rspSnsLen) { |
611 | uint32_t *lp = (uint32_t *)cmd->sense_buffer; | 596 | uint32_t *lp = (uint32_t *)cmd->sense_buffer; |
612 | 597 | ||
613 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | 598 | lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, |
614 | "%d (%d):0710 Iodone <%d/%d> cmd %p, error " | 599 | "0710 Iodone <%d/%d> cmd %p, error " |
615 | "x%x SNS x%x x%x Data: x%x x%x\n", | 600 | "x%x SNS x%x x%x Data: x%x x%x\n", |
616 | phba->brd_no, vpi, cmd->device->id, | 601 | cmd->device->id, cmd->device->lun, cmd, |
617 | cmd->device->lun, cmd, cmd->result, | 602 | cmd->result, *lp, *(lp + 3), cmd->retries, |
618 | *lp, *(lp + 3), cmd->retries, | 603 | scsi_get_resid(cmd)); |
619 | scsi_get_resid(cmd)); | ||
620 | } | 604 | } |
621 | 605 | ||
622 | result = cmd->result; | 606 | result = cmd->result; |
@@ -631,16 +615,16 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
631 | 615 | ||
632 | 616 | ||
633 | if (!result) | 617 | if (!result) |
634 | lpfc_rampup_queue_depth(phba, sdev); | 618 | lpfc_rampup_queue_depth(vport, sdev); |
635 | 619 | ||
636 | if (!result && pnode != NULL && | 620 | if (!result && pnode != NULL && |
637 | ((jiffies - pnode->last_ramp_up_time) > | 621 | ((jiffies - pnode->last_ramp_up_time) > |
638 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && | 622 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && |
639 | ((jiffies - pnode->last_q_full_time) > | 623 | ((jiffies - pnode->last_q_full_time) > |
640 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && | 624 | LPFC_Q_RAMP_UP_INTERVAL * HZ) && |
641 | (phba->cfg_lun_queue_depth > sdev->queue_depth)) { | 625 | (vport->cfg_lun_queue_depth > sdev->queue_depth)) { |
642 | shost_for_each_device(tmp_sdev, sdev->host) { | 626 | shost_for_each_device(tmp_sdev, sdev->host) { |
643 | if (phba->cfg_lun_queue_depth > tmp_sdev->queue_depth) { | 627 | if (vport->cfg_lun_queue_depth > tmp_sdev->queue_depth){ |
644 | if (tmp_sdev->id != sdev->id) | 628 | if (tmp_sdev->id != sdev->id) |
645 | continue; | 629 | continue; |
646 | if (tmp_sdev->ordered_tags) | 630 | if (tmp_sdev->ordered_tags) |
@@ -680,10 +664,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
680 | depth = sdev->host->cmd_per_lun; | 664 | depth = sdev->host->cmd_per_lun; |
681 | 665 | ||
682 | if (depth) { | 666 | if (depth) { |
683 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, | 667 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, |
684 | "%d (%d):0711 detected queue full - " | 668 | "0711 detected queue full - lun queue " |
685 | "lun queue depth adjusted to %d.\n", | 669 | "depth adjusted to %d.\n", depth); |
686 | phba->brd_no, vpi, depth); | ||
687 | } | 670 | } |
688 | } | 671 | } |
689 | 672 | ||
@@ -853,12 +836,9 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_vport *vport, | |||
853 | return FAILED; | 836 | return FAILED; |
854 | 837 | ||
855 | /* Issue Target Reset to TGT <num> */ | 838 | /* Issue Target Reset to TGT <num> */ |
856 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | 839 | lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, |
857 | "%d (%d):0702 Issue Target Reset to TGT %d " | 840 | "0702 Issue Target Reset to TGT %d Data: x%x x%x\n", |
858 | "Data: x%x x%x\n", | 841 | tgt_id, rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag); |
859 | phba->brd_no, vport->vpi, tgt_id, | ||
860 | rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag); | ||
861 | |||
862 | ret = lpfc_sli_issue_iocb_wait(phba, | 842 | ret = lpfc_sli_issue_iocb_wait(phba, |
863 | &phba->sli.ring[phba->sli.fcp_ring], | 843 | &phba->sli.ring[phba->sli.fcp_ring], |
864 | iocbq, iocbqrsp, lpfc_cmd->timeout); | 844 | iocbq, iocbqrsp, lpfc_cmd->timeout); |
@@ -965,10 +945,9 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
965 | if (lpfc_cmd == NULL) { | 945 | if (lpfc_cmd == NULL) { |
966 | lpfc_adjust_queue_depth(phba); | 946 | lpfc_adjust_queue_depth(phba); |
967 | 947 | ||
968 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | 948 | lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, |
969 | "%d (%d):0707 driver's buffer pool is empty, " | 949 | "0707 driver's buffer pool is empty, " |
970 | "IO busied\n", | 950 | "IO busied\n"); |
971 | phba->brd_no, vport->vpi); | ||
972 | goto out_host_busy; | 951 | goto out_host_busy; |
973 | } | 952 | } |
974 | 953 | ||
@@ -1103,28 +1082,25 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
1103 | 1082 | ||
1104 | schedule_timeout_uninterruptible(LPFC_ABORT_WAIT * HZ); | 1083 | schedule_timeout_uninterruptible(LPFC_ABORT_WAIT * HZ); |
1105 | if (++loop_count | 1084 | if (++loop_count |
1106 | > (2 * phba->cfg_devloss_tmo)/LPFC_ABORT_WAIT) | 1085 | > (2 * vport->cfg_devloss_tmo)/LPFC_ABORT_WAIT) |
1107 | break; | 1086 | break; |
1108 | } | 1087 | } |
1109 | 1088 | ||
1110 | if (lpfc_cmd->pCmd == cmnd) { | 1089 | if (lpfc_cmd->pCmd == cmnd) { |
1111 | ret = FAILED; | 1090 | ret = FAILED; |
1112 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1091 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, |
1113 | "%d (%d):0748 abort handler timed out waiting " | 1092 | "0748 abort handler timed out waiting " |
1114 | "for abort to complete: ret %#x, ID %d, " | 1093 | "for abort to complete: ret %#x, ID %d, " |
1115 | "LUN %d, snum %#lx\n", | 1094 | "LUN %d, snum %#lx\n", |
1116 | phba->brd_no, vport->vpi, ret, | 1095 | ret, cmnd->device->id, cmnd->device->lun, |
1117 | cmnd->device->id, cmnd->device->lun, | 1096 | cmnd->serial_number); |
1118 | cmnd->serial_number); | ||
1119 | } | 1097 | } |
1120 | 1098 | ||
1121 | out: | 1099 | out: |
1122 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, | 1100 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, |
1123 | "%d (%d):0749 SCSI Layer I/O Abort Request " | 1101 | "0749 SCSI Layer I/O Abort Request Status x%x ID %d " |
1124 | "Status x%x ID %d LUN %d snum %#lx\n", | 1102 | "LUN %d snum %#lx\n", ret, cmnd->device->id, |
1125 | phba->brd_no, vport->vpi, ret, cmnd->device->id, | 1103 | cmnd->device->lun, cmnd->serial_number); |
1126 | cmnd->device->lun, cmnd->serial_number); | ||
1127 | |||
1128 | return ret; | 1104 | return ret; |
1129 | } | 1105 | } |
1130 | 1106 | ||
@@ -1158,12 +1134,11 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | |||
1158 | loopcnt++; | 1134 | loopcnt++; |
1159 | rdata = cmnd->device->hostdata; | 1135 | rdata = cmnd->device->hostdata; |
1160 | if (!rdata || | 1136 | if (!rdata || |
1161 | (loopcnt > ((phba->cfg_devloss_tmo * 2) + 1))) { | 1137 | (loopcnt > ((vport->cfg_devloss_tmo * 2) + 1))){ |
1162 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1138 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, |
1163 | "%d (%d):0721 LUN Reset rport " | 1139 | "0721 LUN Reset rport " |
1164 | "failure: cnt x%x rdata x%p\n", | 1140 | "failure: cnt x%x rdata x%p\n", |
1165 | phba->brd_no, vport->vpi, | 1141 | loopcnt, rdata); |
1166 | loopcnt, rdata); | ||
1167 | goto out; | 1142 | goto out; |
1168 | } | 1143 | } |
1169 | pnode = rdata->pnode; | 1144 | pnode = rdata->pnode; |
@@ -1193,12 +1168,10 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | |||
1193 | if (iocbqrsp == NULL) | 1168 | if (iocbqrsp == NULL) |
1194 | goto out_free_scsi_buf; | 1169 | goto out_free_scsi_buf; |
1195 | 1170 | ||
1196 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | 1171 | lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, |
1197 | "%d (%d):0703 Issue target reset to TGT %d LUN %d " | 1172 | "0703 Issue target reset to TGT %d LUN %d " |
1198 | "rpi x%x nlp_flag x%x\n", | 1173 | "rpi x%x nlp_flag x%x\n", cmnd->device->id, |
1199 | phba->brd_no, vport->vpi, cmnd->device->id, | 1174 | cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag); |
1200 | cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag); | ||
1201 | |||
1202 | iocb_status = lpfc_sli_issue_iocb_wait(phba, | 1175 | iocb_status = lpfc_sli_issue_iocb_wait(phba, |
1203 | &phba->sli.ring[phba->sli.fcp_ring], | 1176 | &phba->sli.ring[phba->sli.fcp_ring], |
1204 | iocbq, iocbqrsp, lpfc_cmd->timeout); | 1177 | iocbq, iocbqrsp, lpfc_cmd->timeout); |
@@ -1221,33 +1194,28 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | |||
1221 | * Unfortunately, some targets do not abide by this forcing the driver | 1194 | * Unfortunately, some targets do not abide by this forcing the driver |
1222 | * to double check. | 1195 | * to double check. |
1223 | */ | 1196 | */ |
1224 | cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], | 1197 | cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id, cmnd->device->lun, |
1225 | cmnd->device->id, cmnd->device->lun, | ||
1226 | LPFC_CTX_LUN); | 1198 | LPFC_CTX_LUN); |
1227 | if (cnt) | 1199 | if (cnt) |
1228 | lpfc_sli_abort_iocb(phba, | 1200 | lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring], |
1229 | &phba->sli.ring[phba->sli.fcp_ring], | ||
1230 | cmnd->device->id, cmnd->device->lun, | 1201 | cmnd->device->id, cmnd->device->lun, |
1231 | 0, LPFC_CTX_LUN); | 1202 | LPFC_CTX_LUN); |
1232 | loopcnt = 0; | 1203 | loopcnt = 0; |
1233 | while(cnt) { | 1204 | while(cnt) { |
1234 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); | 1205 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); |
1235 | 1206 | ||
1236 | if (++loopcnt | 1207 | if (++loopcnt |
1237 | > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT) | 1208 | > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT) |
1238 | break; | 1209 | break; |
1239 | 1210 | ||
1240 | cnt = lpfc_sli_sum_iocb(phba, | 1211 | cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id, |
1241 | &phba->sli.ring[phba->sli.fcp_ring], | 1212 | cmnd->device->lun, LPFC_CTX_LUN); |
1242 | cmnd->device->id, cmnd->device->lun, | ||
1243 | LPFC_CTX_LUN); | ||
1244 | } | 1213 | } |
1245 | 1214 | ||
1246 | if (cnt) { | 1215 | if (cnt) { |
1247 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1216 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, |
1248 | "%d (%d):0719 device reset I/O flush failure: " | 1217 | "0719 device reset I/O flush failure: " |
1249 | "cnt x%x\n", | 1218 | "cnt x%x\n", cnt); |
1250 | phba->brd_no, vport->vpi, cnt); | ||
1251 | ret = FAILED; | 1219 | ret = FAILED; |
1252 | } | 1220 | } |
1253 | 1221 | ||
@@ -1255,12 +1223,11 @@ out_free_scsi_buf: | |||
1255 | if (iocb_status != IOCB_TIMEDOUT) { | 1223 | if (iocb_status != IOCB_TIMEDOUT) { |
1256 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 1224 | lpfc_release_scsi_buf(phba, lpfc_cmd); |
1257 | } | 1225 | } |
1258 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1226 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, |
1259 | "%d (%d):0713 SCSI layer issued device reset (%d, %d) " | 1227 | "0713 SCSI layer issued device reset (%d, %d) " |
1260 | "return x%x status x%x result x%x\n", | 1228 | "return x%x status x%x result x%x\n", |
1261 | phba->brd_no, vport->vpi, cmnd->device->id, | 1229 | cmnd->device->id, cmnd->device->lun, ret, |
1262 | cmnd->device->lun, ret, cmd_status, cmd_result); | 1230 | cmd_status, cmd_result); |
1263 | |||
1264 | out: | 1231 | out: |
1265 | return ret; | 1232 | return ret; |
1266 | } | 1233 | } |
@@ -1311,10 +1278,9 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) | |||
1311 | cmnd->device->lun, | 1278 | cmnd->device->lun, |
1312 | ndlp->rport->dd_data); | 1279 | ndlp->rport->dd_data); |
1313 | if (ret != SUCCESS) { | 1280 | if (ret != SUCCESS) { |
1314 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1281 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, |
1315 | "%d (%d):0700 Bus Reset on target %d " | 1282 | "0700 Bus Reset on target %d failed\n", |
1316 | "failed\n", | 1283 | i); |
1317 | phba->brd_no, vport->vpi, i); | ||
1318 | err_count++; | 1284 | err_count++; |
1319 | break; | 1285 | break; |
1320 | } | 1286 | } |
@@ -1333,35 +1299,30 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) | |||
1333 | * the targets. Unfortunately, some targets do not abide by | 1299 | * the targets. Unfortunately, some targets do not abide by |
1334 | * this forcing the driver to double check. | 1300 | * this forcing the driver to double check. |
1335 | */ | 1301 | */ |
1336 | cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], | 1302 | cnt = lpfc_sli_sum_iocb(vport, 0, 0, LPFC_CTX_HOST); |
1337 | 0, 0, LPFC_CTX_HOST); | ||
1338 | if (cnt) | 1303 | if (cnt) |
1339 | lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], | 1304 | lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring], |
1340 | 0, 0, 0, LPFC_CTX_HOST); | 1305 | 0, 0, LPFC_CTX_HOST); |
1341 | loopcnt = 0; | 1306 | loopcnt = 0; |
1342 | while(cnt) { | 1307 | while(cnt) { |
1343 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); | 1308 | schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); |
1344 | 1309 | ||
1345 | if (++loopcnt | 1310 | if (++loopcnt |
1346 | > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT) | 1311 | > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT) |
1347 | break; | 1312 | break; |
1348 | 1313 | ||
1349 | cnt = lpfc_sli_sum_iocb(phba, | 1314 | cnt = lpfc_sli_sum_iocb(vport, 0, 0, LPFC_CTX_HOST); |
1350 | &phba->sli.ring[phba->sli.fcp_ring], | ||
1351 | 0, 0, LPFC_CTX_HOST); | ||
1352 | } | 1315 | } |
1353 | 1316 | ||
1354 | if (cnt) { | 1317 | if (cnt) { |
1355 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1318 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, |
1356 | "%d (%d):0715 Bus Reset I/O flush failure: " | 1319 | "0715 Bus Reset I/O flush failure: " |
1357 | "cnt x%x left x%x\n", | 1320 | "cnt x%x left x%x\n", cnt, i); |
1358 | phba->brd_no, vport->vpi, cnt, i); | ||
1359 | ret = FAILED; | 1321 | ret = FAILED; |
1360 | } | 1322 | } |
1361 | 1323 | ||
1362 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1324 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, |
1363 | "%d (%d):0714 SCSI layer issued Bus Reset Data: x%x\n", | 1325 | "0714 SCSI layer issued Bus Reset Data: x%x\n", ret); |
1364 | phba->brd_no, vport->vpi, ret); | ||
1365 | out: | 1326 | out: |
1366 | return ret; | 1327 | return ret; |
1367 | } | 1328 | } |
@@ -1390,36 +1351,32 @@ lpfc_slave_alloc(struct scsi_device *sdev) | |||
1390 | * extra. This list of scsi bufs exists for the lifetime of the driver. | 1351 | * extra. This list of scsi bufs exists for the lifetime of the driver. |
1391 | */ | 1352 | */ |
1392 | total = phba->total_scsi_bufs; | 1353 | total = phba->total_scsi_bufs; |
1393 | num_to_alloc = phba->cfg_lun_queue_depth + 2; | 1354 | num_to_alloc = vport->cfg_lun_queue_depth + 2; |
1394 | 1355 | ||
1395 | /* Allow some exchanges to be available always to complete discovery */ | 1356 | /* Allow some exchanges to be available always to complete discovery */ |
1396 | if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { | 1357 | if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { |
1397 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, | 1358 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, |
1398 | "%d (%d):0704 At limitation of %d " | 1359 | "0704 At limitation of %d preallocated " |
1399 | "preallocated command buffers\n", | 1360 | "command buffers\n", total); |
1400 | phba->brd_no, vport->vpi, total); | ||
1401 | return 0; | 1361 | return 0; |
1402 | |||
1403 | /* Allow some exchanges to be available always to complete discovery */ | 1362 | /* Allow some exchanges to be available always to complete discovery */ |
1404 | } else if (total + num_to_alloc > | 1363 | } else if (total + num_to_alloc > |
1405 | phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { | 1364 | phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { |
1406 | lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, | 1365 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, |
1407 | "%d (%d):0705 Allocation request of %d " | 1366 | "0705 Allocation request of %d " |
1408 | "command buffers will exceed max of %d. " | 1367 | "command buffers will exceed max of %d. " |
1409 | "Reducing allocation request to %d.\n", | 1368 | "Reducing allocation request to %d.\n", |
1410 | phba->brd_no, vport->vpi, num_to_alloc, | 1369 | num_to_alloc, phba->cfg_hba_queue_depth, |
1411 | phba->cfg_hba_queue_depth, | 1370 | (phba->cfg_hba_queue_depth - total)); |
1412 | (phba->cfg_hba_queue_depth - total)); | ||
1413 | num_to_alloc = phba->cfg_hba_queue_depth - total; | 1371 | num_to_alloc = phba->cfg_hba_queue_depth - total; |
1414 | } | 1372 | } |
1415 | 1373 | ||
1416 | for (i = 0; i < num_to_alloc; i++) { | 1374 | for (i = 0; i < num_to_alloc; i++) { |
1417 | scsi_buf = lpfc_new_scsi_buf(vport); | 1375 | scsi_buf = lpfc_new_scsi_buf(vport); |
1418 | if (!scsi_buf) { | 1376 | if (!scsi_buf) { |
1419 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1377 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, |
1420 | "%d (%d):0706 Failed to allocate " | 1378 | "0706 Failed to allocate " |
1421 | "command buffer\n", | 1379 | "command buffer\n"); |
1422 | phba->brd_no, vport->vpi); | ||
1423 | break; | 1380 | break; |
1424 | } | 1381 | } |
1425 | 1382 | ||
@@ -1439,9 +1396,9 @@ lpfc_slave_configure(struct scsi_device *sdev) | |||
1439 | struct fc_rport *rport = starget_to_rport(sdev->sdev_target); | 1396 | struct fc_rport *rport = starget_to_rport(sdev->sdev_target); |
1440 | 1397 | ||
1441 | if (sdev->tagged_supported) | 1398 | if (sdev->tagged_supported) |
1442 | scsi_activate_tcq(sdev, phba->cfg_lun_queue_depth); | 1399 | scsi_activate_tcq(sdev, vport->cfg_lun_queue_depth); |
1443 | else | 1400 | else |
1444 | scsi_deactivate_tcq(sdev, phba->cfg_lun_queue_depth); | 1401 | scsi_deactivate_tcq(sdev, vport->cfg_lun_queue_depth); |
1445 | 1402 | ||
1446 | /* | 1403 | /* |
1447 | * Initialize the fc transport attributes for the target | 1404 | * Initialize the fc transport attributes for the target |
@@ -1449,7 +1406,7 @@ lpfc_slave_configure(struct scsi_device *sdev) | |||
1449 | * target pointer is stored in the starget_data for the | 1406 | * target pointer is stored in the starget_data for the |
1450 | * driver's sysfs entry point functions. | 1407 | * driver's sysfs entry point functions. |
1451 | */ | 1408 | */ |
1452 | rport->dev_loss_tmo = phba->cfg_devloss_tmo; | 1409 | rport->dev_loss_tmo = vport->cfg_devloss_tmo; |
1453 | 1410 | ||
1454 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { | 1411 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { |
1455 | lpfc_sli_poll_fcp_ring(phba); | 1412 | lpfc_sli_poll_fcp_ring(phba); |
@@ -1487,3 +1444,23 @@ struct scsi_host_template lpfc_template = { | |||
1487 | .shost_attrs = lpfc_hba_attrs, | 1444 | .shost_attrs = lpfc_hba_attrs, |
1488 | .max_sectors = 0xFFFF, | 1445 | .max_sectors = 0xFFFF, |
1489 | }; | 1446 | }; |
1447 | |||
1448 | struct scsi_host_template lpfc_vport_template = { | ||
1449 | .module = THIS_MODULE, | ||
1450 | .name = LPFC_DRIVER_NAME, | ||
1451 | .info = lpfc_info, | ||
1452 | .queuecommand = lpfc_queuecommand, | ||
1453 | .eh_abort_handler = lpfc_abort_handler, | ||
1454 | .eh_device_reset_handler= lpfc_device_reset_handler, | ||
1455 | .eh_bus_reset_handler = lpfc_bus_reset_handler, | ||
1456 | .slave_alloc = lpfc_slave_alloc, | ||
1457 | .slave_configure = lpfc_slave_configure, | ||
1458 | .slave_destroy = lpfc_slave_destroy, | ||
1459 | .scan_finished = lpfc_scan_finished, | ||
1460 | .this_id = -1, | ||
1461 | .sg_tablesize = LPFC_SG_SEG_CNT, | ||
1462 | .cmd_per_lun = LPFC_CMD_PER_LUN, | ||
1463 | .use_clustering = ENABLE_CLUSTERING, | ||
1464 | .shost_attrs = lpfc_vport_attrs, | ||
1465 | .max_sectors = 0xFFFF, | ||
1466 | }; | ||
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index f4d5a6b00fde..ce5ff2bccba6 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -49,9 +49,8 @@ | |||
49 | lpfc_printf_log(phba, \ | 49 | lpfc_printf_log(phba, \ |
50 | KERN_INFO, \ | 50 | KERN_INFO, \ |
51 | LOG_MBOX | LOG_SLI, \ | 51 | LOG_MBOX | LOG_SLI, \ |
52 | "%d (%d):0311 Mailbox command x%x cannot " \ | 52 | "(%d):0311 Mailbox command x%x cannot " \ |
53 | "issue Data: x%x x%x x%x\n", \ | 53 | "issue Data: x%x x%x x%x\n", \ |
54 | phba->brd_no, \ | ||
55 | pmbox->vport ? pmbox->vport->vpi : 0, \ | 54 | pmbox->vport ? pmbox->vport->vpi : 0, \ |
56 | pmbox->mb.mbxCommand, \ | 55 | pmbox->mb.mbxCommand, \ |
57 | phba->pport->port_state, \ | 56 | phba->pport->port_state, \ |
@@ -231,13 +230,11 @@ lpfc_sli_ring_map(struct lpfc_hba *phba) | |||
231 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 230 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
232 | if (rc != MBX_SUCCESS) { | 231 | if (rc != MBX_SUCCESS) { |
233 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 232 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
234 | "%d:0446 Adapter failed to init (%d), " | 233 | "0446 Adapter failed to init (%d), " |
235 | "mbxCmd x%x CFG_RING, mbxStatus x%x, " | 234 | "mbxCmd x%x CFG_RING, mbxStatus x%x, " |
236 | "ring %d\n", | 235 | "ring %d\n", |
237 | phba->brd_no, rc, | 236 | rc, pmbox->mbxCommand, |
238 | pmbox->mbxCommand, | 237 | pmbox->mbxStatus, i); |
239 | pmbox->mbxStatus, | ||
240 | i); | ||
241 | phba->link_state = LPFC_HBA_ERROR; | 238 | phba->link_state = LPFC_HBA_ERROR; |
242 | ret = -ENXIO; | 239 | ret = -ENXIO; |
243 | break; | 240 | break; |
@@ -296,9 +293,9 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
296 | 293 | ||
297 | if (unlikely(pring->local_getidx >= max_cmd_idx)) { | 294 | if (unlikely(pring->local_getidx >= max_cmd_idx)) { |
298 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 295 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
299 | "%d:0315 Ring %d issue: portCmdGet %d " | 296 | "0315 Ring %d issue: portCmdGet %d " |
300 | "is bigger then cmd ring %d\n", | 297 | "is bigger then cmd ring %d\n", |
301 | phba->brd_no, pring->ringno, | 298 | pring->ringno, |
302 | pring->local_getidx, max_cmd_idx); | 299 | pring->local_getidx, max_cmd_idx); |
303 | 300 | ||
304 | phba->link_state = LPFC_HBA_ERROR; | 301 | phba->link_state = LPFC_HBA_ERROR; |
@@ -366,7 +363,7 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
366 | if (psli->iocbq_lookup) | 363 | if (psli->iocbq_lookup) |
367 | memcpy(new_arr, old_arr, | 364 | memcpy(new_arr, old_arr, |
368 | ((psli->last_iotag + 1) * | 365 | ((psli->last_iotag + 1) * |
369 | sizeof (struct lpfc_iocbq *))); | 366 | sizeof (struct lpfc_iocbq *))); |
370 | psli->iocbq_lookup = new_arr; | 367 | psli->iocbq_lookup = new_arr; |
371 | psli->iocbq_lookup_len = new_len; | 368 | psli->iocbq_lookup_len = new_len; |
372 | psli->last_iotag = iotag; | 369 | psli->last_iotag = iotag; |
@@ -380,8 +377,8 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
380 | spin_unlock_irq(&phba->hbalock); | 377 | spin_unlock_irq(&phba->hbalock); |
381 | 378 | ||
382 | lpfc_printf_log(phba, KERN_ERR,LOG_SLI, | 379 | lpfc_printf_log(phba, KERN_ERR,LOG_SLI, |
383 | "%d:0318 Failed to allocate IOTAG.last IOTAG is %d\n", | 380 | "0318 Failed to allocate IOTAG.last IOTAG is %d\n", |
384 | phba->brd_no, psli->last_iotag); | 381 | psli->last_iotag); |
385 | 382 | ||
386 | return 0; | 383 | return 0; |
387 | } | 384 | } |
@@ -395,6 +392,14 @@ lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
395 | */ | 392 | */ |
396 | nextiocb->iocb.ulpIoTag = (nextiocb->iocb_cmpl) ? nextiocb->iotag : 0; | 393 | nextiocb->iocb.ulpIoTag = (nextiocb->iocb_cmpl) ? nextiocb->iotag : 0; |
397 | 394 | ||
395 | if (pring->ringno == LPFC_ELS_RING) { | ||
396 | lpfc_debugfs_slow_ring_trc(phba, | ||
397 | "IOCB cmd ring: wd4:x%08x wd6:x%08x wd7:x%08x", | ||
398 | *(((uint32_t *) &nextiocb->iocb) + 4), | ||
399 | *(((uint32_t *) &nextiocb->iocb) + 6), | ||
400 | *(((uint32_t *) &nextiocb->iocb) + 7)); | ||
401 | } | ||
402 | |||
398 | /* | 403 | /* |
399 | * Issue iocb command to adapter | 404 | * Issue iocb command to adapter |
400 | */ | 405 | */ |
@@ -527,10 +532,9 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno) | |||
527 | if (unlikely(hbqp->local_hbqGetIdx >= hbqp->entry_count)) { | 532 | if (unlikely(hbqp->local_hbqGetIdx >= hbqp->entry_count)) { |
528 | lpfc_printf_log(phba, KERN_ERR, | 533 | lpfc_printf_log(phba, KERN_ERR, |
529 | LOG_SLI | LOG_VPORT, | 534 | LOG_SLI | LOG_VPORT, |
530 | "%d:1802 HBQ %d: local_hbqGetIdx " | 535 | "1802 HBQ %d: local_hbqGetIdx " |
531 | "%u is > than hbqp->entry_count %u\n", | 536 | "%u is > than hbqp->entry_count %u\n", |
532 | phba->brd_no, hbqno, | 537 | hbqno, hbqp->local_hbqGetIdx, |
533 | hbqp->local_hbqGetIdx, | ||
534 | hbqp->entry_count); | 538 | hbqp->entry_count); |
535 | 539 | ||
536 | phba->link_state = LPFC_HBA_ERROR; | 540 | phba->link_state = LPFC_HBA_ERROR; |
@@ -541,7 +545,8 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno) | |||
541 | return NULL; | 545 | return NULL; |
542 | } | 546 | } |
543 | 547 | ||
544 | return (struct lpfc_hbq_entry *) phba->hbqslimp.virt + hbqp->hbqPutIdx; | 548 | return (struct lpfc_hbq_entry *) phba->hbqs[hbqno].hbq_virt + |
549 | hbqp->hbqPutIdx; | ||
545 | } | 550 | } |
546 | 551 | ||
547 | void | 552 | void |
@@ -549,18 +554,21 @@ lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba) | |||
549 | { | 554 | { |
550 | struct lpfc_dmabuf *dmabuf, *next_dmabuf; | 555 | struct lpfc_dmabuf *dmabuf, *next_dmabuf; |
551 | struct hbq_dmabuf *hbq_buf; | 556 | struct hbq_dmabuf *hbq_buf; |
557 | int i, hbq_count; | ||
552 | 558 | ||
559 | hbq_count = lpfc_sli_hbq_count(); | ||
553 | /* Return all memory used by all HBQs */ | 560 | /* Return all memory used by all HBQs */ |
554 | list_for_each_entry_safe(dmabuf, next_dmabuf, | 561 | for (i = 0; i < hbq_count; ++i) { |
555 | &phba->hbq_buffer_list, list) { | 562 | list_for_each_entry_safe(dmabuf, next_dmabuf, |
556 | hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf); | 563 | &phba->hbqs[i].hbq_buffer_list, list) { |
557 | list_del(&hbq_buf->dbuf.list); | 564 | hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf); |
558 | lpfc_hbq_free(phba, hbq_buf->dbuf.virt, hbq_buf->dbuf.phys); | 565 | list_del(&hbq_buf->dbuf.list); |
559 | kfree(hbq_buf); | 566 | (phba->hbqs[i].hbq_free_buffer)(phba, hbq_buf); |
567 | } | ||
560 | } | 568 | } |
561 | } | 569 | } |
562 | 570 | ||
563 | static void | 571 | static struct lpfc_hbq_entry * |
564 | lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, | 572 | lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, |
565 | struct hbq_dmabuf *hbq_buf) | 573 | struct hbq_dmabuf *hbq_buf) |
566 | { | 574 | { |
@@ -574,7 +582,7 @@ lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, | |||
574 | 582 | ||
575 | hbqe->bde.addrHigh = le32_to_cpu(putPaddrHigh(physaddr)); | 583 | hbqe->bde.addrHigh = le32_to_cpu(putPaddrHigh(physaddr)); |
576 | hbqe->bde.addrLow = le32_to_cpu(putPaddrLow(physaddr)); | 584 | hbqe->bde.addrLow = le32_to_cpu(putPaddrLow(physaddr)); |
577 | hbqe->bde.tus.f.bdeSize = FCELSSIZE; | 585 | hbqe->bde.tus.f.bdeSize = hbq_buf->size; |
578 | hbqe->bde.tus.f.bdeFlags = 0; | 586 | hbqe->bde.tus.f.bdeFlags = 0; |
579 | hbqe->bde.tus.w = le32_to_cpu(hbqe->bde.tus.w); | 587 | hbqe->bde.tus.w = le32_to_cpu(hbqe->bde.tus.w); |
580 | hbqe->buffer_tag = le32_to_cpu(hbq_buf->tag); | 588 | hbqe->buffer_tag = le32_to_cpu(hbq_buf->tag); |
@@ -583,8 +591,9 @@ lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, | |||
583 | writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno); | 591 | writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno); |
584 | /* flush */ | 592 | /* flush */ |
585 | readl(phba->hbq_put + hbqno); | 593 | readl(phba->hbq_put + hbqno); |
586 | list_add_tail(&hbq_buf->dbuf.list, &phba->hbq_buffer_list); | 594 | list_add_tail(&hbq_buf->dbuf.list, &hbqp->hbq_buffer_list); |
587 | } | 595 | } |
596 | return hbqe; | ||
588 | } | 597 | } |
589 | 598 | ||
590 | static struct lpfc_hbq_init lpfc_els_hbq = { | 599 | static struct lpfc_hbq_init lpfc_els_hbq = { |
@@ -592,22 +601,38 @@ static struct lpfc_hbq_init lpfc_els_hbq = { | |||
592 | .entry_count = 200, | 601 | .entry_count = 200, |
593 | .mask_count = 0, | 602 | .mask_count = 0, |
594 | .profile = 0, | 603 | .profile = 0, |
595 | .ring_mask = 1 << LPFC_ELS_RING, | 604 | .ring_mask = (1 << LPFC_ELS_RING), |
596 | .buffer_count = 0, | 605 | .buffer_count = 0, |
597 | .init_count = 20, | 606 | .init_count = 20, |
598 | .add_count = 5, | 607 | .add_count = 5, |
599 | }; | 608 | }; |
600 | 609 | ||
601 | static struct lpfc_hbq_init *lpfc_hbq_defs[] = { | 610 | static struct lpfc_hbq_init lpfc_extra_hbq = { |
611 | .rn = 1, | ||
612 | .entry_count = 200, | ||
613 | .mask_count = 0, | ||
614 | .profile = 0, | ||
615 | .ring_mask = (1 << LPFC_EXTRA_RING), | ||
616 | .buffer_count = 0, | ||
617 | .init_count = 0, | ||
618 | .add_count = 5, | ||
619 | }; | ||
620 | |||
621 | struct lpfc_hbq_init *lpfc_hbq_defs[] = { | ||
602 | &lpfc_els_hbq, | 622 | &lpfc_els_hbq, |
623 | &lpfc_extra_hbq, | ||
603 | }; | 624 | }; |
604 | 625 | ||
605 | int | 626 | static int |
606 | lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) | 627 | lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) |
607 | { | 628 | { |
608 | uint32_t i, start, end; | 629 | uint32_t i, start, end; |
609 | struct hbq_dmabuf *hbq_buffer; | 630 | struct hbq_dmabuf *hbq_buffer; |
610 | 631 | ||
632 | if (!phba->hbqs[hbqno].hbq_alloc_buffer) { | ||
633 | return 0; | ||
634 | } | ||
635 | |||
611 | start = lpfc_hbq_defs[hbqno]->buffer_count; | 636 | start = lpfc_hbq_defs[hbqno]->buffer_count; |
612 | end = count + lpfc_hbq_defs[hbqno]->buffer_count; | 637 | end = count + lpfc_hbq_defs[hbqno]->buffer_count; |
613 | if (end > lpfc_hbq_defs[hbqno]->entry_count) { | 638 | if (end > lpfc_hbq_defs[hbqno]->entry_count) { |
@@ -616,17 +641,14 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) | |||
616 | 641 | ||
617 | /* Populate HBQ entries */ | 642 | /* Populate HBQ entries */ |
618 | for (i = start; i < end; i++) { | 643 | for (i = start; i < end; i++) { |
619 | hbq_buffer = kmalloc(sizeof(struct hbq_dmabuf), | 644 | hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); |
620 | GFP_KERNEL); | ||
621 | if (!hbq_buffer) | 645 | if (!hbq_buffer) |
622 | return 1; | 646 | return 1; |
623 | hbq_buffer->dbuf.virt = lpfc_hbq_alloc(phba, MEM_PRI, | ||
624 | &hbq_buffer->dbuf.phys); | ||
625 | if (hbq_buffer->dbuf.virt == NULL) | ||
626 | return 1; | ||
627 | hbq_buffer->tag = (i | (hbqno << 16)); | 647 | hbq_buffer->tag = (i | (hbqno << 16)); |
628 | lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer); | 648 | if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) |
629 | lpfc_hbq_defs[hbqno]->buffer_count++; | 649 | lpfc_hbq_defs[hbqno]->buffer_count++; |
650 | else | ||
651 | (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); | ||
630 | } | 652 | } |
631 | return 0; | 653 | return 0; |
632 | } | 654 | } |
@@ -650,28 +672,34 @@ lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag) | |||
650 | { | 672 | { |
651 | struct lpfc_dmabuf *d_buf; | 673 | struct lpfc_dmabuf *d_buf; |
652 | struct hbq_dmabuf *hbq_buf; | 674 | struct hbq_dmabuf *hbq_buf; |
675 | uint32_t hbqno; | ||
676 | |||
677 | hbqno = tag >> 16; | ||
678 | if (hbqno > LPFC_MAX_HBQS) | ||
679 | return NULL; | ||
653 | 680 | ||
654 | list_for_each_entry(d_buf, &phba->hbq_buffer_list, list) { | 681 | list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) { |
655 | hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); | 682 | hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); |
656 | if ((hbq_buf->tag & 0xffff) == tag) { | 683 | if (hbq_buf->tag == tag) { |
657 | return hbq_buf; | 684 | return hbq_buf; |
658 | } | 685 | } |
659 | } | 686 | } |
660 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT, | 687 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT, |
661 | "%d:1803 Bad hbq tag. Data: x%x x%x\n", | 688 | "1803 Bad hbq tag. Data: x%x x%x\n", |
662 | phba->brd_no, tag, | 689 | tag, lpfc_hbq_defs[tag >> 16]->buffer_count); |
663 | lpfc_hbq_defs[tag >> 16]->buffer_count); | ||
664 | return NULL; | 690 | return NULL; |
665 | } | 691 | } |
666 | 692 | ||
667 | void | 693 | void |
668 | lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *sp) | 694 | lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer) |
669 | { | 695 | { |
670 | uint32_t hbqno; | 696 | uint32_t hbqno; |
671 | 697 | ||
672 | if (sp) { | 698 | if (hbq_buffer) { |
673 | hbqno = sp->tag >> 16; | 699 | hbqno = hbq_buffer->tag >> 16; |
674 | lpfc_sli_hbq_to_firmware(phba, hbqno, sp); | 700 | if (!lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) { |
701 | (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); | ||
702 | } | ||
675 | } | 703 | } |
676 | } | 704 | } |
677 | 705 | ||
@@ -837,12 +865,10 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba) | |||
837 | */ | 865 | */ |
838 | if (lpfc_sli_chk_mbx_command(pmbox->mbxCommand) == | 866 | if (lpfc_sli_chk_mbx_command(pmbox->mbxCommand) == |
839 | MBX_SHUTDOWN) { | 867 | MBX_SHUTDOWN) { |
840 | |||
841 | /* Unknow mailbox command compl */ | 868 | /* Unknow mailbox command compl */ |
842 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, | 869 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, |
843 | "%d (%d):0323 Unknown Mailbox command " | 870 | "(%d):0323 Unknown Mailbox command " |
844 | "%x Cmpl\n", | 871 | "%x Cmpl\n", |
845 | phba->brd_no, | ||
846 | pmb->vport ? pmb->vport->vpi : 0, | 872 | pmb->vport ? pmb->vport->vpi : 0, |
847 | pmbox->mbxCommand); | 873 | pmbox->mbxCommand); |
848 | phba->link_state = LPFC_HBA_ERROR; | 874 | phba->link_state = LPFC_HBA_ERROR; |
@@ -857,10 +883,9 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba) | |||
857 | /* Mbox cmd cmpl error - RETRYing */ | 883 | /* Mbox cmd cmpl error - RETRYing */ |
858 | lpfc_printf_log(phba, KERN_INFO, | 884 | lpfc_printf_log(phba, KERN_INFO, |
859 | LOG_MBOX | LOG_SLI, | 885 | LOG_MBOX | LOG_SLI, |
860 | "%d (%d):0305 Mbox cmd cmpl " | 886 | "(%d):0305 Mbox cmd cmpl " |
861 | "error - RETRYing Data: x%x " | 887 | "error - RETRYing Data: x%x " |
862 | "x%x x%x x%x\n", | 888 | "x%x x%x x%x\n", |
863 | phba->brd_no, | ||
864 | pmb->vport ? pmb->vport->vpi :0, | 889 | pmb->vport ? pmb->vport->vpi :0, |
865 | pmbox->mbxCommand, | 890 | pmbox->mbxCommand, |
866 | pmbox->mbxStatus, | 891 | pmbox->mbxStatus, |
@@ -879,9 +904,8 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba) | |||
879 | 904 | ||
880 | /* Mailbox cmd <cmd> Cmpl <cmpl> */ | 905 | /* Mailbox cmd <cmd> Cmpl <cmpl> */ |
881 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, | 906 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, |
882 | "%d (%d):0307 Mailbox cmd x%x Cmpl x%p " | 907 | "(%d):0307 Mailbox cmd x%x Cmpl x%p " |
883 | "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n", | 908 | "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n", |
884 | phba->brd_no, | ||
885 | pmb->vport ? pmb->vport->vpi : 0, | 909 | pmb->vport ? pmb->vport->vpi : 0, |
886 | pmbox->mbxCommand, | 910 | pmbox->mbxCommand, |
887 | pmb->mbox_cmpl, | 911 | pmb->mbox_cmpl, |
@@ -905,21 +929,26 @@ static struct lpfc_dmabuf * | |||
905 | lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag) | 929 | lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag) |
906 | { | 930 | { |
907 | struct hbq_dmabuf *hbq_entry, *new_hbq_entry; | 931 | struct hbq_dmabuf *hbq_entry, *new_hbq_entry; |
932 | uint32_t hbqno; | ||
933 | void *virt; /* virtual address ptr */ | ||
934 | dma_addr_t phys; /* mapped address */ | ||
908 | 935 | ||
909 | hbq_entry = lpfc_sli_hbqbuf_find(phba, tag); | 936 | hbq_entry = lpfc_sli_hbqbuf_find(phba, tag); |
910 | if (hbq_entry == NULL) | 937 | if (hbq_entry == NULL) |
911 | return NULL; | 938 | return NULL; |
912 | list_del(&hbq_entry->dbuf.list); | 939 | list_del(&hbq_entry->dbuf.list); |
913 | new_hbq_entry = kmalloc(sizeof(struct hbq_dmabuf), GFP_ATOMIC); | 940 | |
941 | hbqno = tag >> 16; | ||
942 | new_hbq_entry = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); | ||
914 | if (new_hbq_entry == NULL) | 943 | if (new_hbq_entry == NULL) |
915 | return &hbq_entry->dbuf; | 944 | return &hbq_entry->dbuf; |
916 | new_hbq_entry->dbuf = hbq_entry->dbuf; | ||
917 | new_hbq_entry->tag = -1; | 945 | new_hbq_entry->tag = -1; |
918 | hbq_entry->dbuf.virt = lpfc_hbq_alloc(phba, 0, &hbq_entry->dbuf.phys); | 946 | phys = new_hbq_entry->dbuf.phys; |
919 | if (hbq_entry->dbuf.virt == NULL) { | 947 | virt = new_hbq_entry->dbuf.virt; |
920 | kfree(new_hbq_entry); | 948 | new_hbq_entry->dbuf.phys = hbq_entry->dbuf.phys; |
921 | return &hbq_entry->dbuf; | 949 | new_hbq_entry->dbuf.virt = hbq_entry->dbuf.virt; |
922 | } | 950 | hbq_entry->dbuf.phys = phys; |
951 | hbq_entry->dbuf.virt = virt; | ||
923 | lpfc_sli_free_hbq(phba, hbq_entry); | 952 | lpfc_sli_free_hbq(phba, hbq_entry); |
924 | return &new_hbq_entry->dbuf; | 953 | return &new_hbq_entry->dbuf; |
925 | } | 954 | } |
@@ -965,7 +994,7 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
965 | irsp->un.ulpWord[3]); | 994 | irsp->un.ulpWord[3]); |
966 | if (irsp->ulpBdeCount == 2) | 995 | if (irsp->ulpBdeCount == 2) |
967 | saveq->context3 = lpfc_sli_replace_hbqbuff(phba, | 996 | saveq->context3 = lpfc_sli_replace_hbqbuff(phba, |
968 | irsp->un.ulpWord[15]); | 997 | irsp->unsli3.sli3Words[7]); |
969 | } | 998 | } |
970 | 999 | ||
971 | /* unSolicited Responses */ | 1000 | /* unSolicited Responses */ |
@@ -996,12 +1025,9 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
996 | /* Ring <ringno> handler: unexpected | 1025 | /* Ring <ringno> handler: unexpected |
997 | Rctl <Rctl> Type <Type> received */ | 1026 | Rctl <Rctl> Type <Type> received */ |
998 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 1027 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
999 | "%d:0313 Ring %d handler: unexpected Rctl x%x " | 1028 | "0313 Ring %d handler: unexpected Rctl x%x " |
1000 | "Type x%x received\n", | 1029 | "Type x%x received\n", |
1001 | phba->brd_no, | 1030 | pring->ringno, Rctl, Type); |
1002 | pring->ringno, | ||
1003 | Rctl, | ||
1004 | Type); | ||
1005 | } | 1031 | } |
1006 | return 1; | 1032 | return 1; |
1007 | } | 1033 | } |
@@ -1024,10 +1050,9 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, | |||
1024 | } | 1050 | } |
1025 | 1051 | ||
1026 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1052 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1027 | "%d:0317 iotag x%x is out off " | 1053 | "0317 iotag x%x is out off " |
1028 | "range: max iotag x%x wd0 x%x\n", | 1054 | "range: max iotag x%x wd0 x%x\n", |
1029 | phba->brd_no, iotag, | 1055 | iotag, phba->sli.last_iotag, |
1030 | phba->sli.last_iotag, | ||
1031 | *(((uint32_t *) &prspiocb->iocb) + 7)); | 1056 | *(((uint32_t *) &prspiocb->iocb) + 7)); |
1032 | return NULL; | 1057 | return NULL; |
1033 | } | 1058 | } |
@@ -1075,18 +1100,16 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
1075 | * Ring <ringno> handler: unexpected completion IoTag | 1100 | * Ring <ringno> handler: unexpected completion IoTag |
1076 | * <IoTag> | 1101 | * <IoTag> |
1077 | */ | 1102 | */ |
1078 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 1103 | lpfc_printf_vlog(cmdiocbp->vport, KERN_WARNING, LOG_SLI, |
1079 | "%d (%d):0322 Ring %d handler: " | 1104 | "0322 Ring %d handler: " |
1080 | "unexpected completion IoTag x%x " | 1105 | "unexpected completion IoTag x%x " |
1081 | "Data: x%x x%x x%x x%x\n", | 1106 | "Data: x%x x%x x%x x%x\n", |
1082 | phba->brd_no, | 1107 | pring->ringno, |
1083 | cmdiocbp->vport->vpi, | 1108 | saveq->iocb.ulpIoTag, |
1084 | pring->ringno, | 1109 | saveq->iocb.ulpStatus, |
1085 | saveq->iocb.ulpIoTag, | 1110 | saveq->iocb.un.ulpWord[4], |
1086 | saveq->iocb.ulpStatus, | 1111 | saveq->iocb.ulpCommand, |
1087 | saveq->iocb.un.ulpWord[4], | 1112 | saveq->iocb.ulpContext); |
1088 | saveq->iocb.ulpCommand, | ||
1089 | saveq->iocb.ulpContext); | ||
1090 | } | 1113 | } |
1091 | } | 1114 | } |
1092 | 1115 | ||
@@ -1104,10 +1127,9 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
1104 | * rsp ring <portRspMax> | 1127 | * rsp ring <portRspMax> |
1105 | */ | 1128 | */ |
1106 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1129 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1107 | "%d:0312 Ring %d handler: portRspPut %d " | 1130 | "0312 Ring %d handler: portRspPut %d " |
1108 | "is bigger then rsp ring %d\n", | 1131 | "is bigger then rsp ring %d\n", |
1109 | phba->brd_no, pring->ringno, | 1132 | pring->ringno, le32_to_cpu(pgp->rspPutInx), |
1110 | le32_to_cpu(pgp->rspPutInx), | ||
1111 | pring->numRiocb); | 1133 | pring->numRiocb); |
1112 | 1134 | ||
1113 | phba->link_state = LPFC_HBA_ERROR; | 1135 | phba->link_state = LPFC_HBA_ERROR; |
@@ -1177,9 +1199,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) | |||
1177 | if (unlikely(irsp->ulpStatus)) { | 1199 | if (unlikely(irsp->ulpStatus)) { |
1178 | /* Rsp ring <ringno> error: IOCB */ | 1200 | /* Rsp ring <ringno> error: IOCB */ |
1179 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 1201 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
1180 | "%d:0326 Rsp Ring %d error: IOCB Data: " | 1202 | "0326 Rsp Ring %d error: IOCB Data: " |
1181 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", | 1203 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", |
1182 | phba->brd_no, pring->ringno, | 1204 | pring->ringno, |
1183 | irsp->un.ulpWord[0], | 1205 | irsp->un.ulpWord[0], |
1184 | irsp->un.ulpWord[1], | 1206 | irsp->un.ulpWord[1], |
1185 | irsp->un.ulpWord[2], | 1207 | irsp->un.ulpWord[2], |
@@ -1199,9 +1221,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) | |||
1199 | */ | 1221 | */ |
1200 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { | 1222 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { |
1201 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 1223 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
1202 | "%d:0314 IOCB cmd 0x%x" | 1224 | "0314 IOCB cmd 0x%x " |
1203 | " processed. Skipping" | 1225 | "processed. Skipping " |
1204 | " completion", phba->brd_no, | 1226 | "completion", |
1205 | irsp->ulpCommand); | 1227 | irsp->ulpCommand); |
1206 | break; | 1228 | break; |
1207 | } | 1229 | } |
@@ -1226,10 +1248,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) | |||
1226 | } else { | 1248 | } else { |
1227 | /* Unknown IOCB command */ | 1249 | /* Unknown IOCB command */ |
1228 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1250 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1229 | "%d:0321 Unknown IOCB command " | 1251 | "0321 Unknown IOCB command " |
1230 | "Data: x%x, x%x x%x x%x x%x\n", | 1252 | "Data: x%x, x%x x%x x%x x%x\n", |
1231 | phba->brd_no, type, | 1253 | type, irsp->ulpCommand, |
1232 | irsp->ulpCommand, | ||
1233 | irsp->ulpStatus, | 1254 | irsp->ulpStatus, |
1234 | irsp->ulpIoTag, | 1255 | irsp->ulpIoTag, |
1235 | irsp->ulpContext); | 1256 | irsp->ulpContext); |
@@ -1353,9 +1374,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
1353 | 1374 | ||
1354 | /* Rsp ring <ringno> error: IOCB */ | 1375 | /* Rsp ring <ringno> error: IOCB */ |
1355 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 1376 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
1356 | "%d:0336 Rsp Ring %d error: IOCB Data: " | 1377 | "0336 Rsp Ring %d error: IOCB Data: " |
1357 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", | 1378 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", |
1358 | phba->brd_no, pring->ringno, | 1379 | pring->ringno, |
1359 | irsp->un.ulpWord[0], | 1380 | irsp->un.ulpWord[0], |
1360 | irsp->un.ulpWord[1], | 1381 | irsp->un.ulpWord[1], |
1361 | irsp->un.ulpWord[2], | 1382 | irsp->un.ulpWord[2], |
@@ -1375,10 +1396,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
1375 | */ | 1396 | */ |
1376 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { | 1397 | if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) { |
1377 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 1398 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
1378 | "%d:0333 IOCB cmd 0x%x" | 1399 | "0333 IOCB cmd 0x%x" |
1379 | " processed. Skipping" | 1400 | " processed. Skipping" |
1380 | " completion\n", | 1401 | " completion\n", |
1381 | phba->brd_no, | ||
1382 | irsp->ulpCommand); | 1402 | irsp->ulpCommand); |
1383 | break; | 1403 | break; |
1384 | } | 1404 | } |
@@ -1415,10 +1435,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
1415 | } else { | 1435 | } else { |
1416 | /* Unknown IOCB command */ | 1436 | /* Unknown IOCB command */ |
1417 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1437 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1418 | "%d:0334 Unknown IOCB command " | 1438 | "0334 Unknown IOCB command " |
1419 | "Data: x%x, x%x x%x x%x x%x\n", | 1439 | "Data: x%x, x%x x%x x%x x%x\n", |
1420 | phba->brd_no, type, | 1440 | type, irsp->ulpCommand, |
1421 | irsp->ulpCommand, | ||
1422 | irsp->ulpStatus, | 1441 | irsp->ulpStatus, |
1423 | irsp->ulpIoTag, | 1442 | irsp->ulpIoTag, |
1424 | irsp->ulpContext); | 1443 | irsp->ulpContext); |
@@ -1496,10 +1515,9 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1496 | * rsp ring <portRspMax> | 1515 | * rsp ring <portRspMax> |
1497 | */ | 1516 | */ |
1498 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1517 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1499 | "%d:0303 Ring %d handler: portRspPut %d " | 1518 | "0303 Ring %d handler: portRspPut %d " |
1500 | "is bigger then rsp ring %d\n", | 1519 | "is bigger then rsp ring %d\n", |
1501 | phba->brd_no, pring->ringno, portRspPut, | 1520 | pring->ringno, portRspPut, portRspMax); |
1502 | portRspMax); | ||
1503 | 1521 | ||
1504 | phba->link_state = LPFC_HBA_ERROR; | 1522 | phba->link_state = LPFC_HBA_ERROR; |
1505 | spin_unlock_irqrestore(&phba->hbalock, iflag); | 1523 | spin_unlock_irqrestore(&phba->hbalock, iflag); |
@@ -1542,6 +1560,14 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1542 | if (++pring->rspidx >= portRspMax) | 1560 | if (++pring->rspidx >= portRspMax) |
1543 | pring->rspidx = 0; | 1561 | pring->rspidx = 0; |
1544 | 1562 | ||
1563 | if (pring->ringno == LPFC_ELS_RING) { | ||
1564 | lpfc_debugfs_slow_ring_trc(phba, | ||
1565 | "IOCB rsp ring: wd4:x%08x wd6:x%08x wd7:x%08x", | ||
1566 | *(((uint32_t *) irsp) + 4), | ||
1567 | *(((uint32_t *) irsp) + 6), | ||
1568 | *(((uint32_t *) irsp) + 7)); | ||
1569 | } | ||
1570 | |||
1545 | writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); | 1571 | writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); |
1546 | 1572 | ||
1547 | if (list_empty(&(pring->iocb_continueq))) { | 1573 | if (list_empty(&(pring->iocb_continueq))) { |
@@ -1580,13 +1606,12 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1580 | if (irsp->ulpStatus) { | 1606 | if (irsp->ulpStatus) { |
1581 | /* Rsp ring <ringno> error: IOCB */ | 1607 | /* Rsp ring <ringno> error: IOCB */ |
1582 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 1608 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
1583 | "%d:0328 Rsp Ring %d error: " | 1609 | "0328 Rsp Ring %d error: " |
1584 | "IOCB Data: " | 1610 | "IOCB Data: " |
1585 | "x%x x%x x%x x%x " | 1611 | "x%x x%x x%x x%x " |
1586 | "x%x x%x x%x x%x " | 1612 | "x%x x%x x%x x%x " |
1587 | "x%x x%x x%x x%x " | 1613 | "x%x x%x x%x x%x " |
1588 | "x%x x%x x%x x%x\n", | 1614 | "x%x x%x x%x x%x\n", |
1589 | phba->brd_no, | ||
1590 | pring->ringno, | 1615 | pring->ringno, |
1591 | irsp->un.ulpWord[0], | 1616 | irsp->un.ulpWord[0], |
1592 | irsp->un.ulpWord[1], | 1617 | irsp->un.ulpWord[1], |
@@ -1661,10 +1686,9 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1661 | } else { | 1686 | } else { |
1662 | /* Unknown IOCB command */ | 1687 | /* Unknown IOCB command */ |
1663 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1688 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1664 | "%d:0335 Unknown IOCB " | 1689 | "0335 Unknown IOCB " |
1665 | "command Data: x%x " | 1690 | "command Data: x%x " |
1666 | "x%x x%x x%x\n", | 1691 | "x%x x%x x%x\n", |
1667 | phba->brd_no, | ||
1668 | irsp->ulpCommand, | 1692 | irsp->ulpCommand, |
1669 | irsp->ulpStatus, | 1693 | irsp->ulpStatus, |
1670 | irsp->ulpIoTag, | 1694 | irsp->ulpIoTag, |
@@ -1892,8 +1916,8 @@ lpfc_sli_brdkill(struct lpfc_hba *phba) | |||
1892 | 1916 | ||
1893 | /* Kill HBA */ | 1917 | /* Kill HBA */ |
1894 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 1918 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
1895 | "%d:0329 Kill HBA Data: x%x x%x\n", | 1919 | "0329 Kill HBA Data: x%x x%x\n", |
1896 | phba->brd_no, phba->pport->port_state, psli->sli_flag); | 1920 | phba->pport->port_state, psli->sli_flag); |
1897 | 1921 | ||
1898 | if ((pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, | 1922 | if ((pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, |
1899 | GFP_KERNEL)) == 0) | 1923 | GFP_KERNEL)) == 0) |
@@ -1966,7 +1990,7 @@ lpfc_sli_brdreset(struct lpfc_hba *phba) | |||
1966 | 1990 | ||
1967 | /* Reset HBA */ | 1991 | /* Reset HBA */ |
1968 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 1992 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
1969 | "%d:0325 Reset HBA Data: x%x x%x\n", phba->brd_no, | 1993 | "0325 Reset HBA Data: x%x x%x\n", |
1970 | phba->pport->port_state, psli->sli_flag); | 1994 | phba->pport->port_state, psli->sli_flag); |
1971 | 1995 | ||
1972 | /* perform board reset */ | 1996 | /* perform board reset */ |
@@ -2021,7 +2045,7 @@ lpfc_sli_brdrestart(struct lpfc_hba *phba) | |||
2021 | 2045 | ||
2022 | /* Restart HBA */ | 2046 | /* Restart HBA */ |
2023 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 2047 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
2024 | "%d:0337 Restart HBA Data: x%x x%x\n", phba->brd_no, | 2048 | "0337 Restart HBA Data: x%x x%x\n", |
2025 | phba->pport->port_state, psli->sli_flag); | 2049 | phba->pport->port_state, psli->sli_flag); |
2026 | 2050 | ||
2027 | word0 = 0; | 2051 | word0 = 0; |
@@ -2086,9 +2110,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
2086 | /* Adapter failed to init, timeout, status reg | 2110 | /* Adapter failed to init, timeout, status reg |
2087 | <status> */ | 2111 | <status> */ |
2088 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2112 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
2089 | "%d:0436 Adapter failed to init, " | 2113 | "0436 Adapter failed to init, " |
2090 | "timeout, status reg x%x\n", | 2114 | "timeout, status reg x%x\n", status); |
2091 | phba->brd_no, status); | ||
2092 | phba->link_state = LPFC_HBA_ERROR; | 2115 | phba->link_state = LPFC_HBA_ERROR; |
2093 | return -ETIMEDOUT; | 2116 | return -ETIMEDOUT; |
2094 | } | 2117 | } |
@@ -2099,10 +2122,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
2099 | /* Adapter failed to init, chipset, status reg | 2122 | /* Adapter failed to init, chipset, status reg |
2100 | <status> */ | 2123 | <status> */ |
2101 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2124 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
2102 | "%d:0437 Adapter failed to init, " | 2125 | "0437 Adapter failed to init, " |
2103 | "chipset, status reg x%x\n", | 2126 | "chipset, status reg x%x\n", status); |
2104 | phba->brd_no, | ||
2105 | status); | ||
2106 | phba->link_state = LPFC_HBA_ERROR; | 2127 | phba->link_state = LPFC_HBA_ERROR; |
2107 | return -EIO; | 2128 | return -EIO; |
2108 | } | 2129 | } |
@@ -2129,10 +2150,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
2129 | /* ERROR: During chipset initialization */ | 2150 | /* ERROR: During chipset initialization */ |
2130 | /* Adapter failed to init, chipset, status reg <status> */ | 2151 | /* Adapter failed to init, chipset, status reg <status> */ |
2131 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2152 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
2132 | "%d:0438 Adapter failed to init, chipset, " | 2153 | "0438 Adapter failed to init, chipset, " |
2133 | "status reg x%x\n", | 2154 | "status reg x%x\n", status); |
2134 | phba->brd_no, | ||
2135 | status); | ||
2136 | phba->link_state = LPFC_HBA_ERROR; | 2155 | phba->link_state = LPFC_HBA_ERROR; |
2137 | return -EIO; | 2156 | return -EIO; |
2138 | } | 2157 | } |
@@ -2147,7 +2166,7 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
2147 | return 0; | 2166 | return 0; |
2148 | } | 2167 | } |
2149 | 2168 | ||
2150 | static int | 2169 | int |
2151 | lpfc_sli_hbq_count(void) | 2170 | lpfc_sli_hbq_count(void) |
2152 | { | 2171 | { |
2153 | return ARRAY_SIZE(lpfc_hbq_defs); | 2172 | return ARRAY_SIZE(lpfc_hbq_defs); |
@@ -2200,8 +2219,8 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba) | |||
2200 | phba->hbqs[hbqno].local_hbqGetIdx = 0; | 2219 | phba->hbqs[hbqno].local_hbqGetIdx = 0; |
2201 | phba->hbqs[hbqno].entry_count = | 2220 | phba->hbqs[hbqno].entry_count = |
2202 | lpfc_hbq_defs[hbqno]->entry_count; | 2221 | lpfc_hbq_defs[hbqno]->entry_count; |
2203 | lpfc_config_hbq(phba, lpfc_hbq_defs[hbqno], hbq_entry_index, | 2222 | lpfc_config_hbq(phba, hbqno, lpfc_hbq_defs[hbqno], |
2204 | pmb); | 2223 | hbq_entry_index, pmb); |
2205 | hbq_entry_index += phba->hbqs[hbqno].entry_count; | 2224 | hbq_entry_index += phba->hbqs[hbqno].entry_count; |
2206 | 2225 | ||
2207 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | 2226 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { |
@@ -2210,9 +2229,9 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba) | |||
2210 | 2229 | ||
2211 | lpfc_printf_log(phba, KERN_ERR, | 2230 | lpfc_printf_log(phba, KERN_ERR, |
2212 | LOG_SLI | LOG_VPORT, | 2231 | LOG_SLI | LOG_VPORT, |
2213 | "%d:1805 Adapter failed to init. " | 2232 | "1805 Adapter failed to init. " |
2214 | "Data: x%x x%x x%x\n", | 2233 | "Data: x%x x%x x%x\n", |
2215 | phba->brd_no, pmbox->mbxCommand, | 2234 | pmbox->mbxCommand, |
2216 | pmbox->mbxStatus, hbqno); | 2235 | pmbox->mbxStatus, hbqno); |
2217 | 2236 | ||
2218 | phba->link_state = LPFC_HBA_ERROR; | 2237 | phba->link_state = LPFC_HBA_ERROR; |
@@ -2279,10 +2298,9 @@ lpfc_do_config_port(struct lpfc_hba *phba, int sli_mode) | |||
2279 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 2298 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
2280 | if (rc != MBX_SUCCESS) { | 2299 | if (rc != MBX_SUCCESS) { |
2281 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2300 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
2282 | "%d:0442 Adapter failed to init, mbxCmd x%x " | 2301 | "0442 Adapter failed to init, mbxCmd x%x " |
2283 | "CONFIG_PORT, mbxStatus x%x Data: x%x\n", | 2302 | "CONFIG_PORT, mbxStatus x%x Data: x%x\n", |
2284 | phba->brd_no, pmb->mb.mbxCommand, | 2303 | pmb->mb.mbxCommand, pmb->mb.mbxStatus, 0); |
2285 | pmb->mb.mbxStatus, 0); | ||
2286 | spin_lock_irq(&phba->hbalock); | 2304 | spin_lock_irq(&phba->hbalock); |
2287 | phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE; | 2305 | phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE; |
2288 | spin_unlock_irq(&phba->hbalock); | 2306 | spin_unlock_irq(&phba->hbalock); |
@@ -2321,11 +2339,11 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
2321 | 2339 | ||
2322 | switch (lpfc_sli_mode) { | 2340 | switch (lpfc_sli_mode) { |
2323 | case 2: | 2341 | case 2: |
2324 | if (phba->cfg_npiv_enable) { | 2342 | if (phba->cfg_enable_npiv) { |
2325 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, | 2343 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, |
2326 | "%d:1824 NPIV enabled: Override lpfc_sli_mode " | 2344 | "1824 NPIV enabled: Override lpfc_sli_mode " |
2327 | "parameter (%d) to auto (0).\n", | 2345 | "parameter (%d) to auto (0).\n", |
2328 | phba->brd_no, lpfc_sli_mode); | 2346 | lpfc_sli_mode); |
2329 | break; | 2347 | break; |
2330 | } | 2348 | } |
2331 | mode = 2; | 2349 | mode = 2; |
@@ -2335,9 +2353,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
2335 | break; | 2353 | break; |
2336 | default: | 2354 | default: |
2337 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, | 2355 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, |
2338 | "%d:1819 Unrecognized lpfc_sli_mode " | 2356 | "1819 Unrecognized lpfc_sli_mode " |
2339 | "parameter: %d.\n", | 2357 | "parameter: %d.\n", lpfc_sli_mode); |
2340 | phba->brd_no, lpfc_sli_mode); | ||
2341 | 2358 | ||
2342 | break; | 2359 | break; |
2343 | } | 2360 | } |
@@ -2345,9 +2362,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
2345 | rc = lpfc_do_config_port(phba, mode); | 2362 | rc = lpfc_do_config_port(phba, mode); |
2346 | if (rc && lpfc_sli_mode == 3) | 2363 | if (rc && lpfc_sli_mode == 3) |
2347 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, | 2364 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, |
2348 | "%d:1820 Unable to select SLI-3. " | 2365 | "1820 Unable to select SLI-3. " |
2349 | "Not supported by adapter.\n", | 2366 | "Not supported by adapter.\n"); |
2350 | phba->brd_no); | ||
2351 | if (rc && mode != 2) | 2367 | if (rc && mode != 2) |
2352 | rc = lpfc_do_config_port(phba, 2); | 2368 | rc = lpfc_do_config_port(phba, 2); |
2353 | if (rc) | 2369 | if (rc) |
@@ -2366,8 +2382,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
2366 | } | 2382 | } |
2367 | 2383 | ||
2368 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 2384 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
2369 | "%d:0444 Firmware in SLI %x mode. Max_vpi %d\n", | 2385 | "0444 Firmware in SLI %x mode. Max_vpi %d\n", |
2370 | phba->brd_no, phba->sli_rev, phba->max_vpi); | 2386 | phba->sli_rev, phba->max_vpi); |
2371 | rc = lpfc_sli_ring_map(phba); | 2387 | rc = lpfc_sli_ring_map(phba); |
2372 | 2388 | ||
2373 | if (rc) | 2389 | if (rc) |
@@ -2392,8 +2408,7 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
2392 | lpfc_sli_hba_setup_error: | 2408 | lpfc_sli_hba_setup_error: |
2393 | phba->link_state = LPFC_HBA_ERROR; | 2409 | phba->link_state = LPFC_HBA_ERROR; |
2394 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 2410 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
2395 | "%d:0445 Firmware initialization failed\n", | 2411 | "0445 Firmware initialization failed\n"); |
2396 | phba->brd_no); | ||
2397 | return rc; | 2412 | return rc; |
2398 | } | 2413 | } |
2399 | 2414 | ||
@@ -2445,9 +2460,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | |||
2445 | 2460 | ||
2446 | /* Mbox cmd <mbxCommand> timeout */ | 2461 | /* Mbox cmd <mbxCommand> timeout */ |
2447 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, | 2462 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, |
2448 | "%d:0310 Mailbox command x%x timeout Data: x%x x%x " | 2463 | "0310 Mailbox command x%x timeout Data: x%x x%x x%p\n", |
2449 | "x%p\n", | ||
2450 | phba->brd_no, | ||
2451 | mb->mbxCommand, | 2464 | mb->mbxCommand, |
2452 | phba->pport->port_state, | 2465 | phba->pport->port_state, |
2453 | phba->sli.sli_flag, | 2466 | phba->sli.sli_flag, |
@@ -2470,8 +2483,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | |||
2470 | lpfc_sli_abort_iocb_ring(phba, pring); | 2483 | lpfc_sli_abort_iocb_ring(phba, pring); |
2471 | 2484 | ||
2472 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, | 2485 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, |
2473 | "%d:0316 Resetting board due to mailbox timeout\n", | 2486 | "0316 Resetting board due to mailbox timeout\n"); |
2474 | phba->brd_no); | ||
2475 | /* | 2487 | /* |
2476 | * lpfc_offline calls lpfc_sli_hba_down which will clean up | 2488 | * lpfc_offline calls lpfc_sli_hba_down which will clean up |
2477 | * on oustanding mailbox commands. | 2489 | * on oustanding mailbox commands. |
@@ -2502,8 +2514,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) | |||
2502 | if(!pmbox->vport) { | 2514 | if(!pmbox->vport) { |
2503 | lpfc_printf_log(phba, KERN_ERR, | 2515 | lpfc_printf_log(phba, KERN_ERR, |
2504 | LOG_MBOX | LOG_VPORT, | 2516 | LOG_MBOX | LOG_VPORT, |
2505 | "%d:1806 Mbox x%x failed. No vport\n", | 2517 | "1806 Mbox x%x failed. No vport\n", |
2506 | phba->brd_no, | ||
2507 | pmbox->mb.mbxCommand); | 2518 | pmbox->mb.mbxCommand); |
2508 | dump_stack(); | 2519 | dump_stack(); |
2509 | return MBXERR_ERROR; | 2520 | return MBXERR_ERROR; |
@@ -2580,9 +2591,8 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) | |||
2580 | 2591 | ||
2581 | /* Mbox cmd issue - BUSY */ | 2592 | /* Mbox cmd issue - BUSY */ |
2582 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, | 2593 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, |
2583 | "%d (%d):0308 Mbox cmd issue - BUSY Data: " | 2594 | "(%d):0308 Mbox cmd issue - BUSY Data: " |
2584 | "x%x x%x x%x x%x\n", | 2595 | "x%x x%x x%x x%x\n", |
2585 | phba->brd_no, | ||
2586 | pmbox->vport ? pmbox->vport->vpi : 0xffffff, | 2596 | pmbox->vport ? pmbox->vport->vpi : 0xffffff, |
2587 | mb->mbxCommand, phba->pport->port_state, | 2597 | mb->mbxCommand, phba->pport->port_state, |
2588 | psli->sli_flag, flag); | 2598 | psli->sli_flag, flag); |
@@ -2644,9 +2654,9 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) | |||
2644 | 2654 | ||
2645 | /* Mailbox cmd <cmd> issue */ | 2655 | /* Mailbox cmd <cmd> issue */ |
2646 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, | 2656 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, |
2647 | "%d (%d):0309 Mailbox cmd x%x issue Data: x%x x%x " | 2657 | "(%d):0309 Mailbox cmd x%x issue Data: x%x x%x " |
2648 | "x%x\n", | 2658 | "x%x\n", |
2649 | phba->brd_no, pmbox->vport ? pmbox->vport->vpi : 0, | 2659 | pmbox->vport ? pmbox->vport->vpi : 0, |
2650 | mb->mbxCommand, phba->pport->port_state, | 2660 | mb->mbxCommand, phba->pport->port_state, |
2651 | psli->sli_flag, flag); | 2661 | psli->sli_flag, flag); |
2652 | 2662 | ||
@@ -2848,8 +2858,7 @@ __lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
2848 | (piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN)) { | 2858 | (piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN)) { |
2849 | lpfc_printf_log(phba, KERN_ERR, | 2859 | lpfc_printf_log(phba, KERN_ERR, |
2850 | LOG_SLI | LOG_VPORT, | 2860 | LOG_SLI | LOG_VPORT, |
2851 | "%d:1807 IOCB x%x failed. No vport\n", | 2861 | "1807 IOCB x%x failed. No vport\n", |
2852 | phba->brd_no, | ||
2853 | piocb->iocb.ulpCommand); | 2862 | piocb->iocb.ulpCommand); |
2854 | dump_stack(); | 2863 | dump_stack(); |
2855 | return IOCB_ERROR; | 2864 | return IOCB_ERROR; |
@@ -3080,11 +3089,10 @@ lpfc_sli_setup(struct lpfc_hba *phba) | |||
3080 | } | 3089 | } |
3081 | if (totiocbsize > MAX_SLIM_IOCB_SIZE) { | 3090 | if (totiocbsize > MAX_SLIM_IOCB_SIZE) { |
3082 | /* Too many cmd / rsp ring entries in SLI2 SLIM */ | 3091 | /* Too many cmd / rsp ring entries in SLI2 SLIM */ |
3083 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 3092 | printk(KERN_ERR "%d:0462 Too many cmd / rsp ring entries in " |
3084 | "%d:0462 Too many cmd / rsp ring entries in " | 3093 | "SLI2 SLIM Data: x%x x%lx\n", |
3085 | "SLI2 SLIM Data: x%x x%lx\n", | 3094 | phba->brd_no, totiocbsize, |
3086 | phba->brd_no, totiocbsize, | 3095 | (unsigned long) MAX_SLIM_IOCB_SIZE); |
3087 | (unsigned long) MAX_SLIM_IOCB_SIZE); | ||
3088 | } | 3096 | } |
3089 | if (phba->cfg_multi_ring_support == 2) | 3097 | if (phba->cfg_multi_ring_support == 2) |
3090 | lpfc_extra_ring_setup(phba); | 3098 | lpfc_extra_ring_setup(phba); |
@@ -3305,9 +3313,9 @@ lpfc_sli_ringpostbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3305 | 3313 | ||
3306 | spin_unlock_irq(&phba->hbalock); | 3314 | spin_unlock_irq(&phba->hbalock); |
3307 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 3315 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
3308 | "%d:0410 Cannot find virtual addr for mapped buf on " | 3316 | "0410 Cannot find virtual addr for mapped buf on " |
3309 | "ring %d Data x%llx x%p x%p x%x\n", | 3317 | "ring %d Data x%llx x%p x%p x%x\n", |
3310 | phba->brd_no, pring->ringno, (unsigned long long)phys, | 3318 | pring->ringno, (unsigned long long)phys, |
3311 | slp->next, slp->prev, pring->postbufq_cnt); | 3319 | slp->next, slp->prev, pring->postbufq_cnt); |
3312 | return NULL; | 3320 | return NULL; |
3313 | } | 3321 | } |
@@ -3332,12 +3340,11 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
3332 | abort_iocb = phba->sli.iocbq_lookup[abort_iotag]; | 3340 | abort_iocb = phba->sli.iocbq_lookup[abort_iotag]; |
3333 | 3341 | ||
3334 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_SLI, | 3342 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_SLI, |
3335 | "%d:0327 Cannot abort els iocb %p " | 3343 | "0327 Cannot abort els iocb %p " |
3336 | "with tag %x context %x, abort status %x, " | 3344 | "with tag %x context %x, abort status %x, " |
3337 | "abort code %x\n", | 3345 | "abort code %x\n", |
3338 | phba->brd_no, abort_iocb, abort_iotag, | 3346 | abort_iocb, abort_iotag, abort_context, |
3339 | abort_context, irsp->ulpStatus, | 3347 | irsp->ulpStatus, irsp->un.ulpWord[4]); |
3340 | irsp->un.ulpWord[4]); | ||
3341 | 3348 | ||
3342 | /* | 3349 | /* |
3343 | * make sure we have the right iocbq before taking it | 3350 | * make sure we have the right iocbq before taking it |
@@ -3371,9 +3378,9 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
3371 | 3378 | ||
3372 | /* ELS cmd tag <ulpIoTag> completes */ | 3379 | /* ELS cmd tag <ulpIoTag> completes */ |
3373 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 3380 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
3374 | "%d (X):0133 Ignoring ELS cmd tag x%x completion Data: " | 3381 | "0133 Ignoring ELS cmd tag x%x completion Data: " |
3375 | "x%x x%x x%x\n", | 3382 | "x%x x%x x%x\n", |
3376 | phba->brd_no, irsp->ulpIoTag, irsp->ulpStatus, | 3383 | irsp->ulpIoTag, irsp->ulpStatus, |
3377 | irsp->un.ulpWord[4], irsp->ulpTimeout); | 3384 | irsp->un.ulpWord[4], irsp->ulpTimeout); |
3378 | if (cmdiocb->iocb.ulpCommand == CMD_GEN_REQUEST64_CR) | 3385 | if (cmdiocb->iocb.ulpCommand == CMD_GEN_REQUEST64_CR) |
3379 | lpfc_ct_free_iocb(phba, cmdiocb); | 3386 | lpfc_ct_free_iocb(phba, cmdiocb); |
@@ -3439,12 +3446,11 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3439 | 3446 | ||
3440 | abtsiocbp->iocb_cmpl = lpfc_sli_abort_els_cmpl; | 3447 | abtsiocbp->iocb_cmpl = lpfc_sli_abort_els_cmpl; |
3441 | 3448 | ||
3442 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3449 | lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, |
3443 | "%d (%d):0339 Abort xri x%x, original iotag x%x, " | 3450 | "0339 Abort xri x%x, original iotag x%x, " |
3444 | "abort cmd iotag x%x\n", | 3451 | "abort cmd iotag x%x\n", |
3445 | phba->brd_no, vport->vpi, | 3452 | iabt->un.acxri.abortContextTag, |
3446 | iabt->un.acxri.abortContextTag, | 3453 | iabt->un.acxri.abortIoTag, abtsiocbp->iotag); |
3447 | iabt->un.acxri.abortIoTag, abtsiocbp->iotag); | ||
3448 | retval = __lpfc_sli_issue_iocb(phba, pring, abtsiocbp, 0); | 3454 | retval = __lpfc_sli_issue_iocb(phba, pring, abtsiocbp, 0); |
3449 | 3455 | ||
3450 | abort_iotag_exit: | 3456 | abort_iotag_exit: |
@@ -3457,8 +3463,8 @@ abort_iotag_exit: | |||
3457 | } | 3463 | } |
3458 | 3464 | ||
3459 | static int | 3465 | static int |
3460 | lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, | 3466 | lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport, |
3461 | uint64_t lun_id, uint32_t ctx, | 3467 | uint16_t tgt_id, uint64_t lun_id, |
3462 | lpfc_ctx_cmd ctx_cmd) | 3468 | lpfc_ctx_cmd ctx_cmd) |
3463 | { | 3469 | { |
3464 | struct lpfc_scsi_buf *lpfc_cmd; | 3470 | struct lpfc_scsi_buf *lpfc_cmd; |
@@ -3468,6 +3474,9 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, | |||
3468 | if (!(iocbq->iocb_flag & LPFC_IO_FCP)) | 3474 | if (!(iocbq->iocb_flag & LPFC_IO_FCP)) |
3469 | return rc; | 3475 | return rc; |
3470 | 3476 | ||
3477 | if (iocbq->vport != vport) | ||
3478 | return rc; | ||
3479 | |||
3471 | lpfc_cmd = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq); | 3480 | lpfc_cmd = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq); |
3472 | cmnd = lpfc_cmd->pCmd; | 3481 | cmnd = lpfc_cmd->pCmd; |
3473 | 3482 | ||
@@ -3484,10 +3493,6 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, | |||
3484 | if (cmnd->device->id == tgt_id) | 3493 | if (cmnd->device->id == tgt_id) |
3485 | rc = 0; | 3494 | rc = 0; |
3486 | break; | 3495 | break; |
3487 | case LPFC_CTX_CTX: | ||
3488 | if (iocbq->iocb.ulpContext == ctx) | ||
3489 | rc = 0; | ||
3490 | break; | ||
3491 | case LPFC_CTX_HOST: | 3496 | case LPFC_CTX_HOST: |
3492 | rc = 0; | 3497 | rc = 0; |
3493 | break; | 3498 | break; |
@@ -3501,17 +3506,18 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id, | |||
3501 | } | 3506 | } |
3502 | 3507 | ||
3503 | int | 3508 | int |
3504 | lpfc_sli_sum_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | 3509 | lpfc_sli_sum_iocb(struct lpfc_vport *vport, uint16_t tgt_id, uint64_t lun_id, |
3505 | uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd ctx_cmd) | 3510 | lpfc_ctx_cmd ctx_cmd) |
3506 | { | 3511 | { |
3512 | struct lpfc_hba *phba = vport->phba; | ||
3507 | struct lpfc_iocbq *iocbq; | 3513 | struct lpfc_iocbq *iocbq; |
3508 | int sum, i; | 3514 | int sum, i; |
3509 | 3515 | ||
3510 | for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) { | 3516 | for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) { |
3511 | iocbq = phba->sli.iocbq_lookup[i]; | 3517 | iocbq = phba->sli.iocbq_lookup[i]; |
3512 | 3518 | ||
3513 | if (lpfc_sli_validate_fcp_iocb (iocbq, tgt_id, lun_id, | 3519 | if (lpfc_sli_validate_fcp_iocb (iocbq, vport, tgt_id, lun_id, |
3514 | 0, ctx_cmd) == 0) | 3520 | ctx_cmd) == 0) |
3515 | sum++; | 3521 | sum++; |
3516 | } | 3522 | } |
3517 | 3523 | ||
@@ -3527,10 +3533,10 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
3527 | } | 3533 | } |
3528 | 3534 | ||
3529 | int | 3535 | int |
3530 | lpfc_sli_abort_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | 3536 | lpfc_sli_abort_iocb(struct lpfc_vport *vport, struct lpfc_sli_ring *pring, |
3531 | uint16_t tgt_id, uint64_t lun_id, uint32_t ctx, | 3537 | uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd abort_cmd) |
3532 | lpfc_ctx_cmd abort_cmd) | ||
3533 | { | 3538 | { |
3539 | struct lpfc_hba *phba = vport->phba; | ||
3534 | struct lpfc_iocbq *iocbq; | 3540 | struct lpfc_iocbq *iocbq; |
3535 | struct lpfc_iocbq *abtsiocb; | 3541 | struct lpfc_iocbq *abtsiocb; |
3536 | IOCB_t *cmd = NULL; | 3542 | IOCB_t *cmd = NULL; |
@@ -3540,7 +3546,7 @@ lpfc_sli_abort_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3540 | for (i = 1; i <= phba->sli.last_iotag; i++) { | 3546 | for (i = 1; i <= phba->sli.last_iotag; i++) { |
3541 | iocbq = phba->sli.iocbq_lookup[i]; | 3547 | iocbq = phba->sli.iocbq_lookup[i]; |
3542 | 3548 | ||
3543 | if (lpfc_sli_validate_fcp_iocb(iocbq, tgt_id, lun_id, 0, | 3549 | if (lpfc_sli_validate_fcp_iocb(iocbq, vport, tgt_id, lun_id, |
3544 | abort_cmd) != 0) | 3550 | abort_cmd) != 0) |
3545 | continue; | 3551 | continue; |
3546 | 3552 | ||
@@ -3647,25 +3653,23 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, | |||
3647 | 3653 | ||
3648 | if (piocb->iocb_flag & LPFC_IO_WAKE) { | 3654 | if (piocb->iocb_flag & LPFC_IO_WAKE) { |
3649 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3655 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
3650 | "%d:0331 IOCB wake signaled\n", | 3656 | "0331 IOCB wake signaled\n"); |
3651 | phba->brd_no); | ||
3652 | } else if (timeleft == 0) { | 3657 | } else if (timeleft == 0) { |
3653 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 3658 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
3654 | "%d:0338 IOCB wait timeout error - no " | 3659 | "0338 IOCB wait timeout error - no " |
3655 | "wake response Data x%x\n", | 3660 | "wake response Data x%x\n", timeout); |
3656 | phba->brd_no, timeout); | ||
3657 | retval = IOCB_TIMEDOUT; | 3661 | retval = IOCB_TIMEDOUT; |
3658 | } else { | 3662 | } else { |
3659 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 3663 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
3660 | "%d:0330 IOCB wake NOT set, " | 3664 | "0330 IOCB wake NOT set, " |
3661 | "Data x%x x%lx\n", phba->brd_no, | 3665 | "Data x%x x%lx\n", |
3662 | timeout, (timeleft / jiffies)); | 3666 | timeout, (timeleft / jiffies)); |
3663 | retval = IOCB_TIMEDOUT; | 3667 | retval = IOCB_TIMEDOUT; |
3664 | } | 3668 | } |
3665 | } else { | 3669 | } else { |
3666 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3670 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
3667 | "%d:0332 IOCB wait issue failed, Data x%x\n", | 3671 | ":0332 IOCB wait issue failed, Data x%x\n", |
3668 | phba->brd_no, retval); | 3672 | retval); |
3669 | retval = IOCB_ERROR; | 3673 | retval = IOCB_ERROR; |
3670 | } | 3674 | } |
3671 | 3675 | ||
@@ -3850,12 +3854,33 @@ lpfc_intr_handler(int irq, void *dev_id) | |||
3850 | if (status & HA_RXMASK) { | 3854 | if (status & HA_RXMASK) { |
3851 | spin_lock(&phba->hbalock); | 3855 | spin_lock(&phba->hbalock); |
3852 | control = readl(phba->HCregaddr); | 3856 | control = readl(phba->HCregaddr); |
3857 | |||
3858 | lpfc_debugfs_slow_ring_trc(phba, | ||
3859 | "ISR slow ring: ctl:x%x stat:x%x isrcnt:x%x", | ||
3860 | control, status, | ||
3861 | (uint32_t)phba->sli.slistat.sli_intr); | ||
3862 | |||
3853 | if (control & (HC_R0INT_ENA << LPFC_ELS_RING)) { | 3863 | if (control & (HC_R0INT_ENA << LPFC_ELS_RING)) { |
3864 | lpfc_debugfs_slow_ring_trc(phba, | ||
3865 | "ISR Disable ring:" | ||
3866 | "pwork:x%x hawork:x%x wait:x%x", | ||
3867 | phba->work_ha, work_ha_copy, | ||
3868 | (uint32_t)((unsigned long) | ||
3869 | phba->work_wait)); | ||
3870 | |||
3854 | control &= | 3871 | control &= |
3855 | ~(HC_R0INT_ENA << LPFC_ELS_RING); | 3872 | ~(HC_R0INT_ENA << LPFC_ELS_RING); |
3856 | writel(control, phba->HCregaddr); | 3873 | writel(control, phba->HCregaddr); |
3857 | readl(phba->HCregaddr); /* flush */ | 3874 | readl(phba->HCregaddr); /* flush */ |
3858 | } | 3875 | } |
3876 | else { | ||
3877 | lpfc_debugfs_slow_ring_trc(phba, | ||
3878 | "ISR slow ring: pwork:" | ||
3879 | "x%x hawork:x%x wait:x%x", | ||
3880 | phba->work_ha, work_ha_copy, | ||
3881 | (uint32_t)((unsigned long) | ||
3882 | phba->work_wait)); | ||
3883 | } | ||
3859 | spin_unlock(&phba->hbalock); | 3884 | spin_unlock(&phba->hbalock); |
3860 | } | 3885 | } |
3861 | } | 3886 | } |
@@ -3895,12 +3920,10 @@ lpfc_intr_handler(int irq, void *dev_id) | |||
3895 | */ | 3920 | */ |
3896 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | | 3921 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | |
3897 | LOG_SLI, | 3922 | LOG_SLI, |
3898 | "%d (%d):0304 Stray Mailbox " | 3923 | "(%d):0304 Stray Mailbox " |
3899 | "Interrupt mbxCommand x%x " | 3924 | "Interrupt mbxCommand x%x " |
3900 | "mbxStatus x%x\n", | 3925 | "mbxStatus x%x\n", |
3901 | phba->brd_no, | 3926 | (vport ? vport->vpi : 0), |
3902 | (vport | ||
3903 | ? vport->vpi : 0), | ||
3904 | pmbox->mbxCommand, | 3927 | pmbox->mbxCommand, |
3905 | pmbox->mbxStatus); | 3928 | pmbox->mbxStatus); |
3906 | } | 3929 | } |
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index 76058505795e..51b2b6b949be 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h | |||
@@ -26,7 +26,6 @@ struct lpfc_vport; | |||
26 | typedef enum _lpfc_ctx_cmd { | 26 | typedef enum _lpfc_ctx_cmd { |
27 | LPFC_CTX_LUN, | 27 | LPFC_CTX_LUN, |
28 | LPFC_CTX_TGT, | 28 | LPFC_CTX_TGT, |
29 | LPFC_CTX_CTX, | ||
30 | LPFC_CTX_HOST | 29 | LPFC_CTX_HOST |
31 | } lpfc_ctx_cmd; | 30 | } lpfc_ctx_cmd; |
32 | 31 | ||
@@ -54,9 +53,10 @@ struct lpfc_iocbq { | |||
54 | void *context2; /* caller context information */ | 53 | void *context2; /* caller context information */ |
55 | void *context3; /* caller context information */ | 54 | void *context3; /* caller context information */ |
56 | union { | 55 | union { |
57 | wait_queue_head_t *wait_queue; | 56 | wait_queue_head_t *wait_queue; |
58 | struct lpfc_iocbq *rsp_iocb; | 57 | struct lpfc_iocbq *rsp_iocb; |
59 | struct lpfcMboxq *mbox; | 58 | struct lpfcMboxq *mbox; |
59 | struct lpfc_nodelist *ndlp; | ||
60 | } context_un; | 60 | } context_un; |
61 | 61 | ||
62 | void (*fabric_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *, | 62 | void (*fabric_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *, |
@@ -143,7 +143,7 @@ struct lpfc_sli_ring { | |||
143 | uint16_t numCiocb; /* number of command iocb's per ring */ | 143 | uint16_t numCiocb; /* number of command iocb's per ring */ |
144 | uint16_t numRiocb; /* number of rsp iocb's per ring */ | 144 | uint16_t numRiocb; /* number of rsp iocb's per ring */ |
145 | uint16_t sizeCiocb; /* Size of command iocb's in this ring */ | 145 | uint16_t sizeCiocb; /* Size of command iocb's in this ring */ |
146 | uint16_t sizeRiocb; /* Size of response iocb's in this ring */ | 146 | uint16_t sizeRiocb; /* Size of response iocb's in this ring */ |
147 | 147 | ||
148 | uint32_t fast_iotag; /* max fastlookup based iotag */ | 148 | uint32_t fast_iotag; /* max fastlookup based iotag */ |
149 | uint32_t iotag_ctr; /* keeps track of the next iotag to use */ | 149 | uint32_t iotag_ctr; /* keeps track of the next iotag to use */ |
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index a5bc79eef052..0081f49286bc 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h | |||
@@ -18,12 +18,10 @@ | |||
18 | * included with this package. * | 18 | * included with this package. * |
19 | *******************************************************************/ | 19 | *******************************************************************/ |
20 | 20 | ||
21 | #define LPFC_DRIVER_VERSION "8.2.1" | 21 | #define LPFC_DRIVER_VERSION "8.2.2" |
22 | 22 | ||
23 | #define LPFC_DRIVER_NAME "lpfc" | 23 | #define LPFC_DRIVER_NAME "lpfc" |
24 | 24 | ||
25 | #define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ | 25 | #define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ |
26 | LPFC_DRIVER_VERSION | 26 | LPFC_DRIVER_VERSION |
27 | #define LPFC_COPYRIGHT "Copyright(c) 2004-2007 Emulex. All rights reserved." | 27 | #define LPFC_COPYRIGHT "Copyright(c) 2004-2007 Emulex. All rights reserved." |
28 | |||
29 | #define DFC_API_VERSION "0.0.0" | ||
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index 85797dbf5478..dcb415e717c3 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c | |||
@@ -125,11 +125,10 @@ lpfc_vport_sparm(struct lpfc_hba *phba, struct lpfc_vport *vport) | |||
125 | pmb->vport = vport; | 125 | pmb->vport = vport; |
126 | rc = lpfc_sli_issue_mbox_wait(phba, pmb, phba->fc_ratov * 2); | 126 | rc = lpfc_sli_issue_mbox_wait(phba, pmb, phba->fc_ratov * 2); |
127 | if (rc != MBX_SUCCESS) { | 127 | if (rc != MBX_SUCCESS) { |
128 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, | 128 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT | LOG_VPORT, |
129 | "%d (%d):1818 VPort failed init, mbxCmd x%x " | 129 | "1818 VPort failed init, mbxCmd x%x " |
130 | "READ_SPARM mbxStatus x%x, rc = x%x\n", | 130 | "READ_SPARM mbxStatus x%x, rc = x%x\n", |
131 | phba->brd_no, vport->vpi, | 131 | mb->mbxCommand, mb->mbxStatus, rc); |
132 | mb->mbxCommand, mb->mbxStatus, rc); | ||
133 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 132 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
134 | kfree(mp); | 133 | kfree(mp); |
135 | if (rc != MBX_TIMEOUT) | 134 | if (rc != MBX_TIMEOUT) |
@@ -162,9 +161,9 @@ lpfc_valid_wwn_format(struct lpfc_hba *phba, struct lpfc_name *wwn, | |||
162 | return 1; | 161 | return 1; |
163 | 162 | ||
164 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 163 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
165 | "%d:1822 Invalid %s: %02x:%02x:%02x:%02x:" | 164 | "1822 Invalid %s: %02x:%02x:%02x:%02x:" |
166 | "%02x:%02x:%02x:%02x\n", | 165 | "%02x:%02x:%02x:%02x\n", |
167 | phba->brd_no, name_type, | 166 | name_type, |
168 | wwn->u.wwn[0], wwn->u.wwn[1], | 167 | wwn->u.wwn[0], wwn->u.wwn[1], |
169 | wwn->u.wwn[2], wwn->u.wwn[3], | 168 | wwn->u.wwn[2], wwn->u.wwn[3], |
170 | wwn->u.wwn[4], wwn->u.wwn[5], | 169 | wwn->u.wwn[4], wwn->u.wwn[5], |
@@ -176,16 +175,21 @@ static int | |||
176 | lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport) | 175 | lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport) |
177 | { | 176 | { |
178 | struct lpfc_vport *vport; | 177 | struct lpfc_vport *vport; |
178 | unsigned long flags; | ||
179 | 179 | ||
180 | spin_lock_irqsave(&phba->hbalock, flags); | ||
180 | list_for_each_entry(vport, &phba->port_list, listentry) { | 181 | list_for_each_entry(vport, &phba->port_list, listentry) { |
181 | if (vport == new_vport) | 182 | if (vport == new_vport) |
182 | continue; | 183 | continue; |
183 | /* If they match, return not unique */ | 184 | /* If they match, return not unique */ |
184 | if (memcmp(&vport->fc_sparam.portName, | 185 | if (memcmp(&vport->fc_sparam.portName, |
185 | &new_vport->fc_sparam.portName, | 186 | &new_vport->fc_sparam.portName, |
186 | sizeof(struct lpfc_name)) == 0) | 187 | sizeof(struct lpfc_name)) == 0) { |
188 | spin_unlock_irqrestore(&phba->hbalock, flags); | ||
187 | return 0; | 189 | return 0; |
190 | } | ||
188 | } | 191 | } |
192 | spin_unlock_irqrestore(&phba->hbalock, flags); | ||
189 | return 1; | 193 | return 1; |
190 | } | 194 | } |
191 | 195 | ||
@@ -193,8 +197,8 @@ int | |||
193 | lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | 197 | lpfc_vport_create(struct fc_vport *fc_vport, bool disable) |
194 | { | 198 | { |
195 | struct lpfc_nodelist *ndlp; | 199 | struct lpfc_nodelist *ndlp; |
196 | struct lpfc_vport *pport = | 200 | struct Scsi_Host *shost = fc_vport->shost; |
197 | (struct lpfc_vport *) fc_vport->shost->hostdata; | 201 | struct lpfc_vport *pport = (struct lpfc_vport *) shost->hostdata; |
198 | struct lpfc_hba *phba = pport->phba; | 202 | struct lpfc_hba *phba = pport->phba; |
199 | struct lpfc_vport *vport = NULL; | 203 | struct lpfc_vport *vport = NULL; |
200 | int instance; | 204 | int instance; |
@@ -204,9 +208,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
204 | if ((phba->sli_rev < 3) || | 208 | if ((phba->sli_rev < 3) || |
205 | !(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { | 209 | !(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { |
206 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 210 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
207 | "%d:1808 Create VPORT failed: " | 211 | "1808 Create VPORT failed: " |
208 | "NPIV is not enabled: SLImode:%d\n", | 212 | "NPIV is not enabled: SLImode:%d\n", |
209 | phba->brd_no, phba->sli_rev); | 213 | phba->sli_rev); |
210 | rc = VPORT_INVAL; | 214 | rc = VPORT_INVAL; |
211 | goto error_out; | 215 | goto error_out; |
212 | } | 216 | } |
@@ -214,9 +218,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
214 | vpi = lpfc_alloc_vpi(phba); | 218 | vpi = lpfc_alloc_vpi(phba); |
215 | if (vpi == 0) { | 219 | if (vpi == 0) { |
216 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 220 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
217 | "%d:1809 Create VPORT failed: " | 221 | "1809 Create VPORT failed: " |
218 | "Max VPORTs (%d) exceeded\n", | 222 | "Max VPORTs (%d) exceeded\n", |
219 | phba->brd_no, phba->max_vpi); | 223 | phba->max_vpi); |
220 | rc = VPORT_NORESOURCES; | 224 | rc = VPORT_NORESOURCES; |
221 | goto error_out; | 225 | goto error_out; |
222 | } | 226 | } |
@@ -225,18 +229,17 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
225 | /* Assign an unused board number */ | 229 | /* Assign an unused board number */ |
226 | if ((instance = lpfc_get_instance()) < 0) { | 230 | if ((instance = lpfc_get_instance()) < 0) { |
227 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 231 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
228 | "%d:1810 Create VPORT failed: Cannot get " | 232 | "1810 Create VPORT failed: Cannot get " |
229 | "instance number\n", phba->brd_no); | 233 | "instance number\n"); |
230 | lpfc_free_vpi(phba, vpi); | 234 | lpfc_free_vpi(phba, vpi); |
231 | rc = VPORT_NORESOURCES; | 235 | rc = VPORT_NORESOURCES; |
232 | goto error_out; | 236 | goto error_out; |
233 | } | 237 | } |
234 | 238 | ||
235 | vport = lpfc_create_port(phba, instance, fc_vport); | 239 | vport = lpfc_create_port(phba, instance, &fc_vport->dev); |
236 | if (!vport) { | 240 | if (!vport) { |
237 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 241 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
238 | "%d:1811 Create VPORT failed: vpi x%x\n", | 242 | "1811 Create VPORT failed: vpi x%x\n", vpi); |
239 | phba->brd_no, vpi); | ||
240 | lpfc_free_vpi(phba, vpi); | 243 | lpfc_free_vpi(phba, vpi); |
241 | rc = VPORT_NORESOURCES; | 244 | rc = VPORT_NORESOURCES; |
242 | goto error_out; | 245 | goto error_out; |
@@ -246,10 +249,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
246 | lpfc_debugfs_initialize(vport); | 249 | lpfc_debugfs_initialize(vport); |
247 | 250 | ||
248 | if (lpfc_vport_sparm(phba, vport)) { | 251 | if (lpfc_vport_sparm(phba, vport)) { |
249 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 252 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
250 | "%d:1813 Create VPORT failed: vpi:%d " | 253 | "1813 Create VPORT failed. " |
251 | "Cannot get sparam\n", | 254 | "Cannot get sparam\n"); |
252 | phba->brd_no, vpi); | ||
253 | lpfc_free_vpi(phba, vpi); | 255 | lpfc_free_vpi(phba, vpi); |
254 | destroy_port(vport); | 256 | destroy_port(vport); |
255 | rc = VPORT_NORESOURCES; | 257 | rc = VPORT_NORESOURCES; |
@@ -269,10 +271,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
269 | 271 | ||
270 | if (!lpfc_valid_wwn_format(phba, &vport->fc_sparam.nodeName, "WWNN") || | 272 | if (!lpfc_valid_wwn_format(phba, &vport->fc_sparam.nodeName, "WWNN") || |
271 | !lpfc_valid_wwn_format(phba, &vport->fc_sparam.portName, "WWPN")) { | 273 | !lpfc_valid_wwn_format(phba, &vport->fc_sparam.portName, "WWPN")) { |
272 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 274 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
273 | "%d:1821 Create VPORT failed: vpi:%d " | 275 | "1821 Create VPORT failed. " |
274 | "Invalid WWN format\n", | 276 | "Invalid WWN format\n"); |
275 | phba->brd_no, vpi); | ||
276 | lpfc_free_vpi(phba, vpi); | 277 | lpfc_free_vpi(phba, vpi); |
277 | destroy_port(vport); | 278 | destroy_port(vport); |
278 | rc = VPORT_INVAL; | 279 | rc = VPORT_INVAL; |
@@ -280,10 +281,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
280 | } | 281 | } |
281 | 282 | ||
282 | if (!lpfc_unique_wwpn(phba, vport)) { | 283 | if (!lpfc_unique_wwpn(phba, vport)) { |
283 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 284 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
284 | "%d:1823 Create VPORT failed: vpi:%d " | 285 | "1823 Create VPORT failed. " |
285 | "Duplicate WWN on HBA\n", | 286 | "Duplicate WWN on HBA\n"); |
286 | phba->brd_no, vpi); | ||
287 | lpfc_free_vpi(phba, vpi); | 287 | lpfc_free_vpi(phba, vpi); |
288 | destroy_port(vport); | 288 | destroy_port(vport); |
289 | rc = VPORT_INVAL; | 289 | rc = VPORT_INVAL; |
@@ -315,10 +315,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
315 | lpfc_initial_fdisc(vport); | 315 | lpfc_initial_fdisc(vport); |
316 | } else { | 316 | } else { |
317 | lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); | 317 | lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); |
318 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 318 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
319 | "%d (%d):0262 No NPIV Fabric " | 319 | "0262 No NPIV Fabric support\n"); |
320 | "support\n", | ||
321 | phba->brd_no, vport->vpi); | ||
322 | } | 320 | } |
323 | } else { | 321 | } else { |
324 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 322 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
@@ -326,12 +324,14 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
326 | rc = VPORT_OK; | 324 | rc = VPORT_OK; |
327 | 325 | ||
328 | out: | 326 | out: |
327 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | ||
328 | "1825 Vport Created.\n"); | ||
329 | lpfc_host_attrib_init(lpfc_shost_from_vport(vport)); | 329 | lpfc_host_attrib_init(lpfc_shost_from_vport(vport)); |
330 | error_out: | 330 | error_out: |
331 | return rc; | 331 | return rc; |
332 | } | 332 | } |
333 | 333 | ||
334 | int | 334 | static int |
335 | disable_vport(struct fc_vport *fc_vport) | 335 | disable_vport(struct fc_vport *fc_vport) |
336 | { | 336 | { |
337 | struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; | 337 | struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; |
@@ -371,10 +371,12 @@ disable_vport(struct fc_vport *fc_vport) | |||
371 | lpfc_mbx_unreg_vpi(vport); | 371 | lpfc_mbx_unreg_vpi(vport); |
372 | 372 | ||
373 | lpfc_vport_set_state(vport, FC_VPORT_DISABLED); | 373 | lpfc_vport_set_state(vport, FC_VPORT_DISABLED); |
374 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | ||
375 | "1826 Vport Disabled.\n"); | ||
374 | return VPORT_OK; | 376 | return VPORT_OK; |
375 | } | 377 | } |
376 | 378 | ||
377 | int | 379 | static int |
378 | enable_vport(struct fc_vport *fc_vport) | 380 | enable_vport(struct fc_vport *fc_vport) |
379 | { | 381 | { |
380 | struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; | 382 | struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; |
@@ -400,15 +402,14 @@ enable_vport(struct fc_vport *fc_vport) | |||
400 | lpfc_initial_fdisc(vport); | 402 | lpfc_initial_fdisc(vport); |
401 | } else { | 403 | } else { |
402 | lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); | 404 | lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); |
403 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 405 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
404 | "%d (%d):0264 No NPIV Fabric " | 406 | "0264 No NPIV Fabric support\n"); |
405 | "support\n", | ||
406 | phba->brd_no, vport->vpi); | ||
407 | } | 407 | } |
408 | } else { | 408 | } else { |
409 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 409 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
410 | } | 410 | } |
411 | 411 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | |
412 | "1827 Vport Enabled.\n"); | ||
412 | return VPORT_OK; | 413 | return VPORT_OK; |
413 | } | 414 | } |
414 | 415 | ||
@@ -431,8 +432,29 @@ lpfc_vport_delete(struct fc_vport *fc_vport) | |||
431 | struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; | 432 | struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; |
432 | struct lpfc_hba *phba = vport->phba; | 433 | struct lpfc_hba *phba = vport->phba; |
433 | long timeout; | 434 | long timeout; |
434 | int rc = VPORT_ERROR; | ||
435 | 435 | ||
436 | if (vport->port_type == LPFC_PHYSICAL_PORT) { | ||
437 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | ||
438 | "1812 vport_delete failed: Cannot delete " | ||
439 | "physical host\n"); | ||
440 | return VPORT_ERROR; | ||
441 | } | ||
442 | /* | ||
443 | * If we are not unloading the driver then prevent the vport_delete | ||
444 | * from happening until after this vport's discovery is finished. | ||
445 | */ | ||
446 | if (!(phba->pport->load_flag & FC_UNLOADING)) { | ||
447 | int check_count = 0; | ||
448 | while (check_count < ((phba->fc_ratov * 3) + 3) && | ||
449 | vport->port_state > LPFC_VPORT_FAILED && | ||
450 | vport->port_state < LPFC_VPORT_READY) { | ||
451 | check_count++; | ||
452 | msleep(1000); | ||
453 | } | ||
454 | if (vport->port_state > LPFC_VPORT_FAILED && | ||
455 | vport->port_state < LPFC_VPORT_READY) | ||
456 | return -EAGAIN; | ||
457 | } | ||
436 | /* | 458 | /* |
437 | * This is a bit of a mess. We want to ensure the shost doesn't get | 459 | * This is a bit of a mess. We want to ensure the shost doesn't get |
438 | * torn down until we're done with the embedded lpfc_vport structure. | 460 | * torn down until we're done with the embedded lpfc_vport structure. |
@@ -450,16 +472,9 @@ lpfc_vport_delete(struct fc_vport *fc_vport) | |||
450 | */ | 472 | */ |
451 | if (!scsi_host_get(shost) || !scsi_host_get(shost)) | 473 | if (!scsi_host_get(shost) || !scsi_host_get(shost)) |
452 | return VPORT_INVAL; | 474 | return VPORT_INVAL; |
453 | 475 | spin_lock_irq(&phba->hbalock); | |
454 | if (vport->port_type == LPFC_PHYSICAL_PORT) { | ||
455 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | ||
456 | "%d:1812 vport_delete failed: Cannot delete " | ||
457 | "physical host\n", phba->brd_no); | ||
458 | goto out; | ||
459 | } | ||
460 | |||
461 | vport->load_flag |= FC_UNLOADING; | 476 | vport->load_flag |= FC_UNLOADING; |
462 | 477 | spin_unlock_irq(&phba->hbalock); | |
463 | kfree(vport->vname); | 478 | kfree(vport->vname); |
464 | lpfc_debugfs_terminate(vport); | 479 | lpfc_debugfs_terminate(vport); |
465 | fc_remove_host(lpfc_shost_from_vport(vport)); | 480 | fc_remove_host(lpfc_shost_from_vport(vport)); |
@@ -511,13 +526,46 @@ skip_logo: | |||
511 | spin_lock_irq(&phba->hbalock); | 526 | spin_lock_irq(&phba->hbalock); |
512 | list_del_init(&vport->listentry); | 527 | list_del_init(&vport->listentry); |
513 | spin_unlock_irq(&phba->hbalock); | 528 | spin_unlock_irq(&phba->hbalock); |
514 | 529 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | |
515 | rc = VPORT_OK; | 530 | "1828 Vport Deleted.\n"); |
516 | out: | ||
517 | scsi_host_put(shost); | 531 | scsi_host_put(shost); |
518 | return rc; | 532 | return VPORT_OK; |
519 | } | 533 | } |
520 | 534 | ||
521 | |||
522 | EXPORT_SYMBOL(lpfc_vport_create); | 535 | EXPORT_SYMBOL(lpfc_vport_create); |
523 | EXPORT_SYMBOL(lpfc_vport_delete); | 536 | EXPORT_SYMBOL(lpfc_vport_delete); |
537 | |||
538 | struct lpfc_vport ** | ||
539 | lpfc_create_vport_work_array(struct lpfc_hba *phba) | ||
540 | { | ||
541 | struct lpfc_vport *port_iterator; | ||
542 | struct lpfc_vport **vports; | ||
543 | int index = 0; | ||
544 | vports = kzalloc(LPFC_MAX_VPORTS * sizeof(struct lpfc_vport *), | ||
545 | GFP_KERNEL); | ||
546 | if (vports == NULL) | ||
547 | return NULL; | ||
548 | spin_lock_irq(&phba->hbalock); | ||
549 | list_for_each_entry(port_iterator, &phba->port_list, listentry) { | ||
550 | if (!scsi_host_get(lpfc_shost_from_vport(port_iterator))) { | ||
551 | lpfc_printf_vlog(port_iterator, KERN_WARNING, LOG_VPORT, | ||
552 | "1801 Create vport work array FAILED: " | ||
553 | "cannot do scsi_host_get\n"); | ||
554 | continue; | ||
555 | } | ||
556 | vports[index++] = port_iterator; | ||
557 | } | ||
558 | spin_unlock_irq(&phba->hbalock); | ||
559 | return vports; | ||
560 | } | ||
561 | |||
562 | void | ||
563 | lpfc_destroy_vport_work_array(struct lpfc_vport **vports) | ||
564 | { | ||
565 | int i; | ||
566 | if (vports == NULL) | ||
567 | return; | ||
568 | for (i=0; vports[i] != NULL && i < LPFC_MAX_VPORTS; i++) | ||
569 | scsi_host_put(lpfc_shost_from_vport(vports[i])); | ||
570 | kfree(vports); | ||
571 | } | ||
diff --git a/drivers/scsi/lpfc/lpfc_vport.h b/drivers/scsi/lpfc/lpfc_vport.h index f223550f8cba..91da17751a37 100644 --- a/drivers/scsi/lpfc/lpfc_vport.h +++ b/drivers/scsi/lpfc/lpfc_vport.h | |||
@@ -88,6 +88,8 @@ int lpfc_vport_create(struct fc_vport *, bool); | |||
88 | int lpfc_vport_delete(struct fc_vport *); | 88 | int lpfc_vport_delete(struct fc_vport *); |
89 | int lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *); | 89 | int lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *); |
90 | int lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint); | 90 | int lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint); |
91 | struct lpfc_vport **lpfc_create_vport_work_array(struct lpfc_hba *); | ||
92 | void lpfc_destroy_vport_work_array(struct lpfc_vport **); | ||
91 | 93 | ||
92 | /* | 94 | /* |
93 | * queuecommand VPORT-specific return codes. Specified in the host byte code. | 95 | * queuecommand VPORT-specific return codes. Specified in the host byte code. |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index c488996cb958..93c0c7e4f08f 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -2154,6 +2154,19 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) | |||
2154 | } | 2154 | } |
2155 | } | 2155 | } |
2156 | 2156 | ||
2157 | /* Get memory for cached NVRAM */ | ||
2158 | ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL); | ||
2159 | if (ha->nvram == NULL) { | ||
2160 | /* error */ | ||
2161 | qla_printk(KERN_WARNING, ha, | ||
2162 | "Memory Allocation failed - nvram cache\n"); | ||
2163 | |||
2164 | qla2x00_mem_free(ha); | ||
2165 | msleep(100); | ||
2166 | |||
2167 | continue; | ||
2168 | } | ||
2169 | |||
2157 | /* Done all allocations without any error. */ | 2170 | /* Done all allocations without any error. */ |
2158 | status = 0; | 2171 | status = 0; |
2159 | 2172 | ||
@@ -2266,6 +2279,7 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
2266 | ha->fw_dump_reading = 0; | 2279 | ha->fw_dump_reading = 0; |
2267 | 2280 | ||
2268 | vfree(ha->optrom_buffer); | 2281 | vfree(ha->optrom_buffer); |
2282 | kfree(ha->nvram); | ||
2269 | } | 2283 | } |
2270 | 2284 | ||
2271 | /* | 2285 | /* |
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index c4195ea869e9..594887205b0f 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
@@ -193,7 +193,8 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f | |||
193 | cpu_relax(); | 193 | cpu_relax(); |
194 | } | 194 | } |
195 | if (!loop_count) | 195 | if (!loop_count) |
196 | printk(KERN_EMERG "qlogicpti: mbox_command loop timeout #1\n"); | 196 | printk(KERN_EMERG "qlogicpti%d: mbox_command loop timeout #1\n", |
197 | qpti->qpti_id); | ||
197 | 198 | ||
198 | /* Write mailbox command registers. */ | 199 | /* Write mailbox command registers. */ |
199 | switch (mbox_param[param[0]] >> 4) { | 200 | switch (mbox_param[param[0]] >> 4) { |
@@ -224,8 +225,8 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f | |||
224 | (sbus_readw(qpti->qregs + HCCTRL) & HCCTRL_CRIRQ)) | 225 | (sbus_readw(qpti->qregs + HCCTRL) & HCCTRL_CRIRQ)) |
225 | udelay(20); | 226 | udelay(20); |
226 | if (!loop_count) | 227 | if (!loop_count) |
227 | printk(KERN_EMERG "qlogicpti: mbox_command[%04x] loop timeout #2\n", | 228 | printk(KERN_EMERG "qlogicpti%d: mbox_command[%04x] loop timeout #2\n", |
228 | param[0]); | 229 | qpti->qpti_id, param[0]); |
229 | 230 | ||
230 | /* Wait for SBUS semaphore to get set. */ | 231 | /* Wait for SBUS semaphore to get set. */ |
231 | loop_count = DEFAULT_LOOP_COUNT; | 232 | loop_count = DEFAULT_LOOP_COUNT; |
@@ -238,16 +239,16 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f | |||
238 | break; | 239 | break; |
239 | } | 240 | } |
240 | if (!loop_count) | 241 | if (!loop_count) |
241 | printk(KERN_EMERG "qlogicpti: mbox_command[%04x] loop timeout #3\n", | 242 | printk(KERN_EMERG "qlogicpti%d: mbox_command[%04x] loop timeout #3\n", |
242 | param[0]); | 243 | qpti->qpti_id, param[0]); |
243 | 244 | ||
244 | /* Wait for MBOX busy condition to go away. */ | 245 | /* Wait for MBOX busy condition to go away. */ |
245 | loop_count = DEFAULT_LOOP_COUNT; | 246 | loop_count = DEFAULT_LOOP_COUNT; |
246 | while (--loop_count && (sbus_readw(qpti->qregs + MBOX0) == 0x04)) | 247 | while (--loop_count && (sbus_readw(qpti->qregs + MBOX0) == 0x04)) |
247 | udelay(20); | 248 | udelay(20); |
248 | if (!loop_count) | 249 | if (!loop_count) |
249 | printk(KERN_EMERG "qlogicpti: mbox_command[%04x] loop timeout #4\n", | 250 | printk(KERN_EMERG "qlogicpti%d: mbox_command[%04x] loop timeout #4\n", |
250 | param[0]); | 251 | qpti->qpti_id, param[0]); |
251 | 252 | ||
252 | /* Read back output parameters. */ | 253 | /* Read back output parameters. */ |
253 | switch (mbox_param[param[0]] & 0xf) { | 254 | switch (mbox_param[param[0]] & 0xf) { |
@@ -342,7 +343,8 @@ static int qlogicpti_reset_hardware(struct Scsi_Host *host) | |||
342 | while (--loop_count && ((sbus_readw(qpti->qregs + MBOX0) & 0xff) == 0x04)) | 343 | while (--loop_count && ((sbus_readw(qpti->qregs + MBOX0) & 0xff) == 0x04)) |
343 | udelay(20); | 344 | udelay(20); |
344 | if (!loop_count) | 345 | if (!loop_count) |
345 | printk(KERN_EMERG "qlogicpti: reset_hardware loop timeout\n"); | 346 | printk(KERN_EMERG "qlogicpti%d: reset_hardware loop timeout\n", |
347 | qpti->qpti_id); | ||
346 | 348 | ||
347 | sbus_writew(HCCTRL_PAUSE, qpti->qregs + HCCTRL); | 349 | sbus_writew(HCCTRL_PAUSE, qpti->qregs + HCCTRL); |
348 | set_sbus_cfg1(qpti); | 350 | set_sbus_cfg1(qpti); |
@@ -721,12 +723,12 @@ static int __init qpti_register_irq(struct qlogicpti *qpti) | |||
721 | IRQF_SHARED, "Qlogic/PTI", qpti)) | 723 | IRQF_SHARED, "Qlogic/PTI", qpti)) |
722 | goto fail; | 724 | goto fail; |
723 | 725 | ||
724 | printk("qpti%d: IRQ %d ", qpti->qpti_id, qpti->irq); | 726 | printk("qlogicpti%d: IRQ %d ", qpti->qpti_id, qpti->irq); |
725 | 727 | ||
726 | return 0; | 728 | return 0; |
727 | 729 | ||
728 | fail: | 730 | fail: |
729 | printk("qpti%d: Cannot acquire irq line\n", qpti->qpti_id); | 731 | printk("qlogicpti%d: Cannot acquire irq line\n", qpti->qpti_id); |
730 | return -1; | 732 | return -1; |
731 | } | 733 | } |
732 | 734 | ||
@@ -1210,7 +1212,7 @@ static int qlogicpti_return_status(struct Status_Entry *sts, int id) | |||
1210 | host_status = DID_OK; | 1212 | host_status = DID_OK; |
1211 | break; | 1213 | break; |
1212 | default: | 1214 | default: |
1213 | printk(KERN_EMERG "qpti%d: unknown completion status 0x%04x\n", | 1215 | printk(KERN_EMERG "qlogicpti%d: unknown completion status 0x%04x\n", |
1214 | id, sts->completion_status); | 1216 | id, sts->completion_status); |
1215 | host_status = DID_ERROR; | 1217 | host_status = DID_ERROR; |
1216 | break; | 1218 | break; |
@@ -1329,8 +1331,8 @@ static int qlogicpti_abort(struct scsi_cmnd *Cmnd) | |||
1329 | u32 cmd_cookie; | 1331 | u32 cmd_cookie; |
1330 | int i; | 1332 | int i; |
1331 | 1333 | ||
1332 | printk(KERN_WARNING "qlogicpti : Aborting cmd for tgt[%d] lun[%d]\n", | 1334 | printk(KERN_WARNING "qlogicpti%d: Aborting cmd for tgt[%d] lun[%d]\n", |
1333 | (int)Cmnd->device->id, (int)Cmnd->device->lun); | 1335 | qpti->qpti_id, (int)Cmnd->device->id, (int)Cmnd->device->lun); |
1334 | 1336 | ||
1335 | qlogicpti_disable_irqs(qpti); | 1337 | qlogicpti_disable_irqs(qpti); |
1336 | 1338 | ||
@@ -1348,7 +1350,8 @@ static int qlogicpti_abort(struct scsi_cmnd *Cmnd) | |||
1348 | param[3] = cmd_cookie & 0xffff; | 1350 | param[3] = cmd_cookie & 0xffff; |
1349 | if (qlogicpti_mbox_command(qpti, param, 0) || | 1351 | if (qlogicpti_mbox_command(qpti, param, 0) || |
1350 | (param[0] != MBOX_COMMAND_COMPLETE)) { | 1352 | (param[0] != MBOX_COMMAND_COMPLETE)) { |
1351 | printk(KERN_EMERG "qlogicpti : scsi abort failure: %x\n", param[0]); | 1353 | printk(KERN_EMERG "qlogicpti%d: scsi abort failure: %x\n", |
1354 | qpti->qpti_id, param[0]); | ||
1352 | return_status = FAILED; | 1355 | return_status = FAILED; |
1353 | } | 1356 | } |
1354 | 1357 | ||
@@ -1364,7 +1367,8 @@ static int qlogicpti_reset(struct scsi_cmnd *Cmnd) | |||
1364 | struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata; | 1367 | struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata; |
1365 | int return_status = SUCCESS; | 1368 | int return_status = SUCCESS; |
1366 | 1369 | ||
1367 | printk(KERN_WARNING "qlogicpti : Resetting SCSI bus!\n"); | 1370 | printk(KERN_WARNING "qlogicpti%d: Resetting SCSI bus!\n", |
1371 | qpti->qpti_id); | ||
1368 | 1372 | ||
1369 | qlogicpti_disable_irqs(qpti); | 1373 | qlogicpti_disable_irqs(qpti); |
1370 | 1374 | ||
@@ -1372,7 +1376,8 @@ static int qlogicpti_reset(struct scsi_cmnd *Cmnd) | |||
1372 | param[1] = qpti->host_param.bus_reset_delay; | 1376 | param[1] = qpti->host_param.bus_reset_delay; |
1373 | if (qlogicpti_mbox_command(qpti, param, 0) || | 1377 | if (qlogicpti_mbox_command(qpti, param, 0) || |
1374 | (param[0] != MBOX_COMMAND_COMPLETE)) { | 1378 | (param[0] != MBOX_COMMAND_COMPLETE)) { |
1375 | printk(KERN_EMERG "qlogicisp : scsi bus reset failure: %x\n", param[0]); | 1379 | printk(KERN_EMERG "qlogicisp%d: scsi bus reset failure: %x\n", |
1380 | qpti->qpti_id, param[0]); | ||
1376 | return_status = FAILED; | 1381 | return_status = FAILED; |
1377 | } | 1382 | } |
1378 | 1383 | ||
@@ -1454,22 +1459,25 @@ static int __devinit qpti_sbus_probe(struct of_device *dev, const struct of_devi | |||
1454 | if (qlogicpti_reset_hardware(host)) | 1459 | if (qlogicpti_reset_hardware(host)) |
1455 | goto fail_unmap_queues; | 1460 | goto fail_unmap_queues; |
1456 | 1461 | ||
1457 | if (scsi_add_host(host, &dev->dev)) | ||
1458 | goto fail_unmap_queues; | ||
1459 | |||
1460 | printk("(Firmware v%d.%d.%d)", qpti->fware_majrev, | 1462 | printk("(Firmware v%d.%d.%d)", qpti->fware_majrev, |
1461 | qpti->fware_minrev, qpti->fware_micrev); | 1463 | qpti->fware_minrev, qpti->fware_micrev); |
1462 | 1464 | ||
1463 | fcode = of_get_property(dp, "isp-fcode", NULL); | 1465 | fcode = of_get_property(dp, "isp-fcode", NULL); |
1464 | if (fcode && fcode[0]) | 1466 | if (fcode && fcode[0]) |
1465 | printk("(Firmware %s)", fcode); | 1467 | printk("(FCode %s)", fcode); |
1466 | if (of_find_property(dp, "differential", NULL) != NULL) | 1468 | if (of_find_property(dp, "differential", NULL) != NULL) |
1467 | qpti->differential = 1; | 1469 | qpti->differential = 1; |
1468 | 1470 | ||
1469 | printk (" [%s Wide, using %s interface]\n", | 1471 | printk("\nqlogicpti%d: [%s Wide, using %s interface]\n", |
1472 | qpti->qpti_id, | ||
1470 | (qpti->ultra ? "Ultra" : "Fast"), | 1473 | (qpti->ultra ? "Ultra" : "Fast"), |
1471 | (qpti->differential ? "differential" : "single ended")); | 1474 | (qpti->differential ? "differential" : "single ended")); |
1472 | 1475 | ||
1476 | if (scsi_add_host(host, &dev->dev)) { | ||
1477 | printk("qlogicpti%d: Failed scsi_add_host\n", qpti->qpti_id); | ||
1478 | goto fail_unmap_queues; | ||
1479 | } | ||
1480 | |||
1473 | dev_set_drvdata(&sdev->ofdev.dev, qpti); | 1481 | dev_set_drvdata(&sdev->ofdev.dev, qpti); |
1474 | 1482 | ||
1475 | qpti_chain_add(qpti); | 1483 | qpti_chain_add(qpti); |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 21c075d44db1..a417a6ff9f97 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1038,22 +1038,6 @@ static int scsi_init_io(struct scsi_cmnd *cmd) | |||
1038 | return BLKPREP_KILL; | 1038 | return BLKPREP_KILL; |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | static int scsi_issue_flush_fn(struct request_queue *q, struct gendisk *disk, | ||
1042 | sector_t *error_sector) | ||
1043 | { | ||
1044 | struct scsi_device *sdev = q->queuedata; | ||
1045 | struct scsi_driver *drv; | ||
1046 | |||
1047 | if (sdev->sdev_state != SDEV_RUNNING) | ||
1048 | return -ENXIO; | ||
1049 | |||
1050 | drv = *(struct scsi_driver **) disk->private_data; | ||
1051 | if (drv->issue_flush) | ||
1052 | return drv->issue_flush(&sdev->sdev_gendev, error_sector); | ||
1053 | |||
1054 | return -EOPNOTSUPP; | ||
1055 | } | ||
1056 | |||
1057 | static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev, | 1041 | static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev, |
1058 | struct request *req) | 1042 | struct request *req) |
1059 | { | 1043 | { |
@@ -1596,7 +1580,6 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev) | |||
1596 | return NULL; | 1580 | return NULL; |
1597 | 1581 | ||
1598 | blk_queue_prep_rq(q, scsi_prep_fn); | 1582 | blk_queue_prep_rq(q, scsi_prep_fn); |
1599 | blk_queue_issue_flush_fn(q, scsi_issue_flush_fn); | ||
1600 | blk_queue_softirq_done(q, scsi_softirq_done); | 1583 | blk_queue_softirq_done(q, scsi_softirq_done); |
1601 | return q; | 1584 | return q; |
1602 | } | 1585 | } |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index e21c7142a3ea..2c6116fd4578 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -241,7 +241,6 @@ static struct scsi_driver sd_template = { | |||
241 | }, | 241 | }, |
242 | .rescan = sd_rescan, | 242 | .rescan = sd_rescan, |
243 | .init_command = sd_init_command, | 243 | .init_command = sd_init_command, |
244 | .issue_flush = sd_issue_flush, | ||
245 | }; | 244 | }; |
246 | 245 | ||
247 | /* | 246 | /* |
@@ -800,10 +799,17 @@ static int sd_sync_cache(struct scsi_disk *sdkp) | |||
800 | return 0; | 799 | return 0; |
801 | } | 800 | } |
802 | 801 | ||
803 | static int sd_issue_flush(struct device *dev, sector_t *error_sector) | 802 | static int sd_issue_flush(struct request_queue *q, struct gendisk *disk, |
803 | sector_t *error_sector) | ||
804 | { | 804 | { |
805 | int ret = 0; | 805 | int ret = 0; |
806 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); | 806 | struct scsi_device *sdp = q->queuedata; |
807 | struct scsi_disk *sdkp; | ||
808 | |||
809 | if (sdp->sdev_state != SDEV_RUNNING) | ||
810 | return -ENXIO; | ||
811 | |||
812 | sdkp = scsi_disk_get_from_dev(&sdp->sdev_gendev); | ||
807 | 813 | ||
808 | if (!sdkp) | 814 | if (!sdkp) |
809 | return -ENODEV; | 815 | return -ENODEV; |
@@ -1663,6 +1669,8 @@ static int sd_probe(struct device *dev) | |||
1663 | 1669 | ||
1664 | sd_revalidate_disk(gd); | 1670 | sd_revalidate_disk(gd); |
1665 | 1671 | ||
1672 | blk_queue_issue_flush_fn(sdp->request_queue, sd_issue_flush); | ||
1673 | |||
1666 | gd->driverfs_dev = &sdp->sdev_gendev; | 1674 | gd->driverfs_dev = &sdp->sdev_gendev; |
1667 | gd->flags = GENHD_FL_DRIVERFS; | 1675 | gd->flags = GENHD_FL_DRIVERFS; |
1668 | if (sdp->removable) | 1676 | if (sdp->removable) |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index a4f7b8465773..73c44cbdea47 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -1485,7 +1485,7 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) | |||
1485 | struct st_buffer *STbp; | 1485 | struct st_buffer *STbp; |
1486 | char *name = tape_name(STp); | 1486 | char *name = tape_name(STp); |
1487 | 1487 | ||
1488 | if (down_interruptible(&STp->lock)) | 1488 | if (mutex_lock_interruptible(&STp->lock)) |
1489 | return -ERESTARTSYS; | 1489 | return -ERESTARTSYS; |
1490 | 1490 | ||
1491 | retval = rw_checks(STp, filp, count); | 1491 | retval = rw_checks(STp, filp, count); |
@@ -1736,7 +1736,7 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) | |||
1736 | if (SRpnt != NULL) | 1736 | if (SRpnt != NULL) |
1737 | st_release_request(SRpnt); | 1737 | st_release_request(SRpnt); |
1738 | release_buffering(STp, 0); | 1738 | release_buffering(STp, 0); |
1739 | up(&STp->lock); | 1739 | mutex_unlock(&STp->lock); |
1740 | 1740 | ||
1741 | return retval; | 1741 | return retval; |
1742 | } | 1742 | } |
@@ -1942,7 +1942,7 @@ st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) | |||
1942 | struct st_buffer *STbp = STp->buffer; | 1942 | struct st_buffer *STbp = STp->buffer; |
1943 | DEB( char *name = tape_name(STp); ) | 1943 | DEB( char *name = tape_name(STp); ) |
1944 | 1944 | ||
1945 | if (down_interruptible(&STp->lock)) | 1945 | if (mutex_lock_interruptible(&STp->lock)) |
1946 | return -ERESTARTSYS; | 1946 | return -ERESTARTSYS; |
1947 | 1947 | ||
1948 | retval = rw_checks(STp, filp, count); | 1948 | retval = rw_checks(STp, filp, count); |
@@ -2069,7 +2069,7 @@ st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) | |||
2069 | release_buffering(STp, 1); | 2069 | release_buffering(STp, 1); |
2070 | STbp->buffer_bytes = 0; | 2070 | STbp->buffer_bytes = 0; |
2071 | } | 2071 | } |
2072 | up(&STp->lock); | 2072 | mutex_unlock(&STp->lock); |
2073 | 2073 | ||
2074 | return retval; | 2074 | return retval; |
2075 | } | 2075 | } |
@@ -3226,7 +3226,7 @@ static int st_ioctl(struct inode *inode, struct file *file, | |||
3226 | char *name = tape_name(STp); | 3226 | char *name = tape_name(STp); |
3227 | void __user *p = (void __user *)arg; | 3227 | void __user *p = (void __user *)arg; |
3228 | 3228 | ||
3229 | if (down_interruptible(&STp->lock)) | 3229 | if (mutex_lock_interruptible(&STp->lock)) |
3230 | return -ERESTARTSYS; | 3230 | return -ERESTARTSYS; |
3231 | 3231 | ||
3232 | DEB( | 3232 | DEB( |
@@ -3537,7 +3537,7 @@ static int st_ioctl(struct inode *inode, struct file *file, | |||
3537 | retval = (-EFAULT); | 3537 | retval = (-EFAULT); |
3538 | goto out; | 3538 | goto out; |
3539 | } | 3539 | } |
3540 | up(&STp->lock); | 3540 | mutex_unlock(&STp->lock); |
3541 | switch (cmd_in) { | 3541 | switch (cmd_in) { |
3542 | case SCSI_IOCTL_GET_IDLUN: | 3542 | case SCSI_IOCTL_GET_IDLUN: |
3543 | case SCSI_IOCTL_GET_BUS_NUMBER: | 3543 | case SCSI_IOCTL_GET_BUS_NUMBER: |
@@ -3563,7 +3563,7 @@ static int st_ioctl(struct inode *inode, struct file *file, | |||
3563 | return retval; | 3563 | return retval; |
3564 | 3564 | ||
3565 | out: | 3565 | out: |
3566 | up(&STp->lock); | 3566 | mutex_unlock(&STp->lock); |
3567 | return retval; | 3567 | return retval; |
3568 | } | 3568 | } |
3569 | 3569 | ||
@@ -4029,7 +4029,7 @@ static int st_probe(struct device *dev) | |||
4029 | 4029 | ||
4030 | tpnt->density_changed = tpnt->compression_changed = | 4030 | tpnt->density_changed = tpnt->compression_changed = |
4031 | tpnt->blksize_changed = 0; | 4031 | tpnt->blksize_changed = 0; |
4032 | init_MUTEX(&tpnt->lock); | 4032 | mutex_init(&tpnt->lock); |
4033 | 4033 | ||
4034 | st_nr_dev++; | 4034 | st_nr_dev++; |
4035 | write_unlock(&st_dev_arr_lock); | 4035 | write_unlock(&st_dev_arr_lock); |
diff --git a/drivers/scsi/st.h b/drivers/scsi/st.h index 50f3deb1f9ed..6c8075712974 100644 --- a/drivers/scsi/st.h +++ b/drivers/scsi/st.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #define _ST_H | 3 | #define _ST_H |
4 | 4 | ||
5 | #include <linux/completion.h> | 5 | #include <linux/completion.h> |
6 | #include <linux/mutex.h> | ||
6 | #include <linux/kref.h> | 7 | #include <linux/kref.h> |
7 | #include <scsi/scsi_cmnd.h> | 8 | #include <scsi/scsi_cmnd.h> |
8 | 9 | ||
@@ -98,7 +99,7 @@ struct st_partstat { | |||
98 | struct scsi_tape { | 99 | struct scsi_tape { |
99 | struct scsi_driver *driver; | 100 | struct scsi_driver *driver; |
100 | struct scsi_device *device; | 101 | struct scsi_device *device; |
101 | struct semaphore lock; /* For serialization */ | 102 | struct mutex lock; /* For serialization */ |
102 | struct completion wait; /* For SCSI commands */ | 103 | struct completion wait; /* For SCSI commands */ |
103 | struct st_buffer *buffer; | 104 | struct st_buffer *buffer; |
104 | 105 | ||
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 2f5a5ac1b271..f94109cbb46e 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -129,7 +129,16 @@ struct uart_8250_port { | |||
129 | unsigned char mcr; | 129 | unsigned char mcr; |
130 | unsigned char mcr_mask; /* mask of user bits */ | 130 | unsigned char mcr_mask; /* mask of user bits */ |
131 | unsigned char mcr_force; /* mask of forced bits */ | 131 | unsigned char mcr_force; /* mask of forced bits */ |
132 | unsigned char lsr_break_flag; | 132 | |
133 | /* | ||
134 | * Some bits in registers are cleared on a read, so they must | ||
135 | * be saved whenever the register is read but the bits will not | ||
136 | * be immediately processed. | ||
137 | */ | ||
138 | #define LSR_SAVE_FLAGS UART_LSR_BRK_ERROR_BITS | ||
139 | unsigned char lsr_saved_flags; | ||
140 | #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA | ||
141 | unsigned char msr_saved_flags; | ||
133 | 142 | ||
134 | /* | 143 | /* |
135 | * We provide a per-port pm hook. | 144 | * We provide a per-port pm hook. |
@@ -1238,6 +1247,7 @@ static void serial8250_start_tx(struct uart_port *port) | |||
1238 | if (up->bugs & UART_BUG_TXEN) { | 1247 | if (up->bugs & UART_BUG_TXEN) { |
1239 | unsigned char lsr, iir; | 1248 | unsigned char lsr, iir; |
1240 | lsr = serial_in(up, UART_LSR); | 1249 | lsr = serial_in(up, UART_LSR); |
1250 | up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; | ||
1241 | iir = serial_in(up, UART_IIR) & 0x0f; | 1251 | iir = serial_in(up, UART_IIR) & 0x0f; |
1242 | if ((up->port.type == PORT_RM9000) ? | 1252 | if ((up->port.type == PORT_RM9000) ? |
1243 | (lsr & UART_LSR_THRE && | 1253 | (lsr & UART_LSR_THRE && |
@@ -1290,18 +1300,10 @@ receive_chars(struct uart_8250_port *up, unsigned int *status) | |||
1290 | flag = TTY_NORMAL; | 1300 | flag = TTY_NORMAL; |
1291 | up->port.icount.rx++; | 1301 | up->port.icount.rx++; |
1292 | 1302 | ||
1293 | #ifdef CONFIG_SERIAL_8250_CONSOLE | 1303 | lsr |= up->lsr_saved_flags; |
1294 | /* | 1304 | up->lsr_saved_flags = 0; |
1295 | * Recover the break flag from console xmit | ||
1296 | */ | ||
1297 | if (up->port.line == up->port.cons->index) { | ||
1298 | lsr |= up->lsr_break_flag; | ||
1299 | up->lsr_break_flag = 0; | ||
1300 | } | ||
1301 | #endif | ||
1302 | 1305 | ||
1303 | if (unlikely(lsr & (UART_LSR_BI | UART_LSR_PE | | 1306 | if (unlikely(lsr & UART_LSR_BRK_ERROR_BITS)) { |
1304 | UART_LSR_FE | UART_LSR_OE))) { | ||
1305 | /* | 1307 | /* |
1306 | * For statistics only | 1308 | * For statistics only |
1307 | */ | 1309 | */ |
@@ -1392,6 +1394,8 @@ static unsigned int check_modem_status(struct uart_8250_port *up) | |||
1392 | { | 1394 | { |
1393 | unsigned int status = serial_in(up, UART_MSR); | 1395 | unsigned int status = serial_in(up, UART_MSR); |
1394 | 1396 | ||
1397 | status |= up->msr_saved_flags; | ||
1398 | up->msr_saved_flags = 0; | ||
1395 | if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI && | 1399 | if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI && |
1396 | up->port.info != NULL) { | 1400 | up->port.info != NULL) { |
1397 | if (status & UART_MSR_TERI) | 1401 | if (status & UART_MSR_TERI) |
@@ -1591,7 +1595,8 @@ static void serial8250_timeout(unsigned long data) | |||
1591 | static void serial8250_backup_timeout(unsigned long data) | 1595 | static void serial8250_backup_timeout(unsigned long data) |
1592 | { | 1596 | { |
1593 | struct uart_8250_port *up = (struct uart_8250_port *)data; | 1597 | struct uart_8250_port *up = (struct uart_8250_port *)data; |
1594 | unsigned int iir, ier = 0; | 1598 | unsigned int iir, ier = 0, lsr; |
1599 | unsigned long flags; | ||
1595 | 1600 | ||
1596 | /* | 1601 | /* |
1597 | * Must disable interrupts or else we risk racing with the interrupt | 1602 | * Must disable interrupts or else we risk racing with the interrupt |
@@ -1610,9 +1615,13 @@ static void serial8250_backup_timeout(unsigned long data) | |||
1610 | * the "Diva" UART used on the management processor on many HP | 1615 | * the "Diva" UART used on the management processor on many HP |
1611 | * ia64 and parisc boxes. | 1616 | * ia64 and parisc boxes. |
1612 | */ | 1617 | */ |
1618 | spin_lock_irqsave(&up->port.lock, flags); | ||
1619 | lsr = serial_in(up, UART_LSR); | ||
1620 | up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; | ||
1621 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
1613 | if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) && | 1622 | if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) && |
1614 | (!uart_circ_empty(&up->port.info->xmit) || up->port.x_char) && | 1623 | (!uart_circ_empty(&up->port.info->xmit) || up->port.x_char) && |
1615 | (serial_in(up, UART_LSR) & UART_LSR_THRE)) { | 1624 | (lsr & UART_LSR_THRE)) { |
1616 | iir &= ~(UART_IIR_ID | UART_IIR_NO_INT); | 1625 | iir &= ~(UART_IIR_ID | UART_IIR_NO_INT); |
1617 | iir |= UART_IIR_THRI; | 1626 | iir |= UART_IIR_THRI; |
1618 | } | 1627 | } |
@@ -1631,13 +1640,14 @@ static unsigned int serial8250_tx_empty(struct uart_port *port) | |||
1631 | { | 1640 | { |
1632 | struct uart_8250_port *up = (struct uart_8250_port *)port; | 1641 | struct uart_8250_port *up = (struct uart_8250_port *)port; |
1633 | unsigned long flags; | 1642 | unsigned long flags; |
1634 | unsigned int ret; | 1643 | unsigned int lsr; |
1635 | 1644 | ||
1636 | spin_lock_irqsave(&up->port.lock, flags); | 1645 | spin_lock_irqsave(&up->port.lock, flags); |
1637 | ret = serial_in(up, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0; | 1646 | lsr = serial_in(up, UART_LSR); |
1647 | up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; | ||
1638 | spin_unlock_irqrestore(&up->port.lock, flags); | 1648 | spin_unlock_irqrestore(&up->port.lock, flags); |
1639 | 1649 | ||
1640 | return ret; | 1650 | return lsr & UART_LSR_TEMT ? TIOCSER_TEMT : 0; |
1641 | } | 1651 | } |
1642 | 1652 | ||
1643 | static unsigned int serial8250_get_mctrl(struct uart_port *port) | 1653 | static unsigned int serial8250_get_mctrl(struct uart_port *port) |
@@ -1708,8 +1718,7 @@ static inline void wait_for_xmitr(struct uart_8250_port *up, int bits) | |||
1708 | do { | 1718 | do { |
1709 | status = serial_in(up, UART_LSR); | 1719 | status = serial_in(up, UART_LSR); |
1710 | 1720 | ||
1711 | if (status & UART_LSR_BI) | 1721 | up->lsr_saved_flags |= status & LSR_SAVE_FLAGS; |
1712 | up->lsr_break_flag = UART_LSR_BI; | ||
1713 | 1722 | ||
1714 | if (--tmout == 0) | 1723 | if (--tmout == 0) |
1715 | break; | 1724 | break; |
@@ -1718,8 +1727,12 @@ static inline void wait_for_xmitr(struct uart_8250_port *up, int bits) | |||
1718 | 1727 | ||
1719 | /* Wait up to 1s for flow control if necessary */ | 1728 | /* Wait up to 1s for flow control if necessary */ |
1720 | if (up->port.flags & UPF_CONS_FLOW) { | 1729 | if (up->port.flags & UPF_CONS_FLOW) { |
1721 | tmout = 1000000; | 1730 | unsigned int tmout; |
1722 | while (!(serial_in(up, UART_MSR) & UART_MSR_CTS) && --tmout) { | 1731 | for (tmout = 1000000; tmout; tmout--) { |
1732 | unsigned int msr = serial_in(up, UART_MSR); | ||
1733 | up->msr_saved_flags |= msr & MSR_SAVE_FLAGS; | ||
1734 | if (msr & UART_MSR_CTS) | ||
1735 | break; | ||
1723 | udelay(1); | 1736 | udelay(1); |
1724 | touch_nmi_watchdog(); | 1737 | touch_nmi_watchdog(); |
1725 | } | 1738 | } |
@@ -1889,6 +1902,18 @@ static int serial8250_startup(struct uart_port *port) | |||
1889 | spin_unlock_irqrestore(&up->port.lock, flags); | 1902 | spin_unlock_irqrestore(&up->port.lock, flags); |
1890 | 1903 | ||
1891 | /* | 1904 | /* |
1905 | * Clear the interrupt registers again for luck, and clear the | ||
1906 | * saved flags to avoid getting false values from polling | ||
1907 | * routines or the previous session. | ||
1908 | */ | ||
1909 | serial_inp(up, UART_LSR); | ||
1910 | serial_inp(up, UART_RX); | ||
1911 | serial_inp(up, UART_IIR); | ||
1912 | serial_inp(up, UART_MSR); | ||
1913 | up->lsr_saved_flags = 0; | ||
1914 | up->msr_saved_flags = 0; | ||
1915 | |||
1916 | /* | ||
1892 | * Finally, enable interrupts. Note: Modem status interrupts | 1917 | * Finally, enable interrupts. Note: Modem status interrupts |
1893 | * are set via set_termios(), which will be occurring imminently | 1918 | * are set via set_termios(), which will be occurring imminently |
1894 | * anyway, so we don't enable them here. | 1919 | * anyway, so we don't enable them here. |
@@ -1906,14 +1931,6 @@ static int serial8250_startup(struct uart_port *port) | |||
1906 | (void) inb_p(icp); | 1931 | (void) inb_p(icp); |
1907 | } | 1932 | } |
1908 | 1933 | ||
1909 | /* | ||
1910 | * And clear the interrupt registers again for luck. | ||
1911 | */ | ||
1912 | (void) serial_inp(up, UART_LSR); | ||
1913 | (void) serial_inp(up, UART_RX); | ||
1914 | (void) serial_inp(up, UART_IIR); | ||
1915 | (void) serial_inp(up, UART_MSR); | ||
1916 | |||
1917 | return 0; | 1934 | return 0; |
1918 | } | 1935 | } |
1919 | 1936 | ||
@@ -2484,6 +2501,16 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
2484 | wait_for_xmitr(up, BOTH_EMPTY); | 2501 | wait_for_xmitr(up, BOTH_EMPTY); |
2485 | serial_out(up, UART_IER, ier); | 2502 | serial_out(up, UART_IER, ier); |
2486 | 2503 | ||
2504 | /* | ||
2505 | * The receive handling will happen properly because the | ||
2506 | * receive ready bit will still be set; it is not cleared | ||
2507 | * on read. However, modem control will not, we must | ||
2508 | * call it if we have saved something in the saved flags | ||
2509 | * while processing with interrupts off. | ||
2510 | */ | ||
2511 | if (up->msr_saved_flags) | ||
2512 | check_modem_status(up); | ||
2513 | |||
2487 | if (locked) | 2514 | if (locked) |
2488 | spin_unlock(&up->port.lock); | 2515 | spin_unlock(&up->port.lock); |
2489 | local_irq_restore(flags); | 2516 | local_irq_restore(flags); |
@@ -2514,7 +2541,7 @@ static int __init serial8250_console_setup(struct console *co, char *options) | |||
2514 | return uart_set_options(port, co, baud, parity, bits, flow); | 2541 | return uart_set_options(port, co, baud, parity, bits, flow); |
2515 | } | 2542 | } |
2516 | 2543 | ||
2517 | static int __init serial8250_console_early_setup(void) | 2544 | static int serial8250_console_early_setup(void) |
2518 | { | 2545 | { |
2519 | return serial8250_find_port_for_earlycon(); | 2546 | return serial8250_find_port_for_earlycon(); |
2520 | } | 2547 | } |
diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c index 150cad5c2eba..4d4c9f01be8d 100644 --- a/drivers/serial/8250_early.c +++ b/drivers/serial/8250_early.c | |||
@@ -227,7 +227,7 @@ int __init setup_early_serial8250_console(char *cmdline) | |||
227 | return 0; | 227 | return 0; |
228 | } | 228 | } |
229 | 229 | ||
230 | int __init serial8250_find_port_for_earlycon(void) | 230 | int serial8250_find_port_for_earlycon(void) |
231 | { | 231 | { |
232 | struct early_serial8250_device *device = &early_device; | 232 | struct early_serial8250_device *device = &early_device; |
233 | struct uart_port *port = &device->port; | 233 | struct uart_port *port = &device->port; |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 5e485876f54c..bd66339f7a3f 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -580,6 +580,138 @@ static int pci_netmos_init(struct pci_dev *dev) | |||
580 | return num_serial; | 580 | return num_serial; |
581 | } | 581 | } |
582 | 582 | ||
583 | /* | ||
584 | * ITE support by Niels de Vos <niels.devos@wincor-nixdorf.com> | ||
585 | * | ||
586 | * These chips are available with optionally one parallel port and up to | ||
587 | * two serial ports. Unfortunately they all have the same product id. | ||
588 | * | ||
589 | * Basic configuration is done over a region of 32 I/O ports. The base | ||
590 | * ioport is called INTA or INTC, depending on docs/other drivers. | ||
591 | * | ||
592 | * The region of the 32 I/O ports is configured in POSIO0R... | ||
593 | */ | ||
594 | |||
595 | /* registers */ | ||
596 | #define ITE_887x_MISCR 0x9c | ||
597 | #define ITE_887x_INTCBAR 0x78 | ||
598 | #define ITE_887x_UARTBAR 0x7c | ||
599 | #define ITE_887x_PS0BAR 0x10 | ||
600 | #define ITE_887x_POSIO0 0x60 | ||
601 | |||
602 | /* I/O space size */ | ||
603 | #define ITE_887x_IOSIZE 32 | ||
604 | /* I/O space size (bits 26-24; 8 bytes = 011b) */ | ||
605 | #define ITE_887x_POSIO_IOSIZE_8 (3 << 24) | ||
606 | /* I/O space size (bits 26-24; 32 bytes = 101b) */ | ||
607 | #define ITE_887x_POSIO_IOSIZE_32 (5 << 24) | ||
608 | /* Decoding speed (1 = slow, 2 = medium, 3 = fast) */ | ||
609 | #define ITE_887x_POSIO_SPEED (3 << 29) | ||
610 | /* enable IO_Space bit */ | ||
611 | #define ITE_887x_POSIO_ENABLE (1 << 31) | ||
612 | |||
613 | static int __devinit pci_ite887x_init(struct pci_dev *dev) | ||
614 | { | ||
615 | /* inta_addr are the configuration addresses of the ITE */ | ||
616 | static const short inta_addr[] = { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0, | ||
617 | 0x200, 0x280, 0 }; | ||
618 | int ret, i, type; | ||
619 | struct resource *iobase = NULL; | ||
620 | u32 miscr, uartbar, ioport; | ||
621 | |||
622 | /* search for the base-ioport */ | ||
623 | i = 0; | ||
624 | while (inta_addr[i] && iobase == NULL) { | ||
625 | iobase = request_region(inta_addr[i], ITE_887x_IOSIZE, | ||
626 | "ite887x"); | ||
627 | if (iobase != NULL) { | ||
628 | /* write POSIO0R - speed | size | ioport */ | ||
629 | pci_write_config_dword(dev, ITE_887x_POSIO0, | ||
630 | ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED | | ||
631 | ITE_887x_POSIO_IOSIZE_32 | inta_addr[i]); | ||
632 | /* write INTCBAR - ioport */ | ||
633 | pci_write_config_dword(dev, ITE_887x_INTCBAR, inta_addr[i]); | ||
634 | ret = inb(inta_addr[i]); | ||
635 | if (ret != 0xff) { | ||
636 | /* ioport connected */ | ||
637 | break; | ||
638 | } | ||
639 | release_region(iobase->start, ITE_887x_IOSIZE); | ||
640 | iobase = NULL; | ||
641 | } | ||
642 | i++; | ||
643 | } | ||
644 | |||
645 | if (!inta_addr[i]) { | ||
646 | printk(KERN_ERR "ite887x: could not find iobase\n"); | ||
647 | return -ENODEV; | ||
648 | } | ||
649 | |||
650 | /* start of undocumented type checking (see parport_pc.c) */ | ||
651 | type = inb(iobase->start + 0x18) & 0x0f; | ||
652 | |||
653 | switch (type) { | ||
654 | case 0x2: /* ITE8871 (1P) */ | ||
655 | case 0xa: /* ITE8875 (1P) */ | ||
656 | ret = 0; | ||
657 | break; | ||
658 | case 0xe: /* ITE8872 (2S1P) */ | ||
659 | ret = 2; | ||
660 | break; | ||
661 | case 0x6: /* ITE8873 (1S) */ | ||
662 | ret = 1; | ||
663 | break; | ||
664 | case 0x8: /* ITE8874 (2S) */ | ||
665 | ret = 2; | ||
666 | break; | ||
667 | default: | ||
668 | moan_device("Unknown ITE887x", dev); | ||
669 | ret = -ENODEV; | ||
670 | } | ||
671 | |||
672 | /* configure all serial ports */ | ||
673 | for (i = 0; i < ret; i++) { | ||
674 | /* read the I/O port from the device */ | ||
675 | pci_read_config_dword(dev, ITE_887x_PS0BAR + (0x4 * (i + 1)), | ||
676 | &ioport); | ||
677 | ioport &= 0x0000FF00; /* the actual base address */ | ||
678 | pci_write_config_dword(dev, ITE_887x_POSIO0 + (0x4 * (i + 1)), | ||
679 | ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED | | ||
680 | ITE_887x_POSIO_IOSIZE_8 | ioport); | ||
681 | |||
682 | /* write the ioport to the UARTBAR */ | ||
683 | pci_read_config_dword(dev, ITE_887x_UARTBAR, &uartbar); | ||
684 | uartbar &= ~(0xffff << (16 * i)); /* clear half the reg */ | ||
685 | uartbar |= (ioport << (16 * i)); /* set the ioport */ | ||
686 | pci_write_config_dword(dev, ITE_887x_UARTBAR, uartbar); | ||
687 | |||
688 | /* get current config */ | ||
689 | pci_read_config_dword(dev, ITE_887x_MISCR, &miscr); | ||
690 | /* disable interrupts (UARTx_Routing[3:0]) */ | ||
691 | miscr &= ~(0xf << (12 - 4 * i)); | ||
692 | /* activate the UART (UARTx_En) */ | ||
693 | miscr |= 1 << (23 - i); | ||
694 | /* write new config with activated UART */ | ||
695 | pci_write_config_dword(dev, ITE_887x_MISCR, miscr); | ||
696 | } | ||
697 | |||
698 | if (ret <= 0) { | ||
699 | /* the device has no UARTs if we get here */ | ||
700 | release_region(iobase->start, ITE_887x_IOSIZE); | ||
701 | } | ||
702 | |||
703 | return ret; | ||
704 | } | ||
705 | |||
706 | static void __devexit pci_ite887x_exit(struct pci_dev *dev) | ||
707 | { | ||
708 | u32 ioport; | ||
709 | /* the ioport is bit 0-15 in POSIO0R */ | ||
710 | pci_read_config_dword(dev, ITE_887x_POSIO0, &ioport); | ||
711 | ioport &= 0xffff; | ||
712 | release_region(ioport, ITE_887x_IOSIZE); | ||
713 | } | ||
714 | |||
583 | static int | 715 | static int |
584 | pci_default_setup(struct serial_private *priv, struct pciserial_board *board, | 716 | pci_default_setup(struct serial_private *priv, struct pciserial_board *board, |
585 | struct uart_port *port, int idx) | 717 | struct uart_port *port, int idx) |
@@ -653,6 +785,18 @@ static struct pci_serial_quirk pci_serial_quirks[] = { | |||
653 | .setup = pci_default_setup, | 785 | .setup = pci_default_setup, |
654 | }, | 786 | }, |
655 | /* | 787 | /* |
788 | * ITE | ||
789 | */ | ||
790 | { | ||
791 | .vendor = PCI_VENDOR_ID_ITE, | ||
792 | .device = PCI_DEVICE_ID_ITE_8872, | ||
793 | .subvendor = PCI_ANY_ID, | ||
794 | .subdevice = PCI_ANY_ID, | ||
795 | .init = pci_ite887x_init, | ||
796 | .setup = pci_default_setup, | ||
797 | .exit = __devexit_p(pci_ite887x_exit), | ||
798 | }, | ||
799 | /* | ||
656 | * Panacom | 800 | * Panacom |
657 | */ | 801 | */ |
658 | { | 802 | { |
@@ -933,6 +1077,7 @@ enum pci_board_num_t { | |||
933 | 1077 | ||
934 | pbn_b1_2_1250000, | 1078 | pbn_b1_2_1250000, |
935 | 1079 | ||
1080 | pbn_b1_bt_1_115200, | ||
936 | pbn_b1_bt_2_921600, | 1081 | pbn_b1_bt_2_921600, |
937 | 1082 | ||
938 | pbn_b1_1_1382400, | 1083 | pbn_b1_1_1382400, |
@@ -983,6 +1128,7 @@ enum pci_board_num_t { | |||
983 | pbn_exar_XR17C152, | 1128 | pbn_exar_XR17C152, |
984 | pbn_exar_XR17C154, | 1129 | pbn_exar_XR17C154, |
985 | pbn_exar_XR17C158, | 1130 | pbn_exar_XR17C158, |
1131 | pbn_pasemi_1682M, | ||
986 | }; | 1132 | }; |
987 | 1133 | ||
988 | /* | 1134 | /* |
@@ -1211,6 +1357,13 @@ static struct pciserial_board pci_boards[] __devinitdata = { | |||
1211 | .uart_offset = 8, | 1357 | .uart_offset = 8, |
1212 | }, | 1358 | }, |
1213 | 1359 | ||
1360 | [pbn_b1_bt_1_115200] = { | ||
1361 | .flags = FL_BASE1|FL_BASE_BARS, | ||
1362 | .num_ports = 1, | ||
1363 | .base_baud = 115200, | ||
1364 | .uart_offset = 8, | ||
1365 | }, | ||
1366 | |||
1214 | [pbn_b1_bt_2_921600] = { | 1367 | [pbn_b1_bt_2_921600] = { |
1215 | .flags = FL_BASE1|FL_BASE_BARS, | 1368 | .flags = FL_BASE1|FL_BASE_BARS, |
1216 | .num_ports = 2, | 1369 | .num_ports = 2, |
@@ -1498,6 +1651,18 @@ static struct pciserial_board pci_boards[] __devinitdata = { | |||
1498 | .base_baud = 921600, | 1651 | .base_baud = 921600, |
1499 | .uart_offset = 0x200, | 1652 | .uart_offset = 0x200, |
1500 | }, | 1653 | }, |
1654 | /* | ||
1655 | * PA Semi PWRficient PA6T-1682M on-chip UART | ||
1656 | */ | ||
1657 | [pbn_pasemi_1682M] = { | ||
1658 | .flags = FL_BASE0, | ||
1659 | .num_ports = 1, | ||
1660 | .base_baud = 8333333, | ||
1661 | }, | ||
1662 | }; | ||
1663 | |||
1664 | static const struct pci_device_id softmodem_blacklist[] = { | ||
1665 | { PCI_VDEVICE ( AL, 0x5457 ), }, /* ALi Corporation M5457 AC'97 Modem */ | ||
1501 | }; | 1666 | }; |
1502 | 1667 | ||
1503 | /* | 1668 | /* |
@@ -1508,6 +1673,7 @@ static struct pciserial_board pci_boards[] __devinitdata = { | |||
1508 | static int __devinit | 1673 | static int __devinit |
1509 | serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board) | 1674 | serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board) |
1510 | { | 1675 | { |
1676 | const struct pci_device_id *blacklist; | ||
1511 | int num_iomem, num_port, first_port = -1, i; | 1677 | int num_iomem, num_port, first_port = -1, i; |
1512 | 1678 | ||
1513 | /* | 1679 | /* |
@@ -1522,6 +1688,18 @@ serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board) | |||
1522 | (dev->class & 0xff) > 6) | 1688 | (dev->class & 0xff) > 6) |
1523 | return -ENODEV; | 1689 | return -ENODEV; |
1524 | 1690 | ||
1691 | /* | ||
1692 | * Do not access blacklisted devices that are known not to | ||
1693 | * feature serial ports. | ||
1694 | */ | ||
1695 | for (blacklist = softmodem_blacklist; | ||
1696 | blacklist < softmodem_blacklist + ARRAY_SIZE(softmodem_blacklist); | ||
1697 | blacklist++) { | ||
1698 | if (dev->vendor == blacklist->vendor && | ||
1699 | dev->device == blacklist->device) | ||
1700 | return -ENODEV; | ||
1701 | } | ||
1702 | |||
1525 | num_iomem = num_port = 0; | 1703 | num_iomem = num_port = 0; |
1526 | for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) { | 1704 | for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) { |
1527 | if (pci_resource_flags(dev, i) & IORESOURCE_IO) { | 1705 | if (pci_resource_flags(dev, i) & IORESOURCE_IO) { |
@@ -2364,6 +2542,13 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
2364 | { PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560, | 2542 | { PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560, |
2365 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 2543 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
2366 | pbn_b0_1_115200 }, | 2544 | pbn_b0_1_115200 }, |
2545 | /* | ||
2546 | * ITE | ||
2547 | */ | ||
2548 | { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8872, | ||
2549 | PCI_ANY_ID, PCI_ANY_ID, | ||
2550 | 0, 0, | ||
2551 | pbn_b1_bt_1_115200 }, | ||
2367 | 2552 | ||
2368 | /* | 2553 | /* |
2369 | * IntaShield IS-200 | 2554 | * IntaShield IS-200 |
@@ -2382,6 +2567,13 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
2382 | PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS8, | 2567 | PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS8, |
2383 | 0, 0, pbn_b2_8_921600 }, | 2568 | 0, 0, pbn_b2_8_921600 }, |
2384 | /* | 2569 | /* |
2570 | * PA Semi PA6T-1682M on-chip UART | ||
2571 | */ | ||
2572 | { PCI_VENDOR_ID_PASEMI, 0xa004, | ||
2573 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2574 | pbn_pasemi_1682M }, | ||
2575 | |||
2576 | /* | ||
2385 | * These entries match devices with class COMMUNICATION_SERIAL, | 2577 | * These entries match devices with class COMMUNICATION_SERIAL, |
2386 | * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL | 2578 | * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL |
2387 | */ | 2579 | */ |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 030a6063541d..a055f58f342f 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -1146,11 +1146,14 @@ static void uart_set_termios(struct tty_struct *tty, struct ktermios *old_termio | |||
1146 | 1146 | ||
1147 | /* | 1147 | /* |
1148 | * These are the bits that are used to setup various | 1148 | * These are the bits that are used to setup various |
1149 | * flags in the low level driver. | 1149 | * flags in the low level driver. We can ignore the Bfoo |
1150 | * bits in c_cflag; c_[io]speed will always be set | ||
1151 | * appropriately by set_termios() in tty_ioctl.c | ||
1150 | */ | 1152 | */ |
1151 | #define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) | 1153 | #define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) |
1152 | |||
1153 | if ((cflag ^ old_termios->c_cflag) == 0 && | 1154 | if ((cflag ^ old_termios->c_cflag) == 0 && |
1155 | tty->termios->c_ospeed == old_termios->c_ospeed && | ||
1156 | tty->termios->c_ispeed == old_termios->c_ispeed && | ||
1154 | RELEVANT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0) | 1157 | RELEVANT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0) |
1155 | return; | 1158 | return; |
1156 | 1159 | ||
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c index b8f91e018b21..0930e2a85514 100644 --- a/drivers/serial/serial_txx9.c +++ b/drivers/serial/serial_txx9.c | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | 39 | ||
40 | static char *serial_version = "1.09"; | 40 | static char *serial_version = "1.10"; |
41 | static char *serial_name = "TX39/49 Serial driver"; | 41 | static char *serial_name = "TX39/49 Serial driver"; |
42 | 42 | ||
43 | #define PASS_LIMIT 256 | 43 | #define PASS_LIMIT 256 |
@@ -436,8 +436,10 @@ static unsigned int serial_txx9_get_mctrl(struct uart_port *port) | |||
436 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 436 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; |
437 | unsigned int ret; | 437 | unsigned int ret; |
438 | 438 | ||
439 | ret = ((sio_in(up, TXX9_SIFLCR) & TXX9_SIFLCR_RTSSC) ? 0 : TIOCM_RTS) | 439 | /* no modem control lines */ |
440 | | ((sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS) ? 0 : TIOCM_CTS); | 440 | ret = TIOCM_CAR | TIOCM_DSR; |
441 | ret |= (sio_in(up, TXX9_SIFLCR) & TXX9_SIFLCR_RTSSC) ? 0 : TIOCM_RTS; | ||
442 | ret |= (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS) ? 0 : TIOCM_CTS; | ||
441 | 443 | ||
442 | return ret; | 444 | return ret; |
443 | } | 445 | } |
@@ -557,6 +559,12 @@ serial_txx9_set_termios(struct uart_port *port, struct ktermios *termios, | |||
557 | unsigned long flags; | 559 | unsigned long flags; |
558 | unsigned int baud, quot; | 560 | unsigned int baud, quot; |
559 | 561 | ||
562 | /* | ||
563 | * We don't support modem control lines. | ||
564 | */ | ||
565 | termios->c_cflag &= ~(HUPCL | CMSPAR); | ||
566 | termios->c_cflag |= CLOCAL; | ||
567 | |||
560 | cval = sio_in(up, TXX9_SILCR); | 568 | cval = sio_in(up, TXX9_SILCR); |
561 | /* byte size and parity */ | 569 | /* byte size and parity */ |
562 | cval &= ~TXX9_SILCR_UMODE_MASK; | 570 | cval &= ~TXX9_SILCR_UMODE_MASK; |
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c index 0c16a2b39b41..2adf856e44c2 100644 --- a/drivers/spi/spi_mpc83xx.c +++ b/drivers/spi/spi_mpc83xx.c | |||
@@ -86,7 +86,7 @@ struct mpc83xx_spi { | |||
86 | 86 | ||
87 | unsigned nsecs; /* (clock cycle time)/2 */ | 87 | unsigned nsecs; /* (clock cycle time)/2 */ |
88 | 88 | ||
89 | u32 sysclk; | 89 | u32 spibrg; /* SPIBRG input clock */ |
90 | u32 rx_shift; /* RX data reg shift when in qe mode */ | 90 | u32 rx_shift; /* RX data reg shift when in qe mode */ |
91 | u32 tx_shift; /* TX data reg shift when in qe mode */ | 91 | u32 tx_shift; /* TX data reg shift when in qe mode */ |
92 | 92 | ||
@@ -148,6 +148,8 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value) | |||
148 | if (value == BITBANG_CS_ACTIVE) { | 148 | if (value == BITBANG_CS_ACTIVE) { |
149 | u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); | 149 | u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); |
150 | u32 len = spi->bits_per_word; | 150 | u32 len = spi->bits_per_word; |
151 | u8 pm; | ||
152 | |||
151 | if (len == 32) | 153 | if (len == 32) |
152 | len = 0; | 154 | len = 0; |
153 | else | 155 | else |
@@ -169,17 +171,20 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value) | |||
169 | 171 | ||
170 | regval |= SPMODE_LEN(len); | 172 | regval |= SPMODE_LEN(len); |
171 | 173 | ||
172 | if ((mpc83xx_spi->sysclk / spi->max_speed_hz) >= 64) { | 174 | if ((mpc83xx_spi->spibrg / spi->max_speed_hz) >= 64) { |
173 | u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 64); | 175 | pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 64) - 1; |
174 | if (pm > 0x0f) { | 176 | if (pm > 0x0f) { |
175 | printk(KERN_WARNING "MPC83xx SPI: SPICLK can't be less then a SYSCLK/1024!\n" | 177 | dev_err(&spi->dev, "Requested speed is too " |
176 | "Requested SPICLK is %d Hz. Will use %d Hz instead.\n", | 178 | "low: %d Hz. Will use %d Hz instead.\n", |
177 | spi->max_speed_hz, mpc83xx_spi->sysclk / 1024); | 179 | spi->max_speed_hz, |
180 | mpc83xx_spi->spibrg / 1024); | ||
178 | pm = 0x0f; | 181 | pm = 0x0f; |
179 | } | 182 | } |
180 | regval |= SPMODE_PM(pm) | SPMODE_DIV16; | 183 | regval |= SPMODE_PM(pm) | SPMODE_DIV16; |
181 | } else { | 184 | } else { |
182 | u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 4); | 185 | pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 4); |
186 | if (pm) | ||
187 | pm--; | ||
183 | regval |= SPMODE_PM(pm); | 188 | regval |= SPMODE_PM(pm); |
184 | } | 189 | } |
185 | 190 | ||
@@ -429,13 +434,17 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev) | |||
429 | mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect; | 434 | mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect; |
430 | mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer; | 435 | mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer; |
431 | mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs; | 436 | mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs; |
432 | mpc83xx_spi->sysclk = pdata->sysclk; | ||
433 | mpc83xx_spi->activate_cs = pdata->activate_cs; | 437 | mpc83xx_spi->activate_cs = pdata->activate_cs; |
434 | mpc83xx_spi->deactivate_cs = pdata->deactivate_cs; | 438 | mpc83xx_spi->deactivate_cs = pdata->deactivate_cs; |
435 | mpc83xx_spi->qe_mode = pdata->qe_mode; | 439 | mpc83xx_spi->qe_mode = pdata->qe_mode; |
436 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; | 440 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; |
437 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; | 441 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; |
438 | 442 | ||
443 | if (mpc83xx_spi->qe_mode) | ||
444 | mpc83xx_spi->spibrg = pdata->sysclk / 2; | ||
445 | else | ||
446 | mpc83xx_spi->spibrg = pdata->sysclk; | ||
447 | |||
439 | mpc83xx_spi->rx_shift = 0; | 448 | mpc83xx_spi->rx_shift = 0; |
440 | mpc83xx_spi->tx_shift = 0; | 449 | mpc83xx_spi->tx_shift = 0; |
441 | if (mpc83xx_spi->qe_mode) { | 450 | if (mpc83xx_spi->qe_mode) { |
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 630f781aeb19..c55459c592b8 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
@@ -183,7 +183,9 @@ static int spidev_message(struct spidev_data *spidev, | |||
183 | 183 | ||
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, u_tmp->rx_buf, u_tmp->len)) | 186 | if (!access_ok(VERIFY_WRITE, (u8 __user *) |
187 | (ptrdiff_t) u_tmp->rx_buf, | ||
188 | u_tmp->len)) | ||
187 | goto done; | 189 | goto done; |
188 | } | 190 | } |
189 | if (u_tmp->tx_buf) { | 191 | if (u_tmp->tx_buf) { |
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 7dd73546bf43..63436892688c 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -6,6 +6,9 @@ menuconfig USB_SUPPORT | |||
6 | bool "USB support" | 6 | bool "USB support" |
7 | depends on HAS_IOMEM | 7 | depends on HAS_IOMEM |
8 | default y | 8 | default y |
9 | ---help--- | ||
10 | This option adds core support for Universal Serial Bus (USB). | ||
11 | You will also need drivers from the following menu to make use of it. | ||
9 | 12 | ||
10 | if USB_SUPPORT | 13 | if USB_SUPPORT |
11 | 14 | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index c4e15ed1405a..35cdba10411b 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -275,58 +275,6 @@ static void ehci_work(struct ehci_hcd *ehci); | |||
275 | 275 | ||
276 | /*-------------------------------------------------------------------------*/ | 276 | /*-------------------------------------------------------------------------*/ |
277 | 277 | ||
278 | #ifdef CONFIG_CPU_FREQ | ||
279 | |||
280 | #include <linux/cpufreq.h> | ||
281 | |||
282 | static void ehci_cpufreq_pause (struct ehci_hcd *ehci) | ||
283 | { | ||
284 | unsigned long flags; | ||
285 | |||
286 | spin_lock_irqsave(&ehci->lock, flags); | ||
287 | if (!ehci->cpufreq_changing++) | ||
288 | qh_inactivate_split_intr_qhs(ehci); | ||
289 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
290 | } | ||
291 | |||
292 | static void ehci_cpufreq_unpause (struct ehci_hcd *ehci) | ||
293 | { | ||
294 | unsigned long flags; | ||
295 | |||
296 | spin_lock_irqsave(&ehci->lock, flags); | ||
297 | if (!--ehci->cpufreq_changing) | ||
298 | qh_reactivate_split_intr_qhs(ehci); | ||
299 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
300 | } | ||
301 | |||
302 | /* | ||
303 | * ehci_cpufreq_notifier is needed to avoid MMF errors that occur when | ||
304 | * EHCI controllers that don't cache many uframes get delayed trying to | ||
305 | * read main memory during CPU frequency transitions. This can cause | ||
306 | * split interrupt transactions to not be completed in the required uframe. | ||
307 | * This has been observed on the Broadcom/ServerWorks HT1000 controller. | ||
308 | */ | ||
309 | static int ehci_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | ||
310 | void *data) | ||
311 | { | ||
312 | struct ehci_hcd *ehci = container_of(nb, struct ehci_hcd, | ||
313 | cpufreq_transition); | ||
314 | |||
315 | switch (val) { | ||
316 | case CPUFREQ_PRECHANGE: | ||
317 | ehci_cpufreq_pause(ehci); | ||
318 | break; | ||
319 | case CPUFREQ_POSTCHANGE: | ||
320 | ehci_cpufreq_unpause(ehci); | ||
321 | break; | ||
322 | } | ||
323 | return 0; | ||
324 | } | ||
325 | |||
326 | #endif | ||
327 | |||
328 | /*-------------------------------------------------------------------------*/ | ||
329 | |||
330 | static void ehci_watchdog (unsigned long param) | 278 | static void ehci_watchdog (unsigned long param) |
331 | { | 279 | { |
332 | struct ehci_hcd *ehci = (struct ehci_hcd *) param; | 280 | struct ehci_hcd *ehci = (struct ehci_hcd *) param; |
@@ -460,10 +408,6 @@ static void ehci_stop (struct usb_hcd *hcd) | |||
460 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); | 408 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); |
461 | spin_unlock_irq(&ehci->lock); | 409 | spin_unlock_irq(&ehci->lock); |
462 | 410 | ||
463 | #ifdef CONFIG_CPU_FREQ | ||
464 | cpufreq_unregister_notifier(&ehci->cpufreq_transition, | ||
465 | CPUFREQ_TRANSITION_NOTIFIER); | ||
466 | #endif | ||
467 | /* let companion controllers work when we aren't */ | 411 | /* let companion controllers work when we aren't */ |
468 | ehci_writel(ehci, 0, &ehci->regs->configured_flag); | 412 | ehci_writel(ehci, 0, &ehci->regs->configured_flag); |
469 | 413 | ||
@@ -569,17 +513,6 @@ static int ehci_init(struct usb_hcd *hcd) | |||
569 | } | 513 | } |
570 | ehci->command = temp; | 514 | ehci->command = temp; |
571 | 515 | ||
572 | #ifdef CONFIG_CPU_FREQ | ||
573 | INIT_LIST_HEAD(&ehci->split_intr_qhs); | ||
574 | /* | ||
575 | * If the EHCI controller caches enough uframes, this probably | ||
576 | * isn't needed unless there are so many low/full speed devices | ||
577 | * that the controller's can't cache it all. | ||
578 | */ | ||
579 | ehci->cpufreq_transition.notifier_call = ehci_cpufreq_notifier; | ||
580 | cpufreq_register_notifier(&ehci->cpufreq_transition, | ||
581 | CPUFREQ_TRANSITION_NOTIFIER); | ||
582 | #endif | ||
583 | return 0; | 516 | return 0; |
584 | } | 517 | } |
585 | 518 | ||
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c index 8816d09903d0..0431397836f6 100644 --- a/drivers/usb/host/ehci-mem.c +++ b/drivers/usb/host/ehci-mem.c | |||
@@ -94,9 +94,6 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags) | |||
94 | qh->qh_dma = dma; | 94 | qh->qh_dma = dma; |
95 | // INIT_LIST_HEAD (&qh->qh_list); | 95 | // INIT_LIST_HEAD (&qh->qh_list); |
96 | INIT_LIST_HEAD (&qh->qtd_list); | 96 | INIT_LIST_HEAD (&qh->qtd_list); |
97 | #ifdef CONFIG_CPU_FREQ | ||
98 | INIT_LIST_HEAD (&qh->split_intr_qhs); | ||
99 | #endif | ||
100 | 97 | ||
101 | /* dummy td enables safe urb queuing */ | 98 | /* dummy td enables safe urb queuing */ |
102 | qh->dummy = ehci_qtd_alloc (ehci, flags); | 99 | qh->dummy = ehci_qtd_alloc (ehci, flags); |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 2284028f8aa5..140bfa423e07 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -312,10 +312,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
312 | struct urb *urb; | 312 | struct urb *urb; |
313 | u32 token = 0; | 313 | u32 token = 0; |
314 | 314 | ||
315 | /* ignore QHs that are currently inactive */ | ||
316 | if (qh->hw_info1 & __constant_cpu_to_le32(QH_INACTIVATE)) | ||
317 | break; | ||
318 | |||
319 | qtd = list_entry (entry, struct ehci_qtd, qtd_list); | 315 | qtd = list_entry (entry, struct ehci_qtd, qtd_list); |
320 | urb = qtd->urb; | 316 | urb = qtd->urb; |
321 | 317 | ||
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index d4a8ace49676..e682f2342ef8 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -479,109 +479,6 @@ static int disable_periodic (struct ehci_hcd *ehci) | |||
479 | } | 479 | } |
480 | 480 | ||
481 | /*-------------------------------------------------------------------------*/ | 481 | /*-------------------------------------------------------------------------*/ |
482 | #ifdef CONFIG_CPU_FREQ | ||
483 | |||
484 | static int safe_to_modify_i (struct ehci_hcd *ehci, struct ehci_qh *qh) | ||
485 | { | ||
486 | int now; /* current (frame * 8) + uframe */ | ||
487 | int prev_start, next_start; /* uframes from/to split start */ | ||
488 | int start_uframe = ffs(le32_to_cpup (&qh->hw_info2) & QH_SMASK); | ||
489 | int end_uframe = fls((le32_to_cpup (&qh->hw_info2) & QH_CMASK) >> 8); | ||
490 | int split_duration = end_uframe - start_uframe; | ||
491 | |||
492 | now = readl(&ehci->regs->frame_index) % (ehci->periodic_size << 3); | ||
493 | |||
494 | next_start = ((1024 << 3) + (qh->start << 3) + start_uframe - now) | ||
495 | % (qh->period << 3); | ||
496 | prev_start = (qh->period << 3) - next_start; | ||
497 | |||
498 | /* | ||
499 | * Make sure there will be at least one uframe when qh is safe. | ||
500 | */ | ||
501 | if ((qh->period << 3) <= (ehci->i_thresh + 2 + split_duration)) | ||
502 | /* never safe */ | ||
503 | return -EINVAL; | ||
504 | |||
505 | /* | ||
506 | * Wait 1 uframe after transaction should have started, to make | ||
507 | * sure controller has time to write back overlay, so we can | ||
508 | * check QTD_STS_STS to see if transaction is in progress. | ||
509 | */ | ||
510 | if ((next_start > ehci->i_thresh) && (prev_start > 1)) | ||
511 | /* safe to set "i" bit if split isn't in progress */ | ||
512 | return (qh->hw_token & STATUS_BIT(ehci)) ? 0 : 1; | ||
513 | else | ||
514 | return 0; | ||
515 | } | ||
516 | |||
517 | /* Set inactivate bit for all the split interrupt QHs. */ | ||
518 | static void qh_inactivate_split_intr_qhs (struct ehci_hcd *ehci) | ||
519 | { | ||
520 | struct ehci_qh *qh; | ||
521 | int not_done, safe; | ||
522 | u32 inactivate = INACTIVATE_BIT(ehci); | ||
523 | u32 active = ACTIVE_BIT(ehci); | ||
524 | |||
525 | do { | ||
526 | not_done = 0; | ||
527 | list_for_each_entry(qh, &ehci->split_intr_qhs, | ||
528 | split_intr_qhs) { | ||
529 | if (qh->hw_info1 & inactivate) | ||
530 | /* already off */ | ||
531 | continue; | ||
532 | /* | ||
533 | * To avoid setting "I" after the start split happens, | ||
534 | * don't set it if the QH might be cached in the | ||
535 | * controller. Some HCs (Broadcom/ServerWorks HT1000) | ||
536 | * will stop in the middle of a split transaction when | ||
537 | * the "I" bit is set. | ||
538 | */ | ||
539 | safe = safe_to_modify_i(ehci, qh); | ||
540 | if (safe == 0) { | ||
541 | not_done = 1; | ||
542 | } else if (safe > 0) { | ||
543 | qh->was_active = qh->hw_token & active; | ||
544 | qh->hw_info1 |= inactivate; | ||
545 | } | ||
546 | } | ||
547 | } while (not_done); | ||
548 | wmb(); | ||
549 | } | ||
550 | |||
551 | static void qh_reactivate_split_intr_qhs (struct ehci_hcd *ehci) | ||
552 | { | ||
553 | struct ehci_qh *qh; | ||
554 | u32 token; | ||
555 | int not_done, safe; | ||
556 | u32 inactivate = INACTIVATE_BIT(ehci); | ||
557 | u32 active = ACTIVE_BIT(ehci); | ||
558 | u32 halt = HALT_BIT(ehci); | ||
559 | |||
560 | do { | ||
561 | not_done = 0; | ||
562 | list_for_each_entry(qh, &ehci->split_intr_qhs, split_intr_qhs) { | ||
563 | if (!(qh->hw_info1 & inactivate)) /* already on */ | ||
564 | continue; | ||
565 | /* | ||
566 | * Don't reactivate if cached, or controller might | ||
567 | * overwrite overlay after we modify it! | ||
568 | */ | ||
569 | safe = safe_to_modify_i(ehci, qh); | ||
570 | if (safe == 0) { | ||
571 | not_done = 1; | ||
572 | } else if (safe > 0) { | ||
573 | /* See EHCI 1.0 section 4.15.2.4. */ | ||
574 | token = qh->hw_token; | ||
575 | qh->hw_token = (token | halt) & ~active; | ||
576 | wmb(); | ||
577 | qh->hw_info1 &= ~inactivate; | ||
578 | wmb(); | ||
579 | qh->hw_token = (token & ~halt) | qh->was_active; | ||
580 | } | ||
581 | } | ||
582 | } while (not_done); | ||
583 | } | ||
584 | #endif | ||
585 | 482 | ||
586 | /* periodic schedule slots have iso tds (normal or split) first, then a | 483 | /* periodic schedule slots have iso tds (normal or split) first, then a |
587 | * sparse tree for active interrupt transfers. | 484 | * sparse tree for active interrupt transfers. |
@@ -599,17 +496,6 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
599 | period, hc32_to_cpup(ehci, &qh->hw_info2) & (QH_CMASK | QH_SMASK), | 496 | period, hc32_to_cpup(ehci, &qh->hw_info2) & (QH_CMASK | QH_SMASK), |
600 | qh, qh->start, qh->usecs, qh->c_usecs); | 497 | qh, qh->start, qh->usecs, qh->c_usecs); |
601 | 498 | ||
602 | #ifdef CONFIG_CPU_FREQ | ||
603 | /* | ||
604 | * If low/full speed interrupt QHs are inactive (because of | ||
605 | * cpufreq changing processor speeds), start QH with I flag set-- | ||
606 | * it will automatically be cleared when cpufreq is done. | ||
607 | */ | ||
608 | if (ehci->cpufreq_changing) | ||
609 | if (!(qh->hw_info1 & (cpu_to_le32(1 << 13)))) | ||
610 | qh->hw_info1 |= INACTIVATE_BIT(ehci); | ||
611 | #endif | ||
612 | |||
613 | /* high bandwidth, or otherwise every microframe */ | 499 | /* high bandwidth, or otherwise every microframe */ |
614 | if (period == 0) | 500 | if (period == 0) |
615 | period = 1; | 501 | period = 1; |
@@ -658,12 +544,6 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
658 | ? ((qh->usecs + qh->c_usecs) / qh->period) | 544 | ? ((qh->usecs + qh->c_usecs) / qh->period) |
659 | : (qh->usecs * 8); | 545 | : (qh->usecs * 8); |
660 | 546 | ||
661 | #ifdef CONFIG_CPU_FREQ | ||
662 | /* add qh to list of low/full speed interrupt QHs, if applicable */ | ||
663 | if (!(qh->hw_info1 & (cpu_to_le32(1 << 13)))) { | ||
664 | list_add(&qh->split_intr_qhs, &ehci->split_intr_qhs); | ||
665 | } | ||
666 | #endif | ||
667 | /* maybe enable periodic schedule processing */ | 547 | /* maybe enable periodic schedule processing */ |
668 | if (!ehci->periodic_sched++) | 548 | if (!ehci->periodic_sched++) |
669 | return enable_periodic (ehci); | 549 | return enable_periodic (ehci); |
@@ -683,13 +563,6 @@ static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
683 | // THEN | 563 | // THEN |
684 | // qh->hw_info1 |= __constant_cpu_to_hc32(1 << 7 /* "ignore" */); | 564 | // qh->hw_info1 |= __constant_cpu_to_hc32(1 << 7 /* "ignore" */); |
685 | 565 | ||
686 | #ifdef CONFIG_CPU_FREQ | ||
687 | /* remove qh from list of low/full speed interrupt QHs */ | ||
688 | if (!(qh->hw_info1 & (cpu_to_le32(1 << 13)))) { | ||
689 | list_del_init(&qh->split_intr_qhs); | ||
690 | } | ||
691 | #endif | ||
692 | |||
693 | /* high bandwidth, or otherwise part of every microframe */ | 566 | /* high bandwidth, or otherwise part of every microframe */ |
694 | if ((period = qh->period) == 0) | 567 | if ((period = qh->period) == 0) |
695 | period = 1; | 568 | period = 1; |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 2c68a04230c1..951d69fec513 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -71,12 +71,6 @@ struct ehci_hcd { /* one per controller */ | |||
71 | __u32 hcs_params; /* cached register copy */ | 71 | __u32 hcs_params; /* cached register copy */ |
72 | spinlock_t lock; | 72 | spinlock_t lock; |
73 | 73 | ||
74 | #ifdef CONFIG_CPU_FREQ | ||
75 | struct notifier_block cpufreq_transition; | ||
76 | int cpufreq_changing; | ||
77 | struct list_head split_intr_qhs; | ||
78 | #endif | ||
79 | |||
80 | /* async schedule support */ | 74 | /* async schedule support */ |
81 | struct ehci_qh *async; | 75 | struct ehci_qh *async; |
82 | struct ehci_qh *reclaim; | 76 | struct ehci_qh *reclaim; |
@@ -439,10 +433,6 @@ struct ehci_qh { | |||
439 | __hc32 hw_next; /* see EHCI 3.6.1 */ | 433 | __hc32 hw_next; /* see EHCI 3.6.1 */ |
440 | __hc32 hw_info1; /* see EHCI 3.6.2 */ | 434 | __hc32 hw_info1; /* see EHCI 3.6.2 */ |
441 | #define QH_HEAD 0x00008000 | 435 | #define QH_HEAD 0x00008000 |
442 | #define QH_INACTIVATE 0x00000080 | ||
443 | |||
444 | #define INACTIVATE_BIT(ehci) cpu_to_hc32(ehci, QH_INACTIVATE) | ||
445 | |||
446 | __hc32 hw_info2; /* see EHCI 3.6.2 */ | 436 | __hc32 hw_info2; /* see EHCI 3.6.2 */ |
447 | #define QH_SMASK 0x000000ff | 437 | #define QH_SMASK 0x000000ff |
448 | #define QH_CMASK 0x0000ff00 | 438 | #define QH_CMASK 0x0000ff00 |
@@ -492,10 +482,6 @@ struct ehci_qh { | |||
492 | unsigned short start; /* where polling starts */ | 482 | unsigned short start; /* where polling starts */ |
493 | #define NO_FRAME ((unsigned short)~0) /* pick new start */ | 483 | #define NO_FRAME ((unsigned short)~0) /* pick new start */ |
494 | struct usb_device *dev; /* access to TT */ | 484 | struct usb_device *dev; /* access to TT */ |
495 | #ifdef CONFIG_CPU_FREQ | ||
496 | struct list_head split_intr_qhs; /* list of split qhs */ | ||
497 | __le32 was_active; /* active bit before "i" set */ | ||
498 | #endif | ||
499 | } __attribute__ ((aligned (32))); | 485 | } __attribute__ ((aligned (32))); |
500 | 486 | ||
501 | /*-------------------------------------------------------------------------*/ | 487 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 80a81eccad36..832e4613673a 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -115,6 +115,52 @@ static int nocursor = 0; | |||
115 | module_param(nocursor, int, 0644); | 115 | module_param(nocursor, int, 0644); |
116 | MODULE_PARM_DESC(nocursor, "cursor enable/disable"); | 116 | MODULE_PARM_DESC(nocursor, "cursor enable/disable"); |
117 | 117 | ||
118 | /* fb_blank | ||
119 | * Blank the screen. Depending on the mode, the screen will be | ||
120 | * activated with the backlight color, or desactivated | ||
121 | */ | ||
122 | static int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi) | ||
123 | { | ||
124 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); | ||
125 | |||
126 | print_dbg("fb_blank %d %p", blank_mode, fbi); | ||
127 | |||
128 | switch (blank_mode) { | ||
129 | |||
130 | case VESA_NO_BLANKING: | ||
131 | /* Turn on panel */ | ||
132 | fbdev->regs->lcd_control |= LCD_CONTROL_GO; | ||
133 | #ifdef CONFIG_MIPS_PB1100 | ||
134 | if (drv_info.panel_idx == 1) { | ||
135 | au_writew(au_readw(PB1100_G_CONTROL) | ||
136 | | (PB1100_G_CONTROL_BL | PB1100_G_CONTROL_VDD), | ||
137 | PB1100_G_CONTROL); | ||
138 | } | ||
139 | #endif | ||
140 | au_sync(); | ||
141 | break; | ||
142 | |||
143 | case VESA_VSYNC_SUSPEND: | ||
144 | case VESA_HSYNC_SUSPEND: | ||
145 | case VESA_POWERDOWN: | ||
146 | /* Turn off panel */ | ||
147 | fbdev->regs->lcd_control &= ~LCD_CONTROL_GO; | ||
148 | #ifdef CONFIG_MIPS_PB1100 | ||
149 | if (drv_info.panel_idx == 1) { | ||
150 | au_writew(au_readw(PB1100_G_CONTROL) | ||
151 | & ~(PB1100_G_CONTROL_BL | PB1100_G_CONTROL_VDD), | ||
152 | PB1100_G_CONTROL); | ||
153 | } | ||
154 | #endif | ||
155 | au_sync(); | ||
156 | break; | ||
157 | default: | ||
158 | break; | ||
159 | |||
160 | } | ||
161 | return 0; | ||
162 | } | ||
163 | |||
118 | /* | 164 | /* |
119 | * Set hardware with var settings. This will enable the controller with a specific | 165 | * Set hardware with var settings. This will enable the controller with a specific |
120 | * mode, normally validated with the fb_check_var method | 166 | * mode, normally validated with the fb_check_var method |
@@ -272,52 +318,6 @@ int au1100fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned | |||
272 | return 0; | 318 | return 0; |
273 | } | 319 | } |
274 | 320 | ||
275 | /* fb_blank | ||
276 | * Blank the screen. Depending on the mode, the screen will be | ||
277 | * activated with the backlight color, or desactivated | ||
278 | */ | ||
279 | int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi) | ||
280 | { | ||
281 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); | ||
282 | |||
283 | print_dbg("fb_blank %d %p", blank_mode, fbi); | ||
284 | |||
285 | switch (blank_mode) { | ||
286 | |||
287 | case VESA_NO_BLANKING: | ||
288 | /* Turn on panel */ | ||
289 | fbdev->regs->lcd_control |= LCD_CONTROL_GO; | ||
290 | #ifdef CONFIG_MIPS_PB1100 | ||
291 | if (drv_info.panel_idx == 1) { | ||
292 | au_writew(au_readw(PB1100_G_CONTROL) | ||
293 | | (PB1100_G_CONTROL_BL | PB1100_G_CONTROL_VDD), | ||
294 | PB1100_G_CONTROL); | ||
295 | } | ||
296 | #endif | ||
297 | au_sync(); | ||
298 | break; | ||
299 | |||
300 | case VESA_VSYNC_SUSPEND: | ||
301 | case VESA_HSYNC_SUSPEND: | ||
302 | case VESA_POWERDOWN: | ||
303 | /* Turn off panel */ | ||
304 | fbdev->regs->lcd_control &= ~LCD_CONTROL_GO; | ||
305 | #ifdef CONFIG_MIPS_PB1100 | ||
306 | if (drv_info.panel_idx == 1) { | ||
307 | au_writew(au_readw(PB1100_G_CONTROL) | ||
308 | & ~(PB1100_G_CONTROL_BL | PB1100_G_CONTROL_VDD), | ||
309 | PB1100_G_CONTROL); | ||
310 | } | ||
311 | #endif | ||
312 | au_sync(); | ||
313 | break; | ||
314 | default: | ||
315 | break; | ||
316 | |||
317 | } | ||
318 | return 0; | ||
319 | } | ||
320 | |||
321 | /* fb_pan_display | 321 | /* fb_pan_display |
322 | * Pan display in x and/or y as specified | 322 | * Pan display in x and/or y as specified |
323 | */ | 323 | */ |
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index 87c747123538..ee9046db9c7d 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c | |||
@@ -677,6 +677,7 @@ static int __devinit cg6_probe(struct of_device *op, const struct of_device_id * | |||
677 | struct fb_info *info; | 677 | struct fb_info *info; |
678 | struct cg6_par *par; | 678 | struct cg6_par *par; |
679 | int linebytes, err; | 679 | int linebytes, err; |
680 | int dblbuf; | ||
680 | 681 | ||
681 | info = framebuffer_alloc(sizeof(struct cg6_par), &op->dev); | 682 | info = framebuffer_alloc(sizeof(struct cg6_par), &op->dev); |
682 | 683 | ||
@@ -698,7 +699,9 @@ static int __devinit cg6_probe(struct of_device *op, const struct of_device_id * | |||
698 | linebytes = of_getintprop_default(dp, "linebytes", | 699 | linebytes = of_getintprop_default(dp, "linebytes", |
699 | info->var.xres); | 700 | info->var.xres); |
700 | par->fbsize = PAGE_ALIGN(linebytes * info->var.yres); | 701 | par->fbsize = PAGE_ALIGN(linebytes * info->var.yres); |
701 | if (of_find_property(dp, "dblbuf", NULL)) | 702 | |
703 | dblbuf = of_getintprop_default(dp, "dblbuf", 0); | ||
704 | if (dblbuf) | ||
702 | par->fbsize *= 4; | 705 | par->fbsize *= 4; |
703 | 706 | ||
704 | par->fbc = of_ioremap(&op->resource[0], CG6_FBC_OFFSET, | 707 | par->fbc = of_ioremap(&op->resource[0], CG6_FBC_OFFSET, |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index decfdc8eb9cc..e58c87b3e3a0 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -127,8 +127,20 @@ static int last_fb_vc = MAX_NR_CONSOLES - 1; | |||
127 | static int fbcon_is_default = 1; | 127 | static int fbcon_is_default = 1; |
128 | static int fbcon_has_exited; | 128 | static int fbcon_has_exited; |
129 | static int primary_device = -1; | 129 | static int primary_device = -1; |
130 | |||
131 | #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY | ||
130 | static int map_override; | 132 | static int map_override; |
131 | 133 | ||
134 | static inline void fbcon_map_override(void) | ||
135 | { | ||
136 | map_override = 1; | ||
137 | } | ||
138 | #else | ||
139 | static inline void fbcon_map_override(void) | ||
140 | { | ||
141 | } | ||
142 | #endif /* CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY */ | ||
143 | |||
132 | /* font data */ | 144 | /* font data */ |
133 | static char fontname[40]; | 145 | static char fontname[40]; |
134 | 146 | ||
@@ -506,7 +518,7 @@ static int __init fb_console_setup(char *this_opt) | |||
506 | (options[j++]-'0') % FB_MAX; | 518 | (options[j++]-'0') % FB_MAX; |
507 | } | 519 | } |
508 | 520 | ||
509 | map_override = 1; | 521 | fbcon_map_override(); |
510 | } | 522 | } |
511 | 523 | ||
512 | return 1; | 524 | return 1; |
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c index 7fa1afeae8dc..dda0586ab3f3 100644 --- a/drivers/video/console/newport_con.c +++ b/drivers/video/console/newport_con.c | |||
@@ -738,9 +738,8 @@ const struct consw newport_con = { | |||
738 | #ifdef MODULE | 738 | #ifdef MODULE |
739 | static int __init newport_console_init(void) | 739 | static int __init newport_console_init(void) |
740 | { | 740 | { |
741 | |||
742 | if (!sgi_gfxaddr) | 741 | if (!sgi_gfxaddr) |
743 | return NULL; | 742 | return 0; |
744 | 743 | ||
745 | if (!npregs) | 744 | if (!npregs) |
746 | npregs = (struct newport_regs *)/* ioremap cannot fail */ | 745 | npregs = (struct newport_regs *)/* ioremap cannot fail */ |
diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c index 5715b8ad0ddc..94f4511023d8 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/imsttfb.c | |||
@@ -1391,7 +1391,7 @@ init_imstt(struct fb_info *info) | |||
1391 | } | 1391 | } |
1392 | } | 1392 | } |
1393 | 1393 | ||
1394 | #if USE_NV_MODES && defined(CONFIG_PPC) | 1394 | #if USE_NV_MODES && defined(CONFIG_PPC32) |
1395 | { | 1395 | { |
1396 | int vmode = init_vmode, cmode = init_cmode; | 1396 | int vmode = init_vmode, cmode = init_cmode; |
1397 | 1397 | ||
diff --git a/drivers/video/matrox/g450_pll.c b/drivers/video/matrox/g450_pll.c index 7c76e079ca7d..d42346e7fdda 100644 --- a/drivers/video/matrox/g450_pll.c +++ b/drivers/video/matrox/g450_pll.c | |||
@@ -331,16 +331,19 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll, | |||
331 | tmp |= M1064_XPIXCLKCTRL_PLL_UP; | 331 | tmp |= M1064_XPIXCLKCTRL_PLL_UP; |
332 | } | 332 | } |
333 | matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp); | 333 | matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp); |
334 | #ifdef __powerpc__ | 334 | /* DVI PLL preferred for frequencies up to |
335 | /* This is necessary to avoid jitter on PowerPC | 335 | panel link max, standard PLL otherwise */ |
336 | * (OpenFirmware) systems, but apparently | 336 | if (fout >= MINFO->max_pixel_clock_panellink) |
337 | * introduces jitter, at least on a x86-64 | 337 | tmp = 0; |
338 | * using DVI. | 338 | else tmp = |
339 | * A simple workaround is disable for non-PPC. | 339 | M1064_XDVICLKCTRL_DVIDATAPATHSEL | |
340 | */ | 340 | M1064_XDVICLKCTRL_C1DVICLKSEL | |
341 | matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL, 0); | 341 | M1064_XDVICLKCTRL_C1DVICLKEN | |
342 | #endif /* __powerpc__ */ | 342 | M1064_XDVICLKCTRL_DVILOOPCTL | |
343 | matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl); | 343 | M1064_XDVICLKCTRL_P1LOOPBWDTCTL; |
344 | matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL,tmp); | ||
345 | matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, | ||
346 | xpwrctrl); | ||
344 | 347 | ||
345 | matroxfb_DAC_unlock_irqrestore(flags); | 348 | matroxfb_DAC_unlock_irqrestore(flags); |
346 | } | 349 | } |
diff --git a/drivers/video/matrox/matroxfb_DAC1064.h b/drivers/video/matrox/matroxfb_DAC1064.h index df39c3193735..7a98ce8043d7 100644 --- a/drivers/video/matrox/matroxfb_DAC1064.h +++ b/drivers/video/matrox/matroxfb_DAC1064.h | |||
@@ -33,6 +33,21 @@ void DAC1064_global_restore(WPMINFO2); | |||
33 | #define M1064_XCURCTRL_3COLOR 0x01 /* transparent, 0, 1, 2 */ | 33 | #define M1064_XCURCTRL_3COLOR 0x01 /* transparent, 0, 1, 2 */ |
34 | #define M1064_XCURCTRL_XGA 0x02 /* 0, 1, transparent, complement */ | 34 | #define M1064_XCURCTRL_XGA 0x02 /* 0, 1, transparent, complement */ |
35 | #define M1064_XCURCTRL_XWIN 0x03 /* transparent, transparent, 0, 1 */ | 35 | #define M1064_XCURCTRL_XWIN 0x03 /* transparent, transparent, 0, 1 */ |
36 | /* drive DVI by standard(0)/DVI(1) PLL */ | ||
37 | /* if set(1), C?DVICLKEN and C?DVICLKSEL must be set(1) */ | ||
38 | #define M1064_XDVICLKCTRL_DVIDATAPATHSEL 0x01 | ||
39 | /* drive CRTC1 by standard(0)/DVI(1) PLL */ | ||
40 | #define M1064_XDVICLKCTRL_C1DVICLKSEL 0x02 | ||
41 | /* drive CRTC2 by standard(0)/DVI(1) PLL */ | ||
42 | #define M1064_XDVICLKCTRL_C2DVICLKSEL 0x04 | ||
43 | /* pixel clock allowed to(0)/blocked from(1) driving CRTC1 */ | ||
44 | #define M1064_XDVICLKCTRL_C1DVICLKEN 0x08 | ||
45 | /* DVI PLL loop filter bandwidth selection bits */ | ||
46 | #define M1064_XDVICLKCTRL_DVILOOPCTL 0x30 | ||
47 | /* CRTC2 pixel clock allowed to(0)/blocked from(1) driving CRTC2 */ | ||
48 | #define M1064_XDVICLKCTRL_C2DVICLKEN 0x40 | ||
49 | /* P1PLL loop filter bandwith selection */ | ||
50 | #define M1064_XDVICLKCTRL_P1LOOPBWDTCTL 0x80 | ||
36 | #define M1064_XCURCOL0RED 0x08 | 51 | #define M1064_XCURCOL0RED 0x08 |
37 | #define M1064_XCURCOL0GREEN 0x09 | 52 | #define M1064_XCURCOL0GREEN 0x09 |
38 | #define M1064_XCURCOL0BLUE 0x0A | 53 | #define M1064_XCURCOL0BLUE 0x0A |
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index d59577c8de86..f3107ad7e545 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h | |||
@@ -424,6 +424,7 @@ struct matrox_fb_info { | |||
424 | } mmio; | 424 | } mmio; |
425 | 425 | ||
426 | unsigned int max_pixel_clock; | 426 | unsigned int max_pixel_clock; |
427 | unsigned int max_pixel_clock_panellink; | ||
427 | 428 | ||
428 | struct matrox_switch* hw_switch; | 429 | struct matrox_switch* hw_switch; |
429 | 430 | ||
diff --git a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c index 5948e54b9ef9..ab7fb50bc1de 100644 --- a/drivers/video/matrox/matroxfb_misc.c +++ b/drivers/video/matrox/matroxfb_misc.c | |||
@@ -658,6 +658,7 @@ static int parse_pins5(WPMINFO const struct matrox_bios* bd) { | |||
658 | MINFO->values.reg.mctlwtst_core = (MINFO->values.reg.mctlwtst & ~7) | | 658 | MINFO->values.reg.mctlwtst_core = (MINFO->values.reg.mctlwtst & ~7) | |
659 | wtst_xlat[MINFO->values.reg.mctlwtst & 7]; | 659 | wtst_xlat[MINFO->values.reg.mctlwtst & 7]; |
660 | } | 660 | } |
661 | MINFO->max_pixel_clock_panellink = bd->pins[47] * 4000; | ||
661 | return 0; | 662 | return 0; |
662 | } | 663 | } |
663 | 664 | ||
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c index f9300266044d..7d6c29800d14 100644 --- a/drivers/video/pvr2fb.c +++ b/drivers/video/pvr2fb.c | |||
@@ -94,6 +94,7 @@ | |||
94 | #define DISP_DIWCONF (DISP_BASE + 0xe8) | 94 | #define DISP_DIWCONF (DISP_BASE + 0xe8) |
95 | #define DISP_DIWHSTRT (DISP_BASE + 0xec) | 95 | #define DISP_DIWHSTRT (DISP_BASE + 0xec) |
96 | #define DISP_DIWVSTRT (DISP_BASE + 0xf0) | 96 | #define DISP_DIWVSTRT (DISP_BASE + 0xf0) |
97 | #define DISP_PIXDEPTH (DISP_BASE + 0x108) | ||
97 | 98 | ||
98 | /* Pixel clocks, one for TV output, doubled for VGA output */ | 99 | /* Pixel clocks, one for TV output, doubled for VGA output */ |
99 | #define TV_CLK 74239 | 100 | #define TV_CLK 74239 |
@@ -143,6 +144,7 @@ static struct pvr2fb_par { | |||
143 | unsigned char is_lowres; /* Is horizontal pixel-doubling enabled? */ | 144 | unsigned char is_lowres; /* Is horizontal pixel-doubling enabled? */ |
144 | 145 | ||
145 | unsigned long mmio_base; /* MMIO base */ | 146 | unsigned long mmio_base; /* MMIO base */ |
147 | u32 palette[16]; | ||
146 | } *currentpar; | 148 | } *currentpar; |
147 | 149 | ||
148 | static struct fb_info *fb_info; | 150 | static struct fb_info *fb_info; |
@@ -599,6 +601,7 @@ static void pvr2_init_display(struct fb_info *info) | |||
599 | 601 | ||
600 | /* bits per pixel */ | 602 | /* bits per pixel */ |
601 | fb_writel(fb_readl(DISP_DIWMODE) | (--bytesperpixel << 2), DISP_DIWMODE); | 603 | fb_writel(fb_readl(DISP_DIWMODE) | (--bytesperpixel << 2), DISP_DIWMODE); |
604 | fb_writel(bytesperpixel << 2, DISP_PIXDEPTH); | ||
602 | 605 | ||
603 | /* video enable, color sync, interlace, | 606 | /* video enable, color sync, interlace, |
604 | * hsync and vsync polarity (currently unused) */ | 607 | * hsync and vsync polarity (currently unused) */ |
@@ -790,7 +793,7 @@ static int __devinit pvr2fb_common_init(void) | |||
790 | fb_info->fbops = &pvr2fb_ops; | 793 | fb_info->fbops = &pvr2fb_ops; |
791 | fb_info->fix = pvr2_fix; | 794 | fb_info->fix = pvr2_fix; |
792 | fb_info->par = currentpar; | 795 | fb_info->par = currentpar; |
793 | fb_info->pseudo_palette = (void *)(fb_info->par + 1); | 796 | fb_info->pseudo_palette = currentpar->palette; |
794 | fb_info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; | 797 | fb_info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; |
795 | 798 | ||
796 | if (video_output == VO_VGA) | 799 | if (video_output == VO_VGA) |
@@ -807,6 +810,8 @@ static int __devinit pvr2fb_common_init(void) | |||
807 | 810 | ||
808 | if (register_framebuffer(fb_info) < 0) | 811 | if (register_framebuffer(fb_info) < 0) |
809 | goto out_err; | 812 | goto out_err; |
813 | /*Must write PIXDEPTH to register before anything is displayed - so force init */ | ||
814 | pvr2_init_display(fb_info); | ||
810 | 815 | ||
811 | modememused = get_line_length(fb_info->var.xres_virtual, | 816 | modememused = get_line_length(fb_info->var.xres_virtual, |
812 | fb_info->var.bits_per_pixel); | 817 | fb_info->var.bits_per_pixel); |
@@ -1082,14 +1087,15 @@ static int __init pvr2fb_init(void) | |||
1082 | #endif | 1087 | #endif |
1083 | size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32); | 1088 | size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32); |
1084 | 1089 | ||
1085 | fb_info = kzalloc(size, GFP_KERNEL); | 1090 | fb_info = framebuffer_alloc(sizeof(struct pvr2fb_par), NULL); |
1091 | |||
1086 | if (!fb_info) { | 1092 | if (!fb_info) { |
1087 | printk(KERN_ERR "Failed to allocate memory for fb_info\n"); | 1093 | printk(KERN_ERR "Failed to allocate memory for fb_info\n"); |
1088 | return -ENOMEM; | 1094 | return -ENOMEM; |
1089 | } | 1095 | } |
1090 | 1096 | ||
1091 | 1097 | ||
1092 | currentpar = (struct pvr2fb_par *)(fb_info + 1); | 1098 | currentpar = fb_info->par; |
1093 | 1099 | ||
1094 | for (i = 0; i < ARRAY_SIZE(board_driver); i++) { | 1100 | for (i = 0; i < ARRAY_SIZE(board_driver); i++) { |
1095 | struct pvr2_board *pvr_board = board_driver + i; | 1101 | struct pvr2_board *pvr_board = board_driver + i; |
@@ -1102,7 +1108,7 @@ static int __init pvr2fb_init(void) | |||
1102 | if (ret != 0) { | 1108 | if (ret != 0) { |
1103 | printk(KERN_ERR "pvr2fb: Failed init of %s device\n", | 1109 | printk(KERN_ERR "pvr2fb: Failed init of %s device\n", |
1104 | pvr_board->name); | 1110 | pvr_board->name); |
1105 | kfree(fb_info); | 1111 | framebuffer_release(fb_info); |
1106 | break; | 1112 | break; |
1107 | } | 1113 | } |
1108 | } | 1114 | } |
@@ -1126,7 +1132,7 @@ static void __exit pvr2fb_exit(void) | |||
1126 | #endif | 1132 | #endif |
1127 | 1133 | ||
1128 | unregister_framebuffer(fb_info); | 1134 | unregister_framebuffer(fb_info); |
1129 | kfree(fb_info); | 1135 | framebuffer_release(fb_info); |
1130 | } | 1136 | } |
1131 | 1137 | ||
1132 | module_init(pvr2fb_init); | 1138 | module_init(pvr2fb_init); |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 81e571d59b50..a280a52f8efe 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -66,7 +66,7 @@ static void set_ctrlr_state(struct pxafb_info *fbi, u_int state); | |||
66 | 66 | ||
67 | #ifdef CONFIG_FB_PXA_PARAMETERS | 67 | #ifdef CONFIG_FB_PXA_PARAMETERS |
68 | #define PXAFB_OPTIONS_SIZE 256 | 68 | #define PXAFB_OPTIONS_SIZE 256 |
69 | static char g_options[PXAFB_OPTIONS_SIZE] __initdata = ""; | 69 | static char g_options[PXAFB_OPTIONS_SIZE] __devinitdata = ""; |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | static inline void pxafb_schedule_work(struct pxafb_info *fbi, u_int state) | 72 | static inline void pxafb_schedule_work(struct pxafb_info *fbi, u_int state) |
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c index c97709ecbad0..e7c8db2eb49b 100644 --- a/drivers/video/stifb.c +++ b/drivers/video/stifb.c | |||
@@ -1100,13 +1100,18 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref) | |||
1100 | /* only supported cards are allowed */ | 1100 | /* only supported cards are allowed */ |
1101 | switch (fb->id) { | 1101 | switch (fb->id) { |
1102 | case CRT_ID_VISUALIZE_EG: | 1102 | case CRT_ID_VISUALIZE_EG: |
1103 | /* look for a double buffering device like e.g. the | 1103 | /* Visualize cards can run either in "double buffer" or |
1104 | "INTERNAL_EG_DX1024" in the RDI precisionbook laptop | 1104 | "standard" mode. Depending on the mode, the card reports |
1105 | which won't work. The same device in non-double | 1105 | a different device name, e.g. "INTERNAL_EG_DX1024" in double |
1106 | buffering mode returns "INTERNAL_EG_X1024". */ | 1106 | buffer mode and "INTERNAL_EG_X1024" in standard mode. |
1107 | if (strstr(sti->outptr.dev_name, "EG_DX")) { | 1107 | Since this driver only supports standard mode, we check |
1108 | printk(KERN_WARNING | 1108 | if the device name contains the string "DX" and tell the |
1109 | "stifb: ignoring '%s'. Disable double buffering in IPL menu.\n", | 1109 | user how to reconfigure the card. */ |
1110 | if (strstr(sti->outptr.dev_name, "DX")) { | ||
1111 | printk(KERN_WARNING "WARNING: stifb framebuffer driver does not " | ||
1112 | "support '%s' in double-buffer mode.\n" | ||
1113 | KERN_WARNING "WARNING: Please disable the double-buffer mode " | ||
1114 | "in IPL menu (the PARISC-BIOS).\n", | ||
1110 | sti->outptr.dev_name); | 1115 | sti->outptr.dev_name); |
1111 | goto out_err0; | 1116 | goto out_err0; |
1112 | } | 1117 | } |
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c index 2fbd8dd16df5..6840dfebe4d4 100644 --- a/drivers/w1/w1_int.c +++ b/drivers/w1/w1_int.c | |||
@@ -170,22 +170,24 @@ void __w1_remove_master_device(struct w1_master *dev) | |||
170 | 170 | ||
171 | void w1_remove_master_device(struct w1_bus_master *bm) | 171 | void w1_remove_master_device(struct w1_bus_master *bm) |
172 | { | 172 | { |
173 | struct w1_master *dev = NULL; | 173 | struct w1_master *dev, *found = NULL; |
174 | 174 | ||
175 | list_for_each_entry(dev, &w1_masters, w1_master_entry) { | 175 | list_for_each_entry(dev, &w1_masters, w1_master_entry) { |
176 | if (!dev->initialized) | 176 | if (!dev->initialized) |
177 | continue; | 177 | continue; |
178 | 178 | ||
179 | if (dev->bus_master->data == bm->data) | 179 | if (dev->bus_master->data == bm->data) { |
180 | found = dev; | ||
180 | break; | 181 | break; |
182 | } | ||
181 | } | 183 | } |
182 | 184 | ||
183 | if (!dev) { | 185 | if (!found) { |
184 | printk(KERN_ERR "Device doesn't exist.\n"); | 186 | printk(KERN_ERR "Device doesn't exist.\n"); |
185 | return; | 187 | return; |
186 | } | 188 | } |
187 | 189 | ||
188 | __w1_remove_master_device(dev); | 190 | __w1_remove_master_device(found); |
189 | } | 191 | } |
190 | 192 | ||
191 | EXPORT_SYMBOL(w1_add_master_device); | 193 | EXPORT_SYMBOL(w1_add_master_device); |
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c index 9130f1c12c26..808b4f8675c5 100644 --- a/drivers/zorro/zorro-sysfs.c +++ b/drivers/zorro/zorro-sysfs.c | |||
@@ -78,7 +78,7 @@ static ssize_t zorro_read_config(struct kobject *kobj, | |||
78 | static struct bin_attribute zorro_config_attr = { | 78 | static struct bin_attribute zorro_config_attr = { |
79 | .attr = { | 79 | .attr = { |
80 | .name = "config", | 80 | .name = "config", |
81 | .mode = S_IRUGO | S_IWUSR, | 81 | .mode = S_IRUGO, |
82 | }, | 82 | }, |
83 | .size = sizeof(struct ConfigDev), | 83 | .size = sizeof(struct ConfigDev), |
84 | .read = zorro_read_config, | 84 | .read = zorro_read_config, |