From patchwork Mon Sep 26 03:34:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 674932 X-Patchwork-Delegate: bmeng.cn@gmail.com 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 3sj91l6swbz9s65 for ; Mon, 26 Sep 2016 13:48:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=aBE8xj7B; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 70639A775C; Mon, 26 Sep 2016 05:43:25 +0200 (CEST) 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 JsOJNaLQIj1q; Mon, 26 Sep 2016 05:43:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BD237A7716; Mon, 26 Sep 2016 05:43:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8D663A7739 for ; Mon, 26 Sep 2016 05:43:22 +0200 (CEST) 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 8jkVcS8PxcaJ for ; Mon, 26 Sep 2016 05:43:22 +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 mail-io0-f174.google.com (mail-io0-f174.google.com [209.85.223.174]) by theia.denx.de (Postfix) with ESMTPS id 1B9EAA7716 for ; Mon, 26 Sep 2016 05:43:19 +0200 (CEST) Received: by mail-io0-f174.google.com with SMTP id m79so170435236ioo.3 for ; Sun, 25 Sep 2016 20:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZzSo96JtLznSjWQgw/luo5tlFkoloESiL+tFEcR6+lA=; b=aBE8xj7B7yxD7cJqKQ6GkA3DriMzwMSCuTdYKGOwcB5Bc5iJQjGL6JK2+MqyUxLbrL lPSlOk8b0SgtwMSAdUS6pnLOrMLHjAQyATVlaFAshsnruKuGyI5xkYJgHX1YtqCMSC7N 6VGRrMvpkJ2/kPF0tPbyo+Jn8iAFttaqZSn/L0POaioa/GnKtpL2HzBJMe8/23jRHkBZ cl3DqX3QOmyfcqQR1ZZaE/yVr8S8BYT35YMTpXcDGPD6I24UUwQxCOsMmnbVb7lIsO4H 4excuX+ZOnu4/q/+ybRBd89ZdDAll51AM+MYsHSn666oQHjmAi0gVw1kw2UwHK6vGPdG VwZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ZzSo96JtLznSjWQgw/luo5tlFkoloESiL+tFEcR6+lA=; b=Q/sacMcMMgVGdlX4Ny9lGqjJGhQdbQWr6w7tlrrAyF2CdA1wI5B2HwDbtLquMAW+S4 rZefSncoZtnagZ7cV6y/25ynV1A7bNbcNQHfvOBb2SFYbdQSeJVDsFIjq8uz0JkRkVWW 9OITN56tQvBga/5sKB3Sr8sHwG9DPMocGn0SlZwjdYbhCZkG0ujFWZaicWPeYXGL1AJ7 i/6K3w2v9byoJBg2cmGKODLLGLQCi7ikXkmgqu7QZZn2G6t2KbaLfumqnGpBqCghQonc i/c1R0Cb3chlg55NMceFtxIrVvpXlGFHC+inyoXiLisbF4SzJWFUG0TjgOLCKJHEDiTP 7YXA== X-Gm-Message-State: AE9vXwM/O7k83iVkphP/BE3CVkfYNAfiwrKhBdgxSDoeUPU1P9nisr11y9Lcp6OIDBVDPc2Q X-Received: by 10.107.59.199 with SMTP id i190mr20076094ioa.18.1474861397981; Sun, 25 Sep 2016 20:43:17 -0700 (PDT) Received: from kaki.bld.corp.google.com ([2620:0:1005:12:61b7:f33c:9010:eb01]) by smtp.gmail.com with ESMTPSA id a66sm7549064ioe.22.2016.09.25.20.43.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Sep 2016 20:43:17 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id C25302225C7; Sun, 25 Sep 2016 21:35:14 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 25 Sep 2016 21:34:01 -0600 Message-Id: <1474860866-16406-59-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1474860866-16406-1-git-send-email-sjg@chromium.org> References: <1474860866-16406-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH 58/82] x86: Fix up byteorder.h for x86_64 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Remove the very old x86 code and add support for 64-bit. Signed-off-by: Simon Glass --- arch/x86/include/asm/byteorder.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/byteorder.h b/arch/x86/include/asm/byteorder.h index 7dfeb8b..a2d1fd8 100644 --- a/arch/x86/include/asm/byteorder.h +++ b/arch/x86/include/asm/byteorder.h @@ -8,24 +8,25 @@ static __inline__ __u32 ___arch__swab32(__u32 x) { -#ifdef CONFIG_X86_BSWAP __asm__("bswap %0" : "=r" (x) : "0" (x)); -#else - __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ - "rorl $16,%0\n\t" /* swap words */ - "xchgb %b0,%h0" /* swap higher bytes */ - :"=q" (x) - : "0" (x)); -#endif + return x; } +#define _constant_swab16(x) ((__u16)( \ + (((__u16)(x) & (__u16)0x00ffU) << 8) | \ + (((__u16)(x) & (__u16)0xff00U) >> 8))) + static __inline__ __u16 ___arch__swab16(__u16 x) { +#if CONFIG_IS_ENABLED(X86_64) + return _constant_swab16(x); +#else __asm__("xchgb %b0,%h0" /* swap bytes */ \ : "=q" (x) \ : "0" (x)); \ return x; +#endif } #define __arch__swab32(x) ___arch__swab32(x)