MAINTAINERS: Add Maximilian Brune to RISC-V
[coreboot.git] / util / autoport / ec_fixme.go
blob54f78ab432ac353c0c41f7c501a2c60693f0c2f0
1 package main
3 import "fmt"
5 func FIXMEEC(ctx Context) {
6 ap := Create(ctx, "acpi/platform.asl")
7 defer ap.Close()
9 hasKeyboard := ctx.InfoSource.HasPS2()
11 sbGPE := GuessECGPE(ctx)
12 var GPEUnsure bool
13 if sbGPE < 0 {
14 sbGPE = SouthBridge.EncodeGPE(1)
15 GPEUnsure = true
16 SouthBridge.NeedRouteGPIOManually()
17 } else {
18 GPEUnsure = false
19 SouthBridge.EnableGPE(SouthBridge.DecodeGPE(sbGPE))
22 Add_gpl(ap)
23 ap.WriteString(
24 `Method(_WAK, 1)
26 /* FIXME: EC support */
27 Return(Package() {0, 0})
30 Method(_PTS,1)
32 /* FIXME: EC support */
36 ecs := ctx.InfoSource.GetEC()
37 MainboardIncludes = append(MainboardIncludes, "ec/acpi/ec.h")
38 MainboardIncludes = append(MainboardIncludes, "console/console.h")
40 MainboardInit +=
41 ` /* FIXME: trim this down or remove if necessary */
43 int i;
44 const u8 dmp[256] = {`
45 for i := 0; i < 0x100; i++ {
46 if (i & 0xf) == 0 {
47 MainboardInit += fmt.Sprintf("\n\t\t\t/* %02x */ ", i)
49 MainboardInit += fmt.Sprintf("0x%02x,", ecs[i])
50 if (i & 0xf) != 0xf {
51 MainboardInit += " "
54 MainboardInit += "\n\t\t};\n"
55 MainboardInit += `
56 printk(BIOS_DEBUG, "Replaying EC dump ...");
57 for (i = 0; i < 256; i++)
58 ec_write (i, dmp[i]);
59 printk(BIOS_DEBUG, "done\n");
63 KconfigBool["EC_ACPI"] = true
64 si := Create(ctx, "acpi/superio.asl")
65 defer si.Close()
67 if hasKeyboard {
68 Add_gpl(si)
69 si.WriteString("#include <drivers/pc80/pc/ps2_controller.asl>\n")
70 MainboardInit += fmt.Sprintf("\tpc_keyboard_init(NO_AUX_DEVICE);\n")
71 MainboardIncludes = append(MainboardIncludes, "pc80/keyboard.h")
74 ec := Create(ctx, "acpi/ec.asl")
75 defer ec.Close()
77 Add_gpl(ec)
78 ec.WriteString(`Device(EC)
80 Name (_HID, EISAID("PNP0C09"))
81 Name (_UID, 0)
83 if GPEUnsure {
84 ec.WriteString("\t/* FIXME: Set GPE */\n")
85 ec.WriteString("\t/* Name (_GPE, ?) */\n")
86 } else {
87 fmt.Fprintf(ec, "\tName (_GPE, %d)\n", sbGPE)
89 ec.WriteString("/* FIXME: EC support */\n")
90 ec.WriteString("}\n")