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 <max.senia.poliak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56887
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Maxim Polyakov 2022-12-06 14:29:42 +03:00 committed by Felix Singer
commit 2c2e92f7f7
13 changed files with 40 additions and 216 deletions

View file

@ -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!")
}

View file

@ -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
}

View file

@ -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

View file

@ -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,

View file

@ -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)

View file

@ -25,7 +25,6 @@ type InheritanceMacro interface {
type PlatformSpecific struct {
InheritanceMacro
InheritanceTemplate
}
// RemmapRstSrc - remmap Pad Reset Source Config

View file

@ -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

View file

@ -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

View file

@ -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)
}

View file

@ -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

View file

@ -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
}

View file

@ -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

View file

@ -1 +1 @@
1.4
1.5