arch import user (historical) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 1 | /* |
Uwe Hermann | 8af6d55 | 2010-10-17 19:13:18 +0000 | [diff] [blame] | 2 | * 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) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 15 | */ |
Uwe Hermann | 7f3d48c | 2008-10-02 18:19:17 +0000 | [diff] [blame] | 16 | |
arch import user (historical) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 17 | #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 Serbinenko | 6985d4e | 2014-09-21 14:31:19 +0200 | [diff] [blame] | 22 | #include <arch/acpi.h> |
Kyösti Mälkki | 413e3da | 2015-02-03 08:05:55 +0200 | [diff] [blame] | 23 | #include "chip.h" |
Vladimir Serbinenko | 6985d4e | 2014-09-21 14:31:19 +0200 | [diff] [blame] | 24 | |
Vladimir Serbinenko | f21271e | 2014-10-16 18:00:27 +0200 | [diff] [blame] | 25 | #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) |
Vladimir Serbinenko | 6985d4e | 2014-09-21 14:31:19 +0200 | [diff] [blame] | 26 | |
| 27 | unsigned long acpi_fill_mcfg(unsigned long current) |
| 28 | { |
| 29 | device_t dev; |
| 30 | unsigned long mcfg_base; |
| 31 | |
| 32 | dev = dev_find_slot(0x0, PCI_DEVFN(0x0,0)); |
| 33 | 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) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 50 | |
Jonathan A. Kollasch | 30c34c0 | 2015-01-25 12:57:43 -0600 | [diff] [blame] | 51 | static 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 Hermann | 7f3d48c | 2008-10-02 18:19:17 +0000 | [diff] [blame] | 61 | static struct device_operations ht_ops = { |
arch import user (historical) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 62 | .read_resources = pci_dev_read_resources, |
| 63 | .set_resources = pci_dev_set_resources, |
| 64 | .enable_resources = pci_dev_enable_resources, |
Jonathan A. Kollasch | 30c34c0 | 2015-01-25 12:57:43 -0600 | [diff] [blame] | 65 | .init = ht_init, |
arch import user (historical) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 66 | .scan_bus = 0, |
Jonathan Kollasch | c7f3f80 | 2010-10-29 15:56:04 +0000 | [diff] [blame] | 67 | .ops_pci = &ck804_pci_ops, |
arch import user (historical) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 68 | }; |
| 69 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 70 | static const struct pci_driver ht_driver __pci_driver = { |
arch import user (historical) | 98d0d30 | 2005-07-06 17:13:46 +0000 | [diff] [blame] | 71 | .ops = &ht_ops, |
| 72 | .vendor = PCI_VENDOR_ID_NVIDIA, |
| 73 | .device = PCI_DEVICE_ID_NVIDIA_CK804_HT, |
| 74 | }; |