xref: /freebsd/sys/dev/pms/RefTisa/discovery/dm/dmport.c (revision 685dc743dc3b5645e34836464128e1c0558b404b)
1*4e1bc9a0SAchim Leubner /*******************************************************************************
2*4e1bc9a0SAchim Leubner *Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
3*4e1bc9a0SAchim Leubner *
4*4e1bc9a0SAchim Leubner *Redistribution and use in source and binary forms, with or without modification, are permitted provided
5*4e1bc9a0SAchim Leubner *that the following conditions are met:
6*4e1bc9a0SAchim Leubner *1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7*4e1bc9a0SAchim Leubner *following disclaimer.
8*4e1bc9a0SAchim Leubner *2. Redistributions in binary form must reproduce the above copyright notice,
9*4e1bc9a0SAchim Leubner *this list of conditions and the following disclaimer in the documentation and/or other materials provided
10*4e1bc9a0SAchim Leubner *with the distribution.
11*4e1bc9a0SAchim Leubner *
12*4e1bc9a0SAchim Leubner *THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13*4e1bc9a0SAchim Leubner *WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14*4e1bc9a0SAchim Leubner *FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15*4e1bc9a0SAchim Leubner *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16*4e1bc9a0SAchim Leubner *NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17*4e1bc9a0SAchim Leubner *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18*4e1bc9a0SAchim Leubner *LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19*4e1bc9a0SAchim Leubner *SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20*4e1bc9a0SAchim Leubner 
21*4e1bc9a0SAchim Leubner ********************************************************************************/
22*4e1bc9a0SAchim Leubner #include <sys/cdefs.h>
23*4e1bc9a0SAchim Leubner #include <dev/pms/config.h>
24*4e1bc9a0SAchim Leubner 
25*4e1bc9a0SAchim Leubner #include <dev/pms/freebsd/driver/common/osenv.h>
26*4e1bc9a0SAchim Leubner #include <dev/pms/freebsd/driver/common/ostypes.h>
27*4e1bc9a0SAchim Leubner #include <dev/pms/freebsd/driver/common/osdebug.h>
28*4e1bc9a0SAchim Leubner 
29*4e1bc9a0SAchim Leubner #include <dev/pms/RefTisa/sallsdk/api/sa.h>
30*4e1bc9a0SAchim Leubner #include <dev/pms/RefTisa/sallsdk/api/saapi.h>
31*4e1bc9a0SAchim Leubner #include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
32*4e1bc9a0SAchim Leubner 
33*4e1bc9a0SAchim Leubner #ifdef FDS_DM
34*4e1bc9a0SAchim Leubner #include <dev/pms/RefTisa/discovery/api/dm.h>
35*4e1bc9a0SAchim Leubner #include <dev/pms/RefTisa/discovery/api/dmapi.h>
36*4e1bc9a0SAchim Leubner #include <dev/pms/RefTisa/discovery/api/tddmapi.h>
37*4e1bc9a0SAchim Leubner 
38*4e1bc9a0SAchim Leubner #include <dev/pms/RefTisa/discovery/dm/dmdefs.h>
39*4e1bc9a0SAchim Leubner #include <dev/pms/RefTisa/discovery/dm/dmtypes.h>
40*4e1bc9a0SAchim Leubner #include <dev/pms/RefTisa/discovery/dm/dmproto.h>
41*4e1bc9a0SAchim Leubner 
42*4e1bc9a0SAchim Leubner /*****************************************************************************/
43*4e1bc9a0SAchim Leubner /*! \brief dmCreatePort
44*4e1bc9a0SAchim Leubner  *
45*4e1bc9a0SAchim Leubner  *
46*4e1bc9a0SAchim Leubner  *  Purpose: A port context is created by this function
47*4e1bc9a0SAchim Leubner  *
48*4e1bc9a0SAchim Leubner  *  \param   dmRoot:              DM context handle.
49*4e1bc9a0SAchim Leubner  *  \param   dmPortContext:       Pointer to this instance of port context
50*4e1bc9a0SAchim Leubner  *
51*4e1bc9a0SAchim Leubner  *  \return:
52*4e1bc9a0SAchim Leubner  *          DM_RC_SUCCESS
53*4e1bc9a0SAchim Leubner  *          DM_RC_FAILURE
54*4e1bc9a0SAchim Leubner  *
55*4e1bc9a0SAchim Leubner  */
56*4e1bc9a0SAchim Leubner /*****************************************************************************/
57*4e1bc9a0SAchim Leubner osGLOBAL bit32
dmCreatePort(dmRoot_t * dmRoot,dmPortContext_t * dmPortContext,dmPortInfo_t * dmPortInfo)58*4e1bc9a0SAchim Leubner dmCreatePort(
59*4e1bc9a0SAchim Leubner              dmRoot_t        *dmRoot,
60*4e1bc9a0SAchim Leubner              dmPortContext_t *dmPortContext,
61*4e1bc9a0SAchim Leubner              dmPortInfo_t    *dmPortInfo)
62*4e1bc9a0SAchim Leubner {
63*4e1bc9a0SAchim Leubner   dmIntRoot_t               *dmIntRoot    = agNULL;
64*4e1bc9a0SAchim Leubner   dmIntContext_t            *dmAllShared = agNULL;
65*4e1bc9a0SAchim Leubner   dmIntPortContext_t        *onePortContext = agNULL;
66*4e1bc9a0SAchim Leubner   dmList_t                  *PortContextList = agNULL;
67*4e1bc9a0SAchim Leubner 
68*4e1bc9a0SAchim Leubner   DM_DBG3(("dmCreatePort: start\n"));
69*4e1bc9a0SAchim Leubner 
70*4e1bc9a0SAchim Leubner   if (dmRoot == agNULL)
71*4e1bc9a0SAchim Leubner   {
72*4e1bc9a0SAchim Leubner     DM_DBG1(("dmCreatePort: dmRoot is NULL, wrong!!!\n"));
73*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
74*4e1bc9a0SAchim Leubner   }
75*4e1bc9a0SAchim Leubner 
76*4e1bc9a0SAchim Leubner   if (dmPortContext == agNULL)
77*4e1bc9a0SAchim Leubner   {
78*4e1bc9a0SAchim Leubner     DM_DBG1(("dmCreatePort: dmPortContext is NULL, wrong!!!\n"));
79*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
80*4e1bc9a0SAchim Leubner   }
81*4e1bc9a0SAchim Leubner 
82*4e1bc9a0SAchim Leubner   /* the duplicacy of a port is checked */
83*4e1bc9a0SAchim Leubner   if (dmPortContext->dmData != agNULL)
84*4e1bc9a0SAchim Leubner   {
85*4e1bc9a0SAchim Leubner     DM_DBG1(("dmCreatePort: dmPortContext->dmData is not NULL, wrong, Already created!!!\n"));
86*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
87*4e1bc9a0SAchim Leubner   }
88*4e1bc9a0SAchim Leubner 
89*4e1bc9a0SAchim Leubner   if (dmPortInfo == agNULL)
90*4e1bc9a0SAchim Leubner   {
91*4e1bc9a0SAchim Leubner     DM_DBG1(("dmCreatePort: dmPortInfo is NULL, wrong!!!\n"));
92*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
93*4e1bc9a0SAchim Leubner   }
94*4e1bc9a0SAchim Leubner 
95*4e1bc9a0SAchim Leubner   dmIntRoot = (dmIntRoot_t *)dmRoot->dmData;
96*4e1bc9a0SAchim Leubner 
97*4e1bc9a0SAchim Leubner   if (dmIntRoot == agNULL)
98*4e1bc9a0SAchim Leubner   {
99*4e1bc9a0SAchim Leubner     DM_DBG1(("dmCreatePort: dmIntRoot is NULL, wrong!!!\n"));
100*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
101*4e1bc9a0SAchim Leubner   }
102*4e1bc9a0SAchim Leubner 
103*4e1bc9a0SAchim Leubner   dmAllShared = (dmIntContext_t *)&dmIntRoot->dmAllShared;
104*4e1bc9a0SAchim Leubner 
105*4e1bc9a0SAchim Leubner   if (dmAllShared == agNULL)
106*4e1bc9a0SAchim Leubner   {
107*4e1bc9a0SAchim Leubner     DM_DBG1(("dmCreatePort: dmAllShared is NULL, wrong!!!\n"));
108*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
109*4e1bc9a0SAchim Leubner   }
110*4e1bc9a0SAchim Leubner 
111*4e1bc9a0SAchim Leubner   tddmSingleThreadedEnter(dmRoot, DM_PORT_LOCK);
112*4e1bc9a0SAchim Leubner   if (DMLIST_NOT_EMPTY(&(dmAllShared->FreePortContextList)))
113*4e1bc9a0SAchim Leubner   {
114*4e1bc9a0SAchim Leubner     DMLIST_DEQUEUE_FROM_HEAD(&PortContextList, &(dmAllShared->FreePortContextList));
115*4e1bc9a0SAchim Leubner     tddmSingleThreadedLeave(dmRoot, DM_PORT_LOCK);
116*4e1bc9a0SAchim Leubner     onePortContext = DMLIST_OBJECT_BASE(dmIntPortContext_t, FreeLink, PortContextList);
117*4e1bc9a0SAchim Leubner     if (onePortContext == agNULL)
118*4e1bc9a0SAchim Leubner     {
119*4e1bc9a0SAchim Leubner       DM_DBG1(("dmCreatePort: onePortContext is NULL in allocation, wrong!!!\n"));
120*4e1bc9a0SAchim Leubner       return DM_RC_FAILURE;
121*4e1bc9a0SAchim Leubner     }
122*4e1bc9a0SAchim Leubner 
123*4e1bc9a0SAchim Leubner     dmPortContext->dmData =  onePortContext;
124*4e1bc9a0SAchim Leubner     onePortContext->DiscoveryState = DM_DSTATE_NOT_STARTED;
125*4e1bc9a0SAchim Leubner     onePortContext->discoveryOptions = DM_DISCOVERY_OPTION_FULL_START;
126*4e1bc9a0SAchim Leubner 
127*4e1bc9a0SAchim Leubner     onePortContext->dmRoot = dmRoot;
128*4e1bc9a0SAchim Leubner     onePortContext->dmPortContext = dmPortContext;
129*4e1bc9a0SAchim Leubner     onePortContext->valid = agTRUE;
130*4e1bc9a0SAchim Leubner     onePortContext->RegFailed = agFALSE;
131*4e1bc9a0SAchim Leubner 
132*4e1bc9a0SAchim Leubner     onePortContext->LinkRate = DM_GET_LINK_RATE(dmPortInfo->flag);
133*4e1bc9a0SAchim Leubner     DM_DBG3(("dmCreatePort: linkrate %0x\n", onePortContext->LinkRate));
134*4e1bc9a0SAchim Leubner 
135*4e1bc9a0SAchim Leubner     onePortContext->sasRemoteAddressHi = DM_GET_SAS_ADDRESSHI(dmPortInfo->sasRemoteAddressHi);
136*4e1bc9a0SAchim Leubner     onePortContext->sasRemoteAddressLo = DM_GET_SAS_ADDRESSLO(dmPortInfo->sasRemoteAddressLo);
137*4e1bc9a0SAchim Leubner     onePortContext->sasLocalAddressHi = DM_GET_SAS_ADDRESSHI(dmPortInfo->sasLocalAddressHi);
138*4e1bc9a0SAchim Leubner     onePortContext->sasLocalAddressLo = DM_GET_SAS_ADDRESSLO(dmPortInfo->sasLocalAddressLo);
139*4e1bc9a0SAchim Leubner     DM_DBG3(("dmCreatePort: pid %d\n", onePortContext->id));
140*4e1bc9a0SAchim Leubner     DM_DBG3(("dmCreatePort: RemoteAddrHi 0x%08x RemoteAddrLo 0x%08x\n", onePortContext->sasRemoteAddressHi, onePortContext->sasRemoteAddressLo));
141*4e1bc9a0SAchim Leubner     DM_DBG3(("dmCreatePort: LocalAddrHi 0x%08x LocaAddrLo 0x%08x\n", onePortContext->sasLocalAddressHi, onePortContext->sasLocalAddressLo));
142*4e1bc9a0SAchim Leubner 
143*4e1bc9a0SAchim Leubner     tddmSingleThreadedEnter(dmRoot, DM_PORT_LOCK);
144*4e1bc9a0SAchim Leubner     DMLIST_ENQUEUE_AT_TAIL(&(onePortContext->MainLink), &(dmAllShared->MainPortContextList));
145*4e1bc9a0SAchim Leubner     tddmSingleThreadedLeave(dmRoot, DM_PORT_LOCK);
146*4e1bc9a0SAchim Leubner   }
147*4e1bc9a0SAchim Leubner   else
148*4e1bc9a0SAchim Leubner   {
149*4e1bc9a0SAchim Leubner     tddmSingleThreadedLeave(dmRoot, DM_PORT_LOCK);
150*4e1bc9a0SAchim Leubner     DM_DBG1(("dmCreatePort: Attention. no more free PortContext!!!\n"));
151*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
152*4e1bc9a0SAchim Leubner   }
153*4e1bc9a0SAchim Leubner 
154*4e1bc9a0SAchim Leubner   return DM_RC_SUCCESS;
155*4e1bc9a0SAchim Leubner }
156*4e1bc9a0SAchim Leubner 
157*4e1bc9a0SAchim Leubner /*****************************************************************************/
158*4e1bc9a0SAchim Leubner /*! \brief dmDestroyPort
159*4e1bc9a0SAchim Leubner  *
160*4e1bc9a0SAchim Leubner  *
161*4e1bc9a0SAchim Leubner  *  Purpose: A port context is destroyed by this function
162*4e1bc9a0SAchim Leubner  *
163*4e1bc9a0SAchim Leubner  *  \param   dmRoot:              DM context handle.
164*4e1bc9a0SAchim Leubner  *  \param   dmPortContext:       Pointer to this instance of port context
165*4e1bc9a0SAchim Leubner  *
166*4e1bc9a0SAchim Leubner  *  \return:
167*4e1bc9a0SAchim Leubner  *          DM_RC_SUCCESS
168*4e1bc9a0SAchim Leubner  *          DM_RC_FAILURE
169*4e1bc9a0SAchim Leubner  *
170*4e1bc9a0SAchim Leubner  */
171*4e1bc9a0SAchim Leubner /*****************************************************************************/
172*4e1bc9a0SAchim Leubner osGLOBAL bit32
dmDestroyPort(dmRoot_t * dmRoot,dmPortContext_t * dmPortContext,dmPortInfo_t * dmPortInfo)173*4e1bc9a0SAchim Leubner dmDestroyPort(
174*4e1bc9a0SAchim Leubner           dmRoot_t        *dmRoot,
175*4e1bc9a0SAchim Leubner           dmPortContext_t *dmPortContext,
176*4e1bc9a0SAchim Leubner           dmPortInfo_t    *dmPortInfo)
177*4e1bc9a0SAchim Leubner {
178*4e1bc9a0SAchim Leubner   dmIntRoot_t               *dmIntRoot    = agNULL;
179*4e1bc9a0SAchim Leubner   dmIntContext_t            *dmAllShared = agNULL;
180*4e1bc9a0SAchim Leubner   dmIntPortContext_t        *onePortContext = agNULL;
181*4e1bc9a0SAchim Leubner 
182*4e1bc9a0SAchim Leubner   DM_DBG1(("dmDestroyPort: start\n"));
183*4e1bc9a0SAchim Leubner   if (dmRoot == agNULL)
184*4e1bc9a0SAchim Leubner   {
185*4e1bc9a0SAchim Leubner     DM_DBG1(("dmDestroyPort: dmRoot is NULL, wrong!!!\n"));
186*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
187*4e1bc9a0SAchim Leubner   }
188*4e1bc9a0SAchim Leubner 
189*4e1bc9a0SAchim Leubner   if (dmPortContext == agNULL)
190*4e1bc9a0SAchim Leubner   {
191*4e1bc9a0SAchim Leubner     DM_DBG1(("dmDestroyPort: dmPortContext is NULL, wrong!!!\n"));
192*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
193*4e1bc9a0SAchim Leubner   }
194*4e1bc9a0SAchim Leubner 
195*4e1bc9a0SAchim Leubner   if (dmPortInfo == agNULL)
196*4e1bc9a0SAchim Leubner   {
197*4e1bc9a0SAchim Leubner     DM_DBG1(("dmDestroyPort: dmPortInfo is NULL, wrong!!!\n"));
198*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
199*4e1bc9a0SAchim Leubner   }
200*4e1bc9a0SAchim Leubner 
201*4e1bc9a0SAchim Leubner   dmIntRoot = (dmIntRoot_t *)dmRoot->dmData;
202*4e1bc9a0SAchim Leubner 
203*4e1bc9a0SAchim Leubner   if (dmIntRoot == agNULL)
204*4e1bc9a0SAchim Leubner   {
205*4e1bc9a0SAchim Leubner     DM_DBG1(("dmDestroyPort: dmIntRoot is NULL, wrong!!!\n"));
206*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
207*4e1bc9a0SAchim Leubner   }
208*4e1bc9a0SAchim Leubner 
209*4e1bc9a0SAchim Leubner   dmAllShared = (dmIntContext_t *)&dmIntRoot->dmAllShared;
210*4e1bc9a0SAchim Leubner 
211*4e1bc9a0SAchim Leubner   if (dmAllShared == agNULL)
212*4e1bc9a0SAchim Leubner   {
213*4e1bc9a0SAchim Leubner     DM_DBG1(("dmDestroyPort: dmAllShared is NULL, wrong!!!\n"));
214*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
215*4e1bc9a0SAchim Leubner   }
216*4e1bc9a0SAchim Leubner 
217*4e1bc9a0SAchim Leubner   /*
218*4e1bc9a0SAchim Leubner     no device(expander) to be removed since all devices should
219*4e1bc9a0SAchim Leubner     be in freelist at the end of discovery
220*4e1bc9a0SAchim Leubner     But if the discovery is in progress, abort it and clean up
221*4e1bc9a0SAchim Leubner   */
222*4e1bc9a0SAchim Leubner   onePortContext = (dmIntPortContext_t *)dmPortContext->dmData;
223*4e1bc9a0SAchim Leubner 
224*4e1bc9a0SAchim Leubner   if (onePortContext == agNULL)
225*4e1bc9a0SAchim Leubner   {
226*4e1bc9a0SAchim Leubner     DM_DBG1(("dmDestroyPort: onePortContext is NULL, wrong!!!\n"));
227*4e1bc9a0SAchim Leubner     return DM_RC_FAILURE;
228*4e1bc9a0SAchim Leubner   }
229*4e1bc9a0SAchim Leubner 
230*4e1bc9a0SAchim Leubner #if 1
231*4e1bc9a0SAchim Leubner   if (onePortContext->DiscoveryState != DM_DSTATE_COMPLETED)
232*4e1bc9a0SAchim Leubner   {
233*4e1bc9a0SAchim Leubner     dmDiscoverAbort(dmRoot, onePortContext);
234*4e1bc9a0SAchim Leubner   }
235*4e1bc9a0SAchim Leubner   else
236*4e1bc9a0SAchim Leubner   {
237*4e1bc9a0SAchim Leubner     /* move devices from dmAllShared->MainDeviceList to dmAllShared->FreeDeviceList; dmDiscoveryDeviceCleanUp()
238*4e1bc9a0SAchim Leubner        move from dmAllShared->mainExpanderList to dmAllShared->freeExpanderList; dmDiscoveryExpanderCleanUp()
239*4e1bc9a0SAchim Leubner     */
240*4e1bc9a0SAchim Leubner   }
241*4e1bc9a0SAchim Leubner #endif
242*4e1bc9a0SAchim Leubner 
243*4e1bc9a0SAchim Leubner   if (onePortContext->DiscoveryState != DM_DSTATE_COMPLETED)
244*4e1bc9a0SAchim Leubner   {
245*4e1bc9a0SAchim Leubner     /* move from dmAllShared->discoveringExpanderList to dmAllShared->mainExpanderList
246*4e1bc9a0SAchim Leubner        move from dmAllShared->UpdiscoveringExpanderList to dmAllShared->mainExpanderList
247*4e1bc9a0SAchim Leubner     */
248*4e1bc9a0SAchim Leubner     dmCleanAllExp(dmRoot, onePortContext);
249*4e1bc9a0SAchim Leubner   }
250*4e1bc9a0SAchim Leubner 
251*4e1bc9a0SAchim Leubner   /* move mainExpanderList then MainDeviceList */
252*4e1bc9a0SAchim Leubner   DM_DBG3(("dmDestroyPort: before dmDiscoveryExpanderCleanUp\n"));
253*4e1bc9a0SAchim Leubner   dmDumpAllMainExp(dmRoot, onePortContext);
254*4e1bc9a0SAchim Leubner 
255*4e1bc9a0SAchim Leubner   /* move from dmAllShared->mainExpanderList to dmAllShared->freeExpanderList */
256*4e1bc9a0SAchim Leubner   dmDiscoveryExpanderCleanUp(dmRoot, onePortContext);
257*4e1bc9a0SAchim Leubner 
258*4e1bc9a0SAchim Leubner   DM_DBG3(("dmDestroyPort: after dmDiscoveryExpanderCleanUp\n"));
259*4e1bc9a0SAchim Leubner   dmDumpAllMainExp(dmRoot, onePortContext);
260*4e1bc9a0SAchim Leubner 
261*4e1bc9a0SAchim Leubner   DM_DBG3(("dmDestroyPort: before dmDiscoveryDeviceCleanUp\n"));
262*4e1bc9a0SAchim Leubner   dmDumpAllMainDevice(dmRoot, onePortContext);
263*4e1bc9a0SAchim Leubner   /* move devices from dmAllShared->MainDeviceList to dmAllShared->FreeDeviceList */
264*4e1bc9a0SAchim Leubner   dmDiscoveryDeviceCleanUp(dmRoot, onePortContext);
265*4e1bc9a0SAchim Leubner 
266*4e1bc9a0SAchim Leubner   DM_DBG3(("dmDestroyPort: after dmDiscoveryDeviceCleanUp\n"));
267*4e1bc9a0SAchim Leubner   dmDumpAllMainDevice(dmRoot, onePortContext);
268*4e1bc9a0SAchim Leubner 
269*4e1bc9a0SAchim Leubner   dmPortContextReInit(dmRoot, onePortContext);
270*4e1bc9a0SAchim Leubner 
271*4e1bc9a0SAchim Leubner   tddmSingleThreadedEnter(dmRoot, DM_PORT_LOCK);
272*4e1bc9a0SAchim Leubner 
273*4e1bc9a0SAchim Leubner   if (DMLIST_NOT_EMPTY(&(onePortContext->MainLink)))
274*4e1bc9a0SAchim Leubner   {
275*4e1bc9a0SAchim Leubner     DMLIST_DEQUEUE_THIS(&(onePortContext->MainLink));
276*4e1bc9a0SAchim Leubner   }
277*4e1bc9a0SAchim Leubner   else
278*4e1bc9a0SAchim Leubner   {
279*4e1bc9a0SAchim Leubner     DM_DBG1(("dmDestroyPort: onePortContext->MainLink is NULL, wrong!!!\n"));
280*4e1bc9a0SAchim Leubner   }
281*4e1bc9a0SAchim Leubner 
282*4e1bc9a0SAchim Leubner   if (DMLIST_NOT_EMPTY(&(onePortContext->FreeLink)) && DMLIST_NOT_EMPTY(&(dmAllShared->FreePortContextList)))
283*4e1bc9a0SAchim Leubner   {
284*4e1bc9a0SAchim Leubner     DMLIST_ENQUEUE_AT_TAIL(&(onePortContext->FreeLink), &(dmAllShared->FreePortContextList));
285*4e1bc9a0SAchim Leubner   }
286*4e1bc9a0SAchim Leubner   else
287*4e1bc9a0SAchim Leubner   {
288*4e1bc9a0SAchim Leubner     DM_DBG1(("dmDestroyPort: onePortContext->FreeLink or dmAllShared->FreePortContextList is NULL, wrong!!!\n"));
289*4e1bc9a0SAchim Leubner   }
290*4e1bc9a0SAchim Leubner 
291*4e1bc9a0SAchim Leubner   tddmSingleThreadedLeave(dmRoot, DM_PORT_LOCK);
292*4e1bc9a0SAchim Leubner 
293*4e1bc9a0SAchim Leubner   return DM_RC_SUCCESS;
294*4e1bc9a0SAchim Leubner }
295*4e1bc9a0SAchim Leubner #endif /* FDS_ DM */
296*4e1bc9a0SAchim Leubner 
297*4e1bc9a0SAchim Leubner 
298*4e1bc9a0SAchim Leubner 
299*4e1bc9a0SAchim Leubner 
300*4e1bc9a0SAchim Leubner 
301*4e1bc9a0SAchim Leubner 
302*4e1bc9a0SAchim Leubner 
303*4e1bc9a0SAchim Leubner 
304