soc/intel/alderlake: Add ADL-P 4+4 with 28W TDP
[coreboot.git] / src / acpi / acpi_pm.c
blob40a3fbd7ad2d1caa8fa84de28337d2fd60e66c89
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpi.h>
4 #include <acpi/acpi_pm.h>
5 #include <assert.h>
6 #include <cbmem.h>
7 #include <console/console.h>
8 #include <smbios.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:
26 return PM_MOBILE;
27 case SMBIOS_ENCLOSURE_DETACHABLE:
28 case SMBIOS_ENCLOSURE_TABLET:
29 return PM_TABLET;
30 case SMBIOS_ENCLOSURE_DESKTOP:
31 return PM_DESKTOP;
32 case SMBIOS_ENCLOSURE_UNKNOWN:
33 default:
34 return PM_UNSPECIFIED;
38 struct chipset_power_state *acpi_get_pm_state(void)
40 static struct chipset_power_state *acpi_pm_state;
41 if (acpi_pm_state)
42 return acpi_pm_state;
44 acpi_pm_state = cbmem_find(CBMEM_ID_POWER_STATE);
45 return acpi_pm_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();
54 if (!*ps) {
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.");
58 return -1;
60 return 0;