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 <kramasub@google.com>
Change-Id: Ia12a5bd8f70a70ca8a510ecf00f6268c6904ec25
Reviewed-on: https://review.coreboot.org/c/coreboot/+/61639
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Karthikeyan Ramasubramanian 2022-02-02 16:16:09 -07:00 committed by Felix Held
parent ceefc74f01
commit 55ba8df28c
1 changed files with 28 additions and 9 deletions

View File

@ -57,6 +57,7 @@ type LP5SPDAttribTableEntry struct {
type LP5Set struct { type LP5Set struct {
SPDRevision byte SPDRevision byte
busWidthEncoding byte
} }
/* ------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------ */
@ -137,14 +138,6 @@ const (
*/ */
LP5SPDValueOptionalFeatures = 0x08 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: * From JEDEC spec:
@ -191,9 +184,25 @@ var LP5PlatformSetMap = map[int][]int{
var LP5SetInfo = map[int]LP5Set{ var LP5SetInfo = map[int]LP5Set{
0: { 0: {
SPDRevision: LP5SPDValueRevision1_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: { 1: {
SPDRevision: LP5SPDValueRevision1_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}, LP5SPDIndexPackageType: {getVal: LP5EncodePackageType},
LP5SPDIndexOptionalFeatures: {constVal: LP5SPDValueOptionalFeatures}, LP5SPDIndexOptionalFeatures: {constVal: LP5SPDValueOptionalFeatures},
LP5SPDIndexModuleOrganization: {getVal: LP5EncodeModuleOrganization}, LP5SPDIndexModuleOrganization: {getVal: LP5EncodeModuleOrganization},
LP5SPDIndexBusWidth: {constVal: LP5SPDValueBusWidth}, LP5SPDIndexBusWidth: {getVal: LP5EncodeBusWidth},
LP5SPDIndexTimebases: {constVal: LP5SPDValueTimebases}, LP5SPDIndexTimebases: {constVal: LP5SPDValueTimebases},
LP5SPDIndexTCKMin: {getVal: LP5EncodeTCKMin}, LP5SPDIndexTCKMin: {getVal: LP5EncodeTCKMin},
LP5SPDIndexTCKMinFineOffset: {getVal: LP5EncodeTCKMinFineOffset}, LP5SPDIndexTCKMinFineOffset: {getVal: LP5EncodeTCKMinFineOffset},
@ -409,6 +418,16 @@ func LP5EncodeModuleOrganization(memAttribs *LP5MemAttributes) byte {
return b return b
} }
func LP5EncodeBusWidth(memAttribs *LP5MemAttributes) byte {
f, ok := LP5SetInfo[LP5CurrSet]
if ok == false {
return 0
}
return f.busWidthEncoding
}
func LP5EncodeTCKMin(memAttribs *LP5MemAttributes) byte { func LP5EncodeTCKMin(memAttribs *LP5MemAttributes) byte {
return convPsToMtbByte(memAttribs.TCKMinPs) return convPsToMtbByte(memAttribs.TCKMinPs)
} }