blob: 6028cd663f9984e48126dc010529969cf6105b84 [file] [log] [blame]
arch import user (historical)98d0d302005-07-06 17:13:46 +00001/*
Uwe Hermann8af6d552010-10-17 19:13:18 +00002 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2004 Tyan Computer
5 * Written by Yinghai Lu <yhlu@tyan.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; version 2 of the License.
10 *
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.
arch import user (historical)98d0d302005-07-06 17:13:46 +000015 */
Uwe Hermann7f3d48c2008-10-02 18:19:17 +000016
arch import user (historical)98d0d302005-07-06 17:13:46 +000017#include <console/console.h>
18#include <device/device.h>
19#include <device/pci.h>
20#include <device/pci_ids.h>
21#include <device/pci_ops.h>
Vladimir Serbinenko6985d4e2014-09-21 14:31:19 +020022#include <arch/acpi.h>
Kyösti Mälkki413e3da2015-02-03 08:05:55 +020023#include "chip.h"
Vladimir Serbinenko6985d4e2014-09-21 14:31:19 +020024
Vladimir Serbinenkof21271e2014-10-16 18:00:27 +020025#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
Vladimir Serbinenko6985d4e2014-09-21 14:31:19 +020026
27unsigned long acpi_fill_mcfg(unsigned long current)
28{
Elyes HAOUAS1cbe19f2018-05-19 10:57:04 +020029 struct device *dev;
Vladimir Serbinenko6985d4e2014-09-21 14:31:19 +020030 unsigned long mcfg_base;
31
Kyösti Mälkkic70eed12018-05-22 02:18:00 +030032 dev = pcidev_on_root(0x0, 0);
Vladimir Serbinenko6985d4e2014-09-21 14:31:19 +020033 if (!dev)
34 return current;
35
36 mcfg_base = pci_read_config16(dev, 0x90);
37 if ((mcfg_base & 0x1000) == 0)
38 return current;
39
40 mcfg_base = (mcfg_base & 0xf) << 28;
41
42 printk(BIOS_INFO, "mcfg_base %lx.\n", mcfg_base);
43
44 current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)
45 current, mcfg_base, 0x0, 0x0, 0xff);
46 return current;
47}
48
49#endif
arch import user (historical)98d0d302005-07-06 17:13:46 +000050
Jonathan A. Kollasch30c34c02015-01-25 12:57:43 -060051static void ht_init(struct device *dev)
52{
53 u32 htmsi;
54
55 /* Enable HT MSI Mapping in capability register */
56 htmsi = pci_read_config32(dev, 0xe0);
57 htmsi |= (1 << 16);
58 pci_write_config32(dev, 0xe0, htmsi);
59}
60
Uwe Hermann7f3d48c2008-10-02 18:19:17 +000061static struct device_operations ht_ops = {
arch import user (historical)98d0d302005-07-06 17:13:46 +000062 .read_resources = pci_dev_read_resources,
63 .set_resources = pci_dev_set_resources,
64 .enable_resources = pci_dev_enable_resources,
Jonathan A. Kollasch30c34c02015-01-25 12:57:43 -060065 .init = ht_init,
arch import user (historical)98d0d302005-07-06 17:13:46 +000066 .scan_bus = 0,
Jonathan Kollaschc7f3f802010-10-29 15:56:04 +000067 .ops_pci = &ck804_pci_ops,
arch import user (historical)98d0d302005-07-06 17:13:46 +000068};
69
Stefan Reinauerf1cf1f72007-10-24 09:08:58 +000070static const struct pci_driver ht_driver __pci_driver = {
arch import user (historical)98d0d302005-07-06 17:13:46 +000071 .ops = &ht_ops,
72 .vendor = PCI_VENDOR_ID_NVIDIA,
73 .device = PCI_DEVICE_ID_NVIDIA_CK804_HT,
74};