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__ ( |
Felix Held | 8dd5b9d | 2024-01-04 17:52:41 +0100 | [diff] [blame^] | 16 | "outb %%al, %%dx" |
Patrick Georgi | 3d76725 | 2018-03-15 14:04:35 +0100 | [diff] [blame] | 17 | : "=a" (res) |
Felix Held | 8dd5b9d | 2024-01-04 17:52:41 +0100 | [diff] [blame^] | 18 | : "a" ((subcmd << 8) | cmd), |
| 19 | "b" (arg), |
| 20 | "d" (APM_CNT) |
| 21 | : "memory"); |
Patrick Georgi | 3d76725 | 2018-03-15 14:04:35 +0100 | [diff] [blame] | 22 | return res; |
| 23 | } |