summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ncr53c8xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ncr53c8xx.c')
-rw-r--r--drivers/scsi/ncr53c8xx.c237
1 files changed, 68 insertions, 169 deletions
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 3e41e0c00..168299e0b 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -122,7 +122,7 @@
#include <asm/io.h>
#include <asm/system.h>
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,93)
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#endif
#include <linux/delay.h>
#include <linux/signal.h>
@@ -151,9 +151,6 @@
#ifndef __initdata
#define __initdata
#endif
-#ifndef __initfunc
-#define __initfunc(__arginit) __arginit
-#endif
#endif
#if LINUX_VERSION_CODE <= LinuxVersionCode(2,1,92)
@@ -595,9 +592,7 @@ static spinlock_t driver_lock;
#endif
#if defined(__i386__) || !defined(NCR_IOMAPPED)
-__initfunc(
-static vm_offset_t remap_pci_mem(u_long base, u_long size)
-)
+static vm_offset_t __init remap_pci_mem(u_long base, u_long size)
{
u_long page_base = ((u_long) base) & PAGE_MASK;
u_long page_offs = ((u_long) base) - page_base;
@@ -606,9 +601,7 @@ static vm_offset_t remap_pci_mem(u_long base, u_long size)
return (vm_offset_t) (page_remapped? (page_remapped + page_offs) : 0UL);
}
-__initfunc(
-static void unmap_pci_mem(vm_offset_t vaddr, u_long size)
-)
+static void __init unmap_pci_mem(vm_offset_t vaddr, u_long size)
{
if (vaddr)
iounmap((void *) (vaddr & PAGE_MASK));
@@ -3708,9 +3701,7 @@ static struct scripth scripth0 __initdata = {
**==========================================================
*/
-__initfunc(
-void ncr_script_fill (struct script * scr, struct scripth * scrh)
-)
+void __init ncr_script_fill (struct script * scr, struct scripth * scrh)
{
int i;
ncrcmd *p;
@@ -3786,9 +3777,7 @@ flush_cache_all();
**==========================================================
*/
-__initfunc(
-static void ncr_script_copy_and_bind (ncb_p np, ncrcmd *src, ncrcmd *dst, int len)
-)
+static void __init ncr_script_copy_and_bind (ncb_p np, ncrcmd *src, ncrcmd *dst, int len)
{
ncrcmd opcode, new, old, tmp1, tmp2;
ncrcmd *start, *end;
@@ -4045,10 +4034,8 @@ static inline void ncr_init_burst(ncb_p np, u_char bc)
** Get target set-up from Symbios format NVRAM.
*/
-__initfunc(
-static void
- ncr_Symbios_setup_target(ncb_p np, int target, Symbios_nvram *nvram)
-)
+static void __init
+ncr_Symbios_setup_target(ncb_p np, int target, Symbios_nvram *nvram)
{
tcb_p tp = &np->target[target];
Symbios_target *tn = &nvram->target[target];
@@ -4068,10 +4055,8 @@ static void
** Get target set-up from Tekram format NVRAM.
*/
-__initfunc(
-static void
- ncr_Tekram_setup_target(ncb_p np, int target, Tekram_nvram *nvram)
-)
+static void __init
+ncr_Tekram_setup_target(ncb_p np, int target, Tekram_nvram *nvram)
{
tcb_p tp = &np->target[target];
struct Tekram_target *tn = &nvram->target[target];
@@ -4097,9 +4082,7 @@ static void
}
#endif /* SCSI_NCR_NVRAM_SUPPORT */
-__initfunc(
-static int ncr_prepare_setting(ncb_p np, ncr_nvram *nvram)
-)
+static int __init ncr_prepare_setting(ncb_p np, ncr_nvram *nvram)
{
u_char burst_max;
u_long period;
@@ -4381,9 +4364,7 @@ static int ncr_prepare_setting(ncb_p np, ncr_nvram *nvram)
#ifdef SCSI_NCR_DEBUG_NVRAM
-__initfunc(
-void ncr_display_Symbios_nvram(ncb_p np, Symbios_nvram *nvram)
-)
+void __init ncr_display_Symbios_nvram(ncb_p np, Symbios_nvram *nvram)
{
int i;
@@ -4413,9 +4394,7 @@ void ncr_display_Symbios_nvram(ncb_p np, Symbios_nvram *nvram)
static u_char Tekram_boot_delay[7] __initdata = {3, 5, 10, 20, 30, 60, 120};
-__initfunc(
-void ncr_display_Tekram_nvram(ncb_p np, Tekram_nvram *nvram)
-)
+void __init ncr_display_Tekram_nvram(ncb_p np, Tekram_nvram *nvram)
{
int i, tags, boot_delay;
char *rem;
@@ -4474,9 +4453,8 @@ void ncr_display_Tekram_nvram(ncb_p np, Tekram_nvram *nvram)
** start the timer daemon.
*/
-__initfunc(
-static int ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
-)
+static int __init
+ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
{
struct host_data *host_data;
ncb_p np;
@@ -8852,9 +8830,7 @@ static int ncr_scatter(ccb_p cp, Scsi_Cmnd *cmd)
*/
#ifndef NCR_IOMAPPED
-__initfunc(
-static int ncr_regtest (struct ncb* np)
-)
+static int __init ncr_regtest (struct ncb* np)
{
register volatile u_int32 data;
/*
@@ -8878,9 +8854,7 @@ static int ncr_regtest (struct ncb* np)
}
#endif
-__initfunc(
-static int ncr_snooptest (struct ncb* np)
-)
+static int __init ncr_snooptest (struct ncb* np)
{
u_int32 ncr_rd, ncr_wr, ncr_bk, host_rd, host_wr, pc;
int i, err=0;
@@ -9144,9 +9118,7 @@ static void ncr_selectclock(ncb_p np, u_char scntl3)
/*
* calculate NCR SCSI clock frequency (in KHz)
*/
-__initfunc(
-static unsigned ncrgetfreq (ncb_p np, int gen)
-)
+static unsigned __init ncrgetfreq (ncb_p np, int gen)
{
unsigned ms = 0;
@@ -9194,9 +9166,7 @@ static unsigned ncrgetfreq (ncb_p np, int gen)
/*
* Get/probe NCR SCSI clock frequency
*/
-__initfunc(
-static void ncr_getclock (ncb_p np, int mult)
-)
+static void __init ncr_getclock (ncb_p np, int mult)
{
unsigned char scntl3 = INB(nc_scntl3);
unsigned char stest1 = INB(nc_stest1);
@@ -9284,9 +9254,8 @@ static void ncr_getclock (ncb_p np, int mult)
#define ARG_SEP ','
#endif
-__initfunc(
-void ncr53c8xx_setup(char *str, int *ints)
-)
+
+void __init ncr53c8xx_setup(char *str, int *ints)
{
#ifdef SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT
char *cur = str;
@@ -9397,9 +9366,7 @@ static int ncr53c8xx_pci_init(Scsi_Host_Template *tpnt,
** Returns the number of boards successfully attached.
*/
-__initfunc(
-static void ncr_print_driver_setup(void)
-)
+static void __init ncr_print_driver_setup(void)
{
#define YesNo(y) y ? 'y' : 'n'
printk ("ncr53c8xx: setup=disc:%c,specf:%d,ultra:%d,tags:%d,sync:%d,"
@@ -9438,10 +9405,8 @@ static ncr_chip ncr_chip_table[] __initdata = SCSI_NCR_CHIP_TABLE;
static ushort ncr_chip_ids[] __initdata = SCSI_NCR_CHIP_IDS;
#ifdef SCSI_NCR_NVRAM_SUPPORT
-__initfunc(
-static int
+static int __init
ncr_attach_using_nvram(Scsi_Host_Template *tpnt, int nvram_index, int count, ncr_device device[])
-)
{
int i, j;
int attach_count = 0;
@@ -9522,9 +9487,7 @@ out:
}
#endif /* SCSI_NCR_NVRAM_SUPPORT */
-__initfunc(
-int ncr53c8xx_detect(Scsi_Host_Template *tpnt)
-)
+int __init ncr53c8xx_detect(Scsi_Host_Template *tpnt)
{
int i, j;
int chips;
@@ -9651,44 +9614,18 @@ if (ncr53c8xx)
** Return the offset immediately after the base address that has
** been read. Btw, we blindly assume that the high 32 bits of 64 bit
** base addresses are set to zero on 32 bit architectures.
+** (the pci generic code now does this for us)
**
*/
-#if LINUX_VERSION_CODE <= LinuxVersionCode(2,1,92)
-__initfunc(
-static int
-pci_read_base_address(u_char bus, u_char device_fn, int offset, u_long *base)
-)
-{
- u_int32 tmp;
- pcibios_read_config_dword(bus, device_fn, offset, &tmp);
- *base = tmp;
- offset += sizeof(u_int32);
- if ((tmp & 0x7) == 0x4) {
-#if BITS_PER_LONG > 32
- pcibios_read_config_dword(bus, device_fn, offset, &tmp);
- *base |= (((u_long)tmp) << 32);
-#endif
- offset += sizeof(u_int32);
- }
- return offset;
-}
-#else /* LINUX_VERSION_CODE > LinuxVersionCode(2,1,92) */
-__initfunc(
-static int
+static int __init
pci_get_base_address(struct pci_dev *pdev, int index, u_long *base)
-)
{
- *base = pdev->base_address[index++];
- if ((*base & 0x7) == 0x4) {
-#if BITS_PER_LONG > 32
- *base |= (((u_long)pdev->base_address[index]) << 32);
-#endif
+ *base = pdev->resource[index].start;
+ if ((pdev->resource[index].flags & 0x7) == 0x4)
++index;
- }
- return index;
+ return ++index;
}
-#endif
/*
** Read and check the PCI configuration for any detected NCR
@@ -9696,10 +9633,9 @@ pci_get_base_address(struct pci_dev *pdev, int index, u_long *base)
** been detected.
*/
-__initfunc(
-static int ncr53c8xx_pci_init(Scsi_Host_Template *tpnt,
+
+static int __init ncr53c8xx_pci_init(Scsi_Host_Template *tpnt,
uchar bus, uchar device_fn, ncr_device *device)
-)
{
ushort vendor_id, device_id, command;
uchar cache_line_size, latency_timer;
@@ -9873,9 +9809,6 @@ static int ncr53c8xx_pci_init(Scsi_Host_Template *tpnt,
* each and every PCI card, if they don't use Fcode?
*/
- base = __pa(base);
- base_2 = __pa(base_2);
-
if (!(command & PCI_COMMAND_MASTER)) {
if (initverbose >= 2)
printk("ncr53c8xx: setting PCI_COMMAND_MASTER bit (fixup)\n");
@@ -9916,28 +9849,16 @@ static int ncr53c8xx_pci_init(Scsi_Host_Template *tpnt,
/*
* Check availability of IO space, memory space and master capability.
+ * No need to test BARs flags since they are hardwired to the
+ * expected value.
*/
- if (command & PCI_COMMAND_IO) {
- if ((io_port & 3) != 1) {
- printk("ncr53c8xx: disabling I/O mapping since base address 0 (0x%x)\n"
- " bits 0..1 indicate a non-IO mapping\n", (int) io_port);
- io_port = 0;
- }
- else
- io_port &= PCI_BASE_ADDRESS_IO_MASK;
- }
+ if (command & PCI_COMMAND_IO)
+ io_port &= PCI_BASE_ADDRESS_IO_MASK;
else
io_port = 0;
- if (command & PCI_COMMAND_MEMORY) {
- if ((base & PCI_BASE_ADDRESS_SPACE) != PCI_BASE_ADDRESS_SPACE_MEMORY) {
- printk("ncr53c8xx: disabling memory mapping since base address 1\n"
- " contains a non-memory mapping\n");
- base = 0;
- }
- else
- base &= PCI_BASE_ADDRESS_MEM_MASK;
- }
+ if (command & PCI_COMMAND_MEMORY)
+ base &= PCI_BASE_ADDRESS_MEM_MASK;
else
base = 0;
@@ -10956,9 +10877,7 @@ static void nvram_doBit(ncr_slot *np, u_char *read_bit, u_char write_bit, u_char
static void nvram_stop(ncr_slot *np, u_char *gpreg);
static void nvram_setBit(ncr_slot *np, u_char write_bit, u_char *gpreg, int bit_mode);
-__initfunc(
-static int ncr_get_Symbios_nvram (ncr_slot *np, Symbios_nvram *nvram)
-)
+static int __init ncr_get_Symbios_nvram (ncr_slot *np, Symbios_nvram *nvram)
{
static u_char Symbios_trailer[6] = {0xfe, 0xfe, 0, 0, 0, 0};
u_char gpcntl, gpreg;
@@ -11047,9 +10966,8 @@ out:
/*
* Read Symbios NvRAM data and compute checksum.
*/
-__initfunc(
-static u_short nvram_read_data(ncr_slot *np, u_char *data, int len, u_char *gpreg, u_char *gpcntl)
-)
+static u_short __init nvram_read_data(ncr_slot *np, u_char *data, int len,
+ u_char *gpreg, u_char *gpcntl)
{
int x;
u_short csum;
@@ -11066,9 +10984,7 @@ static u_short nvram_read_data(ncr_slot *np, u_char *data, int len, u_char *gpre
/*
* Send START condition to NVRAM to wake it up.
*/
-__initfunc(
-static void nvram_start(ncr_slot *np, u_char *gpreg)
-)
+static void __init nvram_start(ncr_slot *np, u_char *gpreg)
{
nvram_setBit(np, 1, gpreg, SET_BIT);
nvram_setBit(np, 0, gpreg, SET_CLK);
@@ -11080,9 +10996,9 @@ static void nvram_start(ncr_slot *np, u_char *gpreg)
* WRITE a byte to the NVRAM and then get an ACK to see it was accepted OK,
* GPIO0 must already be set as an output
*/
-__initfunc(
-static void nvram_write_byte(ncr_slot *np, u_char *ack_data, u_char write_data, u_char *gpreg, u_char *gpcntl)
-)
+static void __init nvram_write_byte(ncr_slot *np, u_char *ack_data,
+ u_char write_data, u_char *gpreg,
+ u_char *gpcntl)
{
int x;
@@ -11096,9 +11012,9 @@ static void nvram_write_byte(ncr_slot *np, u_char *ack_data, u_char write_data,
* READ a byte from the NVRAM and then send an ACK to say we have got it,
* GPIO0 must already be set as an input
*/
-__initfunc(
-static void nvram_read_byte(ncr_slot *np, u_char *read_data, u_char ack_data, u_char *gpreg, u_char *gpcntl)
-)
+static void __init nvram_read_byte(ncr_slot *np, u_char *read_data,
+ u_char ack_data, u_char *gpreg,
+ u_char *gpcntl)
{
int x;
u_char read_bit;
@@ -11116,9 +11032,8 @@ static void nvram_read_byte(ncr_slot *np, u_char *read_data, u_char ack_data, u_
* Output an ACK to the NVRAM after reading,
* change GPIO0 to output and when done back to an input
*/
-__initfunc(
-static void nvram_writeAck(ncr_slot *np, u_char write_bit, u_char *gpreg, u_char *gpcntl)
-)
+static void __init nvram_writeAck(ncr_slot *np, u_char write_bit,
+ u_char *gpreg, u_char *gpcntl)
{
OUTB (nc_gpcntl, *gpcntl & 0xfe);
nvram_doBit(np, 0, write_bit, gpreg);
@@ -11129,9 +11044,8 @@ static void nvram_writeAck(ncr_slot *np, u_char write_bit, u_char *gpreg, u_char
* Input an ACK from NVRAM after writing,
* change GPIO0 to input and when done back to an output
*/
-__initfunc(
-static void nvram_readAck(ncr_slot *np, u_char *read_bit, u_char *gpreg, u_char *gpcntl)
-)
+static void __init nvram_readAck(ncr_slot *np, u_char *read_bit,
+ u_char *gpreg, u_char *gpcntl)
{
OUTB (nc_gpcntl, *gpcntl | 0x01);
nvram_doBit(np, read_bit, 1, gpreg);
@@ -11142,9 +11056,8 @@ static void nvram_readAck(ncr_slot *np, u_char *read_bit, u_char *gpreg, u_char
* Read or write a bit to the NVRAM,
* read if GPIO0 input else write if GPIO0 output
*/
-__initfunc(
-static void nvram_doBit(ncr_slot *np, u_char *read_bit, u_char write_bit, u_char *gpreg)
-)
+static void __init nvram_doBit(ncr_slot *np, u_char *read_bit,
+ u_char write_bit, u_char *gpreg)
{
nvram_setBit(np, write_bit, gpreg, SET_BIT);
nvram_setBit(np, 0, gpreg, SET_CLK);
@@ -11157,9 +11070,7 @@ static void nvram_doBit(ncr_slot *np, u_char *read_bit, u_char write_bit, u_char
/*
* Send STOP condition to NVRAM - puts NVRAM to sleep... ZZzzzz!!
*/
-__initfunc(
-static void nvram_stop(ncr_slot *np, u_char *gpreg)
-)
+static void __init nvram_stop(ncr_slot *np, u_char *gpreg)
{
nvram_setBit(np, 0, gpreg, SET_CLK);
nvram_setBit(np, 1, gpreg, SET_BIT);
@@ -11168,9 +11079,8 @@ static void nvram_stop(ncr_slot *np, u_char *gpreg)
/*
* Set/clear data/clock bit in GPIO0
*/
-__initfunc(
-static void nvram_setBit(ncr_slot *np, u_char write_bit, u_char *gpreg, int bit_mode)
-)
+static void __init nvram_setBit(ncr_slot *np, u_char write_bit,
+ u_char *gpreg, int bit_mode)
{
UDELAY (5);
switch (bit_mode){
@@ -11221,9 +11131,7 @@ static void Tnvram_Write_Bit(ncr_slot *np, u_char write_bit, u_char *gpreg);
static void Tnvram_Stop(ncr_slot *np, u_char *gpreg);
static void Tnvram_Clk(ncr_slot *np, u_char *gpreg);
-__initfunc(
-static int ncr_get_Tekram_nvram (ncr_slot *np, Tekram_nvram *nvram)
-)
+static int __init ncr_get_Tekram_nvram (ncr_slot *np, Tekram_nvram *nvram)
{
u_char gpcntl, gpreg;
u_char old_gpcntl, old_gpreg;
@@ -11258,9 +11166,8 @@ static int ncr_get_Tekram_nvram (ncr_slot *np, Tekram_nvram *nvram)
/*
* Read Tekram NvRAM data and compute checksum.
*/
-__initfunc(
-static u_short Tnvram_read_data(ncr_slot *np, u_short *data, int len, u_char *gpreg)
-)
+static u_short __init Tnvram_read_data(ncr_slot *np, u_short *data, int len,
+ u_char *gpreg)
{
u_char read_bit;
u_short csum;
@@ -11285,9 +11192,8 @@ static u_short Tnvram_read_data(ncr_slot *np, u_short *data, int len, u_char *gp
/*
* Send read command and address to NVRAM
*/
-__initfunc(
-static void Tnvram_Send_Command(ncr_slot *np, u_short write_data, u_char *read_bit, u_char *gpreg)
-)
+static void __init Tnvram_Send_Command(ncr_slot *np, u_short write_data,
+ u_char *read_bit, u_char *gpreg)
{
int x;
@@ -11301,9 +11207,8 @@ static void Tnvram_Send_Command(ncr_slot *np, u_short write_data, u_char *read_b
/*
* READ a byte from the NVRAM
*/
-__initfunc(
-static void Tnvram_Read_Word(ncr_slot *np, u_short *nvram_data, u_char *gpreg)
-)
+static void __init Tnvram_Read_Word(ncr_slot *np, u_short *nvram_data,
+ u_char *gpreg)
{
int x;
u_char read_bit;
@@ -11322,9 +11227,8 @@ static void Tnvram_Read_Word(ncr_slot *np, u_short *nvram_data, u_char *gpreg)
/*
* Read bit from NVRAM
*/
-__initfunc(
-static void Tnvram_Read_Bit(ncr_slot *np, u_char *read_bit, u_char *gpreg)
-)
+static void __init Tnvram_Read_Bit(ncr_slot *np, u_char *read_bit,
+ u_char *gpreg)
{
UDELAY (2);
Tnvram_Clk(np, gpreg);
@@ -11334,9 +11238,8 @@ static void Tnvram_Read_Bit(ncr_slot *np, u_char *read_bit, u_char *gpreg)
/*
* Write bit to GPIO0
*/
-__initfunc(
-static void Tnvram_Write_Bit(ncr_slot *np, u_char write_bit, u_char *gpreg)
-)
+static void __init Tnvram_Write_Bit(ncr_slot *np, u_char write_bit,
+ u_char *gpreg)
{
if (write_bit & 0x01)
*gpreg |= 0x02;
@@ -11354,9 +11257,7 @@ static void Tnvram_Write_Bit(ncr_slot *np, u_char write_bit, u_char *gpreg)
/*
* Send STOP condition to NVRAM - puts NVRAM to sleep... ZZZzzz!!
*/
-__initfunc(
-static void Tnvram_Stop(ncr_slot *np, u_char *gpreg)
-)
+static void __init Tnvram_Stop(ncr_slot *np, u_char *gpreg)
{
*gpreg &= 0xef;
OUTB (nc_gpreg, *gpreg);
@@ -11368,9 +11269,7 @@ static void Tnvram_Stop(ncr_slot *np, u_char *gpreg)
/*
* Pulse clock bit in GPIO0
*/
-__initfunc(
-static void Tnvram_Clk(ncr_slot *np, u_char *gpreg)
-)
+static void __init Tnvram_Clk(ncr_slot *np, u_char *gpreg)
{
OUTB (nc_gpreg, *gpreg | 0x04);
UDELAY (2);