summaryrefslogtreecommitdiff
path: root/util/autoport/ec_fixme.go
diff options
context:
space:
mode:
authorLeah Rowe <vimuser@noreply.codeberg.org>2024-03-18 23:59:32 +0000
committerLeah Rowe <vimuser@noreply.codeberg.org>2024-03-18 23:59:32 +0000
commit457a7037d8f421fc16eb12656d54c32ca4d232ec (patch)
treea208e8ff3e8b628b1615918cbb55b6ce351cfe54 /util/autoport/ec_fixme.go
parentc578fe56c36f94af5c51a1be27a1a1c4b57a4289 (diff)
parent8cba237086dfbb312a5913bb75eef4f6046aeae5 (diff)
Merge pull request 'util: Import autoport with Haswell patches' (#195) from nic3-14159/lbmk:autoport-fork into master
Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/195
Diffstat (limited to 'util/autoport/ec_fixme.go')
-rw-r--r--util/autoport/ec_fixme.go91
1 files changed, 91 insertions, 0 deletions
diff --git a/util/autoport/ec_fixme.go b/util/autoport/ec_fixme.go
new file mode 100644
index 00000000..54f78ab4
--- /dev/null
+++ b/util/autoport/ec_fixme.go
@@ -0,0 +1,91 @@
+package main
+
+import "fmt"
+
+func FIXMEEC(ctx Context) {
+ ap := Create(ctx, "acpi/platform.asl")
+ defer ap.Close()
+
+ hasKeyboard := ctx.InfoSource.HasPS2()
+
+ sbGPE := GuessECGPE(ctx)
+ var GPEUnsure bool
+ if sbGPE < 0 {
+ sbGPE = SouthBridge.EncodeGPE(1)
+ GPEUnsure = true
+ SouthBridge.NeedRouteGPIOManually()
+ } else {
+ GPEUnsure = false
+ SouthBridge.EnableGPE(SouthBridge.DecodeGPE(sbGPE))
+ }
+
+ Add_gpl(ap)
+ ap.WriteString(
+ `Method(_WAK, 1)
+{
+ /* FIXME: EC support */
+ Return(Package() {0, 0})
+}
+
+Method(_PTS,1)
+{
+ /* FIXME: EC support */
+}
+`)
+
+ ecs := ctx.InfoSource.GetEC()
+ MainboardIncludes = append(MainboardIncludes, "ec/acpi/ec.h")
+ MainboardIncludes = append(MainboardIncludes, "console/console.h")
+
+ MainboardInit +=
+ ` /* FIXME: trim this down or remove if necessary */
+ {
+ int i;
+ const u8 dmp[256] = {`
+ for i := 0; i < 0x100; i++ {
+ if (i & 0xf) == 0 {
+ MainboardInit += fmt.Sprintf("\n\t\t\t/* %02x */ ", i)
+ }
+ MainboardInit += fmt.Sprintf("0x%02x,", ecs[i])
+ if (i & 0xf) != 0xf {
+ MainboardInit += " "
+ }
+ }
+ MainboardInit += "\n\t\t};\n"
+ MainboardInit += `
+ printk(BIOS_DEBUG, "Replaying EC dump ...");
+ for (i = 0; i < 256; i++)
+ ec_write (i, dmp[i]);
+ printk(BIOS_DEBUG, "done\n");
+ }
+`
+
+ KconfigBool["EC_ACPI"] = true
+ si := Create(ctx, "acpi/superio.asl")
+ defer si.Close()
+
+ if hasKeyboard {
+ Add_gpl(si)
+ si.WriteString("#include <drivers/pc80/pc/ps2_controller.asl>\n")
+ MainboardInit += fmt.Sprintf("\tpc_keyboard_init(NO_AUX_DEVICE);\n")
+ MainboardIncludes = append(MainboardIncludes, "pc80/keyboard.h")
+ }
+
+ ec := Create(ctx, "acpi/ec.asl")
+ defer ec.Close()
+
+ Add_gpl(ec)
+ ec.WriteString(`Device(EC)
+{
+ Name (_HID, EISAID("PNP0C09"))
+ Name (_UID, 0)
+`)
+ if GPEUnsure {
+ ec.WriteString("\t/* FIXME: Set GPE */\n")
+ ec.WriteString("\t/* Name (_GPE, ?) */\n")
+ } else {
+ fmt.Fprintf(ec, "\tName (_GPE, %d)\n", sbGPE)
+ }
+ ec.WriteString("/* FIXME: EC support */\n")
+ ec.WriteString("}\n")
+}