encrypt_ioctl.h revision 285809
1285809Sscottl/******************************************************************************* 2285809Sscottl*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved. 3285809Sscottl* 4285809Sscottl*Redistribution and use in source and binary forms, with or without modification, are permitted provided 5285809Sscottl*that the following conditions are met: 6285809Sscottl*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 7285809Sscottl*following disclaimer. 8285809Sscottl*2. Redistributions in binary form must reproduce the above copyright notice, 9285809Sscottl*this list of conditions and the following disclaimer in the documentation and/or other materials provided 10285809Sscottl*with the distribution. 11285809Sscottl* 12285809Sscottl*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED 13285809Sscottl*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 14285809Sscottl*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 15285809Sscottl*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 16285809Sscottl*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 17285809Sscottl*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 18285809Sscottl*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 19285809Sscottl*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 20285809Sscottl* 21285809Sscottl* $FreeBSD$ 22285809Sscottl* 23285809Sscottl*******************************************************************************/ 24285809Sscottl/******************************************************************************* 25285809Sscottl** 26285809Sscottl** Version Control Information: 27285809Sscottl** 28285809Sscottl** $Revision: 114125 $ 29285809Sscottl** $Author: lindfors $ 30285809Sscottl** $Date: 2012-01-06 17:12:27 -0800 (Fri, 06 Jan 2012) $ 31285809Sscottl** $Id: encrypt_ioctl.h 112360 2012-01-07 01:12:27Z mcleanda $ 32285809Sscottl** 33285809Sscottl*******************************************************************************/ 34285809Sscottl#include <linux/ioctl.h> 35285809Sscottl 36285809Sscottl#ifndef __ENCRYPT_IOCTL_H__ 37285809Sscottl#define __ENCRYPT_IOCTL_H__ 38285809Sscottl 39285809Sscottl#include <dev/pms/RefTisa/tisa/api/tiapi.h> 40285809Sscottl#include <dev/pms/RefTisa/tisa/api/ostiapi.h> 41285809Sscottl#include <dev/pms/RefTisa/tisa/api/tidefs.h> 42285809Sscottl#include <dev/pms/RefTisa/tisa/api/tiglobal.h> 43285809Sscottl#include <dev/pms/RefTisa/tisa/api/titypes.h> 44285809Sscottl#include <dev/pms/RefTisa/tisa/sassata/common/tdioctl.h> 45285809Sscottl#include <dev/pms/freebsd/driver/common/osenv.h> 46285809Sscottl#include <dev/pms/freebsd/driver/common/ostypes.h> 47285809Sscottl#include <dev/pms/freebsd/driver/common/osdebug.h> 48285809Sscottl 49285809Sscottltypedef struct IoctlEncryptGetInfo_s { 50285809Sscottl tiEncryptInfo_t tisaEncryptInfo; 51285809Sscottl} __attribute__ ((packed)) IoctlEncryptGetInfo_t; 52285809Sscottl 53285809Sscottltypedef struct IoctlEncryptSetMode_s { 54285809Sscottl bit32 securityCipherMode; 55285809Sscottl} __attribute__ ((packed)) IoctlEncryptSetMode_t; 56285809Sscottl 57285809Sscottltypedef struct IoctlEncryptKekAdd_s { 58285809Sscottl bit32 kekIndex; 59285809Sscottl bit32 wrapperKekIndex; 60285809Sscottl bit32 blobFormat; 61285809Sscottl tiEncryptKekBlob_t *EncryptKekBlob; 62285809Sscottl} __attribute__ ((packed)) IoctlEncryptKekAdd_t; 63285809Sscottl 64285809Sscottltypedef struct IoctlEncryptDekAdd_s { 65285809Sscottl bit32 kekIndex; 66285809Sscottl bit32 dekTable; 67285809Sscottl bit32 dekIndex; 68285809Sscottl bit32 dekBlobFormat; 69285809Sscottl bit32 dekTableKeyEntrySize; 70285809Sscottl tiEncryptDekBlob_t *dekBlob; 71285809Sscottl} __attribute__ ((packed)) IoctlEncryptDekAdd_t; 72285809Sscottl 73285809Sscottltypedef struct IoctlEncryptDekInvalidate_s { 74285809Sscottl tiEncryptDek_t dek; 75285809Sscottl} __attribute__ ((packed)) IoctlEncryptDekInvalidate_t; 76285809Sscottl 77285809Sscottltypedef struct IoctlEncryptKekNVRAM_s { 78285809Sscottl bit32 index; 79285809Sscottl} __attribute__ ((packed)) IoctlEncryptKekNVRAM_t; 80285809Sscottl 81285809Sscottltypedef struct IoctlEncryptDekTable_s { 82285809Sscottl tiMem_t DekTable1Addr; 83285809Sscottl tiMem_t DekTable2Addr; 84285809Sscottl} __attribute__ ((packed)) IoctlEncryptDekTable_t; 85285809Sscottl 86285809Sscottltypedef struct EncryptDekMapEntry_s { 87285809Sscottl#define ENCRYPT_DEK_MAP_ENTRY_CLEAR 0x00000001UL 88285809Sscottl#define ENCRYPT_DEK_MAP_ENTRY_VALID 0x80000000UL 89285809Sscottl bit32 flags; 90285809Sscottl unsigned long long startLBA; 91285809Sscottl unsigned long long endLBA; 92285809Sscottl tiEncryptDek_t dek; 93285809Sscottl} __attribute__ ((packed)) EncryptDekMapEntry_t; 94285809Sscottl 95285809Sscottltypedef struct EncryptDeviceDekMap_s { 96285809Sscottl bit32 host; 97285809Sscottl bit32 channel; 98285809Sscottl bit32 device; 99285809Sscottl bit32 lun; 100285809Sscottl bit32 keytag_check; 101285809Sscottl bit32 keytag[2]; 102285809Sscottl EncryptDekMapEntry_t dekMapEntry[1]; 103285809Sscottl} __attribute__ ((packed)) EncryptDeviceDekMap_t; 104285809Sscottl 105285809Sscottltypedef struct IoctlEncryptDekMapTable_s { 106285809Sscottl EncryptDeviceDekMap_t dekMap[1]; 107285809Sscottl} __attribute__ ((packed)) IoctlEncryptDekMapTable_t; 108285809Sscottl 109285809Sscottltypedef struct IoctlEncryptIOError_s { 110285809Sscottl bit64 error_id; 111285809Sscottl bit64 timestamp; 112285809Sscottl bit32 error_type; 113285809Sscottl bit32 host; 114285809Sscottl bit32 channel; 115285809Sscottl bit32 device; 116285809Sscottl bit32 lun; 117285809Sscottl bit32 scsi_cmd; 118285809Sscottl bit32 dek_index; 119285809Sscottl bit32 dek_table; 120285809Sscottl bit32 kek_index; 121285809Sscottl bit32 encrypt_mode; 122285809Sscottl bit32 keytag_check; 123285809Sscottl bit32 keytag[2]; 124285809Sscottl} __attribute__ ((packed)) IoctlEncryptIOError_t; 125285809Sscottl 126285809Sscottltypedef struct __attribute__ ((packed)) IoctlEncryptErrorQuery_s { 127285809Sscottl#define ERROR_QUERY_FLAG_BLOCK 1 128285809Sscottl bit32 query_flag; 129285809Sscottl bit32 valid_mask; 130285809Sscottl IoctlEncryptIOError_t error[32]; 131285809Sscottl} __attribute__ ((packed)) IoctlEncryptErrorQuery_t; 132285809Sscottl 133285809Sscottltypedef union IoctlEncryptOp_u { 134285809Sscottl IoctlEncryptGetInfo_t encryptGetInfo; 135285809Sscottl IoctlEncryptSetMode_t encryptSetMode; 136285809Sscottl IoctlEncryptKekAdd_t encryptKekAdd; 137285809Sscottl IoctlEncryptDekAdd_t encryptDekAdd; 138285809Sscottl IoctlEncryptDekInvalidate_t encryptDekInvalidate; 139285809Sscottl IoctlEncryptKekNVRAM_t encryptKekNVRAM; 140285809Sscottl IoctlEncryptDekMapTable_t encryptDekMap; 141285809Sscottl IoctlEncryptErrorQuery_t encryptErrorQuery; 142285809Sscottl} __attribute__ ((packed)) IoctlEncryptOp_t; 143285809Sscottl 144285809Sscottltypedef struct tiIOCTLPayloadHeader_s { 145285809Sscottl bit32 Signature; 146285809Sscottl bit16 MajorFunction; 147285809Sscottl bit16 MinorFunction; 148285809Sscottl bit16 Length; 149285809Sscottl bit16 Status; 150285809Sscottl} __attribute__ ((packed)) tiIOCTLPayloadHeader_t; 151285809Sscottl 152285809Sscottltypedef struct IoctlTISAEncrypt_s { 153285809Sscottl#define encryptGetInfo 0x00000001 154285809Sscottl#define encryptSetMode 0x00000002 155285809Sscottl#define encryptKekAdd 0x00000003 156285809Sscottl#define encryptDekAdd 0x00000004 157285809Sscottl#define encryptDekInvalidate 0x00000005 158285809Sscottl#define encryptKekStore 0x00000006 159285809Sscottl#define encryptKekLoad 0x00000007 160285809Sscottl#define encryptGetDekTable 0x00000008 161285809Sscottl#define encryptSetDekMap 0x00000009 162285809Sscottl#define encryptDekDump 0x0000000a 163285809Sscottl#define encryptErrorQuery 0x0000000c 164285809Sscottl bit32 encryptFunction; 165285809Sscottl bit32 status; 166285809Sscottl bit32 subEvent; 167285809Sscottl IoctlEncryptOp_t request; 168285809Sscottl} __attribute__ ((packed)) IoctlTISAEncrypt_t; 169285809Sscottl 170285809Sscottltypedef struct IOCTLEncrypt_s { 171285809Sscottl tiIOCTLPayloadHeader_t hdr; 172285809Sscottl IoctlTISAEncrypt_t body; 173285809Sscottl} __attribute__ ((packed)) IoctlEncrypt_t; 174285809Sscottl 175285809Sscottl#endif 176