Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amiga Try to make z3rambd less crude. Also support ...



details:   https://anonhg.NetBSD.org/src/rev/ccf9311b2767
branches:  trunk
changeset: 782931:ccf9311b2767
user:      rkujawa <rkujawa%NetBSD.org@localhost>
date:      Mon Nov 26 22:58:24 2012 +0000

description:
Try to make z3rambd less crude. Also support BigRamPlus, FastLane Z3 RAM and
DKB3128.

diffstat:

 sys/arch/amiga/amiga/amiga_init.c |  11 +++-
 sys/arch/amiga/dev/z3rambd.c      |  39 +++++++-----------
 sys/arch/amiga/dev/z3rambdvar.h   |  79 +++++++++++++++++++++++++++++++++++++++
 sys/arch/amiga/dev/zbus.c         |   7 +-
 4 files changed, 105 insertions(+), 31 deletions(-)

diffs (246 lines):

diff -r fa9d484b2c48 -r ccf9311b2767 sys/arch/amiga/amiga/amiga_init.c
--- a/sys/arch/amiga/amiga/amiga_init.c Mon Nov 26 21:15:34 2012 +0000
+++ b/sys/arch/amiga/amiga/amiga_init.c Mon Nov 26 22:58:24 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amiga_init.c,v 1.128 2012/11/25 23:33:55 rkujawa Exp $ */
+/*     $NetBSD: amiga_init.c,v 1.129 2012/11/26 22:58:24 rkujawa Exp $ */
 
 /*
  * Copyright (c) 1994 Michael L. Hitch
@@ -39,7 +39,7 @@
 #include "ser.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amiga_init.c,v 1.128 2012/11/25 23:33:55 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amiga_init.c,v 1.129 2012/11/26 22:58:24 rkujawa Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -68,6 +68,7 @@
 #include <amiga/amiga/gayle.h>
 #include <amiga/amiga/memlist.h>
 #include <amiga/dev/zbusvar.h>
+#include <amiga/dev/z3rambdvar.h>
 
 #define RELOC(v, t)    *((t*)((u_int)&(v) + loadbase))
 
@@ -337,8 +338,10 @@
                    (cd->rom.prodid == 100 || cd->rom.prodid == 110)) 
                        RELOC(ZBUSAVAIL, u_int) += m68k_round_page(0x1400000);
 #if NZ3RAMBD > 0
-               if ( (cd->rom.manid == 3643) && (cd->rom.prodid == 32) ) 
-               { } else
+               if (z3rambd_match_id(cd->rom.manid, cd->rom.prodid) > 0)
+               {
+                       /* XXX: remove board from memlist */
+               } else
 #endif
                if (bd_type != ERT_ZORROIII &&
                    (bd_type != ERT_ZORROII || isztwopa(cd->addr)))
diff -r fa9d484b2c48 -r ccf9311b2767 sys/arch/amiga/dev/z3rambd.c
--- a/sys/arch/amiga/dev/z3rambd.c      Mon Nov 26 21:15:34 2012 +0000
+++ b/sys/arch/amiga/dev/z3rambd.c      Mon Nov 26 22:58:24 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: z3rambd.c,v 1.1 2012/11/25 23:33:56 rkujawa Exp $ */
+/*     $NetBSD: z3rambd.c,v 1.2 2012/11/26 22:58:24 rkujawa Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,10 +30,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: z3rambd.c,v 1.1 2012/11/25 23:33:56 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: z3rambd.c,v 1.2 2012/11/26 22:58:24 rkujawa Exp $");
 
 /*
- * Z3 RAM virtual block device. Supports ZorRAM so far.
+ * Z3 RAM virtual block device. Supports ZorRAM, BigRamPlus and FastLane Z3 so 
+ * far.
  */
 
 #include <sys/param.h>
@@ -41,11 +42,11 @@
 #include <sys/malloc.h>
 #include <sys/socket.h>
 #include <sys/systm.h>
-#include <sys/bus.h>
 
 #include <machine/cpu.h>
 
 #include <amiga/dev/zbusvar.h>
+#include <amiga/dev/z3rambdvar.h>
 
 #include <dev/altmem/altmemvar.h>
 
@@ -62,34 +63,17 @@
        .strategy = z3rambd_altmem_strategy
 };
 
-struct z3rambd_softc {
-       device_t                sc_dev;
-
-       size_t                  sc_size;
-
-       struct bus_space_tag    sc_bst;
-
-       bus_space_tag_t         sc_iot;
-       bus_space_handle_t      sc_ioh;
-
-       void                    *sc_va;
-};
-
 CFATTACH_DECL_NEW(z3rambd, sizeof(struct z3rambd_softc),
     z3rambd_match, z3rambd_attach, NULL, NULL);
 
