From fbe20e6393585fb38519b13b87ef63ddb06d1206 Mon Sep 17 00:00:00 2001 From: anton Date: Sun, 19 Jun 2022 12:52:19 +0000 Subject: [PATCH] pluart(4) does not report the correct baudrate for the hardware console but instead defaults to 38400. This in turn causes the same baudrate to end up in /etc/ttys during installation. Note that this is not a problem as of now since pluart does not support changing the baudrate just yet. Instead, honor and propagate the baudrate given to pluartcnattach() while attaching the hardware console. ok visa@ --- sys/dev/ic/pluart.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/dev/ic/pluart.c b/sys/dev/ic/pluart.c index be7d4483646..40e2b1976fb 100644 --- a/sys/dev/ic/pluart.c +++ b/sys/dev/ic/pluart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pluart.c,v 1.10 2022/06/11 05:29:24 anton Exp $ */ +/* $OpenBSD: pluart.c,v 1.11 2022/06/19 12:52:19 anton Exp $ */ /* * Copyright (c) 2014 Patrick Wildt * Copyright (c) 2005 Dale Rahn @@ -153,11 +153,12 @@ struct cfdriver pluart_cd = { NULL, "pluart", DV_TTY }; +int pluartdefaultrate = B38400; +int pluartconsrate = B38400; bus_space_tag_t pluartconsiot; bus_space_handle_t pluartconsioh; bus_addr_t pluartconsaddr; tcflag_t pluartconscflag = TTYDEF_CFLAG; -int pluartdefaultrate = B38400; struct cdevsw pluartdev = cdev_tty_init(3/*XXX NUART */ ,pluart); /* 12: serial port */ @@ -563,7 +564,10 @@ pluartopen(dev_t dev, int flag, int mode, struct proc *p) if (ISSET(sc->sc_swflags, COM_SW_MDMBUF)) SET(tp->t_cflag, MDMBUF); tp->t_lflag = TTYDEF_LFLAG; - tp->t_ispeed = tp->t_ospeed = pluartdefaultrate; + if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) + tp->t_ispeed = tp->t_ospeed = pluartconsrate; + else + tp->t_ispeed = tp->t_ospeed = pluartdefaultrate; s = spltty(); @@ -837,6 +841,7 @@ pluartcnattach(bus_space_tag_t iot, bus_addr_t iobase, int rate, tcflag_t cflag) pluartconsiot = iot; pluartconsaddr = iobase; pluartconscflag = cflag; + pluartconsrate = rate; return 0; } -- 2.20.1