coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
chip.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/device.h>
4 #include <device/pci.h>
5 #include <arch/pci_ops.h>
6 
7 #include <soc/pci_devs.h>
8 #include <soc/ramstage.h>
9 #include "chip.h"
10 
11 static struct device_operations pci_domain_ops = {
13  .set_resources = pci_domain_set_resources,
14  .scan_bus = pci_domain_scan_bus,
15 };
16 
17 static struct device_operations cpu_bus_ops = {
19  .set_resources = noop_set_resources,
20  .init = mp_cpu_bus_init,
21 };
22 
23 static void enable_dev(struct device *dev)
24 {
25  /* Set the operations if it is a special bus type */
26  if (dev->path.type == DEVICE_PATH_DOMAIN) {
27  dev->ops = &pci_domain_ops;
28  } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
29  dev->ops = &cpu_bus_ops;
30  } else if (dev->path.type == DEVICE_PATH_PCI) {
31  /* Handle south cluster enablement. */
32  if (PCI_SLOT(dev->path.pci.devfn) > GFX_DEV &&
33  (dev->ops == NULL || dev->ops->enable == NULL)) {
35  }
36  }
37 }
38 
39 /* Called at BS_DEV_INIT_CHIPS time -- very early. Just after BS_PRE_DEVICE. */
40 static void soc_init(void *chip_info)
41 {
42  baytrail_init_pre_device(chip_info);
43 }
44 
46  CHIP_NAME("Intel BayTrail SoC")
47  .enable_dev = enable_dev,
48  .init = soc_init,
49 };
50 
51 struct pci_operations soc_pci_ops = {
52  .set_subsystem = &pci_dev_set_subsystem,
53 };
#define CHIP_NAME(X)
Definition: device.h:32
static void noop_read_resources(struct device *dev)
Standard device operations function pointers shims.
Definition: device.h:73
static void noop_set_resources(struct device *dev)
Definition: device.h:74
static void mp_cpu_bus_init(struct device *dev)
Definition: device.h:240
#define GFX_DEV
Definition: pci_devs.h:11
@ DEVICE_PATH_PCI
Definition: path.h:9
@ DEVICE_PATH_CPU_CLUSTER
Definition: path.h:14
@ DEVICE_PATH_DOMAIN
Definition: path.h:13
#define PCI_SLOT(devfn)
Definition: pci_def.h:549
void pci_dev_set_subsystem(struct device *dev, unsigned int vendor, unsigned int device)
Definition: pci_device.c:791
void pci_domain_read_resources(struct device *dev)
Definition: pci_device.c:547
void pci_domain_set_resources(struct device *dev)
Definition: pci_device.c:564
void pci_domain_scan_bus(struct device *dev)
Scan a PCI domain.
Definition: pci_device.c:1610
struct device_operations cpu_bus_ops
Definition: chip.c:22
struct chip_operations soc_intel_baytrail_ops
Definition: chip.c:45
struct pci_operations soc_pci_ops
Definition: chip.c:51
static struct device_operations pci_domain_ops
Definition: chip.c:11
static void enable_dev(struct device *dev)
Definition: chip.c:23
static void soc_init(void *chip_info)
Definition: chip.c:40
void baytrail_init_pre_device(struct soc_intel_baytrail_config *config)
Definition: ramstage.c:170
void southcluster_enable_dev(struct device *dev)
Definition: southcluster.c:452
#define NULL
Definition: stddef.h:19
void(* read_resources)(struct device *dev)
Definition: device.h:39
void(* enable)(struct device *dev)
Definition: device.h:45
struct pci_path pci
Definition: path.h:116
enum device_path_type type
Definition: path.h:114
Definition: device.h:107
struct device_path path
Definition: device.h:115
struct device_operations * ops
Definition: device.h:143
unsigned int devfn
Definition: path.h:54