util/intelp2m: Drop multi-template support

Exclude the template to parse gpio.h, since coreboot no longer has such
files with raw DW register values. The new GPIO config should be
generated using inteltool.log only.

TEST: make test = PASS

Change-Id: I07124cca487f11641c4e107134efb8cfc29c6731
Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70307
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
This commit is contained in:
Maxim Polyakov 2022-11-24 23:54:40 +03:00 committed by Felix Singer
commit 1ce69c9db0
14 changed files with 111 additions and 231 deletions

View file

@ -3,36 +3,15 @@ package config
import "os"
const (
TempInteltool int = 0
TempGpioh int = 1
TempSpec int = 2
)
var template int = 0
func TemplateSet(temp int) bool {
if temp > TempSpec {
return false
} else {
template = temp
return true
}
}
func TemplateGet() int {
return template
}
const (
SunriseType uint8 = 0
LewisburgType uint8 = 1
ApolloType uint8 = 2
CannonType uint8 = 3
TigerType uint8 = 4
AlderType uint8 = 5
JasperType uint8 = 6
MeteorType uint8 = 7
EmmitsburgType uint8 = 8
SunriseType uint8 = 0
LewisburgType uint8 = 1
ApolloType uint8 = 2
CannonType uint8 = 3
TigerType uint8 = 4
AlderType uint8 = 5
JasperType uint8 = 6
MeteorType uint8 = 7
EmmitsburgType uint8 = 8
)
var key uint8 = SunriseType
@ -48,6 +27,7 @@ var platform = map[string]uint8{
"mtl": MeteorType,
"ebg": EmmitsburgType,
}
func PlatformSet(name string) int {
if platformType, valid := platform[name]; valid {
key = platformType
@ -90,6 +70,7 @@ var InputRegDumpFile *os.File = nil
var OutputGenFile *os.File = nil
var ignoredFieldsFormat bool = false
func IgnoredFieldsFlagSet(flag bool) {
ignoredFieldsFormat = flag
}
@ -98,6 +79,7 @@ func AreFieldsIgnored() bool {
}
var nonCheckingFlag bool = false
func NonCheckingFlagSet(flag bool) {
nonCheckingFlag = flag
}
@ -105,8 +87,8 @@ func IsNonCheckingFlagUsed() bool {
return nonCheckingFlag
}
var infolevel int = 0
func InfoLevelSet(lvl int) {
infolevel = lvl
}
@ -115,17 +97,20 @@ func InfoLevelGet() int {
}
var fldstyle uint8 = CbFlds
const (
NoFlds uint8 = 0
CbFlds uint8 = 1 // coreboot style
FspFlds uint8 = 2 // FSP/edk2 style
RawFlds uint8 = 3 // raw DW0/1 values
NoFlds uint8 = 0
CbFlds uint8 = 1 // coreboot style
FspFlds uint8 = 2 // FSP/edk2 style
RawFlds uint8 = 3 // raw DW0/1 values
)
var fldstylemap = map[string]uint8{
"none" : NoFlds,
"cb" : CbFlds,
"fsp" : FspFlds,
"raw" : RawFlds}
"none": NoFlds,
"cb": CbFlds,
"fsp": FspFlds,
"raw": RawFlds}
func FldStyleSet(name string) int {
if style, valid := fldstylemap[name]; valid {
fldstyle = style

View file

@ -61,11 +61,6 @@ func main() {
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"+
"\t1 - gpio.h\n"+
"\t2 - your template\n\t")
platform := flag.String("p", "snr", "set platform:\n"+
"\tsnr - Sunrise PCH or Skylake/Kaby Lake SoC\n"+
"\tlbg - Lewisburg PCH with Xeon SP\n"+
@ -96,11 +91,6 @@ func main() {
}
}
if !config.TemplateSet(*template) {
fmt.Printf("Error! Unknown template format of input file!\n")
os.Exit(1)
}
if valid := config.PlatformSet(*platform); valid != 0 {
fmt.Printf("Error: invalid platform -%s!\n", *platform)
os.Exit(1)

View file

@ -61,12 +61,10 @@ type ParserData struct {
// 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
}
_, group := parser.platform.GroupNameExtract(id)
numder, _ := strconv.Atoi(strings.TrimLeft(id, group))
if (parser.ownership[group] & (1 << uint8(numder))) != 0 {
ownership = 1
}
return ownership
}
@ -76,22 +74,17 @@ func (parser *ParserData) hostOwnershipGet(id string) uint8 {
func (parser *ParserData) padInfoExtract() int {
var function, id string
var dw0, dw1 uint32
var template = map[int]template{
config.TempInteltool: UseInteltoolLogTemplate,
config.TempGpioh: useGpioHTemplate,
config.TempSpec: useYourTemplate,
if rc := UseTemplate(parser.line, &function, &id, &dw0, &dw1); rc != 0 {
return rc
}
if template[config.TemplateGet()](parser.line, &function, &id, &dw0, &dw1) == 0 {
pad := padInfo{id: id,
function: function,
dw0: dw0,
dw1: dw1,
ownership: parser.hostOwnershipGet(id)}
parser.padmap = append(parser.padmap, pad)
return 0
}
fmt.Printf("This template (%d) does not match!\n", config.TemplateGet())
return -1
pad := padInfo{id: id,
function: function,
dw0: dw0,
dw1: dw1,
ownership: parser.hostOwnershipGet(id)}
parser.padmap = append(parser.padmap, pad)
return 0
}
// communityGroupExtract
@ -143,8 +136,7 @@ func (parser *ParserData) Register(nameTemplate string) (
offset uint32,
value uint32,
) {
if strings.Contains(parser.line, nameTemplate) &&
config.TemplateGet() == config.TempInteltool {
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
@ -173,7 +165,7 @@ func (parser *ParserData) padOwnershipExtract() bool {
// 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() {
if config.IsPlatformApollo() {
return false
}
return parser.padOwnershipExtract()

View file

@ -32,7 +32,7 @@ func tokenCheck(c rune) bool {
return c != '_' && c != '#' && !unicode.IsLetter(c) && !unicode.IsNumber(c)
}
// useGpioHTemplate
// UseTemplate
// line : string from file with pad config map
// *function : the string that means the pad function
// *id : pad id string
@ -40,9 +40,7 @@ func tokenCheck(c rune) bool {
// *dw1 : DW1 register value
// return
// error status
func UseInteltoolLogTemplate(line string, function *string,
id *string, dw0 *uint32, dw1 *uint32) int {
func UseTemplate(line string, function *string, id *string, dw0 *uint32, dw1 *uint32) int {
var val uint64
// 0x0520: 0x0000003c44000600 GPP_B12 SLP_S0#
// 0x0438: 0xffffffffffffffff GPP_C7 RESERVED
@ -64,56 +62,6 @@ func UseInteltoolLogTemplate(line string, function *string,
return 0
}
// useGpioHTemplate
// line : string from file with pad config map
// *function : the string that means the pad function
// *id : pad id string
// *dw0 : DW0 register value
// *dw1 : DW1 register value
// return
// error status
func useGpioHTemplate(line string, function *string,
id *string, dw0 *uint32, dw1 *uint32) int {
// /* RCIN# */ _PAD_CFG_STRUCT(GPP_A0, 0x44000702, 0x00000000),
// _PAD_CFG_STRUCT(GPP_A0, 0x44000702, 0x00000000), /* RCIN# */
// _PAD_CFG_STRUCT(GPP_A0, 0x44000702, 0x00000000)
fields := strings.FieldsFunc(line, tokenCheck)
for i, field := range fields {
if field == "_PAD_CFG_STRUCT" {
if len(fields) < 4 {
/* the number of definitions does not match the format */
return -1
}
if !strings.Contains(fields[i+2], "0x") || !strings.Contains(fields[i+3], "0x") {
/* definitions inside the macro do not match the pattern */
return -1
}
*id = fields[i+1]
fmt.Sscanf(fields[i+2], "0x%x", dw0)
fmt.Sscanf(fields[i+3], "0x%x", dw1)
*function = extractPadFuncFromComment(line)
return 0
}
}
return -1
}
// useYourTemplate
func useYourTemplate(line string, function *string,
id *string, dw0 *uint32, dw1 *uint32) int {
// ADD YOUR TEMPLATE HERE
*function = ""
*id = ""
*dw0 = 0
*dw1 = 0
fmt.Printf("ADD YOUR TEMPLATE!\n")
return -1
}
// registerInfoTemplate
// line : (in) string from file with pad config map
// *name : (out) register name

View file

@ -20,7 +20,7 @@ func TestTemp(t *testing.T) {
dw0, dw1 uint32
)
line := fmt.Sprintf("0x0520: 0x%08x%08x %s %s", ref_dw1, ref_dw0, ref_id, ref_fn)
_ = parser.UseInteltoolLogTemplate(line, &fn, &id, &dw0, &dw1)
_ = parser.UseTemplate(line, &fn, &id, &dw0, &dw1)
if fn != ref_fn {
t.Errorf("function from '%s':\nExpects: '%s'\nActually: '%s'\n\n",
line, ref_fn, fn)

View file

@ -1,14 +1,13 @@
package adl
import (
"strings"
"fmt"
"strings"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl"
"review.coreboot.org/coreboot.git/util/intelp2m/config"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
)
const (
@ -37,10 +36,6 @@ type PlatformSpecific struct {
// RemmapRstSrc - remmap Pad Reset Source Config
func (PlatformSpecific) RemmapRstSrc() {
macro := common.GetMacro()
if config.TemplateGet() != config.TempInteltool {
// Use reset source remapping only if the input file is inteltool.log dump
return
}
if strings.Contains(macro.PadIdGet(), "GPD") {
// See reset map for the Alderlake GPD Group in the Community 2:
// https://github.com/coreboot/coreboot/blob/master/src/soc/intel/alderlake/gpio.c#L21
@ -51,9 +46,9 @@ func (PlatformSpecific) RemmapRstSrc() {
dw0 := macro.Register(PAD_CFG_DW0)
var remapping = map[uint8]uint32{
0: common.RST_RSMRST << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
2: common.RST_PLTRST << common.PadRstCfgShift,
3: common.RST_PWROK << common.PadRstCfgShift,
3: common.RST_PWROK << common.PadRstCfgShift,
}
resetsrc, valid := remapping[dw0.GetResetConfig()]
if valid {
@ -61,7 +56,7 @@ func (PlatformSpecific) RemmapRstSrc() {
ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()]
dw0.ValueSet(ResetConfigFieldVal)
} else {
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet())
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet())
}
dw0.CntrMaskFieldsClear(common.PadRstCfgMask)
}

View file

@ -1,12 +1,12 @@
package cnl
import (
"strings"
"fmt"
"strings"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
"review.coreboot.org/coreboot.git/util/intelp2m/config"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr"
)
@ -35,13 +35,9 @@ type PlatformSpecific struct {
// RemmapRstSrc - remmap Pad Reset Source Config
func (PlatformSpecific) RemmapRstSrc() {
macro := common.GetMacro()
if config.TemplateGet() != config.TempInteltool {
// Use reset source remapping only if the input file is inteltool.log dump
return
}
if strings.Contains(macro.PadIdGet(), "GPP_A") ||
strings.Contains(macro.PadIdGet(), "GPP_B") ||
strings.Contains(macro.PadIdGet(), "GPP_G") {
strings.Contains(macro.PadIdGet(), "GPP_B") ||
strings.Contains(macro.PadIdGet(), "GPP_G") {
// See reset map for the Cannonlake Groups the Community 0:
// https://github.com/coreboot/coreboot/blob/master/src/soc/intel/cannonlake/gpio.c#L14
// remmap is not required because it is the same as common.
@ -51,7 +47,7 @@ func (PlatformSpecific) RemmapRstSrc() {
dw0 := macro.Register(PAD_CFG_DW0)
var remapping = map[uint8]uint32{
0: common.RST_RSMRST << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
2: common.RST_PLTRST << common.PadRstCfgShift,
}
resetsrc, valid := remapping[dw0.GetResetConfig()]
@ -60,7 +56,7 @@ func (PlatformSpecific) RemmapRstSrc() {
ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()]
dw0.ValueSet(ResetConfigFieldVal)
} else {
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet())
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet())
}
dw0.CntrMaskFieldsClear(common.PadRstCfgMask)
}
@ -85,9 +81,9 @@ func (PlatformSpecific) Pull() {
if !valid {
str = "INVALID"
fmt.Println("Error",
macro.PadIdGet(),
" invalid TERM value = ",
int(dw1.GetTermination()))
macro.PadIdGet(),
" invalid TERM value = ",
int(dw1.GetTermination()))
}
macro.Separator().Add(str)
}
@ -146,7 +142,7 @@ func (PlatformSpecific) GpiMacroAdd() {
macro := common.GetMacro()
var ids []string
macro.Set("PAD_CFG_GPI")
for routeid, isRoute := range map[string]func() (bool) {
for routeid, isRoute := range map[string]func() bool{
"IOAPIC": ioApicRoute,
"SCI": sciRoute,
"SMI": smiRoute,
@ -204,7 +200,7 @@ func (platform PlatformSpecific) NoConnMacroAdd() {
// return: string of macro
// error
func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string {
macro := common.GetInstanceMacro(PlatformSpecific{InheritanceMacro : snr.PlatformSpecific{}},
macro := common.GetInstanceMacro(PlatformSpecific{InheritanceMacro: snr.PlatformSpecific{}},
fields.InterfaceGet())
macro.Clear()
macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields)

View file

@ -3,11 +3,10 @@ package ebg
import (
"fmt"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
"review.coreboot.org/coreboot.git/util/intelp2m/config"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr"
)
const (
@ -37,14 +36,10 @@ type PlatformSpecific struct {
// RemmapRstSrc - remmap Pad Reset Source Config
func (PlatformSpecific) RemmapRstSrc() {
macro := common.GetMacro()
if config.TemplateGet() != config.TempInteltool {
// Use reset source remapping only if the input file is inteltool.log dump
return
}
dw0 := macro.Register(PAD_CFG_DW0)
var remapping = map[uint8]uint32{
0: common.RST_RSMRST << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
2: common.RST_PLTRST << common.PadRstCfgShift,
}
resetsrc, valid := remapping[dw0.GetResetConfig()]
@ -53,7 +48,7 @@ func (PlatformSpecific) RemmapRstSrc() {
ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()]
dw0.ValueSet(ResetConfigFieldVal)
} else {
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet())
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet())
}
dw0.CntrMaskFieldsClear(common.PadRstCfgMask)
}
@ -88,12 +83,13 @@ func (platform PlatformSpecific) NoConnMacroAdd() {
// dw0 : DW0 config register value
// dw1 : DW1 config register value
// return: string of macro
// error
//
// error
func (platform PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string {
macro := common.GetInstanceMacro(
PlatformSpecific{
InheritanceMacro : cnl.PlatformSpecific{
InheritanceMacro : snr.PlatformSpecific{},
InheritanceMacro: cnl.PlatformSpecific{
InheritanceMacro: snr.PlatformSpecific{},
},
},
fields.InterfaceGet(),

View file

@ -1,14 +1,13 @@
package jsl
import (
"strings"
"fmt"
"strings"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl"
"review.coreboot.org/coreboot.git/util/intelp2m/config"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
)
const (
@ -37,15 +36,11 @@ type PlatformSpecific struct {
// RemmapRstSrc - remmap Pad Reset Source Config
func (PlatformSpecific) RemmapRstSrc() {
macro := common.GetMacro()
if config.TemplateGet() != config.TempInteltool {
// Use reset source remapping only if the input file is inteltool.log dump
return
}
if strings.Contains(macro.PadIdGet(), "GPP_F") ||
strings.Contains(macro.PadIdGet(), "GPP_B") ||
strings.Contains(macro.PadIdGet(), "GPP_A") ||
strings.Contains(macro.PadIdGet(), "GPP_S") ||
strings.Contains(macro.PadIdGet(), "GPP_R") {
strings.Contains(macro.PadIdGet(), "GPP_B") ||
strings.Contains(macro.PadIdGet(), "GPP_A") ||
strings.Contains(macro.PadIdGet(), "GPP_S") ||
strings.Contains(macro.PadIdGet(), "GPP_R") {
// See reset map for the Jasper Lake Community 0:
// https://github.com/coreboot/coreboot/blob/master/src/soc/intel/jasperlake/gpio.c#L21
// remmap is not required because it is the same as common.
@ -55,7 +50,7 @@ func (PlatformSpecific) RemmapRstSrc() {
dw0 := macro.Register(PAD_CFG_DW0)
var remapping = map[uint8]uint32{
0: common.RST_RSMRST << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
2: common.RST_PLTRST << common.PadRstCfgShift,
}
resetsrc, valid := remapping[dw0.GetResetConfig()]
@ -64,7 +59,7 @@ func (PlatformSpecific) RemmapRstSrc() {
ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()]
dw0.ValueSet(ResetConfigFieldVal)
} else {
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet())
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet())
}
dw0.CntrMaskFieldsClear(common.PadRstCfgMask)
}
@ -99,7 +94,8 @@ func (platform PlatformSpecific) NoConnMacroAdd() {
// dw0 : DW0 config register value
// dw1 : DW1 config register value
// return: string of macro
// error
//
// error
func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string {
macro := common.GetInstanceMacro(
PlatformSpecific{

View file

@ -3,9 +3,8 @@ package lbg
import (
"fmt"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
"review.coreboot.org/coreboot.git/util/intelp2m/config"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr"
)
@ -36,14 +35,10 @@ type PlatformSpecific struct {
// RemmapRstSrc - remmap Pad Reset Source Config
func (PlatformSpecific) RemmapRstSrc() {
macro := common.GetMacro()
if config.TemplateGet() != config.TempInteltool {
// Use reset source remapping only if the input file is inteltool.log dump
return
}
dw0 := macro.Register(PAD_CFG_DW0)
var remapping = map[uint8]uint32{
0: common.RST_RSMRST << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
2: common.RST_PLTRST << common.PadRstCfgShift,
}
resetsrc, valid := remapping[dw0.GetResetConfig()]
@ -52,7 +47,7 @@ func (PlatformSpecific) RemmapRstSrc() {
ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()]
dw0.ValueSet(ResetConfigFieldVal)
} else {
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet())
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet())
}
dw0.CntrMaskFieldsClear(common.PadRstCfgMask)
}
@ -91,8 +86,8 @@ func (platform PlatformSpecific) NoConnMacroAdd() {
func (platform PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string {
// The GPIO controller architecture in Lewisburg and Sunrise are very similar,
// so we will inherit some platform-dependent functions from Sunrise.
macro := common.GetInstanceMacro(PlatformSpecific{InheritanceMacro : snr.PlatformSpecific{}},
fields.InterfaceGet())
macro := common.GetInstanceMacro(PlatformSpecific{InheritanceMacro: snr.PlatformSpecific{}},
fields.InterfaceGet())
macro.Clear()
macro.Register(PAD_CFG_DW0).CntrMaskFieldsClear(common.AllFields)
macro.Register(PAD_CFG_DW1).CntrMaskFieldsClear(common.AllFields)

View file

@ -1,14 +1,13 @@
package mtl
import (
"strings"
"fmt"
"strings"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl"
"review.coreboot.org/coreboot.git/util/intelp2m/config"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
)
const (
@ -37,23 +36,19 @@ type PlatformSpecific struct {
// RemmapRstSrc - remmap Pad Reset Source Config
func (PlatformSpecific) RemmapRstSrc() {
macro := common.GetMacro()
if config.TemplateGet() != config.TempInteltool {
// Use reset source remapping only if the input file is inteltool.log dump
return
}
if strings.Contains(macro.PadIdGet(), "GPD") {
// See reset map for the MeteorLake GPD group at
// https://github.com/coreboot/coreboot/blob/master/src/soc/intel/meteorlake/gpio.c#L10
// remmap is not required because it is the same as common.
// https://github.com/coreboot/coreboot/blob/master/src/soc/intel/meteorlake/gpio.c#L10
// remmap is not required because it is the same as common.
return
}
dw0 := macro.Register(PAD_CFG_DW0)
var remapping = map[uint8]uint32{
0: common.RST_RSMRST << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
2: common.RST_PLTRST << common.PadRstCfgShift,
3: common.RST_PWROK << common.PadRstCfgShift,
3: common.RST_PWROK << common.PadRstCfgShift,
}
resetsrc, valid := remapping[dw0.GetResetConfig()]
if valid {
@ -61,7 +56,7 @@ func (PlatformSpecific) RemmapRstSrc() {
ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()]
dw0.ValueSet(ResetConfigFieldVal)
} else {
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet())
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet())
}
dw0.CntrMaskFieldsClear(common.PadRstCfgMask)
}
@ -92,12 +87,12 @@ func (platform PlatformSpecific) NoConnMacroAdd() {
platform.InheritanceMacro.NoConnMacroAdd()
}
// GenMacro - generate pad macro
// dw0 : DW0 config register value
// dw1 : DW1 config register value
// return: string of macro
// error
//
// error
func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string {
macro := common.GetInstanceMacro(
PlatformSpecific{

View file

@ -1,12 +1,12 @@
package snr
import (
"strings"
"fmt"
"strings"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
"review.coreboot.org/coreboot.git/util/intelp2m/config"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
)
const (
@ -20,15 +20,11 @@ const (
MAX_DW_NUM = common.MAX_DW_NUM
)
type PlatformSpecific struct {}
type PlatformSpecific struct{}
// RemmapRstSrc - remmap Pad Reset Source Config
func (PlatformSpecific) RemmapRstSrc() {
macro := common.GetMacro()
if config.TemplateGet() != config.TempInteltool {
// Use reset source remapping only if the input file is inteltool.log dump
return
}
if strings.Contains(macro.PadIdGet(), "GPD") {
// See reset map for the Sunrise GPD Group in the Community 2:
// https://github.com/coreboot/coreboot/blob/master/src/soc/intel/skylake/gpio.c#L15
@ -39,7 +35,7 @@ func (PlatformSpecific) RemmapRstSrc() {
dw0 := macro.Register(PAD_CFG_DW0)
var remapping = map[uint8]uint32{
0: common.RST_RSMRST << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
2: common.RST_PLTRST << common.PadRstCfgShift,
}
resetsrc, valid := remapping[dw0.GetResetConfig()]
@ -48,7 +44,7 @@ func (PlatformSpecific) RemmapRstSrc() {
ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()]
dw0.ValueSet(ResetConfigFieldVal)
} else {
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet())
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet())
}
dw0.CntrMaskFieldsClear(common.PadRstCfgMask)
}
@ -73,9 +69,9 @@ func (PlatformSpecific) Pull() {
if !valid {
str = "INVALID"
fmt.Println("Error",
macro.PadIdGet(),
" invalid TERM value = ",
int(dw1.GetTermination()))
macro.PadIdGet(),
" invalid TERM value = ",
int(dw1.GetTermination()))
}
macro.Separator().Add(str)
}
@ -146,7 +142,7 @@ func (PlatformSpecific) GpiMacroAdd() {
macro := common.GetMacro()
var ids []string
macro.Set("PAD_CFG_GPI")
for routeid, isRoute := range map[string]func() (bool) {
for routeid, isRoute := range map[string]func() bool{
"IOAPIC": ioApicRoute,
"SCI": sciRoute,
"SMI": smiRoute,

View file

@ -1,14 +1,13 @@
package tgl
import (
"strings"
"fmt"
"strings"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/snr"
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/cnl"
"review.coreboot.org/coreboot.git/util/intelp2m/config"
"review.coreboot.org/coreboot.git/util/intelp2m/fields"
)
const (
@ -37,10 +36,6 @@ type PlatformSpecific struct {
// RemmapRstSrc - remmap Pad Reset Source Config
func (PlatformSpecific) RemmapRstSrc() {
macro := common.GetMacro()
if config.TemplateGet() != config.TempInteltool {
// Use reset source remapping only if the input file is inteltool.log dump
return
}
if strings.Contains(macro.PadIdGet(), "GPD") {
// See reset map for the TigerLake Community 2:
// https://github.com/coreboot/coreboot/blob/master/src/soc/intel/tigerlake/gpio.c#L21
@ -51,7 +46,7 @@ func (PlatformSpecific) RemmapRstSrc() {
dw0 := macro.Register(PAD_CFG_DW0)
var remapping = map[uint8]uint32{
0: common.RST_RSMRST << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
1: common.RST_DEEP << common.PadRstCfgShift,
2: common.RST_PLTRST << common.PadRstCfgShift,
}
resetsrc, valid := remapping[dw0.GetResetConfig()]
@ -60,7 +55,7 @@ func (PlatformSpecific) RemmapRstSrc() {
ResetConfigFieldVal := (dw0.ValueGet() & 0x3fffffff) | remapping[dw0.GetResetConfig()]
dw0.ValueSet(ResetConfigFieldVal)
} else {
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc ," ] for ", macro.PadIdGet())
fmt.Println("Invalid Pad Reset Config [ 0x", resetsrc, " ] for ", macro.PadIdGet())
}
dw0.CntrMaskFieldsClear(common.PadRstCfgMask)
}
@ -95,7 +90,8 @@ func (platform PlatformSpecific) NoConnMacroAdd() {
// dw0 : DW0 config register value
// dw1 : DW1 config register value
// return: string of macro
// error
//
// error
func (PlatformSpecific) GenMacro(id string, dw0 uint32, dw1 uint32, ownership uint8) string {
macro := common.GetInstanceMacro(
PlatformSpecific{

View file

@ -1 +1 @@
1.1
1.2