On Sat, Dec 03, 2022 at 11:48:16PM +0100, Jeremie Courreges-Anglas wrote:
> 
> With the diff below we get more details about the SBI version running on
> the machine.  My Unmatched machine has OpenBSD version 0.9 but upstream
> has released 1.1 since, it implements v0.2 of the SBI spec but 0.3 and
> 1.0 have been released since.  I suspect this information could be
> useful for new boards.
> 
> OpenBSD 7.2-current (GENERIC.MP) #11: Thu Dec  1 23:39:45 CET 2022
>     j...@hifive.wxcvbn.org:/usr/src/sys/arch/riscv64/compile/GENERIC.MP
> real mem  = 17179869184 (16384MB)
> avail mem = 16416411648 (15655MB)
> SBI: OpenSBI v0.9, SBI Specification Version 0.2
> random: good seed from bootblocks
> mainbus0 at root: SiFive HiFive Unmatched A00
> cpu0 at mainbus0: SiFive U7 imp 20181004 rv64imafdc
> intc0 at cpu0
> [...]
> 
> I tweaked the code in sbi.c to put all the information on a single line.
> Printing the information in cpu_startup() seemed the most appropriate
> since this code isn't hooked up in a driver.
> 
> ok?
> 

ok mlarkin if not already done.

> 
> Index: machdep.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/riscv64/riscv64/machdep.c,v
> retrieving revision 1.29
> diff -u -p -r1.29 machdep.c
> --- machdep.c 30 Oct 2022 17:43:40 -0000      1.29
> +++ machdep.c 3 Dec 2022 21:41:55 -0000
> @@ -273,6 +273,8 @@ cpu_startup(void)
>       printf("avail mem = %lu (%luMB)\n", ptoa(uvmexp.free),
>           ptoa(uvmexp.free) / 1024 / 1024);
>  
> +     sbi_print_version();
> +
>       curpcb = &proc0.p_addr->u_pcb;
>       curpcb->pcb_flags = 0;
>       curpcb->pcb_tf = &proc0tf;
> Index: sbi.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/riscv64/riscv64/sbi.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 sbi.c
> --- sbi.c     2 Jul 2021 08:44:37 -0000       1.6
> +++ sbi.c     4 Nov 2022 21:38:54 -0000
> @@ -76,22 +76,22 @@ sbi_print_version(void)
>  
>       switch (sbi_impl_id) {
>       case (SBI_IMPL_ID_BBL):
> -             printf("SBI: Berkely Boot Loader %lu\n", sbi_impl_version);
> +             printf("SBI: Berkely Boot Loader %lu", 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);
> +             printf("SBI: OpenSBI v%u.%u", major, minor);
>               break;
>       default:
> -             printf("SBI: Unrecognized Implementation: %lu\n", sbi_impl_id);
> +             printf("SBI: Unrecognized Implementation: %lu", 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);
> +     printf(", SBI Specification Version %u.%u\n", major, minor);
>  }
>  
>  #ifdef MULTIPROCESSOR
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 

Reply via email to