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 Alderlake GPD Group in the Community 2:
46 // https://github.com/coreboot/coreboot/blob/master/src/soc/intel/alderlake/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
,
56 3: common
.RST_PWROK
<< common
.PadRstCfgShift
,
58 resetsrc
, valid
:= remapping
[dw0
.GetResetConfig()]
60 // dw0.SetResetConfig(resetsrc)
61 ResetConfigFieldVal
:= (dw0
.ValueGet() & 0x3fffffff) | remapping
[dw0
.GetResetConfig()]
62 dw0
.ValueSet(ResetConfigFieldVal
)
64 fmt
.Println("Invalid Pad Reset Config [ 0x", resetsrc
," ] for ", macro
.PadIdGet())
66 dw0
.CntrMaskFieldsClear(common
.PadRstCfgMask
)
69 // Adds The Pad Termination (TERM) parameter from PAD_CFG_DW1 to the macro
71 func (platform PlatformSpecific
) Pull() {
72 platform
.InheritanceMacro
.Pull()
75 // Adds PAD_CFG_GPI macro with arguments
76 func (platform PlatformSpecific
) GpiMacroAdd() {
77 platform
.InheritanceMacro
.GpiMacroAdd()
80 // Adds PAD_CFG_GPO macro with arguments
81 func (platform PlatformSpecific
) GpoMacroAdd() {
82 platform
.InheritanceMacro
.GpoMacroAdd()
85 // Adds PAD_CFG_NF macro with arguments
86 func (platform PlatformSpecific
) NativeFunctionMacroAdd() {
87 platform
.InheritanceMacro
.NativeFunctionMacroAdd()
91 func (platform PlatformSpecific
) NoConnMacroAdd() {
92 platform
.InheritanceMacro
.NoConnMacroAdd()
95 // GenMacro - generate pad macro
96 // dw0 : DW0 config register value
97 // dw1 : DW1 config register value
98 // return: string of macro
100 func (PlatformSpecific
) GenMacro(id
string, dw0
uint32, dw1
uint32, ownership
uint8) string {
101 macro
:= common
.GetInstanceMacro(
103 InheritanceMacro
: cnl
.PlatformSpecific
{
104 InheritanceMacro
: snr
.PlatformSpecific
{},
107 fields
.InterfaceGet(),
110 macro
.Register(PAD_CFG_DW0
).CntrMaskFieldsClear(common
.AllFields
)
111 macro
.Register(PAD_CFG_DW1
).CntrMaskFieldsClear(common
.AllFields
)
112 macro
.PadIdSet(id
).SetPadOwnership(ownership
)
113 macro
.Register(PAD_CFG_DW0
).ValueSet(dw0
).ReadOnlyFieldsSet(PAD_CFG_DW0_RO_FIELDS
)
114 macro
.Register(PAD_CFG_DW1
).ValueSet(dw1
).ReadOnlyFieldsSet(PAD_CFG_DW1_RO_FIELDS
)
115 return macro
.Generate()