Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/cobalt NetBSD/cobalt. Work-in-progress.



details:   https://anonhg.NetBSD.org/src/rev/117e3690fb3f
branches:  trunk
changeset: 483863:117e3690fb3f
user:      soren <soren%NetBSD.org@localhost>
date:      Sun Mar 19 23:07:43 2000 +0000

description:
NetBSD/cobalt. Work-in-progress.

diffstat:

 sys/arch/cobalt/Makefile                 |   31 +
 sys/arch/cobalt/cobalt/autoconf.c        |   80 +++
 sys/arch/cobalt/cobalt/bus.c             |  792 +++++++++++++++++++++++++++++++
 sys/arch/cobalt/cobalt/clock.c           |  125 ++++
 sys/arch/cobalt/cobalt/conf.c            |  183 +++++++
 sys/arch/cobalt/cobalt/console.c         |   58 ++
 sys/arch/cobalt/cobalt/cpu.c             |   59 ++
 sys/arch/cobalt/cobalt/disksubr.c        |  341 +++++++++++++
 sys/arch/cobalt/cobalt/locore_machdep.S  |   51 +
 sys/arch/cobalt/cobalt/machdep.c         |  484 ++++++++++++++++++
 sys/arch/cobalt/cobalt/mainbus.c         |  113 ++++
 sys/arch/cobalt/cobalt/md_root.c         |   85 +++
 sys/arch/cobalt/compile/.keep_me         |    3 +
 sys/arch/cobalt/conf/Makefile.cobalt     |  228 ++++++++
 sys/arch/cobalt/conf/RAQ                 |   57 ++
 sys/arch/cobalt/conf/files.cobalt        |   64 ++
 sys/arch/cobalt/conf/std.cobalt          |   16 +
 sys/arch/cobalt/dev/com_mainbus.c        |  102 +++
 sys/arch/cobalt/dev/gt.c                 |   98 +++
 sys/arch/cobalt/include/Makefile         |   13 +
 sys/arch/cobalt/include/ansi.h           |    3 +
 sys/arch/cobalt/include/aout_machdep.h   |    3 +
 sys/arch/cobalt/include/autoconf.h       |   11 +
 sys/arch/cobalt/include/bsd-aout.h       |    3 +
 sys/arch/cobalt/include/bswap.h          |    3 +
 sys/arch/cobalt/include/bus.h            |  644 +++++++++++++++++++++++++
 sys/arch/cobalt/include/cdefs.h          |    3 +
 sys/arch/cobalt/include/conf.h           |    8 +
 sys/arch/cobalt/include/cpu.h            |   11 +
 sys/arch/cobalt/include/db_machdep.h     |    6 +
 sys/arch/cobalt/include/disklabel.h      |   23 +
 sys/arch/cobalt/include/ecoff_machdep.h  |    3 +
 sys/arch/cobalt/include/elf_machdep.h    |    5 +
 sys/arch/cobalt/include/endian.h         |    3 +
 sys/arch/cobalt/include/endian_machdep.h |    4 +
 sys/arch/cobalt/include/float.h          |    3 +
 sys/arch/cobalt/include/ieee.h           |    3 +
 sys/arch/cobalt/include/ieeefp.h         |    3 +
 sys/arch/cobalt/include/intr.h           |   74 ++
 sys/arch/cobalt/include/kcore.h          |    3 +
 sys/arch/cobalt/include/kdbparam.h       |    3 +
 sys/arch/cobalt/include/leds.h           |   32 +
 sys/arch/cobalt/include/limits.h         |    3 +
 sys/arch/cobalt/include/locore.h         |    3 +
 sys/arch/cobalt/include/mips_opcode.h    |    3 +
 sys/arch/cobalt/include/nvram.h          |   48 +
 sys/arch/cobalt/include/param.h          |   49 +
 sys/arch/cobalt/include/pcb.h            |    3 +
 sys/arch/cobalt/include/pci_machdep.h    |   68 ++
 sys/arch/cobalt/include/pmap.h           |    3 +
 sys/arch/cobalt/include/proc.h           |    3 +
 sys/arch/cobalt/include/profile.h        |    3 +
 sys/arch/cobalt/include/psl.h            |    3 +
 sys/arch/cobalt/include/pte.h            |    3 +
 sys/arch/cobalt/include/ptrace.h         |    3 +
 sys/arch/cobalt/include/reg.h            |    3 +
 sys/arch/cobalt/include/regdef.h         |    3 +
 sys/arch/cobalt/include/regnum.h         |    3 +
 sys/arch/cobalt/include/reloc.h          |    5 +
 sys/arch/cobalt/include/setjmp.h         |    3 +
 sys/arch/cobalt/include/signal.h         |    3 +
 sys/arch/cobalt/include/stdarg.h         |    3 +
 sys/arch/cobalt/include/trap.h           |    3 +
 sys/arch/cobalt/include/types.h          |    3 +
 sys/arch/cobalt/include/varargs.h        |    3 +
 sys/arch/cobalt/include/vmparam.h        |    8 +
 sys/arch/cobalt/pci/isaintr.c            |  367 ++++++++++++++
 sys/arch/cobalt/pci/pchb.c               |   88 +++
 sys/arch/cobalt/pci/pci_machdep.c        |  191 +++++++
 sys/arch/cobalt/pci/pcib.c               |   74 ++
 sys/arch/cobalt/pci/pciide_machdep.c     |   60 ++
 71 files changed, 4852 insertions(+), 0 deletions(-)

