blob: a88468b28d8054222bd85a521f572c018a5f0619 [file] [log] [blame]
Martin Roth1a3de8e2022-10-06 15:57:21 -06001/* SPDX-License-Identifier: GPL-2.0-only */
2
Martin Roth20646cd2023-01-04 21:27:06 -07003/* TODO: Update for Phoenix */
Martin Roth1a3de8e2022-10-06 15:57:21 -06004
Felix Helde549ee02024-02-12 22:28:17 +01005#include <acpi/acpigen_pci.h>
Felix Heldd9e82632024-01-26 14:22:31 +01006#include <amdblocks/acpi.h>
Fred Reitberger31e62982022-10-31 14:18:20 -04007#include <amdblocks/data_fabric.h>
Felix Held4e818c52024-01-18 21:43:30 +01008#include <amdblocks/fsp.h>
Felix Held416cc662024-01-31 12:17:58 +01009#include <amdblocks/root_complex.h>
Martin Roth1a3de8e2022-10-06 15:57:21 -060010#include <console/console.h>
11#include <device/device.h>
12#include <device/pci.h>
Martin Roth1a3de8e2022-10-06 15:57:21 -060013#include <soc/cpu.h>
Martin Roth1a3de8e2022-10-06 15:57:21 -060014#include <soc/pci_devs.h>
15#include <soc/southbridge.h>
16#include <types.h>
Felix Held5dc83812024-02-01 20:24:34 +010017#include <vendorcode/amd/opensil/stub/opensil.h>
Martin Roth1a3de8e2022-10-06 15:57:21 -060018#include "chip.h"
19
Martin Roth1a3de8e2022-10-06 15:57:21 -060020static const char *soc_acpi_name(const struct device *dev)
21{
22 if (dev->path.type == DEVICE_PATH_DOMAIN)
23 return "PCI0";
24
25 if (dev->path.type != DEVICE_PATH_PCI)
26 return NULL;
27
28 printk(BIOS_WARNING, "Unknown PCI device: dev: %d, fn: %d\n",
29 PCI_SLOT(dev->path.pci.devfn), PCI_FUNC(dev->path.pci.devfn));
30 return NULL;
31};
32
Martin Roth20646cd2023-01-04 21:27:06 -070033struct device_operations phoenix_pci_domain_ops = {
Felix Held268dadb2023-05-31 16:23:38 +020034 .read_resources = amd_pci_domain_read_resources,
Martin Roth1a3de8e2022-10-06 15:57:21 -060035 .set_resources = pci_domain_set_resources,
Felix Held268dadb2023-05-31 16:23:38 +020036 .scan_bus = amd_pci_domain_scan_bus,
Felix Held416cc662024-01-31 12:17:58 +010037 .init = amd_pci_domain_init,
Martin Roth1a3de8e2022-10-06 15:57:21 -060038 .acpi_name = soc_acpi_name,
Felix Helde549ee02024-02-12 22:28:17 +010039 .acpi_fill_ssdt = pci_domain_fill_ssdt,
Martin Roth1a3de8e2022-10-06 15:57:21 -060040};
41
Martin Roth1a3de8e2022-10-06 15:57:21 -060042static void soc_init(void *chip_info)
43{
Felix Held1b410d92024-01-26 14:05:58 +010044 default_dev_ops_root.write_acpi_tables = soc_acpi_write_tables;
Martin Roth1a3de8e2022-10-06 15:57:21 -060045
Felix Held5dc83812024-02-01 20:24:34 +010046 if (CONFIG(PLATFORM_USES_FSP2_0)) {
Felix Held8706d702024-01-29 14:23:35 +010047 amd_fsp_silicon_init();
Felix Held5dc83812024-02-01 20:24:34 +010048 } else {
49 setup_opensil();
50 opensil_xSIM_timepoint_1();
51 }
Martin Roth1a3de8e2022-10-06 15:57:21 -060052
Felix Held737c8c22024-02-06 18:42:22 +010053 data_fabric_print_mmio_conf();
Martin Roth1a3de8e2022-10-06 15:57:21 -060054
55 fch_init(chip_info);
56}
57
58static void soc_final(void *chip_info)
59{
60 fch_final(chip_info);
61}
62
Martin Roth20646cd2023-01-04 21:27:06 -070063struct chip_operations soc_amd_phoenix_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090064 .name = "AMD Phoenix SoC",
Martin Roth1a3de8e2022-10-06 15:57:21 -060065 .init = soc_init,
66 .final = soc_final
67};