Felix Held submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Matt DeVillier: Looks good to me, approved
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>
---
M src/arch/x86/include/smm.h
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/arch/x86/include/smm.h b/src/arch/x86/include/smm.h
index e6db9dc..c0d96c0 100644
--- a/src/arch/x86/include/smm.h
+++ b/src/arch/x86/include/smm.h
@@ -13,8 +13,11 @@
{
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;
}

To view, visit change 79827. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I73837cab75429014897486b38a5c56f93a850f96
Gerrit-Change-Number: 79827
Gerrit-PatchSet: 5
Gerrit-Owner: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Jérémy Compostella <jeremy.compostella@intel.com>
Gerrit-Reviewer: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged