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 /* for UMA internal graphics */
28 void avoid_lpc_dma_deadlock(device_t nb_dev, device_t sb_dev)
33 k8_f0 = dev_find_slot(0, PCI_DEVFN(0x18, 0));
34 set_nbcfg_enable_bits(k8_f0, 0x68, 3 << 21, 1 << 21);
36 reg = nbpcie_p_read_index(sb_dev, 0x10);
37 reg |= 0x100; /* bit9=1 */
38 nbpcie_p_write_index(sb_dev, 0x10, reg);
40 reg = nbpcie_p_read_index(nb_dev, 0x10);
41 reg |= 0x100; /* bit9=1 */
42 nbpcie_p_write_index(nb_dev, 0x10, reg);
44 /* Enable NP protocol over PCIE for memory-mapped writes targeting LPC
45 * Set this bit to avoid a deadlock condition. */
46 reg = htiu_read_index(nb_dev, 0x6);
47 reg |= 0x1000000; /* bit26 */
48 htiu_write_index(nb_dev, 0x6, reg);
51 static void pcie_init(struct device *dev)
53 /* Enable pci error detecting */
56 printk(BIOS_INFO, "pcie_init in rs690_ht.c\n");
58 /* System error enable */
59 dword = pci_read_config32(dev, 0x04);
60 dword |= (1 << 8); /* System error enable */
61 dword |= (1 << 30); /* Clear possible errors */
62 pci_write_config32(dev, 0x04, dword);
66 * 18 is enable nb to accept A4 interrupt request from SB.
68 dword = pci_read_config32(dev, 0x4C);
69 dword |= 1 << 1 | 1 << 18; /* Clear possible errors */
70 pci_write_config32(dev, 0x4C, dword);
73 static struct pci_operations lops_pci = {
74 .set_subsystem = pci_dev_set_subsystem,
77 static struct device_operations ht_ops = {
78 .read_resources = pci_dev_read_resources,
79 .set_resources = pci_dev_set_resources,
80 .enable_resources = pci_dev_enable_resources,
86 static const struct pci_driver ht_driver __pci_driver = {
88 .vendor = PCI_VENDOR_ID_ATI,
89 .device = PCI_DEVICE_ID_ATI_RS690_HT,