From 2f46860fc9100ab8cce1f5e22a43283756bb6f75 Mon Sep 17 00:00:00 2001 From: chopps Date: Fri, 3 Jun 1994 00:30:27 +0000 Subject: [PATCH] z buses early config support, needs testing. --- sys/arch/amiga/amiga/autoconf.c | 10 +-- sys/arch/amiga/amiga/locore.s | 4 +- sys/arch/amiga/dev/grf_rt.c | 12 ++- sys/arch/amiga/dev/zthreebus.c | 127 ++++++++++++++++++++++---------- sys/arch/amiga/dev/ztwobus.c | 86 ++++++++++++++------- 5 files changed, 164 insertions(+), 75 deletions(-) diff --git a/sys/arch/amiga/amiga/autoconf.c b/sys/arch/amiga/amiga/autoconf.c index 189fa55f9b51..15e344b74728 100644 --- a/sys/arch/amiga/amiga/autoconf.c +++ b/sys/arch/amiga/amiga/autoconf.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: autoconf.c,v 1.20 1994/05/29 01:44:26 chopps Exp $ + * $Id: autoconf.c,v 1.21 1994/06/03 00:30:27 chopps Exp $ */ #include #include @@ -140,7 +140,6 @@ amiga_config_found(pcfp, pdp, auxp, pfn) int config_console() { - extern struct cfdriver mainbuscd, ztwobuscd; struct cfdata *cf; /* @@ -153,12 +152,13 @@ config_console() * internal grf. */ amiga_config_found(cf, NULL, "grfcc", NULL); -#if not_yet /* - * ztwobus knows when its not for real (amiga_realconfig == 0) + * ztwobus and zthreebus know when its not for real and will + * only configure the appropriate hardware */ amiga_config_found(cf, NULL, "ztwobus", NULL); -#endif + if (is_a3000() || is_a4000()) + amiga_config_found(cf, NULL, "zthreebus", NULL); } /* diff --git a/sys/arch/amiga/amiga/locore.s b/sys/arch/amiga/amiga/locore.s index cad7d7ca37ed..1bcf41f6fa8f 100644 --- a/sys/arch/amiga/amiga/locore.s +++ b/sys/arch/amiga/amiga/locore.s @@ -38,7 +38,7 @@ * from: Utah $Hdr: locore.s 1.58 91/04/22$ * * @(#)locore.s 7.11 (Berkeley) 5/9/91 - * $Id: locore.s,v 1.24 1994/06/02 08:32:06 chopps Exp $ + * $Id: locore.s,v 1.25 1994/06/03 00:30:29 chopps Exp $ * * Original (hp300) Author: unknown, maybe Mike Hibler? * Amiga author: Markus Wild @@ -1597,6 +1597,7 @@ Ltbiau040: * Invalidate instruction cache */ ENTRY(ICIA) +ENTRY(ICPA) #if defined(M68030) || defined(M68020) #if defined(M68040) tstl _cpu040 @@ -1608,7 +1609,6 @@ ENTRY(ICIA) Licia040: #endif #if defined(M68040) -ENTRY(ICPA) .word 0xf498 | cinva ic rts #endif diff --git a/sys/arch/amiga/dev/grf_rt.c b/sys/arch/amiga/dev/grf_rt.c index 7c2ac246dbe3..3849ee3dba04 100644 --- a/sys/arch/amiga/dev/grf_rt.c +++ b/sys/arch/amiga/dev/grf_rt.c @@ -1,5 +1,5 @@ /* - * $Id: grf_rt.c,v 1.11 1994/05/08 05:53:07 chopps Exp $ + * $Id: grf_rt.c,v 1.12 1994/06/03 00:30:50 chopps Exp $ */ #include "grf.h" @@ -752,7 +752,6 @@ struct cfdriver grfrtcd = { */ static struct cfdata *cfdata; - /* * we make sure to only init things once. this is somewhat * tricky regarding the console. @@ -763,7 +762,9 @@ grfrtmatch(pdp, cfp, auxp) struct cfdata *cfp; void *auxp; { +#ifdef RETINACONSOLE static int rtconunit = -1; +#endif struct ztwobus_args *zap; zap = auxp; @@ -771,8 +772,11 @@ grfrtmatch(pdp, cfp, auxp) /* * allow only one retina console */ - if (amiga_realconfig == 0 && rtconunit != -1) - return(0); + if (amiga_realconfig == 0) +#ifdef RETINACONSOLE + if (rtconunit != -1) +#endif + return(0); /* * check that this is a retina board. */ diff --git a/sys/arch/amiga/dev/zthreebus.c b/sys/arch/amiga/dev/zthreebus.c index 8d38586e2c52..f5ffa9e52be3 100644 --- a/sys/arch/amiga/dev/zthreebus.c +++ b/sys/arch/amiga/dev/zthreebus.c @@ -34,6 +34,7 @@ #include #include #include +#include #include struct aconfdata { @@ -42,49 +43,67 @@ struct aconfdata { int prodid; }; +struct preconfdata { + int manid; + int prodid; + caddr_t vaddr; +}; + + /* * explain the names.. 0123456789 => zothfisven */ -struct aconfdata aconf3tab[] = { +static struct aconfdata aconftab[] = { /* MacroSystemsUS */ - { "wesc", 2203, 19}, + { "wesc", 2203, 19}, /* Warp engine */ + { "grfrtblt", 18260, 16} /* Retina BLT Z3 */ }; -int naconf3ent = sizeof(aconf3tab) / sizeof(struct aconfdata); +static int naconfent = sizeof(aconftab) / sizeof(struct aconfdata); -extern caddr_t ZTHREEADDR; -extern u_int ZTHREEAVAIL; +/* + * Anything listed in this table is subject to pre-configuration, + * if autoconf.c:config_console() calls amiga_config_found() on + * the Zorro III device. + */ +static struct preconfdata preconftab[] = { + /* Retina BLT Z3 */ + { 18260, 16, 0 } +}; +static int npreconfent = sizeof(preconftab) / sizeof(struct preconfdata); void zthreeattach __P((struct device *, struct device *, void *)); int zthreeprint __P((void *, char *)); int zthreematch __P((struct device *, struct cfdata *,void *)); caddr_t zthreemap __P((caddr_t, u_int)); -char *aconf3lookup __P((int, int)); +static char *aconflookup __P((int, int)); /* * given a manufacturer id and product id, find the name * that describes this board. */ -char * -aconf3lookup(mid, pid) +static char * +aconflookup(mid, pid) int mid, pid; { - int an; + struct aconfdata *adp, *eadp; - for (an = 0; an < naconf3ent; an++) { - if (aconf3tab[an].manid == mid && aconf3tab[an].prodid == pid) - return(aconf3tab[an].name); - } + eadp = &aconftab[naconfent]; + for (adp = aconftab; adp < eadp; adp++) + if (adp->manid == mid && adp->prodid == pid) + return(adp->name); return("board"); } /* - * mainbus driver + * zorro three bus driver */ struct cfdriver zthreebuscd = { NULL, "zthreebus", zthreematch, zthreeattach, DV_DULL, sizeof(struct device), NULL, 0 }; +static struct cfdata *early_cfdata; + /*ARGSUSED*/ int zthreematch(pdp, cfp, auxp) @@ -92,15 +111,21 @@ zthreematch(pdp, cfp, auxp) struct cfdata *cfp; void *auxp; { - if (matchname(auxp, "zthreebus")) - return(1); - return(0); + if (matchname(auxp, "zthreebus") == 0) + return(0); + if (amiga_realconfig == 0) + early_cfdata = cfp; + return(1); } /* * called to attach bus, we probe, i.e., scan configdev structs passed * in, for each found name call config_found() which will do this again * with that driver if matched else print a diag. + * + * If called during config_console() (i.e., amiga_realconfig == 0), skip + * everything but the approved devices in preconftab, and when doing + * those devices save the allocated virtual address. */ void zthreeattach(pdp, dp, auxp) @@ -108,32 +133,58 @@ zthreeattach(pdp, dp, auxp) void *auxp; { struct zthreebus_args za; - u_long lpa; - int i, zcnt; + struct preconfdata *pcp, *epcp; + struct cfdev *cdp, *ecdp; - if (ZTHREEAVAIL) - printf (" I/O size 0x%08x", ZTHREEAVAIL); + epcp = &preconftab[npreconfent]; + ecdp = &cfdev[ncfdev]; + + if (amiga_realconfig) { + if (ZTHREEAVAIL) + printf (" I/O size 0x%08x", ZTHREEAVAIL); #if 0 - if (ZTHREEMEMADDR) - printf (" mem %08x-%08x\n", - ZTHREEMEMADDR, ZTHREEMEMADDR + ZTHREEMEMSIZE - 1); + if (ZTHREEMEMADDR) + printf(" mem %08x-%08x\n", + ZTHREEMEMADDR, ZTHREEMEMADDR + ZTHREEMEMSIZE - 1); #endif - printf("\n"); + printf("\n"); + } - for (i = 0; i < ncfdev; i++) { - za.pa = cfdev[i].addr; - za.size = cfdev[i].size; - /* - * check that its from zorro III space - */ - if ((u_long)za.pa >= ZTHREETOP || (u_long)za.pa < ZTHREEBASE) + for (cdp = cfdev; cdp < ecdp; cdp++) { + for (pcp = preconftab; pcp < epcp; pcp++) { + if (pcp->manid == cdp->rom.manid && + pcp->prodid == cdp->rom.prodid) + break; + } + if (amiga_realconfig == 0 && pcp >= epcp) continue; - za.va = (void *) (iszthreepa(za.pa) ? zthreemap(za.pa, za.size) : 0); - za.manid = cfdev[i].rom.manid; - za.prodid = cfdev[i].rom.prodid; - za.serno = cfdev[i].rom.serno; + + za.pa = cdp->addr; + za.size = cdp->size; + + if (amiga_realconfig && pcp < epcp && pcp->vaddr) + za.va = pcp->vaddr; + else { + /* + * check that its from zorro III space + */ + if ((u_long)za.pa >= ZTHREETOP || + (u_long)za.pa < ZTHREEBASE) + continue; + za.va = (void *)(iszthreepa(za.pa) ? + zthreemap(za.pa, za.size) : 0); + + /* + * save value if early console init + */ + if (amiga_realconfig == 0) + pcp->vaddr = za.va; + } + za.manid = cdp->rom.manid; + za.prodid = cdp->rom.prodid; + za.serno = cdp->rom.serno; za.slot = (((u_long)za.pa >> 16) & 0xF) - 0x9; - config_found(dp, &za, zthreeprint); + amiga_config_found(early_cfdata, dp, &za, zthreeprint); } } @@ -152,7 +203,7 @@ zthreeprint(auxp, pnp) zap = auxp; if (pnp) { - printf("%s at %s", aconf3lookup(zap->manid, zap->prodid), + printf("%s at %s", aconflookup(zap->manid, zap->prodid), pnp); if (zap->manid == -1) rv = UNSUPP; diff --git a/sys/arch/amiga/dev/ztwobus.c b/sys/arch/amiga/dev/ztwobus.c index 5643477d285b..3449f49e8195 100644 --- a/sys/arch/amiga/dev/ztwobus.c +++ b/sys/arch/amiga/dev/ztwobus.c @@ -27,12 +27,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: ztwobus.c,v 1.4 1994/05/26 03:05:01 chopps Exp $ + * $Id: ztwobus.c,v 1.5 1994/06/03 00:30:52 chopps Exp $ */ #include #include #include #include +#include #include struct aconfdata { @@ -41,10 +42,16 @@ struct aconfdata { int prodid; }; +struct preconfdata { + int manid; + int prodid; +}; + + /* * explian the names.. 0123456789 => zothfisven */ -struct aconfdata aconftab[] = { +static struct aconfdata aconftab[] = { /* Commodore Amiga */ { "atzee", 513, 1 }, { "atzsc", 514, 3 }, @@ -81,27 +88,39 @@ struct aconfdata aconftab[] = { /* Hacker Inc. */ { "mlhsc", 2011, 1 }, }; -int naconfent = sizeof(aconftab) / sizeof(struct aconfdata); +static int naconfent = sizeof(aconftab) / sizeof(struct aconfdata); + +/* + * Anything listed in this table is subject to pre-configuration, + * if autoconf.c:config_console() calls amiga_config_found() on + * the Zorro III device. + */ +static struct preconfdata preconftab[] = { + /* Retina BLT Z3 */ + { 18260, 6 } +}; +static int npreconfent = sizeof(preconftab) / sizeof(struct preconfdata); + void ztwoattach __P((struct device *, struct device *, void *)); int ztwoprint __P((void *, char *)); int ztwomatch __P((struct device *, struct cfdata *,void *)); -char *aconflookup __P((int, int)); +static char *aconflookup __P((int, int)); /* * given a manufacturer id and product id, find the name * that describes this board. */ -char * +static char * aconflookup(mid, pid) int mid, pid; { - int an; + struct aconfdata *adp, *eadp; - for (an = 0; an < naconfent; an++) { - if (aconftab[an].manid == mid && aconftab[an].prodid == pid) - return(aconftab[an].name); - } + eadp = &aconftab[naconfent]; + for (adp = aconftab; adp < eadp; adp++) + if (adp->manid == mid && adp->prodid == pid) + return(adp->name); return("board"); } @@ -113,6 +132,8 @@ struct cfdriver ztwobuscd = { DV_DULL, sizeof(struct device), NULL, 0 }; +static struct cfdata *early_cfdata; + /*ARGSUSED*/ int ztwomatch(pdp, cfp, auxp) @@ -120,9 +141,11 @@ ztwomatch(pdp, cfp, auxp) struct cfdata *cfp; void *auxp; { - if (matchname(auxp, "ztwobus")) - return(1); - return(0); + if (matchname(auxp, "ztwobus") == 0) + return(0); + if (amiga_realconfig == 0) + early_cfdata = cfp; + return(1); } /* @@ -136,28 +159,39 @@ ztwoattach(pdp, dp, auxp) void *auxp; { struct ztwobus_args za; - u_long lpa; - int i, zcnt; + struct preconfdata *pcp, *epcp; + struct cfdev *cdp, *ecdp; - if (ZTWOMEMADDR) - printf(" mem %08x-%08x", - ZTWOMEMADDR, ZTWOMEMADDR + ZTWOMEMSIZE - 1); - printf("\n"); + epcp = &preconftab[npreconfent]; + ecdp = &cfdev[ncfdev]; + if (amiga_realconfig) { + if (ZTWOMEMADDR) + printf(" mem %08x-%08x", + ZTWOMEMADDR, ZTWOMEMADDR + ZTWOMEMSIZE - 1); + printf("\n"); + } + for (cdp = cfdev; cdp < ecdp; cdp++) { + for (pcp = preconftab; pcp < epcp; pcp++) { + if (pcp->manid == cdp->rom.manid && + pcp->prodid == cdp->rom.prodid) + break; + } + if (amiga_realconfig == 0 && pcp >= epcp) + continue; - for (i = 0; i < ncfdev; i++) { - za.pa = cfdev[i].addr; + za.pa = cdp->addr; /* * check that its from zorro II space */ if ((u_long)za.pa >= 0xF00000 || (u_long)za.pa < 0xE90000) continue; za.va = (void *) (isztwopa(za.pa) ? ztwomap(za.pa) : 0); - za.size = cfdev[i].size; - za.manid = cfdev[i].rom.manid; - za.prodid = cfdev[i].rom.prodid; - za.serno = cfdev[i].rom.serno; + za.size = cdp->size; + za.manid = cdp->rom.manid; + za.prodid = cdp->rom.prodid; + za.serno = cdp->rom.serno; za.slot = (((u_long)za.pa >> 16) & 0xF) - 0x9; - config_found(dp, &za, ztwoprint); + amiga_config_found(early_cfdata, dp, &za, ztwoprint); } }