diff options
author | Joshua Stein <jcs@cvs.openbsd.org> | 2018-04-15 00:11:00 +0000 |
---|---|---|
committer | Joshua Stein <jcs@cvs.openbsd.org> | 2018-04-15 00:11:00 +0000 |
commit | adb7ae98a1c6ab33d3efed1517a420d1e4022efe (patch) | |
tree | 569da17a4c6b44c5f60587bcb1cdfa8001453e20 /sys/dev/puc | |
parent | 034c6708458ef06c6dab1c9a382e7946d4840afd (diff) |
pucdata: convert port types and frequencies to a lookup table to
allow for custom frequencies not a multiple of COM_FREQ
ok deraadt
Diffstat (limited to 'sys/dev/puc')
-rw-r--r-- | sys/dev/puc/com_puc.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/puc/com_puc.c b/sys/dev/puc/com_puc.c index 93947a28126..33a434fba23 100644 --- a/sys/dev/puc/com_puc.c +++ b/sys/dev/puc/com_puc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com_puc.c,v 1.23 2017/12/30 20:46:59 guenther Exp $ */ +/* $OpenBSD: com_puc.c,v 1.24 2018/04/15 00:10:59 jcs Exp $ */ /* * Copyright (c) 1997 - 1999, Jason Downs. All rights reserved. @@ -82,6 +82,7 @@ com_puc_attach(parent, self, aux) struct com_softc *sc = (void *)self; struct puc_attach_args *pa = aux; const char *intrstr; + int i; /* Grab a PCI interrupt. */ intrstr = pa->intr_string(pa); @@ -99,10 +100,14 @@ com_puc_attach(parent, self, aux) sc->sc_iot = pa->t; sc->sc_ioh = pa->h; sc->sc_iobase = pa->a; - if (PUC_IS_COM_MUL(pa->type)) - sc->sc_frequency = COM_FREQ * PUC_COM_GET_MUL(pa->type); - else - sc->sc_frequency = COM_FREQ * (1 << PUC_COM_GET_POW2(pa->type)); + + sc->sc_frequency = COM_FREQ; + + for (i = 0; i < nitems(puc_port_types); i++) + if (puc_port_types[i].type == pa->type) { + sc->sc_frequency = puc_port_types[i].freq; + break; + } com_attach_subr(sc); } |