From 541a67a1e10b4592e8ce9c7997cd478ff651ef2b Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Wed, 3 Jan 2024 20:54:18 +0100 Subject: parisc: Enable power button switch and add option to disable it Due to a mismatch of memory mapping for PA2.0 with PSW.W=0, the power button was broken on 64-bit machines. The mapping bug is now fixed in qemu, so re-enable the button again. Additionally add option to completely disable the power switch with: "-fw_cfg opt/power-button-enable,string=0" Signed-off-by: Helge Deller --- src/parisc/parisc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/parisc/parisc.c b/src/parisc/parisc.c index afe248a..5f450f7 100644 --- a/src/parisc/parisc.c +++ b/src/parisc/parisc.c @@ -209,8 +209,7 @@ void __VISIBLE __noreturn hlt(void) static int powerswitch_supported(void) { - /* can't reach powerswitch pointer on 64-bit CPU if ptr above 0xf0000000 */ - return cpu_bit_width == 32 || (unsigned long) powersw_ptr < 0xf0000000; + return powersw_ptr != NULL; } static void check_powersw_button(void) @@ -3041,6 +3040,12 @@ void __VISIBLE start_parisc_firmware(void) powersw_ptr = (int *) (unsigned long) romfile_loadint("/etc/hppa/power-button-addr", (unsigned long)&powersw_nop); + /* allow user to disable power button: "-fw_cfg opt/power-button-enable,string=0" */ + i = romfile_loadstring_to_int("opt/power-button-enable", 1); + if (i == 0) { + powersw_ptr = NULL; + } + /* real-time-clock addr */ rtc_ptr = (int *) (unsigned long) romfile_loadint("/etc/hppa/rtc-addr", (unsigned long) LASI_RTC_HPA); -- cgit v1.1