diff options
Diffstat (limited to 'drivers/scsi/aacraid/linit.c')
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 64 |
1 files changed, 49 insertions, 15 deletions
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 720330778648..6ef89c99dd12 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -27,12 +27,6 @@ | |||
27 | * Abstract: Linux Driver entry module for Adaptec RAID Array Controller | 27 | * Abstract: Linux Driver entry module for Adaptec RAID Array Controller |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define AAC_DRIVER_VERSION "1.1-4" | ||
31 | #ifndef AAC_DRIVER_BRANCH | ||
32 | #define AAC_DRIVER_BRANCH "" | ||
33 | #endif | ||
34 | #define AAC_DRIVER_BUILD_DATE __DATE__ " " __TIME__ | ||
35 | #define AAC_DRIVERNAME "aacraid" | ||
36 | 30 | ||
37 | #include <linux/compat.h> | 31 | #include <linux/compat.h> |
38 | #include <linux/blkdev.h> | 32 | #include <linux/blkdev.h> |
@@ -62,6 +56,13 @@ | |||
62 | 56 | ||
63 | #include "aacraid.h" | 57 | #include "aacraid.h" |
64 | 58 | ||
59 | #define AAC_DRIVER_VERSION "1.1-5" | ||
60 | #ifndef AAC_DRIVER_BRANCH | ||
61 | #define AAC_DRIVER_BRANCH "" | ||
62 | #endif | ||
63 | #define AAC_DRIVER_BUILD_DATE __DATE__ " " __TIME__ | ||
64 | #define AAC_DRIVERNAME "aacraid" | ||
65 | |||
65 | #ifdef AAC_DRIVER_BUILD | 66 | #ifdef AAC_DRIVER_BUILD |
66 | #define _str(x) #x | 67 | #define _str(x) #x |
67 | #define str(x) _str(x) | 68 | #define str(x) _str(x) |
@@ -73,7 +74,7 @@ | |||
73 | MODULE_AUTHOR("Red Hat Inc and Adaptec"); | 74 | MODULE_AUTHOR("Red Hat Inc and Adaptec"); |
74 | MODULE_DESCRIPTION("Dell PERC2, 2/Si, 3/Si, 3/Di, " | 75 | MODULE_DESCRIPTION("Dell PERC2, 2/Si, 3/Si, 3/Di, " |
75 | "Adaptec Advanced Raid Products, " | 76 | "Adaptec Advanced Raid Products, " |
76 | "and HP NetRAID-4M SCSI driver"); | 77 | "HP NetRAID-4M, IBM ServeRAID & ICP SCSI driver"); |
77 | MODULE_LICENSE("GPL"); | 78 | MODULE_LICENSE("GPL"); |
78 | MODULE_VERSION(AAC_DRIVER_FULL_VERSION); | 79 | MODULE_VERSION(AAC_DRIVER_FULL_VERSION); |
79 | 80 | ||
@@ -243,6 +244,7 @@ static struct aac_driver_ident aac_drivers[] = { | |||
243 | static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 244 | static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
244 | { | 245 | { |
245 | cmd->scsi_done = done; | 246 | cmd->scsi_done = done; |
247 | cmd->SCp.phase = AAC_OWNER_LOWLEVEL; | ||
246 | return (aac_scsi_cmd(cmd) ? FAILED : 0); | 248 | return (aac_scsi_cmd(cmd) ? FAILED : 0); |
247 | } | 249 | } |
248 | 250 | ||
@@ -471,7 +473,8 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) | |||
471 | __shost_for_each_device(dev, host) { | 473 | __shost_for_each_device(dev, host) { |
472 | spin_lock_irqsave(&dev->list_lock, flags); | 474 | spin_lock_irqsave(&dev->list_lock, flags); |
473 | list_for_each_entry(command, &dev->cmd_list, list) { | 475 | list_for_each_entry(command, &dev->cmd_list, list) { |
474 | if (command->serial_number) { | 476 | if ((command != cmd) && |
477 | (command->SCp.phase == AAC_OWNER_FIRMWARE)) { | ||
475 | active++; | 478 | active++; |
476 | break; | 479 | break; |
477 | } | 480 | } |
@@ -569,12 +572,12 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long | |||
569 | 572 | ||
570 | f = compat_alloc_user_space(sizeof(*f)); | 573 | f = compat_alloc_user_space(sizeof(*f)); |
571 | ret = 0; | 574 | ret = 0; |
572 | if (clear_user(f, sizeof(*f) != sizeof(*f))) | 575 | if (clear_user(f, sizeof(*f)) != sizeof(*f)) |
573 | ret = -EFAULT; | 576 | ret = -EFAULT; |
574 | if (copy_in_user(f, (void __user *)arg, sizeof(struct fib_ioctl) - sizeof(u32))) | 577 | if (copy_in_user(f, (void __user *)arg, sizeof(struct fib_ioctl) - sizeof(u32))) |
575 | ret = -EFAULT; | 578 | ret = -EFAULT; |
576 | if (!ret) | 579 | if (!ret) |
577 | ret = aac_do_ioctl(dev, cmd, (void __user *)arg); | 580 | ret = aac_do_ioctl(dev, cmd, f); |
578 | break; | 581 | break; |
579 | } | 582 | } |
580 | 583 | ||
@@ -687,6 +690,18 @@ static ssize_t aac_show_serial_number(struct class_device *class_dev, | |||
687 | return len; | 690 | return len; |
688 | } | 691 | } |
689 | 692 | ||
693 | static ssize_t aac_show_max_channel(struct class_device *class_dev, char *buf) | ||
694 | { | ||
695 | return snprintf(buf, PAGE_SIZE, "%d\n", | ||
696 | class_to_shost(class_dev)->max_channel); | ||
697 | } | ||
698 | |||
699 | static ssize_t aac_show_max_id(struct class_device *class_dev, char *buf) | ||
700 | { | ||
701 | return snprintf(buf, PAGE_SIZE, "%d\n", | ||
702 | class_to_shost(class_dev)->max_id); | ||
703 | } | ||
704 | |||
690 | 705 | ||
691 | static struct class_device_attribute aac_model = { | 706 | static struct class_device_attribute aac_model = { |
692 | .attr = { | 707 | .attr = { |
@@ -730,6 +745,20 @@ static struct class_device_attribute aac_serial_number = { | |||
730 | }, | 745 | }, |
731 | .show = aac_show_serial_number, | 746 | .show = aac_show_serial_number, |
732 | }; | 747 | }; |
748 | static struct class_device_attribute aac_max_channel = { | ||
749 | .attr = { | ||
750 | .name = "max_channel", | ||
751 | .mode = S_IRUGO, | ||
752 | }, | ||
753 | .show = aac_show_max_channel, | ||
754 | }; | ||
755 | static struct class_device_attribute aac_max_id = { | ||
756 | .attr = { | ||
757 | .name = "max_id", | ||
758 | .mode = S_IRUGO, | ||
759 | }, | ||
760 | .show = aac_show_max_id, | ||
761 | }; | ||
733 | 762 | ||
734 | static struct class_device_attribute *aac_attrs[] = { | 763 | static struct class_device_attribute *aac_attrs[] = { |
735 | &aac_model, | 764 | &aac_model, |
@@ -738,6 +767,8 @@ static struct class_device_attribute *aac_attrs[] = { | |||
738 | &aac_monitor_version, | 767 | &aac_monitor_version, |
739 | &aac_bios_version, | 768 | &aac_bios_version, |
740 | &aac_serial_number, | 769 | &aac_serial_number, |
770 | &aac_max_channel, | ||
771 | &aac_max_id, | ||
741 | NULL | 772 | NULL |
742 | }; | 773 | }; |
743 | 774 | ||
@@ -775,6 +806,7 @@ static struct scsi_host_template aac_driver_template = { | |||
775 | .cmd_per_lun = AAC_NUM_IO_FIB, | 806 | .cmd_per_lun = AAC_NUM_IO_FIB, |
776 | #endif | 807 | #endif |
777 | .use_clustering = ENABLE_CLUSTERING, | 808 | .use_clustering = ENABLE_CLUSTERING, |
809 | .emulated = 1, | ||
778 | }; | 810 | }; |
779 | 811 | ||
780 | 812 | ||
@@ -798,10 +830,11 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
798 | error = pci_enable_device(pdev); | 830 | error = pci_enable_device(pdev); |
799 | if (error) | 831 | if (error) |
800 | goto out; | 832 | goto out; |
833 | error = -ENODEV; | ||
801 | 834 | ||
802 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || | 835 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || |
803 | pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) | 836 | pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) |
804 | goto out; | 837 | goto out_disable_pdev; |
805 | /* | 838 | /* |
806 | * If the quirk31 bit is set, the adapter needs adapter | 839 | * If the quirk31 bit is set, the adapter needs adapter |
807 | * to driver communication memory to be allocated below 2gig | 840 | * to driver communication memory to be allocated below 2gig |
@@ -809,7 +842,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
809 | if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) | 842 | if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) |
810 | if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) || | 843 | if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) || |
811 | pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK)) | 844 | pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK)) |
812 | goto out; | 845 | goto out_disable_pdev; |
813 | 846 | ||
814 | pci_set_master(pdev); | 847 | pci_set_master(pdev); |
815 | 848 | ||
@@ -904,9 +937,9 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
904 | * physical channels are address by their actual physical number+1 | 937 | * physical channels are address by their actual physical number+1 |
905 | */ | 938 | */ |
906 | if (aac->nondasd_support == 1) | 939 | if (aac->nondasd_support == 1) |
907 | shost->max_channel = aac->maximum_num_channels + 1; | 940 | shost->max_channel = aac->maximum_num_channels; |
908 | else | 941 | else |
909 | shost->max_channel = 1; | 942 | shost->max_channel = 0; |
910 | 943 | ||
911 | aac_get_config_status(aac); | 944 | aac_get_config_status(aac); |
912 | aac_get_containers(aac); | 945 | aac_get_containers(aac); |
@@ -1020,7 +1053,8 @@ static int __init aac_init(void) | |||
1020 | 1053 | ||
1021 | static void __exit aac_exit(void) | 1054 | static void __exit aac_exit(void) |
1022 | { | 1055 | { |
1023 | unregister_chrdev(aac_cfg_major, "aac"); | 1056 | if (aac_cfg_major > -1) |
1057 | unregister_chrdev(aac_cfg_major, "aac"); | ||
1024 | pci_unregister_driver(&aac_pci_driver); | 1058 | pci_unregister_driver(&aac_pci_driver); |
1025 | } | 1059 | } |
1026 | 1060 | ||