2020-04-26 21:12:01 +02:00
|
|
|
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
|
2020-08-09 21:13:56 +02:00
|
|
|
CannonType uint8 = 3
|
2022-04-06 10:15:22 +02:00
|
|
|
AlderType uint8 = 4
|
2020-04-26 21:12:01 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var key uint8 = SunriseType
|
|
|
|
|
|
|
|
var platform = map[string]uint8{
|
|
|
|
"snr": SunriseType,
|
|
|
|
"lbg": LewisburgType,
|
2020-08-09 21:13:56 +02:00
|
|
|
"apl": ApolloType,
|
2022-04-06 10:15:22 +02:00
|
|
|
"cnl": CannonType,
|
|
|
|
"adl": AlderType}
|
2020-04-26 21:12:01 +02:00
|
|
|
func PlatformSet(name string) int {
|
|
|
|
if platformType, valid := platform[name]; valid {
|
|
|
|
key = platformType
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return -1
|
|
|
|
}
|
|
|
|
func PlatformGet() uint8 {
|
|
|
|
return key
|
|
|
|
}
|
|
|
|
func IsPlatform(platformType uint8) bool {
|
|
|
|
return platformType == key
|
|
|
|
}
|
|
|
|
func IsPlatformApollo() bool {
|
|
|
|
return IsPlatform(ApolloType)
|
|
|
|
}
|
|
|
|
func IsPlatformSunrise() bool {
|
|
|
|
return IsPlatform(SunriseType)
|
|
|
|
}
|
|
|
|
func IsPlatformLewisburg() bool {
|
|
|
|
return IsPlatform(LewisburgType)
|
|
|
|
}
|
2020-08-09 21:13:56 +02:00
|
|
|
func IsPlatformCannonLake() bool {
|
|
|
|
return IsPlatform(CannonType)
|
|
|
|
}
|
2022-04-06 10:15:22 +02:00
|
|
|
func IsPlatformAlderLakeH() bool {
|
|
|
|
return IsPlatform(AlderType)
|
|
|
|
}
|
2020-04-26 21:12:01 +02:00
|
|
|
|
|
|
|
var InputRegDumpFile *os.File = nil
|
|
|
|
var OutputGenFile *os.File = nil
|
|
|
|
|
|
|
|
var ignoredFieldsFormat bool = false
|
|
|
|
func IgnoredFieldsFlagSet(flag bool) {
|
|
|
|
ignoredFieldsFormat = flag
|
|
|
|
}
|
|
|
|
func AreFieldsIgnored() bool {
|
|
|
|
return ignoredFieldsFormat
|
|
|
|
}
|
|
|
|
|
|
|
|
var nonCheckingFlag bool = false
|
|
|
|
func NonCheckingFlagSet(flag bool) {
|
|
|
|
nonCheckingFlag = flag
|
|
|
|
}
|
|
|
|
func IsNonCheckingFlagUsed() bool {
|
|
|
|
return nonCheckingFlag
|
|
|
|
}
|
|
|
|
|
util/intelp2m: Update output information format in the comments
Update the information format in the comments above the macros in the
generated gpio.h file:
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE,
DISPUPD), /* LPSS_UART0_TXD */ -->(i)
/* GPIO_39 - LPSS_UART0_TXD */ --> (ii)
/* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii)
/* DW0 : PAD_TRIG(OFF) - IGNORED */ --> (iii)
/* _PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) |
PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)), */ --> (iiii)
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE,
DISPUPD),
Also, in the case of field macros:
/* GPIO_39 - LPSS_UART0_TXD */ --> (ii)
/* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii)
/* DW0 : PAD_TRIG(OFF) - IGNORED */ --> (iii)
/* PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE,
DISPUPD), */ --> (iiii)
PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF),
PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)),
By default, if do not use the -i... option, then additional information
in comments will not be generated.
TEST:
git clone https://github.com/maxpoliak/inteltool-examples.git test
./intelp2m -n -file test/inteltool-asrock-h110m-stx.log
./intelp2m -fld cb -file test/inteltool-asrock-h110m-stx.log
./intelp2m -fld fsp -file test/inteltool-asrock-h110m-stx.log
./intelp2m -fld raw -file test/inteltool-asrock-h110m-stx.log
Before and after (now with -i key) the patch, gpio.h is no different.
Change-Id: I760f4aadece786ea455fb7569f42e06fefce2b61
Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45168
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-09-30 15:46:11 +02:00
|
|
|
|
|
|
|
var infolevel int = 0
|
|
|
|
func InfoLevelSet(lvl int) {
|
2020-04-26 21:12:01 +02:00
|
|
|
infolevel = lvl
|
|
|
|
}
|
util/intelp2m: Update output information format in the comments
Update the information format in the comments above the macros in the
generated gpio.h file:
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE,
DISPUPD), /* LPSS_UART0_TXD */ -->(i)
/* GPIO_39 - LPSS_UART0_TXD */ --> (ii)
/* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii)
/* DW0 : PAD_TRIG(OFF) - IGNORED */ --> (iii)
/* _PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) |
PAD_TRIG(OFF), PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)), */ --> (iiii)
PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE,
DISPUPD),
Also, in the case of field macros:
/* GPIO_39 - LPSS_UART0_TXD */ --> (ii)
/* DW0: 0x44000400, DW1: 0x00003100 */ --> (ii)
/* DW0 : PAD_TRIG(OFF) - IGNORED */ --> (iii)
/* PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_39, UP_20K, DEEP, NF1, TxLASTRxE,
DISPUPD), */ --> (iiii)
PAD_CFG_STRUCT(GPIO_39, PAD_FUNC(NF1) | PAD_RESET(DEEP) | PAD_TRIG(OFF),
PAD_PULL(UP_20K) | PAD_IOSTERM(DISPUPD)),
By default, if do not use the -i... option, then additional information
in comments will not be generated.
TEST:
git clone https://github.com/maxpoliak/inteltool-examples.git test
./intelp2m -n -file test/inteltool-asrock-h110m-stx.log
./intelp2m -fld cb -file test/inteltool-asrock-h110m-stx.log
./intelp2m -fld fsp -file test/inteltool-asrock-h110m-stx.log
./intelp2m -fld raw -file test/inteltool-asrock-h110m-stx.log
Before and after (now with -i key) the patch, gpio.h is no different.
Change-Id: I760f4aadece786ea455fb7569f42e06fefce2b61
Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45168
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-09-30 15:46:11 +02:00
|
|
|
func InfoLevelGet() int {
|
2020-04-26 21:12:01 +02:00
|
|
|
return infolevel
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
)
|
|
|
|
var fldstylemap = map[string]uint8{
|
|
|
|
"none" : NoFlds,
|
|
|
|
"cb" : CbFlds,
|
|
|
|
"fsp" : FspFlds,
|
|
|
|
"raw" : RawFlds}
|
|
|
|
func FldStyleSet(name string) int {
|
|
|
|
if style, valid := fldstylemap[name]; valid {
|
|
|
|
fldstyle = style
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return -1
|
|
|
|
}
|
|
|
|
func FldStyleGet() uint8 {
|
|
|
|
return fldstyle
|
|
|
|
}
|
|
|
|
func IsFieldsMacroUsed() bool {
|
|
|
|
return FldStyleGet() != NoFlds
|
|
|
|
}
|
|
|
|
func IsCbStyleMacro() bool {
|
|
|
|
return FldStyleGet() == CbFlds
|
|
|
|
}
|
|
|
|
func IsFspStyleMacro() bool {
|
|
|
|
return FldStyleGet() == FspFlds
|
|
|
|
}
|
|
|
|
func IsRawFields() bool {
|
|
|
|
return FldStyleGet() == RawFlds
|
|
|
|
}
|