soc/intel/*: Add debug prints for misaligned FSP and driver settings

Print a warning when the FSP UPD for CNVi Audio Offload is enabled
without the corresponding USB ACPI driver being enabled.

Throw an error when the USB ACPI driver is enabled without the
corresponding UPD being enabled.

Change-Id: I449c43998dd379dc68a33db47a2fe51cfe5cda2f
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84716
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
This commit is contained in:
Sean Rhodes 2024-10-09 20:38:27 +01:00 committed by Martin L Roth
commit d842e94d35
4 changed files with 101 additions and 0 deletions

View file

@ -11,6 +11,7 @@
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <drivers/intel/gma/i915_reg.h>
#include <drivers/usb/acpi/chip.h>
#include <fsp/api.h>
#include <fsp/fsp_debug_event.h>
#include <fsp/fsp_gop_blt.h>
@ -895,6 +896,23 @@ static void fill_fsps_lan_params(FSP_S_CONFIG *s_cfg,
static void fill_fsps_cnvi_params(FSP_S_CONFIG *s_cfg,
const struct soc_intel_alderlake_config *config)
{
struct device *port = NULL;
struct drivers_usb_acpi_config *usb_cfg;
bool usb_audio_offload = false;
/* Search through the devicetree for matching USB devices */
while ((port = dev_find_path(port, DEVICE_PATH_USB)) != NULL) {
/* Skip ports that are not enabled or not of USB type */
if (!port->enabled || port->path.type != DEVICE_PATH_USB)
continue;
usb_cfg = port->chip_info;
if (usb_cfg && usb_cfg->cnvi_bt_audio_offload) {
usb_audio_offload = true;
break;
}
}
/* CNVi */
s_cfg->CnviWifiCore = is_devfn_enabled(PCH_DEVFN_CNVI_WIFI);
s_cfg->CnviMode = is_devfn_enabled(PCH_DEVFN_CNVI_WIFI);
@ -910,6 +928,13 @@ static void fill_fsps_cnvi_params(FSP_S_CONFIG *s_cfg,
s_cfg->CnviBtCore = 0;
s_cfg->CnviBtAudioOffload = 0;
}
if (s_cfg->CnviBtAudioOffload && !usb_audio_offload) {
printk(BIOS_WARNING, "CNVi BT Audio offload enabled but not in USB driver.\n");
}
if (!s_cfg->CnviBtAudioOffload && usb_audio_offload) {
printk(BIOS_ERR, "USB BT Audio offload enabled but CNVi BT offload disabled\n");
usb_cfg->cnvi_bt_audio_offload = 0;
}
}
static void fill_fsps_vmd_params(FSP_S_CONFIG *s_cfg,

View file

@ -4,6 +4,7 @@
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <drivers/usb/acpi/chip.h>
#include <fsp/api.h>
#include <fsp/util.h>
#include <option.h>
@ -529,6 +530,23 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
/* Enable CNVi Wifi if enabled in device tree */
#if CONFIG(SOC_INTEL_COMETLAKE)
struct device *port = NULL;
struct drivers_usb_acpi_config *usb_cfg;
bool usb_audio_offload = false;
/* Search through the devicetree for matching USB devices */
while ((port = dev_find_path(port, DEVICE_PATH_USB)) != NULL) {
/* Skip ports that are not enabled or not of USB type */
if (!port->enabled || port->path.type != DEVICE_PATH_USB)
continue;
usb_cfg = port->chip_info;
if (usb_cfg && usb_cfg->cnvi_bt_audio_offload) {
usb_audio_offload = true;
break;
}
}
/* CNVi */
s_cfg->CnviMode = is_devfn_enabled(PCH_DEVFN_CNViWIFI);
s_cfg->CnviBtCore = config->CnviBtCore;
@ -543,6 +561,13 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
s_cfg->CnviBtCore = 0;
s_cfg->CnviBtAudioOffload = 0;
}
if (s_cfg->CnviBtAudioOffload && !usb_audio_offload) {
printk(BIOS_WARNING, "CNVi BT Audio offload enabled but not in USB driver.\n");
}
if (!s_cfg->CnviBtAudioOffload && usb_audio_offload) {
printk(BIOS_ERR, "USB BT Audio offload enabled but CNVi BT offload disabled\n");
usb_cfg->cnvi_bt_audio_offload = 0;
}
#else
s_cfg->PchCnviMode = is_devfn_enabled(PCH_DEVFN_CNViWIFI);
#endif

