arch/x86/include/smm: use inline asm from drivers/smmstore/ramstage

The call_smm function is currently unused and the inline assembly code
for more or less the same functionality in drivers/smmstore/ramstage is
both a bit easier to understand since it uses the register names in the
'outb' instruction instead of positional arguments, and also tells the
compiler that this piece of code might change global memory. Having too
much in the clobber list might only have some performance impact, which
should however be negligible compared to the SMI handler being called,
while missing something in the clobber list might cause hard to debug
problems.

This is a preparation to make drivers/smmstore/ramstage use call_smm
instead of having its own inline assembly implementation for this.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I73837cab75429014897486b38a5c56f93a850f96
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79827
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
This commit is contained in:
Felix Held 2024-01-04 17:52:41 +01:00
parent b895d55748
commit 8dd5b9dd2a
1 changed files with 5 additions and 2 deletions

View File

@ -13,8 +13,11 @@ static inline u32 call_smm(u8 cmd, u8 subcmd, void *arg)
{
u32 res = 0;
__asm__ __volatile__ (
"outb %b0, %3"
"outb %%al, %%dx"
: "=a" (res)
: "a" ((subcmd << 8) | cmd), "b" (arg), "i" (APM_CNT));
: "a" ((subcmd << 8) | cmd),
"b" (arg),
"d" (APM_CNT)
: "memory");
return res;
}