summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-04-27 14:56:10 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-04-27 14:56:10 +0000
commit7aa84f5043d36469b0c1e6639e292f02e06476e2 (patch)
tree7d2cda1190c30e51d5fbfd90e6d67b2967abd401 /sys/dev
parent8211cc7a5d2dea315539e12659b022b273855a70 (diff)
add initial nxb_read/nxb_write functions
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_nx.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/dev/pci/if_nx.c b/sys/dev/pci/if_nx.c
index 0be5bae956e..b5fe41313ef 100644
--- a/sys/dev/pci/if_nx.c
+++ b/sys/dev/pci/if_nx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nx.c,v 1.9 2007/04/27 14:54:10 reyk Exp $ */
+/* $OpenBSD: if_nx.c,v 1.10 2007/04/27 14:56:09 reyk Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
@@ -125,6 +125,9 @@ int nxb_match(struct device *, void *, void *);
void nxb_attach(struct device *, struct device *, void *);
int nxb_query(struct nxb_softc *sc);
+u_int32_t nxb_read(struct nxb_softc *, bus_size_t);
+void nxb_write(struct nxb_softc *, bus_size_t, u_int32_t);
+
int nx_match(struct device *, void *, void *);
void nx_attach(struct device *, struct device *, void *);
int nx_print(void *, const char *);
@@ -256,6 +259,22 @@ nxb_query(struct nxb_softc *sc)
return (0);
}
+u_int32_t
+nxb_read(struct nxb_softc *sc, bus_size_t reg)
+{
+ bus_space_barrier(sc->sc_memt, sc->sc_memh, reg, 4,
+ BUS_SPACE_BARRIER_READ);
+ return (bus_space_read_4(sc->sc_memt, sc->sc_memh, reg));
+}
+
+void
+nxb_write(struct nxb_softc *sc, bus_size_t reg, u_int32_t val)
+{
+ bus_space_write_4(sc->sc_memt, sc->sc_memh, reg, val);
+ bus_space_barrier(sc->sc_memt, sc->sc_memh, reg, 4,
+ BUS_SPACE_BARRIER_WRITE);
+}
+
/*
* Routines handling the virtual ''nx'' ports
*/