blob: b7c2565e81b6aed82b2e58acfde3e04452a25bec [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.
Mono9b908242014-03-02 18:40:36 +010015 */
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>
Mono9b908242014-03-02 18:40:36 +010024
Kyösti Mälkki189f3ba2014-12-29 11:32:27 +020025#define GPE_EC_SCI 12
26
Mono9b908242014-03-02 18:40:36 +010027static void mainboard_smm_init(void)
28{
29 printk(BIOS_DEBUG, "initializing SMI\n");
30}
31
32int 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
51int mainboard_smi_apmc(u8 data)
52{
Mono9b908242014-03-02 18:40:36 +010053 switch(data) {
54 case APM_CNT_ACPI_ENABLE:
55 /* route H8SCI to SCI */
Kyösti Mälkkib85a87b2014-12-29 11:32:27 +020056 gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SCI);
Mono9b908242014-03-02 18:40:36 +010057 break;
58 case APM_CNT_ACPI_DISABLE:
59 /* route H8SCI# to SMI */
Kyösti Mälkkib85a87b2014-12-29 11:32:27 +020060 gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SMI);
Mono9b908242014-03-02 18:40:36 +010061 break;
62 default:
63 break;
64 }
65 return 0;
66}