blob: 39802dcabb636fa8368628cd6b393f9506f52ba3 [file] [log] [blame]
Angel Ponsc3f58f62020-04-05 15:46:41 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -05003
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -05004#include <device/device.h>
5#include <device/pci.h>
6#include <arch/pci_ops.h>
7
Julius Werner18ea2d32014-10-07 16:42:17 -07008#include <soc/pci_devs.h>
9#include <soc/ramstage.h>
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050010#include "chip.h"
11
Elyes HAOUAS17a3ceb2018-05-22 10:42:28 +020012static void pci_domain_set_resources(struct device *dev)
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050013{
14 assign_resources(dev->link_list);
15}
16
17static struct device_operations pci_domain_ops = {
18 .read_resources = pci_domain_read_resources,
19 .set_resources = pci_domain_set_resources,
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050020 .scan_bus = pci_domain_scan_bus,
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050021};
22
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050023static struct device_operations cpu_bus_ops = {
Edward O'Callaghan0625a8b2014-10-31 08:03:16 +110024 .read_resources = DEVICE_NOOP,
25 .set_resources = DEVICE_NOOP,
26 .enable_resources = DEVICE_NOOP,
Aaron Durbin302cbd62013-10-21 12:36:17 -050027 .init = baytrail_init_cpus,
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050028};
29
30
Elyes HAOUAS17a3ceb2018-05-22 10:42:28 +020031static void enable_dev(struct device *dev)
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050032{
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050033 /* 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;
Aaron Durbind7bc23a2013-10-29 16:37:10 -050038 } else if (dev->path.type == DEVICE_PATH_PCI) {
39 /* Handle south cluster enablement. */
40 if (PCI_SLOT(dev->path.pci.devfn) > GFX_DEV &&
41 (dev->ops == NULL || dev->ops->enable == NULL)) {
42 southcluster_enable_dev(dev);
43 }
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050044 }
45}
46
Aaron Durbin452d31a2013-09-24 16:47:49 -050047/* Called at BS_DEV_INIT_CHIPS time -- very early. Just after BS_PRE_DEVICE. */
48static void soc_init(void *chip_info)
49{
Kein Yuan35110232014-02-22 12:26:55 -080050 baytrail_init_pre_device(chip_info);
Aaron Durbin452d31a2013-09-24 16:47:49 -050051}
52
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050053struct chip_operations soc_intel_baytrail_ops = {
54 CHIP_NAME("Intel BayTrail SoC")
55 .enable_dev = enable_dev,
Aaron Durbin452d31a2013-09-24 16:47:49 -050056 .init = soc_init,
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050057};
Aaron Durbinfda56a62013-09-24 12:29:57 -050058
Aaron Durbinfda56a62013-09-24 12:29:57 -050059struct pci_operations soc_pci_ops = {
Subrata Banik4a0f0712019-03-20 14:29:47 +053060 .set_subsystem = &pci_dev_set_subsystem,
Aaron Durbinfda56a62013-09-24 12:29:57 -050061};