• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <bootmode.h>
4 #include <stdint.h>
5 #include <acpi/acpi.h>
6 #include <console/console.h>
7 
8 #include "pmclib.h"
9 #include "pmbase.h"
10 #include "pmutil.h"
11 
clear_power_state(void)12 static void clear_power_state(void)
13 {
14 	uint32_t pm1_cnt = read_pmbase32(PM1_CNT);
15 	write_pmbase32(PM1_CNT, pm1_cnt & ~SLP_TYP);
16 }
17 
southbridge_detect_s3_resume(void)18 int southbridge_detect_s3_resume(void)
19 {
20 	if (platform_is_resuming()) {
21 		clear_power_state();
22 		if (!acpi_s3_resume_allowed()) {
23 			printk(BIOS_DEBUG, "SB: Resume from S3 detected, but disabled.\n");
24 			return 0;
25 		}
26 
27 		printk(BIOS_DEBUG, "SB: Resume from S3 detected.\n");
28 		return 1;
29 	}
30 
31 	return 0;
32 }
33