HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32533
Change subject: sb/i82801gx/watchdog: Use {read,write}_pmbase function ......................................................................
sb/i82801gx/watchdog: Use {read,write}_pmbase function
Use already defined common/pmbase functions. Also magic numbers replaced by macro and includes sorted.
Change-Id: I704780b6ae7238560dcb72fc027addc1089e0674 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/southbridge/intel/i82801gx/watchdog.c 1 file changed, 14 insertions(+), 14 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/32533/1
diff --git a/src/southbridge/intel/i82801gx/watchdog.c b/src/southbridge/intel/i82801gx/watchdog.c index 12284b4..6b2a204 100644 --- a/src/southbridge/intel/i82801gx/watchdog.c +++ b/src/southbridge/intel/i82801gx/watchdog.c @@ -14,37 +14,37 @@ * GNU General Public License for more details. */
-#include <console/console.h> #include <arch/io.h> -#include <device/pci_ops.h> +#include <console/console.h> #include <device/device.h> #include <device/pci.h> +#include <device/pci_def.h> +#include <device/pci_ops.h> +#include <southbridge/intel/common/pmbase.h> #include <watchdog.h>
+#include "i82801gx.h" + void watchdog_off(void) { struct device *dev; - unsigned long value, base; + unsigned long value;
- /* Turn off the ICH7 watchdog. */ dev = pcidev_on_root(0x1f, 0);
/* Enable I/O space. */ - value = pci_read_config16(dev, 0x04); - value |= (1 << 10); - pci_write_config16(dev, 0x04, value); - - /* Get TCO base. */ - base = (pci_read_config32(dev, 0x40) & 0x0fffe) + 0x60; + value = pci_read_config16(dev, PCI_COMMAND); + value |= PCI_COMMAND_INT_DISABLE; + pci_write_config16(dev, PCI_COMMAND, value);
/* Disable the watchdog timer. */ - value = inw(base + 0x08); + value = read_pmbase16(TCO1_CNT); value |= 1 << 11; - outw(value, base + 0x08); + write_pmbase16(TCO1_CNT, value);
/* Clear TCO timeout status. */ - outw(0x0008, base + 0x04); - outw(0x0002, base + 0x06); + write_pmbase16(TCO1_CNT + 0x04, (1 << 3)); + write_pmbase16(TCO1_CNT + 0x06, (1 << 2));
printk(BIOS_DEBUG, "ICH7 watchdog disabled\n"); }