lib/smbios: Improve Type9
[coreboot2.git] / src / cpu / x86 / smi_trigger.c
blob52c72472b218d1ec85c96928137cc53255ab019c
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <arch/io.h>
4 #include <console/console.h>
5 #include <cpu/x86/smm.h>
6 #include <smm_call.h>
7 #include <stdint.h>
9 static void apmc_log(const char *fn, u8 cmd)
11 switch (cmd) {
12 case APM_CNT_ACPI_DISABLE:
13 printk(BIOS_DEBUG, "%s: Disabling ACPI.\n", fn);
14 break;
15 case APM_CNT_ACPI_ENABLE:
16 printk(BIOS_DEBUG, "%s: Enabling ACPI.\n", fn);
17 break;
18 case APM_CNT_FINALIZE:
19 printk(BIOS_DEBUG, "%s: Finalizing SMM.\n", fn);
20 break;
21 case APM_CNT_ELOG_GSMI:
22 break;
23 case APM_CNT_SMMSTORE:
24 break;
25 case APM_CNT_SMMINFO:
26 break;
27 default:
28 printk(BIOS_DEBUG, "%s: Unknown APMC 0x%02x.\n", fn, cmd);
29 break;
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))
37 return CB_ERR;
39 apmc_log(__func__, cmd);
41 /* Now raise the SMI. */
42 call_smm(cmd, 0, NULL);
44 printk(BIOS_DEBUG, "APMC done.\n");
45 return CB_SUCCESS;
48 u8 apm_get_apmc(void)
50 /* Read command byte from APMC SMI IO port */
51 u8 cmd = inb(pm_acpi_smi_cmd_port());
53 apmc_log("SMI#", cmd);
54 return cmd;