e110dce370f1e65faa11655a2036ec96fd628e3a
[coreboot.git] / src / southbridge / intel / i82801db / i82801db_pci.c
1 /*
2  * This file is part of the LinuxBIOS project.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
17  */
18
19 #include <console/console.h>
20 #include <device/device.h>
21 #include <device/pci.h>
22 #include <device/pci_ids.h>
23 #include <device/pci_ops.h>
24 #include "i82801db.h"
25
26 static void pci_init(struct device *dev)
27 {
28         uint32_t dword;
29         uint16_t word;
30
31         /* Clear system errors */
32         word = pci_read_config16(dev, 0x06);
33         word |= 0xf900; /* Clear possible errors */
34         pci_write_config16(dev, 0x06, word);
35
36 #if 0
37         /* System error enable */
38         dword = pci_read_config32(dev, 0x04);
39         dword |= (1<<8); /* SERR# Enable */
40         dword |= (1<<6); /* Parity Error Response */
41         pci_write_config32(dev, 0x04, dword);
42 #endif                          
43         
44         word = pci_read_config16(dev, 0x1e);
45         word |= 0xf800; /* Clear possible errors */
46         pci_write_config16(dev, 0x1e, word);
47 }
48
49 static struct device_operations pci_ops  = {
50         .read_resources   = pci_bus_read_resources,
51         .set_resources    = pci_dev_set_resources,
52         .enable_resources = pci_bus_enable_resources,
53         .init             = pci_init,
54         .scan_bus         = pci_scan_bridge,
55         .ops_pci          = 0,
56 };
57
58 static const struct pci_driver pci_driver __pci_driver = {
59         .ops    = &pci_ops,
60         .vendor = PCI_VENDOR_ID_INTEL,
61         .device = PCI_DEVICE_ID_INTEL_82801DB_PCI,
62 };
63