Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2012 Google Inc. |
| 5 | * Copyright (C) 2015 Intel Corp. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Lee Leahy | 5cb9dda | 2015-05-01 10:34:54 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <arch/acpi.h> |
| 18 | #include <console/console.h> |
| 19 | #include <ec/google/chromeec/ec.h> |
| 20 | #include "ec.h" |
| 21 | #include <vendorcode/google/chromeos/chromeos.h> |
| 22 | #include <types.h> |
| 23 | |
| 24 | void mainboard_ec_init(void) |
| 25 | { |
| 26 | printk(BIOS_DEBUG, "mainboard_ec_init\n"); |
| 27 | post_code(0xf0); |
| 28 | |
| 29 | #if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC) |
| 30 | /* Restore SCI event mask on resume. */ |
| 31 | if (acpi_slp_type == 3) { |
| 32 | google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS | |
| 33 | MAINBOARD_EC_S3_WAKE_EVENTS); |
| 34 | |
| 35 | /* Disable SMI and wake events */ |
| 36 | google_chromeec_set_smi_mask(0); |
| 37 | |
| 38 | /* Clear pending events */ |
| 39 | while (google_chromeec_get_event() != 0) |
| 40 | ; |
| 41 | /* |
| 42 | * Set SCI mask.OS may not generate the SMI event to |
| 43 | * set this on S3 resume |
| 44 | */ |
| 45 | google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS); |
| 46 | } else { |
| 47 | google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS | |
| 48 | MAINBOARD_EC_S5_WAKE_EVENTS); |
| 49 | } |
| 50 | |
| 51 | /* Clear wake event mask */ |
| 52 | google_chromeec_set_wake_mask(0); |
| 53 | #endif |
| 54 | post_code(0xf1); |
| 55 | } |