1package config 2 3import "os" 4 5const ( 6 TempInteltool int = 0 7 TempGpioh int = 1 8 TempSpec int = 2 9) 10 11var template int = 0 12 13func TemplateSet(temp int) bool { 14 if temp > TempSpec { 15 return false 16 } else { 17 template = temp 18 return true 19 } 20} 21 22func TemplateGet() int { 23 return template 24} 25 26const ( 27 SunriseType uint8 = 0 28 LewisburgType uint8 = 1 29 ApolloType uint8 = 2 30 CannonType uint8 = 3 31 TigerType uint8 = 4 32 AlderType uint8 = 5 33 JasperType uint8 = 6 34 MeteorType uint8 = 7 35 EmmitsburgType uint8 = 8 36) 37 38var key uint8 = SunriseType 39 40var platform = map[string]uint8{ 41 "snr": SunriseType, 42 "lbg": LewisburgType, 43 "apl": ApolloType, 44 "cnl": CannonType, 45 "tgl": TigerType, 46 "adl": AlderType, 47 "jsl": JasperType, 48 "mtl": MeteorType, 49 "ebg": EmmitsburgType, 50} 51func PlatformSet(name string) int { 52 if platformType, valid := platform[name]; valid { 53 key = platformType 54 return 0 55 } 56 return -1 57} 58func PlatformGet() uint8 { 59 return key 60} 61func IsPlatform(platformType uint8) bool { 62 return platformType == key 63} 64func IsPlatformApollo() bool { 65 return IsPlatform(ApolloType) 66} 67func IsPlatformSunrise() bool { 68 return IsPlatform(SunriseType) 69} 70func IsPlatformLewisburg() bool { 71 return IsPlatform(LewisburgType) 72} 73func IsPlatformCannonLake() bool { 74 return IsPlatform(CannonType) 75} 76func IsPlatformTigerLake() bool { 77 return IsPlatform(TigerType) 78} 79func IsPlatformAlderLakeH() bool { 80 return IsPlatform(AlderType) 81} 82func IsPlatformMeteorLake() bool { 83 return IsPlatform(MeteorType) 84} 85func IsPlatformEmmitsburg() bool { 86 return IsPlatform(EmmitsburgType) 87} 88 89var InputRegDumpFile *os.File = nil 90var OutputGenFile *os.File = nil 91 92var ignoredFieldsFormat bool = false 93func IgnoredFieldsFlagSet(flag bool) { 94 ignoredFieldsFormat = flag 95} 96func AreFieldsIgnored() bool { 97 return ignoredFieldsFormat 98} 99 100var nonCheckingFlag bool = false 101func NonCheckingFlagSet(flag bool) { 102 nonCheckingFlag = flag 103} 104func IsNonCheckingFlagUsed() bool { 105 return nonCheckingFlag 106} 107 108 109var infolevel int = 0 110func InfoLevelSet(lvl int) { 111 infolevel = lvl 112} 113func InfoLevelGet() int { 114 return infolevel 115} 116 117var fldstyle uint8 = CbFlds 118const ( 119 NoFlds uint8 = 0 120 CbFlds uint8 = 1 // coreboot style 121 FspFlds uint8 = 2 // FSP/edk2 style 122 RawFlds uint8 = 3 // raw DW0/1 values 123) 124var fldstylemap = map[string]uint8{ 125 "none" : NoFlds, 126 "cb" : CbFlds, 127 "fsp" : FspFlds, 128 "raw" : RawFlds} 129func FldStyleSet(name string) int { 130 if style, valid := fldstylemap[name]; valid { 131 fldstyle = style 132 return 0 133 } 134 return -1 135} 136func FldStyleGet() uint8 { 137 return fldstyle 138} 139func IsFieldsMacroUsed() bool { 140 return FldStyleGet() != NoFlds 141} 142func IsCbStyleMacro() bool { 143 return FldStyleGet() == CbFlds 144} 145func IsFspStyleMacro() bool { 146 return FldStyleGet() == FspFlds 147} 148func IsRawFields() bool { 149 return FldStyleGet() == RawFlds 150} 151