From 3d76725c415c2cae751fab62fdc51f505896af38 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Thu, 15 Mar 2018 14:04:35 +0100 Subject: arch/x86: add SMM caller Useful for debugging or for cases where we need to enter SMM. Probably should be moved to commonlib or libpayload. Change-Id: I7a9cc626dae9a7751034615ef409eebc6035f5c3 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/25193 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/arch/x86/include/smm.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/arch/x86/include/smm.h (limited to 'src/arch') diff --git a/src/arch/x86/include/smm.h b/src/arch/x86/include/smm.h new file mode 100644 index 0000000000..d66e8906d6 --- /dev/null +++ b/src/arch/x86/include/smm.h @@ -0,0 +1,34 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2018 Google LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include + +/* + * 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 %b0, %3" + : "=a" (res) + : "a" ((subcmd << 8) | cmd), "b" (arg), "i" (APM_CNT)); + return res; +} -- cgit v1.2.3