blob: 99d630fa77d2a5423a1ef2fbd78fc5ddab8c4ac7 [file] [log] [blame]
Corey Osgoode99bd102007-06-14 06:10:57 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Corey Osgoode99bd102007-06-14 06:10:57 +00003 *
4 * Copyright (C) 2005 Digital Design Corporation
Uwe Hermanndfb3c132007-06-19 22:47:11 +00005 * (Written by Steven J. Magnani <steve@digidescorp.com> for Digital Design)
Corey Osgoode99bd102007-06-14 06:10:57 +00006 * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
Corey Osgoode99bd102007-06-14 06:10:57 +000017 */
18
19#include <console/console.h>
20#include <device/device.h>
21#include <device/pci.h>
Stefan Reinauer138be832010-02-27 01:50:21 +000022#include "i82801bx.h"
Corey Osgoode99bd102007-06-14 06:10:57 +000023
Stefan Reinauer138be832010-02-27 01:50:21 +000024void i82801bx_enable(device_t dev)
Corey Osgoode99bd102007-06-14 06:10:57 +000025{
Uwe Hermann0ea281f2010-10-11 21:38:49 +000026 u16 reg16, index;
27 device_t lpc_dev;
Corey Osgoode99bd102007-06-14 06:10:57 +000028
Uwe Hermann0ea281f2010-10-11 21:38:49 +000029 /* Search for the 82801BA/BAM LPC device (D31:F0) on PCI bus 0. */
30 lpc_dev = dev_find_slot(0, PCI_DEVFN(0x1f, 0));
Corey Osgoode99bd102007-06-14 06:10:57 +000031 if (!lpc_dev)
32 return;
33
Uwe Hermann0ea281f2010-10-11 21:38:49 +000034 index = PCI_FUNC(dev->path.pci.devfn);
Uwe Hermanndfb3c132007-06-19 22:47:11 +000035
Uwe Hermann0ea281f2010-10-11 21:38:49 +000036 reg16 = pci_read_config16(lpc_dev, FUNC_DIS);
37 reg16 &= ~(1 << index); /* Enable device. */
38 if (!dev->enabled)
39 reg16 |= (1 << index); /* Disable device, if desired. */
40 pci_write_config16(lpc_dev, FUNC_DIS, reg16);
Corey Osgoode99bd102007-06-14 06:10:57 +000041}
42
Stefan Reinauer138be832010-02-27 01:50:21 +000043struct chip_operations southbridge_intel_i82801bx_ops = {
44 CHIP_NAME("Intel ICH2 (82801Bx) Series Southbridge")
45 .enable_dev = i82801bx_enable,
Corey Osgoode99bd102007-06-14 06:10:57 +000046};