tpm: move buffer size definition to common code
authorVadim Bendebury <vbendeb@chromium.org>
Wed, 22 Jun 2016 17:16:02 +0000 (10:16 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Thu, 23 Jun 2016 00:42:01 +0000 (17:42 -0700)
Also change it to match the naming pattern of the other enums of the
group.

BRANCH=none
BUG=chrome-os-partner:50645
TEST=veyron_jaq compiles cleanly

Change-Id: I1b7b25903c20788e8487ab5ebb3ec7c51470fd76
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/354765
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
src/drivers/tpm/slb9635_i2c.c
src/drivers/tpm/slb9635_i2c.h
src/drivers/tpm/tpm.h

index d817ac1..721a0d9 100644 (file)
@@ -155,7 +155,7 @@ static int iic_tpm_write(Slb9635I2c *tpm, uint8_t addr, const uint8_t *buffer,
        int rc = 0;
        int count;
 
-       if (len > MaxTpmBufSize) {
+       if (len > TpmMaxBufSize) {
                printf("%s: Length %zd is too large\n", __func__, len);
                return -1;
        }
@@ -409,7 +409,7 @@ static int tpm_send(I2cTpmChipOps *me, const uint8_t *buf, size_t len)
        size_t count = 0;
        uint8_t sts = TpmStsGo;
 
-       if (len > MaxTpmBufSize)
+       if (len > TpmMaxBufSize)
                return -1; // Command is too long for our tpm, sorry.
 
        status = tpm->base.chip_ops.status(&tpm->base.chip_ops);
index ce21e91..4380250 100644 (file)
 
 #include "drivers/tpm/i2c.h"
 
-enum {
-       MaxTpmBufSize = 1260
-};
-
 enum i2c_chip_type {
        SLB9635,
        SLB9645,
@@ -33,7 +29,7 @@ enum i2c_chip_type {
 typedef struct Slb9635I2c
 {
        I2cTpm base;
-       uint8_t buf[sizeof(uint8_t) + MaxTpmBufSize]; // addr + buff size
+       uint8_t buf[sizeof(uint8_t) + TpmMaxBufSize]; // addr + buff size
        enum i2c_chip_type chip_type;
 } Slb9635I2c;
 
index ea3c02f..89aee66 100644 (file)
@@ -23,7 +23,8 @@
 
 enum {
        TpmCmdCountOffset = 2,
-       TpmCmdOrdinalOffset = 6
+       TpmCmdOrdinalOffset = 6,
+       TpmMaxBufSize = 1260
 };
 
 typedef struct TpmOps