vme_machdep.c revision 1.5
11.5Sleo/*	$NetBSD: vme_machdep.c,v 1.5 1998/09/02 11:24:22 leo 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.1Sleo#include <vm/vm.h>
441.1Sleo#include <vm/vm_kern.h>
451.1Sleo
461.1Sleo#include <machine/bus.h>
471.1Sleo#include <machine/cpu.h>
481.1Sleo#include <machine/iomap.h>
491.1Sleo#include <machine/mfp.h>
501.1Sleo
511.1Sleo#include <atari/atari/device.h>
521.1Sleo#include <atari/vme/vmevar.h>
531.1Sleo
541.1Sleostatic int	vmebusprint __P((void *auxp, const char *));
551.1Sleostatic int	vmebusmatch __P((struct device *, struct cfdata *, void *));
561.1Sleostatic void	vmebusattach __P((struct device *, struct device *, void *));
571.1Sleo
581.5Sleostruct cfattach avmebus_ca = {
591.1Sleo	sizeof(struct device), vmebusmatch, vmebusattach
601.1Sleo};
611.1Sleo
621.1Sleoint
631.1Sleovmebusmatch(pdp, cfp, auxp)
641.1Sleostruct device	*pdp;
651.1Sleostruct cfdata	*cfp;
661.1Sleovoid		*auxp;
671.1Sleo{
681.1Sleo	if(atari_realconfig == 0)
691.1Sleo		return (0);
701.1Sleo	if (strcmp((char *)auxp, "vmebus") || cfp->cf_unit != 0)
711.1Sleo		return(0);
721.1Sleo	return(machineid & ATARI_FALCON ? 0 : 1);
731.1Sleo}
741.1Sleo
751.1Sleovoid
761.1Sleovmebusattach(pdp, dp, auxp)
771.1Sleostruct device	*pdp, *dp;
781.1Sleovoid		*auxp;
791.1Sleo{
801.1Sleo	struct vmebus_attach_args	vba;
811.4Sleo	bus_space_tag_t			beb_alloc_bus_space_tag __P((void));
821.1Sleo
831.1Sleo	vba.vba_busname = "vme";
841.4Sleo	vba.vba_iot     = beb_alloc_bus_space_tag();
851.4Sleo	vba.vba_memt    = beb_alloc_bus_space_tag();
861.4Sleo	if ((vba.vba_iot == NULL) || (vba.vba_memt == NULL)) {
871.4Sleo		printf("beb_alloc_bus_space_tag failed!\n");
881.4Sleo		return;
891.4Sleo	}
901.4Sleo
911.4Sleo	/*
921.4Sleo	 * XXX: Should we use zero or the actual (phys) start of VME memory.
931.4Sleo	 */
941.4Sleo	vba.vba_iot->base  = 0;
951.4Sleo	vba.vba_memt->base = 0;
961.1Sleo
971.1Sleo	printf("\n");
981.1Sleo	config_found(dp, &vba, vmebusprint);
991.1Sleo}
1001.1Sleo
1011.1Sleoint
1021.1Sleovmebusprint(auxp, name)
1031.1Sleovoid		*auxp;
1041.1Sleoconst char	*name;
1051.1Sleo{
1061.1Sleo	if(name == NULL)
1071.1Sleo		return(UNCONF);
1081.1Sleo	return(QUIET);
1091.1Sleo}
110