patch-2.4.23 linux-2.4.23/drivers/scsi/nsp32_io.h
Next file: linux-2.4.23/drivers/scsi/pas16.c
Previous file: linux-2.4.23/drivers/scsi/nsp32_debug.c
Back to the patch index
Back to the overall index
- Lines: 270
- Date:
2003-11-28 10:26:20.000000000 -0800
- Orig file:
linux-2.4.22/drivers/scsi/nsp32_io.h
- Orig date:
2003-08-25 04:44:42.000000000 -0700
diff -urN linux-2.4.22/drivers/scsi/nsp32_io.h linux-2.4.23/drivers/scsi/nsp32_io.h
@@ -1,5 +1,5 @@
/*
- * Workbit NinjaSCSI-32Bi/UDE PCI/Cardbus SCSI Host Bus Adapter driver
+ * Workbit NinjaSCSI-32Bi/UDE PCI/CardBus SCSI Host Bus Adapter driver
* I/O routine
*
* This software may be used and distributed according to the terms of
@@ -22,30 +22,30 @@
return inb(base + index);
}
-static inline void nsp32_write2(unsigned int base,
- unsigned int index,
+static inline void nsp32_write2(unsigned int base,
+ unsigned int index,
unsigned short val)
{
- outw(cpu_to_le16(val), (base + index));
+ outw(val, (base + index));
}
static inline unsigned short nsp32_read2(unsigned int base,
unsigned int index)
{
- return le16_to_cpu(inw(base + index));
+ return inw(base + index);
}
static inline void nsp32_write4(unsigned int base,
unsigned int index,
unsigned long val)
{
- outl(cpu_to_le32(val), (base + index));
+ outl(val, (base + index));
}
static inline unsigned long nsp32_read4(unsigned int base,
unsigned int index)
{
- return le32_to_cpu(inl(base + index));
+ return inl(base + index);
}
/*==============================================*/
@@ -58,7 +58,7 @@
ptr = (unsigned char *)(base + NSP32_MMIO_OFFSET + index);
- *ptr = val;
+ writeb(val, ptr);
}
static inline unsigned char nsp32_mmio_read1(unsigned long base,
@@ -68,18 +68,18 @@
ptr = (unsigned char *)(base + NSP32_MMIO_OFFSET + index);
- return *ptr;
+ return readb(ptr);
}
-static inline void nsp32_mmio_write2(unsigned long base,
- unsigned int index,
+static inline void nsp32_mmio_write2(unsigned long base,
+ unsigned int index,
unsigned short val)
{
volatile unsigned short *ptr;
ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + index);
- *ptr = cpu_to_le16(val);
+ writew(cpu_to_le16(val), ptr);
}
static inline unsigned short nsp32_mmio_read2(unsigned long base,
@@ -87,11 +87,9 @@
{
volatile unsigned short *ptr;
- //printk(__FUNCTION__ "\n");
-
ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + index);
- return le16_to_cpu(*ptr);
+ return le16_to_cpu(readw(ptr));
}
static inline void nsp32_mmio_write4(unsigned long base,
@@ -102,7 +100,7 @@
ptr = (unsigned long *)(base + NSP32_MMIO_OFFSET + index);
- *ptr = cpu_to_le32(val);
+ writel(cpu_to_le32(val), ptr);
}
static inline unsigned long nsp32_mmio_read4(unsigned long base,
@@ -110,16 +108,12 @@
{
volatile unsigned long *ptr;
- //printk(__FUNCTION__ "\n");
-
ptr = (unsigned long *)(base + NSP32_MMIO_OFFSET + index);
- return le32_to_cpu(*ptr);
+ return le32_to_cpu(readl(ptr));
}
-
-/*=============================================*/
-
+/*==============================================*/
static inline unsigned char nsp32_index_read1(unsigned int base,
unsigned int reg)
@@ -132,7 +126,7 @@
unsigned int reg,
unsigned char val)
{
- outb(reg, base + INDEX_REG);
+ outb(reg, base + INDEX_REG );
outb(val, base + DATA_REG_LOW);
}
@@ -140,15 +134,15 @@
unsigned int reg)
{
outb(reg, base + INDEX_REG);
- return le16_to_cpu(inw(base + DATA_REG_LOW));
+ return inw(base + DATA_REG_LOW);
}
-static inline void nsp32_index_write2(unsigned int base,
- unsigned int reg,
+static inline void nsp32_index_write2(unsigned int base,
+ unsigned int reg,
unsigned short val)
{
- outb(reg, base + INDEX_REG);
- outw(cpu_to_le16(val), base + DATA_REG_LOW);
+ outb(reg, base + INDEX_REG );
+ outw(val, base + DATA_REG_LOW);
}
static inline unsigned long nsp32_index_read4(unsigned int base,
@@ -157,8 +151,8 @@
unsigned long h,l;
outb(reg, base + INDEX_REG);
- l = le16_to_cpu(inw(base + DATA_REG_LOW));
- h = le16_to_cpu(inw(base + DATA_REG_HI ));
+ l = inw(base + DATA_REG_LOW);
+ h = inw(base + DATA_REG_HI );
return ((h << 16) | l);
}
@@ -170,15 +164,14 @@
unsigned long h,l;
h = (val & 0xffff0000) >> 16;
- l = (val & 0x0000ffff) >> 0;
+ l = (val & 0x0000ffff) >> 0;
- outb(reg, base + INDEX_REG);
- outw(cpu_to_le16(l), base + DATA_REG_LOW);
- outw(cpu_to_le16(h), base + DATA_REG_HI);
+ outb(reg, base + INDEX_REG );
+ outw(l, base + DATA_REG_LOW);
+ outw(h, base + DATA_REG_HI );
}
-
-/* ===================================*/
+/*==============================================*/
static inline unsigned char nsp32_mmio_index_read1(unsigned int base,
unsigned int reg)
@@ -188,13 +181,12 @@
index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG);
data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW);
- *index_ptr = reg;
-
- return ((*data_ptr) & 0xff);
+ writeb(reg, index_ptr);
+ return readb(data_ptr);
}
-static inline void nsp32_mmio_index_write1(unsigned int base,
- unsigned int reg,
+static inline void nsp32_mmio_index_write1(unsigned int base,
+ unsigned int reg,
unsigned char val)
{
volatile unsigned short *index_ptr, *data_ptr;
@@ -202,8 +194,8 @@
index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG);
data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW);
- *index_ptr = reg;
- *data_ptr = (unsigned short)val;
+ writeb(reg, index_ptr);
+ writeb(val, data_ptr );
}
static inline unsigned short nsp32_mmio_index_read2(unsigned int base,
@@ -214,13 +206,12 @@
index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG);
data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW);
- *index_ptr = reg;
-
- return le16_to_cpu(*data_ptr);
+ writeb(reg, index_ptr);
+ return le16_to_cpu(readw(data_ptr));
}
-static inline void nsp32_mmio_index_write2(unsigned int base,
- unsigned int reg,
+static inline void nsp32_mmio_index_write2(unsigned int base,
+ unsigned int reg,
unsigned short val)
{
volatile unsigned short *index_ptr, *data_ptr;
@@ -228,34 +219,33 @@
index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG);
data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW);
- *index_ptr = reg;
- *data_ptr = val;
+ writeb(reg, index_ptr);
+ writew(cpu_to_le16(val), data_ptr );
}
-/*-------------------------------------------------------------------*/
+/*==============================================*/
-static inline void nsp32_multi_read4(unsigned int BaseAddr,
- unsigned int Register,
+static inline void nsp32_multi_read4(unsigned int base,
+ unsigned int reg,
void *buf,
unsigned long count)
{
- insl(BaseAddr + Register, buf, count);
+ insl(base + reg, buf, count);
}
static inline void nsp32_fifo_read(unsigned int base,
void *buf,
unsigned long count)
{
- //DEBUG(0, __FUNCTION__ "() buf=0x%p, count=0x%lx*4\n", buf, count);
nsp32_multi_read4(base, FIFO_DATA_LOW, buf, count);
}
-static inline void nsp32_multi_write4(unsigned int BaseAddr,
- unsigned int Register,
+static inline void nsp32_multi_write4(unsigned int base,
+ unsigned int reg,
void *buf,
unsigned long count)
{
- outsl(BaseAddr + Register, buf, count);
+ outsl(base + reg, buf, count);
}
static inline void nsp32_fifo_write(unsigned int base,
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)