From patchwork Thu Jun 14 16:33:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138585 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2340241lji; Thu, 14 Jun 2018 09:38:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIbqTJYXCXALRXMgquA08iNcQzXMimCNmvXb/ZJDedt5SQ4dee/SjrMv9CRA5z+iPkO4G6v X-Received: by 2002:a50:b84e:: with SMTP id k14-v6mr3236621ede.307.1528994319614; Thu, 14 Jun 2018 09:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994319; cv=none; d=google.com; s=arc-20160816; b=x4XR/xDkWdTT7uTtvrv82c0xlXLjol+Mvh0nv4g4YRsZIQvBQYiLlE6fdQoajFkBay YFFU/sXS3PYfR06vClB5+UfK1ryzGCzonWSvJ0OFsZwbo72xKhc16V3ivwvJToH875oA Harex6kTUSewindkD30xEBlpqdRAVzxh3fzKo7j/+TCYWDR79JuNNknRTMq2IbqcwA9I rLWtm1PS9pJdVIOMJ0Wc4NcfsAPM0yjCX38WxmxA8mW7NTb1r1MNFecbKfAnr9z8uMTC b0dG+W1W4KDvRZAVgz2C+FZj7mKU5gI7ZL7amKar81TR73NN1hx+/j7nbqxfNDU20e1k SXvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=4yVe3Qhep2FECKHeBfXJoPFMHyd1p29AD7UN+bxkh04=; b=OqRDpuJhN1HJ0WO2+m94zugbDPtVk1jToNhpEi5DDLb+sLfZMhMHYqYGvEdIe30HhB DkhA/1jfhZjDtx/waoMfNJ7oE2OUesahe0dN7gpTpErJe258hNQK3BLJC3+wzf5cW4TZ XEwlz3st2ocy0Zthnov0Vs+0WgsmRKaK6hgfz8768j483pDhIRQ7A6TgtNc2TKCYXc4d pJc75Y2O9jGwGZ9g+/fnyt8S9d4gg7T5AQwenqmFGjsWm5LlGACcw1T/JkWeV3k0SSvG Ar/5Gpa6Kxd8q6MGehIB24atmYDw5vuAtsDwefhcD06fRu9b18x0DtyrZMnq6Mgle5Nn qHcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id m10-v6si4440173edp.378.2018.06.14.09.38.39; Thu, 14 Jun 2018 09:38:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 1F5A5C21DA2; Thu, 14 Jun 2018 16:36:25 +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=none 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 CF76CC21EDC; Thu, 14 Jun 2018 16:33:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 96DFEC21D74; Thu, 14 Jun 2018 16:33:36 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 86C62C21D9A for ; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BB11FAF7C; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:28 +0200 Message-Id: <20180614163334.46827-6-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 05/11] 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" 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 --- 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 e30a3c51c6..826d484977 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 18d081ac46..ece7907227 100644 --- a/lib/efi/Makefile +++ b/lib/efi/Makefile @@ -7,9 +7,9 @@ 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 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 extra-$(CONFIG_EFI_STUB) += efi_stub.o efi.o