| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
#ifndef __DRIVERS_TPM_SLB9635_I2C_TPM_H__ |
| 13 |
#define __DRIVERS_TPM_SLB9635_I2C_TPM_H__ |
| 14 |
|
| 15 |
#include <security/tpm/tis.h> |
| 16 |
#include <security/tpm/tss_errors.h> |
| 17 |
#include <stdint.h> |
| 18 |
|
| 19 |
enum tpm_timeout { |
| 20 |
TPM_TIMEOUT = 1, |
| 21 |
}; |
| 22 |
|
| 23 |
|
| 24 |
#define TPM_BUFSIZE 1260 |
| 25 |
|
| 26 |
|
| 27 |
#define TPM_HEADER_SIZE 10 |
| 28 |
|
| 29 |
|
| 30 |
#define TPM_CMD_SIZE_BYTE 2 |
| 31 |
#define TPM_CMD_ORDINAL_BYTE 6 |
| 32 |
|
| 33 |
|
| 34 |
#define TPM_RSP_SIZE_BYTE 2 |
| 35 |
#define TPM_RSP_RC_BYTE 6 |
| 36 |
|
| 37 |
#define TPM_ACCESS(l) (0x0000 | ((l) << 4)) |
| 38 |
#define TPM_STS(l) (0x0001 | ((l) << 4)) |
| 39 |
#define TPM_DATA_FIFO(l) (0x0005 | ((l) << 4)) |
| 40 |
#define TPM_DID_VID(l) (0x0006 | ((l) << 4)) |
| 41 |
|
| 42 |
struct tpm_chip { |
| 43 |
uint8_t req_complete_mask; |
| 44 |
uint8_t req_complete_val; |
| 45 |
uint8_t req_canceled; |
| 46 |
|
| 47 |
int (*recv)(uint8_t *buf, size_t len); |
| 48 |
int (*send)(uint8_t *buf, size_t len); |
| 49 |
void (*cancel)(void); |
| 50 |
uint8_t (*status)(void); |
| 51 |
}; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
tpm_result_t tpm_vendor_probe(unsigned int bus, uint32_t addr, enum tpm_family *family); |
| 56 |
|
| 57 |
tpm_result_t tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr); |
| 58 |
|
| 59 |
tis_sendrecv_fn i2c_tis_probe(enum tpm_family *family); |
| 60 |
|
| 61 |
#endif |