summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-04-16 14:40:19 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-04-16 14:40:19 +0000
commit01b91eb4c6eea13a1d9ca0aa3e6fe8385972bef4 (patch)
treed0611468213aca75f5ba1fe74969e89cdaa6e7b3 /sys
parent18c5ba9157ed013a40d5dc3715db90df2b0930bb (diff)
add wrappers around bus space ops for each port
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_tht.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/dev/pci/if_tht.c b/sys/dev/pci/if_tht.c
index 65e44645b90..9fb53bf30c4 100644
--- a/sys/dev/pci/if_tht.c
+++ b/sys/dev/pci/if_tht.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tht.c,v 1.11 2007/04/16 14:35:07 dlg Exp $ */
+/* $OpenBSD: if_tht.c,v 1.12 2007/04/16 14:40:18 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -117,6 +117,10 @@ struct tht_attach_args {
pci_intr_handle_t taa_ih;
};
+/* bus space operations */
+u_int32_t tht_read(struct tht_softc *, bus_size_t);
+void tht_write(struct tht_softc *, bus_size_t, u_int32_t);
+
/* misc */
#define DEVNAME(_sc) ((_sc)->sc_dev.dv_xname)
#define sizeofa(_a) (sizeof(_a) / sizeof((_a)[0]))
@@ -255,3 +259,19 @@ tht_intr(void *arg)
{
return (0);
}
+
+u_int32_t
+tht_read(struct tht_softc *sc, bus_size_t r)
+{
+ bus_space_barrier(sc->sc_thtc->sc_memt, sc->sc_memh, r, 4,
+ BUS_SPACE_BARRIER_READ);
+ return (bus_space_read_4(sc->sc_thtc->sc_memt, sc->sc_memh, r));
+}
+
+void
+tht_write(struct tht_softc *sc, bus_size_t r, u_int32_t v)
+{
+ bus_space_write_4(sc->sc_thtc->sc_memt, sc->sc_memh, r, v);
+ bus_space_barrier(sc->sc_thtc->sc_memt, sc->sc_memh, r, 4,
+ BUS_SPACE_BARRIER_WRITE);
+}