From owner-p4-projects@FreeBSD.ORG Tue Nov 7 23:36:57 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2064A16A492; Tue, 7 Nov 2006 23:36:57 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F012116A40F for ; Tue, 7 Nov 2006 23:36:56 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8360843D55 for ; Tue, 7 Nov 2006 23:36:54 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kA7NasNQ081772 for ; Tue, 7 Nov 2006 23:36:54 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kA7Nas5m081769 for perforce@freebsd.org; Tue, 7 Nov 2006 23:36:54 GMT (envelope-from sam@freebsd.org) Date: Tue, 7 Nov 2006 23:36:54 GMT Message-Id: <200611072336.kA7Nas5m081769@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 109494 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Nov 2006 23:36:57 -0000 http://perforce.freebsd.org/chv.cgi?CH=109494 Change 109494 by sam@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_ */