2 * This file is part of the coreboot project.
4 * Copyright (C) 2008 Advanced Micro Devices, Inc.
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.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include <console/console.h>
21 #include <device/device.h>
22 #include <device/pci.h>
23 #include <device/pci_ids.h>
24 #include <device/pci_ops.h>
27 static void pci_init(struct device *dev)
33 /* RPR 4.1 Enables the PCI-bridge subtractive decode */
34 /* This setting is strongly recommended since it supports some legacy PCI add-on cards,such as BIOS debug cards */
35 byte = pci_read_config8(dev, 0x4B);
37 pci_write_config8(dev, 0x4B, byte);
38 byte = pci_read_config8(dev, 0x40);
40 pci_write_config8(dev, 0x40, byte);
42 /* RPR4.2 PCI-bridge upstream dual address window */
43 /* this setting is applicable if the system memory is more than 4GB,and the PCI device can support dual address access */
44 byte = pci_read_config8(dev, 0x50);
46 pci_write_config8(dev, 0x50, byte);
48 /* RPR 4.3 PCI bus 64-byte DMA read access */
49 /* Enhance the PCI bus DMA performance */
50 byte = pci_read_config8(dev, 0x4B);
52 pci_write_config8(dev, 0x4B, byte);
54 /* RPR 4.4 Enables the PCIB writes to be cacheline aligned. */
55 /* The size of the writes will be set in the Cacheline Register */
56 byte = pci_read_config8(dev, 0x40);
58 pci_write_config8(dev, 0x40, byte);
60 /* RPR 4.5 Enables the PCIB to retain ownership of the bus on the Primary side and on the Secondary side when GNT# is deasserted */
61 pci_write_config8(dev, 0x0D, 0x40);
62 pci_write_config8(dev, 0x1B, 0x40);
64 /* RPR 4.6 Enable the command matching checking function on "Memory Read" & "Memory Read Line" commands */
65 byte = pci_read_config8(dev, 0x4B);
67 pci_write_config8(dev, 0x4B, byte);
69 /* RPR 4.7 When enabled, the PCI arbiter checks for the Bus Idle before asserting GNT# */
70 byte = pci_read_config8(dev, 0x4B);
72 pci_write_config8(dev, 0x4B, byte);
74 /* RPR 4.8 Adjusts the GNT# de-assertion time */
75 word = pci_read_config16(dev, 0x64);
77 pci_write_config16(dev, 0x64, word);
79 /* RPR 4.9 Fast Back to Back transactions support */
80 byte = pci_read_config8(dev, 0x48);
82 pci_write_config8(dev, 0x48, byte);
84 /* RPR 4.10 Enable Lock Operation */
85 byte = pci_read_config8(dev, 0x48);
87 pci_write_config8(dev, 0x48, byte);
88 byte = pci_read_config8(dev, 0x40);
90 pci_write_config8(dev, 0x40, byte);
92 /* RPR 4.11 Enable additional optional PCI clock */
93 word = pci_read_config16(dev, 0x64);
95 pci_write_config16(dev, 0x64, word);
97 /* rpr4.12 Disable Fewer-Retry Mode for A11-A13 only. 0x64[5:4] clear */
98 byte = pci_read_config8(dev, 0x64);
100 pci_write_config8(dev, 0x64, byte);
102 /* rpr4.14 Disabling Downstream Flush, for A12 only, 0x64[18]. */
103 dword = pci_read_config32(dev, 0x64);
105 pci_write_config32(dev, 0x64, dword);
107 /* RPR 4.13 Enable One-Prefetch-Channel Mode */
108 dword = pci_read_config32(dev, 0x64);
110 pci_write_config32(dev, 0x64, dword);
112 /* RPR 4.15 Disable PCIB MSI Capability */
113 byte = pci_read_config8(dev, 0x40);
115 pci_write_config8(dev, 0x40, byte);
117 /* rpr4.16 Adjusting CLKRUN# */
118 dword = pci_read_config32(dev, 0x64);
120 pci_write_config32(dev, 0x64, dword);
123 struct device_operations amd8111_pci = {
124 .id = {.type = DEVICE_ID_PCI,
125 {.pci = {.vendor = PCI_VENDOR_ID_ATI,
126 .device = PCI_DEVICE_ID_ATI_SB600_PCI}}},
127 .constructor = default_device_constructor,
128 .phase3_scan = pci_scan_bridge,
129 .phase4_enable_disable = amd8111_enable,
130 .phase4_read_resources = pci_bus_read_resources,
131 .phase4_set_resources = pci_dev_set_resources,
132 .phase5_enable_resources = pci_bus_enable_resources,
133 .phase6_init = pci_init,
134 .reset_bus = pci_bus_reset,