1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <console/console.h>
5 #include <cpu/x86/smm.h>
9 static void apmc_log(const char *fn
, u8 cmd
)
12 case APM_CNT_ACPI_DISABLE
:
13 printk(BIOS_DEBUG
, "%s: Disabling ACPI.\n", fn
);
15 case APM_CNT_ACPI_ENABLE
:
16 printk(BIOS_DEBUG
, "%s: Enabling ACPI.\n", fn
);
18 case APM_CNT_FINALIZE
:
19 printk(BIOS_DEBUG
, "%s: Finalizing SMM.\n", fn
);
21 case APM_CNT_ELOG_GSMI
:
23 case APM_CNT_SMMSTORE
:
28 printk(BIOS_DEBUG
, "%s: Unknown APMC 0x%02x.\n", fn
, cmd
);
33 enum cb_err
apm_control(u8 cmd
)
35 /* Never proceed inside SMI handler or without one. */
36 if (ENV_SMM
|| !CONFIG(HAVE_SMI_HANDLER
))
39 apmc_log(__func__
, cmd
);
41 /* Now raise the SMI. */
42 call_smm(cmd
, 0, NULL
);
44 printk(BIOS_DEBUG
, "APMC done.\n");
50 /* Read command byte from APMC SMI IO port */
51 u8 cmd
= inb(pm_acpi_smi_cmd_port());
53 apmc_log("SMI#", cmd
);