diff options
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 243 | ||||
-rw-r--r-- | drivers/scsi/aacraid/aacraid.h | 310 | ||||
-rw-r--r-- | drivers/scsi/aacraid/commctrl.c | 80 | ||||
-rw-r--r-- | drivers/scsi/aacraid/commsup.c | 201 | ||||
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 88 |
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 @@ /* * Sense codes */ - -#define SENCODE_NO_SENSE 0x00 -#define SENCODE_END_OF_DATA 0x00 -#define SENCODE_BECOMING_READY 0x04 -#define SENCODE_INIT_CMD_REQUIRED 0x04 -#define SENCODE_PARAM_LIST_LENGTH_ERROR 0x1A -#define SENCODE_INVALID_COMMAND 0x20 -#define SENCODE_LBA_OUT_OF_RANGE 0x21 -#define SENCODE_INVALID_CDB_FIELD 0x24 -#define SENCODE_LUN_NOT_SUPPORTED 0x25 -#define SENCODE_INVALID_PARAM_FIELD 0x26 -#define SENCODE_PARAM_NOT_SUPPORTED 0x26 -#define SENCODE_PARAM_VALUE_INVALID 0x26 -#define SENCODE_RESET_OCCURRED 0x29 -#define SENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x3E -#define SENCODE_INQUIRY_DATA_CHANGED 0x3F -#define SENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x39 -#define SENCODE_DIAGNOSTIC_FAILURE 0x40 -#define SENCODE_INTERNAL_TARGET_FAILURE 0x44 -#define SENCODE_INVALID_MESSAGE_ERROR 0x49 -#define SENCODE_LUN_FAILED_SELF_CONFIG 0x4c -#define SENCODE_OVERLAPPED_COMMAND 0x4E + +#define SENCODE_NO_SENSE 0x00 +#define SENCODE_END_OF_DATA 0x00 +#define SENCODE_BECOMING_READY 0x04 +#define SENCODE_INIT_CMD_REQUIRED 0x04 +#define SENCODE_PARAM_LIST_LENGTH_ERROR 0x1A +#define SENCODE_INVALID_COMMAND 0x20 +#define SENCODE_LBA_OUT_OF_RANGE 0x21 +#define SENCODE_INVALID_CDB_FIELD 0x24 +#define SENCODE_LUN_NOT_SUPPORTED 0x25 +#define SENCODE_INVALID_PARAM_FIELD 0x26 +#define SENCODE_PARAM_NOT_SUPPORTED 0x26 +#define SENCODE_PARAM_VALUE_INVALID 0x26 +#define SENCODE_RESET_OCCURRED 0x29 +#define SENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x3E +#define SENCODE_INQUIRY_DATA_CHANGED 0x3F +#define SENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x39 +#define SENCODE_DIAGNOSTIC_FAILURE 0x40 +#define SENCODE_INTERNAL_TARGET_FAILURE 0x44 +#define SENCODE_INVALID_MESSAGE_ERROR 0x49 +#define SENCODE_LUN_FAILED_SELF_CONFIG 0x4c +#define SENCODE_OVERLAPPED_COMMAND 0x4E /* * Additional sense codes */ - -#define ASENCODE_NO_SENSE 0x00 -#define ASENCODE_END_OF_DATA 0x05 -#define ASENCODE_BECOMING_READY 0x01 -#define ASENCODE_INIT_CMD_REQUIRED 0x02 -#define ASENCODE_PARAM_LIST_LENGTH_ERROR 0x00 -#define ASENCODE_INVALID_COMMAND 0x00 -#define ASENCODE_LBA_OUT_OF_RANGE 0x00 -#define ASENCODE_INVALID_CDB_FIELD 0x00 -#define ASENCODE_LUN_NOT_SUPPORTED 0x00 -#define ASENCODE_INVALID_PARAM_FIELD 0x00 -#define ASENCODE_PARAM_NOT_SUPPORTED 0x01 -#define ASENCODE_PARAM_VALUE_INVALID 0x02 -#define ASENCODE_RESET_OCCURRED 0x00 -#define ASENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x00 -#define ASENCODE_INQUIRY_DATA_CHANGED 0x03 -#define ASENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x00 -#define ASENCODE_DIAGNOSTIC_FAILURE 0x80 -#define ASENCODE_INTERNAL_TARGET_FAILURE 0x00 -#define ASENCODE_INVALID_MESSAGE_ERROR 0x00 -#define ASENCODE_LUN_FAILED_SELF_CONFIG 0x00 -#define ASENCODE_OVERLAPPED_COMMAND 0x00 + +#define ASENCODE_NO_SENSE 0x00 +#define ASENCODE_END_OF_DATA 0x05 +#define ASENCODE_BECOMING_READY 0x01 +#define ASENCODE_INIT_CMD_REQUIRED 0x02 +#define ASENCODE_PARAM_LIST_LENGTH_ERROR 0x00 +#define ASENCODE_INVALID_COMMAND 0x00 +#define ASENCODE_LBA_OUT_OF_RANGE 0x00 +#define ASENCODE_INVALID_CDB_FIELD 0x00 +#define ASENCODE_LUN_NOT_SUPPORTED 0x00 +#define ASENCODE_INVALID_PARAM_FIELD 0x00 +#define ASENCODE_PARAM_NOT_SUPPORTED 0x01 +#define ASENCODE_PARAM_VALUE_INVALID 0x02 +#define ASENCODE_RESET_OCCURRED 0x00 +#define ASENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x00 +#define ASENCODE_INQUIRY_DATA_CHANGED 0x03 +#define ASENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x00 +#define ASENCODE_DIAGNOSTIC_FAILURE 0x80 +#define ASENCODE_INTERNAL_TARGET_FAILURE 0x00 +#define ASENCODE_INVALID_MESSAGE_ERROR 0x00 +#define ASENCODE_LUN_FAILED_SELF_CONFIG 0x00 +#define ASENCODE_OVERLAPPED_COMMAND 0x00 #define BYTE0(x) (unsigned char)(x) #define BYTE1(x) (unsigned char)((x) >> 8) @@ -115,8 +115,8 @@ *----------------------------------------------------------------------------*/ /* SCSI inquiry data */ struct inquiry_data { - u8 inqd_pdt; /* Peripheral qualifier | Peripheral Device Type */ - u8 inqd_dtq; /* RMB | Device Type Qualifier */ + u8 inqd_pdt; /* Peripheral qualifier | Peripheral Device Type */ + u8 inqd_dtq; /* RMB | Device Type Qualifier */ u8 inqd_ver; /* ISO version | ECMA version | ANSI-approved version */ u8 inqd_rdf; /* AENC | TrmIOP | Response data format */ u8 inqd_len; /* Additional length (n-4) */ @@ -130,7 +130,7 @@ struct inquiry_data { /* * M O D U L E G L O B A L S */ - + static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); @@ -141,8 +141,8 @@ static char *aac_get_status_string(u32 status); /* * Non dasd selection is handled entirely in aachba now - */ - + */ + static int nondasd = -1; static int aac_cache = 0; static int dacmode = -1; @@ -196,12 +196,12 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd, struct fib *fibptr) { struct scsi_device *device; - if (unlikely(!scsicmd || !scsicmd->scsi_done )) { + if (unlikely(!scsicmd || !scsicmd->scsi_done)) { dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n")); - aac_fib_complete(fibptr); - aac_fib_free(fibptr); - return 0; - } + aac_fib_complete(fibptr); + aac_fib_free(fibptr); + return 0; + } scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; device = scsicmd->device; if (unlikely(!device || !scsi_device_online(device))) { @@ -243,7 +243,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) FsaNormal, 1, 1, NULL, NULL); - if (status < 0 ) { + if (status < 0) { printk(KERN_WARNING "aac_get_config_status: SendFIB failed.\n"); } else { struct aac_get_config_status_resp *reply @@ -267,10 +267,10 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) struct aac_commit_config * dinfo; aac_fib_init(fibptr); dinfo = (struct aac_commit_config *) fib_data(fibptr); - + dinfo->command = cpu_to_le32(VM_ContainerConfig); dinfo->type = cpu_to_le32(CT_COMMIT_CONFIG); - + status = aac_fib_send(ContainerCommand, fibptr, sizeof (struct aac_commit_config), @@ -296,7 +296,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) int aac_get_containers(struct aac_dev *dev) { struct fsa_dev_info *fsa_dev_ptr; - u32 index; + u32 index; int status = 0; struct fib * fibptr; struct aac_get_container_count *dinfo; @@ -399,7 +399,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr) do { *dp++ = (*sp) ? *sp++ : ' '; } while (--count > 0); - aac_internal_transfer(scsicmd, d, + aac_internal_transfer(scsicmd, d, offsetof(struct inquiry_data, inqd_pid), sizeof(d)); } } @@ -435,13 +435,13 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd) dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data)); status = aac_fib_send(ContainerCommand, - cmd_fibcontext, + cmd_fibcontext, sizeof (struct aac_get_name), - FsaNormal, - 0, 1, - (fib_callback) get_container_name_callback, + FsaNormal, + 0, 1, + (fib_callback)get_container_name_callback, (void *) scsicmd); - + /* * Check that the command queued to the controller */ @@ -449,7 +449,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd) scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; return 0; } - + printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status); aac_fib_complete(cmd_fibcontext); aac_fib_free(cmd_fibcontext); @@ -656,39 +656,39 @@ struct scsi_inq { * @a: string to copy from * @b: string to copy to * - * Copy a String from one location to another + * Copy a String from one location to another * without copying \0 */ static void inqstrcpy(char *a, char *b) { - while(*a != (char)0) + while (*a != (char)0) *b++ = *a++; } static char *container_types[] = { - "None", - "Volume", - "Mirror", - "Stripe", - "RAID5", - "SSRW", - "SSRO", - "Morph", - "Legacy", - "RAID4", - "RAID10", - "RAID00", - "V-MIRRORS", - "PSEUDO R4", + "None", + "Volume", + "Mirror", + "Stripe", + "RAID5", + "SSRW", + "SSRO", + "Morph", + "Legacy", + "RAID4", + "RAID10", + "RAID00", + "V-MIRRORS", + "PSEUDO R4", "RAID50", "RAID5D", "RAID5D0", "RAID1E", "RAID6", "RAID60", - "Unknown" + "Unknown" }; char * get_container_type(unsigned tindex) @@ -1230,11 +1230,11 @@ int aac_get_adapter_info(struct aac_dev* dev) memset(info,0,sizeof(*info)); rcode = aac_fib_send(RequestAdapterInfo, - fibptr, + fibptr, sizeof(*info), - FsaNormal, + FsaNormal, -1, 1, /* First `interrupt' command uses special wait */ - NULL, + NULL, NULL); if (rcode < 0) { @@ -1266,8 +1266,8 @@ int aac_get_adapter_info(struct aac_dev* dev) } - /* - * GetBusInfo + /* + * GetBusInfo */ aac_fib_init(fibptr); @@ -1301,7 +1301,7 @@ int aac_get_adapter_info(struct aac_dev* dev) char buffer[16]; tmp = le32_to_cpu(dev->adapter_info.kernelrev); printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n", - dev->name, + dev->name, dev->id, tmp>>24, (tmp>>16)&0xff, @@ -1363,7 +1363,7 @@ int aac_get_adapter_info(struct aac_dev* dev) if (dev->raid_scsi_mode != 0) printk(KERN_INFO "%s%d: ROMB RAID/SCSI mode enabled\n", dev->name, dev->id); - + if (nondasd != -1) dev->nondasd_support = (nondasd!=0); if(dev->nondasd_support != 0) { @@ -1395,7 +1395,7 @@ int aac_get_adapter_info(struct aac_dev* dev) rcode = -ENOMEM; } } - /* + /* * Deal with configuring for the individualized limits of each packet * interface. */ @@ -1419,8 +1419,8 @@ int aac_get_adapter_info(struct aac_dev* dev) if (dev->dac_support) { dev->a_ops.adapter_read = aac_read_block64; dev->a_ops.adapter_write = aac_write_block64; - /* - * 38 scatter gather elements + /* + * 38 scatter gather elements */ dev->scsi_host_ptr->sg_tablesize = (dev->max_fib_size - @@ -1549,7 +1549,7 @@ static int aac_read(struct scsi_cmnd * scsicmd) case READ_6: dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", scmd_id(scsicmd))); - lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | + lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; count = scsicmd->cmnd[4]; @@ -1559,32 +1559,32 @@ static int aac_read(struct scsi_cmnd * scsicmd) case READ_16: dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", scmd_id(scsicmd))); - lba = ((u64)scsicmd->cmnd[2] << 56) | - ((u64)scsicmd->cmnd[3] << 48) | + lba = ((u64)scsicmd->cmnd[2] << 56) | + ((u64)scsicmd->cmnd[3] << 48) | ((u64)scsicmd->cmnd[4] << 40) | ((u64)scsicmd->cmnd[5] << 32) | - ((u64)scsicmd->cmnd[6] << 24) | + ((u64)scsicmd->cmnd[6] << 24) | (scsicmd->cmnd[7] << 16) | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; - count = (scsicmd->cmnd[10] << 24) | + count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) | (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; break; case READ_12: dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", scmd_id(scsicmd))); - lba = ((u64)scsicmd->cmnd[2] << 24) | + lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | - (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; - count = (scsicmd->cmnd[6] << 24) | + (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; + count = (scsicmd->cmnd[6] << 24) | (scsicmd->cmnd[7] << 16) | - (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; + (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; break; default: dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", scmd_id(scsicmd))); - lba = ((u64)scsicmd->cmnd[2] << 24) | - (scsicmd->cmnd[3] << 16) | + lba = ((u64)scsicmd->cmnd[2] << 24) | + (scsicmd->cmnd[3] << 16) | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; break; @@ -1609,7 +1609,7 @@ static int aac_read(struct scsi_cmnd * scsicmd) scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; return 0; } - + printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status); /* * For some reason, the Fib didn't queue, return QUEUE_FULL @@ -1644,11 +1644,11 @@ static int aac_write(struct scsi_cmnd * scsicmd) } else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */ dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", scmd_id(scsicmd))); - lba = ((u64)scsicmd->cmnd[2] << 56) | + lba = ((u64)scsicmd->cmnd[2] << 56) | ((u64)scsicmd->cmnd[3] << 48) | ((u64)scsicmd->cmnd[4] << 40) | ((u64)scsicmd->cmnd[5] << 32) | - ((u64)scsicmd->cmnd[6] << 24) | + ((u64)scsicmd->cmnd[6] << 24) | (scsicmd->cmnd[7] << 16) | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) | @@ -1875,14 +1875,14 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd) * Emulate a SCSI command and queue the required request for the * aacraid firmware. */ - + int aac_scsi_cmd(struct scsi_cmnd * scsicmd) { u32 cid; struct Scsi_Host *host = scsicmd->device->host; struct aac_dev *dev = (struct aac_dev *)host->hostdata; struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; - + if (fsa_dev_ptr == NULL) return -1; /* @@ -1938,7 +1938,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) * else Command for the controller itself */ else if ((scsicmd->cmnd[0] != INQUIRY) && /* only INQUIRY & TUR cmnd supported for controller */ - (scsicmd->cmnd[0] != TEST_UNIT_READY)) + (scsicmd->cmnd[0] != TEST_UNIT_READY)) { dprintk((KERN_WARNING "Only INQUIRY & TUR command supported for controller, rcvd = 0x%x.\n", scsicmd->cmnd[0])); scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; @@ -1963,7 +1963,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", cid)); memset(&inq_data, 0, sizeof (struct inquiry_data)); - if (scsicmd->cmnd[1] & 0x1 ) { + if (scsicmd->cmnd[1] & 0x1) { char *arr = (char *)&inq_data; /* EVPD bit set */ @@ -2204,7 +2204,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) return 0; } - switch (scsicmd->cmnd[0]) + switch (scsicmd->cmnd[0]) { case READ_6: case READ_10: @@ -2217,11 +2217,11 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) * corresponds to a container. Needed to convert * containers to /dev/sd device names */ - + if (scsicmd->request->rq_disk) strlcpy(fsa_dev_ptr[cid].devname, scsicmd->request->rq_disk->disk_name, - min(sizeof(fsa_dev_ptr[cid].devname), + min(sizeof(fsa_dev_ptr[cid].devname), sizeof(scsicmd->request->rq_disk->disk_name) + 1)); return aac_read(scsicmd); @@ -2275,7 +2275,7 @@ static int query_disk(struct aac_dev *dev, void __user *arg) return -EFAULT; if (qd.cnum == -1) qd.cnum = qd.id; - else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) + else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) { if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers) return -EINVAL; @@ -2402,7 +2402,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */ /* - * Calculate resid for sg + * Calculate resid for sg */ scsi_set_resid(scsicmd, scsi_bufflen(scsicmd) @@ -2442,7 +2442,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) case WRITE_12: case READ_16: case WRITE_16: - if(le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow ) { + if (le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow) { printk(KERN_WARNING"aacraid: SCSI CMD underflow\n"); } else { printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n"); @@ -2511,14 +2511,14 @@ static void aac_srb_callback(void *context, struct fib * fibptr) printk("aacraid: SRB ERROR(%u) %s scsi cmd 0x%x - scsi status 0x%x\n", le32_to_cpu(srbreply->srb_status) & 0x3F, aac_get_status_string( - le32_to_cpu(srbreply->srb_status) & 0x3F), - scsicmd->cmnd[0], + le32_to_cpu(srbreply->srb_status) & 0x3F), + scsicmd->cmnd[0], le32_to_cpu(srbreply->scsi_status)); #endif scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8; break; } - if (le32_to_cpu(srbreply->scsi_status) == 0x02 ){ // Check Condition + if (le32_to_cpu(srbreply->scsi_status) == SAM_STAT_CHECK_CONDITION) { int len; scsicmd->result |= SAM_STAT_CHECK_CONDITION; 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) le32_to_cpu(srbreply->status), len); #endif memcpy(scsicmd->sense_buffer, srbreply->sense_data, len); - } /* * OR in the scsi status (already shifted up a bit) @@ -2545,7 +2544,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) * aac_send_scb_fib * @scsicmd: the scsi command block * - * This routine will form a FIB and fill in the aac_srb from the + * This routine will form a FIB and fill in the aac_srb from the * scsicmd passed in. */ @@ -2759,7 +2758,7 @@ static struct aac_srb_status_info srb_status_info[] = { { SRB_STATUS_ERROR_RECOVERY, "Error Recovery"}, { SRB_STATUS_NOT_STARTED, "Not Started"}, { SRB_STATUS_NOT_IN_USE, "Not In Use"}, - { SRB_STATUS_FORCE_ABORT, "Force Abort"}, + { SRB_STATUS_FORCE_ABORT, "Force Abort"}, { SRB_STATUS_DOMAIN_VALIDATION_FAIL,"Domain Validation Failure"}, { 0xff, "Unknown Error"} }; 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 @@ -#if (!defined(dprintk)) +#ifndef dprintk # define dprintk(x) #endif /* eg: if (nblank(dprintk(x))) */ @@ -50,9 +50,9 @@ struct diskparm /* * Firmware constants */ - + #define CT_NONE 0 -#define CT_OK 218 +#define CT_OK 218 #define FT_FILESYS 8 /* ADAPTEC's "FSA"(tm) filesystem */ #define FT_DRIVE 9 /* physical disk - addressable in scsi by bus/id/lun */ @@ -107,12 +107,12 @@ struct user_sgentryraw { struct sgmap { __le32 count; - struct sgentry sg[1]; + struct sgentry sg[1]; }; struct user_sgmap { u32 count; - struct user_sgentry sg[1]; + struct user_sgentry sg[1]; }; struct sgmap64 { @@ -137,18 +137,18 @@ struct user_sgmapraw { struct creation_info { - u8 buildnum; /* e.g., 588 */ - u8 usec; /* e.g., 588 */ - u8 via; /* e.g., 1 = FSU, - * 2 = API + u8 buildnum; /* e.g., 588 */ + u8 usec; /* e.g., 588 */ + u8 via; /* e.g., 1 = FSU, + * 2 = API */ - u8 year; /* e.g., 1997 = 97 */ + u8 year; /* e.g., 1997 = 97 */ __le32 date; /* - * unsigned Month :4; // 1 - 12 - * unsigned Day :6; // 1 - 32 - * unsigned Hour :6; // 0 - 23 - * unsigned Minute :6; // 0 - 60 - * unsigned Second :6; // 0 - 60 + * unsigned Month :4; // 1 - 12 + * unsigned Day :6; // 1 - 32 + * unsigned Hour :6; // 0 - 23 + * unsigned Minute :6; // 0 - 60 + * unsigned Second :6; // 0 - 60 */ __le32 serial[2]; /* e.g., 0x1DEADB0BFAFAF001 */ }; @@ -184,7 +184,7 @@ struct creation_info /* * Set the queues on a 16 byte alignment */ - + #define QUEUE_ALIGNMENT 16 /* @@ -203,9 +203,9 @@ struct aac_entry { * The adapter assumes the ProducerIndex and ConsumerIndex are grouped * adjacently and in that order. */ - + struct aac_qhdr { - __le64 header_addr;/* Address to hand the adapter to access + __le64 header_addr;/* Address to hand the adapter to access to this queue head */ __le32 *producer; /* The producer index for this queue (host address) */ __le32 *consumer; /* The consumer index for this queue (host address) */ @@ -215,7 +215,7 @@ struct aac_qhdr { * Define all the events which the adapter would like to notify * the host of. */ - + #define HostNormCmdQue 1 /* Change in host normal priority command queue */ #define HostHighCmdQue 2 /* Change in host high priority command queue */ #define HostNormRespQue 3 /* Change in host normal priority response queue */ @@ -286,17 +286,17 @@ struct aac_fibhdr { u8 StructType; /* Type FIB */ u8 Flags; /* Flags for FIB */ __le16 Size; /* Size of this FIB in bytes */ - __le16 SenderSize; /* Size of the FIB in the sender + __le16 SenderSize; /* Size of the FIB in the sender (for response sizing) */ __le32 SenderFibAddress; /* Host defined data in the FIB */ - __le32 ReceiverFibAddress;/* Logical address of this FIB for + __le32 ReceiverFibAddress;/* Logical address of this FIB for the adapter */ u32 SenderData; /* Place holder for the sender to store data */ union { struct { - __le32 _ReceiverTimeStart; /* Timestamp for + __le32 _ReceiverTimeStart; /* Timestamp for receipt of fib */ - __le32 _ReceiverTimeDone; /* Timestamp for + __le32 _ReceiverTimeDone; /* Timestamp for completion of fib */ } _s; } _u; @@ -311,7 +311,7 @@ struct hw_fib { * FIB commands */ -#define TestCommandResponse 1 +#define TestCommandResponse 1 #define TestAdapterCommand 2 /* * Lowlevel and comm commands @@ -350,10 +350,6 @@ struct hw_fib { #define ContainerCommand64 501 #define ContainerRawIo 502 /* - * Cluster Commands - */ -#define ClusterCommand 550 -/* * Scsi Port commands (scsi passthrough) */ #define ScsiPortCommand 600 @@ -375,19 +371,19 @@ struct hw_fib { */ enum fib_xfer_state { - HostOwned = (1<<0), - AdapterOwned = (1<<1), - FibInitialized = (1<<2), - FibEmpty = (1<<3), - AllocatedFromPool = (1<<4), - SentFromHost = (1<<5), - SentFromAdapter = (1<<6), - ResponseExpected = (1<<7), - NoResponseExpected = (1<<8), - AdapterProcessed = (1<<9), - HostProcessed = (1<<10), - HighPriority = (1<<11), - NormalPriority = (1<<12), + HostOwned = (1<<0), + AdapterOwned = (1<<1), + FibInitialized = (1<<2), + FibEmpty = (1<<3), + AllocatedFromPool = (1<<4), + SentFromHost = (1<<5), + SentFromAdapter = (1<<6), + ResponseExpected = (1<<7), + NoResponseExpected = (1<<8), + AdapterProcessed = (1<<9), + HostProcessed = (1<<10), + HighPriority = (1<<11), + NormalPriority = (1<<12), Async = (1<<13), AsyncIo = (1<<13), // rpbfix: remove with new regime PageFileIo = (1<<14), // rpbfix: remove with new regime @@ -420,7 +416,7 @@ struct aac_init __le32 AdapterFibAlign; __le32 printfbuf; __le32 printfbufsiz; - __le32 HostPhysMemPages; /* number of 4k pages of host + __le32 HostPhysMemPages; /* number of 4k pages of host physical memory */ __le32 HostElapsedSeconds; /* number of seconds since 1970. */ /* @@ -481,7 +477,7 @@ struct adapter_ops struct aac_driver_ident { - int (*init)(struct aac_dev *dev); + int (*init)(struct aac_dev *dev); char * name; char * vname; char * model; @@ -489,7 +485,7 @@ struct aac_driver_ident int quirks; }; /* - * Some adapter firmware needs communication memory + * Some adapter firmware needs communication memory * below 2gig. This tells the init function to set the * dma mask such that fib memory will be allocated where the * adapter firmware can get to it. @@ -531,29 +527,29 @@ struct aac_driver_ident * physically contigous block. The host structure that defines the * commuication queues will assume they are each a separate physically * contigous memory region that will support them all being one big - * contigous block. + * contigous block. * There is a command and response queue for each level and direction of * commuication. These regions are accessed by both the host and adapter. */ - + struct aac_queue { - u64 logical; /*address we give the adapter */ + u64 logical; /*address we give the adapter */ struct aac_entry *base; /*system virtual address */ - struct aac_qhdr headers; /*producer,consumer q headers*/ - u32 entries; /*Number of queue entries */ + struct aac_qhdr headers; /*producer,consumer q headers*/ + u32 entries; /*Number of queue entries */ wait_queue_head_t qfull; /*Event to wait on if q full */ wait_queue_head_t cmdready; /*Cmd ready from the adapter */ - /* This is only valid for adapter to host command queues. */ - spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */ + /* This is only valid for adapter to host command queues. */ + spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */ spinlock_t lockdata; /* Actual lock (used only on one side of the lock) */ - struct list_head cmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */ - /* only valid for command queues which receive entries from the adapter. */ + struct list_head cmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */ + /* only valid for command queues which receive entries from the adapter. */ u32 numpending; /* Number of entries on outstanding queue. */ struct aac_dev * dev; /* Back pointer to adapter structure */ }; /* - * Message queues. The order here is important, see also the + * Message queues. The order here is important, see also the * queue type ordering */ @@ -565,12 +561,12 @@ struct aac_queue_block /* * SaP1 Message Unit Registers */ - + struct sa_drawbridge_CSR { - /* Offset | Name */ + /* Offset | Name */ __le32 reserved[10]; /* 00h-27h | Reserved */ u8 LUT_Offset; /* 28h | Lookup Table Offset */ - u8 reserved1[3]; /* 29h-2bh | Reserved */ + u8 reserved1[3]; /* 29h-2bh | Reserved */ __le32 LUT_Data; /* 2ch | Looup Table Data */ __le32 reserved2[26]; /* 30h-97h | Reserved */ __le16 PRICLEARIRQ; /* 98h | Primary Clear Irq */ @@ -589,8 +585,8 @@ struct sa_drawbridge_CSR { __le32 MAILBOX5; /* bch | Scratchpad 5 */ __le32 MAILBOX6; /* c0h | Scratchpad 6 */ __le32 MAILBOX7; /* c4h | Scratchpad 7 */ - __le32 ROM_Setup_Data; /* c8h | Rom Setup and Data */ - __le32 ROM_Control_Addr;/* cch | Rom Control and Address */ + __le32 ROM_Setup_Data; /* c8h | Rom Setup and Data */ + __le32 ROM_Control_Addr;/* cch | Rom Control and Address */ __le32 reserved3[12]; /* d0h-ffh | reserved */ __le32 LUT[64]; /* 100h-1ffh | Lookup Table Entries */ }; @@ -603,7 +599,7 @@ struct sa_drawbridge_CSR { #define Mailbox5 SaDbCSR.MAILBOX5 #define Mailbox6 SaDbCSR.MAILBOX6 #define Mailbox7 SaDbCSR.MAILBOX7 - + #define DoorbellReg_p SaDbCSR.PRISETIRQ #define DoorbellReg_s SaDbCSR.SECSETIRQ #define DoorbellClrReg_p SaDbCSR.PRICLEARIRQ @@ -617,19 +613,19 @@ struct sa_drawbridge_CSR { #define DOORBELL_5 0x0020 #define DOORBELL_6 0x0040 - + #define PrintfReady DOORBELL_5 #define PrintfDone DOORBELL_5 - + struct sa_registers { struct sa_drawbridge_CSR SaDbCSR; /* 98h - c4h */ }; - + #define Sa_MINIPORT_REVISION 1 #define sa_readw(AEP, CSR) readl(&((AEP)->regs.sa->CSR)) -#define sa_readl(AEP, CSR) readl(&((AEP)->regs.sa->CSR)) +#define sa_readl(AEP, CSR) readl(&((AEP)->regs.sa->CSR)) #define sa_writew(AEP, CSR, value) writew(value, &((AEP)->regs.sa->CSR)) #define sa_writel(AEP, CSR, value) writel(value, &((AEP)->regs.sa->CSR)) @@ -646,21 +642,21 @@ struct rx_mu_registers { __le32 IMRx[2]; /* 1310h | 10h | Inbound Message Registers */ __le32 OMRx[2]; /* 1318h | 18h | Outbound Message Registers */ __le32 IDR; /* 1320h | 20h | Inbound Doorbell Register */ - __le32 IISR; /* 1324h | 24h | Inbound Interrupt + __le32 IISR; /* 1324h | 24h | Inbound Interrupt Status Register */ - __le32 IIMR; /* 1328h | 28h | Inbound Interrupt - Mask Register */ + __le32 IIMR; /* 1328h | 28h | Inbound Interrupt + Mask Register */ __le32 ODR; /* 132Ch | 2Ch | Outbound Doorbell Register */ - __le32 OISR; /* 1330h | 30h | Outbound Interrupt + __le32 OISR; /* 1330h | 30h | Outbound Interrupt Status Register */ - __le32 OIMR; /* 1334h | 34h | Outbound Interrupt + __le32 OIMR; /* 1334h | 34h | Outbound Interrupt Mask Register */ __le32 reserved2; /* 1338h | 38h | Reserved */ __le32 reserved3; /* 133Ch | 3Ch | Reserved */ __le32 InboundQueue;/* 1340h | 40h | Inbound Queue Port relative to firmware */ __le32 OutboundQueue;/*1344h | 44h | Outbound Queue Port relative to firmware */ - /* * Must access through ATU Inbound - Translation Window */ + /* * Must access through ATU Inbound + Translation Window */ }; struct rx_inbound { @@ -716,12 +712,12 @@ struct rkt_registers { typedef void (*fib_callback)(void *ctxt, struct fib *fibctx); struct aac_fib_context { - s16 type; // used for verification of structure - s16 size; + s16 type; // used for verification of structure + s16 size; u32 unique; // unique value representing this context ulong jiffies; // used for cleanup - dmb changed to ulong struct list_head next; // used to link context's into a linked list - struct semaphore wait_sem; // this is used to wait for the next fib to arrive. + struct semaphore wait_sem; // this is used to wait for the next fib to arrive. int wait; // Set to true when thread is in WaitForSingleObject unsigned long count; // total number of FIBs on FibList struct list_head fib_list; // this holds fibs and their attachd hw_fibs @@ -740,9 +736,9 @@ struct sense_data { u8 EOM:1; /* End Of Medium - reserved for random access devices */ u8 filemark:1; /* Filemark - reserved for random access devices */ - u8 information[4]; /* for direct-access devices, contains the unsigned - * logical block address or residue associated with - * the sense key + u8 information[4]; /* for direct-access devices, contains the unsigned + * logical block address or residue associated with + * the sense key */ u8 add_sense_len; /* number of additional sense bytes to follow this field */ u8 cmnd_info[4]; /* not used */ @@ -752,7 +748,7 @@ struct sense_data { u8 bit_ptr:3; /* indicates which byte of the CDB or parameter data * was in error */ - u8 BPV:1; /* bit pointer valid (BPV): 1- indicates that + u8 BPV:1; /* bit pointer valid (BPV): 1- indicates that * the bit_ptr field has valid value */ u8 reserved2:2; @@ -786,24 +782,24 @@ struct fib { /* * The Adapter that this I/O is destined for. */ - struct aac_dev *dev; + struct aac_dev *dev; /* * This is the event the sendfib routine will wait on if the * caller did not pass one and this is synch io. */ - struct semaphore event_wait; + struct semaphore event_wait; spinlock_t event_lock; u32 done; /* gets set to 1 when fib is complete */ - fib_callback callback; - void *callback_data; + fib_callback callback; + void *callback_data; u32 flags; // u32 dmb was ulong /* * And for the internal issue/reply queues (we may be able * to merge these two) */ struct list_head fiblink; - void *data; + void *data; struct hw_fib *hw_fib_va; /* Actual shared object */ dma_addr_t hw_fib_pa; /* physical address of hw_fib*/ }; @@ -813,7 +809,7 @@ struct fib { * * This is returned by the RequestAdapterInfo block */ - + struct aac_adapter_info { __le32 platform; @@ -832,7 +828,7 @@ struct aac_adapter_info __le32 biosrev; __le32 biosbuild; __le32 cluster; - __le32 clusterchannelmask; + __le32 clusterchannelmask; __le32 serial[2]; __le32 battery; __le32 options; @@ -922,13 +918,13 @@ struct aac_bus_info_response { #define AAC_OPT_HOST_TIME_FIB cpu_to_le32(1<<4) #define AAC_OPT_RAID50 cpu_to_le32(1<<5) #define AAC_OPT_4GB_WINDOW cpu_to_le32(1<<6) -#define AAC_OPT_SCSI_UPGRADEABLE cpu_to_le32(1<<7) +#define AAC_OPT_SCSI_UPGRADEABLE cpu_to_le32(1<<7) #define AAC_OPT_SOFT_ERR_REPORT cpu_to_le32(1<<8) -#define AAC_OPT_SUPPORTED_RECONDITION cpu_to_le32(1<<9) +#define AAC_OPT_SUPPORTED_RECONDITION cpu_to_le32(1<<9) #define AAC_OPT_SGMAP_HOST64 cpu_to_le32(1<<10) #define AAC_OPT_ALARM cpu_to_le32(1<<11) #define AAC_OPT_NONDASD cpu_to_le32(1<<12) -#define AAC_OPT_SCSI_MANAGED cpu_to_le32(1<<13) +#define AAC_OPT_SCSI_MANAGED cpu_to_le32(1<<13) #define AAC_OPT_RAID_SCSI_MODE cpu_to_le32(1<<14) #define AAC_OPT_SUPPLEMENT_ADAPTER_INFO cpu_to_le32(1<<16) #define AAC_OPT_NEW_COMM cpu_to_le32(1<<17) @@ -948,7 +944,7 @@ struct aac_dev /* * Map for 128 fib objects (64k) - */ + */ dma_addr_t hw_fib_pa; struct hw_fib *hw_fib_va; struct hw_fib *aif_base_va; @@ -959,24 +955,24 @@ struct aac_dev struct fib *free_fib; spinlock_t fib_lock; - + struct aac_queue_block *queues; /* * The user API will use an IOCTL to register itself to receive * FIBs from the adapter. The following list is used to keep * track of all the threads that have requested these FIBs. The - * mutex is used to synchronize access to all data associated + * mutex is used to synchronize access to all data associated * with the adapter fibs. */ struct list_head fib_list; struct adapter_ops a_ops; unsigned long fsrev; /* Main driver's revision number */ - + unsigned base_size; /* Size of mapped in region */ struct aac_init *init; /* Holds initialization info to communicate with adapter */ - dma_addr_t init_pa; /* Holds physical address of the init struct */ - + dma_addr_t init_pa; /* Holds physical address of the init struct */ + struct pci_dev *pdev; /* Our PCI interface */ void * printfbuf; /* pointer to buffer used for printf's from the adapter */ void * comm_addr; /* Base address of Comm area */ @@ -990,11 +986,11 @@ struct aac_dev struct fsa_dev_info *fsa_dev; struct task_struct *thread; int cardtype; - + /* * The following is the device specific extension. */ -#if (!defined(AAC_MIN_FOOTPRINT_SIZE)) +#ifndef AAC_MIN_FOOTPRINT_SIZE # define AAC_MIN_FOOTPRINT_SIZE 8192 #endif union @@ -1015,7 +1011,7 @@ struct aac_dev /* These are in adapter info but they are in the io flow so * lets break them out so we don't have to do an AND to check them */ - u8 nondasd_support; + u8 nondasd_support; u8 cache_protected; u8 dac_support; u8 raid_scsi_mode; @@ -1078,14 +1074,14 @@ struct aac_dev /* * Define the command values */ - + #define Null 0 -#define GetAttributes 1 -#define SetAttributes 2 -#define Lookup 3 -#define ReadLink 4 -#define Read 5 -#define Write 6 +#define GetAttributes 1 +#define SetAttributes 2 +#define Lookup 3 +#define ReadLink 4 +#define Read 5 +#define Write 6 #define Create 7 #define MakeDirectory 8 #define SymbolicLink 9 @@ -1181,19 +1177,19 @@ struct aac_dev struct aac_read { - __le32 command; - __le32 cid; - __le32 block; - __le32 count; + __le32 command; + __le32 cid; + __le32 block; + __le32 count; struct sgmap sg; // Must be last in struct because it is variable }; struct aac_read64 { - __le32 command; - __le16 cid; - __le16 sector_count; - __le32 block; + __le32 command; + __le16 cid; + __le16 sector_count; + __le32 block; __le16 pad; __le16 flags; struct sgmap64 sg; // Must be last in struct because it is variable @@ -1201,26 +1197,26 @@ struct aac_read64 struct aac_read_reply { - __le32 status; - __le32 count; + __le32 status; + __le32 count; }; struct aac_write { __le32 command; - __le32 cid; - __le32 block; - __le32 count; - __le32 stable; // Not used + __le32 cid; + __le32 block; + __le32 count; + __le32 stable; // Not used struct sgmap sg; // Must be last in struct because it is variable }; struct aac_write64 { - __le32 command; - __le16 cid; - __le16 sector_count; - __le32 block; + __le32 command; + __le16 cid; + __le16 sector_count; + __le32 block; __le16 pad; __le16 flags; #define IO_TYPE_WRITE 0x00000000 @@ -1231,7 +1227,7 @@ struct aac_write64 struct aac_write_reply { __le32 status; - __le32 count; + __le32 count; __le32 committed; }; @@ -1334,10 +1330,10 @@ struct aac_srb_reply #define SRB_NoDataXfer 0x0000 #define SRB_DisableDisconnect 0x0004 #define SRB_DisableSynchTransfer 0x0008 -#define SRB_BypassFrozenQueue 0x0010 +#define SRB_BypassFrozenQueue 0x0010 #define SRB_DisableAutosense 0x0020 #define SRB_DataIn 0x0040 -#define SRB_DataOut 0x0080 +#define SRB_DataOut 0x0080 /* * SRB Functions - set in aac_srb->function @@ -1360,7 +1356,7 @@ struct aac_srb_reply #define SRBF_RemoveDevice 0x0016 #define SRBF_DomainValidation 0x0017 -/* +/* * SRB SCSI Status - set in aac_srb->scsi_status */ #define SRB_STATUS_PENDING 0x00 @@ -1519,17 +1515,17 @@ struct aac_get_container_count_resp { */ struct aac_mntent { - __le32 oid; + __le32 oid; u8 name[16]; /* if applicable */ struct creation_info create_info; /* if applicable */ __le32 capacity; - __le32 vol; /* substrate structure */ - __le32 obj; /* FT_FILESYS, etc. */ - __le32 state; /* unready for mounting, + __le32 vol; /* substrate structure */ + __le32 obj; /* FT_FILESYS, etc. */ + __le32 state; /* unready for mounting, readonly, etc. */ - union aac_contentinfo fileinfo; /* Info specific to content + union aac_contentinfo fileinfo; /* Info specific to content manager (eg, filesystem) */ - __le32 altoid; /* != oid <==> snapshot or + __le32 altoid; /* != oid <==> snapshot or broken mirror exists */ __le32 capacityhigh; }; @@ -1546,7 +1542,7 @@ struct aac_query_mount { struct aac_mount { __le32 status; - __le32 type; /* should be same as that requested */ + __le32 type; /* should be same as that requested */ __le32 count; struct aac_mntent mnt[1]; }; @@ -1616,7 +1612,7 @@ struct aac_delete_disk { u32 disknum; u32 cnum; }; - + struct fib_ioctl { u32 fibctx; @@ -1630,10 +1626,10 @@ struct revision __le32 version; __le32 build; }; - + /* - * Ugly - non Linux like ioctl coding for back compat. + * Ugly - non Linux like ioctl coding for back compat. */ #define CTL_CODE(function, method) ( \ @@ -1641,7 +1637,7 @@ struct revision ) /* - * Define the method codes for how buffers are passed for I/O and FS + * Define the method codes for how buffers are passed for I/O and FS * controls */ @@ -1652,15 +1648,15 @@ struct revision * Filesystem ioctls */ -#define FSACTL_SENDFIB CTL_CODE(2050, METHOD_BUFFERED) -#define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED) +#define FSACTL_SENDFIB CTL_CODE(2050, METHOD_BUFFERED) +#define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED) #define FSACTL_DELETE_DISK 0x163 #define FSACTL_QUERY_DISK 0x173 #define FSACTL_OPEN_GET_ADAPTER_FIB CTL_CODE(2100, METHOD_BUFFERED) #define FSACTL_GET_NEXT_ADAPTER_FIB CTL_CODE(2101, METHOD_BUFFERED) #define FSACTL_CLOSE_GET_ADAPTER_FIB CTL_CODE(2102, METHOD_BUFFERED) #define FSACTL_MINIPORT_REV_CHECK CTL_CODE(2107, METHOD_BUFFERED) -#define FSACTL_GET_PCI_INFO CTL_CODE(2119, METHOD_BUFFERED) +#define FSACTL_GET_PCI_INFO CTL_CODE(2119, METHOD_BUFFERED) #define FSACTL_FORCE_DELETE_DISK CTL_CODE(2120, METHOD_NEITHER) #define FSACTL_GET_CONTAINERS 2131 #define FSACTL_SEND_LARGE_FIB CTL_CODE(2138, METHOD_BUFFERED) @@ -1669,7 +1665,7 @@ struct revision struct aac_common { /* - * If this value is set to 1 then interrupt moderation will occur + * If this value is set to 1 then interrupt moderation will occur * in the base commuication support. */ u32 irq_mod; @@ -1698,11 +1694,11 @@ extern struct aac_common aac_config; * The following macro is used when sending and receiving FIBs. It is * only used for debugging. */ - + #ifdef DBG #define FIB_COUNTER_INCREMENT(counter) (counter)++ #else -#define FIB_COUNTER_INCREMENT(counter) +#define FIB_COUNTER_INCREMENT(counter) #endif /* @@ -1734,17 +1730,17 @@ extern struct aac_common aac_config; * * The adapter reports is present state through the phase. Only * a single phase should be ever be set. Each phase can have multiple - * phase status bits to provide more detailed information about the - * state of the board. Care should be taken to ensure that any phase + * phase status bits to provide more detailed information about the + * state of the board. Care should be taken to ensure that any phase * status bits that are set when changing the phase are also valid * for the new phase or be cleared out. Adapter software (monitor, - * iflash, kernel) is responsible for properly maintining the phase + * iflash, kernel) is responsible for properly maintining the phase * status mailbox when it is running. - * - * MONKER_API Phases * - * Phases are bit oriented. It is NOT valid to have multiple bits set - */ + * MONKER_API Phases + * + * Phases are bit oriented. It is NOT valid to have multiple bits set + */ #define SELF_TEST_FAILED 0x00000004 #define MONITOR_PANIC 0x00000020 @@ -1767,8 +1763,8 @@ extern struct aac_common aac_config; * For FIB communication, we need all of the following things * to send back to the user. */ - -#define AifCmdEventNotify 1 /* Notify of event */ + +#define AifCmdEventNotify 1 /* Notify of event */ #define AifEnConfigChange 3 /* Adapter configuration change */ #define AifEnContainerChange 4 /* Container configuration change */ #define AifEnDeviceFailure 5 /* SCSI device failed */ @@ -1792,11 +1788,11 @@ extern struct aac_common aac_config; #define AifDenVolumeExtendComplete 201 /* A volume extend completed */ #define AifReqJobList 100 /* Gets back complete job list */ #define AifReqJobsForCtr 101 /* Gets back jobs for specific container */ -#define AifReqJobsForScsi 102 /* Gets back jobs for specific SCSI device */ -#define AifReqJobReport 103 /* Gets back a specific job report or list of them */ +#define AifReqJobsForScsi 102 /* Gets back jobs for specific SCSI device */ +#define AifReqJobReport 103 /* Gets back a specific job report or list of them */ #define AifReqTerminateJob 104 /* Terminates job */ #define AifReqSuspendJob 105 /* Suspends a job */ -#define AifReqResumeJob 106 /* Resumes a job */ +#define AifReqResumeJob 106 /* Resumes a job */ #define AifReqSendAPIReport 107 /* API generic report requests */ #define AifReqAPIJobStart 108 /* Start a job from the API */ #define AifReqAPIJobUpdate 109 /* Update a job report from the API */ @@ -1815,8 +1811,8 @@ struct aac_aifcmd { }; /** - * Convert capacity to cylinders - * accounting for the fact capacity could be a 64 bit value + * Convert capacity to cylinders + * accounting for the fact capacity could be a 64 bit value * */ static 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 @@ * ioctl_send_fib - send a FIB from userspace * @dev: adapter is being processed * @arg: arguments to the ioctl call - * + * * This routine sends a fib to the adapter on behalf of a user level * program. */ # define AAC_DEBUG_PREAMBLE KERN_INFO # define AAC_DEBUG_POSTAMBLE - + static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) { struct hw_fib * kfib; @@ -71,7 +71,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) if(fibptr == NULL) { return -ENOMEM; } - + kfib = fibptr->hw_fib_va; /* * 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) if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) { aac_adapter_interrupt(dev); /* - * Since we didn't really send a fib, zero out the state to allow + * Since we didn't really send a fib, zero out the state to allow * cleanup code not to assert. */ kfib->header.XferState = 0; @@ -169,7 +169,7 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) fibctx->type = FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT; fibctx->size = sizeof(struct aac_fib_context); - /* + /* * Yes yes, I know this could be an index, but we have a * better guarantee of uniqueness for the locked loop below. * 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) INIT_LIST_HEAD(&fibctx->fib_list); fibctx->jiffies = jiffies/HZ; /* - * Now add this context onto the adapter's + * Now add this context onto the adapter's * AdapterFibContext list. */ spin_lock_irqsave(&dev->fib_lock, flags); @@ -207,12 +207,12 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) } list_add_tail(&fibctx->next, &dev->fib_list); spin_unlock_irqrestore(&dev->fib_lock, flags); - if (copy_to_user(arg, &fibctx->unique, + if (copy_to_user(arg, &fibctx->unique, sizeof(fibctx->unique))) { status = -EFAULT; } else { status = 0; - } + } } return status; } @@ -221,8 +221,8 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) * next_getadapter_fib - get the next fib * @dev: adapter to use * @arg: ioctl argument - * - * This routine will get the next Fib, if available, from the AdapterFibContext + * + * This routine will get the next Fib, if available, from the AdapterFibContext * passed in from the user. */ @@ -234,7 +234,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) int status; struct list_head * entry; unsigned long flags; - + if(copy_from_user((void *)&f, arg, sizeof(struct fib_ioctl))) return -EFAULT; /* @@ -280,7 +280,7 @@ return_fib: */ entry = fibctx->fib_list.next; list_del(entry); - + fib = list_entry(entry, struct fib, fiblink); fibctx->count--; spin_unlock_irqrestore(&dev->fib_lock, flags); @@ -288,7 +288,7 @@ return_fib: kfree(fib->hw_fib_va); kfree(fib); return -EFAULT; - } + } /* * Free the space occupied by this copy of the fib. */ @@ -317,7 +317,7 @@ return_fib: } } else { status = -EAGAIN; - } + } } fibctx->jiffies = jiffies/HZ; return status; @@ -367,7 +367,7 @@ int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx) * * This routine will close down the fibctx passed in from the user. */ - + static int close_getadapter_fib(struct aac_dev * dev, void __user *arg) { struct aac_fib_context *fibctx; @@ -414,7 +414,7 @@ static int close_getadapter_fib(struct aac_dev * dev, void __user *arg) * @arg: ioctl arguments * * This routine returns the driver version. - * Under Linux, there have been no version incompatibilities, so this is + * Under Linux, there have been no version incompatibilities, so this is * simple! */ @@ -425,12 +425,12 @@ static int check_revision(struct aac_dev *dev, void __user *arg) u32 version; response.compat = 1; - version = (simple_strtol(driver_version, + version = (simple_strtol(driver_version, &driver_version, 10) << 24) | 0x00000400; version += simple_strtol(driver_version + 1, &driver_version, 10) << 16; version += simple_strtol(driver_version + 1, NULL, 10); response.version = cpu_to_le32(version); -# if (defined(AAC_DRIVER_BUILD)) +# ifdef AAC_DRIVER_BUILD response.build = cpu_to_le32(AAC_DRIVER_BUILD); # else response.build = cpu_to_le32(9999); @@ -474,7 +474,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) return -EBUSY; } if (!capable(CAP_SYS_ADMIN)){ - dprintk((KERN_DEBUG"aacraid: No permission to send raw srb\n")); + dprintk((KERN_DEBUG"aacraid: No permission to send raw srb\n")); return -EPERM; } /* @@ -489,7 +489,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) memset(sg_list, 0, sizeof(sg_list)); /* cleanup may take issue */ if(copy_from_user(&fibsize, &user_srb->count,sizeof(u32))){ - dprintk((KERN_DEBUG"aacraid: Could not copy data size from user\n")); + dprintk((KERN_DEBUG"aacraid: Could not copy data size from user\n")); rcode = -EFAULT; goto cleanup; } @@ -506,7 +506,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) goto cleanup; } if(copy_from_user(user_srbcmd, user_srb,fibsize)){ - dprintk((KERN_DEBUG"aacraid: Could not copy srb from user\n")); + dprintk((KERN_DEBUG"aacraid: Could not copy srb from user\n")); rcode = -EFAULT; goto cleanup; } @@ -525,7 +525,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) srbcmd->retry_limit = 0; // Obsolete parameter srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size); memcpy(srbcmd->cdb, user_srbcmd->cdb, sizeof(srbcmd->cdb)); - + switch (flags & (SRB_DataIn | SRB_DataOut)) { case SRB_DataOut: data_dir = DMA_TO_DEVICE; @@ -593,7 +593,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) sg_list[i] = p; // save so we can clean up later sg_indx = i; - if( flags & SRB_DataOut ){ + if (flags & SRB_DataOut) { if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); rcode = -EFAULT; @@ -636,7 +636,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) sg_list[i] = p; // save so we can clean up later sg_indx = i; - if( flags & SRB_DataOut ){ + if (flags & SRB_DataOut) { if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ kfree (usg); 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) sg_list[i] = p; // save so we can clean up later sg_indx = i; - if( flags & SRB_DataOut ){ + if (flags & SRB_DataOut) { if(copy_from_user(p,sg_user[i],usg->sg[i].count)){ dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); rcode = -EFAULT; @@ -707,7 +707,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) sg_list[i] = p; // save so we can clean up later sg_indx = i; - if( flags & SRB_DataOut ){ + if (flags & SRB_DataOut) { if(copy_from_user(p, sg_user[i], upsg->sg[i].count)) { 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) } if (status != 0){ - dprintk((KERN_DEBUG"aacraid: Could not send raw srb fib to hba\n")); + dprintk((KERN_DEBUG"aacraid: Could not send raw srb fib to hba\n")); rcode = -ENXIO; goto cleanup; } - if( flags & SRB_DataIn ) { + if (flags & SRB_DataIn) { for(i = 0 ; i <= sg_indx; i++){ byte_count = le32_to_cpu( (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64) ? ((struct sgmap64*)&srbcmd->sg)->sg[i].count : srbcmd->sg.sg[i].count); if(copy_to_user(sg_user[i], sg_list[i], byte_count)){ - dprintk((KERN_DEBUG"aacraid: Could not copy sg data to user\n")); + dprintk((KERN_DEBUG"aacraid: Could not copy sg data to user\n")); rcode = -EFAULT; goto cleanup; @@ -755,7 +755,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) reply = (struct aac_srb_reply *) fib_data(srbfib); if(copy_to_user(user_reply,reply,sizeof(struct aac_srb_reply))){ - dprintk((KERN_DEBUG"aacraid: Could not copy reply to user\n")); + dprintk((KERN_DEBUG"aacraid: Could not copy reply to user\n")); rcode = -EFAULT; goto cleanup; } @@ -774,34 +774,34 @@ cleanup: } struct aac_pci_info { - u32 bus; - u32 slot; + u32 bus; + u32 slot; }; static int aac_get_pci_info(struct aac_dev* dev, void __user *arg) { - struct aac_pci_info pci_info; + struct aac_pci_info pci_info; pci_info.bus = dev->pdev->bus->number; pci_info.slot = PCI_SLOT(dev->pdev->devfn); if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) { - dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n")); - return -EFAULT; + dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n")); + return -EFAULT; } - return 0; + return 0; } - + int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg) { int status; - + /* * HBA gets first crack */ - + status = aac_dev_ioctl(dev, cmd, arg); if(status != -ENOTTY) return status; @@ -831,7 +831,7 @@ int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg) break; default: status = -ENOTTY; - break; + break; } return status; } 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 @@ * Allocate and map the shared PCI space for the FIB blocks used to * talk to the Adaptec firmware. */ - + static int fib_map_alloc(struct aac_dev *dev) { dprintk((KERN_INFO @@ -109,14 +109,16 @@ int aac_fib_setup(struct aac_dev * dev) } if (i<0) return -ENOMEM; - + hw_fib = dev->hw_fib_va; hw_fib_pa = dev->hw_fib_pa; memset(hw_fib, 0, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)); /* * Initialise the fibs */ - for (i = 0, fibptr = &dev->fibs[i]; i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++, fibptr++) + for (i = 0, fibptr = &dev->fibs[i]; + i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); + i++, fibptr++) { fibptr->dev = dev; fibptr->hw_fib_va = hw_fib; @@ -148,13 +150,13 @@ int aac_fib_setup(struct aac_dev * dev) * Allocate a fib from the adapter fib pool. If the pool is empty we * return NULL. */ - + struct fib *aac_fib_alloc(struct aac_dev *dev) { struct fib * fibptr; unsigned long flags; spin_lock_irqsave(&dev->fib_lock, flags); - fibptr = dev->free_fib; + fibptr = dev->free_fib; if(!fibptr){ spin_unlock_irqrestore(&dev->fib_lock, flags); return fibptr; @@ -184,7 +186,7 @@ struct fib *aac_fib_alloc(struct aac_dev *dev) * * Frees up a fib and places it on the appropriate queue */ - + void aac_fib_free(struct fib *fibptr) { unsigned long flags; @@ -205,10 +207,10 @@ void aac_fib_free(struct fib *fibptr) /** * aac_fib_init - initialise a fib * @fibptr: The fib to initialize - * + * * Set up the generic fib fields ready for use */ - + void aac_fib_init(struct fib *fibptr) { struct hw_fib *hw_fib = fibptr->hw_fib_va; @@ -228,12 +230,12 @@ void aac_fib_init(struct fib *fibptr) * Will deallocate and return to the free pool the FIB pointed to by the * caller. */ - + static void fib_dealloc(struct fib * fibptr) { struct hw_fib *hw_fib = fibptr->hw_fib_va; BUG_ON(hw_fib->header.StructType != FIB_MAGIC); - hw_fib->header.XferState = 0; + hw_fib->header.XferState = 0; } /* @@ -242,7 +244,7 @@ static void fib_dealloc(struct fib * fibptr) * these routines and are the only routines which have a knowledge of the * how these queues are implemented. */ - + /** * aac_get_entry - get a queue entry * @dev: Adapter @@ -255,7 +257,7 @@ static void fib_dealloc(struct fib * fibptr) * is full(no free entries) than no entry is returned and the function returns 0 otherwise 1 is * returned. */ - + static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entry, u32 * index, unsigned long *nonotify) { struct aac_queue * q; @@ -280,26 +282,27 @@ static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entr idx = ADAP_NORM_RESP_ENTRIES; } if (idx != le32_to_cpu(*(q->headers.consumer))) - *nonotify = 1; + *nonotify = 1; } if (qid == AdapNormCmdQueue) { - if (*index >= ADAP_NORM_CMD_ENTRIES) + if (*index >= ADAP_NORM_CMD_ENTRIES) *index = 0; /* Wrap to front of the Producer Queue. */ } else { - if (*index >= ADAP_NORM_RESP_ENTRIES) + if (*index >= ADAP_NORM_RESP_ENTRIES) *index = 0; /* Wrap to front of the Producer Queue. */ } - if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) { /* Queue is full */ + /* Queue is full */ + if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) { printk(KERN_WARNING "Queue %d full, %u outstanding.\n", qid, q->numpending); return 0; } else { - *entry = q->base + *index; + *entry = q->base + *index; return 1; } -} +} /** * 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 { struct aac_entry * entry = NULL; int map = 0; - + if (qid == AdapNormCmdQueue) { /* if no entries wait for some if caller wants to */ - while (!aac_get_entry(dev, qid, &entry, index, nonotify)) - { + while (!aac_get_entry(dev, qid, &entry, index, nonotify)) { printk(KERN_ERR "GetEntries failed\n"); } - /* - * Setup queue entry with a command, status and fib mapped - */ - entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); - map = 1; + /* + * Setup queue entry with a command, status and fib mapped + */ + entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); + map = 1; } else { - while(!aac_get_entry(dev, qid, &entry, index, nonotify)) - { + while (!aac_get_entry(dev, qid, &entry, index, nonotify)) { /* if no entries wait for some if caller wants to */ } - /* - * Setup queue entry with command, status and fib mapped - */ - entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); - entry->addr = hw_fib->header.SenderFibAddress; - /* Restore adapters pointer to the FIB */ + /* + * Setup queue entry with command, status and fib mapped + */ + entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); + entry->addr = hw_fib->header.SenderFibAddress; + /* Restore adapters pointer to the FIB */ hw_fib->header.ReceiverFibAddress = hw_fib->header.SenderFibAddress; /* Let the adapter now where to find its data */ - map = 0; + map = 0; } /* * 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 } /* - * Define the highest level of host to adapter communication routines. - * These routines will support host to adapter FS commuication. These + * Define the highest level of host to adapter communication routines. + * These routines will support host to adapter FS commuication. These * routines have no knowledge of the commuication method used. This level * sends and receives FIBs. This level has no knowledge of how these FIBs * 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 * an event to wait on must be supplied. This event will be set when a * response FIB is received from the adapter. */ - + int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, int priority, int wait, int reply, fib_callback callback, void *callback_data) @@ -393,13 +394,13 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, if (!(hw_fib->header.XferState & cpu_to_le32(HostOwned))) return -EBUSY; /* - * There are 5 cases with the wait and reponse requested flags. + * There are 5 cases with the wait and reponse requested flags. * The only invalid cases are if the caller requests to wait and * does not request a response and if the caller does not want a * response and the Fib is not allocated from pool. If a response * is not requesed the Fib will just be deallocaed by the DPC * routine when the response comes back from the adapter. No - * further processing will be done besides deleting the Fib. We + * further processing will be done besides deleting the Fib. We * will have a debug mode where the adapter can notify the host * it had a problem and the host can log that fact. */ @@ -415,7 +416,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, } else if (wait && reply) { hw_fib->header.XferState |= cpu_to_le32(ResponseExpected); FIB_COUNTER_INCREMENT(aac_config.NormalSent); - } + } /* * Map the fib into 32bits by using the fib number */ @@ -438,7 +439,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, hw_fib->header.Size = cpu_to_le16(sizeof(struct aac_fibhdr) + size); if (le16_to_cpu(hw_fib->header.Size) > le16_to_cpu(hw_fib->header.SenderSize)) { return -EMSGSIZE; - } + } /* * Get a queue entry connect the FIB to it and send an notify * the adapter a command is ready. @@ -475,9 +476,9 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, aac_adapter_deliver(fibptr); /* - * If the caller wanted us to wait for response wait now. + * If the caller wanted us to wait for response wait now. */ - + if (wait) { spin_unlock_irqrestore(&fibptr->event_lock, flags); /* Only set for first known interruptable command */ @@ -524,7 +525,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, } spin_unlock_irqrestore(&fibptr->event_lock, flags); BUG_ON(fibptr->done == 0); - + if(unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)) return -ETIMEDOUT; return 0; @@ -539,15 +540,15 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, return 0; } -/** +/** * aac_consumer_get - get the top of the queue * @dev: Adapter * @q: Queue * @entry: Return entry * * Will return a pointer to the entry on the top of the queue requested that - * we are a consumer of, and return the address of the queue entry. It does - * not change the state of the queue. + * we are a consumer of, and return the address of the queue entry. It does + * not change the state of the queue. */ int 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 * the end of the queue, else we just use the entry * pointed to by the header index */ - if (le32_to_cpu(*q->headers.consumer) >= q->entries) - index = 0; + if (le32_to_cpu(*q->headers.consumer) >= q->entries) + index = 0; else - index = le32_to_cpu(*q->headers.consumer); + index = le32_to_cpu(*q->headers.consumer); *entry = q->base + index; status = 1; } @@ -589,12 +590,12 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid) if ((le32_to_cpu(*q->headers.producer)+1) == le32_to_cpu(*q->headers.consumer)) wasfull = 1; - + if (le32_to_cpu(*q->headers.consumer) >= q->entries) *q->headers.consumer = cpu_to_le32(1); else *q->headers.consumer = cpu_to_le32(le32_to_cpu(*q->headers.consumer)+1); - + if (wasfull) { switch (qid) { @@ -610,7 +611,7 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid) } aac_adapter_notify(dev, notify); } -} +} /** * aac_fib_adapter_complete - complete adapter issued fib @@ -632,32 +633,32 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) if (hw_fib->header.XferState == 0) { if (dev->comm_interface == AAC_COMM_MESSAGE) kfree (hw_fib); - return 0; + return 0; } /* * If we plan to do anything check the structure type first. - */ - if ( hw_fib->header.StructType != FIB_MAGIC ) { + */ + if (hw_fib->header.StructType != FIB_MAGIC) { if (dev->comm_interface == AAC_COMM_MESSAGE) kfree (hw_fib); - return -EINVAL; + return -EINVAL; } /* * This block handles the case where the adapter had sent us a * command and we have finished processing the command. We - * call completeFib when we are done processing the command - * and want to send a response back to the adapter. This will + * call completeFib when we are done processing the command + * and want to send a response back to the adapter. This will * send the completed cdb to the adapter. */ if (hw_fib->header.XferState & cpu_to_le32(SentFromAdapter)) { if (dev->comm_interface == AAC_COMM_MESSAGE) { kfree (hw_fib); } else { - u32 index; - hw_fib->header.XferState |= cpu_to_le32(HostProcessed); + u32 index; + hw_fib->header.XferState |= cpu_to_le32(HostProcessed); if (size) { size += sizeof(struct aac_fibhdr); - if (size > le16_to_cpu(hw_fib->header.SenderSize)) + if (size > le16_to_cpu(hw_fib->header.SenderSize)) return -EMSGSIZE; hw_fib->header.Size = cpu_to_le16(size); } @@ -669,12 +670,11 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) if (!(nointr & (int)aac_config.irq_mod)) aac_adapter_notify(dev, AdapNormRespQueue); } + } else { + printk(KERN_WARNING "aac_fib_adapter_complete: " + "Unknown xferstate detected.\n"); + BUG(); } - else - { - printk(KERN_WARNING "aac_fib_adapter_complete: Unknown xferstate detected.\n"); - BUG(); - } return 0; } @@ -684,7 +684,7 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) * * Will do all necessary work to complete a FIB. */ - + int aac_fib_complete(struct fib *fibptr) { struct hw_fib * hw_fib = fibptr->hw_fib_va; @@ -694,15 +694,15 @@ int aac_fib_complete(struct fib *fibptr) */ if (hw_fib->header.XferState == 0) - return 0; + return 0; /* * If we plan to do anything check the structure type first. - */ + */ if (hw_fib->header.StructType != FIB_MAGIC) - return -EINVAL; + return -EINVAL; /* - * This block completes a cdb which orginated on the host and we + * This block completes a cdb which orginated on the host and we * just need to deallocate the cdb or reinit it. At this point the * command is complete that we had sent to the adapter and this * cdb could be reused. @@ -723,7 +723,7 @@ int aac_fib_complete(struct fib *fibptr) fib_dealloc(fibptr); } else { BUG(); - } + } return 0; } @@ -743,7 +743,7 @@ void aac_printf(struct aac_dev *dev, u32 val) { int length = val & 0xffff; int level = (val >> 16) & 0xffff; - + /* * The size of the printfbuf is set in port.c * There is no variable or define for it @@ -757,7 +757,7 @@ void aac_printf(struct aac_dev *dev, u32 val) else printk(KERN_INFO "%s:%s", dev->name, cp); } - memset(cp, 0, 256); + memset(cp, 0, 256); } @@ -816,9 +816,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) */ if ((dev != NULL) && (dev->scsi_host_ptr != NULL)) { - device = scsi_device_lookup(dev->scsi_host_ptr, - CONTAINER_TO_CHANNEL(container), - CONTAINER_TO_ID(container), + device = scsi_device_lookup(dev->scsi_host_ptr, + CONTAINER_TO_CHANNEL(container), + CONTAINER_TO_ID(container), CONTAINER_TO_LUN(container)); if (device) { dev->fsa_dev[container].config_needed = CHANGE; @@ -1184,13 +1184,13 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) } (void)aac_get_adapter_info(aac); if ((quirks & AAC_QUIRK_34SG) && (host->sg_tablesize > 34)) { - host->sg_tablesize = 34; - host->max_sectors = (host->sg_tablesize * 8) + 112; - } - if ((quirks & AAC_QUIRK_17SG) && (host->sg_tablesize > 17)) { - host->sg_tablesize = 17; - host->max_sectors = (host->sg_tablesize * 8) + 112; - } + host->sg_tablesize = 34; + host->max_sectors = (host->sg_tablesize * 8) + 112; + } + if ((quirks & AAC_QUIRK_17SG) && (host->sg_tablesize > 17)) { + host->sg_tablesize = 17; + host->max_sectors = (host->sg_tablesize * 8) + 112; + } aac_get_config_status(aac, 1); aac_get_containers(aac); /* @@ -1461,7 +1461,7 @@ out: * until the queue is empty. When the queue is empty it will wait for * more FIBs. */ - + int aac_command_thread(void *data) { struct aac_dev *dev = data; @@ -1487,30 +1487,29 @@ int aac_command_thread(void *data) add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait); set_current_state(TASK_INTERRUPTIBLE); dprintk ((KERN_INFO "aac_command_thread start\n")); - while(1) - { + while (1) { spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags); while(!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) { struct list_head *entry; struct aac_aifcmd * aifcmd; set_current_state(TASK_RUNNING); - + entry = dev->queues->queue[HostNormCmdQueue].cmdq.next; list_del(entry); - + spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags); fib = list_entry(entry, struct fib, fiblink); /* - * We will process the FIB here or pass it to a - * worker thread that is TBD. We Really can't + * We will process the FIB here or pass it to a + * worker thread that is TBD. We Really can't * do anything at this point since we don't have * anything defined for this thread to do. */ hw_fib = fib->hw_fib_va; memset(fib, 0, sizeof(struct fib)); fib->type = FSAFS_NTC_FIB_CONTEXT; - fib->size = sizeof( struct fib ); + fib->size = sizeof(struct fib); fib->hw_fib_va = hw_fib; fib->data = hw_fib->data; fib->dev = dev; @@ -1526,17 +1525,17 @@ int aac_command_thread(void *data) } else { /* The u32 here is important and intended. We are using 32bit wrapping time to fit the adapter field */ - + u32 time_now, time_last; unsigned long flagv; unsigned num; struct hw_fib ** hw_fib_pool, ** hw_fib_p; struct fib ** fib_pool, ** fib_p; - + /* Sniff events */ - if ((aifcmd->command == + if ((aifcmd->command == cpu_to_le32(AifCmdEventNotify)) || - (aifcmd->command == + (aifcmd->command == cpu_to_le32(AifCmdJobProgress))) { aac_handle_aif(dev, fib); } @@ -1588,7 +1587,7 @@ int aac_command_thread(void *data) spin_lock_irqsave(&dev->fib_lock, flagv); entry = dev->fib_list.next; /* - * For each Context that is on the + * For each Context that is on the * fibctxList, make a copy of the * fib, and then set the event to wake up the * thread that is waiting for it. @@ -1613,7 +1612,7 @@ int aac_command_thread(void *data) */ time_last = fibctx->jiffies; /* - * Has it been > 2 minutes + * Has it been > 2 minutes * since the last read off * the queue? */ @@ -1644,7 +1643,7 @@ int aac_command_thread(void *data) */ list_add_tail(&newfib->fiblink, &fibctx->fib_list); fibctx->count++; - /* + /* * Set the event to wake up the * thread that is waiting. */ 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[] = { MODULE_DEVICE_TABLE(pci, aac_pci_tbl); /* - * dmb - For now we add the number of channels to this structure. + * dmb - For now we add the number of channels to this structure. * In the future we should add a fib that reports the number of channels * for the card. At that time we can remove the channels from here */ @@ -239,7 +239,7 @@ static struct aac_driver_ident aac_drivers[] = { * Queues a command for execution by the associated Host Adapter. * * TODO: unify with aac_scsi_cmd(). - */ + */ static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) { @@ -258,7 +258,7 @@ static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd } cmd->SCp.phase = AAC_OWNER_LOWLEVEL; return (aac_scsi_cmd(cmd) ? FAILED : 0); -} +} /** * aac_info - Returns the host adapter name @@ -292,21 +292,21 @@ struct aac_driver_ident* aac_get_driver_ident(int devtype) * @capacity: the sector capacity of the disk * @geom: geometry block to fill in * - * Return the Heads/Sectors/Cylinders BIOS Disk Parameters for Disk. - * The default disk geometry is 64 heads, 32 sectors, and the appropriate - * number of cylinders so as not to exceed drive capacity. In order for + * Return the Heads/Sectors/Cylinders BIOS Disk Parameters for Disk. + * The default disk geometry is 64 heads, 32 sectors, and the appropriate + * number of cylinders so as not to exceed drive capacity. In order for * disks equal to or larger than 1 GB to be addressable by the BIOS - * without exceeding the BIOS limitation of 1024 cylinders, Extended - * Translation should be enabled. With Extended Translation enabled, - * drives between 1 GB inclusive and 2 GB exclusive are given a disk - * geometry of 128 heads and 32 sectors, and drives above 2 GB inclusive - * are given a disk geometry of 255 heads and 63 sectors. However, if - * the BIOS detects that the Extended Translation setting does not match - * the geometry in the partition table, then the translation inferred - * from the partition table will be used by the BIOS, and a warning may + * without exceeding the BIOS limitation of 1024 cylinders, Extended + * Translation should be enabled. With Extended Translation enabled, + * drives between 1 GB inclusive and 2 GB exclusive are given a disk + * geometry of 128 heads and 32 sectors, and drives above 2 GB inclusive + * are given a disk geometry of 255 heads and 63 sectors. However, if + * the BIOS detects that the Extended Translation setting does not match + * the geometry in the partition table, then the translation inferred + * from the partition table will be used by the BIOS, and a warning may * be displayed. */ - + static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, sector_t capacity, int *geom) { @@ -333,10 +333,10 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors); - /* + /* * Read the first 1024 bytes from the disk device, if the boot * sector partition table is valid, search for a partition table - * entry whose end_head matches one of the standard geometry + * entry whose end_head matches one of the standard geometry * translations ( 64/32, 128/32, 255/63 ). */ buf = scsi_bios_ptable(bdev); @@ -596,7 +596,7 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER; } } - printk(KERN_ERR "%s: Host adapter reset request. SCSI hang ?\n", + printk(KERN_ERR "%s: Host adapter reset request. SCSI hang ?\n", AAC_DRIVERNAME); if ((count = aac_check_health(aac))) @@ -687,8 +687,8 @@ static int aac_cfg_open(struct inode *inode, struct file *file) * Bugs: Needs locking against parallel ioctls lower down * Bugs: Needs to handle hot plugging */ - -static int aac_cfg_ioctl(struct inode *inode, struct file *file, + +static int aac_cfg_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { if (!capable(CAP_SYS_RAWIO)) @@ -701,7 +701,7 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long { long ret; lock_kernel(); - switch (cmd) { + switch (cmd) { case FSACTL_MINIPORT_REV_CHECK: case FSACTL_SENDFIB: case FSACTL_OPEN_GET_ADAPTER_FIB: @@ -711,14 +711,14 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long case FSACTL_QUERY_DISK: case FSACTL_DELETE_DISK: case FSACTL_FORCE_DELETE_DISK: - case FSACTL_GET_CONTAINERS: + case FSACTL_GET_CONTAINERS: case FSACTL_SEND_LARGE_FIB: ret = aac_do_ioctl(dev, cmd, (void __user *)arg); break; case FSACTL_GET_NEXT_ADAPTER_FIB: { struct fib_ioctl __user *f; - + f = compat_alloc_user_space(sizeof(*f)); ret = 0; if (clear_user(f, sizeof(*f))) @@ -731,9 +731,9 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long } default: - ret = -ENOIOCTLCMD; + ret = -ENOIOCTLCMD; break; - } + } unlock_kernel(); return ret; } @@ -797,7 +797,7 @@ static ssize_t aac_show_kernel_version(struct class_device *class_dev, int len, tmp; tmp = le32_to_cpu(dev->adapter_info.kernelrev); - len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", + len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, le32_to_cpu(dev->adapter_info.kernelbuild)); return len; @@ -810,7 +810,7 @@ static ssize_t aac_show_monitor_version(struct class_device *class_dev, int len, tmp; tmp = le32_to_cpu(dev->adapter_info.monitorrev); - len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", + len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, le32_to_cpu(dev->adapter_info.monitorbuild)); return len; @@ -823,7 +823,7 @@ static ssize_t aac_show_bios_version(struct class_device *class_dev, int len, tmp; tmp = le32_to_cpu(dev->adapter_info.biosrev); - len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", + len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, le32_to_cpu(dev->adapter_info.biosbuild)); return len; @@ -983,22 +983,22 @@ static struct scsi_host_template aac_driver_template = { .compat_ioctl = aac_compat_ioctl, #endif .queuecommand = aac_queuecommand, - .bios_param = aac_biosparm, + .bios_param = aac_biosparm, .shost_attrs = aac_attrs, .slave_configure = aac_slave_configure, .change_queue_depth = aac_change_queue_depth, .sdev_attrs = aac_dev_attrs, .eh_abort_handler = aac_eh_abort, .eh_host_reset_handler = aac_eh_reset, - .can_queue = AAC_NUM_IO_FIB, + .can_queue = AAC_NUM_IO_FIB, .this_id = MAXIMUM_NUM_CONTAINERS, .sg_tablesize = 16, .max_sectors = 128, #if (AAC_NUM_IO_FIB > 256) .cmd_per_lun = 256, -#else - .cmd_per_lun = AAC_NUM_IO_FIB, -#endif +#else + .cmd_per_lun = AAC_NUM_IO_FIB, +#endif .use_clustering = ENABLE_CLUSTERING, .use_sg_chaining = ENABLE_SG_CHAINING, .emulated = 1, @@ -1035,18 +1035,18 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, goto out; error = -ENODEV; - if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || + if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) goto out_disable_pdev; /* * If the quirk31 bit is set, the adapter needs adapter * to driver communication memory to be allocated below 2gig */ - if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) + if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) || pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK)) goto out_disable_pdev; - + pci_set_master(pdev); 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, shost->max_cmd_len = 16; aac = (struct aac_dev *)shost->hostdata; - aac->scsi_host_ptr = shost; + aac->scsi_host_ptr = shost; aac->pdev = pdev; aac->name = aac_driver_template.name; aac->id = shost->unique_id; @@ -1096,7 +1096,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) goto out_deinit; - + aac->maximum_num_channels = aac_drivers[index].channels; error = aac_get_adapter_info(aac); if (error < 0) @@ -1105,7 +1105,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, /* * Lets override negotiations and drop the maximum SG limit to 34 */ - if ((aac_drivers[index].quirks & AAC_QUIRK_34SG) && + if ((aac_drivers[index].quirks & AAC_QUIRK_34SG) && (aac->scsi_host_ptr->sg_tablesize > 34)) { aac->scsi_host_ptr->sg_tablesize = 34; aac->scsi_host_ptr->max_sectors @@ -1122,11 +1122,11 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, /* * Firware printf works only with older firmware. */ - if (aac_drivers[index].quirks & AAC_QUIRK_34SG) + if (aac_drivers[index].quirks & AAC_QUIRK_34SG) aac->printf_enabled = 1; else aac->printf_enabled = 0; - + /* * max channel will be the physical channels plus 1 virtual channel * all containers are on the virtual channel 0 (CONTAINER_CHANNEL) @@ -1204,10 +1204,10 @@ static void __devexit aac_remove_one(struct pci_dev *pdev) kfree(aac->queues); aac_adapter_ioremap(aac, 0); - + kfree(aac->fibs); kfree(aac->fsa_dev); - + list_del(&aac->entry); scsi_host_put(shost); pci_disable_device(pdev); @@ -1228,7 +1228,7 @@ static struct pci_driver aac_pci_driver = { static int __init aac_init(void) { int error; - + printk(KERN_INFO "Adaptec %s driver %s\n", AAC_DRIVERNAME, aac_driver_version); |