1/******************************************************************************* 2*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved. 3* 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 7*following disclaimer. 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. 11* 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 20* 21* $FreeBSD$ 22* 23*******************************************************************************/ 24/******************************************************************************* 25** 26** Version Control Information: 27** 28** $Revision: 114125 $ 29** $Author: lindfors $ 30** $Date: 2012-01-06 17:12:27 -0800 (Fri, 06 Jan 2012) $ 31** $Id: lxencrypt.h 112360 2012-01-07 01:12:27Z mcleanda $ 32** 33*******************************************************************************/ 34 35//#ifndef __LXENCRYPT_H__ 36//#define __LXENCRYPT_H__ 37 38 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> 48#include <sys/param.h> //zone allocation 49#include <sys/queue.h> //zone allocation 50#include <vm/uma.h> //zone allocation 51 52 53#ifndef __LXENCRYPT_H__ 54#define __LXENCRYPT_H__ 55 56#define IOERR_QUEUE_DEPTH_MAX 1024 57 58enum { 59 E_SUCCESS = 0, 60 E_DEK_INDEX, 61 E_DEK_TABLE, 62 E_KEK_INDEX, 63 E_CHANNEL_INDEX, 64 E_DEVICE_INDEX, 65 E_LUN_INDEX, 66 E_LBA_RANGE, 67 E_MEMPOOL_ALLOC, 68 E_FLAGS, 69 E_ENCRYPTION_DISABLED, 70 E_BAD_CIPHER_MODE, 71 E_NO_TARGET_MAP, 72 E_NO_LBA_MAP, 73 E_NOT_FOUND, 74} encrypt_error_e; 75 76typedef struct ag_encrypt_ioerr_s { 77 struct list_head *list; 78} ag_encrypt_ioerr_t; 79 80struct agtiapi_softc *pCard; 81#ifdef ENCRYPT_ENHANCE 82 83 84ssize_t set_dek_table_entry0(struct device *dev, struct device_attribute *attr, const char *buf, size_t len); 85ssize_t show_dek_table_entry0(struct device *dev, struct device_attribute *attr, char *buf); 86ssize_t set_dek_table_entry1(struct device *dev, struct device_attribute *attr, const char *buf, size_t len); 87ssize_t show_dek_table_entry1(struct device *dev, struct device_attribute *attr, char *buf); 88ssize_t show_kek_table(struct device *dev, struct device_attribute *attr, char *buf); 89ssize_t show_dek_kek_map0(struct device *dev, struct device_attribute *attr, char *buf); 90ssize_t show_dek_kek_map1(struct device *dev, struct device_attribute *attr, char *buf); 91ssize_t show_target_dek_map(struct device *dev, struct device_attribute *attr, char *buf); 92 93#endif 94int agtiapi_SetupEncryption(struct agtiapi_softc *pCard); 95int agtiapi_SetupEncryptionPools(struct agtiapi_softc *pCard); 96void agtiapi_CleanupEncryption(struct agtiapi_softc *pCard); 97void agtiapi_CleanupEncryptionPools(struct agtiapi_softc *pCard); 98int agtiapi_SetupEncryptedIO(struct agtiapi_softc *pCard, ccb_t *pccb, unsigned long long block); 99void agtiapi_CleanupEncryptedIO(struct agtiapi_softc *pCard, ccb_t *pccb); 100void agtiapi_HandleEncryptedIOFailure(ag_device_t *pDev, ccb_t *pccb); 101 102#endif 103 104