88527d07a3daaf469729f4626a9405ac61ab8419
[coreboot.git] / src / southbridge / sis / sis966 / sis966_pcie.c
1 /*
2  * This file is part of the LinuxBIOS project.
3  *
4  * Copyright (C) 2004 Tyan Computer
5  * Written by Yinghai Lu <yhlu@tyan.com> for Tyan Computer.
6  * Copyright (C) 2006,2007 AMD
7  * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD.
8  * Copyright (C) 2007 Silicon Integrated Systems Corp. (SiS)
9  * Written by Morgan Tsai <my_tsai@sis.com> for SiS.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
24  */
25
26 #include <console/console.h>
27 #include <device/device.h>
28 #include <device/pci.h>
29 #include <device/pci_ids.h>
30 #include <device/pci_ops.h>
31 #include "sis966.h"
32
33 static void pcie_init(struct device *dev)
34 {
35
36         /* Enable pci error detecting */
37         uint32_t dword;
38
39         /* System error enable */
40         dword = pci_read_config32(dev, 0x04);
41         dword |= (1<<8); /* System error enable */
42         dword |= (1<<30); /* Clear possible errors */
43         pci_write_config32(dev, 0x04, dword);
44
45 }
46
47 static struct pci_operations lops_pci = {
48         .set_subsystem  = 0,
49 };
50
51 static struct device_operations pcie_ops  = {
52         .read_resources = pci_bus_read_resources,
53         .set_resources  = pci_dev_set_resources,
54         .enable_resources       = pci_bus_enable_resources,
55         .init           = pcie_init,
56         .scan_bus       = pci_scan_bridge,
57 //      .enable         = sis966_enable,
58         .ops_pci        = &lops_pci,
59 };
60
61 static const struct pci_driver pciebc_driver __pci_driver = {
62         .ops    = &pcie_ops,
63         .vendor = PCI_VENDOR_ID_SIS,
64         .device = PCI_DEVICE_ID_SIS_SIS966_PCIE,
65 };
66