blob: 2266ec3b16b71ef0fa56c35761e649c26cb0d565 [file] [log] [blame]
Corey Osgoode99bd102007-06-14 06:10:57 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Corey Osgoode99bd102007-06-14 06:10:57 +00003 *
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 Osgoode99bd102007-06-14 06:10:57 +000016 */
17
18#include <console/console.h>
19#include <device/device.h>
20#include <device/pci.h>
21#include <device/pci_ids.h>
Uwe Hermanne62fc0d2010-10-11 22:49:39 +000022#include "i82801bx.h"
Corey Osgoode99bd102007-06-14 06:10:57 +000023
24static void pci_init(struct device *dev)
25{
Uwe Hermann0ea281f2010-10-11 21:38:49 +000026 u16 reg16;
Corey Osgoode99bd102007-06-14 06:10:57 +000027
28 /* Clear system errors */
Uwe Hermann0ea281f2010-10-11 21:38:49 +000029 reg16 = pci_read_config16(dev, PCI_STATUS);
Uwe Hermanndfb3c132007-06-19 22:47:11 +000030 reg16 |= 0xf900; /* Clear possible errors */
Uwe Hermann0ea281f2010-10-11 21:38:49 +000031 pci_write_config16(dev, PCI_STATUS, reg16);
Corey Osgoode99bd102007-06-14 06:10:57 +000032
Uwe Hermann0ea281f2010-10-11 21:38:49 +000033 reg16 = pci_read_config16(dev, SECSTS);
Uwe Hermanndfb3c132007-06-19 22:47:11 +000034 reg16 |= 0xf800; /* Clear possible errors */
Uwe Hermann0ea281f2010-10-11 21:38:49 +000035 pci_write_config16(dev, SECSTS, reg16);
Corey Osgoode99bd102007-06-14 06:10:57 +000036}
37
Uwe Hermanndfb3c132007-06-19 22:47:11 +000038static 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 Osgoode99bd102007-06-14 06:10:57 +000044};
45
Uwe Hermann0ea281f2010-10-11 21:38:49 +000046/* 82801BA/BAM (ICH2/ICH2-M) */
Stefan Reinauerf1cf1f72007-10-24 09:08:58 +000047static const struct pci_driver i82801misc_pci __pci_driver = {
Uwe Hermanndfb3c132007-06-19 22:47:11 +000048 .ops = &pci_ops,
49 .vendor = PCI_VENDOR_ID_INTEL,
50 .device = 0x244e,
Corey Osgoode99bd102007-06-14 06:10:57 +000051};