aboutsummaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2016-09-19 16:37:46 -0700
committerPatrick Georgi <pgeorgi@google.com>2016-09-21 10:02:59 +0200
commit3727a8d909c0323eaf21076fd5e327757911ca10 (patch)
tree02aaf50d7497eab62e72c02da7d995cba7bf2ac9 /src/drivers
parent2ea13c8699dc27a7a0ed2874c20508a6a59a201f (diff)
drivers/i2c/tpm/cr50: Reduce max buffer size
Reduce the static buffer size from the generic default 1260 down to 64 to match the max FIFO size for the cr50 hardware and reduce the footprint of the driver. BUG=chrome-os-partner:53336 Change-Id: I6f9f71d501b60299edad4b16cc553a85391a1866 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://review.coreboot.org/16664 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/i2c/tpm/cr50.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/drivers/i2c/tpm/cr50.c b/src/drivers/i2c/tpm/cr50.c
index 419ac1e68f..1190262100 100644
--- a/src/drivers/i2c/tpm/cr50.c
+++ b/src/drivers/i2c/tpm/cr50.c
@@ -41,19 +41,19 @@
#include <timer.h>
#include "tpm.h"
-#define CR50_MAX_BURSTCOUNT 63
#define SLEEP_DURATION 60 /* in usec */
#define SLEEP_DURATION_LONG 210 /* in usec */
#define SLEEP_DURATION_SAFE 750 /* in usec */
#define SLEEP_DURATION_PROBE_MS 1000 /* in msec */
+#define CR50_MAX_BUFSIZE 63
#define CR50_DID_VID 0x00281ae0L
struct tpm_inf_dev {
int bus;
unsigned int addr;
- uint8_t buf[TPM_BUFSIZE + sizeof(uint8_t)];
+ uint8_t buf[CR50_MAX_BUFSIZE + sizeof(uint8_t)];
};
static struct tpm_inf_dev g_tpm_dev CAR_GLOBAL;
@@ -115,7 +115,7 @@ static int iic_tpm_write(uint8_t addr, uint8_t *buffer, size_t len)
if (tpm_dev->addr == 0)
return -1;
- if (len > TPM_BUFSIZE)
+ if (len > CR50_MAX_BUFSIZE)
return -1;
/* Prepend the 'register address' to the buffer */
@@ -226,7 +226,7 @@ static int cr50_wait_burst_status(struct tpm_chip *chip, uint8_t mask,
/* Check if mask matches and burst is valid */
if ((*status & mask) == mask &&
- *burst > 0 && *burst <= CR50_MAX_BURSTCOUNT)
+ *burst > 0 && *burst <= CR50_MAX_BUFSIZE)
return 0;
udelay(SLEEP_DURATION_SAFE);
@@ -310,9 +310,6 @@ static int cr50_tis_i2c_send(struct tpm_chip *chip, uint8_t *buf, size_t len)
uint8_t tpm_go[4] = { TPM_STS_GO };
struct stopwatch sw;
- if (len > TPM_BUFSIZE)
- return -1;
-
stopwatch_init_msecs_expire(&sw, 2000);
/* Wait until TPM is ready for a command */