ahb -> sc
This commit is contained in:
parent
f857b38b11
commit
5b8d7c943e
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: aha1742.c,v 1.59 1996/04/09 22:47:00 cgd Exp $ */
|
/* $NetBSD: aha1742.c,v 1.60 1996/05/05 03:12:47 mycroft Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994 Charles Hannum. All rights reserved.
|
* Copyright (c) 1994 Charles Hannum. All rights reserved.
|
||||||
|
@ -331,13 +331,13 @@ struct cfdriver ahb_cd = {
|
||||||
* Function to send a command out through a mailbox
|
* Function to send a command out through a mailbox
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ahb_send_mbox(ahb, opcode, ecb)
|
ahb_send_mbox(sc, opcode, ecb)
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
int opcode;
|
int opcode;
|
||||||
struct ahb_ecb *ecb;
|
struct ahb_ecb *ecb;
|
||||||
{
|
{
|
||||||
bus_chipset_tag_t bc = ahb->sc_bc;
|
bus_chipset_tag_t bc = sc->sc_bc;
|
||||||
bus_io_handle_t ioh = ahb->sc_ioh;
|
bus_io_handle_t ioh = sc->sc_ioh;
|
||||||
int wait = 300; /* 1ms should be enough */
|
int wait = 300; /* 1ms should be enough */
|
||||||
|
|
||||||
while (--wait) {
|
while (--wait) {
|
||||||
|
@ -347,7 +347,7 @@ ahb_send_mbox(ahb, opcode, ecb)
|
||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
if (!wait) {
|
if (!wait) {
|
||||||
printf("%s: board not responding\n", ahb->sc_dev.dv_xname);
|
printf("%s: board not responding\n", sc->sc_dev.dv_xname);
|
||||||
Debugger();
|
Debugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,13 +359,13 @@ ahb_send_mbox(ahb, opcode, ecb)
|
||||||
* Function to poll for command completion when in poll mode
|
* Function to poll for command completion when in poll mode
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ahb_poll(ahb, xs, count)
|
ahb_poll(sc, xs, count)
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
struct scsi_xfer *xs;
|
struct scsi_xfer *xs;
|
||||||
int count;
|
int count;
|
||||||
{ /* in msec */
|
{ /* in msec */
|
||||||
bus_chipset_tag_t bc = ahb->sc_bc;
|
bus_chipset_tag_t bc = sc->sc_bc;
|
||||||
bus_io_handle_t ioh = ahb->sc_ioh;
|
bus_io_handle_t ioh = sc->sc_ioh;
|
||||||
|
|
||||||
while (count) {
|
while (count) {
|
||||||
/*
|
/*
|
||||||
|
@ -373,7 +373,7 @@ ahb_poll(ahb, xs, count)
|
||||||
* have got an interrupt?
|
* have got an interrupt?
|
||||||
*/
|
*/
|
||||||
if (bus_io_read_1(bc, ioh, G2STAT) & G2STAT_INT_PEND)
|
if (bus_io_read_1(bc, ioh, G2STAT) & G2STAT_INT_PEND)
|
||||||
ahbintr(ahb);
|
ahbintr(sc);
|
||||||
if (xs->flags & ITSDONE)
|
if (xs->flags & ITSDONE)
|
||||||
return 0;
|
return 0;
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
@ -386,13 +386,13 @@ ahb_poll(ahb, xs, count)
|
||||||
* Function to send an immediate type command to the adapter
|
* Function to send an immediate type command to the adapter
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ahb_send_immed(ahb, target, cmd)
|
ahb_send_immed(sc, target, cmd)
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
int target;
|
int target;
|
||||||
u_long cmd;
|
u_long cmd;
|
||||||
{
|
{
|
||||||
bus_chipset_tag_t bc = ahb->sc_bc;
|
bus_chipset_tag_t bc = sc->sc_bc;
|
||||||
bus_io_handle_t ioh = ahb->sc_ioh;
|
bus_io_handle_t ioh = sc->sc_ioh;
|
||||||
int wait = 100; /* 1 ms enough? */
|
int wait = 100; /* 1 ms enough? */
|
||||||
|
|
||||||
while (--wait) {
|
while (--wait) {
|
||||||
|
@ -402,7 +402,7 @@ ahb_send_immed(ahb, target, cmd)
|
||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
if (!wait) {
|
if (!wait) {
|
||||||
printf("%s: board not responding\n", ahb->sc_dev.dv_xname);
|
printf("%s: board not responding\n", sc->sc_dev.dv_xname);
|
||||||
Debugger();
|
Debugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,33 +466,33 @@ ahbattach(parent, self, aux)
|
||||||
void *aux;
|
void *aux;
|
||||||
{
|
{
|
||||||
struct eisa_attach_args *ea = aux;
|
struct eisa_attach_args *ea = aux;
|
||||||
struct ahb_softc *ahb = (void *)self;
|
struct ahb_softc *sc = (void *)self;
|
||||||
bus_chipset_tag_t bc = ea->ea_bc;
|
bus_chipset_tag_t bc = ea->ea_bc;
|
||||||
bus_io_handle_t ioh;
|
bus_io_handle_t ioh;
|
||||||
eisa_chipset_tag_t ec = ea->ea_ec;
|
eisa_chipset_tag_t ec = ea->ea_ec;
|
||||||
eisa_intr_handle_t ih;
|
eisa_intr_handle_t ih;
|
||||||
const char *model, *intrstr;
|
const char *model, *intrstr;
|
||||||
|
|
||||||
ahb->sc_bc = bc;
|
sc->sc_bc = bc;
|
||||||
ahb->sc_ec = ec;
|
sc->sc_ec = ec;
|
||||||
|
|
||||||
if (bus_io_map(bc, EISA_SLOT_ADDR(ea->ea_slot), EISA_SLOT_SIZE, &ioh))
|
if (bus_io_map(bc, EISA_SLOT_ADDR(ea->ea_slot), EISA_SLOT_SIZE, &ioh))
|
||||||
panic("ahbattach: could not map I/O addresses");
|
panic("ahbattach: could not map I/O addresses");
|
||||||
ahb->sc_ioh = ioh;
|
sc->sc_ioh = ioh;
|
||||||
if (ahb_find(bc, ioh, ahb))
|
if (ahb_find(bc, ioh, sc))
|
||||||
panic("ahbattach: ahb_find failed!");
|
panic("ahbattach: ahb_find failed!");
|
||||||
|
|
||||||
ahb_init(ahb);
|
ahb_init(sc);
|
||||||
TAILQ_INIT(&ahb->free_ecb);
|
TAILQ_INIT(&sc->free_ecb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fill in the prototype scsi_link.
|
* fill in the prototype scsi_link.
|
||||||
*/
|
*/
|
||||||
ahb->sc_link.adapter_softc = ahb;
|
sc->sc_link.adapter_softc = sc;
|
||||||
ahb->sc_link.adapter_target = ahb->ahb_scsi_dev;
|
sc->sc_link.adapter_target = sc->ahb_scsi_dev;
|
||||||
ahb->sc_link.adapter = &ahb_switch;
|
sc->sc_link.adapter = &ahb_switch;
|
||||||
ahb->sc_link.device = &ahb_dev;
|
sc->sc_link.device = &ahb_dev;
|
||||||
ahb->sc_link.openings = 2;
|
sc->sc_link.openings = 2;
|
||||||
|
|
||||||
if (!strcmp(ea->ea_idstring, "ADP0000"))
|
if (!strcmp(ea->ea_idstring, "ADP0000"))
|
||||||
model = EISA_PRODUCT_ADP0000;
|
model = EISA_PRODUCT_ADP0000;
|
||||||
|
@ -506,30 +506,30 @@ ahbattach(parent, self, aux)
|
||||||
model = "unknown model!";
|
model = "unknown model!";
|
||||||
printf(": %s\n", model);
|
printf(": %s\n", model);
|
||||||
|
|
||||||
if (eisa_intr_map(ec, ahb->sc_irq, &ih)) {
|
if (eisa_intr_map(ec, sc->sc_irq, &ih)) {
|
||||||
printf("%s: couldn't map interrupt (%d)\n",
|
printf("%s: couldn't map interrupt (%d)\n",
|
||||||
ahb->sc_dev.dv_xname, ahb->sc_irq);
|
sc->sc_dev.dv_xname, sc->sc_irq);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
intrstr = eisa_intr_string(ec, ih);
|
intrstr = eisa_intr_string(ec, ih);
|
||||||
ahb->sc_ih = eisa_intr_establish(ec, ih, IST_LEVEL, IPL_BIO,
|
sc->sc_ih = eisa_intr_establish(ec, ih, IST_LEVEL, IPL_BIO,
|
||||||
ahbintr, ahb);
|
ahbintr, sc);
|
||||||
if (ahb->sc_ih == NULL) {
|
if (sc->sc_ih == NULL) {
|
||||||
printf("%s: couldn't establish interrupt",
|
printf("%s: couldn't establish interrupt",
|
||||||
ahb->sc_dev.dv_xname);
|
sc->sc_dev.dv_xname);
|
||||||
if (intrstr != NULL)
|
if (intrstr != NULL)
|
||||||
printf(" at %s", intrstr);
|
printf(" at %s", intrstr);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (intrstr != NULL)
|
if (intrstr != NULL)
|
||||||
printf("%s: interrupting at %s\n", ahb->sc_dev.dv_xname,
|
printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname,
|
||||||
intrstr);
|
intrstr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ask the adapter what subunits are present
|
* ask the adapter what subunits are present
|
||||||
*/
|
*/
|
||||||
config_found(self, &ahb->sc_link, ahbprint);
|
config_found(self, &sc->sc_link, ahbprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -539,15 +539,15 @@ int
|
||||||
ahbintr(arg)
|
ahbintr(arg)
|
||||||
void *arg;
|
void *arg;
|
||||||
{
|
{
|
||||||
struct ahb_softc *ahb = arg;
|
struct ahb_softc *sc = arg;
|
||||||
bus_chipset_tag_t bc = ahb->sc_bc;
|
bus_chipset_tag_t bc = sc->sc_bc;
|
||||||
bus_io_handle_t ioh = ahb->sc_ioh;
|
bus_io_handle_t ioh = sc->sc_ioh;
|
||||||
struct ahb_ecb *ecb;
|
struct ahb_ecb *ecb;
|
||||||
u_char ahbstat;
|
u_char ahbstat;
|
||||||
u_long mboxval;
|
u_long mboxval;
|
||||||
|
|
||||||
#ifdef AHBDEBUG
|
#ifdef AHBDEBUG
|
||||||
printf("%s: ahbintr ", ahb->sc_dev.dv_xname);
|
printf("%s: ahbintr ", sc->sc_dev.dv_xname);
|
||||||
#endif /* AHBDEBUG */
|
#endif /* AHBDEBUG */
|
||||||
|
|
||||||
if ((bus_io_read_1(bc, ioh, G2STAT) & G2STAT_INT_PEND) == 0)
|
if ((bus_io_read_1(bc, ioh, G2STAT) & G2STAT_INT_PEND) == 0)
|
||||||
|
@ -573,10 +573,10 @@ ahbintr(arg)
|
||||||
case AHB_ECB_OK:
|
case AHB_ECB_OK:
|
||||||
case AHB_ECB_RECOVERED:
|
case AHB_ECB_RECOVERED:
|
||||||
case AHB_ECB_ERR:
|
case AHB_ECB_ERR:
|
||||||
ecb = ahb_ecb_phys_kv(ahb, mboxval);
|
ecb = ahb_ecb_phys_kv(sc, mboxval);
|
||||||
if (!ecb) {
|
if (!ecb) {
|
||||||
printf("%s: BAD ECB RETURNED!\n",
|
printf("%s: BAD ECB RETURNED!\n",
|
||||||
ahb->sc_dev.dv_xname);
|
sc->sc_dev.dv_xname);
|
||||||
continue; /* whatever it was, it'll timeout */
|
continue; /* whatever it was, it'll timeout */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -584,13 +584,13 @@ ahbintr(arg)
|
||||||
case AHB_IMMED_ERR:
|
case AHB_IMMED_ERR:
|
||||||
ecb->flags |= ECB_IMMED_FAIL;
|
ecb->flags |= ECB_IMMED_FAIL;
|
||||||
case AHB_IMMED_OK:
|
case AHB_IMMED_OK:
|
||||||
ecb = ahb->immed_ecb;
|
ecb = sc->immed_ecb;
|
||||||
ahb->immed_ecb = 0;
|
sc->immed_ecb = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("%s: unexpected interrupt %x\n",
|
printf("%s: unexpected interrupt %x\n",
|
||||||
ahb->sc_dev.dv_xname, ahbstat);
|
sc->sc_dev.dv_xname, ahbstat);
|
||||||
ecb = 0;
|
ecb = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -602,7 +602,7 @@ ahbintr(arg)
|
||||||
printf("<int ecb(%x)>", ecb);
|
printf("<int ecb(%x)>", ecb);
|
||||||
#endif /*AHBDEBUG */
|
#endif /*AHBDEBUG */
|
||||||
untimeout(ahb_timeout, ecb);
|
untimeout(ahb_timeout, ecb);
|
||||||
ahb_done(ahb, ecb);
|
ahb_done(sc, ecb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bus_io_read_1(bc, ioh, G2STAT) & G2STAT_INT_PEND) == 0)
|
if ((bus_io_read_1(bc, ioh, G2STAT) & G2STAT_INT_PEND) == 0)
|
||||||
|
@ -615,8 +615,8 @@ ahbintr(arg)
|
||||||
* how the operation went.
|
* how the operation went.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ahb_done(ahb, ecb)
|
ahb_done(sc, ecb)
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
struct ahb_ecb *ecb;
|
struct ahb_ecb *ecb;
|
||||||
{
|
{
|
||||||
struct ahb_ecb_status *stat = &ecb->ecb_status;
|
struct ahb_ecb_status *stat = &ecb->ecb_status;
|
||||||
|
@ -629,7 +629,7 @@ ahb_done(ahb, ecb)
|
||||||
* into the xfer and call whoever started it
|
* into the xfer and call whoever started it
|
||||||
*/
|
*/
|
||||||
if ((xs->flags & INUSE) == 0) {
|
if ((xs->flags & INUSE) == 0) {
|
||||||
printf("%s: exiting but not in use!\n", ahb->sc_dev.dv_xname);
|
printf("%s: exiting but not in use!\n", sc->sc_dev.dv_xname);
|
||||||
Debugger();
|
Debugger();
|
||||||
}
|
}
|
||||||
if (ecb->flags & ECB_IMMED) {
|
if (ecb->flags & ECB_IMMED) {
|
||||||
|
@ -653,7 +653,7 @@ ahb_done(ahb, ecb)
|
||||||
break;
|
break;
|
||||||
default: /* Other scsi protocol messes */
|
default: /* Other scsi protocol messes */
|
||||||
printf("%s: host_stat %x\n",
|
printf("%s: host_stat %x\n",
|
||||||
ahb->sc_dev.dv_xname, stat->host_stat);
|
sc->sc_dev.dv_xname, stat->host_stat);
|
||||||
xs->error = XS_DRIVER_STUFFUP;
|
xs->error = XS_DRIVER_STUFFUP;
|
||||||
}
|
}
|
||||||
} else if (stat->target_stat != SCSI_OK) {
|
} else if (stat->target_stat != SCSI_OK) {
|
||||||
|
@ -669,7 +669,7 @@ ahb_done(ahb, ecb)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("%s: target_stat %x\n",
|
printf("%s: target_stat %x\n",
|
||||||
ahb->sc_dev.dv_xname, stat->target_stat);
|
sc->sc_dev.dv_xname, stat->target_stat);
|
||||||
xs->error = XS_DRIVER_STUFFUP;
|
xs->error = XS_DRIVER_STUFFUP;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -677,7 +677,7 @@ ahb_done(ahb, ecb)
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
xs->flags |= ITSDONE;
|
xs->flags |= ITSDONE;
|
||||||
ahb_free_ecb(ahb, ecb, xs->flags);
|
ahb_free_ecb(sc, ecb, xs->flags);
|
||||||
scsi_done(xs);
|
scsi_done(xs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,8 +686,8 @@ done:
|
||||||
* free list.
|
* free list.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ahb_free_ecb(ahb, ecb, flags)
|
ahb_free_ecb(sc, ecb, flags)
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
struct ahb_ecb *ecb;
|
struct ahb_ecb *ecb;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
|
@ -696,21 +696,21 @@ ahb_free_ecb(ahb, ecb, flags)
|
||||||
s = splbio();
|
s = splbio();
|
||||||
|
|
||||||
ecb->flags = ECB_FREE;
|
ecb->flags = ECB_FREE;
|
||||||
TAILQ_INSERT_HEAD(&ahb->free_ecb, ecb, chain);
|
TAILQ_INSERT_HEAD(&sc->free_ecb, ecb, chain);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there were none, wake anybody waiting for one to come free,
|
* If there were none, wake anybody waiting for one to come free,
|
||||||
* starting with queued entries.
|
* starting with queued entries.
|
||||||
*/
|
*/
|
||||||
if (ecb->chain.tqe_next == 0)
|
if (ecb->chain.tqe_next == 0)
|
||||||
wakeup(&ahb->free_ecb);
|
wakeup(&sc->free_ecb);
|
||||||
|
|
||||||
splx(s);
|
splx(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
ahb_init_ecb(ahb, ecb)
|
ahb_init_ecb(sc, ecb)
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
struct ahb_ecb *ecb;
|
struct ahb_ecb *ecb;
|
||||||
{
|
{
|
||||||
int hashnum;
|
int hashnum;
|
||||||
|
@ -722,13 +722,13 @@ ahb_init_ecb(ahb, ecb)
|
||||||
*/
|
*/
|
||||||
ecb->hashkey = KVTOPHYS(ecb);
|
ecb->hashkey = KVTOPHYS(ecb);
|
||||||
hashnum = ECB_HASH(ecb->hashkey);
|
hashnum = ECB_HASH(ecb->hashkey);
|
||||||
ecb->nexthash = ahb->ecbhash[hashnum];
|
ecb->nexthash = sc->ecbhash[hashnum];
|
||||||
ahb->ecbhash[hashnum] = ecb;
|
sc->ecbhash[hashnum] = ecb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
ahb_reset_ecb(ahb, ecb)
|
ahb_reset_ecb(sc, ecb)
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
struct ahb_ecb *ecb;
|
struct ahb_ecb *ecb;
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -741,8 +741,8 @@ ahb_reset_ecb(ahb, ecb)
|
||||||
* hash table too otherwise either return an error or sleep.
|
* hash table too otherwise either return an error or sleep.
|
||||||
*/
|
*/
|
||||||
struct ahb_ecb *
|
struct ahb_ecb *
|
||||||
ahb_get_ecb(ahb, flags)
|
ahb_get_ecb(sc, flags)
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
struct ahb_ecb *ecb;
|
struct ahb_ecb *ecb;
|
||||||
|
@ -755,29 +755,29 @@ ahb_get_ecb(ahb, flags)
|
||||||
* but only if we can't allocate a new one.
|
* but only if we can't allocate a new one.
|
||||||
*/
|
*/
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ecb = ahb->free_ecb.tqh_first;
|
ecb = sc->free_ecb.tqh_first;
|
||||||
if (ecb) {
|
if (ecb) {
|
||||||
TAILQ_REMOVE(&ahb->free_ecb, ecb, chain);
|
TAILQ_REMOVE(&sc->free_ecb, ecb, chain);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ahb->numecbs < AHB_ECB_MAX) {
|
if (sc->numecbs < AHB_ECB_MAX) {
|
||||||
if (ecb = (struct ahb_ecb *) malloc(sizeof(struct ahb_ecb),
|
if (ecb = (struct ahb_ecb *) malloc(sizeof(struct ahb_ecb),
|
||||||
M_TEMP, M_NOWAIT)) {
|
M_TEMP, M_NOWAIT)) {
|
||||||
ahb_init_ecb(ahb, ecb);
|
ahb_init_ecb(sc, ecb);
|
||||||
ahb->numecbs++;
|
sc->numecbs++;
|
||||||
} else {
|
} else {
|
||||||
printf("%s: can't malloc ecb\n",
|
printf("%s: can't malloc ecb\n",
|
||||||
ahb->sc_dev.dv_xname);
|
sc->sc_dev.dv_xname);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((flags & SCSI_NOSLEEP) != 0)
|
if ((flags & SCSI_NOSLEEP) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
tsleep(&ahb->free_ecb, PRIBIO, "ahbecb", 0);
|
tsleep(&sc->free_ecb, PRIBIO, "ahbecb", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ahb_reset_ecb(ahb, ecb);
|
ahb_reset_ecb(sc, ecb);
|
||||||
ecb->flags = ECB_ACTIVE;
|
ecb->flags = ECB_ACTIVE;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@ -789,12 +789,12 @@ out:
|
||||||
* given a physical address, find the ecb that it corresponds to.
|
* given a physical address, find the ecb that it corresponds to.
|
||||||
*/
|
*/
|
||||||
struct ahb_ecb *
|
struct ahb_ecb *
|
||||||
ahb_ecb_phys_kv(ahb, ecb_phys)
|
ahb_ecb_phys_kv(sc, ecb_phys)
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
physaddr ecb_phys;
|
physaddr ecb_phys;
|
||||||
{
|
{
|
||||||
int hashnum = ECB_HASH(ecb_phys);
|
int hashnum = ECB_HASH(ecb_phys);
|
||||||
struct ahb_ecb *ecb = ahb->ecbhash[hashnum];
|
struct ahb_ecb *ecb = sc->ecbhash[hashnum];
|
||||||
|
|
||||||
while (ecb) {
|
while (ecb) {
|
||||||
if (ecb->hashkey == ecb_phys)
|
if (ecb->hashkey == ecb_phys)
|
||||||
|
@ -808,10 +808,10 @@ ahb_ecb_phys_kv(ahb, ecb_phys)
|
||||||
* Start the board, ready for normal operation
|
* Start the board, ready for normal operation
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ahb_find(bc, ioh, ahb)
|
ahb_find(bc, ioh, sc)
|
||||||
bus_chipset_tag_t bc;
|
bus_chipset_tag_t bc;
|
||||||
bus_io_handle_t ioh;
|
bus_io_handle_t ioh;
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
{
|
{
|
||||||
u_char intdef;
|
u_char intdef;
|
||||||
int i, irq, busid;
|
int i, irq, busid;
|
||||||
|
@ -888,9 +888,9 @@ ahb_find(bc, ioh, ahb)
|
||||||
busid = (bus_io_read_1(bc, ioh, SCSIDEF) & HSCSIID);
|
busid = (bus_io_read_1(bc, ioh, SCSIDEF) & HSCSIID);
|
||||||
|
|
||||||
/* if we want to fill in softc, do so now */
|
/* if we want to fill in softc, do so now */
|
||||||
if (ahb != NULL) {
|
if (sc != NULL) {
|
||||||
ahb->sc_irq = irq;
|
sc->sc_irq = irq;
|
||||||
ahb->ahb_scsi_dev = busid;
|
sc->ahb_scsi_dev = busid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -900,8 +900,8 @@ ahb_find(bc, ioh, ahb)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ahb_init(ahb)
|
ahb_init(sc)
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -925,7 +925,7 @@ ahb_scsi_cmd(xs)
|
||||||
struct scsi_xfer *xs;
|
struct scsi_xfer *xs;
|
||||||
{
|
{
|
||||||
struct scsi_link *sc_link = xs->sc_link;
|
struct scsi_link *sc_link = xs->sc_link;
|
||||||
struct ahb_softc *ahb = sc_link->adapter_softc;
|
struct ahb_softc *sc = sc_link->adapter_softc;
|
||||||
struct ahb_ecb *ecb;
|
struct ahb_ecb *ecb;
|
||||||
struct ahb_dma_seg *sg;
|
struct ahb_dma_seg *sg;
|
||||||
int seg; /* scatter gather seg being worked on */
|
int seg; /* scatter gather seg being worked on */
|
||||||
|
@ -942,11 +942,11 @@ ahb_scsi_cmd(xs)
|
||||||
*/
|
*/
|
||||||
flags = xs->flags;
|
flags = xs->flags;
|
||||||
if ((flags & (ITSDONE|INUSE)) != INUSE) {
|
if ((flags & (ITSDONE|INUSE)) != INUSE) {
|
||||||
printf("%s: done or not in use?\n", ahb->sc_dev.dv_xname);
|
printf("%s: done or not in use?\n", sc->sc_dev.dv_xname);
|
||||||
xs->flags &= ~ITSDONE;
|
xs->flags &= ~ITSDONE;
|
||||||
xs->flags |= INUSE;
|
xs->flags |= INUSE;
|
||||||
}
|
}
|
||||||
if ((ecb = ahb_get_ecb(ahb, flags)) == NULL) {
|
if ((ecb = ahb_get_ecb(sc, flags)) == NULL) {
|
||||||
xs->error = XS_DRIVER_STUFFUP;
|
xs->error = XS_DRIVER_STUFFUP;
|
||||||
return TRY_AGAIN_LATER;
|
return TRY_AGAIN_LATER;
|
||||||
}
|
}
|
||||||
|
@ -960,13 +960,13 @@ ahb_scsi_cmd(xs)
|
||||||
*/
|
*/
|
||||||
if (flags & SCSI_RESET) {
|
if (flags & SCSI_RESET) {
|
||||||
ecb->flags |= ECB_IMMED;
|
ecb->flags |= ECB_IMMED;
|
||||||
if (ahb->immed_ecb)
|
if (sc->immed_ecb)
|
||||||
return TRY_AGAIN_LATER;
|
return TRY_AGAIN_LATER;
|
||||||
ahb->immed_ecb = ecb;
|
sc->immed_ecb = ecb;
|
||||||
|
|
||||||
s = splbio();
|
s = splbio();
|
||||||
|
|
||||||
ahb_send_immed(ahb, sc_link->target, AHB_TARG_RESET);
|
ahb_send_immed(sc, sc_link->target, AHB_TARG_RESET);
|
||||||
|
|
||||||
if ((flags & SCSI_POLL) == 0) {
|
if ((flags & SCSI_POLL) == 0) {
|
||||||
timeout(ahb_timeout, ecb, (xs->timeout * hz) / 1000);
|
timeout(ahb_timeout, ecb, (xs->timeout * hz) / 1000);
|
||||||
|
@ -979,7 +979,7 @@ ahb_scsi_cmd(xs)
|
||||||
/*
|
/*
|
||||||
* If we can't use interrupts, poll on completion
|
* If we can't use interrupts, poll on completion
|
||||||
*/
|
*/
|
||||||
if (ahb_poll(ahb, xs, xs->timeout))
|
if (ahb_poll(sc, xs, xs->timeout))
|
||||||
ahb_timeout(ecb);
|
ahb_timeout(ecb);
|
||||||
return COMPLETE;
|
return COMPLETE;
|
||||||
}
|
}
|
||||||
|
@ -1080,9 +1080,9 @@ ahb_scsi_cmd(xs)
|
||||||
* there's still data, must have run out of segs!
|
* there's still data, must have run out of segs!
|
||||||
*/
|
*/
|
||||||
printf("%s: ahb_scsi_cmd, more than %d dma segs\n",
|
printf("%s: ahb_scsi_cmd, more than %d dma segs\n",
|
||||||
ahb->sc_dev.dv_xname, AHB_NSEG);
|
sc->sc_dev.dv_xname, AHB_NSEG);
|
||||||
xs->error = XS_DRIVER_STUFFUP;
|
xs->error = XS_DRIVER_STUFFUP;
|
||||||
ahb_free_ecb(ahb, ecb, flags);
|
ahb_free_ecb(sc, ecb, flags);
|
||||||
return COMPLETE;
|
return COMPLETE;
|
||||||
}
|
}
|
||||||
} else { /* No data xfer, use non S/G values */
|
} else { /* No data xfer, use non S/G values */
|
||||||
|
@ -1099,7 +1099,7 @@ ahb_scsi_cmd(xs)
|
||||||
|
|
||||||
s = splbio();
|
s = splbio();
|
||||||
|
|
||||||
ahb_send_mbox(ahb, OP_START_ECB, ecb);
|
ahb_send_mbox(sc, OP_START_ECB, ecb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Usually return SUCCESSFULLY QUEUED
|
* Usually return SUCCESSFULLY QUEUED
|
||||||
|
@ -1115,9 +1115,9 @@ ahb_scsi_cmd(xs)
|
||||||
/*
|
/*
|
||||||
* If we can't use interrupts, poll on completion
|
* If we can't use interrupts, poll on completion
|
||||||
*/
|
*/
|
||||||
if (ahb_poll(ahb, xs, xs->timeout)) {
|
if (ahb_poll(sc, xs, xs->timeout)) {
|
||||||
ahb_timeout(ecb);
|
ahb_timeout(ecb);
|
||||||
if (ahb_poll(ahb, xs, 2000))
|
if (ahb_poll(sc, xs, 2000))
|
||||||
ahb_timeout(ecb);
|
ahb_timeout(ecb);
|
||||||
}
|
}
|
||||||
return COMPLETE;
|
return COMPLETE;
|
||||||
|
@ -1130,7 +1130,7 @@ ahb_timeout(arg)
|
||||||
struct ahb_ecb *ecb = arg;
|
struct ahb_ecb *ecb = arg;
|
||||||
struct scsi_xfer *xs = ecb->xs;
|
struct scsi_xfer *xs = ecb->xs;
|
||||||
struct scsi_link *sc_link = xs->sc_link;
|
struct scsi_link *sc_link = xs->sc_link;
|
||||||
struct ahb_softc *ahb = sc_link->adapter_softc;
|
struct ahb_softc *sc = sc_link->adapter_softc;
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
sc_print_addr(sc_link);
|
sc_print_addr(sc_link);
|
||||||
|
@ -1142,7 +1142,7 @@ ahb_timeout(arg)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
ecb->xs->retries = 0; /* I MEAN IT ! */
|
ecb->xs->retries = 0; /* I MEAN IT ! */
|
||||||
ecb->flags |= ECB_IMMED_FAIL;
|
ecb->flags |= ECB_IMMED_FAIL;
|
||||||
ahb_done(ahb, ecb);
|
ahb_done(sc, ecb);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1156,13 +1156,13 @@ ahb_timeout(arg)
|
||||||
/* abort timed out */
|
/* abort timed out */
|
||||||
printf(" AGAIN\n");
|
printf(" AGAIN\n");
|
||||||
ecb->xs->retries = 0; /* I MEAN IT ! */
|
ecb->xs->retries = 0; /* I MEAN IT ! */
|
||||||
ahb_done(ahb, ecb);
|
ahb_done(sc, ecb);
|
||||||
} else {
|
} else {
|
||||||
/* abort the operation that has timed out */
|
/* abort the operation that has timed out */
|
||||||
printf("\n");
|
printf("\n");
|
||||||
ecb->xs->error = XS_TIMEOUT;
|
ecb->xs->error = XS_TIMEOUT;
|
||||||
ecb->flags = ECB_ABORTED;
|
ecb->flags = ECB_ABORTED;
|
||||||
ahb_send_mbox(ahb, OP_ABORT_ECB, ecb);
|
ahb_send_mbox(sc, OP_ABORT_ECB, ecb);
|
||||||
/* 2 secs for the abort */
|
/* 2 secs for the abort */
|
||||||
if ((xs->flags & SCSI_POLL) == 0)
|
if ((xs->flags & SCSI_POLL) == 0)
|
||||||
timeout(ahb_timeout, ecb, 2 * hz);
|
timeout(ahb_timeout, ecb, 2 * hz);
|
||||||
|
@ -1185,14 +1185,14 @@ ahb_print_ecb(ecb)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ahb_print_active_ecb(ahb)
|
ahb_print_active_ecb(sc)
|
||||||
struct ahb_softc *ahb;
|
struct ahb_softc *sc;
|
||||||
{
|
{
|
||||||
struct ahb_ecb *ecb;
|
struct ahb_ecb *ecb;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (i++ < ECB_HASH_SIZE) {
|
while (i++ < ECB_HASH_SIZE) {
|
||||||
ecb = ahb->ecb_hash_list[i];
|
ecb = sc->ecb_hash_list[i];
|
||||||
while (ecb) {
|
while (ecb) {
|
||||||
if (ecb->flags != ECB_FREE)
|
if (ecb->flags != ECB_FREE)
|
||||||
ahb_print_ecb(ecb);
|
ahb_print_ecb(ecb);
|
||||||
|
|
Loading…
Reference in New Issue