util/spd_tools: Format lp5 file to golang standards
This commit formats the lp5.go file according to goland standards. TEST=Built spd_tools Signed-off-by: Robert Zieba <robertzieba@google.com> Change-Id: If102c90f732efc51a90de6cc0e18c879d56699b5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68375 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
This commit is contained in:
parent
3de39fa36f
commit
8ff8937843
|
@ -47,13 +47,13 @@ type LP5DensityParams struct {
|
||||||
|
|
||||||
type LP5SpeedParams struct {
|
type LP5SpeedParams struct {
|
||||||
defaultTCKMinPs int
|
defaultTCKMinPs int
|
||||||
MaxCASLatency int
|
MaxCASLatency int
|
||||||
}
|
}
|
||||||
|
|
||||||
type LP5BankArchParams struct {
|
type LP5BankArchParams struct {
|
||||||
NumBanks int
|
NumBanks int
|
||||||
BankGroups int
|
BankGroups int
|
||||||
BurstAddressBits int
|
BurstAddressBits int
|
||||||
}
|
}
|
||||||
|
|
||||||
type LP5SPDAttribFunc func(*LP5MemAttributes) byte
|
type LP5SPDAttribFunc func(*LP5MemAttributes) byte
|
||||||
|
@ -66,12 +66,12 @@ type LP5SPDAttribTableEntry struct {
|
||||||
type LP5SetFunc func(*LP5MemAttributes) int
|
type LP5SetFunc func(*LP5MemAttributes) int
|
||||||
|
|
||||||
type LP5Set struct {
|
type LP5Set struct {
|
||||||
SPDRevision byte
|
SPDRevision byte
|
||||||
getBankArch LP5SetFunc
|
getBankArch LP5SetFunc
|
||||||
optionalFeatures byte
|
optionalFeatures byte
|
||||||
otherOptionalFeatures byte
|
otherOptionalFeatures byte
|
||||||
busWidthEncoding byte
|
busWidthEncoding byte
|
||||||
speedToTCKMinPs map[int]int
|
speedToTCKMinPs map[int]int
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------------------------ */
|
||||||
|
@ -208,10 +208,10 @@ var LP5SetInfo = map[int]LP5Set{
|
||||||
* = 1 / (WCK rate / WCK:CK)
|
* = 1 / (WCK rate / WCK:CK)
|
||||||
* = 1 / (speed grade / 2 / WCK:CK) // "double data rate"
|
* = 1 / (speed grade / 2 / WCK:CK) // "double data rate"
|
||||||
*/
|
*/
|
||||||
speedToTCKMinPs: map[int]int{
|
speedToTCKMinPs: map[int]int{
|
||||||
7500 : 1066, /* 1 / (7500 / 2 / 4) */
|
7500: 1066, /* 1 / (7500 / 2 / 4) */
|
||||||
6400 : 1250, /* 1 / (6400 / 2 / 4) */
|
6400: 1250, /* 1 / (6400 / 2 / 4) */
|
||||||
5500 : 1455, /* 1 / (5500 / 2 / 4) */
|
5500: 1455, /* 1 / (5500 / 2 / 4) */
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
1: {
|
1: {
|
||||||
|
@ -310,8 +310,8 @@ var LP5DensityGbToSPDEncoding = map[int]LP5DensityParams{
|
||||||
* Maps the number of banks to the SPD encoding as per JESD 21-C.
|
* Maps the number of banks to the SPD encoding as per JESD 21-C.
|
||||||
*/
|
*/
|
||||||
var LP5NumBanksEncoding = map[int]byte{
|
var LP5NumBanksEncoding = map[int]byte{
|
||||||
4: 0x0,
|
4: 0x0,
|
||||||
8: 0x1,
|
8: 0x1,
|
||||||
16: 0x2,
|
16: 0x2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ var LP5RowAddressBitsEncoding = map[int]byte{
|
||||||
* Maps the number of column address bits to the SPD encoding as per JESD 21-C.
|
* Maps the number of column address bits to the SPD encoding as per JESD 21-C.
|
||||||
*/
|
*/
|
||||||
var LP5ColAddressBitsEncoding = map[int]byte{
|
var LP5ColAddressBitsEncoding = map[int]byte{
|
||||||
9: 0x0,
|
9: 0x0,
|
||||||
10: 0x1,
|
10: 0x1,
|
||||||
11: 0x2,
|
11: 0x2,
|
||||||
12: 0x3,
|
12: 0x3,
|
||||||
|
@ -347,18 +347,18 @@ var LP5ColAddressBitsEncoding = map[int]byte{
|
||||||
|
|
||||||
var LP5BankArchToSPDEncoding = map[int]LP5BankArchParams{
|
var LP5BankArchToSPDEncoding = map[int]LP5BankArchParams{
|
||||||
LP5BGBankArch: {
|
LP5BGBankArch: {
|
||||||
NumBanks: 4,
|
NumBanks: 4,
|
||||||
BankGroups: 4,
|
BankGroups: 4,
|
||||||
BurstAddressBits: 4,
|
BurstAddressBits: 4,
|
||||||
},
|
},
|
||||||
LP58BBankArch: {
|
LP58BBankArch: {
|
||||||
NumBanks: 8,
|
NumBanks: 8,
|
||||||
BankGroups: 1,
|
BankGroups: 1,
|
||||||
BurstAddressBits: 5,
|
BurstAddressBits: 5,
|
||||||
},
|
},
|
||||||
LP516BBankArch: {
|
LP516BBankArch: {
|
||||||
NumBanks: 16,
|
NumBanks: 16,
|
||||||
BankGroups: 1,
|
BankGroups: 1,
|
||||||
BurstAddressBits: 4,
|
BurstAddressBits: 4,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -374,16 +374,16 @@ var LP5BankArchToSPDEncoding = map[int]LP5BankArchParams{
|
||||||
*/
|
*/
|
||||||
var LP5SpeedMbpsToSPDEncoding = map[int]LP5SpeedParams{
|
var LP5SpeedMbpsToSPDEncoding = map[int]LP5SpeedParams{
|
||||||
7500: {
|
7500: {
|
||||||
defaultTCKMinPs : 266, /* 1 / (7500 / 2) */
|
defaultTCKMinPs: 266, /* 1 / (7500 / 2) */
|
||||||
MaxCASLatency: 20,
|
MaxCASLatency: 20,
|
||||||
},
|
},
|
||||||
6400: {
|
6400: {
|
||||||
defaultTCKMinPs : 312, /* 1 / (6400 / 2) */
|
defaultTCKMinPs: 312, /* 1 / (6400 / 2) */
|
||||||
MaxCASLatency: 17,
|
MaxCASLatency: 17,
|
||||||
},
|
},
|
||||||
5500: {
|
5500: {
|
||||||
defaultTCKMinPs : 363, /* 1 / (5500 / 2) */
|
defaultTCKMinPs: 363, /* 1 / (5500 / 2) */
|
||||||
MaxCASLatency: 15,
|
MaxCASLatency: 15,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@ func LP5GetBankArchSet1(memAttribs *LP5MemAttributes) int {
|
||||||
* Mendocino does not support 8B. It uses 16B Bank Architecture for speed <= 3200 Mbps.
|
* Mendocino does not support 8B. It uses 16B Bank Architecture for speed <= 3200 Mbps.
|
||||||
* It uses BG Bank Architecture for speed > 3200 Mbps.
|
* It uses BG Bank Architecture for speed > 3200 Mbps.
|
||||||
*/
|
*/
|
||||||
if memAttribs.SpeedMbps <= 3200 {
|
if memAttribs.SpeedMbps <= 3200 {
|
||||||
return LP516BBankArch
|
return LP516BBankArch
|
||||||
}
|
}
|
||||||
return LP5BGBankArch
|
return LP5BGBankArch
|
||||||
|
@ -498,7 +498,7 @@ func LP5EncodeSdramAddressing(memAttribs *LP5MemAttributes) byte {
|
||||||
var b byte
|
var b byte
|
||||||
|
|
||||||
// 2:0 Column address bits.
|
// 2:0 Column address bits.
|
||||||
b = LP5ColAddressBitsEncoding[LP5ColAddressBits + LP5GetBurstAddressBits(memAttribs)]
|
b = LP5ColAddressBitsEncoding[LP5ColAddressBits+LP5GetBurstAddressBits(memAttribs)]
|
||||||
|
|
||||||
// 5:3 Row address bits.
|
// 5:3 Row address bits.
|
||||||
density := memAttribs.DensityPerDieGb
|
density := memAttribs.DensityPerDieGb
|
||||||
|
|
Loading…
Reference in New Issue