Maxim Polyakov has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56887 )
Change subject: util/intelp2m: Remove non-DWx register analysis support ......................................................................
util/intelp2m: Remove non-DWx register analysis support
The utility can parse the value of non-DWx registers, if they are present in the inteltool dump. However, the functions that allow the inteltool utility to print the value of such registers have not been added to the master, and it makes no sense to support such functions in intelp2m, besides, their implementation is far from ideal. Remove this unused functionality. This will be restored or added in a new implementation as soon as similar functionality is added to inteltool.
TEST: ./intelp2m -file inteltool-asrock-h110m-dvs.log generate/gpio.h before and after the patch is the same.
Change-Id: If5c77ff942a620897c085be4135cb879a0d40a00 Signed-off-by: Maxim Polyakov max.senia.poliak@gmail.com --- M util/intelp2m/parser/parser.go M util/intelp2m/parser/template.go M util/intelp2m/platforms/apl/template.go M util/intelp2m/platforms/cnl/template.go M util/intelp2m/platforms/lbg/template.go M util/intelp2m/platforms/snr/template.go 6 files changed, 4 insertions(+), 120 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/56887/1
diff --git a/util/intelp2m/parser/parser.go b/util/intelp2m/parser/parser.go index bfcdff8..2bfc544 100644 --- a/util/intelp2m/parser/parser.go +++ b/util/intelp2m/parser/parser.go @@ -3,8 +3,6 @@ import ( "bufio" "fmt" - "strings" - "strconv" "../platforms/common" "../platforms/snr" "../platforms/lbg" @@ -16,7 +14,6 @@ // PlatformSpecific - platform-specific interface type PlatformSpecific interface { GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string - GroupNameExtract(line string) (bool, string) KeywordCheck(line string) bool }
@@ -94,15 +91,9 @@ // id : pad ID string // return the host software ownership form the parser struct func (parser *ParserData) hostOwnershipGet(id string) uint8 { - var ownership uint8 = 0 - status, group := parser.platform.GroupNameExtract(id) - if config.TemplateGet() == config.TempInteltool && status { - numder, _ := strconv.Atoi(strings.TrimLeft(id, group)) - if (parser.ownership[group] & (1 << uint8(numder))) != 0 { - ownership = 1 - } - } - return ownership + // TODO: Add an implementation of the pad township status analysis as + // soon as it is done in inteltool. + return 0 }
// padInfoExtract - adds a new entry to pad info map @@ -166,51 +157,6 @@ } }
-// Register - read specific platform registers (32 bits) -// line : string from file with pad config map -// nameTemplate : register name femplate to filter parsed lines -// return -// valid : true if the dump of the register in intertool.log is set in accordance -// with the template -// name : full register name -// offset : register offset relative to the base address -// value : register value -func (parser *ParserData) Register(nameTemplate string) ( - valid bool, name string, offset uint32, value uint32) { - if strings.Contains(parser.line, nameTemplate) && - config.TemplateGet() == config.TempInteltool { - if registerInfoTemplate(parser.line, &name, &offset, &value) == 0 { - fmt.Printf("\n\t/* %s : 0x%x : 0x%x */\n", name, offset, value) - return true, name, offset, value - } - } - return false, "ERROR", 0, 0 -} - -// padOwnershipExtract - extract Host Software Pad Ownership from inteltool dump -// return true if success -func (parser *ParserData) padOwnershipExtract() bool { - var group string - status, name, offset, value := parser.Register("HOSTSW_OWN_GPP_") - if status { - _, group = parser.platform.GroupNameExtract(parser.line) - parser.ownership[group] = value - fmt.Printf("\n\t/* padOwnershipExtract: [offset 0x%x] %s = 0x%x */\n", - offset, name, parser.ownership[group]) - } - return status -} - -// padConfigurationExtract - reads GPIO configuration registers and returns true if the -// information from the inteltool log was successfully parsed. -func (parser *ParserData) padConfigurationExtract() bool { - // Only for Sunrise or CannonLake, and only for inteltool.log file template - if config.TemplateGet() != config.TempInteltool || config.IsPlatformApollo() { - return false - } - return parser.padOwnershipExtract() -} - // Parse pads groupe information in the inteltool log file // ConfigFile : name of inteltool log file func (parser *ParserData) Parse() { @@ -229,7 +175,7 @@ isIncluded, _ := common.KeywordsCheck(parser.line, "GPIO Community", "GPIO Group"); if isIncluded { parser.communityGroupExtract() - } else if !parser.padConfigurationExtract() && parser.platform.KeywordCheck(parser.line) { + } else if parser.platform.KeywordCheck(parser.line) { if parser.padInfoExtract() != 0 { fmt.Println("...error!") } diff --git a/util/intelp2m/parser/template.go b/util/intelp2m/parser/template.go index 3248152..dd6304b 100644 --- a/util/intelp2m/parser/template.go +++ b/util/intelp2m/parser/template.go @@ -111,22 +111,3 @@ fmt.Printf("ADD YOUR TEMPLATE!\n") return -1 } - -// registerInfoTemplate -// line : (in) string from file with pad config map -// *name : (out) register name -// *offset : (out) offset name -// *value : (out) register value -// return -// error status -func registerInfoTemplate(line string, name *string, offset *uint32, value *uint32) int { - // 0x0088: 0x00ffffff (HOSTSW_OWN_GPP_F) - // 0x0100: 0x00000000 (GPI_IS_GPP_A) - if fields := strings.FieldsFunc(line, tokenCheck); len(fields) == 3 { - *name = fields[2] - fmt.Sscanf(fields[1], "0x%x", value) - fmt.Sscanf(fields[0], "0x%x", offset) - return 0 - } - return -1 -} diff --git a/util/intelp2m/platforms/apl/template.go b/util/intelp2m/platforms/apl/template.go index 823b321..34b4b24 100644 --- a/util/intelp2m/platforms/apl/template.go +++ b/util/intelp2m/platforms/apl/template.go @@ -2,16 +2,6 @@
import "../common"
-// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (PlatformSpecific) GroupNameExtract(line string) (bool, string) { - // Not supported - return false, "" -} - // KeywordCheck - 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 diff --git a/util/intelp2m/platforms/cnl/template.go b/util/intelp2m/platforms/cnl/template.go index 3b028e6..9b4b9ff 100644 --- a/util/intelp2m/platforms/cnl/template.go +++ b/util/intelp2m/platforms/cnl/template.go @@ -1,21 +1,9 @@ package cnl
-import "../common" - type InheritanceTemplate interface { KeywordCheck(line string) bool }
-// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (PlatformSpecific) GroupNameExtract(line string) (bool, string) { - return common.KeywordsCheck(line, - "GPP_A", "GPP_B", "GPP_G", "GPP_D", "GPP_F", "GPP_H", "GPD", "GPP_C", "GPP_E") -} - // KeywordCheck - 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 diff --git a/util/intelp2m/platforms/lbg/template.go b/util/intelp2m/platforms/lbg/template.go index 74c39ef..5f42957 100644 --- a/util/intelp2m/platforms/lbg/template.go +++ b/util/intelp2m/platforms/lbg/template.go @@ -1,19 +1,9 @@ package lbg
type InheritanceTemplate interface { - GroupNameExtract(line string) (bool, string) KeywordCheck(line string) bool }
-// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (platform PlatformSpecific) GroupNameExtract(line string) (bool, string) { - return platform.InheritanceTemplate.GroupNameExtract(line) -} - // KeywordCheck - 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 diff --git a/util/intelp2m/platforms/snr/template.go b/util/intelp2m/platforms/snr/template.go index 9bcf9e1..375f557 100644 --- a/util/intelp2m/platforms/snr/template.go +++ b/util/intelp2m/platforms/snr/template.go @@ -2,17 +2,6 @@
import "../common"
-// GroupNameExtract - This function extracts the group ID, if it exists in a row -// line : string from the configuration file -// return -// bool : true if the string contains a group identifier -// string : group identifier -func (PlatformSpecific) GroupNameExtract(line string) (bool, string) { - return common.KeywordsCheck(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") -} - // KeywordCheck - 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