Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic For the ESP406/FAS408, add sc_cfg4 and sc_cfg5.
details: https://anonhg.NetBSD.org/src/rev/2c38a6e52774
branches: trunk
changeset: 483851:2c38a6e52774
user: mycroft <mycroft%NetBSD.org@localhost>
date: Sun Mar 19 21:25:49 2000 +0000
description:
For the ESP406/FAS408, add sc_cfg4 and sc_cfg5.
Add a detach routine, and do the addref/delref.
diffstat:
sys/dev/ic/ncr53c9x.c | 61 ++++++++++++++++++++++++++++++++++++-----------
sys/dev/ic/ncr53c9xvar.h | 6 +++-
2 files changed, 52 insertions(+), 15 deletions(-)
diffs (124 lines):
diff -r 76b986b4b136 -r 2c38a6e52774 sys/dev/ic/ncr53c9x.c
--- a/sys/dev/ic/ncr53c9x.c Sun Mar 19 19:16:13 2000 +0000
+++ b/sys/dev/ic/ncr53c9x.c Sun Mar 19 21:25:49 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr53c9x.c,v 1.43 2000/03/18 22:18:57 mycroft Exp $ */
+/* $NetBSD: ncr53c9x.c,v 1.44 2000/03/19 21:25:49 mycroft Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -205,11 +205,6 @@
/* CCF register only has 3 bits; 0 is actually 8 */
sc->sc_ccf &= 7;
- /* Reset state & bus */
- sc->sc_cfflags = sc->sc_dev.dv_cfdata->cf_flags;
- sc->sc_state = 0;
- ncr53c9x_init(sc, 1);
-
/*
* fill in the prototype scsipi_link.
*/
@@ -223,22 +218,60 @@
sc->sc_link.scsipi_scsi.max_lun = 7;
sc->sc_link.type = BUS_SCSI;
+ /* Initialize CFG4 and CFG5, and disable interrupts. */
+ if ((sc->sc_rev == NCR_VARIANT_ESP406) ||
+ (sc->sc_rev == NCR_VARIANT_FAS408)) {
+ NCR_WRITE_REG(sc, NCR_CFG5, sc->sc_cfg5);
+ NCR_WRITE_REG(sc, NCR_CFG4, sc->sc_cfg4);
+ }
+
+ /*
+ * Add reference to adapter so that we drop the reference after
+ * config_found() to make sure the adatper is disabled.
+ */
+ if (scsipi_adapter_addref(&sc->sc_link) != 0) {
+ printf("%s: unable to enable controller\n",
+ sc->sc_dev.dv_xname);
+ return;
+ }
+
+ /* Reset state & bus */
+ sc->sc_cfflags = sc->sc_dev.dv_cfdata->cf_flags;
+ sc->sc_state = 0;
+ ncr53c9x_init(sc, 1);
+
/*
* Now try to attach all the sub-devices
*/
- config_found(&sc->sc_dev, &sc->sc_link, scsiprint);
+ sc->sc_child = config_found(&sc->sc_dev, &sc->sc_link, scsiprint);
- /*
- * Enable interupts from the SCSI core
- */
+ scsipi_adapter_delref(&sc->sc_link);
+
+ /* Enable interrupts. */
if ((sc->sc_rev == NCR_VARIANT_ESP406) ||
(sc->sc_rev == NCR_VARIANT_FAS408)) {
- NCR_PIOREGS(sc);
- NCR_WRITE_REG(sc, NCR_CFG5, NCRCFG5_SINT |
- NCR_READ_REG(sc, NCR_CFG5));
- NCR_SCSIREGS(sc);
+ NCR_WRITE_REG(sc, NCR_CFG5, sc->sc_cfg5 | NCRCFG5_SINT);
+ NCR_WRITE_REG(sc, NCR_CFG4, sc->sc_cfg4);
+ }
+}
+
+int
+ncr53c9x_detach(sc, flags)
+ struct ncr53c9x_softc *sc;
+ int flags;
+{
+ int error;
+
+ if (sc->sc_child) {
+ error = config_detach(sc->sc_child, flags);
+ if (error)
+ return (error);
}
+ free(sc->sc_imess, M_DEVBUF);
+ free(sc->sc_omess, M_DEVBUF);
+
+ return (0);
}
/*
diff -r 76b986b4b136 -r 2c38a6e52774 sys/dev/ic/ncr53c9xvar.h
--- a/sys/dev/ic/ncr53c9xvar.h Sun Mar 19 19:16:13 2000 +0000
+++ b/sys/dev/ic/ncr53c9xvar.h Sun Mar 19 21:25:49 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr53c9xvar.h,v 1.21 2000/03/18 22:18:57 mycroft Exp $ */
+/* $NetBSD: ncr53c9xvar.h,v 1.22 2000/03/19 21:25:49 mycroft Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -234,6 +234,7 @@
struct evcnt sc_intrcnt; /* intr count */
struct scsipi_link sc_link; /* scsipi link struct */
struct scsipi_adapter sc_adapter; /* scsipi adapter glue */
+ struct device *sc_child; /* attached scsibus, if any */
struct ncr53c9x_glue *sc_glue; /* glue to MD code */
@@ -244,6 +245,8 @@
u_char sc_cfg2; /* Config 2, not ESP100 */
u_char sc_cfg3; /* Config 3, only ESP200 */
u_char sc_cfg3_fscsi; /* Chip-specific FSCSI bit */
+ u_char sc_cfg4; /* Config 3, only ESP200 */
+ u_char sc_cfg5; /* Config 3, only ESP200 */
u_char sc_ccf; /* Clock Conversion */
u_char sc_timeout;
@@ -393,6 +396,7 @@
((250 * (cpb)) / (sc)->sc_freq)
void ncr53c9x_attach __P((struct ncr53c9x_softc *, struct scsipi_device *));
+int ncr53c9x_detach __P((struct ncr53c9x_softc *, int));
int ncr53c9x_scsi_cmd __P((struct scsipi_xfer *));
void ncr53c9x_reset __P((struct ncr53c9x_softc *));
int ncr53c9x_intr __P((void *));
Home |
Main Index |
Thread Index |
Old Index