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 <amdblocks/aoac.h>
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <device/pci.h>
7 #include <fsp/api.h>
8 #include <soc/acpi.h>
9 #include <soc/aoac_defs.h>
10 #include <soc/cpu.h>
11 #include <soc/data_fabric.h>
12 #include <soc/pci_devs.h>
13 #include <soc/southbridge.h>
14 #include <types.h>
15 #include "chip.h"
16 
17 /* Supplied by i2c.c */
19 /* Supplied by uart.c */
21 
24  .set_resources = noop_set_resources,
25  .init = mp_cpu_bus_init,
26  .acpi_fill_ssdt = generate_cpu_entries,
27 };
28 
29 static const char *soc_acpi_name(const struct device *dev)
30 {
31  if (dev->path.type == DEVICE_PATH_DOMAIN)
32  return "PCI0";
33 
34  if (dev->path.type != DEVICE_PATH_PCI)
35  return NULL;
36 
37  printk(BIOS_WARNING, "Unknown PCI device: dev: %d, fn: %d\n",
38  PCI_SLOT(dev->path.pci.devfn), PCI_FUNC(dev->path.pci.devfn));
39  return NULL;
40 };
41 
42 static struct device_operations pci_domain_ops = {
44  .set_resources = pci_domain_set_resources,
45  .scan_bus = pci_domain_scan_bus,
46  .acpi_name = soc_acpi_name,
47 };
48 
49 static void set_mmio_dev_ops(struct device *dev)
50 {
51  switch (dev->path.mmio.addr) {
52  case APU_I2C0_BASE:
53  case APU_I2C1_BASE:
54  case APU_I2C2_BASE:
55  case APU_I2C3_BASE:
56  dev->ops = &soc_amd_i2c_mmio_ops;
57  break;
58  case APU_UART0_BASE:
59  case APU_UART1_BASE:
60  dev->ops = &cezanne_uart_mmio_ops;
61  break;
62  case APU_EMMC_BASE:
63  if (!dev->enabled)
65  break;
66  }
67 }
68 
69 static void enable_dev(struct device *dev)
70 {
71  /* Set the operations if it is a special bus type */
72  switch (dev->path.type) {
73  case DEVICE_PATH_DOMAIN:
74  dev->ops = &pci_domain_ops;
75  break;
77  dev->ops = &cpu_bus_ops;
78  break;
79  case DEVICE_PATH_MMIO:
80  set_mmio_dev_ops(dev);
81  break;
82  default:
83  break;
84  }
85 }
86 
87 static void soc_init(void *chip_info)
88 {
90 
92 
94 
95  fch_init(chip_info);
96 }
97 
98 static void soc_final(void *chip_info)
99 {
100  fch_final(chip_info);
101 }
102 
104  CHIP_NAME("AMD Cezanne SoC")
105  .enable_dev = enable_dev,
106  .init = soc_init,
107  .final = soc_final
108 };
#define APU_UART0_BASE
Definition: iomap.h:19
#define APU_I2C0_BASE
Definition: iomap.h:14
#define APU_I2C3_BASE
Definition: iomap.h:17
#define APU_UART1_BASE
Definition: iomap.h:20
#define APU_I2C2_BASE
Definition: iomap.h:16
#define APU_I2C1_BASE
Definition: iomap.h:15
void data_fabric_set_mmio_np(void)
Definition: data_fabric.c:15
void fch_init(void *chip_info)
Definition: fch.c:290
void fch_final(void *chip_info)
Definition: fch.c:304
#define FCH_AOAC_DEV_EMMC
Definition: aoac_defs.h:18
void power_off_aoac_device(unsigned int dev)
Definition: aoac.c:17
#define printk(level,...)
Definition: stdlib.h:16
void generate_cpu_entries(const struct device *device)
Definition: acpi.c:334
void fsp_silicon_init(void)
Definition: silicon_init.c:242
#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 BIOS_WARNING
BIOS_WARNING - Bad configuration.
Definition: loglevel.h:86
static unsigned long agesa_write_acpi_tables(const struct device *device, unsigned long current, acpi_rsdp_t *rsdp)
Definition: northbridge.c:701
@ DEVICE_PATH_PCI
Definition: path.h:9
@ DEVICE_PATH_CPU_CLUSTER
Definition: path.h:14
@ DEVICE_PATH_DOMAIN
Definition: path.h:13
@ DEVICE_PATH_MMIO
Definition: path.h:21
#define PCI_FUNC(devfn)
Definition: pci_def.h:550
#define PCI_SLOT(devfn)
Definition: pci_def.h:549
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 default_dev_ops_root
Default device operation for root device.
Definition: root_device.c:123
struct device_operations cpu_bus_ops
Definition: chip.c:22
static struct device_operations pci_domain_ops
Definition: chip.c:42
struct device_operations soc_amd_i2c_mmio_ops
Definition: i2c.c:123
static void enable_dev(struct device *dev)
Definition: chip.c:69
struct device_operations cezanne_uart_mmio_ops
Definition: uart.c:93
static void soc_init(void *chip_info)
Definition: chip.c:87
struct chip_operations soc_amd_cezanne_ops
Definition: chip.c:103
static const char * soc_acpi_name(const struct device *dev)
Definition: chip.c:29
static void set_mmio_dev_ops(struct device *dev)
Definition: chip.c:49
static void soc_final(void *chip_info)
Definition: chip.c:98
#define NULL
Definition: stddef.h:19
void(* read_resources)(struct device *dev)
Definition: device.h:39
struct mmio_path mmio
Definition: path.h:128
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 enabled
Definition: device.h:122
uintptr_t addr
Definition: path.h:106
unsigned int devfn
Definition: path.h:54