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. |
Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <arch/io.h> |
| 18 | #include <console/console.h> |
| 19 | #include <cpu/x86/smm.h> |
| 20 | #include "southbridge/intel/i82801gx/nvs.h" |
| 21 | #include "southbridge/intel/i82801gx/i82801gx.h" |
| 22 | #include <pc80/mc146818rtc.h> |
| 23 | #include <delay.h> |
Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 24 | |
Kyösti Mälkki | 189f3ba | 2014-12-29 11:32:27 +0200 | [diff] [blame] | 25 | #define GPE_EC_SCI 12 |
| 26 | |
Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 27 | static void mainboard_smm_init(void) |
| 28 | { |
| 29 | printk(BIOS_DEBUG, "initializing SMI\n"); |
| 30 | } |
| 31 | |
| 32 | int mainboard_io_trap_handler(int smif) |
| 33 | { |
| 34 | static int smm_initialized; |
| 35 | |
| 36 | if (!smm_initialized) { |
| 37 | mainboard_smm_init(); |
| 38 | smm_initialized = 1; |
| 39 | } |
| 40 | |
| 41 | switch (smif) { |
| 42 | default: |
| 43 | return 0; |
| 44 | } |
| 45 | |
| 46 | /* On success, the IO Trap Handler returns 1 |
| 47 | * On failure, the IO Trap Handler returns a value != 1 */ |
| 48 | return 1; |
| 49 | } |
| 50 | |
| 51 | int mainboard_smi_apmc(u8 data) |
| 52 | { |
Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 53 | switch(data) { |
| 54 | case APM_CNT_ACPI_ENABLE: |
| 55 | /* route H8SCI to SCI */ |
Kyösti Mälkki | b85a87b | 2014-12-29 11:32:27 +0200 | [diff] [blame] | 56 | gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SCI); |
Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 57 | break; |
| 58 | case APM_CNT_ACPI_DISABLE: |
| 59 | /* route H8SCI# to SMI */ |
Kyösti Mälkki | b85a87b | 2014-12-29 11:32:27 +0200 | [diff] [blame] | 60 | gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SMI); |
Mono | 9b90824 | 2014-03-02 18:40:36 +0100 | [diff] [blame] | 61 | break; |
| 62 | default: |
| 63 | break; |
| 64 | } |
| 65 | return 0; |
| 66 | } |