1 /*******************************************************************************
2 *Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
4 *Redistribution and use in source and binary forms, with or without modification, are permitted provided
5 *that the following conditions are met:
6 *1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
8 *2. Redistributions in binary form must reproduce the above copyright notice,
9 *this list of conditions and the following disclaimer in the documentation and/or other materials provided
10 *with the distribution.
12 *THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 *WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 *FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15 *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 *NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17 *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18 *LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19 *SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
23 *******************************************************************************/
24 /*******************************************************************************
26 ** Version Control Information:
28 ** $Revision: 114125 $
29 ** $Author: lindfors $
30 ** $Date: 2012-01-06 17:12:27 -0800 (Fri, 06 Jan 2012) $
31 ** $Id: encrypt_ioctl.h 112360 2012-01-07 01:12:27Z mcleanda $
33 *******************************************************************************/
34 #include <linux/ioctl.h>
36 #ifndef __ENCRYPT_IOCTL_H__
37 #define __ENCRYPT_IOCTL_H__
39 #include <dev/pms/RefTisa/tisa/api/tiapi.h>
40 #include <dev/pms/RefTisa/tisa/api/ostiapi.h>
41 #include <dev/pms/RefTisa/tisa/api/tidefs.h>
42 #include <dev/pms/RefTisa/tisa/api/tiglobal.h>
43 #include <dev/pms/RefTisa/tisa/api/titypes.h>
44 #include <dev/pms/RefTisa/tisa/sassata/common/tdioctl.h>
45 #include <dev/pms/freebsd/driver/common/osenv.h>
46 #include <dev/pms/freebsd/driver/common/ostypes.h>
47 #include <dev/pms/freebsd/driver/common/osdebug.h>
49 typedef struct IoctlEncryptGetInfo_s {
50 tiEncryptInfo_t tisaEncryptInfo;
51 } __attribute__ ((packed)) IoctlEncryptGetInfo_t;
53 typedef struct IoctlEncryptSetMode_s {
54 bit32 securityCipherMode;
55 } __attribute__ ((packed)) IoctlEncryptSetMode_t;
57 typedef struct IoctlEncryptKekAdd_s {
59 bit32 wrapperKekIndex;
61 tiEncryptKekBlob_t *EncryptKekBlob;
62 } __attribute__ ((packed)) IoctlEncryptKekAdd_t;
64 typedef struct IoctlEncryptDekAdd_s {
69 bit32 dekTableKeyEntrySize;
70 tiEncryptDekBlob_t *dekBlob;
71 } __attribute__ ((packed)) IoctlEncryptDekAdd_t;
73 typedef struct IoctlEncryptDekInvalidate_s {
75 } __attribute__ ((packed)) IoctlEncryptDekInvalidate_t;
77 typedef struct IoctlEncryptKekNVRAM_s {
79 } __attribute__ ((packed)) IoctlEncryptKekNVRAM_t;
81 typedef struct IoctlEncryptDekTable_s {
82 tiMem_t DekTable1Addr;
83 tiMem_t DekTable2Addr;
84 } __attribute__ ((packed)) IoctlEncryptDekTable_t;
86 typedef struct EncryptDekMapEntry_s {
87 #define ENCRYPT_DEK_MAP_ENTRY_CLEAR 0x00000001UL
88 #define ENCRYPT_DEK_MAP_ENTRY_VALID 0x80000000UL
90 unsigned long long startLBA;
91 unsigned long long endLBA;
93 } __attribute__ ((packed)) EncryptDekMapEntry_t;
95 typedef struct EncryptDeviceDekMap_s {
102 EncryptDekMapEntry_t dekMapEntry[1];
103 } __attribute__ ((packed)) EncryptDeviceDekMap_t;
105 typedef struct IoctlEncryptDekMapTable_s {
106 EncryptDeviceDekMap_t dekMap[1];
107 } __attribute__ ((packed)) IoctlEncryptDekMapTable_t;
109 typedef struct IoctlEncryptIOError_s {
124 } __attribute__ ((packed)) IoctlEncryptIOError_t;
126 typedef struct __attribute__ ((packed)) IoctlEncryptErrorQuery_s {
127 #define ERROR_QUERY_FLAG_BLOCK 1
130 IoctlEncryptIOError_t error[32];
131 } __attribute__ ((packed)) IoctlEncryptErrorQuery_t;
133 typedef union IoctlEncryptOp_u {
134 IoctlEncryptGetInfo_t encryptGetInfo;
135 IoctlEncryptSetMode_t encryptSetMode;
136 IoctlEncryptKekAdd_t encryptKekAdd;
137 IoctlEncryptDekAdd_t encryptDekAdd;
138 IoctlEncryptDekInvalidate_t encryptDekInvalidate;
139 IoctlEncryptKekNVRAM_t encryptKekNVRAM;
140 IoctlEncryptDekMapTable_t encryptDekMap;
141 IoctlEncryptErrorQuery_t encryptErrorQuery;
142 } __attribute__ ((packed)) IoctlEncryptOp_t;
144 typedef struct tiIOCTLPayloadHeader_s {
150 } __attribute__ ((packed)) tiIOCTLPayloadHeader_t;
152 typedef struct IoctlTISAEncrypt_s {
153 #define encryptGetInfo 0x00000001
154 #define encryptSetMode 0x00000002
155 #define encryptKekAdd 0x00000003
156 #define encryptDekAdd 0x00000004
157 #define encryptDekInvalidate 0x00000005
158 #define encryptKekStore 0x00000006
159 #define encryptKekLoad 0x00000007
160 #define encryptGetDekTable 0x00000008
161 #define encryptSetDekMap 0x00000009
162 #define encryptDekDump 0x0000000a
163 #define encryptErrorQuery 0x0000000c
164 bit32 encryptFunction;
167 IoctlEncryptOp_t request;
168 } __attribute__ ((packed)) IoctlTISAEncrypt_t;
170 typedef struct IOCTLEncrypt_s {
171 tiIOCTLPayloadHeader_t hdr;
172 IoctlTISAEncrypt_t body;
173 } __attribute__ ((packed)) IoctlEncrypt_t;