Home | History | Annotate | Line # | Download | only in isa
isa_machdep.c revision 1.22
      1 /*	$NetBSD: isa_machdep.c,v 1.22 2001/04/24 06:39:48 leo Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1997 Leo Weppelman.  All rights reserved.
      5  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
      6  * Copyright (c) 1994 Charles M. Hannum.  All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. All advertising materials mentioning features or use of this software
     17  *    must display the following acknowledgement:
     18  *	This product includes software developed by Charles M. Hannum.
     19  * 4. The name of the author may not be used to endorse or promote products
     20  *    derived from this software without specific prior written permission.
     21  *
     22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32  */
     33 
     34 #include <sys/types.h>
     35 #include <sys/param.h>
     36 #include <sys/systm.h>
     37 #include <sys/device.h>
     38 
     39 #define _ATARI_BUS_DMA_PRIVATE
     40 #include <machine/bus.h>
     41 #include <dev/isa/isavar.h>
     42 #include <dev/isa/isareg.h>
     43 
     44 #include <machine/iomap.h>
     45 #include <machine/mfp.h>
     46 #include <atari/atari/device.h>
     47 
     48 #include "isadma.h"
     49 
     50 #if NISADMA == 0
     51 
     52 /*
     53  * Entry points for ISA DMA while no DMA capable devices are attached.
     54  * This must be a serious error. Cause a panic...
     55  */
     56 struct atari_bus_dma_tag isa_bus_dma_tag = {
     57 	0
     58 };
     59 #endif /* NISADMA == 0 */
     60 
     61 static int	isabusprint __P((void *auxp, const char *));
     62 static int	isabusmatch __P((struct device *, struct cfdata *, void *));
     63 static void	isabusattach __P((struct device *, struct device *, void *));
     64 
     65 struct isabus_softc {
     66 	struct device sc_dev;
     67 	struct atari_isa_chipset sc_chipset;
     68 };
     69 
     70 struct cfattach isabus_ca = {
     71 	sizeof(struct isabus_softc), isabusmatch, isabusattach
     72 };
     73 
     74 int
     75 isabusmatch(pdp, cfp, auxp)
     76 struct device	*pdp;
     77 struct cfdata	*cfp;
     78 void		*auxp;
     79 {
     80 	static int	nmatched = 0;
     81 
     82 	if (strcmp((char *)auxp, "isabus"))
     83 		return (0); /* Wrong number... */
     84 
     85 	if(atari_realconfig == 0)
     86 		return (0);
     87 
     88 	if (machineid & (ATARI_HADES|ATARI_MILAN)) {
     89 		/*
     90 		 * The Hades and Milan have only one pci bus
     91 		 */
     92 		if (nmatched)
     93 			return (0);
     94 		nmatched++;
     95 		return (1);
     96 	}
     97 	return(0);
     98 }
     99 
    100 void
    101 isabusattach(pdp, dp, auxp)
    102 struct device	*pdp, *dp;
    103 void		*auxp;
    104 {
    105 	struct isabus_softc *sc = (struct isabus_softc *)dp;
    106 	struct isabus_attach_args	iba;
    107 	extern struct atari_bus_dma_tag isa_bus_dma_tag;
    108 	extern void isa_bus_init(void);
    109 
    110 	iba.iba_busname = "isa";
    111 	iba.iba_dmat	= &isa_bus_dma_tag;
    112 	iba.iba_iot     = leb_alloc_bus_space_tag(NULL);
    113 	iba.iba_memt    = leb_alloc_bus_space_tag(NULL);
    114 	iba.iba_ic	= &sc->sc_chipset;
    115 	if ((iba.iba_iot == NULL) || (iba.iba_memt == NULL)) {
    116 		printf("leb_alloc_bus_space_tag failed!\n");
    117 		return;
    118 	}
    119 	iba.iba_iot->base  = ISA_IOSTART;
    120 	iba.iba_memt->base = ISA_MEMSTART;
    121 
    122 	if (machineid & ATARI_HADES)
    123 	    MFP->mf_aer |= (IO_ISA1|IO_ISA2); /* ISA interrupts: LOW->HIGH */
    124 	isa_bus_init();
    125 
    126 	printf("\n");
    127 	config_found(dp, &iba, isabusprint);
    128 }
    129 
    130 int
    131 isabusprint(auxp, name)
    132 void		*auxp;
    133 const char	*name;
    134 {
    135 	if(name == NULL)
    136 		return(UNCONF);
    137 	return(QUIET);
    138 }
    139 
    140 void
    141 isa_attach_hook(parent, self, iba)
    142 	struct device		  *parent, *self;
    143 	struct isabus_attach_args *iba;
    144 {
    145 }
    146 
    147 const struct evcnt *
    148 isa_intr_evcnt(isa_chipset_tag_t ic, int irq)
    149 {
    150 
    151 	/* XXX for now, no evcnt parent reported */
    152 	return NULL;
    153 }
    154