Tom Rini
2022-04-06 11:52:17 -04:00
6 changed files with 84 additions and 5 deletions

View File

@@ -248,7 +248,7 @@ config SYS_MALLOC_F_LEN
hex "Size of malloc() pool before relocation"
depends on SYS_MALLOC_F
default 0x1000 if AM33XX
default 0x4000 if SANDBOX
default 0x4000 if SANDBOX || RISCV
default 0x2000 if (ARCH_IMX8 || ARCH_IMX8M || ARCH_MX7 || \
ARCH_MX7ULP || ARCH_MX6 || ARCH_MX5 || \
ARCH_LS1012A || ARCH_LS1021A || ARCH_LS1043A || \

View File

@@ -195,9 +195,6 @@ config ANDES_PLIC
The Andes PLIC block holds memory-mapped claim and pending registers
associated with software interrupt.
config SYS_MALLOC_F_LEN
default 0x1000
config SMP
bool "Symmetric Multi-Processing"
depends on SBI_V01 || !RISCV_SMODE

View File

@@ -27,6 +27,7 @@ enum sbi_ext_id {
SBI_EXT_RFENCE = 0x52464E43,
SBI_EXT_HSM = 0x48534D,
SBI_EXT_SRST = 0x53525354,
SBI_EXT_PMU = 0x504D55,
};
enum sbi_ext_base_fid {
@@ -154,6 +155,9 @@ long sbi_get_spec_version(void);
int sbi_get_impl_id(void);
int sbi_get_impl_version(long *version);
int sbi_probe_extension(int ext);
int sbi_get_mvendorid(long *mvendorid);
int sbi_get_marchid(long *marchid);
int sbi_get_mimpid(long *mimpid);
void sbi_srst_reset(unsigned long type, unsigned long reason);
#endif

View File

@@ -127,6 +127,71 @@ int sbi_probe_extension(int extid)
return -ENOTSUPP;
}
/**
* sbi_get_mvendorid() - get machine vendor ID
*
* @mimpid: on return machine vendor ID
* Return: 0 on success
*/
int sbi_get_mvendorid(long *mvendorid)
{
struct sbiret ret;
ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_GET_MVENDORID,
0, 0, 0, 0, 0, 0);
if (ret.error)
return -ENOTSUPP;
if (mvendorid)
*mvendorid = ret.value;
return 0;
}
/**
* sbi_get_marchid() - get machine architecture ID
*
* @mimpid: on return machine architecture ID
* Return: 0 on success
*/
int sbi_get_marchid(long *marchid)
{
struct sbiret ret;
ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_GET_MARCHID,
0, 0, 0, 0, 0, 0);
if (ret.error)
return -ENOTSUPP;
if (marchid)
*marchid = ret.value;
return 0;
}
/**
* sbi_get_mimpid() - get machine implementation ID
*
* @mimpid: on return machine implementation ID
* Return: 0 on success
*/
int sbi_get_mimpid(long *mimpid)
{
struct sbiret ret;
ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_GET_MIMPID,
0, 0, 0, 0, 0, 0);
if (ret.error)
return -ENOTSUPP;
if (mimpid)
*mimpid = ret.value;
return 0;
}
/**
* sbi_srst_reset() - invoke system reset extension
*

View File

@@ -37,6 +37,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
imply SPL_RAM_DEVICE
imply CMD_PCI
imply CMD_POWEROFF
imply CMD_SBI
imply CMD_SCSI
imply CMD_PING
imply CMD_EXT2

View File

@@ -44,6 +44,7 @@ static struct sbi_ext extensions[] = {
{ SBI_EXT_RFENCE, "RFENCE Extension" },
{ SBI_EXT_HSM, "Hart State Management Extension" },
{ SBI_EXT_SRST, "System Reset Extension" },
{ SBI_EXT_PMU, "Performance Monitoring Unit Extension" },
};
static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
@@ -51,6 +52,7 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
{
int i, impl_id;
long ret;
long mvendorid, marchid, mimpid;
ret = sbi_get_spec_version();
if (ret >= 0)
@@ -76,7 +78,17 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
if (i == ARRAY_SIZE(implementations))
printf("Unknown implementation ID %ld", ret);
}
printf("\nExtensions:\n");
printf("\nMachine:\n");
ret = sbi_get_mvendorid(&mvendorid);
if (!ret)
printf(" Vendor ID %lx\n", mvendorid);
ret = sbi_get_marchid(&marchid);
if (!ret)
printf(" Architecture ID %lx\n", marchid);
ret = sbi_get_mimpid(&mimpid);
if (!ret)
printf(" Implementation ID %lx\n", mimpid);
printf("Extensions:\n");
for (i = 0; i < ARRAY_SIZE(extensions); ++i) {
ret = sbi_probe_extension(extensions[i].id);
if (ret > 0)