From owner-freebsd-mips@FreeBSD.ORG Wed Oct 9 00:33:03 2013 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8CB02A8A for ; Wed, 9 Oct 2013 00:33:03 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-qc0-x22a.google.com (mail-qc0-x22a.google.com [IPv6:2607:f8b0:400d:c01::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 50A782D79 for ; Wed, 9 Oct 2013 00:33:03 +0000 (UTC) Received: by mail-qc0-f170.google.com with SMTP id m20so58730qcx.15 for ; Tue, 08 Oct 2013 17:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=f660OdaGuIUm+Ns/xURg0fGnyGjiwdWxavPVpwfbW5M=; b=bES7OTfSkR5/uZN6gqgQE1asectavQ/LIg/6I7kcW1VDeRDetisbO2np+VlFM+LoVN 9/5rNhW0v8wO/9Tb1Qk9MZdOvnx1a3cSIp/DAWxFrZGFmvLc96eh1GOAhfnLs+3sdB27 ltpPJBnu584Dv1h+ahP3B8zfGBxtt80EGGTDiKLcwOZni7ovolC3yRPMPnM2HUTd+qme 2Zk3OBNT2zMasBIxQX6oud+nNJ4HPqNXRcRfv1ep3YvxXOJLQM58byPzuHylzSBfsmsd IiO89ofjJdS09lOAPg1yvJIr1UXfbtna27Ks9F6QtqllKoE5ixllxDCWdC7XtqGw5p/F LoXQ== MIME-Version: 1.0 X-Received: by 10.49.59.115 with SMTP id y19mr6034600qeq.8.1381278782457; Tue, 08 Oct 2013 17:33:02 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.207.66 with HTTP; Tue, 8 Oct 2013 17:33:02 -0700 (PDT) Date: Tue, 8 Oct 2013 17:33:02 -0700 X-Google-Sender-Auth: _WyBqyQ8dM6ULtUbK-nZuwbS-Q4 Message-ID: Subject: [rfc] implement busdma barrier operation From: Adrian Chadd To: "freebsd-mips@freebsd.org" Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 00:33:03 -0000 Hi, I'd like to implement the busdma barrier operation. This is required for (at least) correct behaviour of devices on the ar9344 (mips74k) core, as now I actually need to care about the order of device operations. This (and some local uncommitted changes) are required for the ar9344 ethernet and switchport devices to correctly function. I've tested this on the other mips24k hardware I have and it works. But nothing else (including ath, grr) explicitly uses read/write barriers. I'll eventually add them. I'd like to bounce this to re@ ASAP to get the approval to commit. Thanks, -adrian Index: sys/mips/mips/bus_space_generic.c =================================================================== --- sys/mips/mips/bus_space_generic.c (revision 256173) +++ sys/mips/mips/bus_space_generic.c (working copy) @@ -749,4 +749,8 @@ if (flags & BUS_SPACE_BARRIER_WRITE) mips_dcache_wbinv_all(); #endif + if (flags & BUS_SPACE_BARRIER_READ) + rmb(); + if (flags & BUS_SPACE_BARRIER_WRITE) + wmb(); }