vme_machdep.c revision 1.11
11.11Sthorpej/*	$NetBSD: vme_machdep.c,v 1.11 2002/10/02 05:04:27 thorpej Exp $	*/
21.1Sleo
31.1Sleo/*-
41.1Sleo * Copyright (c) 1997 The NetBSD Foundation, Inc.
51.1Sleo * All rights reserved.
61.1Sleo *
71.1Sleo * Redistribution and use in source and binary forms, with or without
81.1Sleo * modification, are permitted provided that the following conditions
91.1Sleo * are met:
101.1Sleo * 1. Redistributions of source code must retain the above copyright
111.1Sleo *    notice, this list of conditions and the following disclaimer.
121.1Sleo * 2. Redistributions in binary form must reproduce the above copyright
131.1Sleo *    notice, this list of conditions and the following disclaimer in the
141.1Sleo *    documentation and/or other materials provided with the distribution.
151.1Sleo * 3. All advertising materials mentioning features or use of this software
161.1Sleo *    must display the following acknowledgement:
171.1Sleo *        This product includes software developed by the NetBSD
181.1Sleo *        Foundation, Inc. and its contributors.
191.1Sleo * 4. Neither the name of The NetBSD Foundation nor the names of its
201.1Sleo *    contributors may be used to endorse or promote products derived
211.1Sleo *    from this software without specific prior written permission.
221.1Sleo *
231.1Sleo * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
241.1Sleo * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
251.1Sleo * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
261.2Sjtc * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
271.2Sjtc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
281.1Sleo * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
291.1Sleo * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
301.1Sleo * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
311.1Sleo * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
321.1Sleo * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
331.1Sleo * POSSIBILITY OF SUCH DAMAGE.
341.1Sleo */
351.1Sleo
361.1Sleo#include <sys/types.h>
371.1Sleo#include <sys/param.h>
381.1Sleo#include <sys/time.h>
391.1Sleo#include <sys/systm.h>
401.1Sleo#include <sys/errno.h>
411.1Sleo#include <sys/device.h>
421.1Sleo
431.9Smrg#include <uvm/uvm_extern.h>
441.1Sleo
451.1Sleo#include <machine/bus.h>
461.1Sleo#include <machine/cpu.h>
471.1Sleo#include <machine/iomap.h>
481.1Sleo#include <machine/mfp.h>
491.1Sleo
501.1Sleo#include <atari/atari/device.h>
511.1Sleo#include <atari/vme/vmevar.h>
521.1Sleo
531.1Sleostatic int	vmebusprint __P((void *auxp, const char *));
541.1Sleostatic int	vmebusmatch __P((struct device *, struct cfdata *, void *));
551.1Sleostatic void	vmebusattach __P((struct device *, struct device *, void *));
561.1Sleo
571.11SthorpejCFATTACH_DECL(avmebus, sizeof(struct device),
581.11Sthorpej    vmebusmatch, vmebusattach, NULL, NULL);
591.1Sleo
601.1Sleoint
611.1Sleovmebusmatch(pdp, cfp, auxp)
621.1Sleostruct device	*pdp;
631.1Sleostruct cfdata	*cfp;
641.1Sleovoid		*auxp;
651.1Sleo{
661.1Sleo	if(atari_realconfig == 0)
671.1Sleo		return (0);
681.6Sleo	if (strcmp((char *)auxp, "avmebus") || cfp->cf_unit != 0)
691.1Sleo		return(0);
701.1Sleo	return(machineid & ATARI_FALCON ? 0 : 1);
711.1Sleo}
721.1Sleo
731.1Sleovoid
741.1Sleovmebusattach(pdp, dp, auxp)
751.1Sleostruct device	*pdp, *dp;
761.1Sleovoid		*auxp;
771.1Sleo{
781.1Sleo	struct vmebus_attach_args	vba;
791.1Sleo
801.1Sleo	vba.vba_busname = "vme";
811.7Sleo	vba.vba_iot     = beb_alloc_bus_space_tag(NULL);
821.7Sleo	vba.vba_memt    = beb_alloc_bus_space_tag(NULL);
831.4Sleo	if ((vba.vba_iot == NULL) || (vba.vba_memt == NULL)) {
841.4Sleo		printf("beb_alloc_bus_space_tag failed!\n");
851.4Sleo		return;
861.4Sleo	}
871.4Sleo
881.4Sleo	/*
891.4Sleo	 * XXX: Should we use zero or the actual (phys) start of VME memory.
901.4Sleo	 */
911.4Sleo	vba.vba_iot->base  = 0;
921.4Sleo	vba.vba_memt->base = 0;
931.1Sleo
941.1Sleo	printf("\n");
951.1Sleo	config_found(dp, &vba, vmebusprint);
961.1Sleo}
971.1Sleo
981.1Sleoint
991.1Sleovmebusprint(auxp, name)
1001.1Sleovoid		*auxp;
1011.1Sleoconst char	*name;
1021.1Sleo{
1031.1Sleo	if(name == NULL)
1041.1Sleo		return(UNCONF);
1051.1Sleo	return(QUIET);
1061.1Sleo}
107