1 /*++
2 
3 Basic defines for TSS error return codes
4 
5 --*/
6 
7 #ifndef __TSS_ERROR_BASICS_H__
8 #define __TSS_ERROR_BASICS_H__
9 
10 
11 //
12 // definitions for the various TSS-SW layers
13 //
14 #ifndef TSS_LAYER_TPM
15 #define TSS_LAYER_TPM   0x0000L     // definition for TPM layer
16 #endif // TSS_LAYER_TPM
17 
18 #define TSS_LAYER_TDDL   0x1000L     // definition for TDDL layer
19 #define TSS_LAYER_TCS   0x2000L     // definition for TCS layer
20 
21 #ifndef TSS_LAYER_TSP
22 #define TSS_LAYER_TSP   0x3000L     // definition for TSP layer
23 #endif // TSS_LAYER_TSP
24 
25 
26 //
27 // definitions for the start points of layer specific error codes
28 //
29 #ifndef TSS_COMMON_OFFSET
30 #define TSS_COMMON_OFFSET   0x000L
31 #endif // TSS_COMMON_OFFSET
32 
33 #define TSS_TDDL_OFFSET    0x080L
34 #define TSS_TCSI_OFFSET    0x0C0L
35 
36 #ifndef TSS_TSPI_OFFSET
37 #define TSS_TSPI_OFFSET    0x100L
38 #endif // TSS_TSPI_OFFSET
39 
40 #ifndef TSS_VENDOR_OFFSET
41 #define TSS_VENDOR_OFFSET   0x800L
42 #endif // TSS_VENDOR_OFFSET
43 
44 // do not exceed TSS_MAX_ERROR for vendor specific code values:
45 #ifndef TSS_MAX_ERROR
46 #define TSS_MAX_ERROR    0xFFFL
47 #endif // TSS_MAX_ERROR
48 
49 
50 /* Macros for the construction and interpretation of error codes */
51 #define TPM_ERROR(code)        (code)
52 #define TDDL_ERROR(code)       ((code) ? (TSS_LAYER_TDDL | (code)) : (code))
53 #define TCS_ERROR(code)        ((code) ? (TSS_LAYER_TCS | (code)) : (code))
54 #define TSP_ERROR(code)        ((code) ? (TSS_LAYER_TSP | (code)) : (code))
55 #define ERROR_LAYER(error)     ((error) & 0xf000)
56 #define ERROR_CODE(error)      ((error) & 0x0fff)
57 
58 #endif // __TSS_ERROR_BASICS_H__
59 
60