diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-07-15 19:25:50 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-07-15 19:25:50 +0000 |
commit | 69cf2041742e938a8ae0a1dfa255ed1377ba0aad (patch) | |
tree | d871a600601d1a213d8c68b4e6e1b2b386837826 | |
parent | 75794e3db978d84f32b4dfd1285c03786a530b40 (diff) |
Delay switching to the real serial console until we attach the serial device.
The variety of different serial devices is just too big to make a decision up
front. This should make the second serial port on four-digit B/C/J-class
workstation work as a serial console too.
ok miod@
-rw-r--r-- | sys/arch/hppa/conf/files.hppa | 4 | ||||
-rw-r--r-- | sys/arch/hppa/dev/com_dino.c | 14 | ||||
-rw-r--r-- | sys/arch/hppa/dev/pdc.c | 51 | ||||
-rw-r--r-- | sys/arch/hppa/gsc/com_gsc.c | 23 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/conf.c | 20 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/machdep.c | 11 | ||||
-rw-r--r-- | sys/arch/hppa/include/param.h | 10 | ||||
-rw-r--r-- | sys/dev/ic/com.c | 8 |
8 files changed, 36 insertions, 105 deletions
diff --git a/sys/arch/hppa/conf/files.hppa b/sys/arch/hppa/conf/files.hppa index cdfff23044a..aa2dc90202d 100644 --- a/sys/arch/hppa/conf/files.hppa +++ b/sys/arch/hppa/conf/files.hppa @@ -1,4 +1,4 @@ -# $OpenBSD: files.hppa,v 1.69 2007/06/20 17:41:04 kettenis Exp $ +# $OpenBSD: files.hppa,v 1.70 2007/07/15 19:25:49 kettenis Exp $ # # hppa-specific configuration info @@ -308,5 +308,3 @@ file arch/hppa/hppa/in_cksum.c inet file netinet/in4_cksum.c inet file arch/hppa/dev/clock.c file arch/hppa/hppa/fpemu.S fpemul - -file dev/cninit.c diff --git a/sys/arch/hppa/dev/com_dino.c b/sys/arch/hppa/dev/com_dino.c index 813ba2e6337..d1cac3c28c5 100644 --- a/sys/arch/hppa/dev/com_dino.c +++ b/sys/arch/hppa/dev/com_dino.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com_dino.c,v 1.3 2004/10/25 00:08:44 mickey Exp $ */ +/* $OpenBSD: com_dino.c,v 1.4 2007/07/15 19:25:49 kettenis Exp $ */ /* * Copyright (c) 2004 Michael Shalayeff @@ -92,17 +92,17 @@ com_dino_attach(parent, self, aux) sc->sc_iot = ca->ca_iot; sc->sc_iobase = (bus_addr_t)ca->ca_hpa + IOMOD_DEVOFFSET; - if (sc->sc_iobase == CONADDR && comconsioh) - sc->sc_ioh = comconsioh; - else if (bus_space_map(sc->sc_iot, sc->sc_iobase, COM_NPORTS, + 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); */ + if (PAGE0->mem_cons.pz_class == PCL_DUPLEX && + PAGE0->mem_cons.pz_hpa == ca->ca_hpa) { + bus_space_unmap(sc->sc_iot, sc->sc_ioh, COM_NPORTS); + comcnattach(sc->sc_iot, sc->sc_iobase, comdefaultrate, + COM_DINO_FREQ, comconscflag); } /* select clock freq */ diff --git a/sys/arch/hppa/dev/pdc.c b/sys/arch/hppa/dev/pdc.c index 0f1136c042a..69da4292b3e 100644 --- a/sys/arch/hppa/dev/pdc.c +++ b/sys/arch/hppa/dev/pdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pdc.c,v 1.29 2007/05/23 18:29:35 kettenis Exp $ */ +/* $OpenBSD: pdc.c,v 1.30 2007/07/15 19:25:49 kettenis Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -54,8 +54,12 @@ int pdcret[32] PDC_ALIGNMENT; char pdc_consbuf[IODC_MINIOSIZ] PDC_ALIGNMENT; iodcio_t pdc_cniodc, pdc_kbdiodc; pz_device_t *pz_kbd, *pz_cons; -hppa_hpa_t conaddr; -int conunit; + +int pdcngetc(dev_t); +void pdcnputc(dev_t, char *); + +struct consdev pdccons = { NULL, NULL, pdccngetc, pdccnputc, + nullcnpollc, NULL, makedev(22, 0), CN_NORMAL }; int pdcmatch(struct device *, void *, void *); void pdcattach(struct device *, struct device *, void *); @@ -120,10 +124,10 @@ pdc_init() pdc_cniodc = (iodcio_t)cn_iodc; pdc_kbdiodc = (iodcio_t)kbd_iodc; - /* XXX make pdc current console */ - cn_tab = &constab[0]; + /* Start out with pdc as the console. */ + cn_tab = &pdccons; - /* setup the console */ + /* Figure out console settings. */ #if NCOM_GSC > 0 if (PAGE0->mem_cons.pz_class == PCL_DUPLEX) { struct pz_device *pzd = &PAGE0->mem_cons; @@ -138,16 +142,8 @@ pdc_init() pzd->pz_layers[0], pzd->pz_layers[1], pzd->pz_layers[2], pzd->pz_layers[3], pzd->pz_layers[4], pzd->pz_layers[5], pzd->pz_hpa); -#endif - conaddr = (u_long)pzd->pz_hpa + IOMOD_DEVOFFSET; - conunit = 0; - /* - * XXX Attaching the serial console on four-digit B/C/J - * class workstations, so disable it for now. - */ - if (conaddr == 0xfee003f8 + IOMOD_DEVOFFSET) - conaddr = 0; +#endif /* compute correct baud rate */ if (PZL_SPEED(pzd->pz_layers[0]) < @@ -400,23 +396,6 @@ pdctty(dev) return sc->sc_tty; } -void -pdccnprobe(cn) - struct consdev *cn; -{ - cn->cn_dev = makedev(22,0); - cn->cn_pri = CN_NORMAL; -} - -void -pdccninit(cn) - struct consdev *cn; -{ -#ifdef DEBUG - printf("pdc0: console init\n"); -#endif -} - int pdccnlookc(dev, cp) dev_t dev; @@ -473,11 +452,3 @@ pdccnputc(dev, c) #endif } } - -void -pdccnpollc(dev, on) - dev_t dev; - int on; -{ - -} diff --git a/sys/arch/hppa/gsc/com_gsc.c b/sys/arch/hppa/gsc/com_gsc.c index 2bd9fa05198..4b67f2dbd36 100644 --- a/sys/arch/hppa/gsc/com_gsc.c +++ b/sys/arch/hppa/gsc/com_gsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com_gsc.c,v 1.20 2004/09/19 17:50:30 mickey Exp $ */ +/* $OpenBSD: com_gsc.c,v 1.21 2007/07/15 19:25:49 kettenis Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -42,6 +42,8 @@ #include <hppa/dev/cpudevs.h> #include <hppa/gsc/gscbusvar.h> +#define COM_GSC_FREQ 7372800 + struct com_gsc_regs { u_int8_t reset; }; @@ -77,31 +79,26 @@ com_gsc_attach(parent, self, aux) { struct com_softc *sc = (void *)self; struct gsc_attach_args *ga = aux; - struct com_gsc_regs *regs; - int rj16 = 0; - sc->sc_frequency = COM_FREQ; sc->sc_iot = ga->ga_iot; sc->sc_iobase = (bus_addr_t)ga->ga_hpa; if (ga->ga_type.iodc_sv_model != HPPA_FIO_GRJ16) sc->sc_iobase += IOMOD_DEVOFFSET; - else - rj16++; - if (sc->sc_iobase == CONADDR && comconsioh) - sc->sc_ioh = comconsioh; - else if (bus_space_map(sc->sc_iot, sc->sc_iobase, COM_NPORTS, + if (bus_space_map(sc->sc_iot, sc->sc_iobase, COM_NPORTS, 0, &sc->sc_ioh)) { printf(": cannot map io space\n"); return; } - regs = (struct com_gsc_regs *)ga->ga_hpa; - if (!rj16 && sc->sc_iobase != CONADDR) { - /*regs->reset = 0xd0;*/ - DELAY(1000); + if (PAGE0->mem_cons.pz_class == PCL_DUPLEX && + PAGE0->mem_cons.pz_hpa == ga->ga_hpa) { + bus_space_unmap(sc->sc_iot, sc->sc_ioh, COM_NPORTS); + comcnattach(sc->sc_iot, sc->sc_iobase, comdefaultrate, + COM_GSC_FREQ, comconscflag); } + sc->sc_frequency = COM_GSC_FREQ; com_attach_subr(sc); sc->sc_ih = gsc_intr_establish((struct gsc_softc *)parent, diff --git a/sys/arch/hppa/hppa/conf.c b/sys/arch/hppa/hppa/conf.c index 3b55707e607..91c095d22e1 100644 --- a/sys/arch/hppa/hppa/conf.c +++ b/sys/arch/hppa/hppa/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.40 2007/05/28 22:26:03 todd Exp $ */ +/* $OpenBSD: conf.c,v 1.41 2007/07/15 19:25:49 kettenis Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -281,21 +281,3 @@ iskmemdev(dev) { return (major(dev) == mem_no && minor(dev) < 2); } - -#include <dev/cons.h> - -cons_decl(pdc); -cons_decl(ws); -cons_decl(com); - -struct consdev constab[] = { - cons_init(pdc), /* XXX you'd better leave it here for pdc.c */ -#if NWSDISPLAY > 0 - cons_init(ws), -#endif -#if NCOM > 0 - cons_init(com), -#endif - { 0 } -}; - diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index a8b5aae457d..1cbfb3e5bd5 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.161 2007/07/14 22:41:54 kettenis Exp $ */ +/* $OpenBSD: machdep.c,v 1.162 2007/07/15 19:25:49 kettenis Exp $ */ /* * Copyright (c) 1999-2003 Michael Shalayeff @@ -1645,10 +1645,7 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) void consinit(void) { - static int initted; - - if (!initted) { - initted++; - cninit(); - } + /* + * Initial console setup has been done in pdc_init(). + */ } diff --git a/sys/arch/hppa/include/param.h b/sys/arch/hppa/include/param.h index 59dbc90acea..edf08d13765 100644 --- a/sys/arch/hppa/include/param.h +++ b/sys/arch/hppa/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.35 2007/07/01 12:19:27 kettenis Exp $ */ +/* $OpenBSD: param.h,v 1.36 2007/07/15 19:25:49 kettenis Exp $ */ /* * Copyright (c) 1988-1994, The University of Utah and @@ -110,14 +110,6 @@ #define ISHPMMADDR(v) 0 /* XXX ...jef */ #define HPMMBASEADDR(v) ((unsigned)(v) & ~HPMMMASK) #endif - -#ifndef _LOCORE -#define CONADDR conaddr -#define CONUNIT conunit -#define COM_FREQ 7372800 -extern hppa_hpa_t conaddr; -extern int conunit; -#endif #endif #define __SWAP_BROKEN diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 9c15c6b7869..82b1af3634e 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.116 2007/06/22 10:09:21 jasper Exp $ */ +/* $OpenBSD: com.c,v 1.117 2007/07/15 19:25:49 kettenis Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -1325,8 +1325,6 @@ comcnprobe(struct consdev *cp) bus_space_tag_t iot = MD_ISA_IOT; #elif defined(__sgi__) bus_space_tag_t iot = sys_config.cons_iot; -#elif defined(hppa) - bus_space_tag_t iot = &hppa_bustag; #else bus_space_tag_t iot = 0; #endif @@ -1339,11 +1337,7 @@ comcnprobe(struct consdev *cp) comconsiot = iot; if (bus_space_map(iot, CONADDR, COM_NPORTS, 0, &ioh)) return; -#ifdef __hppa__ - found = 1; -#else found = comprobe1(iot, ioh); -#endif bus_space_unmap(iot, ioh, COM_NPORTS); if (!found) return; |