Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 1 | package main |
| 2 | |
| 3 | import "fmt" |
| 4 | |
| 5 | func FIXMEEC(ctx Context) { |
| 6 | ap := Create(ctx, "acpi/platform.asl") |
| 7 | defer ap.Close() |
| 8 | |
Vladimir Serbinenko | 91195c6 | 2015-05-29 23:53:37 +0200 | [diff] [blame] | 9 | hasKeyboard := ctx.InfoSource.HasPS2() |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 10 | |
| 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)) |
| 20 | } |
| 21 | |
| 22 | ap.WriteString( |
Paul Menzel | 56258ff | 2020-01-15 14:28:58 +0100 | [diff] [blame] | 23 | `Method(_WAK, 1) |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 24 | { |
Angel Pons | 6779d23 | 2020-01-08 15:05:56 +0100 | [diff] [blame] | 25 | /* FIXME: EC support */ |
Paul Menzel | 56258ff | 2020-01-15 14:28:58 +0100 | [diff] [blame] | 26 | Return(Package() {0, 0}) |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | Method(_PTS,1) |
| 30 | { |
Angel Pons | 6779d23 | 2020-01-08 15:05:56 +0100 | [diff] [blame] | 31 | /* FIXME: EC support */ |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 32 | } |
| 33 | `) |
| 34 | |
| 35 | ecs := ctx.InfoSource.GetEC() |
| 36 | MainboardIncludes = append(MainboardIncludes, "ec/acpi/ec.h") |
Vladimir Serbinenko | 5868ab4 | 2015-05-29 21:51:54 +0200 | [diff] [blame] | 37 | MainboardIncludes = append(MainboardIncludes, "console/console.h") |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 38 | |
| 39 | MainboardInit += |
| 40 | ` /* FIXME: trim this down or remove if necessary */ |
| 41 | { |
| 42 | int i; |
| 43 | const u8 dmp[256] = {` |
| 44 | for i := 0; i < 0x100; i++ { |
| 45 | if (i & 0xf) == 0 { |
| 46 | MainboardInit += fmt.Sprintf("\n\t\t\t/* %02x */ ", i) |
| 47 | } |
| 48 | MainboardInit += fmt.Sprintf("0x%02x,", ecs[i]) |
| 49 | if (i & 0xf) != 0xf { |
| 50 | MainboardInit += " " |
| 51 | } |
| 52 | } |
| 53 | MainboardInit += "\n\t\t};\n" |
| 54 | MainboardInit += ` |
| 55 | printk(BIOS_DEBUG, "Replaying EC dump ..."); |
| 56 | for (i = 0; i < 256; i++) |
| 57 | ec_write (i, dmp[i]); |
| 58 | printk(BIOS_DEBUG, "done\n"); |
| 59 | } |
| 60 | ` |
| 61 | |
Vladimir Serbinenko | 5868ab4 | 2015-05-29 21:51:54 +0200 | [diff] [blame] | 62 | KconfigBool["EC_ACPI"] = true |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 63 | si := Create(ctx, "acpi/superio.asl") |
| 64 | defer si.Close() |
| 65 | |
| 66 | if hasKeyboard { |
Stefan Reinauer | 86ddd73 | 2016-03-11 20:22:28 -0800 | [diff] [blame] | 67 | si.WriteString("#include <drivers/pc80/pc/ps2_controller.asl>\n") |
Iru Cai | 8bf53a9f | 2017-01-26 20:33:29 +0800 | [diff] [blame] | 68 | MainboardInit += fmt.Sprintf("\tpc_keyboard_init(NO_AUX_DEVICE);\n") |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 69 | MainboardIncludes = append(MainboardIncludes, "pc80/keyboard.h") |
| 70 | } |
| 71 | |
| 72 | ec := Create(ctx, "acpi/ec.asl") |
| 73 | defer ec.Close() |
| 74 | |
| 75 | ec.WriteString(`Device(EC) |
| 76 | { |
| 77 | Name (_HID, EISAID("PNP0C09")) |
| 78 | Name (_UID, 0) |
| 79 | `) |
| 80 | if GPEUnsure { |
| 81 | ec.WriteString("\t/* FIXME: Set GPE */\n") |
| 82 | ec.WriteString("\t/* Name (_GPE, ?) */\n") |
| 83 | } else { |
| 84 | fmt.Fprintf(ec, "\tName (_GPE, %d)\n", sbGPE) |
| 85 | } |
| 86 | ec.WriteString("/* FIXME: EC support */\n") |
Vladimir Serbinenko | 5868ab4 | 2015-05-29 21:51:54 +0200 | [diff] [blame] | 87 | ec.WriteString("}\n") |
Vladimir Serbinenko | 3129f79 | 2014-10-15 21:51:47 +0200 | [diff] [blame] | 88 | } |