[RFC,SeaBIOS,1/2] acpi: add ASL for Embedded Controller

Submitted by liguang on April 17, 2013, 7:22 a.m.

Details

Message ID 1366183380-24333-1-git-send-email-lig.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

liguang April 17, 2013, 7:22 a.m.
defined at ACPI SPEC v5 chapter 12:
"ACPI Embedded Controller Interface Specification"

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 src/acpi-dsdt-ec.dsl |  106 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 106 insertions(+), 0 deletions(-)
 create mode 100644 src/acpi-dsdt-ec.dsl

Comments

Marc Jones April 17, 2013, 1:46 p.m.
What EC is this for? The device and interface is defined by the spec, but
the offsets and methods are custom for every EC.


Marc


On Wed, Apr 17, 2013 at 1:22 AM, liguang <lig.fnst@cn.fujitsu.com> wrote:

> defined at ACPI SPEC v5 chapter 12:
> "ACPI Embedded Controller Interface Specification"
>
> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
> ---
>  src/acpi-dsdt-ec.dsl |  106
> ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 106 insertions(+), 0 deletions(-)
>  create mode 100644 src/acpi-dsdt-ec.dsl
>
> diff --git a/src/acpi-dsdt-ec.dsl b/src/acpi-dsdt-ec.dsl
> new file mode 100644
> index 0000000..6bd8edd
> --- /dev/null
> +++ b/src/acpi-dsdt-ec.dsl
> @@ -0,0 +1,106 @@
> +/*
> + * 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.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
> USA
> + */
> +
> +
> +Device (EC0)
> +{
> +       Name (_HID, EISAID ("PNP0C09"))
> +       Name(_UID, 1)
> +
> +       Method(_CRS, 0)
> +       {
> +       Name(BFFR, ResourceTemplate()
> +       {
> +               IO(Decode16, 0x62, 0x62, 0, 1)      // ACPI DATA IN/OUT
> +               IO(Decode16, 0x66, 0x66, 0, 1)      // CMD/STS
> +               IRQ(Edge, ActiveHigh, Exclusive) {0x0B}
> +       })
> +    Return(BFFR)
> +       }
> +
> +       OperationRegion(ECF0, EmbeddedControl, 0, 0xFF)
> +    Field(ECF2, ByteAcc, Lock, Preserve)
> +       {
> +               Offset(1),
> +               STMP,   8,      // 1,      Sensor Temperature
> +               ACPW,   8,      // 2,      AC Power (AC Present = 1, else
> 0)
> +               LIDS,   8,      // 3,      Lid State (Lid Open = 1, else 0)
> +               PBNS,   8,      // 4,      Power Button State (Pressed =
> 1, else 0)
> +               BTST,   8,      // 5,      Battery Status
> +               BTCR,   8,      // 6,      Battery Current Rate
> +               BTCC,   8,      // 7,      Battery Current Capacity
> +               BTVT,   8,      // 8,      Battery Voltage
> +               offset(0x10),
> +               SPTR,   8,      // 5,      SMBus Protocol Register
> +               SSTS,   8,      // 5,      SMBus Status Register
> +               SADR,   8,      // 6,      SMBus Address Register
> +               SCMD,   8,      // 7,      SMBus Command Register
> +               SBFR,   256,    // 8,      SMBus Block Buffer
> +               SCNT,   8,      // 40,     SMBus Block Count
> +       }
> +
> +       Method(_REG, 2)
> +       {
> +       }
> +
> +       /* AC status: present */
> +       Method(_Q01, 0, NotSerialized)
> +       {
> +               Notify (AC, 0x80)
> +       }
> +
> +       /* AC status: dispear*/
> +       Method(_Q02, 0, NotSerialized)
> +       {
> +               Notify (AC, 0x80)
> +       }
> +
> +    Method(_Q04, 0, NotSerialized)
> +    {
> +       Notify(LID, 0x80)
> +    }
> +
> +    Method(_Q04, 0, NotSerialized)
> +    {
> +       Notify(LID, 0x80)
> +    }
> +
> +       Device(AC)
> +       {
> +               Name(_HID, "ACPI0003")
> +               Name(_UID, 0x00)
> +               Name(_PCL, Package() { \_SB } )
> +
> +               Method(_PSR, 0, NotSerialized)
> +               {
> +                       return (ACPW)
> +               }
> +
> +               Method(_STA, 0, NotSerialized)
> +               {
> +                       Return (0x0f)
> +               }
> +       }
> +
> +       Device(LID)
> +       {
> +               Name(_HID, "PNP0C0D")
> +
> +               Method(_LID, 0, NotSerialized)
> +               {
> +                       return (LIDS)
> +               }
> +       }
> +}
> --
> 1.7.2.5
>
>
> _______________________________________________
> SeaBIOS mailing list
> SeaBIOS@seabios.org
> http://www.seabios.org/mailman/listinfo/seabios
>
liguang April 18, 2013, 1:25 a.m.
在 2013-04-17三的 07:46 -0600,Marc Jones写道:
> What EC is this for? The device and interface is defined by the spec,
> but the offsets and methods are custom for every EC.
> 
> 

