Maxim has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/85769?usp=email )
Change subject: util/intelp2m: Provide GPP group slice from each platform ......................................................................
util/intelp2m: Provide GPP group slice from each platform
Instead of a pointer to a function for analyzing the pad name, provide GPP group slice with pad names to the parser. This will get rid of some functions and files and make the code cleaner.
TEST: - 'make test' = PASS; - 'intelp2m -file parser/testlog/inteltool_test.log' = no errors.
Change-Id: I0d7818d3892450a37bffbf1ffd9524888e4675bf Signed-off-by: Maxim Polyakov max.senia.poliak@gmail.com --- M util/intelp2m/parser/parser.go M util/intelp2m/platforms/adl/macro.go D util/intelp2m/platforms/adl/template.go M util/intelp2m/platforms/apl/macro.go D util/intelp2m/platforms/apl/template.go M util/intelp2m/platforms/cnl/macro.go D util/intelp2m/platforms/cnl/template.go D util/intelp2m/platforms/common/template.go M util/intelp2m/platforms/ebg/macro.go D util/intelp2m/platforms/ebg/template.go M util/intelp2m/platforms/jsl/macro.go D util/intelp2m/platforms/jsl/template.go M util/intelp2m/platforms/lbg/macro.go D util/intelp2m/platforms/lbg/template.go M util/intelp2m/platforms/mtl/macro.go D util/intelp2m/platforms/mtl/template.go M util/intelp2m/platforms/platforms.go M util/intelp2m/platforms/snr/macro.go D util/intelp2m/platforms/snr/template.go M util/intelp2m/platforms/tgl/macro.go D util/intelp2m/platforms/tgl/template.go 21 files changed, 92 insertions(+), 173 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/69/85769/1
diff --git a/util/intelp2m/parser/parser.go b/util/intelp2m/parser/parser.go index 8e0d7c0..050c679 100644 --- a/util/intelp2m/parser/parser.go +++ b/util/intelp2m/parser/parser.go @@ -83,15 +83,25 @@ return group }
+// checkGPPG() checks whether the desired group is present in the string +func checkKeywords(line string, slice []string) bool { + for _, key := range slice { + if strings.Contains(line, key) { + return true + } + } + return false +} + // Extract() extracts pad information from a string func Extract(line string) Entry { - if included, _ := common.KeywordsCheck(line, "GPIO Community", "GPIO Group"); included { + if checkKeywords(line, []string{"GPIO Community", "GPIO Group"}) { return extractGroup(line) } - if checkKeyword := platforms.GetKeywordChekingAction(); checkKeyword == nil { - logs.Errorf("information extraction error: skip line <%s>", line) + if gppg, err := platforms.GetGPPGroups(); err != nil { + logs.Errorf("extract error: %v: skip line <%s>", err, line) return Entry{EType: EntryEmpty} - } else if checkKeyword(line) { + } else if checkKeywords(line, gppg) { pad, err := extractPad(line) if err != nil { logs.Errorf("extract pad info from %s: %v", line, err) diff --git a/util/intelp2m/platforms/adl/macro.go b/util/intelp2m/platforms/adl/macro.go index a7a7362..e66a827 100644 --- a/util/intelp2m/platforms/adl/macro.go +++ b/util/intelp2m/platforms/adl/macro.go @@ -14,6 +14,11 @@ DW1Mask uint32 = 0b11111101111111111100001111111111 )
+// "GPP_A", "GPP_B", "GPP_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", +// "GPP_H", "GPP_I", "GPP_J", "GPP_K", "GPP_R", "GPP_S", "GPP_T", +// "GPD", "VGPIO_USB", "VGPIO_PCIE" +var GPPGroups = []string{"GPP_", "GPD", "VGPIO"} + var remapping = common.ResetSources{ 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, diff --git a/util/intelp2m/platforms/adl/template.go b/util/intelp2m/platforms/adl/template.go deleted file mode 100644 index 4af499d..0000000 --- a/util/intelp2m/platforms/adl/template.go +++ /dev/null @@ -1,13 +0,0 @@ -package adl - -import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - -// CheckKeyword() parses lines of the configuration file and returns true if the keyword is -// contained in the line -// "GPP_A", "GPP_B", "GPP_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", -// "GPP_H", "GPP_I", "GPP_J", "GPP_K", "GPP_R", "GPP_S", "GPP_T", -// "GPD", "VGPIO_USB", "VGPIO_PCIE" -func CheckKeyword(line string) bool { - isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") - return isIncluded -} diff --git a/util/intelp2m/platforms/apl/macro.go b/util/intelp2m/platforms/apl/macro.go index 614d0be..103d602 100644 --- a/util/intelp2m/platforms/apl/macro.go +++ b/util/intelp2m/platforms/apl/macro.go @@ -12,6 +12,18 @@ DW1Mask uint32 = 0b11111111111111000000000011111111 )
+var GPPGroups = []string{ + "GPIO_", "TCK", "TRST_B", "TMS", "TDI", "CX_PMODE", "CX_PREQ_B", "JTAGX", "CX_PRDY_B", + "TDO", "CNV_BRI_DT", "CNV_BRI_RSP", "CNV_RGI_DT", "CNV_RGI_RSP", "SVID0_ALERT_B", + "SVID0_DATA", "SVID0_CLK", "PMC_SPI_FS", "PMC_SPI_RXD", "PMC_SPI_TXD", "PMC_SPI_CLK", + "PMIC_PWRGOOD", "PMIC_RESET_B", "PMIC_THERMTRIP_B", "PMIC_STDBY", "PROCHOT_B", + "PMIC_I2C_SCL", "PMIC_I2C_SDA", "FST_SPI_CLK_FB", "OSC_CLK_OUT_", "PMU_AC_PRESENT", + "PMU_BATLOW_B", "PMU_PLTRST_B", "PMU_PWRBTN_B", "PMU_RESETBUTTON_B", "PMU_SLP_S0_B", + "PMU_SLP_S3_B", "PMU_SLP_S4_B", "PMU_SUSCLK", "PMU_WAKE_B", "SUS_STAT_B", "SUSPWRDNACK", + "SMB_ALERTB", "SMB_CLK", "SMB_DATA", "LPC_ILB_SERIRQ", "LPC_CLKOUT", "LPC_AD", "LPC_CLKRUNB", + "LPC_FRAMEB", +} + type BasePlatform struct { common.BasePlatform } diff --git a/util/intelp2m/platforms/apl/template.go b/util/intelp2m/platforms/apl/template.go deleted file mode 100644 index 014431d..0000000 --- a/util/intelp2m/platforms/apl/template.go +++ /dev/null @@ -1,19 +0,0 @@ -package apl - -import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - -// CheckKeyword() parses lines of the configuration file and returns true if the keyword is -// contained in the line -func CheckKeyword(line string) bool { - isIncluded, _ := common.KeywordsCheck(line, - "GPIO_", "TCK", "TRST_B", "TMS", "TDI", "CX_PMODE", "CX_PREQ_B", "JTAGX", "CX_PRDY_B", - "TDO", "CNV_BRI_DT", "CNV_BRI_RSP", "CNV_RGI_DT", "CNV_RGI_RSP", "SVID0_ALERT_B", - "SVID0_DATA", "SVID0_CLK", "PMC_SPI_FS", "PMC_SPI_RXD", "PMC_SPI_TXD", "PMC_SPI_CLK", - "PMIC_PWRGOOD", "PMIC_RESET_B", "PMIC_THERMTRIP_B", "PMIC_STDBY", "PROCHOT_B", - "PMIC_I2C_SCL", "PMIC_I2C_SDA", "FST_SPI_CLK_FB", "OSC_CLK_OUT_", "PMU_AC_PRESENT", - "PMU_BATLOW_B", "PMU_PLTRST_B", "PMU_PWRBTN_B", "PMU_RESETBUTTON_B", "PMU_SLP_S0_B", - "PMU_SLP_S3_B", "PMU_SLP_S4_B", "PMU_SUSCLK", "PMU_WAKE_B", "SUS_STAT_B", "SUSPWRDNACK", - "SMB_ALERTB", "SMB_CLK", "SMB_DATA", "LPC_ILB_SERIRQ", "LPC_CLKOUT", "LPC_AD", "LPC_CLKRUNB", - "LPC_FRAMEB") - return isIncluded -} diff --git a/util/intelp2m/platforms/cnl/macro.go b/util/intelp2m/platforms/cnl/macro.go index dc54475..740c83b 100644 --- a/util/intelp2m/platforms/cnl/macro.go +++ b/util/intelp2m/platforms/cnl/macro.go @@ -15,6 +15,26 @@ DW1Mask uint32 = 0b11111101111111111100001111111111 )
+var GPPGroups = []string{ + "GPP_", "GPD", // "GPP_A", "GPP_B", "GPP_G", "GPP_D", "GPP_F", "GPP_H", "GPP_C", "GPP_E" + "I2S1_TXD", "CNV_BTEN", "CNV_GNEN", "CNV_WFEN", "CNV_WCEN", "vCNV_GNSS_HOST_WAKE_B", + "vSD3_CD_B", "CNV_BT_HOST_WAKE_B", "CNV_BT_IF_SELECT", "vCNV_BT_UART_TXD", + "vCNV_BT_UART_RXD", "vCNV_BT_UART_CTS_B", "vCNV_BT_UART_RTS_B", "vCNV_MFUART1_TXD", + "vCNV_MFUART1_RXD", "vCNV_MFUART1_CTS_B", "vCNV_MFUART1_RTS_B", "vCNV_GNSS_UART_TXD", + "vCNV_GNSS_UART_RXD", "vCNV_GNSS_UART_CTS_B", "vCNV_GNSS_UART_RTS_B", "vUART0_TXD", + "vUART0_RXD", "vUART0_CTS_B", "vUART0_RTS_B", "vISH_UART0_TXD", "vISH_UART0_RXD", + "vISH_UART0_CTS_B", "vISH_UART0_RTS_B", "vISH_UART1_TXD", "vISH_UART1_RXD", + "vISH_UART1_CTS_B", "vISH_UART1_RTS_B", "vCNV_BT_I2S_BCLK", "vCNV_BT_I2S_WS_SYNC", + "vCNV_BT_I2S_SDO", "vCNV_BT_I2S_SDI", "vSSP2_SCLK", "vSSP2_SFRM", "vSSP2_TXD", + "vSSP2_RXD", "SLP_LAN_B", "SLP_SUS_B", "WAKE_B", "DRAM_RESET_B", "SPI0_IO_2", + "SPI0_IO_3", "SPI0_MISO", "SPI0_MOSI", "SPI0_CS2_B", "SPI0_CS0_B", "SPI0_CS1_B", + "SPI0_CLK", "SPI0_CLK_LOOPBK", "HDACPU_SDI", "HDACPU_SDO", "HDACPU_SCLK", "PM_SYNC", + "PECI", "CPUPWRGD", "THRMTRIP_B", "PLTRST_CPU_B", "PM_DOWN", "TRIGGER_IN", + "TRIGGER_OUT", "PCH_TDO", "PCH_JTAGX", "PROC_PRDY_B", "PROC_PREQ_B", "CPU_TRST_B", + "PCH_TDI", "PCH_TMS", "PCH_TCK", "ITP_PMODE", "SYS_PWROK", "SYS_RESET_B", "CL_RST_B", + "HDA_BCLK", "HDA_RST_B", "HDA_SYNC", "HDA_SDO", "HDA_SDI0", "HDA_SDI1", "I2S1_SFRM", +} + var remapping = common.ResetSources{ 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, diff --git a/util/intelp2m/platforms/cnl/template.go b/util/intelp2m/platforms/cnl/template.go deleted file mode 100644 index f1bb525..0000000 --- a/util/intelp2m/platforms/cnl/template.go +++ /dev/null @@ -1,25 +0,0 @@ -package cnl - -import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - -func CheckKeyword(line string) bool { - // "GPP_" : "GPP_A", "GPP_B", "GPP_G", "GPP_D", "GPP_F", "GPP_H", "GPP_C", "GPP_E" - included, _ := common.KeywordsCheck(line, "GPP_", "GPD", - "I2S1_TXD", "CNV_BTEN", "CNV_GNEN", "CNV_WFEN", "CNV_WCEN", "vCNV_GNSS_HOST_WAKE_B", - "vSD3_CD_B", "CNV_BT_HOST_WAKE_B", "CNV_BT_IF_SELECT", "vCNV_BT_UART_TXD", - "vCNV_BT_UART_RXD", "vCNV_BT_UART_CTS_B", "vCNV_BT_UART_RTS_B", "vCNV_MFUART1_TXD", - "vCNV_MFUART1_RXD", "vCNV_MFUART1_CTS_B", "vCNV_MFUART1_RTS_B", "vCNV_GNSS_UART_TXD", - "vCNV_GNSS_UART_RXD", "vCNV_GNSS_UART_CTS_B", "vCNV_GNSS_UART_RTS_B", "vUART0_TXD", - "vUART0_RXD", "vUART0_CTS_B", "vUART0_RTS_B", "vISH_UART0_TXD", "vISH_UART0_RXD", - "vISH_UART0_CTS_B", "vISH_UART0_RTS_B", "vISH_UART1_TXD", "vISH_UART1_RXD", - "vISH_UART1_CTS_B", "vISH_UART1_RTS_B", "vCNV_BT_I2S_BCLK", "vCNV_BT_I2S_WS_SYNC", - "vCNV_BT_I2S_SDO", "vCNV_BT_I2S_SDI", "vSSP2_SCLK", "vSSP2_SFRM", "vSSP2_TXD", - "vSSP2_RXD", "SLP_LAN_B", "SLP_SUS_B", "WAKE_B", "DRAM_RESET_B", "SPI0_IO_2", - "SPI0_IO_3", "SPI0_MISO", "SPI0_MOSI", "SPI0_CS2_B", "SPI0_CS0_B", "SPI0_CS1_B", - "SPI0_CLK", "SPI0_CLK_LOOPBK", "HDACPU_SDI", "HDACPU_SDO", "HDACPU_SCLK", "PM_SYNC", - "PECI", "CPUPWRGD", "THRMTRIP_B", "PLTRST_CPU_B", "PM_DOWN", "TRIGGER_IN", - "TRIGGER_OUT", "PCH_TDO", "PCH_JTAGX", "PROC_PRDY_B", "PROC_PREQ_B", "CPU_TRST_B", - "PCH_TDI", "PCH_TMS", "PCH_TCK", "ITP_PMODE", "SYS_PWROK", "SYS_RESET_B", "CL_RST_B", - "HDA_BCLK", "HDA_RST_B", "HDA_SYNC", "HDA_SDO", "HDA_SDI0", "HDA_SDI1", "I2S1_SFRM") - return included -} diff --git a/util/intelp2m/platforms/common/template.go b/util/intelp2m/platforms/common/template.go deleted file mode 100644 index 296f169..0000000 --- a/util/intelp2m/platforms/common/template.go +++ /dev/null @@ -1,15 +0,0 @@ -package common - -import "strings" - -// KeywordsCheck - check if one of the keyword from the <keywords> group is included in the -// <line> string. Returns false if no word was found, or true otherwise and also this word -// itself -func KeywordsCheck(line string, keywords ...string) (bool, string) { - for _, key := range keywords { - if strings.Contains(line, key) { - return true, key - } - } - return false, "" -} diff --git a/util/intelp2m/platforms/ebg/macro.go b/util/intelp2m/platforms/ebg/macro.go index e05d06d..05710d1 100644 --- a/util/intelp2m/platforms/ebg/macro.go +++ b/util/intelp2m/platforms/ebg/macro.go @@ -12,6 +12,10 @@ DW1Mask = 0b11111101111111111100001111111111 )
+// "GPPC_A", "GPPC_B", "GPPC_S", "GPPC_C", "GPP_D", "GPP_E", "GPPC_H", "GPP_J", "GPP_I", +// "GPP_L", "GPP_M", "GPP_N" +var GPPGroups = []string{"GPP_", "GPPC_"} + var remapping = common.ResetSources{ 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, diff --git a/util/intelp2m/platforms/ebg/template.go b/util/intelp2m/platforms/ebg/template.go deleted file mode 100644 index 451bd5d..0000000 --- a/util/intelp2m/platforms/ebg/template.go +++ /dev/null @@ -1,14 +0,0 @@ -package ebg - -import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - -// Group : "GPPC_A", "GPPC_B", "GPPC_S", "GPPC_C", "GPP_D", "GPP_E", "GPPC_H", "GPP_J", -// "GPP_I", "GPP_L", "GPP_M", "GPP_N" - -// CheckKeyword - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file -func CheckKeyword(line string) bool { - isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPPC_") - return isIncluded -} diff --git a/util/intelp2m/platforms/jsl/macro.go b/util/intelp2m/platforms/jsl/macro.go index 7a64274..a7565e0 100644 --- a/util/intelp2m/platforms/jsl/macro.go +++ b/util/intelp2m/platforms/jsl/macro.go @@ -14,6 +14,10 @@ DW1Mask = 0b11111101111111111100001111111111 )
+// "GPP_A", "GPP_B", "GPP_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", "GPP_H", "GPP_R", "GPP_S", +// "GPP_T", "GPD", "HVMOS", "VGPIO5" +var GPPGroups = []string{"GPP_", "GPD", "VGPIO"} + var remapping = common.ResetSources{ 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, diff --git a/util/intelp2m/platforms/jsl/template.go b/util/intelp2m/platforms/jsl/template.go deleted file mode 100644 index acf6a5a..0000000 --- a/util/intelp2m/platforms/jsl/template.go +++ /dev/null @@ -1,14 +0,0 @@ -package jsl - -import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - -// Group : "GPP_A", "GPP_B", "GPP_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", "GPP_H", "GPP_R", -// "GPP_S", "GPP_T", "GPD", "HVMOS", "VGPIO5" - -// CheckKeyword - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file -func CheckKeyword(line string) bool { - isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") - return isIncluded -} diff --git a/util/intelp2m/platforms/lbg/macro.go b/util/intelp2m/platforms/lbg/macro.go index dc0ce26..4b3dc7e 100644 --- a/util/intelp2m/platforms/lbg/macro.go +++ b/util/intelp2m/platforms/lbg/macro.go @@ -12,6 +12,10 @@ DW1Mask uint32 = 0b11111101111111111100001111111111 )
+// "GPP_A", "GPP_B", "GPP_F", "GPP_C", "GPP_D", "GPP_E", "GPD", "GPP_I", "GPP_J", "GPP_K", +// "GPP_G", "GPP_H", "GPP_L" +var GPPGroups = []string{"GPP_", "GPD"} + var remapping = common.ResetSources{ 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, diff --git a/util/intelp2m/platforms/lbg/template.go b/util/intelp2m/platforms/lbg/template.go deleted file mode 100644 index f460085..0000000 --- a/util/intelp2m/platforms/lbg/template.go +++ /dev/null @@ -1,12 +0,0 @@ -package lbg - -import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - -// CheckKeyword() parses lines of the configuration file and returns true if the keyword is -// contained in the line -// "GPP_A", "GPP_B", "GPP_F", "GPP_C", "GPP_D", "GPP_E", "GPD", "GPP_I", "GPP_J", -// "GPP_K", "GPP_G", "GPP_H", "GPP_L" -func CheckKeyword(line string) bool { - included, _ := common.KeywordsCheck(line, "GPP_", "GPD") - return included -} diff --git a/util/intelp2m/platforms/mtl/macro.go b/util/intelp2m/platforms/mtl/macro.go index 89bd629..d1ee56a 100644 --- a/util/intelp2m/platforms/mtl/macro.go +++ b/util/intelp2m/platforms/mtl/macro.go @@ -14,6 +14,10 @@ DW1Mask = 0b11111101111111111100001111111111 )
+// "GPP_V", "GPP_C", "GPP_A", "GPP_E", "GPP_H", "GPP_F", "GPP_S", "GPP_B", "GPP_D", "GPD", +// "VGPIO_USB", "VGPIO_PCIE" +var GPPGroups = []string{"GPP_", "GPD", "VGPIO"} + var remapping = common.ResetSources{ 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, diff --git a/util/intelp2m/platforms/mtl/template.go b/util/intelp2m/platforms/mtl/template.go deleted file mode 100644 index 27951fe..0000000 --- a/util/intelp2m/platforms/mtl/template.go +++ /dev/null @@ -1,14 +0,0 @@ -package mtl - -import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - -// Group : "GPP_V", "GPP_C", "GPP_A", "GPP_E", "GPP_H", "GPP_F", "GPP_S", "GPP_B", "GPP_D", -// "GPD", "VGPIO_USB", "VGPIO_PCIE" - -// CheckKeyword - This function is used to filter parsed lines of the configuration file and -// returns true if the keyword is contained in the line. -// line : string from the configuration file -func CheckKeyword(line string) bool { - isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") - return isIncluded -} diff --git a/util/intelp2m/platforms/platforms.go b/util/intelp2m/platforms/platforms.go index b77e910..89ac548 100644 --- a/util/intelp2m/platforms/platforms.go +++ b/util/intelp2m/platforms/platforms.go @@ -1,6 +1,8 @@ package platforms
import ( + "fmt" + "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/logs" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/adl" @@ -15,26 +17,24 @@ "review.coreboot.org/coreboot.git/util/intelp2m/platforms/tgl" )
-type KeywordAction func(line string) bool +var GppMap = map[p2m.PlatformType][]string{ + p2m.Alder: adl.GPPGroups, + p2m.Apollo: apl.GPPGroups, + p2m.Cannon: cnl.GPPGroups, + p2m.Sunrise: snr.GPPGroups, + p2m.Tiger: tgl.GPPGroups, + p2m.Jasper: jsl.GPPGroups, + p2m.Meteor: mtl.GPPGroups, + p2m.Emmitsburg: ebg.GPPGroups, + p2m.Lewisburg: lbg.GPPGroups, +}
-func GetKeywordChekingAction() KeywordAction { - actions := map[p2m.PlatformType]KeywordAction{ - p2m.Alder: adl.CheckKeyword, - p2m.Apollo: apl.CheckKeyword, - p2m.Cannon: cnl.CheckKeyword, - p2m.Sunrise: snr.CheckKeyword, - p2m.Tiger: tgl.CheckKeyword, - p2m.Jasper: jsl.CheckKeyword, - p2m.Meteor: mtl.CheckKeyword, - p2m.Emmitsburg: ebg.CheckKeyword, - p2m.Lewisburg: lbg.CheckKeyword, - } - action, exist := actions[p2m.Config.Platform] +func GetGPPGroups() ([]string, error) { + groups, exist := GppMap[p2m.Config.Platform] if !exist { - logs.Errorf("unregistered platform type %d", p2m.Config.Platform) - return nil + return nil, fmt.Errorf("unregistered platform type %d", p2m.Config.Platform) } - return action + return groups, nil }
func Get(dw0, dw1 uint32) common.PlatformIf { diff --git a/util/intelp2m/platforms/snr/macro.go b/util/intelp2m/platforms/snr/macro.go index 110225b..47c06bc 100644 --- a/util/intelp2m/platforms/snr/macro.go +++ b/util/intelp2m/platforms/snr/macro.go @@ -14,6 +14,10 @@ DW1Mask uint32 = 0b11111101111111111100001111111111 )
+// "GPP_A", "GPP_B", "GPP_F", "GPP_C", "GPP_D", "GPP_E", "GPD", "GPP_I", "GPP_J", "GPP_G", +// "GPP_H", "GPP_L" +var GPPGroups = []string{"GPP_", "GPD"} + var remapping = common.ResetSources{ 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, diff --git a/util/intelp2m/platforms/snr/template.go b/util/intelp2m/platforms/snr/template.go deleted file mode 100644 index 22f477e..0000000 --- a/util/intelp2m/platforms/snr/template.go +++ /dev/null @@ -1,12 +0,0 @@ -package snr - -import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - -// CheckKeyword() parses lines of the configuration file and returns true if the keyword is -// contained in the line -// "GPP_A", "GPP_B", "GPP_F", "GPP_C", "GPP_D", "GPP_E", "GPD", "GPP_I", "GPP_J", -// "GPP_K", "GPP_G", "GPP_H", "GPP_L" -func CheckKeyword(line string) bool { - included, _ := common.KeywordsCheck(line, "GPP_", "GPD") - return included -} diff --git a/util/intelp2m/platforms/tgl/macro.go b/util/intelp2m/platforms/tgl/macro.go index d558cb4..28212d5 100644 --- a/util/intelp2m/platforms/tgl/macro.go +++ b/util/intelp2m/platforms/tgl/macro.go @@ -14,6 +14,10 @@ DW1Mask = 0b11111101111111111100001111111111 )
+// "GPP_A", "GPP_R", "GPP_B", "GPP_D", "GPP_C", "GPP_S", "GPP_G", "GPD", "GPP_E", "GPP_F", +// "GPP_H", "GPP_J", "GPP_K", "GPP_I", "VGPIO_USB", "VGPIO_PCIE" +var GPPGroups = []string{"GPP_", "GPD", "VGPIO"} + var remapping = common.ResetSources{ 0b00: bits.RstCfgRSMRST << bits.DW0PadRstCfg, 0b01: bits.RstCfgDEEP << bits.DW0PadRstCfg, diff --git a/util/intelp2m/platforms/tgl/template.go b/util/intelp2m/platforms/tgl/template.go deleted file mode 100644 index f6a0bcd..0000000 --- a/util/intelp2m/platforms/tgl/template.go +++ /dev/null @@ -1,14 +0,0 @@ -package tgl - -import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" - -// Group : "GPP_A", "GPP_R", "GPP_B", "GPP_D", "GPP_C", "GPP_S", "GPP_G", "GPD", "GPP_E", -// "GPP_F", "GPP_H", "GPP_J", "GPP_K", "GPP_I", "VGPIO_USB", "VGPIO_PCIE" - -// CheckKeyword - This function is used to filter parsed lines of the configuration file -// and returns true if the keyword is contained in the line. -// line : string from the configuration file -func CheckKeyword(line string) bool { - isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") - return isIncluded -}