Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mipsco Support for ISA expansion slot in Mips 3230



details:   https://anonhg.NetBSD.org/src/rev/81af46c7a809
branches:  trunk
changeset: 507752:81af46c7a809
user:      wdk <wdk%NetBSD.org@localhost>
date:      Fri Mar 30 23:45:18 2001 +0000

description:
Support for ISA expansion slot in Mips 3230

The ISA Bus on this machine doesn't support DMA, and all interrupt lines
are wire-OR'ed together.   Mileage may vary if sharing interrupts.

Tested cards:
     com:  8250 and 16550 UART's (8 bit)
     ec:   3com Etherlink II (8 bit)
     we:   SMC 8013 Ethernet (16 bit) [work in progress]
             Probes, ARP in both directions works, sends clean packets,
             tcpdump show correct packets on receive, NDP for IPv6 works,
             netstat -s shows nothing strange.. but doesn't talk TCP/IP!

diffstat:

 sys/arch/mipsco/include/isa_machdep.h    |  129 +++++++++++++++
 sys/arch/mipsco/include/isapnp_machdep.h |   46 +++++
 sys/arch/mipsco/isa/isa_machdep.c        |  259 +++++++++++++++++++++++++++++++
 3 files changed, 434 insertions(+), 0 deletions(-)

diffs (truncated from 446 to 300 lines):

diff -r 9a72e8064183 -r 81af46c7a809 sys/arch/mipsco/include/isa_machdep.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/mipsco/include/isa_machdep.h     Fri Mar 30 23:45:18 2001 +0000
@@ -0,0 +1,129 @@
+/*     $NetBSD: isa_machdep.h,v 1.1 2001/03/30 23:45:19 wdk Exp $      */
+
+/*-
+ * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ *     @(#)isa.h       5.7 (Berkeley) 5/9/91
+ */
+
+/*
+ * Various pieces of the i386 port want to include this file without
+ * or in spite of using isavar.h, and should be fixed.
+ */
+
+#ifndef _ISA_MACHDEP_H_                        /* XXX */
+#define _ISA_MACHDEP_H_                        /* XXX */
+
+#include <machine/bus.h>
+
+/*
+ * XXX THIS FILE IS A MESS.  copyright: berkeley's probably.
+ * contents from isavar.h and isareg.h, mostly the latter.
+ * perhaps charles's?
+ *
+ * copyright from berkeley's isa.h which is now dev/isa/isareg.h.
+ */
+
+/*
+ * Types provided to machine-independent ISA code.
+ */
+struct mipsco_isa_chipset {
+       struct device           sc_dev;
+       struct mipsco_intrhand  ic_intr; /* XXX */
+        struct evcnt           ic_intrcnt; /* Interrupt counter */
+       bus_space_tag_t         ic_bst; /* bus_space tag */
+       bus_space_handle_t      ic_bsh; /* interrupt control register */
+       LIST_HEAD(,mipsco_intrhand)
+               intr_q;
+};
+
+typedef struct mipsco_isa_chipset *isa_chipset_tag_t;
+
+struct device;                 /* XXX */
+struct isabus_attach_args;     /* XXX */
+
+/*
+ * Functions provided to machine-independent ISA code.
+ */
+void   isa_attach_hook(struct device *, struct device *,
+           struct isabus_attach_args *);
+int    isa_intr_alloc(isa_chipset_tag_t, int, int, int *);
+const struct evcnt *isa_intr_evcnt(isa_chipset_tag_t ic, int irq);
+void   *isa_intr_establish(isa_chipset_tag_t ic, int irq, int type,
+           int level, int (*ih_fun)(void *), void *ih_arg);
+void   isa_intr_disestablish(isa_chipset_tag_t ic, void *handler);
+int    isa_mem_alloc(bus_space_tag_t, bus_size_t, bus_size_t,
+           bus_addr_t, int, bus_addr_t *, bus_space_handle_t *);
+void   isa_mem_free(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+
+
+#endif /* _ISA_MACHDEP_H_ XXX */
diff -r 9a72e8064183 -r 81af46c7a809 sys/arch/mipsco/include/isapnp_machdep.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/mipsco/include/isapnp_machdep.h  Fri Mar 30 23:45:18 2001 +0000
@@ -0,0 +1,46 @@
+/*     $NetBSD: isapnp_machdep.h,v 1.1 2001/03/30 23:45:19 wdk Exp $   */
+
+/*-
+ * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center and by Christos Zoulas.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+/*
+ * Functions provided to machine-independent ISA PnP code.
+ */
+int    isapnp_map(struct isapnp_softc *);
+void   isapnp_unmap(struct isapnp_softc *);
+int    isapnp_map_readport(struct isapnp_softc *);
+void   isapnp_unmap_readport(struct isapnp_softc *);
diff -r 9a72e8064183 -r 81af46c7a809 sys/arch/mipsco/isa/isa_machdep.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/mipsco/isa/isa_machdep.c Fri Mar 30 23:45:18 2001 +0000
@@ -0,0 +1,259 @@
+/*     $NetBSD: isa_machdep.c,v 1.1 2001/03/30 23:45:18 wdk Exp $      */
+
+/*
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Wayne Knowles
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/queue.h>
+
+#include <machine/sysconf.h>
+#include <machine/autoconf.h>
+#include <machine/mainboard.h>
+#include <machine/bus.h>
+
+#include <dev/isa/isavar.h>
+#include <dev/isa/isareg.h>
+
+static int     isabusprint __P((void *auxp, const char *));
+static int     isabusmatch __P((struct device *, struct cfdata *, void *));
+static void    isabusattach __P((struct device *, struct device *, void *));
+
+struct isabus_softc {
+       struct device           sc_dev;
+       struct mipsco_isa_chipset sc_isa_ic;
+};
+
+struct cfattach isabus_ca = {
+       sizeof(struct isabus_softc), isabusmatch, isabusattach
+};
+
+extern struct cfdriver isabus_cd;
+
+static struct mipsco_bus_space isa_io_bst, isa_mem_bst, isa_ctl_bst;
+static struct mipsco_bus_dma_tag isa_dmatag;
+
+static void isa_bus_space_init __P((struct mipsco_bus_space *, const char *,
+                                    paddr_t, size_t));
+int    isa_intr __P((void *));
+
+
+int
+isabusmatch(pdp, cfp, aux)
+struct device  *pdp;
+struct cfdata  *cfp;
+void           *aux;
+{
+       struct confargs *ca = aux;
+
+       if (strcmp(ca->ca_name, isabus_cd.cd_name) != 0)
+               return 0;
+       return 1;
+}
+
+static void
+isa_bus_space_init(bst, type, paddr, len)
+    struct mipsco_bus_space *bst;
+    const char *type;
+    paddr_t paddr;
+    size_t len;
+{
+       vaddr_t vaddr = MIPS_PHYS_TO_KSEG1(paddr); /* XXX */
+
+       /* Setup default bus_space */
+       mipsco_bus_space_init(bst, type, paddr, vaddr, 0x0, len);
+
+       /* ISA bus maps 1 word for every byte, therefore stride = 2 */
+       mipsco_bus_space_set_aligned_stride(bst, 2);
+
+       /*
+        * ISA bus will do an automatic byte swap, but when accessing
+        * memory using bus_space_stream functions we need to byte swap
+        * to reverse the one performed in hardware
+        */
+       bst->bs_bswap = 1;
+
+       bst->bs_intr_establish = (void *)isa_intr_establish;
+
+       printf(" %s %p", type, (void *)vaddr);



Home | Main Index | Thread Index | Old Index