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

@@ -54,6 +54,7 @@ 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.
@@ -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,
@@ -85,7 +85,7 @@ 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,
@@ -97,7 +97,7 @@ 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 */
@@ -111,7 +111,7 @@ 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,
@@ -119,7 +119,7 @@ var tRFC1Encoding = map[int]int {
} }
/* 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,
@@ -127,7 +127,7 @@ var tRFC2Encoding = map[int]int {
} }
/* 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,
@@ -148,7 +148,7 @@ type speedBinAttributes struct {
TCKMaxPs int TCKMaxPs int
} }
var speedBinToSPDEncoding = map[int]speedBinAttributes { var speedBinToSPDEncoding = map[int]speedBinAttributes{
1600: { 1600: {
TRASMinPs: 35000, TRASMinPs: 35000,
TCKMaxPs: 1500, TCKMaxPs: 1500,
@@ -394,7 +394,7 @@ 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,
@@ -720,8 +720,8 @@ 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
@@ -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 (
@@ -870,55 +869,55 @@ const (
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 {
@@ -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
@@ -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)

View File

@@ -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

@@ -32,7 +32,7 @@ const (
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,
@@ -73,7 +73,7 @@ type memAttributes struct {
} }
/* 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,
@@ -88,7 +88,7 @@ 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 */
@@ -101,7 +101,7 @@ 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 */
@@ -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,
@@ -181,7 +181,7 @@ 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,
@@ -202,7 +202,7 @@ var speedMbpsToSPDEncoding = map[int]speedParams {
}, },
} }
var bankEncoding = map[int]byte { var bankEncoding = map[int]byte{
4: 0 << 4, 4: 0 << 4,
8: 1 << 4, 8: 1 << 4,
} }
@@ -459,7 +459,7 @@ 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
@@ -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 {
@@ -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])
} }