lib: Add platform features in boot time print

We have now clear distinction between platform and hart features.
Modify the boot print messages to print platform features in a string
format. In the process, this patch moved relatively larger functions
to its own file from platform.h header file.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Tested-by: Jonathan Balkind <jbalkind@cs.princeton.edu>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
Atish Patra
2020-05-09 16:47:31 -07:00
committed by Anup Patel
parent ec0d2a7d7d
commit 1f235ec47f
4 changed files with 158 additions and 27 deletions

View File

@@ -18,6 +18,7 @@
#include <sbi/sbi_ipi.h>
#include <sbi/sbi_platform.h>
#include <sbi/sbi_system.h>
#include <sbi/sbi_string.h>
#include <sbi/sbi_timer.h>
#include <sbi/sbi_tlb.h>
#include <sbi/sbi_version.h>
@@ -34,8 +35,10 @@
static void sbi_boot_prints(struct sbi_scratch *scratch, u32 hartid)
{
int xlen;
int xlen, ret;
char str[64];
int max_fstr_len = 128;
char features[128];
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
#ifdef OPENSBI_VERSION_GIT
@@ -59,6 +62,14 @@ static void sbi_boot_prints(struct sbi_scratch *scratch, u32 hartid)
sbi_printf("Platform Name : %s\n", sbi_platform_name(plat));
sbi_printf("Platform HART Count : %u\n",
sbi_platform_hart_count(plat));
sbi_memset(features, 0, max_fstr_len);
ret = sbi_platform_get_features_str(plat, features, max_fstr_len);
if (!ret)
sbi_printf("Platform Features : %s\n", features);
else
sbi_printf("Platform Features : %s\n", "none");
/* Boot HART details */
sbi_printf("Boot HART ID : %u\n", hartid);
sbi_printf("Boot HART ISA : %s\n", str);