From patchwork Wed Apr 18 13:40:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 133628 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp5895560ljb; Wed, 18 Apr 2018 06:43:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+HTvm2Epkg8fpVGa1ZN0nOqIuTw8Vo68OXbxc18qrm1xvWHgBS74ZXWSDDTQxmI0bkifxb X-Received: by 10.80.134.154 with SMTP id r26mr2613253eda.64.1524059029686; Wed, 18 Apr 2018 06:43:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524059029; cv=none; d=google.com; s=arc-20160816; b=ZFQKf+dVwh3dljbdnqJaj72w0nGkjg1IZBNa7Fh/+Qj2epDmIKk4EorFCBgmrO/I7J QysANis77WfLJJcIlX6KvwzlPt1MZ9R9fbiwzCDN9kPxpv/fubz+4czNsgZZ6NQKMX5u pftecPwlhDVTz7w2JW9cVxN6AKKhy4O4ekAwcVK3N6fBqZK8CQ0iEgkuim4Ilt4PnzuM b5dgLkVcvztIdW7o0vTRyHe+a/Wjk2zzDaIT4vM6PQm2zcZYgxdbJrPeinLUF6biVBFw FOhvI7fis1U06b2B9T8Y+3E2vkMoEy3sizNBf1giep9RLCBd08HV+YTGMaiYLFWPiM3z bdQA== 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=LTrTIXaMK8b+GOeUJ4YMXU/yf4qXB5dvnHlp3BYFPPM=; b=C09q+w6EYf8dfPx6HocHFgyt48iQXqQGDnsQ6SqCP7rJq8wYW5w8uE0AnjW6MMiCk8 Fm2ndVQWn3KgtgP42egpaVF1RJVk3E82G2Y+fQRNqqV1iHcMqITOVmoH6Ni/3EkVBv0R lAeQL/bzJmDQoQiMJ2kGgHRtVmIib6NSu8DtwV2gGIlkRXogmDGkDF7f5NGdbqj9badk z0LeR7AubP6NKonAOAbNAACP70s1HnJbzh9pReKpdxJ43qkUukvI1Eo/FItgux7jaIt3 8VKQ/CmiXbRTF/Ps8t0IYubrkAJcB5f4HHYOo+dGWY94bhpoBBBAVUMMKiJMcOyshrxs T/0Q== 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 c1si876939edk.269.2018.04.18.06.43.49; Wed, 18 Apr 2018 06:43:49 -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 220C9C21E3B; Wed, 18 Apr 2018 13:41:32 +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=RCVD_IN_DNSWL_BLOCKED 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 6ECD4C21EE4; Wed, 18 Apr 2018 13:40:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6CFCFC21C8B; Wed, 18 Apr 2018 13:40:34 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id D8478C21E30 for ; Wed, 18 Apr 2018 13:40:33 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4D98EAF59; Wed, 18 Apr 2018 13:40:33 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Wed, 18 Apr 2018 15:40:23 +0200 Message-Id: <20180418134030.55127-2-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180418134030.55127-1-agraf@suse.de> References: <20180418134030.55127-1-agraf@suse.de> Cc: Heinrich Schuchardt , Greentime Hu Subject: [U-Boot] [PATCH 1/8] riscv: Add setjmp/longjmp code 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" To support efi_loader we need to have platform support for setjmp/longjmp. Add it here. Signed-off-by: Alexander Graf --- arch/riscv/include/asm/setjmp.h | 24 ++++++++++++++++++ arch/riscv/lib/Makefile | 1 + arch/riscv/lib/setjmp.S | 54 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 arch/riscv/include/asm/setjmp.h create mode 100644 arch/riscv/lib/setjmp.S diff --git a/arch/riscv/include/asm/setjmp.h b/arch/riscv/include/asm/setjmp.h new file mode 100644 index 0000000000..37e8281aaa --- /dev/null +++ b/arch/riscv/include/asm/setjmp.h @@ -0,0 +1,24 @@ +/* + * (C) Copyright 2018 Alexander Graf + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef _SETJMP_H_ +#define _SETJMP_H_ 1 + +/* + * This really should be opaque, but the EFI implementation wrongly + * assumes that a 'struct jmp_buf_data' is defined. + */ +struct jmp_buf_data { + /* x2, x8, x9, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27 */ + u64 regs[13]; +}; + +typedef struct jmp_buf_data jmp_buf[1]; + +int setjmp(jmp_buf jmp); +void longjmp(jmp_buf jmp, int ret); + +#endif /* _SETJMP_H_ */ diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile index 323cf3e835..6d97aa2719 100644 --- a/arch/riscv/lib/Makefile +++ b/arch/riscv/lib/Makefile @@ -12,3 +12,4 @@ obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_GO) += boot.o obj-y += cache.o obj-y += interrupts.o +obj-y += setjmp.o diff --git a/arch/riscv/lib/setjmp.S b/arch/riscv/lib/setjmp.S new file mode 100644 index 0000000000..55c5128163 --- /dev/null +++ b/arch/riscv/lib/setjmp.S @@ -0,0 +1,54 @@ +/* + * (C) 2018 Alexander Graf + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +.pushsection .text.setjmp, "ax" +ENTRY(setjmp) + /* Preserve all callee-saved registers and the SP */ + sd s0, 0(a0) + sd s1, 8(a0) + sd s2, 16(a0) + sd s3, 24(a0) + sd s4, 32(a0) + sd s5, 40(a0) + sd s6, 48(a0) + sd s7, 56(a0) + sd s8, 64(a0) + sd s9, 72(a0) + sd s10, 80(a0) + sd s11, 88(a0) + li a0, 0 + ret +ENDPROC(setjmp) +.popsection + +.pushsection .text.longjmp, "ax" +ENTRY(longjmp) + ld s0, 0(a0) + ld s1, 8(a0) + ld s2, 16(a0) + ld s3, 24(a0) + ld s4, 32(a0) + ld s5, 40(a0) + ld s6, 48(a0) + ld s7, 56(a0) + ld s8, 64(a0) + ld s9, 72(a0) + ld s10, 80(a0) + ld s11, 88(a0) + + /* Move the return value in place, but return 1 if passed 0. */ + beq a1, zero, longjmp_1 + mv a0, a1 + ret + + longjmp_1: + li a0, 1 + ret +ENDPROC(longjmp) +.popsection From patchwork Wed Apr 18 13:40:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 133624 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp5893887ljb; Wed, 18 Apr 2018 06:42:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx496p1QCcVgvRzSLQKpYTeOSDizBtjLkwYdKHcVwxk90VOvRQUqY3zOjUHGWmB2K/M6oc62E X-Received: by 10.80.234.195 with SMTP id u3mr3244549edp.49.1524058922017; Wed, 18 Apr 2018 06:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524058922; cv=none; d=google.com; s=arc-20160816; b=qxxwDzVKin8T0PMxcVb4gApzX+2NT3RP1nlGYAK8PYMDcn3sWBw44bkFaiqKCEX+zr 7rhy//tYxIioXsNHm3wEMUdE8RLp3h6KBlSpUv/aRdKSvyN0+GbooeUClO3rXT+k2gHJ Hk46GUI2Ag0kITbDbQ6aRMoOdDOi7hUSpKSFADfX22faO2u+cwDlx0iokCLW/dxJo8QW qHNhB2wSgJwjBUtrJ9blAideiii1ao9HzTlOux0aBBm4l996zaCM2aZDUBmLVR4dgZnm 2alTRCCRPQttE3TKMKrSxH2cH6M9N6ummBNGePqrXu7cq6n5k9F8PPSx9Ky5/IVGw//j 62cQ== 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=HkE7PgZzxlAabLS5GdFfEUunbVRUidOklEb/dM3CVaU=; b=0yK4YFkGvkF40iKXKmj/tFFk9Cmd5xbyxEtwvG9701l8hjz5PIN8TiSfsl7CqNJPGt HmCkBfVH1PGHlMdXwCXL3tO3fofqX3UGMsUCvH3Pzln95RDCcdrDhl08W8NukAFte34D 3hvoDTplQHoTIk/BYgs3CUnDZ5Fto/wk0QrLqU8fGKytjYxMUCZ+DwdTsxKVyXBcWL/i ZxbTbAGISQcz4wdIlF8LFJP4btoUwPstJpHibND4GGLFlyNEZvUFeQmQAvBHN8CdRKes 6fpIpzThuu5mBAG9FD6v2VgyVZPaTZD5b53behsxIKH9xuRCOZuk1ebtHrSoudQeX2Lt 3wXw== 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 r11si337428edc.362.2018.04.18.06.42.01; Wed, 18 Apr 2018 06:42:02 -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 9756FC21E30; Wed, 18 Apr 2018 13:41:16 +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=RCVD_IN_DNSWL_BLOCKED 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 47BA0C21EC9; Wed, 18 Apr 2018 13:40:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5A472C21DD4; Wed, 18 Apr 2018 13:40:34 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id A2DB2C21C8B for ; Wed, 18 Apr 2018 13:40:33 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F2A99AB1E; Wed, 18 Apr 2018 13:40:32 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Wed, 18 Apr 2018 15:40:24 +0200 Message-Id: <20180418134030.55127-3-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180418134030.55127-1-agraf@suse.de> References: <20180418134030.55127-1-agraf@suse.de> Cc: Heinrich Schuchardt , Greentime Hu Subject: [U-Boot] [PATCH 2/8] riscv: Enable function sections 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" The linker can remove sections that are never addressed, so it makes a lot of sense to declare every function as an individual section. This reduces the output U-Boot code size by ~30kb for me. Signed-off-by: Alexander Graf --- arch/riscv/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk index 6b681c4286..69f4cf6ce8 100644 --- a/arch/riscv/config.mk +++ b/arch/riscv/config.mk @@ -29,5 +29,5 @@ CONFIG_STANDALONE_LOAD_ADDR = 0x00000000 \ -T $(srctree)/examples/standalone/riscv.lds PLATFORM_CPPFLAGS += -ffixed-gp -fpic -PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2 +PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2 -ffunction-sections LDFLAGS_u-boot += --gc-sections -static -pie From patchwork Wed Apr 18 13:40:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 133632 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp5896611ljb; Wed, 18 Apr 2018 06:44:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+bQ5uLZoV3JXzJuoUhPi+tMM9kKsy3ujKSRQ9IrKTnElhKd62hKG8SprPDnC4+GoHiRTjq X-Received: by 10.80.186.67 with SMTP id 3mr3315692eds.194.1524059098719; Wed, 18 Apr 2018 06:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524059098; cv=none; d=google.com; s=arc-20160816; b=HBVI37q+r+/kHRYFBftJ43oaNbLNlJAkbdWTLe7qVNoOlF68AkM14RtQUXVAR/x+rl /Xi/YaNLkFe/abKD2ZDVpXmrw+I5aTb39dofi6jR4L2KG5DSVeSZRTvSzuqYqWL6KgBN wVTiza8MO6v83m1dib+nTYP/VRQAOxjnfkmBj69p39oqr4sY5stLV1xjLFqS8bmSwoTK BhmPXYQVMsS7OwDItn7ng/dC7gtk/5ICoQb1rucnCmQTTBN4CK0gVWsz38fp4dC28SsX FoHGZexBBaEtsS/Uh7fc7oeRNxRelPbTsNJDinQdxOy00y2u2JCrkd5MX50dHd3xLuUw iROg== 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=HuRJlLEO47BpxtSlBK2p1QoSiiAv0WU8F6pKhYNOLwI=; b=oLMu/GIixIlf8U4L7iToUJhj4Q3DC0YBFjiJuUb/6Au26DZUbeuZ89g7Dg+kQFMcCo GB+EsCQgOe8CEpqgMwZh5jXDuc00fETTa/uBcPrUgw7/fY/e4Xg3fJUZw1aJ7zIjgKV1 GalnMvsCjGGfGi+i4+MTV0qKBOxBRioTtQ+cR2cr714VVzNsGQY+s/L1ol+PvVNpQ3QT ityutqMeWgQcXbV+1OWXfazcQWgI5SCVdr1NDUO4gUXMfLhrJajmk+oavART1LH9UYyu 8q+yzLdH6wGmDMFLwTcThA0E/QCuPbVBgeAFErykkWqxexoKerymDDeser3I23EjAJnE DRQQ== 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 x10si1002000ede.411.2018.04.18.06.44.58; Wed, 18 Apr 2018 06:44:58 -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 370E6C21EC8; Wed, 18 Apr 2018 13:42:21 +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=RCVD_IN_DNSWL_BLOCKED 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 EE313C21EFD; Wed, 18 Apr 2018 13:40:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9C13CC21C8B; Wed, 18 Apr 2018 13:40:34 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id D846CC21DF3 for ; Wed, 18 Apr 2018 13:40:33 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4D7BFADFD; Wed, 18 Apr 2018 13:40:33 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Wed, 18 Apr 2018 15:40:25 +0200 Message-Id: <20180418134030.55127-4-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180418134030.55127-1-agraf@suse.de> References: <20180418134030.55127-1-agraf@suse.de> Cc: Heinrich Schuchardt , Greentime Hu Subject: [U-Boot] [PATCH 3/8] efi_loader: selftest: Do not build relocation tests for risc-v 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" The relocation selftest doesn't compile for me on RISC-V. Disable for now. Signed-off-by: Alexander Graf --- lib/efi_selftest/Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index 31b444fc8b..ede7831449 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -35,9 +35,10 @@ ifeq ($(CONFIG_BLK)$(CONFIG_PARTITIONS),yy) obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += efi_selftest_block_device.o endif -# TODO: As of v2018.01 the relocation code for the EFI application cannot -# be built on x86_64. +# TODO: As of v2018.05 the relocation code for the EFI application cannot +# be built on x86_64 / RISC-V. ifeq ($(CONFIG_X86_64),) +ifeq ($(CONFIG_RISCV),) ifneq ($(CONFIG_CMD_BOOTEFI_SELFTEST),) @@ -63,6 +64,8 @@ $(obj)/efi_selftest_startimage_exit.o: $(obj)/efi_miniapp_file_image_exit.h $(obj)/efi_selftest_startimage_return.o: $(obj)/efi_miniapp_file_image_return.h -endif +endif # CONFIG_CMD_BOOTEFI_SELFTEST -endif +endif # !CONFIG_RISCV + +endif # !CONFIG_X86_64 From patchwork Wed Apr 18 13:40:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 133631 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp5896187ljb; Wed, 18 Apr 2018 06:44:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/pzu6Oh7l8TayGQ/WHoN4H7ti0NlbJPuzUah+qKp/QN+5ohuHNh1W2U6ImLw9L6/JrWLMw X-Received: by 10.80.157.66 with SMTP id j2mr3304520edk.259.1524059069994; Wed, 18 Apr 2018 06:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524059069; cv=none; d=google.com; s=arc-20160816; b=HYHoB8/JM8m4gJpldxUY2xYL69bufz8DeD8GMG3nhkrWXpHP8mjEIcCDk3OYEXBoyg 1S5BMsjauXbDDgGoIL83Ib/UfrYRFoqTRqu8v/IMwPxP4kKaoJxVb8UEByY+lwlOSA+W oIEnfJRIk/rgVOq66lNYyE0xmoon4izLvCMbYMsyq2D04c1IH60/GvhivXx6QW3+Wh+M tG9q1kxwBbEbCaO8LSX3TFAOpjXYcgVrkC8U/5ch53EAx6TOkBrSioiK5KZDdMUPlPUK 1Yh9jVmFsIaARD5S2W4HZm3D6Dj8OQTXj39RJAJrBRzw8nQgb3kr3rd9muq71dCMFGFB NiAQ== 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=nubpHsVjoyXDlWDf2ClEQ7oY/3zaUgtJF0lPVvN9fyo=; b=NLWSGRoF9h/h4nW3b/nHi8otq1Ded+0l6p0JYgfflIJEZLaKLUBnTKiIyeWjsesR4D /DMkRWxmcpcSUy/67fGv0ZqHM+mul5WrOOCdEbtT31ZiTVLlwue9DLv9FmbOrdLpkfCi faAd1cQh1bOsNFR34J4CCgsQIe2uGjjFaQP156T4nWxfZoXtzXjTWc1JrQZ9Srp/i0qw tzmB47SD5lwF9QfQH0zFEbZja+A51oeHd6lcb/K5Nv8z3R2f7lSHJYV4i7YNUQ/sUfa6 5yYeGh9AlVJ5dN71pI9p60tWD7wzY/ja4NvjFP3wERkL/vbSqY07v7EwPFkjiATGN8ua 7wXw== 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 5si1350657edj.332.2018.04.18.06.44.29; Wed, 18 Apr 2018 06:44:29 -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 8A1EAC21EC3; Wed, 18 Apr 2018 13:42:54 +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=RCVD_IN_DNSWL_BLOCKED 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 7994DC21F21; Wed, 18 Apr 2018 13:40:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D30B6C21C8B; Wed, 18 Apr 2018 13:40:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 801D1C21C93 for ; Wed, 18 Apr 2018 13:40:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4DCB8AF62; Wed, 18 Apr 2018 13:40:35 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Wed, 18 Apr 2018 15:40:26 +0200 Message-Id: <20180418134030.55127-5-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180418134030.55127-1-agraf@suse.de> References: <20180418134030.55127-1-agraf@suse.de> Cc: Heinrich Schuchardt , Greentime Hu Subject: [U-Boot] [PATCH 4/8] riscv: Add board_quiesce_devices stub 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" This patch adds an empty stub for board_quiesce_devices() which allows boards to quiesce their devices before we boot into an OS in a platform agnostic way. Signed-off-by: Alexander Graf --- arch/riscv/include/asm/u-boot-riscv.h | 1 + arch/riscv/lib/bootm.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/arch/riscv/include/asm/u-boot-riscv.h b/arch/riscv/include/asm/u-boot-riscv.h index 18099cd260..0b6428b1ae 100644 --- a/arch/riscv/include/asm/u-boot-riscv.h +++ b/arch/riscv/include/asm/u-boot-riscv.h @@ -17,5 +17,6 @@ int cleanup_before_linux(void); /* board/.../... */ int board_init(void); +void board_quiesce_devices(void); #endif /* _U_BOOT_RISCV_H_ */ diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index 9242fa891a..b80274adba 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -16,6 +16,10 @@ DECLARE_GLOBAL_DATA_PTR; +__weak void board_quiesce_devices(void) +{ +} + int arch_fixup_fdt(void *blob) { return 0; From patchwork Wed Apr 18 13:40:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 133630 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp5895954ljb; Wed, 18 Apr 2018 06:44:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx48uy34UZgKaefkbVLV9JcCkofGj9/NmdhJ8WgaCAXrRTesD7n0sPKBsSDaIoDhO1NUNMQgI X-Received: by 10.80.231.5 with SMTP id a5mr3243436edn.109.1524059053568; Wed, 18 Apr 2018 06:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524059053; cv=none; d=google.com; s=arc-20160816; b=d8E9HU6I56rquuDZ79vgOg+E+Vz2Wu/QNK1RRrkG68oJuchXTnAvg6ACLyFWM6zoD6 2QnXTVAd8vMTxs7F+N9vV+a6nSz1GU8M9W+f4dRH6BetNJrGw6UKElY6zQoKqd0aV5mW 8L4FstxgfIgv0L0pXqnWvFUkkS4KQ1OLbFVKg0tRdwzPifYHkx0wIOdXW+4NNRZbvv3/ gqIRs5nemSPYwkeXxdRUP5PzS+ESS8EE8im9AzT8KgQoyxG8bKecQmzbgs1jVjIYEeah rKRP8qTpKuHeA5oaFye1rZXyb3o+TtHqyGozz0o2Ty5mj7KzPeaLhgGKXaxDCFIG3cmR 6RVg== 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=c4Hh2FYtgzpa9xq5L/AfFgsVJ14/BVeinvb9ERXYdzo=; b=ypZb0+VgieESpGBlbk8C9qNnu1rD7KIEZMTr1MIxDBXRktZeDEP16PJ5y9gsPBFSw7 lTzjPhhQ1Xw+k3FqRVZFfwxgTOJY8V2YLALkA8kroT2vJwYqsq0bs5x4Oq0aofKTNAeF +zBdqcNsOYSLT5JdgDuTHPYKK3qOYsOXVlK3g+nk9VM8ofCJcl67lyOKdw/GxsMnFOhs FqvKAjXvzrYGBtibJdy7t5MHvj5zph8SPj8hXc/vtxrGcf7NvLeObakia9yjfccK+p/j mNKMfQIltv1/B1lM/VyJNGOFMPfmk8cdJvXQX6IDEgvjTLiOzyADCESmk5uvSbCx/F0I aEWA== 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 k31si1354968ede.236.2018.04.18.06.44.13; Wed, 18 Apr 2018 06:44:13 -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 16323C21EE3; Wed, 18 Apr 2018 13:42:38 +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=RCVD_IN_DNSWL_BLOCKED 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 05596C21F1C; Wed, 18 Apr 2018 13:40:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BD433C21D4A; Wed, 18 Apr 2018 13:40:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 37A6AC21C8B for ; Wed, 18 Apr 2018 13:40:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 072FDAF5D; Wed, 18 Apr 2018 13:40:35 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Wed, 18 Apr 2018 15:40:27 +0200 Message-Id: <20180418134030.55127-6-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180418134030.55127-1-agraf@suse.de> References: <20180418134030.55127-1-agraf@suse.de> Cc: Heinrich Schuchardt , Greentime Hu Subject: [U-Boot] [PATCH 5/8] efi_loader: Use EFI_CACHELINE_SIZE in the image loader too 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" We were using our EFI_CACHELINE_SIZE define only in the runtime service code, but left the image loader to use plain CONFIG_SYS_CACHELINE_SIZE. This patch moves EFI_CACHELINE_SIZE into efi_loader.h and converts the image loader to use it. Signed-off-by: Alexander Graf --- include/efi_loader.h | 7 +++++++ lib/efi_loader/efi_image_loader.c | 2 +- lib/efi_loader/efi_runtime.c | 7 ------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 17f9d3d1ef..0b1b3df55a 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -76,6 +76,13 @@ const char *__efi_nesting_dec(void); ##__VA_ARGS__); \ }) +#ifdef CONFIG_SYS_CACHELINE_SIZE +#define EFI_CACHELINE_SIZE CONFIG_SYS_CACHELINE_SIZE +#else +/* Just use the greatest cache flush alignment requirement I'm aware of */ +#define EFI_CACHELINE_SIZE 128 +#endif + extern struct efi_runtime_services efi_runtime_services; extern struct efi_system_table systab; diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index d5fbba3138..2476a97a6a 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -290,7 +290,7 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info) /* Flush cache */ flush_cache((ulong)efi_reloc, - ALIGN(virt_size, CONFIG_SYS_CACHELINE_SIZE)); + ALIGN(virt_size, EFI_CACHELINE_SIZE)); invalidate_icache_all(); /* Populate the loaded image interface bits */ diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 8558124c0a..573a5d6ac1 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -30,13 +30,6 @@ static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void); static efi_status_t __efi_runtime EFIAPI efi_device_error(void); static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void); -#ifdef CONFIG_SYS_CACHELINE_SIZE -#define EFI_CACHELINE_SIZE CONFIG_SYS_CACHELINE_SIZE -#else -/* Just use the greatest cache flush alignment requirement I'm aware of */ -#define EFI_CACHELINE_SIZE 128 -#endif - #if defined(CONFIG_ARM64) #define R_RELATIVE 1027 #define R_MASK 0xffffffffULL From patchwork Wed Apr 18 13:40: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: 133629 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp5895861ljb; Wed, 18 Apr 2018 06:44:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx49kXndSxoxMgqUL/njD7aH5Tql/1wS+2/aRJHFqJwddVuS28bA0/55pj1iR+LREmPlLWSxm X-Received: by 10.80.146.166 with SMTP id k35mr3284763eda.110.1524059048407; Wed, 18 Apr 2018 06:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524059048; cv=none; d=google.com; s=arc-20160816; b=sIJ2hhwWXyYFKRt2OeGTAnyh7mUAtQyXu3z1DMUoDmgtyoSRDaolvVCT3hLdNd/A+4 UyDmSroZWZXy0juofBmiqyV2iETyu2QK1ghsHDrmCQDZZTc+MRA/Z6+Ozykkf1S0/J/J zaOWV4gxasS0NHmjbEwpYYGT1NFTJ9G0TqN8+Lp0MDRDPCCxd399N6g98TrWdlQR9vRL PWBu8R5fFU2U2m0eiBwpw0bz9EXguwDQrPocmWjE1S4I08lVNgg4VuK/pyUrNILjxk2J HcSk9OcSd/wq2Aa0axdTBjcg2vXd4rCx2X6kawMUBxV2MwSNbgV67CZ57FPJMonGpdku Y/dg== 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=5eTxJ6E/l952YcXOQZg6VPk3DuBDklkoGC6miocZPLE=; b=GgMDIoMAZjD0QyazkFKdJwHV4JcH+9nbAshCWiTqlyWLcylvECxjPwjf72iQpdkuaK 3zk4zcXzPU0v28VpuzOfkubv1voxQDv9EKU7jq5JSpIebTazzFyhKKZVRf9XE2rBb4w5 Yrgv3mGIXz47ahsdrfvXKDlU623lEH2MEhU6yS4e2l5E3RZWVfMG2C6LbNbS5PO48ch1 xZBaaZH6tPBPPlnmLdkb7VG7X9xjS9ehAt70Z9TmZzL8gkOvYE23dXuXVu7+LD0NuZ7O neayaLLX485U2ccEClCMQAXxj5NLPH8Ri6tT0wLmiG6Y3n9Zx/Pc7JqXilpDkKuUEaHd LfTg== 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 z3si632655eda.417.2018.04.18.06.44.08; Wed, 18 Apr 2018 06:44:08 -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 D04F0C21C8B; Wed, 18 Apr 2018 13:42:06 +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=RCVD_IN_DNSWL_BLOCKED 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 CF6B8C21F00; Wed, 18 Apr 2018 13:40:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 87335C21D4A; Wed, 18 Apr 2018 13:40:34 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id A2E7FC21C93 for ; Wed, 18 Apr 2018 13:40:33 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 040CEAC99; Wed, 18 Apr 2018 13:40:33 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Wed, 18 Apr 2018 15:40:28 +0200 Message-Id: <20180418134030.55127-7-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180418134030.55127-1-agraf@suse.de> References: <20180418134030.55127-1-agraf@suse.de> Cc: Heinrich Schuchardt , Greentime Hu Subject: [U-Boot] [PATCH 6/8] distro: Extend with RISC-V defines 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" While we don't have VCI or UEFI naming conventions for RISC-V file paths yet, we need to search for something. So let's make up a few defines that at least allow us to get started until the specs officially include RISC-V. Signed-off-by: Alexander Graf --- include/config_distro_bootcmd.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index f567cebd38..7b95872958 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -100,6 +100,10 @@ #define BOOTEFI_NAME "bootia32.efi" #elif defined(CONFIG_X86_RUN_64BIT) #define BOOTEFI_NAME "bootx64.efi" +#elif defined(CONFIG_CPU_RISCV_32) +#define BOOTEFI_NAME "bootrv32.efi" +#elif defined(CONFIG_CPU_RISCV_64) +#define BOOTEFI_NAME "bootrv64.efi" #endif #endif @@ -250,7 +254,15 @@ #elif defined(CONFIG_X86) /* Always assume we're running 64bit */ #define BOOTENV_EFI_PXE_ARCH "0x7" -#define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00007:UNDI:003000" +#define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:0000:UNDI:003000" +#elif defined(CONFIG_CPU_RISCV_32) +/* TODO: Register VCI identifier via RFC */ +#define BOOTENV_EFI_PXE_ARCH "0x5032" +#define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:5032:UNDI:003000" +#elif defined(CONFIG_CPU_RISCV_64) +/* TODO: Register VCI identifier via RFC */ +#define BOOTENV_EFI_PXE_ARCH "0x5064" +#define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:5064:UNDI:003000" #else #error Please specify an EFI client identifier #endif From patchwork Wed Apr 18 13:40:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 133626 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp5895173ljb; Wed, 18 Apr 2018 06:43:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/V83Df0xSx7qyJrTn0wPrKnIoIdD6OClTypH616uWlryR7XRMn0fDg6iz2P20phCZxm9Yl X-Received: by 10.80.136.81 with SMTP id c17mr3219809edc.211.1524059003387; Wed, 18 Apr 2018 06:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524059003; cv=none; d=google.com; s=arc-20160816; b=0Qv/7g8NrUAP5SiIDT4VFujkdW3N9IifsZjybON6OuLeqfriAiNgnL3N8NIJEP5ikb 74qYRitLcz6zImtfb+ChF+zUJ0CzyfI2aHS/MZ22YMsZmzoIVFRnuAQHttEcWuULkpS9 4BktnyKbVoHPBtyIyZ6dbCXLW+9smH3XYI0olfWnXgtlVRwkwj2kKBPzvynB5muX0oYn nVb+wgarZ0DLUuo4IpNRSTWYg32CUH8p8+/zyXSezrw9YWfwrpWUCh/Y+TvKsikRCwqs vU0HqZNSlhTGzVY9e/+tlyoplYQ+HN+jXOMAqCE925c7H2H2hkcwYDBxb4aSasMbbJvX heEw== 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=m/49hZyaBWv8+T9KV58SXA4zMrUiuG5mBleY4wcmPr4=; b=tLWQ+9FNAGGzR79R4E19XtlD0n238hrcReziw8U389VEZ50+59R2EEnvLj2482uuOf IrnoFfBWvOJimRnnzdLm33gDhVoPLHpacjL9G4jYDbMnlb+2MVdnnnCs/LWc9THzRlfv 9YEh8lYUDeBjPFv5YfXlKhwwqSVwSuKb+XdpKWBJCI1GsE3I7dh6SqKMAGwkms4WE1Xx LQYs4/TT2Kb+ajNKWBD1QqWMzObRnG2HzVRFU3Rw7rv50WzcBxHwC9SW6wwp3pe1CXBl UFgCTaCrqX1wVNMqohYPpgwIE1iznOATlXIg++yCSIxPYkM5ugGbUjkzq5eTop+hiEUw BGMA== 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 v45si1588239edc.307.2018.04.18.06.43.22; Wed, 18 Apr 2018 06:43:23 -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 C021DC21EE4; Wed, 18 Apr 2018 13:41:49 +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=RCVD_IN_DNSWL_BLOCKED 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 971D4C21ECE; Wed, 18 Apr 2018 13:40:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 77503C21C93; Wed, 18 Apr 2018 13:40:34 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id A3F09C21D4A for ; Wed, 18 Apr 2018 13:40:33 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 16F76AD7F; Wed, 18 Apr 2018 13:40:33 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Wed, 18 Apr 2018 15:40:29 +0200 Message-Id: <20180418134030.55127-8-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180418134030.55127-1-agraf@suse.de> References: <20180418134030.55127-1-agraf@suse.de> Cc: Heinrich Schuchardt , Greentime Hu Subject: [U-Boot] [PATCH 7/8] riscv: nx25: Enable distro boot 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" Distro boot allows for a common boot path on systems that allow distributions to easily boot from a default configuration. This patch enables distro boot for the nx25-ae250. Hopefully this can serve as a good example for new boards, so they enable it as well. Signed-off-by: Alexander Graf --- configs/nx25-ae250_defconfig | 1 + include/configs/nx25-ae250.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/configs/nx25-ae250_defconfig b/configs/nx25-ae250_defconfig index 4f9bd58f75..437083231b 100644 --- a/configs/nx25-ae250_defconfig +++ b/configs/nx25-ae250_defconfig @@ -37,3 +37,4 @@ CONFIG_DM_SPI=y CONFIG_ATCSPI200_SPI=y CONFIG_TIMER=y CONFIG_ATCPIT100_TIMER=y +CONFIG_DISTRO_DEFAULTS=y diff --git a/include/configs/nx25-ae250.h b/include/configs/nx25-ae250.h index 0e4c431cab..a90c75abc4 100644 --- a/include/configs/nx25-ae250.h +++ b/include/configs/nx25-ae250.h @@ -105,4 +105,21 @@ /* Increase max gunzip size */ #define CONFIG_SYS_BOOTM_LEN (64 << 20) +/* When we use RAM as ENV */ +#define CONFIG_ENV_SIZE 0x2000 + +/* Enable distro boot */ +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) \ + func(DHCP, dhcp, na) +#include + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "kernel_addr_r=0x00080000\0" \ + "pxefile_addr_r=0x01f00000\0" \ + "scriptaddr=0x01f00000\0" \ + "fdt_addr_r=0x02000000\0" \ + "ramdisk_addr_r=0x02800000\0" \ + BOOTENV + #endif /* __CONFIG_H */ From patchwork Wed Apr 18 13:40:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 133623 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp5892722ljb; Wed, 18 Apr 2018 06:40:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx48z3crL5Hf2yHR7S/eOoXVTTJBqiMjyK1CB4tjMIG2vRuOc8p/NrOtep/EDxXB1LQQalRxW X-Received: by 10.80.169.120 with SMTP id m53mr3299472edc.180.1524058844268; Wed, 18 Apr 2018 06:40:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524058844; cv=none; d=google.com; s=arc-20160816; b=MrzWnMWn4UhYZoUptGhPONBHx0C6XqXaS6VuPoNitNtqjf4crGvhQ5WPgpCIGEq+Gi Fe41aAudsGpRnYfaEm2MPdS09+Q+h2zeAXsDmnnAz98b9x7bVfmnsEeeZTGgPtwnD8EI Ch1fzbxGz8qmhKYFxfHuUFnaNxxdDjnDvXeDlH3se/QAhzOkdeVYU3fsNffTMAknPmUj pJIBL9xZ0lKAcp2ij/tZpdcDZrt81sqE3ivy9wr246yWRuPKwFBsVOfI+OW6Wfta1XQq Y1bmKwsXuzZvyJG621Ip/L/xlJolPJSMtjP+zknGRRrxJW4E5R+jMJbQnqwLttxGxQ+2 i0AA== 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=zufw9GTTvbPpLbfWkfofexfb9sKxbsz83Vfl1Dqpb1c=; b=g26qpO0HNWZXbXfeYkVOX153AUdvcPmbB5bV8E3jofrckNKM8riyBlcnjfD/qvdmJJ 654t7BfU7q16YRNRoD+AdK6CWM7Rf1QEfD4RxetO6KBvIXlfTfblnfdJ9W5cCEFL+vak p893xPz4XDnSlwsyoCzlRrtzE1a1HbSWtPKxoM1GBJKwc06qKw0rqCladQej31ocJkKl E1XGwln3lD7IvUO2aR5KnTW/7/q1oXSx1ZgJfCKKB+4wTWqr3DrATahmaA01MDoaEfBj ByvlQBKKEaT0MQ/xDMeainjQLeLVzh1yEjJPNg3JhVc54BYXZDgwW2lJbj4viEVVlAan eUOQ== 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 e12si1506781edk.133.2018.04.18.06.40.43; Wed, 18 Apr 2018 06:40:44 -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 B22F8C21F19; Wed, 18 Apr 2018 13:40:38 +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=RCVD_IN_DNSWL_BLOCKED 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 6CD62C21C93; Wed, 18 Apr 2018 13:40:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2E263C21E34; Wed, 18 Apr 2018 13:40:34 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id A4B6CC21DD4 for ; Wed, 18 Apr 2018 13:40:33 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1988DADE1; Wed, 18 Apr 2018 13:40:33 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Wed, 18 Apr 2018 15:40:30 +0200 Message-Id: <20180418134030.55127-9-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180418134030.55127-1-agraf@suse.de> References: <20180418134030.55127-1-agraf@suse.de> Cc: Heinrich Schuchardt , Greentime Hu Subject: [U-Boot] [PATCH 8/8] efi_loader: Enable RISC-V support 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" We have almost all pieces needed to support RISC-V UEFI binaries in place already. The only missing piece are ELF relocations for runtime code and data. This patch adds respective support in the linker script and the runtime relocation code. It also allows users to enable the EFI_LOADER configuration switch on RISC-V platforms. Signed-off-by: Alexander Graf --- arch/riscv/cpu/nx25/u-boot.lds | 16 ++++++++++++++++ lib/efi_loader/Kconfig | 2 +- lib/efi_loader/efi_runtime.c | 41 ++++++++++++++++++++++++++++++++++++----- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/arch/riscv/cpu/nx25/u-boot.lds b/arch/riscv/cpu/nx25/u-boot.lds index 936fd779aa..508fa7e58d 100644 --- a/arch/riscv/cpu/nx25/u-boot.lds +++ b/arch/riscv/cpu/nx25/u-boot.lds @@ -38,6 +38,22 @@ SECTIONS KEEP(*(SORT(.u_boot_list*))); } + . = ALIGN(4); + + .efi_runtime : { + __efi_runtime_start = .; + *(efi_runtime_text) + *(efi_runtime_data) + __efi_runtime_stop = .; + } + + .efi_runtime_rel : { + __efi_runtime_rel_start = .; + *(.relaefi_runtime_text) + *(.relaefi_runtime_data) + __efi_runtime_rel_stop = .; + } + . = ALIGN(4); /DISCARD/ : { *(.rela.plt*) } diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 83d75c4fdc..9de58bb012 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -1,6 +1,6 @@ config EFI_LOADER bool "Support running EFI Applications in U-Boot" - depends on (ARM || X86) && OF_LIBFDT + depends on (ARM || X86 || RISCV) && OF_LIBFDT # We need EFI_STUB_64BIT to be set on x86_64 with EFI_STUB depends on !EFI_STUB || !X86_64 || EFI_STUB_64BIT # We need EFI_STUB_32BIT to be set on x86_32 with EFI_STUB diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 573a5d6ac1..33bbc8d6cc 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -41,6 +41,25 @@ static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void); #include #define R_RELATIVE R_386_RELATIVE #define R_MASK 0xffULL +#elif defined(CONFIG_RISCV) +#include +#define R_RELATIVE R_RISCV_RELATIVE +#define R_MASK 0xffULL +#define IS_RELA 1 + +struct dyn_sym { + ulong foo1; + ulong addr; + u32 foo2; + u32 foo3; +}; +#ifdef CONFIG_CPU_RISCV_32 +#define R_ABSOLUTE R_RISCV_32 +#define SYM_INDEX 8 +#else +#define R_ABSOLUTE R_RISCV_64 +#define SYM_INDEX 32 +#endif #else #error Need to add relocation awareness #endif @@ -247,15 +266,27 @@ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map) p = (void*)((ulong)rel->offset - base) + gd->relocaddr; - if ((rel->info & R_MASK) != R_RELATIVE) { - continue; - } + debug("%s: rel->info=%#lx *p=%#lx rel->offset=%p\n", __func__, rel->info, *p, rel->offset); + switch (rel->info & R_MASK) { + case R_RELATIVE: #ifdef IS_RELA - newaddr = rel->addend + offset - CONFIG_SYS_TEXT_BASE; + newaddr = rel->addend + offset - CONFIG_SYS_TEXT_BASE; #else - newaddr = *p - lastoff + offset; + newaddr = *p - lastoff + offset; #endif + break; +#ifdef R_ABSOLUTE + case R_ABSOLUTE: { + ulong symidx = rel->info >> SYM_INDEX; + extern struct dyn_sym __dyn_sym_start[]; + newaddr = __dyn_sym_start[symidx].addr + offset; + break; + } +#endif + default: + continue; + } /* Check if the relocation is inside bounds */ if (map && ((newaddr < map->virtual_start) ||