blob: 28e1f5e2f27d2d67ceb2318d6b03c58529fe038e [file] [log] [blame]
Yinghai Lu13f1c2a2005-07-08 02:49:49 +00001#include <console/console.h>
Stefan Reinauerd4ab7c52010-03-17 02:09:12 +00002#include <watchdog.h>
Yinghai Lu13f1c2a2005-07-08 02:49:49 +00003#include <arch/io.h>
4#include <device/device.h>
5#include <device/pci.h>
6
7void watchdog_off(void)
8{
9 device_t dev;
10 unsigned long value,base;
11
12 /* turn off the ICH5 watchdog */
13 dev = dev_find_slot(0, PCI_DEVFN(0x1f,0));
14 /* Enable I/O space */
15 value = pci_read_config16(dev, 0x04);
16 value |= (1 << 10);
17 pci_write_config16(dev, 0x04, value);
18 /* Get TCO base */
19 base = (pci_read_config32(dev, 0x40) & 0x0fffe) + 0x60;
20 /* Disable the watchdog timer */
21 value = inw(base + 0x08);
22 value |= 1 << 11;
23 outw(value, base + 0x08);
24 /* Clear TCO timeout status */
25 outw(0x0008, base + 0x04);
26 outw(0x0002, base + 0x06);
Stefan Reinauer64ed2b72010-03-31 14:47:43 +000027 printk(BIOS_DEBUG, "Watchdog ICH5 disabled\n");
Yinghai Lu13f1c2a2005-07-08 02:49:49 +000028}