Vladimir Serbinenko | 4679c41 | 2015-05-16 16:32:45 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008-2009 coresystems GmbH |
| 5 | * Copyright 2013 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. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #include <arch/io.h> |
| 22 | #include <console/console.h> |
| 23 | #include <cpu/x86/smm.h> |
| 24 | #include <soc/pm.h> |
| 25 | #include <soc/smm.h> |
| 26 | #include <elog.h> |
| 27 | #include <ec/google/chromeec/ec.h> |
| 28 | #include <soc/gpio.h> |
| 29 | #include <soc/iomap.h> |
| 30 | #include <soc/nvs.h> |
| 31 | #include <soc/pm.h> |
| 32 | #include <soc/smm.h> |
| 33 | #include "ec.h" |
| 34 | #include "gpio.h" |
| 35 | |
| 36 | int mainboard_io_trap_handler(int smif) |
| 37 | { |
| 38 | switch (smif) { |
| 39 | case 0x99: |
| 40 | printk(BIOS_DEBUG, "Sample\n"); |
| 41 | smm_get_gnvs()->smif = 0; |
| 42 | break; |
| 43 | default: |
| 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | /* On success, the IO Trap Handler returns 0 |
| 48 | * On failure, the IO Trap Handler returns a value != 0 |
| 49 | * |
| 50 | * For now, we force the return value to 0 and log all traps to |
| 51 | * see what's going on. |
| 52 | */ |
| 53 | //smm_get_gnvs()->smif = 0; |
| 54 | return 1; |
| 55 | } |