drivers/smmstore: Retry APM SCI if it fails

For some reason, the APM SCI to install the SMMSTORE comm buffer
regularly, but not always, fails with 0x4ed on ADL. In this case, a
second attempt seems to always complete successfully.

Tested on system76/darp8 and system76/galp6.

Change-Id: I843116113b8c24f1aee42f9d9042cdc0471a1b43
Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2023-09-07 14:10:14 -06:00
committed by Tim Crawford
parent 254e7dca82
commit 1cb13106c9

View File

@@ -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);
}
}