blob: 4caa23653d7d88ad64383766606daddddcbfffb8 [file] [log] [blame]
Angel Ponsf94ac9a2020-04-05 15:46:48 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Duncan Lauriec88c54c2014-04-30 16:36:13 -07003
Duncan Lauriec88c54c2014-04-30 16:36:13 -07004#include <device/device.h>
5#include <device/pci.h>
Matt DeVillier0f49bbc2018-02-19 17:35:55 -06006#include <soc/acpi.h>
Julius Werner4ee4bd52014-10-20 13:46:39 -07007#include <soc/pci_devs.h>
8#include <soc/ramstage.h>
9#include <soc/intel/broadwell/chip.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -070010
Elyes HAOUAS040aff22018-05-27 16:30:36 +020011static void pci_domain_set_resources(struct device *dev)
Duncan Lauriec88c54c2014-04-30 16:36:13 -070012{
13 assign_resources(dev->link_list);
14}
15
16static struct device_operations pci_domain_ops = {
Matt DeVillier0f49bbc2018-02-19 17:35:55 -060017 .read_resources = &pci_domain_read_resources,
18 .set_resources = &pci_domain_set_resources,
19 .scan_bus = &pci_domain_scan_bus,
Julius Wernercd49cce2019-03-05 16:53:33 -080020#if CONFIG(HAVE_ACPI_TABLES)
Matt DeVillier0f49bbc2018-02-19 17:35:55 -060021 .write_acpi_tables = &northbridge_write_acpi_tables,
22#endif
Duncan Lauriec88c54c2014-04-30 16:36:13 -070023};
24
Duncan Lauriec88c54c2014-04-30 16:36:13 -070025static struct device_operations cpu_bus_ops = {
Edward O'Callaghan0625a8b2014-10-31 08:03:16 +110026 .read_resources = DEVICE_NOOP,
27 .set_resources = DEVICE_NOOP,
Duncan Lauriec88c54c2014-04-30 16:36:13 -070028 .init = &broadwell_init_cpus,
29};
30
Elyes HAOUAS040aff22018-05-27 16:30:36 +020031static void broadwell_enable(struct device *dev)
Duncan Lauriec88c54c2014-04-30 16:36:13 -070032{
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
47struct 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 Lauriec88c54c2014-04-30 16:36:13 -070053struct pci_operations broadwell_pci_ops = {
Subrata Banik4a0f0712019-03-20 14:29:47 +053054 .set_subsystem = &pci_dev_set_subsystem
Duncan Lauriec88c54c2014-04-30 16:36:13 -070055};