This sb800 code is derived from sb700.
[coreboot.git] / src / southbridge / amd / sb800 / pcie.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2010 Advanced Micro Devices, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 #include <console/console.h>
21 #include <device/device.h>
22 #include <device/pci.h>
23 #include <device/pci_ids.h>
24 #include <device/pci_ops.h>
25 #include "sb800.h"
26
27 static void pcie_init(struct device *dev)
28 {
29         /* Enable pci error detecting */
30         u32 dword;
31
32         printk(BIOS_INFO, "pcie_init in rs780_ht.c\n");
33
34         /* System error enable */
35         dword = pci_read_config32(dev, 0x04);
36         dword |= (1 << 8);      /* System error enable */
37         dword |= (1 << 30);     /* Clear possible errors */
38         pci_write_config32(dev, 0x04, dword);
39 }
40
41 static struct pci_operations lops_pci = {
42         .set_subsystem = 0,
43 };
44
45 static struct device_operations pci_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         .reset_bus = pci_bus_reset,
52         .ops_pci = &lops_pci,
53 };
54
55 static const struct pci_driver pciea_driver __pci_driver = {
56         .ops = &pci_ops,
57         .vendor = PCI_VENDOR_ID_ATI,
58         .device = PCI_DEVICE_ID_ATI_SB800_PCIEA,
59 };
60
61 static const struct pci_driver pcieb_driver __pci_driver = {
62         .ops = &pci_ops,
63         .vendor = PCI_VENDOR_ID_ATI,
64         .device = PCI_DEVICE_ID_ATI_SB800_PCIEB,
65 };
66 static const struct pci_driver pciec_driver __pci_driver = {
67         .ops = &pci_ops,
68         .vendor = PCI_VENDOR_ID_ATI,
69         .device = PCI_DEVICE_ID_ATI_SB800_PCIEC,
70 };
71 static const struct pci_driver pcied_driver __pci_driver = {
72         .ops = &pci_ops,
73         .vendor = PCI_VENDOR_ID_ATI,
74         .device = PCI_DEVICE_ID_ATI_SB800_PCIED,
75 };