PERFORCE change 109494 for review
Sam Leffler
sam at FreeBSD.org
Tue Nov 7 23:36:57 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=109494
Change 109494 by sam at sam_ebb on 2006/11/07 23:36:53
Add ixpnpe_sendmsg and ixpnpe_recvmsg to allow callers to
split transaction w/o sleeping. This is unsafe and still
problematic (caller could conceivably sleep on internal
mtx) but is good enough for now.
Also fix mtx type so witness doesn't bitch about duplication
with the npe network driver.
Affected files ...
.. //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425_npe.c#7 edit
.. //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425_npevar.h#6 edit
Differences ...
==== //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425_npe.c#7 (text+ko) ====
@@ -257,7 +257,7 @@
sc = malloc(sizeof(struct ixpnpe_softc), M_TEMP, M_WAITOK | M_ZERO);
sc->sc_dev = dev;
sc->sc_iot = sa->sc_iot;
- mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF);
+ mtx_init(&sc->sc_mtx, device_get_nameunit(dev), "npe driver", MTX_DEF);
if (device_get_unit(dev) == 0) {
base = IXP425_NPE_B_HWBASE;
@@ -1365,3 +1365,32 @@
return error;
}
+
+/* XXX temporary, not reliable */
+
+int
+ixpnpe_sendmsg(struct ixpnpe_softc *sc, const uint32_t msg[2])
+{
+ int error;
+
+ mtx_lock(&sc->sc_mtx);
+ error = ixpnpe_sendmsg_locked(sc, msg);
+ mtx_unlock(&sc->sc_mtx);
+
+ return error;
+}
+
+int
+ixpnpe_recvmsg(struct ixpnpe_softc *sc, uint32_t msg[2])
+{
+ int error;
+
+ mtx_lock(&sc->sc_mtx);
+ if (sc->sc_msgwaiting)
+ bcopy(sc->sc_msg, msg, sizeof(sc->sc_msg));
+ /* NB: sc_msgwaiting != 1 means the ack fetch failed */
+ error = sc->sc_msgwaiting != 1 ? EIO : 0;
+ mtx_unlock(&sc->sc_mtx);
+
+ return error;
+}
==== //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425_npevar.h#6 (text+ko) ====
@@ -87,6 +87,8 @@
const char *imageName, uint32_t imageId);
int ixpnpe_getfunctionality(struct ixpnpe_softc *sc);
+int ixpnpe_sendmsg(struct ixpnpe_softc *, const uint32_t msg[2]);
+int ixpnpe_recvmsg(struct ixpnpe_softc *, uint32_t msg[2]);
int ixpnpe_sendandrecvmsg(struct ixpnpe_softc *, const uint32_t send[2],
uint32_t recv[2]);
#endif /* _IXP425_NPEVAR_H_ */
More information about the p4-projects
mailing list