[PATCH] Add system reboot extension


Anup Patel
 

This patch adds SBI v0.2 compliant system reboot extension. It defines
two functions:
1. sbi_reboot - A system reboot call with reboot type as parameter
2. sbi_shutdown - A system shutdown/poweroff call

The sbi_shutdown function defined here replaces SBI v0.1 shutdown
function.

Signed-off-by: Atish Patra <atish.patra@...>
Signed-off-by: Anup Patel <anup.patel@...>
---
riscv-sbi.adoc | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)

diff --git a/riscv-sbi.adoc b/riscv-sbi.adoc
index 8137686..a39e362 100644
--- a/riscv-sbi.adoc
+++ b/riscv-sbi.adoc
@@ -615,6 +615,70 @@ state of the hart at the time of return value verification.
| sbi_hart_get_status | 2 | 0x48534D
|===

+== System Reboot Extension, Extension ID: 0x53524254 (SRBT)
+
+The System Reboot Extension provides a set of functions that allow the
+supervisor software to request system-level reboot or shutdown.
+
+[source, C]
+----
+struct sbiret sbi_system_reboot(unsigned long reboot_type)
+----
+
+Reboot the system based on provided reboot type. This is a synchronous call
+and is not expected to return if succeeds.
+
+The reboot_type parameter is 32 bit wide and has following possible values:
+
+[cols="<,>",options="header,compact"]
+|===
+| Value | Description
+| 0x00000000 | Cold reboot
+| 0x00000001 | Warm reboot
+| 0x00000002 - 0xEFFFFFFF | Reserved for future use
+| 0xF0000000 - 0xFFFFFFFF | Vendor or platform specific reboot type
+| 0x100000000 - 2^XELN-1 | Reserved for RV64/RV128
+|===
+
+*Returns* one of the following possible SBI error codes through sbiret.error
+upon failure.
+
+Cold reboot results in complete power cycle of the entire system while
+warm reboot depends on SOC vendor design choices.
+
+[cols="<,>",options="header,compact"]
+|===
+| Error code | Description
+| SBI_ERR_INVALID_PARAM | `reboot_type` is not valid.
+| SBI_ERR_FAILED | Reboot request failed for unknown reasons.
+|===
+
+[source, C]
+----
+struct sbiret sbi_system_shutdown()
+----
+
+Shutdown the system. This is a synchronous call and is not expected to
+return if succeeds.
+
+*Returns* one of the following possible SBI error codes through sbiret.error
+upon failure.
+
+[cols="<,>",options="header,compact"]
+|===
+| Error code | Description
+| SBI_ERR_FAILED | The start request failed for unknown reasons.
+|===
+
+=== SRBT Function Listing
+
+[cols="<,,>",options="header,compact"]
+|===
+| Function Name | Function ID | Extension ID
+| sbi_system_reboot | 0 | 0x53524254
+| sbi_system_shutdown | 1 | 0x53524254
+|===
+
== Experimental SBI Extension Space, Extension IDs 0x0800000 through 0x08FFFFFF

No management.
--
2.17.1

Join tech-unixplatformspec@lists.riscv.org to automatically receive all group messages.