Aaron Durbin | 063c873 | 2013-10-28 11:24:53 -0500 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2012 Google Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Aaron Durbin | 063c873 | 2013-10-28 11:24:53 -0500 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <arch/acpi.h> |
Aaron Durbin | 063c873 | 2013-10-28 11:24:53 -0500 | [diff] [blame] | 17 | #include <types.h> |
| 18 | #include <console/console.h> |
| 19 | #include <ec/google/chromeec/ec.h> |
| 20 | #include "ec.h" |
| 21 | |
| 22 | void mainboard_ec_init(void) |
| 23 | { |
| 24 | printk(BIOS_DEBUG, "mainboard_ec_init\n"); |
| 25 | post_code(0xf0); |
| 26 | |
| 27 | /* Restore SCI event mask on resume. */ |
Kyösti Mälkki | c3ed886 | 2014-06-19 19:50:51 +0300 | [diff] [blame] | 28 | if (acpi_is_wakeup_s3()) { |
Aaron Durbin | 063c873 | 2013-10-28 11:24:53 -0500 | [diff] [blame] | 29 | google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS | |
| 30 | MAINBOARD_EC_S3_WAKE_EVENTS); |
| 31 | |
| 32 | /* Disable SMI and wake events */ |
| 33 | google_chromeec_set_smi_mask(0); |
| 34 | |
| 35 | /* Clear pending events */ |
| 36 | while (google_chromeec_get_event() != 0); |
| 37 | google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS); |
| 38 | } else { |
| 39 | google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS | |
| 40 | MAINBOARD_EC_S5_WAKE_EVENTS); |
Aaron Durbin | 3fbf671 | 2013-11-11 14:55:47 -0600 | [diff] [blame] | 41 | google_chromeec_set_smi_mask(MAINBOARD_EC_SMI_EVENTS); |
Aaron Durbin | 063c873 | 2013-10-28 11:24:53 -0500 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | /* Clear wake events, these are enabled on entry to sleep */ |
| 45 | google_chromeec_set_wake_mask(0); |
| 46 | |
| 47 | post_code(0xf1); |
| 48 | } |