mb/google/fatcat: Suppress unnecessary extra space in device trees
[coreboot2.git] / src / arch / x86 / include / smm_call.h
blobdc780399e0ecf205d5e1cf00bb306dc08aacc543
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <stdint.h>
4 #include <cpu/x86/smm.h>
6 /*
7 * Call the APMC SMI handler that resides in SMM. First, the command and sub-command are stored
8 * in eax, and the argument pointer is stored in ebx, then the command byte is written to the
9 * APMC IO port to trigger the SMI. The APMC SMI handler then reads the command from the APMC
10 * IO port and the contents of eax and ebx from the SMM state save area.
12 * static inline because the resulting assembly is often smaller than
13 * the call sequence due to constant folding.
15 static inline u32 call_smm(u8 cmd, u8 subcmd, void *arg)
17 const uint16_t apmc_port = pm_acpi_smi_cmd_port();
18 u32 res = 0;
19 __asm__ __volatile__ (
20 "outb %%al, %%dx"
21 : "=a" (res)
22 : "a" ((subcmd << 8) | cmd),
23 "b" (arg),
24 "d" (apmc_port)
25 : "memory");
26 return res;