Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Chen <vincent.chen@sifive.com>
To: linux-riscv@lists.infradead.org, palmer@dabbelt.com,
	paul.walmsley@sifive.com
Cc: Frank.Zhao@starfivetech.com, anup.patel@wdc.com,
	atish.patra@wdc.com, guoren@kernel.org, alankao@andestech.com,
	ruinland@andestech.com, david.abdurachmanov@sifive.com,
	Vincent Chen <vincent.chen@sifive.com>
Subject: [PATCH v3 1/5] riscv: Add 3 SBI wrapper functions to get cpu manufacturer information
Date: Mon, 22 Mar 2021 22:26:02 +0800	[thread overview]
Message-ID: <1616423166-13857-2-git-send-email-vincent.chen@sifive.com> (raw)
In-Reply-To: <1616423166-13857-1-git-send-email-vincent.chen@sifive.com>

Add 3 wrapper functions to get vendor id, architecture id and implement id
from M-mode

Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
---
 arch/riscv/include/asm/sbi.h |  3 +++
 arch/riscv/kernel/sbi.c      | 15 +++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
index 99895d9c3bdd..dd2329962ceb 100644
--- a/arch/riscv/include/asm/sbi.h
+++ b/arch/riscv/include/asm/sbi.h
@@ -97,6 +97,9 @@ struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
 
 void sbi_console_putchar(int ch);
 int sbi_console_getchar(void);
+long sbi_get_mvendorid(void);
+long sbi_get_marchid(void);
+long sbi_get_mimpid(void);
 void sbi_set_timer(uint64_t stime_value);
 void sbi_shutdown(void);
 void sbi_clear_ipi(void);
diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
index f4a7db3d309e..ead7e3fec104 100644
--- a/arch/riscv/kernel/sbi.c
+++ b/arch/riscv/kernel/sbi.c
@@ -547,6 +547,21 @@ static inline long sbi_get_firmware_version(void)
 	return __sbi_base_ecall(SBI_EXT_BASE_GET_IMP_VERSION);
 }
 
+long sbi_get_mvendorid(void)
+{
+	return __sbi_base_ecall(SBI_EXT_BASE_GET_MVENDORID);
+}
+
+long sbi_get_marchid(void)
+{
+	return __sbi_base_ecall(SBI_EXT_BASE_GET_MARCHID);
+}
+
+long sbi_get_mimpid(void)
+{
+	return __sbi_base_ecall(SBI_EXT_BASE_GET_MIMPID);
+}
+
 static void sbi_send_cpumask_ipi(const struct cpumask *target)
 {
 	struct cpumask hartid_mask;
-- 
2.7.4


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2021-03-22 14:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 14:26 [PATCH v3 0/5] riscv: introduce alternative mechanism to apply errata patches Vincent Chen
2021-03-22 14:26 ` Vincent Chen [this message]
2021-03-22 14:26 ` [PATCH v3 2/5] riscv: Introduce alternative mechanism to apply errata solution Vincent Chen
2021-03-22 14:26 ` [PATCH v3 3/5] riscv: sifive: Add SiFive alternative ports Vincent Chen
2021-03-22 14:26 ` [PATCH v3 4/5] riscv: sifive: Apply errata "cip-453" patch Vincent Chen
2021-03-22 14:26 ` [PATCH v3 5/5] riscv: sifive: Apply errata "cip-1200" patch Vincent Chen
2021-04-11 20:35 ` [PATCH v3 0/5] riscv: introduce alternative mechanism to apply errata patches Palmer Dabbelt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1616423166-13857-2-git-send-email-vincent.chen@sifive.com \
    --to=vincent.chen@sifive.com \
    --cc=Frank.Zhao@starfivetech.com \
    --cc=alankao@andestech.com \
    --cc=anup.patel@wdc.com \
    --cc=atish.patra@wdc.com \
    --cc=david.abdurachmanov@sifive.com \
    --cc=guoren@kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=ruinland@andestech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox