summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormbalmer <mbalmer@openbsd.org>2007-01-03 13:27:12 +0000
committermbalmer <mbalmer@openbsd.org>2007-01-03 13:27:12 +0000
commit3146f6c159fc4cf446ecacacf2ccfba450c0908b (patch)
treed6284884674cf89cbcd04147c6bae7046f1e6c39
parentSupport for continuous reading of syslog memory buffers. (diff)
downloadwireguard-openbsd-3146f6c159fc4cf446ecacacf2ccfba450c0908b.tar.xz
wireguard-openbsd-3146f6c159fc4cf446ecacacf2ccfba450c0908b.zip
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
-rw-r--r--sys/dev/pci/mbg.c11
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;