UPSTREAM: soc/intel/cmn/cse: Skip sending CSE `get_boot_perf` when CSE hidden

This patch avoids sending the `Get Boot perf` command while booting
with CSE device hidden.

Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63867
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Bora Guvendik <bora.guvendik@intel.com>
Original-Change-Id: I498c14d144295a9bc694b90060ca74c66966d65e
GitOrigin-RevId: 0feef9981428eaa1cb94701d260ba8123dd79c35
Change-Id: I1644a165d0766ecf35a12258a3eb12e8431fd832
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/coreboot/+/3614077
Tested-by: CopyBot Service Account <copybot.service@gmail.com>
Commit-Queue: Ricardo Quesada <ricardoq@chromium.org>
Reviewed-by: Ricardo Quesada <ricardoq@chromium.org>
diff --git a/src/soc/intel/common/block/cse/telemetry.c b/src/soc/intel/common/block/cse/telemetry.c
index 544de80..f3dd7ee 100644
--- a/src/soc/intel/common/block/cse/telemetry.c
+++ b/src/soc/intel/common/block/cse/telemetry.c
@@ -6,7 +6,7 @@
 
 #define MSEC_TO_USEC(x) (x * 1000)
 
-void cse_get_telemetry_data(void)
+static void cbmem_inject_telemetry_data(void)
 {
 	struct cse_boot_perf_rsp cse_perf_data;
 	s64 ts[NUM_CSE_BOOT_PERF_DATA] = {0};
@@ -72,3 +72,14 @@
 	timestamp_add(TS_ME_RECEIVED_CRDA_FROM_PMC,
 		start_stamp + ts[PERF_DATA_PMC_SENT_CRDA]);
 }
+
+void cse_get_telemetry_data(void)
+{
+	/* If CSE is already hidden then accessing CSE registers should be avoided */
+	if (!is_cse_enabled()) {
+		printk(BIOS_DEBUG, "CSE is disabled, not sending `Get Boot Perf` message\n");
+		return;
+	}
+
+	cbmem_inject_telemetry_data();
+}