Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Martin Roth | 20646cd | 2023-01-04 21:27:06 -0700 | [diff] [blame] | 3 | /* TODO: Update for Phoenix */ |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 4 | |
Felix Held | e549ee0 | 2024-02-12 22:28:17 +0100 | [diff] [blame^] | 5 | #include <acpi/acpigen_pci.h> |
Felix Held | d9e8263 | 2024-01-26 14:22:31 +0100 | [diff] [blame] | 6 | #include <amdblocks/acpi.h> |
Fred Reitberger | 31e6298 | 2022-10-31 14:18:20 -0400 | [diff] [blame] | 7 | #include <amdblocks/data_fabric.h> |
Felix Held | 4e818c5 | 2024-01-18 21:43:30 +0100 | [diff] [blame] | 8 | #include <amdblocks/fsp.h> |
Felix Held | 416cc66 | 2024-01-31 12:17:58 +0100 | [diff] [blame] | 9 | #include <amdblocks/root_complex.h> |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 10 | #include <console/console.h> |
| 11 | #include <device/device.h> |
| 12 | #include <device/pci.h> |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 13 | #include <soc/cpu.h> |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 14 | #include <soc/pci_devs.h> |
| 15 | #include <soc/southbridge.h> |
| 16 | #include <types.h> |
Felix Held | 5dc8381 | 2024-02-01 20:24:34 +0100 | [diff] [blame] | 17 | #include <vendorcode/amd/opensil/stub/opensil.h> |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 18 | #include "chip.h" |
| 19 | |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 20 | static 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 Roth | 20646cd | 2023-01-04 21:27:06 -0700 | [diff] [blame] | 33 | struct device_operations phoenix_pci_domain_ops = { |
Felix Held | 268dadb | 2023-05-31 16:23:38 +0200 | [diff] [blame] | 34 | .read_resources = amd_pci_domain_read_resources, |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 35 | .set_resources = pci_domain_set_resources, |
Felix Held | 268dadb | 2023-05-31 16:23:38 +0200 | [diff] [blame] | 36 | .scan_bus = amd_pci_domain_scan_bus, |
Felix Held | 416cc66 | 2024-01-31 12:17:58 +0100 | [diff] [blame] | 37 | .init = amd_pci_domain_init, |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 38 | .acpi_name = soc_acpi_name, |
Felix Held | e549ee0 | 2024-02-12 22:28:17 +0100 | [diff] [blame^] | 39 | .acpi_fill_ssdt = pci_domain_fill_ssdt, |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 40 | }; |
| 41 | |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 42 | static void soc_init(void *chip_info) |
| 43 | { |
Felix Held | 1b410d9 | 2024-01-26 14:05:58 +0100 | [diff] [blame] | 44 | default_dev_ops_root.write_acpi_tables = soc_acpi_write_tables; |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 45 | |
Felix Held | 5dc8381 | 2024-02-01 20:24:34 +0100 | [diff] [blame] | 46 | if (CONFIG(PLATFORM_USES_FSP2_0)) { |
Felix Held | 8706d70 | 2024-01-29 14:23:35 +0100 | [diff] [blame] | 47 | amd_fsp_silicon_init(); |
Felix Held | 5dc8381 | 2024-02-01 20:24:34 +0100 | [diff] [blame] | 48 | } else { |
| 49 | setup_opensil(); |
| 50 | opensil_xSIM_timepoint_1(); |
| 51 | } |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 52 | |
Felix Held | 737c8c2 | 2024-02-06 18:42:22 +0100 | [diff] [blame] | 53 | data_fabric_print_mmio_conf(); |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 54 | |
| 55 | fch_init(chip_info); |
| 56 | } |
| 57 | |
| 58 | static void soc_final(void *chip_info) |
| 59 | { |
| 60 | fch_final(chip_info); |
| 61 | } |
| 62 | |
Martin Roth | 20646cd | 2023-01-04 21:27:06 -0700 | [diff] [blame] | 63 | struct chip_operations soc_amd_phoenix_ops = { |
Nicholas Sudsgaard | bfb11be | 2024-01-30 09:53:46 +0900 | [diff] [blame] | 64 | .name = "AMD Phoenix SoC", |
Martin Roth | 1a3de8e | 2022-10-06 15:57:21 -0600 | [diff] [blame] | 65 | .init = soc_init, |
| 66 | .final = soc_final |
| 67 | }; |