From 55ba8df28c55284099ffc62bbf58c217ae412754 Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Wed, 2 Feb 2022 16:16:09 -0700 Subject: [PATCH] util/spd_tools/spd_gen/lp5: Update BusWidth Encoding ADL and Sabrina have different advisory regarding encoding the bus width. Encode the bus width as per the respective advisories. BUG=b:211510456 TEST=Build spd_gen and ensure that the bus width is encoded as expected. Signed-off-by: Karthikeyan Ramasubramanian Change-Id: Ia12a5bd8f70a70ca8a510ecf00f6268c6904ec25 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61639 Tested-by: build bot (Jenkins) Reviewed-by: Tim Wawrzynczak --- util/spd_tools/src/spd_gen/lp5.go | 37 +++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/util/spd_tools/src/spd_gen/lp5.go b/util/spd_tools/src/spd_gen/lp5.go index 22927b21d5..1db5b8d52d 100644 --- a/util/spd_tools/src/spd_gen/lp5.go +++ b/util/spd_tools/src/spd_gen/lp5.go @@ -57,6 +57,7 @@ type LP5SPDAttribTableEntry struct { type LP5Set struct { SPDRevision byte + busWidthEncoding byte } /* ------------------------------------------------------------------------------------------ */ @@ -137,14 +138,6 @@ const ( */ LP5SPDValueOptionalFeatures = 0x08 - /* - * For ADL (as per advisory #616599): - * 7:5 (Number of system channels) = 000 (1 channel always) - * 4:3 (Bus width extension) = 00 (no ECC) - * 2:0 (Bus width) = 001 (x16 always) - * Set to 0x01. - */ - LP5SPDValueBusWidth = 0x01 /* * From JEDEC spec: @@ -191,9 +184,25 @@ var LP5PlatformSetMap = map[int][]int{ var LP5SetInfo = map[int]LP5Set{ 0: { SPDRevision: LP5SPDValueRevision1_0, + /* + * For ADL (as per advisory #616599): + * 7:5 (Number of system channels) = 000 (1 channel always) + * 4:3 (Bus width extension) = 00 (no ECC) + * 2:0 (Bus width) = 001 (x16 always) + * Set to 0x01. + */ + busWidthEncoding: 0x01, }, 1: { SPDRevision: LP5SPDValueRevision1_1, + /* + * For Sabrina (as per advisory b/211510456): + * 7:5 (Number of system channels) = 000 (1 channel always) + * 4:3 (Bus width extension) = 00 (no ECC) + * 2:0 (Bus width) = 010 (x32 always) + * Set to 0x02. + */ + busWidthEncoding: 0x02, }, } @@ -306,7 +315,7 @@ var LP5SPDAttribTable = map[int]LP5SPDAttribTableEntry{ LP5SPDIndexPackageType: {getVal: LP5EncodePackageType}, LP5SPDIndexOptionalFeatures: {constVal: LP5SPDValueOptionalFeatures}, LP5SPDIndexModuleOrganization: {getVal: LP5EncodeModuleOrganization}, - LP5SPDIndexBusWidth: {constVal: LP5SPDValueBusWidth}, + LP5SPDIndexBusWidth: {getVal: LP5EncodeBusWidth}, LP5SPDIndexTimebases: {constVal: LP5SPDValueTimebases}, LP5SPDIndexTCKMin: {getVal: LP5EncodeTCKMin}, LP5SPDIndexTCKMinFineOffset: {getVal: LP5EncodeTCKMinFineOffset}, @@ -409,6 +418,16 @@ func LP5EncodeModuleOrganization(memAttribs *LP5MemAttributes) byte { return b } +func LP5EncodeBusWidth(memAttribs *LP5MemAttributes) byte { + f, ok := LP5SetInfo[LP5CurrSet] + + if ok == false { + return 0 + } + + return f.busWidthEncoding +} + func LP5EncodeTCKMin(memAttribs *LP5MemAttributes) byte { return convPsToMtbByte(memAttribs.TCKMinPs) }