Define supio, a direct bus with a single locator, the port number. This

is for "standard PC i/o stuff" at known and constant locations, e.g. when
multi-io chips are used on non-ISA mainboards.
Implement drsupio.c, the DraCo version of this.
Attach the generic com.c to this bus.
Remove the old drcom hack.
This commit is contained in:
is 1997-08-27 19:32:47 +00:00
parent d2a9d1970d
commit f7c9a70a19
8 changed files with 352 additions and 1429 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: DRACO,v 1.14 1997/07/17 23:29:33 is Exp $
# $NetBSD: DRACO,v 1.15 1997/08/27 19:32:48 is Exp $
#
# Macro System GmbH "DraCo", currently 68060-only until FPE is integrated.
@ -130,8 +130,8 @@ mfcs1 at mfc0 unit 1 # MFC serial
#mfcp1 at mfc1 unit 0
drbbc0 at mainbus0 # DraCo battery backed clock
drcom0 at mainbus0 # DraCo serial ports
drcom1 at mainbus0 # unit 1 normally connected to mouse
drsupio0 at mainbus0 # DraCo superio chip
com* at drsupio? port ? # DraCo serial
le* at zbus0 # Lance ethernet.
ed0 at zbus0 # dp8390 ethernet
@ -157,5 +157,6 @@ pseudo-device pty 16 # pseudo terminals
pseudo-device loop # network loopback
pseudo-device bpfilter 2 # berkeley packet filters
pseudo-device tun 2
pseudo-device ppp 2 # ppp protocol network drivers
config netbsd root on ? type ?

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.84 1997/08/23 19:17:59 mjacob Exp $
# $NetBSD: GENERIC,v 1.85 1997/08/27 19:32:49 is Exp $
#
# GENERIC AMIGA
@ -194,8 +194,8 @@ mfcs1 at mfc0 unit 1 # MFC serial
#mfcp1 at mfc1 unit 0
drbbc0 at mainbus0 # DraCo battery backed clock
drcom0 at mainbus0 # DraCo serial 0
drcom1 at mainbus0 # DraCo serial 1, normally mouse
drsupio0 at mainbus0 # DraCo superio chip
com* at drsupio? port ? # DraCo serial
a2kbbc0 at mainbus0 # A2000 battery backed clock
a34kbbc0 at mainbus0 # A3000/A4000 battery backed clock

View File

@ -1,4 +1,4 @@
# $NetBSD: files.amiga,v 1.61 1997/08/27 11:25:43 bouyer Exp $
# $NetBSD: files.amiga,v 1.62 1997/08/27 19:32:47 is Exp $
# maxpartitions must be first item in files.${ARCH}.newconf
maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
@ -172,10 +172,19 @@ device mfcp
attach mfcp at mfc
file arch/amiga/dev/mfc.c mfcs | mfcp needs-count
# DraCo internal com port
device drcom: tty
attach drcom at mainbus
file arch/amiga/dev/drcom.c drcom needs-count
# DraCo superio chip
define supio {port = -1}
device drsupio: supio
attach drsupio at mainbus
file arch/amiga/dev/drsupio.c drsupio
# yes, this is ugly
device com: tty
file dev/isa/com.c com needs-flag
attach com at supio with com_supio
file arch/amiga/dev/com_supio.c com_supio
include "../../../dev/scsipi/files.scsipi"
major {sd = 4}

View File

