Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14468
-gerrit
commit 69ebf1f28efb439ee84cc5c216e81a733f92fbc1
Author: Divya Sasidharan <divya.s.sasidharan(a)intel.com>
Date: Mon Feb 8 09:45:37 2016 -0800
mainboard/amenia: Enable Chrome EC Interface/Keyboard
Enabled LPC channel between host and EC.
Superio.asl will enable proper probing of onboard keyboard.
Change-Id: I57014fc90b345661853280ae3402f86e56af5fb9
Signed-off-by: Divya Sasidharan <divya.s.sasidharan(a)intel.com>
Signed-off-by: Freddy Paul <freddy.paul(a)intel.com>
---
src/mainboard/intel/amenia/Kconfig | 3 ++
src/mainboard/intel/amenia/Makefile.inc | 1 +
src/mainboard/intel/amenia/acpi/superio.asl | 25 ++++++++++++
src/mainboard/intel/amenia/devicetree.cb | 4 ++
src/mainboard/intel/amenia/dsdt.asl | 3 ++
src/mainboard/intel/amenia/ec.c | 52 ++++++++++++++++++++++++
src/mainboard/intel/amenia/ec.h | 62 +++++++++++++++++++++++++++++
src/mainboard/intel/amenia/mainboard.c | 2 +
8 files changed, 152 insertions(+)
diff --git a/src/mainboard/intel/amenia/Kconfig b/src/mainboard/intel/amenia/Kconfig
index f1946b5..be98b86 100644
--- a/src/mainboard/intel/amenia/Kconfig
+++ b/src/mainboard/intel/amenia/Kconfig
@@ -5,6 +5,9 @@ config BOARD_SPECIFIC_OPTIONS
select SOC_INTEL_APOLLOLAKE
select BOARD_ROMSIZE_KB_8192
select MAINBOARD_HAS_CHROMEOS
+ select EC_GOOGLE_CHROMEEC
+ select EC_GOOGLE_CHROMEEC_LPC
+ select EC_GOOGLE_CHROMEEC_PD
select HAVE_ACPI_TABLES
select MAINBOARD_HAS_LPC_TPM
select HAVE_ACPI_RESUME
diff --git a/src/mainboard/intel/amenia/Makefile.inc b/src/mainboard/intel/amenia/Makefile.inc
index 472a5aa..363c21e 100644
--- a/src/mainboard/intel/amenia/Makefile.inc
+++ b/src/mainboard/intel/amenia/Makefile.inc
@@ -3,5 +3,6 @@ bootblock-$(CONFIG_LPC_TPM) += bootblock.c
romstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-y += mainboard.c
+ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-$(CONFIG_CHROMEOS) += chromeos_ramstage.c
diff --git a/src/mainboard/intel/amenia/acpi/superio.asl b/src/mainboard/intel/amenia/acpi/superio.asl
new file mode 100644
index 0000000..db14d17
--- /dev/null
+++ b/src/mainboard/intel/amenia/acpi/superio.asl
@@ -0,0 +1,25 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015-2016 Intel Corp.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+
+/* mainboard configuration */
+#include "../ec.h"
+
+#define SIO_EC_MEMMAP_ENABLE // EC Memory Map Resources
+#define SIO_EC_HOST_ENABLE // EC Host Interface Resources
+#define SIO_EC_ENABLE_PS2K // Enable PS/2 Keyboard
+
+/* ACPI code for EC SuperIO functions */
+#include <ec/google/chromeec/acpi/superio.asl>
diff --git a/src/mainboard/intel/amenia/devicetree.cb b/src/mainboard/intel/amenia/devicetree.cb
index c54e838..65fa8b7 100644
--- a/src/mainboard/intel/amenia/devicetree.cb
+++ b/src/mainboard/intel/amenia/devicetree.cb
@@ -7,6 +7,10 @@ chip soc/intel/apollolake
register "pcie_rp0_clkreq_pin" = "3" # wifi/bt
register "pcie_rp2_clkreq_pin" = "0" # SSD
+ # EC host command range is in 0x800-0x9ff
+ register "gen1_dec" = "0x00fc0801"
+ register "gen2_dec" = "0x00fc0901"
+
device domain 0 on
device pci 00.0 on end # - Host Bridge
device pci 00.1 on end # - DPTF
diff --git a/src/mainboard/intel/amenia/dsdt.asl b/src/mainboard/intel/amenia/dsdt.asl
index ba4e722..19e7360 100644
--- a/src/mainboard/intel/amenia/dsdt.asl
+++ b/src/mainboard/intel/amenia/dsdt.asl
@@ -36,4 +36,7 @@ DefinitionBlock(
/* Chipset specific sleep states */
#include <soc/intel/apollolake/acpi/sleepstates.asl>
+
+ #include "acpi/superio.asl"
+
}
diff --git a/src/mainboard/intel/amenia/ec.c b/src/mainboard/intel/amenia/ec.c
new file mode 100644
index 0000000..7055936
--- /dev/null
+++ b/src/mainboard/intel/amenia/ec.c
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015-2016 Intel Corp.
+ * Copyright (C) 2015 Google Inc.
+ * (Written by Andrey Petrov <andrey.petrov(a)intel.com> for Intel Corp.)
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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/acpi.h>
+#include <console/console.h>
+#include <ec/google/chromeec/ec.h>
+#include "ec.h"
+
+void mainboard_ec_init(void)
+{
+ printk(BIOS_ERR, "mainboard: EC init\n");
+ post_code(0xf0);
+
+ if (acpi_is_wakeup_s3()) {
+ google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
+ MAINBOARD_EC_S3_WAKE_EVENTS);
+
+ /* Disable SMI and wake events */
+ google_chromeec_set_smi_mask(0);
+
+ /* Clear pending events */
+ while (google_chromeec_get_event() != 0)
+ ;
+
+ /* Restore SCI event mask */
+ google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS);
+ } else {
+ google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
+ MAINBOARD_EC_S5_WAKE_EVENTS);
+ }
+
+ /* Clear wake event mask */
+ google_chromeec_set_wake_mask(0);
+ post_code(0xf1);
+}
diff --git a/src/mainboard/intel/amenia/ec.h b/src/mainboard/intel/amenia/ec.h
new file mode 100644
index 0000000..ab8bcba
--- /dev/null
+++ b/src/mainboard/intel/amenia/ec.h
@@ -0,0 +1,62 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015-2016 Intel Corp.
+ * Copyright (C) 2015 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 MAINBOARD_EC_H
+#define MAINBOARD_EC_H
+
+#include <ec/google/chromeec/ec_commands.h>
+
+#define MAINBOARD_EC_SCI_EVENTS \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_LOW) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_CRITICAL) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_STATUS) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_THRESHOLD) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_OVERLOAD) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_START) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_STOP) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_CHARGER) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_PD_MCU))
+
+#define MAINBOARD_EC_SMI_EVENTS \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED))
+
+/* EC can wake from S5 with lid or power button */
+#define MAINBOARD_EC_S5_WAKE_EVENTS \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))
+
+/* EC can wake from S3 with lid or power button or key press */
+#define MAINBOARD_EC_S3_WAKE_EVENTS \
+ (MAINBOARD_EC_S5_WAKE_EVENTS |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED))
+
+/* Log EC wake events plus EC shutdown events */
+#define MAINBOARD_EC_LOG_EVENTS \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_SHUTDOWN) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_SHUTDOWN)|\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_PANIC))
+
+#ifndef __ACPI__
+extern void mainboard_ec_init(void);
+#endif
+
+#endif
diff --git a/src/mainboard/intel/amenia/mainboard.c b/src/mainboard/intel/amenia/mainboard.c
index 59b4877..f95227f 100644
--- a/src/mainboard/intel/amenia/mainboard.c
+++ b/src/mainboard/intel/amenia/mainboard.c
@@ -21,6 +21,7 @@
#include <soc/lpc.h>
#include <soc/intel/apollolake/chip.h>
#include <soc/pci_devs.h>
+#include "ec.h"
/* TODO: Move GPIO config to its own file once we get more GPIOs in the list */
static const struct pad_config amenia_gpios[] = {
@@ -158,6 +159,7 @@ static void mainboard_init(void *chip_info)
{
gpio_configure_pads(amenia_gpios, ARRAY_SIZE(amenia_gpios));
lpc_decode_enable(chip_info);
+ mainboard_ec_init();
}
struct chip_operations mainboard_ops = {
Timothy Pearson (tpearson(a)raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14457
-gerrit
commit 5b0c08321c350c7bfdbdd0431e264f2264cc2931
Author: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
Date: Thu Apr 21 17:06:37 2016 -0500
board_status/to-wiki: Indicate age of test results by background color
A major issue with the board-status Wiki page is that it shows all
test results equally regardless of age. As a test result ages it
becomes more likely that the board no longer works peroperly under
coreboot due to code churn.
Visually indicate board-test status "at a glance" by smoothly fading
the background color of the test result from green to yellow to red
as the test result ages. This patch sets the full red transition
to 256 days after test for programming convenience, however the
number of days required to fully "stale" a test result could be
modified relatively easily.
Change-Id: I5a076a6cc17d53fda8e4681e38074fc1f46c0e12
Signed-off-by: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
---
util/board_status/to-wiki/towiki.sh | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/util/board_status/to-wiki/towiki.sh b/util/board_status/to-wiki/towiki.sh
index 9cf8a3c..f65d9a2 100755
--- a/util/board_status/to-wiki/towiki.sh
+++ b/util/board_status/to-wiki/towiki.sh
@@ -412,7 +412,25 @@ EOF
if [ -z "$lastgood" ]; then
echo "| style=\"background:red\" | Unknown"
else
- echo "| style=\"background:lime\" | [[#$vendor/$board|$lastgood]]"
+ lastgood_diff=0
+ lastgood_ts=$(date -d "$lastgood" "+%s")
+ if [ "$lastgood_ts" != "" ]; then
+ current_ts=$(date "+%s")
+ if [ "$lastgood_ts" -lt "$current_ts" ]; then
+ lastgood_diff=$(( current_ts - lastgood_ts ))
+ # Convert seconds to days
+ lastgood_diff=$(( lastgood_diff / 86400 ))
+ # Set maximum age at 255 days for convenience of code
+ if [ $lastgood_diff -gt 255 ]; then
+ lastgood_diff=255
+ fi
+ fi
+ fi
+ lastgood_diff_hex=$(echo "obase=16; $lastgood_diff" | bc)
+ green_component=$(( 255 - lastgood_diff ))
+ green_component_hex=$(echo "obase=16; $green_component" | bc)
+ cell_bgcolor="#${lastgood_diff_hex}${green_component_hex}00"
+ echo "| style=\"background:${cell_bgcolor}\" | [[#$vendor/$board|$lastgood]]"
fi
echo "| $northbridge_nice"
Timothy Pearson (tpearson(a)raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14457
-gerrit
commit 5b890b497b12694301fe2ab9db87fb2a73c425e3
Author: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
Date: Thu Apr 21 17:06:37 2016 -0500
board_status/to-wiki: Indicate age of test results by background color
A major issue with the board-status Wiki page is that it shows all
test results equally regardless of age. As a test result ages it
becomes more likely that the board no longer works peroperly under
coreboot due to code churn.
Visually indicate board-test status "at a glance" by smoothly fading
the background color of the test result from green to yellow to red
as the test result ages. This patch sets the full red transition
to 256 days after test for programming convenience, however the
number of days required to fully "stale" a test result could be
modified relatively easily.
Change-Id: I5a076a6cc17d53fda8e4681e38074fc1f46c0e12
Signed-off-by: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
---
util/board_status/to-wiki/towiki.sh | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/util/board_status/to-wiki/towiki.sh b/util/board_status/to-wiki/towiki.sh
index 9cf8a3c..74792c2 100755
--- a/util/board_status/to-wiki/towiki.sh
+++ b/util/board_status/to-wiki/towiki.sh
@@ -412,7 +412,23 @@ EOF
if [ -z "$lastgood" ]; then
echo "| style=\"background:red\" | Unknown"
else
- echo "| style=\"background:lime\" | [[#$vendor/$board|$lastgood]]"
+ lastgood_ts=$(date -d "$lastgood" "+%s")
+ current_ts=$(date "+%s")
+ lastgood_diff=0
+ if [ "$lastgood_ts" -lt "$current_ts" ]; then
+ lastgood_diff=$(( current_ts - lastgood_ts ))
+ # Convert seconds to days
+ lastgood_diff=$(( lastgood_diff / 86400 ))
+ # Set maximum age at 255 days for convenience of code
+ if [ $lastgood_diff -gt 255 ]; then
+ lastgood_diff=255
+ fi
+ fi
+ lastgood_diff_hex=$(echo "obase=16; $lastgood_diff" | bc)
+ green_component=$(( 255 - lastgood_diff ))
+ green_component_hex=$(echo "obase=16; $green_component" | bc)
+ cell_bgcolor="#${lastgood_diff_hex}${green_component_hex}00"
+ echo "| style=\"background:${cell_bgcolor}\" | [[#$vendor/$board|$lastgood]]"
fi
echo "| $northbridge_nice"
the following patch was just integrated into master:
commit 019dbd31be6813b60ce6ad440ef97691f73787a7
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Wed Apr 6 10:02:41 2016 -0700
soc/intel/quark: Fix MTRR reads
Remove offset override improperly added in the "Disable the ROM shadow"
patch
TEST=Build and run on Galileo Gen2
Change-Id: I32fb2da48e3769d59a49619539053f9afdf63b04
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
Reviewed-on: https://review.coreboot.org/14450
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth(a)google.com>
See https://review.coreboot.org/14450 for details.
-gerrit
the following patch was just integrated into master:
commit 50a8c8c95d0f7627dcdb73d3aea6c2abfdb65316
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Tue Apr 12 13:37:02 2016 -0700
soc/intel/quark: Fix uninitialized variable d_variant
Initialize the d_variant variable.
Found-by: CID 1353356 Uninitialized variable
TEST=Build and run on Galileo Gen2
Change-Id: I26fba4e77f91d53b6ff9028669aa0186d3174639
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
Reviewed-on: https://review.coreboot.org/14338
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth(a)google.com>
See https://review.coreboot.org/14338 for details.
-gerrit
Andrey Petrov (andrey.petrov(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14468
-gerrit
commit 3a179cfab9d868f3a58a0758e672f95e9fd1af5b
Author: Divya Sasidharan <divya.s.sasidharan(a)intel.com>
Date: Mon Feb 8 09:45:37 2016 -0800
mainboard/amenia: Enable Chrome EC Interface/Keyboard
Enabled LPC channel between host and EC.
Superio.asl will enable proper probing of onboard keyboard.
Change-Id: I57014fc90b345661853280ae3402f86e56af5fb9
Signed-off-by: Divya Sasidharan <divya.s.sasidharan(a)intel.com>
Signed-off-by: Freddy Paul <freddy.paul(a)intel.com>
---
src/mainboard/intel/amenia/Kconfig | 3 ++
src/mainboard/intel/amenia/Makefile.inc | 1 +
src/mainboard/intel/amenia/acpi/superio.asl | 25 ++++++++++++
src/mainboard/intel/amenia/devicetree.cb | 4 ++
src/mainboard/intel/amenia/dsdt.asl | 3 ++
src/mainboard/intel/amenia/ec.c | 52 ++++++++++++++++++++++++
src/mainboard/intel/amenia/ec.h | 62 +++++++++++++++++++++++++++++
src/mainboard/intel/amenia/mainboard.c | 1 +
8 files changed, 151 insertions(+)
diff --git a/src/mainboard/intel/amenia/Kconfig b/src/mainboard/intel/amenia/Kconfig
index f1946b5..be98b86 100644
--- a/src/mainboard/intel/amenia/Kconfig
+++ b/src/mainboard/intel/amenia/Kconfig
@@ -5,6 +5,9 @@ config BOARD_SPECIFIC_OPTIONS
select SOC_INTEL_APOLLOLAKE
select BOARD_ROMSIZE_KB_8192
select MAINBOARD_HAS_CHROMEOS
+ select EC_GOOGLE_CHROMEEC
+ select EC_GOOGLE_CHROMEEC_LPC
+ select EC_GOOGLE_CHROMEEC_PD
select HAVE_ACPI_TABLES
select MAINBOARD_HAS_LPC_TPM
select HAVE_ACPI_RESUME
diff --git a/src/mainboard/intel/amenia/Makefile.inc b/src/mainboard/intel/amenia/Makefile.inc
index 472a5aa..363c21e 100644
--- a/src/mainboard/intel/amenia/Makefile.inc
+++ b/src/mainboard/intel/amenia/Makefile.inc
@@ -3,5 +3,6 @@ bootblock-$(CONFIG_LPC_TPM) += bootblock.c
romstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-y += mainboard.c
+ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-$(CONFIG_CHROMEOS) += chromeos_ramstage.c
diff --git a/src/mainboard/intel/amenia/acpi/superio.asl b/src/mainboard/intel/amenia/acpi/superio.asl
new file mode 100644
index 0000000..db14d17
--- /dev/null
+++ b/src/mainboard/intel/amenia/acpi/superio.asl
@@ -0,0 +1,25 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015-2016 Intel Corp.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+
+/* mainboard configuration */
+#include "../ec.h"
+
+#define SIO_EC_MEMMAP_ENABLE // EC Memory Map Resources
+#define SIO_EC_HOST_ENABLE // EC Host Interface Resources
+#define SIO_EC_ENABLE_PS2K // Enable PS/2 Keyboard
+
+/* ACPI code for EC SuperIO functions */
+#include <ec/google/chromeec/acpi/superio.asl>
diff --git a/src/mainboard/intel/amenia/devicetree.cb b/src/mainboard/intel/amenia/devicetree.cb
index c54e838..65fa8b7 100644
--- a/src/mainboard/intel/amenia/devicetree.cb
+++ b/src/mainboard/intel/amenia/devicetree.cb
@@ -7,6 +7,10 @@ chip soc/intel/apollolake
register "pcie_rp0_clkreq_pin" = "3" # wifi/bt
register "pcie_rp2_clkreq_pin" = "0" # SSD
+ # EC host command range is in 0x800-0x9ff
+ register "gen1_dec" = "0x00fc0801"
+ register "gen2_dec" = "0x00fc0901"
+
device domain 0 on
device pci 00.0 on end # - Host Bridge
device pci 00.1 on end # - DPTF
diff --git a/src/mainboard/intel/amenia/dsdt.asl b/src/mainboard/intel/amenia/dsdt.asl
index ba4e722..19e7360 100644
--- a/src/mainboard/intel/amenia/dsdt.asl
+++ b/src/mainboard/intel/amenia/dsdt.asl
@@ -36,4 +36,7 @@ DefinitionBlock(
/* Chipset specific sleep states */
#include <soc/intel/apollolake/acpi/sleepstates.asl>
+
+ #include "acpi/superio.asl"
+
}
diff --git a/src/mainboard/intel/amenia/ec.c b/src/mainboard/intel/amenia/ec.c
new file mode 100644
index 0000000..7055936
--- /dev/null
+++ b/src/mainboard/intel/amenia/ec.c
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015-2016 Intel Corp.
+ * Copyright (C) 2015 Google Inc.
+ * (Written by Andrey Petrov <andrey.petrov(a)intel.com> for Intel Corp.)
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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/acpi.h>
+#include <console/console.h>
+#include <ec/google/chromeec/ec.h>
+#include "ec.h"
+
+void mainboard_ec_init(void)
+{
+ printk(BIOS_ERR, "mainboard: EC init\n");
+ post_code(0xf0);
+
+ if (acpi_is_wakeup_s3()) {
+ google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
+ MAINBOARD_EC_S3_WAKE_EVENTS);
+
+ /* Disable SMI and wake events */
+ google_chromeec_set_smi_mask(0);
+
+ /* Clear pending events */
+ while (google_chromeec_get_event() != 0)
+ ;
+
+ /* Restore SCI event mask */
+ google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS);
+ } else {
+ google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
+ MAINBOARD_EC_S5_WAKE_EVENTS);
+ }
+
+ /* Clear wake event mask */
+ google_chromeec_set_wake_mask(0);
+ post_code(0xf1);
+}
diff --git a/src/mainboard/intel/amenia/ec.h b/src/mainboard/intel/amenia/ec.h
new file mode 100644
index 0000000..ab8bcba
--- /dev/null
+++ b/src/mainboard/intel/amenia/ec.h
@@ -0,0 +1,62 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015-2016 Intel Corp.
+ * Copyright (C) 2015 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 MAINBOARD_EC_H
+#define MAINBOARD_EC_H
+
+#include <ec/google/chromeec/ec_commands.h>
+
+#define MAINBOARD_EC_SCI_EVENTS \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_LOW) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_CRITICAL) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_STATUS) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_THRESHOLD) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_OVERLOAD) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_START) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_STOP) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_CHARGER) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_PD_MCU))
+
+#define MAINBOARD_EC_SMI_EVENTS \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED))
+
+/* EC can wake from S5 with lid or power button */
+#define MAINBOARD_EC_S5_WAKE_EVENTS \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))
+
+/* EC can wake from S3 with lid or power button or key press */
+#define MAINBOARD_EC_S3_WAKE_EVENTS \
+ (MAINBOARD_EC_S5_WAKE_EVENTS |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED))
+
+/* Log EC wake events plus EC shutdown events */
+#define MAINBOARD_EC_LOG_EVENTS \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_SHUTDOWN) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_SHUTDOWN)|\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_PANIC))
+
+#ifndef __ACPI__
+extern void mainboard_ec_init(void);
+#endif
+
+#endif
diff --git a/src/mainboard/intel/amenia/mainboard.c b/src/mainboard/intel/amenia/mainboard.c
index 755736e..f95227f 100644
--- a/src/mainboard/intel/amenia/mainboard.c
+++ b/src/mainboard/intel/amenia/mainboard.c
@@ -21,6 +21,7 @@
#include <soc/lpc.h>
#include <soc/intel/apollolake/chip.h>
#include <soc/pci_devs.h>
+#include "ec.h"
/* TODO: Move GPIO config to its own file once we get more GPIOs in the list */
static const struct pad_config amenia_gpios[] = {