diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-02-13 20:39:32 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-02-13 20:39:32 +0000 |
commit | db4af995199bc75869f43966710f40270e2e4aeb (patch) | |
tree | 1f2a4c4738d21b7bec674b8a1fefb7398c2a1ba5 /sys | |
parent | 15606a6640acfb75f08cff43b29b5fe1eddd776b (diff) |
support secondary com@dino from todd@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hppa/conf/GENERIC | 6 | ||||
-rw-r--r-- | sys/arch/hppa/conf/files.hppa | 9 | ||||
-rw-r--r-- | sys/arch/hppa/dev/com_dino.c | 115 | ||||
-rw-r--r-- | sys/arch/hppa/dev/dino.c | 12 | ||||
-rw-r--r-- | sys/conf/files | 4 |
5 files changed, 135 insertions, 11 deletions
diff --git a/sys/arch/hppa/conf/GENERIC b/sys/arch/hppa/conf/GENERIC index b2562dc5ace..f91431b3970 100644 --- a/sys/arch/hppa/conf/GENERIC +++ b/sys/arch/hppa/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.45 2003/12/29 23:27:04 mickey Exp $ +# $OpenBSD: GENERIC,v 1.46 2004/02/13 20:39:31 mickey Exp $ # Machine architecture; required by config(8) machine hppa @@ -48,8 +48,8 @@ mongoose* at mainbus0 irq 17 # EISA Bus Adapter (i82350 or TI???) dino* at phantomas? irq 26 # PCI bus bridge pci* at dino? option PCIVERBOSE -#pckbc0 at dino? irq 23 -#com3 at dino? irq 21 +#pckbc0 at dino? irq 9 +com1 at dino? irq 11 sti0 at mainbus0 irq 11 # [H]CRX-{8,24,48}[Z] graphics sti0 at phantomas0 irq 11 # builtin graphics on BC* diff --git a/sys/arch/hppa/conf/files.hppa b/sys/arch/hppa/conf/files.hppa index 85f2d357163..23f3a60e089 100644 --- a/sys/arch/hppa/conf/files.hppa +++ b/sys/arch/hppa/conf/files.hppa @@ -1,4 +1,4 @@ -# $OpenBSD: files.hppa,v 1.49 2003/09/29 19:23:02 mickey Exp $ +# $OpenBSD: files.hppa,v 1.50 2004/02/13 20:39:31 mickey Exp $ # # hppa-specific configuration info @@ -128,12 +128,17 @@ device mongoose: isabus, eisabus attach mongoose at mainbus file arch/hppa/dev/mongoose.c mongoose +define dinobus {[offset = -1], [irq = -1]} + # Dino, GSC to PCI bridge. Includes ps/2, serial, and flying toaster interfaces # Cujo is a 64-bit data path Dino -device dino: pcibus +device dino: pcibus, dinobus attach dino at phantomas file arch/hppa/dev/dino.c dino +attach com at dinobus with com_dino +file arch/hppa/dev/com_dino.c com_dino + # EPIC, Excalibur PCI Interface Chip. Integrated IOA # SAGA is a 64-bit data path EPIC #device epic: pcibus diff --git a/sys/arch/hppa/dev/com_dino.c b/sys/arch/hppa/dev/com_dino.c new file mode 100644 index 00000000000..bcfae48fbcb --- /dev/null +++ b/sys/arch/hppa/dev/com_dino.c @@ -0,0 +1,115 @@ +/* $OpenBSD: com_dino.c,v 1.1 2004/02/13 20:39:31 mickey Exp $ */ + +/* + * Copyright (c) 2004 Michael Shalayeff + * 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. + * + * 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 MIND, + * 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/param.h> +#include <sys/systm.h> +#include <sys/device.h> +#include <sys/tty.h> + +#include <machine/bus.h> +#include <machine/intr.h> +#include <machine/iomod.h> +#include <machine/autoconf.h> + +#include <dev/ic/comreg.h> +#include <dev/ic/comvar.h> + +#include <hppa/dev/cpudevs.h> + +void *dino_intr_establish(void *sc, int irq, int pri, + int (*handler)(void *v), void *arg, const char *name); + +#define COM_DINO_FREQ 7272700 + +struct com_dino_regs { + u_int8_t reset; + u_int8_t pad0[3]; + u_int8_t test; +#define COM_DINO_PAR_LOOP 0x01 +#define COM_DINO_CLK_SEL 0x02 + u_int8_t pad1[3]; + u_int32_t iodc; + u_int8_t pad2[0x54]; + u_int8_t dither; +}; + +int com_dino_match(struct device *, void *, void *); +void com_dino_attach(struct device *, struct device *, void *); + +struct cfattach com_dino_ca = { + sizeof(struct com_softc), com_dino_match, com_dino_attach +}; + +int +com_dino_match(parent, match, aux) + struct device *parent; + void *match, *aux; +{ + struct confargs *ca = aux; + + if (ca->ca_type.iodc_type != HPPA_TYPE_FIO || + ca->ca_type.iodc_sv_model != HPPA_FIO_GRS232) + return (0); + + return (1); + /* HOZER comprobe1(ca->ca_iot, ca->ca_hpa + IOMOD_DEVOFFSET); */ +} + +void +com_dino_attach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + struct com_softc *sc = (void *)self; + struct confargs *ca = aux; + struct com_dino_regs *regs = (struct com_dino_regs *)ca->ca_hpa; + + sc->sc_iot = ca->ca_iot; + sc->sc_iobase = (bus_addr_t)ca->ca_hpa + IOMOD_DEVOFFSET; + + if (sc->sc_iobase == CONADDR) + sc->sc_ioh = comconsioh; + else if (bus_space_map(sc->sc_iot, sc->sc_iobase, COM_NPORTS, + 0, &sc->sc_ioh)) { + printf(": cannot map io space\n"); + return; + } + + if (sc->sc_iobase != CONADDR) { + /* regs->reset = 0xd0; + DELAY(1000); */ + } + + /* select clock freq */ + regs->test = COM_DINO_CLK_SEL; + sc->sc_frequency = COM_DINO_FREQ; + + com_attach_subr(sc); + + sc->sc_ih = dino_intr_establish(parent, ca->ca_irq, IPL_TTY, + comintr, sc, sc->sc_dev.dv_xname); +} diff --git a/sys/arch/hppa/dev/dino.c b/sys/arch/hppa/dev/dino.c index 6b928796d75..90836648631 100644 --- a/sys/arch/hppa/dev/dino.c +++ b/sys/arch/hppa/dev/dino.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dino.c,v 1.4 2003/12/23 12:07:11 mickey Exp $ */ +/* $OpenBSD: dino.c,v 1.5 2004/02/13 20:39:31 mickey Exp $ */ /* * Copyright (c) 2003 Michael Shalayeff @@ -231,15 +231,15 @@ dino_intr_establish(void *v, pci_intr_handle_t ih, volatile struct dino_regs *r = sc->sc_regs; void *iv; - /* no mapping */ - if (ih == 0) + /* no mapping or bogus */ + if (ih <= 0 || ih > 11) return (NULL); if ((iv = cpu_intr_map(sc->sc_ih, pri, ih - 1, handler, arg, name))) { if (cold) sc->sc_imr |= (1 << (ih - 1)); else - r->imr |= (1 << (ih - 1)); + r->imr = sc->sc_imr |= (1 << (ih - 1)); r->icr &= ~(1 << (ih - 1)); } @@ -1534,6 +1534,10 @@ dinoattach(parent, self, aux) sc->sc_dmatag = dino_dmat; sc->sc_dmatag._cookie = sc; + /* scan for ps2 kbd/ms, serial, and flying toasters */ + ca->ca_hpamask = -1; + pdc_scanbus(self, ca, MAXMODBUS); + pba.pba_busname = "pci"; pba.pba_iot = &sc->sc_iot; pba.pba_memt = &sc->sc_memt; diff --git a/sys/conf/files b/sys/conf/files index c2d9380e7b9..a5e591f09e5 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.288 2004/01/07 21:30:59 markus Exp $ +# $OpenBSD: files,v 1.289 2004/02/13 20:39:31 mickey Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -254,7 +254,7 @@ file dev/ic/tropic.c tr # 8250/16[45]50-based "com" ports device com: tty -file dev/ic/com.c com & (com_isa | com_isapnp | com_commulti | com_pcmcia | com_pica | com_algor | com_gsc | com_puc | com_ebus) needs-flag +file dev/ic/com.c com & (com_isa | com_isapnp | com_commulti | com_pcmcia | com_pica | com_algor | com_gsc | com_puc | com_ebus | com_dino) needs-flag # PC-like keyboard controller device pckbc { [slot = -1] } |