[coreboot-gerrit] Patch set updated for coreboot: arch/x86/acpigen_dsm: Add support for DSM types

Furquan Shaikh (furquan@google.com) gerrit at coreboot.org
Tue Oct 25 00:12:44 CEST 2016


Furquan Shaikh (furquan at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17091

-gerrit

commit 1f5b45cd9e7b44227859b202910d1efc333f5467
Author: Furquan Shaikh <furquan at chromium.org>
Date:   Fri Oct 21 16:40:17 2016 -0700

    arch/x86/acpigen_dsm: Add support for DSM types
    
    Currently, the only supported DSM type is I2C
    HID(3CDFF6F7-4267-4555-AD05-B30A3D8938DE). This provides the required
    callbacks for generating ACPI AML codes for different function
    identifiers for I2C HID.
    
    BUG=chrome-os-partner:57846
    
    Change-Id: Ia403e11f7ce4824956e3c879547ec927478db7b1
    Signed-off-by: Furquan Shaikh <furquan at chromium.org>
---
 src/arch/x86/Makefile.inc               |  1 +
 src/arch/x86/acpigen_dsm.c              | 65 +++++++++++++++++++++++++++++++++
 src/arch/x86/include/arch/acpigen_dsm.h | 27 ++++++++++++++
 3 files changed, 93 insertions(+)

diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 782ca63..c4bb1cc 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -313,6 +313,7 @@ ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32)$(CONFIG_ARCH_RAMSTAGE_X86_64),y)
 
 ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c
 ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpigen.c
+ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpigen_dsm.c
 ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi_device.c
 ramstage-$(CONFIG_HAVE_ACPI_RESUME) += acpi_s3.c
 ramstage-y += boot.c
diff --git a/src/arch/x86/acpigen_dsm.c b/src/arch/x86/acpigen_dsm.c
new file mode 100644
index 0000000..c6d614a
--- /dev/null
+++ b/src/arch/x86/acpigen_dsm.c
@@ -0,0 +1,65 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2016 Google Inc.
+ *
+ * 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.
+ */
+
+#include <arch/acpigen.h>
+#include <arch/acpigen_dsm.h>
+#include <stdlib.h>
+
+/* -------------------  I2C HID DSM ---------------------------- */
+
+#define ACPI_DSM_I2C_HID_UUID		"3CDFF6F7-4267-4555-AD05-B30A3D8938DE"
+
+static void i2c_hid_func0_cb(void *arg)
+{
+	/* ToInteger (Arg1, Local2) */
+	acpigen_write_to_integer(ARG1_OP, LOCAL2_OP);
+	/* If (LEqual (Local2, 0x0)) */
+	acpigen_write_if_lequal(LOCAL2_OP, 0x0);
+	/*   Return (Buffer (One) { 0x1f }) */
+	acpigen_write_return_singleton_buffer(0x1f);
+	acpigen_pop_len();	/* Pop : If */
+	/* Else */
+	acpigen_write_else();
+	/*   If (LEqual (Local2, 0x1)) */
+	acpigen_write_if_lequal(LOCAL2_OP, 0x1);
+	/*     Return (Buffer (One) { 0x3f }) */
+	acpigen_write_return_singleton_buffer(0x3f);
+	acpigen_pop_len();	/* Pop : If */
+	/*   Else */
+	acpigen_write_else();
+	/*     Return (Buffer (One) { 0x0 }) */
+	acpigen_write_return_singleton_buffer(0x0);
+	acpigen_pop_len();	/* Pop : Else */
+	acpigen_pop_len();	/* Pop : Else */
+}
+
+static void i2c_hid_func1_cb(void *arg)
+{
+	struct dsm_i2c_hid_config *config = arg;
+	acpigen_write_return_byte(config->hid_desc_reg_offset);
+}
+
+static void (*i2c_hid_callbacks[2])(void *) = {
+	i2c_hid_func0_cb,
+	i2c_hid_func1_cb,
+};
+
+void acpigen_write_dsm_i2c_hid(struct dsm_i2c_hid_config *config)
+{
+	acpigen_write_dsm(ACPI_DSM_I2C_HID_UUID, i2c_hid_callbacks,
+			  ARRAY_SIZE(i2c_hid_callbacks), config);
+}
+
+/* ------------------- End: I2C HID DSM ------------------------- */
diff --git a/src/arch/x86/include/arch/acpigen_dsm.h b/src/arch/x86/include/arch/acpigen_dsm.h
new file mode 100644
index 0000000..2d8bb48
--- /dev/null
+++ b/src/arch/x86/include/arch/acpigen_dsm.h
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2016 Google Inc.
+ *
+ * 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.
+ */
+
+#ifndef __ARCH_ACPIGEN_DSM_H__
+#define __ARCH_ACPIGEN_DSM_H__
+
+#include <stdint.h>
+
+struct dsm_i2c_hid_config {
+	uint8_t hid_desc_reg_offset;
+};
+
+void acpigen_write_dsm_i2c_hid(struct dsm_i2c_hid_config *config);
+
+#endif /* __ARCH_ACPIGEN_DSM_H__ */



More information about the coreboot-gerrit mailing list