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