Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +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. |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2005 Tyan Computer |
| 5 | * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer) |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #include <console/console.h> |
| 19 | #include <device/device.h> |
| 20 | #include <device/pci.h> |
| 21 | #include <device/pci_ids.h> |
Uwe Hermann | e62fc0d | 2010-10-11 22:49:39 +0000 | [diff] [blame] | 22 | #include "i82801bx.h" |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 23 | |
| 24 | static void pci_init(struct device *dev) |
| 25 | { |
Uwe Hermann | 0ea281f | 2010-10-11 21:38:49 +0000 | [diff] [blame] | 26 | u16 reg16; |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 27 | |
| 28 | /* Clear system errors */ |
Uwe Hermann | 0ea281f | 2010-10-11 21:38:49 +0000 | [diff] [blame] | 29 | reg16 = pci_read_config16(dev, PCI_STATUS); |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 30 | reg16 |= 0xf900; /* Clear possible errors */ |
Uwe Hermann | 0ea281f | 2010-10-11 21:38:49 +0000 | [diff] [blame] | 31 | pci_write_config16(dev, PCI_STATUS, reg16); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 32 | |
Uwe Hermann | 0ea281f | 2010-10-11 21:38:49 +0000 | [diff] [blame] | 33 | reg16 = pci_read_config16(dev, SECSTS); |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 34 | reg16 |= 0xf800; /* Clear possible errors */ |
Uwe Hermann | 0ea281f | 2010-10-11 21:38:49 +0000 | [diff] [blame] | 35 | pci_write_config16(dev, SECSTS, reg16); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 38 | static struct device_operations pci_ops = { |
| 39 | .read_resources = pci_bus_read_resources, |
| 40 | .set_resources = pci_dev_set_resources, |
| 41 | .enable_resources = pci_bus_enable_resources, |
| 42 | .init = pci_init, |
| 43 | .scan_bus = pci_scan_bridge, |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
Uwe Hermann | 0ea281f | 2010-10-11 21:38:49 +0000 | [diff] [blame] | 46 | /* 82801BA/BAM (ICH2/ICH2-M) */ |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 47 | static const struct pci_driver i82801misc_pci __pci_driver = { |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 48 | .ops = &pci_ops, |
| 49 | .vendor = PCI_VENDOR_ID_INTEL, |
| 50 | .device = 0x244e, |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 51 | }; |