blob: f45e7b8a6bd79e1a21a9aad87d3a2a7fd5eca2fe [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 Heldd9e82632024-01-26 14:22:31 +01005#include <amdblocks/acpi.h>
Fred Reitberger31e62982022-10-31 14:18:20 -04006#include <amdblocks/data_fabric.h>
Felix Held4e818c52024-01-18 21:43:30 +01007#include <amdblocks/fsp.h>
Felix Held416cc662024-01-31 12:17:58 +01008#include <amdblocks/root_complex.h>
Martin Roth1a3de8e2022-10-06 15:57:21 -06009#include <console/console.h>
10#include <device/device.h>
11#include <device/pci.h>
Martin Roth1a3de8e2022-10-06 15:57:21 -060012#include <soc/cpu.h>
Martin Roth1a3de8e2022-10-06 15:57:21 -060013#include <soc/pci_devs.h>
14#include <soc/southbridge.h>
15#include <types.h>
Felix Held5dc83812024-02-01 20:24:34 +010016#include <vendorcode/amd/opensil/stub/opensil.h>
Martin Roth1a3de8e2022-10-06 15:57:21 -060017#include "chip.h"
18
Martin Roth1a3de8e2022-10-06 15:57:21 -060019static const char *soc_acpi_name(const struct device *dev)
20{
21 if (dev->path.type == DEVICE_PATH_DOMAIN)
22 return "PCI0";
23
24 if (dev->path.type != DEVICE_PATH_PCI)
25 return NULL;
26
27 printk(BIOS_WARNING, "Unknown PCI device: dev: %d, fn: %d\n",
28 PCI_SLOT(dev->path.pci.devfn), PCI_FUNC(dev->path.pci.devfn));
29 return NULL;
30};
31
Martin Roth20646cd2023-01-04 21:27:06 -070032struct device_operations phoenix_pci_domain_ops = {
Felix Held268dadb2023-05-31 16:23:38 +020033 .read_resources = amd_pci_domain_read_resources,
Martin Roth1a3de8e2022-10-06 15:57:21 -060034 .set_resources = pci_domain_set_resources,
Felix Held268dadb2023-05-31 16:23:38 +020035 .scan_bus = amd_pci_domain_scan_bus,
Felix Held416cc662024-01-31 12:17:58 +010036 .init = amd_pci_domain_init,
Martin Roth1a3de8e2022-10-06 15:57:21 -060037 .acpi_name = soc_acpi_name,
Felix Held268dadb2023-05-31 16:23:38 +020038 .acpi_fill_ssdt = amd_pci_domain_fill_ssdt,
Martin Roth1a3de8e2022-10-06 15:57:21 -060039};
40
Martin Roth1a3de8e2022-10-06 15:57:21 -060041static void soc_init(void *chip_info)
42{
Felix Held1b410d92024-01-26 14:05:58 +010043 default_dev_ops_root.write_acpi_tables = soc_acpi_write_tables;
Martin Roth1a3de8e2022-10-06 15:57:21 -060044
Felix Held5dc83812024-02-01 20:24:34 +010045 if (CONFIG(PLATFORM_USES_FSP2_0)) {
Felix Held8706d702024-01-29 14:23:35 +010046 amd_fsp_silicon_init();
Felix Held5dc83812024-02-01 20:24:34 +010047 } else {
48 setup_opensil();
49 opensil_xSIM_timepoint_1();
50 }
Martin Roth1a3de8e2022-10-06 15:57:21 -060051
Felix Held737c8c22024-02-06 18:42:22 +010052 data_fabric_print_mmio_conf();
Martin Roth1a3de8e2022-10-06 15:57:21 -060053
54 fch_init(chip_info);
55}
56
57static void soc_final(void *chip_info)
58{
59 fch_final(chip_info);
60}
61
Martin Roth20646cd2023-01-04 21:27:06 -070062struct chip_operations soc_amd_phoenix_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090063 .name = "AMD Phoenix SoC",
Martin Roth1a3de8e2022-10-06 15:57:21 -060064 .init = soc_init,
65 .final = soc_final
66};