drivers/smmstore/ramstage.c: retry smmstore init up 5 times
Retry calling the SMI 5 times in case the initial write to APM did not
cause SMM entry immediately.
Fixes occasional SMMSTORE initialization failure on Clevo NV4xPZ with
Intel i5-1240P processor. The issue was especially evident when all
logging in coreboot was disabled.
Based on SMMSTORE implementation in MrChromebox's fork of EDK2:
27854bc8c5
Change-Id: I8929af25c4f69873bbdd835fde5cb60fc324b6ab
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
This commit is contained in:
committed by
Tim Crawford
parent
d9977a9fa9
commit
5f608c9734
@@ -8,6 +8,7 @@
|
|||||||
#include <smmstore.h>
|
#include <smmstore.h>
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <cbmem.h>
|
#include <cbmem.h>
|
||||||
|
#include <delay.h>
|
||||||
|
|
||||||
static struct smmstore_params_info info;
|
static struct smmstore_params_info info;
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@ static void init_store(void *unused)
|
|||||||
struct smmstore_params_init args;
|
struct smmstore_params_init args;
|
||||||
uint32_t eax = ~0;
|
uint32_t eax = ~0;
|
||||||
uint32_t ebx;
|
uint32_t ebx;
|
||||||
|
uint8_t retry = 5;
|
||||||
|
|
||||||
if (smmstore_get_info(&info) < 0) {
|
if (smmstore_get_info(&info) < 0) {
|
||||||
printk(BIOS_INFO, "SMMSTORE: Failed to get meta data\n");
|
printk(BIOS_INFO, "SMMSTORE: Failed to get meta data\n");
|
||||||
@@ -57,14 +59,24 @@ static void init_store(void *unused)
|
|||||||
|
|
||||||
printk(BIOS_INFO, "SMMSTORE: Setting up SMI handler\n");
|
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__ (
|
* Issue SMI using APM to update the com buffer and to lock the SMMSTORE.
|
||||||
"outb %%al, %%dx"
|
* Retry 5 times in case the SMI isn't triggered immediately.
|
||||||
: "=a" (eax)
|
*/
|
||||||
: "a" ((SMMSTORE_CMD_INIT << 8) | APM_CNT_SMMSTORE),
|
do {
|
||||||
"b" (ebx),
|
__asm__ __volatile__ (
|
||||||
"d" (APM_CNT)
|
"outb %%al, %%dx"
|
||||||
: "memory");
|
: "=a" (eax)
|
||||||
|
: "a" ((SMMSTORE_CMD_INIT << 8) | APM_CNT_SMMSTORE),
|
||||||
|
"b" (ebx),
|
||||||
|
"d" (APM_CNT)
|
||||||
|
: "memory");
|
||||||
|
|
||||||
|
if (eax == SMMSTORE_RET_SUCCESS)
|
||||||
|
break;
|
||||||
|
|
||||||
|
mdelay(1);
|
||||||
|
} while (retry--);
|
||||||
|
|
||||||
if (eax != SMMSTORE_RET_SUCCESS) {
|
if (eax != SMMSTORE_RET_SUCCESS) {
|
||||||
printk(BIOS_ERR, "SMMSTORE: Failed to install com buffer\n");
|
printk(BIOS_ERR, "SMMSTORE: Failed to install com buffer\n");
|
||||||
|
Reference in New Issue
Block a user