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: lxencrypt.h 112360 2012-01-07 01:12:27Z mcleanda $ 32285809Sscottl** 33285809Sscottl*******************************************************************************/ 34285809Sscottl 35285809Sscottl//#ifndef __LXENCRYPT_H__ 36285809Sscottl//#define __LXENCRYPT_H__ 37285809Sscottl 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#include <sys/param.h> //zone allocation 49285809Sscottl#include <sys/queue.h> //zone allocation 50285809Sscottl#include <vm/uma.h> //zone allocation 51285809Sscottl 52285809Sscottl 53285809Sscottl#ifndef __LXENCRYPT_H__ 54285809Sscottl#define __LXENCRYPT_H__ 55285809Sscottl 56285809Sscottl#define IOERR_QUEUE_DEPTH_MAX 1024 57285809Sscottl 58285809Sscottlenum { 59285809Sscottl E_SUCCESS = 0, 60285809Sscottl E_DEK_INDEX, 61285809Sscottl E_DEK_TABLE, 62285809Sscottl E_KEK_INDEX, 63285809Sscottl E_CHANNEL_INDEX, 64285809Sscottl E_DEVICE_INDEX, 65285809Sscottl E_LUN_INDEX, 66285809Sscottl E_LBA_RANGE, 67285809Sscottl E_MEMPOOL_ALLOC, 68285809Sscottl E_FLAGS, 69285809Sscottl E_ENCRYPTION_DISABLED, 70285809Sscottl E_BAD_CIPHER_MODE, 71285809Sscottl E_NO_TARGET_MAP, 72285809Sscottl E_NO_LBA_MAP, 73285809Sscottl E_NOT_FOUND, 74285809Sscottl} encrypt_error_e; 75285809Sscottl 76285809Sscottltypedef struct ag_encrypt_ioerr_s { 77285809Sscottl struct list_head *list; 78285809Sscottl} ag_encrypt_ioerr_t; 79285809Sscottl 80285809Sscottlstruct agtiapi_softc *pCard; 81285809Sscottl#ifdef ENCRYPT_ENHANCE 82285809Sscottl 83285809Sscottl 84285809Sscottlssize_t set_dek_table_entry0(struct device *dev, struct device_attribute *attr, const char *buf, size_t len); 85285809Sscottlssize_t show_dek_table_entry0(struct device *dev, struct device_attribute *attr, char *buf); 86285809Sscottlssize_t set_dek_table_entry1(struct device *dev, struct device_attribute *attr, const char *buf, size_t len); 87285809Sscottlssize_t show_dek_table_entry1(struct device *dev, struct device_attribute *attr, char *buf); 88285809Sscottlssize_t show_kek_table(struct device *dev, struct device_attribute *attr, char *buf); 89285809Sscottlssize_t show_dek_kek_map0(struct device *dev, struct device_attribute *attr, char *buf); 90285809Sscottlssize_t show_dek_kek_map1(struct device *dev, struct device_attribute *attr, char *buf); 91285809Sscottlssize_t show_target_dek_map(struct device *dev, struct device_attribute *attr, char *buf); 92285809Sscottl 93285809Sscottl#endif 94285809Sscottlint agtiapi_SetupEncryption(struct agtiapi_softc *pCard); 95285809Sscottlint agtiapi_SetupEncryptionPools(struct agtiapi_softc *pCard); 96285809Sscottlvoid agtiapi_CleanupEncryption(struct agtiapi_softc *pCard); 97285809Sscottlvoid agtiapi_CleanupEncryptionPools(struct agtiapi_softc *pCard); 98285809Sscottlint agtiapi_SetupEncryptedIO(struct agtiapi_softc *pCard, ccb_t *pccb, unsigned long long block); 99285809Sscottlvoid agtiapi_CleanupEncryptedIO(struct agtiapi_softc *pCard, ccb_t *pccb); 100285809Sscottlvoid agtiapi_HandleEncryptedIOFailure(ag_device_t *pDev, ccb_t *pccb); 101285809Sscottl 102285809Sscottl#endif 103285809Sscottl 104