diff options
author | Rob Barnes <robbarnes@google.com> | 2020-08-14 09:40:04 -0600 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2020-08-28 04:36:55 +0000 |
commit | a662648a7fbfc04bb0f4a2ef92d7faa4fb8c7e09 (patch) | |
tree | 010025465fcc0f537672127d9d4e39e3f591c0ec /util/spd_tools/ddr4/gen_spd.go | |
parent | e905753afdc534379a03b442ea07574822813871 (diff) | |
download | coreboot-a662648a7fbfc04bb0f4a2ef92d7faa4fb8c7e09.tar.xz |
util: Add support to spd_tools for fixed id
For boards that have already assigned memory ids, there needs to be a
way to fix parts to a specific id. After assigning all the fixed ids the
tool still attempts to minimize the SPDs entries. Since a fixed ID could
be anywhere, gaps can be created in the list. So an empty SPD entry is
created to fill the gaps in the list until they are used.
BUG=b:162939176
TEST=Generate various outputs
Signed-off-by: Rob Barnes <robbarnes@google.com>
Change-Id: I1f8ea1ff4f33a97ab28ba94896a1054e89189576
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44463
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Diffstat (limited to 'util/spd_tools/ddr4/gen_spd.go')
-rw-r--r-- | util/spd_tools/ddr4/gen_spd.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/util/spd_tools/ddr4/gen_spd.go b/util/spd_tools/ddr4/gen_spd.go index 99fae7d3b4..e3fa732179 100644 --- a/util/spd_tools/ddr4/gen_spd.go +++ b/util/spd_tools/ddr4/gen_spd.go @@ -968,7 +968,10 @@ func createSPD(memAttribs *memAttributes) string { var s string for i := 0; i < 512; i++ { - b := getSPDByte(i, memAttribs) + var b byte = 0 + if memAttribs != nil { + b = getSPDByte(i, memAttribs) + } if (i + 1) % 16 == 0 { s += fmt.Sprintf("%02X\n", b) @@ -997,6 +1000,13 @@ func generateSPD(memPart *memPart, SPDId int, SPDDirName string) { ioutil.WriteFile(filepath.Join(SPDDirName, memPart.SPDFileName), []byte(s), 0644) } +func generateEmptySPD(SPDDirName string) { + + s := createSPD(nil) + SPDFileName := "ddr4-spd-empty.hex" + ioutil.WriteFile(filepath.Join(SPDDirName, SPDFileName), []byte(s), 0644) +} + func readMemoryParts(memParts *memParts, memPartsFileName string) error { databytes, err := ioutil.ReadFile(memPartsFileName) if err != nil { @@ -1396,6 +1406,8 @@ func main() { } } + generateEmptySPD(SPDDir) + if err := writeSPDManifest(&memParts, SPDDir); err != nil { log.Fatal(err) } |