Round 2 of i82801AX fixes to get it into a usable shape.
[coreboot.git] / src / southbridge / intel / i82801ax / i82801ax.c
1 /*
2  * This file is part of the coreboot project.
3  *
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>
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.
17  *
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
21  */
22
23 #include <console/console.h>
24 #include <device/device.h>
25 #include <device/pci.h>
26 #include "i82801ax.h"
27
28 void i82801ax_enable(device_t dev)
29 {
30         u16 reg16, index;
31         device_t lpc_dev;
32
33         /* Search for the 82801AA/AB LPC device (D31:F0) on PCI bus 0. */
34         lpc_dev = dev_find_slot(0, PCI_DEVFN(0x1f, 0));
35         if (!lpc_dev)
36                 return;
37
38         index = PCI_FUNC(dev->path.pci.devfn);
39
40         reg16 = pci_read_config16(lpc_dev, FUNC_DIS);
41         reg16 &= ~(1 << index);         /* Enable device. */
42         if (!dev->enabled)
43                 reg16 |= (1 << index);  /* Disable device, if desired. */
44         pci_write_config16(lpc_dev, FUNC_DIS, reg16);
45 }
46
47 struct chip_operations southbridge_intel_i82801ax_ops = {
48         CHIP_NAME("Intel ICH/ICH0 (82801AA/AB) Series Southbridge")
49         .enable_dev = i82801ax_enable,
50 };