Commit 1975448f authored by Linus Torvalds's avatar Linus Torvalds Committed by Linus Torvalds

Merge http://linux-scsi.bkbits.net/scsi-for-linus-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents df4b68ca f4aa5d56
......@@ -45,7 +45,8 @@ const unsigned char scsi_command_size[8] =
#define SCSI_SENSE_BUFFERSIZE 64
#endif
int blk_do_rq(request_queue_t *q, struct block_device *bdev, struct request *rq)
static int blk_do_rq(request_queue_t *q, struct block_device *bdev,
struct request *rq)
{
DECLARE_COMPLETION(wait);
int err = 0;
......@@ -368,6 +369,7 @@ static int sg_scsi_ioctl(request_queue_t *q, struct block_device *bdev,
goto error;
switch (opcode) {
case SEND_DIAGNOSTIC:
case FORMAT_UNIT:
rq->timeout = FORMAT_UNIT_TIMEOUT;
break;
......@@ -398,7 +400,8 @@ static int sg_scsi_ioctl(request_queue_t *q, struct block_device *bdev,
if (in_len)
rq->flags |= REQ_RW;
err = blk_do_rq(q, bdev, rq);
blk_do_rq(q, bdev, rq);
err = rq->errors & 0xff; /* only 8 bit SCSI status */
if (err) {
if (rq->sense_len)
if (copy_to_user(sic->data, rq->sense, rq->sense_len))
......
......@@ -1715,6 +1715,11 @@ config SCSI_PC980155
If you have the NEC PC-9801-55 SCSI interface card or compatibles
for NEC PC-9801/PC-9821, say Y.
config WD33C93_PIO
bool
depends on SCSI_PC980155
default y
# bool 'Cyberstorm Mk III SCSI support (EXPERIMENTAL)' CONFIG_CYBERSTORMIII_SCSI
# bool 'GVP Turbo 040/060 SCSI support (EXPERIMENTAL)' CONFIG_GVP_TURBO_SCSI
endmenu
......
......@@ -29,6 +29,7 @@ obj-$(CONFIG_WARPENGINE_SCSI) += amiga7xx.o 53c7xx.o
obj-$(CONFIG_A3000_SCSI) += a3000.o wd33c93.o
obj-$(CONFIG_A2091_SCSI) += a2091.o wd33c93.o
obj-$(CONFIG_GVP11_SCSI) += gvp11.o wd33c93.o
obj-$(CONFIG_SCSI_PC980155) += pc980155.o wd33c93.o
obj-$(CONFIG_MVME147_SCSI) += mvme147.o wd33c93.o
obj-$(CONFIG_SGIWD93_SCSI) += sgiwd93.o wd33c93.o
obj-$(CONFIG_CYBERSTORM_SCSI) += NCR53C9x.o cyberstorm.o
......
This diff is collapsed.
......@@ -5,54 +5,12 @@
* $Id: aha152x.h,v 2.5 2002/04/14 11:24:12 fischer Exp $
*/
#if defined(__KERNEL__)
#include <linux/blk.h>
#include "scsi.h"
#include <asm/io.h>
#include <linux/version.h>
int aha152x_detect(Scsi_Host_Template *);
int aha152x_command(Scsi_Cmnd *);
int aha152x_queue(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int aha152x_abort(Scsi_Cmnd *);
int aha152x_release(struct Scsi_Host *shpnt);
int aha152x_device_reset(Scsi_Cmnd *);
int aha152x_bus_reset(Scsi_Cmnd *);
int aha152x_host_reset(Scsi_Cmnd *);
int aha152x_biosparam(struct scsi_device *, struct block_device *,
sector_t, int*);
int aha152x_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout);
/* number of queueable commands
(unless we support more than 1 cmd_per_lun this should do) */
#define AHA152X_MAXQUEUE 7
#define AHA152X_REVID "Adaptec 152x SCSI driver; $Revision: 2.5 $"
/* Initial value of Scsi_Host entry */
#define AHA152X { .proc_name = "aha152x", \
.proc_info = aha152x_proc_info, \
.name = AHA152X_REVID, \
.detect = aha152x_detect, \
.command = aha152x_command, \
.queuecommand = aha152x_queue, \
.eh_abort_handler = aha152x_abort, \
.eh_device_reset_handler = aha152x_device_reset, \
.eh_bus_reset_handler = aha152x_bus_reset, \
.eh_host_reset_handler = aha152x_host_reset, \
.release = aha152x_release, \
.bios_param = aha152x_biosparam, \
.can_queue = 1, \
.this_id = 7, \
.sg_tablesize = SG_ALL, \
.cmd_per_lun = 1, \
.present = 0, \
.unchecked_isa_dma = 0, \
.use_clustering = DISABLE_CLUSTERING }
#endif
/* port addresses */
#define SCSISEQ (HOSTIOPORT0+0x00) /* SCSI sequence control */
#define SXFRCTL0 (HOSTIOPORT0+0x01) /* SCSI transfer control 0 */
......@@ -355,4 +313,24 @@ enum {
};
#endif
/* for the pcmcia stub */
struct aha152x_setup {
int io_port;
int irq;
int scsiid;
int reconnect;
int parity;
int synchronous;
int delay;
int ext_trans;
int tc1550;
#if defined(AHA152X_DEBUG)
int debug;
#endif
char *conf;
};
struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
int aha152x_host_reset(struct scsi_cmnd *);
#endif /* _AHA152X_H */
/*
*
* drivers/scsi/pc980155.c
*
* PC-9801-55 SCSI host adapter driver
*
* Copyright (C) 1997-2003 Kyoto University Microcomputer Club
* (Linux/98 project)
* Tomoharu Ugawa <ohirune@kmc.gr.jp>
*
*/
#include <linux/module.h>
#include <linux/blk.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <asm/dma.h>
#include "scsi.h"
#include "hosts.h"
#include "wd33c93.h"
#include "pc980155.h"
extern int pc98_bios_param(struct scsi_device *, struct block_device *,
sector_t, int *);
static int scsi_pc980155_detect(Scsi_Host_Template *);
static int scsi_pc980155_release(struct Scsi_Host *);
#ifndef CMD_PER_LUN
#define CMD_PER_LUN 2
#endif
#ifndef CAN_QUEUE
#define CAN_QUEUE 16
#endif
#undef PC_9801_55_DEBUG
#undef PC_9801_55_DEBUG_VERBOSE
#define NR_BASE_IOS 4
static int nr_base_ios = NR_BASE_IOS;
static unsigned int base_ios[NR_BASE_IOS] = {0xcc0, 0xcd0, 0xce0, 0xcf0};
static wd33c93_regs init_regs;
static int io;
static struct Scsi_Host *pc980155_host = NULL;
static void pc980155_intr_handle(int irq, void *dev_id, struct pt_regs *regp);
static inline void pc980155_dma_enable(unsigned int base_io)
{
outb(0x01, REG_CWRITE);
}
static inline void pc980155_dma_disable(unsigned int base_io)
{
outb(0x02, REG_CWRITE);
}
static void pc980155_intr_handle(int irq, void *dev_id, struct pt_regs *regp)
{
wd33c93_intr(pc980155_host);
}
static int dma_setup(Scsi_Cmnd *sc, int dir_in)
{
/*
* sc->SCp.this_residual : transfer count
* sc->SCp.ptr : distination address (virtual address)
* dir_in : data direction (DATA_OUT_DIR:0 or DATA_IN_DIR:1)
*
* if success return 0
*/
/*
* DMA WRITE MODE
* bit 7,6 01b single mode (this mode only)
* bit 5 inc/dec (default:0 = inc)
* bit 4 auto initialize (normaly:0 = off)
* bit 3,2 01b memory -> io
* 10b io -> memory
* 00b verify
* bit 1,0 channel
*/
disable_dma(sc->device->host->dma_channel);
set_dma_mode(sc->device->host->dma_channel,
0x40 | (dir_in ? 0x04 : 0x08));
clear_dma_ff(sc->device->host->dma_channel);
set_dma_addr(sc->device->host->dma_channel, virt_to_phys(sc->SCp.ptr));
set_dma_count(sc->device->host->dma_channel, sc->SCp.this_residual);
#ifdef PC_9801_55_DEBUG
printk("D%d(%x)D", sc->device->host->dma_channel,
sc->SCp.this_residual);
#endif
enable_dma(sc->device->host->dma_channel);
pc980155_dma_enable(sc->device->host->io_port);
return 0;
}
static void dma_stop(struct Scsi_Host *instance, Scsi_Cmnd *sc, int status)
{
/*
* instance: Hostadapter's instance
* sc: scsi command
* status: True if success
*/
pc980155_dma_disable(sc->device->host->io_port);
disable_dma(sc->device->host->dma_channel);
}
/* return non-zero on detection */
static inline int pc980155_test_port(wd33c93_regs regs)
{
/* Quick and dirty test for presence of the card. */
if (inb(regs.SASR) == 0xff)
return 0;
return 1;
}
static inline int pc980155_getconfig(unsigned int base_io, wd33c93_regs regs,
unsigned char* irq, unsigned char* dma,
unsigned char* scsi_id)
{
static unsigned char irqs[] = {3, 5, 6, 9, 12, 13};
unsigned char result;
printk(KERN_DEBUG "PC-9801-55: base_io=%x SASR=%x SCMD=%x\n",
base_io, regs.SASR, regs.SCMD);
result = read_pc980155_resetint(regs);
printk(KERN_DEBUG "PC-9801-55: getting config (%x)\n", result);
*scsi_id = result & 0x07;
*irq = (result >> 3) & 0x07;
if (*irq > 5) {
printk(KERN_ERR "PC-9801-55 (base %#x): impossible IRQ (%d)"
" - other device here?\n", base_io, *irq);
return 0;
}
*irq = irqs[*irq];
result = inb(REG_STATRD);
*dma = result & 0x03;
if (*dma == 1) {
printk(KERN_ERR
"PC-9801-55 (base %#x): impossible DMA channl (%d)"
" - other device here?\n", base_io, *dma);
return 0;
}
#ifdef PC_9801_55_DEBUG
printk("PC-9801-55: end of getconfig\n");
#endif
return 1;
}
/* return non-zero on detection */
static int scsi_pc980155_detect(Scsi_Host_Template* tpnt)
{
unsigned int base_io;
unsigned char irq, dma, scsi_id;
int i;
#ifdef PC_9801_55_DEBUG
unsigned char debug;
#endif
if (io) {
base_ios[0] = io;
nr_base_ios = 1;
}
for (i = 0; i < nr_base_ios; i++) {
base_io = base_ios[i];
init_regs.SASR = REG_ADDRST;
init_regs.SCMD = REG_CONTRL;
#ifdef PC_9801_55_DEBUG
printk("PC-9801-55: SASR(%x = %x)\n", SASR, REG_ADDRST);
#endif
if (!request_region(base_io, 6, "PC-9801-55"))
continue;
if (pc980155_test_port(init_regs) &&
pc980155_getconfig(base_io, init_regs,
&irq, &dma, &scsi_id))
goto found;
release_region(base_io, 6);
}
printk("PC-9801-55: not found\n");
return 0;
found:
#ifdef PC_9801_55_DEBUG
printk("PC-9801-55: config: base io = %x, irq = %d, dma channel = %d, scsi id = %d\n", base_io, irq, dma, scsi_id);
#endif
if (request_irq(irq, pc980155_intr_handle, 0, "PC-9801-55", NULL)) {
printk(KERN_ERR "PC-9801-55: unable to allocate IRQ %d\n", irq);
goto err1;
}
if (request_dma(dma, "PC-9801-55")) {
printk(KERN_ERR "PC-9801-55: unable to allocate DMA channel %d\n", dma);
goto err2;
}
pc980155_host = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
if (pc980155_host) {
pc980155_host->this_id = scsi_id;
pc980155_host->io_port = base_io;
pc980155_host->n_io_port = 6;
pc980155_host->irq = irq;
pc980155_host->dma_channel = dma;
printk("PC-9801-55: scsi host found at %x irq = %d, use dma channel %d.\n", base_io, irq, dma);
pc980155_int_enable(init_regs);
wd33c93_init(pc980155_host, init_regs, dma_setup, dma_stop,
WD33C93_FS_12_15);
return 1;
}
printk(KERN_ERR "PC-9801-55: failed to register device\n");
err2:
free_irq(irq, NULL);
err1:
release_region(base_io, 6);
return 0;
}
static int scsi_pc980155_release(struct Scsi_Host *shost)
{
struct WD33C93_hostdata *hostdata
= (struct WD33C93_hostdata *)shost->hostdata;
pc980155_int_disable(hostdata->regs);
release_region(shost->io_port, shost->n_io_port);
free_irq(shost->irq, NULL);
free_dma(shost->dma_channel);
wd33c93_release();
return 1;
}
static int pc980155_bus_reset(Scsi_Cmnd *cmd)
{
struct WD33C93_hostdata *hostdata
= (struct WD33C93_hostdata *)cmd->device->host->hostdata;
pc980155_int_disable(hostdata->regs);
pc980155_assert_bus_reset(hostdata->regs);
udelay(50);
pc980155_negate_bus_reset(hostdata->regs);
(void) inb(hostdata->regs.SASR);
(void) read_pc980155(hostdata->regs, WD_SCSI_STATUS);
pc980155_int_enable(hostdata->regs);
wd33c93_host_reset(cmd);
return SUCCESS;
}
#ifndef MODULE
static int __init pc980155_setup(char *str)
{
int ints[4];
str = get_options(str, ARRAY_SIZE(ints), ints);
if (ints[0] > 0)
io = ints[1];
return 1;
}
__setup("pc980155_io=", pc980155_setup);
#endif
MODULE_PARM(io, "i");
MODULE_AUTHOR("Tomoharu Ugawa <ohirune@kmc.gr.jp>");
MODULE_DESCRIPTION("PC-9801-55 SCSI host adapter driver");
MODULE_LICENSE("GPL");
static Scsi_Host_Template driver_template = {
.proc_info = wd33c93_proc_info,
.name = "SCSI PC-9801-55",
.detect = scsi_pc980155_detect,
.release = scsi_pc980155_release,
.queuecommand = wd33c93_queuecommand,
.eh_abort_handler = wd33c93_abort,
.eh_bus_reset_handler = pc980155_bus_reset,
.eh_host_reset_handler = wd33c93_host_reset,
.bios_param = pc98_bios_param,
.can_queue = CAN_QUEUE,
.this_id = 7,
.sg_tablesize = SG_ALL,
.cmd_per_lun = CMD_PER_LUN, /* dont use link command */
.unchecked_isa_dma = 1, /* use dma **XXXX***/
.use_clustering = ENABLE_CLUSTERING,
.proc_name = "PC_9801_55",
};
#include "scsi_module.c"
/*
*
* drivers/scsi/pc980155.h
*
* PC-9801-55 SCSI host adapter driver
*
* Copyright (C) 1997-2003 Kyoto University Microcomputer Club
* (Linux/98 project)
* Tomoharu Ugawa <ohirune@kmc.gr.jp>
*
*/
#ifndef __PC980155_H
#define __PC980155_H
#include "wd33c93.h"
#define REG_ADDRST (base_io)
#define REG_CONTRL (base_io + 2)
#define REG_CWRITE (base_io + 4)
#define REG_STATRD (base_io + 4)
#define WD_MEMORYBANK 0x30
#define WD_RESETINT 0x33
static inline uchar read_pc980155(const wd33c93_regs regs, uchar reg_num)
{
outb(reg_num, regs.SASR);
return (uchar)inb(regs.SCMD);
}
static inline void write_memorybank(const wd33c93_regs regs, uchar value)
{
outb(WD_MEMORYBANK, regs.SASR);
outb(value, regs.SCMD);
}
#define read_pc980155_resetint(regs) \
read_pc980155((regs), WD_RESETINT)
#define pc980155_int_enable(regs) \
write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) | 0x04)
#define pc980155_int_disable(regs) \
write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) & ~0x04)
#define pc980155_assert_bus_reset(regs) \
write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) | 0x02)
#define pc980155_negate_bus_reset(regs) \
write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) & ~0x02)
#endif /* __PC980155_H */
......@@ -49,6 +49,7 @@
#include "scsi.h"
#include "hosts.h"
#include "aha152x.h"
#include <pcmcia/version.h>
#include <pcmcia/cs_types.h>
......@@ -102,8 +103,6 @@ typedef struct scsi_info_t {
dev_node_t node[8];
} scsi_info_t;
extern void aha152x_setup(char *str, int *ints);
static void aha152x_release_cs(u_long arg);
static int aha152x_event(event_t event, int priority,
event_callback_args_t *args);
......@@ -111,11 +110,7 @@ static int aha152x_event(event_t event, int priority,
static dev_link_t *aha152x_attach(void);
static void aha152x_detach(dev_link_t *);
#define driver_template aha152x_driver_template
extern Scsi_Host_Template aha152x_driver_template;
static dev_link_t *dev_list = NULL;
static dev_link_t *dev_list;
static dev_info_t dev_info = "aha152x_cs";
/*====================================================================*/
......@@ -227,11 +222,12 @@ static void aha152x_config_cs(dev_link_t *link)
{
client_handle_t handle = link->handle;
scsi_info_t *info = link->priv;
struct aha152x_setup s;
tuple_t tuple;
cisparse_t parse;
int i, last_ret, last_fn, ints[8];
int i, last_ret, last_fn;
u_char tuple_data[64];
Scsi_Device *dev;
struct scsi_device *dev;
dev_node_t *node, **tail;
struct Scsi_Host *host;
......@@ -247,7 +243,6 @@ static void aha152x_config_cs(dev_link_t *link)
link->conf.ConfigBase = parse.config.base;
/* Configure card */
driver_template.module = &__this_module;
link->state |= DEV_CONFIG;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
......@@ -276,29 +271,32 @@ static void aha152x_config_cs(dev_link_t *link)
/* A bad hack... */
release_region(link->io.BasePort1, link->io.NumPorts1);
/* Set configuration options for the aha152x driver */
ints[0] = 7;
ints[1] = link->io.BasePort1;
ints[2] = link->irq.AssignedIRQ;
ints[3] = host_id;
ints[4] = reconnect;
ints[5] = parity;
ints[6] = synchronous;
ints[7] = reset_delay;
if (ext_trans) {
ints[8] = ext_trans; ints[0] = 8;
}
aha152x_setup("PCMCIA setup", ints);
scsi_register_host(&driver_template);
memset(&s, 0, sizeof(s));
s.conf = "PCMCIA setup";
s.io_port = link->io.BasePort1;
s.irq = link->irq.AssignedIRQ;
s.scsiid = host_id;
s.reconnect = reconnect;
s.parity = parity;
s.synchronous = synchronous;
s.delay = reset_delay;
if (ext_trans)
s.ext_trans = ext_trans;
tail = &link->dev;
info->ndev = 0;
for (host = scsi_host_get_next(NULL); host;
host = scsi_host_get_next(host))
if (host->hostt == &driver_template)
list_for_each_entry (dev, &host->my_devices, siblings) {
host = aha152x_probe_one(&s);
if (host == NULL) {
printk(KERN_INFO "aha152x_cs: no SCSI devices found\n");
goto cs_failed;
}
scsi_add_host(host, NULL);
list_for_each_entry(dev, &host->my_devices, siblings) {
u_long arg[2], id;
kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
id = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
......@@ -328,11 +326,9 @@ static void aha152x_config_cs(dev_link_t *link)
*tail = node; tail = &node->next;
info->ndev++;
info->host = dev->host;
}
}
*tail = NULL;
if (info->ndev == 0)
printk(KERN_INFO "aha152x_cs: no SCSI devices found\n");
link->state &= ~DEV_CONFIG_PENDING;
return;
......@@ -340,41 +336,26 @@ static void aha152x_config_cs(dev_link_t *link)
cs_error(link->handle, last_fn, last_ret);
aha152x_release_cs((u_long)link);
return;
} /* aha152x_config_cs */
/*====================================================================*/
}
static void aha152x_release_cs(u_long arg)
{
dev_link_t *link = (dev_link_t *)arg;
DEBUG(0, "aha152x_release_cs(0x%p)\n", link);
dev_link_t *link = (dev_link_t *)arg;
scsi_info_t *info = link->priv;
#warning This does not protect you. You need some real fix for your races.
#if 0
if (GET_USE_COUNT(driver_template.module) != 0) {
DEBUG(1, "aha152x_cs: release postponed, "
"device still open\n");
link->state |= DEV_STALE_CONFIG;
return;
}
#endif
scsi_unregister_host(&driver_template);
link->dev = NULL;
scsi_remove_host(info->host);
link->dev = NULL;
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
if (link->state & DEV_STALE_LINK)
aha152x_detach(link);
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
} /* aha152x_release_cs */
link->state &= ~DEV_CONFIG;
scsi_unregister(info->host);
/*====================================================================*/
if (link->state & DEV_STALE_LINK)
aha152x_detach(link);
}
static int aha152x_event(event_t event, int priority,
event_callback_args_t *args)
......@@ -414,28 +395,29 @@ static int aha152x_event(event_t event, int priority,
break;
}
return 0;
} /* aha152x_event */
}
/*====================================================================*/
static struct pcmcia_driver aha152x_cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "aha152x_cs",
},
.attach = aha152x_attach,
.detach = aha152x_detach,
};
static int __init init_aha152x_cs(void) {
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "aha152x_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &aha152x_attach, &aha152x_detach);
return 0;
static int __init init_aha152x_cs(void)
{
return pcmcia_register_driver(&aha152x_cs_driver);
}
static void __exit exit_aha152x_cs(void) {
DEBUG(0, "aha152x_cs: unloading\n");
unregister_pccard_driver(&dev_info);
while (dev_list != NULL)
aha152x_detach(dev_list);
static void __exit exit_aha152x_cs(void)
{
pcmcia_unregister_driver(&aha152x_cs_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL)
aha152x_detach(dev_list);
}
module_init(init_aha152x_cs);
......
......@@ -379,26 +379,27 @@ static int fdomain_event(event_t event, int priority,
return 0;
} /* fdomain_event */
/*====================================================================*/
static int __init init_fdomain_cs(void) {
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "fdomain_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &fdomain_attach, &fdomain_detach);
return 0;
static struct pcmcia_driver fdomain_cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "fdomain_cs",
},
.attach = fdomain_attach,
.detach = fdomain_detach,
};
static int __init init_fdomain_cs(void)
{
return pcmcia_register_driver(&fdomain_cs_driver);
}
static void __exit exit_fdomain_cs(void) {
DEBUG(0, "fdomain_cs: unloading\n");
unregister_pccard_driver(&dev_info);
while (dev_list != NULL)
fdomain_detach(dev_list);
static void __exit exit_fdomain_cs(void)
{
pcmcia_unregister_driver(&fdomain_cs_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL)
fdomain_detach(dev_list);
}
module_init(init_fdomain_cs);
......
......@@ -397,25 +397,26 @@ static int qlogic_event(event_t event, int priority, event_callback_args_t * arg
return 0;
} /* qlogic_event */
/*====================================================================*/
static struct pcmcia_driver qlogic_cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "qlogic_cs",
},
.attach = qlogic_attach,
.detach = qlogic_detach,
};
static int __init init_qlogic_cs(void)
{
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "qlogic_cs: Card Services release " "does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &qlogic_attach, &qlogic_detach);
return 0;
return pcmcia_register_driver(&qlogic_cs_driver);
}
static void __exit exit_qlogic_cs(void)
{
DEBUG(0, "qlogic_cs: unloading\n");
unregister_pccard_driver(&dev_info);
pcmcia_unregister_driver(&qlogic_cs_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL)
qlogic_detach(dev_list);
}
......
......@@ -643,6 +643,7 @@ struct isp2x00_hostdata {
u_char queued;
u_char host_id;
struct timer_list explore_timer;
struct id_name_map tempmap[QLOGICFC_MAX_ID + 1];
};
......@@ -836,22 +837,13 @@ static int isp2x00_make_portdb(struct Scsi_Host *host)
short param[8];
int i, j;
struct id_name_map *map; /* base of array [QLOGICFC_MAX_ID + 1] */
struct id_name_map *mapx; /* array entry pointer */
struct isp2x00_hostdata *hostdata;
hostdata = (struct isp2x00_hostdata *) host->hostdata;
map = kmalloc((QLOGICFC_MAX_ID + 1) * sizeof(struct id_name_map), GFP_ATOMIC);
if (!map) {
printk("qlogicfc%d : error getting memory -- cannot make port database.\n",
hostdata->host_id);
goto fini;
}
memset(map, 0, (QLOGICFC_MAX_ID + 1) * sizeof(struct id_name_map));
isp2x00_disable_irqs(host);
hostdata = (struct isp2x00_hostdata *) host->hostdata;
memset(hostdata->tempmap, 0, sizeof(hostdata->tempmap));
#if ISP2x00_FABRIC
for (i = 0x81; i < QLOGICFC_MAX_ID; i++) {
param[0] = MBOX_PORT_LOGOUT;
......@@ -876,74 +868,72 @@ static int isp2x00_make_portdb(struct Scsi_Host *host)
if (param[0] == MBOX_COMMAND_COMPLETE) {
hostdata->port_id = ((u_int) param[3]) << 16;
hostdata->port_id |= param[2];
map->loop_id = param[1];
map->wwn = hostdata->wwn;
hostdata->tempmap[0].loop_id = param[1];
hostdata->tempmap[0].wwn = hostdata->wwn;
}
else {
printk("qlogicfc%d : error getting scsi id.\n", hostdata->host_id);
}
for (i = 0, mapx = map; i <= QLOGICFC_MAX_ID; i++, mapx++)
mapx->loop_id = map->loop_id;
for (i = 0; i <=QLOGICFC_MAX_ID; i++)
hostdata->tempmap[i].loop_id = hostdata->tempmap[0].loop_id;
for (i = 0, j = 1, mapx = map + 1; i <= QLOGICFC_MAX_LOOP_ID; i++) {
for (i = 0, j = 1; i <= QLOGICFC_MAX_LOOP_ID; i++) {
param[0] = MBOX_GET_PORT_NAME;
param[1] = (i << 8) & 0xff00;
isp2x00_mbox_command(host, param);
if (param[0] == MBOX_COMMAND_COMPLETE) {
mapx->loop_id = i;
mapx->wwn = ((u64) (param[2] & 0xff)) << 56;
mapx->wwn |= ((u64) ((param[2] >> 8) & 0xff)) << 48;
mapx->wwn |= ((u64) (param[3] & 0xff)) << 40;
mapx->wwn |= ((u64) ((param[3] >> 8) & 0xff)) << 32;
mapx->wwn |= ((u64) (param[6] & 0xff)) << 24;
mapx->wwn |= ((u64) ((param[6] >> 8) & 0xff)) << 16;
mapx->wwn |= ((u64) (param[7] & 0xff)) << 8;
mapx->wwn |= ((u64) ((param[7] >> 8) & 0xff));
hostdata->tempmap[j].loop_id = i;
hostdata->tempmap[j].wwn = ((u64) (param[2] & 0xff)) << 56;
hostdata->tempmap[j].wwn |= ((u64) ((param[2] >> 8) & 0xff)) << 48;
hostdata->tempmap[j].wwn |= ((u64) (param[3] & 0xff)) << 40;
hostdata->tempmap[j].wwn |= ((u64) ((param[3] >> 8) & 0xff)) << 32;
hostdata->tempmap[j].wwn |= ((u64) (param[6] & 0xff)) << 24;
hostdata->tempmap[j].wwn |= ((u64) ((param[6] >> 8) & 0xff)) << 16;
hostdata->tempmap[j].wwn |= ((u64) (param[7] & 0xff)) << 8;
hostdata->tempmap[j].wwn |= ((u64) ((param[7] >> 8) & 0xff));
j++;
mapx++;
}
}
#if ISP2x00_FABRIC
isp2x00_init_fabric(host, map, j);
isp2x00_init_fabric(host, hostdata->tempmap, j);
#endif
for (i = 0, mapx = map; i <= QLOGICFC_MAX_ID; i++, mapx++) {
struct id_name_map *tmap; /* second array entry pointer */
if (mapx->wwn != hostdata->port_db[i].wwn) {
for (j = 0, tmap = map; j <= QLOGICFC_MAX_ID; j++, tmap++) {
if (tmap->wwn == hostdata->port_db[i].wwn) {
hostdata->port_db[i].loop_id = tmap->loop_id;
for (i = 0; i <= QLOGICFC_MAX_ID; i++) {
if (hostdata->tempmap[i].wwn != hostdata->port_db[i].wwn) {
for (j = 0; j <= QLOGICFC_MAX_ID; j++) {
if (hostdata->tempmap[j].wwn == hostdata->port_db[i].wwn) {
hostdata->port_db[i].loop_id = hostdata->tempmap[j].loop_id;
break;
}
}
if (j == QLOGICFC_MAX_ID + 1)
hostdata->port_db[i].loop_id = map->loop_id;
hostdata->port_db[i].loop_id = hostdata->tempmap[0].loop_id;
for (j = 0; j <= QLOGICFC_MAX_ID; j++) {
if (hostdata->port_db[j].wwn == mapx->wwn || !hostdata->port_db[j].wwn) {
if (hostdata->port_db[j].wwn == hostdata->tempmap[i].wwn || !hostdata->port_db[j].wwn) {
break;
}
}
if (j == QLOGICFC_MAX_ID + 1)
printk("qlogicfc%d : Too many scsi devices, no more room in port map.\n", hostdata->host_id);
if (!hostdata->port_db[j].wwn) {
hostdata->port_db[j].loop_id = mapx->loop_id;
hostdata->port_db[j].wwn = mapx->wwn;
hostdata->port_db[j].loop_id = hostdata->tempmap[i].loop_id;
hostdata->port_db[j].wwn = hostdata->tempmap[i].wwn;
}
} else
hostdata->port_db[i].loop_id = mapx->loop_id;
hostdata->port_db[i].loop_id = hostdata->tempmap[i].loop_id;
}
isp2x00_enable_irqs(host);
kfree(map);
fini:
return 0;
}
......
......@@ -442,6 +442,7 @@ extern void scsi_finish_command(Scsi_Cmnd *);
extern int scsi_retry_command(Scsi_Cmnd *);
extern int scsi_attach_device(struct scsi_device *);
extern void scsi_detach_device(struct scsi_device *);
extern void scsi_rescan_device(struct scsi_device *);
extern int scsi_get_device_flags(unsigned char *vendor, unsigned char *model);
/*
......
This diff is collapsed.
......@@ -298,6 +298,7 @@ int scsi_ioctl_send_command(Scsi_Device * dev, Scsi_Ioctl_Command * sic)
goto error;
switch (opcode) {
case SEND_DIAGNOSTIC:
case FORMAT_UNIT:
timeout = FORMAT_UNIT_TIMEOUT;
retries = 1;
......
......@@ -810,7 +810,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, int good_sectors,
cmd->device->host->host_no, (int) cmd->device->channel,
(int) cmd->device->id, (int) cmd->device->lun);
print_command(cmd->data_cmnd);
print_sense("sd", cmd);
print_sense("", cmd);
cmd = scsi_end_request(cmd, 0, block_sectors, 1);
return;
default:
......@@ -830,7 +830,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, int good_sectors,
struct Scsi_Device_Template *sdt;
sdt = scsi_get_request_dev(cmd->request);
printk("SCSI %s error : host %d channel %d id %d lun %d return code = %x\n",
printk("SCSI %s error : <%d %d %d %d> return code = 0x%x\n",
(sdt ? sdt->name : "device"),
cmd->device->host->host_no,
cmd->device->channel,
......@@ -838,7 +838,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, int good_sectors,
cmd->device->lun, result);
if (driver_byte(result) & DRIVER_SENSE)
print_sense("sd", cmd);
print_sense("", cmd);
/*
* Mark a single buffer as not uptodate. Queue the remainder.
* We sometimes get this cruft in the event that a medium error
......
......@@ -48,7 +48,7 @@ static int pc98_first_bios_param(struct scsi_device *sdev, int *ip)
int pc98_bios_param(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int *ip)
{
static struct Scsi_Host *first_real = first_real_host();
struct Scsi_Host *first_real = first_real_host();
if (sdev->host == first_real && sdev->id < 7 &&
__PC9800SCA_TEST_BIT(PC9800SCA_DISK_EQUIPS, sdev->id))
......
......@@ -191,6 +191,13 @@ struct dev_info scsi_static_device_list[] __initdata = {
{"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"SUN", "T300", "*", BLIST_SPARSELUN},
{"SUN", "T4", "*", BLIST_SPARSELUN},
{"SGI", "RAID3", "*", BLIST_SPARSELUN},
{"SGI", "RAID5", "*", BLIST_SPARSELUN},
{"SGI", "TP9100", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"SGI", "TP9300", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"SGI", "TP9400", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"SGI", "TP9500", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"MYLEX", "DACARMRB", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{ NULL, NULL, NULL, 0 },
};
......
......@@ -275,12 +275,8 @@ show_rescan_field (struct device *dev, char *buf)
static ssize_t
store_rescan_field (struct device *dev, const char *buf, size_t count)
{
int ret = ENODEV;
struct scsi_device *sdev;
sdev = to_scsi_device(dev);
if (sdev)
ret = scsi_rescan_device(sdev);
return ret;
scsi_rescan_device(to_scsi_device(dev));
return 0;
}
static DEVICE_ATTR(rescan, S_IRUGO | S_IWUSR, show_rescan_field, store_rescan_field)
......
......@@ -4901,6 +4901,11 @@ static int __init ncr_prepare_setting(ncb_p np, ncr_nvram *nvram)
u_long period;
int i;
#ifdef CONFIG_PARISC
char scsi_mode = -1;
struct hardware_path hwpath;
#endif
/*
** Wide ?
*/
......@@ -4972,6 +4977,31 @@ static int __init ncr_prepare_setting(ncb_p np, ncr_nvram *nvram)
*/
period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz;
#ifdef CONFIG_PARISC
/* Host firmware (PDC) keeps a table for crippling SCSI capabilities.
* Many newer machines export one channel of 53c896 chip
* as SE, 50-pin HD. Also used for Multi-initiator SCSI clusters
* to set the SCSI Initiator ID.
*/
get_pci_node_path(np->pdev, &hwpath);
if (pdc_get_initiator(&hwpath, &np->myaddr, &period, &np->maxwide, &scsi_mode))
{
if (np->maxwide)
np->features |= FE_WIDE;
if (scsi_mode >= 0) {
/* C3000 PDC reports period/mode */
driver_setup.diff_support = 0;
switch(scsi_mode) {
case 0: np->scsi_mode = SMODE_SE; break;
case 1: np->scsi_mode = SMODE_HVD; break;
case 2: np->scsi_mode = SMODE_LVD; break;
default: break;
}
}
}
#endif
if (period <= 250) np->minsync = 10;
else if (period <= 303) np->minsync = 11;
else if (period <= 500) np->minsync = 12;
......
......@@ -162,8 +162,8 @@ read_wd33c93(const wd33c93_regs regs, uchar reg_num)
{
uchar data;
outb(reg_num, *regs.SASR);
data = inb(*regs.SCMD);
outb(reg_num, regs.SASR);
data = inb(regs.SCMD);
return data;
}
......@@ -172,33 +172,33 @@ read_wd33c93_count(const wd33c93_regs regs)
{
unsigned long value;
outb(WD_TRANSFER_COUNT_MSB, *regs.SASR);
value = inb(*regs.SCMD) << 16;
value |= inb(*regs.SCMD) << 8;
value |= inb(*regs.SCMD);
outb(WD_TRANSFER_COUNT_MSB, regs.SASR);
value = inb(regs.SCMD) << 16;
value |= inb(regs.SCMD) << 8;
value |= inb(regs.SCMD);
return value;
}
static inline uchar
read_aux_stat(const wd33c93_regs regs)
{
return inb(*regs.SASR);
return inb(regs.SASR);
}
static inline void
write_wd33c93(const wd33c93_regs regs, uchar reg_num, uchar value)
{
outb(reg_num, *regs.SASR);
outb(value, *regs.SCMD);
outb(reg_num, regs.SASR);
outb(value, regs.SCMD);
}
static inline void
write_wd33c93_count(const wd33c93_regs regs, unsigned long value)
{
outb(WD_TRANSFER_COUNT_MSB, *regs.SASR);
outb((value >> 16) & 0xff, *regs.SCMD);
outb((value >> 8) & 0xff, *regs.SCMD);
outb( value & 0xff, *regs.SCMD);
outb(WD_TRANSFER_COUNT_MSB, regs.SASR);
outb((value >> 16) & 0xff, regs.SCMD);
outb((value >> 8) & 0xff, regs.SCMD);
outb( value & 0xff, regs.SCMD);
}
#define write_wd33c93_cmd(regs, cmd) \
......@@ -209,9 +209,9 @@ write_wd33c93_cdb(const wd33c93_regs regs, uint len, uchar cmnd[])
{
int i;
outb(WD_CDB_1, *regs.SASR);
outb(WD_CDB_1, regs.SASR);
for (i=0; i<len; i++)
outb(cmnd[i], *regs.SCMD);
outb(cmnd[i], regs.SCMD);
}
#else /* CONFIG_WD33C93_PIO */
......@@ -1522,7 +1522,7 @@ reset_wd33c93(struct Scsi_Host *instance)
}
int
wd33c93_reset(Scsi_Cmnd * SCpnt, unsigned int reset_flags)
wd33c93_host_reset(Scsi_Cmnd * SCpnt)
{
struct Scsi_Host *instance;
struct WD33C93_hostdata *hostdata;
......@@ -1553,7 +1553,7 @@ wd33c93_reset(Scsi_Cmnd * SCpnt, unsigned int reset_flags)
reset_wd33c93(instance);
SCpnt->result = DID_RESET << 16;
enable_irq(instance->irq);
return 0;
return SUCCESS;
}
int
......@@ -1591,7 +1591,7 @@ wd33c93_abort(Scsi_Cmnd * cmd)
instance->host_no, cmd->pid);
enable_irq(cmd->device->host->irq);
cmd->scsi_done(cmd);
return SCSI_ABORT_SUCCESS;
return SUCCESS;
}
prev = tmp;
tmp = (Scsi_Cmnd *) tmp->host_scribble;
......@@ -1666,7 +1666,7 @@ wd33c93_abort(Scsi_Cmnd * cmd)
enable_irq(cmd->device->host->irq);
cmd->scsi_done(cmd);
return SCSI_ABORT_SUCCESS;
return SUCCESS;
}
/*
......@@ -1681,9 +1681,9 @@ wd33c93_abort(Scsi_Cmnd * cmd)
printk
("scsi%d: Abort - command %ld found on disconnected_Q - ",
instance->host_no, cmd->pid);
printk("returning ABORT_SNOOZE. ");
printk("Abort SNOOZE. ");
enable_irq(cmd->device->host->irq);
return SCSI_ABORT_SNOOZE;
return FAILED;
}
tmp = (Scsi_Cmnd *) tmp->host_scribble;
}
......@@ -1704,7 +1704,7 @@ wd33c93_abort(Scsi_Cmnd * cmd)
enable_irq(cmd->device->host->irq);
printk("scsi%d: warning : SCSI command probably completed successfully"
" before abortion. ", instance->host_no);
return SCSI_ABORT_NOT_RUNNING;
return FAILED;
}
#define MAX_WD33C93_HOSTS 4
......@@ -1755,7 +1755,7 @@ wd33c93_setup(char *str)
return 1;
}
__setup("wd33c9=", wd33c93_setup);
__setup("wd33c93=", wd33c93_setup);
/* check_setup_args() returns index if key found, 0 if not
*/
......@@ -2080,7 +2080,7 @@ wd33c93_release(void)
{
}
EXPORT_SYMBOL(wd33c93_reset);
EXPORT_SYMBOL(wd33c93_host_reset);
EXPORT_SYMBOL(wd33c93_init);
EXPORT_SYMBOL(wd33c93_release);
EXPORT_SYMBOL(wd33c93_abort);
......
......@@ -186,8 +186,13 @@
/* This is what the 3393 chip looks like to us */
typedef struct {
#ifdef CONFIG_WD33C93_PIO
unsigned int SASR;
unsigned int SCMD;
#else
volatile unsigned char *SASR;
volatile unsigned char *SCMD;
#endif
} wd33c93_regs;
......@@ -334,7 +339,7 @@ int wd33c93_abort (Scsi_Cmnd *cmd);
int wd33c93_queuecommand (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *));
void wd33c93_intr (struct Scsi_Host *instance);
int wd33c93_proc_info(char *, char **, off_t, int, int, int);
int wd33c93_reset (Scsi_Cmnd *, unsigned int);
int wd33c93_host_reset (Scsi_Cmnd *);
void wd33c93_release(void);
#endif /* WD33C93_H */
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