aboutsummaryrefslogtreecommitdiff
path: root/src/superio/acpi/pnp_config.asl
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2013-05-23 18:13:23 +0200
committerStefan Reinauer <stefan.reinauer@coreboot.org>2013-06-11 00:13:31 +0200
commitae7c96889f3fb6aec5909bec7c7d77377ab59cc9 (patch)
tree5047dc84b2c4003f5b624b491f287f2fbb9f1d17 /src/superio/acpi/pnp_config.asl
parent1ef5ff277085512a2d24bef0b5f6f185a952b3b7 (diff)
Start ACPI framework for PnP (super i/o) devices
I'm trying to make writing ACPI code for super i/o devices more comfortable. pnp.asl hosts some general cpp macros. The other four files are to be included in dsdt trees. They are controlled by cpp macros which should be defined/undefined before inclusion. Work was inspired by Christoph Grenz' ACPI code for the W83627HF. Change-Id: Idb55332ba9bc788c98964d30a450e0d734cf28ec Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/3286 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/superio/acpi/pnp_config.asl')
-rw-r--r--src/superio/acpi/pnp_config.asl84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/superio/acpi/pnp_config.asl b/src/superio/acpi/pnp_config.asl
new file mode 100644
index 0000000000..79dca9f86a
--- /dev/null
+++ b/src/superio/acpi/pnp_config.asl
@@ -0,0 +1,84 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Christoph Grenz <christophg+cb@grenz-bonn.de>
+ * Copyright (C) 2013 secunet Security Networks AG
+ *
+ * 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
+ */
+
+/* ======== General PnP configuration functions ======= */
+
+/*
+ * Controlled by the following preprocessor defines:
+ * PNP_ENTER_MAGIC_1ST If defined, specifies the first magic byte
+ * used to enter config mode.
+ * PNP_ENTER_MAGIC_2ND If defined, specifies the second magic byte
+ * used to enter config mode.
+ * PNP_ENTER_MAGIC_3RD If defined, specifies the third magic byte
+ * used to enter config mode.
+ * PNP_EXIT_MAGIC_1ST If defined, specifies the first magic byte
+ * used to exit config mode.
+ */
+
+
+/*
+ * Mutex for accesses to the configuration ports (prolog and
+ * epilog commands are used, so synchronization is useful)
+ */
+Mutex(CONFIG_MODE_MUTEX, 1)
+
+/*
+ * Enter configuration mode (and aquire mutex)
+ * Method must be run before accesssing the configuration region.
+ * Parameter is the LDN which should be accessed. Values >= 0xFF mean
+ * no LDN switch should be done.
+ */
+Method (ENTER_CONFIG_MODE, 1)
+{
+ Acquire (CONFIG_MODE_MUTEX, 0xFFFF)
+#ifdef PNP_ENTER_MAGIC_1ST
+ Store (PNP_ENTER_MAGIC_1ST, PNP_ADDR_REG)
+#ifdef PNP_ENTER_MAGIC_2ND
+ Store (PNP_ENTER_MAGIC_2ND, PNP_ADDR_REG)
+#ifdef PNP_ENTER_MAGIC_3RD
+ Store (PNP_ENTER_MAGIC_3RD, PNP_ADDR_REG)
+#endif
+#endif
+#endif
+ If (LLess(Arg0, PNP_NO_LDN_CHANGE)) {
+ Store(Arg0, PNP_LOGICAL_DEVICE)
+ }
+}
+
+/*
+ * Exit configuration mode (i.e. release mutex)
+ * Method must be run after accessing the configuration region.
+ */
+Method (EXIT_CONFIG_MODE)
+{
+#ifdef PNP_EXIT_MAGIC_1ST
+ Store (PNP_EXIT_MAGIC_1ST, PNP_ADDR_REG)
+#endif
+ Release (CONFIG_MODE_MUTEX)
+}
+
+/*
+ * Just change the LDN. Make sure that you are in config mode (or
+ * have otherwise acquired CONFIG_MODE_MUTEX), when calling.
+ */
+Method (SWITCH_LDN, 1)
+{
+ Store(Arg0, PNP_LOGICAL_DEVICE)
+}