2003-04-02 01:26:26 +04:00
|
|
|
/* $NetBSD: drsupio.c,v 1.15 2003/04/01 21:26:31 thorpej Exp $ */
|
1997-08-27 23:32:47 +04:00
|
|
|
|
1999-02-17 01:46:55 +03:00
|
|
|
/*-
|
1999-02-17 02:34:10 +03:00
|
|
|
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
1997-08-27 23:32:47 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
1999-02-17 01:46:55 +03:00
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Ignatios Souvatzis.
|
|
|
|
*
|
1997-08-27 23:32:47 +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:
|
1999-02-17 01:46:55 +03:00
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
1997-08-27 23:32:47 +04:00
|
|
|
*
|
1999-02-17 01:46:55 +03:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``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 FOUNDATION OR CONTRIBUTORS
|
|
|
|
* 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.
|
1997-08-27 23:32:47 +04:00
|
|
|
*/
|
|
|
|
|
2002-01-28 12:56:43 +03:00
|
|
|
#include <sys/cdefs.h>
|
2003-04-02 01:26:26 +04:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: drsupio.c,v 1.15 2003/04/01 21:26:31 thorpej Exp $");
|
2002-01-28 12:56:43 +03:00
|
|
|
|
1997-08-27 23:32:47 +04:00
|
|
|
/*
|
|
|
|
* DraCo multi-io chip bus space stuff
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
2003-04-02 01:26:26 +04:00
|
|
|
#include <uvm/uvm_extern.h>
|
|
|
|
|
1997-08-27 23:32:47 +04:00
|
|
|
#include <machine/bus.h>
|
|
|
|
|
|
|
|
#include <amiga/include/cpu.h>
|
|
|
|
|
|
|
|
#include <amiga/amiga/device.h>
|
|
|
|
#include <amiga/amiga/drcustom.h>
|
|
|
|
|
|
|
|
#include <amiga/dev/supio.h>
|
|
|
|
|
|
|
|
struct drsupio_softc {
|
|
|
|
struct device sc_dev;
|
|
|
|
struct bus_space_tag sc_bst;
|
|
|
|
};
|
|
|
|
|
2002-01-26 16:40:52 +03:00
|
|
|
int drsupiomatch(struct device *, struct cfdata *, void *);
|
|
|
|
void drsupioattach(struct device *, struct device *, void *);
|
|
|
|
int drsupprint(void *auxp, const char *);
|
|
|
|
void drlptintack(void *);
|
1997-08-27 23:32:47 +04:00
|
|
|
|
2002-10-02 08:55:47 +04:00
|
|
|
CFATTACH_DECL(drsupio, sizeof(struct drsupio_softc),
|
|
|
|
drsupiomatch, drsupioattach, NULL, NULL);
|
1997-08-27 23:32:47 +04:00
|
|
|
|
|
|
|
int
|
2002-01-26 16:40:52 +03:00
|
|
|
drsupiomatch(struct device *parent, struct cfdata *cfp, void *auxp)
|
1997-08-27 23:32:47 +04:00
|
|
|
{
|
2000-03-16 19:37:20 +03:00
|
|
|
static int drsupio_matched = 0;
|
1997-08-27 23:32:47 +04:00
|
|
|
|
|
|
|
/* Exactly one of us lives on the DraCo */
|
2000-03-16 19:37:20 +03:00
|
|
|
if (!is_draco() || !matchname(auxp, "drsupio") || drsupio_matched)
|
|
|
|
return 0;
|
1997-08-27 23:32:47 +04:00
|
|
|
|
2000-03-16 19:37:20 +03:00
|
|
|
drsupio_matched = 1;
|
|
|
|
return 1;
|
1997-08-27 23:32:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
struct drsupio_devs {
|
|
|
|
char *name;
|
|
|
|
int off;
|
1997-09-17 00:34:23 +04:00
|
|
|
int arg;
|
1997-08-27 23:32:47 +04:00
|
|
|
} drsupiodevs[] = {
|
1997-09-17 00:34:23 +04:00
|
|
|
{ "com", 0x3f8, 115200 * 16 },
|
|
|
|
{ "com", 0x2f8, 115200 * 16 },
|
1997-09-28 02:44:11 +04:00
|
|
|
{ "lpt", 0x278, (int)drlptintack },
|
1997-09-17 00:34:23 +04:00
|
|
|
{ "fdc", 0x3f0, 0 },
|
1997-08-27 23:32:47 +04:00
|
|
|
/* WD port? */
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
2002-01-26 16:40:52 +03:00
|
|
|
drsupioattach(struct device *parent, struct device *self, void *auxp)
|
1997-08-27 23:32:47 +04:00
|
|
|
{
|
|
|
|
struct drsupio_softc *drsc;
|
|
|
|
struct drsupio_devs *drsd;
|
1997-09-28 02:44:11 +04:00
|
|
|
struct drioct *ioct;
|
1997-08-27 23:32:47 +04:00
|
|
|
struct supio_attach_args supa;
|
|
|
|
|
|
|
|
drsc = (struct drsupio_softc *)self;
|
|
|
|
drsd = drsupiodevs;
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
printf("\n");
|
|
|
|
|
2003-04-02 01:26:26 +04:00
|
|
|
drsc->sc_bst.base = DRCCADDR + PAGE_SIZE * DRSUPIOPG + 1;
|
1999-12-30 23:56:44 +03:00
|
|
|
drsc->sc_bst.absm = &amiga_bus_stride_4;
|
2002-01-26 16:40:52 +03:00
|
|
|
|
1997-08-27 23:32:47 +04:00
|
|
|
supa.supio_iot = &drsc->sc_bst;
|
1997-09-17 00:34:23 +04:00
|
|
|
supa.supio_ipl = 5;
|
1997-08-27 23:32:47 +04:00
|
|
|
|
|
|
|
while (drsd->name) {
|
|
|
|
supa.supio_name = drsd->name;
|
|
|
|
supa.supio_iobase = drsd->off;
|
1997-09-17 00:34:23 +04:00
|
|
|
supa.supio_arg = drsd->arg;
|
1997-08-27 23:32:47 +04:00
|
|
|
config_found(self, &supa, drsupprint); /* XXX */
|
|
|
|
++drsd;
|
|
|
|
}
|
1997-09-28 02:44:11 +04:00
|
|
|
|
|
|
|
drlptintack(0);
|
2003-04-02 01:26:26 +04:00
|
|
|
ioct = (struct drioct *)(DRCCADDR + PAGE_SIZE * DRIOCTLPG);
|
1997-09-28 02:44:11 +04:00
|
|
|
ioct->io_status2 |= DRSTAT2_PARIRQENA;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-01-26 16:40:52 +03:00
|
|
|
drlptintack(void *p)
|
1997-09-28 02:44:11 +04:00
|
|
|
{
|
|
|
|
struct drioct *ioct;
|
|
|
|
|
|
|
|
(void)p;
|
2003-04-02 01:26:26 +04:00
|
|
|
ioct = (struct drioct *)(DRCCADDR + PAGE_SIZE * DRIOCTLPG);
|
1997-09-28 02:44:11 +04:00
|
|
|
|
|
|
|
ioct->io_parrst = 0; /* any value works */
|
1997-08-27 23:32:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-01-26 16:40:52 +03:00
|
|
|
drsupprint(void *auxp, const char *pnp)
|
1997-08-27 23:32:47 +04:00
|
|
|
{
|
|
|
|
struct supio_attach_args *supa;
|
|
|
|
supa = auxp;
|
|
|
|
|
|
|
|
if (pnp == NULL)
|
|
|
|
return(QUIET);
|
|
|
|
|
2003-01-01 03:25:01 +03:00
|
|
|
aprint_normal("%s at %s port 0x%02x",
|
1997-08-27 23:32:47 +04:00
|
|
|
supa->supio_name, pnp, supa->supio_iobase);
|
|
|
|
|
|
|
|
return(UNCONF);
|
|
|
|
}
|