diff options
author | Martin Roth <martin@coreboot.org> | 2021-02-22 20:11:18 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-02-27 09:37:34 +0000 |
commit | f0a7e365276827bc8e1174074c15508211df1801 (patch) | |
tree | d401eaeedeb64eaafab144f99769b8c1c3c85254 /util/spd_tools/lp4x | |
parent | db717db5c59059a5d8646c2db32002b798bed106 (diff) |
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>
Diffstat (limited to 'util/spd_tools/lp4x')
-rw-r--r-- | util/spd_tools/lp4x/gen_part_id.go | 10 | ||||
-rw-r--r-- | util/spd_tools/lp4x/gen_spd.go | 236 |
2 files changed, 123 insertions, 123 deletions
diff --git a/util/spd_tools/lp4x/gen_part_id.go b/util/spd_tools/lp4x/gen_part_id.go index ad47aab521..71ef3ec11b 100644 --- a/util/spd_tools/lp4x/gen_part_id.go +++ b/util/spd_tools/lp4x/gen_part_id.go @@ -26,8 +26,8 @@ import ( */ const ( SPDManifestFileName = "lp4x_spd_manifest.generated.txt" - MakefileName = "Makefile.inc" - DRAMIdFileName = "dram_id.generated.txt" + MakefileName = "Makefile.inc" + DRAMIdFileName = "dram_id.generated.txt" ) func usage() { @@ -41,7 +41,7 @@ func usage() { func checkArgs() error { for _, arg := range os.Args[1:] { - if _, err := os.Stat(arg); err != nil { + if _, err := os.Stat(arg); err != nil { return err } } @@ -112,7 +112,7 @@ func appendPartIdInfo(s *string, partName string, index int) { type partIds struct { SPDFileName string - memParts string + memParts string } /* @@ -136,7 +136,7 @@ func genPartIdInfo(parts []string, partToSPDMap map[string]string, SPDToIndexMap continue } - SPDFileName,ok := partToSPDMap[p] + SPDFileName, ok := partToSPDMap[p] 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") } diff --git a/util/spd_tools/lp4x/gen_spd.go b/util/spd_tools/lp4x/gen_spd.go index 6f4f8955a5..aeb5e1923e 100644 --- a/util/spd_tools/lp4x/gen_spd.go +++ b/util/spd_tools/lp4x/gen_spd.go @@ -28,11 +28,11 @@ const ( SPDManifestFileName = "lp4x_spd_manifest.generated.txt" PlatformTGLADL = 0 - PlatformJSL = 1 + PlatformJSL = 1 PlatformCZN = 2 ) -var platformMap = map[string]int { +var platformMap = map[string]int{ "TGL": PlatformTGLADL, "JSL": PlatformJSL, "ADL": PlatformTGLADL, @@ -44,39 +44,39 @@ var currPlatform int type memAttributes struct { /* Primary attributes - must be provided by JSON file for each part */ DensityPerChannelGb int - Banks int - ChannelsPerDie int - DiesPerPackage int - BitWidthPerChannel int - RanksPerChannel int - SpeedMbps int + Banks int + ChannelsPerDie int + DiesPerPackage int + BitWidthPerChannel int + RanksPerChannel int + SpeedMbps int /* * All the following parameters are optional and required only if the part requires * special parameters as per the datasheet. */ /* Timing parameters */ - TRFCABNs int - TRFCPBNs int + TRFCABNs int + TRFCPBNs int TRPABMinNs int TRPPBMinNs int - TCKMinPs int - TCKMaxPs int - TAAMinPs int - TRCDMinNs int + TCKMinPs int + TCKMaxPs int + TAAMinPs int + TRCDMinNs int /* CAS */ - CASLatencies string - CASFirstByte byte + CASLatencies string + CASFirstByte byte CASSecondByte byte - CASThirdByte byte + CASThirdByte byte } /* This encodes the density in Gb to SPD values as per JESD 21-C */ -var densityGbToSPDEncoding = map[int]byte { - 4: 0x4, - 6: 0xb, - 8: 0x5, +var densityGbToSPDEncoding = map[int]byte{ + 4: 0x4, + 6: 0xb, + 8: 0x5, 12: 0x8, 16: 0x6, 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 * x16 physical channel. */ -var densityGbx16ChannelToRowColumnEncoding = map[int]byte { - 4: 0x19, /* 15 rows, 10 columns */ - 6: 0x21, /* 16 rows, 10 columns */ - 8: 0x21, /* 16 rows, 10 columns */ +var densityGbx16ChannelToRowColumnEncoding = map[int]byte{ + 4: 0x19, /* 15 rows, 10 columns */ + 6: 0x21, /* 16 rows, 10 columns */ + 8: 0x21, /* 16 rows, 10 columns */ 12: 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 * x8 physical channel. */ -var densityGbx8ChannelToRowColumnEncoding = map[int]byte { - 3: 0x21, /* 16 rows, 10 columns */ - 4: 0x21, /* 16 rows, 10 columns */ - 6: 0x29, /* 17 rows, 10 columns */ - 8: 0x29, /* 17 rows, 10 columns */ +var densityGbx8ChannelToRowColumnEncoding = map[int]byte{ + 3: 0x21, /* 16 rows, 10 columns */ + 4: 0x21, /* 16 rows, 10 columns */ + 6: 0x29, /* 17 rows, 10 columns */ + 8: 0x29, /* 17 rows, 10 columns */ 12: 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 * devices. */ -var densityGbPhysicalChannelToRefreshEncoding = map[int]refreshTimings { +var densityGbPhysicalChannelToRefreshEncoding = map[int]refreshTimings{ 3: { TRFCABNs: 180, TRFCPBNs: 90, @@ -148,15 +148,15 @@ var densityGbPhysicalChannelToRefreshEncoding = map[int]refreshTimings { } type speedParams struct { - TCKMinPs int - TCKMaxPs int + TCKMinPs int + TCKMaxPs int CASLatenciesx16Channel string - CASLatenciesx8Channel string + CASLatenciesx8Channel string } const ( /* First Byte */ - CAS6 = 1 << 1 + CAS6 = 1 << 1 CAS10 = 1 << 4 CAS14 = 1 << 7 /* Second Byte */ @@ -181,28 +181,28 @@ const ( TCKMaxPsDefault = 31875 ) -var speedMbpsToSPDEncoding = map[int]speedParams { +var speedMbpsToSPDEncoding = map[int]speedParams{ 4267: { - TCKMinPs: 468, /* 1/4267 * 2 */ - TCKMaxPs: TCKMaxPsDefault, + TCKMinPs: 468, /* 1/4267 * 2 */ + TCKMaxPs: TCKMaxPsDefault, 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: { - TCKMinPs: 535, /* 1/3733 * 2 */ - TCKMaxPs: TCKMaxPsDefault, + TCKMinPs: 535, /* 1/3733 * 2 */ + TCKMaxPs: TCKMaxPsDefault, 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: { - TCKMinPs: 625, /* 1/3200 * 2 */ - TCKMaxPs: TCKMaxPsDefault, + TCKMinPs: 625, /* 1/3200 * 2 */ + TCKMaxPs: TCKMaxPsDefault, 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, 8: 1 << 4, } @@ -459,49 +459,49 @@ func encodeTRFCPBMinLsb(memAttribs *memAttributes) byte { return byte(convNsToMtb(memAttribs.TRFCPBNs) & 0xff) } -type SPDAttribFunc func (*memAttributes) byte +type SPDAttribFunc func(*memAttributes) byte type SPDAttribTableEntry struct { constVal byte - getVal SPDAttribFunc + getVal SPDAttribFunc } const ( /* SPD Byte Index */ - SPDIndexSize = 0 - SPDIndexRevision = 1 - SPDIndexMemoryType = 2 - SPDIndexModuleType = 3 - SPDIndexDensityBanks = 4 - SPDIndexAddressing = 5 - SPDIndexPackageType = 6 - SPDIndexOptionalFeatures = 7 - SPDIndexModuleOrganization = 12 - SPDIndexBusWidth = 13 - SPDIndexTimebases = 17 - SPDIndexTCKMin = 18 - SPDIndexTCKMax = 19 - SPDIndexCASFirstByte = 20 - SPDIndexCASSecondByte = 21 - SPDIndexCASThirdByte = 22 - SPDIndexCASFourthByte = 23 - SPDIndexTAAMin = 24 - SPDIndexReadWriteLatency = 25 - SPDIndexTRCDMin = 26 - SPDIndexTRPABMin = 27 - SPDIndexTRPPBMin = 28 - SPDIndexTRFCABMinLSB = 29 - SPDIndexTRFCABMinMSB = 30 - SPDIndexTRFCPBMinLSB = 31 - SPDIndexTRFCPBMinMSB = 32 - SPDIndexTRPPBMinFineOffset = 120 - SPDIndexTRPABMinFineOffset = 121 - SPDIndexTRCDMinFineOffset = 122 - SPDIndexTAAMinFineOffset = 123 - SPDIndexTCKMaxFineOffset = 124 - SPDIndexTCKMinFineOffset = 125 + SPDIndexSize = 0 + SPDIndexRevision = 1 + SPDIndexMemoryType = 2 + SPDIndexModuleType = 3 + SPDIndexDensityBanks = 4 + SPDIndexAddressing = 5 + SPDIndexPackageType = 6 + SPDIndexOptionalFeatures = 7 + SPDIndexModuleOrganization = 12 + SPDIndexBusWidth = 13 + SPDIndexTimebases = 17 + SPDIndexTCKMin = 18 + SPDIndexTCKMax = 19 + SPDIndexCASFirstByte = 20 + SPDIndexCASSecondByte = 21 + SPDIndexCASThirdByte = 22 + SPDIndexCASFourthByte = 23 + SPDIndexTAAMin = 24 + SPDIndexReadWriteLatency = 25 + SPDIndexTRCDMin = 26 + SPDIndexTRPABMin = 27 + SPDIndexTRPPBMin = 28 + SPDIndexTRFCABMinLSB = 29 + SPDIndexTRFCABMinMSB = 30 + SPDIndexTRFCPBMinLSB = 31 + SPDIndexTRFCPBMinMSB = 32 + SPDIndexTRPPBMinFineOffset = 120 + SPDIndexTRPABMinFineOffset = 121 + SPDIndexTRCDMinFineOffset = 122 + SPDIndexTAAMinFineOffset = 123 + SPDIndexTCKMaxFineOffset = 124 + SPDIndexTCKMinFineOffset = 125 SPDIndexManufacturerPartNumberStartByte = 329 - SPDIndexManufacturerPartNumberEndByte = 348 + SPDIndexManufacturerPartNumberEndByte = 348 /* SPD Byte Value */ @@ -562,39 +562,39 @@ const ( SPDValueManufacturerPartNumberBlank = 0x20 ) -var SPDAttribTable = map[int]SPDAttribTableEntry { - SPDIndexSize: { constVal: SPDValueSize }, - SPDIndexRevision: { constVal: SPDValueRevision }, - SPDIndexMemoryType: { constVal: SPDValueMemoryType }, - SPDIndexModuleType: { constVal: SPDValueModuleType }, - SPDIndexDensityBanks: { getVal: encodeDensityBanks }, - SPDIndexAddressing: { getVal: encodeSdramAddressing }, - SPDIndexPackageType: { getVal: encodePackageType }, - SPDIndexOptionalFeatures: { constVal: SPDValueOptionalFeatures }, - SPDIndexModuleOrganization: { getVal: encodeModuleOrganization }, - SPDIndexBusWidth: { getVal: encodeBusWidth }, - SPDIndexTimebases: { constVal: SPDValueTimebases }, - SPDIndexTCKMin: { getVal: encodeTCKMin }, - SPDIndexTCKMax: { getVal: encodeTCKMax }, - SPDIndexTCKMaxFineOffset: { getVal: encodeTCKMaxFineOffset }, - SPDIndexTCKMinFineOffset: { getVal: encodeTCKMinFineOffset }, - SPDIndexCASFirstByte: { getVal: encodeCASFirstByte }, - SPDIndexCASSecondByte: { getVal: encodeCASSecondByte }, - SPDIndexCASThirdByte: { getVal: encodeCASThirdByte }, - SPDIndexCASFourthByte: { constVal: SPDValueCASFourthByte }, - SPDIndexTAAMin: { getVal: encodeTAAMin }, - SPDIndexTAAMinFineOffset: { getVal: encodeTAAMinFineOffset }, - SPDIndexReadWriteLatency: { constVal: SPDValueReadWriteLatency }, - SPDIndexTRCDMin: { getVal: encodeTRCDMin }, - SPDIndexTRCDMinFineOffset: { getVal: encodeTRCDMinFineOffset }, - SPDIndexTRPABMin: { getVal: encodeTRPABMin }, - SPDIndexTRPABMinFineOffset: { getVal: encodeTRPABMinFineOffset }, - SPDIndexTRPPBMin: { getVal: encodeTRPPBMin }, - SPDIndexTRPPBMinFineOffset: { getVal: encodeTRPPBMinFineOffset }, - SPDIndexTRFCABMinLSB: { getVal: encodeTRFCABMinLsb }, - SPDIndexTRFCABMinMSB: { getVal: encodeTRFCABMinMsb }, - SPDIndexTRFCPBMinLSB: { getVal: encodeTRFCPBMinLsb }, - SPDIndexTRFCPBMinMSB: { getVal: encodeTRFCPBMinMsb }, +var SPDAttribTable = map[int]SPDAttribTableEntry{ + SPDIndexSize: {constVal: SPDValueSize}, + SPDIndexRevision: {constVal: SPDValueRevision}, + SPDIndexMemoryType: {constVal: SPDValueMemoryType}, + SPDIndexModuleType: {constVal: SPDValueModuleType}, + SPDIndexDensityBanks: {getVal: encodeDensityBanks}, + SPDIndexAddressing: {getVal: encodeSdramAddressing}, + SPDIndexPackageType: {getVal: encodePackageType}, + SPDIndexOptionalFeatures: {constVal: SPDValueOptionalFeatures}, + SPDIndexModuleOrganization: {getVal: encodeModuleOrganization}, + SPDIndexBusWidth: {getVal: encodeBusWidth}, + SPDIndexTimebases: {constVal: SPDValueTimebases}, + SPDIndexTCKMin: {getVal: encodeTCKMin}, + SPDIndexTCKMax: {getVal: encodeTCKMax}, + SPDIndexTCKMaxFineOffset: {getVal: encodeTCKMaxFineOffset}, + SPDIndexTCKMinFineOffset: {getVal: encodeTCKMinFineOffset}, + SPDIndexCASFirstByte: {getVal: encodeCASFirstByte}, + SPDIndexCASSecondByte: {getVal: encodeCASSecondByte}, + SPDIndexCASThirdByte: {getVal: encodeCASThirdByte}, + SPDIndexCASFourthByte: {constVal: SPDValueCASFourthByte}, + SPDIndexTAAMin: {getVal: encodeTAAMin}, + SPDIndexTAAMinFineOffset: {getVal: encodeTAAMinFineOffset}, + SPDIndexReadWriteLatency: {constVal: SPDValueReadWriteLatency}, + SPDIndexTRCDMin: {getVal: encodeTRCDMin}, + SPDIndexTRCDMinFineOffset: {getVal: encodeTRCDMinFineOffset}, + SPDIndexTRPABMin: {getVal: encodeTRPABMin}, + SPDIndexTRPABMinFineOffset: {getVal: encodeTRPABMinFineOffset}, + SPDIndexTRPPBMin: {getVal: encodeTRPPBMin}, + SPDIndexTRPPBMinFineOffset: {getVal: encodeTRPPBMinFineOffset}, + SPDIndexTRFCABMinLSB: {getVal: encodeTRFCABMinLsb}, + SPDIndexTRFCABMinMSB: {getVal: encodeTRFCABMinMsb}, + SPDIndexTRFCPBMinLSB: {getVal: encodeTRFCPBMinLsb}, + SPDIndexTRFCPBMinMSB: {getVal: encodeTRFCPBMinMsb}, } type memParts struct { @@ -602,8 +602,8 @@ type memParts struct { } type memPart struct { - Name string - Attribs memAttributes + Name string + Attribs memAttributes SPDFileName string } @@ -649,7 +649,7 @@ func createSPD(memAttribs *memAttributes) string { for i := 0; i < 512; i++ { b := getSPDByte(i, memAttribs) - if (i + 1) % 16 == 0 { + if (i+1)%16 == 0 { s += fmt.Sprintf("%02X\n", b) } else { s += fmt.Sprintf("%02X ", b) @@ -827,7 +827,7 @@ func updateCAS(memAttribs *memAttributes) error { latencies := strings.Fields(memAttribs.CASLatencies) for i := 0; i < len(latencies); i++ { - latency,err := strconv.Atoi(latencies[i]) + latency, err := strconv.Atoi(latencies[i]) if err != nil { return fmt.Errorf("Unable to convert latency ", latencies[i]) } |