blob: e6db9dcf04e438cc0339520bc5f9a47a1d5b13af [file] [log] [blame]
Patrick Georgi11f00792020-03-04 15:10:45 +01001/* SPDX-License-Identifier: GPL-2.0-only */
Patrick Georgi3d767252018-03-15 14:04:35 +01002
Patrick Georgi3d767252018-03-15 14:04:35 +01003#include <stdint.h>
4#include <cpu/x86/smm.h>
5
6/*
7 * calls into SMM with the given cmd and subcmd in eax, and arg in ebx
8 *
9 * static inline because the resulting assembly is often smaller than
10 * the call sequence due to constant folding.
11 */
12static inline u32 call_smm(u8 cmd, u8 subcmd, void *arg)
13{
14 u32 res = 0;
15 __asm__ __volatile__ (
16 "outb %b0, %3"
17 : "=a" (res)
18 : "a" ((subcmd << 8) | cmd), "b" (arg), "i" (APM_CNT));
19 return res;
20}