View file

@ -9,6 +9,7 @@
#include <cpu/intel/microcode.h>
#include <device/device.h>
#include <device/pci.h>
#include <drivers/usb/acpi/chip.h>
#include <fsp/api.h>
#include <fsp/fsp_debug_event.h>
#include <fsp/fsp_gop_blt.h>
@ -576,6 +577,23 @@ static void fill_fsps_lan_params(FSP_S_CONFIG *s_cfg,
static void fill_fsps_cnvi_params(FSP_S_CONFIG *s_cfg,
const struct soc_intel_meteorlake_config *config)
{
struct device *port = NULL;
struct drivers_usb_acpi_config *usb_cfg;
bool usb_audio_offload = false;
/* Search through the devicetree for matching USB devices */
while ((port = dev_find_path(port, DEVICE_PATH_USB)) != NULL) {
/* Skip ports that are not enabled or not of USB type */
if (!port->enabled || port->path.type != DEVICE_PATH_USB)
continue;
usb_cfg = port->chip_info;
if (usb_cfg && usb_cfg->cnvi_bt_audio_offload) {
usb_audio_offload = true;
break;
}
}
/* CNVi */
s_cfg->CnviMode = is_devfn_enabled(PCI_DEVFN_CNVI_WIFI);
s_cfg->CnviWifiCore = config->cnvi_wifi_core;
@ -594,6 +612,13 @@ static void fill_fsps_cnvi_params(FSP_S_CONFIG *s_cfg,
s_cfg->CnviBtCore = 0;
s_cfg->CnviBtAudioOffload = 0;
}
if (s_cfg->CnviBtAudioOffload && !usb_audio_offload) {
printk(BIOS_WARNING, "CNVi BT Audio offload enabled but not in USB driver\n");
}
if (!s_cfg->CnviBtAudioOffload && usb_audio_offload) {
printk(BIOS_ERR, "USB BT Audio offload enabled but CNVi BT offload disabled\n");
usb_cfg->cnvi_bt_audio_offload = 0;
}
}
static void fill_fsps_vmd_params(FSP_S_CONFIG *s_cfg,

View file

@ -7,6 +7,7 @@
#include <device/pci_ops.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <drivers/usb/acpi/chip.h>
#include <fsp/api.h>
#include <fsp/ppi/mp_service_ppi.h>
#include <fsp/util.h>
@ -493,6 +494,24 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
params->PchLanEnable = is_devfn_enabled(PCH_DEVFN_GBE);
/* CNVi */
struct device *port = NULL;
struct drivers_usb_acpi_config *usb_cfg;
bool usb_audio_offload = false;
/* Search through the devicetree for matching USB devices */
while ((port = dev_find_path(port, DEVICE_PATH_USB)) != NULL) {
/* Skip ports that are not enabled or not of USB type */
if (!port->enabled || port->path.type != DEVICE_PATH_USB)
continue;
usb_cfg = port->chip_info;
if (usb_cfg && usb_cfg->cnvi_bt_audio_offload) {
usb_audio_offload = true;
break;
}
}
params->CnviMode = is_devfn_enabled(PCH_DEVFN_CNVI_WIFI);
params->CnviBtCore = config->CnviBtCore;
params->CnviBtAudioOffload = config->CnviBtAudioOffload;
@ -506,6 +525,13 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
params->CnviBtCore = 0;
params->CnviBtAudioOffload = 0;
}
if (params->CnviBtAudioOffload && !usb_audio_offload) {
printk(BIOS_WARNING, "CNVi BT Audio offload enabled but not in USB driver.\n");
}
if (!params->CnviBtAudioOffload && usb_audio_offload) {
printk(BIOS_ERR, "USB BT Audio offload enabled but CNVi BT offload disabled\n");
usb_cfg->cnvi_bt_audio_offload = 0;
}
/* VMD */
params->VmdEnable = is_devfn_enabled(SA_DEVFN_VMD);