1 // SPDX-License-Identifier: GPL-2.0+
3 * The 'sbi' command displays information about the SBI implementation.
21 static struct sbi_imp implementations[] = {
22 { 0, "Berkeley Boot Loader (BBL)" },
30 { 8, "PolarFire Hart Software Services" },
36 static struct sbi_ext extensions[] = {
37 { SBI_EXT_0_1_SET_TIMER, "Set Timer" },
38 { SBI_EXT_0_1_CONSOLE_PUTCHAR, "Console Putchar" },
39 { SBI_EXT_0_1_CONSOLE_GETCHAR, "Console Getchar" },
40 { SBI_EXT_0_1_CLEAR_IPI, "Clear IPI" },
41 { SBI_EXT_0_1_SEND_IPI, "Send IPI" },
42 { SBI_EXT_0_1_REMOTE_FENCE_I, "Remote FENCE.I" },
43 { SBI_EXT_0_1_REMOTE_SFENCE_VMA, "Remote SFENCE.VMA" },
44 { SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID, "Remote SFENCE.VMA with ASID" },
45 { SBI_EXT_0_1_SHUTDOWN, "System Shutdown" },
46 { SBI_EXT_BASE, "SBI Base Functionality" },
47 { SBI_EXT_TIME, "Timer Extension" },
48 { SBI_EXT_IPI, "IPI Extension" },
49 { SBI_EXT_RFENCE, "RFENCE Extension" },
50 { SBI_EXT_HSM, "Hart State Management Extension" },
51 { SBI_EXT_SRST, "System Reset Extension" },
52 { SBI_EXT_PMU, "Performance Monitoring Unit Extension" },
53 { SBI_EXT_DBCN, "Debug Console Extension" },
54 { SBI_EXT_SUSP, "System Suspend Extension" },
55 { SBI_EXT_CPPC, "Collaborative Processor Performance Control Extension" },
56 { SBI_EXT_NACL, "Nested Acceleration Extension" },
57 { SBI_EXT_STA, "Steal-time Accounting Extension" },
58 { SBI_EXT_SSE, "Supervisor Software Events" },
59 { SBI_EXT_FWFT, "Firmware Features Extension" },
60 { SBI_EXT_DBTR, "Debug Triggers Extension" },
61 { SBI_EXT_MPXY, "Message Proxy Extension" },
64 static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
69 long mvendorid, marchid, mimpid;
71 ret = sbi_get_spec_version();
73 printf("No SBI 0.2+\n");
74 return CMD_RET_FAILURE;
76 printf("SBI %ld.%ld", ret >> 24, ret & 0xffffff);
77 impl_id = sbi_get_impl_id();
79 for (i = 0; i < ARRAY_SIZE(implementations); ++i) {
80 if (impl_id == implementations[i].id) {
83 printf("\n%s ", implementations[i].name);
84 ret = sbi_get_impl_version(&vers);
89 case 8: /* PolarFire Hart Software Services */
91 vers >> 16, vers & 0xffff);
101 printf("0x%lx", vers);
107 if (i == ARRAY_SIZE(implementations))
108 printf("\nUnknown implementation ID 0x%x", impl_id);
110 printf("\nMachine:\n");
111 ret = sbi_get_mvendorid(&mvendorid);
113 printf(" Vendor ID %lx\n", mvendorid);
114 ret = sbi_get_marchid(&marchid);
116 printf(" Architecture ID %lx\n", marchid);
117 ret = sbi_get_mimpid(&mimpid);
119 printf(" Implementation ID %lx\n", mimpid);
120 printf("Extensions:\n");
121 for (i = 0; i < ARRAY_SIZE(extensions); ++i) {
122 ret = sbi_probe_extension(extensions[i].id);
124 printf(" %s\n", extensions[i].name);
130 "- display SBI spec version, implementation, and available extensions");
134 "display SBI information",