Skip to content

Commit 1cb1310

Browse files
committed
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 <[email protected]>
1 parent 254e7dc commit 1cb1310

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/drivers/smmstore/ramstage.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,22 @@ static void init_store(void *unused)
5757

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

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

69-
if (eax != SMMSTORE_RET_SUCCESS) {
70-
printk(BIOS_ERR, "SMMSTORE: Failed to install com buffer\n");
71-
return;
70+
if (eax == SMMSTORE_RET_SUCCESS) {
71+
printk(BIOS_INFO, "SMMSTORE: Installed com buffer\n");
72+
break;
73+
}
74+
75+
printk(BIOS_ERR, "SMMSTORE: Failed to install com buffer: 0x%x\n", eax);
7276
}
7377
}
7478

0 commit comments

Comments
 (0)