From d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 11 Dec 2023 02:45:28 +0000
Subject: [PATCH] add boot partition  size

---
 kernel/arch/riscv/kernel/reset.c |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/kernel/arch/riscv/kernel/reset.c b/kernel/arch/riscv/kernel/reset.c
index 2a53d26..9c842c4 100644
--- a/kernel/arch/riscv/kernel/reset.c
+++ b/kernel/arch/riscv/kernel/reset.c
@@ -1,21 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 2012 Regents of the University of California
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation, version 2.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
  */
 
 #include <linux/reboot.h>
-#include <linux/export.h>
-#include <asm/sbi.h>
+#include <linux/pm.h>
 
-void (*pm_power_off)(void) = machine_power_off;
+static void default_power_off(void)
+{
+	while (1)
+		wait_for_interrupt();
+}
+
+void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 
 void machine_restart(char *cmd)
@@ -26,11 +23,16 @@
 
 void machine_halt(void)
 {
-	machine_power_off();
+	if (pm_power_off != NULL)
+		pm_power_off();
+	else
+		default_power_off();
 }
 
 void machine_power_off(void)
 {
-	sbi_shutdown();
-	while (1);
+	if (pm_power_off != NULL)
+		pm_power_off();
+	else
+		default_power_off();
 }

--
Gitblit v1.6.2