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