2 * This file is part of the coreboot project.
4 * Copyright (C) 2005 Digital Design Corporation
5 * (Written by Steven J. Magnani <steve@digidescorp.com> for Digital Design)
6 * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
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.
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.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <console/console.h>
24 #include <device/device.h>
25 #include <device/pci.h>
28 void i82801ax_enable(device_t dev)
30 unsigned int index = 0;
31 uint16_t cur_disable_mask, new_disable_mask;
33 /* All 82801xx devices should be on bus 0. */
34 unsigned int devfn = PCI_DEVFN(0x1f, 0); // LPC
35 device_t lpc_dev = dev_find_slot(0, devfn); // 0
39 /* We're going to assume, perhaps incorrectly, that if a function
40 * exists it can be disabled. Workarounds for ICH variants that don't
41 * follow this should be done by checking the device ID.
43 if (PCI_SLOT(dev->path.pci.devfn) == 31) {
44 index = PCI_FUNC(dev->path.pci.devfn);
45 } else if (PCI_SLOT(dev->path.pci.devfn) == 29) {
46 index = 8 + PCI_FUNC(dev->path.pci.devfn);
49 /* Function 0 is a bit of an exception. */
54 cur_disable_mask = pci_read_config16(lpc_dev, FUNC_DIS);
55 new_disable_mask = cur_disable_mask & ~(1 << index); /* Enable it. */
57 new_disable_mask |= (1 << index); /* Disable it, if desired. */
59 if (new_disable_mask != cur_disable_mask) {
60 pci_write_config16(lpc_dev, FUNC_DIS, new_disable_mask);
64 struct chip_operations southbridge_intel_i82801ax_ops = {
65 CHIP_NAME("Intel ICH/ICH0 (82801AA/AB) Series Southbridge")
66 .enable_dev = i82801ax_enable,