ia64/xen-unstable

view tools/vtpm_manager/manager/vtpm_manager.h @ 8977:f84d5cdd9895

Clean up segment selector fixup and validation.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Feb 23 14:43:45 2006 +0100 (2006-02-23)
parents 3399f4b9396a
children 72ef14e79cc0
line source
1 // ===================================================================
2 //
3 // Copyright (c) 2005, Intel Corp.
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions
8 // are met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following
14 // disclaimer in the documentation and/or other materials provided
15 // with the distribution.
16 // * Neither the name of Intel Corporation nor the names of its
17 // contributors may be used to endorse or promote products derived
18 // from this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31 // OF THE POSSIBILITY OF SUCH DAMAGE.
32 // ===================================================================
33 //
34 // vtpm_manager.h
35 //
36 // Public Interface header for VTPM Manager
37 //
38 // ==================================================================
40 #ifndef __VTPM_MANAGER_H__
41 #define __VTPM_MANAGER_H__
43 #include "tcg.h"
45 #define VTPM_TAG_REQ 0x01c1
46 #define VTPM_TAG_RSP 0x01c4
47 #define COMMAND_BUFFER_SIZE 4096
49 // Header sizes. Note Header MAY include the DMI
50 #define VTPM_COMMAND_HEADER_SIZE_SRV ( sizeof(UINT32) + sizeof(TPM_TAG) + sizeof(UINT32) + sizeof(TPM_COMMAND_CODE))
51 #define VTPM_COMMAND_HEADER_SIZE_CLT ( sizeof(TPM_TAG) + sizeof(UINT32) + sizeof(TPM_COMMAND_CODE))
53 // ********************** Public Functions *************************
54 TPM_RESULT VTPM_Init_Service(); // Start VTPM Service
55 void VTPM_Stop_Service(); // Stop VTPM Service
56 #ifdef VTPM_MULTI_VM
57 int VTPM_Service_Handler();
58 #else
59 void *VTPM_Service_Handler(void *threadTypePtr);
60 #endif
62 //************************ Command Codes ****************************
63 #define VTPM_ORD_OPEN 1 // ULM Creates New DMI
64 #define VTPM_ORD_CLOSE 2 // ULM Closes a DMI
65 #define VTPM_ORD_DELETE 3 // ULM Permemently Deletes DMI
66 #define VTPM_ORD_SAVENVM 4 // DMI requests Secrets Unseal
67 #define VTPM_ORD_LOADNVM 5 // DMI requests Secrets Saved
68 #define VTPM_ORD_TPMCOMMAND 6 // DMI issues HW TPM Command
70 //************************ Return Codes ****************************
71 #define VTPM_SUCCESS 0
72 #define VTPM_FAIL 1
73 #define VTPM_UNSUPPORTED 2
74 #define VTPM_FORBIDDEN 3
75 #define VTPM_RESTORE_CONTEXT_FAILED 4
76 #define VTPM_INVALID_REQUEST 5
78 /******************* Command Parameter API *************************
80 VTPM Command Format
81 dmi: 4 bytes // Source of message.
82 // WARNING: This is prepended by the channel.
83 // Thus it is received by VTPM Manager,
84 // but not sent by DMI
85 tpm tag: 2 bytes
86 command size: 4 bytes // Size of command including header but not DMI
87 ord: 4 bytes // Command ordinal above
88 parameters: size - 10 bytes // Command Parameter
90 VTPM Response Format
91 tpm tag: 2 bytes
92 response_size: 4 bytes
93 status: 4 bytes
94 parameters: size - 10 bytes
97 VTPM_Open:
98 Input Parameters:
99 Domain_type: 1 byte
100 domain_id: 4 bytes
101 instance_id: 4 bytes
102 Output Parameters:
103 None
105 VTPM_Close
106 Input Parameters:
107 instance_id: 4 bytes
108 Output Parameters:
109 None
111 VTPM_Delete
112 Input Parameters:
113 instance_id: 4 bytes
114 Output Parameters:
115 None
117 VTPM_SaveNVM
118 Input Parameters:
119 data: n bytes (Header indicates size of data)
120 Output Parameters:
121 None
123 VTPM_LoadNVM
124 Input Parameters:
125 None
126 Output Parameters:
127 data: n bytes (Header indicates size of data)
129 VTPM_TPMCommand
130 Input Parameters:
131 TPM Command Byte Stream: n bytes
132 Output Parameters:
133 TPM Reponse Byte Stream: n bytes
135 *********************************************************************/
137 #endif //_VTPM_MANAGER_H_