util: Modify LPDDR4 spd_tools to generate SPDs for ADL boards

Generates de-duplicated SPD files using a global memory part
list provided by the mainboard in JSON format.

BUG=b:173132516

Change-Id: I4964ec28d74ab36c6b6f2e9dce6c923d1df95c84
Signed-off-by: Amanda Huang <amanda_hwang@compal.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48526
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Amanda Huang 2020-12-10 14:41:14 +08:00 committed by Tim Wawrzynczak
parent 2e0053b840
commit 8edb48baa6
1 changed files with 7 additions and 6 deletions

View File

@ -27,13 +27,14 @@ import (
const ( const (
SPDManifestFileName = "lp4x_spd_manifest.generated.txt" SPDManifestFileName = "lp4x_spd_manifest.generated.txt"
PlatformTGL = 0 PlatformTGLADL = 0
PlatformJSL = 1 PlatformJSL = 1
) )
var platformMap = map[string]int { var platformMap = map[string]int {
"TGL": PlatformTGL, "TGL": PlatformTGLADL,
"JSL": PlatformJSL, "JSL": PlatformJSL,
"ADL": PlatformTGLADL,
} }
var currPlatform int var currPlatform int
@ -210,7 +211,7 @@ const (
/* Returns density to encode as per Intel MRC expectations. */ /* Returns density to encode as per Intel MRC expectations. */
func getMRCDensity(memAttribs *memAttributes) int { func getMRCDensity(memAttribs *memAttributes) int {
if currPlatform == PlatformTGL { if currPlatform == PlatformTGLADL {
/* /*
* Intel MRC on TGL expects density per logical channel to be encoded in * Intel MRC on TGL expects density per logical channel to be encoded in
* SPDIndexDensityBanks. Logical channel on TGL is an x16 channel. * SPDIndexDensityBanks. Logical channel on TGL is an x16 channel.
@ -270,7 +271,7 @@ func encodePackage(dies int) byte {
func encodeDiesPerPackage(memAttribs *memAttributes) byte { func encodeDiesPerPackage(memAttribs *memAttributes) byte {
var dies int = 0 var dies int = 0
if currPlatform == PlatformTGL { if currPlatform == PlatformTGLADL {
/* Intel MRC expects logical dies to be encoded for TGL. */ /* Intel MRC expects logical dies to be encoded for TGL. */
dies = memAttribs.ChannelsPerDie * memAttribs.RanksPerChannel * memAttribs.BitWidthPerChannel / 16 dies = memAttribs.ChannelsPerDie * memAttribs.RanksPerChannel * memAttribs.BitWidthPerChannel / 16
} else if currPlatform == PlatformJSL { } else if currPlatform == PlatformJSL {
@ -330,7 +331,7 @@ const (
) )
func encodeBusWidth(memAttribs *memAttributes) byte { func encodeBusWidth(memAttribs *memAttributes) byte {
if currPlatform == PlatformTGL { if currPlatform == PlatformTGLADL {
return SPDValueBusWidthTGL return SPDValueBusWidthTGL
} else if currPlatform == PlatformJSL { } else if currPlatform == PlatformJSL {
return SPDValueBusWidthJSL return SPDValueBusWidthJSL
@ -895,7 +896,7 @@ func updateTRPPB(memAttribs *memAttributes) {
} }
func normalizeMemoryAttributes(memAttribs *memAttributes) { func normalizeMemoryAttributes(memAttribs *memAttributes) {
if currPlatform == PlatformTGL { if currPlatform == PlatformTGLADL {
/* /*
* TGL does not really use physical organization of dies per package when * TGL does not really use physical organization of dies per package when
* generating the SPD. So, set it to 0 here so that deduplication ignores * generating the SPD. So, set it to 0 here so that deduplication ignores