you're mostly right,
the specific content ACPI space will vary 
for different boards, this one just for
a common case

> 
> 
> Marc
> 
> 
> On Wed, Apr 17, 2013 at 1:22 AM, liguang <lig.fnst@cn.fujitsu.com>
> wrote:
>         defined at ACPI SPEC v5 chapter 12:
>         "ACPI Embedded Controller Interface Specification"
>         
>         Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
>         ---
>          src/acpi-dsdt-ec.dsl |  106
>         ++++++++++++++++++++++++++++++++++++++++++++++++++
>          1 files changed, 106 insertions(+), 0 deletions(-)
>          create mode 100644 src/acpi-dsdt-ec.dsl
>         
>         diff --git a/src/acpi-dsdt-ec.dsl b/src/acpi-dsdt-ec.dsl
>         new file mode 100644
>         index 0000000..6bd8edd
>         --- /dev/null
>         +++ b/src/acpi-dsdt-ec.dsl
>         @@ -0,0 +1,106 @@
>         +/*
>         + * 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.
>         + *
>         + * You should have received a copy of the GNU General Public
>         License
>         + * along with this program; if not, write to the Free
>         Software
>         + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
>         02110-1301 USA
>         + */
>         +
>         +
>         +Device (EC0)
>         +{
>         +       Name (_HID, EISAID ("PNP0C09"))
>         +       Name(_UID, 1)
>         +
>         +       Method(_CRS, 0)
>         +       {
>         +       Name(BFFR, ResourceTemplate()
>         +       {
>         +               IO(Decode16, 0x62, 0x62, 0, 1)      // ACPI
>         DATA IN/OUT
>         +               IO(Decode16, 0x66, 0x66, 0, 1)      // CMD/STS
>         +               IRQ(Edge, ActiveHigh, Exclusive) {0x0B}
>         +       })
>         +    Return(BFFR)
>         +       }
>         +
>         +       OperationRegion(ECF0, EmbeddedControl, 0, 0xFF)
>         +    Field(ECF2, ByteAcc, Lock, Preserve)
>         +       {
>         +               Offset(1),
>         +               STMP,   8,      // 1,      Sensor Temperature
>         +               ACPW,   8,      // 2,      AC Power (AC
>         Present = 1, else 0)
>         +               LIDS,   8,      // 3,      Lid State (Lid Open
>         = 1, else 0)
>         +               PBNS,   8,      // 4,      Power Button State
>         (Pressed = 1, else 0)
>         +               BTST,   8,      // 5,      Battery Status
>         +               BTCR,   8,      // 6,      Battery Current
>         Rate
>         +               BTCC,   8,      // 7,      Battery Current
>         Capacity
>         +               BTVT,   8,      // 8,      Battery Voltage
>         +               offset(0x10),
>         +               SPTR,   8,      // 5,      SMBus Protocol
>         Register
>         +               SSTS,   8,      // 5,      SMBus Status
>         Register
>         +               SADR,   8,      // 6,      SMBus Address
>         Register
>         +               SCMD,   8,      // 7,      SMBus Command
>         Register
>         +               SBFR,   256,    // 8,      SMBus Block Buffer
>         +               SCNT,   8,      // 40,     SMBus Block Count
>         +       }
>         +
>         +       Method(_REG, 2)
>         +       {
>         +       }
>         +
>         +       /* AC status: present */
>         +       Method(_Q01, 0, NotSerialized)
>         +       {
>         +               Notify (AC, 0x80)
>         +       }
>         +
>         +       /* AC status: dispear*/
>         +       Method(_Q02, 0, NotSerialized)
>         +       {
>         +               Notify (AC, 0x80)
>         +       }
>         +
>         +    Method(_Q04, 0, NotSerialized)
>         +    {
>         +       Notify(LID, 0x80)
>         +    }
>         +
>         +    Method(_Q04, 0, NotSerialized)
>         +    {
>         +       Notify(LID, 0x80)
>         +    }
>         +
>         +       Device(AC)
>         +       {
>         +               Name(_HID, "ACPI0003")
>         +               Name(_UID, 0x00)
>         +               Name(_PCL, Package() { \_SB } )
>         +
>         +               Method(_PSR, 0, NotSerialized)
>         +               {
>         +                       return (ACPW)
>         +               }
>         +
>         +               Method(_STA, 0, NotSerialized)
>         +               {
>         +                       Return (0x0f)
>         +               }
>         +       }
>         +
>         +       Device(LID)
>         +       {
>         +               Name(_HID, "PNP0C0D")
>         +
>         +               Method(_LID, 0, NotSerialized)
>         +               {
>         +                       return (LIDS)
>         +               }
>         +       }
>         +}
>         --
>         1.7.2.5
>         
>         
>         _______________________________________________
>         SeaBIOS mailing list
>         SeaBIOS@seabios.org
>         http://www.seabios.org/mailman/listinfo/seabios
> 
> 
> 
> 
> -- 
> http://se-eng.com

