aboutsummaryrefslogtreecommitdiff
path: root/src/ec/hp/kbc1126/acpi
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2017-03-26 10:25:00 +0800
committerMartin Roth <martinroth@google.com>2017-08-11 16:10:52 +0000
commit44d399c394f0cd5d38dffe551742badc100573d3 (patch)
tree23084902b39de3b72963bfc8bf8d24ebce979951 /src/ec/hp/kbc1126/acpi
parentae1548621acae99b7f7ac4a722607af0a4a0c825 (diff)
ec: add support for KBC1126 in HP laptops
- let the coreboot build system insert the two blobs to the coreboot image - EC and Super I/O initialization - ACPI support Tested on 2760p, 8460p, 2570p, 8470p. Issue: Kernel gives the following error: ACPI Error: No handler for Region [ECRM] (...) [EmbeddedControl] ACPI Error: Region EmbeddedControl (ID=3) has no handler TODO: - consider moving the Super I/O initialization code to ramstage, or reuse the existing sio/smsc/kbc1100 code (if so, how to add the additional kbc1126 specific functions to sio/kbc1100) - sort out the ACPI code which is mostly from the ACPI dump of vendor firmware - find out why the digitizer in hp/2760p doesn't work - GRUB payload freezing on all HP Elitebooks may be related to EC Change-Id: I6b16eb7e26303eda740f52d667dedb7cc04b4ef0 Signed-off-by: Iru Cai <mytbk920423@gmail.com> Reviewed-on: https://review.coreboot.org/19072 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/ec/hp/kbc1126/acpi')
-rw-r--r--src/ec/hp/kbc1126/acpi/ac.asl89
-rw-r--r--src/ec/hp/kbc1126/acpi/battery.asl520
-rw-r--r--src/ec/hp/kbc1126/acpi/ec.asl241
-rw-r--r--src/ec/hp/kbc1126/acpi/lid.asl30
4 files changed, 880 insertions, 0 deletions
diff --git a/src/ec/hp/kbc1126/acpi/ac.asl b/src/ec/hp/kbc1126/acpi/ac.asl
new file mode 100644
index 0000000000..3a80f8dedb
--- /dev/null
+++ b/src/ec/hp/kbc1126/acpi/ac.asl
@@ -0,0 +1,89 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Iru Cai <mytbk920423@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+Name (ACST, 0x01)
+Name (SMAR, 0x00)
+
+Field (ECRM, ByteAcc, NoLock, Preserve)
+{
+ Offset (0x84),
+ ADP, 1,
+ ADID, 2
+}
+
+Method (UPAD, 0, Serialized)
+{
+ Acquire (BTMX, 0xFFFF)
+ If ((GACP & 0x01))
+ {
+ GACP &= 0x06
+ Release (BTMX)
+ Acquire (ECMX, 0xFFFF)
+ Local0 = ADP
+ Local1 = ADID
+ Release (ECMX)
+ ACST = Local0
+ SMAR = Local1
+ }
+ Else
+ {
+ Release (BTMX)
+ }
+}
+
+Method (GPID, 0, Serialized)
+{
+ UPAD ()
+ Return (SMAR)
+}
+
+Method (GACS, 0, Serialized) /* get AC status */
+{
+ UPAD ()
+ Return (ACST)
+}
+
+Device (AC)
+{
+ Name (_HID, "ACPI0003")
+ Name (_PCL, Package () { \_SB })
+
+ Method (_STA)
+ {
+ Return (0x0F)
+ }
+
+ Method (_PSR, 0, NotSerialized)
+ {
+ Local0 = GACS ()
+ PWRS = Local0 /* GNVS.PWRS */
+ Local1 = GPID ()
+ ACST = Local0
+ SMAR = Local1
+ Return (Local0)
+ }
+}
+
+Method (_Q06, 0, NotSerialized)
+{
+ Store ("EC: AC STATUS", Debug)
+ PWUP (0x05, (0x02 | 0x01))
+ If (BTDR (0x02))
+ {
+ Notify (AC, 0x80)
+ PNOT ()
+ }
+}
diff --git a/src/ec/hp/kbc1126/acpi/battery.asl b/src/ec/hp/kbc1126/acpi/battery.asl
new file mode 100644
index 0000000000..a659cfaa73
--- /dev/null
+++ b/src/ec/hp/kbc1126/acpi/battery.asl
@@ -0,0 +1,520 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Iru Cai <mytbk920423@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+Field (ECRM, ByteAcc, NoLock, Preserve)
+{
+ Offset (0x84),
+ , 3,
+ LCTV, 1,
+ BATP, 4,
+ BPU, 1,
+ Offset (0x86),
+ BSEL, 4, /* battery select */
+ Offset (0x87),
+ LB1, 8,
+ LB2, 8,
+ BDC, 16,
+ Offset (0x8D),
+ BFC, 16, /* battery full capacity */
+ BRTE, 16,
+ BTC, 1,
+ Offset (0x92),
+ BME, 16,
+ BDN, 8,
+ BDV, 16, /* battery design voltage */
+ BCV1, 16,
+ BST, 4,
+ Offset (0xC9),
+ BSN, 16, /* battery serial number */
+ BDAT, 16, /* battery date */
+ BMF, 8,
+}
+
+Name (NGBF, 0xFF)
+Name (NGBT, 0xFF)
+Name (GACP, 0x07)
+Name (NBAP, 0x00)
+Name (NNBO, 0x01)
+Name (NDCB, 0x00)
+Mutex (BTMX, 0x00)
+
+#define NLB1 0xC8 /* design capacity of warning */
+#define NLB2 0x64 /* design capacity of low */
+
+Method (ITLB, 0, NotSerialized)
+{
+ Divide ((NLB1 + 0x09), 0x0A, Local0, Local1)
+ Divide ((0x96 + 0x09), 0x0A, Local0, Local2)
+ Local0 = Local0
+ LB1 = Local1
+ LB2 = Local2
+}
+
+Method (PWUP, 2, Serialized)
+{
+ Local0 = 0x00
+ Acquire (BTMX, 0xFFFF)
+ Local1 = (Arg0 | GACP)
+ GACP = (Local1 & 0x07)
+ If ((GACP & 0x02))
+ {
+ NGBF |= Arg1
+ }
+
+ If ((GACP & 0x04))
+ {
+ If ((NGBT != 0xFF))
+ {
+ Local0 = 0x01
+ }
+
+ NGBT |= Arg1
+ }
+
+ Release (BTMX)
+ Return (Local0)
+}
+
+Method (GBAP, 0, Serialized)
+{
+ Acquire (BTMX, 0xFFFF)
+ If ((GACP & 0x02))
+ {
+ GACP &= 0x05
+ Release (BTMX)
+ Acquire (ECMX, 0xFFFF)
+ NBAP = BATP
+ Release (ECMX)
+ }
+ Else
+ {
+ Release (BTMX)
+ }
+ Return (NBAP)
+}
+
+Method (BTDR, 1, Serialized)
+{
+ If ((Arg0 == 0x01))
+ {
+ NNBO = 0x01
+ }
+ ElseIf ((Arg0 == 0x00))
+ {
+ NNBO = 0x00
+ }
+
+ Return (NNBO)
+}
+
+Method (BSTA, 1, Serialized)
+{
+ BTDR (0x01)
+ Local0 = GBAP ()
+ Local1 = 0x0F
+ If ((Local0 & Arg0))
+ {
+ Local1 = 0x1F
+ }
+ Return (Local1)
+}
+
+Device (BAT0)
+{
+ Name (_HID, EisaId ("PNP0C0A"))
+ Name (_UID, 0x01)
+
+ Method (_STA, 0, NotSerialized)
+ {
+ Return (BSTA (0x01))
+ }
+
+ Method (_BIF, 0, NotSerialized)
+ {
+ Return (BTIF (0x00))
+ }
+
+ Method (_BST, 0, NotSerialized)
+ {
+ Return (BTSZ (0x00))
+ }
+
+ Name (_PCL, Package (0x01)
+ {
+ \_SB
+ })
+}
+
+Device (BAT1)
+{
+ Name (_HID, EisaId ("PNP0C0A"))
+ Name (_UID, 0x02)
+
+ Method (_STA, 0, NotSerialized)
+ {
+ Return (BSTA (0x02))
+ }
+
+ Method (_BIF, 0, NotSerialized)
+ {
+ Return (BTIF (0x01))
+ }
+
+ Method (_BST, 0, NotSerialized)
+ {
+ Return (BTSZ (0x01))
+ }
+
+ Name (_PCL, Package (0x01)
+ {
+ \_SB
+ })
+}
+
+Name (NBTI, Package (0x02)
+{
+ Package (0x0D)
+ {
+ 0x01, /* power unit: mA */
+ 0xFFFFFFFF, /* design capacity */
+ 0xFFFFFFFF, /* last full charge capacity */
+ 0x01, /* battery technology */
+ 0xFFFFFFFF, /* design voltage */
+ 0x00, /* design capacity of warning */
+ 0x00, /* design capacity of low */
+ 0x64, /* battery capacity granularity 1 */
+ 0x64, /* battery capacity granularity 2 */
+ "Primary", /* model number */
+ "100000", /* serial number */
+ "LIon", /* battery type */
+ "Hewlett-Packard" /* OEM information */
+ },
+
+ Package (0x0D)
+ {
+ 0x01,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0x01,
+ 0xFFFFFFFF,
+ 0x00,
+ 0x00,
+ 0x64,
+ 0x64,
+ "Travel",
+ "100000",
+ "LIon",
+ "Hewlett-Packard"
+ }
+})
+
+Name (NBST, Package (0x02)
+{
+ Package (0x04) {0x00, 0x00, 0x0FA0, 0x04B0},
+ Package (0x04) {0x00, 0x00, 0x0FA0, 0x04B0}
+})
+
+Name (NDBS, Package (0x04)
+{
+ 0x00,
+ 0x00,
+ 0x0FA0,
+ 0x04B0
+})
+
+Method (\ISTR, 2, NotSerialized)
+{
+ Name (NUMB, Buffer (6) { " " })
+ Local0 = Arg0
+ Local1 = Arg1
+ While (Local1)
+ {
+ Local1--
+ Divide (Local0, 10, Local2, Local0)
+ Add (Local2, 48, Index (NUMB, Local1))
+ }
+ ToString (NUMB, Arg1, Local3)
+ Return (Local3)
+}
+
+Method (GBSS, 2, Serialized)
+{
+ Local3 = \ISTR (Arg0, 0x05)
+ Concatenate (Local3, " ", Local4)
+ Local0 = (Arg1 >> 0x09)
+ Local1 = (Local0 + 1980)
+ Local2 = \ISTR (Local1, 0x04)
+ Concatenate (Local4, Local2, Local3)
+ Concatenate (Local3, "/", Local4)
+ Local0 = (Arg1 >> 0x05)
+ Local1 = (Local0 & 0x0F)
+ Local2 = \ISTR (Local1, 0x02)
+ Concatenate (Local4, Local2, Local3)
+ Concatenate (Local3, "/", Local4)
+ Local1 = (Arg1 & 0x1F)
+ Local2 = \ISTR (Local1, 0x02)
+ Concatenate (Local4, Local2, Local3)
+ Return (Local3)
+}
+
+Method (BTIG, 1, Serialized) /* in vendor DSDT is EC0.BTIF */
+{
+ Local7 = (0x01 << Arg0)
+ BTDR (0x01)
+ If ((BSTA (Local7) == 0x0F))
+ {
+ Return (0xFF)
+ }
+
+ Acquire (BTMX, 0xFFFF)
+ Local0 = NGBF
+ Release (BTMX)
+ If (((Local0 & Local7) == 0x00))
+ {
+ Return (0x00)
+ }
+
+ NBST [Arg0] = NDBS
+ Acquire (BTMX, 0xFFFF)
+ NGBT |= Local7
+ Release (BTMX)
+
+ /* fill battery information */
+ Acquire (ECMX, 0xFFFF)
+ BSEL = Arg0
+ Local0 = BFC
+ DerefOf (NBTI [Arg0]) [0x01] = Local0
+ DerefOf (NBTI [Arg0]) [0x02] = Local0
+ DerefOf (NBTI [Arg0]) [0x04] = BDV
+ DerefOf (NBTI [Arg0]) [0x05] = NLB1
+ DerefOf (NBTI [Arg0]) [0x06] = NLB2
+ Local0 = BSN
+ Local1 = BDAT
+ Release (ECMX)
+
+ /* serial number */
+ Local2 = GBSS (Local0, Local1)
+ DerefOf (NBTI [Arg0]) [0x0A] = Local2
+
+ Acquire (BTMX, 0xFFFF)
+ NGBF &= ~Local7
+ Release (BTMX)
+ Return (0x00)
+}
+
+Method (BTIF, 1, Serialized) /* in vendor DSDT is SB.BTIF */
+{
+ Local0 = BTIG (Arg0)
+ If ((Local0 == 0xFF))
+ {
+ Return (Package (0x0D)
+ {
+ 0x00,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0x01,
+ 0xFFFFFFFF,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ "",
+ "",
+ "",
+ 0x00
+ })
+ }
+ Else
+ {
+ Return (DerefOf (NBTI [Arg0]))
+ }
+}
+
+Name (NFBS, 0x01)
+Method (BTSZ, 1, Serialized) /* in vendor DSDT is EC.BTST */
+{
+ Local1 = NFBS
+ If (NFBS)
+ {
+ NFBS = 0x00
+ }
+ BTST (Arg0, Local1)
+ Return (DerefOf (NBST [Arg0]))
+}
+
+Method (BTST, 2, Serialized)
+{
+ Local7 = (0x01 << Arg0)
+ BTDR (0x01)
+ If ((BSTA (Local7) == 0x0F))
+ {
+ NBST [Arg0] = Package (0x04)
+ {
+ 0x00,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF
+ }
+ Return (0xFF)
+ }
+
+ Acquire (BTMX, 0xFFFF)
+ If (Arg1)
+ {
+ NGBT = 0xFF
+ }
+
+ Local0 = NGBT /* \_SB_.PCI0.LPCB.EC0_.NGBT */
+ Release (BTMX)
+ If (((Local0 & Local7) == 0x00))
+ {
+ Return (0x00)
+ }
+
+ Acquire (ECMX, 0xFFFF)
+ BSEL = Arg0
+ Local0 = BST
+ Local3 = BPR
+ DerefOf (NBST [Arg0]) [0x02] = BRC
+ DerefOf (NBST [Arg0]) [0x03] = BPV
+ Release (ECMX)
+
+ If ((GACS () == 0x01))
+ {
+ Local0 &= ~0x01
+ }
+ Else
+ {
+ Local0 &= ~0x02
+ }
+
+ If ((Local0 & 0x01))
+ {
+ Acquire (BTMX, 0xFFFF)
+ NDCB = Local7
+ Release (BTMX)
+ }
+
+ DerefOf (NBST [Arg0]) [0x00] = Local0
+ If ((Local0 & 0x01))
+ {
+ If (((Local3 < 0x0190) || (Local3 > 0x1964)))
+ {
+ Local5 = DerefOf (DerefOf (NBST [Arg0]) [0x01])
+ If (((Local5 < 0x0190) || (Local5 > 0x1964)))
+ {
+ Local3 = (0x1AF4 / 0x02)
+ }
+ Else
+ {
+ Local3 = Local5
+ }
+ }
+ }
+ ElseIf (((Local0 & 0x02) == 0x00))
+ {
+ Local3 = 0x00
+ }
+
+ DerefOf (NBST [Arg0]) [0x01] = Local3
+ Acquire (BTMX, 0xFFFF)
+ NGBT &= ~Local7
+ Release (BTMX)
+ Return (0x00)
+}
+
+Method (SBTN, 2, Serialized)
+{
+ If ((Arg0 & 0x01))
+ {
+ Notify (BAT0, Arg1)
+ }
+
+ If ((Arg0 & 0x02))
+ {
+ Notify (BAT1, Arg1)
+ }
+}
+
+Method (_Q03, 0, NotSerialized)
+{
+ Store ("EC: _Q03", Debug)
+ Acquire (BTMX, 0xFFFF)
+ Local0 = NDCB
+ Release (BTMX)
+ PWUP (0x04, Local0)
+ SBTN (Local0, 0x80)
+}
+
+Method (_Q08, 0, NotSerialized)
+{
+ Store ("EC: PRIMARY BATTERY ATTACHED/DETACHED", Debug)
+ PWUP (0x06, 0x01)
+ Local0 = GBAP ()
+ If ((Local0 != 0x02))
+ {
+ PWUP (0x04, 0x02)
+ If (BTDR (0x02))
+ {
+ Notify (BAT1, 0x80)
+ }
+ }
+
+ If (BTDR (0x02))
+ {
+ Notify (BAT0, 0x81)
+ }
+}
+
+Method (_Q09, 0, NotSerialized)
+{
+ Store ("EC: PRIMARY BATTERY STATUS", Debug)
+ PWUP (0x04, 0x01)
+ If (BTDR (0x02))
+ {
+ Notify (BAT0, 0x80)
+ }
+}
+
+Method (_Q18, 0, NotSerialized)
+{
+ Store("EC: SECONDARY BATTERY ATTACHED/DETACHED", Debug)
+ PWUP (0x06, 0x02)
+ Local0 = GBAP ()
+ If ((Local0 != 0x01))
+ {
+ PWUP (0x04, 0x01)
+ If (BTDR (0x02))
+ {
+ Notify (BAT0, 0x80)
+ }
+ }
+
+ If (BTDR (0x02))
+ {
+ Notify (BAT1, 0x81) // Information Change
+ }
+}
+
+Method (_Q19, 0, NotSerialized)
+{
+ Store ("EC: SECONDARY BATTERY STATUS", Debug)
+ PWUP (0x04, 0x02)
+ If (BTDR (0x02))
+ {
+ Notify (BAT1, 0x80)
+ }
+}
diff --git a/src/ec/hp/kbc1126/acpi/ec.asl b/src/ec/hp/kbc1126/acpi/ec.asl
new file mode 100644
index 0000000000..6e636ed3ff
--- /dev/null
+++ b/src/ec/hp/kbc1126/acpi/ec.asl
@@ -0,0 +1,241 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Iru Cai <mytbk920423@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+Device (EC0)
+{
+ Name (_HID, EISAID("PNP0C09"))
+ Name (_UID, 0)
+ Name (_GPE, 0x16)
+
+ Name (_CRS, ResourceTemplate ()
+ {
+ IO (Decode16, 0x62, 0x62, 1, 1)
+ IO (Decode16, 0x66, 0x66, 1, 1)
+ })
+
+ Method (_STA, 0, NotSerialized)
+ {
+ Return (0x0F)
+ }
+
+ OperationRegion (ECRM, EmbeddedControl, 0x00, 0xFF)
+ Field (ECRM, ByteAcc, NoLock, Preserve)
+ {
+ PMCD, 32,
+ S0FL, 8,
+ SXF0, 8,
+ SXF1, 8,
+ CPWR, 16,
+ CVLT, 16,
+ CCUR, 16,
+ DIDX, 8,
+ CIDX, 8,
+ PMCC, 8,
+ PMEP, 8,
+ Offset (0x22),
+ CRZN, 8,
+ THTA, 8,
+ HYST, 8,
+ CRIT, 8,
+ TEMP, 8,
+ TENA, 8,
+ Offset (0x29),
+ TOAD, 8,
+ PHTP, 8,
+ THEM, 8,
+ TMPO, 8,
+ Offset (0x2E),
+ FRDC, 8,
+ FTGC, 8,
+ PLTP, 8,
+ Offset (0x32),
+ DTMP, 8,
+ Offset (0x35),
+ PL1, 8,
+ PL2, 8,
+ BCVD, 8,
+ Offset (0x40),
+ ABDI, 8,
+ ABAD, 8,
+ ABIX, 8,
+ ABDA, 8,
+ ABST, 8,
+ PORI, 8,
+ Offset (0x4C),
+ PSSB, 8,
+ Offset (0x80),
+ Offset (0x81),
+ , 4,
+ SLPT, 4,
+ FNSW, 1,
+ SFNC, 1,
+ ACPI, 1,
+ , 1,
+ , 1,
+ , 1,
+ , 1,
+ DETF, 1,
+ LIDS, 1,
+ TBLT, 1,
+ , 1,
+ , 1,
+ , 1,
+ COMM, 1,
+ PME, 1,
+ SBVD, 1,
+
+ /* 0x84 to 0x9A is in battery.asl */
+
+ Offset (0x9B),
+ BATE, 16,
+ BPR, 16,
+ BCR, 16,
+ BRC, 16,
+ BCC, 16,
+ BPV, 16,
+ BCV2, 16,
+ BCV3, 16,
+ BCV4, 16,
+ BCW, 16,
+ BATF, 16,
+ BCL, 16,
+ MAXC, 16,
+ BCG1, 8,
+ BT1I, 1,
+ BT2I, 1,
+ , 2,
+ BATN, 4,
+ BSTS, 16,
+ BCG2, 8,
+ Offset (0xBD),
+ BMO, 8,
+ Offset (0xBF),
+ BRCV, 8,
+ Offset (0xC1),
+ BIF, 8,
+ BRCC, 8,
+
+ /* 0xC9 to 0xCD in battery.asl */
+
+ Offset (0xCF),
+ CTLB, 8,
+ Offset (0xD1),
+ BTY, 8,
+ Offset (0xD5),
+ MFAC, 8,
+ CFAN, 8,
+ PFAN, 8,
+ OCPS, 8,
+ OCPR, 8,
+ OCPE, 8,
+ TMP1, 8,
+ TMP2, 8,
+ NABT, 4,
+ BCM, 4,
+ CCBQ, 16,
+ CBT, 16,
+ Offset (0xE3),
+ OST, 4,
+ Offset (0xE4),
+ Offset (0xE5),
+ TPTE, 1,
+ TBBN, 1,
+ , 3,
+ TP, 1,
+ Offset (0xE6),
+ SHK, 8,
+ AUDS, 1,
+ SPKR, 1,
+ Offset (0xE8),
+ HSEN, 4,
+ HSST, 4,
+ Offset (0xEA),
+ , 2,
+ WWP, 1,
+ WLP, 1,
+ Offset (0xEF),
+ INCH, 2,
+ IDIS, 2,
+ INAC, 1
+ }
+
+ Method (ECRI, 0, Serialized)
+ {
+ OST = 0x7 /* FIXME: OS specific, in Linux is 7 */
+ PWUP (0x07, 0xFF)
+ Local0 = GBAP ()
+ ITLB ()
+ SBTN (Local0, 0x81)
+ }
+
+ Method (_REG, 2, NotSerialized)
+ {
+ ACPI = 1
+ ECRI ()
+ }
+
+ /* mailbox: port 0x200 and 0x201 */
+ OperationRegion (MAIO, SystemIO, 0x0200, 0x02)
+ Field (MAIO, ByteAcc, NoLock, Preserve)
+ {
+ MAIN, 8,
+ MADT, 8
+ }
+ IndexField (MAIN, MADT, ByteAcc, NoLock, Preserve)
+ {
+ Offset (0x8C),
+ , 7,
+ CLID, 1,
+ Offset (0x95),
+ PWM0, 8,
+ Offset (0x9D),
+ PWMC, 8
+ }
+
+ Mutex (ECMX, 0x00)
+
+#include "ac.asl"
+#include "battery.asl"
+#include "lid.asl"
+
+ /* The following are _Qxx methods in vendor DSDT whose function
+ is unknown. Just leave a debug message here. */
+
+ Method (_Q04, 0, NotSerialized)
+ {
+ Store ("EC: _Q04", Debug)
+ PNOT()
+ }
+
+ Method (_Q05, 0, NotSerialized)
+ {
+ Store ("EC: _Q05", Debug)
+ }
+
+ Method (_Q0B, 0, NotSerialized)
+ {
+ Store ("EC: _Q0B", Debug)
+ }
+
+ Method (_Q0C, 0, NotSerialized)
+ {
+ Store ("EC: _Q0C", Debug)
+ }
+
+ Method (_Q0D, 0, NotSerialized)
+ {
+ Store ("EC: _Q0D", Debug)
+ }
+}
diff --git a/src/ec/hp/kbc1126/acpi/lid.asl b/src/ec/hp/kbc1126/acpi/lid.asl
new file mode 100644
index 0000000000..c123c4c1f1
--- /dev/null
+++ b/src/ec/hp/kbc1126/acpi/lid.asl
@@ -0,0 +1,30 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Iru Cai <mytbk920423@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+Device (LID)
+{
+ Name (_HID, EisaId ("PNP0C0D"))
+ Method (_LID, 0, NotSerialized)
+ {
+ Local0 = CLID
+ Return (Local0)
+ }
+}
+
+Method (_Q0A, 0, NotSerialized)
+{
+ Store ("EC: LID STATUS", Debug)
+ Notify (LID, 0x80)
+}