From patchwork Wed Dec 12 07:11:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1011639 X-Patchwork-Delegate: uboot@andestech.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="jhLcwTrC"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43F7bg2Qkyz9s8J for ; Wed, 12 Dec 2018 18:24:15 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E00AEC228D5; Wed, 12 Dec 2018 07:17:27 +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 47BA1C228F6; Wed, 12 Dec 2018 07:07:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 83547C228FD; Wed, 12 Dec 2018 07:06:54 +0000 (UTC) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by lists.denx.de (Postfix) with ESMTPS id D7466C22671 for ; Wed, 12 Dec 2018 07:06:49 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id b5so8170902plr.4 for ; Tue, 11 Dec 2018 23:06:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=k95xJhcPH2yiCC1D3qV2RkTAQkP9ZnOdFe6epH3hUMY=; b=jhLcwTrC2GRaQxlP6p3JpBlWL8onT/KEb1Ik8sEel9Zt/JEsqHsqtMy3DiracLh2Td Tw1kyyNrKpSUnxRe2pXBVbhWh2+p3zX9LrZsiAS1I2REBehhuD2nj2MPFAzzNhFkYXmZ RKYc060sWiqtTYoYLXy8WcMjQPBHMZAPWbcABCd4Q5unOrw3BI6Hsce0jG2Nx1hew8ko X96rTARFaBD45nlZittAVnNBMxtlLvFFCUiGMhasNYLByPkeKWsEGwe0pDkKfqfdMcjc GmD7wqmSQ2ujpG333pHJ3H4WWG/DmzvHgmwAPUfFIRhFhvb9STZlBgwafQsPQMbNeRlW Dv2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=k95xJhcPH2yiCC1D3qV2RkTAQkP9ZnOdFe6epH3hUMY=; b=CBLmR3igmdEs9S39FYYzmSRdVtbEh1o1X53UG1XcLncPYLbofjiHeJ9IGmmDEcNDU2 azaPYpMlC/M2f9DcD72NHgWoEoVMvFoomZN0YXKT7Otell3YHZFZ6Z7qjXXhY+/BmO4X oY0+4UZVHgl+Ku2lUfS3kSKvX6N5+uJFKbZ3jgRUFSuDQZahUPaF0eDk3vOwLM7Tjga6 dfAiFBSAOAsK/T/5CPthP8Tn5R/62MF1EsqQbh44mMa9qdLNeZNtd/im6w79uOhyK/H3 qZujTDI4R/W1MVjXRbWRBN1Q5wcYhmhcW3MdapDByeHIHkg7uXF5QjdNsKMly8yVHzZE 76Tg== X-Gm-Message-State: AA+aEWZTu6GS0G+ull4e6rHEW2+cIyhIfGVxCYzJzbrkj1c0QbcWcQNk uq6cru300YzXJrGU+fdluh4= X-Google-Smtp-Source: AFSGD/WJ62U9Mr0ywCMUes1IOQIsjEoqxEmCOXeU2+V1bi6XT+bKVg1dEvIueV8N4/m7uVEU6Tssog== X-Received: by 2002:a17:902:59d6:: with SMTP id d22mr19264260plj.10.1544598408129; Tue, 11 Dec 2018 23:06:48 -0800 (PST) Received: from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com. [147.11.156.139]) by smtp.gmail.com with ESMTPSA id z9sm37330096pfd.99.2018.12.11.23.06.47 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Dec 2018 23:06:47 -0800 (PST) From: Bin Meng To: Rick Chen , Simon Glass , Lukas Auer , Anup Patel , U-Boot Mailing List Date: Tue, 11 Dec 2018 23:11:24 -0800 Message-Id: <1544598686-14130-24-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1544598686-14130-1-git-send-email-bmeng.cn@gmail.com> References: <1544598686-14130-1-git-send-email-bmeng.cn@gmail.com> Subject: [U-Boot] [PATCH v4 23/25] riscv: Save boot hart id to the global data 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" At present the hart id passed via a0 in the U-Boot entry is saved to s0 at the beginning but does not preserve later. Save it to the global data structure so that it can be used later. Signed-off-by: Bin Meng Reviewed-by: Lukas Auer --- Changes in v4: None Changes in v3: - new patch to save boot hart id to the global data Changes in v2: None arch/riscv/cpu/start.S | 4 ++++ arch/riscv/include/asm/global_data.h | 1 + arch/riscv/lib/asm-offsets.c | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 arch/riscv/lib/asm-offsets.c diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index 47c3bf0..81ea52b 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -14,6 +14,7 @@ #include #include #include +#include #ifdef CONFIG_32BIT #define LREG lw @@ -70,6 +71,9 @@ call_board_init_f_0: jal board_init_f_init_reserve + /* save the boot hart id to global_data */ + SREG s0, GD_BOOT_HART(gp) + mv a0, zero /* a0 <-- boot_flags = 0 */ la t5, board_init_f jr t5 /* jump to board_init_f() */ diff --git a/arch/riscv/include/asm/global_data.h b/arch/riscv/include/asm/global_data.h index 46fcfab..a3a342c 100644 --- a/arch/riscv/include/asm/global_data.h +++ b/arch/riscv/include/asm/global_data.h @@ -12,6 +12,7 @@ /* Architecture-specific global data */ struct arch_global_data { + long boot_hart; /* boot hart id */ #ifdef CONFIG_SIFIVE_CLINT void __iomem *clint; /* clint base address */ #endif diff --git a/arch/riscv/lib/asm-offsets.c b/arch/riscv/lib/asm-offsets.c new file mode 100644 index 0000000..e0b71f5 --- /dev/null +++ b/arch/riscv/lib/asm-offsets.c @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018, Bin Meng + * + * From arch/x86/lib/asm-offsets.c + * + * This program is used to generate definitions needed by + * assembly language modules. + */ + +#include +#include + +int main(void) +{ + DEFINE(GD_BOOT_HART, offsetof(gd_t, arch.boot_hart)); + + return 0; +}