Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] aacraid: Series 7 Async. (performance) mode support

- Series 7 Async. (performance) mode support added
- New scatter/gather list format for Series 7
- Driver converts s/g list to a firmware suitable list for best performance on
Series 7, this can be disabled with driver parameter "aac_convert_sgl" for
testing purposes
- New container read/write command structure for Series 7
- Fast response support for the SCSI pass-through path added
- Async. status response buffer changes

Signed-off-by: Mahesh Rajashekhara <Mahesh_Rajashekhara@pmc-sierra.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Mahesh Rajashekhara and committed by
James Bottomley
85d22bbf fa7250d6

+358 -126
+201 -38
drivers/scsi/aacraid/aachba.c
··· 135 135 static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); 136 136 static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); 137 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 140 static int aac_send_srb_fib(struct scsi_cmnd* scsicmd); 139 141 #ifdef AAC_DETAILED_STATUS_INFO 140 142 static char *aac_get_status_string(u32 status); ··· 154 152 int startup_timeout = 180; 155 153 int aif_timeout = 120; 156 154 int aac_sync_mode; /* Only Sync. transfer - disabled */ 155 + int aac_convert_sgl = 1; /* convert non-conformable s/g list - enabled */ 157 156 158 157 module_param(aac_sync_mode, int, S_IRUGO|S_IWUSR); 159 158 MODULE_PARM_DESC(aac_sync_mode, "Force sync. transfer mode" 159 + " 0=off, 1=on"); 160 + module_param(aac_convert_sgl, int, S_IRUGO|S_IWUSR); 161 + MODULE_PARM_DESC(aac_convert_sgl, "Convert non-conformable s/g list" 160 162 " 0=off, 1=on"); 161 163 module_param(nondasd, int, S_IRUGO|S_IWUSR); 162 164 MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices." ··· 969 963 970 964 static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 count) 971 965 { 972 - u16 fibsize; 973 - struct aac_raw_io *readcmd; 974 - aac_fib_init(fib); 975 - readcmd = (struct aac_raw_io *) fib_data(fib); 976 - readcmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); 977 - readcmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); 978 - readcmd->count = cpu_to_le32(count<<9); 979 - readcmd->cid = cpu_to_le16(scmd_id(cmd)); 980 - readcmd->flags = cpu_to_le16(IO_TYPE_READ); 981 - readcmd->bpTotal = 0; 982 - readcmd->bpComplete = 0; 966 + struct aac_dev *dev = fib->dev; 967 + u16 fibsize, command; 983 968 984 - aac_build_sgraw(cmd, &readcmd->sg); 985 - fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd->sg.count) - 1) * sizeof (struct sgentryraw)); 969 + aac_fib_init(fib); 970 + if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2 && !dev->sync_mode) { 971 + struct aac_raw_io2 *readcmd2; 972 + readcmd2 = (struct aac_raw_io2 *) fib_data(fib); 973 + memset(readcmd2, 0, sizeof(struct aac_raw_io2)); 974 + readcmd2->blockLow = cpu_to_le32((u32)(lba&0xffffffff)); 975 + readcmd2->blockHigh = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); 976 + readcmd2->byteCount = cpu_to_le32(count<<9); 977 + readcmd2->cid = cpu_to_le16(scmd_id(cmd)); 978 + readcmd2->flags = cpu_to_le16(RIO2_IO_TYPE_READ); 979 + aac_build_sgraw2(cmd, readcmd2, dev->scsi_host_ptr->sg_tablesize); 980 + command = ContainerRawIo2; 981 + fibsize = sizeof(struct aac_raw_io2) + 982 + ((le32_to_cpu(readcmd2->sgeCnt)-1) * sizeof(struct sge_ieee1212)); 983 + } else { 984 + struct aac_raw_io *readcmd; 985 + readcmd = (struct aac_raw_io *) fib_data(fib); 986 + readcmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); 987 + readcmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); 988 + readcmd->count = cpu_to_le32(count<<9); 989 + readcmd->cid = cpu_to_le16(scmd_id(cmd)); 990 + readcmd->flags = cpu_to_le16(RIO_TYPE_READ); 991 + readcmd->bpTotal = 0; 992 + readcmd->bpComplete = 0; 993 + aac_build_sgraw(cmd, &readcmd->sg); 994 + command = ContainerRawIo; 995 + fibsize = sizeof(struct aac_raw_io) + 996 + ((le32_to_cpu(readcmd->sg.count)-1) * sizeof(struct sgentryraw)); 997 + } 998 + 986 999 BUG_ON(fibsize > (fib->dev->max_fib_size - sizeof(struct aac_fibhdr))); 987 1000 /* 988 1001 * Now send the Fib to the adapter 989 1002 */ 990 - return aac_fib_send(ContainerRawIo, 1003 + return aac_fib_send(command, 991 1004 fib, 992 1005 fibsize, 993 1006 FsaNormal, ··· 1077 1052 1078 1053 static int aac_write_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 count, int fua) 1079 1054 { 1080 - u16 fibsize; 1081 - struct aac_raw_io *writecmd; 1082 - aac_fib_init(fib); 1083 - writecmd = (struct aac_raw_io *) fib_data(fib); 1084 - writecmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); 1085 - writecmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); 1086 - writecmd->count = cpu_to_le32(count<<9); 1087 - writecmd->cid = cpu_to_le16(scmd_id(cmd)); 1088 - writecmd->flags = (fua && ((aac_cache & 5) != 1) && 1089 - (((aac_cache & 5) != 5) || !fib->dev->cache_protected)) ? 1090 - cpu_to_le16(IO_TYPE_WRITE|IO_SUREWRITE) : 1091 - cpu_to_le16(IO_TYPE_WRITE); 1092 - writecmd->bpTotal = 0; 1093 - writecmd->bpComplete = 0; 1055 + struct aac_dev *dev = fib->dev; 1056 + u16 fibsize, command; 1094 1057 1095 - aac_build_sgraw(cmd, &writecmd->sg); 1096 - fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(writecmd->sg.count) - 1) * sizeof (struct sgentryraw)); 1058 + aac_fib_init(fib); 1059 + if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2 && !dev->sync_mode) { 1060 + struct aac_raw_io2 *writecmd2; 1061 + writecmd2 = (struct aac_raw_io2 *) fib_data(fib); 1062 + memset(writecmd2, 0, sizeof(struct aac_raw_io2)); 1063 + writecmd2->blockLow = cpu_to_le32((u32)(lba&0xffffffff)); 1064 + writecmd2->blockHigh = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); 1065 + writecmd2->byteCount = cpu_to_le32(count<<9); 1066 + writecmd2->cid = cpu_to_le16(scmd_id(cmd)); 1067 + writecmd2->flags = (fua && ((aac_cache & 5) != 1) && 1068 + (((aac_cache & 5) != 5) || !fib->dev->cache_protected)) ? 1069 + cpu_to_le16(RIO2_IO_TYPE_WRITE|RIO2_IO_SUREWRITE) : 1070 + cpu_to_le16(RIO2_IO_TYPE_WRITE); 1071 + aac_build_sgraw2(cmd, writecmd2, dev->scsi_host_ptr->sg_tablesize); 1072 + command = ContainerRawIo2; 1073 + fibsize = sizeof(struct aac_raw_io2) + 1074 + ((le32_to_cpu(writecmd2->sgeCnt)-1) * sizeof(struct sge_ieee1212)); 1075 + } else { 1076 + struct aac_raw_io *writecmd; 1077 + writecmd = (struct aac_raw_io *) fib_data(fib); 1078 + writecmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); 1079 + writecmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); 1080 + writecmd->count = cpu_to_le32(count<<9); 1081 + writecmd->cid = cpu_to_le16(scmd_id(cmd)); 1082 + writecmd->flags = (fua && ((aac_cache & 5) != 1) && 1083 + (((aac_cache & 5) != 5) || !fib->dev->cache_protected)) ? 1084 + cpu_to_le16(RIO_TYPE_WRITE|RIO_SUREWRITE) : 1085 + cpu_to_le16(RIO_TYPE_WRITE); 1086 + writecmd->bpTotal = 0; 1087 + writecmd->bpComplete = 0; 1088 + aac_build_sgraw(cmd, &writecmd->sg); 1089 + command = ContainerRawIo; 1090 + fibsize = sizeof(struct aac_raw_io) + 1091 + ((le32_to_cpu(writecmd->sg.count)-1) * sizeof (struct sgentryraw)); 1092 + } 1093 + 1097 1094 BUG_ON(fibsize > (fib->dev->max_fib_size - sizeof(struct aac_fibhdr))); 1098 1095 /* 1099 1096 * Now send the Fib to the adapter 1100 1097 */ 1101 - return aac_fib_send(ContainerRawIo, 1098 + return aac_fib_send(command, 1102 1099 fib, 1103 1100 fibsize, 1104 1101 FsaNormal, ··· 1539 1492 dev->a_ops.adapter_write = aac_write_block; 1540 1493 } 1541 1494 dev->scsi_host_ptr->max_sectors = AAC_MAX_32BIT_SGBCOUNT; 1542 - if (dev->adapter_info.options & AAC_OPT_NEW_COMM_TYPE1) 1543 - dev->adapter_info.options |= AAC_OPT_NEW_COMM; 1544 1495 if (!(dev->adapter_info.options & AAC_OPT_NEW_COMM)) { 1545 1496 /* 1546 1497 * Worst case size that could cause sg overflow when ··· 2661 2616 srbreply = (struct aac_srb_reply *) fib_data(fibptr); 2662 2617 2663 2618 scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */ 2664 - /* 2665 - * Calculate resid for sg 2666 - */ 2667 2619 2668 - scsi_set_resid(scsicmd, scsi_bufflen(scsicmd) 2669 - - le32_to_cpu(srbreply->data_xfer_length)); 2620 + if (fibptr->flags & FIB_CONTEXT_FLAG_FASTRESP) { 2621 + /* fast response */ 2622 + srbreply->srb_status = cpu_to_le32(SRB_STATUS_SUCCESS); 2623 + srbreply->scsi_status = cpu_to_le32(SAM_STAT_GOOD); 2624 + } else { 2625 + /* 2626 + * Calculate resid for sg 2627 + */ 2628 + scsi_set_resid(scsicmd, scsi_bufflen(scsicmd) 2629 + - le32_to_cpu(srbreply->data_xfer_length)); 2630 + } 2670 2631 2671 2632 scsi_dma_unmap(scsicmd); 2672 2633 ··· 3003 2952 } 3004 2953 } 3005 2954 return byte_count; 2955 + } 2956 + 2957 + static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct aac_raw_io2 *rio2, int sg_max) 2958 + { 2959 + unsigned long byte_count = 0; 2960 + int nseg; 2961 + 2962 + nseg = scsi_dma_map(scsicmd); 2963 + BUG_ON(nseg < 0); 2964 + if (nseg) { 2965 + struct scatterlist *sg; 2966 + int i, conformable = 0; 2967 + u32 min_size = PAGE_SIZE, cur_size; 2968 + 2969 + scsi_for_each_sg(scsicmd, sg, nseg, i) { 2970 + int count = sg_dma_len(sg); 2971 + u64 addr = sg_dma_address(sg); 2972 + 2973 + BUG_ON(i >= sg_max); 2974 + rio2->sge[i].addrHigh = cpu_to_le32((u32)(addr>>32)); 2975 + rio2->sge[i].addrLow = cpu_to_le32((u32)(addr & 0xffffffff)); 2976 + cur_size = cpu_to_le32(count); 2977 + rio2->sge[i].length = cur_size; 2978 + rio2->sge[i].flags = 0; 2979 + if (i == 0) { 2980 + conformable = 1; 2981 + rio2->sgeFirstSize = cur_size; 2982 + } else if (i == 1) { 2983 + rio2->sgeNominalSize = cur_size; 2984 + min_size = cur_size; 2985 + } else if ((i+1) < nseg && cur_size != rio2->sgeNominalSize) { 2986 + conformable = 0; 2987 + if (cur_size < min_size) 2988 + min_size = cur_size; 2989 + } 2990 + byte_count += count; 2991 + } 2992 + 2993 + /* hba wants the size to be exact */ 2994 + if (byte_count > scsi_bufflen(scsicmd)) { 2995 + u32 temp = le32_to_cpu(rio2->sge[i-1].length) - 2996 + (byte_count - scsi_bufflen(scsicmd)); 2997 + rio2->sge[i-1].length = cpu_to_le32(temp); 2998 + byte_count = scsi_bufflen(scsicmd); 2999 + } 3000 + 3001 + rio2->sgeCnt = cpu_to_le32(nseg); 3002 + rio2->flags |= cpu_to_le16(RIO2_SG_FORMAT_IEEE1212); 3003 + /* not conformable: evaluate required sg elements */ 3004 + if (!conformable) { 3005 + int j, nseg_new = nseg, err_found; 3006 + for (i = min_size / PAGE_SIZE; i >= 1; --i) { 3007 + err_found = 0; 3008 + nseg_new = 2; 3009 + for (j = 1; j < nseg - 1; ++j) { 3010 + if (rio2->sge[j].length % (i*PAGE_SIZE)) { 3011 + err_found = 1; 3012 + break; 3013 + } 3014 + nseg_new += (rio2->sge[j].length / (i*PAGE_SIZE)); 3015 + } 3016 + if (!err_found) 3017 + break; 3018 + } 3019 + if (i > 0 && nseg_new <= sg_max) 3020 + aac_convert_sgraw2(rio2, i, nseg, nseg_new); 3021 + } else 3022 + rio2->flags |= cpu_to_le16(RIO2_SGL_CONFORMANT); 3023 + 3024 + /* Check for command underflow */ 3025 + if (scsicmd->underflow && (byte_count < scsicmd->underflow)) { 3026 + printk(KERN_WARNING"aacraid: cmd len %08lX cmd underflow %08X\n", 3027 + byte_count, scsicmd->underflow); 3028 + } 3029 + } 3030 + 3031 + return byte_count; 3032 + } 3033 + 3034 + static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, int nseg_new) 3035 + { 3036 + struct sge_ieee1212 *sge; 3037 + int i, j, pos; 3038 + u32 addr_low; 3039 + 3040 + if (aac_convert_sgl == 0) 3041 + return 0; 3042 + 3043 + sge = kmalloc(nseg_new * sizeof(struct sge_ieee1212), GFP_ATOMIC); 3044 + if (sge == NULL) 3045 + return -1; 3046 + 3047 + for (i = 1, pos = 1; i < nseg-1; ++i) { 3048 + for (j = 0; j < rio2->sge[i].length / (pages * PAGE_SIZE); ++j) { 3049 + addr_low = rio2->sge[i].addrLow + j * pages * PAGE_SIZE; 3050 + sge[pos].addrLow = addr_low; 3051 + sge[pos].addrHigh = rio2->sge[i].addrHigh; 3052 + if (addr_low < rio2->sge[i].addrLow) 3053 + sge[pos].addrHigh++; 3054 + sge[pos].length = pages * PAGE_SIZE; 3055 + sge[pos].flags = 0; 3056 + pos++; 3057 + } 3058 + } 3059 + sge[pos] = rio2->sge[nseg-1]; 3060 + memcpy(&rio2->sge[1], &sge[1], (nseg_new-1)*sizeof(struct sge_ieee1212)); 3061 + 3062 + kfree(sge); 3063 + rio2->sgeCnt = cpu_to_le32(nseg_new); 3064 + rio2->flags |= cpu_to_le16(RIO2_SGL_CONFORMANT); 3065 + rio2->sgeNominalSize = pages * PAGE_SIZE; 3066 + return 0; 3006 3067 } 3007 3068 3008 3069 #ifdef AAC_DETAILED_STATUS_INFO
+58 -16
drivers/scsi/aacraid/aacraid.h
··· 12 12 *----------------------------------------------------------------------------*/ 13 13 14 14 #ifndef AAC_DRIVER_BUILD 15 - # define AAC_DRIVER_BUILD 28900 15 + # define AAC_DRIVER_BUILD 29800 16 16 # define AAC_DRIVER_BRANCH "-ms" 17 17 #endif 18 18 #define MAXIMUM_NUM_CONTAINERS 32 ··· 98 98 u32 addr[2]; 99 99 u32 count; 100 100 u32 flags; /* reserved for F/W use */ 101 + }; 102 + 103 + struct sge_ieee1212 { 104 + u32 addrLow; 105 + u32 addrHigh; 106 + u32 length; 107 + u32 flags; 101 108 }; 102 109 103 110 /* ··· 277 270 */ 278 271 279 272 #define FIB_MAGIC 0x0001 273 + #define FIB_MAGIC2 0x0004 274 + #define FIB_MAGIC2_64 0x0005 280 275 281 276 /* 282 277 * Define the priority levels the FSA communication routines support. ··· 305 296 __le32 XferState; /* Current transfer state for this CCB */ 306 297 __le16 Command; /* Routing information for the destination */ 307 298 u8 StructType; /* Type FIB */ 308 - u8 Flags; /* Flags for FIB */ 299 + u8 Unused; /* Unused */ 309 300 __le16 Size; /* Size of this FIB in bytes */ 310 301 __le16 SenderSize; /* Size of the FIB in the sender 311 302 (for response sizing) */ 312 303 __le32 SenderFibAddress; /* Host defined data in the FIB */ 313 - __le32 ReceiverFibAddress;/* Logical address of this FIB for 314 - the adapter */ 315 - u32 SenderData; /* Place holder for the sender to store data */ 316 304 union { 317 - struct { 318 - __le32 _ReceiverTimeStart; /* Timestamp for 319 - receipt of fib */ 320 - __le32 _ReceiverTimeDone; /* Timestamp for 321 - completion of fib */ 322 - } _s; 323 - } _u; 305 + __le32 ReceiverFibAddress;/* Logical address of this FIB for 306 + the adapter (old) */ 307 + __le32 SenderFibAddressHigh;/* upper 32bit of phys. FIB address */ 308 + __le32 TimeStamp; /* otherwise timestamp for FW internal use */ 309 + } u; 310 + u32 Handle; /* FIB handle used for MSGU commnunication */ 311 + u32 Previous; /* FW internal use */ 312 + u32 Next; /* FW internal use */ 324 313 }; 325 314 326 315 struct hw_fib { ··· 368 361 #define ContainerCommand 500 369 362 #define ContainerCommand64 501 370 363 #define ContainerRawIo 502 364 + #define ContainerRawIo2 503 371 365 /* 372 366 * Scsi Port commands (scsi passthrough) 373 367 */ ··· 425 417 #define ADAPTER_INIT_STRUCT_REVISION 3 426 418 #define ADAPTER_INIT_STRUCT_REVISION_4 4 // rocket science 427 419 #define ADAPTER_INIT_STRUCT_REVISION_6 6 /* PMC src */ 420 + #define ADAPTER_INIT_STRUCT_REVISION_7 7 /* Denali */ 428 421 429 422 struct aac_init 430 423 { ··· 450 441 #define INITFLAGS_NEW_COMM_SUPPORTED 0x00000001 451 442 #define INITFLAGS_DRIVER_USES_UTC_TIME 0x00000010 452 443 #define INITFLAGS_DRIVER_SUPPORTS_PM 0x00000020 453 - #define INITFLAGS_NEW_COMM_TYPE1_SUPPORTED 0x00000041 444 + #define INITFLAGS_NEW_COMM_TYPE1_SUPPORTED 0x00000040 445 + #define INITFLAGS_FAST_JBOD_SUPPORTED 0x00000080 446 + #define INITFLAGS_NEW_COMM_TYPE2_SUPPORTED 0x00000100 454 447 __le32 MaxIoCommands; /* max outstanding commands */ 455 448 __le32 MaxIoSize; /* largest I/O command */ 456 449 __le32 MaxFibSize; /* largest FIB to adapter */ ··· 1135 1124 # define AAC_COMM_PRODUCER 0 1136 1125 # define AAC_COMM_MESSAGE 1 1137 1126 # define AAC_COMM_MESSAGE_TYPE1 3 1127 + # define AAC_COMM_MESSAGE_TYPE2 4 1138 1128 u8 raw_io_interface; 1139 1129 u8 raw_io_64; 1140 1130 u8 printf_enabled; ··· 1194 1182 #define FIB_CONTEXT_FLAG_TIMED_OUT (0x00000001) 1195 1183 #define FIB_CONTEXT_FLAG (0x00000002) 1196 1184 #define FIB_CONTEXT_FLAG_WAIT (0x00000004) 1185 + #define FIB_CONTEXT_FLAG_FASTRESP (0x00000008) 1197 1186 1198 1187 /* 1199 1188 * Define the command values ··· 1301 1288 #define CMDATA_SYNCH 4 1302 1289 #define CMUNSTABLE 5 1303 1290 1291 + #define RIO_TYPE_WRITE 0x0000 1292 + #define RIO_TYPE_READ 0x0001 1293 + #define RIO_SUREWRITE 0x0008 1294 + 1295 + #define RIO2_IO_TYPE 0x0003 1296 + #define RIO2_IO_TYPE_WRITE 0x0000 1297 + #define RIO2_IO_TYPE_READ 0x0001 1298 + #define RIO2_IO_TYPE_VERIFY 0x0002 1299 + #define RIO2_IO_ERROR 0x0004 1300 + #define RIO2_IO_SUREWRITE 0x0008 1301 + #define RIO2_SGL_CONFORMANT 0x0010 1302 + #define RIO2_SG_FORMAT 0xF000 1303 + #define RIO2_SG_FORMAT_ARC 0x0000 1304 + #define RIO2_SG_FORMAT_SRL 0x1000 1305 + #define RIO2_SG_FORMAT_IEEE1212 0x2000 1306 + 1304 1307 struct aac_read 1305 1308 { 1306 1309 __le32 command; ··· 1361 1332 __le32 block; 1362 1333 __le16 pad; 1363 1334 __le16 flags; 1364 - #define IO_TYPE_WRITE 0x00000000 1365 - #define IO_TYPE_READ 0x00000001 1366 - #define IO_SUREWRITE 0x00000008 1367 1335 struct sgmap64 sg; // Must be last in struct because it is variable 1368 1336 }; 1369 1337 struct aac_write_reply ··· 1379 1353 __le16 bpTotal; /* reserved for F/W use */ 1380 1354 __le16 bpComplete; /* reserved for F/W use */ 1381 1355 struct sgmapraw sg; 1356 + }; 1357 + 1358 + struct aac_raw_io2 { 1359 + __le32 blockLow; 1360 + __le32 blockHigh; 1361 + __le32 byteCount; 1362 + __le16 cid; 1363 + __le16 flags; /* RIO2 flags */ 1364 + __le32 sgeFirstSize; /* size of first sge el. */ 1365 + __le32 sgeNominalSize; /* size of 2nd sge el. (if conformant) */ 1366 + u8 sgeCnt; /* only 8 bits required */ 1367 + u8 bpTotal; /* reserved for F/W use */ 1368 + u8 bpComplete; /* reserved for F/W use */ 1369 + u8 sgeFirstIndex; /* reserved for F/W use */ 1370 + u8 unused[4]; 1371 + struct sge_ieee1212 sge[1]; 1382 1372 }; 1383 1373 1384 1374 #define CT_FLUSH_CACHE 129
+2
drivers/scsi/aacraid/commctrl.c
··· 498 498 return -ENOMEM; 499 499 } 500 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 504 srbcmd = (struct aac_srb*) fib_data(srbfib); 503 505
+32 -22
drivers/scsi/aacraid/comminit.c
··· 58 58 dma_addr_t phys; 59 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 63 host_rrq_size = (dev->scsi_host_ptr->can_queue 63 64 + AAC_NUM_MGT_FIB) * sizeof(u32); 64 65 size = fibsize + sizeof(struct aac_init) + commsize + ··· 76 75 dev->comm_phys = phys; 77 76 dev->comm_size = size; 78 77 79 - if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1) { 78 + if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1 || 79 + dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) { 80 80 dev->host_rrq = (u32 *)(base + fibsize); 81 81 dev->host_rrq_pa = phys + fibsize; 82 82 memset(dev->host_rrq, 0, host_rrq_size); ··· 117 115 else 118 116 init->HostPhysMemPages = cpu_to_le32(AAC_MAX_HOSTPHYSMEMPAGES); 119 117 120 - init->InitFlags = 0; 118 + init->InitFlags = cpu_to_le32(INITFLAGS_DRIVER_USES_UTC_TIME | 119 + INITFLAGS_DRIVER_SUPPORTS_PM); 120 + init->MaxIoCommands = cpu_to_le32(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); 121 + init->MaxIoSize = cpu_to_le32(dev->scsi_host_ptr->max_sectors << 9); 122 + init->MaxFibSize = cpu_to_le32(dev->max_fib_size); 123 + init->MaxNumAif = cpu_to_le32(dev->max_num_aif); 124 + 121 125 if (dev->comm_interface == AAC_COMM_MESSAGE) { 122 126 init->InitFlags |= cpu_to_le32(INITFLAGS_NEW_COMM_SUPPORTED); 123 127 dprintk((KERN_WARNING"aacraid: New Comm Interface enabled\n")); 124 128 } else if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1) { 125 129 init->InitStructRevision = cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_6); 126 - init->InitFlags |= cpu_to_le32(INITFLAGS_NEW_COMM_TYPE1_SUPPORTED); 127 - dprintk((KERN_WARNING 128 - "aacraid: New Comm Interface type1 enabled\n")); 130 + init->InitFlags |= cpu_to_le32(INITFLAGS_NEW_COMM_SUPPORTED | 131 + INITFLAGS_NEW_COMM_TYPE1_SUPPORTED | INITFLAGS_FAST_JBOD_SUPPORTED); 132 + init->HostRRQ_AddrHigh = cpu_to_le32((u32)((u64)dev->host_rrq_pa >> 32)); 133 + init->HostRRQ_AddrLow = cpu_to_le32((u32)(dev->host_rrq_pa & 0xffffffff)); 134 + dprintk((KERN_WARNING"aacraid: New Comm Interface type1 enabled\n")); 135 + } else if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) { 136 + init->InitStructRevision = cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_7); 137 + init->InitFlags |= cpu_to_le32(INITFLAGS_NEW_COMM_SUPPORTED | 138 + INITFLAGS_NEW_COMM_TYPE2_SUPPORTED | INITFLAGS_FAST_JBOD_SUPPORTED); 139 + init->HostRRQ_AddrHigh = cpu_to_le32((u32)((u64)dev->host_rrq_pa >> 32)); 140 + init->HostRRQ_AddrLow = cpu_to_le32((u32)(dev->host_rrq_pa & 0xffffffff)); 141 + init->MiniPortRevision = cpu_to_le32(0L); /* number of MSI-X */ 142 + dprintk((KERN_WARNING"aacraid: New Comm Interface type2 enabled\n")); 129 143 } 130 - init->InitFlags |= cpu_to_le32(INITFLAGS_DRIVER_USES_UTC_TIME | 131 - INITFLAGS_DRIVER_SUPPORTS_PM); 132 - init->MaxIoCommands = cpu_to_le32(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); 133 - init->MaxIoSize = cpu_to_le32(dev->scsi_host_ptr->max_sectors << 9); 134 - init->MaxFibSize = cpu_to_le32(dev->max_fib_size); 135 - 136 - init->MaxNumAif = cpu_to_le32(dev->max_num_aif); 137 - init->HostRRQ_AddrHigh = cpu_to_le32((u32)((u64)dev->host_rrq_pa >> 32)); 138 - init->HostRRQ_AddrLow = cpu_to_le32((u32)(dev->host_rrq_pa & 0xffffffff)); 139 - 140 144 141 145 /* 142 146 * Increment the base address by the amount already used ··· 362 354 if ((status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE1))) { 363 355 /* driver supports TYPE1 (Tupelo) */ 364 356 dev->comm_interface = AAC_COMM_MESSAGE_TYPE1; 357 + } else if ((status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE2))) { 358 + /* driver supports TYPE2 (Denali) */ 359 + dev->comm_interface = AAC_COMM_MESSAGE_TYPE2; 365 360 } else if ((status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE4)) || 366 - (status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE3)) || 367 - (status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE2))) { 368 - /* driver doesn't support TYPE2 (Series7), TYPE3 and TYPE4 */ 369 - /* switch to sync. mode */ 370 - dev->comm_interface = AAC_COMM_MESSAGE_TYPE1; 371 - dev->sync_mode = 1; 361 + (status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_TYPE3))) { 362 + /* driver doesn't TYPE3 and TYPE4 */ 363 + /* switch to sync. mode */ 364 + dev->comm_interface = AAC_COMM_MESSAGE_TYPE2; 365 + dev->sync_mode = 1; 372 366 } 373 367 } 374 368 if ((dev->comm_interface == AAC_COMM_MESSAGE) &&
+13 -9
drivers/scsi/aacraid/commsup.c
··· 136 136 i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); 137 137 i++, fibptr++) 138 138 { 139 + fibptr->flags = 0; 139 140 fibptr->dev = dev; 140 141 fibptr->hw_fib_va = hw_fib; 141 142 fibptr->data = (void *) fibptr->hw_fib_va->data; ··· 241 240 { 242 241 struct hw_fib *hw_fib = fibptr->hw_fib_va; 243 242 243 + memset(&hw_fib->header, 0, sizeof(struct aac_fibhdr)); 244 244 hw_fib->header.StructType = FIB_MAGIC; 245 245 hw_fib->header.Size = cpu_to_le16(fibptr->dev->max_fib_size); 246 246 hw_fib->header.XferState = cpu_to_le32(HostOwned | FibInitialized | FibEmpty | FastResponseCapable); 247 - hw_fib->header.SenderFibAddress = 0; /* Filled in later if needed */ 248 - hw_fib->header.ReceiverFibAddress = cpu_to_le32(fibptr->hw_fib_pa); 247 + hw_fib->header.u.ReceiverFibAddress = cpu_to_le32(fibptr->hw_fib_pa); 249 248 hw_fib->header.SenderSize = cpu_to_le16(fibptr->dev->max_fib_size); 250 249 } 251 250 ··· 260 259 static void fib_dealloc(struct fib * fibptr) 261 260 { 262 261 struct hw_fib *hw_fib = fibptr->hw_fib_va; 263 - BUG_ON(hw_fib->header.StructType != FIB_MAGIC); 264 262 hw_fib->header.XferState = 0; 265 263 } 266 264 ··· 370 370 entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); 371 371 entry->addr = hw_fib->header.SenderFibAddress; 372 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 374 map = 0; 375 375 } 376 376 /* ··· 450 450 */ 451 451 452 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 455 * Set FIB state to indicate where it came from and if we want a 456 456 * response from the adapter. Also load the command from the ··· 460 460 */ 461 461 hw_fib->header.Command = cpu_to_le16(command); 462 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 464 * Set the size of the Fib we want to send to the adapter 466 465 */ ··· 710 711 unsigned long nointr = 0; 711 712 unsigned long qflags; 712 713 713 - if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1) { 714 + if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1 || 715 + dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) { 714 716 kfree(hw_fib); 715 717 return 0; 716 718 } ··· 724 724 /* 725 725 * If we plan to do anything check the structure type first. 726 726 */ 727 - 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) { 728 730 if (dev->comm_interface == AAC_COMM_MESSAGE) 729 731 kfree(hw_fib); 730 732 return -EINVAL; ··· 788 786 * If we plan to do anything check the structure type first. 789 787 */ 790 788 791 - if (hw_fib->header.StructType != FIB_MAGIC) 789 + if (hw_fib->header.StructType != FIB_MAGIC && 790 + hw_fib->header.StructType != FIB_MAGIC2 && 791 + hw_fib->header.StructType != FIB_MAGIC2_64) 792 792 return -EINVAL; 793 793 /* 794 794 * This block completes a cdb which orginated on the host and we
+4 -2
drivers/scsi/aacraid/dpcsup.c
··· 101 101 */ 102 102 *(__le32 *)hwfib->data = cpu_to_le32(ST_OK); 103 103 hwfib->header.XferState |= cpu_to_le32(AdapterProcessed); 104 + fib->flags |= FIB_CONTEXT_FLAG_FASTRESP; 104 105 } 105 106 106 107 FIB_COUNTER_INCREMENT(aac_config.FibRecved); ··· 122 121 * NOTE: we cannot touch the fib after this 123 122 * call, because it may have been deallocated. 124 123 */ 125 - fib->flags = 0; 124 + fib->flags &= FIB_CONTEXT_FLAG_FASTRESP; 126 125 fib->callback(fib->callback_data, fib); 127 126 } else { 128 127 unsigned long flagv; ··· 368 367 */ 369 368 *(__le32 *)hwfib->data = cpu_to_le32(ST_OK); 370 369 hwfib->header.XferState |= cpu_to_le32(AdapterProcessed); 370 + fib->flags |= FIB_CONTEXT_FLAG_FASTRESP; 371 371 } 372 372 373 373 FIB_COUNTER_INCREMENT(aac_config.FibRecved); ··· 389 387 * NOTE: we cannot touch the fib after this 390 388 * call, because it may have been deallocated. 391 389 */ 392 - fib->flags = 0; 390 + fib->flags &= FIB_CONTEXT_FLAG_FASTRESP; 393 391 fib->callback(fib->callback_data, fib); 394 392 } else { 395 393 unsigned long flagv;
+1 -1
drivers/scsi/aacraid/linit.c
··· 1166 1166 aac->cardtype = index; 1167 1167 INIT_LIST_HEAD(&aac->entry); 1168 1168 1169 - 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); 1170 1170 if (!aac->fibs) 1171 1171 goto out_free_host; 1172 1172 spin_lock_init(&aac->fib_lock);
+47 -38
drivers/scsi/aacraid/src.c
··· 56 56 if (bellbits & PmDoorBellResponseSent) { 57 57 bellbits = PmDoorBellResponseSent; 58 58 /* handle async. status */ 59 + src_writel(dev, MUnit.ODR_C, bellbits); 60 + src_readl(dev, MUnit.ODR_C); 59 61 our_interrupt = 1; 60 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 63 for (;;) { 75 64 isFastResponse = 0; 76 65 /* remove toggle bit (31) */ ··· 82 93 } else { 83 94 bellbits_shifted = (bellbits >> SRC_ODR_SHIFT); 84 95 if (bellbits_shifted & DoorBellAifPending) { 96 + src_writel(dev, MUnit.ODR_C, bellbits); 97 + src_readl(dev, MUnit.ODR_C); 85 98 our_interrupt = 1; 86 99 /* handle AIF */ 87 100 aac_intr_normal(dev, 0, 2, 0, NULL); ··· 91 100 unsigned long sflags; 92 101 struct list_head *entry; 93 102 int send_it = 0; 103 + extern int aac_sync_mode; 104 + 105 + if (!aac_sync_mode) { 106 + src_writel(dev, MUnit.ODR_C, bellbits); 107 + src_readl(dev, MUnit.ODR_C); 108 + our_interrupt = 1; 109 + } 94 110 95 111 if (dev->sync_fib) { 96 112 our_interrupt = 1; ··· 130 132 } 131 133 132 134 if (our_interrupt) { 133 - src_writel(dev, MUnit.ODR_C, bellbits); 134 135 return IRQ_HANDLED; 135 136 } 136 137 return IRQ_NONE; ··· 333 336 { 334 337 struct aac_init *init; 335 338 339 + /* reset host_rrq_idx first */ 340 + dev->host_rrq_idx = 0; 341 + 336 342 init = dev->init; 337 343 init->HostElapsedSeconds = cpu_to_le32(get_seconds()); 338 344 ··· 397 397 q->numpending++; 398 398 spin_unlock_irqrestore(q->lock, qflags); 399 399 400 - /* Calculate the amount to the fibsize bits */ 401 - fibsize = (sizeof(struct aac_fib_xporthdr) + hdr_size + 127) / 128 - 1; 402 - if (fibsize > (ALIGN32 - 1)) 403 - return -EMSGSIZE; 400 + if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) { 401 + /* Calculate the amount to the fibsize bits */ 402 + fibsize = (hdr_size + 127) / 128 - 1; 403 + if (fibsize > (ALIGN32 - 1)) 404 + return -EMSGSIZE; 405 + /* New FIB header, 32-bit */ 406 + address = fib->hw_fib_pa; 407 + fib->hw_fib_va->header.StructType = FIB_MAGIC2; 408 + fib->hw_fib_va->header.SenderFibAddress = (u32)address; 409 + fib->hw_fib_va->header.u.TimeStamp = 0; 410 + BUG_ON((u32)(address >> 32) != 0L); 411 + address |= fibsize; 412 + } else { 413 + /* Calculate the amount to the fibsize bits */ 414 + fibsize = (sizeof(struct aac_fib_xporthdr) + hdr_size + 127) / 128 - 1; 415 + if (fibsize > (ALIGN32 - 1)) 416 + return -EMSGSIZE; 404 417 405 - /* Fill XPORT header */ 406 - pFibX = (void *)fib->hw_fib_va - sizeof(struct aac_fib_xporthdr); 407 - /* 408 - * This was stored by aac_fib_send() and it is the index into 409 - * dev->fibs. Not sure why we add 1 to it, but I suspect that it's 410 - * because it can't be zero when we pass it to the hardware. Note that 411 - * it was stored in native endian, hence the lack of swapping. -- BenC 412 - */ 413 - pFibX->Handle = cpu_to_le32(fib->hw_fib_va->header.SenderData + 1); 414 - pFibX->HostAddress = cpu_to_le64(fib->hw_fib_pa); 415 - pFibX->Size = cpu_to_le32(hdr_size); 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); 416 423 417 - /* 418 - * The xport header has been 32-byte aligned for us so that fibsize 419 - * can be masked out of this address by hardware. -- BenC 420 - */ 421 - address = fib->hw_fib_pa - sizeof(struct aac_fib_xporthdr); 422 - if (address & (ALIGN32 - 1)) 423 - return -EINVAL; 424 - address |= fibsize; 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 + 425 434 src_writel(dev, MUnit.IQ_H, (address >> 32) & 0xffffffff); 426 435 src_writel(dev, MUnit.IQ_L, address & 0xffffffff); 427 436 ··· 773 764 774 765 if (aac_init_adapter(dev) == NULL) 775 766 goto error_iounmap; 776 - if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE1) 767 + if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE2) 777 768 goto error_iounmap; 778 769 dev->msi = aac_msi && !pci_enable_msi(dev->pdev); 779 770 if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,