From bc0032a8c20d3dadba3eba65e5b6d03743d70170 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Mon, 20 Sep 2021 15:12:56 +0200 Subject: [PATCH] soc/amd/picasso/fsp_m_params: use DEV_PTR to check if device is enabled The aliases are defined in the chipset devicetree, so the device pointers will be available for all boards using this SoC. TEST=None Signed-off-by: Felix Held Change-Id: Id4c921575e978bb29e61f35e78ff2a1711acf06a Reviewed-on: https://review.coreboot.org/c/coreboot/+/57780 Tested-by: build bot (Jenkins) Reviewed-by: Raul Rangel Reviewed-by: Furquan Shaikh --- src/soc/amd/picasso/fsp_m_params.c | 51 ++---------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) diff --git a/src/soc/amd/picasso/fsp_m_params.c b/src/soc/amd/picasso/fsp_m_params.c index 3532fb2c2c..6a5c07425f 100644 --- a/src/soc/amd/picasso/fsp_m_params.c +++ b/src/soc/amd/picasso/fsp_m_params.c @@ -12,53 +12,6 @@ void __weak mainboard_updm_update(FSP_M_CONFIG *mupd) {} -static const struct device_path hda_path[] = { - { - .type = DEVICE_PATH_PCI, - .pci.devfn = PCIE_GPP_A_DEVFN - }, - { - .type = DEVICE_PATH_PCI, - .pci.devfn = HD_AUDIO_DEVFN - }, -}; - -static bool devtree_hda_dev_enabled(void) -{ - const struct device *hda_dev; - - hda_dev = find_dev_nested_path(pci_root_bus(), hda_path, ARRAY_SIZE(hda_path)); - - if (!hda_dev) - return false; - - return hda_dev->enabled; -} - - -static const struct device_path sata_path[] = { - { - .type = DEVICE_PATH_PCI, - .pci.devfn = PCIE_GPP_B_DEVFN - }, - { - .type = DEVICE_PATH_PCI, - .pci.devfn = SATA_DEVFN - }, -}; - -static bool devtree_sata_dev_enabled(void) -{ - const struct device *ahci_dev; - - ahci_dev = find_dev_nested_path(pci_root_bus(), sata_path, ARRAY_SIZE(sata_path)); - - if (!ahci_dev) - return false; - - return ahci_dev->enabled; -} - void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version) { FSP_M_CONFIG *mcfg = &mupd->FspmConfig; @@ -108,8 +61,8 @@ void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version) mcfg->telemetry_vddcr_vdd_offset = config->telemetry_vddcr_vdd_offset; mcfg->telemetry_vddcr_soc_slope_mA = config->telemetry_vddcr_soc_slope_mA; mcfg->telemetry_vddcr_soc_offset = config->telemetry_vddcr_soc_offset; - mcfg->hd_audio_enable = devtree_hda_dev_enabled(); - mcfg->sata_enable = devtree_sata_dev_enabled(); + mcfg->hd_audio_enable = is_dev_enabled(DEV_PTR(hda)); + mcfg->sata_enable = is_dev_enabled(DEV_PTR(sata)); mcfg->hdmi2_disable = config->hdmi2_disable; /* PCIe power vs. speed */