#ifndef __DMTYPES_H__
#define __DMTYPES_H__
#include <dev/pms/freebsd/driver/common/osenv.h>
#include <dev/pms/freebsd/driver/common/ostypes.h>
#include <dev/pms/freebsd/driver/common/osdebug.h>
#include <dev/pms/RefTisa/sallsdk/api/sa.h>
#include <dev/pms/RefTisa/sallsdk/api/saapi.h>
#include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
#include <dev/pms/RefTisa/discovery/api/dm.h>
#include <dev/pms/RefTisa/discovery/api/dmapi.h>
#include <dev/pms/RefTisa/discovery/api/tddmapi.h>
#include <dev/pms/RefTisa/discovery/dm/dmlist.h>
#ifdef TBD
#include <dev/pms/RefTisa/tisa/api/tiscsi.h>
#endif
typedef void (*dmSMPCompleted_t) (
agsaRoot_t *,
agsaIORequest_t *,
bit32 ,
bit32 ,
agsaFrameHandle_t
);
typedef void (*dmTimerCBFunc_t)(dmRoot_t *dmRoot, void *timerData1, void *timerData2, void *timerData3);
typedef struct dmTimerRequest_s {
bit32 timeout;
void *timerData1;
void *timerData2;
void *timerData3;
dmTimerCBFunc_t timerCBFunc;
dmList_t timerLink;
bit32 timerRunning;
} dmTimerRequest_t;
typedef struct dmRootOsData_s {
dmRoot_t *dmRoot;
void *dmAllShared;
void *dmIni;
} dmRootOsData_t;
typedef struct DMSASAddressID_s
{
bit32 sasAddressLo;
bit32 sasAddressHi;
bit8 phyIdentifier;
} DMSASAddressID_t;
struct dmExpander_s;
typedef struct dmDiscovery_s
{
dmList_t discoveringExpanderList;
dmList_t UpdiscoveringExpanderList;
bit32 status;
DMSASAddressID_t sasAddressIDDiscoverError;
agsaSATAIdentifyData_t *pSataIdentifyData;
struct dmExpander_s *RootExp;
bit32 NumOfUpExp;
bit32 type;
bit32 retries;
bit32 configureRouteRetries;
bit32 deviceRetistrationRetries;
dmTimerRequest_t discoveryTimer;
dmTimerRequest_t configureRouteTimer;
dmTimerRequest_t deviceRegistrationTimer;
dmTimerRequest_t BCTimer;
smpRespDiscover_t SMPDiscoverResp;
smpRespDiscover2_t SMPDiscover2Resp;
bit32 pendingSMP;
bit32 SeenBC;
bit32 forcedOK;
dmTimerRequest_t SMPBusyTimer;
bit32 SMPRetries;
bit32 ResetTriggerred;
dmTimerRequest_t DiscoverySMPTimer;
bit32 DeferredError;
bit32 ConfiguresOthers;
} dmDiscovery_t;
typedef struct dmSASSubID_s
{
bit32 sasAddressHi;
bit32 sasAddressLo;
bit8 initiator_ssp_stp_smp;
bit8 target_ssp_stp_smp;
} dmSASSubID_t;
struct dmDeviceData_s;
typedef struct dmIntPortContext_s
{
bit32 Count;
bit32 DiscoveryState;
bit32 DiscoveryAbortInProgress;
bit32 discoveryOptions;
bit32 DiscoveryRdyGiven;
bit32 SeenLinkUp;
bit32 numAvailableTargets;
bit32 osInitiatedDiscovery;
bit32 id;
dmList_t FreeLink;
dmList_t MainLink;
bit32 sasRemoteAddressHi;
bit32 sasRemoteAddressLo;
agsaSASIdentify_t sasIDframe;
bit32 sasLocalAddressHi;
bit32 sasLocalAddressLo;
#ifdef TBD
bit8 PhyIDList[DM_MAX_NUM_PHYS];
#endif
dmPortContext_t *dmPortContext;
dmRoot_t *dmRoot;
#ifdef TBD
agsaRoot_t *agRoot;
agsaPortContext_t *agPortContext;
bit8 nativeSATAMode;
bit8 remoteSignature[8];
#endif
bit8 directAttatchedSAS;
dmDiscovery_t discovery;
bit32 valid;
bit8 LinkRate;
bit32 RegisteredDevNums;
bit32 eventPhyID;
bit32 Transient;
bit32 RegFailed;
} dmIntPortContext_t;
typedef struct dmDeviceData_s {
dmList_t FreeLink;
dmList_t MainLink;
dmList_t IncDisLink;
bit32 id;
bit8 DeviceType;
dmRoot_t *dmRoot;
DMSASAddressID_t SASAddressID;
bit8 initiator_ssp_stp_smp;
bit8 target_ssp_stp_smp;
bit8 numOfPhys;
bit8 satSignature[8];
struct dmIntPortContext_s *dmPortContext;
bit8 valid;
bit8 valid2;
bit8 processed;
#ifdef AGTIAPI_CTL
bit8 discovered;
#endif
agsaDeviceInfo_t agDeviceInfo;
dmDeviceInfo_t dmDeviceInfo;
agsaContext_t agContext;
struct dmExpander_s *dmExpander;
struct dmDeviceData_s *ExpDevice;
bit8 phyID;
agsaSASIdentify_t sasIdentify;
bit8 connectionRate;
bit8 directlyAttached;
bit8 SASSpecDeviceType;
bit32 IOStart;
bit32 IOResponse;
agsaContext_t agDeviceResetContext;
bit32 TRflag;
bit32 ResetCnt;
bit32 registered;
bit32 reported;
bit32 MCN;
bit32 MCNDone;
bit32 PrevMCN;
} dmDeviceData_t;
typedef struct dmExpander_s
{
#ifdef TBD
dmList_t FreeLink;
dmList_t MainLink;
#endif
bit32 id;
bit32 InQID;
bit32 OutQID;
bit8 DeviceType;
dmRoot_t *dmRoot;
agsaDevHandle_t *agDevHandle;
dmList_t linkNode;
dmList_t upNode;
dmDeviceData_t *dmDevice;
struct dmExpander_s *dmUpStreamExpander;
bit8 hasUpStreamDevice;
bit8 discoveringPhyId;
bit16 routingIndex;
bit16 currentIndex[DM_MAX_EXPANDER_PHYS];
dmDeviceData_t *dmDeviceToProcess;
bit32 configSASAddressHi;
bit32 configSASAddressLo;
struct dmExpander_s *dmCurrentDownStreamExpander;
bit8 upStreamPhys[DM_MAX_EXPANDER_PHYS];
bit16 numOfUpStreamPhys;
bit16 currentUpStreamPhyIndex;
bit32 upStreamSASAddressHi;
bit32 upStreamSASAddressLo;
bit32 underDiscovering;
bit32 configRouteTable: 1;
bit32 configuring: 1;
bit32 configReserved: 30;
#ifdef TBD
bit32 id;
#endif
struct dmExpander_s *dmReturnginExpander;
bit8 downStreamPhys[DM_MAX_EXPANDER_PHYS];
bit16 numOfDownStreamPhys;
bit8 currentDownStreamPhyIndex;
bit32 discoverSMPAllowed;
bit8 routingAttribute[DM_MAX_EXPANDER_PHYS];
bit32 configSASAddressHiTable[DM_MAX_DEV];
bit32 configSASAddressLoTable[DM_MAX_DEV];
bit32 configSASAddrTableIndex;
bit32 SAS2;
bit32 TTTSupported;
bit32 UndoDueToTTTSupported;
} dmExpander_t;
typedef struct dmIndirectSMPRequestBody_s {
dmList_t Link;
bit32 id;
} dmIndirectSMPRequestBody_t;
typedef struct dmSMPRequestBody_s {
dmList_t Link;
dmSMPCompleted_t SMPCompletionFunc;
#ifdef TBD
tiDeviceHandle_t *tiDevHandle;
#endif
agsaIORequest_t agIORequest;
agsaSASRequestBody_t agSASRequestBody;
agsaSATAInitiatorRequest_t agSATARequestBody;
dmDeviceData_t *dmDevice;
#ifdef TBD
void *osMemHandle;
dmDeviceData_t *dmDevice;
tiIORequest_t *CurrentTaskTag;
#endif
dmRoot_t *dmRoot;
dmIntPortContext_t *dmPortContext;
bit8 smpPayload[SMP_DIRECT_PAYLOAD_LIMIT];
bit32 retries;
void *IndirectSMP;
bit32 IndirectSMPUpper32;
bit32 IndirectSMPLower32;
void *IndirectSMPResponse;
#ifdef TBD
void *IndirectSMPReqosMemHandle;
void *IndirectSMPReq;
bit32 IndirectSMPReqLen;
bit32 IndirectSMPReqUpper32;
bit32 IndirectSMPReqLower32;
void *IndirectSMPResposMemHandle;
void *IndirectSMPResp;
bit32 IndirectSMPRespLen;
bit32 IndirectSMPRespUpper32;
bit32 IndirectSMPRespLower32;
#endif
bit32 id;
agsaContext_t agContext;
} dmSMPRequestBody_t;
typedef struct dmIntContext_s {
struct dmRootOsData_s dmRootOsData;
bit32 usecsPerTick;
#ifdef TBD
dmRoot_t dmRootInt;
dmRoot_t dmRootNonInt;
#endif
agsaRoot_t *agRoot;
dmSwConfig_t SwConfig;
dmList_t timerlist;
dmIntPortContext_t *PortContextMem;
dmList_t FreePortContextList;
dmList_t MainPortContextList;
dmDeviceData_t *DeviceMem;
dmList_t FreeDeviceList;
dmList_t MainDeviceList;
dmExpander_t *ExpanderMem;
dmList_t freeExpanderList;
dmList_t mainExpanderList;
dmSMPRequestBody_t *SMPMem;
dmList_t freeSMPList;
bit8 *IndirectSMPMem;
bit32 IndirectSMPUpper32;
bit32 IndirectSMPLower32;
bit32 itNexusTimeout;
bit32 MaxRetryDiscovery;
bit32 RateAdjust;
} dmIntContext_t;
typedef struct dmIntRoot_s
{
dmIntContext_t dmAllShared;
} dmIntRoot_t;
#endif