Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106144035
D22327.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D22327.diff
View Options
Index: head/sys/riscv/include/sbi.h
===================================================================
--- head/sys/riscv/include/sbi.h
+++ head/sys/riscv/include/sbi.h
@@ -201,6 +201,7 @@
start, size, asid);
}
+void sbi_print_version(void);
void sbi_init(void);
#endif /* !_MACHINE_SBI_H_ */
Index: head/sys/riscv/riscv/machdep.c
===================================================================
--- head/sys/riscv/riscv/machdep.c
+++ head/sys/riscv/riscv/machdep.c
@@ -128,6 +128,7 @@
cpu_startup(void *dummy)
{
+ sbi_print_version();
identify_cpu();
printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)realmem),
Index: head/sys/riscv/riscv/sbi.c
===================================================================
--- head/sys/riscv/riscv/sbi.c
+++ head/sys/riscv/riscv/sbi.c
@@ -35,6 +35,10 @@
#include <machine/md_var.h>
#include <machine/sbi.h>
+/* SBI Implementation-Specific Definitions */
+#define OPENSBI_VERSION_MAJOR_OFFSET 16
+#define OPENSBI_VERSION_MINOR_MASK 0xFFFF
+
u_long sbi_spec_version;
u_long sbi_impl_id;
u_long sbi_impl_version;
@@ -74,6 +78,39 @@
sbi_get_mimpid(void)
{
return (SBI_CALL0(SBI_EXT_ID_BASE, SBI_BASE_GET_MIMPID));
+}
+
+void
+sbi_print_version(void)
+{
+ u_int major;
+ u_int minor;
+
+ /* For legacy SBI implementations. */
+ if (sbi_spec_version == 0) {
+ printf("SBI: Unknown (Legacy) Implementation\n");
+ printf("SBI Specification Version: 0.1\n");
+ return;
+ }
+
+ switch (sbi_impl_id) {
+ case (SBI_IMPL_ID_BBL):
+ printf("SBI: Berkely Boot Loader %u\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;
+ default:
+ printf("SBI: Unrecognized Implementation: %u\n", sbi_impl_id);
+ break;
+ }
+
+ major = (sbi_spec_version & SBI_SPEC_VERS_MAJOR_MASK) >>
+ SBI_SPEC_VERS_MAJOR_OFFSET;
+ minor = (sbi_spec_version & SBI_SPEC_VERS_MINOR_MASK);
+ printf("SBI Specification Version: %u.%u\n", major, minor);
}
void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 3:12 AM (12 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15602633
Default Alt Text
D22327.diff (2 KB)
Attached To
Mode
D22327: RISC-V: Print SBI info at startup
Attached
Detach File
Event Timeline
Log In to Comment