7 "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
8 "review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr"
9 "review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl"
10 "review.coreboot.org/coreboot.git/util/intelp2m/config"
11 "review.coreboot.org/coreboot.git/util/intelp2m/fields"
15 PAD_CFG_DW0_RO_FIELDS
= (0x1 << 27) |
(0x1 << 24) |
(0x3 << 21) |
(0xf << 16) |
0xfc
16 PAD_CFG_DW1_RO_FIELDS
= 0xfdffc3ff
20 PAD_CFG_DW0
= common
.PAD_CFG_DW0
21 PAD_CFG_DW1
= common
.PAD_CFG_DW1
22 MAX_DW_NUM
= common
.MAX_DW_NUM
25 type InheritanceMacro
interface {
29 NativeFunctionMacroAdd()
33 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 if strings
.Contains(macro
.PadIdGet(), "GPD") {
45 // See reset map for the TigerLake Community 2:
46 // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/tigerlake/gpio.c#L21
47 // remmap is not required because it is the same as common.
51 dw0
:= macro
.Register(PAD_CFG_DW0
)
52 var remapping
= map[uint8]uint32{
53 0: common
.RST_RSMRST
<< common
.PadRstCfgShift
,
54 1: common
.RST_DEEP
<< common
.PadRstCfgShift
,
55 2: common
.RST_PLTRST
<< common
.PadRstCfgShift
,
57 resetsrc
, valid
:= remapping
[dw0
.GetResetConfig()]
59 // dw0.SetResetConfig(resetsrc)
60 ResetConfigFieldVal
:= (dw0
.ValueGet() & 0x3fffffff) | remapping
[dw0
.GetResetConfig()]
61 dw0
.ValueSet(ResetConfigFieldVal
)
63 fmt
.Println("Invalid Pad Reset Config [ 0x", resetsrc
," ] for ", macro
.PadIdGet())
65 dw0
.CntrMaskFieldsClear(common
.PadRstCfgMask
)
68 // Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro
70 func (platform PlatformSpecific
) Pull() {
71 platform
.InheritanceMacro
.Pull()
74 // Adds PAD_CFG_GPI macro with arguments
75 func (platform PlatformSpecific
) GpiMacroAdd() {
76 platform
.InheritanceMacro
.GpiMacroAdd()
79 // Adds PAD_CFG_GPO macro with arguments
80 func (platform PlatformSpecific
) GpoMacroAdd() {
81 platform
.InheritanceMacro
.GpoMacroAdd()
84 // Adds PAD_CFG_NF macro with arguments
85 func (platform PlatformSpecific
) NativeFunctionMacroAdd() {
86 platform
.InheritanceMacro
.NativeFunctionMacroAdd()
90 func (platform PlatformSpecific
) NoConnMacroAdd() {
91 platform
.InheritanceMacro
.NoConnMacroAdd()
94 // GenMacro - generate pad macro
95 // dw0 : DW0 config register value
96 // dw1 : DW1 config register value
97 // return: string of macro
99 func (PlatformSpecific
) GenMacro(id
string, dw0
uint32, dw1
uint32, ownership
uint8) string {
100 macro
:= common
.GetInstanceMacro(
102 InheritanceMacro
: cnl
.PlatformSpecific
{
103 InheritanceMacro
: snr
.PlatformSpecific
{},
106 fields
.InterfaceGet(),
109 macro
.Register(PAD_CFG_DW0
).CntrMaskFieldsClear(common
.AllFields
)
110 macro
.Register(PAD_CFG_DW1
).CntrMaskFieldsClear(common
.AllFields
)
111 macro
.PadIdSet(id
).SetPadOwnership(ownership
)
112 macro
.Register(PAD_CFG_DW0
).ValueSet(dw0
).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS
)
113 macro
.Register(PAD_CFG_DW1
).ValueSet(dw1
).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS
)
114 return macro
.Generate()