Commit 798e4437 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] avoid obsolete APIs in eata

Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 01d08aa9
...@@ -474,7 +474,7 @@ ...@@ -474,7 +474,7 @@
* The boards are named EATA0, EATA1,... according to the detection order. * The boards are named EATA0, EATA1,... according to the detection order.
* *
* In order to support multiple ISA boards in a reliable way, * In order to support multiple ISA boards in a reliable way,
* the driver sets host->wish_block = TRUE for all ISA boards. * the driver sets host->wish_block = 1 for all ISA boards.
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -482,9 +482,6 @@ ...@@ -482,9 +482,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/byteorder.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -493,22 +490,29 @@ ...@@ -493,22 +490,29 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <scsi/scsicam.h> #include <asm/byteorder.h>
#include "scsi.h"
#include <scsi/scsi_host.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
static int eata2x_detect(Scsi_Host_Template *); #include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsicam.h>
static int eata2x_detect(struct scsi_host_template *);
static int eata2x_release(struct Scsi_Host *); static int eata2x_release(struct Scsi_Host *);
static int eata2x_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); static int eata2x_queuecommand(struct scsi_cmnd *,
static int eata2x_eh_abort(Scsi_Cmnd *); void (*done)(struct scsi_cmnd *));
static int eata2x_eh_host_reset(Scsi_Cmnd *); static int eata2x_eh_abort(struct scsi_cmnd *);
static int eata2x_eh_host_reset(struct scsi_cmnd *);
static int eata2x_bios_param(struct scsi_device *, struct block_device *, static int eata2x_bios_param(struct scsi_device *, struct block_device *,
sector_t, int *); sector_t, int *);
static int eata2x_slave_configure(Scsi_Device *); static int eata2x_slave_configure(struct scsi_device *);
static Scsi_Host_Template driver_template = { static struct scsi_host_template driver_template = {
.name = "EATA/DMA 2.0x rev. 8.10.00 ", .name = "EATA/DMA 2.0x rev. 8.10.00 ",
.detect = eata2x_detect, .detect = eata2x_detect,
.release = eata2x_release, .release = eata2x_release,
...@@ -558,8 +562,6 @@ static Scsi_Host_Template driver_template = { ...@@ -558,8 +562,6 @@ static Scsi_Host_Template driver_template = {
#define MAX_TAGGED_CMD_PER_LUN (MAX_MAILBOXES - MAX_CMD_PER_LUN) #define MAX_TAGGED_CMD_PER_LUN (MAX_MAILBOXES - MAX_CMD_PER_LUN)
#define SKIP ULONG_MAX #define SKIP ULONG_MAX
#define FALSE 0
#define TRUE 1
#define FREE 0 #define FREE 0
#define IN_USE 1 #define IN_USE 1
#define LOCKED 2 #define LOCKED 2
...@@ -766,7 +768,7 @@ struct mscp { ...@@ -766,7 +768,7 @@ struct mscp {
u_int32_t sense_addr; /* Address where Sense Data is DMA'ed on error */ u_int32_t sense_addr; /* Address where Sense Data is DMA'ed on error */
/* Additional fields begin here. */ /* Additional fields begin here. */
Scsi_Cmnd *SCpnt; struct scsi_cmnd *SCpnt;
/* All the cp structure is zero filled by queuecommand except the /* All the cp structure is zero filled by queuecommand except the
following CP_TAIL_SIZE bytes, initialized by detect */ following CP_TAIL_SIZE bytes, initialized by detect */
...@@ -785,12 +787,12 @@ struct hostdata { ...@@ -785,12 +787,12 @@ struct hostdata {
char board_name[16]; /* Name of this board */ char board_name[16]; /* Name of this board */
int in_reset; /* True if board is doing a reset */ int in_reset; /* True if board is doing a reset */
int target_to[MAX_TARGET][MAX_CHANNEL]; /* N. of timeout errors on target */ int target_to[MAX_TARGET][MAX_CHANNEL]; /* N. of timeout errors on target */
int target_redo[MAX_TARGET][MAX_CHANNEL]; /* If TRUE redo i/o on target */ int target_redo[MAX_TARGET][MAX_CHANNEL]; /* If 1 redo i/o on target */
unsigned int retries; /* Number of internal retries */ unsigned int retries; /* Number of internal retries */
unsigned long last_retried_pid; /* Pid of last retried command */ unsigned long last_retried_pid; /* Pid of last retried command */
unsigned char subversion; /* Bus type, either ISA or EISA/PCI */ unsigned char subversion; /* Bus type, either ISA or EISA/PCI */
unsigned char protocol_rev; /* EATA 2.0 rev., 'A' or 'B' or 'C' */ unsigned char protocol_rev; /* EATA 2.0 rev., 'A' or 'B' or 'C' */
unsigned char is_pci; /* TRUE is bus type is PCI */ unsigned char is_pci; /* 1 is bus type is PCI */
struct pci_dev *pdev; /* pdev for PCI bus, NULL otherwise */ struct pci_dev *pdev; /* pdev for PCI bus, NULL otherwise */
struct mssp *sp_cpu_addr; /* cpu addr for DMA buffer sp */ struct mssp *sp_cpu_addr; /* cpu addr for DMA buffer sp */
dma_addr_t sp_dma_addr; /* dma handle for DMA buffer sp */ dma_addr_t sp_dma_addr; /* dma handle for DMA buffer sp */
...@@ -842,12 +844,12 @@ static unsigned long io_port[] = { ...@@ -842,12 +844,12 @@ static unsigned long io_port[] = {
#define REG2H(x) le16_to_cpu(x) #define REG2H(x) le16_to_cpu(x)
static irqreturn_t do_interrupt_handler(int, void *, struct pt_regs *); static irqreturn_t do_interrupt_handler(int, void *, struct pt_regs *);
static void flush_dev(Scsi_Device *, unsigned long, unsigned int, unsigned int); static void flush_dev(struct scsi_device *, unsigned long, unsigned int, unsigned int);
static int do_trace = FALSE; static int do_trace = 0;
static int setup_done = FALSE; static int setup_done = 0;
static int link_statistics; static int link_statistics;
static int ext_tran = FALSE; static int ext_tran = 0;
static int rev_scan = TRUE; static int rev_scan = 1;
#if defined(CONFIG_SCSI_EATA_TAGGED_QUEUE) #if defined(CONFIG_SCSI_EATA_TAGGED_QUEUE)
static int tag_mode = TAG_SIMPLE; static int tag_mode = TAG_SIMPLE;
...@@ -856,9 +858,9 @@ static int tag_mode = TAG_DISABLED; ...@@ -856,9 +858,9 @@ static int tag_mode = TAG_DISABLED;
#endif #endif
#if defined(CONFIG_SCSI_EATA_LINKED_COMMANDS) #if defined(CONFIG_SCSI_EATA_LINKED_COMMANDS)
static int linked_comm = TRUE; static int linked_comm = 1;
#else #else
static int linked_comm = FALSE; static int linked_comm = 0;
#endif #endif
#if defined(CONFIG_SCSI_EATA_MAX_TAGS) #if defined(CONFIG_SCSI_EATA_MAX_TAGS)
...@@ -868,21 +870,21 @@ static int max_queue_depth = MAX_CMD_PER_LUN; ...@@ -868,21 +870,21 @@ static int max_queue_depth = MAX_CMD_PER_LUN;
#endif #endif
#if defined(CONFIG_ISA) #if defined(CONFIG_ISA)
static int isa_probe = TRUE; static int isa_probe = 1;
#else #else
static int isa_probe = FALSE; static int isa_probe = 0;
#endif #endif
#if defined(CONFIG_EISA) #if defined(CONFIG_EISA)
static int eisa_probe = TRUE; static int eisa_probe = 1;
#else #else
static int eisa_probe = FALSE; static int eisa_probe = 0;
#endif #endif
#if defined(CONFIG_PCI) #if defined(CONFIG_PCI)
static int pci_probe = TRUE; static int pci_probe = 1;
#else #else
static int pci_probe = FALSE; static int pci_probe = 0;
#endif #endif
#define MAX_INT_PARAM 10 #define MAX_INT_PARAM 10
...@@ -902,7 +904,7 @@ MODULE_DESCRIPTION("EATA/DMA SCSI Driver"); ...@@ -902,7 +904,7 @@ MODULE_DESCRIPTION("EATA/DMA SCSI Driver");
#endif #endif
static int eata2x_slave_configure(Scsi_Device *dev) { static int eata2x_slave_configure(struct scsi_device *dev) {
int j, tqd, utqd; int j, tqd, utqd;
char *tag_suffix, *link_suffix; char *tag_suffix, *link_suffix;
struct Scsi_Host *host = dev->host; struct Scsi_Host *host = dev->host;
...@@ -948,24 +950,24 @@ static int eata2x_slave_configure(Scsi_Device *dev) { ...@@ -948,24 +950,24 @@ static int eata2x_slave_configure(Scsi_Device *dev) {
BN(j), host->host_no, dev->channel, dev->id, dev->lun, BN(j), host->host_no, dev->channel, dev->id, dev->lun,
dev->queue_depth, link_suffix, tag_suffix); dev->queue_depth, link_suffix, tag_suffix);
return FALSE; return 0;
} }
static int wait_on_busy(unsigned long iobase, unsigned int loop) { static int wait_on_busy(unsigned long iobase, unsigned int loop) {
while (inb(iobase + REG_AUX_STATUS) & ABSY_ASSERTED) { while (inb(iobase + REG_AUX_STATUS) & ABSY_ASSERTED) {
udelay(1L); udelay(1L);
if (--loop == 0) return TRUE; if (--loop == 0) return 1;
} }
return FALSE; return 0;
} }
static int do_dma(unsigned long iobase, unsigned long addr, unchar cmd) { static int do_dma(unsigned long iobase, unsigned long addr, unchar cmd) {
unsigned char *byaddr; unsigned char *byaddr;
unsigned long devaddr; unsigned long devaddr;
if (wait_on_busy(iobase, (addr ? MAXLOOP * 100 : MAXLOOP))) return TRUE; if (wait_on_busy(iobase, (addr ? MAXLOOP * 100 : MAXLOOP))) return 1;
if (addr) { if (addr) {
devaddr = H2DEV(addr); devaddr = H2DEV(addr);
...@@ -977,7 +979,7 @@ static int do_dma(unsigned long iobase, unsigned long addr, unchar cmd) { ...@@ -977,7 +979,7 @@ static int do_dma(unsigned long iobase, unsigned long addr, unchar cmd) {
} }
outb(cmd, iobase + REG_CMD); outb(cmd, iobase + REG_CMD);
return FALSE; return 0;
} }
static int read_pio(unsigned long iobase, ushort *start, ushort *end) { static int read_pio(unsigned long iobase, ushort *start, ushort *end) {
...@@ -988,14 +990,14 @@ static int read_pio(unsigned long iobase, ushort *start, ushort *end) { ...@@ -988,14 +990,14 @@ static int read_pio(unsigned long iobase, ushort *start, ushort *end) {
while (!(inb(iobase + REG_STATUS) & DRQ_ASSERTED)) { while (!(inb(iobase + REG_STATUS) & DRQ_ASSERTED)) {
udelay(1L); udelay(1L);
if (--loop == 0) return TRUE; if (--loop == 0) return 1;
} }
loop = MAXLOOP; loop = MAXLOOP;
*p = REG2H(inw(iobase)); *p = REG2H(inw(iobase));
} }
return FALSE; return 0;
} }
static struct pci_dev *get_pci_dev(unsigned long port_base) { static struct pci_dev *get_pci_dev(unsigned long port_base) {
...@@ -1043,8 +1045,8 @@ static void enable_pci_ports(void) { ...@@ -1043,8 +1045,8 @@ static void enable_pci_ports(void) {
} }
static int port_detect \ static int port_detect \
(unsigned long port_base, unsigned int j, Scsi_Host_Template *tpnt) { (unsigned long port_base, unsigned int j, struct scsi_host_template *tpnt) {
unsigned char irq, dma_channel, subversion, i, is_pci = FALSE; unsigned char irq, dma_channel, subversion, i, is_pci = 0;
unsigned char protocol_rev; unsigned char protocol_rev;
struct eata_info info; struct eata_info info;
char *bus_type, dma_name[16]; char *bus_type, dma_name[16];
...@@ -1112,12 +1114,12 @@ static int port_detect \ ...@@ -1112,12 +1114,12 @@ static int port_detect \
if (protocol_rev != 'A' && info.forcaddr) { if (protocol_rev != 'A' && info.forcaddr) {
printk("%s: warning, port address has been forced.\n", name); printk("%s: warning, port address has been forced.\n", name);
bus_type = "PCI"; bus_type = "PCI";
is_pci = TRUE; is_pci = 1;
subversion = ESA; subversion = ESA;
} }
else if (port_base > MAX_EISA_ADDR || (protocol_rev == 'C' && info.pci)) { else if (port_base > MAX_EISA_ADDR || (protocol_rev == 'C' && info.pci)) {
bus_type = "PCI"; bus_type = "PCI";
is_pci = TRUE; is_pci = 1;
subversion = ESA; subversion = ESA;
} }
else if (port_base >= MIN_EISA_ADDR || (protocol_rev == 'C' && info.eisa)) { else if (port_base >= MIN_EISA_ADDR || (protocol_rev == 'C' && info.eisa)) {
...@@ -1130,7 +1132,7 @@ static int port_detect \ ...@@ -1130,7 +1132,7 @@ static int port_detect \
} }
else if (port_base > MAX_ISA_ADDR) { else if (port_base > MAX_ISA_ADDR) {
bus_type = "PCI"; bus_type = "PCI";
is_pci = TRUE; is_pci = 1;
subversion = ESA; subversion = ESA;
} }
else { else {
...@@ -1212,7 +1214,7 @@ static int port_detect \ ...@@ -1212,7 +1214,7 @@ static int port_detect \
/* Set board configuration */ /* Set board configuration */
memset((char *)cf, 0, sizeof(struct eata_config)); memset((char *)cf, 0, sizeof(struct eata_config));
cf->len = (ushort) H2DEV16((ushort)510); cf->len = (ushort) H2DEV16((ushort)510);
cf->ocena = TRUE; cf->ocena = 1;
if (do_dma(port_base, cf_dma_addr, SET_CONFIG_DMA)) { if (do_dma(port_base, cf_dma_addr, SET_CONFIG_DMA)) {
printk("%s: busy timeout sending configuration, detaching.\n", name); printk("%s: busy timeout sending configuration, detaching.\n", name);
...@@ -1249,10 +1251,10 @@ static int port_detect \ ...@@ -1249,10 +1251,10 @@ static int port_detect \
HD(j)->board_number = j; HD(j)->board_number = j;
if (HD(j)->subversion == ESA) if (HD(j)->subversion == ESA)
sh[j]->unchecked_isa_dma = FALSE; sh[j]->unchecked_isa_dma = 0;
else { else {
unsigned long flags; unsigned long flags;
sh[j]->unchecked_isa_dma = TRUE; sh[j]->unchecked_isa_dma = 1;
flags=claim_dma_lock(); flags=claim_dma_lock();
disable_dma(dma_channel); disable_dma(dma_channel);
...@@ -1373,7 +1375,7 @@ static int port_detect \ ...@@ -1373,7 +1375,7 @@ static int port_detect \
printk("%s: warning, pci_set_dma_mask failed.\n", BN(j)); printk("%s: warning, pci_set_dma_mask failed.\n", BN(j));
} }
return TRUE; return 1;
freedma: freedma:
if (subversion == ISA) free_dma(dma_channel); if (subversion == ISA) free_dma(dma_channel);
...@@ -1383,11 +1385,11 @@ static int port_detect \ ...@@ -1383,11 +1385,11 @@ static int port_detect \
spin_unlock_irq(&driver_lock); spin_unlock_irq(&driver_lock);
release_region(port_base, REGION_SIZE); release_region(port_base, REGION_SIZE);
fail: fail:
return FALSE; return 0;
release: release:
eata2x_release(sh[j]); eata2x_release(sh[j]);
return FALSE; return 0;
} }
static void internal_setup(char *str, int *ints) { static void internal_setup(char *str, int *ints) {
...@@ -1401,14 +1403,14 @@ static void internal_setup(char *str, int *ints) { ...@@ -1401,14 +1403,14 @@ static void internal_setup(char *str, int *ints) {
for (i = 0; i < argc; i++) io_port[i] = ints[i + 1]; for (i = 0; i < argc; i++) io_port[i] = ints[i + 1];
io_port[i] = 0; io_port[i] = 0;
setup_done = TRUE; setup_done = 1;
} }
while (cur && (pc = strchr(cur, ':'))) { while (cur && (pc = strchr(cur, ':'))) {
int val = 0, c = *++pc; int val = 0, c = *++pc;
if (c == 'n' || c == 'N') val = FALSE; if (c == 'n' || c == 'N') val = 0;
else if (c == 'y' || c == 'Y') val = TRUE; else if (c == 'y' || c == 'Y') val = 1;
else val = (int) simple_strtoul(pc, NULL, 0); else val = (int) simple_strtoul(pc, NULL, 0);
if (!strncmp(cur, "lc:", 3)) linked_comm = val; if (!strncmp(cur, "lc:", 3)) linked_comm = val;
...@@ -1483,7 +1485,7 @@ static void add_pci_ports(void) { ...@@ -1483,7 +1485,7 @@ static void add_pci_ports(void) {
return; return;
} }
static int eata2x_detect(Scsi_Host_Template *tpnt) { static int eata2x_detect(struct scsi_host_template *tpnt) {
unsigned int j = 0, k; unsigned int j = 0, k;
tpnt->proc_name = "eata2x"; tpnt->proc_name = "eata2x";
...@@ -1493,7 +1495,7 @@ static int eata2x_detect(Scsi_Host_Template *tpnt) { ...@@ -1493,7 +1495,7 @@ static int eata2x_detect(Scsi_Host_Template *tpnt) {
#if defined(MODULE) #if defined(MODULE)
/* io_port could have been modified when loading as a module */ /* io_port could have been modified when loading as a module */
if(io_port[0] != SKIP) { if(io_port[0] != SKIP) {
setup_done = TRUE; setup_done = 1;
io_port[MAX_INT_PARAM] = 0; io_port[MAX_INT_PARAM] = 0;
} }
#endif #endif
...@@ -1529,10 +1531,10 @@ static void map_dma(unsigned int i, unsigned int j) { ...@@ -1529,10 +1531,10 @@ static void map_dma(unsigned int i, unsigned int j) {
unsigned int k, count, pci_dir; unsigned int k, count, pci_dir;
struct scatterlist *sgpnt; struct scatterlist *sgpnt;
struct mscp *cpp; struct mscp *cpp;
Scsi_Cmnd *SCpnt; struct scsi_cmnd *SCpnt;
cpp = &HD(j)->cp[i]; SCpnt = cpp->SCpnt; cpp = &HD(j)->cp[i]; SCpnt = cpp->SCpnt;
pci_dir = scsi_to_pci_dma_dir(SCpnt->sc_data_direction); pci_dir = SCpnt->sc_data_direction;
if (SCpnt->sense_buffer) if (SCpnt->sense_buffer)
cpp->sense_addr = H2DEV(pci_map_single(HD(j)->pdev, SCpnt->sense_buffer, cpp->sense_addr = H2DEV(pci_map_single(HD(j)->pdev, SCpnt->sense_buffer,
...@@ -1561,7 +1563,7 @@ static void map_dma(unsigned int i, unsigned int j) { ...@@ -1561,7 +1563,7 @@ static void map_dma(unsigned int i, unsigned int j) {
cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(&sgpnt[k])); cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(&sgpnt[k]));
} }
cpp->sg = TRUE; cpp->sg = 1;
cpp->data_address = H2DEV(pci_map_single(HD(j)->pdev, cpp->sglist, cpp->data_address = H2DEV(pci_map_single(HD(j)->pdev, cpp->sglist,
SCpnt->use_sg * sizeof(struct sg_list), pci_dir)); SCpnt->use_sg * sizeof(struct sg_list), pci_dir));
cpp->data_len = H2DEV((SCpnt->use_sg * sizeof(struct sg_list))); cpp->data_len = H2DEV((SCpnt->use_sg * sizeof(struct sg_list)));
...@@ -1570,10 +1572,10 @@ static void map_dma(unsigned int i, unsigned int j) { ...@@ -1570,10 +1572,10 @@ static void map_dma(unsigned int i, unsigned int j) {
static void unmap_dma(unsigned int i, unsigned int j) { static void unmap_dma(unsigned int i, unsigned int j) {
unsigned int pci_dir; unsigned int pci_dir;
struct mscp *cpp; struct mscp *cpp;
Scsi_Cmnd *SCpnt; struct scsi_cmnd *SCpnt;
cpp = &HD(j)->cp[i]; SCpnt = cpp->SCpnt; cpp = &HD(j)->cp[i]; SCpnt = cpp->SCpnt;
pci_dir = scsi_to_pci_dma_dir(SCpnt->sc_data_direction); pci_dir = SCpnt->sc_data_direction;
if (DEV2H(cpp->sense_addr)) if (DEV2H(cpp->sense_addr))
pci_unmap_single(HD(j)->pdev, DEV2H(cpp->sense_addr), pci_unmap_single(HD(j)->pdev, DEV2H(cpp->sense_addr),
...@@ -1592,10 +1594,10 @@ static void unmap_dma(unsigned int i, unsigned int j) { ...@@ -1592,10 +1594,10 @@ static void unmap_dma(unsigned int i, unsigned int j) {
static void sync_dma(unsigned int i, unsigned int j) { static void sync_dma(unsigned int i, unsigned int j) {
unsigned int pci_dir; unsigned int pci_dir;
struct mscp *cpp; struct mscp *cpp;
Scsi_Cmnd *SCpnt; struct scsi_cmnd *SCpnt;
cpp = &HD(j)->cp[i]; SCpnt = cpp->SCpnt; cpp = &HD(j)->cp[i]; SCpnt = cpp->SCpnt;
pci_dir = scsi_to_pci_dma_dir(SCpnt->sc_data_direction); pci_dir = SCpnt->sc_data_direction;
if (DEV2H(cpp->sense_addr)) if (DEV2H(cpp->sense_addr))
pci_dma_sync_single_for_cpu(HD(j)->pdev, DEV2H(cpp->sense_addr), pci_dma_sync_single_for_cpu(HD(j)->pdev, DEV2H(cpp->sense_addr),
...@@ -1628,45 +1630,45 @@ static void scsi_to_dev_dir(unsigned int i, unsigned int j) { ...@@ -1628,45 +1630,45 @@ static void scsi_to_dev_dir(unsigned int i, unsigned int j) {
}; };
struct mscp *cpp; struct mscp *cpp;
Scsi_Cmnd *SCpnt; struct scsi_cmnd *SCpnt;
cpp = &HD(j)->cp[i]; SCpnt = cpp->SCpnt; cpp = &HD(j)->cp[i]; SCpnt = cpp->SCpnt;
if (SCpnt->sc_data_direction == SCSI_DATA_READ) { if (SCpnt->sc_data_direction == DMA_FROM_DEVICE) {
cpp->din = TRUE; cpp->din = 1;
cpp->dout = FALSE; cpp->dout = 0;
return; return;
} }
else if (SCpnt->sc_data_direction == SCSI_DATA_WRITE) { else if (SCpnt->sc_data_direction == DMA_TO_DEVICE) {
cpp->din = FALSE; cpp->din = 0;
cpp->dout = TRUE; cpp->dout = 1;
return; return;
} }
else if (SCpnt->sc_data_direction == SCSI_DATA_NONE) { else if (SCpnt->sc_data_direction == DMA_NONE) {
cpp->din = FALSE; cpp->din = 0;
cpp->dout = FALSE; cpp->dout = 0;
return; return;
} }
if (SCpnt->sc_data_direction != SCSI_DATA_UNKNOWN) if (SCpnt->sc_data_direction != DMA_BIDIRECTIONAL)
panic("%s: qcomm, invalid SCpnt->sc_data_direction.\n", BN(j)); panic("%s: qcomm, invalid SCpnt->sc_data_direction.\n", BN(j));
for (k = 0; k < ARRAY_SIZE(data_out_cmds); k++) for (k = 0; k < ARRAY_SIZE(data_out_cmds); k++)
if (SCpnt->cmnd[0] == data_out_cmds[k]) { if (SCpnt->cmnd[0] == data_out_cmds[k]) {
cpp->dout = TRUE; cpp->dout = 1;
break; break;
} }
if ((cpp->din = !cpp->dout)) if ((cpp->din = !cpp->dout))
for (k = 0; k < ARRAY_SIZE(data_none_cmds); k++) for (k = 0; k < ARRAY_SIZE(data_none_cmds); k++)
if (SCpnt->cmnd[0] == data_none_cmds[k]) { if (SCpnt->cmnd[0] == data_none_cmds[k]) {
cpp->din = FALSE; cpp->din = 0;
break; break;
} }
} }
static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) { static int eata2x_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) {
unsigned int i, j, k; unsigned int i, j, k;
struct mscp *cpp; struct mscp *cpp;
...@@ -1712,12 +1714,12 @@ static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) { ...@@ -1712,12 +1714,12 @@ static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
BN(j), i, SCpnt->device->channel, SCpnt->device->id, BN(j), i, SCpnt->device->channel, SCpnt->device->id,
SCpnt->device->lun, SCpnt->pid); SCpnt->device->lun, SCpnt->pid);
cpp->reqsen = TRUE; cpp->reqsen = 1;
cpp->dispri = TRUE; cpp->dispri = 1;
#if 0 #if 0
if (SCpnt->device->type == TYPE_TAPE) cpp->hbaci = TRUE; if (SCpnt->device->type == TYPE_TAPE) cpp->hbaci = 1;
#endif #endif
cpp->one = TRUE; cpp->one = 1;
cpp->channel = SCpnt->device->channel; cpp->channel = SCpnt->device->channel;
cpp->target = SCpnt->device->id; cpp->target = SCpnt->device->id;
cpp->lun = SCpnt->device->lun; cpp->lun = SCpnt->device->lun;
...@@ -1733,7 +1735,7 @@ static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) { ...@@ -1733,7 +1735,7 @@ static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
if (linked_comm && SCpnt->device->queue_depth > 2 if (linked_comm && SCpnt->device->queue_depth > 2
&& TLDEV(SCpnt->device->type)) { && TLDEV(SCpnt->device->type)) {
HD(j)->cp_stat[i] = READY; HD(j)->cp_stat[i] = READY;
flush_dev(SCpnt->device, SCpnt->request->sector, j, FALSE); flush_dev(SCpnt->device, SCpnt->request->sector, j, 0);
return 0; return 0;
} }
...@@ -1750,7 +1752,7 @@ static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) { ...@@ -1750,7 +1752,7 @@ static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
return 0; return 0;
} }
static int eata2x_eh_abort(Scsi_Cmnd *SCarg) { static int eata2x_eh_abort(struct scsi_cmnd *SCarg) {
unsigned int i, j; unsigned int i, j;
j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number; j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number;
...@@ -1824,10 +1826,10 @@ static int eata2x_eh_abort(Scsi_Cmnd *SCarg) { ...@@ -1824,10 +1826,10 @@ static int eata2x_eh_abort(Scsi_Cmnd *SCarg) {
panic("%s: abort, mbox %d, invalid cp_stat.\n", BN(j), i); panic("%s: abort, mbox %d, invalid cp_stat.\n", BN(j), i);
} }
static int eata2x_eh_host_reset(Scsi_Cmnd *SCarg) { static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg) {
unsigned int i, j, time, k, c, limit = 0; unsigned int i, j, time, k, c, limit = 0;
int arg_done = FALSE; int arg_done = 0;
Scsi_Cmnd *SCpnt; struct scsi_cmnd *SCpnt;
j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number; j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number;
printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n", printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n",
...@@ -1850,7 +1852,7 @@ static int eata2x_eh_host_reset(Scsi_Cmnd *SCarg) { ...@@ -1850,7 +1852,7 @@ static int eata2x_eh_host_reset(Scsi_Cmnd *SCarg) {
for (c = 0; c <= sh[j]->max_channel; c++) for (c = 0; c <= sh[j]->max_channel; c++)
for (k = 0; k < sh[j]->max_id; k++) { for (k = 0; k < sh[j]->max_id; k++) {
HD(j)->target_redo[k][c] = TRUE; HD(j)->target_redo[k][c] = 1;
HD(j)->target_to[k][c] = 0; HD(j)->target_to[k][c] = 0;
} }
...@@ -1888,7 +1890,7 @@ static int eata2x_eh_host_reset(Scsi_Cmnd *SCarg) { ...@@ -1888,7 +1890,7 @@ static int eata2x_eh_host_reset(Scsi_Cmnd *SCarg) {
if (SCpnt->scsi_done == NULL) if (SCpnt->scsi_done == NULL)
panic("%s: reset, mbox %d, SCpnt->scsi_done == NULL.\n", BN(j), i); panic("%s: reset, mbox %d, SCpnt->scsi_done == NULL.\n", BN(j), i);
if (SCpnt == SCarg) arg_done = TRUE; if (SCpnt == SCarg) arg_done = 1;
} }
if (do_dma(sh[j]->io_port, 0, RESET_PIO)) { if (do_dma(sh[j]->io_port, 0, RESET_PIO)) {
...@@ -1899,10 +1901,10 @@ static int eata2x_eh_host_reset(Scsi_Cmnd *SCarg) { ...@@ -1899,10 +1901,10 @@ static int eata2x_eh_host_reset(Scsi_Cmnd *SCarg) {
printk("%s: reset, board reset done, enabling interrupts.\n", BN(j)); printk("%s: reset, board reset done, enabling interrupts.\n", BN(j));
#if defined(DEBUG_RESET) #if defined(DEBUG_RESET)
do_trace = TRUE; do_trace = 1;
#endif #endif
HD(j)->in_reset = TRUE; HD(j)->in_reset = 1;
spin_unlock_irq(sh[j]->host_lock); spin_unlock_irq(sh[j]->host_lock);
time = jiffies; time = jiffies;
...@@ -1947,8 +1949,8 @@ static int eata2x_eh_host_reset(Scsi_Cmnd *SCarg) { ...@@ -1947,8 +1949,8 @@ static int eata2x_eh_host_reset(Scsi_Cmnd *SCarg) {
SCpnt->scsi_done(SCpnt); SCpnt->scsi_done(SCpnt);
} }
HD(j)->in_reset = FALSE; HD(j)->in_reset = 0;
do_trace = FALSE; do_trace = 0;
if (arg_done) printk("%s: reset, exit, pid %ld done.\n", BN(j), SCarg->pid); if (arg_done) printk("%s: reset, exit, pid %ld done.\n", BN(j), SCarg->pid);
else printk("%s: reset, exit.\n", BN(j)); else printk("%s: reset, exit.\n", BN(j));
...@@ -1971,7 +1973,7 @@ int eata2x_bios_param(struct scsi_device *sdev, struct block_device *bdev, ...@@ -1971,7 +1973,7 @@ int eata2x_bios_param(struct scsi_device *sdev, struct block_device *bdev,
dkinfo[0], dkinfo[1], dkinfo[2]); dkinfo[0], dkinfo[1], dkinfo[2]);
#endif #endif
return FALSE; return 0;
} }
static void sort(unsigned long sk[], unsigned int da[], unsigned int n, static void sort(unsigned long sk[], unsigned int da[], unsigned int n,
...@@ -2001,11 +2003,11 @@ static void sort(unsigned long sk[], unsigned int da[], unsigned int n, ...@@ -2001,11 +2003,11 @@ static void sort(unsigned long sk[], unsigned int da[], unsigned int n,
static int reorder(unsigned int j, unsigned long cursec, static int reorder(unsigned int j, unsigned long cursec,
unsigned int ihdlr, unsigned int il[], unsigned int n_ready) { unsigned int ihdlr, unsigned int il[], unsigned int n_ready) {
Scsi_Cmnd *SCpnt; struct scsi_cmnd *SCpnt;
struct mscp *cpp; struct mscp *cpp;
unsigned int k, n; unsigned int k, n;
unsigned int rev = FALSE, s = TRUE, r = TRUE; unsigned int rev = 0, s = 1, r = 1;
unsigned int input_only = TRUE, overlap = FALSE; unsigned int input_only = 1, overlap = 0;
unsigned long sl[n_ready], pl[n_ready], ll[n_ready]; unsigned long sl[n_ready], pl[n_ready], ll[n_ready];
unsigned long maxsec = 0, minsec = ULONG_MAX, seek = 0, iseek = 0; unsigned long maxsec = 0, minsec = ULONG_MAX, seek = 0, iseek = 0;
unsigned long ioseek = 0; unsigned long ioseek = 0;
...@@ -2022,12 +2024,12 @@ static int reorder(unsigned int j, unsigned long cursec, ...@@ -2022,12 +2024,12 @@ static int reorder(unsigned int j, unsigned long cursec,
seeknosort / (readycount + 1), seeknosort / (readycount + 1),
seeksorted / (readycount + 1)); seeksorted / (readycount + 1));
if (n_ready <= 1) return FALSE; if (n_ready <= 1) return 0;
for (n = 0; n < n_ready; n++) { for (n = 0; n < n_ready; n++) {
k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt; k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
if (!cpp->din) input_only = FALSE; if (!cpp->din) input_only = 0;
if (SCpnt->request->sector < minsec) minsec = SCpnt->request->sector; if (SCpnt->request->sector < minsec) minsec = SCpnt->request->sector;
if (SCpnt->request->sector > maxsec) maxsec = SCpnt->request->sector; if (SCpnt->request->sector > maxsec) maxsec = SCpnt->request->sector;
...@@ -2037,8 +2039,8 @@ static int reorder(unsigned int j, unsigned long cursec, ...@@ -2037,8 +2039,8 @@ static int reorder(unsigned int j, unsigned long cursec,
if (!n) continue; if (!n) continue;
if (sl[n] < sl[n - 1]) s = FALSE; if (sl[n] < sl[n - 1]) s = 0;
if (sl[n] > sl[n - 1]) r = FALSE; if (sl[n] > sl[n - 1]) r = 0;
if (link_statistics) { if (link_statistics) {
if (sl[n] > sl[n - 1]) if (sl[n] > sl[n - 1])
...@@ -2053,9 +2055,9 @@ static int reorder(unsigned int j, unsigned long cursec, ...@@ -2053,9 +2055,9 @@ static int reorder(unsigned int j, unsigned long cursec,
if (cursec > sl[0]) seek += cursec - sl[0]; else seek += sl[0] - cursec; if (cursec > sl[0]) seek += cursec - sl[0]; else seek += sl[0] - cursec;
} }
if (cursec > ((maxsec + minsec) / 2)) rev = TRUE; if (cursec > ((maxsec + minsec) / 2)) rev = 1;
if (ioseek > ((maxsec - minsec) / 2)) rev = FALSE; if (ioseek > ((maxsec - minsec) / 2)) rev = 0;
if (!((rev && r) || (!rev && s))) sort(sl, il, n_ready, rev); if (!((rev && r) || (!rev && s))) sort(sl, il, n_ready, rev);
...@@ -2066,10 +2068,10 @@ static int reorder(unsigned int j, unsigned long cursec, ...@@ -2066,10 +2068,10 @@ static int reorder(unsigned int j, unsigned long cursec,
if (!n) continue; if (!n) continue;
if ((sl[n] == sl[n - 1]) || (!rev && ((sl[n - 1] + ll[n - 1]) > sl[n])) if ((sl[n] == sl[n - 1]) || (!rev && ((sl[n - 1] + ll[n - 1]) > sl[n]))
|| (rev && ((sl[n] + ll[n]) > sl[n - 1]))) overlap = TRUE; || (rev && ((sl[n] + ll[n]) > sl[n - 1]))) overlap = 1;
} }
if (overlap) sort(pl, il, n_ready, FALSE); if (overlap) sort(pl, il, n_ready, 0);
if (link_statistics) { if (link_statistics) {
if (cursec > sl[0]) iseek = cursec - sl[0]; else iseek = sl[0] - cursec; if (cursec > sl[0]) iseek = cursec - sl[0]; else iseek = sl[0] - cursec;
...@@ -2097,9 +2099,9 @@ static int reorder(unsigned int j, unsigned long cursec, ...@@ -2097,9 +2099,9 @@ static int reorder(unsigned int j, unsigned long cursec,
return overlap; return overlap;
} }
static void flush_dev(Scsi_Device *dev, unsigned long cursec, unsigned int j, static void flush_dev(struct scsi_device *dev, unsigned long cursec, unsigned int j,
unsigned int ihdlr) { unsigned int ihdlr) {
Scsi_Cmnd *SCpnt; struct scsi_cmnd *SCpnt;
struct mscp *cpp; struct mscp *cpp;
unsigned int k, n, n_ready = 0, il[MAX_MAILBOXES]; unsigned int k, n, n_ready = 0, il[MAX_MAILBOXES];
...@@ -2135,7 +2137,7 @@ static void flush_dev(Scsi_Device *dev, unsigned long cursec, unsigned int j, ...@@ -2135,7 +2137,7 @@ static void flush_dev(Scsi_Device *dev, unsigned long cursec, unsigned int j,
} }
static irqreturn_t ihdlr(int irq, unsigned int j) { static irqreturn_t ihdlr(int irq, unsigned int j) {
Scsi_Cmnd *SCpnt; struct scsi_cmnd *SCpnt;
unsigned int i, k, c, status, tstatus, reg; unsigned int i, k, c, status, tstatus, reg;
struct mssp *spp; struct mssp *spp;
struct mscp *cpp; struct mscp *cpp;
...@@ -2184,13 +2186,13 @@ static irqreturn_t ihdlr(int irq, unsigned int j) { ...@@ -2184,13 +2186,13 @@ static irqreturn_t ihdlr(int irq, unsigned int j) {
#endif #endif
/* Reject any sp with supspect data */ /* Reject any sp with supspect data */
if (spp->eoc == FALSE && HD(j)->iocount > 1) if (spp->eoc == 0 && HD(j)->iocount > 1)
printk("%s: ihdlr, spp->eoc == FALSE, irq %d, reg 0x%x, count %d.\n", printk("%s: ihdlr, spp->eoc == 0, irq %d, reg 0x%x, count %d.\n",
BN(j), irq, reg, HD(j)->iocount); BN(j), irq, reg, HD(j)->iocount);
if (spp->cpp_index < 0 || spp->cpp_index >= sh[j]->can_queue) if (spp->cpp_index < 0 || spp->cpp_index >= sh[j]->can_queue)
printk("%s: ihdlr, bad spp->cpp_index %d, irq %d, reg 0x%x, count %d.\n", printk("%s: ihdlr, bad spp->cpp_index %d, irq %d, reg 0x%x, count %d.\n",
BN(j), spp->cpp_index, irq, reg, HD(j)->iocount); BN(j), spp->cpp_index, irq, reg, HD(j)->iocount);
if (spp->eoc == FALSE || spp->cpp_index < 0 if (spp->eoc == 0 || spp->cpp_index < 0
|| spp->cpp_index >= sh[j]->can_queue) goto handled; || spp->cpp_index >= sh[j]->can_queue) goto handled;
/* Find the mailbox to be serviced on this board */ /* Find the mailbox to be serviced on this board */
...@@ -2240,7 +2242,7 @@ static irqreturn_t ihdlr(int irq, unsigned int j) { ...@@ -2240,7 +2242,7 @@ static irqreturn_t ihdlr(int irq, unsigned int j) {
if (linked_comm && SCpnt->device->queue_depth > 2 if (linked_comm && SCpnt->device->queue_depth > 2
&& TLDEV(SCpnt->device->type)) && TLDEV(SCpnt->device->type))
flush_dev(SCpnt->device, SCpnt->request->sector, j, TRUE); flush_dev(SCpnt->device, SCpnt->request->sector, j, 1);
tstatus = status_byte(spp->target_status); tstatus = status_byte(spp->target_status);
...@@ -2271,7 +2273,7 @@ static irqreturn_t ihdlr(int irq, unsigned int j) { ...@@ -2271,7 +2273,7 @@ static irqreturn_t ihdlr(int irq, unsigned int j) {
status = DID_OK << 16; status = DID_OK << 16;
if (tstatus == GOOD) if (tstatus == GOOD)
HD(j)->target_redo[SCpnt->device->id][SCpnt->device->channel] = FALSE; HD(j)->target_redo[SCpnt->device->id][SCpnt->device->channel] = 0;
if (spp->target_status && SCpnt->device->type == TYPE_DISK && if (spp->target_status && SCpnt->device->type == TYPE_DISK &&
(!(tstatus == CHECK_CONDITION && HD(j)->iocount <= 1000 && (!(tstatus == CHECK_CONDITION && HD(j)->iocount <= 1000 &&
...@@ -2305,7 +2307,7 @@ static irqreturn_t ihdlr(int irq, unsigned int j) { ...@@ -2305,7 +2307,7 @@ static irqreturn_t ihdlr(int irq, unsigned int j) {
for (c = 0; c <= sh[j]->max_channel; c++) for (c = 0; c <= sh[j]->max_channel; c++)
for (k = 0; k < sh[j]->max_id; k++) for (k = 0; k < sh[j]->max_id; k++)
HD(j)->target_redo[k][c] = TRUE; HD(j)->target_redo[k][c] = 1;
if (SCpnt->device->type != TYPE_TAPE if (SCpnt->device->type != TYPE_TAPE
&& HD(j)->retries < MAX_INTERNAL_RETRIES) { && HD(j)->retries < MAX_INTERNAL_RETRIES) {
...@@ -2408,7 +2410,7 @@ static int eata2x_release(struct Scsi_Host *shpnt) { ...@@ -2408,7 +2410,7 @@ static int eata2x_release(struct Scsi_Host *shpnt) {
release_region(sh[j]->io_port, sh[j]->n_io_port); release_region(sh[j]->io_port, sh[j]->n_io_port);
scsi_unregister(sh[j]); scsi_unregister(sh[j]);
return FALSE; return 0;
} }
#include "scsi_module.c" #include "scsi_module.c"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment