Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- arch/sparc64/openbios.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
diff --git a/arch/sparc64/openbios.c b/arch/sparc64/openbios.c index c0e1d0d..46d44ea 100644 --- a/arch/sparc64/openbios.c +++ b/arch/sparc64/openbios.c @@ -120,6 +120,28 @@ sparc64_reset_all(void) : : "r" (val), "r" (addr) : "memory"); }
+/* Power off */ +static void +sparc64_power_off(void) +{ + /* Locate address of ebus power device */ + phandle_t ph; + uint32_t addr; + volatile uint32_t *p; + int len; + + ph = find_dev("/pci/pci@1,1/ebus/power"); + if (ph) { + addr = get_int_property(ph, "address", &len); + + if (len) { + /* Set bit 24 to invoke power off */ + p = cell2pointer(addr); + *p = 0x1000000; + } + } +} + /* PCI Target Address Space Register (see UltraSPARC IIi User's Manual section 19.3.0.4) */ #define PBM_PCI_TARGET_AS 0x2028 @@ -727,6 +749,11 @@ arch_init( void ) bind_func("spacel@", spacel_read); bind_func("spacex@", spacex_read);
+ /* Bind power functions */ + bind_func("sparc64-power-off", sparc64_power_off); + push_str("' sparc64-power-off to power-off"); + fword("eval"); + bind_func("platform-boot", boot ); }