blob: 7d315cbd3b8b99e48da372710e3bc77de0103b5e [file] [log] [blame]
Felix Helddc2d3562020-12-02 14:38:53 +01001/* SPDX-License-Identifier: GPL-2.0-only */
2
Felix Heldd9e82632024-01-26 14:22:31 +01003#include <amdblocks/acpi.h>
Fred Reitberger31e62982022-10-31 14:18:20 -04004#include <amdblocks/data_fabric.h>
Felix Held4e818c52024-01-18 21:43:30 +01005#include <amdblocks/fsp.h>
Felix Held416cc662024-01-31 12:17:58 +01006#include <amdblocks/root_complex.h>
Felix Held51c4d682021-02-16 23:14:42 +01007#include <console/console.h>
Felix Helddc2d3562020-12-02 14:38:53 +01008#include <device/device.h>
Felix Held51c4d682021-02-16 23:14:42 +01009#include <device/pci.h>
Jason Glenesk79542fa2021-03-10 03:50:57 -080010#include <soc/cpu.h>
Felix Held51c4d682021-02-16 23:14:42 +010011#include <soc/pci_devs.h>
Felix Held230dbd62021-01-28 23:40:52 +010012#include <soc/southbridge.h>
Felix Held86c24a22021-01-28 23:07:48 +010013#include <types.h>
Felix Heldc8272782020-12-05 01:39:28 +010014#include "chip.h"
Felix Helddc2d3562020-12-02 14:38:53 +010015
Felix Held51c4d682021-02-16 23:14:42 +010016static const char *soc_acpi_name(const struct device *dev)
17{
18 if (dev->path.type == DEVICE_PATH_DOMAIN)
19 return "PCI0";
20
21 if (dev->path.type != DEVICE_PATH_PCI)
22 return NULL;
23
24 printk(BIOS_WARNING, "Unknown PCI device: dev: %d, fn: %d\n",
25 PCI_SLOT(dev->path.pci.devfn), PCI_FUNC(dev->path.pci.devfn));
26 return NULL;
27};
28
Arthur Heymans7f380772022-09-20 14:03:28 +020029struct device_operations cezanne_pci_domain_ops = {
Felix Held9adc33d2023-05-31 16:08:42 +020030 .read_resources = amd_pci_domain_read_resources,
Felix Held5a7e4a52021-02-05 21:46:53 +010031 .set_resources = pci_domain_set_resources,
Felix Held9adc33d2023-05-31 16:08:42 +020032 .scan_bus = amd_pci_domain_scan_bus,
Felix Held416cc662024-01-31 12:17:58 +010033 .init = amd_pci_domain_init,
Felix Held51c4d682021-02-16 23:14:42 +010034 .acpi_name = soc_acpi_name,
Felix Held9adc33d2023-05-31 16:08:42 +020035 .acpi_fill_ssdt = amd_pci_domain_fill_ssdt,
Felix Held5a7e4a52021-02-05 21:46:53 +010036};
37
Felix Held613f9fc2021-01-26 18:09:46 +010038static void soc_init(void *chip_info)
39{
Felix Held1b410d92024-01-26 14:05:58 +010040 default_dev_ops_root.write_acpi_tables = soc_acpi_write_tables;
Felix Held144c7aa2021-05-04 21:06:04 +020041
Felix Held4e818c52024-01-18 21:43:30 +010042 amd_fsp_silicon_init();
Felix Held230dbd62021-01-28 23:40:52 +010043
Felix Heldea32c522021-02-13 01:42:44 +010044 data_fabric_set_mmio_np();
45
Felix Held230dbd62021-01-28 23:40:52 +010046 fch_init(chip_info);
Felix Held613f9fc2021-01-26 18:09:46 +010047}
48
49static void soc_final(void *chip_info)
50{
Felix Held230dbd62021-01-28 23:40:52 +010051 fch_final(chip_info);
Felix Held613f9fc2021-01-26 18:09:46 +010052}
53
54struct chip_operations soc_amd_cezanne_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090055 .name = "AMD Cezanne SoC",
Felix Held613f9fc2021-01-26 18:09:46 +010056 .init = soc_init,
57 .final = soc_final
58};