From 42583de6b8e2692962e2ec86136fe7ae2b42e162 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Sat, 19 Jun 2021 00:06:02 +0200 Subject: soc/amd/cezanne/fsp_m_params: set HD Audio enable UPD from devicetree Pass the info if the non-graphics HD audio controller device is enabled or disabled in the board's devicetree via a UPD to the FSP so that it knows if it should enable or disable the corresponding device. TEST=When adding "device ref hda on end" to the devicetree of amd/majolica the non-graphics HD Audio controller shows up in lspci and when that line isn't added the PCIe device doesn't show up. Signed-off-by: Felix Held Change-Id: I9f5e164d308906bfc788e5c2674c13c7b2ebf471 Reviewed-on: https://review.coreboot.org/c/coreboot/+/55680 Tested-by: build bot (Jenkins) Reviewed-by: Marshall Dawson --- src/soc/amd/cezanne/fsp_m_params.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/soc') diff --git a/src/soc/amd/cezanne/fsp_m_params.c b/src/soc/amd/cezanne/fsp_m_params.c index 5601568d30..1a0366b4fa 100644 --- a/src/soc/amd/cezanne/fsp_m_params.c +++ b/src/soc/amd/cezanne/fsp_m_params.c @@ -36,6 +36,29 @@ static bool devtree_gfx_hda_dev_enabled(void) return gfx_hda_dev->enabled; } +static const struct device_path hda_path[] = { + { + .type = DEVICE_PATH_PCI, + .pci.devfn = PCIE_ABC_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 sata0_path[] = { { .type = DEVICE_PATH_PCI, @@ -202,6 +225,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->hda_enable = devtree_hda_dev_enabled(); mcfg->sata_enable = devtree_sata_dev_enabled(); if (config->usb_phy_custom) -- cgit v1.2.3