Add more missing GPL-headers, fix inconsistencies in others.
[coreboot.git] / src / southbridge / broadcom / bcm21000 / bcm21000_pcie.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2009 University of Heidelberg
5  * Written by Mondrian Nuessle <nuessle@uni-heidelberg.de> for
6  * University of Heidelberg.
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 <device/pci_ids.h>
27 #include <device/pci_ops.h>
28
29 static void pcie_init(struct device *dev)
30 {
31         /* Enable pci error detecting */
32         uint32_t dword;
33         uint32_t msicap;
34
35         printk(BIOS_DEBUG, "PCIE enable.... dev= %s\n",dev_path(dev));
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         /* enable MSI on PCIE: */
44         msicap = pci_read_config32(dev, 0xa0);
45         msicap |= (1<<16); /* enable MSI*/
46         pci_write_config32(dev, 0xa0, msicap);
47 }
48
49 static struct pci_operations lops_pci = {
50         .set_subsystem = 0,
51 };
52
53 static struct device_operations pcie_ops  = {
54         .read_resources   = pci_bus_read_resources,
55         .set_resources    = pci_dev_set_resources,
56         .enable_resources = pci_bus_enable_resources,
57         .init             = pcie_init,
58         .scan_bus         = pci_scan_bridge,
59         .reset_bus        = pci_bus_reset,
60         .ops_pci          = &lops_pci,
61 };
62
63 static const struct pci_driver pcie_driver1 __pci_driver = {
64         .ops    = &pcie_ops,
65         .vendor = PCI_VENDOR_ID_SERVERWORKS,
66         .device = PCI_DEVICE_ID_SERVERWORKS_BCM21000_EXB0,
67 };
68
69 static const struct pci_driver pcie_driver2 __pci_driver = {
70         .ops    = &pcie_ops,
71         .vendor = PCI_VENDOR_ID_SERVERWORKS,
72         .device = PCI_DEVICE_ID_SERVERWORKS_BCM21000_EXB1,
73 };
74
75 static const struct pci_driver pcie_driver3 __pci_driver = {
76         .ops    = &pcie_ops,
77         .vendor = PCI_VENDOR_ID_SERVERWORKS,
78         .device = PCI_DEVICE_ID_SERVERWORKS_BCM21000_EXB2,
79 };