debuggers.hg

view tools/vtpm_manager/manager/vtpm_manager.h @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children
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 #define VTPM_TAG_REQ 0x01c1
44 #define VTPM_TAG_RSP 0x01c4
45 #define COMMAND_BUFFER_SIZE 4096
47 // Header sizes. Note Header MAY include the DMI
48 #define VTPM_COMMAND_HEADER_SIZE_CLT ( 2 + 4 + 4)
49 // sizeof(TPM_TAG + UINT32 + TPM_COMMAND_CODE)
50 #define VTPM_COMMAND_HEADER_SIZE_SRV ( 4 + VTPM_COMMAND_HEADER_SIZE_CLT )
51 // sizeof( UINT32 + VTPM_COMMAND_HEADER_SIZE_CLT)
53 //************************ Command Codes ****************************
54 #define VTPM_ORD_BASE 0x0000
55 #define VTPM_PRIV_MASK 0x01000000 // Priviledged VTPM Command
56 #define VTPM_PRIV_BASE (VTPM_ORD_BASE | VTPM_PRIV_MASK)
58 // Non-priviledged VTPM Commands (From DMI's)
59 #define VTPM_ORD_SAVENVM (VTPM_ORD_BASE + 1) // DMI Saves Secrets
60 #define VTPM_ORD_LOADNVM (VTPM_ORD_BASE + 2) // DMI Loads Secrets
61 #define VTPM_ORD_TPMCOMMAND (VTPM_ORD_BASE + 3) // DMI issues HW TPM Command
62 #define VTPM_ORD_GET_MIG_KEY (VTPM_ORD_BASE + 4) // Get manager's migration key
63 #define VTPM_ORD_LOAD_MIG_KEY (VTPM_ORD_BASE + 5) // load dest migration key
65 // Priviledged VTPM Commands (From management console)
66 #define VTPM_ORD_OPEN (VTPM_PRIV_BASE + 1) // Creates/reopens DMI
67 #define VTPM_ORD_CLOSE (VTPM_PRIV_BASE + 2) // Closes a DMI
68 #define VTPM_ORD_DELETE (VTPM_PRIV_BASE + 3) // Permemently Deletes DMI
69 #define VTPM_ORD_MIGRATE_IN (VTPM_PRIV_BASE + 4) // Load migrated VTPM
70 #define VTPM_ORD_MIGRATE_OUT (VTPM_PRIV_BASE + 5) // migrate VTPM to dest
72 //************************ Return Codes ****************************
73 #define VTPM_TYPE_PVM 1 // Paravirtualized Domain
74 #define VTPM_TYPE_HVM 2 // HVM Domain
76 //************************ Return Codes ****************************
77 #define VTPM_SUCCESS 0
78 #define VTPM_FAIL 1
79 #define VTPM_UNSUPPORTED 2
80 #define VTPM_FORBIDDEN 3
81 #define VTPM_RESTORE_CONTEXT_FAILED 4
82 #define VTPM_INVALID_REQUEST 5
84 //*********************** Parameter Values *************************
85 #define VTPM_TYPE_NON_MIGRATABLE 0x00
86 #define VTPM_TYPE_MIGRATABLE 0x01
87 #define VTPM_TYPE_MIGRATED 0xFF // VTPM has been migrated.
88 // VTPM can be recovered or deleted only
90 /******************* Command Parameter API *************************
92 VTPM Command Format
93 dmi: 4 bytes // Source of message.
94 // WARNING: This is prepended by the channel.
95 // Thus it is received by VTPM Manager,
96 // but not sent by DMI
97 tpm tag: 2 bytes
98 command size: 4 bytes // Size of command including header but not DMI
99 ord: 4 bytes // Command ordinal above
100 parameters: size - 10 bytes // Command Parameter
102 VTPM Response Format
103 tpm tag: 2 bytes
104 response_size: 4 bytes
105 status: 4 bytes
106 parameters: size - 10 bytes
109 VTPM_Open:
110 Input Parameters:
111 mig_type: 1 byte
112 startup_mode: 1 byte // Cold Boot = 1, resume = 2, deactive = 3
113 domain type: 1 byte
114 instance_id: 4 bytes
115 Output Parameters:
116 None
118 VTPM_Close
119 Input Parameters:
120 instance_id: 4 bytes
121 Output Parameters:
122 None
124 VTPM_Delete
125 Input Parameters:
126 instance_id: 4 bytes
127 Output Parameters:
128 None
130 VTPM_SaveNVM
131 Input Parameters:
132 data: n bytes (Header indicates size of data)
133 Output Parameters:
134 None
136 VTPM_LoadNVM
137 Input Parameters:
138 None
139 Output Parameters:
140 data: n bytes (Header indicates size of data)
142 VTPM_TPMCommand
143 Input Parameters:
144 TPM Command Byte Stream: n bytes
145 Output Parameters:
146 TPM Reponse Byte Stream: n bytes
148 *********************************************************************/
150 #endif //_VTPM_MANAGER_H_