summaryrefslogtreecommitdiff
path: root/src/include/tss/tss_error_basics.h
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2012-11-25 14:36:20 +0000
committerIgor Pashev <pashev.igor@gmail.com>2012-11-25 14:36:20 +0000
commitc3649a2def02c41d837ae1f79dda729ccb91e677 (patch)
treebea46dff212fdef977fe9094a70a939e8cc21885 /src/include/tss/tss_error_basics.h
downloadtrousers-upstream.tar.gz
Imported Upstream version 0.3.9upstream/0.3.9upstream
Diffstat (limited to 'src/include/tss/tss_error_basics.h')
-rw-r--r--src/include/tss/tss_error_basics.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/include/tss/tss_error_basics.h b/src/include/tss/tss_error_basics.h
new file mode 100644
index 0000000..b9e965c
--- /dev/null
+++ b/src/include/tss/tss_error_basics.h
@@ -0,0 +1,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__
+