From 4b574281f09df6f112a5c302ec3ec9592e6a7e8d Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 3 Dec 2024 23:48:15 +0530 Subject: [PATCH] soc/intel/cmn/pmc: Retrieve SoC QDF information via PMC IPC This commit introduces a new function, `retrieve_soc_qdf_info_via_pmc_ipc()`, to retrieve the SoC QDF information string using the PMC IPC mechanism. This function allows for more flexible use of the SoC QDF information, enabling its use in various data structures like the SMBIOS Type 4 table. The existing `pmc_dump_soc_qdf_info()` function is updated to use this new function to retrieve the QDF information before printing it. TEST=Able to build and boot google/fatcat. Change-Id: I91ccf8aae4be9e9bbcad8ef2f422b88edef66376 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/85455 Tested-by: build bot (Jenkins) Reviewed-by: Christian Walter --- .../common/block/include/intelblocks/pmclib.h | 11 +++++++++ src/soc/intel/common/block/pmc/pmclib.c | 27 ++++++++++++++-------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/soc/intel/common/block/include/intelblocks/pmclib.h b/src/soc/intel/common/block/include/intelblocks/pmclib.h index 18d1b4d234..54238654a6 100644 --- a/src/soc/intel/common/block/include/intelblocks/pmclib.h +++ b/src/soc/intel/common/block/include/intelblocks/pmclib.h @@ -287,4 +287,15 @@ void pmc_set_acpi_mode(void); */ void pmc_dump_soc_qdf_info(void); +/* + * Retrieve SoC QDF information. + * + * This function retrieves the SoC QDF information string, which can be used to + * populate various data structures, such as the SMBIOS Type 4 table for CPU + * identification. + * + * @return A pointer to the SoC QDF information string. + */ +char *retrieve_soc_qdf_info_via_pmc_ipc(void); + #endif /* SOC_INTEL_COMMON_BLOCK_PMCLIB_H */ diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c index c51a960854..0fadd6e409 100644 --- a/src/soc/intel/common/block/pmc/pmclib.c +++ b/src/soc/intel/common/block/pmc/pmclib.c @@ -934,20 +934,16 @@ void pmc_send_bios_reset_pci_enum_done(void) printk(BIOS_ERR, "PMC: Failed sending PCI Enumeration Done Command\n"); } -/* - * This function reads and prints SoC QDF information using PMC interface - * if SOC_QDF_DYNAMIC_READ_PMC config is enabled. - */ -void pmc_dump_soc_qdf_info(void) +char *retrieve_soc_qdf_info_via_pmc_ipc(void) { struct pmc_ipc_buffer req = { 0 }; struct pmc_ipc_buffer rsp; uint32_t cmd_reg; int r; - char qdf_info[5]; + static char qdf_info[5] = { 0 }; if (!CONFIG(SOC_QDF_DYNAMIC_READ_PMC)) - return; + return NULL; req.buf[0] = PMC_IPC_CMD_REGID_SOC_QDF; cmd_reg = pmc_make_ipc_cmd(PMC_IPC_CMD_SOC_REG_ACC, @@ -959,7 +955,7 @@ void pmc_dump_soc_qdf_info(void) if (r < 0 || rsp.buf[0] == 0) { printk(BIOS_ERR, "%s: pmc_send_ipc_cmd failed or QDF not available.\n", __func__); - return; + return NULL; } qdf_info[0] = ((rsp.buf[0] >> 24) & 0xFF); @@ -967,5 +963,18 @@ void pmc_dump_soc_qdf_info(void) qdf_info[2] = ((rsp.buf[0] >> 8) & 0xFF); qdf_info[3] = (rsp.buf[0] & 0xFF); qdf_info[4] = '\0'; - printk(BIOS_INFO, "SoC QDF: %s\n", qdf_info); + + return qdf_info; +} + +/* + * This function reads and prints SoC QDF information using PMC interface + * if SOC_QDF_DYNAMIC_READ_PMC config is enabled. + */ +void pmc_dump_soc_qdf_info(void) +{ + char *qdf = retrieve_soc_qdf_info_via_pmc_ipc(); + + if (qdf != NULL) + printk(BIOS_INFO, "SoC QDF: %s\n", qdf); } -- 2.11.4.GIT