aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorSalyzyn, Mark <Mark_Salyzyn@adaptec.com>2008-01-16 10:39:06 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-23 12:29:28 -0500
commit8ce3eca4dc8161e030a055bde94cde28476e0894 (patch)
tree4cbf81513780508f763ce115a05ab1597a3a0ebc /drivers/scsi
parentd07e03610ca1f4be373f32ad5b25ac00dbdb867d (diff)
[SCSI] aacraid: remove pigs in space
I was amazed at how much embedded space was present in the aacraid driver source files. Just selected five files from the set to clean up for now and the attached patch swelled to 73K in size! - Removed trailing space or tabs - Removed spaces embedded within tabs - Replaced leading 8 spaces with tabs - Removed spaces before ) - Removed ClusterCommand as it was unused (noticed it as one triggered by above) - Replaced scsi_status comparison with 0x02, to compare against SAM_STATUS_CHECK_CONDITION. - Replaced a long series of spaces with tabs - Replaced some simple if...defined() with ifdef/ifndef Signed-off-by: Mark Salyzyn <aacraid@adaptec.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/aacraid/aachba.c243
-rw-r--r--drivers/scsi/aacraid/aacraid.h310
-rw-r--r--drivers/scsi/aacraid/commctrl.c80
-rw-r--r--drivers/scsi/aacraid/commsup.c201
-rw-r--r--drivers/scsi/aacraid/linit.c88
5 files changed, 458 insertions, 464 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};
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 858b97494343..8a5b9c898e5b 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1,4 +1,4 @@
1#if (!defined(dprintk)) 1#ifndef dprintk
2# define dprintk(x) 2# define dprintk(x)
3#endif 3#endif
4/* eg: if (nblank(dprintk(x))) */ 4/* eg: if (nblank(dprintk(x))) */
@@ -50,9 +50,9 @@ struct diskparm
50/* 50/*
51 * Firmware constants 51 * Firmware constants
52 */ 52 */
53 53
54#define CT_NONE 0 54#define CT_NONE 0
55#define CT_OK 218 55#define CT_OK 218
56#define FT_FILESYS 8 /* ADAPTEC's "FSA"(tm) filesystem */ 56#define FT_FILESYS 8 /* ADAPTEC's "FSA"(tm) filesystem */
57#define FT_DRIVE 9 /* physical disk - addressable in scsi by bus/id/lun */ 57#define FT_DRIVE 9 /* physical disk - addressable in scsi by bus/id/lun */
58 58
@@ -107,12 +107,12 @@ struct user_sgentryraw {
107 107
108struct sgmap { 108struct sgmap {
109 __le32 count; 109 __le32 count;
110 struct sgentry sg[1]; 110 struct sgentry sg[1];
111}; 111};
112 112
113struct user_sgmap { 113struct user_sgmap {
114 u32 count; 114 u32 count;
115 struct user_sgentry sg[1]; 115 struct user_sgentry sg[1];
116}; 116};
117 117
118struct sgmap64 { 118struct sgmap64 {
@@ -137,18 +137,18 @@ struct user_sgmapraw {
137 137
138struct creation_info 138struct creation_info
139{ 139{
140 u8 buildnum; /* e.g., 588 */ 140 u8 buildnum; /* e.g., 588 */
141 u8 usec; /* e.g., 588 */ 141 u8 usec; /* e.g., 588 */
142 u8 via; /* e.g., 1 = FSU, 142 u8 via; /* e.g., 1 = FSU,
143 * 2 = API 143 * 2 = API
144 */ 144 */
145 u8 year; /* e.g., 1997 = 97 */ 145 u8 year; /* e.g., 1997 = 97 */
146 __le32 date; /* 146 __le32 date; /*
147 * unsigned Month :4; // 1 - 12 147 * unsigned Month :4; // 1 - 12
148 * unsigned Day :6; // 1 - 32 148 * unsigned Day :6; // 1 - 32
149 * unsigned Hour :6; // 0 - 23 149 * unsigned Hour :6; // 0 - 23
150 * unsigned Minute :6; // 0 - 60 150 * unsigned Minute :6; // 0 - 60
151 * unsigned Second :6; // 0 - 60 151 * unsigned Second :6; // 0 - 60
152 */ 152 */
153 __le32 serial[2]; /* e.g., 0x1DEADB0BFAFAF001 */ 153 __le32 serial[2]; /* e.g., 0x1DEADB0BFAFAF001 */
154}; 154};
@@ -184,7 +184,7 @@ struct creation_info
184/* 184/*
185 * Set the queues on a 16 byte alignment 185 * Set the queues on a 16 byte alignment
186 */ 186 */
187 187
188#define QUEUE_ALIGNMENT 16 188#define QUEUE_ALIGNMENT 16
189 189
190/* 190/*
@@ -203,9 +203,9 @@ struct aac_entry {
203 * The adapter assumes the ProducerIndex and ConsumerIndex are grouped 203 * The adapter assumes the ProducerIndex and ConsumerIndex are grouped
204 * adjacently and in that order. 204 * adjacently and in that order.
205 */ 205 */
206 206
207struct aac_qhdr { 207struct aac_qhdr {
208 __le64 header_addr;/* Address to hand the adapter to access 208 __le64 header_addr;/* Address to hand the adapter to access
209 to this queue head */ 209 to this queue head */
210 __le32 *producer; /* The producer index for this queue (host address) */ 210 __le32 *producer; /* The producer index for this queue (host address) */
211 __le32 *consumer; /* The consumer index for this queue (host address) */ 211 __le32 *consumer; /* The consumer index for this queue (host address) */
@@ -215,7 +215,7 @@ struct aac_qhdr {
215 * Define all the events which the adapter would like to notify 215 * Define all the events which the adapter would like to notify
216 * the host of. 216 * the host of.
217 */ 217 */
218 218
219#define HostNormCmdQue 1 /* Change in host normal priority command queue */ 219#define HostNormCmdQue 1 /* Change in host normal priority command queue */
220#define HostHighCmdQue 2 /* Change in host high priority command queue */ 220#define HostHighCmdQue 2 /* Change in host high priority command queue */
221#define HostNormRespQue 3 /* Change in host normal priority response queue */ 221#define HostNormRespQue 3 /* Change in host normal priority response queue */
@@ -286,17 +286,17 @@ struct aac_fibhdr {
286 u8 StructType; /* Type FIB */ 286 u8 StructType; /* Type FIB */
287 u8 Flags; /* Flags for FIB */ 287 u8 Flags; /* Flags for FIB */
288 __le16 Size; /* Size of this FIB in bytes */ 288 __le16 Size; /* Size of this FIB in bytes */
289 __le16 SenderSize; /* Size of the FIB in the sender 289 __le16 SenderSize; /* Size of the FIB in the sender
290 (for response sizing) */ 290 (for response sizing) */
291 __le32 SenderFibAddress; /* Host defined data in the FIB */ 291 __le32 SenderFibAddress; /* Host defined data in the FIB */
292 __le32 ReceiverFibAddress;/* Logical address of this FIB for 292 __le32 ReceiverFibAddress;/* Logical address of this FIB for
293 the adapter */ 293 the adapter */
294 u32 SenderData; /* Place holder for the sender to store data */ 294 u32 SenderData; /* Place holder for the sender to store data */
295 union { 295 union {
296 struct { 296 struct {
297 __le32 _ReceiverTimeStart; /* Timestamp for 297 __le32 _ReceiverTimeStart; /* Timestamp for
298 receipt of fib */ 298 receipt of fib */
299 __le32 _ReceiverTimeDone; /* Timestamp for 299 __le32 _ReceiverTimeDone; /* Timestamp for
300 completion of fib */ 300 completion of fib */
301 } _s; 301 } _s;
302 } _u; 302 } _u;
@@ -311,7 +311,7 @@ struct hw_fib {
311 * FIB commands 311 * FIB commands
312 */ 312 */
313 313
314#define TestCommandResponse 1 314#define TestCommandResponse 1
315#define TestAdapterCommand 2 315#define TestAdapterCommand 2
316/* 316/*
317 * Lowlevel and comm commands 317 * Lowlevel and comm commands
@@ -350,10 +350,6 @@ struct hw_fib {
350#define ContainerCommand64 501 350#define ContainerCommand64 501
351#define ContainerRawIo 502 351#define ContainerRawIo 502
352/* 352/*
353 * Cluster Commands
354 */
355#define ClusterCommand 550
356/*
357 * Scsi Port commands (scsi passthrough) 353 * Scsi Port commands (scsi passthrough)
358 */ 354 */
359#define ScsiPortCommand 600 355#define ScsiPortCommand 600
@@ -375,19 +371,19 @@ struct hw_fib {
375 */ 371 */
376 372
377enum fib_xfer_state { 373enum fib_xfer_state {
378 HostOwned = (1<<0), 374 HostOwned = (1<<0),
379 AdapterOwned = (1<<1), 375 AdapterOwned = (1<<1),
380 FibInitialized = (1<<2), 376 FibInitialized = (1<<2),
381 FibEmpty = (1<<3), 377 FibEmpty = (1<<3),
382 AllocatedFromPool = (1<<4), 378 AllocatedFromPool = (1<<4),
383 SentFromHost = (1<<5), 379 SentFromHost = (1<<5),
384 SentFromAdapter = (1<<6), 380 SentFromAdapter = (1<<6),
385 ResponseExpected = (1<<7), 381 ResponseExpected = (1<<7),
386 NoResponseExpected = (1<<8), 382 NoResponseExpected = (1<<8),
387 AdapterProcessed = (1<<9), 383 AdapterProcessed = (1<<9),
388 HostProcessed = (1<<10), 384 HostProcessed = (1<<10),
389 HighPriority = (1<<11), 385 HighPriority = (1<<11),
390 NormalPriority = (1<<12), 386 NormalPriority = (1<<12),
391 Async = (1<<13), 387 Async = (1<<13),
392 AsyncIo = (1<<13), // rpbfix: remove with new regime 388 AsyncIo = (1<<13), // rpbfix: remove with new regime
393 PageFileIo = (1<<14), // rpbfix: remove with new regime 389 PageFileIo = (1<<14), // rpbfix: remove with new regime
@@ -420,7 +416,7 @@ struct aac_init
420 __le32 AdapterFibAlign; 416 __le32 AdapterFibAlign;
421 __le32 printfbuf; 417 __le32 printfbuf;
422 __le32 printfbufsiz; 418 __le32 printfbufsiz;
423 __le32 HostPhysMemPages; /* number of 4k pages of host 419 __le32 HostPhysMemPages; /* number of 4k pages of host
424 physical memory */ 420 physical memory */
425 __le32 HostElapsedSeconds; /* number of seconds since 1970. */ 421 __le32 HostElapsedSeconds; /* number of seconds since 1970. */
426 /* 422 /*
@@ -481,7 +477,7 @@ struct adapter_ops
481 477
482struct aac_driver_ident 478struct aac_driver_ident
483{ 479{
484 int (*init)(struct aac_dev *dev); 480 int (*init)(struct aac_dev *dev);
485 char * name; 481 char * name;
486 char * vname; 482 char * vname;
487 char * model; 483 char * model;
@@ -489,7 +485,7 @@ struct aac_driver_ident
489 int quirks; 485 int quirks;
490}; 486};
491/* 487/*
492 * Some adapter firmware needs communication memory 488 * Some adapter firmware needs communication memory
493 * below 2gig. This tells the init function to set the 489 * below 2gig. This tells the init function to set the
494 * dma mask such that fib memory will be allocated where the 490 * dma mask such that fib memory will be allocated where the
495 * adapter firmware can get to it. 491 * adapter firmware can get to it.
@@ -531,29 +527,29 @@ struct aac_driver_ident
531 * physically contigous block. The host structure that defines the 527 * physically contigous block. The host structure that defines the
532 * commuication queues will assume they are each a separate physically 528 * commuication queues will assume they are each a separate physically
533 * contigous memory region that will support them all being one big 529 * contigous memory region that will support them all being one big
534 * contigous block. 530 * contigous block.
535 * There is a command and response queue for each level and direction of 531 * There is a command and response queue for each level and direction of
536 * commuication. These regions are accessed by both the host and adapter. 532 * commuication. These regions are accessed by both the host and adapter.
537 */ 533 */
538 534
539struct aac_queue { 535struct aac_queue {
540 u64 logical; /*address we give the adapter */ 536 u64 logical; /*address we give the adapter */
541 struct aac_entry *base; /*system virtual address */ 537 struct aac_entry *base; /*system virtual address */
542 struct aac_qhdr headers; /*producer,consumer q headers*/ 538 struct aac_qhdr headers; /*producer,consumer q headers*/
543 u32 entries; /*Number of queue entries */ 539 u32 entries; /*Number of queue entries */
544 wait_queue_head_t qfull; /*Event to wait on if q full */ 540 wait_queue_head_t qfull; /*Event to wait on if q full */
545 wait_queue_head_t cmdready; /*Cmd ready from the adapter */ 541 wait_queue_head_t cmdready; /*Cmd ready from the adapter */
546 /* This is only valid for adapter to host command queues. */ 542 /* This is only valid for adapter to host command queues. */
547 spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */ 543 spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */
548 spinlock_t lockdata; /* Actual lock (used only on one side of the lock) */ 544 spinlock_t lockdata; /* Actual lock (used only on one side of the lock) */
549 struct list_head cmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */ 545 struct list_head cmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */
550 /* only valid for command queues which receive entries from the adapter. */ 546 /* only valid for command queues which receive entries from the adapter. */
551 u32 numpending; /* Number of entries on outstanding queue. */ 547 u32 numpending; /* Number of entries on outstanding queue. */
552 struct aac_dev * dev; /* Back pointer to adapter structure */ 548 struct aac_dev * dev; /* Back pointer to adapter structure */
553}; 549};
554 550
555/* 551/*
556 * Message queues. The order here is important, see also the 552 * Message queues. The order here is important, see also the
557 * queue type ordering 553 * queue type ordering
558 */ 554 */
559 555
@@ -565,12 +561,12 @@ struct aac_queue_block
565/* 561/*
566 * SaP1 Message Unit Registers 562 * SaP1 Message Unit Registers
567 */ 563 */
568 564
569struct sa_drawbridge_CSR { 565struct sa_drawbridge_CSR {
570 /* Offset | Name */ 566 /* Offset | Name */
571 __le32 reserved[10]; /* 00h-27h | Reserved */ 567 __le32 reserved[10]; /* 00h-27h | Reserved */
572 u8 LUT_Offset; /* 28h | Lookup Table Offset */ 568 u8 LUT_Offset; /* 28h | Lookup Table Offset */
573 u8 reserved1[3]; /* 29h-2bh | Reserved */ 569 u8 reserved1[3]; /* 29h-2bh | Reserved */
574 __le32 LUT_Data; /* 2ch | Looup Table Data */ 570 __le32 LUT_Data; /* 2ch | Looup Table Data */
575 __le32 reserved2[26]; /* 30h-97h | Reserved */ 571 __le32 reserved2[26]; /* 30h-97h | Reserved */
576 __le16 PRICLEARIRQ; /* 98h | Primary Clear Irq */ 572 __le16 PRICLEARIRQ; /* 98h | Primary Clear Irq */
@@ -589,8 +585,8 @@ struct sa_drawbridge_CSR {
589 __le32 MAILBOX5; /* bch | Scratchpad 5 */ 585 __le32 MAILBOX5; /* bch | Scratchpad 5 */
590 __le32 MAILBOX6; /* c0h | Scratchpad 6 */ 586 __le32 MAILBOX6; /* c0h | Scratchpad 6 */
591 __le32 MAILBOX7; /* c4h | Scratchpad 7 */ 587 __le32 MAILBOX7; /* c4h | Scratchpad 7 */
592 __le32 ROM_Setup_Data; /* c8h | Rom Setup and Data */ 588 __le32 ROM_Setup_Data; /* c8h | Rom Setup and Data */
593 __le32 ROM_Control_Addr;/* cch | Rom Control and Address */ 589 __le32 ROM_Control_Addr;/* cch | Rom Control and Address */
594 __le32 reserved3[12]; /* d0h-ffh | reserved */ 590 __le32 reserved3[12]; /* d0h-ffh | reserved */
595 __le32 LUT[64]; /* 100h-1ffh | Lookup Table Entries */ 591 __le32 LUT[64]; /* 100h-1ffh | Lookup Table Entries */
596}; 592};
@@ -603,7 +599,7 @@ struct sa_drawbridge_CSR {
603#define Mailbox5 SaDbCSR.MAILBOX5 599#define Mailbox5 SaDbCSR.MAILBOX5
604#define Mailbox6 SaDbCSR.MAILBOX6 600#define Mailbox6 SaDbCSR.MAILBOX6
605#define Mailbox7 SaDbCSR.MAILBOX7 601#define Mailbox7 SaDbCSR.MAILBOX7
606 602
607#define DoorbellReg_p SaDbCSR.PRISETIRQ 603#define DoorbellReg_p SaDbCSR.PRISETIRQ
608#define DoorbellReg_s SaDbCSR.SECSETIRQ 604#define DoorbellReg_s SaDbCSR.SECSETIRQ
609#define DoorbellClrReg_p SaDbCSR.PRICLEARIRQ 605#define DoorbellClrReg_p SaDbCSR.PRICLEARIRQ
@@ -617,19 +613,19 @@ struct sa_drawbridge_CSR {
617#define DOORBELL_5 0x0020 613#define DOORBELL_5 0x0020
618#define DOORBELL_6 0x0040 614#define DOORBELL_6 0x0040
619 615
620 616
621#define PrintfReady DOORBELL_5 617#define PrintfReady DOORBELL_5
622#define PrintfDone DOORBELL_5 618#define PrintfDone DOORBELL_5
623 619
624struct sa_registers { 620struct sa_registers {
625 struct sa_drawbridge_CSR SaDbCSR; /* 98h - c4h */ 621 struct sa_drawbridge_CSR SaDbCSR; /* 98h - c4h */
626}; 622};
627 623
628 624
629#define Sa_MINIPORT_REVISION 1 625#define Sa_MINIPORT_REVISION 1
630 626
631#define sa_readw(AEP, CSR) readl(&((AEP)->regs.sa->CSR)) 627#define sa_readw(AEP, CSR) readl(&((AEP)->regs.sa->CSR))
632#define sa_readl(AEP, CSR) readl(&((AEP)->regs.sa->CSR)) 628#define sa_readl(AEP, CSR) readl(&((AEP)->regs.sa->CSR))
633#define sa_writew(AEP, CSR, value) writew(value, &((AEP)->regs.sa->CSR)) 629#define sa_writew(AEP, CSR, value) writew(value, &((AEP)->regs.sa->CSR))
634#define sa_writel(AEP, CSR, value) writel(value, &((AEP)->regs.sa->CSR)) 630#define sa_writel(AEP, CSR, value) writel(value, &((AEP)->regs.sa->CSR))
635 631
@@ -646,21 +642,21 @@ struct rx_mu_registers {
646 __le32 IMRx[2]; /* 1310h | 10h | Inbound Message Registers */ 642 __le32 IMRx[2]; /* 1310h | 10h | Inbound Message Registers */
647 __le32 OMRx[2]; /* 1318h | 18h | Outbound Message Registers */ 643 __le32 OMRx[2]; /* 1318h | 18h | Outbound Message Registers */
648 __le32 IDR; /* 1320h | 20h | Inbound Doorbell Register */ 644 __le32 IDR; /* 1320h | 20h | Inbound Doorbell Register */
649 __le32 IISR; /* 1324h | 24h | Inbound Interrupt 645 __le32 IISR; /* 1324h | 24h | Inbound Interrupt
650 Status Register */ 646 Status Register */
651 __le32 IIMR; /* 1328h | 28h | Inbound Interrupt 647 __le32 IIMR; /* 1328h | 28h | Inbound Interrupt
652 Mask Register */ 648 Mask Register */
653 __le32 ODR; /* 132Ch | 2Ch | Outbound Doorbell Register */ 649 __le32 ODR; /* 132Ch | 2Ch | Outbound Doorbell Register */
654 __le32 OISR; /* 1330h | 30h | Outbound Interrupt 650 __le32 OISR; /* 1330h | 30h | Outbound Interrupt
655 Status Register */ 651 Status Register */
656 __le32 OIMR; /* 1334h | 34h | Outbound Interrupt 652 __le32 OIMR; /* 1334h | 34h | Outbound Interrupt
657 Mask Register */ 653 Mask Register */
658 __le32 reserved2; /* 1338h | 38h | Reserved */ 654 __le32 reserved2; /* 1338h | 38h | Reserved */
659 __le32 reserved3; /* 133Ch | 3Ch | Reserved */ 655 __le32 reserved3; /* 133Ch | 3Ch | Reserved */
660 __le32 InboundQueue;/* 1340h | 40h | Inbound Queue Port relative to firmware */ 656 __le32 InboundQueue;/* 1340h | 40h | Inbound Queue Port relative to firmware */
661 __le32 OutboundQueue;/*1344h | 44h | Outbound Queue Port relative to firmware */ 657 __le32 OutboundQueue;/*1344h | 44h | Outbound Queue Port relative to firmware */
662 /* * Must access through ATU Inbound 658 /* * Must access through ATU Inbound
663 Translation Window */ 659 Translation Window */
664}; 660};
665 661
666struct rx_inbound { 662struct rx_inbound {
@@ -716,12 +712,12 @@ struct rkt_registers {
716typedef void (*fib_callback)(void *ctxt, struct fib *fibctx); 712typedef void (*fib_callback)(void *ctxt, struct fib *fibctx);
717 713
718struct aac_fib_context { 714struct aac_fib_context {
719 s16 type; // used for verification of structure 715 s16 type; // used for verification of structure
720 s16 size; 716 s16 size;
721 u32 unique; // unique value representing this context 717 u32 unique; // unique value representing this context
722 ulong jiffies; // used for cleanup - dmb changed to ulong 718 ulong jiffies; // used for cleanup - dmb changed to ulong
723 struct list_head next; // used to link context's into a linked list 719 struct list_head next; // used to link context's into a linked list
724 struct semaphore wait_sem; // this is used to wait for the next fib to arrive. 720 struct semaphore wait_sem; // this is used to wait for the next fib to arrive.
725 int wait; // Set to true when thread is in WaitForSingleObject 721 int wait; // Set to true when thread is in WaitForSingleObject
726 unsigned long count; // total number of FIBs on FibList 722 unsigned long count; // total number of FIBs on FibList
727 struct list_head fib_list; // this holds fibs and their attachd hw_fibs 723 struct list_head fib_list; // this holds fibs and their attachd hw_fibs
@@ -740,9 +736,9 @@ struct sense_data {
740 u8 EOM:1; /* End Of Medium - reserved for random access devices */ 736 u8 EOM:1; /* End Of Medium - reserved for random access devices */
741 u8 filemark:1; /* Filemark - reserved for random access devices */ 737 u8 filemark:1; /* Filemark - reserved for random access devices */
742 738
743 u8 information[4]; /* for direct-access devices, contains the unsigned 739 u8 information[4]; /* for direct-access devices, contains the unsigned
744 * logical block address or residue associated with 740 * logical block address or residue associated with
745 * the sense key 741 * the sense key
746 */ 742 */
747 u8 add_sense_len; /* number of additional sense bytes to follow this field */ 743 u8 add_sense_len; /* number of additional sense bytes to follow this field */
748 u8 cmnd_info[4]; /* not used */ 744 u8 cmnd_info[4]; /* not used */
@@ -752,7 +748,7 @@ struct sense_data {
752 u8 bit_ptr:3; /* indicates which byte of the CDB or parameter data 748 u8 bit_ptr:3; /* indicates which byte of the CDB or parameter data
753 * was in error 749 * was in error
754 */ 750 */
755 u8 BPV:1; /* bit pointer valid (BPV): 1- indicates that 751 u8 BPV:1; /* bit pointer valid (BPV): 1- indicates that
756 * the bit_ptr field has valid value 752 * the bit_ptr field has valid value
757 */ 753 */
758 u8 reserved2:2; 754 u8 reserved2:2;
@@ -786,24 +782,24 @@ struct fib {
786 /* 782 /*
787 * The Adapter that this I/O is destined for. 783 * The Adapter that this I/O is destined for.
788 */ 784 */
789 struct aac_dev *dev; 785 struct aac_dev *dev;
790 /* 786 /*
791 * This is the event the sendfib routine will wait on if the 787 * This is the event the sendfib routine will wait on if the
792 * caller did not pass one and this is synch io. 788 * caller did not pass one and this is synch io.
793 */ 789 */
794 struct semaphore event_wait; 790 struct semaphore event_wait;
795 spinlock_t event_lock; 791 spinlock_t event_lock;
796 792
797 u32 done; /* gets set to 1 when fib is complete */ 793 u32 done; /* gets set to 1 when fib is complete */
798 fib_callback callback; 794 fib_callback callback;
799 void *callback_data; 795 void *callback_data;
800 u32 flags; // u32 dmb was ulong 796 u32 flags; // u32 dmb was ulong
801 /* 797 /*
802 * And for the internal issue/reply queues (we may be able 798 * And for the internal issue/reply queues (we may be able
803 * to merge these two) 799 * to merge these two)
804 */ 800 */
805 struct list_head fiblink; 801 struct list_head fiblink;
806 void *data; 802 void *data;
807 struct hw_fib *hw_fib_va; /* Actual shared object */ 803 struct hw_fib *hw_fib_va; /* Actual shared object */
808 dma_addr_t hw_fib_pa; /* physical address of hw_fib*/ 804 dma_addr_t hw_fib_pa; /* physical address of hw_fib*/
809}; 805};
@@ -813,7 +809,7 @@ struct fib {
813 * 809 *
814 * This is returned by the RequestAdapterInfo block 810 * This is returned by the RequestAdapterInfo block
815 */ 811 */
816 812
817struct aac_adapter_info 813struct aac_adapter_info
818{ 814{
819 __le32 platform; 815 __le32 platform;
@@ -832,7 +828,7 @@ struct aac_adapter_info
832 __le32 biosrev; 828 __le32 biosrev;
833 __le32 biosbuild; 829 __le32 biosbuild;
834 __le32 cluster; 830 __le32 cluster;
835 __le32 clusterchannelmask; 831 __le32 clusterchannelmask;
836 __le32 serial[2]; 832 __le32 serial[2];
837 __le32 battery; 833 __le32 battery;
838 __le32 options; 834 __le32 options;
@@ -922,13 +918,13 @@ struct aac_bus_info_response {
922#define AAC_OPT_HOST_TIME_FIB cpu_to_le32(1<<4) 918#define AAC_OPT_HOST_TIME_FIB cpu_to_le32(1<<4)
923#define AAC_OPT_RAID50 cpu_to_le32(1<<5) 919#define AAC_OPT_RAID50 cpu_to_le32(1<<5)
924#define AAC_OPT_4GB_WINDOW cpu_to_le32(1<<6) 920#define AAC_OPT_4GB_WINDOW cpu_to_le32(1<<6)
925#define AAC_OPT_SCSI_UPGRADEABLE cpu_to_le32(1<<7) 921#define AAC_OPT_SCSI_UPGRADEABLE cpu_to_le32(1<<7)
926#define AAC_OPT_SOFT_ERR_REPORT cpu_to_le32(1<<8) 922#define AAC_OPT_SOFT_ERR_REPORT cpu_to_le32(1<<8)
927#define AAC_OPT_SUPPORTED_RECONDITION cpu_to_le32(1<<9) 923#define AAC_OPT_SUPPORTED_RECONDITION cpu_to_le32(1<<9)
928#define AAC_OPT_SGMAP_HOST64 cpu_to_le32(1<<10) 924#define AAC_OPT_SGMAP_HOST64 cpu_to_le32(1<<10)
929#define AAC_OPT_ALARM cpu_to_le32(1<<11) 925#define AAC_OPT_ALARM cpu_to_le32(1<<11)
930#define AAC_OPT_NONDASD cpu_to_le32(1<<12) 926#define AAC_OPT_NONDASD cpu_to_le32(1<<12)
931#define AAC_OPT_SCSI_MANAGED cpu_to_le32(1<<13) 927#define AAC_OPT_SCSI_MANAGED cpu_to_le32(1<<13)
932#define AAC_OPT_RAID_SCSI_MODE cpu_to_le32(1<<14) 928#define AAC_OPT_RAID_SCSI_MODE cpu_to_le32(1<<14)
933#define AAC_OPT_SUPPLEMENT_ADAPTER_INFO cpu_to_le32(1<<16) 929#define AAC_OPT_SUPPLEMENT_ADAPTER_INFO cpu_to_le32(1<<16)
934#define AAC_OPT_NEW_COMM cpu_to_le32(1<<17) 930#define AAC_OPT_NEW_COMM cpu_to_le32(1<<17)
@@ -948,7 +944,7 @@ struct aac_dev
948 944
949 /* 945 /*
950 * Map for 128 fib objects (64k) 946 * Map for 128 fib objects (64k)
951 */ 947 */
952 dma_addr_t hw_fib_pa; 948 dma_addr_t hw_fib_pa;
953 struct hw_fib *hw_fib_va; 949 struct hw_fib *hw_fib_va;
954 struct hw_fib *aif_base_va; 950 struct hw_fib *aif_base_va;
@@ -959,24 +955,24 @@ struct aac_dev
959 955
960 struct fib *free_fib; 956 struct fib *free_fib;
961 spinlock_t fib_lock; 957 spinlock_t fib_lock;
962 958
963 struct aac_queue_block *queues; 959 struct aac_queue_block *queues;
964 /* 960 /*
965 * The user API will use an IOCTL to register itself to receive 961 * The user API will use an IOCTL to register itself to receive
966 * FIBs from the adapter. The following list is used to keep 962 * FIBs from the adapter. The following list is used to keep
967 * track of all the threads that have requested these FIBs. The 963 * track of all the threads that have requested these FIBs. The
968 * mutex is used to synchronize access to all data associated 964 * mutex is used to synchronize access to all data associated
969 * with the adapter fibs. 965 * with the adapter fibs.
970 */ 966 */
971 struct list_head fib_list; 967 struct list_head fib_list;
972 968
973 struct adapter_ops a_ops; 969 struct adapter_ops a_ops;
974 unsigned long fsrev; /* Main driver's revision number */ 970 unsigned long fsrev; /* Main driver's revision number */
975 971
976 unsigned base_size; /* Size of mapped in region */ 972 unsigned base_size; /* Size of mapped in region */
977 struct aac_init *init; /* Holds initialization info to communicate with adapter */ 973 struct aac_init *init; /* Holds initialization info to communicate with adapter */
978 dma_addr_t init_pa; /* Holds physical address of the init struct */ 974 dma_addr_t init_pa; /* Holds physical address of the init struct */
979 975
980 struct pci_dev *pdev; /* Our PCI interface */ 976 struct pci_dev *pdev; /* Our PCI interface */
981 void * printfbuf; /* pointer to buffer used for printf's from the adapter */ 977 void * printfbuf; /* pointer to buffer used for printf's from the adapter */
982 void * comm_addr; /* Base address of Comm area */ 978 void * comm_addr; /* Base address of Comm area */
@@ -990,11 +986,11 @@ struct aac_dev
990 struct fsa_dev_info *fsa_dev; 986 struct fsa_dev_info *fsa_dev;
991 struct task_struct *thread; 987 struct task_struct *thread;
992 int cardtype; 988 int cardtype;
993 989
994 /* 990 /*
995 * The following is the device specific extension. 991 * The following is the device specific extension.
996 */ 992 */
997#if (!defined(AAC_MIN_FOOTPRINT_SIZE)) 993#ifndef AAC_MIN_FOOTPRINT_SIZE
998# define AAC_MIN_FOOTPRINT_SIZE 8192 994# define AAC_MIN_FOOTPRINT_SIZE 8192
999#endif 995#endif
1000 union 996 union
@@ -1015,7 +1011,7 @@ struct aac_dev
1015 /* These are in adapter info but they are in the io flow so 1011 /* These are in adapter info but they are in the io flow so
1016 * lets break them out so we don't have to do an AND to check them 1012 * lets break them out so we don't have to do an AND to check them
1017 */ 1013 */
1018 u8 nondasd_support; 1014 u8 nondasd_support;
1019 u8 cache_protected; 1015 u8 cache_protected;
1020 u8 dac_support; 1016 u8 dac_support;
1021 u8 raid_scsi_mode; 1017 u8 raid_scsi_mode;
@@ -1078,14 +1074,14 @@ struct aac_dev
1078/* 1074/*
1079 * Define the command values 1075 * Define the command values
1080 */ 1076 */
1081 1077
1082#define Null 0 1078#define Null 0
1083#define GetAttributes 1 1079#define GetAttributes 1
1084#define SetAttributes 2 1080#define SetAttributes 2
1085#define Lookup 3 1081#define Lookup 3
1086#define ReadLink 4 1082#define ReadLink 4
1087#define Read 5 1083#define Read 5
1088#define Write 6 1084#define Write 6
1089#define Create 7 1085#define Create 7
1090#define MakeDirectory 8 1086#define MakeDirectory 8
1091#define SymbolicLink 9 1087#define SymbolicLink 9
@@ -1181,19 +1177,19 @@ struct aac_dev
1181 1177
1182struct aac_read 1178struct aac_read
1183{ 1179{
1184 __le32 command; 1180 __le32 command;
1185 __le32 cid; 1181 __le32 cid;
1186 __le32 block; 1182 __le32 block;
1187 __le32 count; 1183 __le32 count;
1188 struct sgmap sg; // Must be last in struct because it is variable 1184 struct sgmap sg; // Must be last in struct because it is variable
1189}; 1185};
1190 1186
1191struct aac_read64 1187struct aac_read64
1192{ 1188{
1193 __le32 command; 1189 __le32 command;
1194 __le16 cid; 1190 __le16 cid;
1195 __le16 sector_count; 1191 __le16 sector_count;
1196 __le32 block; 1192 __le32 block;
1197 __le16 pad; 1193 __le16 pad;
1198 __le16 flags; 1194 __le16 flags;
1199 struct sgmap64 sg; // Must be last in struct because it is variable 1195 struct sgmap64 sg; // Must be last in struct because it is variable
@@ -1201,26 +1197,26 @@ struct aac_read64
1201 1197
1202struct aac_read_reply 1198struct aac_read_reply
1203{ 1199{
1204 __le32 status; 1200 __le32 status;
1205 __le32 count; 1201 __le32 count;
1206}; 1202};
1207 1203
1208struct aac_write 1204struct aac_write
1209{ 1205{
1210 __le32 command; 1206 __le32 command;
1211 __le32 cid; 1207 __le32 cid;
1212 __le32 block; 1208 __le32 block;
1213 __le32 count; 1209 __le32 count;
1214 __le32 stable; // Not used 1210 __le32 stable; // Not used
1215 struct sgmap sg; // Must be last in struct because it is variable 1211 struct sgmap sg; // Must be last in struct because it is variable
1216}; 1212};
1217 1213
1218struct aac_write64 1214struct aac_write64
1219{ 1215{
1220 __le32 command; 1216 __le32 command;
1221 __le16 cid; 1217 __le16 cid;
1222 __le16 sector_count; 1218 __le16 sector_count;
1223 __le32 block; 1219 __le32 block;
1224 __le16 pad; 1220 __le16 pad;
1225 __le16 flags; 1221 __le16 flags;
1226#define IO_TYPE_WRITE 0x00000000 1222#define IO_TYPE_WRITE 0x00000000
@@ -1231,7 +1227,7 @@ struct aac_write64
1231struct aac_write_reply 1227struct aac_write_reply
1232{ 1228{
1233 __le32 status; 1229 __le32 status;
1234 __le32 count; 1230 __le32 count;
1235 __le32 committed; 1231 __le32 committed;
1236}; 1232};
1237 1233
@@ -1334,10 +1330,10 @@ struct aac_srb_reply
1334#define SRB_NoDataXfer 0x0000 1330#define SRB_NoDataXfer 0x0000
1335#define SRB_DisableDisconnect 0x0004 1331#define SRB_DisableDisconnect 0x0004
1336#define SRB_DisableSynchTransfer 0x0008 1332#define SRB_DisableSynchTransfer 0x0008
1337#define SRB_BypassFrozenQueue 0x0010 1333#define SRB_BypassFrozenQueue 0x0010
1338#define SRB_DisableAutosense 0x0020 1334#define SRB_DisableAutosense 0x0020
1339#define SRB_DataIn 0x0040 1335#define SRB_DataIn 0x0040
1340#define SRB_DataOut 0x0080 1336#define SRB_DataOut 0x0080
1341 1337
1342/* 1338/*
1343 * SRB Functions - set in aac_srb->function 1339 * SRB Functions - set in aac_srb->function
@@ -1360,7 +1356,7 @@ struct aac_srb_reply
1360#define SRBF_RemoveDevice 0x0016 1356#define SRBF_RemoveDevice 0x0016
1361#define SRBF_DomainValidation 0x0017 1357#define SRBF_DomainValidation 0x0017
1362 1358
1363/* 1359/*
1364 * SRB SCSI Status - set in aac_srb->scsi_status 1360 * SRB SCSI Status - set in aac_srb->scsi_status
1365 */ 1361 */
1366#define SRB_STATUS_PENDING 0x00 1362#define SRB_STATUS_PENDING 0x00
@@ -1519,17 +1515,17 @@ struct aac_get_container_count_resp {
1519 */ 1515 */
1520 1516
1521struct aac_mntent { 1517struct aac_mntent {
1522 __le32 oid; 1518 __le32 oid;
1523 u8 name[16]; /* if applicable */ 1519 u8 name[16]; /* if applicable */
1524 struct creation_info create_info; /* if applicable */ 1520 struct creation_info create_info; /* if applicable */
1525 __le32 capacity; 1521 __le32 capacity;
1526 __le32 vol; /* substrate structure */ 1522 __le32 vol; /* substrate structure */
1527 __le32 obj; /* FT_FILESYS, etc. */ 1523 __le32 obj; /* FT_FILESYS, etc. */
1528 __le32 state; /* unready for mounting, 1524 __le32 state; /* unready for mounting,
1529 readonly, etc. */ 1525 readonly, etc. */
1530 union aac_contentinfo fileinfo; /* Info specific to content 1526 union aac_contentinfo fileinfo; /* Info specific to content
1531 manager (eg, filesystem) */ 1527 manager (eg, filesystem) */
1532 __le32 altoid; /* != oid <==> snapshot or 1528 __le32 altoid; /* != oid <==> snapshot or
1533 broken mirror exists */ 1529 broken mirror exists */
1534 __le32 capacityhigh; 1530 __le32 capacityhigh;
1535}; 1531};
@@ -1546,7 +1542,7 @@ struct aac_query_mount {
1546 1542
1547struct aac_mount { 1543struct aac_mount {
1548 __le32 status; 1544 __le32 status;
1549 __le32 type; /* should be same as that requested */ 1545 __le32 type; /* should be same as that requested */
1550 __le32 count; 1546 __le32 count;
1551 struct aac_mntent mnt[1]; 1547 struct aac_mntent mnt[1];
1552}; 1548};
@@ -1616,7 +1612,7 @@ struct aac_delete_disk {
1616 u32 disknum; 1612 u32 disknum;
1617 u32 cnum; 1613 u32 cnum;
1618}; 1614};
1619 1615
1620struct fib_ioctl 1616struct fib_ioctl
1621{ 1617{
1622 u32 fibctx; 1618 u32 fibctx;
@@ -1630,10 +1626,10 @@ struct revision
1630 __le32 version; 1626 __le32 version;
1631 __le32 build; 1627 __le32 build;
1632}; 1628};
1633 1629
1634 1630
1635/* 1631/*
1636 * Ugly - non Linux like ioctl coding for back compat. 1632 * Ugly - non Linux like ioctl coding for back compat.
1637 */ 1633 */
1638 1634
1639#define CTL_CODE(function, method) ( \ 1635#define CTL_CODE(function, method) ( \
@@ -1641,7 +1637,7 @@ struct revision
1641) 1637)
1642 1638
1643/* 1639/*
1644 * Define the method codes for how buffers are passed for I/O and FS 1640 * Define the method codes for how buffers are passed for I/O and FS
1645 * controls 1641 * controls
1646 */ 1642 */
1647 1643
@@ -1652,15 +1648,15 @@ struct revision
1652 * Filesystem ioctls 1648 * Filesystem ioctls
1653 */ 1649 */
1654 1650
1655#define FSACTL_SENDFIB CTL_CODE(2050, METHOD_BUFFERED) 1651#define FSACTL_SENDFIB CTL_CODE(2050, METHOD_BUFFERED)
1656#define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED) 1652#define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED)
1657#define FSACTL_DELETE_DISK 0x163 1653#define FSACTL_DELETE_DISK 0x163
1658#define FSACTL_QUERY_DISK 0x173 1654#define FSACTL_QUERY_DISK 0x173
1659#define FSACTL_OPEN_GET_ADAPTER_FIB CTL_CODE(2100, METHOD_BUFFERED) 1655#define FSACTL_OPEN_GET_ADAPTER_FIB CTL_CODE(2100, METHOD_BUFFERED)
1660#define FSACTL_GET_NEXT_ADAPTER_FIB CTL_CODE(2101, METHOD_BUFFERED) 1656#define FSACTL_GET_NEXT_ADAPTER_FIB CTL_CODE(2101, METHOD_BUFFERED)
1661#define FSACTL_CLOSE_GET_ADAPTER_FIB CTL_CODE(2102, METHOD_BUFFERED) 1657#define FSACTL_CLOSE_GET_ADAPTER_FIB CTL_CODE(2102, METHOD_BUFFERED)
1662#define FSACTL_MINIPORT_REV_CHECK CTL_CODE(2107, METHOD_BUFFERED) 1658#define FSACTL_MINIPORT_REV_CHECK CTL_CODE(2107, METHOD_BUFFERED)
1663#define FSACTL_GET_PCI_INFO CTL_CODE(2119, METHOD_BUFFERED) 1659#define FSACTL_GET_PCI_INFO CTL_CODE(2119, METHOD_BUFFERED)
1664#define FSACTL_FORCE_DELETE_DISK CTL_CODE(2120, METHOD_NEITHER) 1660#define FSACTL_FORCE_DELETE_DISK CTL_CODE(2120, METHOD_NEITHER)
1665#define FSACTL_GET_CONTAINERS 2131 1661#define FSACTL_GET_CONTAINERS 2131
1666#define FSACTL_SEND_LARGE_FIB CTL_CODE(2138, METHOD_BUFFERED) 1662#define FSACTL_SEND_LARGE_FIB CTL_CODE(2138, METHOD_BUFFERED)
@@ -1669,7 +1665,7 @@ struct revision
1669struct aac_common 1665struct aac_common
1670{ 1666{
1671 /* 1667 /*
1672 * If this value is set to 1 then interrupt moderation will occur 1668 * If this value is set to 1 then interrupt moderation will occur
1673 * in the base commuication support. 1669 * in the base commuication support.
1674 */ 1670 */
1675 u32 irq_mod; 1671 u32 irq_mod;
@@ -1698,11 +1694,11 @@ extern struct aac_common aac_config;
1698 * The following macro is used when sending and receiving FIBs. It is 1694 * The following macro is used when sending and receiving FIBs. It is
1699 * only used for debugging. 1695 * only used for debugging.
1700 */ 1696 */
1701 1697
1702#ifdef DBG 1698#ifdef DBG
1703#define FIB_COUNTER_INCREMENT(counter) (counter)++ 1699#define FIB_COUNTER_INCREMENT(counter) (counter)++
1704#else 1700#else
1705#define FIB_COUNTER_INCREMENT(counter) 1701#define FIB_COUNTER_INCREMENT(counter)
1706#endif 1702#endif
1707 1703
1708/* 1704/*
@@ -1734,17 +1730,17 @@ extern struct aac_common aac_config;
1734 * 1730 *
1735 * The adapter reports is present state through the phase. Only 1731 * The adapter reports is present state through the phase. Only
1736 * a single phase should be ever be set. Each phase can have multiple 1732 * a single phase should be ever be set. Each phase can have multiple
1737 * phase status bits to provide more detailed information about the 1733 * phase status bits to provide more detailed information about the
1738 * state of the board. Care should be taken to ensure that any phase 1734 * state of the board. Care should be taken to ensure that any phase
1739 * status bits that are set when changing the phase are also valid 1735 * status bits that are set when changing the phase are also valid
1740 * for the new phase or be cleared out. Adapter software (monitor, 1736 * for the new phase or be cleared out. Adapter software (monitor,
1741 * iflash, kernel) is responsible for properly maintining the phase 1737 * iflash, kernel) is responsible for properly maintining the phase
1742 * status mailbox when it is running. 1738 * status mailbox when it is running.
1743 *
1744 * MONKER_API Phases
1745 * 1739 *
1746 * Phases are bit oriented. It is NOT valid to have multiple bits set 1740 * MONKER_API Phases
1747 */ 1741 *
1742 * Phases are bit oriented. It is NOT valid to have multiple bits set
1743 */
1748 1744
1749#define SELF_TEST_FAILED 0x00000004 1745#define SELF_TEST_FAILED 0x00000004
1750#define MONITOR_PANIC 0x00000020 1746#define MONITOR_PANIC 0x00000020
@@ -1767,8 +1763,8 @@ extern struct aac_common aac_config;
1767 * For FIB communication, we need all of the following things 1763 * For FIB communication, we need all of the following things
1768 * to send back to the user. 1764 * to send back to the user.
1769 */ 1765 */
1770 1766
1771#define AifCmdEventNotify 1 /* Notify of event */ 1767#define AifCmdEventNotify 1 /* Notify of event */
1772#define AifEnConfigChange 3 /* Adapter configuration change */ 1768#define AifEnConfigChange 3 /* Adapter configuration change */
1773#define AifEnContainerChange 4 /* Container configuration change */ 1769#define AifEnContainerChange 4 /* Container configuration change */
1774#define AifEnDeviceFailure 5 /* SCSI device failed */ 1770#define AifEnDeviceFailure 5 /* SCSI device failed */
@@ -1792,11 +1788,11 @@ extern struct aac_common aac_config;
1792#define AifDenVolumeExtendComplete 201 /* A volume extend completed */ 1788#define AifDenVolumeExtendComplete 201 /* A volume extend completed */
1793#define AifReqJobList 100 /* Gets back complete job list */ 1789#define AifReqJobList 100 /* Gets back complete job list */
1794#define AifReqJobsForCtr 101 /* Gets back jobs for specific container */ 1790#define AifReqJobsForCtr 101 /* Gets back jobs for specific container */
1795#define AifReqJobsForScsi 102 /* Gets back jobs for specific SCSI device */ 1791#define AifReqJobsForScsi 102 /* Gets back jobs for specific SCSI device */
1796#define AifReqJobReport 103 /* Gets back a specific job report or list of them */ 1792#define AifReqJobReport 103 /* Gets back a specific job report or list of them */
1797#define AifReqTerminateJob 104 /* Terminates job */ 1793#define AifReqTerminateJob 104 /* Terminates job */
1798#define AifReqSuspendJob 105 /* Suspends a job */ 1794#define AifReqSuspendJob 105 /* Suspends a job */
1799#define AifReqResumeJob 106 /* Resumes a job */ 1795#define AifReqResumeJob 106 /* Resumes a job */
1800#define AifReqSendAPIReport 107 /* API generic report requests */ 1796#define AifReqSendAPIReport 107 /* API generic report requests */
1801#define AifReqAPIJobStart 108 /* Start a job from the API */ 1797#define AifReqAPIJobStart 108 /* Start a job from the API */
1802#define AifReqAPIJobUpdate 109 /* Update a job report from the API */ 1798#define AifReqAPIJobUpdate 109 /* Update a job report from the API */
@@ -1815,8 +1811,8 @@ struct aac_aifcmd {
1815}; 1811};
1816 1812
1817/** 1813/**
1818 * Convert capacity to cylinders 1814 * Convert capacity to cylinders
1819 * accounting for the fact capacity could be a 64 bit value 1815 * accounting for the fact capacity could be a 64 bit value
1820 * 1816 *
1821 */ 1817 */
1822static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor) 1818static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor)
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index a27207e27c30..f8afa358b6b6 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -48,13 +48,13 @@
48 * ioctl_send_fib - send a FIB from userspace 48 * ioctl_send_fib - send a FIB from userspace
49 * @dev: adapter is being processed 49 * @dev: adapter is being processed
50 * @arg: arguments to the ioctl call 50 * @arg: arguments to the ioctl call
51 * 51 *
52 * This routine sends a fib to the adapter on behalf of a user level 52 * This routine sends a fib to the adapter on behalf of a user level
53 * program. 53 * program.
54 */ 54 */
55# define AAC_DEBUG_PREAMBLE KERN_INFO 55# define AAC_DEBUG_PREAMBLE KERN_INFO
56# define AAC_DEBUG_POSTAMBLE 56# define AAC_DEBUG_POSTAMBLE
57 57
58static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) 58static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
59{ 59{
60 struct hw_fib * kfib; 60 struct hw_fib * kfib;
@@ -71,7 +71,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
71 if(fibptr == NULL) { 71 if(fibptr == NULL) {
72 return -ENOMEM; 72 return -ENOMEM;
73 } 73 }
74 74
75 kfib = fibptr->hw_fib_va; 75 kfib = fibptr->hw_fib_va;
76 /* 76 /*
77 * First copy in the header so that we can check the size field. 77 * First copy in the header so that we can check the size field.
@@ -109,7 +109,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
109 if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) { 109 if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) {
110 aac_adapter_interrupt(dev); 110 aac_adapter_interrupt(dev);
111 /* 111 /*
112 * Since we didn't really send a fib, zero out the state to allow 112 * Since we didn't really send a fib, zero out the state to allow
113 * cleanup code not to assert. 113 * cleanup code not to assert.
114 */ 114 */
115 kfib->header.XferState = 0; 115 kfib->header.XferState = 0;
@@ -169,7 +169,7 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg)
169 169
170 fibctx->type = FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT; 170 fibctx->type = FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT;
171 fibctx->size = sizeof(struct aac_fib_context); 171 fibctx->size = sizeof(struct aac_fib_context);
172 /* 172 /*
173 * Yes yes, I know this could be an index, but we have a 173 * Yes yes, I know this could be an index, but we have a
174 * better guarantee of uniqueness for the locked loop below. 174 * better guarantee of uniqueness for the locked loop below.
175 * Without the aid of a persistent history, this also helps 175 * Without the aid of a persistent history, this also helps
@@ -189,7 +189,7 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg)
189 INIT_LIST_HEAD(&fibctx->fib_list); 189 INIT_LIST_HEAD(&fibctx->fib_list);
190 fibctx->jiffies = jiffies/HZ; 190 fibctx->jiffies = jiffies/HZ;
191 /* 191 /*
192 * Now add this context onto the adapter's 192 * Now add this context onto the adapter's
193 * AdapterFibContext list. 193 * AdapterFibContext list.
194 */ 194 */
195 spin_lock_irqsave(&dev->fib_lock, flags); 195 spin_lock_irqsave(&dev->fib_lock, flags);
@@ -207,12 +207,12 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg)
207 } 207 }
208 list_add_tail(&fibctx->next, &dev->fib_list); 208 list_add_tail(&fibctx->next, &dev->fib_list);
209 spin_unlock_irqrestore(&dev->fib_lock, flags); 209 spin_unlock_irqrestore(&dev->fib_lock, flags);
210 if (copy_to_user(arg, &fibctx->unique, 210 if (copy_to_user(arg, &fibctx->unique,
211 sizeof(fibctx->unique))) { 211 sizeof(fibctx->unique))) {
212 status = -EFAULT; 212 status = -EFAULT;
213 } else { 213 } else {
214 status = 0; 214 status = 0;
215 } 215 }
216 } 216 }
217 return status; 217 return status;
218} 218}
@@ -221,8 +221,8 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg)
221 * next_getadapter_fib - get the next fib 221 * next_getadapter_fib - get the next fib
222 * @dev: adapter to use 222 * @dev: adapter to use
223 * @arg: ioctl argument 223 * @arg: ioctl argument
224 * 224 *
225 * This routine will get the next Fib, if available, from the AdapterFibContext 225 * This routine will get the next Fib, if available, from the AdapterFibContext
226 * passed in from the user. 226 * passed in from the user.
227 */ 227 */
228 228
@@ -234,7 +234,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg)
234 int status; 234 int status;
235 struct list_head * entry; 235 struct list_head * entry;
236 unsigned long flags; 236 unsigned long flags;
237 237
238 if(copy_from_user((void *)&f, arg, sizeof(struct fib_ioctl))) 238 if(copy_from_user((void *)&f, arg, sizeof(struct fib_ioctl)))
239 return -EFAULT; 239 return -EFAULT;
240 /* 240 /*
@@ -280,7 +280,7 @@ return_fib:
280 */ 280 */
281 entry = fibctx->fib_list.next; 281 entry = fibctx->fib_list.next;
282 list_del(entry); 282 list_del(entry);
283 283
284 fib = list_entry(entry, struct fib, fiblink); 284 fib = list_entry(entry, struct fib, fiblink);
285 fibctx->count--; 285 fibctx->count--;
286 spin_unlock_irqrestore(&dev->fib_lock, flags); 286 spin_unlock_irqrestore(&dev->fib_lock, flags);
@@ -288,7 +288,7 @@ return_fib:
288 kfree(fib->hw_fib_va); 288 kfree(fib->hw_fib_va);
289 kfree(fib); 289 kfree(fib);
290 return -EFAULT; 290 return -EFAULT;
291 } 291 }
292 /* 292 /*
293 * Free the space occupied by this copy of the fib. 293 * Free the space occupied by this copy of the fib.
294 */ 294 */
@@ -317,7 +317,7 @@ return_fib:
317 } 317 }
318 } else { 318 } else {
319 status = -EAGAIN; 319 status = -EAGAIN;
320 } 320 }
321 } 321 }
322 fibctx->jiffies = jiffies/HZ; 322 fibctx->jiffies = jiffies/HZ;
323 return status; 323 return status;
@@ -367,7 +367,7 @@ int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx)
367 * 367 *
368 * This routine will close down the fibctx passed in from the user. 368 * This routine will close down the fibctx passed in from the user.
369 */ 369 */
370 370
371static int close_getadapter_fib(struct aac_dev * dev, void __user *arg) 371static int close_getadapter_fib(struct aac_dev * dev, void __user *arg)
372{ 372{
373 struct aac_fib_context *fibctx; 373 struct aac_fib_context *fibctx;
@@ -414,7 +414,7 @@ static int close_getadapter_fib(struct aac_dev * dev, void __user *arg)
414 * @arg: ioctl arguments 414 * @arg: ioctl arguments
415 * 415 *
416 * This routine returns the driver version. 416 * This routine returns the driver version.
417 * Under Linux, there have been no version incompatibilities, so this is 417 * Under Linux, there have been no version incompatibilities, so this is
418 * simple! 418 * simple!
419 */ 419 */
420 420
@@ -425,12 +425,12 @@ static int check_revision(struct aac_dev *dev, void __user *arg)
425 u32 version; 425 u32 version;
426 426
427 response.compat = 1; 427 response.compat = 1;
428 version = (simple_strtol(driver_version, 428 version = (simple_strtol(driver_version,
429 &driver_version, 10) << 24) | 0x00000400; 429 &driver_version, 10) << 24) | 0x00000400;
430 version += simple_strtol(driver_version + 1, &driver_version, 10) << 16; 430 version += simple_strtol(driver_version + 1, &driver_version, 10) << 16;
431 version += simple_strtol(driver_version + 1, NULL, 10); 431 version += simple_strtol(driver_version + 1, NULL, 10);
432 response.version = cpu_to_le32(version); 432 response.version = cpu_to_le32(version);
433# if (defined(AAC_DRIVER_BUILD)) 433# ifdef AAC_DRIVER_BUILD
434 response.build = cpu_to_le32(AAC_DRIVER_BUILD); 434 response.build = cpu_to_le32(AAC_DRIVER_BUILD);
435# else 435# else
436 response.build = cpu_to_le32(9999); 436 response.build = cpu_to_le32(9999);
@@ -474,7 +474,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
474 return -EBUSY; 474 return -EBUSY;
475 } 475 }
476 if (!capable(CAP_SYS_ADMIN)){ 476 if (!capable(CAP_SYS_ADMIN)){
477 dprintk((KERN_DEBUG"aacraid: No permission to send raw srb\n")); 477 dprintk((KERN_DEBUG"aacraid: No permission to send raw srb\n"));
478 return -EPERM; 478 return -EPERM;
479 } 479 }
480 /* 480 /*
@@ -489,7 +489,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
489 489
490 memset(sg_list, 0, sizeof(sg_list)); /* cleanup may take issue */ 490 memset(sg_list, 0, sizeof(sg_list)); /* cleanup may take issue */
491 if(copy_from_user(&fibsize, &user_srb->count,sizeof(u32))){ 491 if(copy_from_user(&fibsize, &user_srb->count,sizeof(u32))){
492 dprintk((KERN_DEBUG"aacraid: Could not copy data size from user\n")); 492 dprintk((KERN_DEBUG"aacraid: Could not copy data size from user\n"));
493 rcode = -EFAULT; 493 rcode = -EFAULT;
494 goto cleanup; 494 goto cleanup;
495 } 495 }
@@ -506,7 +506,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
506 goto cleanup; 506 goto cleanup;
507 } 507 }
508 if(copy_from_user(user_srbcmd, user_srb,fibsize)){ 508 if(copy_from_user(user_srbcmd, user_srb,fibsize)){
509 dprintk((KERN_DEBUG"aacraid: Could not copy srb from user\n")); 509 dprintk((KERN_DEBUG"aacraid: Could not copy srb from user\n"));
510 rcode = -EFAULT; 510 rcode = -EFAULT;
511 goto cleanup; 511 goto cleanup;
512 } 512 }
@@ -525,7 +525,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
525 srbcmd->retry_limit = 0; // Obsolete parameter 525 srbcmd->retry_limit = 0; // Obsolete parameter
526 srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size); 526 srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size);
527 memcpy(srbcmd->cdb, user_srbcmd->cdb, sizeof(srbcmd->cdb)); 527 memcpy(srbcmd->cdb, user_srbcmd->cdb, sizeof(srbcmd->cdb));
528 528
529 switch (flags & (SRB_DataIn | SRB_DataOut)) { 529 switch (flags & (SRB_DataIn | SRB_DataOut)) {
530 case SRB_DataOut: 530 case SRB_DataOut:
531 data_dir = DMA_TO_DEVICE; 531 data_dir = DMA_TO_DEVICE;
@@ -593,7 +593,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
593 sg_list[i] = p; // save so we can clean up later 593 sg_list[i] = p; // save so we can clean up later
594 sg_indx = i; 594 sg_indx = i;
595 595
596 if( flags & SRB_DataOut ){ 596 if (flags & SRB_DataOut) {
597 if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ 597 if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){
598 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); 598 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
599 rcode = -EFAULT; 599 rcode = -EFAULT;
@@ -636,7 +636,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
636 sg_list[i] = p; // save so we can clean up later 636 sg_list[i] = p; // save so we can clean up later
637 sg_indx = i; 637 sg_indx = i;
638 638
639 if( flags & SRB_DataOut ){ 639 if (flags & SRB_DataOut) {
640 if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ 640 if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){
641 kfree (usg); 641 kfree (usg);
642 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); 642 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
@@ -679,7 +679,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
679 sg_list[i] = p; // save so we can clean up later 679 sg_list[i] = p; // save so we can clean up later
680 sg_indx = i; 680 sg_indx = i;
681 681
682 if( flags & SRB_DataOut ){ 682 if (flags & SRB_DataOut) {
683 if(copy_from_user(p,sg_user[i],usg->sg[i].count)){ 683 if(copy_from_user(p,sg_user[i],usg->sg[i].count)){
684 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); 684 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
685 rcode = -EFAULT; 685 rcode = -EFAULT;
@@ -707,7 +707,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
707 sg_list[i] = p; // save so we can clean up later 707 sg_list[i] = p; // save so we can clean up later
708 sg_indx = i; 708 sg_indx = i;
709 709
710 if( flags & SRB_DataOut ){ 710 if (flags & SRB_DataOut) {
711 if(copy_from_user(p, sg_user[i], 711 if(copy_from_user(p, sg_user[i],
712 upsg->sg[i].count)) { 712 upsg->sg[i].count)) {
713 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); 713 dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
@@ -733,19 +733,19 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
733 } 733 }
734 734
735 if (status != 0){ 735 if (status != 0){
736 dprintk((KERN_DEBUG"aacraid: Could not send raw srb fib to hba\n")); 736 dprintk((KERN_DEBUG"aacraid: Could not send raw srb fib to hba\n"));
737 rcode = -ENXIO; 737 rcode = -ENXIO;
738 goto cleanup; 738 goto cleanup;
739 } 739 }
740 740
741 if( flags & SRB_DataIn ) { 741 if (flags & SRB_DataIn) {
742 for(i = 0 ; i <= sg_indx; i++){ 742 for(i = 0 ; i <= sg_indx; i++){
743 byte_count = le32_to_cpu( 743 byte_count = le32_to_cpu(
744 (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64) 744 (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64)
745 ? ((struct sgmap64*)&srbcmd->sg)->sg[i].count 745 ? ((struct sgmap64*)&srbcmd->sg)->sg[i].count
746 : srbcmd->sg.sg[i].count); 746 : srbcmd->sg.sg[i].count);
747 if(copy_to_user(sg_user[i], sg_list[i], byte_count)){ 747 if(copy_to_user(sg_user[i], sg_list[i], byte_count)){
748 dprintk((KERN_DEBUG"aacraid: Could not copy sg data to user\n")); 748 dprintk((KERN_DEBUG"aacraid: Could not copy sg data to user\n"));
749 rcode = -EFAULT; 749 rcode = -EFAULT;
750 goto cleanup; 750 goto cleanup;
751 751
@@ -755,7 +755,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
755 755
756 reply = (struct aac_srb_reply *) fib_data(srbfib); 756 reply = (struct aac_srb_reply *) fib_data(srbfib);
757 if(copy_to_user(user_reply,reply,sizeof(struct aac_srb_reply))){ 757 if(copy_to_user(user_reply,reply,sizeof(struct aac_srb_reply))){
758 dprintk((KERN_DEBUG"aacraid: Could not copy reply to user\n")); 758 dprintk((KERN_DEBUG"aacraid: Could not copy reply to user\n"));
759 rcode = -EFAULT; 759 rcode = -EFAULT;
760 goto cleanup; 760 goto cleanup;
761 } 761 }
@@ -774,34 +774,34 @@ cleanup:
774} 774}
775 775
776struct aac_pci_info { 776struct aac_pci_info {
777 u32 bus; 777 u32 bus;
778 u32 slot; 778 u32 slot;
779}; 779};
780 780
781 781
782static int aac_get_pci_info(struct aac_dev* dev, void __user *arg) 782static int aac_get_pci_info(struct aac_dev* dev, void __user *arg)
783{ 783{
784 struct aac_pci_info pci_info; 784 struct aac_pci_info pci_info;
785 785
786 pci_info.bus = dev->pdev->bus->number; 786 pci_info.bus = dev->pdev->bus->number;
787 pci_info.slot = PCI_SLOT(dev->pdev->devfn); 787 pci_info.slot = PCI_SLOT(dev->pdev->devfn);
788 788
789 if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) { 789 if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) {
790 dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n")); 790 dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n"));
791 return -EFAULT; 791 return -EFAULT;
792 } 792 }
793 return 0; 793 return 0;
794} 794}
795 795
796 796
797int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg) 797int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg)
798{ 798{
799 int status; 799 int status;
800 800
801 /* 801 /*
802 * HBA gets first crack 802 * HBA gets first crack
803 */ 803 */
804 804
805 status = aac_dev_ioctl(dev, cmd, arg); 805 status = aac_dev_ioctl(dev, cmd, arg);
806 if(status != -ENOTTY) 806 if(status != -ENOTTY)
807 return status; 807 return status;
@@ -831,7 +831,7 @@ int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg)
831 break; 831 break;
832 default: 832 default:
833 status = -ENOTTY; 833 status = -ENOTTY;
834 break; 834 break;
835 } 835 }
836 return status; 836 return status;
837} 837}
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 6d88f30296e1..1dd2e57c3345 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -56,7 +56,7 @@
56 * Allocate and map the shared PCI space for the FIB blocks used to 56 * Allocate and map the shared PCI space for the FIB blocks used to
57 * talk to the Adaptec firmware. 57 * talk to the Adaptec firmware.
58 */ 58 */
59 59
60static int fib_map_alloc(struct aac_dev *dev) 60static int fib_map_alloc(struct aac_dev *dev)
61{ 61{
62 dprintk((KERN_INFO 62 dprintk((KERN_INFO
@@ -109,14 +109,16 @@ int aac_fib_setup(struct aac_dev * dev)
109 } 109 }
110 if (i<0) 110 if (i<0)
111 return -ENOMEM; 111 return -ENOMEM;
112 112
113 hw_fib = dev->hw_fib_va; 113 hw_fib = dev->hw_fib_va;
114 hw_fib_pa = dev->hw_fib_pa; 114 hw_fib_pa = dev->hw_fib_pa;
115 memset(hw_fib, 0, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)); 115 memset(hw_fib, 0, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB));
116 /* 116 /*
117 * Initialise the fibs 117 * Initialise the fibs
118 */ 118 */
119 for (i = 0, fibptr = &dev->fibs[i]; i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++, fibptr++) 119 for (i = 0, fibptr = &dev->fibs[i];
120 i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB);
121 i++, fibptr++)
120 { 122 {
121 fibptr->dev = dev; 123 fibptr->dev = dev;
122 fibptr->hw_fib_va = hw_fib; 124 fibptr->hw_fib_va = hw_fib;
@@ -148,13 +150,13 @@ int aac_fib_setup(struct aac_dev * dev)
148 * Allocate a fib from the adapter fib pool. If the pool is empty we 150 * Allocate a fib from the adapter fib pool. If the pool is empty we
149 * return NULL. 151 * return NULL.
150 */ 152 */
151 153
152struct fib *aac_fib_alloc(struct aac_dev *dev) 154struct fib *aac_fib_alloc(struct aac_dev *dev)
153{ 155{
154 struct fib * fibptr; 156 struct fib * fibptr;
155 unsigned long flags; 157 unsigned long flags;
156 spin_lock_irqsave(&dev->fib_lock, flags); 158 spin_lock_irqsave(&dev->fib_lock, flags);
157 fibptr = dev->free_fib; 159 fibptr = dev->free_fib;
158 if(!fibptr){ 160 if(!fibptr){
159 spin_unlock_irqrestore(&dev->fib_lock, flags); 161 spin_unlock_irqrestore(&dev->fib_lock, flags);
160 return fibptr; 162 return fibptr;
@@ -184,7 +186,7 @@ struct fib *aac_fib_alloc(struct aac_dev *dev)
184 * 186 *
185 * Frees up a fib and places it on the appropriate queue 187 * Frees up a fib and places it on the appropriate queue
186 */ 188 */
187 189
188void aac_fib_free(struct fib *fibptr) 190void aac_fib_free(struct fib *fibptr)
189{ 191{
190 unsigned long flags; 192 unsigned long flags;
@@ -205,10 +207,10 @@ void aac_fib_free(struct fib *fibptr)
205/** 207/**
206 * aac_fib_init - initialise a fib 208 * aac_fib_init - initialise a fib
207 * @fibptr: The fib to initialize 209 * @fibptr: The fib to initialize
208 * 210 *
209 * Set up the generic fib fields ready for use 211 * Set up the generic fib fields ready for use
210 */ 212 */
211 213
212void aac_fib_init(struct fib *fibptr) 214void aac_fib_init(struct fib *fibptr)
213{ 215{
214 struct hw_fib *hw_fib = fibptr->hw_fib_va; 216 struct hw_fib *hw_fib = fibptr->hw_fib_va;
@@ -228,12 +230,12 @@ void aac_fib_init(struct fib *fibptr)
228 * Will deallocate and return to the free pool the FIB pointed to by the 230 * Will deallocate and return to the free pool the FIB pointed to by the
229 * caller. 231 * caller.
230 */ 232 */
231 233
232static void fib_dealloc(struct fib * fibptr) 234static void fib_dealloc(struct fib * fibptr)
233{ 235{
234 struct hw_fib *hw_fib = fibptr->hw_fib_va; 236 struct hw_fib *hw_fib = fibptr->hw_fib_va;
235 BUG_ON(hw_fib->header.StructType != FIB_MAGIC); 237 BUG_ON(hw_fib->header.StructType != FIB_MAGIC);
236 hw_fib->header.XferState = 0; 238 hw_fib->header.XferState = 0;
237} 239}
238 240
239/* 241/*
@@ -242,7 +244,7 @@ static void fib_dealloc(struct fib * fibptr)
242 * these routines and are the only routines which have a knowledge of the 244 * these routines and are the only routines which have a knowledge of the
243 * how these queues are implemented. 245 * how these queues are implemented.
244 */ 246 */
245 247
246/** 248/**
247 * aac_get_entry - get a queue entry 249 * aac_get_entry - get a queue entry
248 * @dev: Adapter 250 * @dev: Adapter
@@ -255,7 +257,7 @@ static void fib_dealloc(struct fib * fibptr)
255 * is full(no free entries) than no entry is returned and the function returns 0 otherwise 1 is 257 * is full(no free entries) than no entry is returned and the function returns 0 otherwise 1 is
256 * returned. 258 * returned.
257 */ 259 */
258 260
259static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entry, u32 * index, unsigned long *nonotify) 261static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entry, u32 * index, unsigned long *nonotify)
260{ 262{
261 struct aac_queue * q; 263 struct aac_queue * q;
@@ -280,26 +282,27 @@ static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entr
280 idx = ADAP_NORM_RESP_ENTRIES; 282 idx = ADAP_NORM_RESP_ENTRIES;
281 } 283 }
282 if (idx != le32_to_cpu(*(q->headers.consumer))) 284 if (idx != le32_to_cpu(*(q->headers.consumer)))
283 *nonotify = 1; 285 *nonotify = 1;
284 } 286 }
285 287
286 if (qid == AdapNormCmdQueue) { 288 if (qid == AdapNormCmdQueue) {
287 if (*index >= ADAP_NORM_CMD_ENTRIES) 289 if (*index >= ADAP_NORM_CMD_ENTRIES)
288 *index = 0; /* Wrap to front of the Producer Queue. */ 290 *index = 0; /* Wrap to front of the Producer Queue. */
289 } else { 291 } else {
290 if (*index >= ADAP_NORM_RESP_ENTRIES) 292 if (*index >= ADAP_NORM_RESP_ENTRIES)
291 *index = 0; /* Wrap to front of the Producer Queue. */ 293 *index = 0; /* Wrap to front of the Producer Queue. */
292 } 294 }
293 295
294 if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) { /* Queue is full */ 296 /* Queue is full */
297 if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) {
295 printk(KERN_WARNING "Queue %d full, %u outstanding.\n", 298 printk(KERN_WARNING "Queue %d full, %u outstanding.\n",
296 qid, q->numpending); 299 qid, q->numpending);
297 return 0; 300 return 0;
298 } else { 301 } else {
299 *entry = q->base + *index; 302 *entry = q->base + *index;
300 return 1; 303 return 1;
301 } 304 }
302} 305}
303 306
304/** 307/**
305 * aac_queue_get - get the next free QE 308 * aac_queue_get - get the next free QE
@@ -321,31 +324,29 @@ int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw
321{ 324{
322 struct aac_entry * entry = NULL; 325 struct aac_entry * entry = NULL;
323 int map = 0; 326 int map = 0;
324 327
325 if (qid == AdapNormCmdQueue) { 328 if (qid == AdapNormCmdQueue) {
326 /* if no entries wait for some if caller wants to */ 329 /* if no entries wait for some if caller wants to */
327 while (!aac_get_entry(dev, qid, &entry, index, nonotify)) 330 while (!aac_get_entry(dev, qid, &entry, index, nonotify)) {
328 {
329 printk(KERN_ERR "GetEntries failed\n"); 331 printk(KERN_ERR "GetEntries failed\n");
330 } 332 }
331 /* 333 /*
332 * Setup queue entry with a command, status and fib mapped 334 * Setup queue entry with a command, status and fib mapped
333 */ 335 */
334 entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); 336 entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size));
335 map = 1; 337 map = 1;
336 } else { 338 } else {
337 while(!aac_get_entry(dev, qid, &entry, index, nonotify)) 339 while (!aac_get_entry(dev, qid, &entry, index, nonotify)) {
338 {
339 /* if no entries wait for some if caller wants to */ 340 /* if no entries wait for some if caller wants to */
340 } 341 }
341 /* 342 /*
342 * Setup queue entry with command, status and fib mapped 343 * Setup queue entry with command, status and fib mapped
343 */ 344 */
344 entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); 345 entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size));
345 entry->addr = hw_fib->header.SenderFibAddress; 346 entry->addr = hw_fib->header.SenderFibAddress;
346 /* Restore adapters pointer to the FIB */ 347 /* Restore adapters pointer to the FIB */
347 hw_fib->header.ReceiverFibAddress = hw_fib->header.SenderFibAddress; /* Let the adapter now where to find its data */ 348 hw_fib->header.ReceiverFibAddress = hw_fib->header.SenderFibAddress; /* Let the adapter now where to find its data */
348 map = 0; 349 map = 0;
349 } 350 }
350 /* 351 /*
351 * If MapFib is true than we need to map the Fib and put pointers 352 * If MapFib is true than we need to map the Fib and put pointers
@@ -357,8 +358,8 @@ int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw
357} 358}
358 359
359/* 360/*
360 * Define the highest level of host to adapter communication routines. 361 * Define the highest level of host to adapter communication routines.
361 * These routines will support host to adapter FS commuication. These 362 * These routines will support host to adapter FS commuication. These
362 * routines have no knowledge of the commuication method used. This level 363 * routines have no knowledge of the commuication method used. This level
363 * sends and receives FIBs. This level has no knowledge of how these FIBs 364 * sends and receives FIBs. This level has no knowledge of how these FIBs
364 * get passed back and forth. 365 * get passed back and forth.
@@ -380,7 +381,7 @@ int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw
380 * an event to wait on must be supplied. This event will be set when a 381 * an event to wait on must be supplied. This event will be set when a
381 * response FIB is received from the adapter. 382 * response FIB is received from the adapter.
382 */ 383 */
383 384
384int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, 385int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
385 int priority, int wait, int reply, fib_callback callback, 386 int priority, int wait, int reply, fib_callback callback,
386 void *callback_data) 387 void *callback_data)
@@ -393,13 +394,13 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
393 if (!(hw_fib->header.XferState & cpu_to_le32(HostOwned))) 394 if (!(hw_fib->header.XferState & cpu_to_le32(HostOwned)))
394 return -EBUSY; 395 return -EBUSY;
395 /* 396 /*
396 * There are 5 cases with the wait and reponse requested flags. 397 * There are 5 cases with the wait and reponse requested flags.
397 * The only invalid cases are if the caller requests to wait and 398 * The only invalid cases are if the caller requests to wait and
398 * does not request a response and if the caller does not want a 399 * does not request a response and if the caller does not want a
399 * response and the Fib is not allocated from pool. If a response 400 * response and the Fib is not allocated from pool. If a response
400 * is not requesed the Fib will just be deallocaed by the DPC 401 * is not requesed the Fib will just be deallocaed by the DPC
401 * routine when the response comes back from the adapter. No 402 * routine when the response comes back from the adapter. No
402 * further processing will be done besides deleting the Fib. We 403 * further processing will be done besides deleting the Fib. We
403 * will have a debug mode where the adapter can notify the host 404 * will have a debug mode where the adapter can notify the host
404 * it had a problem and the host can log that fact. 405 * it had a problem and the host can log that fact.
405 */ 406 */
@@ -415,7 +416,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
415 } else if (wait && reply) { 416 } else if (wait && reply) {
416 hw_fib->header.XferState |= cpu_to_le32(ResponseExpected); 417 hw_fib->header.XferState |= cpu_to_le32(ResponseExpected);
417 FIB_COUNTER_INCREMENT(aac_config.NormalSent); 418 FIB_COUNTER_INCREMENT(aac_config.NormalSent);
418 } 419 }
419 /* 420 /*
420 * Map the fib into 32bits by using the fib number 421 * Map the fib into 32bits by using the fib number
421 */ 422 */
@@ -438,7 +439,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
438 hw_fib->header.Size = cpu_to_le16(sizeof(struct aac_fibhdr) + size); 439 hw_fib->header.Size = cpu_to_le16(sizeof(struct aac_fibhdr) + size);
439 if (le16_to_cpu(hw_fib->header.Size) > le16_to_cpu(hw_fib->header.SenderSize)) { 440 if (le16_to_cpu(hw_fib->header.Size) > le16_to_cpu(hw_fib->header.SenderSize)) {
440 return -EMSGSIZE; 441 return -EMSGSIZE;
441 } 442 }
442 /* 443 /*
443 * Get a queue entry connect the FIB to it and send an notify 444 * Get a queue entry connect the FIB to it and send an notify
444 * the adapter a command is ready. 445 * the adapter a command is ready.
@@ -475,9 +476,9 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
475 aac_adapter_deliver(fibptr); 476 aac_adapter_deliver(fibptr);
476 477
477 /* 478 /*
478 * If the caller wanted us to wait for response wait now. 479 * If the caller wanted us to wait for response wait now.
479 */ 480 */
480 481
481 if (wait) { 482 if (wait) {
482 spin_unlock_irqrestore(&fibptr->event_lock, flags); 483 spin_unlock_irqrestore(&fibptr->event_lock, flags);
483 /* Only set for first known interruptable command */ 484 /* Only set for first known interruptable command */
@@ -524,7 +525,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
524 } 525 }
525 spin_unlock_irqrestore(&fibptr->event_lock, flags); 526 spin_unlock_irqrestore(&fibptr->event_lock, flags);
526 BUG_ON(fibptr->done == 0); 527 BUG_ON(fibptr->done == 0);
527 528
528 if(unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)) 529 if(unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT))
529 return -ETIMEDOUT; 530 return -ETIMEDOUT;
530 return 0; 531 return 0;
@@ -539,15 +540,15 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
539 return 0; 540 return 0;
540} 541}
541 542
542/** 543/**
543 * aac_consumer_get - get the top of the queue 544 * aac_consumer_get - get the top of the queue
544 * @dev: Adapter 545 * @dev: Adapter
545 * @q: Queue 546 * @q: Queue
546 * @entry: Return entry 547 * @entry: Return entry
547 * 548 *
548 * Will return a pointer to the entry on the top of the queue requested that 549 * Will return a pointer to the entry on the top of the queue requested that
549 * we are a consumer of, and return the address of the queue entry. It does 550 * we are a consumer of, and return the address of the queue entry. It does
550 * not change the state of the queue. 551 * not change the state of the queue.
551 */ 552 */
552 553
553int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry) 554int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry)
@@ -562,10 +563,10 @@ int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entr
562 * the end of the queue, else we just use the entry 563 * the end of the queue, else we just use the entry
563 * pointed to by the header index 564 * pointed to by the header index
564 */ 565 */
565 if (le32_to_cpu(*q->headers.consumer) >= q->entries) 566 if (le32_to_cpu(*q->headers.consumer) >= q->entries)
566 index = 0; 567 index = 0;
567 else 568 else
568 index = le32_to_cpu(*q->headers.consumer); 569 index = le32_to_cpu(*q->headers.consumer);
569 *entry = q->base + index; 570 *entry = q->base + index;
570 status = 1; 571 status = 1;
571 } 572 }
@@ -589,12 +590,12 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid)
589 590
590 if ((le32_to_cpu(*q->headers.producer)+1) == le32_to_cpu(*q->headers.consumer)) 591 if ((le32_to_cpu(*q->headers.producer)+1) == le32_to_cpu(*q->headers.consumer))
591 wasfull = 1; 592 wasfull = 1;
592 593
593 if (le32_to_cpu(*q->headers.consumer) >= q->entries) 594 if (le32_to_cpu(*q->headers.consumer) >= q->entries)
594 *q->headers.consumer = cpu_to_le32(1); 595 *q->headers.consumer = cpu_to_le32(1);
595 else 596 else
596 *q->headers.consumer = cpu_to_le32(le32_to_cpu(*q->headers.consumer)+1); 597 *q->headers.consumer = cpu_to_le32(le32_to_cpu(*q->headers.consumer)+1);
597 598
598 if (wasfull) { 599 if (wasfull) {
599 switch (qid) { 600 switch (qid) {
600 601
@@ -610,7 +611,7 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid)
610 } 611 }
611 aac_adapter_notify(dev, notify); 612 aac_adapter_notify(dev, notify);
612 } 613 }
613} 614}
614 615
615/** 616/**
616 * aac_fib_adapter_complete - complete adapter issued fib 617 * aac_fib_adapter_complete - complete adapter issued fib
@@ -632,32 +633,32 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
632 if (hw_fib->header.XferState == 0) { 633 if (hw_fib->header.XferState == 0) {
633 if (dev->comm_interface == AAC_COMM_MESSAGE) 634 if (dev->comm_interface == AAC_COMM_MESSAGE)
634 kfree (hw_fib); 635 kfree (hw_fib);
635 return 0; 636 return 0;
636 } 637 }
637 /* 638 /*
638 * If we plan to do anything check the structure type first. 639 * If we plan to do anything check the structure type first.
639 */ 640 */
640 if ( hw_fib->header.StructType != FIB_MAGIC ) { 641 if (hw_fib->header.StructType != FIB_MAGIC) {
641 if (dev->comm_interface == AAC_COMM_MESSAGE) 642 if (dev->comm_interface == AAC_COMM_MESSAGE)
642 kfree (hw_fib); 643 kfree (hw_fib);
643 return -EINVAL; 644 return -EINVAL;
644 } 645 }
645 /* 646 /*
646 * This block handles the case where the adapter had sent us a 647 * This block handles the case where the adapter had sent us a
647 * command and we have finished processing the command. We 648 * command and we have finished processing the command. We
648 * call completeFib when we are done processing the command 649 * call completeFib when we are done processing the command
649 * and want to send a response back to the adapter. This will 650 * and want to send a response back to the adapter. This will
650 * send the completed cdb to the adapter. 651 * send the completed cdb to the adapter.
651 */ 652 */
652 if (hw_fib->header.XferState & cpu_to_le32(SentFromAdapter)) { 653 if (hw_fib->header.XferState & cpu_to_le32(SentFromAdapter)) {
653 if (dev->comm_interface == AAC_COMM_MESSAGE) { 654 if (dev->comm_interface == AAC_COMM_MESSAGE) {
654 kfree (hw_fib); 655 kfree (hw_fib);
655 } else { 656 } else {
656 u32 index; 657 u32 index;
657 hw_fib->header.XferState |= cpu_to_le32(HostProcessed); 658 hw_fib->header.XferState |= cpu_to_le32(HostProcessed);
658 if (size) { 659 if (size) {
659 size += sizeof(struct aac_fibhdr); 660 size += sizeof(struct aac_fibhdr);
660 if (size > le16_to_cpu(hw_fib->header.SenderSize)) 661 if (size > le16_to_cpu(hw_fib->header.SenderSize))
661 return -EMSGSIZE; 662 return -EMSGSIZE;
662 hw_fib->header.Size = cpu_to_le16(size); 663 hw_fib->header.Size = cpu_to_le16(size);
663 } 664 }
@@ -669,12 +670,11 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
669 if (!(nointr & (int)aac_config.irq_mod)) 670 if (!(nointr & (int)aac_config.irq_mod))
670 aac_adapter_notify(dev, AdapNormRespQueue); 671 aac_adapter_notify(dev, AdapNormRespQueue);
671 } 672 }
673 } else {
674 printk(KERN_WARNING "aac_fib_adapter_complete: "
675 "Unknown xferstate detected.\n");
676 BUG();
672 } 677 }
673 else
674 {
675 printk(KERN_WARNING "aac_fib_adapter_complete: Unknown xferstate detected.\n");
676 BUG();
677 }
678 return 0; 678 return 0;
679} 679}
680 680
@@ -684,7 +684,7 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
684 * 684 *
685 * Will do all necessary work to complete a FIB. 685 * Will do all necessary work to complete a FIB.
686 */ 686 */
687 687
688int aac_fib_complete(struct fib *fibptr) 688int aac_fib_complete(struct fib *fibptr)
689{ 689{
690 struct hw_fib * hw_fib = fibptr->hw_fib_va; 690 struct hw_fib * hw_fib = fibptr->hw_fib_va;
@@ -694,15 +694,15 @@ int aac_fib_complete(struct fib *fibptr)
694 */ 694 */
695 695
696 if (hw_fib->header.XferState == 0) 696 if (hw_fib->header.XferState == 0)
697 return 0; 697 return 0;
698 /* 698 /*
699 * If we plan to do anything check the structure type first. 699 * If we plan to do anything check the structure type first.
700 */ 700 */
701 701
702 if (hw_fib->header.StructType != FIB_MAGIC) 702 if (hw_fib->header.StructType != FIB_MAGIC)
703 return -EINVAL; 703 return -EINVAL;
704 /* 704 /*
705 * This block completes a cdb which orginated on the host and we 705 * This block completes a cdb which orginated on the host and we
706 * just need to deallocate the cdb or reinit it. At this point the 706 * just need to deallocate the cdb or reinit it. At this point the
707 * command is complete that we had sent to the adapter and this 707 * command is complete that we had sent to the adapter and this
708 * cdb could be reused. 708 * cdb could be reused.
@@ -723,7 +723,7 @@ int aac_fib_complete(struct fib *fibptr)
723 fib_dealloc(fibptr); 723 fib_dealloc(fibptr);
724 } else { 724 } else {
725 BUG(); 725 BUG();
726 } 726 }
727 return 0; 727 return 0;
728} 728}
729 729
@@ -743,7 +743,7 @@ void aac_printf(struct aac_dev *dev, u32 val)
743 { 743 {
744 int length = val & 0xffff; 744 int length = val & 0xffff;
745 int level = (val >> 16) & 0xffff; 745 int level = (val >> 16) & 0xffff;
746 746
747 /* 747 /*
748 * The size of the printfbuf is set in port.c 748 * The size of the printfbuf is set in port.c
749 * There is no variable or define for it 749 * There is no variable or define for it
@@ -757,7 +757,7 @@ void aac_printf(struct aac_dev *dev, u32 val)
757 else 757 else
758 printk(KERN_INFO "%s:%s", dev->name, cp); 758 printk(KERN_INFO "%s:%s", dev->name, cp);
759 } 759 }
760 memset(cp, 0, 256); 760 memset(cp, 0, 256);
761} 761}
762 762
763 763
@@ -816,9 +816,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
816 */ 816 */
817 817
818 if ((dev != NULL) && (dev->scsi_host_ptr != NULL)) { 818 if ((dev != NULL) && (dev->scsi_host_ptr != NULL)) {
819 device = scsi_device_lookup(dev->scsi_host_ptr, 819 device = scsi_device_lookup(dev->scsi_host_ptr,
820 CONTAINER_TO_CHANNEL(container), 820 CONTAINER_TO_CHANNEL(container),
821 CONTAINER_TO_ID(container), 821 CONTAINER_TO_ID(container),
822 CONTAINER_TO_LUN(container)); 822 CONTAINER_TO_LUN(container));
823 if (device) { 823 if (device) {
824 dev->fsa_dev[container].config_needed = CHANGE; 824 dev->fsa_dev[container].config_needed = CHANGE;
@@ -1184,13 +1184,13 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced)
1184 } 1184 }
1185 (void)aac_get_adapter_info(aac); 1185 (void)aac_get_adapter_info(aac);
1186 if ((quirks & AAC_QUIRK_34SG) && (host->sg_tablesize > 34)) { 1186 if ((quirks & AAC_QUIRK_34SG) && (host->sg_tablesize > 34)) {
1187 host->sg_tablesize = 34; 1187 host->sg_tablesize = 34;
1188 host->max_sectors = (host->sg_tablesize * 8) + 112; 1188 host->max_sectors = (host->sg_tablesize * 8) + 112;
1189 } 1189 }
1190 if ((quirks & AAC_QUIRK_17SG) && (host->sg_tablesize > 17)) { 1190 if ((quirks & AAC_QUIRK_17SG) && (host->sg_tablesize > 17)) {
1191 host->sg_tablesize = 17; 1191 host->sg_tablesize = 17;
1192 host->max_sectors = (host->sg_tablesize * 8) + 112; 1192 host->max_sectors = (host->sg_tablesize * 8) + 112;
1193 } 1193 }
1194 aac_get_config_status(aac, 1); 1194 aac_get_config_status(aac, 1);
1195 aac_get_containers(aac); 1195 aac_get_containers(aac);
1196 /* 1196 /*
@@ -1461,7 +1461,7 @@ out:
1461 * until the queue is empty. When the queue is empty it will wait for 1461 * until the queue is empty. When the queue is empty it will wait for
1462 * more FIBs. 1462 * more FIBs.
1463 */ 1463 */
1464 1464
1465int aac_command_thread(void *data) 1465int aac_command_thread(void *data)
1466{ 1466{
1467 struct aac_dev *dev = data; 1467 struct aac_dev *dev = data;
@@ -1487,30 +1487,29 @@ int aac_command_thread(void *data)
1487 add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait); 1487 add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait);
1488 set_current_state(TASK_INTERRUPTIBLE); 1488 set_current_state(TASK_INTERRUPTIBLE);
1489 dprintk ((KERN_INFO "aac_command_thread start\n")); 1489 dprintk ((KERN_INFO "aac_command_thread start\n"));
1490 while(1) 1490 while (1) {
1491 {
1492 spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags); 1491 spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags);
1493 while(!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) { 1492 while(!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) {
1494 struct list_head *entry; 1493 struct list_head *entry;
1495 struct aac_aifcmd * aifcmd; 1494 struct aac_aifcmd * aifcmd;
1496 1495
1497 set_current_state(TASK_RUNNING); 1496 set_current_state(TASK_RUNNING);
1498 1497
1499 entry = dev->queues->queue[HostNormCmdQueue].cmdq.next; 1498 entry = dev->queues->queue[HostNormCmdQueue].cmdq.next;
1500 list_del(entry); 1499 list_del(entry);
1501 1500
1502 spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags); 1501 spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags);
1503 fib = list_entry(entry, struct fib, fiblink); 1502 fib = list_entry(entry, struct fib, fiblink);
1504 /* 1503 /*
1505 * We will process the FIB here or pass it to a 1504 * We will process the FIB here or pass it to a
1506 * worker thread that is TBD. We Really can't 1505 * worker thread that is TBD. We Really can't
1507 * do anything at this point since we don't have 1506 * do anything at this point since we don't have
1508 * anything defined for this thread to do. 1507 * anything defined for this thread to do.
1509 */ 1508 */
1510 hw_fib = fib->hw_fib_va; 1509 hw_fib = fib->hw_fib_va;
1511 memset(fib, 0, sizeof(struct fib)); 1510 memset(fib, 0, sizeof(struct fib));
1512 fib->type = FSAFS_NTC_FIB_CONTEXT; 1511 fib->type = FSAFS_NTC_FIB_CONTEXT;
1513 fib->size = sizeof( struct fib ); 1512 fib->size = sizeof(struct fib);
1514 fib->hw_fib_va = hw_fib; 1513 fib->hw_fib_va = hw_fib;
1515 fib->data = hw_fib->data; 1514 fib->data = hw_fib->data;
1516 fib->dev = dev; 1515 fib->dev = dev;
@@ -1526,17 +1525,17 @@ int aac_command_thread(void *data)
1526 } else { 1525 } else {
1527 /* The u32 here is important and intended. We are using 1526 /* The u32 here is important and intended. We are using
1528 32bit wrapping time to fit the adapter field */ 1527 32bit wrapping time to fit the adapter field */
1529 1528
1530 u32 time_now, time_last; 1529 u32 time_now, time_last;
1531 unsigned long flagv; 1530 unsigned long flagv;
1532 unsigned num; 1531 unsigned num;
1533 struct hw_fib ** hw_fib_pool, ** hw_fib_p; 1532 struct hw_fib ** hw_fib_pool, ** hw_fib_p;
1534 struct fib ** fib_pool, ** fib_p; 1533 struct fib ** fib_pool, ** fib_p;
1535 1534
1536 /* Sniff events */ 1535 /* Sniff events */
1537 if ((aifcmd->command == 1536 if ((aifcmd->command ==
1538 cpu_to_le32(AifCmdEventNotify)) || 1537 cpu_to_le32(AifCmdEventNotify)) ||
1539 (aifcmd->command == 1538 (aifcmd->command ==
1540 cpu_to_le32(AifCmdJobProgress))) { 1539 cpu_to_le32(AifCmdJobProgress))) {
1541 aac_handle_aif(dev, fib); 1540 aac_handle_aif(dev, fib);
1542 } 1541 }
@@ -1588,7 +1587,7 @@ int aac_command_thread(void *data)
1588 spin_lock_irqsave(&dev->fib_lock, flagv); 1587 spin_lock_irqsave(&dev->fib_lock, flagv);
1589 entry = dev->fib_list.next; 1588 entry = dev->fib_list.next;
1590 /* 1589 /*
1591 * For each Context that is on the 1590 * For each Context that is on the
1592 * fibctxList, make a copy of the 1591 * fibctxList, make a copy of the
1593 * fib, and then set the event to wake up the 1592 * fib, and then set the event to wake up the
1594 * thread that is waiting for it. 1593 * thread that is waiting for it.
@@ -1613,7 +1612,7 @@ int aac_command_thread(void *data)
1613 */ 1612 */
1614 time_last = fibctx->jiffies; 1613 time_last = fibctx->jiffies;
1615 /* 1614 /*
1616 * Has it been > 2 minutes 1615 * Has it been > 2 minutes
1617 * since the last read off 1616 * since the last read off
1618 * the queue? 1617 * the queue?
1619 */ 1618 */
@@ -1644,7 +1643,7 @@ int aac_command_thread(void *data)
1644 */ 1643 */
1645 list_add_tail(&newfib->fiblink, &fibctx->fib_list); 1644 list_add_tail(&newfib->fiblink, &fibctx->fib_list);
1646 fibctx->count++; 1645 fibctx->count++;
1647 /* 1646 /*
1648 * Set the event to wake up the 1647 * Set the event to wake up the
1649 * thread that is waiting. 1648 * thread that is waiting.
1650 */ 1649 */
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 143e4c16b079..6650f6fa9890 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -159,7 +159,7 @@ static struct pci_device_id aac_pci_tbl[] = {
159MODULE_DEVICE_TABLE(pci, aac_pci_tbl); 159MODULE_DEVICE_TABLE(pci, aac_pci_tbl);
160 160
161/* 161/*
162 * dmb - For now we add the number of channels to this structure. 162 * dmb - For now we add the number of channels to this structure.
163 * In the future we should add a fib that reports the number of channels 163 * In the future we should add a fib that reports the number of channels
164 * for the card. At that time we can remove the channels from here 164 * for the card. At that time we can remove the channels from here
165 */ 165 */
@@ -239,7 +239,7 @@ static struct aac_driver_ident aac_drivers[] = {
239 * Queues a command for execution by the associated Host Adapter. 239 * Queues a command for execution by the associated Host Adapter.
240 * 240 *
241 * TODO: unify with aac_scsi_cmd(). 241 * TODO: unify with aac_scsi_cmd().
242 */ 242 */
243 243
244static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 244static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
245{ 245{
@@ -258,7 +258,7 @@ static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd
258 } 258 }
259 cmd->SCp.phase = AAC_OWNER_LOWLEVEL; 259 cmd->SCp.phase = AAC_OWNER_LOWLEVEL;
260 return (aac_scsi_cmd(cmd) ? FAILED : 0); 260 return (aac_scsi_cmd(cmd) ? FAILED : 0);
261} 261}
262 262
263/** 263/**
264 * aac_info - Returns the host adapter name 264 * aac_info - Returns the host adapter name
@@ -292,21 +292,21 @@ struct aac_driver_ident* aac_get_driver_ident(int devtype)
292 * @capacity: the sector capacity of the disk 292 * @capacity: the sector capacity of the disk
293 * @geom: geometry block to fill in 293 * @geom: geometry block to fill in
294 * 294 *
295 * Return the Heads/Sectors/Cylinders BIOS Disk Parameters for Disk. 295 * Return the Heads/Sectors/Cylinders BIOS Disk Parameters for Disk.
296 * The default disk geometry is 64 heads, 32 sectors, and the appropriate 296 * The default disk geometry is 64 heads, 32 sectors, and the appropriate
297 * number of cylinders so as not to exceed drive capacity. In order for 297 * number of cylinders so as not to exceed drive capacity. In order for
298 * disks equal to or larger than 1 GB to be addressable by the BIOS 298 * disks equal to or larger than 1 GB to be addressable by the BIOS
299 * without exceeding the BIOS limitation of 1024 cylinders, Extended 299 * without exceeding the BIOS limitation of 1024 cylinders, Extended
300 * Translation should be enabled. With Extended Translation enabled, 300 * Translation should be enabled. With Extended Translation enabled,
301 * drives between 1 GB inclusive and 2 GB exclusive are given a disk 301 * drives between 1 GB inclusive and 2 GB exclusive are given a disk
302 * geometry of 128 heads and 32 sectors, and drives above 2 GB inclusive 302 * geometry of 128 heads and 32 sectors, and drives above 2 GB inclusive
303 * are given a disk geometry of 255 heads and 63 sectors. However, if 303 * are given a disk geometry of 255 heads and 63 sectors. However, if
304 * the BIOS detects that the Extended Translation setting does not match 304 * the BIOS detects that the Extended Translation setting does not match
305 * the geometry in the partition table, then the translation inferred 305 * the geometry in the partition table, then the translation inferred
306 * from the partition table will be used by the BIOS, and a warning may 306 * from the partition table will be used by the BIOS, and a warning may
307 * be displayed. 307 * be displayed.
308 */ 308 */
309 309
310static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, 310static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev,
311 sector_t capacity, int *geom) 311 sector_t capacity, int *geom)
312{ 312{
@@ -333,10 +333,10 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev,
333 333
334 param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors); 334 param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors);
335 335
336 /* 336 /*
337 * Read the first 1024 bytes from the disk device, if the boot 337 * Read the first 1024 bytes from the disk device, if the boot
338 * sector partition table is valid, search for a partition table 338 * sector partition table is valid, search for a partition table
339 * entry whose end_head matches one of the standard geometry 339 * entry whose end_head matches one of the standard geometry
340 * translations ( 64/32, 128/32, 255/63 ). 340 * translations ( 64/32, 128/32, 255/63 ).
341 */ 341 */
342 buf = scsi_bios_ptable(bdev); 342 buf = scsi_bios_ptable(bdev);
@@ -596,7 +596,7 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
596 cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER; 596 cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER;
597 } 597 }
598 } 598 }
599 printk(KERN_ERR "%s: Host adapter reset request. SCSI hang ?\n", 599 printk(KERN_ERR "%s: Host adapter reset request. SCSI hang ?\n",
600 AAC_DRIVERNAME); 600 AAC_DRIVERNAME);
601 601
602 if ((count = aac_check_health(aac))) 602 if ((count = aac_check_health(aac)))
@@ -687,8 +687,8 @@ static int aac_cfg_open(struct inode *inode, struct file *file)
687 * Bugs: Needs locking against parallel ioctls lower down 687 * Bugs: Needs locking against parallel ioctls lower down
688 * Bugs: Needs to handle hot plugging 688 * Bugs: Needs to handle hot plugging
689 */ 689 */
690 690
691static int aac_cfg_ioctl(struct inode *inode, struct file *file, 691static int aac_cfg_ioctl(struct inode *inode, struct file *file,
692 unsigned int cmd, unsigned long arg) 692 unsigned int cmd, unsigned long arg)
693{ 693{
694 if (!capable(CAP_SYS_RAWIO)) 694 if (!capable(CAP_SYS_RAWIO))
@@ -701,7 +701,7 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long
701{ 701{
702 long ret; 702 long ret;
703 lock_kernel(); 703 lock_kernel();
704 switch (cmd) { 704 switch (cmd) {
705 case FSACTL_MINIPORT_REV_CHECK: 705 case FSACTL_MINIPORT_REV_CHECK:
706 case FSACTL_SENDFIB: 706 case FSACTL_SENDFIB:
707 case FSACTL_OPEN_GET_ADAPTER_FIB: 707 case FSACTL_OPEN_GET_ADAPTER_FIB:
@@ -711,14 +711,14 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long
711 case FSACTL_QUERY_DISK: 711 case FSACTL_QUERY_DISK:
712 case FSACTL_DELETE_DISK: 712 case FSACTL_DELETE_DISK:
713 case FSACTL_FORCE_DELETE_DISK: 713 case FSACTL_FORCE_DELETE_DISK:
714 case FSACTL_GET_CONTAINERS: 714 case FSACTL_GET_CONTAINERS:
715 case FSACTL_SEND_LARGE_FIB: 715 case FSACTL_SEND_LARGE_FIB:
716 ret = aac_do_ioctl(dev, cmd, (void __user *)arg); 716 ret = aac_do_ioctl(dev, cmd, (void __user *)arg);
717 break; 717 break;
718 718
719 case FSACTL_GET_NEXT_ADAPTER_FIB: { 719 case FSACTL_GET_NEXT_ADAPTER_FIB: {
720 struct fib_ioctl __user *f; 720 struct fib_ioctl __user *f;
721 721
722 f = compat_alloc_user_space(sizeof(*f)); 722 f = compat_alloc_user_space(sizeof(*f));
723 ret = 0; 723 ret = 0;
724 if (clear_user(f, sizeof(*f))) 724 if (clear_user(f, sizeof(*f)))
@@ -731,9 +731,9 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long
731 } 731 }
732 732
733 default: 733 default:
734 ret = -ENOIOCTLCMD; 734 ret = -ENOIOCTLCMD;
735 break; 735 break;
736 } 736 }
737 unlock_kernel(); 737 unlock_kernel();
738 return ret; 738 return ret;
739} 739}
@@ -797,7 +797,7 @@ static ssize_t aac_show_kernel_version(struct class_device *class_dev,
797 int len, tmp; 797 int len, tmp;
798 798
799 tmp = le32_to_cpu(dev->adapter_info.kernelrev); 799 tmp = le32_to_cpu(dev->adapter_info.kernelrev);
800 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", 800 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n",
801 tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, 801 tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff,
802 le32_to_cpu(dev->adapter_info.kernelbuild)); 802 le32_to_cpu(dev->adapter_info.kernelbuild));
803 return len; 803 return len;
@@ -810,7 +810,7 @@ static ssize_t aac_show_monitor_version(struct class_device *class_dev,
810 int len, tmp; 810 int len, tmp;
811 811
812 tmp = le32_to_cpu(dev->adapter_info.monitorrev); 812 tmp = le32_to_cpu(dev->adapter_info.monitorrev);
813 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", 813 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n",
814 tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, 814 tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff,
815 le32_to_cpu(dev->adapter_info.monitorbuild)); 815 le32_to_cpu(dev->adapter_info.monitorbuild));
816 return len; 816 return len;
@@ -823,7 +823,7 @@ static ssize_t aac_show_bios_version(struct class_device *class_dev,
823 int len, tmp; 823 int len, tmp;
824 824
825 tmp = le32_to_cpu(dev->adapter_info.biosrev); 825 tmp = le32_to_cpu(dev->adapter_info.biosrev);
826 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", 826 len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n",
827 tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, 827 tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff,
828 le32_to_cpu(dev->adapter_info.biosbuild)); 828 le32_to_cpu(dev->adapter_info.biosbuild));
829 return len; 829 return len;
@@ -983,22 +983,22 @@ static struct scsi_host_template aac_driver_template = {
983 .compat_ioctl = aac_compat_ioctl, 983 .compat_ioctl = aac_compat_ioctl,
984#endif 984#endif
985 .queuecommand = aac_queuecommand, 985 .queuecommand = aac_queuecommand,
986 .bios_param = aac_biosparm, 986 .bios_param = aac_biosparm,
987 .shost_attrs = aac_attrs, 987 .shost_attrs = aac_attrs,
988 .slave_configure = aac_slave_configure, 988 .slave_configure = aac_slave_configure,
989 .change_queue_depth = aac_change_queue_depth, 989 .change_queue_depth = aac_change_queue_depth,
990 .sdev_attrs = aac_dev_attrs, 990 .sdev_attrs = aac_dev_attrs,
991 .eh_abort_handler = aac_eh_abort, 991 .eh_abort_handler = aac_eh_abort,
992 .eh_host_reset_handler = aac_eh_reset, 992 .eh_host_reset_handler = aac_eh_reset,
993 .can_queue = AAC_NUM_IO_FIB, 993 .can_queue = AAC_NUM_IO_FIB,
994 .this_id = MAXIMUM_NUM_CONTAINERS, 994 .this_id = MAXIMUM_NUM_CONTAINERS,
995 .sg_tablesize = 16, 995 .sg_tablesize = 16,
996 .max_sectors = 128, 996 .max_sectors = 128,
997#if (AAC_NUM_IO_FIB > 256) 997#if (AAC_NUM_IO_FIB > 256)
998 .cmd_per_lun = 256, 998 .cmd_per_lun = 256,
999#else 999#else
1000 .cmd_per_lun = AAC_NUM_IO_FIB, 1000 .cmd_per_lun = AAC_NUM_IO_FIB,
1001#endif 1001#endif
1002 .use_clustering = ENABLE_CLUSTERING, 1002 .use_clustering = ENABLE_CLUSTERING,
1003 .use_sg_chaining = ENABLE_SG_CHAINING, 1003 .use_sg_chaining = ENABLE_SG_CHAINING,
1004 .emulated = 1, 1004 .emulated = 1,
@@ -1035,18 +1035,18 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
1035 goto out; 1035 goto out;
1036 error = -ENODEV; 1036 error = -ENODEV;
1037 1037
1038 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || 1038 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) ||
1039 pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) 1039 pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))
1040 goto out_disable_pdev; 1040 goto out_disable_pdev;
1041 /* 1041 /*
1042 * If the quirk31 bit is set, the adapter needs adapter 1042 * If the quirk31 bit is set, the adapter needs adapter
1043 * to driver communication memory to be allocated below 2gig 1043 * to driver communication memory to be allocated below 2gig
1044 */ 1044 */
1045 if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) 1045 if (aac_drivers[index].quirks & AAC_QUIRK_31BIT)
1046 if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) || 1046 if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) ||
1047 pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK)) 1047 pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK))
1048 goto out_disable_pdev; 1048 goto out_disable_pdev;
1049 1049
1050 pci_set_master(pdev); 1050 pci_set_master(pdev);
1051 1051
1052 shost = scsi_host_alloc(&aac_driver_template, sizeof(struct aac_dev)); 1052 shost = scsi_host_alloc(&aac_driver_template, sizeof(struct aac_dev));
@@ -1059,7 +1059,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
1059 shost->max_cmd_len = 16; 1059 shost->max_cmd_len = 16;
1060 1060
1061 aac = (struct aac_dev *)shost->hostdata; 1061 aac = (struct aac_dev *)shost->hostdata;
1062 aac->scsi_host_ptr = shost; 1062 aac->scsi_host_ptr = shost;
1063 aac->pdev = pdev; 1063 aac->pdev = pdev;
1064 aac->name = aac_driver_template.name; 1064 aac->name = aac_driver_template.name;
1065 aac->id = shost->unique_id; 1065 aac->id = shost->unique_id;
@@ -1096,7 +1096,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
1096 if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) 1096 if (aac_drivers[index].quirks & AAC_QUIRK_31BIT)
1097 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) 1097 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK))
1098 goto out_deinit; 1098 goto out_deinit;
1099 1099
1100 aac->maximum_num_channels = aac_drivers[index].channels; 1100 aac->maximum_num_channels = aac_drivers[index].channels;
1101 error = aac_get_adapter_info(aac); 1101 error = aac_get_adapter_info(aac);
1102 if (error < 0) 1102 if (error < 0)
@@ -1105,7 +1105,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
1105 /* 1105 /*
1106 * Lets override negotiations and drop the maximum SG limit to 34 1106 * Lets override negotiations and drop the maximum SG limit to 34
1107 */ 1107 */
1108 if ((aac_drivers[index].quirks & AAC_QUIRK_34SG) && 1108 if ((aac_drivers[index].quirks & AAC_QUIRK_34SG) &&
1109 (aac->scsi_host_ptr->sg_tablesize > 34)) { 1109 (aac->scsi_host_ptr->sg_tablesize > 34)) {
1110 aac->scsi_host_ptr->sg_tablesize = 34; 1110 aac->scsi_host_ptr->sg_tablesize = 34;
1111 aac->scsi_host_ptr->max_sectors 1111 aac->scsi_host_ptr->max_sectors
@@ -1122,11 +1122,11 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
1122 /* 1122 /*
1123 * Firware printf works only with older firmware. 1123 * Firware printf works only with older firmware.
1124 */ 1124 */
1125 if (aac_drivers[index].quirks & AAC_QUIRK_34SG) 1125 if (aac_drivers[index].quirks & AAC_QUIRK_34SG)
1126 aac->printf_enabled = 1; 1126 aac->printf_enabled = 1;
1127 else 1127 else
1128 aac->printf_enabled = 0; 1128 aac->printf_enabled = 0;
1129 1129
1130 /* 1130 /*
1131 * max channel will be the physical channels plus 1 virtual channel 1131 * max channel will be the physical channels plus 1 virtual channel
1132 * all containers are on the virtual channel 0 (CONTAINER_CHANNEL) 1132 * all containers are on the virtual channel 0 (CONTAINER_CHANNEL)
@@ -1204,10 +1204,10 @@ static void __devexit aac_remove_one(struct pci_dev *pdev)
1204 kfree(aac->queues); 1204 kfree(aac->queues);
1205 1205
1206 aac_adapter_ioremap(aac, 0); 1206 aac_adapter_ioremap(aac, 0);
1207 1207
1208 kfree(aac->fibs); 1208 kfree(aac->fibs);
1209 kfree(aac->fsa_dev); 1209 kfree(aac->fsa_dev);
1210 1210
1211 list_del(&aac->entry); 1211 list_del(&aac->entry);
1212 scsi_host_put(shost); 1212 scsi_host_put(shost);
1213 pci_disable_device(pdev); 1213 pci_disable_device(pdev);
@@ -1228,7 +1228,7 @@ static struct pci_driver aac_pci_driver = {
1228static int __init aac_init(void) 1228static int __init aac_init(void)
1229{ 1229{
1230 int error; 1230 int error;
1231 1231
1232 printk(KERN_INFO "Adaptec %s driver %s\n", 1232 printk(KERN_INFO "Adaptec %s driver %s\n",
1233 AAC_DRIVERNAME, aac_driver_version); 1233 AAC_DRIVERNAME, aac_driver_version);
1234 1234