= (struct aac_get_config_status_resp *) fib_data(fibptr);
dprintk((KERN_WARNING
"aac_get_config_status: response=%d status=%d action=%d\n",
- reply->response, reply->status, reply->data.action));
- if ((reply->response != ST_OK)
- || (reply->status != CT_OK)
- || (reply->data.action > CFACT_PAUSE)) {
+ le32_to_cpu(reply->response),
+ le32_to_cpu(reply->status),
+ le32_to_cpu(reply->data.action)));
+ if ((le32_to_cpu(reply->response) != ST_OK) ||
+ (le32_to_cpu(reply->status) != CT_OK) ||
+ (le32_to_cpu(reply->data.action) > CFACT_PAUSE)) {
printk(KERN_WARNING "aac_get_config_status: Will not issue the Commit Configuration\n");
status = -EINVAL;
}
NULL, NULL);
if (status >= 0) {
dresp = (struct aac_get_container_count_resp *)fib_data(fibptr);
- maximum_num_containers = dresp->ContainerSwitchEntries;
+ maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries);
fib_complete(fibptr);
}
memcpy(&dev->adapter_info, info, sizeof(struct aac_adapter_info));
- tmp = dev->adapter_info.kernelrev;
- printk(KERN_INFO"%s%d: kernel %d.%d.%d build %d\n",
+ tmp = le32_to_cpu(dev->adapter_info.kernelrev);
+ printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d]\n",
+ dev->name,
+ dev->id,
+ tmp>>24,
+ (tmp>>16)&0xff,
+ tmp&0xff,
+ le32_to_cpu(dev->adapter_info.kernelbuild));
+ tmp = le32_to_cpu(dev->adapter_info.monitorrev);
+ printk(KERN_INFO "%s%d: monitor %d.%d-%d[%d]\n",
dev->name, dev->id,
- tmp>>24,(tmp>>16)&0xff,(tmp>>8)&0xff,
- dev->adapter_info.kernelbuild);
- tmp = dev->adapter_info.monitorrev;
- printk(KERN_INFO"%s%d: monitor %d.%d.%d build %d\n",
+ tmp>>24,(tmp>>16)&0xff,tmp&0xff,
+ le32_to_cpu(dev->adapter_info.monitorbuild));
+ tmp = le32_to_cpu(dev->adapter_info.biosrev);
+ printk(KERN_INFO "%s%d: bios %d.%d-%d[%d]\n",
dev->name, dev->id,
- tmp>>24,(tmp>>16)&0xff,(tmp>>8)&0xff,
- dev->adapter_info.monitorbuild);
- tmp = dev->adapter_info.biosrev;
- printk(KERN_INFO"%s%d: bios %d.%d.%d build %d\n",
+ tmp>>24,(tmp>>16)&0xff,tmp&0xff,
+ le32_to_cpu(dev->adapter_info.biosbuild));
+ if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0)
+ printk(KERN_INFO "%s%d: serial %x\n",
dev->name, dev->id,
- tmp>>24,(tmp>>16)&0xff,(tmp>>8)&0xff,
- dev->adapter_info.biosbuild);
- printk(KERN_INFO"%s%d: serial %x%x\n",
- dev->name, dev->id,
- dev->adapter_info.serial[0],
- dev->adapter_info.serial[1]);
+ le32_to_cpu(dev->adapter_info.serial[0]));
dev->nondasd_support = 0;
dev->raid_scsi_mode = 0;
if (le32_to_cpu(readreply->status) == ST_OK)
scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
else {
- printk(KERN_WARNING "read_callback: read failed, status = %d\n", readreply->status);
+ printk(KERN_WARNING "read_callback: read failed, status = %d\n",
+ le32_to_cpu(readreply->status));
scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
set_sense((u8 *) &dev->fsa_dev[cid].sense_data,
HARDWARE_ERROR,
readcmd->cid = cpu_to_le16(cid);
readcmd->sector_count = cpu_to_le16(count);
readcmd->block = cpu_to_le32(lba);
- readcmd->pad = cpu_to_le16(0);
- readcmd->flags = cpu_to_le16(0);
+ readcmd->pad = 0;
+ readcmd->flags = 0;
aac_build_sg64(scsicmd, &readcmd->sg);
- if(readcmd->sg.count > MAX_DRIVER_SG_SEGMENT_COUNT)
- BUG();
- fibsize = sizeof(struct aac_read64) + ((readcmd->sg.count - 1) * sizeof (struct sgentry64));
+ fibsize = sizeof(struct aac_read64) +
+ ((le32_to_cpu(readcmd->sg.count) - 1) *
+ sizeof (struct sgentry64));
+ BUG_ON (fibsize > (sizeof(struct hw_fib) -
+ sizeof(struct aac_fibhdr)));
/*
* Now send the Fib to the adapter
*/
BUG();
aac_build_sg(scsicmd, &readcmd->sg);
- if(readcmd->sg.count > MAX_DRIVER_SG_SEGMENT_COUNT)
- BUG();
- fibsize = sizeof(struct aac_read) + ((readcmd->sg.count - 1) * sizeof (struct sgentry));
+ fibsize = sizeof(struct aac_read) +
+ ((le32_to_cpu(readcmd->sg.count) - 1) *
+ sizeof (struct sgentry));
+ BUG_ON (fibsize > (sizeof(struct hw_fib) -
+ sizeof(struct aac_fibhdr)));
/*
* Now send the Fib to the adapter
*/
* Check that the command queued to the controller
*/
if (status == -EINPROGRESS)
- {
- dprintk("read queued.\n");
return 0;
- }
printk(KERN_WARNING "aac_read: fib_send failed with status: %d.\n", status);
/*
lba = (scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8];
}
- dprintk((KERN_DEBUG "aac_write[cpu %d]: lba = %u, t = %ld.\n", smp_processor_id(), lba, jiffies));
+ dprintk((KERN_DEBUG "aac_write[cpu %d]: lba = %u, t = %ld.\n",
+ smp_processor_id(), (unsigned long long)lba, jiffies));
/*
* Allocate and initialize a Fib then setup a BlockWrite command
*/
writecmd->cid = cpu_to_le16(cid);
writecmd->sector_count = cpu_to_le16(count);
writecmd->block = cpu_to_le32(lba);
- writecmd->pad = cpu_to_le16(0);
- writecmd->flags = cpu_to_le16(0);
+ writecmd->pad = 0;
+ writecmd->flags = 0;
aac_build_sg64(scsicmd, &writecmd->sg);
- if(writecmd->sg.count > MAX_DRIVER_SG_SEGMENT_COUNT)
- BUG();
- fibsize = sizeof(struct aac_write64) + ((writecmd->sg.count - 1) * sizeof (struct sgentry64));
+ fibsize = sizeof(struct aac_write64) +
+ ((le32_to_cpu(writecmd->sg.count) - 1) *
+ sizeof (struct sgentry64));
+ BUG_ON (fibsize > (sizeof(struct hw_fib) -
+ sizeof(struct aac_fibhdr)));
/*
* Now send the Fib to the adapter
*/
}
aac_build_sg(scsicmd, &writecmd->sg);
- if(writecmd->sg.count > MAX_DRIVER_SG_SEGMENT_COUNT)
- BUG();
- fibsize = sizeof(struct aac_write) + ((writecmd->sg.count - 1) * sizeof (struct sgentry));
+ fibsize = sizeof(struct aac_write) +
+ ((le32_to_cpu(writecmd->sg.count) - 1) *
+ sizeof (struct sgentry));
+ BUG_ON (fibsize > (sizeof(struct hw_fib) -
+ sizeof(struct aac_fibhdr)));
/*
* Now send the Fib to the adapter
*/
u32 cid = ID_LUN_TO_CONTAINER(sdev->id, sdev->lun);
printk(KERN_WARNING
"synchronize_callback: synchronize failed, status = %d\n",
- synchronizereply->status);
+ le32_to_cpu(synchronizereply->status));
cmd->result = DID_OK << 16 |
COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
set_sense((u8 *)&dev->fsa_dev[cid].sense_data,
* Calculate resid for sg
*/
- scsicmd->resid = scsicmd->request_bufflen - srbreply->data_xfer_length;
+ scsicmd->resid = scsicmd->request_bufflen -
+ le32_to_cpu(srbreply->data_xfer_length);
if(scsicmd->use_sg)
pci_unmap_sg(dev->pdev,
if (le32_to_cpu(srbreply->status) != ST_OK){
int len;
printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status));
- len = (srbreply->sense_data_size > sizeof(scsicmd->sense_buffer))?
- sizeof(scsicmd->sense_buffer):srbreply->sense_data_size;
+ len = (le32_to_cpu(srbreply->sense_data_size) >
+ sizeof(scsicmd->sense_buffer)) ?
+ sizeof(scsicmd->sense_buffer) :
+ le32_to_cpu(srbreply->sense_data_size);
scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
}
default:
#ifdef AAC_DETAILED_STATUS_INFO
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(
le32_to_cpu(srbreply->srb_status) & 0x3F),
scsicmd->cmnd[0],
if (le32_to_cpu(srbreply->scsi_status) == 0x02 ){ // Check Condition
int len;
scsicmd->result |= SAM_STAT_CHECK_CONDITION;
- len = (srbreply->sense_data_size > sizeof(scsicmd->sense_buffer))?
- sizeof(scsicmd->sense_buffer):srbreply->sense_data_size;
+ len = (le32_to_cpu(srbreply->sense_data_size) >
+ sizeof(scsicmd->sense_buffer)) ?
+ sizeof(scsicmd->sense_buffer) :
+ le32_to_cpu(srbreply->sense_data_size);
#ifdef AAC_DETAILED_STATUS_INFO
dprintk((KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n",
le32_to_cpu(srbreply->status), len));
timeout = 1;
}
srbcmd->timeout = cpu_to_le32(timeout); // timeout in seconds
- srbcmd->retry_limit =cpu_to_le32(0); // Obsolete parameter
+ srbcmd->retry_limit = 0; /* Obsolete parameter */
srbcmd->cdb_size = cpu_to_le32(scsicmd->cmd_len);
if( dev->dac_support == 1 ) {
/*
* Build Scatter/Gather list
*/
- fibsize = sizeof (struct aac_srb) + (((srbcmd->sg.count & 0xff) - 1) * sizeof (struct sgentry64));
+ fibsize = sizeof (struct aac_srb) - sizeof (struct sgentry) +
+ ((le32_to_cpu(srbcmd->sg.count) & 0xff) *
+ sizeof (struct sgentry64));
+ BUG_ON (fibsize > (sizeof(struct hw_fib) -
+ sizeof(struct aac_fibhdr)));
/*
* Now send the Fib to the adapter
*/
- status = fib_send(ScsiPortCommand64, cmd_fibcontext, fibsize, FsaNormal, 0, 1,
- (fib_callback) aac_srb_callback, (void *) scsicmd);
+ status = fib_send(ScsiPortCommand64, cmd_fibcontext,
+ fibsize, FsaNormal, 0, 1,
+ (fib_callback) aac_srb_callback,
+ (void *) scsicmd);
} else {
aac_build_sg(scsicmd, (struct sgmap*)&srbcmd->sg);
srbcmd->count = cpu_to_le32(scsicmd->request_bufflen);
/*
* Build Scatter/Gather list
*/
- fibsize = sizeof (struct aac_srb) + (((srbcmd->sg.count & 0xff) - 1) * sizeof (struct sgentry));
+ fibsize = sizeof (struct aac_srb) +
+ (((le32_to_cpu(srbcmd->sg.count) & 0xff) - 1) *
+ sizeof (struct sgentry));
+ BUG_ON (fibsize > (sizeof(struct hw_fib) -
+ sizeof(struct aac_fibhdr)));
/*
* Now send the Fib to the adapter
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
// Get rid of old data
- psg->count = cpu_to_le32(0);
- psg->sg[0].addr = cpu_to_le32(0);
- psg->sg[0].count = cpu_to_le32(0);
+ psg->count = 0;
+ psg->sg[0].addr = 0;
+ psg->sg[0].count = 0;
if (scsicmd->use_sg) {
struct scatterlist *sg;
int i;
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
// Get rid of old data
- psg->count = cpu_to_le32(0);
- psg->sg[0].addr[0] = cpu_to_le32(0);
- psg->sg[0].addr[1] = cpu_to_le32(0);
- psg->sg[0].count = cpu_to_le32(0);
+ psg->count = 0;
+ psg->sg[0].addr[0] = 0;
+ psg->sg[0].addr[1] = 0;
+ psg->sg[0].count = 0;
if (scsicmd->use_sg) {
struct scatterlist *sg;
int i;