summaryrefslogtreecommitdiff
path: root/src/arch/x86/include/smm_call.h
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2024-01-05 19:05:52 +0100
committerFelix Held <felix-coreboot@felixheld.de>2024-01-10 20:36:16 +0000
commita2b2ac0ed2b39ed3ea7972732521e0d731e50671 (patch)
treee322a68ae0f5d124979184600e5ecf1180036c5b /src/arch/x86/include/smm_call.h
parent8dd5b9dd2ad444e9c1057e1ef67e790dbe343cc8 (diff)
arch/x86/include: rename smm.h to smm_call.h
Rename smm.h to smm_call.h to make including this file look less ambiguous. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Ia907ad92459e835feeddf7eb4743a38f99549179 Reviewed-on: https://review.coreboot.org/c/coreboot/+/79833 Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Diffstat (limited to 'src/arch/x86/include/smm_call.h')
-rw-r--r--src/arch/x86/include/smm_call.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/arch/x86/include/smm_call.h b/src/arch/x86/include/smm_call.h
new file mode 100644
index 0000000000..c0d96c0182
--- /dev/null
+++ b/src/arch/x86/include/smm_call.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <stdint.h>
+#include <cpu/x86/smm.h>
+
+/*
+ * calls into SMM with the given cmd and subcmd in eax, and arg in ebx
+ *
+ * static inline because the resulting assembly is often smaller than
+ * the call sequence due to constant folding.
+ */
+static inline u32 call_smm(u8 cmd, u8 subcmd, void *arg)
+{
+ u32 res = 0;
+ __asm__ __volatile__ (
+ "outb %%al, %%dx"
+ : "=a" (res)
+ : "a" ((subcmd << 8) | cmd),
+ "b" (arg),
+ "d" (APM_CNT)
+ : "memory");
+ return res;
+}