* [PATCH] 2.6 aacraid: endian cleanup
@ 2005-03-21 18:41 Mark Haverkamp
2005-03-28 21:58 ` James Bottomley
2005-03-28 21:59 ` Christoph Hellwig
0 siblings, 2 replies; 12+ messages in thread
From: Mark Haverkamp @ 2005-03-21 18:41 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-scsi, Mark Salyzyn
A patch from Adaptec with byte order changes:
- drop byte swapping on all 0's and all 1's content
- fix up missing swapping directives
- ensure swapping on 16 bit values does not use 32 bit swap
- reconcile the readl/writel auto-swapping in only most of the
configurations.
I tested this on a ppc64 machine and the driver loaded and configured
the attached disks.
Signed-off-by: Mark Haverkamp <markh@osdl.org>
===== drivers/scsi/aacraid/README 1.8 vs edited =====
--- 1.8/drivers/scsi/aacraid/README 2004-11-24 10:24:16 -08:00
+++ edited/drivers/scsi/aacraid/README 2005-03-03 13:01:32 -08:00
@@ -13,6 +13,7 @@
Adaptec 2020S
Adaptec 2025S
Adaptec 2120S
+ Adaptec 2130S
Adaptec 2200S
Adaptec 2230S
Adaptec 2240S
@@ -35,6 +36,7 @@
HP NetRAID-4M
Legend S220
Legend S230
+ IBM ServeRAID 8i
People
-------------------------
===== drivers/scsi/aacraid/TODO 1.2 vs edited =====
--- 1.2/drivers/scsi/aacraid/TODO 2004-05-30 09:41:11 -07:00
+++ edited/drivers/scsi/aacraid/TODO 2005-03-03 13:01:32 -08:00
@@ -1,6 +1,4 @@
o Testing
o More testing
-o Feature request: display the firmware/bios/etc revisions in the
- /proc info
-o Drop irq_mask, basically unused
o I/O size increase
+o add sysfs interface
===== drivers/scsi/aacraid/aachba.c 1.34 vs edited =====
--- 1.34/drivers/scsi/aacraid/aachba.c 2005-02-02 00:12:13 -08:00
+++ edited/drivers/scsi/aacraid/aachba.c 2005-03-03 13:46:22 -08:00
@@ -195,10 +195,12 @@
= (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;
}
@@ -265,7 +267,7 @@
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);
}
@@ -624,25 +626,28 @@
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;
@@ -742,7 +747,7 @@
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,
@@ -853,13 +858,15 @@
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
*/
@@ -882,9 +889,11 @@
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
*/
@@ -903,10 +912,7 @@
* 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);
/*
@@ -943,7 +949,8 @@
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
*/
@@ -961,13 +968,15 @@
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
*/
@@ -993,9 +1002,11 @@
}
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
*/
@@ -1051,7 +1062,7 @@
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,
@@ -1538,7 +1549,7 @@
* 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,
@@ -1556,8 +1567,8 @@
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);
}
@@ -1693,7 +1704,7 @@
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],
@@ -1705,8 +1716,8 @@
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));
@@ -1786,7 +1797,7 @@
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 ) {
@@ -1798,13 +1809,19 @@
/*
* 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);
@@ -1814,7 +1831,11 @@
/*
* 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
@@ -1843,9 +1864,9 @@
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;
@@ -1899,10 +1920,10 @@
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;
===== drivers/scsi/aacraid/aacraid.h 1.29 vs edited =====
--- 1.29/drivers/scsi/aacraid/aacraid.h 2005-01-19 10:48:23 -08:00
+++ edited/drivers/scsi/aacraid/aacraid.h 2005-03-03 13:01:32 -08:00
@@ -28,6 +28,22 @@
#define aac_logical_to_phys(x) (x?x-1:0)
/* #define AAC_DETAILED_STATUS_INFO */
+/*
+ * Some configurations of BE Linux have writel and readl automatically perform
+ * byte swapping, and some configurations (embedded) do not. Typically
+ * AAC_IO_USES_CPU_ORDER needs to be defined since most BE ports are working
+ * with drivers that have not been coded to support BE.
+ */
+#define AAC_IO_USES_CPU_ORDER 1
+#ifdef AAC_IO_USES_CPU_ORDER
+# define aac_io_le32_to_cpu
+# define aac_io_cpu_to_le16
+# define aac_io_cpu_to_le32
+#else
+# define aac_io_le32_to_cpu le32_to_cpu
+# define aac_io_cpu_to_le16 cpu_to_le16
+# define aac_io_cpu_to_le32 cpu_to_le32
+#endif
struct diskparm
{
@@ -556,13 +572,13 @@
#define DoorbellClrReg_p SaDbCSR.PRICLEARIRQ
-#define DOORBELL_0 cpu_to_le16(0x0001)
-#define DOORBELL_1 cpu_to_le16(0x0002)
-#define DOORBELL_2 cpu_to_le16(0x0004)
-#define DOORBELL_3 cpu_to_le16(0x0008)
-#define DOORBELL_4 cpu_to_le16(0x0010)
-#define DOORBELL_5 cpu_to_le16(0x0020)
-#define DOORBELL_6 cpu_to_le16(0x0040)
+#define DOORBELL_0 aac_io_cpu_to_le16(0x0001)
+#define DOORBELL_1 aac_io_cpu_to_le16(0x0002)
+#define DOORBELL_2 aac_io_cpu_to_le16(0x0004)
+#define DOORBELL_3 aac_io_cpu_to_le16(0x0008)
+#define DOORBELL_4 aac_io_cpu_to_le16(0x0010)
+#define DOORBELL_5 aac_io_cpu_to_le16(0x0020)
+#define DOORBELL_6 aac_io_cpu_to_le16(0x0040)
#define PrintfReady DOORBELL_5
@@ -613,21 +629,20 @@
#define InboundMailbox4 IndexRegs.Mailbox[4]
#define InboundMailbox5 IndexRegs.Mailbox[5]
#define InboundMailbox6 IndexRegs.Mailbox[6]
-#define InboundMailbox7 IndexRegs.Mailbox[7]
-#define INBOUNDDOORBELL_0 cpu_to_le32(0x00000001)
-#define INBOUNDDOORBELL_1 cpu_to_le32(0x00000002)
-#define INBOUNDDOORBELL_2 cpu_to_le32(0x00000004)
-#define INBOUNDDOORBELL_3 cpu_to_le32(0x00000008)
-#define INBOUNDDOORBELL_4 cpu_to_le32(0x00000010)
-#define INBOUNDDOORBELL_5 cpu_to_le32(0x00000020)
-#define INBOUNDDOORBELL_6 cpu_to_le32(0x00000040)
-
-#define OUTBOUNDDOORBELL_0 cpu_to_le32(0x00000001)
-#define OUTBOUNDDOORBELL_1 cpu_to_le32(0x00000002)
-#define OUTBOUNDDOORBELL_2 cpu_to_le32(0x00000004)
-#define OUTBOUNDDOORBELL_3 cpu_to_le32(0x00000008)
-#define OUTBOUNDDOORBELL_4 cpu_to_le32(0x00000010)
+#define INBOUNDDOORBELL_0 aac_io_cpu_to_le32(0x00000001)
+#define INBOUNDDOORBELL_1 aac_io_cpu_to_le32(0x00000002)
+#define INBOUNDDOORBELL_2 aac_io_cpu_to_le32(0x00000004)
+#define INBOUNDDOORBELL_3 aac_io_cpu_to_le32(0x00000008)
+#define INBOUNDDOORBELL_4 aac_io_cpu_to_le32(0x00000010)
+#define INBOUNDDOORBELL_5 aac_io_cpu_to_le32(0x00000020)
+#define INBOUNDDOORBELL_6 aac_io_cpu_to_le32(0x00000040)
+
+#define OUTBOUNDDOORBELL_0 aac_io_cpu_to_le32(0x00000001)
+#define OUTBOUNDDOORBELL_1 aac_io_cpu_to_le32(0x00000002)
+#define OUTBOUNDDOORBELL_2 aac_io_cpu_to_le32(0x00000004)
+#define OUTBOUNDDOORBELL_3 aac_io_cpu_to_le32(0x00000008)
+#define OUTBOUNDDOORBELL_4 aac_io_cpu_to_le32(0x00000010)
#define InboundDoorbellReg MUnit.IDR
#define OutboundDoorbellReg MUnit.ODR
@@ -824,6 +839,9 @@
#define AAC_OPT_NONDASD cpu_to_le32(1<<12)
#define AAC_OPT_SCSI_MANAGED cpu_to_le32(1<<13)
#define AAC_OPT_RAID_SCSI_MODE cpu_to_le32(1<<14)
+#define AAC_OPT_SUPPLEMENT_ADAPTER_INFO cpu_to_le32(1<<16)
+#define AAC_OPT_NEW_COMM cpu_to_le32(1<<17)
+#define AAC_OPT_NEW_COMM_64 cpu_to_le32(1<<18)
struct aac_dev
{
@@ -1482,15 +1500,19 @@
* Monitor/Kernel API
*/
-#define BREAKPOINT_REQUEST cpu_to_le32(0x00000004)
-#define INIT_STRUCT_BASE_ADDRESS cpu_to_le32(0x00000005)
-#define READ_PERMANENT_PARAMETERS cpu_to_le32(0x0000000a)
-#define WRITE_PERMANENT_PARAMETERS cpu_to_le32(0x0000000b)
-#define HOST_CRASHING cpu_to_le32(0x0000000d)
-#define SEND_SYNCHRONOUS_FIB cpu_to_le32(0x0000000c)
-#define COMMAND_POST_RESULTS cpu_to_le32(0x00000014)
-#define GET_ADAPTER_PROPERTIES cpu_to_le32(0x00000019)
-#define RE_INIT_ADAPTER cpu_to_le32(0x000000ee)
+#define BREAKPOINT_REQUEST aac_io_cpu_to_le32(0x00000004)
+#define INIT_STRUCT_BASE_ADDRESS aac_io_cpu_to_le32(0x00000005)
+#define READ_PERMANENT_PARAMETERS aac_io_cpu_to_le32(0x0000000a)
+#define WRITE_PERMANENT_PARAMETERS aac_io_cpu_to_le32(0x0000000b)
+#define HOST_CRASHING aac_io_cpu_to_le32(0x0000000d)
+#define SEND_SYNCHRONOUS_FIB aac_io_cpu_to_le32(0x0000000c)
+#define COMMAND_POST_RESULTS aac_io_cpu_to_le32(0x00000014)
+#define GET_ADAPTER_PROPERTIES aac_io_cpu_to_le32(0x00000019)
+#define GET_DRIVER_BUFFER_PROPERTIES aac_io_cpu_to_le32(0x00000023)
+#define RCV_TEMP_READINGS aac_io_cpu_to_le32(0x00000025)
+#define GET_COMM_PREFERRED_SETTINGS aac_io_cpu_to_le32(0x00000026)
+#define IOP_RESET aac_io_cpu_to_le32(0x00001000)
+#define RE_INIT_ADAPTER aac_io_cpu_to_le32(0x000000ee)
/*
* Adapter Status Register
@@ -1513,22 +1535,22 @@
* Phases are bit oriented. It is NOT valid to have multiple bits set
*/
-#define SELF_TEST_FAILED (cpu_to_le32(0x00000004))
-#define MONITOR_PANIC (cpu_to_le32(0x00000020))
-#define KERNEL_UP_AND_RUNNING (cpu_to_le32(0x00000080))
-#define KERNEL_PANIC (cpu_to_le32(0x00000100))
+#define SELF_TEST_FAILED aac_io_cpu_to_le32(0x00000004)
+#define MONITOR_PANIC aac_io_cpu_to_le32(0x00000020)
+#define KERNEL_UP_AND_RUNNING aac_io_cpu_to_le32(0x00000080)
+#define KERNEL_PANIC aac_io_cpu_to_le32(0x00000100)
/*
* Doorbell bit defines
*/
-#define DoorBellSyncCmdAvailable cpu_to_le32(1<<0) // Host -> Adapter
-#define DoorBellPrintfDone cpu_to_le32(1<<5) // Host -> Adapter
-#define DoorBellAdapterNormCmdReady cpu_to_le32(1<<1) // Adapter -> Host
-#define DoorBellAdapterNormRespReady cpu_to_le32(1<<2) // Adapter -> Host
-#define DoorBellAdapterNormCmdNotFull cpu_to_le32(1<<3) // Adapter -> Host
-#define DoorBellAdapterNormRespNotFull cpu_to_le32(1<<4) // Adapter -> Host
-#define DoorBellPrintfReady cpu_to_le32(1<<5) // Adapter -> Host
+#define DoorBellSyncCmdAvailable aac_io_cpu_to_le32(1<<0) // Host -> Adapter
+#define DoorBellPrintfDone aac_io_cpu_to_le32(1<<5) // Host -> Adapter
+#define DoorBellAdapterNormCmdReady aac_io_cpu_to_le32(1<<1) // Adapter -> Host
+#define DoorBellAdapterNormRespReady aac_io_cpu_to_le32(1<<2) // Adapter -> Host
+#define DoorBellAdapterNormCmdNotFull aac_io_cpu_to_le32(1<<3) // Adapter -> Host
+#define DoorBellAdapterNormRespNotFull aac_io_cpu_to_le32(1<<4) // Adapter -> Host
+#define DoorBellPrintfReady aac_io_cpu_to_le32(1<<5) // Adapter -> Host
/*
* For FIB communication, we need all of the following things
@@ -1599,7 +1621,6 @@
void aac_printf(struct aac_dev *dev, u32 val);
int fib_send(u16 command, struct fib * context, unsigned long size, int priority, int wait, int reply, fib_callback callback, void *ctxt);
int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry);
-int aac_consumer_avail(struct aac_dev * dev, struct aac_queue * q);
void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum);
int fib_complete(struct fib * context);
#define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data)
===== drivers/scsi/aacraid/commctrl.c 1.9 vs edited =====
--- 1.9/drivers/scsi/aacraid/commctrl.c 2004-08-09 15:07:39 -07:00
+++ edited/drivers/scsi/aacraid/commctrl.c 2005-03-03 13:01:32 -08:00
@@ -74,12 +74,12 @@
* will not overrun the buffer when we copy the memory. Return
* an error if we would.
*/
- if(le32_to_cpu(kfib->header.Size) > sizeof(struct hw_fib) - sizeof(struct aac_fibhdr)) {
+ if(le16_to_cpu(kfib->header.Size) > sizeof(struct hw_fib) - sizeof(struct aac_fibhdr)) {
fib_free(fibptr);
return -EINVAL;
}
- if (copy_from_user((void *) kfib, arg, le32_to_cpu(kfib->header.Size) + sizeof(struct aac_fibhdr))) {
+ if (copy_from_user((void *) kfib, arg, le16_to_cpu(kfib->header.Size) + sizeof(struct aac_fibhdr))) {
fib_free(fibptr);
return -EFAULT;
}
@@ -93,7 +93,7 @@
kfib->header.XferState = 0;
} else {
int retval = fib_send(kfib->header.Command, fibptr,
- le32_to_cpu(kfib->header.Size) , FsaNormal,
+ le16_to_cpu(kfib->header.Size) , FsaNormal,
1, 1, NULL, NULL);
if (retval) {
fib_free(fibptr);
@@ -538,7 +538,7 @@
struct sgmap* psg = &srbcmd->sg;
byte_count = 0;
- actual_fibsize = sizeof (struct aac_srb) + (((srbcmd->sg.count & 0xff) - 1) * sizeof (struct sgentry));
+ actual_fibsize = sizeof (struct aac_srb) + (((le32_to_cpu(srbcmd->sg.count) & 0xff) - 1) * sizeof (struct sgentry));
if(actual_fibsize != fibsize){ // User made a mistake - should not continue
printk(KERN_DEBUG"aacraid: Bad Size specified in Raw SRB command\n");
rcode = -EINVAL;
===== drivers/scsi/aacraid/comminit.c 1.10 vs edited =====
--- 1.10/drivers/scsi/aacraid/comminit.c 2004-05-11 12:20:37 -07:00
+++ edited/drivers/scsi/aacraid/comminit.c 2005-03-03 13:01:32 -08:00
@@ -83,7 +83,7 @@
*/
dev->aif_base_va = (struct hw_fib *)base;
- init->AdapterFibsVirtualAddress = cpu_to_le32(0);
+ init->AdapterFibsVirtualAddress = 0;
init->AdapterFibsPhysicalAddress = cpu_to_le32((u32)phys);
init->AdapterFibsSize = cpu_to_le32(fibsize);
init->AdapterFibAlign = cpu_to_le32(sizeof(struct hw_fib));
===== drivers/scsi/aacraid/commsup.c 1.10 vs edited =====
--- 1.10/drivers/scsi/aacraid/commsup.c 2005-01-02 16:00:00 -08:00
+++ edited/drivers/scsi/aacraid/commsup.c 2005-03-03 13:01:32 -08:00
@@ -102,7 +102,7 @@
fibptr->next = fibptr+1; /* Forward chain the fibs */
init_MUTEX_LOCKED(&fibptr->event_wait);
spin_lock_init(&fibptr->event_lock);
- hw_fib_va->header.XferState = cpu_to_le32(0xffffffff);
+ hw_fib_va->header.XferState = 0xffffffff;
hw_fib_va->header.SenderSize = cpu_to_le16(sizeof(struct hw_fib));
fibptr->hw_fib_pa = hw_fib_pa;
hw_fib_va = (struct hw_fib *)((unsigned char *)hw_fib_va + sizeof(struct hw_fib));
@@ -148,7 +148,7 @@
* Null out fields that depend on being zero at the start of
* each I/O
*/
- fibptr->hw_fib->header.XferState = cpu_to_le32(0);
+ fibptr->hw_fib->header.XferState = 0;
fibptr->callback = NULL;
fibptr->callback_data = NULL;
@@ -175,7 +175,7 @@
} else {
if (fibptr->hw_fib->header.XferState != 0) {
printk(KERN_WARNING "fib_free, XferState != 0, fibptr = 0x%p, XferState = 0x%x\n",
- (void*)fibptr, fibptr->hw_fib->header.XferState);
+ (void*)fibptr, le32_to_cpu(fibptr->hw_fib->header.XferState));
}
fibptr->next = fibptr->dev->free_fib;
fibptr->dev->free_fib = fibptr;
@@ -215,7 +215,7 @@
struct hw_fib *hw_fib = fibptr->hw_fib;
if(hw_fib->header.StructType != FIB_MAGIC)
BUG();
- hw_fib->header.XferState = cpu_to_le32(0);
+ hw_fib->header.XferState = 0;
}
/*
@@ -344,7 +344,7 @@
* in the queue entry.
*/
if (map)
- entry->addr = fibptr->hw_fib_pa;
+ entry->addr = cpu_to_le32(fibptr->hw_fib_pa);
return 0;
}
@@ -418,13 +418,13 @@
struct hw_fib * hw_fib = fibptr->hw_fib;
struct aac_queue * q;
unsigned long flags = 0;
- if (!(le32_to_cpu(hw_fib->header.XferState) & HostOwned))
+ if (!(hw_fib->header.XferState & cpu_to_le32(HostOwned)))
return -EBUSY;
/*
* There are 5 cases with the wait and reponse requested flags.
* The only invalid cases are if the caller requests to wait and
* does not request a response and if the caller does not want a
- * response and the Fibis 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
* routine when the response comes back from the adapter. No
* further processing will be done besides deleting the Fib. We
@@ -566,12 +566,6 @@
return(status);
}
-int aac_consumer_avail(struct aac_dev *dev, struct aac_queue * q)
-{
- return (le32_to_cpu(*q->headers.producer) != le32_to_cpu(*q->headers.consumer));
-}
-
-
/**
* aac_consumer_free - free consumer entry
* @dev: Adapter
@@ -632,7 +626,7 @@
struct hw_fib * hw_fib = fibptr->hw_fib;
struct aac_dev * dev = fibptr->dev;
unsigned long nointr = 0;
- if (le32_to_cpu(hw_fib->header.XferState) == 0)
+ if (hw_fib->header.XferState == 0)
return 0;
/*
* If we plan to do anything check the structure type first.
@@ -704,7 +698,7 @@
* Check for a fib which has already been completed
*/
- if (hw_fib->header.XferState == cpu_to_le32(0))
+ if (hw_fib->header.XferState == 0)
return 0;
/*
* If we plan to do anything check the structure type first.
===== drivers/scsi/aacraid/rkt.c 1.7 vs edited =====
--- 1.7/drivers/scsi/aacraid/rkt.c 2004-11-01 13:09:31 -08:00
+++ edited/drivers/scsi/aacraid/rkt.c 2005-03-08 13:35:34 -08:00
@@ -63,7 +63,7 @@
{
bellbits = rkt_readl(dev, OutboundDoorbellReg);
if (bellbits & DoorBellPrintfReady) {
- aac_printf(dev, le32_to_cpu(rkt_readl (dev, IndexRegs.Mailbox[5])));
+ aac_printf(dev, aac_io_le32_to_cpu(rkt_readl (dev, IndexRegs.Mailbox[5])));
rkt_writel(dev, MUnit.ODR,DoorBellPrintfReady);
rkt_writel(dev, InboundDoorbellReg,DoorBellPrintfDone);
}
@@ -94,7 +94,7 @@
* @p1: first parameter
* @ret: adapter status
*
- * This routine will send a synchronous comamnd to the adapter and wait
+ * This routine will send a synchronous command to the adapter and wait
* for its completion.
*/
@@ -105,11 +105,11 @@
/*
* Write the command into Mailbox 0
*/
- rkt_writel(dev, InboundMailbox0, cpu_to_le32(command));
+ rkt_writel(dev, InboundMailbox0, command);
/*
* Write the parameters into Mailboxes 1 - 4
*/
- rkt_writel(dev, InboundMailbox1, cpu_to_le32(p1));
+ rkt_writel(dev, InboundMailbox1, aac_io_cpu_to_le32(p1));
rkt_writel(dev, InboundMailbox2, 0);
rkt_writel(dev, InboundMailbox3, 0);
rkt_writel(dev, InboundMailbox4, 0);
@@ -168,7 +168,7 @@
* Pull the synch status from Mailbox 0.
*/
if (status)
- *status = le32_to_cpu(rkt_readl(dev, IndexRegs.Mailbox[0]));
+ *status = aac_io_le32_to_cpu(rkt_readl(dev, IndexRegs.Mailbox[0]));
/*
* Clear the synch command doorbell.
*/
@@ -275,7 +275,7 @@
*/
static int aac_rkt_check_health(struct aac_dev *dev)
{
- u32 status = le32_to_cpu(rkt_readl(dev, MUnit.OMRx[0]));
+ long status = aac_io_le32_to_cpu(rkt_readl(dev, MUnit.OMRx[0]));
/*
* Check to see if the board failed any self tests.
@@ -307,9 +307,13 @@
return ret;
}
memset(buffer, 0, 512);
- post->Post_Command = cpu_to_le32(COMMAND_POST_RESULTS);
+# if (defined(AAC_IO_USES_CPU_ORDER))
+ post->Post_Command = cpu_to_le32(COMMAND_POST_RESULTS);
+# else
+ post->Post_Command = COMMAND_POST_RESULTS;
+# endif
post->Post_Address = cpu_to_le32(baddr);
- rkt_writel(dev, MUnit.IMRx[0], cpu_to_le32(paddr));
+ rkt_writel(dev, MUnit.IMRx[0], aac_io_cpu_to_le32(paddr));
rkt_sync_cmd(dev, COMMAND_POST_RESULTS, baddr, &status);
pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS),
post, paddr);
@@ -388,8 +392,8 @@
{
if(time_after(jiffies, start+180*HZ))
{
- status = rkt_readl(dev, IndexRegs.Mailbox[7]) >> 16;
- printk(KERN_ERR "%s%d: adapter kernel failed to start, init status = %ld.\n", dev->name, instance, status);
+ status = aac_io_le32_to_cpu(rkt_readl(dev, MUnit.OMRx[0]));
+ printk(KERN_ERR "%s%d: adapter kernel failed to start, init status = %lx.\n", dev->name, instance, status);
goto error_iounmap;
}
set_current_state(TASK_UNINTERRUPTIBLE);
===== drivers/scsi/aacraid/rx.c 1.13 vs edited =====
--- 1.13/drivers/scsi/aacraid/rx.c 2004-11-04 09:37:33 -08:00
+++ edited/drivers/scsi/aacraid/rx.c 2005-03-08 13:36:06 -08:00
@@ -94,7 +94,7 @@
* @p1: first parameter
* @ret: adapter status
*
- * This routine will send a synchronous comamnd to the adapter and wait
+ * This routine will send a synchronous command to the adapter and wait
* for its completion.
*/
@@ -105,11 +105,11 @@
/*
* Write the command into Mailbox 0
*/
- rx_writel(dev, InboundMailbox0, cpu_to_le32(command));
+ rx_writel(dev, InboundMailbox0, command);
/*
* Write the parameters into Mailboxes 1 - 4
*/
- rx_writel(dev, InboundMailbox1, cpu_to_le32(p1));
+ rx_writel(dev, InboundMailbox1, aac_io_cpu_to_le32(p1));
rx_writel(dev, InboundMailbox2, 0);
rx_writel(dev, InboundMailbox3, 0);
rx_writel(dev, InboundMailbox4, 0);
@@ -167,7 +167,8 @@
/*
* Pull the synch status from Mailbox 0.
*/
- *status = le32_to_cpu(rx_readl(dev, IndexRegs.Mailbox[0]));
+ if (status)
+ *status = aac_io_le32_to_cpu(rx_readl(dev, IndexRegs.Mailbox[0]));
/*
* Clear the synch command doorbell.
*/
@@ -274,7 +275,7 @@
*/
static int aac_rx_check_health(struct aac_dev *dev)
{
- u32 status = le32_to_cpu(rx_readl(dev, MUnit.OMRx[0]));
+ long status = aac_io_le32_to_cpu(rx_readl(dev, MUnit.OMRx[0]));
/*
* Check to see if the board failed any self tests.
@@ -306,9 +307,13 @@
return ret;
}
memset(buffer, 0, 512);
- post->Post_Command = cpu_to_le32(COMMAND_POST_RESULTS);
+# if (defined(AAC_IO_USES_CPU_ORDER))
+ post->Post_Command = cpu_to_le32(COMMAND_POST_RESULTS);
+# else
+ post->Post_Command = COMMAND_POST_RESULTS;
+# endif
post->Post_Address = cpu_to_le32(baddr);
- rx_writel(dev, MUnit.IMRx[0], cpu_to_le32(paddr));
+ rx_writel(dev, MUnit.IMRx[0], aac_io_cpu_to_le32(paddr));
rx_sync_cmd(dev, COMMAND_POST_RESULTS, baddr, &status);
pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS),
post, paddr);
@@ -388,8 +393,8 @@
{
if(time_after(jiffies, start+180*HZ))
{
- status = rx_readl(dev, IndexRegs.Mailbox[7]) >> 16;
- printk(KERN_ERR "%s%d: adapter kernel failed to start, init status = %ld.\n", dev->name, instance, status);
+ status = aac_io_le32_to_cpu(rx_readl(dev, IndexRegs.Mailbox[7]));
+ printk(KERN_ERR "%s%d: adapter kernel failed to start, init status = %lx.\n", dev->name, instance, status);
goto error_iounmap;
}
set_current_state(TASK_UNINTERRUPTIBLE);
===== drivers/scsi/aacraid/sa.c 1.13 vs edited =====
--- 1.13/drivers/scsi/aacraid/sa.c 2004-11-01 13:09:31 -08:00
+++ edited/drivers/scsi/aacraid/sa.c 2005-03-03 13:01:32 -08:00
@@ -62,7 +62,7 @@
if (intstat & mask) {
if (intstat & PrintfReady) {
- aac_printf(dev, le32_to_cpu(sa_readl(dev, Mailbox5)));
+ aac_printf(dev, aac_io_le32_to_cpu(sa_readl(dev, Mailbox5)));
sa_writew(dev, DoorbellClrReg_p, PrintfReady); /* clear PrintfReady */
sa_writew(dev, DoorbellReg_s, PrintfDone);
} else if (intstat & DOORBELL_1) { // dev -> Host Normal Command Ready
@@ -128,7 +128,7 @@
* @p1: first parameter
* @ret: adapter status
*
- * This routine will send a synchronous comamnd to the adapter and wait
+ * This routine will send a synchronous command to the adapter and wait
* for its completion.
*/
@@ -139,11 +139,11 @@
/*
* Write the Command into Mailbox 0
*/
- sa_writel(dev, Mailbox0, cpu_to_le32(command));
+ sa_writel(dev, Mailbox0, command);
/*
* Write the parameters into Mailboxes 1 - 4
*/
- sa_writel(dev, Mailbox1, cpu_to_le32(p1));
+ sa_writel(dev, Mailbox1, aac_io_cpu_to_le32(p1));
sa_writel(dev, Mailbox2, 0);
sa_writel(dev, Mailbox3, 0);
sa_writel(dev, Mailbox4, 0);
@@ -186,7 +186,8 @@
/*
* Pull the synch status from Mailbox 0.
*/
- *ret = le32_to_cpu(sa_readl(dev, Mailbox0));
+ if (ret)
+ *ret = aac_io_le32_to_cpu(sa_readl(dev, Mailbox0));
return 0;
}
@@ -218,9 +219,8 @@
* Fill in the remaining pieces of the init.
*/
init = dev->init;
- init->HostElapsedSeconds = cpu_to_le32(jiffies/HZ);
+ init->HostElapsedSeconds = cpu_to_le32(get_seconds());
- dprintk(("INIT\n"));
/*
* Tell the adapter we are back and up and running so it will scan its command
* queues and enable our interrupts
@@ -230,10 +230,8 @@
* First clear out all interrupts. Then enable the one's that
* we can handle.
*/
- dprintk(("MASK\n"));
sa_writew(dev, SaDbCSR.PRISETIRQMASK, cpu_to_le16(0xffff));
sa_writew(dev, SaDbCSR.PRICLEARIRQMASK, (PrintfReady | DOORBELL_1 | DOORBELL_2 | DOORBELL_3 | DOORBELL_4));
- dprintk(("SYNCCMD\n"));
/* We can only use a 32 bit address here */
sa_sync_cmd(dev, INIT_STRUCT_BASE_ADDRESS, (u32)(ulong)dev->init_pa, &ret);
}
@@ -286,14 +284,12 @@
int instance;
const char *name;
- dprintk(("PREINST\n"));
instance = dev->id;
name = dev->name;
/*
* Map in the registers from the adapter.
*/
- dprintk(("PREMAP\n"));
if((dev->regs.sa = ioremap((unsigned long)dev->scsi_host_ptr->base, 8192))==NULL)
{
@@ -320,15 +316,14 @@
*/
while (!(sa_readl(dev, Mailbox7) & KERNEL_UP_AND_RUNNING)) {
if (time_after(jiffies, start+180*HZ)) {
- status = sa_readl(dev, Mailbox7) >> 16;
- printk(KERN_WARNING "%s%d: adapter kernel failed to start, init status = %d.\n", name, instance, le32_to_cpu(status));
+ status = aac_io_le32_to_cpu(sa_readl(dev, Mailbox7));
+ printk(KERN_WARNING "%s%d: adapter kernel failed to start, init status = %lx.\n", name, instance, status);
goto error_iounmap;
}
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
}
- dprintk(("ATIRQ\n"));
if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev ) < 0) {
printk(KERN_WARNING "%s%d: Interrupt unavailable.\n", name, instance);
goto error_iounmap;
@@ -343,12 +338,10 @@
dev->a_ops.adapter_sync_cmd = sa_sync_cmd;
dev->a_ops.adapter_check_health = aac_sa_check_health;
- dprintk(("FUNCDONE\n"));
if(aac_init_adapter(dev) == NULL)
goto error_irq;
- dprintk(("NEWADAPTDONE\n"));
/*
* Start any kernel threads needed
*/
@@ -362,9 +355,7 @@
* Tell the adapter that all is configure, and it can start
* accepting requests
*/
- dprintk(("STARTING\n"));
aac_sa_start_adapter(dev);
- dprintk(("STARTED\n"));
return 0;
--
Mark Haverkamp <markh@osdl.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] 2.6 aacraid: endian cleanup
2005-03-21 18:41 [PATCH] 2.6 aacraid: endian cleanup Mark Haverkamp
@ 2005-03-28 21:58 ` James Bottomley
2005-03-28 22:04 ` Mark Haverkamp
2005-03-28 21:59 ` Christoph Hellwig
1 sibling, 1 reply; 12+ messages in thread
From: James Bottomley @ 2005-03-28 21:58 UTC (permalink / raw)
To: Mark Haverkamp; +Cc: linux-scsi, Mark Salyzyn
On Mon, 2005-03-21 at 10:41 -0800, Mark Haverkamp wrote:
> + Adaptec 2130S
Why are we getting updated card support in an endian cleanup patch?
> +/*
> + * Some configurations of BE Linux have writel and readl automatically perform
> + * byte swapping, and some configurations (embedded) do not. Typically
> + * AAC_IO_USES_CPU_ORDER needs to be defined since most BE ports are working
> + * with drivers that have not been coded to support BE.
> + */
> +#define AAC_IO_USES_CPU_ORDER 1
> +#ifdef AAC_IO_USES_CPU_ORDER
> +# define aac_io_le32_to_cpu
> +# define aac_io_cpu_to_le16
> +# define aac_io_cpu_to_le32
> +#else
> +# define aac_io_le32_to_cpu le32_to_cpu
> +# define aac_io_cpu_to_le16 cpu_to_le16
> +# define aac_io_cpu_to_le32 cpu_to_le32
> +#endif
What exactly is this for? I know of no platforms that implement readl
and friends incorrectly, so all of this should be unnecessary.
James
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] 2.6 aacraid: endian cleanup
2005-03-21 18:41 [PATCH] 2.6 aacraid: endian cleanup Mark Haverkamp
2005-03-28 21:58 ` James Bottomley
@ 2005-03-28 21:59 ` Christoph Hellwig
2005-03-28 22:05 ` Mark Haverkamp
` (2 more replies)
1 sibling, 3 replies; 12+ messages in thread
From: Christoph Hellwig @ 2005-03-28 21:59 UTC (permalink / raw)
To: Mark Haverkamp; +Cc: James Bottomley, linux-scsi, Mark Salyzyn
On Mon, Mar 21, 2005 at 10:41:23AM -0800, Mark Haverkamp wrote:
> A patch from Adaptec with byte order changes:
> - drop byte swapping on all 0's and all 1's content
> - fix up missing swapping directives
> - ensure swapping on 16 bit values does not use 32 bit swap
> - reconcile the readl/writel auto-swapping in only most of the
> configurations.
that last bit is bogus. readl/writel are defined to swap bytes on
big endian systems. Whatever broken Mvista/Windriver or whatever port
doesn't do that should be fixed.
Also please remove unrelated changes like the new cardtypes from the patch,
follow normal kernel codingstyle (e.g. ||, && at the end of the line) and
switch to __le* types for harware structures and make sure it's passing
sparse -Wbitwise.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] 2.6 aacraid: endian cleanup
2005-03-28 21:58 ` James Bottomley
@ 2005-03-28 22:04 ` Mark Haverkamp
2005-03-28 22:17 ` James Bottomley
0 siblings, 1 reply; 12+ messages in thread
From: Mark Haverkamp @ 2005-03-28 22:04 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-scsi, Mark Salyzyn
On Mon, 2005-03-28 at 15:58 -0600, James Bottomley wrote:
> On Mon, 2005-03-21 at 10:41 -0800, Mark Haverkamp wrote:
> > + Adaptec 2130S
That was in the TODO file I think. There isn't a new card supported in
this patch set.
>
> Why are we getting updated card support in an endian cleanup patch?
>
> > +/*
> > + * Some configurations of BE Linux have writel and readl automatically perform
> > + * byte swapping, and some configurations (embedded) do not. Typically
> > + * AAC_IO_USES_CPU_ORDER needs to be defined since most BE ports are working
> > + * with drivers that have not been coded to support BE.
> > + */
> > +#define AAC_IO_USES_CPU_ORDER 1
> > +#ifdef AAC_IO_USES_CPU_ORDER
> > +# define aac_io_le32_to_cpu
> > +# define aac_io_cpu_to_le16
> > +# define aac_io_cpu_to_le32
> > +#else
> > +# define aac_io_le32_to_cpu le32_to_cpu
> > +# define aac_io_cpu_to_le16 cpu_to_le16
> > +# define aac_io_cpu_to_le32 cpu_to_le32
> > +#endif
>
> What exactly is this for? I know of no platforms that implement readl
> and friends incorrectly, so all of this should be unnecessary.
I wondered about this. Mark S. thought that there were some. If there
aren't, I can remove all that code.
Mark.
>
> James
>
--
Mark Haverkamp <markh@osdl.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] 2.6 aacraid: endian cleanup
2005-03-28 21:59 ` Christoph Hellwig
@ 2005-03-28 22:05 ` Mark Haverkamp
2005-03-28 23:28 ` Mark Haverkamp
2005-03-29 16:49 ` Mark Haverkamp
2 siblings, 0 replies; 12+ messages in thread
From: Mark Haverkamp @ 2005-03-28 22:05 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: James Bottomley, linux-scsi, Mark Salyzyn
On Mon, 2005-03-28 at 22:59 +0100, Christoph Hellwig wrote:
> On Mon, Mar 21, 2005 at 10:41:23AM -0800, Mark Haverkamp wrote:
> > A patch from Adaptec with byte order changes:
> > - drop byte swapping on all 0's and all 1's content
> > - fix up missing swapping directives
> > - ensure swapping on 16 bit values does not use 32 bit swap
> > - reconcile the readl/writel auto-swapping in only most of the
> > configurations.
>
> that last bit is bogus. readl/writel are defined to swap bytes on
> big endian systems. Whatever broken Mvista/Windriver or whatever port
> doesn't do that should be fixed.
Yes, I just got something similar from James. I'll fix it.
>
> Also please remove unrelated changes like the new cardtypes from the patch,
> follow normal kernel codingstyle (e.g. ||, && at the end of the line) and
> switch to __le* types for harware structures and make sure it's passing
> sparse -Wbitwise.
OK, I'll take a look.
Mark.
--
Mark Haverkamp <markh@osdl.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] 2.6 aacraid: endian cleanup
2005-03-28 22:04 ` Mark Haverkamp
@ 2005-03-28 22:17 ` James Bottomley
0 siblings, 0 replies; 12+ messages in thread
From: James Bottomley @ 2005-03-28 22:17 UTC (permalink / raw)
To: Mark Haverkamp; +Cc: linux-scsi, Mark Salyzyn
On Mon, 2005-03-28 at 14:04 -0800, Mark Haverkamp wrote:
> On Mon, 2005-03-28 at 15:58 -0600, James Bottomley wrote:
> > What exactly is this for? I know of no platforms that implement readl
> > and friends incorrectly, so all of this should be unnecessary.
>
> I wondered about this. Mark S. thought that there were some. If there
> aren't, I can remove all that code.
Thanks.
Please, the next time, ask first before patching .... it should be
fairly clear that if every driver did this, we'd have a huge mess and
great impetus to fix whichever embedded platform was causing
problems ...
James
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] 2.6 aacraid: endian cleanup
@ 2005-03-28 23:02 Salyzyn, Mark
0 siblings, 0 replies; 12+ messages in thread
From: Salyzyn, Mark @ 2005-03-28 23:02 UTC (permalink / raw)
To: Christoph Hellwig, Mark Haverkamp; +Cc: James Bottomley, linux-scsi
The new cardtype was a documentation. Could have been handled separately
I agree.
*I* have to support the broken port for reasons of expediency. Dropping
this behavior from the kernel.org patch is perfectly fine by me. I was
not sure how extensive this problem was.
Sincerely -- Mark Salyzyn
-----Original Message-----
From: Christoph Hellwig [mailto:hch@infradead.org]
Sent: Monday, March 28, 2005 5:00 PM
To: Mark Haverkamp
Cc: James Bottomley; linux-scsi; Salyzyn, Mark
Subject: Re: [PATCH] 2.6 aacraid: endian cleanup
On Mon, Mar 21, 2005 at 10:41:23AM -0800, Mark Haverkamp wrote:
> A patch from Adaptec with byte order changes:
> - drop byte swapping on all 0's and all 1's content
> - fix up missing swapping directives
> - ensure swapping on 16 bit values does not use 32 bit swap
> - reconcile the readl/writel auto-swapping in only most of the
> configurations.
that last bit is bogus. readl/writel are defined to swap bytes on
big endian systems. Whatever broken Mvista/Windriver or whatever port
doesn't do that should be fixed.
Also please remove unrelated changes like the new cardtypes from the
patch,
follow normal kernel codingstyle (e.g. ||, && at the end of the line)
and
switch to __le* types for harware structures and make sure it's passing
sparse -Wbitwise.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] 2.6 aacraid: endian cleanup
2005-03-28 21:59 ` Christoph Hellwig
2005-03-28 22:05 ` Mark Haverkamp
@ 2005-03-28 23:28 ` Mark Haverkamp
2005-03-28 23:36 ` Randy.Dunlap
2005-03-28 23:38 ` Mark Haverkamp
2005-03-29 16:49 ` Mark Haverkamp
2 siblings, 2 replies; 12+ messages in thread
From: Mark Haverkamp @ 2005-03-28 23:28 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: James Bottomley, linux-scsi, Mark Salyzyn
On Mon, 2005-03-28 at 22:59 +0100, Christoph Hellwig wrote:
> On Mon, Mar 21, 2005 at 10:41:23AM -0800, Mark Haverkamp wrote:
> > A patch from Adaptec with byte order changes:
> > - drop byte swapping on all 0's and all 1's content
> > - fix up missing swapping directives
> > - ensure swapping on 16 bit values does not use 32 bit swap
> > - reconcile the readl/writel auto-swapping in only most of the
> > configurations.
>
> that last bit is bogus. readl/writel are defined to swap bytes on
> big endian systems. Whatever broken Mvista/Windriver or whatever port
> doesn't do that should be fixed.
>
> Also please remove unrelated changes like the new cardtypes from the patch,
> follow normal kernel codingstyle (e.g. ||, && at the end of the line) and
> switch to __le* types for harware structures and make sure it's passing
> sparse -Wbitwise.
Sorry if this is a dumb question, but I haven't used sparse before. If
I do a make C=1, will that run sparse with the appropriate options?
Thanks,
Mark.
--
Mark Haverkamp <markh@osdl.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] 2.6 aacraid: endian cleanup
2005-03-28 23:28 ` Mark Haverkamp
@ 2005-03-28 23:36 ` Randy.Dunlap
2005-03-28 23:38 ` Mark Haverkamp
1 sibling, 0 replies; 12+ messages in thread
From: Randy.Dunlap @ 2005-03-28 23:36 UTC (permalink / raw)
To: Mark Haverkamp
Cc: Christoph Hellwig, James Bottomley, linux-scsi, Mark Salyzyn
Mark Haverkamp wrote:
> On Mon, 2005-03-28 at 22:59 +0100, Christoph Hellwig wrote:
>
>>On Mon, Mar 21, 2005 at 10:41:23AM -0800, Mark Haverkamp wrote:
>>
>>>A patch from Adaptec with byte order changes:
>>> - drop byte swapping on all 0's and all 1's content
>>> - fix up missing swapping directives
>>> - ensure swapping on 16 bit values does not use 32 bit swap
>>> - reconcile the readl/writel auto-swapping in only most of the
>>>configurations.
>>
>>that last bit is bogus. readl/writel are defined to swap bytes on
>>big endian systems. Whatever broken Mvista/Windriver or whatever port
>>doesn't do that should be fixed.
>>
>>Also please remove unrelated changes like the new cardtypes from the patch,
>>follow normal kernel codingstyle (e.g. ||, && at the end of the line) and
>>switch to __le* types for harware structures and make sure it's passing
>>sparse -Wbitwise.
>
>
> Sorry if this is a dumb question, but I haven't used sparse before. If
> I do a make C=1, will that run sparse with the appropriate options?
sparse doesn't do bitwise by default, so you need to do
make C=1 CHECK="sparse -Wbitwise" drivers/scsi/filename.o (e.g.)
--
~Randy
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] 2.6 aacraid: endian cleanup
2005-03-28 23:28 ` Mark Haverkamp
2005-03-28 23:36 ` Randy.Dunlap
@ 2005-03-28 23:38 ` Mark Haverkamp
1 sibling, 0 replies; 12+ messages in thread
From: Mark Haverkamp @ 2005-03-28 23:38 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: James Bottomley, linux-scsi, Mark Salyzyn
On Mon, 2005-03-28 at 15:28 -0800, Mark Haverkamp wrote:
> On Mon, 2005-03-28 at 22:59 +0100, Christoph Hellwig wrote:
> > On Mon, Mar 21, 2005 at 10:41:23AM -0800, Mark Haverkamp wrote:
> > > A patch from Adaptec with byte order changes:
> > > - drop byte swapping on all 0's and all 1's content
> > > - fix up missing swapping directives
> > > - ensure swapping on 16 bit values does not use 32 bit swap
> > > - reconcile the readl/writel auto-swapping in only most of the
> > > configurations.
> >
> > that last bit is bogus. readl/writel are defined to swap bytes on
> > big endian systems. Whatever broken Mvista/Windriver or whatever port
> > doesn't do that should be fixed.
> >
> > Also please remove unrelated changes like the new cardtypes from the patch,
> > follow normal kernel codingstyle (e.g. ||, && at the end of the line) and
> > switch to __le* types for harware structures and make sure it's passing
> > sparse -Wbitwise.
>
> Sorry if this is a dumb question, but I haven't used sparse before. If
> I do a make C=1, will that run sparse with the appropriate options?
Never mind, I found the instructions in the Documentation directory.
Mark.
--
Mark Haverkamp <markh@osdl.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] 2.6 aacraid: endian cleanup
2005-03-28 21:59 ` Christoph Hellwig
2005-03-28 22:05 ` Mark Haverkamp
2005-03-28 23:28 ` Mark Haverkamp
@ 2005-03-29 16:49 ` Mark Haverkamp
2005-03-29 16:51 ` Christoph Hellwig
2 siblings, 1 reply; 12+ messages in thread
From: Mark Haverkamp @ 2005-03-29 16:49 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: James Bottomley, linux-scsi, Mark Salyzyn
On Mon, 2005-03-28 at 22:59 +0100, Christoph Hellwig wrote:
> On Mon, Mar 21, 2005 at 10:41:23AM -0800, Mark Haverkamp wrote:
> > A patch from Adaptec with byte order changes:
> > - drop byte swapping on all 0's and all 1's content
> > - fix up missing swapping directives
> > - ensure swapping on 16 bit values does not use 32 bit swap
> > - reconcile the readl/writel auto-swapping in only most of the
> > configurations.
>
> that last bit is bogus. readl/writel are defined to swap bytes on
> big endian systems. Whatever broken Mvista/Windriver or whatever port
> doesn't do that should be fixed.
>
> Also please remove unrelated changes like the new cardtypes from the patch,
> follow normal kernel codingstyle (e.g. ||, && at the end of the line) and
> switch to __le* types for harware structures and make sure it's passing
> sparse -Wbitwise.
I ran sparse on the driver and without the -Wbitwise, it only has 7
warnings such as:
CHECK drivers/scsi/aacraid/linit.c
drivers/scsi/aacraid/linit.c:218:12: warning: symbol 'aac_info' was not declared. Should it be static?
With -Wbitwise there are about 200 warnings of this sort:
drivers/scsi/aacraid/aachba.c:180:18: warning: incorrect type in assignment (different base types)
drivers/scsi/aacraid/aachba.c:180:18: expected unsigned int [unsigned] [usertype] command
drivers/scsi/aacraid/aachba.c:180:18: got restricted unsigned int [usertype] [force] <noident>
What is your preference, I could clean up the existing patch and re-
submit and then address the sparse warnings with a follow-up patch. Or
try to fix everything in one patch.
Thanks,
Mark.
--
Mark Haverkamp <markh@osdl.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] 2.6 aacraid: endian cleanup
2005-03-29 16:49 ` Mark Haverkamp
@ 2005-03-29 16:51 ` Christoph Hellwig
0 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2005-03-29 16:51 UTC (permalink / raw)
To: Mark Haverkamp; +Cc: James Bottomley, linux-scsi, Mark Salyzyn
On Tue, Mar 29, 2005 at 08:49:33AM -0800, Mark Haverkamp wrote:
> I ran sparse on the driver and without the -Wbitwise, it only has 7
> warnings such as:
>
> CHECK drivers/scsi/aacraid/linit.c
> drivers/scsi/aacraid/linit.c:218:12: warning: symbol 'aac_info' was not declared. Should it be static?
>
> With -Wbitwise there are about 200 warnings of this sort:
> drivers/scsi/aacraid/aachba.c:180:18: warning: incorrect type in assignment (different base types)
> drivers/scsi/aacraid/aachba.c:180:18: expected unsigned int [unsigned] [usertype] command
> drivers/scsi/aacraid/aachba.c:180:18: got restricted unsigned int [usertype] [force] <noident>
>
> What is your preference, I could clean up the existing patch and re-
> submit and then address the sparse warnings with a follow-up patch. Or
> try to fix everything in one patch.
I think we can postpone the sparse fixes to a followon patch.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2005-03-29 16:51 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-21 18:41 [PATCH] 2.6 aacraid: endian cleanup Mark Haverkamp
2005-03-28 21:58 ` James Bottomley
2005-03-28 22:04 ` Mark Haverkamp
2005-03-28 22:17 ` James Bottomley
2005-03-28 21:59 ` Christoph Hellwig
2005-03-28 22:05 ` Mark Haverkamp
2005-03-28 23:28 ` Mark Haverkamp
2005-03-28 23:36 ` Randy.Dunlap
2005-03-28 23:38 ` Mark Haverkamp
2005-03-29 16:49 ` Mark Haverkamp
2005-03-29 16:51 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2005-03-28 23:02 Salyzyn, Mark
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox