Home | History | Annotate | Line # | Download | only in dev
zbus.c revision 1.72
      1  1.72   rkujawa /*	$NetBSD: zbus.c,v 1.72 2012/11/25 23:33:56 rkujawa Exp $ */
      2   1.1    chopps 
      3   1.1    chopps /*
      4   1.1    chopps  * Copyright (c) 1994 Christian E. Hopps
      5   1.1    chopps  * All rights reserved.
      6   1.1    chopps  *
      7   1.1    chopps  * Redistribution and use in source and binary forms, with or without
      8   1.1    chopps  * modification, are permitted provided that the following conditions
      9   1.1    chopps  * are met:
     10   1.1    chopps  * 1. Redistributions of source code must retain the above copyright
     11   1.1    chopps  *    notice, this list of conditions and the following disclaimer.
     12   1.1    chopps  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1    chopps  *    notice, this list of conditions and the following disclaimer in the
     14   1.1    chopps  *    documentation and/or other materials provided with the distribution.
     15   1.1    chopps  * 3. All advertising materials mentioning features or use of this software
     16   1.1    chopps  *    must display the following acknowledgement:
     17   1.1    chopps  *      This product includes software developed by Christian E. Hopps.
     18   1.1    chopps  * 4. The name of the author may not be used to endorse or promote products
     19   1.1    chopps  *    derived from this software without specific prior written permission
     20   1.1    chopps  *
     21   1.1    chopps  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22   1.1    chopps  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23   1.1    chopps  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24   1.1    chopps  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25   1.1    chopps  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26   1.1    chopps  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27   1.1    chopps  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28   1.1    chopps  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29   1.1    chopps  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30   1.1    chopps  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31   1.1    chopps  */
     32  1.46   aymeric 
     33  1.46   aymeric #include <sys/cdefs.h>
     34  1.72   rkujawa __KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.72 2012/11/25 23:33:56 rkujawa Exp $");
     35  1.46   aymeric 
     36   1.1    chopps #include <sys/param.h>
     37   1.1    chopps #include <sys/device.h>
     38  1.14     veego #include <sys/systm.h>
     39  1.64   rkujawa #include <sys/bus.h>
     40  1.51   thorpej 
     41   1.1    chopps #include <machine/cpu.h>
     42   1.1    chopps #include <machine/pte.h>
     43   1.1    chopps #include <amiga/amiga/cfdev.h>
     44   1.1    chopps #include <amiga/amiga/device.h>
     45   1.1    chopps #include <amiga/dev/zbusvar.h>
     46   1.1    chopps 
     47  1.72   rkujawa #include "z3rambd.h"
     48  1.72   rkujawa 
     49   1.1    chopps struct aconfdata {
     50  1.55       jmc 	const char *name;
     51   1.1    chopps 	int manid;
     52   1.1    chopps 	int prodid;
     53   1.1    chopps };
     54   1.1    chopps 
     55   1.1    chopps struct preconfdata {
     56   1.1    chopps 	int manid;
     57   1.1    chopps 	int prodid;
     58  1.57  christos 	void *vaddr;
     59   1.1    chopps };
     60   1.1    chopps 
     61  1.64   rkujawa struct quirksdata {
     62  1.64   rkujawa 	int manid;
     63  1.64   rkujawa 	int prodid;
     64  1.64   rkujawa 	uint8_t quirks;
     65  1.64   rkujawa };
     66  1.64   rkujawa 
     67  1.47   aymeric vaddr_t		ZTWOROMADDR;
     68  1.47   aymeric vaddr_t		ZTWOMEMADDR;
     69  1.47   aymeric u_int		NZTWOMEMPG;
     70  1.47   aymeric vaddr_t		ZBUSADDR;	/* kva of Zorro bus I/O pages */
     71  1.47   aymeric u_int		ZBUSAVAIL;	/* bytes of Zorro bus I/O space left */
     72   1.1    chopps 
     73  1.45   aymeric /*
     74   1.1    chopps  * explain the names.. 0123456789 => zothfisven
     75   1.1    chopps  */
     76  1.62      matt static const struct aconfdata aconftab[] = {
     77   1.1    chopps 	/* Commodore Amiga */
     78   1.1    chopps 	{ "atzee",	513,	1 },
     79  1.21        is 	{ "atzsc",	514,	2 },
     80   1.1    chopps 	{ "atzsc",	514,	3 },
     81  1.13    chopps 	{ "bah",	514,	9 },	/* A2060 */
     82   1.1    chopps 	{ "ql",		514,	69 },
     83   1.1    chopps 	{ "ql",		514,	70 },
     84  1.27        is 	{ "atfsc",	514,	84 },
     85  1.27        is 	{ "le",		514,	112 },
     86   1.1    chopps 	/* Ameristar */
     87   1.1    chopps 	{ "le",		1053,	1 },
     88  1.13    chopps 	{ "bah",	1053,	9 },	/* A2060 */
     89   1.3    chopps 	{ "es",		1053,	10 },
     90  1.13    chopps 	/* University of Lowell */
     91   1.9    chopps 	{ "grful",	1030,	0 },
     92  1.23        is 	/* DMI */
     93  1.23        is 	{ "grfrs",	2129,	1 },	/* Resolver graphics board */
     94   1.1    chopps 	/* Macrosystems */
     95   1.1    chopps 	{ "grfrt",	18260,	6 },
     96   1.3    chopps 	{ "grfrh",	18260,	16},	/* Retina BLT Z3 */
     97  1.15        is 	{ "grfrh",	18260,	19},	/* Altais */
     98   1.1    chopps 	/* Greater valley products */
     99   1.1    chopps 	{ "gvpbus",	2017,	2 },
    100   1.1    chopps 	{ "gvpbus",	2017,	11 },
    101   1.1    chopps 	{ "giv",	2017,	32 },
    102   1.5    chopps 	{ "gio",	2017,	255 },
    103   1.1    chopps 	/* progressive perhiperals */
    104   1.1    chopps 	{ "zssc",	2026,	150 },
    105   1.1    chopps 	{ "ppia",	2026,	187 },
    106   1.1    chopps 	{ "ppta",	2026,	105 },
    107   1.1    chopps 	{ "ppha",	2026,	1 },
    108   1.1    chopps 	{ "mrsc",	2026,	0 },
    109   1.1    chopps 	/* CSA */
    110   1.1    chopps 	{ "mgnsc",	1058,	17 },
    111   1.1    chopps 	{ "otgsc",	1058,	21 },
    112   1.1    chopps 	/* Microbotics */
    113   1.1    chopps 	{ "vhzsc",	1010,	69 },
    114   1.1    chopps 	/* Supra */
    115   1.1    chopps 	{ "wstsc",	1056,	12 },
    116   1.6    chopps 	{ "wstsc",	1056,	13 },
    117   1.1    chopps 	/* IVS */
    118   1.6    chopps 	{ "itrmp",	2112,	48 },
    119   1.1    chopps 	{ "itrmp",	2112,	52 },
    120   1.1    chopps 	{ "ivasc",	2112,	242 },
    121   1.1    chopps 	{ "ivsc",	2112,	243 },
    122   1.1    chopps 	/* Hydra */
    123   1.1    chopps 	{ "ed",		2121,	1 },
    124   1.1    chopps 	/* ASDG */
    125  1.21        is 	{ "ed",		1023,	254 },
    126   1.7    chopps 	/* Village Tronic Ariadne */
    127  1.33     veego 	{ "le",		2167,	201},
    128  1.38     veego 	/* Village Tronic Ariadne II */
    129  1.38     veego 	{ "ne",		2167,	202},
    130   1.1    chopps 	/* bsc/Alf Data */
    131  1.53       wiz 	{ "Tandem", 2092,    6 },	/* Tandem AT disk controller */
    132   1.1    chopps 	{ "mfc",	2092,	16 },
    133   1.1    chopps 	{ "mfc",	2092,	17 },
    134   1.1    chopps 	{ "mfc",	2092,	18 },
    135   1.1    chopps 	/* Cirrus CL GD 5426 -> Picasso, Piccolo, EGS Spectrum */
    136  1.32     veego 	{ "grfcl",	2167,	11},	/* PicassoII mem */
    137  1.32     veego 	{ "grfcl",	2167,	12},	/* PicassoII regs */
    138  1.32     veego 	{ "grfcl",	2167,	21},	/* PicassoIV Z2 mem1 */
    139  1.32     veego 	{ "grfcl",	2167,	22},	/* PicassoIV Z2 mem2 */
    140  1.32     veego 	{ "grfcl",	2167,	23},	/* PicassoIV Z2 regs */
    141  1.32     veego 	{ "grfcl",	2167,	24},	/* PicassoIV Z3 */
    142   1.3    chopps 	{ "grfcl",	2193,	2},	/* Spectrum mem */
    143   1.3    chopps 	{ "grfcl",	2193,	1},	/* Spectrum regs */
    144   1.3    chopps 	{ "grfcl",	2195,	5},	/* Piccolo mem */
    145   1.3    chopps 	{ "grfcl",	2195,	6},	/* Piccolo regs */
    146  1.19     veego 	{ "grfcl",	2195,	10},	/* Piccolo SD64 mem */
    147  1.19     veego 	{ "grfcl",	2195,	11},	/* Piccolo SD64 regs */
    148   1.1    chopps 	/* MacroSystemsUS */
    149   1.1    chopps 	{ "wesc",	2203,	19},	/* Warp engine */
    150  1.10    chopps 	/* phase 5 digital products */
    151  1.10    chopps 	{ "flmem",	8512,	10},	/* FastlaneZ3 memory */
    152  1.10    chopps 	{ "flsc",	8512,	11},	/* FastlaneZ3 */
    153  1.30        is 	{ "cbsc",	8512,	12},	/* Cyberstorm Mk I SCSI */
    154  1.28        is 	{ "bzivsc",	8512,	17},	/* Blizzard IV SCSI */
    155  1.28        is 	{ "bztzsc", 	8512,	24},	/* Blizzard 2060 SCSI */
    156  1.30        is 	{ "cbiisc", 	8512,	25},	/* Cyberstorm Mk II SCSI */
    157  1.12    chopps 	{ "grfcv",	8512,	34},	/* CyberVison 64 */
    158  1.35     veego 	{ "grfcv3d",	8512,	67},	/* CyberVison 64/3D */
    159  1.39    mhitch 	{ "cbiiisc", 	8512,	100},	/* Cyberstorm Mk III SCSI */
    160  1.64   rkujawa 	{ "p5pb", 	8512,	101},	/* CyberVisionPPC / BlizzardVisionPPC */
    161  1.64   rkujawa 	{ "bppcsc", 	8512,	110},	/* Blizzard 603e+ SCSI */
    162   1.3    chopps 	/* Hacker Inc. */
    163  1.11    chopps 	{ "mlhsc",	2011,	1 },
    164  1.11    chopps 	/* Resource Management Force */
    165  1.17        is 	{ "qn",		2011,	2 },	/* QuickNet Ethernet */
    166  1.17        is 	/* ??? */
    167  1.19     veego 	{ "empsc",	2171,	21 },	/* Emplant SCSI */
    168  1.21        is 	{ "empsc",	2171,	32 },	/* Emplant SCSI */
    169  1.19     veego 	/* Tseng ET4000 boards */
    170  1.19     veego 	{ "grfet",	2117,	3 },	/* Merlin mem */
    171  1.20        is 	{ "grfet",	2117,	4 },	/* Merlin regs */
    172  1.32     veego 	{ "grfet",	2167,	1 },	/* Domino mem */
    173  1.32     veego 	{ "grfet",	2167,	2 },	/* Domino regs */
    174  1.32     veego 	{ "grfet",	2167,	3 },	/* Domino regs (proto 16M) */
    175  1.32     veego 	{ "grfet",	2181,	0 },	/* oMniBus */
    176  1.20        is 	/* Advanced Systems */
    177  1.27        is 	{ "nxsc",	2102,	1 },	/* Nexus SCSI board */
    178  1.21        is 	/* Masoboshi */
    179  1.31        is 	{ "mcsc",	8535,	4 },	/* Masoboshi Mastercard 702 */
    180  1.31        is 	/* Apollo */
    181  1.34        is 	{ "apssc",	8738,	35 },	/* Apollo '060 scsi */
    182  1.34        is 	/* KATO development */
    183  1.34        is 	{ "aumld",	2145,	128 },	/* Melody MPEG layer 2 audio board */
    184  1.43        is 	/* Individual Computers Jens Schoenfeld */
    185  1.42        is 	{ "buddha",	4626,	0 },
    186  1.59        is 	{ "xsurf",	4626,	23 },	/* X-Surf Ethernet */
    187  1.34        is 	/* VMC Harald Frank */
    188  1.34        is 	{ "blst",	5001,	1},	/* ISDN Blaster */
    189  1.34        is 	{ "hyper4",	5001,	2},	/* Hypercom4-Zbus */
    190  1.42        is 	{ "hyper3Z",	5001,	3},	/* Hypercom3-Zbus */
    191  1.42        is 	{ "hyper4+",	5001,	6},	/* Hypercom4+ */
    192  1.52        is 	{ "hyper3+",	5001,	7},	/* Hypercom3+ */
    193  1.52        is 	/* Matay Grzegorz Kraszewski */
    194  1.65   rkujawa 	{ "mppb",	44359,	1}	/* Prometheus PCI bridge */
    195   1.1    chopps };
    196   1.1    chopps static int naconfent = sizeof(aconftab) / sizeof(struct aconfdata);
    197   1.1    chopps 
    198   1.1    chopps /*
    199   1.1    chopps  * Anything listed in this table is subject to pre-configuration,
    200   1.1    chopps  * if autoconf.c:config_console() calls amiga_config_found() on
    201   1.1    chopps  * the Zorro III device.
    202   1.1    chopps  */
    203   1.1    chopps static struct preconfdata preconftab[] = {
    204  1.32     veego 	{18260, 6, 0 },	/* Retina Z2 */			/* grf1 */
    205  1.32     veego 	{18260, 16, 0}, /* Retina BLT Z3 */		/* grf2 */
    206  1.15        is 	{18260, 19, 0}, /* Altais */
    207  1.32     veego 	{2167,	11, 0},	/* PicassoII mem */		/* grf3 */
    208  1.32     veego 	{2167,	12, 0},	/* PicassoII regs */
    209  1.32     veego 	{2167,	21, 0},	/* PicassoIV Z2 mem1 */
    210  1.32     veego 	{2167,	22, 0},	/* PicassoIV Z2 mem2 */
    211  1.32     veego 	{2167,	23, 0},	/* PicassoIV Z2 regs */
    212  1.32     veego 	{2167,	24, 0},	/* PicassoIV Z3 */
    213   1.4    chopps 	{2193,	2, 0},	/* Spectrum mem */
    214   1.4    chopps 	{2193,	1, 0},	/* Spectrum regs */
    215   1.4    chopps 	{2195,	5, 0},	/* Piccolo mem */
    216   1.8    chopps 	{2195,	6, 0},	/* Piccolo regs */
    217  1.19     veego 	{2195,	10, 0},	/* Piccolo SD64 mem */
    218  1.19     veego 	{2195,	11, 0},	/* Piccolo SD64 regs */
    219  1.32     veego 	{1030,	0, 0},	/* Ulwl board */		/* grf4 */
    220  1.32     veego 	{8512,	34, 0},	/* Cybervison 64 */		/* grf5 */
    221  1.32     veego 	{2117,	3, 0},	/* Merlin mem */		/* grf6 */
    222  1.32     veego 	{2117,	4, 0},	/* Merlin regs */
    223  1.19     veego 	{2167,	1, 0},	/* Domino mem */
    224  1.19     veego 	{2167,	2, 0},	/* Domino regs */
    225  1.32     veego 	{2167,	3, 0},	/* Domino regs (proto 16M) */
    226  1.35     veego 	{2181,	0, 0},	/* oMniBus mem or regs */
    227  1.35     veego 	{8512,	67, 0}	/* Cybervison 64/3D */		/* grf7 */
    228   1.1    chopps };
    229   1.1    chopps static int npreconfent = sizeof(preconftab) / sizeof(struct preconfdata);
    230   1.1    chopps 
    231  1.64   rkujawa /*
    232  1.64   rkujawa  * Quirks table.
    233  1.64   rkujawa  */
    234  1.64   rkujawa #define ZORRO_QUIRK_NO_ZBUSMAP 1	/* Don't map VA=PA in zbusattach. */
    235  1.64   rkujawa static struct quirksdata quirkstab[] = {
    236  1.64   rkujawa 	{8512, 101, ZORRO_QUIRK_NO_ZBUSMAP}
    237  1.64   rkujawa };
    238  1.64   rkujawa static int nquirksent = sizeof(quirkstab) / sizeof(struct quirksdata);
    239   1.1    chopps 
    240  1.63      matt void zbusattach(device_t, device_t, void *);
    241  1.45   aymeric int zbusprint(void *, const char *);
    242  1.63      matt int zbusmatch(device_t, cfdata_t, void *);
    243  1.55       jmc static const char *aconflookup(int, int);
    244   1.1    chopps 
    245   1.1    chopps /*
    246  1.64   rkujawa  * given a manufacturer id and product id, find quirks
    247  1.64   rkujawa  * for this board.
    248  1.64   rkujawa  */
    249  1.68   rkujawa 
    250  1.64   rkujawa static uint8_t
    251  1.64   rkujawa quirkslookup(int mid, int pid)
    252  1.64   rkujawa {
    253  1.64   rkujawa 	const struct quirksdata *qdp, *eqdp;
    254  1.64   rkujawa 
    255  1.64   rkujawa 	eqdp = &quirkstab[nquirksent];
    256  1.64   rkujawa 	for (qdp = quirkstab; qdp < eqdp; qdp++)
    257  1.68   rkujawa 		if (qdp->manid == mid && qdp->prodid == pid)
    258  1.64   rkujawa 			return(qdp->quirks);
    259  1.64   rkujawa 	return(0);
    260  1.64   rkujawa }
    261  1.64   rkujawa 
    262  1.64   rkujawa /*
    263   1.1    chopps  * given a manufacturer id and product id, find the name
    264   1.1    chopps  * that describes this board.
    265   1.1    chopps  */
    266  1.55       jmc static const char *
    267  1.45   aymeric aconflookup(int mid, int pid)
    268   1.1    chopps {
    269  1.62      matt 	const struct aconfdata *adp, *eadp;
    270   1.1    chopps 
    271   1.1    chopps 	eadp = &aconftab[naconfent];
    272   1.1    chopps 	for (adp = aconftab; adp < eadp; adp++)
    273   1.1    chopps 		if (adp->manid == mid && adp->prodid == pid)
    274   1.1    chopps 			return(adp->name);
    275   1.1    chopps 	return("board");
    276   1.1    chopps }
    277   1.1    chopps 
    278  1.45   aymeric /*
    279  1.45   aymeric  * mainbus driver
    280   1.1    chopps  */
    281  1.16   thorpej 
    282  1.63      matt CFATTACH_DECL_NEW(zbus, 0,
    283  1.49   thorpej     zbusmatch, zbusattach, NULL, NULL);
    284   1.1    chopps 
    285  1.63      matt static cfdata_t early_cfdata;
    286   1.1    chopps 
    287   1.1    chopps /*ARGSUSED*/
    288   1.1    chopps int
    289  1.69       chs zbusmatch(device_t parent, cfdata_t cf, void *aux)
    290   1.1    chopps {
    291  1.16   thorpej 
    292  1.69       chs 	if (matchname(aux, "zbus") == 0)
    293   1.1    chopps 		return(0);
    294   1.1    chopps 	if (amiga_realconfig == 0)
    295  1.69       chs 		early_cfdata = cf;
    296   1.1    chopps 	return(1);
    297   1.1    chopps }
    298   1.1    chopps 
    299   1.1    chopps /*
    300   1.1    chopps  * called to attach bus, we probe, i.e., scan configdev structs passed
    301   1.1    chopps  * in, for each found name call config_found() which will do this again
    302   1.1    chopps  * with that driver if matched else print a diag.
    303   1.1    chopps  */
    304   1.1    chopps void
    305  1.69       chs zbusattach(device_t parent, device_t self, void *aux)
    306   1.1    chopps {
    307   1.1    chopps 	struct zbus_args za;
    308   1.1    chopps 	struct preconfdata *pcp, *epcp;
    309   1.1    chopps 	struct cfdev *cdp, *ecdp;
    310   1.1    chopps 
    311   1.1    chopps 	epcp = &preconftab[npreconfent];
    312   1.1    chopps 	ecdp = &cfdev[ncfdev];
    313   1.1    chopps 	if (amiga_realconfig) {
    314   1.1    chopps 		if (ZTWOMEMADDR)
    315  1.26  christos 			printf(": mem 0x%08lx-0x%08lx",
    316  1.51   thorpej 			    ZTWOMEMADDR,
    317  1.51   thorpej 			    ZTWOMEMADDR + PAGE_SIZE * NZTWOMEMPG - 1);
    318   1.1    chopps 		if (ZBUSAVAIL)
    319  1.26  christos 			printf (": i/o size 0x%08x", ZBUSAVAIL);
    320  1.26  christos 		printf("\n");
    321   1.1    chopps 	}
    322   1.1    chopps 	for (cdp = cfdev; cdp < ecdp; cdp++) {
    323   1.1    chopps 		for (pcp = preconftab; pcp < epcp; pcp++) {
    324  1.45   aymeric 			if (pcp->manid == cdp->rom.manid &&
    325   1.1    chopps 			    pcp->prodid == cdp->rom.prodid)
    326   1.1    chopps 				break;
    327   1.1    chopps 		}
    328   1.1    chopps 		if (amiga_realconfig == 0 && pcp >= epcp)
    329   1.1    chopps 			continue;
    330   1.1    chopps 
    331  1.72   rkujawa #if NZ3RAMBD > 0
    332  1.72   rkujawa 		if ((cdp->rom.manid == 3643) && (cdp->rom.prodid == 32))
    333  1.72   rkujawa 		{ }
    334  1.72   rkujawa 		else
    335  1.72   rkujawa #endif /* NZ3RAMBD */
    336   1.1    chopps 		/*
    337   1.1    chopps 		 * check if it's a Zorro II or III board and not linked into
    338   1.1    chopps 		 * MemList (i.e. not a memory board)
    339   1.1    chopps 		 */
    340  1.71  christos 		switch (cdp->rom.type & (ERT_TYPEMASK | ERTF_MEMLIST)) {
    341  1.71  christos 		case ERT_ZORROII:
    342  1.71  christos 		case ERT_ZORROIII:
    343  1.71  christos 			break;
    344  1.71  christos 		default:
    345  1.71  christos 			continue;
    346  1.71  christos 		}
    347   1.1    chopps 
    348   1.1    chopps 		za.pa = cdp->addr;
    349   1.1    chopps 		za.size = cdp->size;
    350  1.68   rkujawa 		za.manid = cdp->rom.manid;
    351  1.68   rkujawa 		za.prodid = cdp->rom.prodid;
    352  1.68   rkujawa 		za.serno = cdp->rom.serno;
    353  1.68   rkujawa 		za.slot = (((u_long)za.pa >> 16) & 0xF) - 0x9;
    354  1.68   rkujawa 
    355   1.1    chopps 		if (amiga_realconfig && pcp < epcp && pcp->vaddr)
    356   1.1    chopps 			za.va = pcp->vaddr;
    357   1.1    chopps 		else {
    358  1.64   rkujawa 			if(quirkslookup(za.manid, za.prodid) !=
    359  1.64   rkujawa 		 	    ZORRO_QUIRK_NO_ZBUSMAP)
    360  1.64   rkujawa 				za.va = (void *) (isztwopa(za.pa) ?
    361  1.64   rkujawa 				    __UNVOLATILE(ztwomap(za.pa)) :
    362  1.64   rkujawa 				    zbusmap(za.pa, za.size));
    363   1.1    chopps 			/*
    364  1.45   aymeric 			 * save value if early console init
    365   1.1    chopps 			 */
    366   1.1    chopps 			if (amiga_realconfig == 0)
    367   1.1    chopps 				pcp->vaddr = za.va;
    368   1.1    chopps 		}
    369  1.69       chs 		amiga_config_found(early_cfdata, self, &za, zbusprint);
    370   1.1    chopps 	}
    371   1.1    chopps }
    372   1.1    chopps 
    373   1.1    chopps /*
    374   1.1    chopps  * print configuration info.
    375   1.1    chopps  */
    376   1.1    chopps int
    377  1.69       chs zbusprint(void *aux, const char *pnp)
    378   1.1    chopps {
    379   1.1    chopps 	struct zbus_args *zap;
    380   1.1    chopps 	int rv;
    381   1.1    chopps 
    382   1.1    chopps 	rv = UNCONF;
    383  1.69       chs 	zap = aux;
    384   1.1    chopps 
    385   1.1    chopps 	if (pnp) {
    386  1.50   thorpej 		aprint_normal("%s at %s:",
    387  1.50   thorpej 		    aconflookup(zap->manid, zap->prodid), pnp);
    388   1.1    chopps 		if (zap->manid == -1)
    389   1.1    chopps 			rv = UNSUPP;
    390   1.1    chopps 	}
    391  1.50   thorpej 	aprint_normal(" pa %8p man/pro %d/%d", zap->pa, zap->manid,
    392  1.50   thorpej 	    zap->prodid);
    393   1.1    chopps 	return(rv);
    394   1.1    chopps }
    395   1.1    chopps 
    396   1.1    chopps /*
    397  1.17        is  * this function is used to map Zorro physical I/O addresses into kernel
    398  1.17        is  * virtual addresses. We don't keep track which address we map where, we don't
    399  1.17        is  * NEED to know this. We made sure in amiga_init.c (by scanning all available
    400  1.17        is  * Zorro devices) to have enough kva-space available, so there is no extra
    401  1.17        is  * range check done here.
    402   1.1    chopps  */
    403  1.67   rkujawa void *
    404  1.57  christos zbusmap(void *pa, u_int size)
    405   1.1    chopps {
    406  1.60        is #if defined(__m68k__)
    407  1.41        is 	static vaddr_t nextkva = 0;
    408  1.41        is 	vaddr_t kva;
    409   1.1    chopps 
    410   1.1    chopps 	if (nextkva == 0)
    411   1.1    chopps 		nextkva = ZBUSADDR;
    412   1.1    chopps 
    413   1.1    chopps 	if (nextkva > ZBUSADDR + ZBUSAVAIL)
    414   1.1    chopps 		return 0;
    415   1.1    chopps 
    416   1.1    chopps 	/* size better be an integral multiple of the page size... */
    417   1.1    chopps 	kva = nextkva;
    418   1.1    chopps 	nextkva += size;
    419   1.1    chopps 	if (nextkva > ZBUSADDR + ZBUSAVAIL)
    420   1.1    chopps 		panic("allocating too much Zorro I/O address space");
    421  1.60        is 	physaccess((void *)kva, (void *)pa, size, PG_RW|PG_CI);
    422  1.60        is 	return((void *)kva);
    423  1.60        is #else
    424  1.44        is /*
    425  1.60        is  * XXX we use direct constant mapping
    426  1.44        is  */
    427  1.60        is 	return(pa);
    428  1.44        is #endif
    429   1.1    chopps }
    430