Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/smmstore: Retry APM SCI if it fails #195

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/drivers/smmstore/ramstage.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,22 @@ static void init_store(void *unused)

printk(BIOS_INFO, "SMMSTORE: Setting up SMI handler\n");

/* Issue SMI using APM to update the com buffer and to lock the SMMSTORE */
__asm__ __volatile__ (
"outb %%al, %%dx"
: "=a" (eax)
: "a" ((SMMSTORE_CMD_INIT << 8) | APM_CNT_SMMSTORE),
"b" (ebx),
"d" (APM_CNT)
: "memory");
for (int retries = 0; retries < 3; retries++) {
/* Issue SMI using APM to update the com buffer and to lock the SMMSTORE */
__asm__ __volatile__ (
"outb %%al, %%dx"
: "=a" (eax)
: "a" ((SMMSTORE_CMD_INIT << 8) | APM_CNT_SMMSTORE),
"b" (ebx),
"d" (APM_CNT)
: "memory");

if (eax != SMMSTORE_RET_SUCCESS) {
printk(BIOS_ERR, "SMMSTORE: Failed to install com buffer\n");
return;
if (eax == SMMSTORE_RET_SUCCESS) {
printk(BIOS_INFO, "SMMSTORE: Installed com buffer\n");
break;
}

printk(BIOS_ERR, "SMMSTORE: Failed to install com buffer: 0x%x\n", eax);
}
}

Expand Down