Patchwork [4/4,seabios] ec: add ASL for ACPI Embedded Controller

login
register
mail settings
Submitter liguang
Date May 22, 2013, 3:46 a.m.
Message ID <1369194397-608-5-git-send-email-lig.fnst@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/245499/
State New
Headers show

Comments

liguang - May 22, 2013, 3:46 a.m.
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 src/acpi-dsdt.dsl     |    1 +
 src/ec.dsl            |   51 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/q35-acpi-dsdt.dsl |    1 +
 3 files changed, 53 insertions(+), 0 deletions(-)
 create mode 100644 src/ec.dsl
liguang - May 23, 2013, 3:03 a.m.
Add seabios mail-list

在 2013-05-22三的 11:46 +0800,liguang写道:
> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
> ---
>  src/acpi-dsdt.dsl     |    1 +
>  src/ec.dsl            |   51 +++++++++++++++++++++++++++++++++++++++++++++++++
>  src/q35-acpi-dsdt.dsl |    1 +
>  3 files changed, 53 insertions(+), 0 deletions(-)
>  create mode 100644 src/ec.dsl
> 
> diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
> index 158f6b4..4fa2b9a 100644
> --- a/src/acpi-dsdt.dsl
> +++ b/src/acpi-dsdt.dsl
> @@ -112,6 +112,7 @@ DefinitionBlock (
>              }
>              Name(FDEN, 1)
>          }
> +#include "ec.dsl"
>      }
>  
>  #include "acpi-dsdt-isa.dsl"
> diff --git a/src/ec.dsl b/src/ec.dsl
> new file mode 100644
> index 0000000..c8be420
> --- /dev/null
> +++ b/src/ec.dsl
> @@ -0,0 +1,51 @@
> +/*
> + * 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
> +		})
> +		Return(BFFR)
> +	}
> +
> +	OperationRegion(ECFD, EmbeddedControl, 0, 0xFF)
> +	Field(ECFD, ByteAcc, Lock, Preserve)
> +	{	Offset(1),
> +		CPUS,   8,		// 1, CPU status
> +		CPUN,	8,		// 2, CPU index
> +	}
> +
> +	Name(_GPE, 17)
> +
> +	Method(_Q01)
> +	{
> +		If(LEqual(1, CPUS))
> +		{
> +			Store(0, CPUS)
> +		}
> +		Else
> +		{
> +			Store(1, CPUS)
> +		}
> +	}
> +}
> diff --git a/src/q35-acpi-dsdt.dsl b/src/q35-acpi-dsdt.dsl
> index c031d83..056b4f8 100644
> --- a/src/q35-acpi-dsdt.dsl
> +++ b/src/q35-acpi-dsdt.dsl
> @@ -167,6 +167,7 @@ DefinitionBlock (
>                  FDEN,   1
>              }
>          }
> +#include "ec.dsl"
>      }
>  
>  #include "acpi-dsdt-isa.dsl"

Patch

diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index 158f6b4..4fa2b9a 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -112,6 +112,7 @@  DefinitionBlock (
             }
             Name(FDEN, 1)
         }
+#include "ec.dsl"
     }
 
 #include "acpi-dsdt-isa.dsl"
diff --git a/src/ec.dsl b/src/ec.dsl
new file mode 100644
index 0000000..c8be420
--- /dev/null
+++ b/src/ec.dsl
@@ -0,0 +1,51 @@ 
+/*
+ * 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
+		})
+		Return(BFFR)
+	}
+
+	OperationRegion(ECFD, EmbeddedControl, 0, 0xFF)
+	Field(ECFD, ByteAcc, Lock, Preserve)
+	{	Offset(1),
+		CPUS,   8,		// 1, CPU status
+		CPUN,	8,		// 2, CPU index
+	}
+
+	Name(_GPE, 17)
+
+	Method(_Q01)
+	{
+		If(LEqual(1, CPUS))
+		{
+			Store(0, CPUS)
+		}
+		Else
+		{
+			Store(1, CPUS)
+		}
+	}
+}
diff --git a/src/q35-acpi-dsdt.dsl b/src/q35-acpi-dsdt.dsl
index c031d83..056b4f8 100644
--- a/src/q35-acpi-dsdt.dsl
+++ b/src/q35-acpi-dsdt.dsl
@@ -167,6 +167,7 @@  DefinitionBlock (
                 FDEN,   1
             }
         }
+#include "ec.dsl"
     }
 
 #include "acpi-dsdt-isa.dsl"