From 2c2e92f7f7e939668a2435c088647aa7634254b1 Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Tue, 6 Dec 2022 14:29:42 +0300 Subject: [PATCH] util/intelp2m: Drop 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 branch, 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 in the future in a different form and after corresponding changes in inteltool. TEST: make test = PASS Change-Id: If5c77ff942a620897c085be4135cb879a0d40a00 Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/56887 Reviewed-by: Angel Pons Reviewed-by: Matt DeVillier Reviewed-by: David Hendricks Tested-by: build bot (Jenkins) --- util/intelp2m/parser/parser.go | 77 +------------------------ util/intelp2m/parser/template.go | 22 +------ util/intelp2m/platforms/adl/template.go | 19 ++---- util/intelp2m/platforms/apl/template.go | 12 +--- util/intelp2m/platforms/cnl/template.go | 14 +---- util/intelp2m/platforms/ebg/macro.go | 1 - util/intelp2m/platforms/ebg/template.go | 21 ++----- util/intelp2m/platforms/jsl/template.go | 17 ++---- util/intelp2m/platforms/lbg/template.go | 15 ++--- util/intelp2m/platforms/mtl/template.go | 17 ++---- util/intelp2m/platforms/snr/template.go | 18 ++---- util/intelp2m/platforms/tgl/template.go | 21 ++----- util/intelp2m/version.txt | 2 +- 13 files changed, 40 insertions(+), 216 deletions(-) diff --git a/util/intelp2m/parser/parser.go b/util/intelp2m/parser/parser.go index f2756107bf..4fd15a357d 100644 --- a/util/intelp2m/parser/parser.go +++ b/util/intelp2m/parser/parser.go @@ -4,8 +4,6 @@ import ( "bufio" "errors" "fmt" - "strconv" - "strings" "review.coreboot.org/coreboot.git/util/intelp2m/config/p2m" "review.coreboot.org/coreboot.git/util/intelp2m/platforms/adl" @@ -23,7 +21,6 @@ import ( // 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 } @@ -55,20 +52,6 @@ type ParserData struct { ownership map[string]uint32 } -// hostOwnershipGet - get the host software ownership value for the corresponding -// pad ID -// id : pad ID string -// return the host software ownership form the parser struct -func (parser *ParserData) hostOwnershipGet(id string) uint8 { - var ownership uint8 = 0 - _, group := parser.platform.GroupNameExtract(id) - numder, _ := strconv.Atoi(strings.TrimLeft(id, group)) - if (parser.ownership[group] & (1 << uint8(numder))) != 0 { - ownership = 1 - } - return ownership -} - // padInfoExtract - adds a new entry to pad info map // return error status func (parser *ParserData) padInfoExtract() int { @@ -81,7 +64,7 @@ func (parser *ParserData) padInfoExtract() int { function: function, dw0: dw0, dw1: dw1, - ownership: parser.hostOwnershipGet(id)} + ownership: 0} parser.padmap = append(parser.padmap, pad) return 0 @@ -111,65 +94,11 @@ func (parser *ParserData) PlatformSpecificInterfaceSet() { p2m.Jasper: jsl.PlatformSpecific{}, p2m.Meteor: mtl.PlatformSpecific{}, // See platforms/ebg/macro.go - p2m.Emmitsburg: ebg.PlatformSpecific{ - InheritanceTemplate: cnl.PlatformSpecific{ - InheritanceTemplate: snr.PlatformSpecific{}, - }, - }, + p2m.Emmitsburg: ebg.PlatformSpecific{}, } parser.platform = platform[p2m.Config.Platform] } -// 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) { - 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 { - if p2m.Config.Platform == p2m.Apollo { - return false - } - return parser.padOwnershipExtract() -} - // Parse pads groupe information in the inteltool log file // ConfigFile : name of inteltool log file func (parser *ParserData) Parse() { @@ -189,7 +118,7 @@ func (parser *ParserData) Parse() { 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 49b938fd56..7d3e1aa819 100644 --- a/util/intelp2m/parser/template.go +++ b/util/intelp2m/parser/template.go @@ -38,8 +38,9 @@ func tokenCheck(c rune) bool { // *id : pad id string // *dw0 : DW0 register value // *dw1 : DW1 register value +// // return -// error status +// error status func UseTemplate(line string, function *string, id *string, dw0 *uint32, dw1 *uint32) int { var val uint64 // 0x0520: 0x0000003c44000600 GPP_B12 SLP_S0# @@ -61,22 +62,3 @@ func UseTemplate(line string, function *string, id *string, dw0 *uint32, dw1 *ui } return 0 } - -// 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/adl/template.go b/util/intelp2m/platforms/adl/template.go index 672be84070..1642670144 100644 --- a/util/intelp2m/platforms/adl/template.go +++ b/util/intelp2m/platforms/adl/template.go @@ -2,22 +2,13 @@ package adl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/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_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") - -} +// Group : "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" // 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 +// returns true if the keyword is contained in the line. +// line : string from the configuration file func (PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded diff --git a/util/intelp2m/platforms/apl/template.go b/util/intelp2m/platforms/apl/template.go index 05d505f786..36040cab96 100644 --- a/util/intelp2m/platforms/apl/template.go +++ b/util/intelp2m/platforms/apl/template.go @@ -2,18 +2,8 @@ package apl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/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. +// returns true if the keyword is contained in the line. // line : string from the configuration file func (PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, diff --git a/util/intelp2m/platforms/cnl/template.go b/util/intelp2m/platforms/cnl/template.go index b38d9689f4..886a59a920 100644 --- a/util/intelp2m/platforms/cnl/template.go +++ b/util/intelp2m/platforms/cnl/template.go @@ -1,23 +1,13 @@ package cnl -import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/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") -} +// Group: "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. +// returns true if the keyword is contained in the line. // line : string from the configuration file func (platform PlatformSpecific) KeywordCheck(line string) bool { return platform.InheritanceTemplate.KeywordCheck(line) diff --git a/util/intelp2m/platforms/ebg/macro.go b/util/intelp2m/platforms/ebg/macro.go index 9dba566907..8026a2d484 100644 --- a/util/intelp2m/platforms/ebg/macro.go +++ b/util/intelp2m/platforms/ebg/macro.go @@ -25,7 +25,6 @@ type InheritanceMacro interface { type PlatformSpecific struct { InheritanceMacro - InheritanceTemplate } // RemmapRstSrc - remmap Pad Reset Source Config diff --git a/util/intelp2m/platforms/ebg/template.go b/util/intelp2m/platforms/ebg/template.go index 0ec9bc31a8..32ba246ec9 100644 --- a/util/intelp2m/platforms/ebg/template.go +++ b/util/intelp2m/platforms/ebg/template.go @@ -2,25 +2,12 @@ package ebg import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" -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 common.KeywordsCheck(line, - "GPPC_A", "GPPC_B", "GPPC_S", "GPPC_C", "GPP_D", "GPP_E", "GPPC_H", "GPP_J", - "GPP_I", "GPP_L", "GPP_M", "GPP_N") -} +// 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" // 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 +// returns true if the keyword is contained in the line. +// line : string from the configuration file func (platform PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPPC_") return isIncluded diff --git a/util/intelp2m/platforms/jsl/template.go b/util/intelp2m/platforms/jsl/template.go index 203b27ebdc..ec6e9c91a9 100644 --- a/util/intelp2m/platforms/jsl/template.go +++ b/util/intelp2m/platforms/jsl/template.go @@ -2,21 +2,12 @@ package jsl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/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_C", "GPP_D", "GPP_E", "GPP_F", "GPP_G", - "GPP_H", "GPP_R", "GPP_S", "GPP_T", "GPD", "HVMOS", "VGPIO5") - -} +// 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" // 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 +// returns true if the keyword is contained in the line. +// line : string from the configuration file func (PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded diff --git a/util/intelp2m/platforms/lbg/template.go b/util/intelp2m/platforms/lbg/template.go index 74c39efadf..d76f2cdef3 100644 --- a/util/intelp2m/platforms/lbg/template.go +++ b/util/intelp2m/platforms/lbg/template.go @@ -1,22 +1,15 @@ 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) -} +// Group: "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 +// returns true if the keyword is contained in the line. +// line : string from the configuration file func (platform PlatformSpecific) KeywordCheck(line string) bool { return platform.InheritanceTemplate.KeywordCheck(line) } diff --git a/util/intelp2m/platforms/mtl/template.go b/util/intelp2m/platforms/mtl/template.go index 76a65f3f18..3f44928909 100644 --- a/util/intelp2m/platforms/mtl/template.go +++ b/util/intelp2m/platforms/mtl/template.go @@ -2,21 +2,12 @@ package mtl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/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_V", "GPP_C", "GPP_A", "GPP_E", "GPP_H", "GPP_F", "GPP_S", - "GPP_B", "GPP_D", "GPD", "VGPIO_USB", "VGPIO_PCIE") - -} +// Group : "GPP_V", "GPP_C", "GPP_A", "GPP_E", "GPP_H", "GPP_F", "GPP_S", "GPP_B", "GPP_D", +// "GPD", "VGPIO_USB", "VGPIO_PCIE" // 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 +// returns true if the keyword is contained in the line. +// line : string from the configuration file func (PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded diff --git a/util/intelp2m/platforms/snr/template.go b/util/intelp2m/platforms/snr/template.go index 2a5dfc3643..4d02743463 100644 --- a/util/intelp2m/platforms/snr/template.go +++ b/util/intelp2m/platforms/snr/template.go @@ -2,22 +2,14 @@ package snr import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/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") -} +// Group: "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. +// returns true if the keyword is contained in the line. // line : string from the configuration file // Returns false if no word was found, or true otherwise func (PlatformSpecific) KeywordCheck(line string) bool { - isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD") - return isIncluded + included, _ := common.KeywordsCheck(line, "GPP_", "GPD") + return included } diff --git a/util/intelp2m/platforms/tgl/template.go b/util/intelp2m/platforms/tgl/template.go index 5a93aee06b..4e9a2ba069 100644 --- a/util/intelp2m/platforms/tgl/template.go +++ b/util/intelp2m/platforms/tgl/template.go @@ -2,23 +2,12 @@ package tgl import "review.coreboot.org/coreboot.git/util/intelp2m/platforms/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_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") +// 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" -} - -// 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 +// 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 func (PlatformSpecific) KeywordCheck(line string) bool { isIncluded, _ := common.KeywordsCheck(line, "GPP_", "GPD", "VGPIO") return isIncluded diff --git a/util/intelp2m/version.txt b/util/intelp2m/version.txt index c068b2447c..c239c60cba 100644 --- a/util/intelp2m/version.txt +++ b/util/intelp2m/version.txt @@ -1 +1 @@ -1.4 +1.5