From patchwork Tue Jun 12 15:36:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 928384 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bO7t6FMj"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 414v836Tv5z9s0w for ; Wed, 13 Jun 2018 01:34:43 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 8B38DC21DF3; Tue, 12 Jun 2018 15:32:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1CA7FC21DDC; Tue, 12 Jun 2018 15:31:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A8165C21D56; Tue, 12 Jun 2018 15:31:42 +0000 (UTC) Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by lists.denx.de (Postfix) with ESMTPS id D4C88C21DAF for ; Tue, 12 Jun 2018 15:31:37 +0000 (UTC) Received: by mail-it0-f67.google.com with SMTP id l6-v6so15972171iti.2 for ; Tue, 12 Jun 2018 08:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mYK+lG5zqybFiLxl9lk+lHKmqtPzyJeT4dJ5u2ocV0A=; b=bO7t6FMjPfM1DRONBl/WXFUCr2WwDtswejMbCYPNZDu69IzbZDlc6KV2qI2cvd6CU9 1X9hwT0nilFMoLL8UnbAN+IQWVG2p5bqoTimfHs5Y4z1tEZKT+NzTncp1JCzN21pRkJx hFx5BdQSvU33fMYdJ5Kve0R9kmPCiV2poOnuUisOA91e7YDArgQqyo2vmbcGErKwdT+3 l7hvcz/c19zzH9uTUsMyom3JGKS/HIx/OP9n0Aejq90auuh6Fn2+pxYD4K8rM8QWMiwd gIlnEiopRvp3gyVPVY2LlqdSV5HdW5Vc3YxikYwd6gJD8g1rP6DgBsMIoVs9RTPJkr7j 9jZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mYK+lG5zqybFiLxl9lk+lHKmqtPzyJeT4dJ5u2ocV0A=; b=R9Cs8eRprXvfCLpDlfHZo+8WcWvkU4/8hPeu1xpiS7Sl5BiG2K1DYfk56csOLv8pvy tkOVB+v02N+qGdb3vdp1se89e0aXU569zxrOKmB4mO9IVpwBLOkQ4gMPmvequrNiSY7u 5h7hZ/NO0b6dxa21rV6a8tM6Ev7I16K35r+TwGfvpp41W68XFWYwU9ogGasLSJwgb014 F8xbF0DczS+DCQgDmI8t1RSU2GK9MTReaKuMDkduM2y9fi5FhKFVQbtOGK3RbvEjAgHq 3HzpeyZnqIppNHfL+4PLWjktR137u3RHM/BW4lj1Mcq2zMrNLThPlkm6504X2KAGqmuq r2kg== X-Gm-Message-State: APt69E0H7xxhMlX4ArUoyuX2c1CRH4hR/w+ZnNKFWDr8DvdmmCQx0UhD F+1DAVbcgMeHgx7YcxUI2SQ= X-Google-Smtp-Source: ADUXVKL/j973ITseqFmPIu3lcxLPqPdgkfohRH2AaD74H2NNxVejeJPQWUyx1MKA3BNr7R7KVLUqPw== X-Received: by 2002:a24:4a15:: with SMTP id k21-v6mr938215itb.128.1528817496789; Tue, 12 Jun 2018 08:31:36 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com. [147.11.156.139]) by smtp.gmail.com with ESMTPSA id l82-v6sm369743itl.25.2018.06.12.08.31.35 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Jun 2018 08:31:35 -0700 (PDT) From: Bin Meng To: Simon Glass , U-Boot Mailing List Date: Tue, 12 Jun 2018 08:36:14 -0700 Message-Id: <1528817785-20208-3-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1528817785-20208-1-git-send-email-bmeng.cn@gmail.com> References: <1528817785-20208-1-git-send-email-bmeng.cn@gmail.com> Cc: Alexander Graf Subject: [U-Boot] [PATCH v2 02/13] efi.h: Do not use config options X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" From: Alexander Graf Currently efi.h determines a few bits of its environment according to config options. This falls apart with the efi stub support which may result in efi.h getting pulled into the stub as well as real U-Boot code. In that case, one may be 32bit while the other one is 64bit. This patch changes the conditionals to use compiler provided defines instead. That way we always adhere to the build environment we're in and the definitions adjust automatically. Signed-off-by: Alexander Graf Reviewed-by: Bin Meng Tested-by: Bin Meng Signed-off-by: Bin Meng --- Changes in v2: None include/efi.h | 17 ++++------------- lib/efi/Makefile | 4 ++-- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/include/efi.h b/include/efi.h index 98bddba..5e1e8ac 100644 --- a/include/efi.h +++ b/include/efi.h @@ -19,12 +19,12 @@ #include #include -#if CONFIG_EFI_STUB_64BIT || (!defined(CONFIG_EFI_STUB) && defined(__x86_64__)) -/* EFI uses the Microsoft ABI which is not the default for GCC */ +/* EFI on x86_64 uses the Microsoft ABI which is not the default for GCC */ +#ifdef __x86_64__ #define EFIAPI __attribute__((ms_abi)) #else #define EFIAPI asmlinkage -#endif +#endif /* __x86_64__ */ struct efi_device_path; @@ -32,16 +32,7 @@ typedef struct { u8 b[16]; } efi_guid_t; -#define EFI_BITS_PER_LONG BITS_PER_LONG - -/* - * With 64-bit EFI stub, EFI_BITS_PER_LONG has to be 64. EFI_STUB is set - * in lib/efi/Makefile, when building the stub. - */ -#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB) -#undef EFI_BITS_PER_LONG -#define EFI_BITS_PER_LONG 64 -#endif +#define EFI_BITS_PER_LONG (sizeof(long) * 8) /* Bit mask for EFI status code with error */ #define EFI_ERROR_MASK (1UL << (EFI_BITS_PER_LONG - 1)) diff --git a/lib/efi/Makefile b/lib/efi/Makefile index f1a3929..a790d2d 100644 --- a/lib/efi/Makefile +++ b/lib/efi/Makefile @@ -7,11 +7,11 @@ obj-$(CONFIG_EFI_STUB) += efi_info.o CFLAGS_REMOVE_efi_stub.o := -mregparm=3 \ $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32) -CFLAGS_efi_stub.o := -fpic -fshort-wchar -DEFI_STUB \ +CFLAGS_efi_stub.o := -fpic -fshort-wchar \ $(if $(CONFIG_EFI_STUB_64BIT),-m64) CFLAGS_REMOVE_efi.o := -mregparm=3 \ $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32) -CFLAGS_efi.o := -fpic -fshort-wchar -DEFI_STUB \ +CFLAGS_efi.o := -fpic -fshort-wchar \ $(if $(CONFIG_EFI_STUB_64BIT),-m64) extra-$(CONFIG_EFI_STUB) += efi_stub.o efi.o