vme_machdep.c revision 1.9
11.9Smrg/*	$NetBSD: vme_machdep.c,v 1.9 2000/06/29 08:28:25 mrg 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.5Sleostruct cfattach avmebus_ca = {
581.1Sleo	sizeof(struct device), vmebusmatch, vmebusattach
591.1Sleo};
601.1Sleo
611.1Sleoint
621.1Sleovmebusmatch(pdp, cfp, auxp)
631.1Sleostruct device	*pdp;
641.1Sleostruct cfdata	*cfp;
651.1Sleovoid		*auxp;
661.1Sleo{
671.1Sleo	if(atari_realconfig == 0)
681.1Sleo		return (0);
691.6Sleo	if (strcmp((char *)auxp, "avmebus") || cfp->cf_unit != 0)
701.1Sleo		return(0);
711.1Sleo	return(machineid & ATARI_FALCON ? 0 : 1);
721.1Sleo}
731.1Sleo
741.1Sleovoid
751.1Sleovmebusattach(pdp, dp, auxp)
761.1Sleostruct device	*pdp, *dp;
771.1Sleovoid		*auxp;
781.1Sleo{
791.1Sleo	struct vmebus_attach_args	vba;
801.1Sleo
811.1Sleo	vba.vba_busname = "vme";
821.7Sleo	vba.vba_iot     = beb_alloc_bus_space_tag(NULL);
831.7Sleo	vba.vba_memt    = beb_alloc_bus_space_tag(NULL);
841.4Sleo	if ((vba.vba_iot == NULL) || (vba.vba_memt == NULL)) {
851.4Sleo		printf("beb_alloc_bus_space_tag failed!\n");
861.4Sleo		return;
871.4Sleo	}
881.4Sleo
891.4Sleo	/*
901.4Sleo	 * XXX: Should we use zero or the actual (phys) start of VME memory.
911.4Sleo	 */
921.4Sleo	vba.vba_iot->base  = 0;
931.4Sleo	vba.vba_memt->base = 0;
941.1Sleo
951.1Sleo	printf("\n");
961.1Sleo	config_found(dp, &vba, vmebusprint);
971.1Sleo}
981.1Sleo
991.1Sleoint
1001.1Sleovmebusprint(auxp, name)
1011.1Sleovoid		*auxp;
1021.1Sleoconst char	*name;
1031.1Sleo{
1041.1Sleo	if(name == NULL)
1051.1Sleo		return(UNCONF);
1061.1Sleo	return(QUIET);
1071.1Sleo}
108