haswell/lynxpoint: Add native early ME init

Implement native early ME init for Lynx Point. This is only needed when
MRC.bin is not used.

Change-Id: If416e2078f139f26b4742c564b70e018725bf003
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64178
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Angel Pons
2022-05-06 22:18:21 +02:00
committed by Felix Held
parent 567ece44ea
commit 322b1c3d90
3 changed files with 50 additions and 4 deletions

View File

@@ -1,11 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/io.h>
#include <cf9_reset.h>
#include <device/pci_ops.h>
#include <console/console.h>
#include <delay.h>
#include <halt.h>
#include <timer.h>
#include "me.h"
#include "pch.h"
@@ -60,6 +61,33 @@ int intel_early_me_init(void)
return 0;
}
bool intel_early_me_cpu_replacement_check(void)
{
printk(BIOS_DEBUG, "ME: Checking whether CPU was replaced... ");
struct stopwatch timer;
stopwatch_init_msecs_expire(&timer, 50);
union me_hfs2 hfs2;
do {
hfs2.raw = pci_read_config32(PCH_ME_DEV, PCI_ME_HFS2);
if (stopwatch_expired(&timer)) {
/* Assume CPU was replaced just in case */
printk(BIOS_DEBUG, "timed out, assuming CPU was replaced\n");
return true;
}
udelay(ME_DELAY);
} while (!hfs2.cpu_replaced_valid);
if (hfs2.warm_reset_request) {
printk(BIOS_DEBUG, "warm reset needed for dynamic fusing\n");
system_reset();
}
printk(BIOS_DEBUG, "%sreplaced\n", hfs2.cpu_replaced_sts ? "" : "not ");
return hfs2.cpu_replaced_sts;
}
int intel_early_me_uma_size(void)
{
union me_uma uma = { .raw = pci_read_config32(PCH_ME_DEV, PCI_ME_UMA) };

View File

@@ -177,14 +177,16 @@ union me_did {
union me_hfs2 {
struct __packed {
u32 bist_in_progress: 1;
u32 reserved1: 2;
u32 icc_prog_sts: 2;
u32 invoke_mebx: 1;
u32 cpu_replaced_sts: 1;
u32 mbp_rdy: 1;
u32 mfs_failure: 1;
u32 warm_reset_request: 1;
u32 cpu_replaced_valid: 1;
u32 reserved2: 4;
u32 reserved: 2;
u32 fw_upd_ipu: 1;
u32 reserved2: 1;
u32 mbp_cleared: 1;
u32 reserved3: 2;
u32 current_state: 8;
@@ -338,6 +340,7 @@ void intel_me_status(union me_hfs hfs, union me_hfs2 hfs2);
void intel_early_me_status(void);
int intel_early_me_init(void);
bool intel_early_me_cpu_replacement_check(void);
int intel_early_me_uma_size(void);
int intel_early_me_init_done(u8 status);