soc/intel/fsp_broadwell_de: Check if memory is 'locked'

Under certain conditions TXT can "lock" memory controller for security
purpose. This manifests itself in IMC's SMbus controller failing all SPD
data read requests.  FSP does not detect error condition and fails boot
with "No memory found" issue.

TEST=tested on OCP monolake in 'locked' state

Change-Id: If4637e4293421794a89037ff107e87794c40114a
Signed-off-by: Andrey Petrov <anpetrov@fb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42710
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
This commit is contained in:
Andrey Petrov 2019-11-11 14:27:54 -08:00 committed by Patrick Georgi
parent 674a825cd7
commit df7e1f9a43
3 changed files with 17 additions and 0 deletions

View File

@ -27,4 +27,8 @@
void save_dimm_info(void);
/* Determine if memory configuration has been locked by TXT */
bool memory_config_is_locked(void);
#endif

View File

@ -39,4 +39,9 @@
#define MSR_PRMRR_PHYS_BASE 0x1f4
#define MSR_PRMRR_PHYS_MASK 0x1f5
/* EDS vol 2 */
#define MSR_LT_MEMORY_LOCKED 0x2e7
#define MSR_MEM_LOCK_BIT1 (1 << 1)
#define MSR_MEM_LOCK_BIT2 (1 << 2)
#endif /* _SOC_MSR_H_ */

View File

@ -13,6 +13,8 @@
* GNU General Public License for more details.
*/
#include <cpu/x86/msr.h>
#include <soc/msr.h>
#include <stddef.h>
#include <device/pci_ops.h>
#include <device/dram/ddr4.h>
@ -85,3 +87,9 @@ void save_dimm_info(void)
}
}
}
bool memory_config_is_locked(void)
{
msr_t msr = rdmsr(MSR_LT_MEMORY_LOCKED);
return (msr.lo & (MSR_MEM_LOCK_BIT1 | MSR_MEM_LOCK_BIT2));
}