vme_machdep.c revision 1.13
11.13Schs/*	$NetBSD: vme_machdep.c,v 1.13 2004/12/13 02:14:13 chs 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.12Slukem
361.12Slukem#include <sys/cdefs.h>
371.13Schs__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.13 2004/12/13 02:14:13 chs Exp $");
381.1Sleo
391.1Sleo#include <sys/types.h>
401.1Sleo#include <sys/param.h>
411.1Sleo#include <sys/time.h>
421.1Sleo#include <sys/systm.h>
431.1Sleo#include <sys/errno.h>
441.1Sleo#include <sys/device.h>
451.1Sleo
461.9Smrg#include <uvm/uvm_extern.h>
471.1Sleo
481.1Sleo#include <machine/bus.h>
491.1Sleo#include <machine/cpu.h>
501.1Sleo#include <machine/iomap.h>
511.1Sleo#include <machine/mfp.h>
521.1Sleo
531.1Sleo#include <atari/atari/device.h>
541.1Sleo#include <atari/vme/vmevar.h>
551.1Sleo
561.1Sleostatic int	vmebusprint __P((void *auxp, const char *));
571.1Sleostatic int	vmebusmatch __P((struct device *, struct cfdata *, void *));
581.1Sleostatic void	vmebusattach __P((struct device *, struct device *, void *));
591.1Sleo
601.11SthorpejCFATTACH_DECL(avmebus, sizeof(struct device),
611.11Sthorpej    vmebusmatch, vmebusattach, NULL, NULL);
621.1Sleo
631.13Schsint vmebus_attached;
641.13Schs
651.1Sleoint
661.1Sleovmebusmatch(pdp, cfp, auxp)
671.1Sleostruct device	*pdp;
681.1Sleostruct cfdata	*cfp;
691.1Sleovoid		*auxp;
701.1Sleo{
711.1Sleo	if(atari_realconfig == 0)
721.1Sleo		return (0);
731.13Schs	if (strcmp((char *)auxp, "avmebus") || vmebus_attached)
741.1Sleo		return(0);
751.1Sleo	return(machineid & ATARI_FALCON ? 0 : 1);
761.1Sleo}
771.1Sleo
781.1Sleovoid
791.1Sleovmebusattach(pdp, dp, auxp)
801.1Sleostruct device	*pdp, *dp;
811.1Sleovoid		*auxp;
821.1Sleo{
831.1Sleo	struct vmebus_attach_args	vba;
841.1Sleo
851.13Schs	vmebus_attached = 1;
861.13Schs
871.1Sleo	vba.vba_busname = "vme";
881.7Sleo	vba.vba_iot     = beb_alloc_bus_space_tag(NULL);
891.7Sleo	vba.vba_memt    = beb_alloc_bus_space_tag(NULL);
901.4Sleo	if ((vba.vba_iot == NULL) || (vba.vba_memt == NULL)) {
911.4Sleo		printf("beb_alloc_bus_space_tag failed!\n");
921.4Sleo		return;
931.4Sleo	}
941.4Sleo
951.4Sleo	/*
961.4Sleo	 * XXX: Should we use zero or the actual (phys) start of VME memory.
971.4Sleo	 */
981.4Sleo	vba.vba_iot->base  = 0;
991.4Sleo	vba.vba_memt->base = 0;
1001.1Sleo
1011.1Sleo	printf("\n");
1021.1Sleo	config_found(dp, &vba, vmebusprint);
1031.1Sleo}
1041.1Sleo
1051.1Sleoint
1061.1Sleovmebusprint(auxp, name)
1071.1Sleovoid		*auxp;
1081.1Sleoconst char	*name;
1091.1Sleo{
1101.1Sleo	if(name == NULL)
1111.1Sleo		return(UNCONF);
1121.1Sleo	return(QUIET);
1131.1Sleo}
114