diff options
author | Maxim Polyakov <max.senia.poliak@gmail.com> | 2020-09-30 16:46:11 +0300 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-10-12 08:43:14 +0000 |
commit | 726282b44f15904b06f86f3d1d6b4d5d93bba76d (patch) | |
tree | 2d604a1ebddcb9e8f00dfdfce10723ca8cbbf29c /util/intelp2m/main.go | |
parent | f2f53c447aaac242f45eaaa2e9af7e3c76047baa (diff) | |
download | coreboot-726282b44f15904b06f86f3d1d6b4d5d93bba76d.tar.xz |
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/main.go')
-rw-r--r-- | util/intelp2m/main.go | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/util/intelp2m/main.go b/util/intelp2m/main.go index 8527c54586..a7bbc91079 100644 --- a/util/intelp2m/main.go +++ b/util/intelp2m/main.go @@ -51,27 +51,12 @@ func main() { "\tIn this case, some fields of the configuration registers\n" + "\tDW0 will be ignored.\n") - infoLevel1 := flag.Bool("i", - false, - "\n\tInfo Level 1: adds DW0/DW1 value to the comments:\n" + - "\t/* GPIO_173 - SDCARD_D0 */\n") - - infoLevel2 := flag.Bool("ii", - false, - "Info Level 2: adds original macro to the comments:\n" + - "\t/* GPIO_173 - SDCARD_D0 (DW0: 0x44000400, DW1: 0x00021000) */\n") - - infoLevel3 := flag.Bool("iii", - false, - "Info Level 3: adds information about bit fields that (need to be ignored)\n" + - "\twere ignored to generate a macro:\n" + - "\t/* GPIO_173 - SDCARD_D0 (DW0: 0x44000400, DW1: 0x00021000) */\n" + - "\t/* PAD_CFG_NF_IOSSTATE(GPIO_173, DN_20K, DEEP, NF1, HIZCRx1), */\n") - - infoLevel4 := flag.Bool("iiii", - false, - "Info Level 4: show decoded DW0/DW1 register:\n" + - "\t/* DW0: PAD_TRIG(DEEP) | PAD_BUF(TX_RX_DISABLE) - IGNORED */\n") + infoLevels := []*bool { + flag.Bool("i", false, "Show pads function in the comments"), + flag.Bool("ii", false, "Show DW0/DW1 value in the comments"), + flag.Bool("iii", false, "Show ignored bit fields in the comments"), + flag.Bool("iiii", false, "Show target PAD_CFG() macro in the comments"), + } template := flag.Int("t", 0, "template type number\n"+ "\t0 - inteltool.log (default)\n"+ @@ -94,14 +79,12 @@ func main() { config.IgnoredFieldsFlagSet(*ignFlag) config.NonCheckingFlagSet(*nonCheckFlag) - if *infoLevel1 { - config.InfoLevelSet(1) - } else if *infoLevel2 { - config.InfoLevelSet(2) - } else if *infoLevel3 { - config.InfoLevelSet(3) - } else if *infoLevel4 { - config.InfoLevelSet(4) + for level, flag := range infoLevels { + if *flag { + config.InfoLevelSet(level + 1) + fmt.Printf("Info level: Use level %d!\n", level + 1) + break + } } if !config.TemplateSet(*template) { |