diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-02-08 20:43:17 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-02-08 20:43:17 +0000 |
commit | 28095814e7a406c63a14bced7b2e507d0410a923 (patch) | |
tree | 2714adc5d01cb4290f85f44bb5e29aef9f93ff74 /sys/arch/hppa/dev/pdc.c | |
parent | cf9b9a9febd547d6696d6962ab054211afe1e49a (diff) |
Teach some magic to the kernel so that it can decode serial console settings.
mickey@ said "commitski".
Diffstat (limited to 'sys/arch/hppa/dev/pdc.c')
-rw-r--r-- | sys/arch/hppa/dev/pdc.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/sys/arch/hppa/dev/pdc.c b/sys/arch/hppa/dev/pdc.c index 346f462a511..afe67285aaa 100644 --- a/sys/arch/hppa/dev/pdc.c +++ b/sys/arch/hppa/dev/pdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pdc.c,v 1.20 2002/02/05 03:46:23 mickey Exp $ */ +/* $OpenBSD: pdc.c,v 1.21 2002/02/08 20:43:14 miod Exp $ */ /* * Copyright (c) 1998-2002 Michael Shalayeff @@ -75,6 +75,21 @@ void pdctimeout __P((void *v)); int pdcparam __P((struct tty *tp, struct termios *)); int pdccnlookc __P((dev_t dev, int *cp)); +/* serial console speed table */ +static int pdc_speeds[] = { + B50, + B75, + B110, + B150, + B300, + B600, + B1200, + B2400, + B4800, + B7200, + B9600, +}; + void pdc_init() { @@ -122,8 +137,14 @@ pdc_init() #endif conaddr = (u_long)pzd->pz_hpa + IOMOD_DEVOFFSET; conunit = 0; - /* TODO detect the baud rate from layer[0] */ - comdefaultrate = B9600; + + /* compute correct baud rate */ + if (PZL_SPEED(pzd->pz_layers[0]) < + sizeof(pdc_speeds) / sizeof(int)) + comdefaultrate = + pdc_speeds[PZL_SPEED(pzd->pz_layers[0])]; + else + comdefaultrate = B9600; /* XXX */ } #endif } |