-#define ZORRO_MANID_E3B                3643
-#define ZORRO_PRODID_ZORRAM    32
-
 int
 z3rambd_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct zbus_args *zap;
        zap = aux;
 
-       if (zap->manid == ZORRO_MANID_E3B) 
-               if (zap->prodid == ZORRO_PRODID_ZORRAM)
-                       return 100;
+       if (z3rambd_match_id(zap->manid, zap->prodid) > 0)
+               return 100;
 
        return 0; 
 }
@@ -112,7 +96,14 @@
        /* XXX: duh, size of the board does not necessarily equal mem size */
        sc->sc_size = zap->size;
 
-       aprint_normal(": AmigaKit ZorRAM\n");
+       if (zap->prodid == ZORRO_PRODID_ZORRAM)
+               aprint_normal(": AmigaKit ZorRAM / Individual Computers BigRamPlus\n");
+       else if (zap->prodid == ZORRO_PRODID_3128)
+               aprint_normal(": DKB 3128\n");
+       else if (zap->prodid == ZORRO_PRODID_FLZ3MEM)
+               aprint_normal(": FastLane Z3 memory\n");
+       else
+               aprint_normal("\n");
 
        if (bus_space_map(sc->sc_iot, 0, sc->sc_size, 0,
            &sc->sc_ioh)) {
diff -r fa9d484b2c48 -r ccf9311b2767 sys/arch/amiga/dev/z3rambdvar.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/dev/z3rambdvar.h   Mon Nov 26 22:58:24 2012 +0000
@@ -0,0 +1,79 @@
+/*     $NetBSD: z3rambdvar.h,v 1.1 2012/11/26 22:58:24 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * 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 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.
+ */
+#ifndef _AMIGA_Z3RAMBDVAR_H_
+
+#include <sys/bus.h>
+
+/* there are a couple of hacks that check for presence of Z3 RAM boards */
+#define ZORRO_MANID_E3B                3643
+#define ZORRO_PRODID_ZORRAM    32      /* BigRamPlus has the same */
+
+#define ZORRO_MANID_DKB                2012
+#define ZORRO_PRODID_3128      14      
+
+#define ZORRO_MANID_PHASE5     8512    
+#define ZORRO_PRODID_FLZ3MEM   10
+
+struct z3rambd_softc {
+       device_t                sc_dev;
+
+       size_t                  sc_size;
+
+       struct bus_space_tag    sc_bst;
+
+       bus_space_tag_t         sc_iot;
+       bus_space_handle_t      sc_ioh;
+
+       void                    *sc_va;
+};
+
+inline int z3rambd_match_id(uint16_t, uint8_t);
+
+inline int
+z3rambd_match_id(uint16_t manid, uint8_t prodid)
+{
+       if (manid == ZORRO_MANID_E3B) 
+               if (prodid == ZORRO_PRODID_ZORRAM)
+                       return 1;
+
+       if (manid == ZORRO_MANID_DKB) 
+               if (prodid == ZORRO_PRODID_3128)
+                       return 1;
+
+       if (manid == ZORRO_MANID_PHASE5) 
+               if (prodid == ZORRO_PRODID_FLZ3MEM)
+                       return 1;
+
+       return 0;
+}
+
+#endif /* _AMIGA_Z3RAMBDVAR_H_ */
+
diff -r fa9d484b2c48 -r ccf9311b2767 sys/arch/amiga/dev/zbus.c
--- a/sys/arch/amiga/dev/zbus.c Mon Nov 26 21:15:34 2012 +0000
+++ b/sys/arch/amiga/dev/zbus.c Mon Nov 26 22:58:24 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zbus.c,v 1.72 2012/11/25 23:33:56 rkujawa Exp $ */
+/*     $NetBSD: zbus.c,v 1.73 2012/11/26 22:58:24 rkujawa Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.72 2012/11/25 23:33:56 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.73 2012/11/26 22:58:24 rkujawa Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -43,6 +43,7 @@
 #include <amiga/amiga/cfdev.h>
 #include <amiga/amiga/device.h>
 #include <amiga/dev/zbusvar.h>
+#include <amiga/dev/z3rambdvar.h>
 
 #include "z3rambd.h"
 
@@ -329,7 +330,7 @@
                        continue;
 
 #if NZ3RAMBD > 0
-               if ((cdp->rom.manid == 3643) && (cdp->rom.prodid == 32))
+               if (z3rambd_match_id(cdp->rom.manid, cdp->rom.prodid) > 0)
                { }
                else 
 #endif /* NZ3RAMBD */



Home | Main Index | Thread Index | Old Index