Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 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. |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #include <console/console.h> |
| 23 | #include <device/device.h> |
| 24 | #include <device/pci.h> |
| 25 | #include <device/pci_ids.h> |
| 26 | #include <device/pci_ops.h> |
| 27 | #include "sis966.h" |
| 28 | |
| 29 | static void pcie_init(struct device *dev) |
| 30 | { |
| 31 | |
| 32 | /* Enable pci error detecting */ |
| 33 | uint32_t dword; |
| 34 | |
| 35 | /* System error enable */ |
| 36 | dword = pci_read_config32(dev, 0x04); |
| 37 | dword |= (1<<8); /* System error enable */ |
| 38 | dword |= (1<<30); /* Clear possible errors */ |
| 39 | pci_write_config32(dev, 0x04, dword); |
| 40 | |
| 41 | } |
| 42 | |
| 43 | static struct pci_operations lops_pci = { |
| 44 | .set_subsystem = 0, |
| 45 | }; |
| 46 | |
| 47 | static struct device_operations pcie_ops = { |
| 48 | .read_resources = pci_bus_read_resources, |
| 49 | .set_resources = pci_dev_set_resources, |
| 50 | .enable_resources = pci_bus_enable_resources, |
| 51 | .init = pcie_init, |
| 52 | .scan_bus = pci_scan_bridge, |
| 53 | // .enable = sis966_enable, |
| 54 | .ops_pci = &lops_pci, |
| 55 | }; |
| 56 | |
Stefan Reinauer | 83b52e7 | 2007-10-30 02:17:49 +0000 | [diff] [blame] | 57 | static const struct pci_driver pciebc_driver __pci_driver = { |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 58 | .ops = &pcie_ops, |
| 59 | .vendor = PCI_VENDOR_ID_SIS, |
Morgan Tsai | 31e805d | 2007-11-14 01:34:02 +0000 | [diff] [blame] | 60 | .device = PCI_DEVICE_ID_SIS_SIS966_PCIE, |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 61 | }; |