From 0c923732dd653610f990de67d5bbf68825c23bee Mon Sep 17 00:00:00 2001 From: Sridhar Siricilla Date: Mon, 14 Nov 2022 17:25:37 +0530 Subject: [PATCH] soc/intel/meteorlake: Check MANUF_LOCK when logging manufacturing mode As per Intel doc #729124 Section 3.6.1 "Intel CSME Production Machine Determination", from ADL onwards there are three criteria which determine whether a device is in production mode: 1. Fuses are programmed 2. SPI descriptor is locked 3. Manufacturing variables are locked When logging whether the device is in manufacturing mode, #1 and #2 are already checked. Add a check for #3 as well. TEST=Build and boot MTL RVP Snippet from coreboot log: [DEBUG] ME: Manufacturing Mode : YES Signed-off-by: Sridhar Siricilla Change-Id: I495a7d8730716fc92e8c57b2caef73e8bb44d30b Reviewed-on: https://review.coreboot.org/c/coreboot/+/69578 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Jamie Ryu Reviewed-by: Eric Lai Reviewed-by: Ivy Jian --- src/soc/intel/meteorlake/me.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/soc/intel/meteorlake/me.c b/src/soc/intel/meteorlake/me.c index 7d89590dc3..743e9636a8 100644 --- a/src/soc/intel/meteorlake/me.c +++ b/src/soc/intel/meteorlake/me.c @@ -76,6 +76,18 @@ union me_hfsts6 { } __packed fields; }; + +/* + * Manufacturing mode is disabled if the descriptor is locked, fuses + * are programmed and manufacturing variables are locked. + * The function returns true if manufacturing mode is disabled otherwise false. + */ +static bool is_eom(union me_hfsts1 hfsts1, union me_hfsts6 hfsts6) +{ + return (hfsts1.fields.mfg_mode == 0) && (hfsts6.fields.manuf_lock == 1) && + (hfsts6.fields.fpf_soc_lock == 1); +} + static void dump_me_status(void *unused) { union me_hfsts1 hfsts1; @@ -102,13 +114,9 @@ static void dump_me_status(void *unused) printk(BIOS_DEBUG, "ME: HFSTS5 : 0x%08X\n", hfsts5.data); printk(BIOS_DEBUG, "ME: HFSTS6 : 0x%08X\n", hfsts6.data); - /* - * Lock Descriptor, and Fuses must be programmed on a - * production system to indicate ME Manufacturing mode is disabled. - */ printk(BIOS_DEBUG, "ME: Manufacturing Mode : %s\n", - ((hfsts1.fields.mfg_mode == 0) && - (hfsts6.fields.fpf_soc_lock == 1)) ? "NO" : "YES"); + is_eom(hfsts1, hfsts6) ? "NO" : "YES"); + /* * The SPI Protection Mode bit reflects SPI descriptor * locked(0) or unlocked(1).