tpm2: introduce _plat__NvInformIndexDataChanged()

This new function is designed to let CR50 know about a change in
a certain TPM NV index.
In this patch, TPM2_NV_WRITE command will notify CR50 about a change
on a given NV index.

BUG=b:148489182
TEST=make

Cq-Depend:chromium:1956159, chromium:2067157
Change-Id: I612a7b5553f67468477fd3a79ade1f5df500eb61
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/tpm2/+/2027027
Tested-by: Namyoon Woo <namyoon@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Namyoon Woo <namyoon@chromium.org>
diff --git a/NVMem.c b/NVMem.c
index 02f9736..8066ac8 100644
--- a/NVMem.c
+++ b/NVMem.c
@@ -343,3 +343,10 @@
 {
     return FALSE;
 }
+
+LIB_EXPORT void
+_plat__NvInformIndexDataChanged(uint32_t handle)
+{
+  /* Do nothing */
+  return;
+}
diff --git a/NV_Write.c b/NV_Write.c
index 40e048b..7d65dfe 100644
--- a/NV_Write.c
+++ b/NV_Write.c
@@ -66,7 +66,11 @@
    // Perform the write. This called routine will SET the TPMA_NV_WRITTEN
    // attribute if it has not already been SET. If NV isn't available, an error
    // will be returned.
-   return NvWriteIndexData(in->nvIndex, &nvIndex, in->offset,
-                           in->data.t.size, in->data.t.buffer);
+   result = NvWriteIndexData(in->nvIndex, &nvIndex, in->offset,
+                             in->data.t.size, in->data.t.buffer);
+
+   _plat__NvInformIndexDataChanged(in->nvIndex);
+
+   return result;
 
 }
diff --git a/Platform.h b/Platform.h
index 966ce82..a0bdeb1 100644
--- a/Platform.h
+++ b/Platform.h
@@ -440,6 +440,10 @@
     void
 );
 
+// A function to inform CR50 that NvIndexData (handle) has been changed.
+LIB_EXPORT void
+_plat__NvInformIndexDataChanged(uint32_t handle);
+
 int uart_printf(const char *format, ...);
 #define ecprintf(format, args...) uart_printf(format, ## args);