Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/85455?usp=email )
Change subject: soc/intel/cmn/pmc: Retrieve SoC QDF information via PMC IPC ......................................................................
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 subratabanik@google.com --- M src/soc/intel/common/block/include/intelblocks/pmclib.h M src/soc/intel/common/block/pmc/pmclib.c 2 files changed, 29 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/55/85455/1
diff --git a/src/soc/intel/common/block/include/intelblocks/pmclib.h b/src/soc/intel/common/block/include/intelblocks/pmclib.h index 18d1b4d..5423865 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_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 c51a960..0fadd6e 100644 --- a/src/soc/intel/common/block/pmc/pmclib.c +++ b/src/soc/intel/common/block/pmc/pmclib.c @@ -934,20 +934,16 @@ 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 @@ 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 @@ 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); }