diffs (truncated from 5136 to 300 lines):

diff -r 9ed193c11f1b -r 117e3690fb3f sys/arch/cobalt/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/cobalt/Makefile  Sun Mar 19 23:07:43 2000 +0000
@@ -0,0 +1,31 @@
+#      $NetBSD: Makefile,v 1.1 2000/03/19 23:07:43 soren Exp $
+
+# Makefile for cobalt tags file
+
+# Find where mips source files are for inclusion in tags
+.include <../mips/Makefile.inc>
+
+TCOBALT=       ../cobalt/tags
+SCOBALT=       ../cobalt/cobalt/*.[ch] ../cobalt/include/*.h \
+               ../cobalt/pci/*.[ch]
+ACOBALT=       ../cobalt/cobalt/*.S
+
+# Directories in which to place tags links
+DCOBALT=       pci include
+
+.include "../../kern/Make.tags.inc"
+
+tags:
+       -ctags -wdtf ${TCOBALT} ${SCOBALT} ${SMIPS} ${COMM}
+       egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${ACOBALT} ${AMIPS} | \
+           sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
+               >> ${TCOBALT}
+       sort -o ${TCOBALT} ${TCOBALT}
+
+links:
+       -for i in ${DCOBALT}; do \
+           cd $$i && rm -f tags; ln -s ../tags tags; done
+
+SUBDIR=        include
+
+.include <bsd.subdir.mk>
diff -r 9ed193c11f1b -r 117e3690fb3f sys/arch/cobalt/cobalt/autoconf.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/cobalt/cobalt/autoconf.c Sun Mar 19 23:07:43 2000 +0000
@@ -0,0 +1,80 @@
+/*     $NetBSD: autoconf.c,v 1.1 2000/03/19 23:07:43 soren Exp $       */
+
+/*
+ * Copyright (c) 2000 Soren S. Jorvang.  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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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/buf.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+
+#include <machine/cpu.h>
+
+void   findroot(struct device **, int *);
+
+int    cpuspeed = 100; /* XXX Approximate number of instructions per usec */
+
+void   initicu(void);
+
+void
+cpu_configure()
+{
+       (void)splhigh();
+
+       initicu();                                              /* XXX */
+
+       if (config_rootfound("mainbus", "mainbus") == NULL)
+               panic("no mainbus found");
+
+       _splnone();
+}
+
+void
+cpu_rootconf()
+{
+       struct device *booted_device;
+       int booted_partition;
+
+       findroot(&booted_device, &booted_partition);
+
+       printf("boot device: %s\n",
+               booted_device ? booted_device->dv_xname : "<unknown>");
+
+       setroot(booted_device, booted_partition);
+}
+
+dev_t  bootdev = 0;
+
+void
+findroot(devpp, partp)
+       struct device **devpp;
+       int *partp;
+{
+       *devpp = NULL;
+       *partp = 0;
+
+       return;
+}
diff -r 9ed193c11f1b -r 117e3690fb3f sys/arch/cobalt/cobalt/bus.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/cobalt/cobalt/bus.c      Sun Mar 19 23:07:43 2000 +0000
@@ -0,0 +1,792 @@
+/*     $NetBSD: bus.c,v 1.1 2000/03/19 23:07:43 soren Exp $    */
+
+/*
+ * Copyright (c) 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.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/mbuf.h>
+
+#define _COBALT_BUS_DMA_PRIVATE
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <mips/cpuregs.h>
+#include <mips/locore.h>
+
+static int     _bus_dmamap_load_buffer(bus_dmamap_t, void *, bus_size_t,
+                               struct proc *, int, vaddr_t *, int *, int);
+
+struct cobalt_bus_dma_tag cobalt_default_bus_dma_tag = {
+       _bus_dmamap_create,
+       _bus_dmamap_destroy,
+       _bus_dmamap_load,
+       _bus_dmamap_load_mbuf,
+       _bus_dmamap_load_uio,
+       _bus_dmamap_load_raw,
+       _bus_dmamap_unload,
+       _bus_dmamap_sync,
+       _bus_dmamem_alloc,
+       _bus_dmamem_free,
+       _bus_dmamem_map,
+       _bus_dmamem_unmap,
+       _bus_dmamem_mmap,
+};
+
+int
+bus_space_map(t, bpa, size, flags, bshp)
+       bus_space_tag_t t;
+       bus_addr_t bpa;
+       bus_size_t size;
+       int flags;
+       bus_space_handle_t *bshp;
+{
+       int cacheable = flags & BUS_SPACE_MAP_CACHEABLE;
+
+
+       if (cacheable)
+               *bshp = MIPS_PHYS_TO_KSEG0(bpa);
+       else
+               *bshp = MIPS_PHYS_TO_KSEG1(bpa);
+
+       /* Evil! */
+       if (bpa < 0x10000000)
+               *bshp += 0x10000000;
+
+       return 0;
+}
+
+int
+bus_space_alloc(t, rstart, rend, size, alignment, boundary, flags, bpap, bshp)
+       bus_space_tag_t t;
+       bus_addr_t rstart, rend;
+       bus_size_t size, alignment, boundary;
+       int flags;
+       bus_addr_t *bpap;
+       bus_space_handle_t *bshp;
+{
+       panic("bus_space_alloc: not implemented");
+}
+
+void
+bus_space_free(t, bsh, size)
+       bus_space_tag_t t;
+       bus_space_handle_t bsh;
+       bus_size_t size;
+{
+       panic("bus_space_free: not implemented");
+}
+
+void
+bus_space_unmap(t, bsh, size)
+       bus_space_tag_t t;
+       bus_space_handle_t bsh;
+       bus_size_t size;
+{
+       return;
+}
+
+int
+bus_space_subregion(t, bsh, offset, size, nbshp)
+       bus_space_tag_t t;
+       bus_space_handle_t bsh;
+       bus_size_t offset, size;
+       bus_space_handle_t *nbshp;
+{
+
+       *nbshp = bsh + offset;
+       return 0;
+}
+
+/*
+ * Common function for DMA map creation.  May be called by bus-specific
+ * DMA map creation functions.
+ */
+int
+_bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
+       bus_dma_tag_t t;
+       bus_size_t size;
+       int nsegments;
+       bus_size_t maxsegsz;
+       bus_size_t boundary;
+       int flags;
+       bus_dmamap_t *dmamp;
+{
+       struct cobalt_bus_dmamap *map;
+       void *mapstore;
+       size_t mapsize;
+
+       /*
+        * Allcoate and initialize the DMA map.  The end of the map
+        * is a variable-sized array of segments, so we allocate enough
+        * room for them in one shot.
+        *
+        * Note we don't preserve the WAITOK or NOWAIT flags.  Preservation
+        * of ALLOCNOW notifes others that we've reserved these resources,
+        * and they are not to be freed.
+        *
+        * The bus_dmamap_t includes one bus_dma_segment_t, hence
+        * the (nsegments - 1).
+        */
+       mapsize = sizeof(struct cobalt_bus_dmamap) +
+           (sizeof(bus_dma_segment_t) * (nsegments - 1));
+       if ((mapstore = malloc(mapsize, M_DMAMAP,
+           (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)



Home | Main Index | Thread Index | Old Index