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 | |
| 9 | hasKeyboard := IsIOPortUsedBy(ctx, 0x60, "keyboard") |
| 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( |
| 23 | `Method(_WAK,1) |
| 24 | { |
| 25 | /* FIXME: EC support */ |
| 26 | Return(Package(){0,0}) |
| 27 | } |
| 28 | |
| 29 | Method(_PTS,1) |
| 30 | { |
| 31 | /* FIXME: EC support */ |
| 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 { |
| 67 | si.WriteString("#include <drivers/pc80/ps2_controller.asl>\n") |
| 68 | MainboardInit += fmt.Sprintf("\tpc_keyboard_init();\n") |
| 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 | } |