-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtis.h
51 lines (41 loc) · 1.18 KB
/
tis.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Copyright (c) 2019 Apertus Solutions, LLC
*
* Author(s):
* Daniel P. Smith <dpsmith@apertussolutions.com>
*
* The definitions in this header are extracted from the Trusted Computing
* Group's "TPM Main Specification", Parts 1-3.
*
*/
#ifndef _TIS_H
#define _TIS_H
#ifdef LINUX_USERSPACE
#include <sys/types.h>
#endif
#include "tpm.h"
#include "tpm_common.h"
/* macros to access registers at locality ’’l’’ */
#define ACCESS(l) (0x0000 | ((l) << 12))
#define STS(l) (0x0018 | ((l) << 12))
#define DATA_FIFO(l) (0x0024 | ((l) << 12))
#define DID_VID(l) (0x0F00 | ((l) << 12))
/* access bits */
#define ACCESS_ACTIVE_LOCALITY 0x20 /* (R)*/
#define ACCESS_RELINQUISH_LOCALITY 0x20 /* (W) */
#define ACCESS_REQUEST_USE 0x02 /* (W) */
/* status bits */
#define STS_VALID 0x80 /* (R) */
#define STS_COMMAND_READY 0x40 /* (R) */
#define STS_DATA_AVAIL 0x10 /* (R) */
#define STS_DATA_EXPECT 0x08 /* (R) */
#define STS_GO 0x20 /* (W) */
static inline bool tis_data_available(int locality)
{
int status;
status = tpm_read8(STS(locality));
return ((status & (STS_DATA_AVAIL | STS_VALID)) ==
(STS_DATA_AVAIL | STS_VALID));
}
u8 tis_init(struct tpm *t);
#endif