Patrick Georgi | 11f0079 | 2020-03-04 15:10:45 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Patrick Georgi | 3d76725 | 2018-03-15 14:04:35 +0100 | [diff] [blame] | 2 | |
Patrick Georgi | 3d76725 | 2018-03-15 14:04:35 +0100 | [diff] [blame] | 3 | #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 | */ |
| 12 | static 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 | } |