diff options
-rw-r--r-- | Documentation/scsi/ChangeLog.megaraid_sas | 15 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.c | 160 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.h | 12 |
3 files changed, 68 insertions, 119 deletions
diff --git a/Documentation/scsi/ChangeLog.megaraid_sas b/Documentation/scsi/ChangeLog.megaraid_sas new file mode 100644 index 000000000000..e2319aeffbcc --- /dev/null +++ b/Documentation/scsi/ChangeLog.megaraid_sas | |||
@@ -0,0 +1,15 @@ | |||
1 | 1 Release Date : Mon Dec 19 14:36:26 PST 2005 - Sumant Patro <Sumant.Patro@lsil.com> | ||
2 | 2 Current Version : 00.00.02.00-rc4 | ||
3 | 3 Older Version : 00.00.02.01 | ||
4 | |||
5 | i. Code reorganized to remove code duplication in megasas_build_cmd. | ||
6 | |||
7 | "There's a lot of duplicate code megasas_build_cmd. Move that out of the different codepathes and merge the reminder of megasas_build_cmd into megasas_queue_command" | ||
8 | |||
9 | - Christoph Hellwig <hch@lst.de> | ||
10 | |||
11 | ii. Defined MEGASAS_IOC_FIRMWARE32 for code paths that handles 32 bit applications in 64 bit systems. | ||
12 | |||
13 | "MEGASAS_IOC_FIRMWARE can't be redefined if CONFIG_COMPAT is set, we need to define a MEGASAS_IOC_FIRMWARE32 define so native binaries continue to work" | ||
14 | |||
15 | - Christoph Hellwig <hch@lst.de> | ||
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index 511ed52a5807..2fb53af8de2a 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
11 | * | 11 | * |
12 | * FILE : megaraid_sas.c | 12 | * FILE : megaraid_sas.c |
13 | * Version : v00.00.02.00-rc4 | 13 | * Version : v00.00.02.01 |
14 | * | 14 | * |
15 | * Authors: | 15 | * Authors: |
16 | * Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com> | 16 | * Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com> |
@@ -558,112 +558,29 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, | |||
558 | } | 558 | } |
559 | 559 | ||
560 | /** | 560 | /** |
561 | * megasas_build_cmd - Prepares a command packet | 561 | * megasas_is_ldio - Checks if the cmd is for logical drive |
562 | * @instance: Adapter soft state | 562 | * @scmd: SCSI command |
563 | * @scp: SCSI command | 563 | * |
564 | * @frame_count: [OUT] Number of frames used to prepare this command | 564 | * Called by megasas_queue_command to find out if the command to be queued |
565 | * is a logical drive command | ||
565 | */ | 566 | */ |
566 | static struct megasas_cmd *megasas_build_cmd(struct megasas_instance | 567 | static inline int megasas_is_ldio(struct scsi_cmnd *cmd) |
567 | *instance, | ||
568 | struct scsi_cmnd *scp, | ||
569 | int *frame_count) | ||
570 | { | 568 | { |
571 | u32 logical_cmd; | 569 | if (!MEGASAS_IS_LOGICAL(cmd)) |
572 | struct megasas_cmd *cmd; | 570 | return 0; |
573 | 571 | switch (cmd->cmnd[0]) { | |
574 | /* | 572 | case READ_10: |
575 | * Find out if this is logical or physical drive command. | 573 | case WRITE_10: |
576 | */ | 574 | case READ_12: |
577 | logical_cmd = MEGASAS_IS_LOGICAL(scp); | 575 | case WRITE_12: |
578 | 576 | case READ_6: | |
579 | /* | 577 | case WRITE_6: |
580 | * Logical drive command | 578 | case READ_16: |
581 | */ | 579 | case WRITE_16: |
582 | if (logical_cmd) { | 580 | return 1; |
583 | 581 | default: | |
584 | if (scp->device->id >= MEGASAS_MAX_LD) { | 582 | return 0; |
585 | scp->result = DID_BAD_TARGET << 16; | ||
586 | return NULL; | ||
587 | } | ||
588 | |||
589 | switch (scp->cmnd[0]) { | ||
590 | |||
591 | case READ_10: | ||
592 | case WRITE_10: | ||
593 | case READ_12: | ||
594 | case WRITE_12: | ||
595 | case READ_6: | ||
596 | case WRITE_6: | ||
597 | case READ_16: | ||
598 | case WRITE_16: | ||
599 | /* | ||
600 | * Fail for LUN > 0 | ||
601 | */ | ||
602 | if (scp->device->lun) { | ||
603 | scp->result = DID_BAD_TARGET << 16; | ||
604 | return NULL; | ||
605 | } | ||
606 | |||
607 | cmd = megasas_get_cmd(instance); | ||
608 | |||
609 | if (!cmd) { | ||
610 | scp->result = DID_IMM_RETRY << 16; | ||
611 | return NULL; | ||
612 | } | ||
613 | |||
614 | *frame_count = megasas_build_ldio(instance, scp, cmd); | ||
615 | |||
616 | if (!(*frame_count)) { | ||
617 | megasas_return_cmd(instance, cmd); | ||
618 | return NULL; | ||
619 | } | ||
620 | |||
621 | return cmd; | ||
622 | |||
623 | default: | ||
624 | /* | ||
625 | * Fail for LUN > 0 | ||
626 | */ | ||
627 | if (scp->device->lun) { | ||
628 | scp->result = DID_BAD_TARGET << 16; | ||
629 | return NULL; | ||
630 | } | ||
631 | |||
632 | cmd = megasas_get_cmd(instance); | ||
633 | |||
634 | if (!cmd) { | ||
635 | scp->result = DID_IMM_RETRY << 16; | ||
636 | return NULL; | ||
637 | } | ||
638 | |||
639 | *frame_count = megasas_build_dcdb(instance, scp, cmd); | ||
640 | |||
641 | if (!(*frame_count)) { | ||
642 | megasas_return_cmd(instance, cmd); | ||
643 | return NULL; | ||
644 | } | ||
645 | |||
646 | return cmd; | ||
647 | } | ||
648 | } else { | ||
649 | cmd = megasas_get_cmd(instance); | ||
650 | |||
651 | if (!cmd) { | ||
652 | scp->result = DID_IMM_RETRY << 16; | ||
653 | return NULL; | ||
654 | } | ||
655 | |||
656 | *frame_count = megasas_build_dcdb(instance, scp, cmd); | ||
657 | |||
658 | if (!(*frame_count)) { | ||
659 | megasas_return_cmd(instance, cmd); | ||
660 | return NULL; | ||
661 | } | ||
662 | |||
663 | return cmd; | ||
664 | } | 583 | } |
665 | |||
666 | return NULL; | ||
667 | } | 584 | } |
668 | 585 | ||
669 | /** | 586 | /** |
@@ -684,13 +601,27 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) | |||
684 | scmd->scsi_done = done; | 601 | scmd->scsi_done = done; |
685 | scmd->result = 0; | 602 | scmd->result = 0; |
686 | 603 | ||
687 | cmd = megasas_build_cmd(instance, scmd, &frame_count); | 604 | if (MEGASAS_IS_LOGICAL(scmd) && |
688 | 605 | (scmd->device->id >= MEGASAS_MAX_LD || scmd->device->lun)) { | |
689 | if (!cmd) { | 606 | scmd->result = DID_BAD_TARGET << 16; |
690 | done(scmd); | 607 | goto out_done; |
691 | return 0; | ||
692 | } | 608 | } |
693 | 609 | ||
610 | cmd = megasas_get_cmd(instance); | ||
611 | if (!cmd) | ||
612 | return SCSI_MLQUEUE_HOST_BUSY; | ||
613 | |||
614 | /* | ||
615 | * Logical drive command | ||
616 | */ | ||
617 | if (megasas_is_ldio(scmd)) | ||
618 | frame_count = megasas_build_ldio(instance, scmd, cmd); | ||
619 | else | ||
620 | frame_count = megasas_build_dcdb(instance, scmd, cmd); | ||
621 | |||
622 | if (!frame_count) | ||
623 | goto out_return_cmd; | ||
624 | |||
694 | cmd->scmd = scmd; | 625 | cmd->scmd = scmd; |
695 | scmd->SCp.ptr = (char *)cmd; | 626 | scmd->SCp.ptr = (char *)cmd; |
696 | scmd->SCp.sent_command = jiffies; | 627 | scmd->SCp.sent_command = jiffies; |
@@ -706,6 +637,12 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) | |||
706 | &instance->reg_set->inbound_queue_port); | 637 | &instance->reg_set->inbound_queue_port); |
707 | 638 | ||
708 | return 0; | 639 | return 0; |
640 | |||
641 | out_return_cmd: | ||
642 | megasas_return_cmd(instance, cmd); | ||
643 | out_done: | ||
644 | done(scmd); | ||
645 | return 0; | ||
709 | } | 646 | } |
710 | 647 | ||
711 | /** | 648 | /** |
@@ -2681,9 +2618,8 @@ megasas_mgmt_compat_ioctl(struct file *file, unsigned int cmd, | |||
2681 | unsigned long arg) | 2618 | unsigned long arg) |
2682 | { | 2619 | { |
2683 | switch (cmd) { | 2620 | switch (cmd) { |
2684 | case MEGASAS_IOC_FIRMWARE:{ | 2621 | case MEGASAS_IOC_FIRMWARE32: |
2685 | return megasas_mgmt_compat_ioctl_fw(file, arg); | 2622 | return megasas_mgmt_compat_ioctl_fw(file, arg); |
2686 | } | ||
2687 | case MEGASAS_IOC_GET_AEN: | 2623 | case MEGASAS_IOC_GET_AEN: |
2688 | return megasas_mgmt_ioctl_aen(file, arg); | 2624 | return megasas_mgmt_ioctl_aen(file, arg); |
2689 | } | 2625 | } |
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index eaec9d531424..67e07d30258f 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -18,10 +18,9 @@ | |||
18 | /** | 18 | /** |
19 | * MegaRAID SAS Driver meta data | 19 | * MegaRAID SAS Driver meta data |
20 | */ | 20 | */ |
21 | #define MEGASAS_VERSION "00.00.02.00-rc4" | 21 | #define MEGASAS_VERSION "00.00.02.01" |
22 | #define MEGASAS_RELDATE "Sep 16, 2005" | 22 | #define MEGASAS_RELDATE "Dec 19, 2005" |
23 | #define MEGASAS_EXT_VERSION "Fri Sep 16 12:37:08 EDT 2005" | 23 | #define MEGASAS_EXT_VERSION "Mon Dec 19 14:36:26 PST 2005" |
24 | |||
25 | /* | 24 | /* |
26 | * ===================================== | 25 | * ===================================== |
27 | * MegaRAID SAS MFI firmware definitions | 26 | * MegaRAID SAS MFI firmware definitions |
@@ -1125,11 +1124,10 @@ struct compat_megasas_iocpacket { | |||
1125 | struct compat_iovec sgl[MAX_IOCTL_SGE]; | 1124 | struct compat_iovec sgl[MAX_IOCTL_SGE]; |
1126 | } __attribute__ ((packed)); | 1125 | } __attribute__ ((packed)); |
1127 | 1126 | ||
1128 | #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct compat_megasas_iocpacket) | ||
1129 | #else | ||
1130 | #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket) | ||
1131 | #endif | 1127 | #endif |
1132 | 1128 | ||
1129 | #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket) | ||
1130 | #define MEGASAS_IOC_FIRMWARE32 _IOWR('M', 1, struct compat_megasas_iocpacket) | ||
1133 | #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen) | 1131 | #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen) |
1134 | 1132 | ||
1135 | struct megasas_mgmt_info { | 1133 | struct megasas_mgmt_info { |