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;
scsi_unregister_host(&acornscsi_template);
return -ENODEV;
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;
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;
static int __init init_arxe_scsi_driver(void)
host = scsi_register(&arxescsi_template, sizeof(struct arxescsi_info));
if (!host)
goto out;
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);
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);
}
scsi_unregister_host(&arxescsi_template);
return -ENODEV;
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);
......
This diff is collapsed.
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 */
......
This diff is collapsed.
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
......
......@@ -53,6 +53,9 @@
#define MANU_SERPORT 0x003f
#define PROD_SERPORT_DSPORT 0x00b9
#define MANU_ARXE 0x0041
#define PROD_ARXE_SCSI 0x00be
#define MANU_I3 0x0046
#define PROD_I3_ETHERLAN500 0x00d4
#define PROD_I3_ETHERLAN600 0x00ec
......@@ -95,11 +98,11 @@ typedef enum { /* Speed for ECARD_IOC space */
ECARD_SYNC = 3
} card_speed_t;
typedef struct ecard_id { /* Card ID structure */
struct ecard_id { /* Card ID structure */
unsigned short manufacturer;
unsigned short product;
void *data;
} card_ids;
};
struct in_ecid { /* Packed card ID information */
unsigned short product; /* Product code */
......@@ -177,16 +180,6 @@ struct in_chunk_dir {
*/
#define ecard_release(ec) ((ec)->claimed = 0)
/*
* Start finding cards from the top of the list
*/
extern void ecard_startfind (void);
/*
* Find an expansion card with the correct cid, product and manufacturer code
*/
extern struct expansion_card *ecard_find (int cid, const card_ids *ids);
/*
* Read a chunk from an expansion card
* cd : where to put read data
......
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