1285242Sachim/******************************************************************************* 2285242Sachim** 3285242Sachim*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved. 4285242Sachim* 5285242Sachim*Redistribution and use in source and binary forms, with or without modification, are permitted provided 6285242Sachim*that the following conditions are met: 7285242Sachim*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 8285242Sachim*following disclaimer. 9285242Sachim*2. Redistributions in binary form must reproduce the above copyright notice, 10285242Sachim*this list of conditions and the following disclaimer in the documentation and/or other materials provided 11285242Sachim*with the distribution. 12285242Sachim* 13285242Sachim*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED 14285242Sachim*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 15285242Sachim*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 16285242Sachim*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 17285242Sachim*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 18285242Sachim*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 19285242Sachim*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 20285242Sachim*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 21285242Sachim* 22285242Sachim* $FreeBSD$ 23285242Sachim* 24285242Sachim********************************************************************************/ 25285242Sachim/******************************************************************************** 26285242Sachim** 27285242Sachim* dm.h 28285242Sachim* 29285242Sachim* Abstract: This module defines the contants, enum and #define definition used 30285242Sachim* by Discovery Moduled (DM). 31285242Sachim* 32285242Sachim********************************************************************************/ 33285242Sachim 34285242Sachim#ifndef DM_H 35285242Sachim 36285242Sachim#define DM_H 37285242Sachim 38285242Sachim/************************************************* 39285242Sachim * constants for type field in agsaMem_t 40285242Sachim *************************************************/ 41285242Sachim#define DM_CACHED_MEM 0x00 /**< CACHED memory type */ 42285242Sachim#define DM_DMA_MEM 0x01 /**< DMA memory type */ 43285242Sachim#define DM_CACHED_DMA_MEM 0x02 /**< CACHED DMA memory type */ 44285242Sachim 45285242Sachim/************************************************* 46285242Sachim * constants for API return values 47285242Sachim *************************************************/ 48285242Sachim#define DM_RC_SUCCESS 0x00 /**< Successful function return value */ 49285242Sachim#define DM_RC_FAILURE 0x01 /**< Failed function return value */ 50285242Sachim#define DM_RC_BUSY 0x02 /**< Busy function return value */ 51285242Sachim#define DM_RC_VERSION_INCOMPATIBLE 0x03 /**< Version miss match */ 52285242Sachim#define DM_RC_VERSION_UNTESTED 0x04 /**< Version not tested */ 53285242Sachim 54285242Sachim 55285242Sachim 56285242Sachim/************************************************* 57285242Sachim * Discovery option 58285242Sachim *************************************************/ 59285242Sachim#define DM_DISCOVERY_OPTION_FULL_START 0x00 /**< Full discovery */ 60285242Sachim#define DM_DISCOVERY_OPTION_INCREMENTAL_START 0x01 /**< Incremental discovery */ 61285242Sachim#define DM_DISCOVERY_OPTION_ABORT 0x02 /**< Discovery abort */ 62285242Sachim 63285242Sachim 64285242Sachim/************************************************* 65285242Sachim * Discovery status 66285242Sachim *************************************************/ 67285242Sachimenum dmDiscoveryState_e 68285242Sachim{ 69285242Sachim dmDiscCompleted = 0, 70285242Sachim dmDiscFailed, 71285242Sachim dmDiscAborted, 72285242Sachim dmDiscAbortFailed, 73285242Sachim dmDiscInProgress, 74285242Sachim dmDiscAbortInvalid, /* no discovery to abort */ 75285242Sachim dmDiscAbortInProgress, /* abort in progress */ 76285242Sachim 77285242Sachim}; 78285242Sachim 79285242Sachim/************************************************* 80285242Sachim * Device status 81285242Sachim *************************************************/ 82285242Sachimenum dmDeviceState_e 83285242Sachim{ 84285242Sachim dmDeviceNoChange = 0, 85285242Sachim dmDeviceArrival, 86285242Sachim dmDeviceRemoval, 87285242Sachim dmDeviceMCNChange, 88285242Sachim dmDeviceRateChange, 89285242Sachim}; 90285242Sachim 91285242Sachimtypedef struct dmContext_s { 92285242Sachim void *tdData; 93285242Sachim void *dmData; 94285242Sachim} dmContext_t; 95285242Sachim 96285242Sachimtypedef struct{ 97285242Sachim bit16 smpTimeout; 98285242Sachim bit16 it_NexusTimeout; 99285242Sachim bit16 firstBurstSize; 100285242Sachim bit8 flag; 101285242Sachim bit8 devType_S_Rate; 102285242Sachim bit8 sasAddressHi[4]; 103285242Sachim bit8 sasAddressLo[4]; 104285242Sachim bit8 initiator_ssp_stp_smp; 105285242Sachim bit8 target_ssp_stp_smp; 106285242Sachim /* bit8 - bit14 are set by the user of DM such as TDM for directly attached expander 107285242Sachim 0 - 7; PhyID 108285242Sachim 8: non SMP or not 109285242Sachim 9 - 10: types of expander, valid only when bit8 is set 110285242Sachim 10b (2): edge expander 111285242Sachim 11b (3): fanout expander 112285242Sachim 11 - 14: MCN 113285242Sachim */ 114285242Sachim bit16 ext; 115285242Sachim bit8 sataDeviceType; 116285242Sachim bit8 reserved; 117285242Sachim} dmDeviceInfo_t; 118285242Sachim 119285242Sachim 120285242Sachimtypedef struct{ 121285242Sachim void *virtPtr; 122285242Sachim void *osHandle; 123285242Sachim bit32 physAddrUpper; 124285242Sachim bit32 physAddrLower; 125285242Sachim bit32 totalLength; 126285242Sachim bit32 numElements; 127285242Sachim bit32 singleElementLength; 128285242Sachim bit32 alignment; 129285242Sachim bit32 type; 130285242Sachim bit32 reserved; 131285242Sachim} dmMem_t; 132285242Sachim 133285242Sachim#define DM_NUM_MEM_CHUNKS 8 134285242Sachim 135285242Sachimtypedef struct{ 136285242Sachim bit32 count; 137285242Sachim dmMem_t dmMemory[DM_NUM_MEM_CHUNKS]; 138285242Sachim} dmMemoryRequirement_t; 139285242Sachim 140285242Sachimtypedef dmContext_t dmPortContext_t; 141285242Sachim 142285242Sachimtypedef dmContext_t dmRoot_t; 143285242Sachim 144285242Sachimtypedef struct{ 145285242Sachim bit32 numDevHandles; 146285242Sachim bit32 tbd1; 147285242Sachim bit32 tbd2; 148285242Sachim#ifdef DM_DEBUG 149285242Sachim bit32 DMDebugLevel; 150285242Sachim#endif 151285242Sachim bit32 itNexusTimeout; 152285242Sachim} dmSwConfig_t; 153285242Sachim 154285242Sachimtypedef struct{ 155285242Sachim bit8 sasRemoteAddressHi[4]; 156285242Sachim bit8 sasRemoteAddressLo[4]; 157285242Sachim bit8 sasLocalAddressHi[4]; 158285242Sachim bit8 sasLocalAddressLo[4]; 159285242Sachim bit32 flag; 160285242Sachim} dmPortInfo_t; 161285242Sachim 162285242Sachim 163285242Sachim#endif /* DM_H */ 164