Commit 7db54bfe authored by Huacai Chen's avatar Huacai Chen
Browse files

LoongArch: Add hibernation (ACPI S4) support



Add hibernation (Suspend to Disk, aka ACPI S4) support for LoongArch.

Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 366bb35a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -521,6 +521,9 @@ menu "Power management options"
config ARCH_SUSPEND_POSSIBLE
	def_bool y

config ARCH_HIBERNATION_POSSIBLE
	def_bool y

source "kernel/power/Kconfig"
source "drivers/acpi/Kconfig"

+12 −0
Original line number Diff line number Diff line
@@ -257,3 +257,15 @@ void output_smpboot_defines(void)
	BLANK();
}
#endif

#ifdef CONFIG_HIBERNATION
void output_pbe_defines(void)
{
	COMMENT(" Linux struct pbe offsets. ");
	OFFSET(PBE_ADDRESS, pbe, address);
	OFFSET(PBE_ORIG_ADDRESS, pbe, orig_address);
	OFFSET(PBE_NEXT, pbe, next);
	DEFINE(PBE_SIZE, sizeof(struct pbe));
	BLANK();
}
#endif
+5 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <acpi/reboot.h>
#include <asm/idle.h>
#include <asm/loongarch.h>
#include <asm/loongson.h>

void (*pm_power_off)(void);
EXPORT_SYMBOL(pm_power_off);
@@ -41,6 +42,10 @@ void machine_power_off(void)
#ifdef CONFIG_SMP
	preempt_disable();
	smp_send_stop();
#endif
#ifdef CONFIG_PM
	if (!acpi_disabled)
		enable_pci_wakeup();
#endif
	do_kernel_power_off();
#ifdef CONFIG_EFI
+5 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <linux/libfdt.h>
#include <linux/of_fdt.h>
#include <linux/of_address.h>
#include <linux/suspend.h>
#include <linux/swiotlb.h>

#include <asm/addrspace.h>
@@ -370,6 +371,10 @@ static void __init arch_mem_init(char **cmdline_p)

	dma_contiguous_reserve(PFN_PHYS(max_low_pfn));

	/* Reserve for hibernation. */
	register_nosave_region(PFN_DOWN(__pa_symbol(&__nosave_begin)),
				   PFN_UP(__pa_symbol(&__nosave_end)));

	memblock_dump_all();

	early_memtest(PFN_PHYS(ARCH_PFN_OFFSET), PFN_PHYS(max_low_pfn));
+1 −0
Original line number Diff line number Diff line
obj-y	+= platform.o

obj-$(CONFIG_SUSPEND)		+= suspend.o suspend_asm.o
obj-$(CONFIG_HIBERNATION)	+= hibernate.o hibernate_asm.o
Loading