From patchwork Mon Apr 4 21:21:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timur Tabi X-Patchwork-Id: 89713 X-Patchwork-Delegate: wd@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 370EDB6FD1 for ; Tue, 5 Apr 2011 07:21:20 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 770D4280B6; Mon, 4 Apr 2011 23:21:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bhifC54+J+NZ; Mon, 4 Apr 2011 23:21:17 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ED777280DC; Mon, 4 Apr 2011 23:21:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3D556280DC for ; Mon, 4 Apr 2011 23:21:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HDWwnLrB9two for ; Mon, 4 Apr 2011 23:21:12 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from VA3EHSOBE005.bigfish.com (va3ehsobe005.messaging.microsoft.com [216.32.180.31]) by theia.denx.de (Postfix) with ESMTPS id 06837280B6 for ; Mon, 4 Apr 2011 23:21:10 +0200 (CEST) Received: from mail16-va3-R.bigfish.com (10.7.14.252) by VA3EHSOBE005.bigfish.com (10.7.40.25) with Microsoft SMTP Server id 14.1.225.8; Mon, 4 Apr 2011 21:21:09 +0000 Received: from mail16-va3 (localhost.localdomain [127.0.0.1]) by mail16-va3-R.bigfish.com (Postfix) with ESMTP id 35C27770118; Mon, 4 Apr 2011 21:21:09 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail16-va3 (localhost.localdomain [127.0.0.1]) by mail16-va3 (MessageSwitch) id 1301952069101969_22413; Mon, 4 Apr 2011 21:21:09 +0000 (UTC) Received: from VA3EHSMHS011.bigfish.com (unknown [10.7.14.247]) by mail16-va3.bigfish.com (Postfix) with ESMTP id 159D81C18051; Mon, 4 Apr 2011 21:21:09 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS011.bigfish.com (10.7.99.21) with Microsoft SMTP Server (TLS) id 14.1.225.8; Mon, 4 Apr 2011 21:21:06 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.270.2; Mon, 4 Apr 2011 16:21:05 -0500 Received: from efes.am.freescale.net (efes.am.freescale.net [10.82.123.3]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p34LL4KH029985; Mon, 4 Apr 2011 16:21:04 -0500 (CDT) From: Timur Tabi To: , , , Date: Mon, 4 Apr 2011 16:21:04 -0500 Message-ID: <1301952064-1418-1-git-send-email-timur@freescale.com> X-Mailer: git-send-email 1.7.3.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Subject: [U-Boot] [PATCH] [v2] powerpc: fix implementation of out_8 to match the other out_XX functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de For some reason, the implementation of out_8() does not match the other output accessors, nor does it match equivalent Linux accessor. This can cause a problem in a situation like this: __raw_readb(p1); out_8(p2, x); In this case, there is no barrier between the read and the write. If the out_8() is changed to out_be16(), then there is a barrier. Signed-off-by: Timur Tabi --- arch/powerpc/include/asm/io.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h index 4ddad26..56ac9fe 100644 --- a/arch/powerpc/include/asm/io.h +++ b/arch/powerpc/include/asm/io.h @@ -175,7 +175,10 @@ extern inline int in_8(const volatile unsigned char __iomem *addr) extern inline void out_8(volatile unsigned char __iomem *addr, int val) { - __asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); + __asm__ __volatile__("sync;\n" + "stb%U0%X0 %1,%0;\n" + : "=m" (*addr) + : "r" (val)); } extern inline int in_le16(const volatile unsigned short __iomem *addr)