diff options
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 237 | ||||
-rw-r--r-- | drivers/scsi/aacraid/aacraid.h | 79 | ||||
-rw-r--r-- | drivers/scsi/aacraid/commctrl.c | 2 | ||||
-rw-r--r-- | drivers/scsi/aacraid/comminit.c | 54 | ||||
-rw-r--r-- | drivers/scsi/aacraid/commsup.c | 31 | ||||
-rw-r--r-- | drivers/scsi/aacraid/dpcsup.c | 6 | ||||
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 16 | ||||
-rw-r--r-- | drivers/scsi/aacraid/nark.c | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/rkt.c | 2 | ||||
-rw-r--r-- | drivers/scsi/aacraid/rx.c | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/sa.c | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/src.c | 96 |
12 files changed, 396 insertions, 139 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 52551662d107..d79457ac8bef 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -135,6 +135,8 @@ struct inquiry_data { | |||
135 | static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); | 135 | static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); |
136 | static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); | 136 | static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); |
137 | static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); | 137 | static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); |
138 | static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct aac_raw_io2 *rio2, int sg_max); | ||
139 | static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, int nseg_new); | ||
138 | static int aac_send_srb_fib(struct scsi_cmnd* scsicmd); | 140 | static int aac_send_srb_fib(struct scsi_cmnd* scsicmd); |
139 | #ifdef AAC_DETAILED_STATUS_INFO | 141 | #ifdef AAC_DETAILED_STATUS_INFO |
140 | static char *aac_get_status_string(u32 status); | 142 | static char *aac_get_status_string(u32 status); |
@@ -152,10 +154,14 @@ int aac_commit = -1; | |||
152 | int startup_timeout = 180; | 154 | int startup_timeout = 180; |
153 | int aif_timeout = 120; | 155 | int aif_timeout = 120; |
154 | int aac_sync_mode; /* Only Sync. transfer - disabled */ | 156 | int aac_sync_mode; /* Only Sync. transfer - disabled */ |
157 | int aac_convert_sgl = 1; /* convert non-conformable s/g list - enabled */ | ||
155 | 158 | ||
156 | module_param(aac_sync_mode, int, S_IRUGO|S_IWUSR); | 159 | module_param(aac_sync_mode, int, S_IRUGO|S_IWUSR); |
157 | MODULE_PARM_DESC(aac_sync_mode, "Force sync. transfer mode" | 160 | MODULE_PARM_DESC(aac_sync_mode, "Force sync. transfer mode" |
158 | " 0=off, 1=on"); | 161 | " 0=off, 1=on"); |
162 | module_param(aac_convert_sgl, int, S_IRUGO|S_IWUSR); | ||
163 | MODULE_PARM_DESC(aac_convert_sgl, "Convert non-conformable s/g list" | ||
164 | " 0=off, 1=on"); | ||
159 | module_param(nondasd, int, S_IRUGO|S_IWUSR); | 165 | module_param(nondasd, int, S_IRUGO|S_IWUSR); |
160 | MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices." | 166 | MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices." |
161 | " 0=off, 1=on"); | 167 | " 0=off, 1=on"); |
@@ -963,25 +969,44 @@ static void io_callback(void *context, struct fib * fibptr); | |||
963 | 969 | ||
964 | static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 count) | 970 | static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 count) |
965 | { | 971 | { |
966 | u16 fibsize; | 972 | struct aac_dev *dev = fib->dev; |
967 | struct aac_raw_io *readcmd; | 973 | u16 fibsize, command; |
974 | |||
968 | aac_fib_init(fib); | 975 | aac_fib_init(fib); |
969 | readcmd = (struct aac_raw_io *) fib_data(fib); | 976 | if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2 && !dev->sync_mode) { |
970 | readcmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); | 977 | struct aac_raw_io2 *readcmd2; |
971 | readcmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); | 978 | readcmd2 = (struct aac_raw_io2 *) fib_data(fib); |
972 | readcmd->count = cpu_to_le32(count<<9); | 979 | memset(readcmd2, 0, sizeof(struct aac_raw_io2)); |
973 | readcmd->cid = cpu_to_le16(scmd_id(cmd)); | 980 | readcmd2->blockLow = cpu_to_le32((u32)(lba&0xffffffff)); |
974 | readcmd->flags = cpu_to_le16(IO_TYPE_READ); | 981 | readcmd2->blockHigh = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); |
975 | readcmd->bpTotal = 0; | 982 | readcmd2->byteCount = cpu_to_le32(count<<9); |
976 | readcmd->bpComplete = 0; | 983 | readcmd2->cid = cpu_to_le16(scmd_id(cmd)); |
984 | readcmd2->flags = cpu_to_le16(RIO2_IO_TYPE_READ); | ||
985 | aac_build_sgraw2(cmd, readcmd2, dev->scsi_host_ptr->sg_tablesize); | ||
986 | command = ContainerRawIo2; | ||
987 | fibsize = sizeof(struct aac_raw_io2) + | ||
988 | ((le32_to_cpu(readcmd2->sgeCnt)-1) * sizeof(struct sge_ieee1212)); | ||
989 | } else { | ||
990 | struct aac_raw_io *readcmd; | ||
991 | readcmd = (struct aac_raw_io *) fib_data(fib); | ||
992 | readcmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); | ||
993 | readcmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); | ||
994 | readcmd->count = cpu_to_le32(count<<9); | ||
995 | readcmd->cid = cpu_to_le16(scmd_id(cmd)); | ||
996 | readcmd->flags = cpu_to_le16(RIO_TYPE_READ); | ||
997 | readcmd->bpTotal = 0; | ||
998 | readcmd->bpComplete = 0; | ||
999 | aac_build_sgraw(cmd, &readcmd->sg); | ||
1000 | command = ContainerRawIo; | ||
1001 | fibsize = sizeof(struct aac_raw_io) + | ||
1002 | ((le32_to_cpu(readcmd->sg.count)-1) * sizeof(struct sgentryraw)); | ||
1003 | } | ||
977 | 1004 | ||
978 | aac_build_sgraw(cmd, &readcmd->sg); | ||
979 | fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd->sg.count) - 1) * sizeof (struct sgentryraw)); | ||
980 | BUG_ON(fibsize > (fib->dev->max_fib_size - sizeof(struct aac_fibhdr))); | 1005 | BUG_ON(fibsize > (fib->dev->max_fib_size - sizeof(struct aac_fibhdr))); |
981 | /* | 1006 | /* |
982 | * Now send the Fib to the adapter | 1007 | * Now send the Fib to the adapter |
983 | */ | 1008 | */ |
984 | return aac_fib_send(ContainerRawIo, | 1009 | return aac_fib_send(command, |
985 | fib, | 1010 | fib, |
986 | fibsize, | 1011 | fibsize, |
987 | FsaNormal, | 1012 | FsaNormal, |
@@ -1052,28 +1077,50 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 | |||
1052 | 1077 | ||
1053 | static int aac_write_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 count, int fua) | 1078 | static int aac_write_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 count, int fua) |
1054 | { | 1079 | { |
1055 | u16 fibsize; | 1080 | struct aac_dev *dev = fib->dev; |
1056 | struct aac_raw_io *writecmd; | 1081 | u16 fibsize, command; |
1082 | |||
1057 | aac_fib_init(fib); | 1083 | aac_fib_init(fib); |
1058 | writecmd = (struct aac_raw_io *) fib_data(fib); | 1084 | if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2 && !dev->sync_mode) { |
1059 | writecmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); | 1085 | struct aac_raw_io2 *writecmd2; |
1060 | writecmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); | 1086 | writecmd2 = (struct aac_raw_io2 *) fib_data(fib); |
1061 | writecmd->count = cpu_to_le32(count<<9); | 1087 | memset(writecmd2, 0, sizeof(struct aac_raw_io2)); |
1062 | writecmd->cid = cpu_to_le16(scmd_id(cmd)); | 1088 | writecmd2->blockLow = cpu_to_le32((u32)(lba&0xffffffff)); |
1063 | writecmd->flags = (fua && ((aac_cache & 5) != 1) && | 1089 | writecmd2->blockHigh = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); |
1064 | (((aac_cache & 5) != 5) || !fib->dev->cache_protected)) ? | 1090 | writecmd2->byteCount = cpu_to_le32(count<<9); |
1065 | cpu_to_le16(IO_TYPE_WRITE|IO_SUREWRITE) : | 1091 | writecmd2->cid = cpu_to_le16(scmd_id(cmd)); |
1066 | cpu_to_le16(IO_TYPE_WRITE); | 1092 | writecmd2->flags = (fua && ((aac_cache & 5) != 1) && |
1067 | writecmd->bpTotal = 0; | 1093 | (((aac_cache & 5) != 5) || !fib->dev->cache_protected)) ? |
1068 | writecmd->bpComplete = 0; | 1094 | cpu_to_le16(RIO2_IO_TYPE_WRITE|RIO2_IO_SUREWRITE) : |
1069 | 1095 | cpu_to_le16(RIO2_IO_TYPE_WRITE); | |
1070 | aac_build_sgraw(cmd, &writecmd->sg); | 1096 | aac_build_sgraw2(cmd, writecmd2, dev->scsi_host_ptr->sg_tablesize); |
1071 | fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(writecmd->sg.count) - 1) * sizeof (struct sgentryraw)); | 1097 | command = ContainerRawIo2; |
1098 | fibsize = sizeof(struct aac_raw_io2) + | ||
1099 | ((le32_to_cpu(writecmd2->sgeCnt)-1) * sizeof(struct sge_ieee1212)); | ||
1100 | } else { | ||
1101 | struct aac_raw_io *writecmd; | ||
1102 | writecmd = (struct aac_raw_io *) fib_data(fib); | ||
1103 | writecmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); | ||
1104 | writecmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); | ||
1105 | writecmd->count = cpu_to_le32(count<<9); | ||
1106 | writecmd->cid = cpu_to_le16(scmd_id(cmd)); | ||
1107 | writecmd->flags = (fua && ((aac_cache & 5) != 1) && | ||
1108 | (((aac_cache & 5) != 5) || !fib->dev->cache_protected)) ? | ||
1109 | cpu_to_le16(RIO_TYPE_WRITE|RIO_SUREWRITE) : | ||
1110 | cpu_to_le16(RIO_TYPE_WRITE); | ||
1111 | writecmd->bpTotal = 0; | ||
1112 | writecmd->bpComplete = 0; | ||
1113 | aac_build_sgraw(cmd, &writecmd->sg); | ||
1114 | command = ContainerRawIo; | ||
1115 | fibsize = sizeof(struct aac_raw_io) + | ||
1116 | ((le32_to_cpu(writecmd->sg.count)-1) * sizeof (struct sgentryraw)); | ||
1117 | } | ||
1118 | |||
1072 | BUG_ON(fibsize > (fib->dev->max_fib_size - sizeof(struct aac_fibhdr))); | 1119 | BUG_ON(fibsize > (fib->dev->max_fib_size - sizeof(struct aac_fibhdr))); |
1073 | /* | 1120 | /* |
1074 | * Now send the Fib to the adapter | 1121 | * Now send the Fib to the adapter |
1075 | */ | 1122 | */ |
1076 | return aac_fib_send(ContainerRawIo, | 1123 | return aac_fib_send(command, |
1077 | fib, | 1124 | fib, |
1078 | fibsize, | 1125 | fibsize, |
1079 | FsaNormal, | 1126 | FsaNormal, |
@@ -1492,8 +1539,6 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1492 | dev->a_ops.adapter_write = aac_write_block; | 1539 | dev->a_ops.adapter_write = aac_write_block; |
1493 | } | 1540 | } |
1494 | dev->scsi_host_ptr->max_sectors = AAC_MAX_32BIT_SGBCOUNT; | 1541 | dev->scsi_host_ptr->max_sectors = AAC_MAX_32BIT_SGBCOUNT; |
1495 | if (dev->adapter_info.options & AAC_OPT_NEW_COMM_TYPE1) | ||
1496 | dev->adapter_info.options |= AAC_OPT_NEW_COMM; | ||
1497 | if (!(dev->adapter_info.options & AAC_OPT_NEW_COMM)) { | 1542 | if (!(dev->adapter_info.options & AAC_OPT_NEW_COMM)) { |
1498 | /* | 1543 | /* |
1499 | * Worst case size that could cause sg overflow when | 1544 | * Worst case size that could cause sg overflow when |
@@ -2616,12 +2661,18 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
2616 | srbreply = (struct aac_srb_reply *) fib_data(fibptr); | 2661 | srbreply = (struct aac_srb_reply *) fib_data(fibptr); |
2617 | 2662 | ||
2618 | scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */ | 2663 | scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */ |
2619 | /* | ||
2620 | * Calculate resid for sg | ||
2621 | */ | ||
2622 | 2664 | ||
2623 | scsi_set_resid(scsicmd, scsi_bufflen(scsicmd) | 2665 | if (fibptr->flags & FIB_CONTEXT_FLAG_FASTRESP) { |
2624 | - le32_to_cpu(srbreply->data_xfer_length)); | 2666 | /* fast response */ |
2667 | srbreply->srb_status = cpu_to_le32(SRB_STATUS_SUCCESS); | ||
2668 | srbreply->scsi_status = cpu_to_le32(SAM_STAT_GOOD); | ||
2669 | } else { | ||
2670 | /* | ||
2671 | * Calculate resid for sg | ||
2672 | */ | ||
2673 | scsi_set_resid(scsicmd, scsi_bufflen(scsicmd) | ||
2674 | - le32_to_cpu(srbreply->data_xfer_length)); | ||
2675 | } | ||
2625 | 2676 | ||
2626 | scsi_dma_unmap(scsicmd); | 2677 | scsi_dma_unmap(scsicmd); |
2627 | 2678 | ||
@@ -2954,6 +3005,118 @@ static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* | |||
2954 | return byte_count; | 3005 | return byte_count; |
2955 | } | 3006 | } |
2956 | 3007 | ||
3008 | static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct aac_raw_io2 *rio2, int sg_max) | ||
3009 | { | ||
3010 | unsigned long byte_count = 0; | ||
3011 | int nseg; | ||
3012 | |||
3013 | nseg = scsi_dma_map(scsicmd); | ||
3014 | BUG_ON(nseg < 0); | ||
3015 | if (nseg) { | ||
3016 | struct scatterlist *sg; | ||
3017 | int i, conformable = 0; | ||
3018 | u32 min_size = PAGE_SIZE, cur_size; | ||
3019 | |||
3020 | scsi_for_each_sg(scsicmd, sg, nseg, i) { | ||
3021 | int count = sg_dma_len(sg); | ||
3022 | u64 addr = sg_dma_address(sg); | ||
3023 | |||
3024 | BUG_ON(i >= sg_max); | ||
3025 | rio2->sge[i].addrHigh = cpu_to_le32((u32)(addr>>32)); | ||
3026 | rio2->sge[i].addrLow = cpu_to_le32((u32)(addr & 0xffffffff)); | ||
3027 | cur_size = cpu_to_le32(count); | ||
3028 | rio2->sge[i].length = cur_size; | ||
3029 | rio2->sge[i].flags = 0; | ||
3030 | if (i == 0) { | ||
3031 | conformable = 1; | ||
3032 | rio2->sgeFirstSize = cur_size; | ||
3033 | } else if (i == 1) { | ||
3034 | rio2->sgeNominalSize = cur_size; | ||
3035 | min_size = cur_size; | ||
3036 | } else if ((i+1) < nseg && cur_size != rio2->sgeNominalSize) { | ||
3037 | conformable = 0; | ||
3038 | if (cur_size < min_size) | ||
3039 | min_size = cur_size; | ||
3040 | } | ||
3041 | byte_count += count; | ||
3042 | } | ||
3043 | |||
3044 | /* hba wants the size to be exact */ | ||
3045 | if (byte_count > scsi_bufflen(scsicmd)) { | ||
3046 | u32 temp = le32_to_cpu(rio2->sge[i-1].length) - | ||
3047 | (byte_count - scsi_bufflen(scsicmd)); | ||
3048 | rio2->sge[i-1].length = cpu_to_le32(temp); | ||
3049 | byte_count = scsi_bufflen(scsicmd); | ||
3050 | } | ||
3051 | |||
3052 | rio2->sgeCnt = cpu_to_le32(nseg); | ||
3053 | rio2->flags |= cpu_to_le16(RIO2_SG_FORMAT_IEEE1212); | ||
3054 | /* not conformable: evaluate required sg elements */ | ||
3055 | if (!conformable) { | ||
3056 | int j, nseg_new = nseg, err_found; | ||
3057 | for (i = min_size / PAGE_SIZE; i >= 1; --i) { | ||
3058 | err_found = 0; | ||
3059 | nseg_new = 2; | ||
3060 | for (j = 1; j < nseg - 1; ++j) { | ||
3061 | if (rio2->sge[j].length % (i*PAGE_SIZE)) { | ||
3062 | err_found = 1; | ||
3063 | break; | ||
3064 | } | ||
3065 | nseg_new += (rio2->sge[j].length / (i*PAGE_SIZE)); | ||
3066 | } | ||
3067 | if (!err_found) | ||
3068 | break; | ||
3069 | } | ||
3070 | if (i > 0 && nseg_new <= sg_max) | ||
3071 | aac_convert_sgraw2(rio2, i, nseg, nseg_new); | ||
3072 | } else | ||
3073 | rio2->flags |= cpu_to_le16(RIO2_SGL_CONFORMANT); | ||
3074 | |||
3075 | /* Check for command underflow */ | ||
3076 | if (scsicmd->underflow && (byte_count < scsicmd->underflow)) { | ||
3077 | printk(KERN_WARNING"aacraid: cmd len %08lX cmd underflow %08X\n", | ||
3078 | byte_count, scsicmd->underflow); | ||
3079 | } | ||
3080 | } | ||
3081 | |||
3082 | return byte_count; | ||
3083 | } | ||
3084 | |||
3085 | static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, int nseg_new) | ||
3086 | { | ||
3087 | struct sge_ieee1212 *sge; | ||
3088 | int i, j, pos; | ||
3089 | u32 addr_low; | ||
3090 | |||
3091 | if (aac_convert_sgl == 0) | ||
3092 | return 0; | ||
3093 | |||
3094 | sge = kmalloc(nseg_new * sizeof(struct sge_ieee1212), GFP_ATOMIC); | ||
3095 | if (sge == NULL) | ||
3096 | return -1; | ||
3097 | |||
3098 | for (i = 1, pos = 1; i < nseg-1; ++i) { | ||
3099 | for (j = 0; j < rio2->sge[i].length / (pages * PAGE_SIZE); ++j) { | ||
3100 | addr_low = rio2->sge[i].addrLow + j * pages * PAGE_SIZE; | ||
3101 | sge[pos].addrLow = addr_low; | ||
3102 | sge[pos].addrHigh = rio2->sge[i].addrHigh; | ||
3103 | if (addr_low < rio2->sge[i].addrLow) | ||
3104 | sge[pos].addrHigh++; | ||
3105 | sge[pos].length = pages * PAGE_SIZE; | ||
3106 | sge[pos].flags = 0; | ||
3107 | pos++; | ||
3108 | } | ||
3109 | } | ||
3110 | sge[pos] = rio2->sge[nseg-1]; | ||
3111 | memcpy(&rio2->sge[1], &sge[1], (nseg_new-1)*sizeof(struct sge_ieee1212)); | ||
3112 | |||
3113 | kfree(sge); | ||
3114 | rio2->sgeCnt = cpu_to_le32(nseg_new); | ||
3115 | rio2->flags |= cpu_to_le16(RIO2_SGL_CONFORMANT); | ||
3116 | rio2->sgeNominalSize = pages * PAGE_SIZE; | ||
3117 | return 0; | ||
3118 | } | ||
3119 | |||
2957 | #ifdef AAC_DETAILED_STATUS_INFO | 3120 | #ifdef AAC_DETAILED_STATUS_INFO |
2958 | 3121 | ||
2959 | struct aac_srb_status_info { | 3122 | struct aac_srb_status_info { |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 3fcf62724fad..9e933a88a8bc 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -12,7 +12,7 @@ | |||
12 | *----------------------------------------------------------------------------*/ | 12 | *----------------------------------------------------------------------------*/ |
13 | 13 | ||
14 | #ifndef AAC_DRIVER_BUILD | 14 | #ifndef AAC_DRIVER_BUILD |
15 | # define AAC_DRIVER_BUILD 28900 | 15 | # define AAC_DRIVER_BUILD 29800 |
16 | # define AAC_DRIVER_BRANCH "-ms" | 16 | # define AAC_DRIVER_BRANCH "-ms" |
17 | #endif | 17 | #endif |
18 | #define MAXIMUM_NUM_CONTAINERS 32 | 18 | #define MAXIMUM_NUM_CONTAINERS 32 |
@@ -100,6 +100,13 @@ struct user_sgentryraw { | |||
100 | u32 flags; /* reserved for F/W use */ | 100 | u32 flags; /* reserved for F/W use */ |
101 | }; | 101 | }; |
102 | 102 | ||
103 | struct sge_ieee1212 { | ||
104 | u32 addrLow; | ||
105 | u32 addrHigh; | ||
106 | u32 length; | ||
107 | u32 flags; | ||
108 | }; | ||
109 | |||
103 | /* | 110 | /* |
104 | * SGMAP | 111 | * SGMAP |
105 | * | 112 | * |
@@ -270,6 +277,8 @@ enum aac_queue_types { | |||
270 | */ | 277 | */ |
271 | 278 | ||
272 | #define FIB_MAGIC 0x0001 | 279 | #define FIB_MAGIC 0x0001 |
280 | #define FIB_MAGIC2 0x0004 | ||
281 | #define FIB_MAGIC2_64 0x0005 | ||
273 | 282 | ||
274 | /* | 283 | /* |
275 | * Define the priority levels the FSA communication routines support. | 284 | * Define the priority levels the FSA communication routines support. |
@@ -296,22 +305,20 @@ struct aac_fibhdr { | |||
296 | __le32 XferState; /* Current transfer state for this CCB */ | 305 | __le32 XferState; /* Current transfer state for this CCB */ |
297 | __le16 Command; /* Routing information for the destination */ | 306 | __le16 Command; /* Routing information for the destination */ |
298 | u8 StructType; /* Type FIB */ | 307 | u8 StructType; /* Type FIB */ |
299 | u8 Flags; /* Flags for FIB */ | 308 | u8 Unused; /* Unused */ |
300 | __le16 Size; /* Size of this FIB in bytes */ | 309 | __le16 Size; /* Size of this FIB in bytes */ |
301 | __le16 SenderSize; /* Size of the FIB in the sender | 310 | __le16 SenderSize; /* Size of the FIB in the sender |
302 | (for response sizing) */ | 311 | (for response sizing) */ |
303 | __le32 SenderFibAddress; /* Host defined data in the FIB */ | 312 | __le32 SenderFibAddress; /* Host defined data in the FIB */ |
304 | __le32 ReceiverFibAddress;/* Logical address of this FIB for | ||
305 | the adapter */ | ||
306 | u32 SenderData; /* Place holder for the sender to store data */ | ||
307 | union { | 313 | union { |
308 | struct { | 314 | __le32 ReceiverFibAddress;/* Logical address of this FIB for |
309 | __le32 _ReceiverTimeStart; /* Timestamp for | 315 | the adapter (old) */ |
310 | receipt of fib */ | 316 | __le32 SenderFibAddressHigh;/* upper 32bit of phys. FIB address */ |
311 | __le32 _ReceiverTimeDone; /* Timestamp for | 317 | __le32 TimeStamp; /* otherwise timestamp for FW internal use */ |
312 | completion of fib */ | 318 | } u; |
313 | } _s; | 319 | u32 Handle; /* FIB handle used for MSGU commnunication */ |
314 | } _u; | 320 | u32 Previous; /* FW internal use */ |
321 | u32 Next; /* FW internal use */ | ||
315 | }; | 322 | }; |
316 | 323 | ||
317 | struct hw_fib { | 324 | struct hw_fib { |
@@ -361,6 +368,7 @@ struct hw_fib { | |||
361 | #define ContainerCommand 500 | 368 | #define ContainerCommand 500 |
362 | #define ContainerCommand64 501 | 369 | #define ContainerCommand64 501 |
363 | #define ContainerRawIo 502 | 370 | #define ContainerRawIo 502 |
371 | #define ContainerRawIo2 503 | ||
364 | /* | 372 | /* |
365 | * Scsi Port commands (scsi passthrough) | 373 | * Scsi Port commands (scsi passthrough) |
366 | */ | 374 | */ |
@@ -417,6 +425,7 @@ enum fib_xfer_state { | |||
417 | #define ADAPTER_INIT_STRUCT_REVISION 3 | 425 | #define ADAPTER_INIT_STRUCT_REVISION 3 |
418 | #define ADAPTER_INIT_STRUCT_REVISION_4 4 // rocket science | 426 | #define ADAPTER_INIT_STRUCT_REVISION_4 4 // rocket science |
419 | #define ADAPTER_INIT_STRUCT_REVISION_6 6 /* PMC src */ | 427 | #define ADAPTER_INIT_STRUCT_REVISION_6 6 /* PMC src */ |
428 | #define ADAPTER_INIT_STRUCT_REVISION_7 7 /* Denali */ | ||
420 | 429 | ||
421 | struct aac_init | 430 | struct aac_init |
422 | { | 431 | { |
@@ -441,7 +450,9 @@ struct aac_init | |||
441 | #define INITFLAGS_NEW_COMM_SUPPORTED 0x00000001 | 450 | #define INITFLAGS_NEW_COMM_SUPPORTED 0x00000001 |
442 | #define INITFLAGS_DRIVER_USES_UTC_TIME 0x00000010 | 451 | #define INITFLAGS_DRIVER_USES_UTC_TIME 0x00000010 |
443 | #define INITFLAGS_DRIVER_SUPPORTS_PM 0x00000020 | 452 | #define INITFLAGS_DRIVER_SUPPORTS_PM 0x00000020 |
444 | #define INITFLAGS_NEW_COMM_TYPE1_SUPPORTED 0x00000041 | 453 | #define INITFLAGS_NEW_COMM_TYPE1_SUPPORTED 0x00000040 |
454 | #define INITFLAGS_FAST_JBOD_SUPPORTED 0x00000080 | ||
455 | #define INITFLAGS_NEW_COMM_TYPE2_SUPPORTED 0x00000100 | ||
445 | __le32 MaxIoCommands; /* max outstanding commands */ | 456 | __le32 MaxIoCommands; /* max outstanding commands */ |
446 | __le32 MaxIoSize; /* largest I/O command */ | 457 | __le32 MaxIoSize; /* largest I/O command */ |
447 | __le32 MaxFibSize; /* largest FIB to adapter */ | 458 | __le32 MaxFibSize; /* largest FIB to adapter */ |
@@ -1052,10 +1063,11 @@ struct aac_dev | |||
1052 | struct adapter_ops a_ops; | 1063 | struct adapter_ops a_ops; |
1053 | unsigned long fsrev; /* Main driver's revision number */ | 1064 | unsigned long fsrev; /* Main driver's revision number */ |
1054 | 1065 | ||
1055 | unsigned long dbg_base; /* address of UART | 1066 | resource_size_t base_start; /* main IO base */ |
1067 | resource_size_t dbg_base; /* address of UART | ||
1056 | * debug buffer */ | 1068 | * debug buffer */ |
1057 | 1069 | ||
1058 | unsigned base_size, dbg_size; /* Size of | 1070 | resource_size_t base_size, dbg_size; /* Size of |
1059 | * mapped in region */ | 1071 | * mapped in region */ |
1060 | 1072 | ||
1061 | struct aac_init *init; /* Holds initialization info to communicate with adapter */ | 1073 | struct aac_init *init; /* Holds initialization info to communicate with adapter */ |
@@ -1123,6 +1135,7 @@ struct aac_dev | |||
1123 | # define AAC_COMM_PRODUCER 0 | 1135 | # define AAC_COMM_PRODUCER 0 |
1124 | # define AAC_COMM_MESSAGE 1 | 1136 | # define AAC_COMM_MESSAGE 1 |
1125 | # define AAC_COMM_MESSAGE_TYPE1 3 | 1137 | # define AAC_COMM_MESSAGE_TYPE1 3 |
1138 | # define AAC_COMM_MESSAGE_TYPE2 4 | ||
1126 | u8 raw_io_interface; | 1139 | u8 raw_io_interface; |
1127 | u8 raw_io_64; | 1140 | u8 raw_io_64; |
1128 | u8 printf_enabled; | 1141 | u8 printf_enabled; |
@@ -1181,6 +1194,7 @@ struct aac_dev | |||
1181 | #define FIB_CONTEXT_FLAG_TIMED_OUT (0x00000001) | 1194 | #define FIB_CONTEXT_FLAG_TIMED_OUT (0x00000001) |
1182 | #define FIB_CONTEXT_FLAG (0x00000002) | 1195 | #define FIB_CONTEXT_FLAG (0x00000002) |
1183 | #define FIB_CONTEXT_FLAG_WAIT (0x00000004) | 1196 | #define FIB_CONTEXT_FLAG_WAIT (0x00000004) |
1197 | #define FIB_CONTEXT_FLAG_FASTRESP (0x00000008) | ||
1184 | 1198 | ||
1185 | /* | 1199 | /* |
1186 | * Define the command values | 1200 | * Define the command values |
@@ -1287,6 +1301,22 @@ struct aac_dev | |||
1287 | #define CMDATA_SYNCH 4 | 1301 | #define CMDATA_SYNCH 4 |
1288 | #define CMUNSTABLE 5 | 1302 | #define CMUNSTABLE 5 |
1289 | 1303 | ||
1304 | #define RIO_TYPE_WRITE 0x0000 | ||
1305 | #define RIO_TYPE_READ 0x0001 | ||
1306 | #define RIO_SUREWRITE 0x0008 | ||
1307 | |||
1308 | #define RIO2_IO_TYPE 0x0003 | ||
1309 | #define RIO2_IO_TYPE_WRITE 0x0000 | ||
1310 | #define RIO2_IO_TYPE_READ 0x0001 | ||
1311 | #define RIO2_IO_TYPE_VERIFY 0x0002 | ||
1312 | #define RIO2_IO_ERROR 0x0004 | ||
1313 | #define RIO2_IO_SUREWRITE 0x0008 | ||
1314 | #define RIO2_SGL_CONFORMANT 0x0010 | ||
1315 | #define RIO2_SG_FORMAT 0xF000 | ||
1316 | #define RIO2_SG_FORMAT_ARC 0x0000 | ||
1317 | #define RIO2_SG_FORMAT_SRL 0x1000 | ||
1318 | #define RIO2_SG_FORMAT_IEEE1212 0x2000 | ||
1319 | |||
1290 | struct aac_read | 1320 | struct aac_read |
1291 | { | 1321 | { |
1292 | __le32 command; | 1322 | __le32 command; |
@@ -1331,9 +1361,6 @@ struct aac_write64 | |||
1331 | __le32 block; | 1361 | __le32 block; |
1332 | __le16 pad; | 1362 | __le16 pad; |
1333 | __le16 flags; | 1363 | __le16 flags; |
1334 | #define IO_TYPE_WRITE 0x00000000 | ||
1335 | #define IO_TYPE_READ 0x00000001 | ||
1336 | #define IO_SUREWRITE 0x00000008 | ||
1337 | struct sgmap64 sg; // Must be last in struct because it is variable | 1364 | struct sgmap64 sg; // Must be last in struct because it is variable |
1338 | }; | 1365 | }; |
1339 | struct aac_write_reply | 1366 | struct aac_write_reply |
@@ -1354,6 +1381,22 @@ struct aac_raw_io | |||
1354 | struct sgmapraw sg; | 1381 | struct sgmapraw sg; |
1355 | }; | 1382 | }; |
1356 | 1383 | ||
1384 | struct aac_raw_io2 { | ||
1385 | __le32 blockLow; | ||
1386 | __le32 blockHigh; | ||
1387 | __le32 byteCount; | ||
1388 | __le16 cid; | ||
1389 | __le16 flags; /* RIO2 flags */ | ||
1390 | __le32 sgeFirstSize; /* size of first sge el. */ | ||
1391 | __le32 sgeNominalSize; /* size of 2nd sge el. (if conformant) */ | ||
1392 | u8 sgeCnt; /* only 8 bits required */ | ||
1393 | u8 bpTotal; /* reserved for F/W use */ | ||
1394 | u8 bpComplete; /* reserved for F/W use */ | ||
1395 | u8 sgeFirstIndex; /* reserved for F/W use */ | ||
1396 | u8 unused[4]; | ||
1397 | struct sge_ieee1212 sge[1]; | ||
1398 | }; | ||
1399 | |||
1357 | #define CT_FLUSH_CACHE 129 | 1400 | #define CT_FLUSH_CACHE 129 |
1358 | struct aac_synchronize { | 1401 | struct aac_synchronize { |
1359 | __le32 command; /* VM_ContainerConfig */ | 1402 | __le32 command; /* VM_ContainerConfig */ |
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 0bd38da4ada0..1ef041bc60c8 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c | |||
@@ -498,6 +498,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
498 | return -ENOMEM; | 498 | return -ENOMEM; |
499 | } | 499 | } |
500 | aac_fib_init(srbfib); | 500 | aac_fib_init(srbfib); |
501 | /* raw_srb FIB is not FastResponseCapable */ | ||
502 | srbfib->hw_fib_va->header.XferState &= ~cpu_to_le32(FastResponseCapable); | ||
501 | 503 | ||
502 | srbcmd = (struct aac_srb*) fib_data(srbfib); | 504 | srbcmd = (struct aac_srb*) fib_data(srbfib); |
503 | 505 | ||
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index a35f54ebdce0..8e5d3be16127 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c | |||
@@ -58,7 +58,8 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co | |||
58 | dma_addr_t phys; | 58 | dma_addr_t phys; |
59 | unsigned long aac_max_hostphysmempages; | 59 | unsigned long aac_max_hostphysmempages; |
60 | 60 | ||
61 | if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1) | 61 | if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1 || |
62 | dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) | ||
62 | host_rrq_size = (dev->scsi_host_ptr->can_queue | 63 | host_rrq_size = (dev->scsi_host_ptr->can_queue |
63 | + AAC_NUM_MGT_FIB) * sizeof(u32); | 64 | + AAC_NUM_MGT_FIB) * sizeof(u32); |
64 | size = fibsize + sizeof(struct aac_init) + commsize + | 65 | size = fibsize + sizeof(struct aac_init) + commsize + |
@@ -75,7 +76,8 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co | |||
75 | dev->comm_phys = phys; | 76 | dev->comm_phys = phys; |
76 | dev->comm_size = size; | 77 | dev->comm_size = size; |
77 | 78 | ||
78 | if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1) { | 79 | if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1 || |
80 | dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) { | ||
79 | dev->host_rrq = (u32 *)(base + fibsize); | 81 | dev->host_rrq = (u32 *)(base + fibsize); |
80 | dev->host_rrq_pa = phys + fibsize; | 82 | dev->host_rrq_pa = phys + fibsize; |
81 | memset(dev->host_rrq, 0, host_rrq_size); | 83 | memset(dev->host_rrq, 0, host_rrq_size); |
@@ -115,26 +117,32 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co | |||
115 | else | 117 | else |
116 | init->HostPhysMemPages = cpu_to_le32(AAC_MAX_HOSTPHYSMEMPAGES); | 118 | init->HostPhysMemPages = cpu_to_le32(AAC_MAX_HOSTPHYSMEMPAGES); |
117 | 119 | ||
118 | init->InitFlags = 0; | 120 | init->InitFlags = cpu_to_le32(INITFLAGS_DRIVER_USES_UTC_TIME | |
121 | INITFLAGS_DRIVER_SUPPORTS_PM); | ||
122 | init->MaxIoCommands = cpu_to_le32(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); | ||
123 | init->MaxIoSize = cpu_to_le32(dev->scsi_host_ptr->max_sectors << 9); | ||
124 | init->MaxFibSize = cpu_to_le32(dev->max_fib_size); | ||
125 | init->MaxNumAif = cpu_to_le32(dev->max_num_aif); | ||
126 | |||
119 | if (dev->comm_interface == AAC_COMM_MESSAGE) { | 127 | if (dev->comm_interface == AAC_COMM_MESSAGE) { |
120 | init->InitFlags |= cpu_to_le32(INITFLAGS_NEW_COMM_SUPPORTED); | 128 | init->InitFlags |= cpu_to_le32(INITFLAGS_NEW_COMM_SUPPORTED); |
121 | dprintk((KERN_WARNING"aacraid: New Comm Interface enabled\n")); | 129 | dprintk((KERN_WARNING"aacraid: New Comm Interface enabled\n")); |
122 | } else if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1) { | 130 | } else if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1) { |
123 | init->InitStructRevision = cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_6); | 131 | init->InitStructRevision = cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_6); |
124 | init->InitFlags |= cpu_to_le32(INITFLAGS_NEW_COMM_TYPE1_SUPPORTED); | 132 | init->InitFlags |= cpu_to_le32(INITFLAGS_NEW_COMM_SUPPORTED | |
125 | dprintk((KERN_WARNING | 133 | INITFLAGS_NEW_COMM_TYPE1_SUPPORTED | INITFLAGS_FAST_JBOD_SUPPORTED); |
126 | "aacraid: New Comm Interface type1 enabled\n")); | 134 | init->HostRRQ_AddrHigh = cpu_to_le32((u32)((u64)dev->host_rrq_pa >> 32)); |
135 | init->HostRRQ_AddrLow = cpu_to_le32((u32)(dev->host_rrq_pa & 0xffffffff)); | ||
136 | dprintk((KERN_WARNING"aacraid: New Comm Interface type1 enabled\n")); | ||
137 | } else if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) { | ||
138 | init->InitStructRevision = cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_7); | ||
139 | init->InitFlags |= cpu_to_le32(INITFLAGS_NEW_COMM_SUPPORTED | | ||
140 | INITFLAGS_NEW_COMM_TYPE2_SUPPORTED | INITFLAGS_FAST_JBOD_SUPPORTED); | ||
141 | init->HostRRQ_AddrHigh = cpu_to_le32((u32)((u64)dev->host_rrq_pa >> 32)); | ||
142 | init->HostRRQ_AddrLow = cpu_to_le32((u32)(dev->host_rrq_pa & 0xffffffff)); | ||
143 | init->MiniPortRevision = cpu_to_le32(0L); /* number of MSI-X */ | ||
144 | dprintk((KERN_WARNING"aacraid: New Comm Interface type2 enabled\n")); | ||
127 | } | 145 | } |
128 | init->InitFlags |= cpu_to_le32(INITFLAGS_DRIVER_USES_UTC_TIME | | ||
129 | INITFLAGS_DRIVER_SUPPORTS_PM); | ||
130 | init->MaxIoCommands = cpu_to_le32(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); | ||
131 | init->MaxIoSize = cpu_to_le32(dev->scsi_host_ptr->max_sectors << 9); | ||
132 | init->MaxFibSize = cpu_to_le32(dev->max_fib_size); | ||
133 | |||
134 | init->MaxNumAif = cpu_to_le32(dev->max_num_aif); | ||
135 | init->HostRRQ_AddrHigh = (u32)((u64)dev->host_rrq_pa >> 32); | ||
136 | init->HostRRQ_AddrLow = (u32)(dev->host_rrq_pa & 0xffffffff); | ||
137 | |||
138 | 146 | ||
139 | /* | 147 | /* |
140 | * Increment the base address by the amount already used | 148 | * Increment the base address by the amount already used |
@@ -354,13 +362,15 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) | |||
354 | if ((status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE1))) { | 362 | if ((status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE1))) { |
355 | /* driver supports TYPE1 (Tupelo) */ | 363 | /* driver supports TYPE1 (Tupelo) */ |
356 | dev->comm_interface = AAC_COMM_MESSAGE_TYPE1; | 364 | dev->comm_interface = AAC_COMM_MESSAGE_TYPE1; |
365 | } else if ((status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE2))) { | ||
366 | /* driver supports TYPE2 (Denali) */ | ||
367 | dev->comm_interface = AAC_COMM_MESSAGE_TYPE2; | ||
357 | } else if ((status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE4)) || | 368 | } else if ((status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE4)) || |
358 | (status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE3)) || | 369 | (status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE3))) { |
359 | (status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE2))) { | 370 | /* driver doesn't TYPE3 and TYPE4 */ |
360 | /* driver doesn't support TYPE2 (Series7), TYPE3 and TYPE4 */ | 371 | /* switch to sync. mode */ |
361 | /* switch to sync. mode */ | 372 | dev->comm_interface = AAC_COMM_MESSAGE_TYPE2; |
362 | dev->comm_interface = AAC_COMM_MESSAGE_TYPE1; | 373 | dev->sync_mode = 1; |
363 | dev->sync_mode = 1; | ||
364 | } | 374 | } |
365 | } | 375 | } |
366 | if ((dev->comm_interface == AAC_COMM_MESSAGE) && | 376 | if ((dev->comm_interface == AAC_COMM_MESSAGE) && |
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 4b32ca442433..1be0776a80c4 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c | |||
@@ -136,6 +136,7 @@ int aac_fib_setup(struct aac_dev * dev) | |||
136 | i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); | 136 | i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); |
137 | i++, fibptr++) | 137 | i++, fibptr++) |
138 | { | 138 | { |
139 | fibptr->flags = 0; | ||
139 | fibptr->dev = dev; | 140 | fibptr->dev = dev; |
140 | fibptr->hw_fib_va = hw_fib; | 141 | fibptr->hw_fib_va = hw_fib; |
141 | fibptr->data = (void *) fibptr->hw_fib_va->data; | 142 | fibptr->data = (void *) fibptr->hw_fib_va->data; |
@@ -240,11 +241,11 @@ void aac_fib_init(struct fib *fibptr) | |||
240 | { | 241 | { |
241 | struct hw_fib *hw_fib = fibptr->hw_fib_va; | 242 | struct hw_fib *hw_fib = fibptr->hw_fib_va; |
242 | 243 | ||
244 | memset(&hw_fib->header, 0, sizeof(struct aac_fibhdr)); | ||
243 | hw_fib->header.StructType = FIB_MAGIC; | 245 | hw_fib->header.StructType = FIB_MAGIC; |
244 | hw_fib->header.Size = cpu_to_le16(fibptr->dev->max_fib_size); | 246 | hw_fib->header.Size = cpu_to_le16(fibptr->dev->max_fib_size); |
245 | hw_fib->header.XferState = cpu_to_le32(HostOwned | FibInitialized | FibEmpty | FastResponseCapable); | 247 | hw_fib->header.XferState = cpu_to_le32(HostOwned | FibInitialized | FibEmpty | FastResponseCapable); |
246 | hw_fib->header.SenderFibAddress = 0; /* Filled in later if needed */ | 248 | hw_fib->header.u.ReceiverFibAddress = cpu_to_le32(fibptr->hw_fib_pa); |
247 | hw_fib->header.ReceiverFibAddress = cpu_to_le32(fibptr->hw_fib_pa); | ||
248 | hw_fib->header.SenderSize = cpu_to_le16(fibptr->dev->max_fib_size); | 249 | hw_fib->header.SenderSize = cpu_to_le16(fibptr->dev->max_fib_size); |
249 | } | 250 | } |
250 | 251 | ||
@@ -259,7 +260,6 @@ void aac_fib_init(struct fib *fibptr) | |||
259 | static void fib_dealloc(struct fib * fibptr) | 260 | static void fib_dealloc(struct fib * fibptr) |
260 | { | 261 | { |
261 | struct hw_fib *hw_fib = fibptr->hw_fib_va; | 262 | struct hw_fib *hw_fib = fibptr->hw_fib_va; |
262 | BUG_ON(hw_fib->header.StructType != FIB_MAGIC); | ||
263 | hw_fib->header.XferState = 0; | 263 | hw_fib->header.XferState = 0; |
264 | } | 264 | } |
265 | 265 | ||
@@ -370,7 +370,7 @@ int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw | |||
370 | entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); | 370 | entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); |
371 | entry->addr = hw_fib->header.SenderFibAddress; | 371 | entry->addr = hw_fib->header.SenderFibAddress; |
372 | /* Restore adapters pointer to the FIB */ | 372 | /* Restore adapters pointer to the FIB */ |
373 | hw_fib->header.ReceiverFibAddress = hw_fib->header.SenderFibAddress; /* Let the adapter now where to find its data */ | 373 | hw_fib->header.u.ReceiverFibAddress = hw_fib->header.SenderFibAddress; /* Let the adapter now where to find its data */ |
374 | map = 0; | 374 | map = 0; |
375 | } | 375 | } |
376 | /* | 376 | /* |
@@ -450,7 +450,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | |||
450 | */ | 450 | */ |
451 | 451 | ||
452 | hw_fib->header.SenderFibAddress = cpu_to_le32(((u32)(fibptr - dev->fibs)) << 2); | 452 | hw_fib->header.SenderFibAddress = cpu_to_le32(((u32)(fibptr - dev->fibs)) << 2); |
453 | hw_fib->header.SenderData = (u32)(fibptr - dev->fibs); | 453 | hw_fib->header.Handle = (u32)(fibptr - dev->fibs) + 1; |
454 | /* | 454 | /* |
455 | * Set FIB state to indicate where it came from and if we want a | 455 | * Set FIB state to indicate where it came from and if we want a |
456 | * response from the adapter. Also load the command from the | 456 | * response from the adapter. Also load the command from the |
@@ -460,7 +460,6 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | |||
460 | */ | 460 | */ |
461 | hw_fib->header.Command = cpu_to_le16(command); | 461 | hw_fib->header.Command = cpu_to_le16(command); |
462 | hw_fib->header.XferState |= cpu_to_le32(SentFromHost); | 462 | hw_fib->header.XferState |= cpu_to_le32(SentFromHost); |
463 | fibptr->hw_fib_va->header.Flags = 0; /* 0 the flags field - internal only*/ | ||
464 | /* | 463 | /* |
465 | * Set the size of the Fib we want to send to the adapter | 464 | * Set the size of the Fib we want to send to the adapter |
466 | */ | 465 | */ |
@@ -564,10 +563,10 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | |||
564 | * functioning because an interrupt routing or other | 563 | * functioning because an interrupt routing or other |
565 | * hardware failure has occurred. | 564 | * hardware failure has occurred. |
566 | */ | 565 | */ |
567 | unsigned long count = 36000000L; /* 3 minutes */ | 566 | unsigned long timeout = jiffies + (180 * HZ); /* 3 minutes */ |
568 | while (down_trylock(&fibptr->event_wait)) { | 567 | while (down_trylock(&fibptr->event_wait)) { |
569 | int blink; | 568 | int blink; |
570 | if (--count == 0) { | 569 | if (time_is_before_eq_jiffies(timeout)) { |
571 | struct aac_queue * q = &dev->queues->queue[AdapNormCmdQueue]; | 570 | struct aac_queue * q = &dev->queues->queue[AdapNormCmdQueue]; |
572 | spin_lock_irqsave(q->lock, qflags); | 571 | spin_lock_irqsave(q->lock, qflags); |
573 | q->numpending--; | 572 | q->numpending--; |
@@ -588,7 +587,10 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | |||
588 | } | 587 | } |
589 | return -EFAULT; | 588 | return -EFAULT; |
590 | } | 589 | } |
591 | udelay(5); | 590 | /* We used to udelay() here but that absorbed |
591 | * a CPU when a timeout occured. Not very | ||
592 | * useful. */ | ||
593 | cpu_relax(); | ||
592 | } | 594 | } |
593 | } else if (down_interruptible(&fibptr->event_wait)) { | 595 | } else if (down_interruptible(&fibptr->event_wait)) { |
594 | /* Do nothing ... satisfy | 596 | /* Do nothing ... satisfy |
@@ -708,7 +710,8 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) | |||
708 | unsigned long nointr = 0; | 710 | unsigned long nointr = 0; |
709 | unsigned long qflags; | 711 | unsigned long qflags; |
710 | 712 | ||
711 | if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1) { | 713 | if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1 || |
714 | dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) { | ||
712 | kfree(hw_fib); | 715 | kfree(hw_fib); |
713 | return 0; | 716 | return 0; |
714 | } | 717 | } |
@@ -721,7 +724,9 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) | |||
721 | /* | 724 | /* |
722 | * If we plan to do anything check the structure type first. | 725 | * If we plan to do anything check the structure type first. |
723 | */ | 726 | */ |
724 | if (hw_fib->header.StructType != FIB_MAGIC) { | 727 | if (hw_fib->header.StructType != FIB_MAGIC && |
728 | hw_fib->header.StructType != FIB_MAGIC2 && | ||
729 | hw_fib->header.StructType != FIB_MAGIC2_64) { | ||
725 | if (dev->comm_interface == AAC_COMM_MESSAGE) | 730 | if (dev->comm_interface == AAC_COMM_MESSAGE) |
726 | kfree(hw_fib); | 731 | kfree(hw_fib); |
727 | return -EINVAL; | 732 | return -EINVAL; |
@@ -783,7 +788,9 @@ int aac_fib_complete(struct fib *fibptr) | |||
783 | * If we plan to do anything check the structure type first. | 788 | * If we plan to do anything check the structure type first. |
784 | */ | 789 | */ |
785 | 790 | ||
786 | if (hw_fib->header.StructType != FIB_MAGIC) | 791 | if (hw_fib->header.StructType != FIB_MAGIC && |
792 | hw_fib->header.StructType != FIB_MAGIC2 && | ||
793 | hw_fib->header.StructType != FIB_MAGIC2_64) | ||
787 | return -EINVAL; | 794 | return -EINVAL; |
788 | /* | 795 | /* |
789 | * This block completes a cdb which orginated on the host and we | 796 | * This block completes a cdb which orginated on the host and we |
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c index f0c66a80ad13..d81b2810f0f7 100644 --- a/drivers/scsi/aacraid/dpcsup.c +++ b/drivers/scsi/aacraid/dpcsup.c | |||
@@ -101,6 +101,7 @@ unsigned int aac_response_normal(struct aac_queue * q) | |||
101 | */ | 101 | */ |
102 | *(__le32 *)hwfib->data = cpu_to_le32(ST_OK); | 102 | *(__le32 *)hwfib->data = cpu_to_le32(ST_OK); |
103 | hwfib->header.XferState |= cpu_to_le32(AdapterProcessed); | 103 | hwfib->header.XferState |= cpu_to_le32(AdapterProcessed); |
104 | fib->flags |= FIB_CONTEXT_FLAG_FASTRESP; | ||
104 | } | 105 | } |
105 | 106 | ||
106 | FIB_COUNTER_INCREMENT(aac_config.FibRecved); | 107 | FIB_COUNTER_INCREMENT(aac_config.FibRecved); |
@@ -121,7 +122,7 @@ unsigned int aac_response_normal(struct aac_queue * q) | |||
121 | * NOTE: we cannot touch the fib after this | 122 | * NOTE: we cannot touch the fib after this |
122 | * call, because it may have been deallocated. | 123 | * call, because it may have been deallocated. |
123 | */ | 124 | */ |
124 | fib->flags = 0; | 125 | fib->flags &= FIB_CONTEXT_FLAG_FASTRESP; |
125 | fib->callback(fib->callback_data, fib); | 126 | fib->callback(fib->callback_data, fib); |
126 | } else { | 127 | } else { |
127 | unsigned long flagv; | 128 | unsigned long flagv; |
@@ -367,6 +368,7 @@ unsigned int aac_intr_normal(struct aac_dev *dev, u32 index, | |||
367 | */ | 368 | */ |
368 | *(__le32 *)hwfib->data = cpu_to_le32(ST_OK); | 369 | *(__le32 *)hwfib->data = cpu_to_le32(ST_OK); |
369 | hwfib->header.XferState |= cpu_to_le32(AdapterProcessed); | 370 | hwfib->header.XferState |= cpu_to_le32(AdapterProcessed); |
371 | fib->flags |= FIB_CONTEXT_FLAG_FASTRESP; | ||
370 | } | 372 | } |
371 | 373 | ||
372 | FIB_COUNTER_INCREMENT(aac_config.FibRecved); | 374 | FIB_COUNTER_INCREMENT(aac_config.FibRecved); |
@@ -387,7 +389,7 @@ unsigned int aac_intr_normal(struct aac_dev *dev, u32 index, | |||
387 | * NOTE: we cannot touch the fib after this | 389 | * NOTE: we cannot touch the fib after this |
388 | * call, because it may have been deallocated. | 390 | * call, because it may have been deallocated. |
389 | */ | 391 | */ |
390 | fib->flags = 0; | 392 | fib->flags &= FIB_CONTEXT_FLAG_FASTRESP; |
391 | fib->callback(fib->callback_data, fib); | 393 | fib->callback(fib->callback_data, fib); |
392 | } else { | 394 | } else { |
393 | unsigned long flagv; | 395 | unsigned long flagv; |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 0d279c445a30..7199534cd07d 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -1089,8 +1089,17 @@ static struct scsi_host_template aac_driver_template = { | |||
1089 | 1089 | ||
1090 | static void __aac_shutdown(struct aac_dev * aac) | 1090 | static void __aac_shutdown(struct aac_dev * aac) |
1091 | { | 1091 | { |
1092 | if (aac->aif_thread) | 1092 | if (aac->aif_thread) { |
1093 | int i; | ||
1094 | /* Clear out events first */ | ||
1095 | for (i = 0; i < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++) { | ||
1096 | struct fib *fib = &aac->fibs[i]; | ||
1097 | if (!(fib->hw_fib_va->header.XferState & cpu_to_le32(NoResponseExpected | Async)) && | ||
1098 | (fib->hw_fib_va->header.XferState & cpu_to_le32(ResponseExpected))) | ||
1099 | up(&fib->event_wait); | ||
1100 | } | ||
1093 | kthread_stop(aac->thread); | 1101 | kthread_stop(aac->thread); |
1102 | } | ||
1094 | aac_send_shutdown(aac); | 1103 | aac_send_shutdown(aac); |
1095 | aac_adapter_disable_int(aac); | 1104 | aac_adapter_disable_int(aac); |
1096 | free_irq(aac->pdev->irq, aac); | 1105 | free_irq(aac->pdev->irq, aac); |
@@ -1145,11 +1154,11 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
1145 | goto out_disable_pdev; | 1154 | goto out_disable_pdev; |
1146 | 1155 | ||
1147 | shost->irq = pdev->irq; | 1156 | shost->irq = pdev->irq; |
1148 | shost->base = pci_resource_start(pdev, 0); | ||
1149 | shost->unique_id = unique_id; | 1157 | shost->unique_id = unique_id; |
1150 | shost->max_cmd_len = 16; | 1158 | shost->max_cmd_len = 16; |
1151 | 1159 | ||
1152 | aac = (struct aac_dev *)shost->hostdata; | 1160 | aac = (struct aac_dev *)shost->hostdata; |
1161 | aac->base_start = pci_resource_start(pdev, 0); | ||
1153 | aac->scsi_host_ptr = shost; | 1162 | aac->scsi_host_ptr = shost; |
1154 | aac->pdev = pdev; | 1163 | aac->pdev = pdev; |
1155 | aac->name = aac_driver_template.name; | 1164 | aac->name = aac_driver_template.name; |
@@ -1157,7 +1166,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
1157 | aac->cardtype = index; | 1166 | aac->cardtype = index; |
1158 | INIT_LIST_HEAD(&aac->entry); | 1167 | INIT_LIST_HEAD(&aac->entry); |
1159 | 1168 | ||
1160 | aac->fibs = kmalloc(sizeof(struct fib) * (shost->can_queue + AAC_NUM_MGT_FIB), GFP_KERNEL); | 1169 | aac->fibs = kzalloc(sizeof(struct fib) * (shost->can_queue + AAC_NUM_MGT_FIB), GFP_KERNEL); |
1161 | if (!aac->fibs) | 1170 | if (!aac->fibs) |
1162 | goto out_free_host; | 1171 | goto out_free_host; |
1163 | spin_lock_init(&aac->fib_lock); | 1172 | spin_lock_init(&aac->fib_lock); |
@@ -1191,6 +1200,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
1191 | if (IS_ERR(aac->thread)) { | 1200 | if (IS_ERR(aac->thread)) { |
1192 | printk(KERN_ERR "aacraid: Unable to create command thread.\n"); | 1201 | printk(KERN_ERR "aacraid: Unable to create command thread.\n"); |
1193 | error = PTR_ERR(aac->thread); | 1202 | error = PTR_ERR(aac->thread); |
1203 | aac->thread = NULL; | ||
1194 | goto out_deinit; | 1204 | goto out_deinit; |
1195 | } | 1205 | } |
1196 | 1206 | ||
diff --git a/drivers/scsi/aacraid/nark.c b/drivers/scsi/aacraid/nark.c index f397d21a0c06..6c53b1d8b2ba 100644 --- a/drivers/scsi/aacraid/nark.c +++ b/drivers/scsi/aacraid/nark.c | |||
@@ -49,14 +49,14 @@ static int aac_nark_ioremap(struct aac_dev * dev, u32 size) | |||
49 | dev->base = NULL; | 49 | dev->base = NULL; |
50 | return 0; | 50 | return 0; |
51 | } | 51 | } |
52 | dev->scsi_host_ptr->base = pci_resource_start(dev->pdev, 2); | 52 | dev->base_start = pci_resource_start(dev->pdev, 2); |
53 | dev->regs.rx = ioremap((u64)pci_resource_start(dev->pdev, 0) | | 53 | dev->regs.rx = ioremap((u64)pci_resource_start(dev->pdev, 0) | |
54 | ((u64)pci_resource_start(dev->pdev, 1) << 32), | 54 | ((u64)pci_resource_start(dev->pdev, 1) << 32), |
55 | sizeof(struct rx_registers) - sizeof(struct rx_inbound)); | 55 | sizeof(struct rx_registers) - sizeof(struct rx_inbound)); |
56 | dev->base = NULL; | 56 | dev->base = NULL; |
57 | if (dev->regs.rx == NULL) | 57 | if (dev->regs.rx == NULL) |
58 | return -1; | 58 | return -1; |
59 | dev->base = ioremap(dev->scsi_host_ptr->base, size); | 59 | dev->base = ioremap(dev->base_start, size); |
60 | if (dev->base == NULL) { | 60 | if (dev->base == NULL) { |
61 | iounmap(dev->regs.rx); | 61 | iounmap(dev->regs.rx); |
62 | dev->regs.rx = NULL; | 62 | dev->regs.rx = NULL; |
diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c index be44de92429a..7d8013feedde 100644 --- a/drivers/scsi/aacraid/rkt.c +++ b/drivers/scsi/aacraid/rkt.c | |||
@@ -79,7 +79,7 @@ static int aac_rkt_ioremap(struct aac_dev * dev, u32 size) | |||
79 | iounmap(dev->regs.rkt); | 79 | iounmap(dev->regs.rkt); |
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
82 | dev->base = dev->regs.rkt = ioremap(dev->scsi_host_ptr->base, size); | 82 | dev->base = dev->regs.rkt = ioremap(dev->base_start, size); |
83 | if (dev->base == NULL) | 83 | if (dev->base == NULL) |
84 | return -1; | 84 | return -1; |
85 | dev->IndexRegs = &dev->regs.rkt->IndexRegs; | 85 | dev->IndexRegs = &dev->regs.rkt->IndexRegs; |
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c index b029c7cc785b..dada38aeacc0 100644 --- a/drivers/scsi/aacraid/rx.c +++ b/drivers/scsi/aacraid/rx.c | |||
@@ -471,7 +471,7 @@ static int aac_rx_ioremap(struct aac_dev * dev, u32 size) | |||
471 | iounmap(dev->regs.rx); | 471 | iounmap(dev->regs.rx); |
472 | return 0; | 472 | return 0; |
473 | } | 473 | } |
474 | dev->base = dev->regs.rx = ioremap(dev->scsi_host_ptr->base, size); | 474 | dev->base = dev->regs.rx = ioremap(dev->base_start, size); |
475 | if (dev->base == NULL) | 475 | if (dev->base == NULL) |
476 | return -1; | 476 | return -1; |
477 | dev->IndexRegs = &dev->regs.rx->IndexRegs; | 477 | dev->IndexRegs = &dev->regs.rx->IndexRegs; |
@@ -653,7 +653,7 @@ int _aac_rx_init(struct aac_dev *dev) | |||
653 | name, instance); | 653 | name, instance); |
654 | goto error_iounmap; | 654 | goto error_iounmap; |
655 | } | 655 | } |
656 | dev->dbg_base = dev->scsi_host_ptr->base; | 656 | dev->dbg_base = dev->base_start; |
657 | dev->dbg_base_mapped = dev->base; | 657 | dev->dbg_base_mapped = dev->base; |
658 | dev->dbg_size = dev->base_size; | 658 | dev->dbg_size = dev->base_size; |
659 | 659 | ||
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c index beb533630d4b..2244f315f33b 100644 --- a/drivers/scsi/aacraid/sa.c +++ b/drivers/scsi/aacraid/sa.c | |||
@@ -305,7 +305,7 @@ static int aac_sa_ioremap(struct aac_dev * dev, u32 size) | |||
305 | iounmap(dev->regs.sa); | 305 | iounmap(dev->regs.sa); |
306 | return 0; | 306 | return 0; |
307 | } | 307 | } |
308 | dev->base = dev->regs.sa = ioremap(dev->scsi_host_ptr->base, size); | 308 | dev->base = dev->regs.sa = ioremap(dev->base_start, size); |
309 | return (dev->base == NULL) ? -1 : 0; | 309 | return (dev->base == NULL) ? -1 : 0; |
310 | } | 310 | } |
311 | 311 | ||
@@ -393,7 +393,7 @@ int aac_sa_init(struct aac_dev *dev) | |||
393 | name, instance); | 393 | name, instance); |
394 | goto error_iounmap; | 394 | goto error_iounmap; |
395 | } | 395 | } |
396 | dev->dbg_base = dev->scsi_host_ptr->base; | 396 | dev->dbg_base = dev->base_start; |
397 | dev->dbg_base_mapped = dev->base; | 397 | dev->dbg_base_mapped = dev->base; |
398 | dev->dbg_size = dev->base_size; | 398 | dev->dbg_size = dev->base_size; |
399 | 399 | ||
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index 762820636304..3b021ec63255 100644 --- a/drivers/scsi/aacraid/src.c +++ b/drivers/scsi/aacraid/src.c | |||
@@ -56,25 +56,14 @@ static irqreturn_t aac_src_intr_message(int irq, void *dev_id) | |||
56 | if (bellbits & PmDoorBellResponseSent) { | 56 | if (bellbits & PmDoorBellResponseSent) { |
57 | bellbits = PmDoorBellResponseSent; | 57 | bellbits = PmDoorBellResponseSent; |
58 | /* handle async. status */ | 58 | /* handle async. status */ |
59 | src_writel(dev, MUnit.ODR_C, bellbits); | ||
60 | src_readl(dev, MUnit.ODR_C); | ||
59 | our_interrupt = 1; | 61 | our_interrupt = 1; |
60 | index = dev->host_rrq_idx; | 62 | index = dev->host_rrq_idx; |
61 | if (dev->host_rrq[index] == 0) { | ||
62 | u32 old_index = index; | ||
63 | /* adjust index */ | ||
64 | do { | ||
65 | index++; | ||
66 | if (index == dev->scsi_host_ptr->can_queue + | ||
67 | AAC_NUM_MGT_FIB) | ||
68 | index = 0; | ||
69 | if (dev->host_rrq[index] != 0) | ||
70 | break; | ||
71 | } while (index != old_index); | ||
72 | dev->host_rrq_idx = index; | ||
73 | } | ||
74 | for (;;) { | 63 | for (;;) { |
75 | isFastResponse = 0; | 64 | isFastResponse = 0; |
76 | /* remove toggle bit (31) */ | 65 | /* remove toggle bit (31) */ |
77 | handle = (dev->host_rrq[index] & 0x7fffffff); | 66 | handle = le32_to_cpu(dev->host_rrq[index]) & 0x7fffffff; |
78 | /* check fast response bit (30) */ | 67 | /* check fast response bit (30) */ |
79 | if (handle & 0x40000000) | 68 | if (handle & 0x40000000) |
80 | isFastResponse = 1; | 69 | isFastResponse = 1; |
@@ -93,6 +82,8 @@ static irqreturn_t aac_src_intr_message(int irq, void *dev_id) | |||
93 | } else { | 82 | } else { |
94 | bellbits_shifted = (bellbits >> SRC_ODR_SHIFT); | 83 | bellbits_shifted = (bellbits >> SRC_ODR_SHIFT); |
95 | if (bellbits_shifted & DoorBellAifPending) { | 84 | if (bellbits_shifted & DoorBellAifPending) { |
85 | src_writel(dev, MUnit.ODR_C, bellbits); | ||
86 | src_readl(dev, MUnit.ODR_C); | ||
96 | our_interrupt = 1; | 87 | our_interrupt = 1; |
97 | /* handle AIF */ | 88 | /* handle AIF */ |
98 | aac_intr_normal(dev, 0, 2, 0, NULL); | 89 | aac_intr_normal(dev, 0, 2, 0, NULL); |
@@ -100,6 +91,13 @@ static irqreturn_t aac_src_intr_message(int irq, void *dev_id) | |||
100 | unsigned long sflags; | 91 | unsigned long sflags; |
101 | struct list_head *entry; | 92 | struct list_head *entry; |
102 | int send_it = 0; | 93 | int send_it = 0; |
94 | extern int aac_sync_mode; | ||
95 | |||
96 | if (!aac_sync_mode) { | ||
97 | src_writel(dev, MUnit.ODR_C, bellbits); | ||
98 | src_readl(dev, MUnit.ODR_C); | ||
99 | our_interrupt = 1; | ||
100 | } | ||
103 | 101 | ||
104 | if (dev->sync_fib) { | 102 | if (dev->sync_fib) { |
105 | our_interrupt = 1; | 103 | our_interrupt = 1; |
@@ -132,7 +130,6 @@ static irqreturn_t aac_src_intr_message(int irq, void *dev_id) | |||
132 | } | 130 | } |
133 | 131 | ||
134 | if (our_interrupt) { | 132 | if (our_interrupt) { |
135 | src_writel(dev, MUnit.ODR_C, bellbits); | ||
136 | return IRQ_HANDLED; | 133 | return IRQ_HANDLED; |
137 | } | 134 | } |
138 | return IRQ_NONE; | 135 | return IRQ_NONE; |
@@ -336,6 +333,9 @@ static void aac_src_start_adapter(struct aac_dev *dev) | |||
336 | { | 333 | { |
337 | struct aac_init *init; | 334 | struct aac_init *init; |
338 | 335 | ||
336 | /* reset host_rrq_idx first */ | ||
337 | dev->host_rrq_idx = 0; | ||
338 | |||
339 | init = dev->init; | 339 | init = dev->init; |
340 | init->HostElapsedSeconds = cpu_to_le32(get_seconds()); | 340 | init->HostElapsedSeconds = cpu_to_le32(get_seconds()); |
341 | 341 | ||
@@ -389,30 +389,51 @@ static int aac_src_deliver_message(struct fib *fib) | |||
389 | struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue]; | 389 | struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue]; |
390 | unsigned long qflags; | 390 | unsigned long qflags; |
391 | u32 fibsize; | 391 | u32 fibsize; |
392 | u64 address; | 392 | dma_addr_t address; |
393 | struct aac_fib_xporthdr *pFibX; | 393 | struct aac_fib_xporthdr *pFibX; |
394 | u16 hdr_size = le16_to_cpu(fib->hw_fib_va->header.Size); | ||
394 | 395 | ||
395 | spin_lock_irqsave(q->lock, qflags); | 396 | spin_lock_irqsave(q->lock, qflags); |
396 | q->numpending++; | 397 | q->numpending++; |
397 | spin_unlock_irqrestore(q->lock, qflags); | 398 | spin_unlock_irqrestore(q->lock, qflags); |
398 | 399 | ||
399 | /* Calculate the amount to the fibsize bits */ | 400 | if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) { |
400 | fibsize = (sizeof(struct aac_fib_xporthdr) + | 401 | /* Calculate the amount to the fibsize bits */ |
401 | fib->hw_fib_va->header.Size + 127) / 128 - 1; | 402 | fibsize = (hdr_size + 127) / 128 - 1; |
402 | if (fibsize > (ALIGN32 - 1)) | 403 | if (fibsize > (ALIGN32 - 1)) |
403 | fibsize = ALIGN32 - 1; | 404 | return -EMSGSIZE; |
404 | 405 | /* New FIB header, 32-bit */ | |
405 | /* Fill XPORT header */ | 406 | address = fib->hw_fib_pa; |
406 | pFibX = (struct aac_fib_xporthdr *) | 407 | fib->hw_fib_va->header.StructType = FIB_MAGIC2; |
407 | ((unsigned char *)fib->hw_fib_va - | 408 | fib->hw_fib_va->header.SenderFibAddress = (u32)address; |
408 | sizeof(struct aac_fib_xporthdr)); | 409 | fib->hw_fib_va->header.u.TimeStamp = 0; |
409 | pFibX->Handle = fib->hw_fib_va->header.SenderData + 1; | 410 | BUG_ON((u32)(address >> 32) != 0L); |
410 | pFibX->HostAddress = fib->hw_fib_pa; | 411 | address |= fibsize; |
411 | pFibX->Size = fib->hw_fib_va->header.Size; | 412 | } else { |
412 | address = fib->hw_fib_pa - (u64)sizeof(struct aac_fib_xporthdr); | 413 | /* Calculate the amount to the fibsize bits */ |
413 | 414 | fibsize = (sizeof(struct aac_fib_xporthdr) + hdr_size + 127) / 128 - 1; | |
414 | src_writel(dev, MUnit.IQ_H, (u32)(address >> 32)); | 415 | if (fibsize > (ALIGN32 - 1)) |
415 | src_writel(dev, MUnit.IQ_L, (u32)(address & 0xffffffff) + fibsize); | 416 | return -EMSGSIZE; |
417 | |||
418 | /* Fill XPORT header */ | ||
419 | pFibX = (void *)fib->hw_fib_va - sizeof(struct aac_fib_xporthdr); | ||
420 | pFibX->Handle = cpu_to_le32(fib->hw_fib_va->header.Handle); | ||
421 | pFibX->HostAddress = cpu_to_le64(fib->hw_fib_pa); | ||
422 | pFibX->Size = cpu_to_le32(hdr_size); | ||
423 | |||
424 | /* | ||
425 | * The xport header has been 32-byte aligned for us so that fibsize | ||
426 | * can be masked out of this address by hardware. -- BenC | ||
427 | */ | ||
428 | address = fib->hw_fib_pa - sizeof(struct aac_fib_xporthdr); | ||
429 | if (address & (ALIGN32 - 1)) | ||
430 | return -EINVAL; | ||
431 | address |= fibsize; | ||
432 | } | ||
433 | |||
434 | src_writel(dev, MUnit.IQ_H, (address >> 32) & 0xffffffff); | ||
435 | src_writel(dev, MUnit.IQ_L, address & 0xffffffff); | ||
436 | |||
416 | return 0; | 437 | return 0; |
417 | } | 438 | } |
418 | 439 | ||
@@ -435,8 +456,7 @@ static int aac_src_ioremap(struct aac_dev *dev, u32 size) | |||
435 | dev->base = NULL; | 456 | dev->base = NULL; |
436 | if (dev->regs.src.bar1 == NULL) | 457 | if (dev->regs.src.bar1 == NULL) |
437 | return -1; | 458 | return -1; |
438 | dev->base = dev->regs.src.bar0 = ioremap(dev->scsi_host_ptr->base, | 459 | dev->base = dev->regs.src.bar0 = ioremap(dev->base_start, size); |
439 | size); | ||
440 | if (dev->base == NULL) { | 460 | if (dev->base == NULL) { |
441 | iounmap(dev->regs.src.bar1); | 461 | iounmap(dev->regs.src.bar1); |
442 | dev->regs.src.bar1 = NULL; | 462 | dev->regs.src.bar1 = NULL; |
@@ -459,7 +479,7 @@ static int aac_srcv_ioremap(struct aac_dev *dev, u32 size) | |||
459 | dev->base = dev->regs.src.bar0 = NULL; | 479 | dev->base = dev->regs.src.bar0 = NULL; |
460 | return 0; | 480 | return 0; |
461 | } | 481 | } |
462 | dev->base = dev->regs.src.bar0 = ioremap(dev->scsi_host_ptr->base, size); | 482 | dev->base = dev->regs.src.bar0 = ioremap(dev->base_start, size); |
463 | if (dev->base == NULL) | 483 | if (dev->base == NULL) |
464 | return -1; | 484 | return -1; |
465 | dev->IndexRegs = &((struct src_registers __iomem *) | 485 | dev->IndexRegs = &((struct src_registers __iomem *) |
@@ -753,7 +773,7 @@ int aac_srcv_init(struct aac_dev *dev) | |||
753 | 773 | ||
754 | if (aac_init_adapter(dev) == NULL) | 774 | if (aac_init_adapter(dev) == NULL) |
755 | goto error_iounmap; | 775 | goto error_iounmap; |
756 | if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE1) | 776 | if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE2) |
757 | goto error_iounmap; | 777 | goto error_iounmap; |
758 | dev->msi = aac_msi && !pci_enable_msi(dev->pdev); | 778 | dev->msi = aac_msi && !pci_enable_msi(dev->pdev); |
759 | if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr, | 779 | if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr, |
@@ -764,7 +784,7 @@ int aac_srcv_init(struct aac_dev *dev) | |||
764 | name, instance); | 784 | name, instance); |
765 | goto error_iounmap; | 785 | goto error_iounmap; |
766 | } | 786 | } |
767 | dev->dbg_base = dev->scsi_host_ptr->base; | 787 | dev->dbg_base = dev->base_start; |
768 | dev->dbg_base_mapped = dev->base; | 788 | dev->dbg_base_mapped = dev->base; |
769 | dev->dbg_size = dev->base_size; | 789 | dev->dbg_size = dev->base_size; |
770 | 790 | ||