Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160420841
D38704.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D38704.diff
View Options
diff --git a/sys/riscv/include/sbi.h b/sys/riscv/include/sbi.h
--- a/sys/riscv/include/sbi.h
+++ b/sys/riscv/include/sbi.h
@@ -166,10 +166,10 @@
extern u_long sbi_impl_id;
extern u_long sbi_impl_version;
-static __inline long
-sbi_probe_extension(long id)
+static __inline bool
+sbi_has_extension(long id)
{
- return (SBI_CALL1(SBI_EXT_ID_BASE, SBI_BASE_PROBE_EXTENSION, id).value);
+ return (SBI_CALL1(SBI_EXT_ID_BASE, SBI_BASE_PROBE_EXTENSION, id).value != 0);
}
/* TIME extension functions. */
diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c
--- a/sys/riscv/riscv/machdep.c
+++ b/sys/riscv/riscv/machdep.c
@@ -201,7 +201,7 @@
* simple wfi loop.
*/
intr_disable();
- if (sbi_probe_extension(SBI_EXT_ID_HSM) != 0)
+ if (sbi_has_extension(SBI_EXT_ID_HSM))
sbi_hsm_hart_stop();
for (;;)
__asm __volatile("wfi");
diff --git a/sys/riscv/riscv/mp_machdep.c b/sys/riscv/riscv/mp_machdep.c
--- a/sys/riscv/riscv/mp_machdep.c
+++ b/sys/riscv/riscv/mp_machdep.c
@@ -468,7 +468,7 @@
* Depending on the SBI implementation, APs are waiting either in
* locore.S or to be activated explicitly, via SBI call.
*/
- if (sbi_probe_extension(SBI_EXT_ID_HSM) != 0) {
+ if (sbi_has_extension(SBI_EXT_ID_HSM)) {
start_addr = pmap_kextract((vm_offset_t)mpentry);
error = sbi_hsm_hart_start(hart, start_addr, 0);
if (error != 0) {
diff --git a/sys/riscv/riscv/sbi.c b/sys/riscv/riscv/sbi.c
--- a/sys/riscv/riscv/sbi.c
+++ b/sys/riscv/riscv/sbi.c
@@ -283,37 +283,37 @@
mimpid = sbi_get_mimpid().value;
/* Probe for legacy replacement extensions. */
- if (sbi_probe_extension(SBI_EXT_ID_TIME) != 0)
+ if (sbi_has_extension(SBI_EXT_ID_TIME))
has_time_extension = true;
- if (sbi_probe_extension(SBI_EXT_ID_IPI) != 0)
+ if (sbi_has_extension(SBI_EXT_ID_IPI))
has_ipi_extension = true;
- if (sbi_probe_extension(SBI_EXT_ID_RFNC) != 0)
+ if (sbi_has_extension(SBI_EXT_ID_RFNC))
has_rfnc_extension = true;
- if (sbi_probe_extension(SBI_EXT_ID_SRST) != 0)
+ if (sbi_has_extension(SBI_EXT_ID_SRST))
has_srst_extension = true;
/*
* Probe for legacy extensions. We still rely on many of them to be
* implemented, but this is not guaranteed by the spec.
*/
- KASSERT(has_time_extension || sbi_probe_extension(SBI_SET_TIMER) != 0,
+ KASSERT(has_time_extension || sbi_has_extension(SBI_SET_TIMER),
("SBI doesn't implement sbi_set_timer()"));
- KASSERT(sbi_probe_extension(SBI_CONSOLE_PUTCHAR) != 0,
+ KASSERT(sbi_has_extension(SBI_CONSOLE_PUTCHAR),
("SBI doesn't implement sbi_console_putchar()"));
- KASSERT(sbi_probe_extension(SBI_CONSOLE_GETCHAR) != 0,
+ KASSERT(sbi_has_extension(SBI_CONSOLE_GETCHAR),
("SBI doesn't implement sbi_console_getchar()"));
- KASSERT(has_ipi_extension || sbi_probe_extension(SBI_SEND_IPI) != 0,
+ KASSERT(has_ipi_extension || sbi_has_extension(SBI_SEND_IPI),
("SBI doesn't implement sbi_send_ipi()"));
KASSERT(has_rfnc_extension ||
- sbi_probe_extension(SBI_REMOTE_FENCE_I) != 0,
+ sbi_has_extension(SBI_REMOTE_FENCE_I),
("SBI doesn't implement sbi_remote_fence_i()"));
KASSERT(has_rfnc_extension ||
- sbi_probe_extension(SBI_REMOTE_SFENCE_VMA) != 0,
+ sbi_has_extension(SBI_REMOTE_SFENCE_VMA),
("SBI doesn't implement sbi_remote_sfence_vma()"));
KASSERT(has_rfnc_extension ||
- sbi_probe_extension(SBI_REMOTE_SFENCE_VMA_ASID) != 0,
+ sbi_has_extension(SBI_REMOTE_SFENCE_VMA_ASID),
("SBI doesn't implement sbi_remote_sfence_vma_asid()"));
- KASSERT(has_srst_extension || sbi_probe_extension(SBI_SHUTDOWN) != 0,
+ KASSERT(has_srst_extension || sbi_has_extension(SBI_SHUTDOWN),
("SBI doesn't implement a shutdown or reset extension"));
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jun 25, 7:34 AM (19 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34311689
Default Alt Text
D38704.diff (3 KB)
Attached To
Mode
D38704: sbi: boolify sbi_probe_extension()
Attached
Detach File
Event Timeline
Log In to Comment