summaryrefslogtreecommitdiff
path: root/util/intelp2m/platforms
diff options
context:
space:
mode:
authorMaxim Polyakov <max.senia.poliak@gmail.com>2020-09-30 16:46:11 +0300
committerPatrick Georgi <pgeorgi@google.com>2020-10-12 08:43:14 +0000
commit726282b44f15904b06f86f3d1d6b4d5d93bba76d (patch)
tree2d604a1ebddcb9e8f00dfdfce10723ca8cbbf29c /util/intelp2m/platforms
parentf2f53c447aaac242f45eaaa2e9af7e3c76047baa (diff)
util/intelp2m: Update output information format in the comments
Update the information format in the comments above the macros in the generated gpio.h file: PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD), /* LPSS_UART0_TXD */ -->(i) /* GPIO_39 - LPSS_UART0_TXD */ --> (ii) /* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii) /* DW0 : PAD_TRIG(OFF) - IGNORED */ --> (iii) /* _PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)), */ --> (iiii) PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD), Also, in the case of field macros: /* GPIO_39 - LPSS_UART0_TXD */ --> (ii) /* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii) /* DW0 : PAD_TRIG(OFF) - IGNORED */ --> (iii) /* PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE, DISPUPD), */ --> (iiii) PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)), By default, if do not use the -i... option, then additional information in comments will not be generated. TEST: git clone https://github.com/maxpoliak/inteltool-examples.git test ./intelp2m -n -file test/inteltool-asrock-h110m-stx.log ./intelp2m -fld cb -file test/inteltool-asrock-h110m-stx.log ./intelp2m -fld fsp -file test/inteltool-asrock-h110m-stx.log ./intelp2m -fld raw -file test/inteltool-asrock-h110m-stx.log Before and after (now with -i key) the patch, gpio.h is no different. Change-Id: I760f4aadece786ea455fb7569f42e06fefce2b61 Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/45168 Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/intelp2m/platforms')
-rw-r--r--util/intelp2m/platforms/common/macro.go72
1 files changed, 41 insertions, 31 deletions
diff --git a/util/intelp2m/platforms/common/macro.go b/util/intelp2m/platforms/common/macro.go
index e30ef225fe..38937f66b9 100644
--- a/util/intelp2m/platforms/common/macro.go
+++ b/util/intelp2m/platforms/common/macro.go
@@ -292,32 +292,27 @@ func (macro *Macro) Or() *Macro {
return macro
}
-// AddToMacroIgnoredMask - Print info about ignored field mask
-// title - warning message
-func (macro *Macro) AddToMacroIgnoredMask() *Macro {
- if config.InfoLevelGet() < 4 || config.IsFspStyleMacro() {
- return macro
+// DecodeIgnored - Add info about ignored field mask
+// reg : PAD_CFG_DW0 or PAD_CFG_DW1 register
+func (macro *Macro) DecodeIgnored(reg uint8) *Macro {
+ var decode = map[uint8]func() {
+ PAD_CFG_DW0: macro.Fields.DecodeDW0,
+ PAD_CFG_DW1: macro.Fields.DecodeDW1,
}
- dw0 := macro.Register(PAD_CFG_DW0)
- dw1 := macro.Register(PAD_CFG_DW1)
- // Get mask of ignored bit fields.
- dw0Ignored := dw0.IgnoredFieldsGet()
- dw1Ignored := dw1.IgnoredFieldsGet()
- if dw0Ignored != 0 {
- dw0temp := dw0.ValueGet()
- dw0.ValueSet(dw0Ignored)
- macro.Add("\n\t/* DW0 : ")
- macro.Fields.DecodeDW0()
- macro.Add(" - IGNORED */")
- dw0.ValueSet(dw0temp)
+ decodefn, valid := decode[reg]
+ if !valid || config.IsFspStyleMacro() {
+ return macro
}
- if dw1Ignored != 0 {
- dw1temp := dw1.ValueGet()
- dw1.ValueSet(dw1Ignored)
- macro.Add("\n\t/* DW1 : ")
- macro.Fields.DecodeDW1()
- macro.Add(" - IGNORED */")
- dw1.ValueSet(dw1temp)
+ dw := macro.Register(reg)
+ ignored := dw.IgnoredFieldsGet()
+ if ignored != 0 {
+ temp := dw.ValueGet()
+ dw.ValueSet(ignored)
+ regnum := strconv.Itoa(int(reg))
+ macro.Add("/* DW" + regnum + ": ")
+ decodefn()
+ macro.Add(" - IGNORED */\n\t")
+ dw.ValueSet(temp)
}
return macro
}
@@ -331,15 +326,19 @@ func (macro *Macro) GenerateFields() *Macro {
dw0Ignored := dw0.IgnoredFieldsGet()
dw1Ignored := dw1.IgnoredFieldsGet()
- if config.InfoLevelGet() <= 1 {
+ if config.InfoLevelGet() != 4 {
macro.Clear()
- } else if config.InfoLevelGet() >= 3 {
+ }
+ if config.InfoLevelGet() >= 3 {
// Add string of reference macro as a comment
reference := macro.Get()
macro.Clear()
- macro.Add("/* ").Add(reference).Add(" */")
- macro.AddToMacroIgnoredMask()
- macro.Add("\n\t")
+ /* DW0 : PAD_TRIG(OFF) | PAD_BUF(RX_DISABLE) | 1 - IGNORED */
+ macro.DecodeIgnored(PAD_CFG_DW0).DecodeIgnored(PAD_CFG_DW1)
+ if config.InfoLevelGet() >= 4 {
+ /* PAD_CFG_NF(GPP_B23, 20K_PD, PLTRST, NF2), */
+ macro.Add("/* ").Add(reference).Add(" */\n\t")
+ }
}
if config.AreFieldsIgnored() {
// Consider bit fields that should be ignored when regenerating
@@ -409,8 +408,19 @@ func (macro *Macro) Generate() string {
}
if config.IsNonCheckingFlagUsed() {
- macro.AddToMacroIgnoredMask()
- return macro.Get()
+ body := macro.Get()
+ if config.InfoLevelGet() >= 3 {
+ macro.Clear().DecodeIgnored(PAD_CFG_DW0).DecodeIgnored(PAD_CFG_DW1)
+ comment := macro.Get()
+ if config.InfoLevelGet() >= 4 {
+ macro.Clear().Add("/* ")
+ macro.Fields.GenerateString()
+ macro.Add(" */\n\t")
+ comment += macro.Get()
+ }
+ return comment + body
+ }
+ return body
}
return macro.check().Get()