Angel Pons | f94ac9a | 2020-04-05 15:46:48 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 3 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 4 | #include <device/device.h> |
| 5 | #include <device/pci.h> |
Matt DeVillier | 0f49bbc | 2018-02-19 17:35:55 -0600 | [diff] [blame] | 6 | #include <soc/acpi.h> |
Julius Werner | 4ee4bd5 | 2014-10-20 13:46:39 -0700 | [diff] [blame] | 7 | #include <soc/pci_devs.h> |
| 8 | #include <soc/ramstage.h> |
| 9 | #include <soc/intel/broadwell/chip.h> |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 10 | |
Elyes HAOUAS | 040aff2 | 2018-05-27 16:30:36 +0200 | [diff] [blame] | 11 | static void pci_domain_set_resources(struct device *dev) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 12 | { |
| 13 | assign_resources(dev->link_list); |
| 14 | } |
| 15 | |
| 16 | static struct device_operations pci_domain_ops = { |
Matt DeVillier | 0f49bbc | 2018-02-19 17:35:55 -0600 | [diff] [blame] | 17 | .read_resources = &pci_domain_read_resources, |
| 18 | .set_resources = &pci_domain_set_resources, |
| 19 | .scan_bus = &pci_domain_scan_bus, |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 20 | #if CONFIG(HAVE_ACPI_TABLES) |
Matt DeVillier | 0f49bbc | 2018-02-19 17:35:55 -0600 | [diff] [blame] | 21 | .write_acpi_tables = &northbridge_write_acpi_tables, |
| 22 | #endif |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 23 | }; |
| 24 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 25 | static struct device_operations cpu_bus_ops = { |
Edward O'Callaghan | 0625a8b | 2014-10-31 08:03:16 +1100 | [diff] [blame] | 26 | .read_resources = DEVICE_NOOP, |
| 27 | .set_resources = DEVICE_NOOP, |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 28 | .init = &broadwell_init_cpus, |
| 29 | }; |
| 30 | |
Elyes HAOUAS | 040aff2 | 2018-05-27 16:30:36 +0200 | [diff] [blame] | 31 | static void broadwell_enable(struct device *dev) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 32 | { |
| 33 | /* Set the operations if it is a special bus type */ |
| 34 | if (dev->path.type == DEVICE_PATH_DOMAIN) { |
| 35 | dev->ops = &pci_domain_ops; |
| 36 | } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) { |
| 37 | dev->ops = &cpu_bus_ops; |
| 38 | } else if (dev->path.type == DEVICE_PATH_PCI) { |
| 39 | /* Handle PCH device enable */ |
| 40 | if (PCI_SLOT(dev->path.pci.devfn) > SA_DEV_SLOT_MINIHD && |
| 41 | (dev->ops == NULL || dev->ops->enable == NULL)) { |
| 42 | broadwell_pch_enable_dev(dev); |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | struct chip_operations soc_intel_broadwell_ops = { |
| 48 | CHIP_NAME("Intel Broadwell") |
| 49 | .enable_dev = &broadwell_enable, |
| 50 | .init = &broadwell_init_pre_device, |
| 51 | }; |
| 52 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 53 | struct pci_operations broadwell_pci_ops = { |
Subrata Banik | 4a0f071 | 2019-03-20 14:29:47 +0530 | [diff] [blame] | 54 | .set_subsystem = &pci_dev_set_subsystem |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 55 | }; |