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: 138373 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5503424lji; Tue, 12 Jun 2018 08:34:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLIruydChNxtwV2h8lGBBh1xqUq/QUCaAp5oNx+EijjciXerGa6vLAu/dyGvz6XAr8omI0u X-Received: by 2002:a50:cd96:: with SMTP id p22-v6mr820636edi.159.1528817690454; Tue, 12 Jun 2018 08:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528817690; cv=none; d=google.com; s=arc-20160816; b=m4WqCaHMCqHvYMYcWwdIHUVQ+W7216Xjw3ViYk1Idc34bfKB9sIbEnp9yONAFvDU+D WNfloByHO7ANLCWOCyiIZWqWa8NBclSlMe34nmsEjjukvko7l+zdMs+ODwvpsYa5dmWP IatDxG1O3vQOH0Qpjs5mRKFykLViNrrj7qf8Tbct59LtYyxfYmnODVGgD40Lmf13ZN40 9fY8k6aQQfeJT0jDQwq8FDTa7OJqXjV201VZxA82U+VwrO0Q7jFXpZlup11dVQnSPzoE nmvVqOQdDPvc/tta0K9RIADCfDkz0A+oLvnpjN904cAC/vr7b3sHUYAa0ayeYtTUNaKl Rlow== 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:dkim-signature:arc-authentication-results; bh=mP7hLkMfb2A5ObTfi1ulR2h8HDDN7LwIBWtNFGcBxIw=; b=E4fe4ImH4K1bC/wJ0C6URkcYCCKfbk9iUIJtzBxISr3vNPJemLp71BCtEoprb7CGoy 3kL9P7Rqb6P1ATxyIFWaqOLInFtAdANqpqGvezFMkhXQPfEA6fDEp9B5EwSSbNmFmfir Key6H/sz7qV3DCOi8id7FxdPSeq9fx8NkK7Sy97+BC5v2YyE0LeXQNIMCE6CPFlZPnpm aSsYbapmPiHF3FHnWfQXGu/iYa0n+Oub1Wh8bGNc9aWm3Goz3T1KSl4QeBCO7/jamOCi FBNMWSn/AcPy7F3CH8TUVLsuOw0rdbtjg1XDRiFICjvmtaTFOuMJecekQNgb3bvstt5S rS7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=bO7t6FMj; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id u30-v6si545015edm.404.2018.06.12.08.34.50; Tue, 12 Jun 2018 08:34:50 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=bO7t6FMj; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: by lists.denx.de (Postfix, from userid 105) id E7F9EC21C6A; Tue, 12 Jun 2018 15:32:14 +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-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