Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amigappc Initial AmigaPPC commit.



details:   https://anonhg.NetBSD.org/src/rev/af0cc5661b45
branches:  trunk
changeset: 486568:af0cc5661b45
user:      is <is%NetBSD.org@localhost>
date:      Thu May 25 22:11:57 2000 +0000

description:
Initial AmigaPPC commit.

Lots of the work was done by Adam Ciarcinsky.

Currently, this only supports CyberPPC boards by Phase 5. Blizzard PPC
expected later.

The kernel is useless but for demonstrating that it starts... especially
interupts, and most of MMU support, is not in yet. Builtin console works,
however, and you can look at the kernel startup messages.

diffstat:

 sys/arch/amigappc/amigappc/amiga_init.c    |    94 +
 sys/arch/amigappc/amigappc/cc.c            |   719 ++++++++++++++
 sys/arch/amigappc/amigappc/genassym.cf     |    70 +
 sys/arch/amigappc/amigappc/locore.S        |  1437 ++++++++++++++++++++++++++++
 sys/arch/amigappc/amigappc/machdep.c       |   891 +++++++++++++++++
 sys/arch/amigappc/conf/Makefile.amigappc   |   210 ++++
 sys/arch/amigappc/conf/NULL                |   323 ++++++
 sys/arch/amigappc/conf/files.amigappc      |   416 ++++++++
 sys/arch/amigappc/conf/std.amigappc        |    14 +
 sys/arch/amigappc/include/Makefile         |    13 +
 sys/arch/amigappc/include/ansi.h           |     3 +
 sys/arch/amigappc/include/aout_machdep.h   |     3 +
 sys/arch/amigappc/include/asm.h            |     3 +
 sys/arch/amigappc/include/bat.h            |     3 +
 sys/arch/amigappc/include/bswap.h          |     3 +
 sys/arch/amigappc/include/bus.h            |   289 +++++
 sys/arch/amigappc/include/cdefs.h          |     3 +
 sys/arch/amigappc/include/conf.h           |    92 +
 sys/arch/amigappc/include/cpu.h            |    93 +
 sys/arch/amigappc/include/cpufunc.h        |     8 +
 sys/arch/amigappc/include/db_machdep.h     |     3 +
 sys/arch/amigappc/include/disklabel.h      |   205 +++
 sys/arch/amigappc/include/elf_machdep.h    |     3 +
 sys/arch/amigappc/include/endian.h         |     3 +
 sys/arch/amigappc/include/endian_machdep.h |     3 +
 sys/arch/amigappc/include/fbio.h           |    46 +
 sys/arch/amigappc/include/float.h          |     3 +
 sys/arch/amigappc/include/fpu.h            |     3 +
 sys/arch/amigappc/include/frame.h          |     3 +
 sys/arch/amigappc/include/hid.h            |    98 +
 sys/arch/amigappc/include/ieee.h           |     3 +
 sys/arch/amigappc/include/ieeefp.h         |     3 +
 sys/arch/amigappc/include/intr.h           |   247 ++++
 sys/arch/amigappc/include/ipkdb.h          |     3 +
 sys/arch/amigappc/include/kcore.h          |     3 +
 sys/arch/amigappc/include/limits.h         |     3 +
 sys/arch/amigappc/include/lock.h           |     3 +
 sys/arch/amigappc/include/machine_type.h   |     3 +
 sys/arch/amigappc/include/mtpr.h           |    96 +
 sys/arch/amigappc/include/p5reg.h          |    96 +
 sys/arch/amigappc/include/param.h          |   167 +++
 sys/arch/amigappc/include/pcb.h            |     3 +
 sys/arch/amigappc/include/pmap.h           |     3 +
 sys/arch/amigappc/include/powerpc.h        |    58 +
 sys/arch/amigappc/include/proc.h           |     3 +
 sys/arch/amigappc/include/profile.h        |     3 +
 sys/arch/amigappc/include/psl.h            |     5 +
 sys/arch/amigappc/include/pte.h            |     3 +
 sys/arch/amigappc/include/ptrace.h         |     3 +
 sys/arch/amigappc/include/reg.h            |     3 +
 sys/arch/amigappc/include/reloc.h          |     3 +
 sys/arch/amigappc/include/setjmp.h         |     3 +
 sys/arch/amigappc/include/signal.h         |     3 +
 sys/arch/amigappc/include/stdarg.h         |     3 +
 sys/arch/amigappc/include/svr4_machdep.h   |     9 +
 sys/arch/amigappc/include/trap.h           |    11 +
 sys/arch/amigappc/include/types.h          |     3 +
 sys/arch/amigappc/include/varargs.h        |     3 +
 sys/arch/amigappc/include/vmparam.h        |   112 ++
 59 files changed, 5918 insertions(+), 0 deletions(-)

