On 6/1/22 03:25, Xiaojuan Yang wrote:
Signed-off-by: Xiaojuan Yang <[email protected]>
Signed-off-by: Song Gao <[email protected]>
---
hw/loongarch/loongson3.c | 45 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
Acked-by: Richard Henderson <[email protected]>
+#define PM_BASE 0x10080000
+#define PM_SIZE 0x100
+#define PM_CTRL 0x10
+
+static uint64_t loongarch_virt_pm_read(void *opaque, hwaddr addr, unsigned
size)
+{
+ return 0;
+}
+
+static void loongarch_virt_pm_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+ if (addr != PM_CTRL) {
+ return;
+ }
+
+ switch (val) {
+ case 0x00:
+ qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
+ return;
+ case 0xff:
+ qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
+ return;
+ default:
+ return;
+ }
+}
It would be nice to add a comment that this is a placeholder for missing ACPI, and will
eventually be replaced.
r~