2 * This file is part of the coreboot project.
4 * Copyright (C) 2003 Tyan Computer
5 * Written by Yinghai Lu <yhlu@tyan.com> for Tyan Computer.
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; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <console/console.h>
22 #include <device/device.h>
23 #include <device/pci.h>
24 #include <device/pci_ids.h>
25 #include <device/pci_ops.h>
27 static void agp3bridge_init(device_t dev)
31 /* Enable BM, MEM and IO */
32 byte = pci_read_config32(dev, 0x04);
34 pci_write_config8(dev, 0x04, byte);
39 static struct device_operations agp3bridge_ops = {
40 .read_resources = pci_bus_read_resources,
41 .set_resources = pci_dev_set_resources,
42 .enable_resources = pci_bus_enable_resources,
43 .init = agp3bridge_init,
44 .scan_bus = pci_scan_bridge,
47 static const struct pci_driver agp3bridge_driver __pci_driver = {
48 .ops = &agp3bridge_ops,
49 .vendor = PCI_VENDOR_ID_AMD,
50 .device = 0x7455, // AGP Bridge
53 static void agp3dev_enable(device_t dev)
58 value = pci_read_config32(dev, 0xa8);
59 value |= (3<<8)|2; //AGP 8x
60 pci_write_config32(dev, 0xa8, value);
62 /* enable BM and MEM */
63 value = pci_read_config32(dev, 0x4);
65 pci_write_config32(dev, 0x4, value);
67 /* FIXME: should we add agp aperture base and size here ?
68 * or it is done by AGP drivers */
72 static struct pci_operations pci_ops_pci_dev = {
73 .set_subsystem = pci_dev_set_subsystem,
76 static struct device_operations agp3dev_ops = {
77 .read_resources = pci_dev_read_resources,
78 .set_resources = pci_dev_set_resources,
79 .enable_resources = pci_dev_enable_resources,
82 .enable = agp3dev_enable,
83 .ops_pci = &pci_ops_pci_dev,
86 static const struct pci_driver agp3dev_driver __pci_driver = {
88 .vendor = PCI_VENDOR_ID_AMD,
89 .device = 0x7454, //AGP Device