xref: /freebsd/sys/dev/pms/RefTisa/discovery/api/dm.h (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1 /*******************************************************************************
2 **
3 *Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
4 *
5 *Redistribution and use in source and binary forms, with or without modification, are permitted provided
6 *that the following conditions are met:
7 *1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
8 *following disclaimer.
9 *2. Redistributions in binary form must reproduce the above copyright notice,
10 *this list of conditions and the following disclaimer in the documentation and/or other materials provided
11 *with the distribution.
12 *
13 *THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 *WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
15 *FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16 *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 *NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
18 *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
19 *LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
20 *SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
21 *
22 *
23 ********************************************************************************/
24 /********************************************************************************
25 **
26 *   dm.h
27 *
28 *   Abstract:   This module defines the contants, enum and #define definition used
29 *               by Discovery Moduled (DM).
30 *
31 ********************************************************************************/
32 
33 #ifndef DM_H
34 
35 #define DM_H
36 
37 /*************************************************
38  *   constants for type field in agsaMem_t
39  *************************************************/
40 #define DM_CACHED_MEM                             0x00     /**< CACHED memory type */
41 #define DM_DMA_MEM                                0x01     /**< DMA memory type */
42 #define DM_CACHED_DMA_MEM                         0x02     /**< CACHED DMA memory type */
43 
44 /*************************************************
45  *   constants for API return values
46  *************************************************/
47 #define DM_RC_SUCCESS                             0x00     /**< Successful function return value */
48 #define DM_RC_FAILURE                             0x01     /**< Failed function return value */
49 #define DM_RC_BUSY                                0x02     /**< Busy function return value */
50 #define DM_RC_VERSION_INCOMPATIBLE                0x03     /**< Version miss match */
51 #define DM_RC_VERSION_UNTESTED                    0x04     /**< Version not tested */
52 
53 
54 
55 /*************************************************
56  *   Discovery option
57  *************************************************/
58 #define DM_DISCOVERY_OPTION_FULL_START			0x00     /**< Full discovery */
59 #define DM_DISCOVERY_OPTION_INCREMENTAL_START		0x01     /**< Incremental discovery */
60 #define DM_DISCOVERY_OPTION_ABORT			0x02     /**< Discovery abort */
61 
62 
63 /*************************************************
64  *   Discovery status
65  *************************************************/
66 enum dmDiscoveryState_e
67 {
68   dmDiscCompleted  = 0,
69   dmDiscFailed,
70   dmDiscAborted,
71   dmDiscAbortFailed,
72   dmDiscInProgress,
73   dmDiscAbortInvalid, /* no discovery to abort */
74   dmDiscAbortInProgress, /* abort in progress */
75 
76 };
77 
78 /*************************************************
79  *   Device status
80  *************************************************/
81 enum dmDeviceState_e
82 {
83   dmDeviceNoChange = 0,
84   dmDeviceArrival,
85   dmDeviceRemoval,
86   dmDeviceMCNChange,
87   dmDeviceRateChange,
88 };
89 
90 typedef struct  dmContext_s {
91 		void		*tdData;
92 		void		*dmData;
93 } dmContext_t;
94 
95 typedef struct{
96         bit16	smpTimeout;
97         bit16	it_NexusTimeout;
98         bit16	firstBurstSize;
99         bit8	 flag;
100         bit8	 devType_S_Rate;
101         bit8 	sasAddressHi[4];
102         bit8 	sasAddressLo[4];
103         bit8    initiator_ssp_stp_smp;
104         bit8    target_ssp_stp_smp;
105         /* bit8 - bit14 are set by the user of DM such as TDM for directly attached expander
106            0 - 7; PhyID
107            8: non SMP or not
108            9 - 10: types of expander, valid only when bit8 is set
109                    10b (2): edge expander
110                    11b (3): fanout expander
111            11 - 14: MCN
112         */
113         bit16   ext;
114         bit8    sataDeviceType;
115         bit8    reserved;
116 } dmDeviceInfo_t;
117 
118 
119 typedef struct{
120 	void 	*virtPtr;
121 	void 	*osHandle;
122 	bit32 	physAddrUpper;
123 	bit32 	physAddrLower;
124 	bit32 	totalLength;
125 	bit32 	numElements;
126 	bit32 	singleElementLength;
127 	bit32 	alignment;
128 	bit32 	type;
129 	bit32 	reserved;
130 } dmMem_t;
131 
132 #define DM_NUM_MEM_CHUNKS 8
133 
134 typedef struct{
135 	bit32 		count;
136 	dmMem_t 	dmMemory[DM_NUM_MEM_CHUNKS];
137 } dmMemoryRequirement_t;
138 
139 typedef    dmContext_t    dmPortContext_t;
140 
141 typedef    dmContext_t    dmRoot_t;
142 
143 typedef struct{
144  bit32   numDevHandles;
145  bit32   tbd1;
146  bit32   tbd2;
147 #ifdef DM_DEBUG
148  bit32   DMDebugLevel;
149 #endif
150  bit32   itNexusTimeout;
151 } dmSwConfig_t;
152 
153 typedef struct{
154                bit8  	sasRemoteAddressHi[4];
155                bit8  	sasRemoteAddressLo[4];
156                bit8  	sasLocalAddressHi[4];
157                bit8  	sasLocalAddressLo[4];
158                bit32    flag;
159 } dmPortInfo_t;
160 
161 
162 #endif  /* DM_H */
163