diff --git a/src/soc/amd/cezanne/fsp_m_params.c b/src/soc/amd/cezanne/fsp_m_params.c index 9546721f0e..5601568d30 100644 --- a/src/soc/amd/cezanne/fsp_m_params.c +++ b/src/soc/amd/cezanne/fsp_m_params.c @@ -36,6 +36,41 @@ static bool devtree_gfx_hda_dev_enabled(void) return gfx_hda_dev->enabled; } +static const struct device_path sata0_path[] = { + { + .type = DEVICE_PATH_PCI, + .pci.devfn = PCIE_GPP_B_DEVFN + }, + { + .type = DEVICE_PATH_PCI, + .pci.devfn = SATA0_DEVFN + }, +}; + +static const struct device_path sata1_path[] = { + { + .type = DEVICE_PATH_PCI, + .pci.devfn = PCIE_GPP_B_DEVFN + }, + { + .type = DEVICE_PATH_PCI, + .pci.devfn = SATA1_DEVFN + }, +}; + +static bool devtree_sata_dev_enabled(void) +{ + const struct device *ahci0_dev, *ahci1_dev; + + ahci0_dev = find_dev_nested_path(pci_root_bus(), sata0_path, ARRAY_SIZE(sata0_path)); + ahci1_dev = find_dev_nested_path(pci_root_bus(), sata1_path, ARRAY_SIZE(sata1_path)); + + if (!ahci0_dev || !ahci1_dev) + return false; + + return ahci0_dev->enabled || ahci1_dev->enabled; +} + __weak void mb_pre_fspm(void) { } @@ -167,6 +202,7 @@ void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version) mcfg->pspp_policy = config->pspp_policy; mcfg->enable_nb_azalia = devtree_gfx_hda_dev_enabled(); + mcfg->sata_enable = devtree_sata_dev_enabled(); if (config->usb_phy_custom) mcfg->usb_phy = (struct usb_phy_config *)&config->usb_phy;