Patch hide | download patch | download mbox

diff --git a/src/acpi-dsdt-ec.dsl b/src/acpi-dsdt-ec.dsl
new file mode 100644
index 0000000..6bd8edd
--- /dev/null
+++ b/src/acpi-dsdt-ec.dsl
@@ -0,0 +1,106 @@ 
+/*
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+Device (EC0)
+{
+	Name (_HID, EISAID ("PNP0C09"))
+	Name(_UID, 1)
+	
+	Method(_CRS, 0)
+  	{
+    	Name(BFFR, ResourceTemplate()
+    	{
+      		IO(Decode16, 0x62, 0x62, 0, 1)      // ACPI DATA IN/OUT
+      		IO(Decode16, 0x66, 0x66, 0, 1)      // CMD/STS
+      		IRQ(Edge, ActiveHigh, Exclusive) {0x0B}
+    	})
+    Return(BFFR)
+  	}
+  	
+  	OperationRegion(ECF0, EmbeddedControl, 0, 0xFF)
+    Field(ECF2, ByteAcc, Lock, Preserve)
+  	{
+		Offset(1),
+		STMP,   8,      // 1,      Sensor Temperature
+		ACPW,   8,      // 2,      AC Power (AC Present = 1, else 0)
+		LIDS,   8,      // 3,      Lid State (Lid Open = 1, else 0)
+		PBNS,   8,      // 4,      Power Button State (Pressed = 1, else 0)
+		BTST,   8,      // 5,      Battery Status
+		BTCR,   8,      // 6,      Battery Current Rate
+		BTCC,   8,      // 7,      Battery Current Capacity
+		BTVT,   8,      // 8,      Battery Voltage
+		offset(0x10),
+		SPTR,   8,      // 5,      SMBus Protocol Register
+		SSTS,   8,      // 5,      SMBus Status Register
+		SADR,   8,      // 6,      SMBus Address Register
+		SCMD,   8,      // 7,      SMBus Command Register
+		SBFR,   256,    // 8,      SMBus Block Buffer
+		SCNT,   8,      // 40,     SMBus Block Count
+  	}
+  	
+	Method(_REG, 2)
+	{
+	}
+	
+	/* AC status: present */
+	Method(_Q01, 0, NotSerialized)
+	{
+		Notify (AC, 0x80)
+	}
+
+	/* AC status: dispear*/
+	Method(_Q02, 0, NotSerialized)
+	{
+		Notify (AC, 0x80)
+	}
+
+    Method(_Q04, 0, NotSerialized)
+    {
+       Notify(LID, 0x80)
+    }
+	
+    Method(_Q04, 0, NotSerialized)
+    {
+       Notify(LID, 0x80)
+    }	
+	
+	Device(AC)
+	{
+		Name(_HID, "ACPI0003")
+		Name(_UID, 0x00)
+		Name(_PCL, Package() { \_SB } )
+
+		Method(_PSR, 0, NotSerialized)
+		{
+			return (ACPW)
+		}
+
+		Method(_STA, 0, NotSerialized)
+		{
+			Return (0x0f)
+		}
+	}
+	
+	Device(LID)
+	{
+		Name(_HID, "PNP0C0D")
+
+		Method(_LID, 0, NotSerialized)
+		{
+			return (LIDS)
+		}
+	}
+}