git: d5963606f0c6 - main - riscv: add SBI implementation IDs.

From: Ruslan Bukin <br_at_FreeBSD.org>
Date: Tue, 25 Jun 2024 11:32:17 UTC
The branch main has been updated by br:

URL: https://cgit.FreeBSD.org/src/commit/?id=d5963606f0c6c084955c6ed41c92c4cca8edeb36

commit d5963606f0c6c084955c6ed41c92c4cca8edeb36
Author:     Ruslan Bukin <br@FreeBSD.org>
AuthorDate: 2024-06-25 11:25:26 +0000
Commit:     Ruslan Bukin <br@FreeBSD.org>
CommitDate: 2024-06-25 11:25:26 +0000

    riscv: add SBI implementation IDs.
    
    Add new SBI implementation IDs including recently allocated one for bhyve.
    
    Reviewed by:    mhorne
    Sponsored by:   UKRI
    Differential Revision:  https://reviews.freebsd.org/D45696
---
 sys/riscv/include/sbi.h |  6 ++++++
 sys/riscv/riscv/sbi.c   | 27 +++++++++++++++++++++++----
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/sys/riscv/include/sbi.h b/sys/riscv/include/sbi.h
index bd3991e0a89f..c8093238e268 100644
--- a/sys/riscv/include/sbi.h
+++ b/sys/riscv/include/sbi.h
@@ -49,6 +49,12 @@
 #define	SBI_IMPL_ID_KVM			3
 #define	SBI_IMPL_ID_RUSTSBI		4
 #define	SBI_IMPL_ID_DIOSIX		5
+#define	SBI_IMPL_ID_COFFER		6
+#define	SBI_IMPL_ID_XEN_PROJECT		7
+#define	SBI_IMPL_ID_POLARFIRE_HSS	8
+#define	SBI_IMPL_ID_COREBOOT		9
+#define	SBI_IMPL_ID_OREBOOT		10
+#define	SBI_IMPL_ID_BHYVE		11
 
 /* SBI Error Codes */
 #define	SBI_SUCCESS			0
diff --git a/sys/riscv/riscv/sbi.c b/sys/riscv/riscv/sbi.c
index 53eadbe54bc6..b0a05bd88ef1 100644
--- a/sys/riscv/riscv/sbi.c
+++ b/sys/riscv/riscv/sbi.c
@@ -132,6 +132,11 @@ sbi_print_version(void)
 	case (SBI_IMPL_ID_BBL):
 		printf("SBI: Berkely Boot Loader %lu\n", sbi_impl_version);
 		break;
+	case (SBI_IMPL_ID_OPENSBI):
+		major = sbi_impl_version >> OPENSBI_VERSION_MAJOR_OFFSET;
+		minor = sbi_impl_version & OPENSBI_VERSION_MINOR_MASK;
+		printf("SBI: OpenSBI v%u.%u\n", major, minor);
+		break;
 	case (SBI_IMPL_ID_XVISOR):
 		printf("SBI: eXtensible Versatile hypervISOR %lu\n",
 		    sbi_impl_version);
@@ -146,10 +151,24 @@ sbi_print_version(void)
 	case (SBI_IMPL_ID_DIOSIX):
 		printf("SBI: Diosix %lu\n", sbi_impl_version);
 		break;
-	case (SBI_IMPL_ID_OPENSBI):
-		major = sbi_impl_version >> OPENSBI_VERSION_MAJOR_OFFSET;
-		minor = sbi_impl_version & OPENSBI_VERSION_MINOR_MASK;
-		printf("SBI: OpenSBI v%u.%u\n", major, minor);
+	case (SBI_IMPL_ID_COFFER):
+		printf("SBI: Coffer %lu\n", sbi_impl_version);
+		break;
+	case (SBI_IMPL_ID_XEN_PROJECT):
+		printf("SBI: Xen Project %lu\n", sbi_impl_version);
+		break;
+	case (SBI_IMPL_ID_POLARFIRE_HSS):
+		printf("SBI: PolarFire Hart Software Services %lu\n",
+		    sbi_impl_version);
+		break;
+	case (SBI_IMPL_ID_COREBOOT):
+		printf("SBI: coreboot %lu\n", sbi_impl_version);
+		break;
+	case (SBI_IMPL_ID_OREBOOT):
+		printf("SBI: oreboot %lu\n", sbi_impl_version);
+		break;
+	case (SBI_IMPL_ID_BHYVE):
+		printf("SBI: bhyve %lu\n", sbi_impl_version);
 		break;
 	default:
 		printf("SBI: Unrecognized Implementation: %lu\n", sbi_impl_id);