[OpenBIOS] [PATCH 2/5] SPARC32: implement power-off word

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Mon Jan 15 22:04:33 CET 2018


Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 drivers/obio.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/obio.c b/drivers/obio.c
index a3778f4..12cdb46 100644
--- a/drivers/obio.c
+++ b/drivers/obio.c
@@ -224,6 +224,12 @@ volatile unsigned char *power_reg;
 volatile unsigned int *reset_reg;
 
 static void
+sparc32_power_off(void)
+{
+    *power_reg = 1;
+}
+
+static void
 sparc32_reset_all(void)
 {
     *reset_reg = 1;
@@ -237,6 +243,10 @@ ob_aux2_reset_init(uint64_t base, uint64_t offset, int intr)
 
     power_reg = (void *)ob_reg(base, offset, AUXIO2_REGS, 1);
 
+    bind_func("sparc32-power-off", sparc32_power_off);
+    push_str("' sparc32-power-off to power-off");
+    fword("eval");
+
     // Not in device tree
     reset_reg = (unsigned int *)ofmem_map_io(base + (uint64_t)SLAVIO_RESET, RESET_REGS);
 
-- 
2.11.0




More information about the OpenBIOS mailing list