Commit e0029ad1 authored by Russell King's avatar Russell King

[ARM] Finally kill old ecard device discovery interfaces.

This cset kills the old racy ecard device discovery interfaces,
converting the remaining drivers to use the new LDM-based
interface.
parent 8d2c59fd
......@@ -989,42 +989,6 @@ ecard_probe(int slot, card_type_t type)
return rc;
}
static ecard_t *finding_pos;
void ecard_startfind(void)
{
finding_pos = NULL;
}
ecard_t *ecard_find(int cid, const card_ids *cids)
{
if (!finding_pos)
finding_pos = cards;
else
finding_pos = finding_pos->next;
for (; finding_pos; finding_pos = finding_pos->next) {
if (finding_pos->claimed)
continue;
if (finding_pos->dev.driver)
continue;
if (!cids) {
if ((finding_pos->cid.id ^ cid) == 0)
break;
} else {
const struct ecard_id *id;
id = ecard_match_device(cids, finding_pos);
if (id)
break;
}
}
return finding_pos;
}
/*
* Initialise the expansion card system.
* Locate all hardware - interrupt management and
......@@ -1087,10 +1051,15 @@ static int ecard_drv_probe(struct device *dev)
struct expansion_card *ec = ECARD_DEV(dev);
struct ecard_driver *drv = ECARD_DRV(dev->driver);
const struct ecard_id *id;
int ret;
id = ecard_match_device(drv->id_table, ec);
return drv->probe(ec, id);
ecard_claim(ec);
ret = drv->probe(ec, id);
if (ret)
ecard_release(ec);
return ret;
}
static int ecard_drv_remove(struct device *dev)
......@@ -1099,6 +1068,7 @@ static int ecard_drv_remove(struct device *dev)
struct ecard_driver *drv = ECARD_DRV(dev->driver);
drv->remove(ec);
ecard_release(ec);
return 0;
}
......@@ -1144,12 +1114,8 @@ static int ecard_bus_init(void)
postcore_initcall(ecard_bus_init);
EXPORT_SYMBOL(ecard_startfind);
EXPORT_SYMBOL(ecard_find);
EXPORT_SYMBOL(ecard_readchunk);
EXPORT_SYMBOL(ecard_address);
EXPORT_SYMBOL(ecard_register_driver);
EXPORT_SYMBOL(ecard_remove_driver);
EXPORT_SYMBOL(ecard_bus_type);
......@@ -160,13 +160,6 @@ struct hd_geometry {
#ifndef DEBUG
/*#define DEBUG */
#endif
/*
* List of card types that we recognise
*/
static const card_ids mfm_cids[] = {
{ MANU_ACORN, PROD_ACORN_MFM },
{ 0xffff, 0xffff }
};
/*
* End of configuration
*/
......@@ -1230,8 +1223,6 @@ static struct block_device_operations mfm_fops =
.ioctl = mfm_ioctl,
};
static struct expansion_card *ecs;
/*
* See if there is a controller at the address presently at mfm_addr
*
......@@ -1266,44 +1257,18 @@ static int mfm_probecontroller (unsigned int mfm_addr)
return 1;
}
/*
* Look for a MFM controller - first check the motherboard, then the podules
* The podules have an extra interrupt enable that needs to be played with
*
* The HDC is accessed at MEDIUM IOC speeds.
*/
static int __init mfm_init (void)
static int mfm_do_init(unsigned char irqmask)
{
unsigned char irqmask;
int i;
if (mfm_probecontroller(ONBOARD_MFM_ADDRESS)) {
mfm_addr = ONBOARD_MFM_ADDRESS;
mfm_IRQPollLoc = IOC_IRQSTATB;
mfm_irqenable = 0;
mfm_irq = IRQ_HARDDISK;
irqmask = 0x08; /* IL3 pin */
} else {
ecs = ecard_find(0, mfm_cids);
if (!ecs) {
mfm_addr = 0;
return -1;
}
mfm_addr = ecard_address(ecs, ECARD_IOC, ECARD_MEDIUM) + 0x800;
mfm_IRQPollLoc = ioaddr(mfm_addr + 0x400);
mfm_irqenable = mfm_IRQPollLoc;
mfm_irq = ecs->irq;
irqmask = 0x08;
ecard_claim(ecs);
}
int i, ret;
printk("mfm: found at address %08X, interrupt %d\n", mfm_addr, mfm_irq);
ret = -EBUSY;
if (!request_region (mfm_addr, 10, "mfm"))
goto out1;
if (register_blkdev(MAJOR_NR, "mfm", &mfm_fops)) {
ret = register_blkdev(MAJOR_NR, "mfm", &mfm_fops);
if (ret) {
printk("mfm_init: unable to get major number %d\n", MAJOR_NR);
goto out2;
}
......@@ -1319,8 +1284,10 @@ static int __init mfm_init (void)
lastspecifieddrive = -1;
mfm_drives = mfm_initdrives();
if (!mfm_drives)
if (!mfm_drives) {
ret = -ENODEV;
goto out3;
}
for (i = 0; i < mfm_drives; i++) {
struct gendisk *disk = alloc_disk(64);
......@@ -1335,7 +1302,8 @@ static int __init mfm_init (void)
printk("mfm: detected %d hard drive%s\n", mfm_drives,
mfm_drives == 1 ? "" : "s");
if (request_irq(mfm_irq, mfm_interrupt_handler, SA_INTERRUPT, "MFM harddisk", NULL)) {
ret = request_irq(mfm_irq, mfm_interrupt_handler, SA_INTERRUPT, "MFM harddisk", NULL);
if (ret) {
printk("mfm: unable to get IRQ%d\n", mfm_irq);
goto out4;
}
......@@ -1359,19 +1327,17 @@ static int __init mfm_init (void)
out2:
release_region(mfm_addr, 10);
out1:
ecard_release(ecs);
return -1;
return ret;
Enomem:
while (i--)
put_disk(mfm_gendisk[i]);
goto out3;
}
static void __exit mfm_exit(void)
static void mfm_do_exit(void)
{
int i;
if (ecs && mfm_irqenable)
outw (0, mfm_irqenable); /* Required to enable IRQs from MFM podule */
free_irq(mfm_irq, NULL);
for (i = 0; i < mfm_drives; i++) {
del_gendisk(mfm_gendisk[i]);
......@@ -1379,12 +1345,72 @@ static void __exit mfm_exit(void)
}
blk_cleanup_queue(&mfm_queue);
unregister_blkdev(MAJOR_NR, "mfm");
if (ecs)
ecard_release(ecs);
if (mfm_addr)
release_region(mfm_addr, 10);
}
static int __devinit mfm_probe(struct expansion_card *ec, struct ecard_id *id)
{
if (mfm_addr)
return -EBUSY;
mfm_addr = ecard_address(ec, ECARD_IOC, ECARD_MEDIUM) + 0x800;
mfm_IRQPollLoc = ioaddr(mfm_addr + 0x400);
mfm_irqenable = mfm_IRQPollLoc;
mfm_irq = ec->irq;
return mfm_do_init(0x08);
}
static void __devexit mfm_remove(struct expansion_card *ec)
{
outw (0, mfm_irqenable); /* Required to enable IRQs from MFM podule */
mfm_do_exit();
}
static const struct ecard_id mfm_cids[] = {
{ MANU_ACORN, PROD_ACORN_MFM },
{ 0xffff, 0xffff },
};
static struct ecard_driver mfm_driver = {
.probe = mfm_probe,
.remove = __devexit(mfm_remove),
.id_table = mfm_cids,
.drv = {
.name = "mfm",
},
};
/*
* Look for a MFM controller - first check the motherboard, then the podules
* The podules have an extra interrupt enable that needs to be played with
*
* The HDC is accessed at MEDIUM IOC speeds.
*/
static int __init mfm_init (void)
{
unsigned char irqmask;
if (mfm_probecontroller(ONBOARD_MFM_ADDRESS)) {
mfm_addr = ONBOARD_MFM_ADDRESS;
mfm_IRQPollLoc = IOC_IRQSTATB;
mfm_irqenable = 0;
mfm_irq = IRQ_HARDDISK;
return mfm_do_init(0x08); /* IL3 pin */
} else {
return ecard_register_driver(&mfm_driver);
}
}
static void __exit mfm_exit(void)
{
if (mfm_addr == ONBOARD_MFM_ADDRESS)
mfm_do_exit();
else
ecard_unregister_driver(&mfm_driver);
}
module_init(mfm_init)
module_exit(mfm_exit)
MODULE_LICENSE("GPL");
......@@ -1021,8 +1021,6 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
ether1_banner();
ecard_claim(ec);
dev = init_etherdev(NULL, sizeof(struct ether1_priv));
if (!dev) {
ret = -ENOMEM;
......@@ -1077,7 +1075,6 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
unregister_netdev(dev);
kfree(dev);
out:
ecard_release(ec);
return ret;
}
......@@ -1092,8 +1089,6 @@ static void __devexit ether1_remove(struct expansion_card *ec)
release_region(dev->base_addr, 16);
release_region(dev->base_addr + 0x800, 4096);
kfree(dev);
ecard_release(ec);
}
static const struct ecard_id ether1_ids[] = {
......
......@@ -830,8 +830,6 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
ether3_banner();
ecard_claim(ec);
dev = init_etherdev(NULL, sizeof(struct dev_priv));
if (!dev) {
ret = -ENOMEM;
......@@ -917,7 +915,6 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
unregister_netdev(dev);
kfree(dev);
out:
ecard_release(ec);
return ret;
}
......@@ -930,8 +927,6 @@ static void __devexit ether3_remove(struct expansion_card *ec)
unregister_netdev(dev);
release_region(dev->base_addr, 128);
kfree(dev);
ecard_release(ec);
}
static const struct ecard_id ether3_ids[] = {
......
......@@ -568,8 +568,6 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
etherh_banner();
ecard_claim(ec);
dev = init_etherdev(NULL, sizeof(struct etherh_priv));
if (!dev) {
ret = -ENOMEM;
......@@ -725,7 +723,6 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
kfree(dev->priv);
kfree(dev);
out:
ecard_release(ec);
return ret;
}
......@@ -744,7 +741,6 @@ static void __devexit etherh_remove(struct expansion_card *ec)
ec->ops = NULL;
kfree(ec->irq_data);
ecard_release(ec);
}
static const struct ecard_id etherh_ids[] = {
......
......@@ -109,10 +109,7 @@
* If not set, then use PIO mode (not currently supported).
*/
#define USE_DMAC
/*
* List of devices that the driver will recognise
*/
#define ACORNSCSI_LIST { MANU_ACORN, PROD_ACORN_SCSI }
/*
* ====================================================================================
*/
......@@ -2832,148 +2829,6 @@ int acornscsi_reset(Scsi_Cmnd *SCpnt, unsigned int reset_flags)
/*==============================================================================================
* initialisation & miscellaneous support
*/
static struct expansion_card *ecs[MAX_ECARDS];
/*
* Prototype: void acornscsi_init(AS_Host *host)
* Purpose : initialise the AS_Host structure for one interface & setup hardware
* Params : host - host to setup
*/
static
void acornscsi_host_init(AS_Host *host)
{
memset(&host->stats, 0, sizeof (host->stats));
queue_initialise(&host->queues.issue);
queue_initialise(&host->queues.disconnected);
msgqueue_initialise(&host->scsi.msgs);
acornscsi_resetcard(host);
}
int acornscsi_detect(Scsi_Host_Template * tpnt)
{
static const card_ids acornscsi_cids[] = { ACORNSCSI_LIST, { 0xffff, 0xffff } };
int i, count = 0;
struct Scsi_Host *instance;
AS_Host *host;
tpnt->proc_name = "acornscsi";
for (i = 0; i < MAX_ECARDS; i++)
ecs[i] = NULL;
ecard_startfind();
while(1) {
ecs[count] = ecard_find(0, acornscsi_cids);
if (!ecs[count])
break;
if (ecs[count]->irq == 0xff) {
printk("scsi: WD33C93 does not have IRQ enabled - ignoring\n");
continue;
}
ecard_claim(ecs[count]); /* Must claim here - card produces irq on reset */
instance = scsi_register(tpnt, sizeof(AS_Host));
if (!instance) {
ecard_release(ecs[count]);
break;
}
host = (AS_Host *)instance->hostdata;
instance->io_port = ecard_address(ecs[count], ECARD_MEMC, 0);
instance->irq = ecs[count]->irq;
host->host = instance;
host->scsi.io_port = ioaddr(instance->io_port + 0x800);
host->scsi.irq = instance->irq;
host->card.io_intr = POD_SPACE(instance->io_port) + 0x800;
host->card.io_page = POD_SPACE(instance->io_port) + 0xc00;
host->card.io_ram = ioaddr(instance->io_port);
host->dma.io_port = instance->io_port + 0xc00;
host->dma.io_intr_clear = POD_SPACE(instance->io_port) + 0x800;
ecs[count]->irqaddr = (char *)ioaddr(host->card.io_intr);
ecs[count]->irqmask = 0x0a;
if (!request_region(instance->io_port + 0x800, 2, "acornscsi(sbic)"))
goto err_1;
if (!request_region(host->card.io_intr, 1, "acornscsi(intr)"))
goto err_2;
if (!request_region(host->card.io_page, 1, "acornscsi(page)"))
goto err_3;
#ifdef USE_DMAC
if (!request_region(host->dma.io_port, 256, "acornscsi(dmac)"))
goto err_4;
#endif
if (!request_region(instance->io_port, 2048, "acornscsi(ram)"))
goto err_5;
if (request_irq(host->scsi.irq, acornscsi_intr, SA_INTERRUPT, "acornscsi", host)) {
printk(KERN_CRIT "scsi%d: IRQ%d not free, interrupts disabled\n",
instance->host_no, host->scsi.irq);
host->scsi.irq = NO_IRQ;
}
acornscsi_host_init(host);
++count;
}
return count;
err_5:
#ifdef USE_DMAC
release_region(host->dma.io_port, 256);
#endif
err_4:
release_region(host->card.io_page, 1);
err_3:
release_region(host->card.io_intr, 1);
err_2:
release_region(instance->io_port + 0x800, 2);
err_1:
scsi_unregister(instance);
return 0;
}
/*
* Function: int acornscsi_release(struct Scsi_Host *host)
* Purpose : release all resources used by this adapter
* Params : host - driver structure to release
* Returns : nothing of any consequence
*/
int acornscsi_release(struct Scsi_Host *instance)
{
AS_Host *host = (AS_Host *)instance->hostdata;
int i;
/*
* Put card into RESET state
*/
outb(0x80, host->card.io_page);
if (host->scsi.irq != NO_IRQ)
free_irq(host->scsi.irq, host);
release_region(instance->io_port + 0x800, 2);
release_region(host->card.io_intr, 1);
release_region(host->card.io_page, 1);
release_region(host->dma.io_port, 256);
release_region(instance->io_port, 2048);
for (i = 0; i < MAX_ECARDS; i++)
if (ecs[i] && instance->io_port == ecard_address(ecs[i], ECARD_MEMC, 0))
ecard_release(ecs[i]);
msgqueue_free(&host->scsi.msgs);
queue_free(&host->queues.disconnected);
queue_free(&host->queues.issue);
return 0;
}
/*
* Function: char *acornscsi_info(struct Scsi_Host *host)
......@@ -3126,10 +2981,9 @@ static Scsi_Host_Template acornscsi_template = {
.module = THIS_MODULE,
.proc_info = acornscsi_proc_info,
.name = "AcornSCSI",
.detect = acornscsi_detect,
.release = acornscsi_release,
.info = acornscsi_info,
.queuecommand = acornscsi_queuecmd,
#warning fixme
.abort = acornscsi_abort,
.reset = acornscsi_reset,
.can_queue = 16,
......@@ -3137,22 +2991,137 @@ static Scsi_Host_Template acornscsi_template = {
.sg_tablesize = SG_ALL,
.cmd_per_lun = 2,
.unchecked_isa_dma = 0,
.use_clustering = DISABLE_CLUSTERING
.use_clustering = DISABLE_CLUSTERING,
.proc_name = "acornscsi",
};
static int __init acornscsi_init(void)
static int __devinit
acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
{
scsi_register_host(&acornscsi_template);
if (acornscsi_template.present)
return 0;
struct Scsi_Host *host;
AS_Host *ashost;
int ret = -ENOMEM;
host = scsi_register(&acornscsi_template, sizeof(AS_Host));
if (!host)
goto out;
ashost = (AS_Host *)host->hostdata;
host->io_port = ecard_address(ec, ECARD_MEMC, 0);
host->irq = ec->irq;
ashost->host = host;
ashost->scsi.io_port = ioaddr(host->io_port + 0x800);
ashost->scsi.irq = host->irq;
ashost->card.io_intr = POD_SPACE(host->io_port) + 0x800;
ashost->card.io_page = POD_SPACE(host->io_port) + 0xc00;
ashost->card.io_ram = ioaddr(host->io_port);
ashost->dma.io_port = host->io_port + 0xc00;
ashost->dma.io_intr_clear = POD_SPACE(host->io_port) + 0x800;
ec->irqaddr = (char *)ioaddr(ashost->card.io_intr);
ec->irqmask = 0x0a;
ret = -EBUSY;
if (!request_region(host->io_port + 0x800, 2, "acornscsi(sbic)"))
goto err_1;
if (!request_region(ashost->card.io_intr, 1, "acornscsi(intr)"))
goto err_2;
if (!request_region(ashost->card.io_page, 1, "acornscsi(page)"))
goto err_3;
#ifdef USE_DMAC
if (!request_region(ashost->dma.io_port, 256, "acornscsi(dmac)"))
goto err_4;
#endif
if (!request_region(host->io_port, 2048, "acornscsi(ram)"))
goto err_5;
scsi_unregister_host(&acornscsi_template);
return -ENODEV;
ret = request_irq(host->irq, acornscsi_intr, SA_INTERRUPT, "acornscsi", ashost);
if (ret) {
printk(KERN_CRIT "scsi%d: IRQ%d not free: %d\n",
host->host_no, ashost->scsi.irq, ret);
goto err_6;
}
memset(&ashost->stats, 0, sizeof (ashost->stats));
queue_initialise(&ashost->queues.issue);
queue_initialise(&ashost->queues.disconnected);
msgqueue_initialise(&ashost->scsi.msgs);
acornscsi_resetcard(ashost);
ret = scsi_add_host(host);
if (ret == 0)
goto out;
free_irq(host->irq, ashost);
err_6:
release_region(host->io_port, 2048);
err_5:
#ifdef USE_DMAC
release_region(ashost->dma.io_port, 256);
#endif
err_4:
release_region(ashost->card.io_page, 1);
err_3:
release_region(ashost->card.io_intr, 1);
err_2:
release_region(host->io_port + 0x800, 2);
err_1:
scsi_unregister(host);
out:
return ret;
}
static void __devexit acornscsi_remove(struct expansion_card *ec)
{
struct Scsi_Host *host = ecard_get_drvdata(ec);
AS_Host *ashost = (AS_Host *)host->hostdata;
ecard_set_drvdata(ec, NULL);
scsi_remove_host(host);
/*
* Put card into RESET state
*/
outb(0x80, ashost->card.io_page);
free_irq(host->irq, ashost);
release_region(host->io_port + 0x800, 2);
release_region(ashost->card.io_intr, 1);
release_region(ashost->card.io_page, 1);
release_region(ashost->dma.io_port, 256);
release_region(host->io_port, 2048);
msgqueue_free(&ashost->scsi.msgs);
queue_free(&ashost->queues.disconnected);
queue_free(&ashost->queues.issue);
}
static const struct ecard_id acornscsi_cids[] = {
{ MANU_ACORN, PROD_ACORN_SCSI },
{ 0xffff, 0xffff },
};
static struct ecard_driver acornscsi_driver = {
.probe = acornscsi_probe,
.remove = __devexit_p(acornscsi_remove),
.id_table = acornscsi_cids,
.drv = {
.name = "acornscsi",
},
};
static int __init acornscsi_init(void)
{
return ecard_register_driver(&acornscsi_driver);
}
static void __exit acornscsi_exit(void)
{
scsi_unregister_host(&acornscsi_template);
ecard_remove_driver(&acornscsi_driver);
}
module_init(acornscsi_init);
......@@ -3161,4 +3130,3 @@ module_exit(acornscsi_exit);
MODULE_AUTHOR("Russell King");
MODULE_DESCRIPTION("AcornSCSI driver");
MODULE_LICENSE("GPL");
......@@ -37,21 +37,29 @@
#include "../../scsi/scsi.h"
#include "../../scsi/hosts.h"
#include "arxescsi.h"
#include "fas216.h"
/* Hmm - this should go somewhere else */
#define BUS_ADDR(x) ((((unsigned long)(x)) << 2) + IO_BASE)
struct arxescsi_info {
FAS216_Info info;
/* Configuration */
#define ARXESCSI_XTALFREQ 24
#define ARXESCSI_ASYNC_PERIOD 200
#define ARXESCSI_SYNC_DEPTH 0
/* other info... */
unsigned int cstatus; /* card status register */
unsigned int dmaarea; /* Pseudo DMA area */
};
/*
* List of devices that the driver will recognise
*/
#define ARXESCSI_LIST { MANU_ARXE, PROD_ARXE_SCSI }
#define CSTATUS_IRQ (1 << 0)
#define CSTATUS_DRQ (1 << 0)
#ifndef CAN_QUEUE
#define CAN_QUEUE 1
#endif
#ifndef CMD_PER_LUN
#define CMD_PER_LUN 1
#endif
/* Hmm - this should go somewhere else */
#define BUS_ADDR(x) ((((unsigned long)(x)) << 2) + IO_BASE)
/*
* Version
......@@ -60,8 +68,6 @@
#define VER_MINOR 1
#define VER_PATCH 1
static struct expansion_card *ecs[MAX_ECARDS];
/*
* Function: int arxescsi_dma_setup(host, SCpnt, direction, min_type)
* Purpose : initialises DMA/PIO
......@@ -85,7 +91,7 @@ arxescsi_dma_setup(struct Scsi_Host *host, Scsi_Pointer *SCp,
/* Faster transfer routines, written by SH to speed up the loops */
static __inline__ unsigned char getb(unsigned int address, unsigned int reg)
static inline unsigned char getb(unsigned int address, unsigned int reg)
{
unsigned char value;
......@@ -96,7 +102,7 @@ static __inline__ unsigned char getb(unsigned int address, unsigned int reg)
return value;
}
static __inline__ unsigned int getw(unsigned int address, unsigned int reg)
static inline unsigned int getw(unsigned int address, unsigned int reg)
{
unsigned int value;
......@@ -109,7 +115,7 @@ static __inline__ unsigned int getw(unsigned int address, unsigned int reg)
return value;
}
static __inline__ void putw(unsigned int address, unsigned int reg, unsigned long value)
static inline void putw(unsigned int address, unsigned int reg, unsigned long value)
{
__asm__ __volatile__(
"mov %0, %0, lsl #16\n\t"
......@@ -157,7 +163,7 @@ void arxescsi_pseudo_dma_write(unsigned char *addr, unsigned int io)
void arxescsi_dma_pseudo(struct Scsi_Host *host, Scsi_Pointer *SCp,
fasdmadir_t direction, int transfer)
{
ARXEScsi_Info *info = (ARXEScsi_Info *)host->hostdata;
struct arxescsi_info *info = (struct arxescsi_info *)host->hostdata;
unsigned int length, io, error=0;
unsigned char *addr;
......@@ -247,106 +253,6 @@ static void arxescsi_dma_stop(struct Scsi_Host *host, Scsi_Pointer *SCp)
*/
}
/*
* Function: int arxescsi_detect(Scsi_Host_Template * tpnt)
* Purpose : initialises ARXE SCSI driver
* Params : tpnt - template for this SCSI adapter
* Returns : >0 if host found, 0 otherwise.
*/
int arxescsi_detect(Scsi_Host_Template *tpnt)
{
static const card_ids arxescsi_cids[] = { ARXESCSI_LIST, { 0xffff, 0xffff} };
int count = 0;
struct Scsi_Host *host;
tpnt->proc_name = "arxescsi";
memset(ecs, 0, sizeof (ecs));
ecard_startfind();
while (1) {
ARXEScsi_Info *info;
ecs[count] = ecard_find(0, arxescsi_cids);
if (!ecs[count])
break;
ecard_claim(ecs[count]);
host = scsi_register(tpnt, sizeof (ARXEScsi_Info));
if (!host) {
ecard_release(ecs[count]);
break;
}
host->io_port = ecard_address(ecs[count], ECARD_MEMC, 0) + 0x0800;
host->irq = NO_IRQ;
host->dma_channel = NO_DMA;
host->can_queue = 0; /* no command queueing */
info = (ARXEScsi_Info *)host->hostdata;
info->info.scsi.io_port = host->io_port;
info->info.scsi.irq = host->irq;
info->info.scsi.io_shift = 3;
info->info.ifcfg.clockrate = ARXESCSI_XTALFREQ;
info->info.ifcfg.select_timeout = 255;
info->info.ifcfg.asyncperiod = ARXESCSI_ASYNC_PERIOD;
info->info.ifcfg.sync_max_depth = ARXESCSI_SYNC_DEPTH;
info->info.ifcfg.cntl3 = CNTL3_FASTSCSI | CNTL3_FASTCLK;
info->info.ifcfg.disconnect_ok = 0;
info->info.ifcfg.wide_max_size = 0;
info->info.dma.setup = arxescsi_dma_setup;
info->info.dma.pseudo = arxescsi_dma_pseudo;
info->info.dma.stop = arxescsi_dma_stop;
info->dmaarea = host->io_port + 128;
info->cstatus = host->io_port + 384;
ecs[count]->irqaddr = (unsigned char *)BUS_ADDR(host->io_port);
ecs[count]->irqmask = CSTATUS_IRQ;
if (!request_region(host->io_port, 120, "arxescsi-fas")) {
ecard_release(ecs[count]);
scsi_unregister(host);
break;
}
if (!request_region(host->io_port + 128, 384, "arxescsi-dma")) {
ecard_release(ecs[count]);
release_region(host->io_port, 120);
scsi_unregister(host);
break;
}
printk("scsi%d: Has no interrupts - using polling mode\n",
host->host_no);
fas216_init(host);
++count;
}
return count;
}
/*
* Function: int arxescsi_release(struct Scsi_Host * host)
* Purpose : releases all resources used by this adapter
* Params : host - driver host structure to return info for.
* Returns : nothing
*/
int arxescsi_release(struct Scsi_Host *host)
{
int i;
fas216_release(host);
release_region(host->io_port, 120);
release_region(host->io_port + 128, 384);
for (i = 0; i < MAX_ECARDS; i++)
if (ecs[i] && host->io_port == (ecard_address(ecs[i], ECARD_MEMC, 0) + 0x0800))
ecard_release(ecs[i]);
return 0;
}
/*
* Function: const char *arxescsi_info(struct Scsi_Host * host)
* Purpose : returns a descriptive string about this interface,
......@@ -355,7 +261,7 @@ int arxescsi_release(struct Scsi_Host *host)
*/
const char *arxescsi_info(struct Scsi_Host *host)
{
ARXEScsi_Info *info = (ARXEScsi_Info *)host->hostdata;
struct arxescsi_info *info = (struct arxescsi_info *)host->hostdata;
static char string[100], *p;
p = string;
......@@ -385,14 +291,14 @@ int arxescsi_proc_info(char *buffer, char **start, off_t offset,
{
int pos, begin;
struct Scsi_Host *host;
ARXEScsi_Info *info;
struct arxescsi_info *info;
Scsi_Device *scd;
host = scsi_host_hn_get(host_no);
if (!host)
return 0;
info = (ARXEScsi_Info *)host->hostdata;
info = (struct arxescsi_info *)host->hostdata;
if (inout == 1)
return -EINVAL;
......@@ -424,22 +330,122 @@ int arxescsi_proc_info(char *buffer, char **start, off_t offset,
return pos;
}
static Scsi_Host_Template arxescsi_template = ARXEScsi;
static Scsi_Host_Template arxescsi_template = {
.proc_info = arxescsi_proc_info,
.name = "ARXE SCSI card",
.info = arxescsi_info,
.command = fas216_command,
.queuecommand = fas216_queue_command,
.eh_host_reset_handler = fas216_eh_host_reset,
.eh_bus_reset_handler = fas216_eh_bus_reset,
.eh_device_reset_handler = fas216_eh_device_reset,
.eh_abort_handler = fas216_eh_abort,
.can_queue = 0,
.this_id = 7,
.sg_tablesize = SG_ALL,
.cmd_per_lun = CMD_PER_LUN,
.use_clustering = DISABLE_CLUSTERING,
.proc_name = "arxescsi",
};
static int __devinit
arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
{
struct Scsi_Host *host;
struct arxescsi_info *info;
int ret = -ENOMEM;
host = scsi_register(&arxescsi_template, sizeof(struct arxescsi_info));
if (!host)
goto out;
static int __init init_arxe_scsi_driver(void)
host->io_port = ecard_address(ec, ECARD_MEMC, 0) + 0x0800;
host->irq = NO_IRQ;
host->dma_channel = NO_DMA;
info = (struct arxescsi_info *)host->hostdata;
info->info.scsi.io_port = host->io_port;
info->info.scsi.irq = host->irq;
info->info.scsi.io_shift = 3;
info->info.ifcfg.clockrate = 24; /* MHz */
info->info.ifcfg.select_timeout = 255;
info->info.ifcfg.asyncperiod = 200; /* ns */
info->info.ifcfg.sync_max_depth = 0;
info->info.ifcfg.cntl3 = CNTL3_FASTSCSI | CNTL3_FASTCLK;
info->info.ifcfg.disconnect_ok = 0;
info->info.ifcfg.wide_max_size = 0;
info->info.dma.setup = arxescsi_dma_setup;
info->info.dma.pseudo = arxescsi_dma_pseudo;
info->info.dma.stop = arxescsi_dma_stop;
info->dmaarea = host->io_port + 128;
info->cstatus = host->io_port + 384;
ec->irqaddr = (unsigned char *)BUS_ADDR(host->io_port);
ec->irqmask = CSTATUS_IRQ;
if (!request_region(host->io_port, 120, "arxescsi-fas")) {
ret = -EBUSY;
goto out_free;
}
if (!request_region(host->io_port + 128, 384, "arxescsi-dma")) {
ret = -EBUSY;
goto out_release;
}
printk("scsi%d: Has no interrupts - using polling mode\n",
host->host_no);
fas216_init(host);
ret = scsi_add_host(host);
if (ret == 0)
goto out;
release_region(host->io_port + 128, 384);
out_release:
release_region(host->io_port, 120);
out_free:
scsi_unregister(host);
out:
return ret;
}
static void __devexit arxescsi_release(struct expansion_card *ec)
{
arxescsi_template.module = THIS_MODULE;
scsi_register_host(&arxescsi_template);
if (arxescsi_template.present)
return 0;
struct Scsi_Host *host = ecard_get_drvdata(ec);
scsi_unregister_host(&arxescsi_template);
return -ENODEV;
ecard_set_drvdata(ec, NULL);
scsi_remove_host(host);
fas216_release(host);
release_region(host->io_port + 128, 384);
release_region(host->io_port, 120);
scsi_unregister(host);
}
static const struct ecard_id arxescsi_cids[] = {
{ MANU_ARXE, PROD_ARXE_SCSI },
{ 0xffff, 0xffff },
};
static struct ecard_driver arxescsi_driver = {
.probe = arxescsi_probe,
.remove = __devexit_p(arxescsi_remove),
.id_table = arxescsi_cids,
.drv = {
.name = "arxescsi",
},
};
static int __init init_arxe_scsi_driver(void)
{
return ecard_register_driver(&arxescsi_driver);
}
static void __exit exit_arxe_scsi_driver(void)
{
scsi_unregister_host(&arxescsi_template);
ecard_remove_driver(&arxescsi_driver);
}
module_init(init_arxe_scsi_driver);
......
#define AUTOSENSE
#define PSEUDO_DMA
/*
* Generic Generic NCR5380 driver
*
* Copyright 1995, Russell King
*
* ALPHA RELEASE 1.
*
* For more information, please consult
*
* NCR 5380 Family
* SCSI Protocol Controller
* Databook
*
* NCR Microelectronics
* 1635 Aeroplaza Drive
* Colorado Springs, CO 80916
* 1+ (719) 578-3400
* 1+ (800) 334-5454
*/
/*
* Options :
*
* PARITY - enable parity checking. Not supported.
*
* SCSI2 - enable support for SCSI-II tagged queueing. Untested.
*
* USLEEP - enable support for devices that don't disconnect. Untested.
*/
/*
* $Log: cumana_1.c,v $
* Revision 1.3 1998/05/03 20:45:32 alan
* ARM SCSI update. This adds the eesox driver and massively updates the
* Cumana driver. The folks who bought cumana arent anal retentive all
* docs are secret weenies so now there are docs ..
*
* Revision 1.2 1998/03/08 05:49:46 davem
* Merge to 2.1.89
*
* Revision 1.1 1998/02/23 02:45:22 davem
* Merge to 2.1.88
*
* Copyright 1995-2002, Russell King
*/
#include <linux/module.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/blk.h>
#include <linux/init.h>
......@@ -64,25 +21,16 @@
#include <scsi/scsicam.h>
#define CUMANASCSI_PUBLIC_RELEASE 1
static const card_ids cumanascsi_cids[] = {
{ MANU_CUMANA, PROD_CUMANA_SCSI_1 },
{ 0xffff, 0xffff }
};
#define NCR5380_implementation_fields \
int port, ctrl
#define NCR5380_local_declare() \
struct Scsi_Host *_instance
#define AUTOSENSE
#define PSEUDO_DMA
#define NCR5380_setup(instance) \
_instance = instance
#define CUMANASCSI_PUBLIC_RELEASE 1
#define NCR5380_implementation_fields int port, ctrl
#define NCR5380_local_declare() struct Scsi_Host *_instance
#define NCR5380_setup(instance) _instance = instance
#define NCR5380_read(reg) cumanascsi_read(_instance, reg)
#define NCR5380_write(reg, value) cumanascsi_write(_instance, reg, value)
#define NCR5380_intr cumanascsi_intr
#define NCR5380_queue_command cumanascsi_queue_command
#define NCR5380_proc_info cumanascsi_proc_info
......@@ -95,111 +43,12 @@ int NCR5380_proc_info(char *buffer, char **start, off_t offset,
#include "../../scsi/NCR5380.h"
/*
* Function : cumanascsi_setup(char *str, int *ints)
*
* Purpose : LILO command line initialization of the overrides array,
*
* Inputs : str - unused, ints - array of integer parameters with ints[0]
* equal to the number of ints.
*
*/
void cumanascsi_setup(char *str, int *ints)
{
}
#define CUMANA_ADDRESS(card) (ecard_address((card), ECARD_IOC, ECARD_SLOW) + 0x800)
#define CUMANA_IRQ(card) ((card)->irq)
/*
* Function : int cumanascsi_detect(Scsi_Host_Template * tpnt)
*
* Purpose : initializes cumana NCR5380 driver based on the
* command line / compile time port and irq definitions.
*
* Inputs : tpnt - template for this SCSI adapter.
*
* Returns : 1 if a host adapter was found, 0 if not.
*
*/
static struct expansion_card *ecs[4];
int cumanascsi_detect(Scsi_Host_Template * tpnt)
{
int count = 0;
struct Scsi_Host *instance;
tpnt->proc_name = "CumanaSCSI-1";
memset (ecs, 0, sizeof (ecs));
while(1) {
if((ecs[count] = ecard_find(0, cumanascsi_cids)) == NULL)
break;
instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata));
if (!instance)
break;
instance->io_port = CUMANA_ADDRESS(ecs[count]);
instance->irq = CUMANA_IRQ(ecs[count]);
NCR5380_init(instance, 0);
ecard_claim(ecs[count]);
instance->n_io_port = 255;
if ( !(request_region (instance->io_port, instance->n_io_port, "CumanaSCSI-1")) ) {
ecard_release(ecs[count]);
scsi_unregister(instance);
break;
}
((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0;
outb(0x00, instance->io_port - 577);
if (instance->irq != IRQ_NONE)
if (request_irq(instance->irq, cumanascsi_intr, SA_INTERRUPT, "CumanaSCSI-1", NULL)) {
printk("scsi%d: IRQ%d not free, interrupts disabled\n",
instance->host_no, instance->irq);
instance->irq = IRQ_NONE;
}
if (instance->irq == IRQ_NONE) {
printk("scsi%d: interrupts not enabled. for better interactive performance,\n", instance->host_no);
printk("scsi%d: please jumper the board for a free IRQ.\n", instance->host_no);
}
printk("scsi%d: at port %lX irq", instance->host_no, instance->io_port);
if (instance->irq == IRQ_NONE)
printk ("s disabled");
else
printk (" %d", instance->irq);
printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d",
tpnt->can_queue, tpnt->cmd_per_lun, CUMANASCSI_PUBLIC_RELEASE);
printk("\nscsi%d:", instance->host_no);
NCR5380_print_options(instance);
printk("\n");
++count;
}
return count;
}
int cumanascsi_release (struct Scsi_Host *shpnt)
const char *cumanascsi_info(struct Scsi_Host *spnt)
{
int i;
if (shpnt->irq != IRQ_NONE)
free_irq (shpnt->irq, NULL);
if (shpnt->io_port)
release_region (shpnt->io_port, shpnt->n_io_port);
for (i = 0; i < 4; i++)
if (shpnt->io_port == CUMANA_ADDRESS(ecs[i]))
ecard_release (ecs[i]);
return 0;
}
const char * cumanascsi_info (struct Scsi_Host *spnt) {
return "";
}
......@@ -219,8 +68,8 @@ const char * cumanascsi_info (struct Scsi_Host *spnt) {
#define L(v) (((v)<<16)|((v) & 0x0000ffff))
#define H(v) (((v)>>16)|((v) & 0xffff0000))
static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *addr,
int len)
static inline int
NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *addr, int len)
{
int *ctrl = &((struct NCR5380_hostdata *)instance->hostdata)->ctrl;
int oldctrl = *ctrl;
......@@ -289,8 +138,8 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *addr
return len;
}
static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *addr,
int len)
static inline int
NCR5380_pread(struct Scsi_Host *instance, unsigned char *addr, int len)
{
int *ctrl = &((struct NCR5380_hostdata *)instance->hostdata)->ctrl;
int oldctrl = *ctrl;
......@@ -367,7 +216,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *addr,
static char cumanascsi_read(struct Scsi_Host *instance, int reg)
{
int iobase = instance->io_port;
unsigned int iobase = instance->io_port;
int i;
int *ctrl = &((struct NCR5380_hostdata *)instance->hostdata)->ctrl;
......@@ -395,8 +244,6 @@ static void cumanascsi_write(struct Scsi_Host *instance, int reg, int value)
static Scsi_Host_Template cumanascsi_template = {
.module = THIS_MODULE,
.name = "Cumana 16-bit SCSI",
.detect = cumanascsi_detect,
.release = cumanascsi_release,
.info = cumanascsi_info,
.queuecommand = cumanascsi_queue_command,
.eh_abort_handler = NCR5380_abort,
......@@ -408,26 +255,101 @@ static Scsi_Host_Template cumanascsi_template = {
.sg_tablesize = SG_ALL,
.cmd_per_lun = 2,
.unchecked_isa_dma = 0,
.use_clustering = DISABLE_CLUSTERING
.use_clustering = DISABLE_CLUSTERING,
.proc_name = "CumanaSCSI-1",
};
static int __init cumanascsi_init(void)
static int __devinit
cumanascsi1_probe(struct expansion_card *ec, struct ecard_ids *id)
{
struct Scsi_Host *host;
int ret = -ENOMEM;
host = scsi_register (tpnt, sizeof(struct NCR5380_hostdata));
if (!host)
goto out;
host->io_port = ecard_address(ec, ECARD_IOC, ECARD_SLOW) + 0x800;
host->irq = ec->irq;
NCR5380_init(host, 0);
host->n_io_port = 255;
if (!(request_region(host->io_port, host->n_io_port, "CumanaSCSI-1"))) {
ret = -EBUSY;
goto out_free;
}
((struct NCR5380_hostdata *)host->hostdata)->ctrl = 0;
outb(0x00, host->io_port - 577);
ret = request_irq(host->irq, cumanascsi_intr, SA_INTERRUPT,
"CumanaSCSI-1", host);
if (ret) {
printk("scsi%d: IRQ%d not free: %d\n",
host->host_no, host->irq, ret);
goto out_release;
}
printk("scsi%d: at port 0x%08lx irq %d",
host->host_no, host->io_port, host->irq);
printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d",
tpnt->can_queue, tpnt->cmd_per_lun, CUMANASCSI_PUBLIC_RELEASE);
printk("\nscsi%d:", host->host_no);
NCR5380_print_options(host);
printk("\n");
ret = scsi_add_host(host);
if (ret == 0)
goto out;
free_irq(host->irq, host);
out_release:
release_region(host->io_port, host->n_io_port);
out_free:
scsi_unregister(host);
out:
return ret;
}
static void __devexit cumanascsi1_remove(struct expansion_card *ec)
{
scsi_register_host(&cumanascsi_template);
if (cumanascsi_template.present)
return 0;
struct Scsi_Host *host = ecard_get_drvdata(ec);
ecard_set_drvdata(ec, NULL);
scsi_unregister_host(&cumanascsi_template);
return -ENODEV;
scsi_remove_host(host);
free_irq(host->irq, host);
release_region(host->io_port, host->n_io_port);
scsi_remove(host);
}
static const struct ecard_ids cumanascsi1_cids[] = {
{ MANU_CUMANA, PROD_CUMANA_SCSI_1 },
{ 0xffff, 0xffff }
};
static struct ecard_driver cumanascsi1_driver = {
.probe = cumanascsi1_probe,
.remove = __devexit_p(cumanascsi1_remove),
.id_table = cumanascsi1_cids,
.drv = {
.name = "cumanascsi1",
},
};
static int __init cumanascsi_init(void)
{
return ecard_register_driver(&cumanascsi1_driver);
}
static void __exit cumanascsi_exit(void)
{
scsi_unregister_host(&cumanascsi_template);
ecard_remove_driver(&cumanascsi1_driver);
}
module_init(cumanascsi_init);
module_exit(cumanascsi_exit);
MODULE_DESCRIPTION("Cumana SCSI-1 driver for Acorn machines");
MODULE_LICENSE("GPL");
This diff is collapsed.
......@@ -45,6 +45,7 @@
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/blk.h>
......
This diff is collapsed.
This diff is collapsed.
......@@ -214,10 +214,22 @@ typedef enum {
typedef struct {
unsigned long magic_start;
spinlock_t host_lock;
struct Scsi_Host *host; /* host */
Scsi_Cmnd *SCpnt; /* currently processing command */
Scsi_Cmnd *origSCpnt; /* original connecting command */
Scsi_Cmnd *reqSCpnt; /* request sense command */
Scsi_Cmnd *rstSCpnt; /* reset command */
Scsi_Cmnd *pending_SCpnt[8]; /* per-device pending commands */
int next_pending; /* next pending device */
/*
* Error recovery
*/
wait_queue_head_t eh_wait;
struct timer_list eh_timer;
unsigned int rst_dev_status;
unsigned int rst_bus_status;
/* driver information */
struct {
......@@ -281,6 +293,8 @@ typedef struct {
/* per-device info */
struct fas216_device {
unsigned char disconnect_ok:1; /* device can disconnect */
unsigned char parity_enabled:1; /* parity checking enabled */
unsigned char parity_check:1; /* need to check parity checking */
unsigned char period; /* sync xfer period in (*4ns) */
unsigned char stp; /* synchronous transfer period */
unsigned char sof; /* synchronous offset register */
......
#define AUTOSENSE
/*#define PSEUDO_DMA*/
/*
* Oak Generic NCR5380 driver
*
* Copyright 1995, Russell King
*
* ALPHA RELEASE 1.
*
* For more information, please consult
*
* NCR 5380 Family
* SCSI Protocol Controller
* Databook
*
* NCR Microelectronics
* 1635 Aeroplaza Drive
* Colorado Springs, CO 80916
* 1+ (719) 578-3400
* 1+ (800) 334-5454
*/
/*
* Options :
*
* PARITY - enable parity checking. Not supported.
*
* SCSI2 - enable support for SCSI-II tagged queueing. Untested.
*
* USLEEP - enable support for devices that don't disconnect. Untested.
*/
/*
* $Log: oak.c,v $
* Revision 1.3 1998/05/03 20:45:37 alan
* ARM SCSI update. This adds the eesox driver and massively updates the
* Cumana driver. The folks who bought cumana arent anal retentive all
* docs are secret weenies so now there are docs ..
*
* Revision 1.2 1998/03/08 05:49:48 davem
* Merge to 2.1.89
*
* Revision 1.1 1998/02/23 02:45:27 davem
* Merge to 2.1.88
*
* Copyright 1995-2002, Russell King
*/
#include <linux/module.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/blk.h>
#include <linux/init.h>
......@@ -60,6 +19,9 @@
#include "../../scsi/scsi.h"
#include "../../scsi/hosts.h"
#define AUTOSENSE
/*#define PSEUDO_DMA*/
#define OAKSCSI_PUBLIC_RELEASE 1
#define NCR5380_read(reg) oakscsi_read(_instance, reg)
......@@ -71,14 +33,9 @@
int NCR5380_proc_info(char *buffer, char **start, off_t offset,
int length, int hostno, int inout);
#define NCR5380_implementation_fields \
int port, ctrl
#define NCR5380_local_declare() \
struct Scsi_Host *_instance
#define NCR5380_setup(instance) \
_instance = instance
#define NCR5380_implementation_fields int port, ctrl
#define NCR5380_local_declare() struct Scsi_Host *_instance
#define NCR5380_setup(instance) _instance = instance
#define BOARD_NORMAL 0
#define BOARD_NCR53C400 1
......@@ -88,105 +45,8 @@ int NCR5380_proc_info(char *buffer, char **start, off_t offset,
#undef START_DMA_INITIATOR_RECEIVE_REG
#define START_DMA_INITIATOR_RECEIVE_REG (7 + 128)
static const card_ids oakscsi_cids[] = {
{ MANU_OAK, PROD_OAK_SCSI },
{ 0xffff, 0xffff }
};
#define OAK_ADDRESS(card) (ecard_address((card), ECARD_MEMC, 0))
#define OAK_IRQ(card) (IRQ_NONE)
/*
* Function : int oakscsi_detect(Scsi_Host_Template * tpnt)
*
* Purpose : initializes oak NCR5380 driver based on the
* command line / compile time port and irq definitions.
*
* Inputs : tpnt - template for this SCSI adapter.
*
* Returns : 1 if a host adapter was found, 0 if not.
*
*/
static struct expansion_card *ecs[4];
int oakscsi_detect(Scsi_Host_Template * tpnt)
{
int count = 0;
struct Scsi_Host *instance;
tpnt->proc_name = "oakscsi";
memset (ecs, 0, sizeof (ecs));
ecard_startfind ();
while(1) {
if ((ecs[count] = ecard_find(0, oakscsi_cids)) == NULL)
break;
instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata));
if (!instance)
break;
instance->io_port = OAK_ADDRESS(ecs[count]);
instance->irq = OAK_IRQ(ecs[count]);
NCR5380_init(instance, 0);
ecard_claim(ecs[count]);
instance->n_io_port = 255;
if (!request_region (instance->io_port, instance->n_io_port, "Oak SCSI")) {
ecard_release(ecs[count]);
scsi_unregister(instance);
break;
}
if (instance->irq != IRQ_NONE)
if (request_irq(instance->irq, oakscsi_intr, SA_INTERRUPT, "Oak SCSI", NULL)) {
printk("scsi%d: IRQ%d not free, interrupts disabled\n",
instance->host_no, instance->irq);
instance->irq = IRQ_NONE;
}
if (instance->irq != IRQ_NONE) {
printk("scsi%d: eek! Interrupts enabled, but I don't think\n", instance->host_no);
printk("scsi%d: that the board had an interrupt!\n", instance->host_no);
}
printk("scsi%d: at port %lX irq", instance->host_no, instance->io_port);
if (instance->irq == IRQ_NONE)
printk ("s disabled");
else
printk (" %d", instance->irq);
printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d",
tpnt->can_queue, tpnt->cmd_per_lun, OAKSCSI_PUBLIC_RELEASE);
printk("\nscsi%d:", instance->host_no);
NCR5380_print_options(instance);
printk("\n");
++count;
}
#ifdef MODULE
if(count == 0)
printk("No oak scsi devices found\n");
#endif
return count;
}
int oakscsi_release (struct Scsi_Host *shpnt)
const char * oakscsi_info (struct Scsi_Host *spnt)
{
int i;
if (shpnt->irq != IRQ_NONE)
free_irq (shpnt->irq, NULL);
if (shpnt->io_port)
release_region (shpnt->io_port, shpnt->n_io_port);
for (i = 0; i < 4; i++)
if (shpnt->io_port == OAK_ADDRESS(ecs[i]))
ecard_release (ecs[i]);
return 0;
}
const char * oakscsi_info (struct Scsi_Host *spnt) {
return "";
}
......@@ -258,8 +118,6 @@ static Scsi_Host_Template oakscsi_template = {
.module = THIS_MODULE,
.proc_info = oakscsi_proc_info,
.name = "Oak 16-bit SCSI",
.detect = oakscsi_detect,
.release = oakscsi_release,
.info = oakscsi_info,
.queuecommand = oakscsi_queue_command,
.eh_abort_handler = NCR5380_abort,
......@@ -270,22 +128,82 @@ static Scsi_Host_Template oakscsi_template = {
.this_id = 7,
.sg_tablesize = SG_ALL,
.cmd_per_lun = 2,
.use_clustering = DISABLE_CLUSTERING
.use_clustering = DISABLE_CLUSTERING,
.proc_name = "oakscsi",
};
static int __init oakscsi_init(void)
static int __devinit
oakscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
{
scsi_register_host(&oakscsi_template);
if (oakscsi_template.present)
return 0;
struct Scsi_Host *host;
int ret = -ENOMEM;
host = scsi_register (tpnt, sizeof(struct NCR5380_hostdata));
if (!host)
goto out;
host->io_port = ecard_address(ec, ECARD_MEMC, 0)
host->irq = IRQ_NONE;
host->n_io_port = 255;
scsi_unregister_host(&oakscsi_template);
return -ENODEV;
ret = -EBUSY;
if (!request_region (host->io_port, host->n_io_port, "Oak SCSI"))
goto unreg;
NCR5380_init(host, 0);
printk("scsi%d: at port 0x%08lx irqs disabled",
host->host_no, host->io_port);
printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d",
tpnt->can_queue, tpnt->cmd_per_lun, OAKSCSI_PUBLIC_RELEASE);
printk("\nscsi%d:", host->host_no);
NCR5380_print_options(host);
printk("\n");
ret = scsi_add_host(host);
if (ret == 0)
goto out;
release_region(host->io_port, host->n_io_port);
unreg:
scsi_unregister(host);
out:
return ret;
}
static void __devexit oakscsi_remove(struct expansion_card *ec)
{
struct Scsi_Host *host = ecard_get_drvdata(ec);
ecard_set_drvdata(ec, NULL);
scsi_remove_host(host);
release_region(host->io_port, host->n_io_port);
scsi_unregister(host);
}
static const struct ecard_id oakscsi_cids[] = {
{ MANU_OAK, PROD_OAK_SCSI },
{ 0xffff, 0xffff }
};
static struct ecard_driver oakscsi_driver = {
.probe = oakscsi_probe,
.remove = __devexit_p(oakscsi_remove),
.id_table = oakscsi_cids,
.drv = {
.name = "oakscsi",
},
};
static int __init oakscsi_init(void)
{
return ecard_register_driver(&oakscsi_driver);
}
static void __exit oakscsi_exit(void)
{
scsi_unregister_host(&oakscsi_template);
ecard_remove_driver(&oakscsi_driver);
}
module_init(oakscsi_init);
......
This diff is collapsed.
......@@ -228,6 +228,27 @@ Scsi_Cmnd *queue_remove_tgtluntag (Queue_t *queue, int target, int lun, int tag)
return SCpnt;
}
/*
* Function: queue_remove_all_target(queue, target)
* Purpose : remove all SCSI commands from the queue for a specified target
* Params : queue - queue to remove command from
* target - target device id
* Returns : nothing
*/
void queue_remove_all_target(Queue_t *queue, int target)
{
unsigned long flags;
struct list_head *l;
spin_lock_irqsave(&queue->queue_lock, flags);
list_for_each(l, &queue->head) {
QE_t *q = list_entry(l, QE_t, list);
if (q->SCpnt->target == target)
__queue_remove(queue, l);
}
spin_unlock_irqrestore(&queue->queue_lock, flags);
}
/*
* Function: int queue_probetgtlun (queue, target, lun)
* Purpose : check to see if we have a command in the queue for the specified
......@@ -290,6 +311,7 @@ EXPORT_SYMBOL(queue_remove);
EXPORT_SYMBOL(queue_remove_exclude);
EXPORT_SYMBOL(queue_remove_tgtluntag);
EXPORT_SYMBOL(queue_remove_cmd);
EXPORT_SYMBOL(queue_remove_all_target);
EXPORT_SYMBOL(queue_probetgtlun);
MODULE_AUTHOR("Russell King");
......
......@@ -73,6 +73,15 @@ extern int __queue_add(Queue_t *queue, Scsi_Cmnd *SCpnt, int head);
*/
extern Scsi_Cmnd *queue_remove_tgtluntag (Queue_t *queue, int target, int lun, int tag);
/*
* Function: queue_remove_all_target(queue, target)
* Purpose : remove all SCSI commands from the queue for a specified target
* Params : queue - queue to remove command from
* target - target device id
* Returns : nothing
*/
extern void queue_remove_all_target(Queue_t *queue, int target);
/*
* Function: int queue_probetgtlun (queue, target, lun)
* Purpose : check to see if we have a command in the queue for the specified
......
This diff is collapsed.
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