diffs (truncated from 6154 to 300 lines):

diff -r a07995d8c28a -r af0cc5661b45 sys/arch/amigappc/amigappc/amiga_init.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amigappc/amigappc/amiga_init.c   Thu May 25 22:11:57 2000 +0000
@@ -0,0 +1,94 @@
+/*     $NetBSD: amiga_init.c,v 1.1 2000/05/25 22:11:57 is Exp $        */
+
+/*
+ * Copyright (c) 1994 Michael L. Hitch
+ * Copyright (c) 1993 Markus Wild
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Markus Wild.
+ * 4. 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.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <vm/vm.h>
+#include <sys/user.h>
+#include <sys/ioctl.h>
+#include <sys/select.h>
+#include <sys/tty.h>
+#include <sys/proc.h>
+#include <sys/buf.h>
+#include <sys/msgbuf.h>
+#include <sys/mbuf.h>
+#include <sys/protosw.h>
+#include <sys/domain.h>
+#include <sys/dkbad.h>
+#include <sys/reboot.h>
+#include <sys/exec.h>
+#include <vm/pmap.h>
+#include <amiga/amiga/cc.h>
+
+u_long boot_fphystart, boot_fphysize, cphysize;
+
+vaddr_t z2mem_start;           /* XXX */
+static vaddr_t z2mem_end;      /* XXX */
+int use_z2_mem = 1;            /* XXX */
+
+void *
+chipmem_steal(amount)
+        long amount;
+{
+        /*
+         * steal from top of chipmem, so we don't collide with
+         * the kernel loaded into chipmem in the not-yet-mapped state.
+         */
+        vaddr_t p = chipmem_end - amount;
+        if (p & 1)
+                p = p - 1;
+        chipmem_end = p;
+        if(chipmem_start > chipmem_end)
+                panic("not enough chip memory");
+        return((void *)p);
+}
+
+
+/*
+ * XXX
+ * used by certain drivers currently to allocate zorro II memory
+ * for bounce buffers, if use_z2_mem is NULL, chipmem will be
+ * returned instead.
+ * XXX
+ */
+void *
+alloc_z2mem(amount)
+       long amount;
+{
+       if (use_z2_mem && z2mem_end && (z2mem_end - amount) >= z2mem_start) {
+               z2mem_end -= amount;
+               return ((void *)z2mem_end);
+       }
+       return (alloc_chipmem(amount));
+}
diff -r a07995d8c28a -r af0cc5661b45 sys/arch/amigappc/amigappc/cc.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amigappc/amigappc/cc.c   Thu May 25 22:11:57 2000 +0000
@@ -0,0 +1,719 @@
+/*     $NetBSD: cc.c,v 1.1 2000/05/25 22:11:57 is Exp $        */
+
+/*
+ * Copyright (c) 1994 Christian E. Hopps
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christian E. Hopps.
+ * 4. 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.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/queue.h>
+
+#include <amiga/amiga/custom.h>
+#include <amiga/amiga/cc.h>
+#include "audio.h"
+
+#if defined (__GNUC__)
+#define INLINE inline
+#else
+#define INLINE
+#endif
+
+#ifdef __powerpc__
+#define PPC_CC_SYNC    asm volatile ("eieio");
+#endif
+
+/* init all the "custom chips" */
+void
+custom_chips_init()
+{
+       cc_init_chipmem();
+       cc_init_vbl();
+       cc_init_audio();
+       cc_init_blitter();
+       cc_init_copper();
+}
+
+/*
+ * Vertical blank iterrupt sever chains.
+ */
+LIST_HEAD(vbllist, vbl_node) vbl_list;
+
+void 
+turn_vbl_function_off(n)
+       struct vbl_node *n;
+{
+       if (n->flags & VBLNF_OFF)
+               return;
+
+       n->flags |= VBLNF_TURNOFF;
+       while ((n->flags & VBLNF_OFF) == 0) 
+               ;
+}
+
+/* allow function to be called on next vbl interrupt. */
+void
+turn_vbl_function_on(n)
+       struct vbl_node *n;
+{
+       n->flags &= (short) ~(VBLNF_OFF);
+}
+
+void                    
+add_vbl_function(add, priority, data)
+       struct vbl_node *add;
+       short priority;
+       void *data;
+{
+       int s;
+       struct vbl_node *n, *prev;
+       
+       s = spl3();
+       prev = NULL;
+       for (n = vbl_list.lh_first; n != NULL; n = n->link.le_next) {
+               if (add->priority > n->priority) {
+                       /* insert add_node before. */
+                       if (prev == NULL) {
+                               LIST_INSERT_HEAD(&vbl_list, add, link);
+                       } else {
+                               LIST_INSERT_AFTER(prev, add, link);
+                       }
+                       add = NULL;
+                       break;
+               }
+               prev = n;
+       }
+       if (add) {
+               if (prev == NULL) {
+                       LIST_INSERT_HEAD(&vbl_list, add, link);
+               } else {
+                       LIST_INSERT_AFTER(prev, add, link);
+               }
+       }
+       splx(s);
+}
+
+void
+remove_vbl_function(n)
+       struct vbl_node *n;
+{
+       int s;
+
+       s = spl3();
+       LIST_REMOVE(n, link);
+       splx(s);
+}
+
+/* Level 3 hardware interrupt */
+void
+vbl_handler()
+{
+       struct vbl_node *n;
+
+       /* handle all vbl functions */
+       for (n = vbl_list.lh_first; n != NULL; n = n->link.le_next) {
+               if (n->flags & VBLNF_TURNOFF) {
+                       n->flags |= VBLNF_OFF;
+                       n->flags &= ~(VBLNF_TURNOFF);
+               } else {
+                       if (n != NULL)
+                               n->function(n->data);
+               }
+       }
+       custom.intreq = INTF_VERTB;
+       PPC_CC_SYNC
+}
+
+void
+cc_init_vbl()
+{
+       LIST_INIT(&vbl_list);
+       /*
+        * enable vertical blank interrupts
+        */
+       custom.intena = INTF_SETCLR | INTF_VERTB; 
+       PPC_CC_SYNC
+}
+
+
+/*
+ * Blitter stuff.
+ */
+
+void
+cc_init_blitter()
+{
+}
+
+/* test twice to cover blitter bugs if BLTDONE (BUSY) is set it is not done. */
+int
+is_blitter_busy()
+{
+       u_short bb;
+
+       bb = (custom.dmaconr & DMAF_BLTDONE);
+       PPC_CC_SYNC
+       if ((custom.dmaconr & DMAF_BLTDONE) || bb) 
+       {
+               PPC_CC_SYNC
+               return (1);
+       }
+       return (0);
+}
+
+void
+wait_blit()
+{
+       /*
+        * V40 state this covers all blitter bugs.
+        */
+       while (is_blitter_busy()) 
+               ;
+}
+



Home | Main Index | Thread Index | Old Index