git: c0ca5378047b - main - riscv: Add the T-Head C908 and C920v2 marchid values
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 26 Nov 2026 16:23:05 UTC
The branch main has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=c0ca5378047b429d4db72de6470e555bf936ad03
commit c0ca5378047b429d4db72de6470e555bf936ad03
Author: Han Gao <gaohan@iscas.ac.cn>
AuthorDate: 2026-10-30 10:34:41 +0000
Commit: Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-11-26 16:22:43 +0000
riscv: Add the T-Head C908 and C920v2 marchid values
Older T-Head cores report a zero marchid, but the C908 and C920v2 have
their own: 0x8000000009140d00 and 0x80000000090c0d00, as read on the
Zhihe A210, whose firmware also uses them to tell its two clusters
apart. Add them so that these cores are named instead of "Unknown".
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
Reviewed by: mhorne
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/2584
---
sys/riscv/include/cpu.h | 4 ++++
sys/riscv/riscv/identcpu.c | 8 +++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/sys/riscv/include/cpu.h b/sys/riscv/include/cpu.h
index fcd78c092018..082f1783703a 100644
--- a/sys/riscv/include/cpu.h
+++ b/sys/riscv/include/cpu.h
@@ -89,6 +89,10 @@
/* SpacemiT marchid values */
#define MARCHID_SPACEMIT_K1 MARCHID_COMMERCIAL(0x58000001)
+/* T-Head marchid values */
+#define MARCHID_THEAD_C908 MARCHID_COMMERCIAL(0x09140d00)
+#define MARCHID_THEAD_C920V2 MARCHID_COMMERCIAL(0x090c0d00)
+
/*
* MMU virtual-addressing modes. Support for each level implies the previous,
* so Sv48-enabled systems MUST support Sv39, etc.
diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c
index 5cdd5b883997..33208191c336 100644
--- a/sys/riscv/riscv/identcpu.c
+++ b/sys/riscv/riscv/identcpu.c
@@ -140,6 +140,12 @@ static const struct marchid_entry spacemit_marchids[] = {
MARCHID_END
};
+static const struct marchid_entry thead_marchids[] = {
+ { MARCHID_THEAD_C908, "C908" },
+ { MARCHID_THEAD_C920V2, "C920v2" },
+ MARCHID_END
+};
+
/*
* Known CPU vendor/manufacturer table.
*/
@@ -150,7 +156,7 @@ static const struct {
} mvendor_ids[] = {
{ MVENDORID_UNIMPL, "Unspecified", NULL },
{ MVENDORID_SIFIVE, "SiFive", sifive_marchids },
- { MVENDORID_THEAD, "T-Head", NULL },
+ { MVENDORID_THEAD, "T-Head", thead_marchids },
{ MVENDORID_SPACEMIT, "SpacemiT", spacemit_marchids },
};