util/spd_tools/spd_gen/lp5: Encode Optional SDRAM features

ADL and Sabrina provide different advisories to encode Optional SDRAM
features (byte indices 7 & 9). Encode those bytes as per the respective
advisories.

BUG=b:211510456
TEST=Generate the SPD binaries for Sabrina.

Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Change-Id: Icac8ae148458162768a919d9690d7bf96734e6c0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/61730
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Reka Norman <rekanorman@chromium.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
This commit is contained in:
Karthikeyan Ramasubramanian 2022-02-08 22:34:16 -07:00 committed by Felix Held
parent 6c4135e636
commit 3248db0e5a
4 changed files with 72 additions and 37 deletions

View File

@ -1,4 +1,4 @@
23 11 13 0E 15 1A 95 08 00 00 00 00 02 02 00 00
23 11 13 0E 15 1A 95 18 00 40 00 00 02 02 00 00
00 00 0A 00 00 00 00 00 AA 00 90 A8 90 90 06 C0
03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

View File

@ -1,4 +1,4 @@
23 11 13 0E 15 1A B5 08 00 00 00 00 0A 02 00 00
23 11 13 0E 15 1A B5 18 00 40 00 00 0A 02 00 00
00 00 0A 00 00 00 00 00 AA 00 90 A8 90 90 06 C0
03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

View File

@ -1,4 +1,4 @@
23 11 13 0E 16 22 95 08 00 00 00 00 02 02 00 00
23 11 13 0E 16 22 95 18 00 40 00 00 02 02 00 00
00 00 0A 00 00 00 00 00 AA 00 90 A8 90 C0 08 60
04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

View File

@ -57,6 +57,8 @@ type LP5SPDAttribTableEntry struct {
type LP5Set struct {
SPDRevision byte
optionalFeatures byte
otherOptionalFeatures byte
busWidthEncoding byte
}
@ -74,6 +76,7 @@ const (
LP5SPDIndexAddressing = 5
LP5SPDIndexPackageType = 6
LP5SPDIndexOptionalFeatures = 7
LP5SPDIndexOtherOptionalFeatures = 9
LP5SPDIndexModuleOrganization = 12
LP5SPDIndexBusWidth = 13
LP5SPDIndexTimebases = 17
@ -130,15 +133,6 @@ const (
*/
LP5SPDValueModuleType = 0x0e
/*
* From JEDEC spec:
* 5:4 (Maximum Activate Window) = 00 (8192 * tREFI)
* 3:0 (Maximum Activate Count) = 1000 (Unlimited MAC)
* Set to 0x08.
*/
LP5SPDValueOptionalFeatures = 0x08
/*
* From JEDEC spec:
* 3:2 (MTB) = 00 (0.125ns)
@ -184,6 +178,13 @@ var LP5PlatformSetMap = map[int][]int{
var LP5SetInfo = map[int]LP5Set{
0: {
SPDRevision: LP5SPDValueRevision1_0,
/*
* From JEDEC spec:
* 5:4 (Maximum Activate Window) = 00 (8192 * tREFI)
* 3:0 (Maximum Activate Count) = 1000 (Unlimited MAC)
* Set to 0x08.
*/
optionalFeatures: 0x08,
/*
* For ADL (as per advisory #616599):
* 7:5 (Number of system channels) = 000 (1 channel always)
@ -195,6 +196,19 @@ var LP5SetInfo = map[int]LP5Set{
},
1: {
SPDRevision: LP5SPDValueRevision1_1,
/*
* For Sabrina (as per advisory b/211510456):
* 5:4 (Maximum Activate Window) = 01 (4096 * tREFI)
* 3:0 (Maximum Activate Count) = 1000 (Unlimited MAC)
* Set to 0x18.
*/
optionalFeatures: 0x18,
/*
* For Sabrina (as per advisory b/211510456):
* 7:6 (PPR) = 1 (Post Package Repair is supported)
* Set to 0x40.
*/
otherOptionalFeatures: 0x40,
/*
* For Sabrina (as per advisory b/211510456):
* 7:5 (Number of system channels) = 000 (1 channel always)
@ -313,7 +327,8 @@ var LP5SPDAttribTable = map[int]LP5SPDAttribTableEntry{
LP5SPDIndexDensityBanks: {getVal: LP5EncodeDensityBanks},
LP5SPDIndexAddressing: {getVal: LP5EncodeSdramAddressing},
LP5SPDIndexPackageType: {getVal: LP5EncodePackageType},
LP5SPDIndexOptionalFeatures: {constVal: LP5SPDValueOptionalFeatures},
LP5SPDIndexOptionalFeatures: {getVal: LP5EncodeOptionalFeatures},
LP5SPDIndexOtherOptionalFeatures: {getVal: LP5EncodeOtherOptionalFeatures},
LP5SPDIndexModuleOrganization: {getVal: LP5EncodeModuleOrganization},
LP5SPDIndexBusWidth: {getVal: LP5EncodeBusWidth},
LP5SPDIndexTimebases: {constVal: LP5SPDValueTimebases},
@ -418,6 +433,26 @@ func LP5EncodeModuleOrganization(memAttribs *LP5MemAttributes) byte {
return b
}
func LP5EncodeOptionalFeatures(memAttribs *LP5MemAttributes) byte {
f, ok := LP5SetInfo[LP5CurrSet]
if ok == false {
return 0
}
return f.optionalFeatures
}
func LP5EncodeOtherOptionalFeatures(memAttribs *LP5MemAttributes) byte {
f, ok := LP5SetInfo[LP5CurrSet]
if ok == false {
return 0
}
return f.otherOptionalFeatures
}
func LP5EncodeBusWidth(memAttribs *LP5MemAttributes) byte {
f, ok := LP5SetInfo[LP5CurrSet]