g: add stream sniffing for DUT spiflash content.

Use the stream signing mechanism to hook outgoing spiflash content.
This is (only?) used by Mn50 during chip production flows.

BUG=None
BRANCH=none
TEST=make buildall -j8
Signed-off-by: mschilder@google.com

Change-Id: Iccfee173865f587f088a31fcbc7b939823884c31
Reviewed-on: https://chromium-review.googlesource.com/981892
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
Marius Schilder
2018-03-26 22:15:14 -07:00
committed by chrome-bot
parent e23e0cf3c0
commit 62cd2cb56c

View File

@@ -12,6 +12,10 @@
#include "timer.h"
#include "util.h"
#ifdef CONFIG_STREAM_SIGNATURE
#include "signing.h"
#endif
/* Not defined in the hardware register spec, the RX and TX buffers are 128B. */
#define SPI_BUF_SIZE 0x80
@@ -69,6 +73,13 @@ int spi_transaction(const struct spi_device_t *spi_device,
/* Grab the port's mutex. */
mutex_lock(&spi_mutex[port]);
#ifdef CONFIG_STREAM_SIGNATURE
/*
* This hook allows mn50 to sniff data written to target
* manufactured H1 devices.
*/
sig_append(stream_spiflash, txdata, txlen);
#endif
/* Copy the txdata into the 128B Transmit Buffer. */
memmove((uint8_t *)GREG32_ADDR_I(SPI, port, TX_DATA), txdata, txlen);