Patrick Georgi | 04746fc | 2015-06-05 18:53:43 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008-2009 coresystems GmbH |
| 5 | * Copyright 2014 Google Inc. |
| 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. |
Patrick Georgi | 04746fc | 2015-06-05 18:53:43 +0200 | [diff] [blame] | 15 | */ |
| 16 | |
Aaron Durbin | 30b0c7a | 2016-07-13 13:01:13 -0500 | [diff] [blame] | 17 | #include <arch/acpi.h> |
Patrick Georgi | 04746fc | 2015-06-05 18:53:43 +0200 | [diff] [blame] | 18 | #include <arch/io.h> |
| 19 | #include <console/console.h> |
| 20 | #include <cpu/x86/smm.h> |
| 21 | #include <soc/pm.h> |
| 22 | #include <soc/smm.h> |
| 23 | #include <elog.h> |
| 24 | #include <ec/google/chromeec/ec.h> |
| 25 | #include <soc/gpio.h> |
| 26 | #include <soc/iomap.h> |
| 27 | #include <soc/nvs.h> |
| 28 | #include <soc/pm.h> |
| 29 | #include <soc/smm.h> |
| 30 | |
| 31 | int mainboard_io_trap_handler(int smif) |
| 32 | { |
| 33 | switch (smif) { |
| 34 | case 0x99: |
| 35 | printk(BIOS_DEBUG, "Sample\n"); |
| 36 | smm_get_gnvs()->smif = 0; |
| 37 | break; |
| 38 | default: |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | /* On success, the IO Trap Handler returns 0 |
| 43 | * On failure, the IO Trap Handler returns a value != 0 |
| 44 | * |
| 45 | * For now, we force the return value to 0 and log all traps to |
| 46 | * see what's going on. |
| 47 | */ |
| 48 | return 1; |
| 49 | } |
| 50 | |
| 51 | /* gpi_sts is GPIO 47:32 */ |
| 52 | void mainboard_smi_gpi(u32 gpi_sts) |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | void mainboard_smi_sleep(u8 slp_typ) |
| 57 | { |
| 58 | /* Disable USB charging if required */ |
| 59 | switch (slp_typ) { |
Aaron Durbin | 30b0c7a | 2016-07-13 13:01:13 -0500 | [diff] [blame] | 60 | case ACPI_S3: |
Patrick Georgi | 04746fc | 2015-06-05 18:53:43 +0200 | [diff] [blame] | 61 | break; |
Aaron Durbin | 30b0c7a | 2016-07-13 13:01:13 -0500 | [diff] [blame] | 62 | case ACPI_S5: |
Patrick Georgi | 04746fc | 2015-06-05 18:53:43 +0200 | [diff] [blame] | 63 | break; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | int mainboard_smi_apmc(u8 apmc) |
| 68 | { |
| 69 | switch (apmc) { |
| 70 | case APM_CNT_ACPI_ENABLE: |
| 71 | break; |
| 72 | case APM_CNT_ACPI_DISABLE: |
| 73 | break; |
| 74 | } |
| 75 | return 0; |
| 76 | } |