aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid/aachba.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aacraid/aachba.c')
-rw-r--r--drivers/scsi/aacraid/aachba.c243
1 files changed, 121 insertions, 122 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 9bd7173072fe..8d7b7703ee2a 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -56,54 +56,54 @@
56/* 56/*
57 * Sense codes 57 * Sense codes
58 */ 58 */
59 59
60#define SENCODE_NO_SENSE 0x00 60#define SENCODE_NO_SENSE 0x00
61#define SENCODE_END_OF_DATA 0x00 61#define SENCODE_END_OF_DATA 0x00
62#define SENCODE_BECOMING_READY 0x04 62#define SENCODE_BECOMING_READY 0x04
63#define SENCODE_INIT_CMD_REQUIRED 0x04 63#define SENCODE_INIT_CMD_REQUIRED 0x04
64#define SENCODE_PARAM_LIST_LENGTH_ERROR 0x1A 64#define SENCODE_PARAM_LIST_LENGTH_ERROR 0x1A
65#define SENCODE_INVALID_COMMAND 0x20 65#define SENCODE_INVALID_COMMAND 0x20
66#define SENCODE_LBA_OUT_OF_RANGE 0x21 66#define SENCODE_LBA_OUT_OF_RANGE 0x21
67#define SENCODE_INVALID_CDB_FIELD 0x24 67#define SENCODE_INVALID_CDB_FIELD 0x24
68#define SENCODE_LUN_NOT_SUPPORTED 0x25 68#define SENCODE_LUN_NOT_SUPPORTED 0x25
69#define SENCODE_INVALID_PARAM_FIELD 0x26 69#define SENCODE_INVALID_PARAM_FIELD 0x26
70#define SENCODE_PARAM_NOT_SUPPORTED 0x26 70#define SENCODE_PARAM_NOT_SUPPORTED 0x26
71#define SENCODE_PARAM_VALUE_INVALID 0x26 71#define SENCODE_PARAM_VALUE_INVALID 0x26
72#define SENCODE_RESET_OCCURRED 0x29 72#define SENCODE_RESET_OCCURRED 0x29
73#define SENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x3E 73#define SENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x3E
74#define SENCODE_INQUIRY_DATA_CHANGED 0x3F 74#define SENCODE_INQUIRY_DATA_CHANGED 0x3F
75#define SENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x39 75#define SENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x39
76#define SENCODE_DIAGNOSTIC_FAILURE 0x40 76#define SENCODE_DIAGNOSTIC_FAILURE 0x40
77#define SENCODE_INTERNAL_TARGET_FAILURE 0x44 77#define SENCODE_INTERNAL_TARGET_FAILURE 0x44
78#define SENCODE_INVALID_MESSAGE_ERROR 0x49 78#define SENCODE_INVALID_MESSAGE_ERROR 0x49
79#define SENCODE_LUN_FAILED_SELF_CONFIG 0x4c 79#define SENCODE_LUN_FAILED_SELF_CONFIG 0x4c
80#define SENCODE_OVERLAPPED_COMMAND 0x4E 80#define SENCODE_OVERLAPPED_COMMAND 0x4E
81 81
82/* 82/*
83 * Additional sense codes 83 * Additional sense codes
84 */ 84 */
85 85
86#define ASENCODE_NO_SENSE 0x00 86#define ASENCODE_NO_SENSE 0x00
87#define ASENCODE_END_OF_DATA 0x05 87#define ASENCODE_END_OF_DATA 0x05
88#define ASENCODE_BECOMING_READY 0x01 88#define ASENCODE_BECOMING_READY 0x01
89#define ASENCODE_INIT_CMD_REQUIRED 0x02 89#define ASENCODE_INIT_CMD_REQUIRED 0x02
90#define ASENCODE_PARAM_LIST_LENGTH_ERROR 0x00 90#define ASENCODE_PARAM_LIST_LENGTH_ERROR 0x00
91#define ASENCODE_INVALID_COMMAND 0x00 91#define ASENCODE_INVALID_COMMAND 0x00
92#define ASENCODE_LBA_OUT_OF_RANGE 0x00 92#define ASENCODE_LBA_OUT_OF_RANGE 0x00
93#define ASENCODE_INVALID_CDB_FIELD 0x00 93#define ASENCODE_INVALID_CDB_FIELD 0x00
94#define ASENCODE_LUN_NOT_SUPPORTED 0x00 94#define ASENCODE_LUN_NOT_SUPPORTED 0x00
95#define ASENCODE_INVALID_PARAM_FIELD 0x00 95#define ASENCODE_INVALID_PARAM_FIELD 0x00
96#define ASENCODE_PARAM_NOT_SUPPORTED 0x01 96#define ASENCODE_PARAM_NOT_SUPPORTED 0x01
97#define ASENCODE_PARAM_VALUE_INVALID 0x02 97#define ASENCODE_PARAM_VALUE_INVALID 0x02
98#define ASENCODE_RESET_OCCURRED 0x00 98#define ASENCODE_RESET_OCCURRED 0x00
99#define ASENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x00 99#define ASENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x00
100#define ASENCODE_INQUIRY_DATA_CHANGED 0x03 100#define ASENCODE_INQUIRY_DATA_CHANGED 0x03
101#define ASENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x00 101#define ASENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x00
102#define ASENCODE_DIAGNOSTIC_FAILURE 0x80 102#define ASENCODE_DIAGNOSTIC_FAILURE 0x80
103#define ASENCODE_INTERNAL_TARGET_FAILURE 0x00 103#define ASENCODE_INTERNAL_TARGET_FAILURE 0x00
104#define ASENCODE_INVALID_MESSAGE_ERROR 0x00 104#define ASENCODE_INVALID_MESSAGE_ERROR 0x00
105#define ASENCODE_LUN_FAILED_SELF_CONFIG 0x00 105#define ASENCODE_LUN_FAILED_SELF_CONFIG 0x00
106#define ASENCODE_OVERLAPPED_COMMAND 0x00 106#define ASENCODE_OVERLAPPED_COMMAND 0x00
107 107
108#define BYTE0(x) (unsigned char)(x) 108#define BYTE0(x) (unsigned char)(x)
109#define BYTE1(x) (unsigned char)((x) >> 8) 109#define BYTE1(x) (unsigned char)((x) >> 8)
@@ -115,8 +115,8 @@
115 *----------------------------------------------------------------------------*/ 115 *----------------------------------------------------------------------------*/
116/* SCSI inquiry data */ 116/* SCSI inquiry data */
117struct inquiry_data { 117struct inquiry_data {
118 u8 inqd_pdt; /* Peripheral qualifier | Peripheral Device Type */ 118 u8 inqd_pdt; /* Peripheral qualifier | Peripheral Device Type */
119 u8 inqd_dtq; /* RMB | Device Type Qualifier */ 119 u8 inqd_dtq; /* RMB | Device Type Qualifier */
120 u8 inqd_ver; /* ISO version | ECMA version | ANSI-approved version */ 120 u8 inqd_ver; /* ISO version | ECMA version | ANSI-approved version */
121 u8 inqd_rdf; /* AENC | TrmIOP | Response data format */ 121 u8 inqd_rdf; /* AENC | TrmIOP | Response data format */
122 u8 inqd_len; /* Additional length (n-4) */ 122 u8 inqd_len; /* Additional length (n-4) */
@@ -130,7 +130,7 @@ struct inquiry_data {
130/* 130/*
131 * M O D U L E G L O B A L S 131 * M O D U L E G L O B A L S
132 */ 132 */
133 133
134static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); 134static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap);
135static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); 135static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg);
136static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); 136static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg);
@@ -141,8 +141,8 @@ static char *aac_get_status_string(u32 status);
141 141
142/* 142/*
143 * Non dasd selection is handled entirely in aachba now 143 * Non dasd selection is handled entirely in aachba now
144 */ 144 */
145 145
146static int nondasd = -1; 146static int nondasd = -1;
147static int aac_cache = 0; 147static int aac_cache = 0;
148static int dacmode = -1; 148static int dacmode = -1;
@@ -196,12 +196,12 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd,
196 struct fib *fibptr) { 196 struct fib *fibptr) {
197 struct scsi_device *device; 197 struct scsi_device *device;
198 198
199 if (unlikely(!scsicmd || !scsicmd->scsi_done )) { 199 if (unlikely(!scsicmd || !scsicmd->scsi_done)) {
200 dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n")); 200 dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n"));
201 aac_fib_complete(fibptr); 201 aac_fib_complete(fibptr);
202 aac_fib_free(fibptr); 202 aac_fib_free(fibptr);
203 return 0; 203 return 0;
204 } 204 }
205 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; 205 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
206 device = scsicmd->device; 206 device = scsicmd->device;
207 if (unlikely(!device || !scsi_device_online(device))) { 207 if (unlikely(!device || !scsi_device_online(device))) {
@@ -243,7 +243,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
243 FsaNormal, 243 FsaNormal,
244 1, 1, 244 1, 1,
245 NULL, NULL); 245 NULL, NULL);
246 if (status < 0 ) { 246 if (status < 0) {
247 printk(KERN_WARNING "aac_get_config_status: SendFIB failed.\n"); 247 printk(KERN_WARNING "aac_get_config_status: SendFIB failed.\n");
248 } else { 248 } else {
249 struct aac_get_config_status_resp *reply 249 struct aac_get_config_status_resp *reply
@@ -267,10 +267,10 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
267 struct aac_commit_config * dinfo; 267 struct aac_commit_config * dinfo;
268 aac_fib_init(fibptr); 268 aac_fib_init(fibptr);
269 dinfo = (struct aac_commit_config *) fib_data(fibptr); 269 dinfo = (struct aac_commit_config *) fib_data(fibptr);
270 270
271 dinfo->command = cpu_to_le32(VM_ContainerConfig); 271 dinfo->command = cpu_to_le32(VM_ContainerConfig);
272 dinfo->type = cpu_to_le32(CT_COMMIT_CONFIG); 272 dinfo->type = cpu_to_le32(CT_COMMIT_CONFIG);
273 273
274 status = aac_fib_send(ContainerCommand, 274 status = aac_fib_send(ContainerCommand,
275 fibptr, 275 fibptr,
276 sizeof (struct aac_commit_config), 276 sizeof (struct aac_commit_config),
@@ -296,7 +296,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
296int aac_get_containers(struct aac_dev *dev) 296int aac_get_containers(struct aac_dev *dev)
297{ 297{
298 struct fsa_dev_info *fsa_dev_ptr; 298 struct fsa_dev_info *fsa_dev_ptr;
299 u32 index; 299 u32 index;
300 int status = 0; 300 int status = 0;
301 struct fib * fibptr; 301 struct fib * fibptr;
302 struct aac_get_container_count *dinfo; 302 struct aac_get_container_count *dinfo;
@@ -399,7 +399,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
399 do { 399 do {
400 *dp++ = (*sp) ? *sp++ : ' '; 400 *dp++ = (*sp) ? *sp++ : ' ';
401 } while (--count > 0); 401 } while (--count > 0);
402 aac_internal_transfer(scsicmd, d, 402 aac_internal_transfer(scsicmd, d,
403 offsetof(struct inquiry_data, inqd_pid), sizeof(d)); 403 offsetof(struct inquiry_data, inqd_pid), sizeof(d));
404 } 404 }
405 } 405 }
@@ -435,13 +435,13 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd)
435 dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data)); 435 dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data));
436 436
437 status = aac_fib_send(ContainerCommand, 437 status = aac_fib_send(ContainerCommand,
438 cmd_fibcontext, 438 cmd_fibcontext,
439 sizeof (struct aac_get_name), 439 sizeof (struct aac_get_name),
440 FsaNormal, 440 FsaNormal,
441 0, 1, 441 0, 1,
442 (fib_callback) get_container_name_callback, 442 (fib_callback)get_container_name_callback,
443 (void *) scsicmd); 443 (void *) scsicmd);
444 444
445 /* 445 /*
446 * Check that the command queued to the controller 446 * Check that the command queued to the controller
447 */ 447 */
@@ -449,7 +449,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd)
449 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; 449 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
450 return 0; 450 return 0;
451 } 451 }
452 452
453 printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status); 453 printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status);
454 aac_fib_complete(cmd_fibcontext); 454 aac_fib_complete(cmd_fibcontext);
455 aac_fib_free(cmd_fibcontext); 455 aac_fib_free(cmd_fibcontext);
@@ -656,39 +656,39 @@ struct scsi_inq {
656 * @a: string to copy from 656 * @a: string to copy from
657 * @b: string to copy to 657 * @b: string to copy to
658 * 658 *
659 * Copy a String from one location to another 659 * Copy a String from one location to another
660 * without copying \0 660 * without copying \0
661 */ 661 */
662 662
663static void inqstrcpy(char *a, char *b) 663static void inqstrcpy(char *a, char *b)
664{ 664{
665 665
666 while(*a != (char)0) 666 while (*a != (char)0)
667 *b++ = *a++; 667 *b++ = *a++;
668} 668}
669 669
670static char *container_types[] = { 670static char *container_types[] = {
671 "None", 671 "None",
672 "Volume", 672 "Volume",
673 "Mirror", 673 "Mirror",
674 "Stripe", 674 "Stripe",
675 "RAID5", 675 "RAID5",
676 "SSRW", 676 "SSRW",
677 "SSRO", 677 "SSRO",
678 "Morph", 678 "Morph",
679 "Legacy", 679 "Legacy",
680 "RAID4", 680 "RAID4",
681 "RAID10", 681 "RAID10",
682 "RAID00", 682 "RAID00",
683 "V-MIRRORS", 683 "V-MIRRORS",
684 "PSEUDO R4", 684 "PSEUDO R4",
685 "RAID50", 685 "RAID50",
686 "RAID5D", 686 "RAID5D",
687 "RAID5D0", 687 "RAID5D0",
688 "RAID1E", 688 "RAID1E",
689 "RAID6", 689 "RAID6",
690 "RAID60", 690 "RAID60",
691 "Unknown" 691 "Unknown"
692}; 692};
693 693
694char * get_container_type(unsigned tindex) 694char * get_container_type(unsigned tindex)
@@ -1230,11 +1230,11 @@ int aac_get_adapter_info(struct aac_dev* dev)
1230 memset(info,0,sizeof(*info)); 1230 memset(info,0,sizeof(*info));
1231 1231
1232 rcode = aac_fib_send(RequestAdapterInfo, 1232 rcode = aac_fib_send(RequestAdapterInfo,
1233 fibptr, 1233 fibptr,
1234 sizeof(*info), 1234 sizeof(*info),
1235 FsaNormal, 1235 FsaNormal,
1236 -1, 1, /* First `interrupt' command uses special wait */ 1236 -1, 1, /* First `interrupt' command uses special wait */
1237 NULL, 1237 NULL,
1238 NULL); 1238 NULL);
1239 1239
1240 if (rcode < 0) { 1240 if (rcode < 0) {
@@ -1266,8 +1266,8 @@ int aac_get_adapter_info(struct aac_dev* dev)
1266 } 1266 }
1267 1267
1268 1268
1269 /* 1269 /*
1270 * GetBusInfo 1270 * GetBusInfo
1271 */ 1271 */
1272 1272
1273 aac_fib_init(fibptr); 1273 aac_fib_init(fibptr);
@@ -1301,7 +1301,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
1301 char buffer[16]; 1301 char buffer[16];
1302 tmp = le32_to_cpu(dev->adapter_info.kernelrev); 1302 tmp = le32_to_cpu(dev->adapter_info.kernelrev);
1303 printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n", 1303 printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n",
1304 dev->name, 1304 dev->name,
1305 dev->id, 1305 dev->id,
1306 tmp>>24, 1306 tmp>>24,
1307 (tmp>>16)&0xff, 1307 (tmp>>16)&0xff,
@@ -1363,7 +1363,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
1363 if (dev->raid_scsi_mode != 0) 1363 if (dev->raid_scsi_mode != 0)
1364 printk(KERN_INFO "%s%d: ROMB RAID/SCSI mode enabled\n", 1364 printk(KERN_INFO "%s%d: ROMB RAID/SCSI mode enabled\n",
1365 dev->name, dev->id); 1365 dev->name, dev->id);
1366 1366
1367 if (nondasd != -1) 1367 if (nondasd != -1)
1368 dev->nondasd_support = (nondasd!=0); 1368 dev->nondasd_support = (nondasd!=0);
1369 if(dev->nondasd_support != 0) { 1369 if(dev->nondasd_support != 0) {
@@ -1395,7 +1395,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
1395 rcode = -ENOMEM; 1395 rcode = -ENOMEM;
1396 } 1396 }
1397 } 1397 }
1398 /* 1398 /*
1399 * Deal with configuring for the individualized limits of each packet 1399 * Deal with configuring for the individualized limits of each packet
1400 * interface. 1400 * interface.
1401 */ 1401 */
@@ -1419,8 +1419,8 @@ int aac_get_adapter_info(struct aac_dev* dev)
1419 if (dev->dac_support) { 1419 if (dev->dac_support) {
1420 dev->a_ops.adapter_read = aac_read_block64; 1420 dev->a_ops.adapter_read = aac_read_block64;
1421 dev->a_ops.adapter_write = aac_write_block64; 1421 dev->a_ops.adapter_write = aac_write_block64;
1422 /* 1422 /*
1423 * 38 scatter gather elements 1423 * 38 scatter gather elements
1424 */ 1424 */
1425 dev->scsi_host_ptr->sg_tablesize = 1425 dev->scsi_host_ptr->sg_tablesize =
1426 (dev->max_fib_size - 1426 (dev->max_fib_size -
@@ -1549,7 +1549,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)
1549 case READ_6: 1549 case READ_6:
1550 dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", scmd_id(scsicmd))); 1550 dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", scmd_id(scsicmd)));
1551 1551
1552 lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | 1552 lba = ((scsicmd->cmnd[1] & 0x1F) << 16) |
1553 (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; 1553 (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3];
1554 count = scsicmd->cmnd[4]; 1554 count = scsicmd->cmnd[4];
1555 1555
@@ -1559,32 +1559,32 @@ static int aac_read(struct scsi_cmnd * scsicmd)
1559 case READ_16: 1559 case READ_16:
1560 dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", scmd_id(scsicmd))); 1560 dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", scmd_id(scsicmd)));
1561 1561
1562 lba = ((u64)scsicmd->cmnd[2] << 56) | 1562 lba = ((u64)scsicmd->cmnd[2] << 56) |
1563 ((u64)scsicmd->cmnd[3] << 48) | 1563 ((u64)scsicmd->cmnd[3] << 48) |
1564 ((u64)scsicmd->cmnd[4] << 40) | 1564 ((u64)scsicmd->cmnd[4] << 40) |
1565 ((u64)scsicmd->cmnd[5] << 32) | 1565 ((u64)scsicmd->cmnd[5] << 32) |
1566 ((u64)scsicmd->cmnd[6] << 24) | 1566 ((u64)scsicmd->cmnd[6] << 24) |
1567 (scsicmd->cmnd[7] << 16) | 1567 (scsicmd->cmnd[7] << 16) |
1568 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; 1568 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
1569 count = (scsicmd->cmnd[10] << 24) | 1569 count = (scsicmd->cmnd[10] << 24) |
1570 (scsicmd->cmnd[11] << 16) | 1570 (scsicmd->cmnd[11] << 16) |
1571 (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; 1571 (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13];
1572 break; 1572 break;
1573 case READ_12: 1573 case READ_12:
1574 dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", scmd_id(scsicmd))); 1574 dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", scmd_id(scsicmd)));
1575 1575
1576 lba = ((u64)scsicmd->cmnd[2] << 24) | 1576 lba = ((u64)scsicmd->cmnd[2] << 24) |
1577 (scsicmd->cmnd[3] << 16) | 1577 (scsicmd->cmnd[3] << 16) |
1578 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; 1578 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
1579 count = (scsicmd->cmnd[6] << 24) | 1579 count = (scsicmd->cmnd[6] << 24) |
1580 (scsicmd->cmnd[7] << 16) | 1580 (scsicmd->cmnd[7] << 16) |
1581 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; 1581 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
1582 break; 1582 break;
1583 default: 1583 default:
1584 dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", scmd_id(scsicmd))); 1584 dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", scmd_id(scsicmd)));
1585 1585
1586 lba = ((u64)scsicmd->cmnd[2] << 24) | 1586 lba = ((u64)scsicmd->cmnd[2] << 24) |
1587 (scsicmd->cmnd[3] << 16) | 1587 (scsicmd->cmnd[3] << 16) |
1588 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; 1588 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
1589 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; 1589 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8];
1590 break; 1590 break;
@@ -1609,7 +1609,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)
1609 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; 1609 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
1610 return 0; 1610 return 0;
1611 } 1611 }
1612 1612
1613 printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status); 1613 printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status);
1614 /* 1614 /*
1615 * For some reason, the Fib didn't queue, return QUEUE_FULL 1615 * For some reason, the Fib didn't queue, return QUEUE_FULL
@@ -1644,11 +1644,11 @@ static int aac_write(struct scsi_cmnd * scsicmd)
1644 } else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */ 1644 } else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */
1645 dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", scmd_id(scsicmd))); 1645 dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", scmd_id(scsicmd)));
1646 1646
1647 lba = ((u64)scsicmd->cmnd[2] << 56) | 1647 lba = ((u64)scsicmd->cmnd[2] << 56) |
1648 ((u64)scsicmd->cmnd[3] << 48) | 1648 ((u64)scsicmd->cmnd[3] << 48) |
1649 ((u64)scsicmd->cmnd[4] << 40) | 1649 ((u64)scsicmd->cmnd[4] << 40) |
1650 ((u64)scsicmd->cmnd[5] << 32) | 1650 ((u64)scsicmd->cmnd[5] << 32) |
1651 ((u64)scsicmd->cmnd[6] << 24) | 1651 ((u64)scsicmd->cmnd[6] << 24) |
1652 (scsicmd->cmnd[7] << 16) | 1652 (scsicmd->cmnd[7] << 16) |
1653 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; 1653 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
1654 count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) | 1654 count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) |
@@ -1875,14 +1875,14 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
1875 * Emulate a SCSI command and queue the required request for the 1875 * Emulate a SCSI command and queue the required request for the
1876 * aacraid firmware. 1876 * aacraid firmware.
1877 */ 1877 */
1878 1878
1879int aac_scsi_cmd(struct scsi_cmnd * scsicmd) 1879int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1880{ 1880{
1881 u32 cid; 1881 u32 cid;
1882 struct Scsi_Host *host = scsicmd->device->host; 1882 struct Scsi_Host *host = scsicmd->device->host;
1883 struct aac_dev *dev = (struct aac_dev *)host->hostdata; 1883 struct aac_dev *dev = (struct aac_dev *)host->hostdata;
1884 struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; 1884 struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev;
1885 1885
1886 if (fsa_dev_ptr == NULL) 1886 if (fsa_dev_ptr == NULL)
1887 return -1; 1887 return -1;
1888 /* 1888 /*
@@ -1938,7 +1938,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1938 * else Command for the controller itself 1938 * else Command for the controller itself
1939 */ 1939 */
1940 else if ((scsicmd->cmnd[0] != INQUIRY) && /* only INQUIRY & TUR cmnd supported for controller */ 1940 else if ((scsicmd->cmnd[0] != INQUIRY) && /* only INQUIRY & TUR cmnd supported for controller */
1941 (scsicmd->cmnd[0] != TEST_UNIT_READY)) 1941 (scsicmd->cmnd[0] != TEST_UNIT_READY))
1942 { 1942 {
1943 dprintk((KERN_WARNING "Only INQUIRY & TUR command supported for controller, rcvd = 0x%x.\n", scsicmd->cmnd[0])); 1943 dprintk((KERN_WARNING "Only INQUIRY & TUR command supported for controller, rcvd = 0x%x.\n", scsicmd->cmnd[0]));
1944 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; 1944 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
@@ -1963,7 +1963,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1963 dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", cid)); 1963 dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", cid));
1964 memset(&inq_data, 0, sizeof (struct inquiry_data)); 1964 memset(&inq_data, 0, sizeof (struct inquiry_data));
1965 1965
1966 if (scsicmd->cmnd[1] & 0x1 ) { 1966 if (scsicmd->cmnd[1] & 0x1) {
1967 char *arr = (char *)&inq_data; 1967 char *arr = (char *)&inq_data;
1968 1968
1969 /* EVPD bit set */ 1969 /* EVPD bit set */
@@ -2204,7 +2204,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
2204 return 0; 2204 return 0;
2205 } 2205 }
2206 2206
2207 switch (scsicmd->cmnd[0]) 2207 switch (scsicmd->cmnd[0])
2208 { 2208 {
2209 case READ_6: 2209 case READ_6:
2210 case READ_10: 2210 case READ_10:
@@ -2217,11 +2217,11 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
2217 * corresponds to a container. Needed to convert 2217 * corresponds to a container. Needed to convert
2218 * containers to /dev/sd device names 2218 * containers to /dev/sd device names
2219 */ 2219 */
2220 2220
2221 if (scsicmd->request->rq_disk) 2221 if (scsicmd->request->rq_disk)
2222 strlcpy(fsa_dev_ptr[cid].devname, 2222 strlcpy(fsa_dev_ptr[cid].devname,
2223 scsicmd->request->rq_disk->disk_name, 2223 scsicmd->request->rq_disk->disk_name,
2224 min(sizeof(fsa_dev_ptr[cid].devname), 2224 min(sizeof(fsa_dev_ptr[cid].devname),
2225 sizeof(scsicmd->request->rq_disk->disk_name) + 1)); 2225 sizeof(scsicmd->request->rq_disk->disk_name) + 1));
2226 2226
2227 return aac_read(scsicmd); 2227 return aac_read(scsicmd);
@@ -2275,7 +2275,7 @@ static int query_disk(struct aac_dev *dev, void __user *arg)
2275 return -EFAULT; 2275 return -EFAULT;
2276 if (qd.cnum == -1) 2276 if (qd.cnum == -1)
2277 qd.cnum = qd.id; 2277 qd.cnum = qd.id;
2278 else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) 2278 else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1))
2279 { 2279 {
2280 if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers) 2280 if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers)
2281 return -EINVAL; 2281 return -EINVAL;
@@ -2402,7 +2402,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
2402 2402
2403 scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */ 2403 scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */
2404 /* 2404 /*
2405 * Calculate resid for sg 2405 * Calculate resid for sg
2406 */ 2406 */
2407 2407
2408 scsi_set_resid(scsicmd, scsi_bufflen(scsicmd) 2408 scsi_set_resid(scsicmd, scsi_bufflen(scsicmd)
@@ -2442,7 +2442,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
2442 case WRITE_12: 2442 case WRITE_12:
2443 case READ_16: 2443 case READ_16:
2444 case WRITE_16: 2444 case WRITE_16:
2445 if(le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow ) { 2445 if (le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow) {
2446 printk(KERN_WARNING"aacraid: SCSI CMD underflow\n"); 2446 printk(KERN_WARNING"aacraid: SCSI CMD underflow\n");
2447 } else { 2447 } else {
2448 printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n"); 2448 printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n");
@@ -2511,14 +2511,14 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
2511 printk("aacraid: SRB ERROR(%u) %s scsi cmd 0x%x - scsi status 0x%x\n", 2511 printk("aacraid: SRB ERROR(%u) %s scsi cmd 0x%x - scsi status 0x%x\n",
2512 le32_to_cpu(srbreply->srb_status) & 0x3F, 2512 le32_to_cpu(srbreply->srb_status) & 0x3F,
2513 aac_get_status_string( 2513 aac_get_status_string(
2514 le32_to_cpu(srbreply->srb_status) & 0x3F), 2514 le32_to_cpu(srbreply->srb_status) & 0x3F),
2515 scsicmd->cmnd[0], 2515 scsicmd->cmnd[0],
2516 le32_to_cpu(srbreply->scsi_status)); 2516 le32_to_cpu(srbreply->scsi_status));
2517#endif 2517#endif
2518 scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8; 2518 scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8;
2519 break; 2519 break;
2520 } 2520 }
2521 if (le32_to_cpu(srbreply->scsi_status) == 0x02 ){ // Check Condition 2521 if (le32_to_cpu(srbreply->scsi_status) == SAM_STAT_CHECK_CONDITION) {
2522 int len; 2522 int len;
2523 scsicmd->result |= SAM_STAT_CHECK_CONDITION; 2523 scsicmd->result |= SAM_STAT_CHECK_CONDITION;
2524 len = min_t(u32, le32_to_cpu(srbreply->sense_data_size), 2524 len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
@@ -2528,7 +2528,6 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
2528 le32_to_cpu(srbreply->status), len); 2528 le32_to_cpu(srbreply->status), len);
2529#endif 2529#endif
2530 memcpy(scsicmd->sense_buffer, srbreply->sense_data, len); 2530 memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
2531
2532 } 2531 }
2533 /* 2532 /*
2534 * OR in the scsi status (already shifted up a bit) 2533 * OR in the scsi status (already shifted up a bit)
@@ -2545,7 +2544,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
2545 * aac_send_scb_fib 2544 * aac_send_scb_fib
2546 * @scsicmd: the scsi command block 2545 * @scsicmd: the scsi command block
2547 * 2546 *
2548 * This routine will form a FIB and fill in the aac_srb from the 2547 * This routine will form a FIB and fill in the aac_srb from the
2549 * scsicmd passed in. 2548 * scsicmd passed in.
2550 */ 2549 */
2551 2550
@@ -2759,7 +2758,7 @@ static struct aac_srb_status_info srb_status_info[] = {
2759 { SRB_STATUS_ERROR_RECOVERY, "Error Recovery"}, 2758 { SRB_STATUS_ERROR_RECOVERY, "Error Recovery"},
2760 { SRB_STATUS_NOT_STARTED, "Not Started"}, 2759 { SRB_STATUS_NOT_STARTED, "Not Started"},
2761 { SRB_STATUS_NOT_IN_USE, "Not In Use"}, 2760 { SRB_STATUS_NOT_IN_USE, "Not In Use"},
2762 { SRB_STATUS_FORCE_ABORT, "Force Abort"}, 2761 { SRB_STATUS_FORCE_ABORT, "Force Abort"},
2763 { SRB_STATUS_DOMAIN_VALIDATION_FAIL,"Domain Validation Failure"}, 2762 { SRB_STATUS_DOMAIN_VALIDATION_FAIL,"Domain Validation Failure"},
2764 { 0xff, "Unknown Error"} 2763 { 0xff, "Unknown Error"}
2765}; 2764};