Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/podulebus Add a driver for the HCCS IDE interface I ...
details: https://anonhg.NetBSD.org/src/rev/2ce7ce6eb2dc
branches: trunk
changeset: 511169:2ce7ce6eb2dc
user: bjh21 <bjh21%NetBSD.org@localhost>
date: Wed Jun 13 18:31:43 2001 +0000
description:
Add a driver for the HCCS IDE interface I got at Wakefield. Like the D.T.
Software one (dtide), it doesn't generate interrupts, so we run it in polled
mode.
diffstat:
sys/dev/podulebus/files.podulebus | 7 ++-
sys/dev/podulebus/hcide.c | 106 ++++++++++++++++++++++++++++++++++++++
sys/dev/podulebus/hcidereg.h | 16 +++++
3 files changed, 128 insertions(+), 1 deletions(-)
diffs (151 lines):
diff -r e1d182d075cd -r 2ce7ce6eb2dc sys/dev/podulebus/files.podulebus
--- a/sys/dev/podulebus/files.podulebus Wed Jun 13 18:29:40 2001 +0000
+++ b/sys/dev/podulebus/files.podulebus Wed Jun 13 18:31:43 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.podulebus,v 1.9 2001/06/08 22:33:59 bjh21 Exp $
+# $NetBSD: files.podulebus,v 1.10 2001/06/13 18:31:43 bjh21 Exp $
# Oak SCSI
device oak: scsi, ncr5380sbc
@@ -15,6 +15,11 @@
attach dtide at podulebus
file dev/podulebus/dtide.c dtide
+# HCCS IDE
+device hcide: wdc_base, ata, atapi
+attach hcide at podulebus
+file dev/podulebus/hcide.c hcide
+
# Acorn Ether1
device ei: ether, ifnet, arp, i82586
attach ei at podulebus
diff -r e1d182d075cd -r 2ce7ce6eb2dc sys/dev/podulebus/hcide.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/podulebus/hcide.c Wed Jun 13 18:31:43 2001 +0000
@@ -0,0 +1,106 @@
+/* $NetBSD: hcide.c,v 1.1 2001/06/13 18:31:43 bjh21 Exp $ */
+
+/*-
+ * Copyright (c) 2000, 2001 Ben Harris
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * hcide.c - Driver for the HCCS 16-bit IDE interface.
+ */
+
+#include <sys/param.h>
+
+__KERNEL_RCSID(0, "$NetBSD: hcide.c,v 1.1 2001/06/13 18:31:43 bjh21 Exp $");
+
+#include <sys/device.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+
+#include <dev/podulebus/podulebus.h>
+#include <dev/podulebus/podules.h>
+#include <dev/podulebus/hcidereg.h>
+
+#include <dev/ata/atavar.h>
+#include <dev/ic/wdcvar.h>
+
+struct hcide_softc {
+ struct wdc_softc sc_wdc;
+ struct channel_softc *sc_chp[HCIDE_NCHANNELS];/* pointers to sc_chan */
+ struct channel_softc sc_chan[HCIDE_NCHANNELS];
+ struct channel_queue sc_chq[HCIDE_NCHANNELS];
+};
+
+static void hcide_attach (struct device *, struct device *, void *);
+static int hcide_match (struct device *, struct cfdata *, void *);
+
+struct cfattach hcide_ca = {
+ sizeof(struct hcide_softc), hcide_match, hcide_attach
+};
+
+static const int hcide_cmdoffsets[] = { HCIDE_CMD0, HCIDE_CMD1, HCIDE_CMD2 };
+static const int hcide_ctloffsets[] = { HCIDE_CTL, HCIDE_CTL, HCIDE_CTL };
+
+static int
+hcide_match(struct device *parent, struct cfdata *cf, void *aux)
+{
+ struct podulebus_attach_args *pa = aux;
+
+ if (pa->pa_product == PODULE_HCCS_IDESCSI &&
+ strncmp(pa->pa_descr, "IDE", 3) == 0)
+ return 1;
+ return 0;
+}
+
+static void
+hcide_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct hcide_softc *sc = (void *)self;
+ struct podulebus_attach_args *pa = aux;
+ int i;
+
+ sc->sc_wdc.cap = WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_NOIRQ;
+ sc->sc_wdc.PIO_cap = 0; /* XXX correct? */
+ sc->sc_wdc.DMA_cap = 0; /* XXX correct? */
+ sc->sc_wdc.UDMA_cap = 0;
+ sc->sc_wdc.nchannels = HCIDE_NCHANNELS;
+ sc->sc_wdc.channels = sc->sc_chp;
+ printf("\n");
+ for (i = 0; i < HCIDE_NCHANNELS; i++) {
+ sc->sc_chp[i] = &sc->sc_chan[i];
+ sc->sc_chan[i].channel = i;
+ sc->sc_chan[i].wdc = &sc->sc_wdc;
+ sc->sc_chan[i].cmd_iot = pa->pa_mod_t;
+ sc->sc_chan[i].ctl_iot = pa->pa_mod_t;
+ sc->sc_chan[i].ch_queue = &sc->sc_chq[i];
+ bus_space_map(pa->pa_fast_t,
+ pa->pa_fast_base + hcide_cmdoffsets[i], 0, 8,
+ &sc->sc_chan[i].cmd_ioh);
+ bus_space_map(pa->pa_fast_t,
+ pa->pa_fast_base + hcide_ctloffsets[i], 0, 8,
+ &sc->sc_chan[i].ctl_ioh);
+ wdcattach(&sc->sc_chan[i]);
+ }
+}
diff -r e1d182d075cd -r 2ce7ce6eb2dc sys/dev/podulebus/hcidereg.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/podulebus/hcidereg.h Wed Jun 13 18:31:43 2001 +0000
@@ -0,0 +1,16 @@
+/* $NetBSD: hcidereg.h,v 1.1 2001/06/13 18:31:43 bjh21 Exp $ */
+
+/* This file is in the public domain */
+
+/*
+ * hcidereg.h - hardware-related constants of the HCCS IDE interface.
+ */
+
+#define HCIDE_NCHANNELS 3
+
+/* In FAST space: */
+
+#define HCIDE_CMD0 0x2100 /* Command registers, on-board channel */
+#define HCIDE_CMD1 0x2140 /* Command registers, internal channel */
+#define HCIDE_CMD2 0x2180 /* Command registers, external channel */
+#define HCIDE_CTL 0x21c0 /* Control registers, all channels */
Home |
Main Index |
Thread Index |
Old Index