RISC-V: Print SBI info at startup
SBI version 0.2 introduces functions for obtaining the details of the SBI implementation, such as version and implemntation ID. Print this info at startup when it is available. Reviewed by: jhb, kp MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D22327
This commit is contained in:
parent
0a0f40c768
commit
a109294221
@ -201,6 +201,7 @@ sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
|
||||
start, size, asid);
|
||||
}
|
||||
|
||||
void sbi_print_version(void);
|
||||
void sbi_init(void);
|
||||
|
||||
#endif /* !_MACHINE_SBI_H_ */
|
||||
|
@ -128,6 +128,7 @@ static void
|
||||
cpu_startup(void *dummy)
|
||||
{
|
||||
|
||||
sbi_print_version();
|
||||
identify_cpu();
|
||||
|
||||
printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)realmem),
|
||||
|
@ -35,6 +35,10 @@ __FBSDID("$FreeBSD$");
|
||||
#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;
|
||||
@ -76,6 +80,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
|
||||
sbi_init(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user