Zheng Bao | d098575 | 2011-01-20 04:45:48 +0000 | [diff] [blame] | 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. |
Zheng Bao | d098575 | 2011-01-20 04:45:48 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <console/console.h> |
| 17 | #include <device/device.h> |
| 18 | #include <device/pci.h> |
| 19 | #include <device/pci_ids.h> |
| 20 | #include <device/pci_ops.h> |
| 21 | #include "sb800.h" |
| 22 | |
| 23 | static void pcie_init(struct device *dev) |
| 24 | { |
| 25 | /* Enable pci error detecting */ |
| 26 | u32 dword; |
| 27 | |
| 28 | printk(BIOS_INFO, "pcie_init in rs780_ht.c\n"); |
| 29 | |
| 30 | /* System error enable */ |
| 31 | dword = pci_read_config32(dev, 0x04); |
| 32 | dword |= (1 << 8); /* System error enable */ |
| 33 | dword |= (1 << 30); /* Clear possible errors */ |
| 34 | pci_write_config32(dev, 0x04, dword); |
| 35 | } |
| 36 | |
| 37 | static struct pci_operations lops_pci = { |
| 38 | .set_subsystem = 0, |
| 39 | }; |
| 40 | |
| 41 | static struct device_operations pci_ops = { |
| 42 | .read_resources = pci_bus_read_resources, |
| 43 | .set_resources = pci_dev_set_resources, |
| 44 | .enable_resources = pci_bus_enable_resources, |
| 45 | .init = pcie_init, |
| 46 | .scan_bus = pci_scan_bridge, |
| 47 | .reset_bus = pci_bus_reset, |
| 48 | .ops_pci = &lops_pci, |
| 49 | }; |
| 50 | |
| 51 | static const struct pci_driver pciea_driver __pci_driver = { |
| 52 | .ops = &pci_ops, |
| 53 | .vendor = PCI_VENDOR_ID_ATI, |
| 54 | .device = PCI_DEVICE_ID_ATI_SB800_PCIEA, |
| 55 | }; |
| 56 | |
| 57 | static const struct pci_driver pcieb_driver __pci_driver = { |
| 58 | .ops = &pci_ops, |
| 59 | .vendor = PCI_VENDOR_ID_ATI, |
| 60 | .device = PCI_DEVICE_ID_ATI_SB800_PCIEB, |
| 61 | }; |
| 62 | static const struct pci_driver pciec_driver __pci_driver = { |
| 63 | .ops = &pci_ops, |
| 64 | .vendor = PCI_VENDOR_ID_ATI, |
| 65 | .device = PCI_DEVICE_ID_ATI_SB800_PCIEC, |
| 66 | }; |
| 67 | static const struct pci_driver pcied_driver __pci_driver = { |
| 68 | .ops = &pci_ops, |
| 69 | .vendor = PCI_VENDOR_ID_ATI, |
| 70 | .device = PCI_DEVICE_ID_ATI_SB800_PCIED, |
| 71 | }; |