cb60f3143a614b4e29722ee7cb4f2ed41f1a1e7c
[coreboot.git] / src / southbridge / nvidia / mcp55 / pcie.c
1 /*
2  * This file is part of the coreboot 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  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
22  */
23
24 #include <console/console.h>
25 #include <device/device.h>
26 #include <device/pci.h>
27 #include <device/pci_ids.h>
28 #include <device/pci_ops.h>
29 #include "mcp55.h"
30
31 static void pcie_init(struct device *dev)
32 {
33
34         /* Enable pci error detecting */
35         uint32_t dword;
36
37         /* System error enable */
38         dword = pci_read_config32(dev, 0x04);
39         dword |= (1<<8); /* System error enable */
40         dword |= (1<<30); /* Clear possible errors */
41         pci_write_config32(dev, 0x04, dword);
42
43 }
44
45 static struct device_operations pcie_ops  = {
46         .read_resources = pci_bus_read_resources,
47         .set_resources  = pci_dev_set_resources,
48         .enable_resources       = pci_bus_enable_resources,
49         .init           = pcie_init,
50         .scan_bus       = pci_scan_bridge,
51 //      .enable         = mcp55_enable,
52 };
53
54 static const struct pci_driver pciebc_driver __pci_driver = {
55         .ops    = &pcie_ops,
56         .vendor = PCI_VENDOR_ID_NVIDIA,
57         .device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_B_C,
58 };
59 static const struct pci_driver pciee_driver __pci_driver = {
60         .ops    = &pcie_ops,
61         .vendor = PCI_VENDOR_ID_NVIDIA,
62         .device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_E,
63 };
64 static const struct pci_driver pciea_driver __pci_driver = {
65         .ops    = &pcie_ops,
66         .vendor = PCI_VENDOR_ID_NVIDIA,
67         .device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_A,
68 };
69 static const struct pci_driver pcief_driver __pci_driver = {
70         .ops    = &pcie_ops,
71         .vendor = PCI_VENDOR_ID_NVIDIA,
72         .device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_F,
73 };
74 static const struct pci_driver pcied_driver __pci_driver = {
75         .ops    = &pcie_ops,
76         .vendor = PCI_VENDOR_ID_NVIDIA,
77         .device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_D,
78 };
79