diff options
author | Marc Balmer <mbalmer@cvs.openbsd.org> | 2007-01-03 13:27:13 +0000 |
---|---|---|
committer | Marc Balmer <mbalmer@cvs.openbsd.org> | 2007-01-03 13:27:13 +0000 |
commit | 0cc24b5630ce9c790508142c9abf525242a7a618 (patch) | |
tree | f2abec6903b0ae9b4372609c928f3ece8e0513b0 /sys/dev | |
parent | f0348aacfc51f98bd7766c43f4a9cbc01b71748f (diff) |
mbg(4) cards with ASIC take the internal timestamp at the very moment the
first command byte is written to the card over the pci bus. the driver has
to capture this moment to get a precise timedelta. so make sure the code
fragment that takes the internal timestamp and sends the command byte can not
be interrupted.
this function is called with a low frequency (currently 0.1 Hz).
ok claudio, mglocker
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/mbg.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/pci/mbg.c b/sys/dev/pci/mbg.c index 25d4c577560..f317d4e96c9 100644 --- a/sys/dev/pci/mbg.c +++ b/sys/dev/pci/mbg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbg.c,v 1.11 2007/01/02 19:25:02 mbalmer Exp $ */ +/* $OpenBSD: mbg.c,v 1.12 2007/01/03 13:27:12 mbalmer Exp $ */ /* * Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org> @@ -333,11 +333,16 @@ mbg_read_asic(struct mbg_softc *sc, int cmd, char *buf, size_t len, char *p = buf; u_int16_t port; u_int8_t status; + int s; /* write the command, optionally taking a timestamp */ - if (tstamp) + if (tstamp) { + s = splhigh(); nanotime(tstamp); - bus_space_write_4(sc->sc_iot, sc->sc_ioh, ASIC_DATA, cmd); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, ASIC_DATA, cmd); + splx(s); + } else + bus_space_write_4(sc->sc_iot, sc->sc_ioh, ASIC_DATA, cmd); /* wait for the BUSY flag to go low */ timer = 0; |