blob: 5c6cd443d95f6e9363726ff0e3fa5370af240fe6 [file] [log] [blame]
Mono9b908242014-03-02 18:40:36 +01001/*
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>
Mono9b908242014-03-02 18:40:36 +010029
Kyösti Mälkki189f3ba2014-12-29 11:32:27 +020030#define GPE_EC_SCI 12
31
Mono9b908242014-03-02 18:40:36 +010032/* The southbridge SMI handler checks whether gnvs has a
33 * valid pointer before calling the trap handler
34 */
35extern global_nvs_t *gnvs;
36
37static void mainboard_smm_init(void)
38{
39 printk(BIOS_DEBUG, "initializing SMI\n");
40}
41
42int 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
61int mainboard_smi_apmc(u8 data)
62{
Mono9b908242014-03-02 18:40:36 +010063 switch(data) {
64 case APM_CNT_ACPI_ENABLE:
65 /* route H8SCI to SCI */
Kyösti Mälkkib85a87b2014-12-29 11:32:27 +020066 gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SCI);
Mono9b908242014-03-02 18:40:36 +010067 break;
68 case APM_CNT_ACPI_DISABLE:
69 /* route H8SCI# to SMI */
Kyösti Mälkkib85a87b2014-12-29 11:32:27 +020070 gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SMI);
Mono9b908242014-03-02 18:40:36 +010071 break;
72 default:
73 break;
74 }
75 return 0;
76}