Round 2 of i82801AX fixes to get it into a usable shape.
[coreboot.git] / src / southbridge / intel / i82801bx / i82801bx_early_lpc.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2008 Joseph Smith <joe@settoplinux.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  *
19  */
20
21 static void i82801bx_halt_tco_timer(void)
22 {
23         device_t dev;
24         uint16_t halt_tco_timer;
25
26         /* Set the LPC device statically. */
27         dev = PCI_DEV(0x0, 0x1f, 0x0);
28
29         /* Temporarily set ACPI base address (I/O space). */
30         pci_write_config32(dev, PMBASE, (PMBASE_ADDR | 1));
31
32         /* Temporarily enable ACPI I/O. */
33         pci_write_config8(dev, ACPI_CNTL, 0x10);
34
35         /* Halt the TCO timer, preventing SMI and automatic reboot */
36         outw(inw(PMBASE_ADDR + TCOBASE + TCO1_CNT) | (1 << 11), PMBASE_ADDR + TCOBASE + TCO1_CNT);
37
38         /* Disable ACPI I/O. */
39         pci_write_config8(dev, ACPI_CNTL, 0x00);
40 }