security/tpm: Drop CAR_GLOBAL_MIGRATION support

Change-Id: I1c09eda6164efb390de4626f52aafba59962f9c4
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/37029
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/security/tpm/tss/tcg-2.0/tss_marshaling.c b/src/security/tpm/tss/tcg-2.0/tss_marshaling.c
index 1bf211a..720e7c4 100644
--- a/src/security/tpm/tss/tcg-2.0/tss_marshaling.c
+++ b/src/security/tpm/tss/tcg-2.0/tss_marshaling.c
@@ -5,7 +5,6 @@
  * found in the LICENSE file.
  */
 
-#include <arch/early_variables.h>
 #include <commonlib/iobuf.h>
 #include <console/console.h>
 #include <stdlib.h>
@@ -15,7 +14,7 @@
 #include <security/tpm/tss/vendor/cr50/cr50.h>
 #include <security/tpm/tss.h>
 
-static uint16_t tpm_tag CAR_GLOBAL;  /* Depends on the command type. */
+static uint16_t tpm_tag;  /* Depends on the command type. */
 
 #define unmarshal_TPM_CAP(a, b) ibuf_read_be32(a, b)
 #define unmarshal_TPM_CC(a, b) ibuf_read_be32(a, b)
@@ -165,7 +164,7 @@
 	struct tpm2_session_header session_header;
 	int rc = 0;
 
-	car_set_var(tpm_tag, TPM_ST_SESSIONS);
+	tpm_tag = TPM_ST_SESSIONS;
 
 	for (i = 0; i < handle_count; i++)
 		rc |= marshal_TPM_HANDLE(ob, handles[i]);
@@ -270,7 +269,7 @@
 	int rc = 0;
 	struct tpm2_session_header session_header;
 
-	car_set_var(tpm_tag, TPM_ST_SESSIONS);
+	tpm_tag = TPM_ST_SESSIONS;
 
 	rc |= marshal_TPM_HANDLE(ob, TPM_RH_PLATFORM);
 	memset(&session_header, 0, sizeof(session_header));
@@ -335,7 +334,7 @@
 	const size_t hdr_sz = sizeof(uint16_t) + 2 * sizeof(uint32_t);
 	int rc = 0;
 
-	car_set_var(tpm_tag, TPM_ST_NO_SESSIONS);
+	tpm_tag = TPM_ST_NO_SESSIONS;
 
 	if (obuf_splice_current(ob, &ob_hdr, hdr_sz) < 0)
 		return -1;
@@ -407,7 +406,7 @@
 		return rc;
 
 	/* Fix up the command header with known values. */
-	rc |= obuf_write_be16(&ob_hdr, car_get_var(tpm_tag));
+	rc |= obuf_write_be16(&ob_hdr, tpm_tag);
 	rc |= obuf_write_be32(&ob_hdr, obuf_nr_written(ob));
 
 	return rc;
@@ -552,23 +551,22 @@
 
 struct tpm2_response *tpm_unmarshal_response(TPM_CC command, struct ibuf *ib)
 {
-	static struct tpm2_response tpm2_static_resp CAR_GLOBAL;
-	struct tpm2_response *tpm2_resp = car_get_var_ptr(&tpm2_static_resp);
+	static struct tpm2_response tpm2_static_resp;
 	int rc = 0;
 
-	rc |= ibuf_read_be16(ib, &tpm2_resp->hdr.tpm_tag);
-	rc |= ibuf_read_be32(ib, &tpm2_resp->hdr.tpm_size);
-	rc |= unmarshal_TPM_CC(ib, &tpm2_resp->hdr.tpm_code);
+	rc |= ibuf_read_be16(ib, &tpm2_static_resp.hdr.tpm_tag);
+	rc |= ibuf_read_be32(ib, &tpm2_static_resp.hdr.tpm_size);
+	rc |= unmarshal_TPM_CC(ib, &tpm2_static_resp.hdr.tpm_code);
 
 	if (rc != 0)
 		return NULL;
 
 	if (ibuf_remaining(ib) == 0) {
-		if (tpm2_resp->hdr.tpm_size != ibuf_nr_read(ib))
+		if (tpm2_static_resp.hdr.tpm_size != ibuf_nr_read(ib))
 			printk(BIOS_ERR,
 			       "%s: size mismatch in response to command %#x\n",
 			       __func__, command);
-		return tpm2_resp;
+		return &tpm2_static_resp;
 	}
 
 	switch (command) {
@@ -577,11 +575,11 @@
 		break;
 
 	case TPM2_GetCapability:
-		rc |= unmarshal_get_capability(ib, &tpm2_resp->gc);
+		rc |= unmarshal_get_capability(ib, &tpm2_static_resp.gc);
 		break;
 
 	case TPM2_NV_Read:
-		rc |= unmarshal_nv_read(ib, &tpm2_resp->nvr);
+		rc |= unmarshal_nv_read(ib, &tpm2_static_resp.nvr);
 		break;
 
 	case TPM2_Hierarchy_Control:
@@ -595,7 +593,7 @@
 		break;
 
 	case TPM2_CR50_VENDOR_COMMAND:
-		rc |= unmarshal_vendor_command(ib, &tpm2_resp->vcr);
+		rc |= unmarshal_vendor_command(ib, &tpm2_static_resp.vcr);
 		break;
 
 	default:
@@ -608,7 +606,7 @@
 			       "Request to unmarshal unexpected command %#x,"
 			       " code %#x",
 			       __func__, __LINE__, command,
-			       tpm2_resp->hdr.tpm_code);
+			       tpm2_static_resp.hdr.tpm_code);
 
 			sz_left = ibuf_remaining(ib);
 			data = ibuf_oob_drain(ib, sz_left);
@@ -627,7 +625,7 @@
 		printk(BIOS_INFO,
 		       "%s:%d got %d bytes back in response to %#x,"
 		       " failed to parse (%zd)\n",
-		       __func__, __LINE__, tpm2_resp->hdr.tpm_size,
+		       __func__, __LINE__, tpm2_static_resp.hdr.tpm_size,
 		       command, ibuf_remaining(ib));
 		return NULL;
 	}
@@ -636,5 +634,5 @@
 					__func__);
 
 	/* The entire message have been parsed. */
-	return tpm2_resp;
+	return &tpm2_static_resp;
 }