Split device_t/softc.
No crash on: esiop0 at pci0 dev 11 function 0: Symbios Logic 53c875 (ultra-wide scsi) siop0 at pci0 dev 9 function 0: Symbios Logic 53c810a (fast scsi) siop0 at gsc0 hpa 0xf0830000 path 2/0/7 irq 3 ipl 6: NCR53C720 rev 2
This commit is contained in:
parent
dfb36ab4e4
commit
31ec75e9f1
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: siop_sgc.c,v 1.3 2009/05/08 09:33:58 skrll Exp $ */
|
||||
/* $NetBSD: siop_sgc.c,v 1.4 2009/05/15 17:55:44 tsutsui Exp $ */
|
||||
|
||||
/* $OpenBSD: siop_sgc.c,v 1.1 2007/08/05 19:09:52 kettenis Exp $ */
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop_sgc.c,v 1.3 2009/05/08 09:33:58 skrll Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop_sgc.c,v 1.4 2009/05/15 17:55:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -46,8 +46,8 @@ __KERNEL_RCSID(0, "$NetBSD: siop_sgc.c,v 1.3 2009/05/08 09:33:58 skrll Exp $");
|
|||
#define IO_II_PACKEN 0x10000000
|
||||
#define IO_II_PREFETCHEN 0x08000000
|
||||
|
||||
int siop_sgc_match(struct device *, struct cfdata *, void *);
|
||||
void siop_sgc_attach(struct device *, struct device *, void *);
|
||||
int siop_sgc_match(device_t, cfdata_t, void *);
|
||||
void siop_sgc_attach(device_t, device_t, void *);
|
||||
int siop_sgc_intr(void *);
|
||||
void siop_sgc_reset(struct siop_common_softc *);
|
||||
|
||||
|
@ -63,11 +63,11 @@ struct siop_sgc_softc {
|
|||
struct hppa_bus_space_tag sc_bustag;
|
||||
};
|
||||
|
||||
CFATTACH_DECL(siop_gedoens, sizeof(struct siop_sgc_softc),
|
||||
CFATTACH_DECL_NEW(siop_gedoens, sizeof(struct siop_sgc_softc),
|
||||
siop_sgc_match, siop_sgc_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
siop_sgc_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
siop_sgc_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
|
||||
|
@ -83,17 +83,18 @@ siop_sgc_match(struct device *parent, struct cfdata *match, void *aux)
|
|||
}
|
||||
|
||||
void
|
||||
siop_sgc_attach(struct device *parent, struct device *self, void *aux)
|
||||
siop_sgc_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct siop_sgc_softc *sgc = (struct siop_sgc_softc *)self;
|
||||
struct siop_sgc_softc *sgc = device_private(self);
|
||||
struct siop_softc *sc = &sgc->sc_siop;
|
||||
struct confargs *ca = aux;
|
||||
volatile struct iomod *regs;
|
||||
|
||||
sc->sc_c.sc_dev = self;
|
||||
sgc->sc_iot = ca->ca_iot;
|
||||
if (bus_space_map(sgc->sc_iot, ca->ca_hpa,
|
||||
IOMOD_HPASIZE, 0, &sgc->sc_ioh)) {
|
||||
printf(": can't map io space\n");
|
||||
aprint_error(": can't map io space\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -128,12 +129,12 @@ siop_sgc_attach(struct device *parent, struct device *self, void *aux)
|
|||
regs->io_eim = cpu_gethpa(0) | (31 - ca->ca_irq);
|
||||
regs->io_ii_rw |= IO_II_INTEN;
|
||||
|
||||
printf(": NCR53C720 rev %d\n", bus_space_read_1(sc->sc_c.sc_rt,
|
||||
aprint_normal(": NCR53C720 rev %d\n", bus_space_read_1(sc->sc_c.sc_rt,
|
||||
sc->sc_c.sc_rh, SIOP_CTEST3) >> 4);
|
||||
|
||||
siop_attach(&sgc->sc_siop);
|
||||
|
||||
(void)hp700_intr_establish(&sc->sc_c.sc_dev, IPL_BIO,
|
||||
(void)hp700_intr_establish(self, IPL_BIO,
|
||||
siop_intr, sc, &int_reg_cpu, ca->ca_irq);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: siop_gsc.c,v 1.9 2009/05/08 09:33:58 skrll Exp $ */
|
||||
/* $NetBSD: siop_gsc.c,v 1.10 2009/05/15 17:55:44 tsutsui Exp $ */
|
||||
|
||||
/* $OpenBSD: siop_gsc.c,v 1.4 2007/08/23 21:01:22 kettenis Exp $ */
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop_gsc.c,v 1.9 2009/05/08 09:33:58 skrll Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop_gsc.c,v 1.10 2009/05/15 17:55:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -45,8 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: siop_gsc.c,v 1.9 2009/05/08 09:33:58 skrll Exp $");
|
|||
#define SIOP_GSC_RESET 0x0000
|
||||
#define SIOP_GSC_OFFSET 0x0100
|
||||
|
||||
int siop_gsc_match(struct device *, struct cfdata *, void *);
|
||||
void siop_gsc_attach(struct device *, struct device *, void *);
|
||||
int siop_gsc_match(device_t, cfdata_t, void *);
|
||||
void siop_gsc_attach(device_t, device_t, void *);
|
||||
int siop_gsc_intr(void *);
|
||||
void siop_gsc_reset(struct siop_common_softc *);
|
||||
|
||||
|
@ -62,11 +62,11 @@ struct siop_gsc_softc {
|
|||
struct hppa_bus_space_tag sc_bustag;
|
||||
};
|
||||
|
||||
CFATTACH_DECL(siop_gsc, sizeof(struct siop_gsc_softc),
|
||||
CFATTACH_DECL_NEW(siop_gsc, sizeof(struct siop_gsc_softc),
|
||||
siop_gsc_match, siop_gsc_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
siop_gsc_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
siop_gsc_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct gsc_attach_args *ga = aux;
|
||||
|
||||
|
@ -78,16 +78,17 @@ siop_gsc_match(struct device *parent, struct cfdata *match, void *aux)
|
|||
}
|
||||
|
||||
void
|
||||
siop_gsc_attach(struct device *parent, struct device *self, void *aux)
|
||||
siop_gsc_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct siop_gsc_softc *gsc = (struct siop_gsc_softc *)self;
|
||||
struct siop_gsc_softc *gsc = device_private(self);
|
||||
struct siop_softc *sc = &gsc->sc_siop;
|
||||
struct gsc_attach_args *ga = aux;
|
||||
|
||||
sc->sc_c.sc_dev = self;
|
||||
gsc->sc_iot = ga->ga_iot;
|
||||
if (bus_space_map(gsc->sc_iot, ga->ga_hpa,
|
||||
IOMOD_HPASIZE, 0, &gsc->sc_ioh)) {
|
||||
printf(": can't map io space\n");
|
||||
aprint_error(": can't map io space\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -118,12 +119,12 @@ siop_gsc_attach(struct device *parent, struct device *self, void *aux)
|
|||
DELAY(1000);
|
||||
siop_gsc_reset(&sc->sc_c);
|
||||
|
||||
printf(": NCR53C720 rev %d\n", bus_space_read_1(sc->sc_c.sc_rt,
|
||||
aprint_normal(": NCR53C720 rev %d\n", bus_space_read_1(sc->sc_c.sc_rt,
|
||||
sc->sc_c.sc_rh, SIOP_CTEST3) >> 4);
|
||||
|
||||
siop_attach(sc);
|
||||
|
||||
(void)hp700_intr_establish(&sc->sc_c.sc_dev, IPL_BIO,
|
||||
(void)hp700_intr_establish(self, IPL_BIO,
|
||||
siop_intr, sc, ga->ga_int_reg, ga->ga_irq);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: esiop.c,v 1.45 2009/03/15 15:52:12 cegger Exp $ */
|
||||
/* $NetBSD: esiop.c,v 1.46 2009/05/15 17:55:44 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Manuel Bouyer.
|
||||
|
@ -33,7 +33,7 @@
|
|||
/* SYM53c7/8xx PCI-SCSI I/O Processors driver */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.45 2009/03/15 15:52:12 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.46 2009/05/15 17:55:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -161,7 +161,7 @@ esiop_attach(struct esiop_softc *sc)
|
|||
TAILQ_INIT(&sc->tag_tblblk);
|
||||
sc->sc_currschedslot = 0;
|
||||
#ifdef SIOP_DEBUG
|
||||
aprint_debug_dev(&sc->sc_c.sc_dev, "script size = %d, PHY addr=0x%x, VIRT=%p\n",
|
||||
aprint_debug_dev(sc->sc_c.sc_dev, "script size = %d, PHY addr=0x%x, VIRT=%p\n",
|
||||
(int)sizeof(esiop_script),
|
||||
(u_int32_t)sc->sc_c.sc_scriptaddr, sc->sc_c.sc_script);
|
||||
#endif
|
||||
|
@ -175,7 +175,7 @@ esiop_attach(struct esiop_softc *sc)
|
|||
*/
|
||||
#ifdef DIAGNOSTIC
|
||||
if (ESIOP_NTAG != A_ndone_slots) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "size of tag DSA table different from the done"
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "size of tag DSA table different from the done"
|
||||
" ring\n");
|
||||
return;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ esiop_attach(struct esiop_softc *sc)
|
|||
esiop_moretagtbl(sc);
|
||||
tagtbl_donering = TAILQ_FIRST(&sc->free_tagtbl);
|
||||
if (tagtbl_donering == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "no memory for command done ring\n");
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "no memory for command done ring\n");
|
||||
return;
|
||||
}
|
||||
TAILQ_REMOVE(&sc->free_tagtbl, tagtbl_donering, next);
|
||||
|
@ -201,7 +201,7 @@ esiop_attach(struct esiop_softc *sc)
|
|||
esiop_dump_script(sc);
|
||||
#endif
|
||||
|
||||
config_found((struct device*)sc, &sc->sc_c.sc_chan, scsiprint);
|
||||
config_found(sc->sc_c.sc_dev, &sc->sc_c.sc_chan, scsiprint);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -387,7 +387,7 @@ esiop_reset(struct esiop_softc *sc)
|
|||
((addr & 0xff000000) >> 16));
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s: target table offset %d free offset %d\n",
|
||||
device_xname(&sc->sc_c.sc_dev), sc->sc_target_table_offset,
|
||||
device_xname(sc->sc_c.sc_dev), sc->sc_target_table_offset,
|
||||
sc->sc_free_offset);
|
||||
#endif
|
||||
|
||||
|
@ -538,7 +538,7 @@ none:
|
|||
}
|
||||
|
||||
if (dstat & ~(DSTAT_SIR | DSTAT_DFE | DSTAT_SSI)) {
|
||||
printf("%s: DMA IRQ:", device_xname(&sc->sc_c.sc_dev));
|
||||
printf("%s: DMA IRQ:", device_xname(sc->sc_c.sc_dev));
|
||||
if (dstat & DSTAT_IID)
|
||||
printf(" Illegal instruction");
|
||||
if (dstat & DSTAT_BF)
|
||||
|
@ -590,7 +590,7 @@ none:
|
|||
if (esiop_cmd)
|
||||
scsipi_printaddr(xs->xs_periph);
|
||||
else
|
||||
printf("%s:", device_xname(&sc->sc_c.sc_dev));
|
||||
printf("%s:", device_xname(sc->sc_c.sc_dev));
|
||||
printf("scsi gross error\n");
|
||||
if (esiop_target)
|
||||
esiop_target->target_c.flags &= ~TARF_DT;
|
||||
|
@ -656,10 +656,10 @@ none:
|
|||
CALL_SCRIPT(Ent_msgin);
|
||||
return 1;
|
||||
}
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unexpected phase mismatch %d\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unexpected phase mismatch %d\n",
|
||||
sstat1 & SSTAT1_PHASE_MASK);
|
||||
} else {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "phase mismatch without command\n");
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "phase mismatch without command\n");
|
||||
}
|
||||
need_reset = 1;
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ none:
|
|||
if (esiop_cmd)
|
||||
scsipi_printaddr(xs->xs_periph);
|
||||
else
|
||||
printf("%s:", device_xname(&sc->sc_c.sc_dev));
|
||||
printf("%s:", device_xname(sc->sc_c.sc_dev));
|
||||
printf("parity error\n");
|
||||
if (esiop_target)
|
||||
esiop_target->target_c.flags &= ~TARF_DT;
|
||||
|
@ -717,7 +717,7 @@ none:
|
|||
printf("%s: selection timeout without "
|
||||
"command, target %d (sdid 0x%x), "
|
||||
"slot %d\n",
|
||||
device_xname(&sc->sc_c.sc_dev), target,
|
||||
device_xname(sc->sc_c.sc_dev), target,
|
||||
bus_space_read_1(sc->sc_c.sc_rt,
|
||||
sc->sc_c.sc_rh, SIOP_SDID), slot);
|
||||
need_reset = 1;
|
||||
|
@ -733,7 +733,7 @@ none:
|
|||
htole32(SCSI_CHECK);
|
||||
goto end;
|
||||
}
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unexpected disconnect without "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unexpected disconnect without "
|
||||
"command\n");
|
||||
goto reset;
|
||||
}
|
||||
|
@ -759,7 +759,7 @@ none:
|
|||
return 1;
|
||||
}
|
||||
/* Else it's an unhandled exception (for now). */
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unhandled scsi interrupt, sist=0x%x sstat1=0x%x "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unhandled scsi interrupt, sist=0x%x sstat1=0x%x "
|
||||
"DSA=0x%x DSP=0x%x\n", sist,
|
||||
bus_space_read_1(sc->sc_c.sc_rt, sc->sc_c.sc_rh,
|
||||
SIOP_SSTAT1),
|
||||
|
@ -794,13 +794,13 @@ scintr:
|
|||
*/
|
||||
if ((irqcode & 0x80) == 0) {
|
||||
if (esiop_cmd == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev,
|
||||
aprint_error_dev(sc->sc_c.sc_dev,
|
||||
"script interrupt (0x%x) with invalid DSA !!!\n",
|
||||
irqcode);
|
||||
goto reset;
|
||||
}
|
||||
if (esiop_cmd->cmd_c.status != CMDST_ACTIVE) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "command with invalid status "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "command with invalid status "
|
||||
"(IRQ code 0x%x current status %d) !\n",
|
||||
irqcode, esiop_cmd->cmd_c.status);
|
||||
xs = NULL;
|
||||
|
@ -845,7 +845,7 @@ scintr:
|
|||
scsipi_printaddr(xs->xs_periph);
|
||||
else
|
||||
printf("%s: ",
|
||||
device_xname(&sc->sc_c.sc_dev));
|
||||
device_xname(sc->sc_c.sc_dev));
|
||||
printf("our reject message was "
|
||||
"rejected\n");
|
||||
goto reset;
|
||||
|
@ -910,7 +910,7 @@ scintr:
|
|||
scsipi_printaddr(xs->xs_periph);
|
||||
else
|
||||
printf("%s: ",
|
||||
device_xname(&sc->sc_c.sc_dev));
|
||||
device_xname(sc->sc_c.sc_dev));
|
||||
if (msg == MSG_EXTENDED) {
|
||||
printf("scsi message reject, extended "
|
||||
"message sent was 0x%x\n", extmsg);
|
||||
|
@ -934,7 +934,7 @@ scintr:
|
|||
if (xs)
|
||||
scsipi_printaddr(xs->xs_periph);
|
||||
else
|
||||
printf("%s: ", device_xname(&sc->sc_c.sc_dev));
|
||||
printf("%s: ", device_xname(sc->sc_c.sc_dev));
|
||||
printf("unhandled message 0x%x\n", msgin);
|
||||
esiop_cmd->cmd_tables->msg_out[0] = MSG_MESSAGE_REJECT;
|
||||
esiop_cmd->cmd_tables->t_msgout.count= htole32(1);
|
||||
|
@ -951,7 +951,7 @@ scintr:
|
|||
#endif
|
||||
if (esiop_cmd->cmd_tables->msg_in[1] >
|
||||
sizeof(esiop_cmd->cmd_tables->msg_in) - 2)
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "extended message too big (%d)\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "extended message too big (%d)\n",
|
||||
esiop_cmd->cmd_tables->msg_in[1]);
|
||||
esiop_cmd->cmd_tables->t_extmsgdata.count =
|
||||
htole32(esiop_cmd->cmd_tables->msg_in[1] - 1);
|
||||
|
@ -1087,7 +1087,7 @@ scintr:
|
|||
case A_int_done:
|
||||
if (xs == NULL) {
|
||||
printf("%s: done without command\n",
|
||||
device_xname(&sc->sc_c.sc_dev));
|
||||
device_xname(sc->sc_c.sc_dev));
|
||||
CALL_SCRIPT(Ent_script_sched);
|
||||
return 1;
|
||||
}
|
||||
|
@ -1173,7 +1173,7 @@ esiop_scsicmd_end(struct esiop_cmd *esiop_cmd, int offset)
|
|||
INCSTAT(esiop_stat_intr_qfull);
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s:%d:%d: queue full (tag %d)\n",
|
||||
device_xname(&sc->sc_c.sc_dev),
|
||||
device_xname(sc->sc_c.sc_dev),
|
||||
xs->xs_periph->periph_target,
|
||||
xs->xs_periph->periph_lun, esiop_cmd->cmd_c.tag);
|
||||
#endif
|
||||
|
@ -1377,12 +1377,12 @@ esiop_handle_qtag_reject(struct esiop_cmd *esiop_cmd)
|
|||
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s:%d:%d: tag message %d (%d) rejected (status %d)\n",
|
||||
device_xname(&sc->sc_c.sc_dev), target, lun, tag, esiop_cmd->cmd_c.tag,
|
||||
device_xname(sc->sc_c.sc_dev), target, lun, tag, esiop_cmd->cmd_c.tag,
|
||||
esiop_cmd->cmd_c.status);
|
||||
#endif
|
||||
|
||||
if (esiop_lun->active != NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "untagged command already running for target %d "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "untagged command already running for target %d "
|
||||
"lun %d (status %d)\n",
|
||||
target, lun, esiop_lun->active->cmd_c.status);
|
||||
return -1;
|
||||
|
@ -1417,7 +1417,7 @@ esiop_handle_reset(struct esiop_softc *sc)
|
|||
* scsi bus reset. reset the chip and restart
|
||||
* the queue. Need to clean up all active commands
|
||||
*/
|
||||
printf("%s: scsi bus reset\n", device_xname(&sc->sc_c.sc_dev));
|
||||
printf("%s: scsi bus reset\n", device_xname(sc->sc_c.sc_dev));
|
||||
/* stop, reset and restart the chip */
|
||||
esiop_reset(sc);
|
||||
|
||||
|
@ -1480,7 +1480,7 @@ esiop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
{
|
||||
struct scsipi_xfer *xs;
|
||||
struct scsipi_periph *periph;
|
||||
struct esiop_softc *sc = (void *)chan->chan_adapter->adapt_dev;
|
||||
struct esiop_softc *sc = device_private(chan->chan_adapter->adapt_dev);
|
||||
struct esiop_cmd *esiop_cmd;
|
||||
struct esiop_target *esiop_target;
|
||||
int s, error, i;
|
||||
|
@ -1525,13 +1525,13 @@ esiop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
if (esiop_target == NULL) {
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s: alloc siop_target for target %d\n",
|
||||
device_xname(&sc->sc_c.sc_dev), target);
|
||||
device_xname(sc->sc_c.sc_dev), target);
|
||||
#endif
|
||||
sc->sc_c.targets[target] =
|
||||
malloc(sizeof(struct esiop_target),
|
||||
M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (sc->sc_c.targets[target] == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't malloc memory for "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't malloc memory for "
|
||||
"target %d\n", target);
|
||||
xs->error = XS_RESOURCE_SHORTAGE;
|
||||
scsipi_done(xs);
|
||||
|
@ -1556,7 +1556,7 @@ esiop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
malloc(sizeof(struct esiop_lun), M_DEVBUF,
|
||||
M_NOWAIT|M_ZERO);
|
||||
if (esiop_target->esiop_lun[lun] == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't alloc esiop_lun for "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't alloc esiop_lun for "
|
||||
"target %d lun %d\n",
|
||||
target, lun);
|
||||
xs->error = XS_RESOURCE_SHORTAGE;
|
||||
|
@ -1575,7 +1575,7 @@ esiop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
esiop_cmd->cmd_c.dmamap_cmd,
|
||||
xs->cmd, xs->cmdlen, NULL, BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to load cmd DMA map: %d\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to load cmd DMA map: %d\n",
|
||||
error);
|
||||
xs->error = XS_DRIVER_STUFFUP;
|
||||
scsipi_done(xs);
|
||||
|
@ -1589,7 +1589,7 @@ esiop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
((xs->xs_control & XS_CTL_DATA_IN) ?
|
||||
BUS_DMA_READ : BUS_DMA_WRITE));
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to load cmd DMA map: %d",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to load cmd DMA map: %d",
|
||||
error);
|
||||
xs->error = XS_DRIVER_STUFFUP;
|
||||
scsipi_done(xs);
|
||||
|
@ -1638,7 +1638,7 @@ esiop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
|
||||
case ADAPTER_REQ_GROW_RESOURCES:
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s grow resources (%d)\n", device_xname(&sc->sc_c.sc_dev),
|
||||
printf("%s grow resources (%d)\n", device_xname(sc->sc_c.sc_dev),
|
||||
sc->sc_c.sc_adapt.adapt_openings);
|
||||
#endif
|
||||
esiop_morecbd(sc);
|
||||
|
@ -1869,7 +1869,7 @@ esiop_morecbd(struct esiop_softc *sc)
|
|||
/* allocate a new list head */
|
||||
newcbd = malloc(sizeof(struct esiop_cbd), M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
if (newcbd == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't allocate memory for command descriptors "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't allocate memory for command descriptors "
|
||||
"head\n");
|
||||
return;
|
||||
}
|
||||
|
@ -1878,37 +1878,37 @@ esiop_morecbd(struct esiop_softc *sc)
|
|||
newcbd->cmds = malloc(sizeof(struct esiop_cmd) * SIOP_NCMDPB,
|
||||
M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
if (newcbd->cmds == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't allocate memory for command descriptors\n");
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't allocate memory for command descriptors\n");
|
||||
goto bad3;
|
||||
}
|
||||
error = bus_dmamem_alloc(sc->sc_c.sc_dmat, PAGE_SIZE, PAGE_SIZE, 0,
|
||||
&seg, 1, &rseg, BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to allocate cbd DMA memory, error = %d\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to allocate cbd DMA memory, error = %d\n",
|
||||
error);
|
||||
goto bad2;
|
||||
}
|
||||
error = bus_dmamem_map(sc->sc_c.sc_dmat, &seg, rseg, PAGE_SIZE,
|
||||
(void **)&newcbd->xfers, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to map cbd DMA memory, error = %d\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to map cbd DMA memory, error = %d\n",
|
||||
error);
|
||||
goto bad2;
|
||||
}
|
||||
error = bus_dmamap_create(sc->sc_c.sc_dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
|
||||
BUS_DMA_NOWAIT, &newcbd->xferdma);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to create cbd DMA map, error = %d\n", error);
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to create cbd DMA map, error = %d\n", error);
|
||||
goto bad1;
|
||||
}
|
||||
error = bus_dmamap_load(sc->sc_c.sc_dmat, newcbd->xferdma,
|
||||
newcbd->xfers, PAGE_SIZE, NULL, BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to load cbd DMA map, error = %d\n", error);
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to load cbd DMA map, error = %d\n", error);
|
||||
goto bad0;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("%s: alloc newcdb at PHY addr 0x%lx\n", device_xname(&sc->sc_c.sc_dev),
|
||||
printf("%s: alloc newcdb at PHY addr 0x%lx\n", device_xname(sc->sc_c.sc_dev),
|
||||
(unsigned long)newcbd->xferdma->dm_segs[0].ds_addr);
|
||||
#endif
|
||||
for (i = 0; i < SIOP_NCMDPB; i++) {
|
||||
|
@ -1916,7 +1916,7 @@ esiop_morecbd(struct esiop_softc *sc)
|
|||
MAXPHYS, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
|
||||
&newcbd->cmds[i].cmd_c.dmamap_data);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to create data DMA map for cbd: "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to create data DMA map for cbd: "
|
||||
"error %d\n", error);
|
||||
goto bad0;
|
||||
}
|
||||
|
@ -1926,7 +1926,7 @@ esiop_morecbd(struct esiop_softc *sc)
|
|||
BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
|
||||
&newcbd->cmds[i].cmd_c.dmamap_cmd);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to create cmd DMA map for cbd %d\n", error);
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to create cmd DMA map for cbd %d\n", error);
|
||||
goto bad0;
|
||||
}
|
||||
newcbd->cmds[i].cmd_c.siop_sc = &sc->sc_c;
|
||||
|
@ -1994,7 +1994,7 @@ esiop_moretagtbl(struct esiop_softc *sc)
|
|||
newtblblk = malloc(sizeof(struct esiop_dsatblblk),
|
||||
M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
if (newtblblk == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't allocate memory for tag DSA table block\n");
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't allocate memory for tag DSA table block\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2002,36 +2002,36 @@ esiop_moretagtbl(struct esiop_softc *sc)
|
|||
newtbls = malloc(sizeof(struct esiop_dsatbl) * ESIOP_NTPB,
|
||||
M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
if (newtbls == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't allocate memory for command descriptors\n");
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't allocate memory for command descriptors\n");
|
||||
goto bad3;
|
||||
}
|
||||
error = bus_dmamem_alloc(sc->sc_c.sc_dmat, PAGE_SIZE, PAGE_SIZE, 0,
|
||||
&seg, 1, &rseg, BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to allocate tbl DMA memory, error = %d\n", error);
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to allocate tbl DMA memory, error = %d\n", error);
|
||||
goto bad2;
|
||||
}
|
||||
error = bus_dmamem_map(sc->sc_c.sc_dmat, &seg, rseg, PAGE_SIZE,
|
||||
(void *)&tbls, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to map tbls DMA memory, error = %d\n", error);
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to map tbls DMA memory, error = %d\n", error);
|
||||
goto bad2;
|
||||
}
|
||||
error = bus_dmamap_create(sc->sc_c.sc_dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
|
||||
BUS_DMA_NOWAIT, &newtblblk->blkmap);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to create tbl DMA map, error = %d\n", error);
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to create tbl DMA map, error = %d\n", error);
|
||||
goto bad1;
|
||||
}
|
||||
error = bus_dmamap_load(sc->sc_c.sc_dmat, newtblblk->blkmap,
|
||||
tbls, PAGE_SIZE, NULL, BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to load tbl DMA map, error = %d\n", error);
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to load tbl DMA map, error = %d\n", error);
|
||||
goto bad0;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("%s: alloc new tag DSA table at PHY addr 0x%lx\n",
|
||||
device_xname(&sc->sc_c.sc_dev),
|
||||
device_xname(sc->sc_c.sc_dev),
|
||||
(unsigned long)newtblblk->blkmap->dm_segs[0].ds_addr);
|
||||
#endif
|
||||
for (i = 0; i < ESIOP_NTPB; i++) {
|
||||
|
@ -2106,7 +2106,7 @@ esiop_del_dev(struct esiop_softc *sc, int target, int lun)
|
|||
struct esiop_target *esiop_target;
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s:%d:%d: free lun sw entry\n",
|
||||
device_xname(&sc->sc_c.sc_dev), target, lun);
|
||||
device_xname(sc->sc_c.sc_dev), target, lun);
|
||||
#endif
|
||||
if (sc->sc_c.targets[target] == NULL)
|
||||
return;
|
||||
|
@ -2128,7 +2128,7 @@ esiop_target_register(struct esiop_softc *sc, u_int32_t target)
|
|||
sc->sc_free_offset += sc->sc_c.sc_chan.chan_nluns * 2 + 2;
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s: lun table for target %d offset %d free offset %d\n",
|
||||
device_xname(&sc->sc_c.sc_dev), target, esiop_target->lun_table_offset,
|
||||
device_xname(sc->sc_c.sc_dev), target, esiop_target->lun_table_offset,
|
||||
sc->sc_free_offset);
|
||||
#endif
|
||||
/* first 32 bytes are ID (for select) */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: siop.c,v 1.90 2009/03/15 17:24:43 cegger Exp $ */
|
||||
/* $NetBSD: siop.c,v 1.91 2009/05/15 17:55:44 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Manuel Bouyer.
|
||||
|
@ -33,7 +33,7 @@
|
|||
/* SYM53c7/8xx PCI-SCSI I/O Processors driver */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.90 2009/03/15 17:24:43 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.91 2009/05/15 17:55:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -162,7 +162,7 @@ siop_attach(struct siop_softc *sc)
|
|||
sc->sc_currschedslot = 0;
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s: script size = %d, PHY addr=0x%x, VIRT=%p\n",
|
||||
device_xname(&sc->sc_c.sc_dev), (int)sizeof(siop_script),
|
||||
device_xname(sc->sc_c.sc_dev), (int)sizeof(siop_script),
|
||||
(u_int32_t)sc->sc_c.sc_scriptaddr, sc->sc_c.sc_script);
|
||||
#endif
|
||||
|
||||
|
@ -179,7 +179,7 @@ siop_attach(struct siop_softc *sc)
|
|||
siop_dump_script(sc);
|
||||
#endif
|
||||
|
||||
config_found((struct device*)sc, &sc->sc_c.sc_chan, scsiprint);
|
||||
config_found(sc->sc_c.sc_dev, &sc->sc_c.sc_chan, scsiprint);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -254,7 +254,7 @@ siop_reset(struct siop_softc *sc)
|
|||
while((lunsw = TAILQ_FIRST(&sc->lunsw_list)) != NULL) {
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s: free lunsw at offset %d\n",
|
||||
device_xname(&sc->sc_c.sc_dev), lunsw->lunsw_off);
|
||||
device_xname(sc->sc_c.sc_dev), lunsw->lunsw_off);
|
||||
#endif
|
||||
TAILQ_REMOVE(&sc->lunsw_list, lunsw, next);
|
||||
free(lunsw, M_DEVBUF);
|
||||
|
@ -267,13 +267,13 @@ siop_reset(struct siop_softc *sc)
|
|||
continue;
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s: restore sw for target %d\n",
|
||||
device_xname(&sc->sc_c.sc_dev), i);
|
||||
device_xname(sc->sc_c.sc_dev), i);
|
||||
#endif
|
||||
target = (struct siop_target *)sc->sc_c.targets[i];
|
||||
free(target->lunsw, M_DEVBUF);
|
||||
target->lunsw = siop_get_lunsw(sc);
|
||||
if (target->lunsw == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't alloc lunsw for target %d\n", i);
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't alloc lunsw for target %d\n", i);
|
||||
break;
|
||||
}
|
||||
siop_add_reselsw(sc, i);
|
||||
|
@ -427,7 +427,7 @@ siop_intr(void *v)
|
|||
siop_ctoh32(&sc->sc_c,
|
||||
siop_cmd->cmd_tables->status));
|
||||
else
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "current DSA invalid\n");
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "current DSA invalid\n");
|
||||
need_reset = 1;
|
||||
}
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ siop_intr(void *v)
|
|||
if (siop_cmd)
|
||||
scsipi_printaddr(xs->xs_periph);
|
||||
else
|
||||
printf("%s:", device_xname(&sc->sc_c.sc_dev));
|
||||
printf("%s:", device_xname(sc->sc_c.sc_dev));
|
||||
printf("scsi gross error\n");
|
||||
goto reset;
|
||||
}
|
||||
|
@ -512,10 +512,10 @@ siop_intr(void *v)
|
|||
CALL_SCRIPT(Ent_msgin);
|
||||
return 1;
|
||||
}
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unexpected phase mismatch %d\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unexpected phase mismatch %d\n",
|
||||
sstat1 & SSTAT1_PHASE_MASK);
|
||||
} else {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "phase mismatch without command\n");
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "phase mismatch without command\n");
|
||||
}
|
||||
need_reset = 1;
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ siop_intr(void *v)
|
|||
if (siop_cmd)
|
||||
scsipi_printaddr(xs->xs_periph);
|
||||
else
|
||||
printf("%s:", device_xname(&sc->sc_c.sc_dev));
|
||||
printf("%s:", device_xname(sc->sc_c.sc_dev));
|
||||
printf("parity error\n");
|
||||
goto reset;
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ siop_intr(void *v)
|
|||
freetarget = 1;
|
||||
goto end;
|
||||
} else {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "selection timeout without "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "selection timeout without "
|
||||
"command\n");
|
||||
need_reset = 1;
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ siop_intr(void *v)
|
|||
siop_htoc32(&sc->sc_c, SCSI_CHECK);
|
||||
goto end;
|
||||
}
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unexpected disconnect without "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unexpected disconnect without "
|
||||
"command\n");
|
||||
goto reset;
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ siop_intr(void *v)
|
|||
return 1;
|
||||
}
|
||||
/* Else it's an unhandled exception (for now). */
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unhandled scsi interrupt, sist=0x%x sstat1=0x%x "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unhandled scsi interrupt, sist=0x%x sstat1=0x%x "
|
||||
"DSA=0x%x DSP=0x%x\n", sist,
|
||||
bus_space_read_1(sc->sc_c.sc_rt, sc->sc_c.sc_rh,
|
||||
SIOP_SSTAT1),
|
||||
|
@ -612,13 +612,13 @@ scintr:
|
|||
*/
|
||||
if ((irqcode & 0x80) == 0) {
|
||||
if (siop_cmd == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev,
|
||||
aprint_error_dev(sc->sc_c.sc_dev,
|
||||
"script interrupt (0x%x) with invalid DSA !!!\n",
|
||||
irqcode);
|
||||
goto reset;
|
||||
}
|
||||
if (siop_cmd->cmd_c.status != CMDST_ACTIVE) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "command with invalid status "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "command with invalid status "
|
||||
"(IRQ code 0x%x current status %d) !\n",
|
||||
irqcode, siop_cmd->cmd_c.status);
|
||||
xs = NULL;
|
||||
|
@ -636,7 +636,7 @@ scintr:
|
|||
goto reset;
|
||||
}
|
||||
case A_int_reseltarg:
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "reselect with invalid target\n");
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "reselect with invalid target\n");
|
||||
goto reset;
|
||||
case A_int_resellun:
|
||||
INCSTAT(siop_stat_intr_lunresel);
|
||||
|
@ -650,20 +650,20 @@ scintr:
|
|||
(struct siop_target *)sc->sc_c.targets[target];
|
||||
if (siop_target == NULL) {
|
||||
printf("%s: reselect with invalid target %d\n",
|
||||
device_xname(&sc->sc_c.sc_dev), target);
|
||||
device_xname(sc->sc_c.sc_dev), target);
|
||||
goto reset;
|
||||
}
|
||||
siop_lun = siop_target->siop_lun[lun];
|
||||
if (siop_lun == NULL) {
|
||||
printf("%s: target %d reselect with invalid "
|
||||
"lun %d\n", device_xname(&sc->sc_c.sc_dev),
|
||||
"lun %d\n", device_xname(sc->sc_c.sc_dev),
|
||||
target, lun);
|
||||
goto reset;
|
||||
}
|
||||
if (siop_lun->siop_tag[tag].active == NULL) {
|
||||
printf("%s: target %d lun %d tag %d reselect "
|
||||
"without command\n",
|
||||
device_xname(&sc->sc_c.sc_dev),
|
||||
device_xname(sc->sc_c.sc_dev),
|
||||
target, lun, tag);
|
||||
goto reset;
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ scintr:
|
|||
return 1;
|
||||
case A_int_reseltag:
|
||||
printf("%s: reselect with invalid tag\n",
|
||||
device_xname(&sc->sc_c.sc_dev));
|
||||
device_xname(sc->sc_c.sc_dev));
|
||||
goto reset;
|
||||
case A_int_msgin:
|
||||
{
|
||||
|
@ -705,7 +705,7 @@ scintr:
|
|||
scsipi_printaddr(xs->xs_periph);
|
||||
else
|
||||
printf("%s: ",
|
||||
device_xname(&sc->sc_c.sc_dev));
|
||||
device_xname(sc->sc_c.sc_dev));
|
||||
printf("our reject message was "
|
||||
"rejected\n");
|
||||
goto reset;
|
||||
|
@ -757,7 +757,7 @@ scintr:
|
|||
scsipi_printaddr(xs->xs_periph);
|
||||
else
|
||||
printf("%s: ",
|
||||
device_xname(&sc->sc_c.sc_dev));
|
||||
device_xname(sc->sc_c.sc_dev));
|
||||
if (msg == MSG_EXTENDED) {
|
||||
printf("scsi message reject, extended "
|
||||
"message sent was 0x%x\n", extmsg);
|
||||
|
@ -781,7 +781,7 @@ scintr:
|
|||
if (xs)
|
||||
scsipi_printaddr(xs->xs_periph);
|
||||
else
|
||||
printf("%s: ", device_xname(&sc->sc_c.sc_dev));
|
||||
printf("%s: ", device_xname(sc->sc_c.sc_dev));
|
||||
printf("unhandled message 0x%x\n",
|
||||
siop_cmd->cmd_tables->msg_in[0]);
|
||||
siop_cmd->cmd_tables->msg_out[0] = MSG_MESSAGE_REJECT;
|
||||
|
@ -800,7 +800,7 @@ scintr:
|
|||
#endif
|
||||
if (siop_cmd->cmd_tables->msg_in[1] >
|
||||
sizeof(siop_cmd->cmd_tables->msg_in) - 2)
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "extended message too big (%d)\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "extended message too big (%d)\n",
|
||||
siop_cmd->cmd_tables->msg_in[1]);
|
||||
siop_cmd->cmd_tables->t_extmsgdata.count =
|
||||
siop_htoc32(&sc->sc_c,
|
||||
|
@ -926,7 +926,7 @@ scintr:
|
|||
case A_int_done:
|
||||
if (xs == NULL) {
|
||||
printf("%s: done without command, DSA=0x%lx\n",
|
||||
device_xname(&sc->sc_c.sc_dev),
|
||||
device_xname(sc->sc_c.sc_dev),
|
||||
(u_long)siop_cmd->cmd_c.dsa);
|
||||
siop_cmd->cmd_c.status = CMDST_FREE;
|
||||
CALL_SCRIPT(Ent_script_sched);
|
||||
|
@ -1018,7 +1018,7 @@ siop_scsicmd_end(struct siop_cmd *siop_cmd)
|
|||
INCSTAT(siop_stat_intr_qfull);
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s:%d:%d: queue full (tag %d)\n",
|
||||
device_xname(&sc->sc_c.sc_dev),
|
||||
device_xname(sc->sc_c.sc_dev),
|
||||
xs->xs_periph->periph_target,
|
||||
xs->xs_periph->periph_lun, siop_cmd->cmd_c.tag);
|
||||
#endif
|
||||
|
@ -1123,13 +1123,13 @@ siop_handle_qtag_reject(struct siop_cmd *siop_cmd)
|
|||
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s:%d:%d: tag message %d (%d) rejected (status %d)\n",
|
||||
device_xname(&sc->sc_c.sc_dev), target, lun, tag, siop_cmd->cmd_c.tag,
|
||||
device_xname(sc->sc_c.sc_dev), target, lun, tag, siop_cmd->cmd_c.tag,
|
||||
siop_cmd->cmd_c.status);
|
||||
#endif
|
||||
|
||||
if (siop_lun->siop_tag[0].active != NULL) {
|
||||
printf("%s: untagged command already running for target %d "
|
||||
"lun %d (status %d)\n", device_xname(&sc->sc_c.sc_dev),
|
||||
"lun %d (status %d)\n", device_xname(sc->sc_c.sc_dev),
|
||||
target, lun, siop_lun->siop_tag[0].active->cmd_c.status);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1165,7 +1165,7 @@ siop_handle_reset(struct siop_softc *sc)
|
|||
* scsi bus reset. reset the chip and restart
|
||||
* the queue. Need to clean up all active commands
|
||||
*/
|
||||
printf("%s: scsi bus reset\n", device_xname(&sc->sc_c.sc_dev));
|
||||
printf("%s: scsi bus reset\n", device_xname(sc->sc_c.sc_dev));
|
||||
/* stop, reset and restart the chip */
|
||||
siop_reset(sc);
|
||||
if (sc->sc_flags & SCF_CHAN_NOSLOT) {
|
||||
|
@ -1219,7 +1219,7 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
{
|
||||
struct scsipi_xfer *xs;
|
||||
struct scsipi_periph *periph;
|
||||
struct siop_softc *sc = (void *)chan->chan_adapter->adapt_dev;
|
||||
struct siop_softc *sc = device_private(chan->chan_adapter->adapt_dev);
|
||||
struct siop_cmd *siop_cmd;
|
||||
struct siop_target *siop_target;
|
||||
int s, error, i;
|
||||
|
@ -1253,13 +1253,13 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
if (siop_target == NULL) {
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s: alloc siop_target for target %d\n",
|
||||
device_xname(&sc->sc_c.sc_dev), target);
|
||||
device_xname(sc->sc_c.sc_dev), target);
|
||||
#endif
|
||||
sc->sc_c.targets[target] =
|
||||
malloc(sizeof(struct siop_target),
|
||||
M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
if (sc->sc_c.targets[target] == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't malloc memory for "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't malloc memory for "
|
||||
"target %d\n", target);
|
||||
xs->error = XS_RESOURCE_SHORTAGE;
|
||||
scsipi_done(xs);
|
||||
|
@ -1278,7 +1278,7 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
/* get a lun switch script */
|
||||
siop_target->lunsw = siop_get_lunsw(sc);
|
||||
if (siop_target->lunsw == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't alloc lunsw for target %d\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't alloc lunsw for target %d\n",
|
||||
target);
|
||||
xs->error = XS_RESOURCE_SHORTAGE;
|
||||
scsipi_done(xs);
|
||||
|
@ -1294,7 +1294,7 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
malloc(sizeof(struct siop_lun), M_DEVBUF,
|
||||
M_NOWAIT|M_ZERO);
|
||||
if (siop_target->siop_lun[lun] == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't alloc siop_lun for "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't alloc siop_lun for "
|
||||
"target %d lun %d\n",
|
||||
target, lun);
|
||||
xs->error = XS_RESOURCE_SHORTAGE;
|
||||
|
@ -1313,7 +1313,7 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
siop_cmd->cmd_c.dmamap_cmd,
|
||||
xs->cmd, xs->cmdlen, NULL, BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to load cmd DMA map: %d\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to load cmd DMA map: %d\n",
|
||||
error);
|
||||
xs->error = XS_DRIVER_STUFFUP;
|
||||
scsipi_done(xs);
|
||||
|
@ -1327,7 +1327,7 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
((xs->xs_control & XS_CTL_DATA_IN) ?
|
||||
BUS_DMA_READ : BUS_DMA_WRITE));
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to load cmd DMA map: %d",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to load cmd DMA map: %d",
|
||||
error);
|
||||
xs->error = XS_DRIVER_STUFFUP;
|
||||
scsipi_done(xs);
|
||||
|
@ -1369,7 +1369,7 @@ siop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void
|
|||
|
||||
case ADAPTER_REQ_GROW_RESOURCES:
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s grow resources (%d)\n", device_xname(&sc->sc_c.sc_dev),
|
||||
printf("%s grow resources (%d)\n", device_xname(sc->sc_c.sc_dev),
|
||||
sc->sc_c.sc_adapt.adapt_openings);
|
||||
#endif
|
||||
siop_morecbd(sc);
|
||||
|
@ -1602,7 +1602,7 @@ siop_morecbd(struct siop_softc *sc)
|
|||
/* allocate a new list head */
|
||||
newcbd = malloc(sizeof(struct siop_cbd), M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
if (newcbd == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't allocate memory for command descriptors head\n");
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't allocate memory for command descriptors head\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1610,39 +1610,39 @@ siop_morecbd(struct siop_softc *sc)
|
|||
newcbd->cmds = malloc(sizeof(struct siop_cmd) * SIOP_NCMDPB,
|
||||
M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
if (newcbd->cmds == NULL) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "can't allocate memory for command descriptors\n");
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "can't allocate memory for command descriptors\n");
|
||||
goto bad3;
|
||||
}
|
||||
error = bus_dmamem_alloc(sc->sc_c.sc_dmat, PAGE_SIZE, PAGE_SIZE, 0, &seg,
|
||||
1, &rseg, BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to allocate cbd DMA memory, error = %d\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to allocate cbd DMA memory, error = %d\n",
|
||||
error);
|
||||
goto bad2;
|
||||
}
|
||||
error = bus_dmamem_map(sc->sc_c.sc_dmat, &seg, rseg, PAGE_SIZE,
|
||||
(void **)&newcbd->xfers, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to map cbd DMA memory, error = %d\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to map cbd DMA memory, error = %d\n",
|
||||
error);
|
||||
goto bad2;
|
||||
}
|
||||
error = bus_dmamap_create(sc->sc_c.sc_dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
|
||||
BUS_DMA_NOWAIT, &newcbd->xferdma);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to create cbd DMA map, error = %d\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to create cbd DMA map, error = %d\n",
|
||||
error);
|
||||
goto bad1;
|
||||
}
|
||||
error = bus_dmamap_load(sc->sc_c.sc_dmat, newcbd->xferdma, newcbd->xfers,
|
||||
PAGE_SIZE, NULL, BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to load cbd DMA map, error = %d\n",
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to load cbd DMA map, error = %d\n",
|
||||
error);
|
||||
goto bad0;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("%s: alloc newcdb at PHY addr 0x%lx\n", device_xname(&sc->sc_c.sc_dev),
|
||||
printf("%s: alloc newcdb at PHY addr 0x%lx\n", device_xname(sc->sc_c.sc_dev),
|
||||
(unsigned long)newcbd->xferdma->dm_segs[0].ds_addr);
|
||||
#endif
|
||||
off = (sc->sc_c.features & SF_CHIP_BE) ? 3 : 0;
|
||||
|
@ -1651,7 +1651,7 @@ siop_morecbd(struct siop_softc *sc)
|
|||
MAXPHYS, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
|
||||
&newcbd->cmds[i].cmd_c.dmamap_data);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to create data DMA map for cbd: "
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to create data DMA map for cbd: "
|
||||
"error %d\n", error);
|
||||
goto bad0;
|
||||
}
|
||||
|
@ -1661,7 +1661,7 @@ siop_morecbd(struct siop_softc *sc)
|
|||
BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
|
||||
&newcbd->cmds[i].cmd_c.dmamap_cmd);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "unable to create cmd DMA map for cbd %d\n", error);
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "unable to create cmd DMA map for cbd %d\n", error);
|
||||
goto bad0;
|
||||
}
|
||||
newcbd->cmds[i].cmd_c.siop_sc = &sc->sc_c;
|
||||
|
@ -1872,7 +1872,7 @@ siop_add_dev(struct siop_softc *sc, int target, int lun)
|
|||
* with this case
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "%d:%d: can't allocate a lun sw slot\n", target, lun);
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "%d:%d: can't allocate a lun sw slot\n", target, lun);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -1895,13 +1895,13 @@ siop_add_dev(struct siop_softc *sc, int target, int lun)
|
|||
* We can hold 13 tagged-queuing capable devices in the 4k RAM.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
aprint_error_dev(&sc->sc_c.sc_dev, "%d:%d: not enough memory for a lun sw slot\n", target, lun);
|
||||
aprint_error_dev(sc->sc_c.sc_dev, "%d:%d: not enough memory for a lun sw slot\n", target, lun);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s:%d:%d: allocate lun sw entry\n",
|
||||
device_xname(&sc->sc_c.sc_dev), target, lun);
|
||||
device_xname(sc->sc_c.sc_dev), target, lun);
|
||||
#endif
|
||||
/* INT int_resellun */
|
||||
siop_script_write(sc, sc->script_free_lo, 0x98080000);
|
||||
|
@ -1955,7 +1955,7 @@ siop_del_dev(struct siop_softc *sc, int target, int lun)
|
|||
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s:%d:%d: free lun sw entry\n",
|
||||
device_xname(&sc->sc_c.sc_dev), target, lun);
|
||||
device_xname(sc->sc_c.sc_dev), target, lun);
|
||||
#endif
|
||||
if (sc->sc_c.targets[target] == NULL)
|
||||
return;
|
||||
|
@ -1970,7 +1970,7 @@ siop_del_dev(struct siop_softc *sc, int target, int lun)
|
|||
}
|
||||
#ifdef SIOP_DEBUG
|
||||
printf("%s: free siop_target for target %d lun %d lunsw offset %d\n",
|
||||
device_xname(&sc->sc_c.sc_dev), target, lun,
|
||||
device_xname(sc->sc_c.sc_dev), target, lun,
|
||||
siop_target->lunsw->lunsw_off);
|
||||
#endif
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: siop_common.c,v 1.48 2009/03/14 21:04:20 dsl Exp $ */
|
||||
/* $NetBSD: siop_common.c,v 1.49 2009/05/15 17:55:44 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000, 2002 Manuel Bouyer.
|
||||
|
@ -33,7 +33,7 @@
|
|||
/* SYM53c7/8xx PCI-SCSI I/O Processors driver */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop_common.c,v 1.48 2009/03/14 21:04:20 dsl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop_common.c,v 1.49 2009/05/15 17:55:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -77,7 +77,7 @@ siop_common_attach(struct siop_common_softc *sc)
|
|||
error = bus_dmamem_alloc(sc->sc_dmat, PAGE_SIZE,
|
||||
PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_dev,
|
||||
aprint_error_dev(sc->sc_dev,
|
||||
"unable to allocate script DMA memory, "
|
||||
"error = %d\n", error);
|
||||
return error;
|
||||
|
@ -86,21 +86,21 @@ siop_common_attach(struct siop_common_softc *sc)
|
|||
(void **)&sc->sc_script,
|
||||
BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_dev, "unable to map script DMA memory, "
|
||||
aprint_error_dev(sc->sc_dev, "unable to map script DMA memory, "
|
||||
"error = %d\n", error);
|
||||
return error;
|
||||
}
|
||||
error = bus_dmamap_create(sc->sc_dmat, PAGE_SIZE, 1,
|
||||
PAGE_SIZE, 0, BUS_DMA_NOWAIT, &sc->sc_scriptdma);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_dev, "unable to create script DMA map, "
|
||||
aprint_error_dev(sc->sc_dev, "unable to create script DMA map, "
|
||||
"error = %d\n", error);
|
||||
return error;
|
||||
}
|
||||
error = bus_dmamap_load(sc->sc_dmat, sc->sc_scriptdma,
|
||||
sc->sc_script, PAGE_SIZE, NULL, BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
aprint_error_dev(&sc->sc_dev, "unable to load script DMA map, "
|
||||
aprint_error_dev(sc->sc_dev, "unable to load script DMA map, "
|
||||
"error = %d\n", error);
|
||||
return error;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ siop_common_attach(struct siop_common_softc *sc)
|
|||
sc->ram_size = PAGE_SIZE;
|
||||
}
|
||||
|
||||
sc->sc_adapt.adapt_dev = &sc->sc_dev;
|
||||
sc->sc_adapt.adapt_dev = sc->sc_dev;
|
||||
sc->sc_adapt.adapt_nchannels = 1;
|
||||
sc->sc_adapt.adapt_openings = 0;
|
||||
sc->sc_adapt.adapt_ioctl = siop_ioctl;
|
||||
|
@ -368,7 +368,7 @@ siop_wdtr_neg(struct siop_common_cmd *siop_cmd)
|
|||
siop_target->offset = siop_target->period = 0;
|
||||
siop_update_xfer_mode(sc, target);
|
||||
printf("%s: rejecting invalid wide negotiation from "
|
||||
"target %d (%d)\n", device_xname(&sc->sc_dev), target,
|
||||
"target %d (%d)\n", device_xname(sc->sc_dev), target,
|
||||
tables->msg_in[3]);
|
||||
tables->t_msgout.count = siop_htoc32(sc, 1);
|
||||
tables->msg_out[0] = MSG_MESSAGE_REJECT;
|
||||
|
@ -426,7 +426,7 @@ siop_ppr_neg(struct siop_common_cmd *siop_cmd)
|
|||
int i;
|
||||
|
||||
#ifdef DEBUG_NEG
|
||||
printf("%s: answer on ppr negotiation:", device_xname(&sc->sc_dev));
|
||||
printf("%s: answer on ppr negotiation:", device_xname(sc->sc_dev));
|
||||
for (i = 0; i < 8; i++)
|
||||
printf(" 0x%x", tables->msg_in[i]);
|
||||
printf("\n");
|
||||
|
@ -440,7 +440,7 @@ siop_ppr_neg(struct siop_common_cmd *siop_cmd)
|
|||
if (options != MSG_EXT_PPR_DT) {
|
||||
/* should't happen */
|
||||
printf("%s: ppr negotiation for target %d: "
|
||||
"no DT option\n", device_xname(&sc->sc_dev), target);
|
||||
"no DT option\n", device_xname(sc->sc_dev), target);
|
||||
siop_target->status = TARST_ASYNC;
|
||||
siop_target->flags &= ~(TARF_DT | TARF_ISDT);
|
||||
siop_target->offset = 0;
|
||||
|
@ -452,7 +452,7 @@ siop_ppr_neg(struct siop_common_cmd *siop_cmd)
|
|||
sync > sc->dt_maxsync) {
|
||||
printf("%s: ppr negotiation for target %d: "
|
||||
"offset (%d) or sync (%d) out of range\n",
|
||||
device_xname(&sc->sc_dev), target, offset, sync);
|
||||
device_xname(sc->sc_dev), target, offset, sync);
|
||||
/* should not happen */
|
||||
siop_target->offset = 0;
|
||||
siop_target->period = 0;
|
||||
|
@ -474,7 +474,7 @@ siop_ppr_neg(struct siop_common_cmd *siop_cmd)
|
|||
if ((siop_target->flags & TARF_ISDT) == 0) {
|
||||
printf("%s: ppr negotiation for target %d: "
|
||||
"sync (%d) incompatible with adapter\n",
|
||||
device_xname(&sc->sc_dev), target, sync);
|
||||
device_xname(sc->sc_dev), target, sync);
|
||||
/*
|
||||
* we didn't find it in our table, do async
|
||||
* send reject msg, start SDTR/WDTR neg
|
||||
|
@ -489,7 +489,7 @@ siop_ppr_neg(struct siop_common_cmd *siop_cmd)
|
|||
if (tables->msg_in[6] != 1) {
|
||||
printf("%s: ppr negotiation for target %d: "
|
||||
"transfer width (%d) incompatible with dt\n",
|
||||
device_xname(&sc->sc_dev), target, tables->msg_in[6]);
|
||||
device_xname(sc->sc_dev), target, tables->msg_in[6]);
|
||||
/* DT mode can only be done with wide transfers */
|
||||
siop_target->status = TARST_ASYNC;
|
||||
goto reject;
|
||||
|
@ -515,7 +515,7 @@ siop_ppr_neg(struct siop_common_cmd *siop_cmd)
|
|||
} else {
|
||||
/* target initiated PPR negotiation, shouldn't happen */
|
||||
printf("%s: rejecting invalid PPR negotiation from "
|
||||
"target %d\n", device_xname(&sc->sc_dev), target);
|
||||
"target %d\n", device_xname(sc->sc_dev), target);
|
||||
reject:
|
||||
tables->t_msgout.count = siop_htoc32(sc, 1);
|
||||
tables->msg_out[0] = MSG_MESSAGE_REJECT;
|
||||
|
@ -704,7 +704,9 @@ int
|
|||
siop_ioctl(struct scsipi_channel *chan, u_long cmd, void *arg,
|
||||
int flag, struct proc *p)
|
||||
{
|
||||
struct siop_common_softc *sc = (void *)chan->chan_adapter->adapt_dev;
|
||||
struct siop_common_softc *sc;
|
||||
|
||||
sc = device_private(chan->chan_adapter->adapt_dev);
|
||||
|
||||
switch (cmd) {
|
||||
case SCBUSIORESET:
|
||||
|
@ -738,7 +740,7 @@ siop_ma(struct siop_common_cmd *siop_cmd)
|
|||
|
||||
offset = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_SCRATCHA + 1);
|
||||
if (offset >= SIOP_NSG) {
|
||||
aprint_error_dev(&sc->sc_dev, "bad offset in siop_sdp (%d)\n",
|
||||
aprint_error_dev(sc->sc_dev, "bad offset in siop_sdp (%d)\n",
|
||||
offset);
|
||||
return;
|
||||
}
|
||||
|
@ -976,31 +978,31 @@ siop_modechange(struct siop_common_softc *sc)
|
|||
switch(sc->mode) {
|
||||
case STEST4_MODE_DIF:
|
||||
printf("%s: switching to differential mode\n",
|
||||
device_xname(&sc->sc_dev));
|
||||
device_xname(sc->sc_dev));
|
||||
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST2,
|
||||
stest2 | STEST2_DIF);
|
||||
break;
|
||||
case STEST4_MODE_SE:
|
||||
printf("%s: switching to single-ended mode\n",
|
||||
device_xname(&sc->sc_dev));
|
||||
device_xname(sc->sc_dev));
|
||||
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST2,
|
||||
stest2 & ~STEST2_DIF);
|
||||
break;
|
||||
case STEST4_MODE_LVD:
|
||||
printf("%s: switching to LVD mode\n",
|
||||
device_xname(&sc->sc_dev));
|
||||
device_xname(sc->sc_dev));
|
||||
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST2,
|
||||
stest2 & ~STEST2_DIF);
|
||||
break;
|
||||
default:
|
||||
aprint_error_dev(&sc->sc_dev, "invalid SCSI mode 0x%x\n",
|
||||
aprint_error_dev(sc->sc_dev, "invalid SCSI mode 0x%x\n",
|
||||
sc->mode);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
printf("%s: timeout waiting for DIFFSENSE to stabilise\n",
|
||||
device_xname(&sc->sc_dev));
|
||||
device_xname(sc->sc_dev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: siopvar_common.h,v 1.36 2008/06/11 02:09:16 kiyohara Exp $ */
|
||||
/* $NetBSD: siopvar_common.h,v 1.37 2009/05/15 17:55:44 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Manuel Bouyer.
|
||||
|
@ -129,7 +129,7 @@ struct siop_common_target {
|
|||
|
||||
/* Driver internal state */
|
||||
struct siop_common_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
struct scsipi_channel sc_chan;
|
||||
struct scsipi_adapter sc_adapt;
|
||||
int features; /* chip's features */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: esiop_pci.c,v 1.15 2009/05/12 08:23:00 cegger Exp $ */
|
||||
/* $NetBSD: esiop_pci.c,v 1.16 2009/05/15 17:55:44 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Manuel Bouyer.
|
||||
|
@ -32,7 +32,7 @@
|
|||
/* SYM53c8xx PCI-SCSI I/O Processors driver: PCI front-end */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: esiop_pci.c,v 1.15 2009/05/12 08:23:00 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: esiop_pci.c,v 1.16 2009/05/15 17:55:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -80,6 +80,7 @@ esiop_pci_attach(device_t parent, device_t self, void *aux)
|
|||
struct pci_attach_args *pa = aux;
|
||||
struct esiop_pci_softc *sc = device_private(self);
|
||||
|
||||
sc->esiop.sc_c.sc_dev = self;
|
||||
if (siop_pci_attach_common(&sc->esiop_pci, &sc->esiop.sc_c,
|
||||
pa, esiop_intr) == 0)
|
||||
return;
|
||||
|
@ -88,5 +89,5 @@ esiop_pci_attach(device_t parent, device_t self, void *aux)
|
|||
}
|
||||
|
||||
|
||||
CFATTACH_DECL(esiop_pci, sizeof(struct esiop_pci_softc),
|
||||
CFATTACH_DECL_NEW(esiop_pci, sizeof(struct esiop_pci_softc),
|
||||
esiop_pci_match, esiop_pci_attach, NULL, NULL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: siop_pci.c,v 1.24 2009/05/12 08:23:01 cegger Exp $ */
|
||||
/* $NetBSD: siop_pci.c,v 1.25 2009/05/15 17:55:44 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Manuel Bouyer.
|
||||
|
@ -32,7 +32,7 @@
|
|||
/* SYM53c8xx PCI-SCSI I/O Processors driver: PCI front-end */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop_pci.c,v 1.24 2009/05/12 08:23:01 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop_pci.c,v 1.25 2009/05/15 17:55:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -75,6 +75,7 @@ siop_pci_attach(device_t parent, device_t self, void *aux)
|
|||
struct pci_attach_args *pa = aux;
|
||||
struct siop_pci_softc *sc = device_private(self);
|
||||
|
||||
sc->siop.sc_c.sc_dev = self;
|
||||
if (siop_pci_attach_common(&sc->siop_pci, &sc->siop.sc_c,
|
||||
pa, siop_intr) == 0)
|
||||
return;
|
||||
|
@ -82,5 +83,5 @@ siop_pci_attach(device_t parent, device_t self, void *aux)
|
|||
siop_attach(&sc->siop);
|
||||
}
|
||||
|
||||
CFATTACH_DECL(siop_pci, sizeof(struct siop_pci_softc),
|
||||
CFATTACH_DECL_NEW(siop_pci, sizeof(struct siop_pci_softc),
|
||||
siop_pci_match, siop_pci_attach, NULL, NULL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: siop_pci_common.c,v 1.29 2009/02/13 21:12:14 bouyer Exp $ */
|
||||
/* $NetBSD: siop_pci_common.c,v 1.30 2009/05/15 17:55:44 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Manuel Bouyer.
|
||||
|
@ -32,7 +32,7 @@
|
|||
/* SYM53c8xx PCI-SCSI I/O Processors driver: PCI front-end */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop_pci_common.c,v 1.29 2009/02/13 21:12:14 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: siop_pci_common.c,v 1.30 2009/05/15 17:55:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -260,7 +260,7 @@ siop_pci_attach_common(struct siop_pci_common_softc *pci_sc,
|
|||
#ifdef SIOP_SYMLED /* XXX Should be a devprop! */
|
||||
siop_sc->features |= SF_CHIP_LED0;
|
||||
#endif
|
||||
dict = device_properties(&siop_sc->sc_dev);
|
||||
dict = device_properties(siop_sc->sc_dev);
|
||||
if (prop_dictionary_get_bool(dict, "use_pciclock", &use_pciclock))
|
||||
if (use_pciclock)
|
||||
siop_sc->features |= SF_CHIP_USEPCIC;
|
||||
|
@ -299,7 +299,7 @@ siop_pci_attach_common(struct siop_pci_common_softc *pci_sc,
|
|||
siop_sc->sc_rh = ioh;
|
||||
siop_sc->sc_raddr = ioaddr;
|
||||
} else {
|
||||
aprint_error_dev(&siop_sc->sc_dev, "unable to map device registers\n");
|
||||
aprint_error_dev(siop_sc->sc_dev, "unable to map device registers\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -313,32 +313,32 @@ siop_pci_attach_common(struct siop_pci_common_softc *pci_sc,
|
|||
bar = 0x1c;
|
||||
break;
|
||||
default:
|
||||
aprint_error_dev(&siop_sc->sc_dev, "invalid memory type %d\n",
|
||||
aprint_error_dev(siop_sc->sc_dev, "invalid memory type %d\n",
|
||||
memtype);
|
||||
return 0;
|
||||
}
|
||||
if (pci_mapreg_map(pa, bar, memtype, 0,
|
||||
&siop_sc->sc_ramt, &siop_sc->sc_ramh,
|
||||
&siop_sc->sc_scriptaddr, NULL) == 0) {
|
||||
aprint_normal_dev(&siop_sc->sc_dev, "using on-board RAM\n");
|
||||
aprint_normal_dev(siop_sc->sc_dev, "using on-board RAM\n");
|
||||
} else {
|
||||
aprint_error_dev(&siop_sc->sc_dev, "can't map on-board RAM\n");
|
||||
aprint_error_dev(siop_sc->sc_dev, "can't map on-board RAM\n");
|
||||
siop_sc->features &= ~SF_CHIP_RAM;
|
||||
}
|
||||
}
|
||||
|
||||
if (pci_intr_map(pa, &intrhandle) != 0) {
|
||||
aprint_error_dev(&siop_sc->sc_dev, "couldn't map interrupt\n");
|
||||
aprint_error_dev(siop_sc->sc_dev, "couldn't map interrupt\n");
|
||||
return 0;
|
||||
}
|
||||
intrstr = pci_intr_string(pa->pa_pc, intrhandle);
|
||||
pci_sc->sc_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO,
|
||||
intr, siop_sc);
|
||||
if (pci_sc->sc_ih != NULL) {
|
||||
aprint_normal_dev(&siop_sc->sc_dev, "interrupting at %s\n",
|
||||
aprint_normal_dev(siop_sc->sc_dev, "interrupting at %s\n",
|
||||
intrstr ? intrstr : "unknown interrupt");
|
||||
} else {
|
||||
aprint_error_dev(&siop_sc->sc_dev, "couldn't establish interrupt");
|
||||
aprint_error_dev(siop_sc->sc_dev, "couldn't establish interrupt");
|
||||
if (intrstr != NULL)
|
||||
aprint_normal(" at %s", intrstr);
|
||||
aprint_normal("\n");
|
||||
|
|
Loading…
Reference in New Issue