@ -0,0 +1,175 @@
/* $NetBSD: com_supio.c,v 1.1 1997/08/27 19:32:53 is Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996
* Charles M. Hannum. All rights reserved.
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
*
* 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:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)com.c 7.5 (Berkeley) 5/16/91
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/tty.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/syslog.h>
#include <sys/types.h>
#include <sys/device.h>
#include <machine/intr.h>
#include <machine/bus.h>
/*#include <dev/isa/isavar.h>*/
#include <dev/isa/comreg.h>
#include <dev/isa/comvar.h>
#include <amiga/dev/supio.h>
struct comsupio_softc {
struct com_softc sc_com;
struct isr sc_isr;
};
#ifdef __BROKEN_INDIRECT_CONFIG
int com_supio_probe __P((struct device *, void *, void *));
#else
int com_supio_probe __P((struct device *, struct cfdata *, void *));
#endif
void com_supio_attach __P((struct device *, struct device *, void *));
void com_supio_cleanup __P((void *));
static int comconsaddr;
static bus_space_handle_t comconsioh;
#if 0
static int comconsattached;
static bus_space_tag_t comconstag;
static int comconsrate;
static tcflag_t comconscflag;
#endif
struct cfattach com_supio_ca = {
sizeof(struct comsupio_softc), com_supio_probe, com_supio_attach
};
int
com_supio_probe(parent, match, aux)
struct device *parent;
#ifdef __BROKEN_INDIRECT_CONFIG
void *match;
#else
struct cfdata *match;
#endif
void *aux;
{
bus_space_tag_t iot;
/* XXX bus_space_handle_t ioh;*/
int iobase;
int rv = 1;
struct supio_attach_args *supa = aux;
iot = supa->supio_iot;
iobase = supa->supio_iobase;
if (strcmp(supa->supio_name,"com") || (match->cf_unit > 1))
return 0;
#if 0
/* if it's in use as console, it's there. */
if (iobase != comconsaddr || comconsattached) {
if (bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh)) {
return 0;
}
rv = comprobe1(iot, ioh, iobase);
bus_space_unmap(iot, ioh, COM_NPORTS);
}
#endif
return (rv);
}
void
com_supio_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct comsupio_softc *sc = (void *)self;
struct com_softc *csc = &sc->sc_com;
int iobase;
bus_space_tag_t iot;
struct supio_attach_args *supa = aux;
/*
* We're living on a superio chip.
*/
iobase = csc->sc_iobase = supa->supio_iobase;
iot = csc->sc_iot = supa->supio_iot;
if (iobase != comconsaddr) {
if (bus_space_map(iot, iobase, COM_NPORTS, 0, &csc->sc_ioh))
panic("comattach: io mapping failed");
} else
csc->sc_ioh = comconsioh;
printf(" port 0x%x", iobase);
com_attach_subr(csc);
if (amiga_ttyspl < (PSL_S|PSL_IPL5)) {
printf("%s: raising amiga_ttyspl from 0x%x to 0x%x\n",
csc->sc_dev.dv_xname, amiga_ttyspl, PSL_S|PSL_IPL5);
amiga_ttyspl = PSL_S|PSL_IPL5;
}
sc->sc_isr.isr_intr = comintr;
sc->sc_isr.isr_arg = csc;
sc->sc_isr.isr_ipl = 5;
add_isr(&sc->sc_isr);
/*
* Shutdown hook for buggy BIOSs that don't recognize the UART
* without a disabled FIFO.
*/
if (shutdownhook_establish(com_supio_cleanup, csc) == NULL)
panic("comsupio: could not establish shutdown hook");
}
void
com_supio_cleanup(arg)
void *arg;
{
struct com_softc *sc = arg;
if (ISSET(sc->sc_hwflags, COM_HW_FIFO))
bus_space_write_1(sc->sc_iot, sc->sc_ioh, com_fifo, 0);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,124 +0,0 @@
/* $NetBSD: drcomreg.h,v 1.1 1996/11/30 00:43:03 is Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
*
* 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:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)comreg.h 7.2 (Berkeley) 5/9/91
*/
#include <dev/ic/ns16550reg.h>
#define COM_FREQ 1843200 /* 16-bit baud rate divisor */
#define COM_TOLERANCE 30 /* baud rate tolerance, in 0.1% units */
/* interrupt enable register */
#define IER_ERXRDY 0x1 /* Enable receiver interrupt */
#define IER_ETXRDY 0x2 /* Enable transmitter empty interrupt */
#define IER_ERLS 0x4 /* Enable line status interrupt */
#define IER_EMSC 0x8 /* Enable modem status interrupt */
/* interrupt identification register */
#define IIR_IMASK 0xf
#define IIR_RXTOUT 0xc
#define IIR_RLS 0x6 /* Line status change */
#define IIR_RXRDY 0x4 /* Receiver ready */
#define IIR_TXRDY 0x2 /* Transmitter ready */
#define IIR_MLSC 0x0 /* Modem status */
#define IIR_NOPEND 0x1 /* No pending interrupts */
#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */
/* fifo control register */
#define FIFO_ENABLE 0x01 /* Turn the FIFO on */
#define FIFO_RCV_RST 0x02 /* Reset RX FIFO */
#define FIFO_XMT_RST 0x04 /* Reset TX FIFO */
#define FIFO_DMA_MODE 0x08
#define FIFO_TRIGGER_1 0x00 /* Trigger RXRDY intr on 1 character */
#define FIFO_TRIGGER_4 0x40 /* ibid 4 */
#define FIFO_TRIGGER_8 0x80 /* ibid 8 */
#define FIFO_TRIGGER_14 0xc0 /* ibid 14 */
/* line control register */
#define LCR_DLAB 0x80 /* Divisor latch access enable */
#define LCR_SBREAK 0x40 /* Break Control */
#define LCR_PZERO 0x38 /* Space parity */
#define LCR_PONE 0x28 /* Mark parity */
#define LCR_PEVEN 0x18 /* Even parity */
#define LCR_PODD 0x08 /* Odd parity */
#define LCR_PNONE 0x00 /* No parity */
#define LCR_PENAB 0x08 /* XXX - low order bit of all parity */
#define LCR_STOPB 0x04 /* 2 stop bits per serial word */
#define LCR_8BITS 0x03 /* 8 bits per serial word */
#define LCR_7BITS 0x02 /* 7 bits */
#define LCR_6BITS 0x01 /* 6 bits */
#define LCR_5BITS 0x00 /* 5 bits */
/* modem control register */
#define MCR_LOOPBACK 0x10 /* Loop test: echos from TX to RX */
#define MCR_IENABLE 0x08 /* Out2: enables UART interrupts */
#define MCR_DRS 0x04 /* Out1: resets some internal modems */
#define MCR_RTS 0x02 /* Request To Send */
#define MCR_DTR 0x01 /* Data Terminal Ready */
/* line status register */
#define LSR_RCV_FIFO 0x80
#define LSR_TSRE 0x40 /* Transmitter empty: byte sent */
#define LSR_TXRDY 0x20 /* Transmitter buffer empty */
#define LSR_BI 0x10 /* Break detected */
#define LSR_FE 0x08 /* Framing error: bad stop bit */
#define LSR_PE 0x04 /* Parity error */
#define LSR_OE 0x02 /* Overrun, lost incoming byte */
#define LSR_RXRDY 0x01 /* Byte ready in Receive Buffer */
#define LSR_RCV_MASK 0x1f /* Mask for incoming data or error */
/* modem status register */
/* All deltas are from the last read of the MSR. */
#define MSR_DCD 0x80 /* Current Data Carrier Detect */
#define MSR_RI 0x40 /* Current Ring Indicator */
#define MSR_DSR 0x20 /* Current Data Set Ready */
#define MSR_CTS 0x10 /* Current Clear to Send */
#define MSR_DDCD 0x08 /* DCD has changed state */
#define MSR_TERI 0x04 /* RI has toggled low to high */
#define MSR_DDSR 0x02 /* DSR has changed state */
#define MSR_DCTS 0x01 /* CTS has changed state */
#define COM_NPORTS 8
/*
* WARNING: Serial console is assumed to be at COM1 address
* and CONUNIT must be 0.
*/
#ifndef CONADDR
#define CONADDR (0x3f8)
#endif
#ifndef CONUNIT
#define CONUNIT (0)
#endif

View File

@ -0,0 +1,143 @@
/* $NetBSD: drsupio.c,v 1.1 1997/08/27 19:32:53 is Exp $ */
/*
* Copyright (c) 1997 Ignatios Souvatzis
* All rights reserved.
*
* 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:
* This product includes software developed by Ignatios Souvatzis
* for the NetBSD Project.
* 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.
*/
/*
* 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>
#include <machine/bus.h>
#include <machine/conf.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;
};
int drsupiomatch __P((struct device *, struct cfdata *, void *));
void drsupioattach __P((struct device *, struct device *, void *));
int drsupprint __P((void *auxp, const char *));
struct cfattach drsupio_ca = {
sizeof(struct drsupio_softc), drsupiomatch, drsupioattach
};
struct cfdriver drsupio_cd = {
NULL, "drsupio", DV_DULL
};
int
drsupiomatch(parent, cfp, auxp)
struct device *parent;
struct cfdata *cfp;
void *auxp;
{
/* Exactly one of us lives on the DraCo */
if (is_draco() && matchname(auxp, "drsupio") && (cfp->cf_unit == 0))
return 1;
return 0;
}
struct drsupio_devs {
char *name;
int off;
} drsupiodevs[] = {
{ "com", 0x3f8 },
{ "com", 0x2f8 },
{ "lpt", 0x378 },
{ "fdc", 0x3f0 },
/* WD port? */
{ 0 }
};
void
drsupioattach(parent, self, auxp)
struct device *parent, *self;
void *auxp;
{
struct drsupio_softc *drsc;
struct drsupio_devs *drsd;
struct supio_attach_args supa;
drsc = (struct drsupio_softc *)self;
drsd = drsupiodevs;
if (parent)
printf("\n");
drsc->sc_bst.base = DRCCADDR + NBPG * DRSUPIOPG + 1;
drsc->sc_bst.stride = 2;
supa.supio_iot = &drsc->sc_bst;
while (drsd->name) {
supa.supio_name = drsd->name;
supa.supio_iobase = drsd->off;
config_found(self, &supa, drsupprint); /* XXX */
++drsd;
}
}
int
drsupprint(auxp, pnp)
void *auxp;
const char *pnp;
{
struct supio_attach_args *supa;
supa = auxp;
if (pnp == NULL)
return(QUIET);
printf("%s at %s port 0x%02x",
supa->supio_name, pnp, supa->supio_iobase);
return(UNCONF);
}

View File

@ -1,7 +1,8 @@
/* $NetBSD: drcomvar.h,v 1.1 1996/11/30 00:43:04 is Exp $ */
/* $NetBSD: supio.h,v 1.1 1997/08/27 19:32:52 is Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
* Copyright (c) 1997 Ignatios Souvatzis
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -13,8 +14,8 @@
* 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:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* This product includes software developed by Ignatios Souvatzis
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
@ -30,10 +31,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
int comintr __P((void *));
/*
* DraCo multi-io chip bus space stuff definitions
*/
extern int comconsaddr;
extern int comconsattached;
extern bus_chipset_tag_t comconsbc;
extern bus_io_handle_t comconsioh;
extern tcflag_t comconscflag;
struct supio_attach_args {
bus_space_tag_t supio_iot;
char *supio_name;
int supio_iobase;
};