summaryrefslogtreecommitdiff
path: root/sys/dev/pci/envy.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2010-10-08 19:26:33 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2010-10-08 19:26:33 +0000
commit35bf876bcf076a4fdfdde12558d038f948f161ea (patch)
treebbc5aaf93e122bc81265570a79c234ea471540e1 /sys/dev/pci/envy.c
parentb9c8c03505676a796deb6f04bf8f49ae9de76dcf (diff)
Call bus_space_barrier() after each read and write, since this
driver was developed with the assumption that all operations are ordered.
Diffstat (limited to 'sys/dev/pci/envy.c')
-rw-r--r--sys/dev/pci/envy.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/sys/dev/pci/envy.c b/sys/dev/pci/envy.c
index e6f8a091b8b..b05a3704c1f 100644
--- a/sys/dev/pci/envy.c
+++ b/sys/dev/pci/envy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: envy.c,v 1.46 2010/10/08 18:54:03 ratchov Exp $ */
+/* $OpenBSD: envy.c,v 1.47 2010/10/08 19:26:32 ratchov Exp $ */
/*
* Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
*
@@ -933,49 +933,77 @@ ak5365_adc_set(struct envy_softc *sc, struct mixer_ctrl *ctl, int idx)
int
envy_ccs_read(struct envy_softc *sc, int reg)
{
- return bus_space_read_1(sc->ccs_iot, sc->ccs_ioh, reg);
+ int val;
+
+ val = bus_space_read_1(sc->ccs_iot, sc->ccs_ioh, reg);
+ bus_space_barrier(sc->ccs_iot, sc->ccs_ioh, 0, sc->ccs_iosz,
+ BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+ return val;
}
void
envy_ccs_write(struct envy_softc *sc, int reg, int val)
{
bus_space_write_1(sc->ccs_iot, sc->ccs_ioh, reg, val);
+ bus_space_barrier(sc->ccs_iot, sc->ccs_ioh, 0, sc->ccs_iosz,
+ BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
}
int
envy_mt_read_1(struct envy_softc *sc, int reg)
{
- return bus_space_read_1(sc->mt_iot, sc->mt_ioh, reg);
+ int val;
+
+ val = bus_space_read_1(sc->mt_iot, sc->mt_ioh, reg);
+ bus_space_barrier(sc->mt_iot, sc->mt_ioh, 0, sc->mt_iosz,
+ BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+ return val;
}
void
envy_mt_write_1(struct envy_softc *sc, int reg, int val)
{
bus_space_write_1(sc->mt_iot, sc->mt_ioh, reg, val);
+ bus_space_barrier(sc->mt_iot, sc->mt_ioh, 0, sc->mt_iosz,
+ BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
}
int
envy_mt_read_2(struct envy_softc *sc, int reg)
{
- return bus_space_read_2(sc->mt_iot, sc->mt_ioh, reg);
+ int val;
+
+ val = bus_space_read_2(sc->mt_iot, sc->mt_ioh, reg);
+ bus_space_barrier(sc->mt_iot, sc->mt_ioh, 0, sc->mt_iosz,
+ BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+ return val;
}
void
envy_mt_write_2(struct envy_softc *sc, int reg, int val)
{
bus_space_write_2(sc->mt_iot, sc->mt_ioh, reg, val);
+ bus_space_barrier(sc->mt_iot, sc->mt_ioh, 0, sc->mt_iosz,
+ BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
}
int
envy_mt_read_4(struct envy_softc *sc, int reg)
{
- return bus_space_read_4(sc->mt_iot, sc->mt_ioh, reg);
+ int val;
+
+ val = bus_space_read_4(sc->mt_iot, sc->mt_ioh, reg);
+ bus_space_barrier(sc->mt_iot, sc->mt_ioh, 0, sc->mt_iosz,
+ BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+ return val;
}
void
envy_mt_write_4(struct envy_softc *sc, int reg, int val)
{
bus_space_write_4(sc->mt_iot, sc->mt_ioh, reg, val);
+ bus_space_barrier(sc->mt_iot, sc->mt_ioh, 0, sc->mt_iosz,
+ BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
}
int