6 "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
7 "review.coreboot.org/coreboot.git/util/intelp2m/config"
8 "review.coreboot.org/coreboot.git/util/intelp2m/fields"
9 "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr"
10 "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl"
14 PAD_CFG_DW0_RO_FIELDS
= (0x1 << 27) |
(0x1 << 24) |
(0x3 << 21) |
(0xf << 16) |
0xfc
15 PAD_CFG_DW1_RO_FIELDS
= 0xfdffc3ff
19 PAD_CFG_DW0
= common
.PAD_CFG_DW0
20 PAD_CFG_DW1
= common
.PAD_CFG_DW1
21 MAX_DW_NUM
= common
.MAX_DW_NUM
24 type InheritanceMacro
interface {
28 NativeFunctionMacroAdd()
32 type PlatformSpecific
struct {
37 // RemmapRstSrc - remmap Pad Reset Source Config
38 func (PlatformSpecific
) RemmapRstSrc() {
39 macro
:= common
.GetMacro()
40 if config
.TemplateGet() != config
.TempInteltool
{
41 // Use reset source remapping only if the input file is inteltool.log dump
44 dw0
:= macro
.Register(PAD_CFG_DW0
)
45 var remapping
= map[uint8]uint32{
46 0: common
.RST_RSMRST
<< common
.PadRstCfgShift
,
47 1: common
.RST_DEEP
<< common
.PadRstCfgShift
,
48 2: common
.RST_PLTRST
<< common
.PadRstCfgShift
,
50 resetsrc
, valid
:= remapping
[dw0
.GetResetConfig()]
52 // dw0.SetResetConfig(resetsrc)
53 ResetConfigFieldVal
:= (dw0
.ValueGet() & 0x3fffffff) | remapping
[dw0
.GetResetConfig()]
54 dw0
.ValueSet(ResetConfigFieldVal
)
56 fmt
.Println("Invalid Pad Reset Config [ 0x", resetsrc
," ] for ", macro
.PadIdGet())
58 dw0
.CntrMaskFieldsClear(common
.PadRstCfgMask
)
61 // Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro
63 func (platform PlatformSpecific
) Pull() {
64 platform
.InheritanceMacro
.Pull()
67 // Adds PAD_CFG_GPI macro with arguments
68 func (platform PlatformSpecific
) GpiMacroAdd() {
69 platform
.InheritanceMacro
.GpiMacroAdd()
72 // Adds PAD_CFG_GPO macro with arguments
73 func (platform PlatformSpecific
) GpoMacroAdd() {
74 platform
.InheritanceMacro
.GpoMacroAdd()
77 // Adds PAD_CFG_NF macro with arguments
78 func (platform PlatformSpecific
) NativeFunctionMacroAdd() {
79 platform
.InheritanceMacro
.NativeFunctionMacroAdd()
83 func (platform PlatformSpecific
) NoConnMacroAdd() {
84 platform
.InheritanceMacro
.NoConnMacroAdd()
87 // GenMacro - generate pad macro
88 // dw0 : DW0 config register value
89 // dw1 : DW1 config register value
90 // return: string of macro
92 func (platform PlatformSpecific
) GenMacro(id
string, dw0
uint32, dw1
uint32, ownership
uint8) string {
93 macro
:= common
.GetInstanceMacro(
95 InheritanceMacro
: cnl
.PlatformSpecific
{
96 InheritanceMacro
: snr
.PlatformSpecific
{},
99 fields
.InterfaceGet(),
102 macro
.Register(PAD_CFG_DW0
).CntrMaskFieldsClear(common
.AllFields
)
103 macro
.Register(PAD_CFG_DW1
).CntrMaskFieldsClear(common
.AllFields
)
104 macro
.PadIdSet(id
).SetPadOwnership(ownership
)
105 macro
.Register(PAD_CFG_DW0
).ValueSet(dw0
).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS
)
106 macro
.Register(PAD_CFG_DW1
).ValueSet(dw1
).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS
)
107 return macro
.Generate()