util/spd_tools: Run go fmt on all .go files

This just reformats these files. go fmt should probably be
run on the check-in of every .go file.

Signed-off-by: Martin Roth <martin@coreboot.org>
Change-Id: I70ced115bad42d123474b18bbff2e4c0a16f3d88
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51019
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Martin Roth 2021-02-22 20:11:18 -07:00 committed by Patrick Georgi
parent db717db5c5
commit f0a7e36527
4 changed files with 330 additions and 333 deletions

View File

@ -26,9 +26,9 @@ import (
*/ */
const ( const (
SPDManifestFileName = "ddr4_spd_manifest.generated.txt" SPDManifestFileName = "ddr4_spd_manifest.generated.txt"
MakefileName = "Makefile.inc" MakefileName = "Makefile.inc"
DRAMIdFileName = "dram_id.generated.txt" DRAMIdFileName = "dram_id.generated.txt"
MaxMemoryId = 15 MaxMemoryId = 15
) )
func usage() { func usage() {
@ -42,7 +42,7 @@ func usage() {
func checkArgs() error { func checkArgs() error {
for _, arg := range os.Args[1:] { for _, arg := range os.Args[1:] {
if _, err := os.Stat(arg); err != nil { if _, err := os.Stat(arg); err != nil {
return err return err
} }
} }
@ -52,8 +52,9 @@ func checkArgs() error {
type usedPart struct { type usedPart struct {
partName string partName string
index int index int
} }
/* /*
* Read input file CSV that contains list of memory part names used by the variant * Read input file CSV that contains list of memory part names used by the variant
* and an optional assigned id. * and an optional assigned id.
@ -150,7 +151,7 @@ func appendPartIdInfo(s *string, partName string, index int) {
type partIds struct { type partIds struct {
SPDFileName string SPDFileName string
memParts string memParts string
} }
/* /*
@ -178,7 +179,7 @@ func genPartIdInfo(parts []usedPart, partToSPDMap map[string]string, SPDToIndexM
return nil, fmt.Errorf("Invalid part entry") return nil, fmt.Errorf("Invalid part entry")
} }
SPDFileName,ok := partToSPDMap[p.partName] SPDFileName, ok := partToSPDMap[p.partName]
if !ok { if !ok {
return nil, fmt.Errorf("Failed to find part ", p.partName, " in SPD Manifest. Please add the part to global part list and regenerate SPD Manifest") return nil, fmt.Errorf("Failed to find part ", p.partName, " in SPD Manifest. Please add the part to global part list and regenerate SPD Manifest")
} }
@ -214,7 +215,7 @@ func genPartIdInfo(parts []usedPart, partToSPDMap map[string]string, SPDToIndexM
continue continue
} }
SPDFileName,ok := partToSPDMap[p.partName] SPDFileName, ok := partToSPDMap[p.partName]
if !ok { if !ok {
return nil, fmt.Errorf("Failed to find part ", p.partName, " in SPD Manifest. Please add the part to global part list and regenerate SPD Manifest") return nil, fmt.Errorf("Failed to find part ", p.partName, " in SPD Manifest. Please add the part to global part list and regenerate SPD Manifest")
} }

View File

@ -10,9 +10,9 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"reflect" "reflect"
"regexp"
"strconv" "strconv"
"strings" "strings"
"regexp"
) )
/* /*
@ -33,7 +33,7 @@ const (
PlatformPLK = 2 PlatformPLK = 2
) )
var platformMap = map[string]int { var platformMap = map[string]int{
"TGL": PlatformTGL, "TGL": PlatformTGL,
"PCO": PlatformPCO, "PCO": PlatformPCO,
"PLK": PlatformPLK, "PLK": PlatformPLK,
@ -43,41 +43,41 @@ var currPlatform int
type memAttributes struct { type memAttributes struct {
/* Primary attributes - must be provided by JSON file for each part */ /* Primary attributes - must be provided by JSON file for each part */
SpeedMTps int SpeedMTps int
CL_nRCD_nRP int CL_nRCD_nRP int
CapacityPerDieGb int CapacityPerDieGb int
DiesPerPackage int DiesPerPackage int
PackageBusWidth int PackageBusWidth int
RanksPerPackage int RanksPerPackage int
/* /*
* All the following parameters are optional and required only if the part requires * All the following parameters are optional and required only if the part requires
* special parameters as per the datasheet. * special parameters as per the datasheet.
*/ */
/* Timing parameters */ /* Timing parameters */
TAAMinPs int TAAMinPs int
TRCDMinPs int TRCDMinPs int
TRPMinPs int TRPMinPs int
TRASMinPs int TRASMinPs int
TRCMinPs int TRCMinPs int
TCKMinPs int TCKMinPs int
TCKMaxPs int TCKMaxPs int
TRFC1MinPs int TRFC1MinPs int
TRFC2MinPs int TRFC2MinPs int
TRFC4MinPs int TRFC4MinPs int
TFAWMinPs int TFAWMinPs int
TRRDLMinPs int TRRDLMinPs int
TRRDSMinPs int TRRDSMinPs int
TCCDLMinPs int TCCDLMinPs int
TWRMinPs int TWRMinPs int
TWTRLMinPs int TWTRLMinPs int
TWTRSMinPs int TWTRSMinPs int
/* CAS */ /* CAS */
CASLatencies string CASLatencies string
CASFirstByte byte CASFirstByte byte
CASSecondByte byte CASSecondByte byte
CASThirdByte byte CASThirdByte byte
CASFourthByte byte CASFourthByte byte
/* The following is for internal-use only and is not overridable */ /* The following is for internal-use only and is not overridable */
@ -85,10 +85,10 @@ type memAttributes struct {
} }
/* This encodes the density in Gb to SPD low nibble value as per JESD 4.1.2.L-5 R29 */ /* This encodes the density in Gb to SPD low nibble value as per JESD 4.1.2.L-5 R29 */
var densityGbToSPDEncoding = map[int]byte { var densityGbToSPDEncoding = map[int]byte{
2: 0x3, 2: 0x3,
4: 0x4, 4: 0x4,
8: 0x5, 8: 0x5,
16: 0x6, 16: 0x6,
} }
@ -97,10 +97,10 @@ var densityGbToSPDEncoding = map[int]byte {
* Maps density per die to row-column encoding for a device with x8/x16 * Maps density per die to row-column encoding for a device with x8/x16
* physical channel. * physical channel.
*/ */
var densityGbx8x16DieCapacityToRowColumnEncoding = map[int]byte { var densityGbx8x16DieCapacityToRowColumnEncoding = map[int]byte{
2: 0x11, /* 14 rows, 10 columns */ 2: 0x11, /* 14 rows, 10 columns */
4: 0x19, /* 15 rows, 10 columns */ 4: 0x19, /* 15 rows, 10 columns */
8: 0x21, /* 16 rows, 10 columns */ 8: 0x21, /* 16 rows, 10 columns */
16: 0x29, /* 17 rows, 10 columns */ 16: 0x29, /* 17 rows, 10 columns */
} }
@ -111,26 +111,26 @@ var densityGbx8x16DieCapacityToRowColumnEncoding = map[int]byte {
*/ */
/* maps die density to rcf1 timing in pico seconds */ /* maps die density to rcf1 timing in pico seconds */
var tRFC1Encoding = map[int]int { var tRFC1Encoding = map[int]int{
2: 160000, 2: 160000,
4: 260000, 4: 260000,
8: 350000, 8: 350000,
16: 550000, 16: 550000,
} }
/* maps die density to rcf2 timing in pico seconds */ /* maps die density to rcf2 timing in pico seconds */
var tRFC2Encoding = map[int]int { var tRFC2Encoding = map[int]int{
2: 110000, 2: 110000,
4: 160000, 4: 160000,
8: 260000, 8: 260000,
16: 350000, 16: 350000,
} }
/* maps die density to rcf4 timing in pico seconds */ /* maps die density to rcf4 timing in pico seconds */
var tRFC4Encoding = map[int]int { var tRFC4Encoding = map[int]int{
2: 90000, 2: 90000,
4: 110000, 4: 110000,
8: 160000, 8: 160000,
16: 260000, 16: 260000,
} }
@ -145,37 +145,37 @@ func getDefaultTCKMinPs(memAttribs *memAttributes) int {
type speedBinAttributes struct { type speedBinAttributes struct {
TRASMinPs int TRASMinPs int
TCKMaxPs int TCKMaxPs int
} }
var speedBinToSPDEncoding = map[int]speedBinAttributes { var speedBinToSPDEncoding = map[int]speedBinAttributes{
1600: { 1600: {
TRASMinPs: 35000, TRASMinPs: 35000,
TCKMaxPs: 1500, TCKMaxPs: 1500,
}, },
1866: { 1866: {
TRASMinPs: 34000, TRASMinPs: 34000,
TCKMaxPs: 1250, TCKMaxPs: 1250,
}, },
2133: { 2133: {
TRASMinPs: 33000, TRASMinPs: 33000,
TCKMaxPs: 1071, TCKMaxPs: 1071,
}, },
2400: { 2400: {
TRASMinPs: 32000, TRASMinPs: 32000,
TCKMaxPs: 937, TCKMaxPs: 937,
}, },
2666: { 2666: {
TRASMinPs: 32000, TRASMinPs: 32000,
TCKMaxPs: 833, TCKMaxPs: 833,
}, },
2933: { 2933: {
TRASMinPs: 32000, TRASMinPs: 32000,
TCKMaxPs: 750, TCKMaxPs: 750,
}, },
3200: { 3200: {
TRASMinPs: 32000, TRASMinPs: 32000,
TCKMaxPs: 682, TCKMaxPs: 682,
}, },
} }
@ -394,8 +394,8 @@ func encodeTRCMinLsb(memAttribs *memAttributes) byte {
} }
/* This takes memAttribs.PackageBusWidth as an index */ /* This takes memAttribs.PackageBusWidth as an index */
var pageSizefromBusWidthEncoding = map[int]int { var pageSizefromBusWidthEncoding = map[int]int{
8: 1, 8: 1,
16: 2, 16: 2,
} }
@ -498,7 +498,7 @@ func updateTRRDLMin(memAttribs *memAttributes) {
var tRRDLFromTck int var tRRDLFromTck int
if memAttribs.TRRDLMinPs == 0 { if memAttribs.TRRDLMinPs == 0 {
memAttribs.TRRDLMinPs= getTRRDLMinPs(memAttribs) memAttribs.TRRDLMinPs = getTRRDLMinPs(memAttribs)
} }
tRRDLFromTck = 4 * memAttribs.TCKMinPs tRRDLFromTck = 4 * memAttribs.TCKMinPs
@ -508,7 +508,7 @@ func updateTRRDLMin(memAttribs *memAttributes) {
} }
} }
var speedToTRRDSMinPsOneKPageSize = map[int]int { var speedToTRRDSMinPsOneKPageSize = map[int]int{
1600: 5000, 1600: 5000,
1866: 4200, 1866: 4200,
2133: 3700, 2133: 3700,
@ -518,7 +518,7 @@ var speedToTRRDSMinPsOneKPageSize = map[int]int {
3200: 2500, 3200: 2500,
} }
var speedToTRRDSMinPsTwoKPageSize = map[int]int { var speedToTRRDSMinPsTwoKPageSize = map[int]int{
1600: 6000, 1600: 6000,
1866: 5300, 1866: 5300,
2133: 5300, 2133: 5300,
@ -564,11 +564,11 @@ func getTCCDLMinPs(memAttribs *memAttributes) int {
var tCCDLFixed int var tCCDLFixed int
switch memAttribs.SpeedMTps { switch memAttribs.SpeedMTps {
case 1600: case 1600:
tCCDLFixed = 6250 tCCDLFixed = 6250
case 1866: case 1866:
tCCDLFixed = 5355 tCCDLFixed = 5355
case 2133: case 2133:
tCCDLFixed = 5355 tCCDLFixed = 5355
default: default:
tCCDLFixed = 5000 tCCDLFixed = 5000
@ -720,66 +720,66 @@ func encodeTWTRLMinLsb(memAttribs *memAttributes) byte {
return byte(convPsToMtb(memAttribs.TWTRLMinPs) & 0xff) return byte(convPsToMtb(memAttribs.TWTRLMinPs) & 0xff)
} }
type SPDMemAttribFunc func (*memAttributes) byte type SPDMemAttribFunc func(*memAttributes) byte
type SPDConvConstFunc func () byte type SPDConvConstFunc func() byte
type SPDAttribTableEntry struct { type SPDAttribTableEntry struct {
constVal byte constVal byte
getVal SPDMemAttribFunc getVal SPDMemAttribFunc
} }
const ( const (
/* SPD Byte Index */ /* SPD Byte Index */
SPDIndexSize = 0 SPDIndexSize = 0
SPDIndexRevision = 1 SPDIndexRevision = 1
SPDIndexMemoryType = 2 SPDIndexMemoryType = 2
SPDIndexModuleType = 3 SPDIndexModuleType = 3
SPDIndexDensityBanks = 4 SPDIndexDensityBanks = 4
SPDIndexAddressing = 5 SPDIndexAddressing = 5
SPDIndexPackageType = 6 SPDIndexPackageType = 6
SPDIndexOptionalFeatures = 7 SPDIndexOptionalFeatures = 7
SPDIndexModuleOrganization = 12 SPDIndexModuleOrganization = 12
SPDIndexBusWidth = 13 SPDIndexBusWidth = 13
SPDIndexTimebases = 17 SPDIndexTimebases = 17
SPDIndexTCKMin = 18 SPDIndexTCKMin = 18
SPDIndexTCKMax = 19 SPDIndexTCKMax = 19
SPDIndexCASFirstByte = 20 SPDIndexCASFirstByte = 20
SPDIndexCASSecondByte = 21 SPDIndexCASSecondByte = 21
SPDIndexCASThirdByte = 22 SPDIndexCASThirdByte = 22
SPDIndexCASFourthByte = 23 SPDIndexCASFourthByte = 23
SPDIndexTAAMin = 24 SPDIndexTAAMin = 24
SPDIndexTRCDMin = 25 SPDIndexTRCDMin = 25
SPDIndexTRPMin = 26 SPDIndexTRPMin = 26
SPDIndexTRASRCMinMSNs = 27 SPDIndexTRASRCMinMSNs = 27
SPDIndexTRASMinLsb = 28 SPDIndexTRASMinLsb = 28
SPDIndexTRCMinLsb = 29 SPDIndexTRCMinLsb = 29
SPDIndexTRFC1MinLsb = 30 SPDIndexTRFC1MinLsb = 30
SPDIndexTRFC1MinMsb = 31 SPDIndexTRFC1MinMsb = 31
SPDIndexTRFC2MinLsb = 32 SPDIndexTRFC2MinLsb = 32
SPDIndexTRFC2MinMsb = 33 SPDIndexTRFC2MinMsb = 33
SPDIndexTRFC4MinLsb = 34 SPDIndexTRFC4MinLsb = 34
SPDIndexTRFC4MinMsb = 35 SPDIndexTRFC4MinMsb = 35
SPDIndexTFAWMinMSN = 36 SPDIndexTFAWMinMSN = 36
SPDIndexTFAWMinLsb = 37 SPDIndexTFAWMinLsb = 37
SPDIndexTRRDSMin = 38 SPDIndexTRRDSMin = 38
SPDIndexTRRDLMin = 39 SPDIndexTRRDLMin = 39
SPDIndexTCCDLMin = 40 SPDIndexTCCDLMin = 40
SPDIndexTWRMinMSN = 41 SPDIndexTWRMinMSN = 41
SPDIndexTWRMinLsb = 42 SPDIndexTWRMinLsb = 42
SPDIndexTWTRMinMSNs = 43 SPDIndexTWTRMinMSNs = 43
SPDIndexWTRSMinLsb = 44 SPDIndexWTRSMinLsb = 44
SPDIndexWTRLMinLsb = 45 SPDIndexWTRLMinLsb = 45
SPDIndexTCCDLMinFineOffset = 117 SPDIndexTCCDLMinFineOffset = 117
SPDIndexTRRDLMinFineOffset = 118 SPDIndexTRRDLMinFineOffset = 118
SPDIndexTRRDSMinFineOffset = 119 SPDIndexTRRDSMinFineOffset = 119
SPDIndexTRCMinFineOffset = 120 SPDIndexTRCMinFineOffset = 120
SPDIndexTRPMinFineOffset = 121 SPDIndexTRPMinFineOffset = 121
SPDIndexTRCDMinFineOffset = 122 SPDIndexTRCDMinFineOffset = 122
SPDIndexTAAMinFineOffset = 123 SPDIndexTAAMinFineOffset = 123
SPDIndexTCKMaxFineOffset = 124 SPDIndexTCKMaxFineOffset = 124
SPDIndexTCKMinFineOffset = 125 SPDIndexTCKMinFineOffset = 125
SPDIndexManufacturerPartNumberStartByte = 329 SPDIndexManufacturerPartNumberStartByte = 329
SPDIndexManufacturerPartNumberEndByte = 348 SPDIndexManufacturerPartNumberEndByte = 348
/* SPD Byte Value */ /* SPD Byte Value */
@ -801,17 +801,17 @@ const (
SPDValueMemoryType = 0x0C SPDValueMemoryType = 0x0C
/* /*
* From JEDEC spec: * From JEDEC spec:
* Module Type [0:3] : * Module Type [0:3] :
* 0 = Undefined * 0 = Undefined
* 1 = RDIMM (width = 133.35 mm nom) * 1 = RDIMM (width = 133.35 mm nom)
* 2 = UDIMM (width = 133.35 mm nom) * 2 = UDIMM (width = 133.35 mm nom)
* 3 = SO-DIMM (width = 68.60 mm nom) * 3 = SO-DIMM (width = 68.60 mm nom)
* 4 = LRDIMM (width = 133.35 mm nom) * 4 = LRDIMM (width = 133.35 mm nom)
* *
* DDR4 on TGL uses SO-DIMM type for for both memory down and DIMM config. * DDR4 on TGL uses SO-DIMM type for for both memory down and DIMM config.
* Set to 0x03. * Set to 0x03.
*/ */
SPDValueModuleType = 0x03 SPDValueModuleType = 0x03
/* /*
@ -844,7 +844,6 @@ const (
/* As per JEDEC spec, unused digits of manufacturer part number are left as blank. */ /* As per JEDEC spec, unused digits of manufacturer part number are left as blank. */
SPDValueManufacturerPartNumberBlank = 0x20 SPDValueManufacturerPartNumberBlank = 0x20
) )
const ( const (
@ -853,72 +852,72 @@ const (
* tWRMin = 15nS for all DDR4 Speed Bins * tWRMin = 15nS for all DDR4 Speed Bins
* Set to 15000 pS * Set to 15000 pS
*/ */
TimingValueTWRMinPs = 15000 TimingValueTWRMinPs = 15000
/* /*
* As per Table 78 of Jedec spec 4.1.20-L-5 R29 v103: * As per Table 78 of Jedec spec 4.1.20-L-5 R29 v103:
* tWTR_SMin = 2.5nS for all DDR4 Speed Bins * tWTR_SMin = 2.5nS for all DDR4 Speed Bins
* Set to 2500 pS * Set to 2500 pS
*/ */
TimingValueTWTRSMinPs = 2500 TimingValueTWTRSMinPs = 2500
/* /*
* As per Table 80 of Jedec spec 4.1.20-L-5 R29 v103: * As per Table 80 of Jedec spec 4.1.20-L-5 R29 v103:
* tWTR_LMin = 7.5 nS for all DDR4 Speed Bins * tWTR_LMin = 7.5 nS for all DDR4 Speed Bins
* Set to 7500 pS * Set to 7500 pS
*/ */
TimingValueTWTRLMinPs = 7500 TimingValueTWTRLMinPs = 7500
) )
var SPDAttribTable = map[int]SPDAttribTableEntry { var SPDAttribTable = map[int]SPDAttribTableEntry{
SPDIndexSize: { constVal: SPDValueSize }, SPDIndexSize: {constVal: SPDValueSize},
SPDIndexRevision: { constVal: SPDValueRevision }, SPDIndexRevision: {constVal: SPDValueRevision},
SPDIndexMemoryType: { constVal: SPDValueMemoryType }, SPDIndexMemoryType: {constVal: SPDValueMemoryType},
SPDIndexModuleType: { constVal: SPDValueModuleType }, SPDIndexModuleType: {constVal: SPDValueModuleType},
SPDIndexDensityBanks: { getVal: encodeDensityBanks }, SPDIndexDensityBanks: {getVal: encodeDensityBanks},
SPDIndexAddressing: { getVal: encodeSdramAddressing }, SPDIndexAddressing: {getVal: encodeSdramAddressing},
SPDIndexPackageType: { getVal: encodePackageType }, SPDIndexPackageType: {getVal: encodePackageType},
SPDIndexOptionalFeatures: { constVal: SPDValueOptionalFeatures }, SPDIndexOptionalFeatures: {constVal: SPDValueOptionalFeatures},
SPDIndexModuleOrganization: { getVal: encodeModuleOrganization }, SPDIndexModuleOrganization: {getVal: encodeModuleOrganization},
SPDIndexBusWidth: { constVal: SPDValueModuleBusWidth }, SPDIndexBusWidth: {constVal: SPDValueModuleBusWidth},
SPDIndexTimebases: { constVal: SPDValueTimebases }, SPDIndexTimebases: {constVal: SPDValueTimebases},
SPDIndexTCKMin: { getVal: encodeTCKMin }, SPDIndexTCKMin: {getVal: encodeTCKMin},
SPDIndexTCKMinFineOffset: { getVal: encodeTCKMinFineOffset }, SPDIndexTCKMinFineOffset: {getVal: encodeTCKMinFineOffset},
SPDIndexTCKMax: { getVal: encodeTCKMax }, SPDIndexTCKMax: {getVal: encodeTCKMax},
SPDIndexTCKMaxFineOffset: { getVal: encodeTCKMaxFineOffset }, SPDIndexTCKMaxFineOffset: {getVal: encodeTCKMaxFineOffset},
SPDIndexCASFirstByte: { getVal: encodeCASFirstByte }, SPDIndexCASFirstByte: {getVal: encodeCASFirstByte},
SPDIndexCASSecondByte: { getVal: encodeCASSecondByte }, SPDIndexCASSecondByte: {getVal: encodeCASSecondByte},
SPDIndexCASThirdByte: { getVal: encodeCASThirdByte }, SPDIndexCASThirdByte: {getVal: encodeCASThirdByte},
SPDIndexCASFourthByte: { getVal: encodeCASFourthByte }, SPDIndexCASFourthByte: {getVal: encodeCASFourthByte},
SPDIndexTAAMin: { getVal: encodeTAAMin }, SPDIndexTAAMin: {getVal: encodeTAAMin},
SPDIndexTAAMinFineOffset: { getVal: encodeTAAMinFineOffset }, SPDIndexTAAMinFineOffset: {getVal: encodeTAAMinFineOffset},
SPDIndexTRCDMin: { getVal: encodeTRCDMin }, SPDIndexTRCDMin: {getVal: encodeTRCDMin},
SPDIndexTRCDMinFineOffset: { getVal: encodeTRCDMinFineOffset }, SPDIndexTRCDMinFineOffset: {getVal: encodeTRCDMinFineOffset},
SPDIndexTRPMin: { getVal: encodeTRPMin }, SPDIndexTRPMin: {getVal: encodeTRPMin},
SPDIndexTRPMinFineOffset: { getVal: encodeTRPMinFineOffset }, SPDIndexTRPMinFineOffset: {getVal: encodeTRPMinFineOffset},
SPDIndexTRASRCMinMSNs: { getVal: encodeTRASRCMinMSNs }, SPDIndexTRASRCMinMSNs: {getVal: encodeTRASRCMinMSNs},
SPDIndexTRASMinLsb: { getVal: encodeTRASMinLsb }, SPDIndexTRASMinLsb: {getVal: encodeTRASMinLsb},
SPDIndexTRCMinLsb: { getVal: encodeTRCMinLsb }, SPDIndexTRCMinLsb: {getVal: encodeTRCMinLsb},
SPDIndexTRCMinFineOffset: { getVal: encodeTRCMinFineOffset }, SPDIndexTRCMinFineOffset: {getVal: encodeTRCMinFineOffset},
SPDIndexTRFC1MinLsb: { getVal: encodeTRFC1MinLsb }, SPDIndexTRFC1MinLsb: {getVal: encodeTRFC1MinLsb},
SPDIndexTRFC1MinMsb: { getVal: encodeTRFC1MinMsb }, SPDIndexTRFC1MinMsb: {getVal: encodeTRFC1MinMsb},
SPDIndexTRFC2MinLsb: { getVal: encodeTRFC2MinLsb }, SPDIndexTRFC2MinLsb: {getVal: encodeTRFC2MinLsb},
SPDIndexTRFC2MinMsb: { getVal: encodeTRFC2MinMsb }, SPDIndexTRFC2MinMsb: {getVal: encodeTRFC2MinMsb},
SPDIndexTRFC4MinLsb: { getVal: encodeTRFC4MinLsb }, SPDIndexTRFC4MinLsb: {getVal: encodeTRFC4MinLsb},
SPDIndexTRFC4MinMsb: { getVal: encodeTRFC4MinMsb }, SPDIndexTRFC4MinMsb: {getVal: encodeTRFC4MinMsb},
SPDIndexTFAWMinMSN: { getVal: encodeTFAWMinMSN }, SPDIndexTFAWMinMSN: {getVal: encodeTFAWMinMSN},
SPDIndexTFAWMinLsb: { getVal: encodeTFAWMinLsb }, SPDIndexTFAWMinLsb: {getVal: encodeTFAWMinLsb},
SPDIndexTRRDSMin: { getVal: encodeTRRDSMin }, SPDIndexTRRDSMin: {getVal: encodeTRRDSMin},
SPDIndexTRRDSMinFineOffset: { getVal: encodeTRRDSMinFineOffset }, SPDIndexTRRDSMinFineOffset: {getVal: encodeTRRDSMinFineOffset},
SPDIndexTRRDLMin: { getVal: encodeTRRDLMin }, SPDIndexTRRDLMin: {getVal: encodeTRRDLMin},
SPDIndexTRRDLMinFineOffset: { getVal: encodeTRRDLMinFineOffset }, SPDIndexTRRDLMinFineOffset: {getVal: encodeTRRDLMinFineOffset},
SPDIndexTCCDLMin: { getVal: encodeTCCDLMin }, SPDIndexTCCDLMin: {getVal: encodeTCCDLMin},
SPDIndexTCCDLMinFineOffset: { getVal: encodeTCCDLMinFineOffset }, SPDIndexTCCDLMinFineOffset: {getVal: encodeTCCDLMinFineOffset},
SPDIndexTWRMinMSN: { getVal: encodeTWRMinMSN }, SPDIndexTWRMinMSN: {getVal: encodeTWRMinMSN},
SPDIndexTWRMinLsb: { getVal: encodeTWRMinLsb }, SPDIndexTWRMinLsb: {getVal: encodeTWRMinLsb},
SPDIndexTWTRMinMSNs: { getVal: encodeTWTRMinMSNs }, SPDIndexTWTRMinMSNs: {getVal: encodeTWTRMinMSNs},
SPDIndexWTRSMinLsb: { getVal: encodeTWTRSMinLsb }, SPDIndexWTRSMinLsb: {getVal: encodeTWTRSMinLsb},
SPDIndexWTRLMinLsb: { getVal: encodeTWTRLMinLsb }, SPDIndexWTRLMinLsb: {getVal: encodeTWTRLMinLsb},
} }
type memParts struct { type memParts struct {
@ -926,8 +925,8 @@ type memParts struct {
} }
type memPart struct { type memPart struct {
Name string Name string
Attribs memAttributes Attribs memAttributes
SPDFileName string SPDFileName string
} }
@ -951,7 +950,6 @@ func isManufacturerPartNumberByte(index int) bool {
return false return false
} }
func getSPDByte(index int, memAttribs *memAttributes) byte { func getSPDByte(index int, memAttribs *memAttributes) byte {
e, ok := SPDAttribTable[index] e, ok := SPDAttribTable[index]
if ok == false { if ok == false {
@ -977,7 +975,7 @@ func createSPD(memAttribs *memAttributes) string {
b = getSPDByte(i, memAttribs) b = getSPDByte(i, memAttribs)
} }
if (i + 1) % 16 == 0 { if (i+1)%16 == 0 {
s += fmt.Sprintf("%02X\n", b) s += fmt.Sprintf("%02X\n", b)
} else { } else {
s += fmt.Sprintf("%02X ", b) s += fmt.Sprintf("%02X ", b)
@ -1059,7 +1057,6 @@ func validateRanksPerPackage(ranks int) error {
return fmt.Errorf("Incorrect package ranks: ", ranks) return fmt.Errorf("Incorrect package ranks: ", ranks)
} }
func validateCASLatency(CL int) error { func validateCASLatency(CL int) error {
if CL >= 10 && CL <= 24 && CL != 23 { if CL >= 10 && CL <= 24 && CL != 23 {
return nil return nil
@ -1120,24 +1117,24 @@ func validateMemoryParts(memParts *memParts) error {
} }
const ( const (
/* First Byte */ /* First Byte */
CAS9 = 1 << 2 CAS9 = 1 << 2
CAS10 = 1 << 3 CAS10 = 1 << 3
CAS11 = 1 << 4 CAS11 = 1 << 4
CAS12 = 1 << 5 CAS12 = 1 << 5
CAS13 = 1 << 6 CAS13 = 1 << 6
CAS14 = 1 << 7 CAS14 = 1 << 7
/* Second Byte */ /* Second Byte */
CAS15 = 1 << 0 CAS15 = 1 << 0
CAS16 = 1 << 1 CAS16 = 1 << 1
CAS17 = 1 << 2 CAS17 = 1 << 2
CAS18 = 1 << 3 CAS18 = 1 << 3
CAS19 = 1 << 4 CAS19 = 1 << 4
CAS20 = 1 << 5 CAS20 = 1 << 5
CAS21 = 1 << 6 CAS21 = 1 << 6
CAS22 = 1 << 7 CAS22 = 1 << 7
/* Third Byte */ /* Third Byte */
CAS24 = 1 << 1 CAS24 = 1 << 1
) )
func encodeLatencies(latency int, memAttribs *memAttributes) error { func encodeLatencies(latency int, memAttribs *memAttributes) error {
@ -1260,7 +1257,7 @@ func getDefaultCASLatencies(memAttribs *memAttributes) string {
func updateDieBusWidth(memAttribs *memAttributes) { func updateDieBusWidth(memAttribs *memAttributes) {
if memAttribs.PackageBusWidth == 16 && memAttribs.RanksPerPackage == 1 && if memAttribs.PackageBusWidth == 16 && memAttribs.RanksPerPackage == 1 &&
memAttribs.DiesPerPackage == 2 { memAttribs.DiesPerPackage == 2 {
/* /*
* If a x16 part has 2 die with single rank, PackageBusWidth * If a x16 part has 2 die with single rank, PackageBusWidth
* needs to be converted to match die bus width. * needs to be converted to match die bus width.
@ -1278,7 +1275,7 @@ func updateCAS(memAttribs *memAttributes) error {
latencies := strings.Fields(memAttribs.CASLatencies) latencies := strings.Fields(memAttribs.CASLatencies)
for i := 0; i < len(latencies); i++ { for i := 0; i < len(latencies); i++ {
latency,err := strconv.Atoi(latencies[i]) latency, err := strconv.Atoi(latencies[i])
if err != nil { if err != nil {
return fmt.Errorf("Unable to convert latency ", latencies[i]) return fmt.Errorf("Unable to convert latency ", latencies[i])
} }
@ -1320,7 +1317,6 @@ func updateTRASMin(memAttribs *memAttributes) {
} }
} }
func updateTRCMin(memAttribs *memAttributes) { func updateTRCMin(memAttribs *memAttributes) {
if memAttribs.TRCMinPs == 0 { if memAttribs.TRCMinPs == 0 {
memAttribs.TRCMinPs = getTRCMinPs(memAttribs) memAttribs.TRCMinPs = getTRCMinPs(memAttribs)
@ -1342,7 +1338,7 @@ func updateTWRMin(memAttribs *memAttributes) {
} }
} }
func updateTWTRMin(memAttribs *memAttributes) { func updateTWTRMin(memAttribs *memAttributes) {
if memAttribs.TWTRLMinPs == 0 { if memAttribs.TWTRLMinPs == 0 {
memAttribs.TWTRLMinPs = TimingValueTWTRLMinPs memAttribs.TWTRLMinPs = TimingValueTWTRLMinPs
} }

View File

@ -26,8 +26,8 @@ import (
*/ */
const ( const (
SPDManifestFileName = "lp4x_spd_manifest.generated.txt" SPDManifestFileName = "lp4x_spd_manifest.generated.txt"
MakefileName = "Makefile.inc" MakefileName = "Makefile.inc"
DRAMIdFileName = "dram_id.generated.txt" DRAMIdFileName = "dram_id.generated.txt"
) )
func usage() { func usage() {
@ -41,7 +41,7 @@ func usage() {
func checkArgs() error { func checkArgs() error {
for _, arg := range os.Args[1:] { for _, arg := range os.Args[1:] {
if _, err := os.Stat(arg); err != nil { if _, err := os.Stat(arg); err != nil {
return err return err
} }
} }
@ -112,7 +112,7 @@ func appendPartIdInfo(s *string, partName string, index int) {
type partIds struct { type partIds struct {
SPDFileName string SPDFileName string
memParts string memParts string
} }
/* /*
@ -136,7 +136,7 @@ func genPartIdInfo(parts []string, partToSPDMap map[string]string, SPDToIndexMap
continue continue
} }
SPDFileName,ok := partToSPDMap[p] SPDFileName, ok := partToSPDMap[p]
if !ok { if !ok {
return nil, fmt.Errorf("Failed to find part ", p, " in SPD Manifest. Please add the part to global part list and regenerate SPD Manifest") return nil, fmt.Errorf("Failed to find part ", p, " in SPD Manifest. Please add the part to global part list and regenerate SPD Manifest")
} }

View File

@ -28,11 +28,11 @@ const (
SPDManifestFileName = "lp4x_spd_manifest.generated.txt" SPDManifestFileName = "lp4x_spd_manifest.generated.txt"
PlatformTGLADL = 0 PlatformTGLADL = 0
PlatformJSL = 1 PlatformJSL = 1
PlatformCZN = 2 PlatformCZN = 2
) )
var platformMap = map[string]int { var platformMap = map[string]int{
"TGL": PlatformTGLADL, "TGL": PlatformTGLADL,
"JSL": PlatformJSL, "JSL": PlatformJSL,
"ADL": PlatformTGLADL, "ADL": PlatformTGLADL,
@ -44,39 +44,39 @@ var currPlatform int
type memAttributes struct { type memAttributes struct {
/* Primary attributes - must be provided by JSON file for each part */ /* Primary attributes - must be provided by JSON file for each part */
DensityPerChannelGb int DensityPerChannelGb int
Banks int Banks int
ChannelsPerDie int ChannelsPerDie int
DiesPerPackage int DiesPerPackage int
BitWidthPerChannel int BitWidthPerChannel int
RanksPerChannel int RanksPerChannel int
SpeedMbps int SpeedMbps int
/* /*
* All the following parameters are optional and required only if the part requires * All the following parameters are optional and required only if the part requires
* special parameters as per the datasheet. * special parameters as per the datasheet.
*/ */
/* Timing parameters */ /* Timing parameters */
TRFCABNs int TRFCABNs int
TRFCPBNs int TRFCPBNs int
TRPABMinNs int TRPABMinNs int
TRPPBMinNs int TRPPBMinNs int
TCKMinPs int TCKMinPs int
TCKMaxPs int TCKMaxPs int
TAAMinPs int TAAMinPs int
TRCDMinNs int TRCDMinNs int
/* CAS */ /* CAS */
CASLatencies string CASLatencies string
CASFirstByte byte CASFirstByte byte
CASSecondByte byte CASSecondByte byte
CASThirdByte byte CASThirdByte byte
} }
/* This encodes the density in Gb to SPD values as per JESD 21-C */ /* This encodes the density in Gb to SPD values as per JESD 21-C */
var densityGbToSPDEncoding = map[int]byte { var densityGbToSPDEncoding = map[int]byte{
4: 0x4, 4: 0x4,
6: 0xb, 6: 0xb,
8: 0x5, 8: 0x5,
12: 0x8, 12: 0x8,
16: 0x6, 16: 0x6,
24: 0x9, 24: 0x9,
@ -88,10 +88,10 @@ var densityGbToSPDEncoding = map[int]byte {
* Maps density per physical channel to row-column encoding as per JESD 21-C for a device with * Maps density per physical channel to row-column encoding as per JESD 21-C for a device with
* x16 physical channel. * x16 physical channel.
*/ */
var densityGbx16ChannelToRowColumnEncoding = map[int]byte { var densityGbx16ChannelToRowColumnEncoding = map[int]byte{
4: 0x19, /* 15 rows, 10 columns */ 4: 0x19, /* 15 rows, 10 columns */
6: 0x21, /* 16 rows, 10 columns */ 6: 0x21, /* 16 rows, 10 columns */
8: 0x21, /* 16 rows, 10 columns */ 8: 0x21, /* 16 rows, 10 columns */
12: 0x29, /* 17 rows, 10 columns */ 12: 0x29, /* 17 rows, 10 columns */
16: 0x29, /* 17 rows, 10 columns */ 16: 0x29, /* 17 rows, 10 columns */
} }
@ -101,11 +101,11 @@ var densityGbx16ChannelToRowColumnEncoding = map[int]byte {
* Maps density per physical channel to row-column encoding as per JESD 21-C for a device with * Maps density per physical channel to row-column encoding as per JESD 21-C for a device with
* x8 physical channel. * x8 physical channel.
*/ */
var densityGbx8ChannelToRowColumnEncoding = map[int]byte { var densityGbx8ChannelToRowColumnEncoding = map[int]byte{
3: 0x21, /* 16 rows, 10 columns */ 3: 0x21, /* 16 rows, 10 columns */
4: 0x21, /* 16 rows, 10 columns */ 4: 0x21, /* 16 rows, 10 columns */
6: 0x29, /* 17 rows, 10 columns */ 6: 0x29, /* 17 rows, 10 columns */
8: 0x29, /* 17 rows, 10 columns */ 8: 0x29, /* 17 rows, 10 columns */
12: 0x31, /* 18 rows, 10 columns */ 12: 0x31, /* 18 rows, 10 columns */
16: 0x31, /* 18 rows, 10 columns */ 16: 0x31, /* 18 rows, 10 columns */
} }
@ -120,7 +120,7 @@ type refreshTimings struct {
* Maps density per physical channel to refresh timings. This is the same for x8 and x16 * Maps density per physical channel to refresh timings. This is the same for x8 and x16
* devices. * devices.
*/ */
var densityGbPhysicalChannelToRefreshEncoding = map[int]refreshTimings { var densityGbPhysicalChannelToRefreshEncoding = map[int]refreshTimings{
3: { 3: {
TRFCABNs: 180, TRFCABNs: 180,
TRFCPBNs: 90, TRFCPBNs: 90,
@ -148,15 +148,15 @@ var densityGbPhysicalChannelToRefreshEncoding = map[int]refreshTimings {
} }
type speedParams struct { type speedParams struct {
TCKMinPs int TCKMinPs int
TCKMaxPs int TCKMaxPs int
CASLatenciesx16Channel string CASLatenciesx16Channel string
CASLatenciesx8Channel string CASLatenciesx8Channel string
} }
const ( const (
/* First Byte */ /* First Byte */
CAS6 = 1 << 1 CAS6 = 1 << 1
CAS10 = 1 << 4 CAS10 = 1 << 4
CAS14 = 1 << 7 CAS14 = 1 << 7
/* Second Byte */ /* Second Byte */
@ -181,28 +181,28 @@ const (
TCKMaxPsDefault = 31875 TCKMaxPsDefault = 31875
) )
var speedMbpsToSPDEncoding = map[int]speedParams { var speedMbpsToSPDEncoding = map[int]speedParams{
4267: { 4267: {
TCKMinPs: 468, /* 1/4267 * 2 */ TCKMinPs: 468, /* 1/4267 * 2 */
TCKMaxPs: TCKMaxPsDefault, TCKMaxPs: TCKMaxPsDefault,
CASLatenciesx16Channel: "6 10 14 20 24 28 32 36", CASLatenciesx16Channel: "6 10 14 20 24 28 32 36",
CASLatenciesx8Channel: "6 10 16 22 26 32 36 40", CASLatenciesx8Channel: "6 10 16 22 26 32 36 40",
}, },
3733: { 3733: {
TCKMinPs: 535, /* 1/3733 * 2 */ TCKMinPs: 535, /* 1/3733 * 2 */
TCKMaxPs: TCKMaxPsDefault, TCKMaxPs: TCKMaxPsDefault,
CASLatenciesx16Channel: "6 10 14 20 24 28 32", CASLatenciesx16Channel: "6 10 14 20 24 28 32",
CASLatenciesx8Channel: "6 10 16 22 26 32 36", CASLatenciesx8Channel: "6 10 16 22 26 32 36",
}, },
3200: { 3200: {
TCKMinPs: 625, /* 1/3200 * 2 */ TCKMinPs: 625, /* 1/3200 * 2 */
TCKMaxPs: TCKMaxPsDefault, TCKMaxPs: TCKMaxPsDefault,
CASLatenciesx16Channel: "6 10 14 20 24 28", CASLatenciesx16Channel: "6 10 14 20 24 28",
CASLatenciesx8Channel: "6 10 16 22 26 32", CASLatenciesx8Channel: "6 10 16 22 26 32",
}, },
} }
var bankEncoding = map[int]byte { var bankEncoding = map[int]byte{
4: 0 << 4, 4: 0 << 4,
8: 1 << 4, 8: 1 << 4,
} }
@ -459,49 +459,49 @@ func encodeTRFCPBMinLsb(memAttribs *memAttributes) byte {
return byte(convNsToMtb(memAttribs.TRFCPBNs) & 0xff) return byte(convNsToMtb(memAttribs.TRFCPBNs) & 0xff)
} }
type SPDAttribFunc func (*memAttributes) byte type SPDAttribFunc func(*memAttributes) byte
type SPDAttribTableEntry struct { type SPDAttribTableEntry struct {
constVal byte constVal byte
getVal SPDAttribFunc getVal SPDAttribFunc
} }
const ( const (
/* SPD Byte Index */ /* SPD Byte Index */
SPDIndexSize = 0 SPDIndexSize = 0
SPDIndexRevision = 1 SPDIndexRevision = 1
SPDIndexMemoryType = 2 SPDIndexMemoryType = 2
SPDIndexModuleType = 3 SPDIndexModuleType = 3
SPDIndexDensityBanks = 4 SPDIndexDensityBanks = 4
SPDIndexAddressing = 5 SPDIndexAddressing = 5
SPDIndexPackageType = 6 SPDIndexPackageType = 6
SPDIndexOptionalFeatures = 7 SPDIndexOptionalFeatures = 7
SPDIndexModuleOrganization = 12 SPDIndexModuleOrganization = 12
SPDIndexBusWidth = 13 SPDIndexBusWidth = 13
SPDIndexTimebases = 17 SPDIndexTimebases = 17
SPDIndexTCKMin = 18 SPDIndexTCKMin = 18
SPDIndexTCKMax = 19 SPDIndexTCKMax = 19
SPDIndexCASFirstByte = 20 SPDIndexCASFirstByte = 20
SPDIndexCASSecondByte = 21 SPDIndexCASSecondByte = 21
SPDIndexCASThirdByte = 22 SPDIndexCASThirdByte = 22
SPDIndexCASFourthByte = 23 SPDIndexCASFourthByte = 23
SPDIndexTAAMin = 24 SPDIndexTAAMin = 24
SPDIndexReadWriteLatency = 25 SPDIndexReadWriteLatency = 25
SPDIndexTRCDMin = 26 SPDIndexTRCDMin = 26
SPDIndexTRPABMin = 27 SPDIndexTRPABMin = 27
SPDIndexTRPPBMin = 28 SPDIndexTRPPBMin = 28
SPDIndexTRFCABMinLSB = 29 SPDIndexTRFCABMinLSB = 29
SPDIndexTRFCABMinMSB = 30 SPDIndexTRFCABMinMSB = 30
SPDIndexTRFCPBMinLSB = 31 SPDIndexTRFCPBMinLSB = 31
SPDIndexTRFCPBMinMSB = 32 SPDIndexTRFCPBMinMSB = 32
SPDIndexTRPPBMinFineOffset = 120 SPDIndexTRPPBMinFineOffset = 120
SPDIndexTRPABMinFineOffset = 121 SPDIndexTRPABMinFineOffset = 121
SPDIndexTRCDMinFineOffset = 122 SPDIndexTRCDMinFineOffset = 122
SPDIndexTAAMinFineOffset = 123 SPDIndexTAAMinFineOffset = 123
SPDIndexTCKMaxFineOffset = 124 SPDIndexTCKMaxFineOffset = 124
SPDIndexTCKMinFineOffset = 125 SPDIndexTCKMinFineOffset = 125
SPDIndexManufacturerPartNumberStartByte = 329 SPDIndexManufacturerPartNumberStartByte = 329
SPDIndexManufacturerPartNumberEndByte = 348 SPDIndexManufacturerPartNumberEndByte = 348
/* SPD Byte Value */ /* SPD Byte Value */
@ -562,39 +562,39 @@ const (
SPDValueManufacturerPartNumberBlank = 0x20 SPDValueManufacturerPartNumberBlank = 0x20
) )
var SPDAttribTable = map[int]SPDAttribTableEntry { var SPDAttribTable = map[int]SPDAttribTableEntry{
SPDIndexSize: { constVal: SPDValueSize }, SPDIndexSize: {constVal: SPDValueSize},
SPDIndexRevision: { constVal: SPDValueRevision }, SPDIndexRevision: {constVal: SPDValueRevision},
SPDIndexMemoryType: { constVal: SPDValueMemoryType }, SPDIndexMemoryType: {constVal: SPDValueMemoryType},
SPDIndexModuleType: { constVal: SPDValueModuleType }, SPDIndexModuleType: {constVal: SPDValueModuleType},
SPDIndexDensityBanks: { getVal: encodeDensityBanks }, SPDIndexDensityBanks: {getVal: encodeDensityBanks},
SPDIndexAddressing: { getVal: encodeSdramAddressing }, SPDIndexAddressing: {getVal: encodeSdramAddressing},
SPDIndexPackageType: { getVal: encodePackageType }, SPDIndexPackageType: {getVal: encodePackageType},
SPDIndexOptionalFeatures: { constVal: SPDValueOptionalFeatures }, SPDIndexOptionalFeatures: {constVal: SPDValueOptionalFeatures},
SPDIndexModuleOrganization: { getVal: encodeModuleOrganization }, SPDIndexModuleOrganization: {getVal: encodeModuleOrganization},
SPDIndexBusWidth: { getVal: encodeBusWidth }, SPDIndexBusWidth: {getVal: encodeBusWidth},
SPDIndexTimebases: { constVal: SPDValueTimebases }, SPDIndexTimebases: {constVal: SPDValueTimebases},
SPDIndexTCKMin: { getVal: encodeTCKMin }, SPDIndexTCKMin: {getVal: encodeTCKMin},
SPDIndexTCKMax: { getVal: encodeTCKMax }, SPDIndexTCKMax: {getVal: encodeTCKMax},
SPDIndexTCKMaxFineOffset: { getVal: encodeTCKMaxFineOffset }, SPDIndexTCKMaxFineOffset: {getVal: encodeTCKMaxFineOffset},
SPDIndexTCKMinFineOffset: { getVal: encodeTCKMinFineOffset }, SPDIndexTCKMinFineOffset: {getVal: encodeTCKMinFineOffset},
SPDIndexCASFirstByte: { getVal: encodeCASFirstByte }, SPDIndexCASFirstByte: {getVal: encodeCASFirstByte},
SPDIndexCASSecondByte: { getVal: encodeCASSecondByte }, SPDIndexCASSecondByte: {getVal: encodeCASSecondByte},
SPDIndexCASThirdByte: { getVal: encodeCASThirdByte }, SPDIndexCASThirdByte: {getVal: encodeCASThirdByte},
SPDIndexCASFourthByte: { constVal: SPDValueCASFourthByte }, SPDIndexCASFourthByte: {constVal: SPDValueCASFourthByte},
SPDIndexTAAMin: { getVal: encodeTAAMin }, SPDIndexTAAMin: {getVal: encodeTAAMin},
SPDIndexTAAMinFineOffset: { getVal: encodeTAAMinFineOffset }, SPDIndexTAAMinFineOffset: {getVal: encodeTAAMinFineOffset},
SPDIndexReadWriteLatency: { constVal: SPDValueReadWriteLatency }, SPDIndexReadWriteLatency: {constVal: SPDValueReadWriteLatency},
SPDIndexTRCDMin: { getVal: encodeTRCDMin }, SPDIndexTRCDMin: {getVal: encodeTRCDMin},
SPDIndexTRCDMinFineOffset: { getVal: encodeTRCDMinFineOffset }, SPDIndexTRCDMinFineOffset: {getVal: encodeTRCDMinFineOffset},
SPDIndexTRPABMin: { getVal: encodeTRPABMin }, SPDIndexTRPABMin: {getVal: encodeTRPABMin},
SPDIndexTRPABMinFineOffset: { getVal: encodeTRPABMinFineOffset }, SPDIndexTRPABMinFineOffset: {getVal: encodeTRPABMinFineOffset},
SPDIndexTRPPBMin: { getVal: encodeTRPPBMin }, SPDIndexTRPPBMin: {getVal: encodeTRPPBMin},
SPDIndexTRPPBMinFineOffset: { getVal: encodeTRPPBMinFineOffset }, SPDIndexTRPPBMinFineOffset: {getVal: encodeTRPPBMinFineOffset},
SPDIndexTRFCABMinLSB: { getVal: encodeTRFCABMinLsb }, SPDIndexTRFCABMinLSB: {getVal: encodeTRFCABMinLsb},
SPDIndexTRFCABMinMSB: { getVal: encodeTRFCABMinMsb }, SPDIndexTRFCABMinMSB: {getVal: encodeTRFCABMinMsb},
SPDIndexTRFCPBMinLSB: { getVal: encodeTRFCPBMinLsb }, SPDIndexTRFCPBMinLSB: {getVal: encodeTRFCPBMinLsb},
SPDIndexTRFCPBMinMSB: { getVal: encodeTRFCPBMinMsb }, SPDIndexTRFCPBMinMSB: {getVal: encodeTRFCPBMinMsb},
} }
type memParts struct { type memParts struct {
@ -602,8 +602,8 @@ type memParts struct {
} }
type memPart struct { type memPart struct {
Name string Name string
Attribs memAttributes Attribs memAttributes
SPDFileName string SPDFileName string
} }
@ -649,7 +649,7 @@ func createSPD(memAttribs *memAttributes) string {
for i := 0; i < 512; i++ { for i := 0; i < 512; i++ {
b := getSPDByte(i, memAttribs) b := getSPDByte(i, memAttribs)
if (i + 1) % 16 == 0 { if (i+1)%16 == 0 {
s += fmt.Sprintf("%02X\n", b) s += fmt.Sprintf("%02X\n", b)
} else { } else {
s += fmt.Sprintf("%02X ", b) s += fmt.Sprintf("%02X ", b)
@ -827,7 +827,7 @@ func updateCAS(memAttribs *memAttributes) error {
latencies := strings.Fields(memAttribs.CASLatencies) latencies := strings.Fields(memAttribs.CASLatencies)
for i := 0; i < len(latencies); i++ { for i := 0; i < len(latencies); i++ {
latency,err := strconv.Atoi(latencies[i]) latency, err := strconv.Atoi(latencies[i])
if err != nil { if err != nil {
return fmt.Errorf("Unable to convert latency ", latencies[i]) return fmt.Errorf("Unable to convert latency ", latencies[i])
} }