1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <acpi/acpi_pm.h>
7 #include <console/console.h>
10 static const char *pm_fetch_failure_msg
[PS_CLAIMER_MAX
] = {
11 [PS_CLAIMER_ELOG
] = "no event recorded in ELOG.",
12 [PS_CLAIMER_RTC
] = "RTC init aborted.",
13 [PS_CLAIMER_WAKE
] = "wake source unknown.",
16 void __weak
mainboard_suspend_resume(void)
20 /* Default mapping to ACPI FADT preferred_pm_profile field. */
21 uint8_t acpi_get_preferred_pm_profile(void)
23 switch (smbios_mainboard_enclosure_type()) {
24 case SMBIOS_ENCLOSURE_LAPTOP
:
25 case SMBIOS_ENCLOSURE_CONVERTIBLE
:
27 case SMBIOS_ENCLOSURE_DETACHABLE
:
28 case SMBIOS_ENCLOSURE_TABLET
:
30 case SMBIOS_ENCLOSURE_DESKTOP
:
32 case SMBIOS_ENCLOSURE_UNKNOWN
:
34 return PM_UNSPECIFIED
;
38 struct chipset_power_state
*acpi_get_pm_state(void)
40 static struct chipset_power_state
*acpi_pm_state
;
44 acpi_pm_state
= cbmem_find(CBMEM_ID_POWER_STATE
);
48 int acpi_fetch_pm_state(const struct chipset_power_state
**ps
,
49 enum power_state_claimer ps_claimer
)
51 assert(ps_claimer
< PS_CLAIMER_MAX
);
52 *ps
= acpi_get_pm_state();
55 printk(BIOS_ERR
, "No CBMEM_ID_POWER_STATE entry, %s\n",
56 ps_claimer
< PS_CLAIMER_MAX
?
57 pm_fetch_failure_msg
[ps_claimer
] : "unknown claimer.");