summaryrefslogtreecommitdiff
path: root/src/include/tss/tss_error_basics.h
blob: b9e965ca5c1d7108861863f1985effcf5021ebf5 (plain)
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
52
53
54
55
56
57
58
59
/*++

Basic defines for TSS error return codes
 
--*/

#ifndef __TSS_ERROR_BASICS_H__
#define __TSS_ERROR_BASICS_H__


//
// definitions for the various TSS-SW layers
//
#ifndef TSS_LAYER_TPM
#define TSS_LAYER_TPM   0x0000L     // definition for TPM layer
#endif // TSS_LAYER_TPM

#define TSS_LAYER_TDDL   0x1000L     // definition for TDDL layer
#define TSS_LAYER_TCS   0x2000L     // definition for TCS layer

#ifndef TSS_LAYER_TSP
#define TSS_LAYER_TSP   0x3000L     // definition for TSP layer
#endif // TSS_LAYER_TSP


//
// definitions for the start points of layer specific error codes
//
#ifndef TSS_COMMON_OFFSET
#define TSS_COMMON_OFFSET   0x000L     
#endif // TSS_COMMON_OFFSET

#define TSS_TDDL_OFFSET    0x080L     
#define TSS_TCSI_OFFSET    0x0C0L     

#ifndef TSS_TSPI_OFFSET
#define TSS_TSPI_OFFSET    0x100L     
#endif // TSS_TSPI_OFFSET

#ifndef TSS_VENDOR_OFFSET
#define TSS_VENDOR_OFFSET   0x800L       
#endif // TSS_VENDOR_OFFSET
 
// do not exceed TSS_MAX_ERROR for vendor specific code values:               
#ifndef TSS_MAX_ERROR              
#define TSS_MAX_ERROR    0xFFFL 
#endif // TSS_MAX_ERROR


/* Macros for the construction and interpretation of error codes */
#define TPM_ERROR(code)        (code)
#define TDDL_ERROR(code)       ((code) ? (TSS_LAYER_TDDL | (code)) : (code))
#define TCS_ERROR(code)        ((code) ? (TSS_LAYER_TCS | (code)) : (code))
#define TSP_ERROR(code)        ((code) ? (TSS_LAYER_TSP | (code)) : (code))
#define ERROR_LAYER(error)     ((error) & 0xf000)
#define ERROR_CODE(error)      ((error) & 0x0fff)

#endif // __TSS_ERROR_BASICS_H__