| 1 |
package ehl |
| 2 |
|
| 3 |
import ( |
| 4 |
"review.coreboot.org/coreboot.git/util/intelp2m/logs" |
| 5 |
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/apl" |
| 6 |
"review.coreboot.org/coreboot.git/util/intelp2m/platforms/common" |
| 7 |
) |
| 8 |
|
| 9 |
const ( |
| 10 |
DW0Mask = (0b1 << 27) | (0b1111 << 14) | 0b11111100 |
| 11 |
DW1Mask = 0b11111111111111000000000011111111 |
| 12 |
) |
| 13 |
|
| 14 |
var GPPGroups = []string{"GPP_", "GPD_", "GPIO_", "VGPIO_"} |
| 15 |
|
| 16 |
type BasePlatform struct { |
| 17 |
|
| 18 |
apl.BasePlatform |
| 19 |
} |
| 20 |
|
| 21 |
func InitBasePlatform(dw0Val, dw0Mask uint32, dw1Val, dw1Mask uint32) BasePlatform { |
| 22 |
return BasePlatform{apl.InitBasePlatform(dw0Val, dw0Mask, dw1Val, dw1Mask)} |
| 23 |
} |
| 24 |
|
| 25 |
func GetPlatform(dw0, dw1 uint32) common.PlatformIf { |
| 26 |
p := InitBasePlatform(dw0, DW0Mask, dw1, DW1Mask) |
| 27 |
return &p |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
func (p *BasePlatform) Pull(m *common.Macro) { |
| 32 |
dw1 := p.GetRegisterDW1() |
| 33 |
var pull = map[uint32]string{ |
| 34 |
0b0000: "NONE", |
| 35 |
0b0001: "DN_1K", |
| 36 |
0b0010: "DN_5K", |
| 37 |
0b0100: "DN_20K", |
| 38 |
0b1000: "UP_1K_5K_20K", |
| 39 |
0b1001: "UP_1K", |
| 40 |
0b1010: "UP_5K", |
| 41 |
0b1011: "UP_1K_5K", |
| 42 |
0b1100: "UP_20K", |
| 43 |
0b1101: "UP_1K_20K", |
| 44 |
0b1110: "UP_5K_20K", |
| 45 |
0b1111: "NATIVE", |
| 46 |
} |
| 47 |
term, valid := pull[dw1.GetTermination()] |
| 48 |
if !valid { |
| 49 |
term = "ERROR" |
| 50 |
logs.Errorf("%s: DW1 %s: invalid termination value 0b%b", |
| 51 |
dw1, m.GetPadId(), dw1.GetTermination()) |
| 52 |
} |
| 53 |
m.Separator().Add(term) |
| 54 |
} |