Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008-2009 coresystems GmbH |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; version 2 of |
| 9 | * 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, |
| 19 | * MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #include <arch/io.h> |
| 23 | #include <console/console.h> |
| 24 | #include <cpu/x86/smm.h> |
| 25 | #include "southbridge/intel/i82801gx/nvs.h" |
| 26 | #include "southbridge/intel/i82801gx/i82801gx.h" |
| 27 | #include <pc80/mc146818rtc.h> |
| 28 | #include <delay.h> |
Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 29 | |
Kyösti Mälkki | 189f3ba | 2014-12-29 11:32:27 +0200 | [diff] [blame] | 30 | #define GPE_EC_SCI 12 |
| 31 | |
Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 32 | /* The southbridge SMI handler checks whether gnvs has a |
| 33 | * valid pointer before calling the trap handler |
| 34 | */ |
| 35 | extern global_nvs_t *gnvs; |
| 36 | |
| 37 | static void mainboard_smm_init(void) |
| 38 | { |
| 39 | printk(BIOS_DEBUG, "initializing SMI\n"); |
| 40 | } |
| 41 | |
| 42 | int mainboard_io_trap_handler(int smif) |
| 43 | { |
| 44 | static int smm_initialized; |
| 45 | |
| 46 | if (!smm_initialized) { |
| 47 | mainboard_smm_init(); |
| 48 | smm_initialized = 1; |
| 49 | } |
| 50 | |
| 51 | switch (smif) { |
| 52 | default: |
| 53 | return 0; |
| 54 | } |
| 55 | |
| 56 | /* On success, the IO Trap Handler returns 1 |
| 57 | * On failure, the IO Trap Handler returns a value != 1 */ |
| 58 | return 1; |
| 59 | } |
| 60 | |
| 61 | int mainboard_smi_apmc(u8 data) |
| 62 | { |
Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 63 | switch(data) { |
| 64 | case APM_CNT_ACPI_ENABLE: |
| 65 | /* route H8SCI to SCI */ |
Kyösti Mälkki | b85a87b | 2014-12-29 11:32:27 +0200 | [diff] [blame^] | 66 | gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SCI); |
Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 67 | break; |
| 68 | case APM_CNT_ACPI_DISABLE: |
| 69 | /* route H8SCI# to SMI */ |
Kyösti Mälkki | b85a87b | 2014-12-29 11:32:27 +0200 | [diff] [blame^] | 70 | gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SMI); |
Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 71 | break; |
| 72 | default: |
| 73 | break; |
| 74 | } |
| 75 | return 0; |
| 76 | } |