提交 8ce3eca4 编写于 作者: S Salyzyn, Mark 提交者: James Bottomley

[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: NMark Salyzyn <aacraid@adaptec.com>
Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
上级 d07e0361
...@@ -56,54 +56,54 @@ ...@@ -56,54 +56,54 @@
/* /*
* Sense codes * Sense codes
*/ */
#define SENCODE_NO_SENSE 0x00 #define SENCODE_NO_SENSE 0x00
#define SENCODE_END_OF_DATA 0x00 #define SENCODE_END_OF_DATA 0x00
#define SENCODE_BECOMING_READY 0x04 #define SENCODE_BECOMING_READY 0x04
#define SENCODE_INIT_CMD_REQUIRED 0x04 #define SENCODE_INIT_CMD_REQUIRED 0x04
#define SENCODE_PARAM_LIST_LENGTH_ERROR 0x1A #define SENCODE_PARAM_LIST_LENGTH_ERROR 0x1A
#define SENCODE_INVALID_COMMAND 0x20 #define SENCODE_INVALID_COMMAND 0x20
#define SENCODE_LBA_OUT_OF_RANGE 0x21 #define SENCODE_LBA_OUT_OF_RANGE 0x21
#define SENCODE_INVALID_CDB_FIELD 0x24 #define SENCODE_INVALID_CDB_FIELD 0x24
#define SENCODE_LUN_NOT_SUPPORTED 0x25 #define SENCODE_LUN_NOT_SUPPORTED 0x25
#define SENCODE_INVALID_PARAM_FIELD 0x26 #define SENCODE_INVALID_PARAM_FIELD 0x26
#define SENCODE_PARAM_NOT_SUPPORTED 0x26 #define SENCODE_PARAM_NOT_SUPPORTED 0x26
#define SENCODE_PARAM_VALUE_INVALID 0x26 #define SENCODE_PARAM_VALUE_INVALID 0x26
#define SENCODE_RESET_OCCURRED 0x29 #define SENCODE_RESET_OCCURRED 0x29
#define SENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x3E #define SENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x3E
#define SENCODE_INQUIRY_DATA_CHANGED 0x3F #define SENCODE_INQUIRY_DATA_CHANGED 0x3F
#define SENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x39 #define SENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x39
#define SENCODE_DIAGNOSTIC_FAILURE 0x40 #define SENCODE_DIAGNOSTIC_FAILURE 0x40
#define SENCODE_INTERNAL_TARGET_FAILURE 0x44 #define SENCODE_INTERNAL_TARGET_FAILURE 0x44
#define SENCODE_INVALID_MESSAGE_ERROR 0x49 #define SENCODE_INVALID_MESSAGE_ERROR 0x49
#define SENCODE_LUN_FAILED_SELF_CONFIG 0x4c #define SENCODE_LUN_FAILED_SELF_CONFIG 0x4c
#define SENCODE_OVERLAPPED_COMMAND 0x4E #define SENCODE_OVERLAPPED_COMMAND 0x4E
/* /*
* Additional sense codes * Additional sense codes
*/ */
#define ASENCODE_NO_SENSE 0x00 #define ASENCODE_NO_SENSE 0x00
#define ASENCODE_END_OF_DATA 0x05 #define ASENCODE_END_OF_DATA 0x05
#define ASENCODE_BECOMING_READY 0x01 #define ASENCODE_BECOMING_READY 0x01
#define ASENCODE_INIT_CMD_REQUIRED 0x02 #define ASENCODE_INIT_CMD_REQUIRED 0x02
#define ASENCODE_PARAM_LIST_LENGTH_ERROR 0x00 #define ASENCODE_PARAM_LIST_LENGTH_ERROR 0x00
#define ASENCODE_INVALID_COMMAND 0x00 #define ASENCODE_INVALID_COMMAND 0x00
#define ASENCODE_LBA_OUT_OF_RANGE 0x00 #define ASENCODE_LBA_OUT_OF_RANGE 0x00
#define ASENCODE_INVALID_CDB_FIELD 0x00 #define ASENCODE_INVALID_CDB_FIELD 0x00
#define ASENCODE_LUN_NOT_SUPPORTED 0x00 #define ASENCODE_LUN_NOT_SUPPORTED 0x00
#define ASENCODE_INVALID_PARAM_FIELD 0x00 #define ASENCODE_INVALID_PARAM_FIELD 0x00
#define ASENCODE_PARAM_NOT_SUPPORTED 0x01 #define ASENCODE_PARAM_NOT_SUPPORTED 0x01
#define ASENCODE_PARAM_VALUE_INVALID 0x02 #define ASENCODE_PARAM_VALUE_INVALID 0x02
#define ASENCODE_RESET_OCCURRED 0x00 #define ASENCODE_RESET_OCCURRED 0x00
#define ASENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x00 #define ASENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x00
#define ASENCODE_INQUIRY_DATA_CHANGED 0x03 #define ASENCODE_INQUIRY_DATA_CHANGED 0x03
#define ASENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x00 #define ASENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x00
#define ASENCODE_DIAGNOSTIC_FAILURE 0x80 #define ASENCODE_DIAGNOSTIC_FAILURE 0x80
#define ASENCODE_INTERNAL_TARGET_FAILURE 0x00 #define ASENCODE_INTERNAL_TARGET_FAILURE 0x00
#define ASENCODE_INVALID_MESSAGE_ERROR 0x00 #define ASENCODE_INVALID_MESSAGE_ERROR 0x00
#define ASENCODE_LUN_FAILED_SELF_CONFIG 0x00 #define ASENCODE_LUN_FAILED_SELF_CONFIG 0x00
#define ASENCODE_OVERLAPPED_COMMAND 0x00 #define ASENCODE_OVERLAPPED_COMMAND 0x00
#define BYTE0(x) (unsigned char)(x) #define BYTE0(x) (unsigned char)(x)
#define BYTE1(x) (unsigned char)((x) >> 8) #define BYTE1(x) (unsigned char)((x) >> 8)
...@@ -115,8 +115,8 @@ ...@@ -115,8 +115,8 @@
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
/* SCSI inquiry data */ /* SCSI inquiry data */
struct inquiry_data { struct inquiry_data {
u8 inqd_pdt; /* Peripheral qualifier | Peripheral Device Type */ u8 inqd_pdt; /* Peripheral qualifier | Peripheral Device Type */
u8 inqd_dtq; /* RMB | Device Type Qualifier */ u8 inqd_dtq; /* RMB | Device Type Qualifier */
u8 inqd_ver; /* ISO version | ECMA version | ANSI-approved version */ u8 inqd_ver; /* ISO version | ECMA version | ANSI-approved version */
u8 inqd_rdf; /* AENC | TrmIOP | Response data format */ u8 inqd_rdf; /* AENC | TrmIOP | Response data format */
u8 inqd_len; /* Additional length (n-4) */ u8 inqd_len; /* Additional length (n-4) */
...@@ -130,7 +130,7 @@ struct inquiry_data { ...@@ -130,7 +130,7 @@ struct inquiry_data {
/* /*
* M O D U L E G L O B A L S * 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_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_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg);
static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* 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); ...@@ -141,8 +141,8 @@ static char *aac_get_status_string(u32 status);
/* /*
* Non dasd selection is handled entirely in aachba now * Non dasd selection is handled entirely in aachba now
*/ */
static int nondasd = -1; static int nondasd = -1;
static int aac_cache = 0; static int aac_cache = 0;
static int dacmode = -1; static int dacmode = -1;
...@@ -196,12 +196,12 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd, ...@@ -196,12 +196,12 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd,
struct fib *fibptr) { struct fib *fibptr) {
struct scsi_device *device; 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")); dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n"));
aac_fib_complete(fibptr); aac_fib_complete(fibptr);
aac_fib_free(fibptr); aac_fib_free(fibptr);
return 0; return 0;
} }
scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
device = scsicmd->device; device = scsicmd->device;
if (unlikely(!device || !scsi_device_online(device))) { if (unlikely(!device || !scsi_device_online(device))) {
...@@ -243,7 +243,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) ...@@ -243,7 +243,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
FsaNormal, FsaNormal,
1, 1, 1, 1,
NULL, NULL); NULL, NULL);
if (status < 0 ) { if (status < 0) {
printk(KERN_WARNING "aac_get_config_status: SendFIB failed.\n"); printk(KERN_WARNING "aac_get_config_status: SendFIB failed.\n");
} else { } else {
struct aac_get_config_status_resp *reply struct aac_get_config_status_resp *reply
...@@ -267,10 +267,10 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) ...@@ -267,10 +267,10 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
struct aac_commit_config * dinfo; struct aac_commit_config * dinfo;
aac_fib_init(fibptr); aac_fib_init(fibptr);
dinfo = (struct aac_commit_config *) fib_data(fibptr); dinfo = (struct aac_commit_config *) fib_data(fibptr);
dinfo->command = cpu_to_le32(VM_ContainerConfig); dinfo->command = cpu_to_le32(VM_ContainerConfig);
dinfo->type = cpu_to_le32(CT_COMMIT_CONFIG); dinfo->type = cpu_to_le32(CT_COMMIT_CONFIG);
status = aac_fib_send(ContainerCommand, status = aac_fib_send(ContainerCommand,
fibptr, fibptr,
sizeof (struct aac_commit_config), sizeof (struct aac_commit_config),
...@@ -296,7 +296,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) ...@@ -296,7 +296,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
int aac_get_containers(struct aac_dev *dev) int aac_get_containers(struct aac_dev *dev)
{ {
struct fsa_dev_info *fsa_dev_ptr; struct fsa_dev_info *fsa_dev_ptr;
u32 index; u32 index;
int status = 0; int status = 0;
struct fib * fibptr; struct fib * fibptr;
struct aac_get_container_count *dinfo; struct aac_get_container_count *dinfo;
...@@ -399,7 +399,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr) ...@@ -399,7 +399,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
do { do {
*dp++ = (*sp) ? *sp++ : ' '; *dp++ = (*sp) ? *sp++ : ' ';
} while (--count > 0); } while (--count > 0);
aac_internal_transfer(scsicmd, d, aac_internal_transfer(scsicmd, d,
offsetof(struct inquiry_data, inqd_pid), sizeof(d)); offsetof(struct inquiry_data, inqd_pid), sizeof(d));
} }
} }
...@@ -435,13 +435,13 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd) ...@@ -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)); dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data));
status = aac_fib_send(ContainerCommand, status = aac_fib_send(ContainerCommand,
cmd_fibcontext, cmd_fibcontext,
sizeof (struct aac_get_name), sizeof (struct aac_get_name),
FsaNormal, FsaNormal,
0, 1, 0, 1,
(fib_callback) get_container_name_callback, (fib_callback)get_container_name_callback,
(void *) scsicmd); (void *) scsicmd);
/* /*
* Check that the command queued to the controller * Check that the command queued to the controller
*/ */
...@@ -449,7 +449,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd) ...@@ -449,7 +449,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd)
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
return 0; return 0;
} }
printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status); printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status);
aac_fib_complete(cmd_fibcontext); aac_fib_complete(cmd_fibcontext);
aac_fib_free(cmd_fibcontext); aac_fib_free(cmd_fibcontext);
...@@ -656,39 +656,39 @@ struct scsi_inq { ...@@ -656,39 +656,39 @@ struct scsi_inq {
* @a: string to copy from * @a: string to copy from
* @b: string to copy to * @b: string to copy to
* *
* Copy a String from one location to another * Copy a String from one location to another
* without copying \0 * without copying \0
*/ */
static void inqstrcpy(char *a, char *b) static void inqstrcpy(char *a, char *b)
{ {
while(*a != (char)0) while (*a != (char)0)
*b++ = *a++; *b++ = *a++;
} }
static char *container_types[] = { static char *container_types[] = {
"None", "None",
"Volume", "Volume",
"Mirror", "Mirror",
"Stripe", "Stripe",
"RAID5", "RAID5",
"SSRW", "SSRW",
"SSRO", "SSRO",
"Morph", "Morph",
"Legacy", "Legacy",
"RAID4", "RAID4",
"RAID10", "RAID10",
"RAID00", "RAID00",
"V-MIRRORS", "V-MIRRORS",
"PSEUDO R4", "PSEUDO R4",
"RAID50", "RAID50",
"RAID5D", "RAID5D",
"RAID5D0", "RAID5D0",
"RAID1E", "RAID1E",
"RAID6", "RAID6",
"RAID60", "RAID60",
"Unknown" "Unknown"
}; };
char * get_container_type(unsigned tindex) char * get_container_type(unsigned tindex)
...@@ -1230,11 +1230,11 @@ int aac_get_adapter_info(struct aac_dev* dev) ...@@ -1230,11 +1230,11 @@ int aac_get_adapter_info(struct aac_dev* dev)
memset(info,0,sizeof(*info)); memset(info,0,sizeof(*info));
rcode = aac_fib_send(RequestAdapterInfo, rcode = aac_fib_send(RequestAdapterInfo,
fibptr, fibptr,
sizeof(*info), sizeof(*info),
FsaNormal, FsaNormal,
-1, 1, /* First `interrupt' command uses special wait */ -1, 1, /* First `interrupt' command uses special wait */
NULL, NULL,
NULL); NULL);
if (rcode < 0) { if (rcode < 0) {
...@@ -1266,8 +1266,8 @@ int aac_get_adapter_info(struct aac_dev* dev) ...@@ -1266,8 +1266,8 @@ int aac_get_adapter_info(struct aac_dev* dev)
} }
/* /*
* GetBusInfo * GetBusInfo
*/ */
aac_fib_init(fibptr); aac_fib_init(fibptr);
...@@ -1301,7 +1301,7 @@ int aac_get_adapter_info(struct aac_dev* dev) ...@@ -1301,7 +1301,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
char buffer[16]; char buffer[16];
tmp = le32_to_cpu(dev->adapter_info.kernelrev); tmp = le32_to_cpu(dev->adapter_info.kernelrev);
printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n", printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n",
dev->name, dev->name,
dev->id, dev->id,
tmp>>24, tmp>>24,
(tmp>>16)&0xff, (tmp>>16)&0xff,
...@@ -1363,7 +1363,7 @@ int aac_get_adapter_info(struct aac_dev* dev) ...@@ -1363,7 +1363,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
if (dev->raid_scsi_mode != 0) if (dev->raid_scsi_mode != 0)
printk(KERN_INFO "%s%d: ROMB RAID/SCSI mode enabled\n", printk(KERN_INFO "%s%d: ROMB RAID/SCSI mode enabled\n",
dev->name, dev->id); dev->name, dev->id);
if (nondasd != -1) if (nondasd != -1)
dev->nondasd_support = (nondasd!=0); dev->nondasd_support = (nondasd!=0);
if(dev->nondasd_support != 0) { if(dev->nondasd_support != 0) {
...@@ -1395,7 +1395,7 @@ int aac_get_adapter_info(struct aac_dev* dev) ...@@ -1395,7 +1395,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
rcode = -ENOMEM; rcode = -ENOMEM;
} }
} }
/* /*
* Deal with configuring for the individualized limits of each packet * Deal with configuring for the individualized limits of each packet
* interface. * interface.
*/ */
...@@ -1419,8 +1419,8 @@ int aac_get_adapter_info(struct aac_dev* dev) ...@@ -1419,8 +1419,8 @@ int aac_get_adapter_info(struct aac_dev* dev)
if (dev->dac_support) { if (dev->dac_support) {
dev->a_ops.adapter_read = aac_read_block64; dev->a_ops.adapter_read = aac_read_block64;
dev->a_ops.adapter_write = aac_write_block64; dev->a_ops.adapter_write = aac_write_block64;
/* /*
* 38 scatter gather elements * 38 scatter gather elements
*/ */
dev->scsi_host_ptr->sg_tablesize = dev->scsi_host_ptr->sg_tablesize =
(dev->max_fib_size - (dev->max_fib_size -
...@@ -1549,7 +1549,7 @@ static int aac_read(struct scsi_cmnd * scsicmd) ...@@ -1549,7 +1549,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)
case READ_6: case READ_6:
dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", scmd_id(scsicmd))); 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]; (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3];
count = scsicmd->cmnd[4]; count = scsicmd->cmnd[4];
...@@ -1559,32 +1559,32 @@ static int aac_read(struct scsi_cmnd * scsicmd) ...@@ -1559,32 +1559,32 @@ static int aac_read(struct scsi_cmnd * scsicmd)
case READ_16: case READ_16:
dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", scmd_id(scsicmd))); dprintk((KERN_DEBUG "aachba: received a read(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[3] << 48) |
((u64)scsicmd->cmnd[4] << 40) | ((u64)scsicmd->cmnd[4] << 40) |
((u64)scsicmd->cmnd[5] << 32) | ((u64)scsicmd->cmnd[5] << 32) |
((u64)scsicmd->cmnd[6] << 24) | ((u64)scsicmd->cmnd[6] << 24) |
(scsicmd->cmnd[7] << 16) | (scsicmd->cmnd[7] << 16) |
(scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
count = (scsicmd->cmnd[10] << 24) | count = (scsicmd->cmnd[10] << 24) |
(scsicmd->cmnd[11] << 16) | (scsicmd->cmnd[11] << 16) |
(scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13];
break; break;
case READ_12: case READ_12:
dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", scmd_id(scsicmd))); 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[3] << 16) |
(scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
count = (scsicmd->cmnd[6] << 24) | count = (scsicmd->cmnd[6] << 24) |
(scsicmd->cmnd[7] << 16) | (scsicmd->cmnd[7] << 16) |
(scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
break; break;
default: default:
dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", scmd_id(scsicmd))); dprintk((KERN_DEBUG "aachba: received a read(10) 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[3] << 16) |
(scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8];
break; break;
...@@ -1609,7 +1609,7 @@ static int aac_read(struct scsi_cmnd * scsicmd) ...@@ -1609,7 +1609,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
return 0; return 0;
} }
printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status); 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 * For some reason, the Fib didn't queue, return QUEUE_FULL
...@@ -1644,11 +1644,11 @@ static int aac_write(struct scsi_cmnd * scsicmd) ...@@ -1644,11 +1644,11 @@ static int aac_write(struct scsi_cmnd * scsicmd)
} else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */ } 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))); 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[3] << 48) |
((u64)scsicmd->cmnd[4] << 40) | ((u64)scsicmd->cmnd[4] << 40) |
((u64)scsicmd->cmnd[5] << 32) | ((u64)scsicmd->cmnd[5] << 32) |
((u64)scsicmd->cmnd[6] << 24) | ((u64)scsicmd->cmnd[6] << 24) |
(scsicmd->cmnd[7] << 16) | (scsicmd->cmnd[7] << 16) |
(scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9];
count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) | count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) |
...@@ -1875,14 +1875,14 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd) ...@@ -1875,14 +1875,14 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
* Emulate a SCSI command and queue the required request for the * Emulate a SCSI command and queue the required request for the
* aacraid firmware. * aacraid firmware.
*/ */
int aac_scsi_cmd(struct scsi_cmnd * scsicmd) int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
{ {
u32 cid; u32 cid;
struct Scsi_Host *host = scsicmd->device->host; struct Scsi_Host *host = scsicmd->device->host;
struct aac_dev *dev = (struct aac_dev *)host->hostdata; struct aac_dev *dev = (struct aac_dev *)host->hostdata;
struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev;
if (fsa_dev_ptr == NULL) if (fsa_dev_ptr == NULL)
return -1; return -1;
/* /*
...@@ -1938,7 +1938,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) ...@@ -1938,7 +1938,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
* else Command for the controller itself * else Command for the controller itself
*/ */
else if ((scsicmd->cmnd[0] != INQUIRY) && /* only INQUIRY & TUR cmnd supported for controller */ 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])); 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; 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,7 +1963,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", cid)); dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", cid));
memset(&inq_data, 0, sizeof (struct inquiry_data)); memset(&inq_data, 0, sizeof (struct inquiry_data));
if (scsicmd->cmnd[1] & 0x1 ) { if (scsicmd->cmnd[1] & 0x1) {
char *arr = (char *)&inq_data; char *arr = (char *)&inq_data;
/* EVPD bit set */ /* EVPD bit set */
...@@ -2204,7 +2204,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) ...@@ -2204,7 +2204,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
return 0; return 0;
} }
switch (scsicmd->cmnd[0]) switch (scsicmd->cmnd[0])
{ {
case READ_6: case READ_6:
case READ_10: case READ_10:
...@@ -2217,11 +2217,11 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) ...@@ -2217,11 +2217,11 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
* corresponds to a container. Needed to convert * corresponds to a container. Needed to convert
* containers to /dev/sd device names * containers to /dev/sd device names
*/ */
if (scsicmd->request->rq_disk) if (scsicmd->request->rq_disk)
strlcpy(fsa_dev_ptr[cid].devname, strlcpy(fsa_dev_ptr[cid].devname,
scsicmd->request->rq_disk->disk_name, 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)); sizeof(scsicmd->request->rq_disk->disk_name) + 1));
return aac_read(scsicmd); return aac_read(scsicmd);
...@@ -2275,7 +2275,7 @@ static int query_disk(struct aac_dev *dev, void __user *arg) ...@@ -2275,7 +2275,7 @@ static int query_disk(struct aac_dev *dev, void __user *arg)
return -EFAULT; return -EFAULT;
if (qd.cnum == -1) if (qd.cnum == -1)
qd.cnum = qd.id; 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) if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers)
return -EINVAL; return -EINVAL;
...@@ -2402,7 +2402,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) ...@@ -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 */ 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) scsi_set_resid(scsicmd, scsi_bufflen(scsicmd)
...@@ -2442,7 +2442,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) ...@@ -2442,7 +2442,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
case WRITE_12: case WRITE_12:
case READ_16: case READ_16:
case WRITE_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"); printk(KERN_WARNING"aacraid: SCSI CMD underflow\n");
} else { } else {
printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n"); printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n");
...@@ -2511,14 +2511,14 @@ static void aac_srb_callback(void *context, struct fib * fibptr) ...@@ -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", printk("aacraid: SRB ERROR(%u) %s scsi cmd 0x%x - scsi status 0x%x\n",
le32_to_cpu(srbreply->srb_status) & 0x3F, le32_to_cpu(srbreply->srb_status) & 0x3F,
aac_get_status_string( aac_get_status_string(
le32_to_cpu(srbreply->srb_status) & 0x3F), le32_to_cpu(srbreply->srb_status) & 0x3F),
scsicmd->cmnd[0], scsicmd->cmnd[0],
le32_to_cpu(srbreply->scsi_status)); le32_to_cpu(srbreply->scsi_status));
#endif #endif
scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8; scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8;
break; break;
} }
if (le32_to_cpu(srbreply->scsi_status) == 0x02 ){ // Check Condition if (le32_to_cpu(srbreply->scsi_status) == SAM_STAT_CHECK_CONDITION) {
int len; int len;
scsicmd->result |= SAM_STAT_CHECK_CONDITION; scsicmd->result |= SAM_STAT_CHECK_CONDITION;
len = min_t(u32, le32_to_cpu(srbreply->sense_data_size), 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,7 +2528,6 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
le32_to_cpu(srbreply->status), len); le32_to_cpu(srbreply->status), len);
#endif #endif
memcpy(scsicmd->sense_buffer, srbreply->sense_data, len); memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
} }
/* /*
* OR in the scsi status (already shifted up a bit) * 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,7 +2544,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
* aac_send_scb_fib * aac_send_scb_fib
* @scsicmd: the scsi command block * @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. * scsicmd passed in.
*/ */
...@@ -2759,7 +2758,7 @@ static struct aac_srb_status_info srb_status_info[] = { ...@@ -2759,7 +2758,7 @@ static struct aac_srb_status_info srb_status_info[] = {
{ SRB_STATUS_ERROR_RECOVERY, "Error Recovery"}, { SRB_STATUS_ERROR_RECOVERY, "Error Recovery"},
{ SRB_STATUS_NOT_STARTED, "Not Started"}, { SRB_STATUS_NOT_STARTED, "Not Started"},
{ SRB_STATUS_NOT_IN_USE, "Not In Use"}, { 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"}, { SRB_STATUS_DOMAIN_VALIDATION_FAIL,"Domain Validation Failure"},
{ 0xff, "Unknown Error"} { 0xff, "Unknown Error"}
}; };
......
此差异已折叠。
...@@ -48,13 +48,13 @@ ...@@ -48,13 +48,13 @@
* ioctl_send_fib - send a FIB from userspace * ioctl_send_fib - send a FIB from userspace
* @dev: adapter is being processed * @dev: adapter is being processed
* @arg: arguments to the ioctl call * @arg: arguments to the ioctl call
* *
* This routine sends a fib to the adapter on behalf of a user level * This routine sends a fib to the adapter on behalf of a user level
* program. * program.
*/ */
# define AAC_DEBUG_PREAMBLE KERN_INFO # define AAC_DEBUG_PREAMBLE KERN_INFO
# define AAC_DEBUG_POSTAMBLE # define AAC_DEBUG_POSTAMBLE
static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
{ {
struct hw_fib * kfib; struct hw_fib * kfib;
...@@ -71,7 +71,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) ...@@ -71,7 +71,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
if(fibptr == NULL) { if(fibptr == NULL) {
return -ENOMEM; return -ENOMEM;
} }
kfib = fibptr->hw_fib_va; kfib = fibptr->hw_fib_va;
/* /*
* First copy in the header so that we can check the size field. * 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,7 +109,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) { if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) {
aac_adapter_interrupt(dev); 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. * cleanup code not to assert.
*/ */
kfib->header.XferState = 0; kfib->header.XferState = 0;
...@@ -169,7 +169,7 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) ...@@ -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->type = FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT;
fibctx->size = sizeof(struct aac_fib_context); fibctx->size = sizeof(struct aac_fib_context);
/* /*
* Yes yes, I know this could be an index, but we have a * Yes yes, I know this could be an index, but we have a
* better guarantee of uniqueness for the locked loop below. * better guarantee of uniqueness for the locked loop below.
* Without the aid of a persistent history, this also helps * 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,7 +189,7 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg)
INIT_LIST_HEAD(&fibctx->fib_list); INIT_LIST_HEAD(&fibctx->fib_list);
fibctx->jiffies = jiffies/HZ; fibctx->jiffies = jiffies/HZ;
/* /*
* Now add this context onto the adapter's * Now add this context onto the adapter's
* AdapterFibContext list. * AdapterFibContext list.
*/ */
spin_lock_irqsave(&dev->fib_lock, flags); spin_lock_irqsave(&dev->fib_lock, flags);
...@@ -207,12 +207,12 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) ...@@ -207,12 +207,12 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg)
} }
list_add_tail(&fibctx->next, &dev->fib_list); list_add_tail(&fibctx->next, &dev->fib_list);
spin_unlock_irqrestore(&dev->fib_lock, flags); spin_unlock_irqrestore(&dev->fib_lock, flags);
if (copy_to_user(arg, &fibctx->unique, if (copy_to_user(arg, &fibctx->unique,
sizeof(fibctx->unique))) { sizeof(fibctx->unique))) {
status = -EFAULT; status = -EFAULT;
} else { } else {
status = 0; status = 0;
} }
} }
return status; return status;
} }
...@@ -221,8 +221,8 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) ...@@ -221,8 +221,8 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg)
* next_getadapter_fib - get the next fib * next_getadapter_fib - get the next fib
* @dev: adapter to use * @dev: adapter to use
* @arg: ioctl argument * @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. * passed in from the user.
*/ */
...@@ -234,7 +234,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) ...@@ -234,7 +234,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg)
int status; int status;
struct list_head * entry; struct list_head * entry;
unsigned long flags; unsigned long flags;
if(copy_from_user((void *)&f, arg, sizeof(struct fib_ioctl))) if(copy_from_user((void *)&f, arg, sizeof(struct fib_ioctl)))
return -EFAULT; return -EFAULT;
/* /*
...@@ -280,7 +280,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) ...@@ -280,7 +280,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg)
*/ */
entry = fibctx->fib_list.next; entry = fibctx->fib_list.next;
list_del(entry); list_del(entry);
fib = list_entry(entry, struct fib, fiblink); fib = list_entry(entry, struct fib, fiblink);
fibctx->count--; fibctx->count--;
spin_unlock_irqrestore(&dev->fib_lock, flags); spin_unlock_irqrestore(&dev->fib_lock, flags);
...@@ -288,7 +288,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) ...@@ -288,7 +288,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg)
kfree(fib->hw_fib_va); kfree(fib->hw_fib_va);
kfree(fib); kfree(fib);
return -EFAULT; return -EFAULT;
} }
/* /*
* Free the space occupied by this copy of the fib. * Free the space occupied by this copy of the fib.
*/ */
...@@ -317,7 +317,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) ...@@ -317,7 +317,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg)
} }
} else { } else {
status = -EAGAIN; status = -EAGAIN;
} }
} }
fibctx->jiffies = jiffies/HZ; fibctx->jiffies = jiffies/HZ;
return status; return status;
...@@ -367,7 +367,7 @@ int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx) ...@@ -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. * This routine will close down the fibctx passed in from the user.
*/ */
static int close_getadapter_fib(struct aac_dev * dev, void __user *arg) static int close_getadapter_fib(struct aac_dev * dev, void __user *arg)
{ {
struct aac_fib_context *fibctx; struct aac_fib_context *fibctx;
...@@ -414,7 +414,7 @@ static int close_getadapter_fib(struct aac_dev * dev, void __user *arg) ...@@ -414,7 +414,7 @@ static int close_getadapter_fib(struct aac_dev * dev, void __user *arg)
* @arg: ioctl arguments * @arg: ioctl arguments
* *
* This routine returns the driver version. * 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! * simple!
*/ */
...@@ -425,12 +425,12 @@ static int check_revision(struct aac_dev *dev, void __user *arg) ...@@ -425,12 +425,12 @@ static int check_revision(struct aac_dev *dev, void __user *arg)
u32 version; u32 version;
response.compat = 1; response.compat = 1;
version = (simple_strtol(driver_version, version = (simple_strtol(driver_version,
&driver_version, 10) << 24) | 0x00000400; &driver_version, 10) << 24) | 0x00000400;
version += simple_strtol(driver_version + 1, &driver_version, 10) << 16; version += simple_strtol(driver_version + 1, &driver_version, 10) << 16;
version += simple_strtol(driver_version + 1, NULL, 10); version += simple_strtol(driver_version + 1, NULL, 10);
response.version = cpu_to_le32(version); response.version = cpu_to_le32(version);
# if (defined(AAC_DRIVER_BUILD)) # ifdef AAC_DRIVER_BUILD
response.build = cpu_to_le32(AAC_DRIVER_BUILD); response.build = cpu_to_le32(AAC_DRIVER_BUILD);
# else # else
response.build = cpu_to_le32(9999); response.build = cpu_to_le32(9999);
...@@ -474,7 +474,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) ...@@ -474,7 +474,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
return -EBUSY; return -EBUSY;
} }
if (!capable(CAP_SYS_ADMIN)){ 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; return -EPERM;
} }
/* /*
...@@ -489,7 +489,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) ...@@ -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 */ memset(sg_list, 0, sizeof(sg_list)); /* cleanup may take issue */
if(copy_from_user(&fibsize, &user_srb->count,sizeof(u32))){ 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; rcode = -EFAULT;
goto cleanup; goto cleanup;
} }
...@@ -506,7 +506,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) ...@@ -506,7 +506,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
goto cleanup; goto cleanup;
} }
if(copy_from_user(user_srbcmd, user_srb,fibsize)){ 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; rcode = -EFAULT;
goto cleanup; goto cleanup;
} }
...@@ -525,7 +525,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) ...@@ -525,7 +525,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
srbcmd->retry_limit = 0; // Obsolete parameter srbcmd->retry_limit = 0; // Obsolete parameter
srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size); srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size);
memcpy(srbcmd->cdb, user_srbcmd->cdb, sizeof(srbcmd->cdb)); memcpy(srbcmd->cdb, user_srbcmd->cdb, sizeof(srbcmd->cdb));
switch (flags & (SRB_DataIn | SRB_DataOut)) { switch (flags & (SRB_DataIn | SRB_DataOut)) {
case SRB_DataOut: case SRB_DataOut:
data_dir = DMA_TO_DEVICE; data_dir = DMA_TO_DEVICE;
...@@ -593,7 +593,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) ...@@ -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_list[i] = p; // save so we can clean up later
sg_indx = i; sg_indx = i;
if( flags & SRB_DataOut ){ if (flags & SRB_DataOut) {
if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){
dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
rcode = -EFAULT; rcode = -EFAULT;
...@@ -636,7 +636,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) ...@@ -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_list[i] = p; // save so we can clean up later
sg_indx = i; sg_indx = i;
if( flags & SRB_DataOut ){ if (flags & SRB_DataOut) {
if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){
kfree (usg); kfree (usg);
dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); 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,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_list[i] = p; // save so we can clean up later
sg_indx = i; sg_indx = i;
if( flags & SRB_DataOut ){ if (flags & SRB_DataOut) {
if(copy_from_user(p,sg_user[i],usg->sg[i].count)){ if(copy_from_user(p,sg_user[i],usg->sg[i].count)){
dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
rcode = -EFAULT; rcode = -EFAULT;
...@@ -707,7 +707,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) ...@@ -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_list[i] = p; // save so we can clean up later
sg_indx = i; sg_indx = i;
if( flags & SRB_DataOut ){ if (flags & SRB_DataOut) {
if(copy_from_user(p, sg_user[i], if(copy_from_user(p, sg_user[i],
upsg->sg[i].count)) { upsg->sg[i].count)) {
dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); 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,19 +733,19 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
} }
if (status != 0){ 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; rcode = -ENXIO;
goto cleanup; goto cleanup;
} }
if( flags & SRB_DataIn ) { if (flags & SRB_DataIn) {
for(i = 0 ; i <= sg_indx; i++){ for(i = 0 ; i <= sg_indx; i++){
byte_count = le32_to_cpu( byte_count = le32_to_cpu(
(dev->adapter_info.options & AAC_OPT_SGMAP_HOST64) (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64)
? ((struct sgmap64*)&srbcmd->sg)->sg[i].count ? ((struct sgmap64*)&srbcmd->sg)->sg[i].count
: srbcmd->sg.sg[i].count); : srbcmd->sg.sg[i].count);
if(copy_to_user(sg_user[i], sg_list[i], byte_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; rcode = -EFAULT;
goto cleanup; goto cleanup;
...@@ -755,7 +755,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) ...@@ -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); reply = (struct aac_srb_reply *) fib_data(srbfib);
if(copy_to_user(user_reply,reply,sizeof(struct aac_srb_reply))){ 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; rcode = -EFAULT;
goto cleanup; goto cleanup;
} }
...@@ -774,34 +774,34 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) ...@@ -774,34 +774,34 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
} }
struct aac_pci_info { struct aac_pci_info {
u32 bus; u32 bus;
u32 slot; u32 slot;
}; };
static int aac_get_pci_info(struct aac_dev* dev, void __user *arg) 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.bus = dev->pdev->bus->number;
pci_info.slot = PCI_SLOT(dev->pdev->devfn); pci_info.slot = PCI_SLOT(dev->pdev->devfn);
if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) { if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) {
dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n")); dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n"));
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
} }
int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg) int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg)
{ {
int status; int status;
/* /*
* HBA gets first crack * HBA gets first crack
*/ */
status = aac_dev_ioctl(dev, cmd, arg); status = aac_dev_ioctl(dev, cmd, arg);
if(status != -ENOTTY) if(status != -ENOTTY)
return status; return status;
...@@ -831,7 +831,7 @@ int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg) ...@@ -831,7 +831,7 @@ int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg)
break; break;
default: default:
status = -ENOTTY; status = -ENOTTY;
break; break;
} }
return status; return status;
} }
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
* Allocate and map the shared PCI space for the FIB blocks used to * Allocate and map the shared PCI space for the FIB blocks used to
* talk to the Adaptec firmware. * talk to the Adaptec firmware.
*/ */
static int fib_map_alloc(struct aac_dev *dev) static int fib_map_alloc(struct aac_dev *dev)
{ {
dprintk((KERN_INFO dprintk((KERN_INFO
...@@ -109,14 +109,16 @@ int aac_fib_setup(struct aac_dev * dev) ...@@ -109,14 +109,16 @@ int aac_fib_setup(struct aac_dev * dev)
} }
if (i<0) if (i<0)
return -ENOMEM; return -ENOMEM;
hw_fib = dev->hw_fib_va; hw_fib = dev->hw_fib_va;
hw_fib_pa = dev->hw_fib_pa; 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)); memset(hw_fib, 0, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB));
/* /*
* Initialise the fibs * 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->dev = dev;
fibptr->hw_fib_va = hw_fib; fibptr->hw_fib_va = hw_fib;
...@@ -148,13 +150,13 @@ int aac_fib_setup(struct aac_dev * dev) ...@@ -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 * Allocate a fib from the adapter fib pool. If the pool is empty we
* return NULL. * return NULL.
*/ */
struct fib *aac_fib_alloc(struct aac_dev *dev) struct fib *aac_fib_alloc(struct aac_dev *dev)
{ {
struct fib * fibptr; struct fib * fibptr;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&dev->fib_lock, flags); spin_lock_irqsave(&dev->fib_lock, flags);
fibptr = dev->free_fib; fibptr = dev->free_fib;
if(!fibptr){ if(!fibptr){
spin_unlock_irqrestore(&dev->fib_lock, flags); spin_unlock_irqrestore(&dev->fib_lock, flags);
return fibptr; return fibptr;
...@@ -184,7 +186,7 @@ struct fib *aac_fib_alloc(struct aac_dev *dev) ...@@ -184,7 +186,7 @@ struct fib *aac_fib_alloc(struct aac_dev *dev)
* *
* Frees up a fib and places it on the appropriate queue * Frees up a fib and places it on the appropriate queue
*/ */
void aac_fib_free(struct fib *fibptr) void aac_fib_free(struct fib *fibptr)
{ {
unsigned long flags; unsigned long flags;
...@@ -205,10 +207,10 @@ void aac_fib_free(struct fib *fibptr) ...@@ -205,10 +207,10 @@ void aac_fib_free(struct fib *fibptr)
/** /**
* aac_fib_init - initialise a fib * aac_fib_init - initialise a fib
* @fibptr: The fib to initialize * @fibptr: The fib to initialize
* *
* Set up the generic fib fields ready for use * Set up the generic fib fields ready for use
*/ */
void aac_fib_init(struct fib *fibptr) void aac_fib_init(struct fib *fibptr)
{ {
struct hw_fib *hw_fib = fibptr->hw_fib_va; struct hw_fib *hw_fib = fibptr->hw_fib_va;
...@@ -228,12 +230,12 @@ void aac_fib_init(struct fib *fibptr) ...@@ -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 * Will deallocate and return to the free pool the FIB pointed to by the
* caller. * caller.
*/ */
static void fib_dealloc(struct fib * fibptr) static void fib_dealloc(struct fib * fibptr)
{ {
struct hw_fib *hw_fib = fibptr->hw_fib_va; struct hw_fib *hw_fib = fibptr->hw_fib_va;
BUG_ON(hw_fib->header.StructType != FIB_MAGIC); 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) ...@@ -242,7 +244,7 @@ static void fib_dealloc(struct fib * fibptr)
* these routines and are the only routines which have a knowledge of the * these routines and are the only routines which have a knowledge of the
* how these queues are implemented. * how these queues are implemented.
*/ */
/** /**
* aac_get_entry - get a queue entry * aac_get_entry - get a queue entry
* @dev: Adapter * @dev: Adapter
...@@ -255,7 +257,7 @@ static void fib_dealloc(struct fib * fibptr) ...@@ -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 * is full(no free entries) than no entry is returned and the function returns 0 otherwise 1 is
* returned. * returned.
*/ */
static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entry, u32 * index, unsigned long *nonotify) static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entry, u32 * index, unsigned long *nonotify)
{ {
struct aac_queue * q; struct aac_queue * q;
...@@ -280,26 +282,27 @@ static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entr ...@@ -280,26 +282,27 @@ static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entr
idx = ADAP_NORM_RESP_ENTRIES; idx = ADAP_NORM_RESP_ENTRIES;
} }
if (idx != le32_to_cpu(*(q->headers.consumer))) if (idx != le32_to_cpu(*(q->headers.consumer)))
*nonotify = 1; *nonotify = 1;
} }
if (qid == AdapNormCmdQueue) { if (qid == AdapNormCmdQueue) {
if (*index >= ADAP_NORM_CMD_ENTRIES) if (*index >= ADAP_NORM_CMD_ENTRIES)
*index = 0; /* Wrap to front of the Producer Queue. */ *index = 0; /* Wrap to front of the Producer Queue. */
} else { } else {
if (*index >= ADAP_NORM_RESP_ENTRIES) if (*index >= ADAP_NORM_RESP_ENTRIES)
*index = 0; /* Wrap to front of the Producer Queue. */ *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", printk(KERN_WARNING "Queue %d full, %u outstanding.\n",
qid, q->numpending); qid, q->numpending);
return 0; return 0;
} else { } else {
*entry = q->base + *index; *entry = q->base + *index;
return 1; return 1;
} }
} }
/** /**
* aac_queue_get - get the next free QE * 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,31 +324,29 @@ int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw
{ {
struct aac_entry * entry = NULL; struct aac_entry * entry = NULL;
int map = 0; int map = 0;
if (qid == AdapNormCmdQueue) { if (qid == AdapNormCmdQueue) {
/* if no entries wait for some if caller wants to */ /* 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"); printk(KERN_ERR "GetEntries failed\n");
} }
/* /*
* Setup queue entry with a command, status and fib mapped * Setup queue entry with a command, status and fib mapped
*/ */
entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size));
map = 1; map = 1;
} else { } 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 */ /* if no entries wait for some if caller wants to */
} }
/* /*
* Setup queue entry with command, status and fib mapped * Setup queue entry with command, status and fib mapped
*/ */
entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size));
entry->addr = hw_fib->header.SenderFibAddress; entry->addr = hw_fib->header.SenderFibAddress;
/* Restore adapters pointer to the FIB */ /* Restore adapters pointer to the FIB */
hw_fib->header.ReceiverFibAddress = hw_fib->header.SenderFibAddress; /* Let the adapter now where to find its data */ 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 * 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,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. * Define the highest level of host to adapter communication routines.
* These routines will support host to adapter FS commuication. These * These routines will support host to adapter FS commuication. These
* routines have no knowledge of the commuication method used. This level * routines have no knowledge of the commuication method used. This level
* sends and receives FIBs. This level has no knowledge of how these FIBs * sends and receives FIBs. This level has no knowledge of how these FIBs
* get passed back and forth. * 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,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 * an event to wait on must be supplied. This event will be set when a
* response FIB is received from the adapter. * response FIB is received from the adapter.
*/ */
int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
int priority, int wait, int reply, fib_callback callback, int priority, int wait, int reply, fib_callback callback,
void *callback_data) void *callback_data)
...@@ -393,13 +394,13 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, ...@@ -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))) if (!(hw_fib->header.XferState & cpu_to_le32(HostOwned)))
return -EBUSY; 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 * 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 * 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 * response and the Fib is not allocated from pool. If a response
* is not requesed the Fib will just be deallocaed by the DPC * is not requesed the Fib will just be deallocaed by the DPC
* routine when the response comes back from the adapter. No * 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 * will have a debug mode where the adapter can notify the host
* it had a problem and the host can log that fact. * 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, ...@@ -415,7 +416,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
} else if (wait && reply) { } else if (wait && reply) {
hw_fib->header.XferState |= cpu_to_le32(ResponseExpected); hw_fib->header.XferState |= cpu_to_le32(ResponseExpected);
FIB_COUNTER_INCREMENT(aac_config.NormalSent); FIB_COUNTER_INCREMENT(aac_config.NormalSent);
} }
/* /*
* Map the fib into 32bits by using the fib number * 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, ...@@ -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); 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)) { if (le16_to_cpu(hw_fib->header.Size) > le16_to_cpu(hw_fib->header.SenderSize)) {
return -EMSGSIZE; return -EMSGSIZE;
} }
/* /*
* Get a queue entry connect the FIB to it and send an notify * Get a queue entry connect the FIB to it and send an notify
* the adapter a command is ready. * the adapter a command is ready.
...@@ -475,9 +476,9 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, ...@@ -475,9 +476,9 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
aac_adapter_deliver(fibptr); 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) { if (wait) {
spin_unlock_irqrestore(&fibptr->event_lock, flags); spin_unlock_irqrestore(&fibptr->event_lock, flags);
/* Only set for first known interruptable command */ /* Only set for first known interruptable command */
...@@ -524,7 +525,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, ...@@ -524,7 +525,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
} }
spin_unlock_irqrestore(&fibptr->event_lock, flags); spin_unlock_irqrestore(&fibptr->event_lock, flags);
BUG_ON(fibptr->done == 0); BUG_ON(fibptr->done == 0);
if(unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)) if(unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT))
return -ETIMEDOUT; return -ETIMEDOUT;
return 0; return 0;
...@@ -539,15 +540,15 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, ...@@ -539,15 +540,15 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
return 0; return 0;
} }
/** /**
* aac_consumer_get - get the top of the queue * aac_consumer_get - get the top of the queue
* @dev: Adapter * @dev: Adapter
* @q: Queue * @q: Queue
* @entry: Return entry * @entry: Return entry
* *
* Will return a pointer to the entry on the top of the queue requested that * 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 * we are a consumer of, and return the address of the queue entry. It does
* not change the state of the queue. * not change the state of the queue.
*/ */
int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry) 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 ...@@ -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 * the end of the queue, else we just use the entry
* pointed to by the header index * pointed to by the header index
*/ */
if (le32_to_cpu(*q->headers.consumer) >= q->entries) if (le32_to_cpu(*q->headers.consumer) >= q->entries)
index = 0; index = 0;
else else
index = le32_to_cpu(*q->headers.consumer); index = le32_to_cpu(*q->headers.consumer);
*entry = q->base + index; *entry = q->base + index;
status = 1; status = 1;
} }
...@@ -589,12 +590,12 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid) ...@@ -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)) if ((le32_to_cpu(*q->headers.producer)+1) == le32_to_cpu(*q->headers.consumer))
wasfull = 1; wasfull = 1;
if (le32_to_cpu(*q->headers.consumer) >= q->entries) if (le32_to_cpu(*q->headers.consumer) >= q->entries)
*q->headers.consumer = cpu_to_le32(1); *q->headers.consumer = cpu_to_le32(1);
else else
*q->headers.consumer = cpu_to_le32(le32_to_cpu(*q->headers.consumer)+1); *q->headers.consumer = cpu_to_le32(le32_to_cpu(*q->headers.consumer)+1);
if (wasfull) { if (wasfull) {
switch (qid) { switch (qid) {
...@@ -610,7 +611,7 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 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_adapter_notify(dev, notify);
} }
} }
/** /**
* aac_fib_adapter_complete - complete adapter issued fib * aac_fib_adapter_complete - complete adapter issued fib
...@@ -632,32 +633,32 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) ...@@ -632,32 +633,32 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
if (hw_fib->header.XferState == 0) { if (hw_fib->header.XferState == 0) {
if (dev->comm_interface == AAC_COMM_MESSAGE) if (dev->comm_interface == AAC_COMM_MESSAGE)
kfree (hw_fib); kfree (hw_fib);
return 0; return 0;
} }
/* /*
* If we plan to do anything check the structure type first. * 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) if (dev->comm_interface == AAC_COMM_MESSAGE)
kfree (hw_fib); kfree (hw_fib);
return -EINVAL; return -EINVAL;
} }
/* /*
* This block handles the case where the adapter had sent us a * This block handles the case where the adapter had sent us a
* command and we have finished processing the command. We * command and we have finished processing the command. We
* call completeFib when we are done processing the command * call completeFib when we are done processing the command
* and want to send a response back to the adapter. This will * and want to send a response back to the adapter. This will
* send the completed cdb to the adapter. * send the completed cdb to the adapter.
*/ */
if (hw_fib->header.XferState & cpu_to_le32(SentFromAdapter)) { if (hw_fib->header.XferState & cpu_to_le32(SentFromAdapter)) {
if (dev->comm_interface == AAC_COMM_MESSAGE) { if (dev->comm_interface == AAC_COMM_MESSAGE) {
kfree (hw_fib); kfree (hw_fib);
} else { } else {
u32 index; u32 index;
hw_fib->header.XferState |= cpu_to_le32(HostProcessed); hw_fib->header.XferState |= cpu_to_le32(HostProcessed);
if (size) { if (size) {
size += sizeof(struct aac_fibhdr); 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; return -EMSGSIZE;
hw_fib->header.Size = cpu_to_le16(size); hw_fib->header.Size = cpu_to_le16(size);
} }
...@@ -669,12 +670,11 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) ...@@ -669,12 +670,11 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
if (!(nointr & (int)aac_config.irq_mod)) if (!(nointr & (int)aac_config.irq_mod))
aac_adapter_notify(dev, AdapNormRespQueue); 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; return 0;
} }
...@@ -684,7 +684,7 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) ...@@ -684,7 +684,7 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size)
* *
* Will do all necessary work to complete a FIB. * Will do all necessary work to complete a FIB.
*/ */
int aac_fib_complete(struct fib *fibptr) int aac_fib_complete(struct fib *fibptr)
{ {
struct hw_fib * hw_fib = fibptr->hw_fib_va; struct hw_fib * hw_fib = fibptr->hw_fib_va;
...@@ -694,15 +694,15 @@ int aac_fib_complete(struct fib *fibptr) ...@@ -694,15 +694,15 @@ int aac_fib_complete(struct fib *fibptr)
*/ */
if (hw_fib->header.XferState == 0) if (hw_fib->header.XferState == 0)
return 0; return 0;
/* /*
* If we plan to do anything check the structure type first. * 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)
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 * 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 * command is complete that we had sent to the adapter and this
* cdb could be reused. * cdb could be reused.
...@@ -723,7 +723,7 @@ int aac_fib_complete(struct fib *fibptr) ...@@ -723,7 +723,7 @@ int aac_fib_complete(struct fib *fibptr)
fib_dealloc(fibptr); fib_dealloc(fibptr);
} else { } else {
BUG(); BUG();
} }
return 0; return 0;
} }
...@@ -743,7 +743,7 @@ void aac_printf(struct aac_dev *dev, u32 val) ...@@ -743,7 +743,7 @@ void aac_printf(struct aac_dev *dev, u32 val)
{ {
int length = val & 0xffff; int length = val & 0xffff;
int level = (val >> 16) & 0xffff; int level = (val >> 16) & 0xffff;
/* /*
* The size of the printfbuf is set in port.c * The size of the printfbuf is set in port.c
* There is no variable or define for it * There is no variable or define for it
...@@ -757,7 +757,7 @@ void aac_printf(struct aac_dev *dev, u32 val) ...@@ -757,7 +757,7 @@ void aac_printf(struct aac_dev *dev, u32 val)
else else
printk(KERN_INFO "%s:%s", dev->name, cp); 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) ...@@ -816,9 +816,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
*/ */
if ((dev != NULL) && (dev->scsi_host_ptr != NULL)) { if ((dev != NULL) && (dev->scsi_host_ptr != NULL)) {
device = scsi_device_lookup(dev->scsi_host_ptr, device = scsi_device_lookup(dev->scsi_host_ptr,
CONTAINER_TO_CHANNEL(container), CONTAINER_TO_CHANNEL(container),
CONTAINER_TO_ID(container), CONTAINER_TO_ID(container),
CONTAINER_TO_LUN(container)); CONTAINER_TO_LUN(container));
if (device) { if (device) {
dev->fsa_dev[container].config_needed = CHANGE; dev->fsa_dev[container].config_needed = CHANGE;
...@@ -1184,13 +1184,13 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) ...@@ -1184,13 +1184,13 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced)
} }
(void)aac_get_adapter_info(aac); (void)aac_get_adapter_info(aac);
if ((quirks & AAC_QUIRK_34SG) && (host->sg_tablesize > 34)) { if ((quirks & AAC_QUIRK_34SG) && (host->sg_tablesize > 34)) {
host->sg_tablesize = 34; host->sg_tablesize = 34;
host->max_sectors = (host->sg_tablesize * 8) + 112; host->max_sectors = (host->sg_tablesize * 8) + 112;
} }
if ((quirks & AAC_QUIRK_17SG) && (host->sg_tablesize > 17)) { if ((quirks & AAC_QUIRK_17SG) && (host->sg_tablesize > 17)) {
host->sg_tablesize = 17; host->sg_tablesize = 17;
host->max_sectors = (host->sg_tablesize * 8) + 112; host->max_sectors = (host->sg_tablesize * 8) + 112;
} }
aac_get_config_status(aac, 1); aac_get_config_status(aac, 1);
aac_get_containers(aac); aac_get_containers(aac);
/* /*
...@@ -1461,7 +1461,7 @@ int aac_check_health(struct aac_dev * aac) ...@@ -1461,7 +1461,7 @@ int aac_check_health(struct aac_dev * aac)
* until the queue is empty. When the queue is empty it will wait for * until the queue is empty. When the queue is empty it will wait for
* more FIBs. * more FIBs.
*/ */
int aac_command_thread(void *data) int aac_command_thread(void *data)
{ {
struct aac_dev *dev = data; struct aac_dev *dev = data;
...@@ -1487,30 +1487,29 @@ int aac_command_thread(void *data) ...@@ -1487,30 +1487,29 @@ int aac_command_thread(void *data)
add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait); add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
dprintk ((KERN_INFO "aac_command_thread start\n")); dprintk ((KERN_INFO "aac_command_thread start\n"));
while(1) while (1) {
{
spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags); spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags);
while(!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) { while(!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) {
struct list_head *entry; struct list_head *entry;
struct aac_aifcmd * aifcmd; struct aac_aifcmd * aifcmd;
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
entry = dev->queues->queue[HostNormCmdQueue].cmdq.next; entry = dev->queues->queue[HostNormCmdQueue].cmdq.next;
list_del(entry); list_del(entry);
spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags); spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags);
fib = list_entry(entry, struct fib, fiblink); fib = list_entry(entry, struct fib, fiblink);
/* /*
* We will process the FIB here or pass it to a * We will process the FIB here or pass it to a
* worker thread that is TBD. We Really can't * worker thread that is TBD. We Really can't
* do anything at this point since we don't have * do anything at this point since we don't have
* anything defined for this thread to do. * anything defined for this thread to do.
*/ */
hw_fib = fib->hw_fib_va; hw_fib = fib->hw_fib_va;
memset(fib, 0, sizeof(struct fib)); memset(fib, 0, sizeof(struct fib));
fib->type = FSAFS_NTC_FIB_CONTEXT; fib->type = FSAFS_NTC_FIB_CONTEXT;
fib->size = sizeof( struct fib ); fib->size = sizeof(struct fib);
fib->hw_fib_va = hw_fib; fib->hw_fib_va = hw_fib;
fib->data = hw_fib->data; fib->data = hw_fib->data;
fib->dev = dev; fib->dev = dev;
...@@ -1526,17 +1525,17 @@ int aac_command_thread(void *data) ...@@ -1526,17 +1525,17 @@ int aac_command_thread(void *data)
} else { } else {
/* The u32 here is important and intended. We are using /* The u32 here is important and intended. We are using
32bit wrapping time to fit the adapter field */ 32bit wrapping time to fit the adapter field */
u32 time_now, time_last; u32 time_now, time_last;
unsigned long flagv; unsigned long flagv;
unsigned num; unsigned num;
struct hw_fib ** hw_fib_pool, ** hw_fib_p; struct hw_fib ** hw_fib_pool, ** hw_fib_p;
struct fib ** fib_pool, ** fib_p; struct fib ** fib_pool, ** fib_p;
/* Sniff events */ /* Sniff events */
if ((aifcmd->command == if ((aifcmd->command ==
cpu_to_le32(AifCmdEventNotify)) || cpu_to_le32(AifCmdEventNotify)) ||
(aifcmd->command == (aifcmd->command ==
cpu_to_le32(AifCmdJobProgress))) { cpu_to_le32(AifCmdJobProgress))) {
aac_handle_aif(dev, fib); aac_handle_aif(dev, fib);
} }
...@@ -1588,7 +1587,7 @@ int aac_command_thread(void *data) ...@@ -1588,7 +1587,7 @@ int aac_command_thread(void *data)
spin_lock_irqsave(&dev->fib_lock, flagv); spin_lock_irqsave(&dev->fib_lock, flagv);
entry = dev->fib_list.next; 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 * fibctxList, make a copy of the
* fib, and then set the event to wake up the * fib, and then set the event to wake up the
* thread that is waiting for it. * thread that is waiting for it.
...@@ -1613,7 +1612,7 @@ int aac_command_thread(void *data) ...@@ -1613,7 +1612,7 @@ int aac_command_thread(void *data)
*/ */
time_last = fibctx->jiffies; time_last = fibctx->jiffies;
/* /*
* Has it been > 2 minutes * Has it been > 2 minutes
* since the last read off * since the last read off
* the queue? * the queue?
*/ */
...@@ -1644,7 +1643,7 @@ int aac_command_thread(void *data) ...@@ -1644,7 +1643,7 @@ int aac_command_thread(void *data)
*/ */
list_add_tail(&newfib->fiblink, &fibctx->fib_list); list_add_tail(&newfib->fiblink, &fibctx->fib_list);
fibctx->count++; fibctx->count++;
/* /*
* Set the event to wake up the * Set the event to wake up the
* thread that is waiting. * thread that is waiting.
*/ */
......
...@@ -159,7 +159,7 @@ static struct pci_device_id aac_pci_tbl[] = { ...@@ -159,7 +159,7 @@ static struct pci_device_id aac_pci_tbl[] = {
MODULE_DEVICE_TABLE(pci, 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 * 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 * for the card. At that time we can remove the channels from here
*/ */
...@@ -239,7 +239,7 @@ static struct aac_driver_ident aac_drivers[] = { ...@@ -239,7 +239,7 @@ static struct aac_driver_ident aac_drivers[] = {
* Queues a command for execution by the associated Host Adapter. * Queues a command for execution by the associated Host Adapter.
* *
* TODO: unify with aac_scsi_cmd(). * TODO: unify with aac_scsi_cmd().
*/ */
static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 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 ...@@ -258,7 +258,7 @@ static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd
} }
cmd->SCp.phase = AAC_OWNER_LOWLEVEL; cmd->SCp.phase = AAC_OWNER_LOWLEVEL;
return (aac_scsi_cmd(cmd) ? FAILED : 0); return (aac_scsi_cmd(cmd) ? FAILED : 0);
} }
/** /**
* aac_info - Returns the host adapter name * aac_info - Returns the host adapter name
...@@ -292,21 +292,21 @@ struct aac_driver_ident* aac_get_driver_ident(int devtype) ...@@ -292,21 +292,21 @@ struct aac_driver_ident* aac_get_driver_ident(int devtype)
* @capacity: the sector capacity of the disk * @capacity: the sector capacity of the disk
* @geom: geometry block to fill in * @geom: geometry block to fill in
* *
* Return the Heads/Sectors/Cylinders BIOS Disk Parameters for Disk. * Return the Heads/Sectors/Cylinders BIOS Disk Parameters for Disk.
* The default disk geometry is 64 heads, 32 sectors, and the appropriate * 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 * 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 * disks equal to or larger than 1 GB to be addressable by the BIOS
* without exceeding the BIOS limitation of 1024 cylinders, Extended * without exceeding the BIOS limitation of 1024 cylinders, Extended
* Translation should be enabled. With Extended Translation enabled, * Translation should be enabled. With Extended Translation enabled,
* drives between 1 GB inclusive and 2 GB exclusive are given a disk * 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 * 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 * 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 BIOS detects that the Extended Translation setting does not match
* the geometry in the partition table, then the translation inferred * the geometry in the partition table, then the translation inferred
* from the partition table will be used by the BIOS, and a warning may * from the partition table will be used by the BIOS, and a warning may
* be displayed. * be displayed.
*/ */
static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int *geom) sector_t capacity, int *geom)
{ {
...@@ -333,10 +333,10 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, ...@@ -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); param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors);
/* /*
* Read the first 1024 bytes from the disk device, if the boot * Read the first 1024 bytes from the disk device, if the boot
* sector partition table is valid, search for a partition table * 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 ). * translations ( 64/32, 128/32, 255/63 ).
*/ */
buf = scsi_bios_ptable(bdev); buf = scsi_bios_ptable(bdev);
...@@ -596,7 +596,7 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) ...@@ -596,7 +596,7 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER; 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); AAC_DRIVERNAME);
if ((count = aac_check_health(aac))) if ((count = aac_check_health(aac)))
...@@ -687,8 +687,8 @@ static int aac_cfg_open(struct inode *inode, struct file *file) ...@@ -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 locking against parallel ioctls lower down
* Bugs: Needs to handle hot plugging * 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) unsigned int cmd, unsigned long arg)
{ {
if (!capable(CAP_SYS_RAWIO)) if (!capable(CAP_SYS_RAWIO))
...@@ -701,7 +701,7 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long ...@@ -701,7 +701,7 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long
{ {
long ret; long ret;
lock_kernel(); lock_kernel();
switch (cmd) { switch (cmd) {
case FSACTL_MINIPORT_REV_CHECK: case FSACTL_MINIPORT_REV_CHECK:
case FSACTL_SENDFIB: case FSACTL_SENDFIB:
case FSACTL_OPEN_GET_ADAPTER_FIB: 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,14 +711,14 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long
case FSACTL_QUERY_DISK: case FSACTL_QUERY_DISK:
case FSACTL_DELETE_DISK: case FSACTL_DELETE_DISK:
case FSACTL_FORCE_DELETE_DISK: case FSACTL_FORCE_DELETE_DISK:
case FSACTL_GET_CONTAINERS: case FSACTL_GET_CONTAINERS:
case FSACTL_SEND_LARGE_FIB: case FSACTL_SEND_LARGE_FIB:
ret = aac_do_ioctl(dev, cmd, (void __user *)arg); ret = aac_do_ioctl(dev, cmd, (void __user *)arg);
break; break;
case FSACTL_GET_NEXT_ADAPTER_FIB: { case FSACTL_GET_NEXT_ADAPTER_FIB: {
struct fib_ioctl __user *f; struct fib_ioctl __user *f;
f = compat_alloc_user_space(sizeof(*f)); f = compat_alloc_user_space(sizeof(*f));
ret = 0; ret = 0;
if (clear_user(f, sizeof(*f))) 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,9 +731,9 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long
} }
default: default:
ret = -ENOIOCTLCMD; ret = -ENOIOCTLCMD;
break; break;
} }
unlock_kernel(); unlock_kernel();
return ret; return ret;
} }
...@@ -797,7 +797,7 @@ static ssize_t aac_show_kernel_version(struct class_device *class_dev, ...@@ -797,7 +797,7 @@ static ssize_t aac_show_kernel_version(struct class_device *class_dev,
int len, tmp; int len, tmp;
tmp = le32_to_cpu(dev->adapter_info.kernelrev); 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, tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff,
le32_to_cpu(dev->adapter_info.kernelbuild)); le32_to_cpu(dev->adapter_info.kernelbuild));
return len; return len;
...@@ -810,7 +810,7 @@ static ssize_t aac_show_monitor_version(struct class_device *class_dev, ...@@ -810,7 +810,7 @@ static ssize_t aac_show_monitor_version(struct class_device *class_dev,
int len, tmp; int len, tmp;
tmp = le32_to_cpu(dev->adapter_info.monitorrev); 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, tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff,
le32_to_cpu(dev->adapter_info.monitorbuild)); le32_to_cpu(dev->adapter_info.monitorbuild));
return len; return len;
...@@ -823,7 +823,7 @@ static ssize_t aac_show_bios_version(struct class_device *class_dev, ...@@ -823,7 +823,7 @@ static ssize_t aac_show_bios_version(struct class_device *class_dev,
int len, tmp; int len, tmp;
tmp = le32_to_cpu(dev->adapter_info.biosrev); 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, tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff,
le32_to_cpu(dev->adapter_info.biosbuild)); le32_to_cpu(dev->adapter_info.biosbuild));
return len; return len;
...@@ -983,22 +983,22 @@ static struct scsi_host_template aac_driver_template = { ...@@ -983,22 +983,22 @@ static struct scsi_host_template aac_driver_template = {
.compat_ioctl = aac_compat_ioctl, .compat_ioctl = aac_compat_ioctl,
#endif #endif
.queuecommand = aac_queuecommand, .queuecommand = aac_queuecommand,
.bios_param = aac_biosparm, .bios_param = aac_biosparm,
.shost_attrs = aac_attrs, .shost_attrs = aac_attrs,
.slave_configure = aac_slave_configure, .slave_configure = aac_slave_configure,
.change_queue_depth = aac_change_queue_depth, .change_queue_depth = aac_change_queue_depth,
.sdev_attrs = aac_dev_attrs, .sdev_attrs = aac_dev_attrs,
.eh_abort_handler = aac_eh_abort, .eh_abort_handler = aac_eh_abort,
.eh_host_reset_handler = aac_eh_reset, .eh_host_reset_handler = aac_eh_reset,
.can_queue = AAC_NUM_IO_FIB, .can_queue = AAC_NUM_IO_FIB,
.this_id = MAXIMUM_NUM_CONTAINERS, .this_id = MAXIMUM_NUM_CONTAINERS,
.sg_tablesize = 16, .sg_tablesize = 16,
.max_sectors = 128, .max_sectors = 128,
#if (AAC_NUM_IO_FIB > 256) #if (AAC_NUM_IO_FIB > 256)
.cmd_per_lun = 256, .cmd_per_lun = 256,
#else #else
.cmd_per_lun = AAC_NUM_IO_FIB, .cmd_per_lun = AAC_NUM_IO_FIB,
#endif #endif
.use_clustering = ENABLE_CLUSTERING, .use_clustering = ENABLE_CLUSTERING,
.use_sg_chaining = ENABLE_SG_CHAINING, .use_sg_chaining = ENABLE_SG_CHAINING,
.emulated = 1, .emulated = 1,
...@@ -1035,18 +1035,18 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, ...@@ -1035,18 +1035,18 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
goto out; goto out;
error = -ENODEV; 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)) pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))
goto out_disable_pdev; goto out_disable_pdev;
/* /*
* If the quirk31 bit is set, the adapter needs adapter * If the quirk31 bit is set, the adapter needs adapter
* to driver communication memory to be allocated below 2gig * 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) || if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) ||
pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK)) pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK))
goto out_disable_pdev; goto out_disable_pdev;
pci_set_master(pdev); pci_set_master(pdev);
shost = scsi_host_alloc(&aac_driver_template, sizeof(struct aac_dev)); 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,7 +1059,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
shost->max_cmd_len = 16; shost->max_cmd_len = 16;
aac = (struct aac_dev *)shost->hostdata; aac = (struct aac_dev *)shost->hostdata;
aac->scsi_host_ptr = shost; aac->scsi_host_ptr = shost;
aac->pdev = pdev; aac->pdev = pdev;
aac->name = aac_driver_template.name; aac->name = aac_driver_template.name;
aac->id = shost->unique_id; aac->id = shost->unique_id;
...@@ -1096,7 +1096,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, ...@@ -1096,7 +1096,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) if (aac_drivers[index].quirks & AAC_QUIRK_31BIT)
if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) if (pci_set_dma_mask(pdev, DMA_32BIT_MASK))
goto out_deinit; goto out_deinit;
aac->maximum_num_channels = aac_drivers[index].channels; aac->maximum_num_channels = aac_drivers[index].channels;
error = aac_get_adapter_info(aac); error = aac_get_adapter_info(aac);
if (error < 0) if (error < 0)
...@@ -1105,7 +1105,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, ...@@ -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 * 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->sg_tablesize = 34; aac->scsi_host_ptr->sg_tablesize = 34;
aac->scsi_host_ptr->max_sectors aac->scsi_host_ptr->max_sectors
...@@ -1122,11 +1122,11 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, ...@@ -1122,11 +1122,11 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
/* /*
* Firware printf works only with older firmware. * 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; aac->printf_enabled = 1;
else else
aac->printf_enabled = 0; aac->printf_enabled = 0;
/* /*
* max channel will be the physical channels plus 1 virtual channel * max channel will be the physical channels plus 1 virtual channel
* all containers are on the virtual channel 0 (CONTAINER_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) ...@@ -1204,10 +1204,10 @@ static void __devexit aac_remove_one(struct pci_dev *pdev)
kfree(aac->queues); kfree(aac->queues);
aac_adapter_ioremap(aac, 0); aac_adapter_ioremap(aac, 0);
kfree(aac->fibs); kfree(aac->fibs);
kfree(aac->fsa_dev); kfree(aac->fsa_dev);
list_del(&aac->entry); list_del(&aac->entry);
scsi_host_put(shost); scsi_host_put(shost);
pci_disable_device(pdev); pci_disable_device(pdev);
...@@ -1228,7 +1228,7 @@ static struct pci_driver aac_pci_driver = { ...@@ -1228,7 +1228,7 @@ static struct pci_driver aac_pci_driver = {
static int __init aac_init(void) static int __init aac_init(void)
{ {
int error; int error;
printk(KERN_INFO "Adaptec %s driver %s\n", printk(KERN_INFO "Adaptec %s driver %s\n",
AAC_DRIVERNAME, aac_driver_version); AAC_DRIVERNAME, aac_driver_version);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册