2001-05-14 17:18:47 +04:00
|
|
|
/* $NetBSD: isa_machdep.c,v 1.23 2001/05/14 13:18:47 leo Exp $ */
|
1997-07-15 12:17:39 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1997 Leo Weppelman. All rights reserved.
|
|
|
|
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
1998-08-15 07:02:31 +04:00
|
|
|
* Copyright (c) 1994 Charles M. Hannum. All rights reserved.
|
1997-07-15 12:17:39 +04:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
1998-08-15 07:02:31 +04:00
|
|
|
* This product includes software developed by Charles M. Hannum.
|
1997-07-15 12:17:39 +04:00
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
|
2001-03-09 23:55:46 +03:00
|
|
|
#define _ATARI_BUS_DMA_PRIVATE
|
|
|
|
#include <machine/bus.h>
|
1997-07-15 12:17:39 +04:00
|
|
|
#include <dev/isa/isavar.h>
|
|
|
|
#include <dev/isa/isareg.h>
|
|
|
|
|
2001-05-14 17:18:47 +04:00
|
|
|
#include "pckbc.h"
|
|
|
|
#if (NPCKBC > 0)
|
|
|
|
#include <dev/ic/pckbcvar.h>
|
|
|
|
#include <dev/isa/isareg.h>
|
|
|
|
#include <dev/ic/i8042reg.h>
|
|
|
|
#endif /* NPCKBC > 0 */
|
|
|
|
|
1997-07-15 12:17:39 +04:00
|
|
|
#include <machine/iomap.h>
|
|
|
|
#include <machine/mfp.h>
|
|
|
|
#include <atari/atari/device.h>
|
|
|
|
|
2001-03-09 23:55:46 +03:00
|
|
|
#include "isadma.h"
|
|
|
|
|
|
|
|
#if NISADMA == 0
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Entry points for ISA DMA while no DMA capable devices are attached.
|
|
|
|
* This must be a serious error. Cause a panic...
|
|
|
|
*/
|
|
|
|
struct atari_bus_dma_tag isa_bus_dma_tag = {
|
|
|
|
0
|
|
|
|
};
|
|
|
|
#endif /* NISADMA == 0 */
|
|
|
|
|
1997-07-15 12:17:39 +04:00
|
|
|
static int isabusprint __P((void *auxp, const char *));
|
|
|
|
static int isabusmatch __P((struct device *, struct cfdata *, void *));
|
|
|
|
static void isabusattach __P((struct device *, struct device *, void *));
|
|
|
|
|
1998-06-09 04:08:12 +04:00
|
|
|
struct isabus_softc {
|
|
|
|
struct device sc_dev;
|
|
|
|
struct atari_isa_chipset sc_chipset;
|
|
|
|
};
|
|
|
|
|
1997-07-15 12:17:39 +04:00
|
|
|
struct cfattach isabus_ca = {
|
1998-06-09 04:08:12 +04:00
|
|
|
sizeof(struct isabus_softc), isabusmatch, isabusattach
|
1997-07-15 12:17:39 +04:00
|
|
|
};
|
|
|
|
|
2001-05-14 17:18:47 +04:00
|
|
|
/*
|
|
|
|
* We need some static storage to attach a console keyboard on the Milan
|
|
|
|
* during early console init.
|
|
|
|
*/
|
|
|
|
static struct atari_bus_space bs_storage[2]; /* 1 iot, 1 memt */
|
|
|
|
|
1997-07-15 12:17:39 +04:00
|
|
|
int
|
|
|
|
isabusmatch(pdp, cfp, auxp)
|
|
|
|
struct device *pdp;
|
|
|
|
struct cfdata *cfp;
|
|
|
|
void *auxp;
|
|
|
|
{
|
2001-01-08 00:17:32 +03:00
|
|
|
static int nmatched = 0;
|
|
|
|
|
|
|
|
if (strcmp((char *)auxp, "isabus"))
|
|
|
|
return (0); /* Wrong number... */
|
|
|
|
|
1997-07-15 12:17:39 +04:00
|
|
|
if(atari_realconfig == 0)
|
2001-05-14 17:18:47 +04:00
|
|
|
return (1);
|
2001-01-08 00:17:32 +03:00
|
|
|
|
|
|
|
if (machineid & (ATARI_HADES|ATARI_MILAN)) {
|
|
|
|
/*
|
|
|
|
* The Hades and Milan have only one pci bus
|
|
|
|
*/
|
|
|
|
if (nmatched)
|
|
|
|
return (0);
|
|
|
|
nmatched++;
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
return(0);
|
1997-07-15 12:17:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
isabusattach(pdp, dp, auxp)
|
|
|
|
struct device *pdp, *dp;
|
|
|
|
void *auxp;
|
|
|
|
{
|
1998-06-11 12:32:00 +04:00
|
|
|
struct isabus_softc *sc = (struct isabus_softc *)dp;
|
1997-07-15 12:17:39 +04:00
|
|
|
struct isabus_attach_args iba;
|
2001-03-09 23:55:46 +03:00
|
|
|
extern struct atari_bus_dma_tag isa_bus_dma_tag;
|
2001-04-24 10:39:47 +04:00
|
|
|
extern void isa_bus_init(void);
|
1997-07-15 12:17:39 +04:00
|
|
|
|
|
|
|
iba.iba_busname = "isa";
|
2001-03-09 23:55:46 +03:00
|
|
|
iba.iba_dmat = &isa_bus_dma_tag;
|
2001-05-14 17:18:47 +04:00
|
|
|
iba.iba_iot = leb_alloc_bus_space_tag(&bs_storage[0]);
|
|
|
|
iba.iba_memt = leb_alloc_bus_space_tag(&bs_storage[1]);
|
1998-06-09 04:08:12 +04:00
|
|
|
iba.iba_ic = &sc->sc_chipset;
|
1998-04-10 12:19:53 +04:00
|
|
|
if ((iba.iba_iot == NULL) || (iba.iba_memt == NULL)) {
|
|
|
|
printf("leb_alloc_bus_space_tag failed!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
iba.iba_iot->base = ISA_IOSTART;
|
|
|
|
iba.iba_memt->base = ISA_MEMSTART;
|
1997-07-15 12:17:39 +04:00
|
|
|
|
2001-04-24 10:39:47 +04:00
|
|
|
if (machineid & ATARI_HADES)
|
|
|
|
MFP->mf_aer |= (IO_ISA1|IO_ISA2); /* ISA interrupts: LOW->HIGH */
|
|
|
|
isa_bus_init();
|
2001-05-14 17:18:47 +04:00
|
|
|
if (dp == NULL) { /* Early init */
|
|
|
|
#if (NPCKBC > 0)
|
|
|
|
pckbc_cnattach(iba.iba_iot, IO_KBD, KBCMDP, PCKBC_KBD_SLOT);
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
}
|
1997-07-15 12:17:39 +04:00
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
config_found(dp, &iba, isabusprint);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
isabusprint(auxp, name)
|
|
|
|
void *auxp;
|
|
|
|
const char *name;
|
|
|
|
{
|
|
|
|
if(name == NULL)
|
|
|
|
return(UNCONF);
|
|
|
|
return(QUIET);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
isa_attach_hook(parent, self, iba)
|
|
|
|
struct device *parent, *self;
|
|
|
|
struct isabus_attach_args *iba;
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-06-04 23:14:14 +04:00
|
|
|
const struct evcnt *
|
|
|
|
isa_intr_evcnt(isa_chipset_tag_t ic, int irq)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* XXX for now, no evcnt parent reported */
|
|
|
|
return NULL;
|
|
|
|
}
|