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 /*******************************************************************************/
23*4e1bc9a0SAchim Leubner /*! \file sadisc.c
24*4e1bc9a0SAchim Leubner * \brief The file implements the functions to do SAS/SATA discovery
25*4e1bc9a0SAchim Leubner */
26*4e1bc9a0SAchim Leubner
27*4e1bc9a0SAchim Leubner /******************************************************************************/
28*4e1bc9a0SAchim Leubner
29*4e1bc9a0SAchim Leubner #include <sys/cdefs.h>
30*4e1bc9a0SAchim Leubner #include <dev/pms/config.h>
31*4e1bc9a0SAchim Leubner
32*4e1bc9a0SAchim Leubner #include <dev/pms/RefTisa/sallsdk/spc/saglobal.h>
33*4e1bc9a0SAchim Leubner #ifdef SA_ENABLE_TRACE_FUNCTIONS
34*4e1bc9a0SAchim Leubner #ifdef siTraceFileID
35*4e1bc9a0SAchim Leubner #undef siTraceFileID
36*4e1bc9a0SAchim Leubner #endif
37*4e1bc9a0SAchim Leubner #define siTraceFileID 'C'
38*4e1bc9a0SAchim Leubner #endif
39*4e1bc9a0SAchim Leubner
40*4e1bc9a0SAchim Leubner /******************************************************************************/
41*4e1bc9a0SAchim Leubner /*! \brief Start/Abort SAS/SATA discovery
42*4e1bc9a0SAchim Leubner *
43*4e1bc9a0SAchim Leubner * Start/Abort SAS/SATA discovery
44*4e1bc9a0SAchim Leubner *
45*4e1bc9a0SAchim Leubner * \param agRoot Handles for this instance of SAS/SATA hardware
46*4e1bc9a0SAchim Leubner * \param agPortContext Pointer to this instance of port context
47*4e1bc9a0SAchim Leubner * \param type Specifies the type(s) of discovery operation to start or cancel
48*4e1bc9a0SAchim Leubner * \param option Specified the discovery option
49*4e1bc9a0SAchim Leubner *
50*4e1bc9a0SAchim Leubner * \return If discovery is started/aborted successfully
51*4e1bc9a0SAchim Leubner * - \e AGSA_RC_SUCCESS discovery is started/aborted successfully
52*4e1bc9a0SAchim Leubner * - \e AGSA_RC_FAILURE discovery is not started/aborted successfully
53*4e1bc9a0SAchim Leubner *
54*4e1bc9a0SAchim Leubner */
55*4e1bc9a0SAchim Leubner /*******************************************************************************/
saDiscover(agsaRoot_t * agRoot,agsaPortContext_t * agPortContext,bit32 type,bit32 option)56*4e1bc9a0SAchim Leubner GLOBAL bit32 saDiscover(
57*4e1bc9a0SAchim Leubner agsaRoot_t *agRoot,
58*4e1bc9a0SAchim Leubner agsaPortContext_t *agPortContext,
59*4e1bc9a0SAchim Leubner bit32 type,
60*4e1bc9a0SAchim Leubner bit32 option
61*4e1bc9a0SAchim Leubner )
62*4e1bc9a0SAchim Leubner {
63*4e1bc9a0SAchim Leubner /* Currently not supported */
64*4e1bc9a0SAchim Leubner return AGSA_RC_FAILURE;
65*4e1bc9a0SAchim Leubner }
66*4e1bc9a0SAchim Leubner
67*4e1bc9a0SAchim Leubner /******************************************************************************/
68*4e1bc9a0SAchim Leubner /*! \brief Function for target to remove stale initiator device handle
69*4e1bc9a0SAchim Leubner *
70*4e1bc9a0SAchim Leubner * function is called to ask the LL layer to remove all LL layer and SPC firmware
71*4e1bc9a0SAchim Leubner * internal resources associated with a device handle
72*4e1bc9a0SAchim Leubner *
73*4e1bc9a0SAchim Leubner * \param agRoot Handles for this instance of SAS/SATA hardware
74*4e1bc9a0SAchim Leubner * \param agDevHandle Handle of the device that this I/O request will be made on
75*4e1bc9a0SAchim Leubner *
76*4e1bc9a0SAchim Leubner * \return If the device handle is removed successfully
77*4e1bc9a0SAchim Leubner * - \e AGSA_RC_SUCCESS the device handle is removed successfully
78*4e1bc9a0SAchim Leubner * - \e AGSA_RC_BUSY the device is busy, cannot be removed now
79*4e1bc9a0SAchim Leubner *
80*4e1bc9a0SAchim Leubner */
81*4e1bc9a0SAchim Leubner /*******************************************************************************/
saDeregisterDeviceHandle(agsaRoot_t * agRoot,agsaContext_t * agContext,agsaDevHandle_t * agDevHandle,bit32 queueNum)82*4e1bc9a0SAchim Leubner GLOBAL bit32 saDeregisterDeviceHandle(
83*4e1bc9a0SAchim Leubner agsaRoot_t *agRoot,
84*4e1bc9a0SAchim Leubner agsaContext_t *agContext,
85*4e1bc9a0SAchim Leubner agsaDevHandle_t *agDevHandle,
86*4e1bc9a0SAchim Leubner bit32 queueNum
87*4e1bc9a0SAchim Leubner )
88*4e1bc9a0SAchim Leubner {
89*4e1bc9a0SAchim Leubner agsaLLRoot_t *saRoot = (agsaLLRoot_t *) (agRoot->sdkData);
90*4e1bc9a0SAchim Leubner agsaDeviceDesc_t *pDevice;
91*4e1bc9a0SAchim Leubner agsaPort_t *pPort;
92*4e1bc9a0SAchim Leubner bit32 ret = AGSA_RC_SUCCESS;
93*4e1bc9a0SAchim Leubner bit32 deviceid, portid;
94*4e1bc9a0SAchim Leubner bit32 deviceIdx;
95*4e1bc9a0SAchim Leubner
96*4e1bc9a0SAchim Leubner OS_ASSERT(agDevHandle != agNULL, "saDeregisterDeviceHandle agDevHandle is NULL");
97*4e1bc9a0SAchim Leubner
98*4e1bc9a0SAchim Leubner smTraceFuncEnter(hpDBG_VERY_LOUD, "za");
99*4e1bc9a0SAchim Leubner
100*4e1bc9a0SAchim Leubner if(agNULL == agDevHandle)
101*4e1bc9a0SAchim Leubner {
102*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "za");
103*4e1bc9a0SAchim Leubner return AGSA_RC_FAILURE;
104*4e1bc9a0SAchim Leubner }
105*4e1bc9a0SAchim Leubner
106*4e1bc9a0SAchim Leubner pDevice = (agsaDeviceDesc_t *) (agDevHandle->sdkData);
107*4e1bc9a0SAchim Leubner
108*4e1bc9a0SAchim Leubner OS_ASSERT(pDevice != agNULL, "saDeregisterDeviceHandle pDevice is NULL");
109*4e1bc9a0SAchim Leubner if(pDevice == agNULL)
110*4e1bc9a0SAchim Leubner {
111*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "za");
112*4e1bc9a0SAchim Leubner return AGSA_RC_FAILURE;
113*4e1bc9a0SAchim Leubner }
114*4e1bc9a0SAchim Leubner
115*4e1bc9a0SAchim Leubner /* find device id */
116*4e1bc9a0SAchim Leubner deviceid = pDevice->DeviceMapIndex;
117*4e1bc9a0SAchim Leubner deviceIdx = deviceid & DEVICE_ID_BITS;
118*4e1bc9a0SAchim Leubner OS_ASSERT(deviceIdx < MAX_IO_DEVICE_ENTRIES, "deviceIdx MAX_IO_DEVICE_ENTRIES");
119*4e1bc9a0SAchim Leubner pPort = pDevice->pPort;
120*4e1bc9a0SAchim Leubner /* find port id */
121*4e1bc9a0SAchim Leubner portid = pPort->portId;
122*4e1bc9a0SAchim Leubner
123*4e1bc9a0SAchim Leubner SA_DBG3(("saDeregisterDeviceHandle: start DeviceHandle %p\n", agDevHandle));
124*4e1bc9a0SAchim Leubner SA_DBG1(("saDeregisterDeviceHandle: deviceId 0x%x Device Context %p\n", deviceid, pDevice));
125*4e1bc9a0SAchim Leubner
126*4e1bc9a0SAchim Leubner if ((deviceid != saRoot->DeviceMap[deviceIdx].DeviceIdFromFW) ||
127*4e1bc9a0SAchim Leubner (pDevice != saRoot->DeviceMap[deviceIdx].DeviceHandle))
128*4e1bc9a0SAchim Leubner {
129*4e1bc9a0SAchim Leubner SA_DBG1(("saDeregisterDeviceHandle: Not match failure\n"));
130*4e1bc9a0SAchim Leubner ret = AGSA_RC_FAILURE;
131*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "za");
132*4e1bc9a0SAchim Leubner return ret;
133*4e1bc9a0SAchim Leubner }
134*4e1bc9a0SAchim Leubner
135*4e1bc9a0SAchim Leubner /* Build IOMB and send it to SPC */
136*4e1bc9a0SAchim Leubner ret = mpiDeregDevHandleCmd(agRoot, agContext, pDevice, deviceid, portid, queueNum);
137*4e1bc9a0SAchim Leubner
138*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "za");
139*4e1bc9a0SAchim Leubner return ret;
140*4e1bc9a0SAchim Leubner }
141*4e1bc9a0SAchim Leubner
142*4e1bc9a0SAchim Leubner /******************************************************************************/
143*4e1bc9a0SAchim Leubner /*! \brief Function for target to remove stale initiator device handle
144*4e1bc9a0SAchim Leubner *
145*4e1bc9a0SAchim Leubner * function is called to ask the LL layer to remove all LL layer internal resources
146*4e1bc9a0SAchim Leubner * associated with a device handle
147*4e1bc9a0SAchim Leubner *
148*4e1bc9a0SAchim Leubner * \param agRoot Handles for this instance of SAS/SATA hardware
149*4e1bc9a0SAchim Leubner * \param agDevHandle Handle of the device that this I/O request will be made on
150*4e1bc9a0SAchim Leubner *
151*4e1bc9a0SAchim Leubner * \return If the device handle is removed successfully
152*4e1bc9a0SAchim Leubner * - \e AGSA_RC_SUCCESS the device handle is removed successfully
153*4e1bc9a0SAchim Leubner * - \e AGSA_RC_BUSY the device is busy, cannot be removed now
154*4e1bc9a0SAchim Leubner *
155*4e1bc9a0SAchim Leubner */
156*4e1bc9a0SAchim Leubner /*******************************************************************************/
siRemoveDevHandle(agsaRoot_t * agRoot,agsaDevHandle_t * agDevHandle)157*4e1bc9a0SAchim Leubner GLOBAL bit32 siRemoveDevHandle(
158*4e1bc9a0SAchim Leubner agsaRoot_t *agRoot,
159*4e1bc9a0SAchim Leubner agsaDevHandle_t *agDevHandle
160*4e1bc9a0SAchim Leubner )
161*4e1bc9a0SAchim Leubner {
162*4e1bc9a0SAchim Leubner agsaDeviceDesc_t *pDevice = (agsaDeviceDesc_t *) (agDevHandle->sdkData);
163*4e1bc9a0SAchim Leubner agsaPort_t *pPort;
164*4e1bc9a0SAchim Leubner bit32 ret = AGSA_RC_SUCCESS;
165*4e1bc9a0SAchim Leubner
166*4e1bc9a0SAchim Leubner OS_ASSERT(pDevice != agNULL, "siRemoveDevHandle is NULL");
167*4e1bc9a0SAchim Leubner smTraceFuncEnter(hpDBG_VERY_LOUD,"zb");
168*4e1bc9a0SAchim Leubner
169*4e1bc9a0SAchim Leubner if (pDevice == agNULL)
170*4e1bc9a0SAchim Leubner {
171*4e1bc9a0SAchim Leubner SA_DBG1(("siRemoveDevHandle: pDevice is NULL \n"));
172*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "zb");
173*4e1bc9a0SAchim Leubner return AGSA_RC_FAILURE;
174*4e1bc9a0SAchim Leubner }
175*4e1bc9a0SAchim Leubner
176*4e1bc9a0SAchim Leubner /* If it's to remove an initiator device handle */
177*4e1bc9a0SAchim Leubner if ( &(pDevice->initiatorDevHandle) == agDevHandle )
178*4e1bc9a0SAchim Leubner {
179*4e1bc9a0SAchim Leubner (pDevice->initiatorDevHandle).sdkData = agNULL;
180*4e1bc9a0SAchim Leubner }
181*4e1bc9a0SAchim Leubner /* If it's to remove an target device handle */
182*4e1bc9a0SAchim Leubner else if ( &(pDevice->targetDevHandle) == agDevHandle )
183*4e1bc9a0SAchim Leubner {
184*4e1bc9a0SAchim Leubner (pDevice->targetDevHandle).sdkData = agNULL;
185*4e1bc9a0SAchim Leubner }
186*4e1bc9a0SAchim Leubner else
187*4e1bc9a0SAchim Leubner {
188*4e1bc9a0SAchim Leubner SA_ASSERT(agFALSE, "");
189*4e1bc9a0SAchim Leubner }
190*4e1bc9a0SAchim Leubner
191*4e1bc9a0SAchim Leubner /* remove the device descriptor if it doesn't have either initiator handle and target handle */
192*4e1bc9a0SAchim Leubner if ( (agNULL == (pDevice->initiatorDevHandle).sdkData)
193*4e1bc9a0SAchim Leubner && (agNULL == (pDevice->targetDevHandle).sdkData) )
194*4e1bc9a0SAchim Leubner {
195*4e1bc9a0SAchim Leubner /* Find the port of the device */
196*4e1bc9a0SAchim Leubner pPort = pDevice->pPort;
197*4e1bc9a0SAchim Leubner
198*4e1bc9a0SAchim Leubner /* remove the device descriptor free discover list */
199*4e1bc9a0SAchim Leubner switch ( pDevice->deviceType )
200*4e1bc9a0SAchim Leubner {
201*4e1bc9a0SAchim Leubner case STP_DEVICE: /* fall through */
202*4e1bc9a0SAchim Leubner case SSP_SMP_DEVICE:
203*4e1bc9a0SAchim Leubner case DIRECT_SATA_DEVICE:
204*4e1bc9a0SAchim Leubner {
205*4e1bc9a0SAchim Leubner SA_DBG3(("siRemoveDevHandle: remove device context %p\n", pDevice));
206*4e1bc9a0SAchim Leubner siPortDeviceRemove(agRoot, pPort, pDevice, agTRUE);
207*4e1bc9a0SAchim Leubner break;
208*4e1bc9a0SAchim Leubner }
209*4e1bc9a0SAchim Leubner default:
210*4e1bc9a0SAchim Leubner {
211*4e1bc9a0SAchim Leubner SA_DBG1(("siRemoveDevHandle: switch. Not calling siPortDeviceRemove %d\n", pDevice->deviceType));
212*4e1bc9a0SAchim Leubner break;
213*4e1bc9a0SAchim Leubner }
214*4e1bc9a0SAchim Leubner }
215*4e1bc9a0SAchim Leubner }
216*4e1bc9a0SAchim Leubner else
217*4e1bc9a0SAchim Leubner {
218*4e1bc9a0SAchim Leubner SA_DBG1(("siRemoveDevHandle: else. Not caling siPortDeviceRemove\n"));
219*4e1bc9a0SAchim Leubner }
220*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "zb");
221*4e1bc9a0SAchim Leubner return ret;
222*4e1bc9a0SAchim Leubner }
223*4e1bc9a0SAchim Leubner
224*4e1bc9a0SAchim Leubner /******************************************************************************/
225*4e1bc9a0SAchim Leubner /*! \brief Get Device Handles from a specific local port
226*4e1bc9a0SAchim Leubner *
227*4e1bc9a0SAchim Leubner * Get a Device Handles
228*4e1bc9a0SAchim Leubner *
229*4e1bc9a0SAchim Leubner * \param agRoot Handles for this instance of SAS/SATA hardware
230*4e1bc9a0SAchim Leubner * \param agsaContext Pointer to this API context
231*4e1bc9a0SAchim Leubner * \param agPortContext Pointer to this instance of port context
232*4e1bc9a0SAchim Leubner * \param flags Device flags
233*4e1bc9a0SAchim Leubner * \param agDev[] Pointer of array of device handles
234*4e1bc9a0SAchim Leubner * \param MaxDevs Specified Maximum number of Device Handles
235*4e1bc9a0SAchim Leubner *
236*4e1bc9a0SAchim Leubner * \return If GetDeviceHandles is successfully or failure
237*4e1bc9a0SAchim Leubner * - \e AGSA_RC_SUCCESS GetDeviceHandles is successfully
238*4e1bc9a0SAchim Leubner * - \e AGSA_RC_FAILURE GetDeviceHandles is not successfully
239*4e1bc9a0SAchim Leubner *
240*4e1bc9a0SAchim Leubner */
241*4e1bc9a0SAchim Leubner /*******************************************************************************/
saGetDeviceHandles(agsaRoot_t * agRoot,agsaContext_t * agContext,bit32 queueNum,agsaPortContext_t * agPortContext,bit32 flags,agsaDevHandle_t * agDev[],bit32 skipCount,bit32 MaxDevs)242*4e1bc9a0SAchim Leubner GLOBAL bit32 saGetDeviceHandles(
243*4e1bc9a0SAchim Leubner agsaRoot_t *agRoot,
244*4e1bc9a0SAchim Leubner agsaContext_t *agContext,
245*4e1bc9a0SAchim Leubner bit32 queueNum,
246*4e1bc9a0SAchim Leubner agsaPortContext_t *agPortContext,
247*4e1bc9a0SAchim Leubner bit32 flags,
248*4e1bc9a0SAchim Leubner agsaDevHandle_t *agDev[],
249*4e1bc9a0SAchim Leubner bit32 skipCount,
250*4e1bc9a0SAchim Leubner bit32 MaxDevs
251*4e1bc9a0SAchim Leubner )
252*4e1bc9a0SAchim Leubner {
253*4e1bc9a0SAchim Leubner agsaLLRoot_t *saRoot = (agsaLLRoot_t *) (agRoot->sdkData);
254*4e1bc9a0SAchim Leubner agsaPort_t *pPort = (agsaPort_t *) (agPortContext->sdkData);
255*4e1bc9a0SAchim Leubner bit32 portIndex, i;
256*4e1bc9a0SAchim Leubner bit32 ret = AGSA_RC_SUCCESS;
257*4e1bc9a0SAchim Leubner
258*4e1bc9a0SAchim Leubner OS_ASSERT(pPort != agNULL, "saGetDeviceHandles is NULL");
259*4e1bc9a0SAchim Leubner smTraceFuncEnter(hpDBG_VERY_LOUD,"zc");
260*4e1bc9a0SAchim Leubner
261*4e1bc9a0SAchim Leubner if (pPort == agNULL)
262*4e1bc9a0SAchim Leubner {
263*4e1bc9a0SAchim Leubner SA_DBG1(("saGetDeviceHandles: pPort is NULL \n"));
264*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "zc");
265*4e1bc9a0SAchim Leubner return AGSA_RC_FAILURE;
266*4e1bc9a0SAchim Leubner }
267*4e1bc9a0SAchim Leubner
268*4e1bc9a0SAchim Leubner SA_DBG1(("saGetDeviceHandles: start portId %d\n", pPort->portId));
269*4e1bc9a0SAchim Leubner
270*4e1bc9a0SAchim Leubner /* save the device handles arrary pointer */
271*4e1bc9a0SAchim Leubner for (i = 0; i < MaxDevs; i ++)
272*4e1bc9a0SAchim Leubner {
273*4e1bc9a0SAchim Leubner saRoot->DeviceHandle[i] = agDev[i];
274*4e1bc9a0SAchim Leubner }
275*4e1bc9a0SAchim Leubner
276*4e1bc9a0SAchim Leubner /* send GET_DEVICE_HANDLE IOMB to SPC */
277*4e1bc9a0SAchim Leubner portIndex = pPort->portId;
278*4e1bc9a0SAchim Leubner mpiGetDeviceHandleCmd(agRoot, agContext, portIndex, flags, MaxDevs, queueNum, skipCount);
279*4e1bc9a0SAchim Leubner
280*4e1bc9a0SAchim Leubner /* return */
281*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "zc");
282*4e1bc9a0SAchim Leubner return ret;
283*4e1bc9a0SAchim Leubner }
284*4e1bc9a0SAchim Leubner
285*4e1bc9a0SAchim Leubner /******************************************************************************/
286*4e1bc9a0SAchim Leubner /*! \brief Register New Device from a specific local port
287*4e1bc9a0SAchim Leubner *
288*4e1bc9a0SAchim Leubner * Register New Device API
289*4e1bc9a0SAchim Leubner *
290*4e1bc9a0SAchim Leubner * \param agRoot Handles for this instance of SAS/SATA hardware
291*4e1bc9a0SAchim Leubner * \param agContext Pointer to this API context
292*4e1bc9a0SAchim Leubner * \param agDeviceInfo Pointer to this instance of device info
293*4e1bc9a0SAchim Leubner * \param agPortContext Pointer to this instance of port context
294*4e1bc9a0SAchim Leubner *
295*4e1bc9a0SAchim Leubner * \return If discovery is started/aborted successfully
296*4e1bc9a0SAchim Leubner * - \e AGSA_RC_SUCCESS discovery is started/aborted successfully
297*4e1bc9a0SAchim Leubner * - \e AGSA_RC_FAILURE discovery is not started/aborted successfully
298*4e1bc9a0SAchim Leubner *
299*4e1bc9a0SAchim Leubner */
300*4e1bc9a0SAchim Leubner /*******************************************************************************/
saRegisterNewDevice(agsaRoot_t * agRoot,agsaContext_t * agContext,bit32 queueNum,agsaDeviceInfo_t * agDeviceInfo,agsaPortContext_t * agPortContext,bit16 hostAssignedDeviceId)301*4e1bc9a0SAchim Leubner GLOBAL bit32 saRegisterNewDevice(
302*4e1bc9a0SAchim Leubner agsaRoot_t *agRoot,
303*4e1bc9a0SAchim Leubner agsaContext_t *agContext,
304*4e1bc9a0SAchim Leubner bit32 queueNum,
305*4e1bc9a0SAchim Leubner agsaDeviceInfo_t *agDeviceInfo,
306*4e1bc9a0SAchim Leubner agsaPortContext_t *agPortContext,
307*4e1bc9a0SAchim Leubner bit16 hostAssignedDeviceId
308*4e1bc9a0SAchim Leubner )
309*4e1bc9a0SAchim Leubner {
310*4e1bc9a0SAchim Leubner bit32 ret = AGSA_RC_SUCCESS;
311*4e1bc9a0SAchim Leubner agsaRegDevCmd_t payload;
312*4e1bc9a0SAchim Leubner agsaLLRoot_t *saRoot = (agsaLLRoot_t *) (agRoot->sdkData);
313*4e1bc9a0SAchim Leubner agsaIORequestDesc_t *pRequest;
314*4e1bc9a0SAchim Leubner agsaPort_t *pPort = (agsaPort_t *) (agPortContext->sdkData);
315*4e1bc9a0SAchim Leubner agsaSASIdentify_t remoteIdentify;
316*4e1bc9a0SAchim Leubner bit32 i, phyId, sDTypeRate;
317*4e1bc9a0SAchim Leubner agsaDeviceDesc_t *pDevice = agNULL;
318*4e1bc9a0SAchim Leubner
319*4e1bc9a0SAchim Leubner OS_ASSERT(pPort != agNULL, "saRegisterNewDevice is NULL");
320*4e1bc9a0SAchim Leubner OS_ASSERT(saRoot != agNULL, "saRoot is NULL");
321*4e1bc9a0SAchim Leubner smTraceFuncEnter(hpDBG_VERY_LOUD,"zd");
322*4e1bc9a0SAchim Leubner
323*4e1bc9a0SAchim Leubner if(saRoot == agNULL)
324*4e1bc9a0SAchim Leubner {
325*4e1bc9a0SAchim Leubner SA_DBG1(("saRegisterNewDevice: saRoot == agNULL\n"));
326*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "zd");
327*4e1bc9a0SAchim Leubner return(AGSA_RC_FAILURE);
328*4e1bc9a0SAchim Leubner }
329*4e1bc9a0SAchim Leubner
330*4e1bc9a0SAchim Leubner if (pPort == agNULL)
331*4e1bc9a0SAchim Leubner {
332*4e1bc9a0SAchim Leubner SA_DBG1(("saRegisterNewDevice: pPort is NULL \n"));
333*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "zd");
334*4e1bc9a0SAchim Leubner return AGSA_RC_FAILURE;
335*4e1bc9a0SAchim Leubner }
336*4e1bc9a0SAchim Leubner
337*4e1bc9a0SAchim Leubner SA_DBG2(("saRegisterNewDevice: start portId %d Port Context %p\n", pPort->portId, agPortContext));
338*4e1bc9a0SAchim Leubner
339*4e1bc9a0SAchim Leubner SA_DBG2(("saRegisterNewDevice: smpTimeout 0x%x\n", agDeviceInfo->smpTimeout));
340*4e1bc9a0SAchim Leubner SA_DBG2(("saRegisterNewDevice: it_NexusTimeout 0x%x\n", agDeviceInfo->it_NexusTimeout));
341*4e1bc9a0SAchim Leubner SA_DBG2(("saRegisterNewDevice: firstBurstSize 0x%x\n", agDeviceInfo->firstBurstSize));
342*4e1bc9a0SAchim Leubner SA_DBG2(("saRegisterNewDevice: devType_S_Rate 0x%x\n", agDeviceInfo->devType_S_Rate));
343*4e1bc9a0SAchim Leubner SA_DBG2(("saRegisterNewDevice: flag 0x%x\n", agDeviceInfo->flag));
344*4e1bc9a0SAchim Leubner SA_DBG2(("saRegisterNewDevice: hostAssignedDeviceId 0x%x\n",hostAssignedDeviceId ));
345*4e1bc9a0SAchim Leubner SA_DBG2(("saRegisterNewDevice: Addr 0x%02x%02x%02x%02x 0x%02x%02x%02x%02x\n",
346*4e1bc9a0SAchim Leubner agDeviceInfo->sasAddressHi[0],agDeviceInfo->sasAddressHi[1],agDeviceInfo->sasAddressHi[2],agDeviceInfo->sasAddressHi[3],
347*4e1bc9a0SAchim Leubner agDeviceInfo->sasAddressLo[0],agDeviceInfo->sasAddressLo[1],agDeviceInfo->sasAddressLo[2],agDeviceInfo->sasAddressLo[3] ));
348*4e1bc9a0SAchim Leubner
349*4e1bc9a0SAchim Leubner agDeviceInfo->devType_S_Rate &= DEV_LINK_RATE;
350*4e1bc9a0SAchim Leubner
351*4e1bc9a0SAchim Leubner /*
352*4e1bc9a0SAchim Leubner Using agsaDeviceInfo_t, fill in only sas address and device type
353*4e1bc9a0SAchim Leubner of identify address frame
354*4e1bc9a0SAchim Leubner */
355*4e1bc9a0SAchim Leubner si_memset(&remoteIdentify, 0, sizeof(agsaSASIdentify_t));
356*4e1bc9a0SAchim Leubner for (i=0;i<4;i++)
357*4e1bc9a0SAchim Leubner {
358*4e1bc9a0SAchim Leubner remoteIdentify.sasAddressHi[i] = agDeviceInfo->sasAddressHi[i];
359*4e1bc9a0SAchim Leubner remoteIdentify.sasAddressLo[i] = agDeviceInfo->sasAddressLo[i];
360*4e1bc9a0SAchim Leubner }
361*4e1bc9a0SAchim Leubner remoteIdentify.deviceType_addressFrameType = (bit8)(agDeviceInfo->devType_S_Rate & 0xC0);
362*4e1bc9a0SAchim Leubner
363*4e1bc9a0SAchim Leubner /* Get request from free IORequests */
364*4e1bc9a0SAchim Leubner ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
365*4e1bc9a0SAchim Leubner pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeIORequests));
366*4e1bc9a0SAchim Leubner
367*4e1bc9a0SAchim Leubner /* If no LL Control request entry available */
368*4e1bc9a0SAchim Leubner if ( agNULL == pRequest )
369*4e1bc9a0SAchim Leubner {
370*4e1bc9a0SAchim Leubner pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeReservedRequests)); /**/
371*4e1bc9a0SAchim Leubner if(agNULL != pRequest)
372*4e1bc9a0SAchim Leubner {
373*4e1bc9a0SAchim Leubner saLlistIORemove(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
374*4e1bc9a0SAchim Leubner SA_DBG1(("saRegisterNewDevice, using saRoot->freeReservedRequests\n"));
375*4e1bc9a0SAchim Leubner }
376*4e1bc9a0SAchim Leubner else
377*4e1bc9a0SAchim Leubner {
378*4e1bc9a0SAchim Leubner SA_DBG1(("saRegisterNewDevice, No request from free list Not using saRoot->freeReservedRequests\n"));
379*4e1bc9a0SAchim Leubner ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
380*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "zd");
381*4e1bc9a0SAchim Leubner return AGSA_RC_BUSY;
382*4e1bc9a0SAchim Leubner }
383*4e1bc9a0SAchim Leubner }
384*4e1bc9a0SAchim Leubner else
385*4e1bc9a0SAchim Leubner {
386*4e1bc9a0SAchim Leubner /* If LL Control request entry avaliable */
387*4e1bc9a0SAchim Leubner saLlistIORemove(&(saRoot->freeIORequests), &(pRequest->linkNode));
388*4e1bc9a0SAchim Leubner }
389*4e1bc9a0SAchim Leubner
390*4e1bc9a0SAchim Leubner saRoot->IOMap[pRequest->HTag].Tag = pRequest->HTag;
391*4e1bc9a0SAchim Leubner saRoot->IOMap[pRequest->HTag].IORequest = (void *)pRequest;
392*4e1bc9a0SAchim Leubner saRoot->IOMap[pRequest->HTag].agContext = agContext;
393*4e1bc9a0SAchim Leubner pRequest->valid = agTRUE;
394*4e1bc9a0SAchim Leubner
395*4e1bc9a0SAchim Leubner ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
396*4e1bc9a0SAchim Leubner /* checking bit5 for SATA direct device */
397*4e1bc9a0SAchim Leubner if (!(agDeviceInfo->devType_S_Rate & 0x20))
398*4e1bc9a0SAchim Leubner {
399*4e1bc9a0SAchim Leubner /* SAS device */
400*4e1bc9a0SAchim Leubner /* Add SAS device to the device list */
401*4e1bc9a0SAchim Leubner pDevice = siPortSASDeviceAdd(agRoot,
402*4e1bc9a0SAchim Leubner pPort,
403*4e1bc9a0SAchim Leubner remoteIdentify,
404*4e1bc9a0SAchim Leubner agFALSE,
405*4e1bc9a0SAchim Leubner agDeviceInfo->smpTimeout,
406*4e1bc9a0SAchim Leubner agDeviceInfo->it_NexusTimeout,
407*4e1bc9a0SAchim Leubner agDeviceInfo->firstBurstSize,
408*4e1bc9a0SAchim Leubner agDeviceInfo->devType_S_Rate,
409*4e1bc9a0SAchim Leubner (agDeviceInfo->flag & DEV_INFO_MASK));
410*4e1bc9a0SAchim Leubner }
411*4e1bc9a0SAchim Leubner else
412*4e1bc9a0SAchim Leubner {
413*4e1bc9a0SAchim Leubner /* SATA device */
414*4e1bc9a0SAchim Leubner /* Add SATA device to the device list */
415*4e1bc9a0SAchim Leubner pDevice = siPortSATADeviceAdd(agRoot,
416*4e1bc9a0SAchim Leubner pPort,
417*4e1bc9a0SAchim Leubner agNULL,
418*4e1bc9a0SAchim Leubner agNULL, /* no signature */
419*4e1bc9a0SAchim Leubner agFALSE,
420*4e1bc9a0SAchim Leubner 0,
421*4e1bc9a0SAchim Leubner agDeviceInfo->smpTimeout,
422*4e1bc9a0SAchim Leubner agDeviceInfo->it_NexusTimeout,
423*4e1bc9a0SAchim Leubner agDeviceInfo->firstBurstSize,
424*4e1bc9a0SAchim Leubner agDeviceInfo->devType_S_Rate,
425*4e1bc9a0SAchim Leubner (agDeviceInfo->flag & DEV_INFO_MASK));
426*4e1bc9a0SAchim Leubner }
427*4e1bc9a0SAchim Leubner
428*4e1bc9a0SAchim Leubner SA_DBG1(("saRegisterNewDevice: Device Context %p, TypeRate 0x%x\n", pDevice, agDeviceInfo->devType_S_Rate));
429*4e1bc9a0SAchim Leubner
430*4e1bc9a0SAchim Leubner pRequest->pDevice = pDevice;
431*4e1bc9a0SAchim Leubner
432*4e1bc9a0SAchim Leubner /* adjust the flag bit to build the IOMB; use only bit0 and 1 */
433*4e1bc9a0SAchim Leubner sDTypeRate = agDeviceInfo->devType_S_Rate << SHIFT24;
434*4e1bc9a0SAchim Leubner sDTypeRate |= (agDeviceInfo->flag & 0x01);
435*4e1bc9a0SAchim Leubner /* set AWT flag */
436*4e1bc9a0SAchim Leubner sDTypeRate |= (agDeviceInfo->flag & 0x02) << 1;
437*4e1bc9a0SAchim Leubner
438*4e1bc9a0SAchim Leubner /* If the host assigned device ID is used, then set the HA bit. */
439*4e1bc9a0SAchim Leubner if ( hostAssignedDeviceId != 0 )
440*4e1bc9a0SAchim Leubner {
441*4e1bc9a0SAchim Leubner sDTypeRate |= 2;
442*4e1bc9a0SAchim Leubner SA_DBG3(("saRegisterNewDevice:hostAssignedDeviceId 0x%x sDTypeRate 0x%x\n",hostAssignedDeviceId,sDTypeRate ));
443*4e1bc9a0SAchim Leubner }
444*4e1bc9a0SAchim Leubner
445*4e1bc9a0SAchim Leubner /* Add the MCN field */
446*4e1bc9a0SAchim Leubner
447*4e1bc9a0SAchim Leubner sDTypeRate |= ((agDeviceInfo->flag >> DEV_INFO_MCN_SHIFT) & 0xf) << 4;
448*4e1bc9a0SAchim Leubner
449*4e1bc9a0SAchim Leubner /* Add the IR field */
450*4e1bc9a0SAchim Leubner sDTypeRate |= ((agDeviceInfo->flag >> DEV_INFO_IR_SHIFT) & 0x1) << 3;
451*4e1bc9a0SAchim Leubner
452*4e1bc9a0SAchim Leubner /* Add the ATAPI protocol flag */
453*4e1bc9a0SAchim Leubner sDTypeRate |= ((agDeviceInfo->flag & ATAPI_DEVICE_FLAG) << SHIFT9 );
454*4e1bc9a0SAchim Leubner
455*4e1bc9a0SAchim Leubner /* Add the AWT flag */
456*4e1bc9a0SAchim Leubner sDTypeRate |= (agDeviceInfo->flag & AWT_DEVICE_FLAG) ? (1 << SHIFT2) : 0;
457*4e1bc9a0SAchim Leubner
458*4e1bc9a0SAchim Leubner /* Add the XFER_READY flag */
459*4e1bc9a0SAchim Leubner sDTypeRate |= (agDeviceInfo->flag & XFER_RDY_PRIORTY_DEVICE_FLAG) ? (1 << SHIFT31) : 0;
460*4e1bc9a0SAchim Leubner if(agDeviceInfo->flag & XFER_RDY_PRIORTY_DEVICE_FLAG)
461*4e1bc9a0SAchim Leubner {
462*4e1bc9a0SAchim Leubner SA_DBG1(("saRegisterNewDevice: sflag XFER_RDY_PRIORTY_DEVICE_FLAG sDTypeRate 0x%x\n",sDTypeRate ));
463*4e1bc9a0SAchim Leubner }
464*4e1bc9a0SAchim Leubner #ifdef CCFLAG_FORCE_AWT_ON
465*4e1bc9a0SAchim Leubner sDTypeRate |= (1 << SHIFT2);
466*4e1bc9a0SAchim Leubner SA_DBG1(("saRegisterNewDevice: Force AWT_DEVICE_FLAG sDTypeRate 0x%x\n",sDTypeRate ));
467*4e1bc9a0SAchim Leubner #endif /* CCFLAG_FORCE_AWT_ON */
468*4e1bc9a0SAchim Leubner
469*4e1bc9a0SAchim Leubner /* create payload for IOMB */
470*4e1bc9a0SAchim Leubner si_memset(&payload, 0, sizeof(agsaRegDevCmd_t));
471*4e1bc9a0SAchim Leubner
472*4e1bc9a0SAchim Leubner SA_DBG2(("saRegisterNewDevice,flag 0x%08X\n",agDeviceInfo->flag));
473*4e1bc9a0SAchim Leubner if ((agDeviceInfo->devType_S_Rate & 0x30) == 0x20)
474*4e1bc9a0SAchim Leubner {
475*4e1bc9a0SAchim Leubner if(smIS_SPC(agRoot))
476*4e1bc9a0SAchim Leubner {
477*4e1bc9a0SAchim Leubner /* direct SATA device */
478*4e1bc9a0SAchim Leubner phyId = (agDeviceInfo->flag & 0xF0);
479*4e1bc9a0SAchim Leubner }
480*4e1bc9a0SAchim Leubner else
481*4e1bc9a0SAchim Leubner {
482*4e1bc9a0SAchim Leubner phyId = (agDeviceInfo->flag & 0xF0) << SHIFT4;
483*4e1bc9a0SAchim Leubner }
484*4e1bc9a0SAchim Leubner }
485*4e1bc9a0SAchim Leubner else
486*4e1bc9a0SAchim Leubner {
487*4e1bc9a0SAchim Leubner phyId = 0;
488*4e1bc9a0SAchim Leubner }
489*4e1bc9a0SAchim Leubner
490*4e1bc9a0SAchim Leubner smTrace(hpDBG_VERY_LOUD,"QQ",phyId);
491*4e1bc9a0SAchim Leubner /* TP:QQ phyId */
492*4e1bc9a0SAchim Leubner smTrace(hpDBG_VERY_LOUD,"QR",pPort->portId);
493*4e1bc9a0SAchim Leubner /* TP:QR portId */
494*4e1bc9a0SAchim Leubner smTrace(hpDBG_VERY_LOUD,"QS",sDTypeRate);
495*4e1bc9a0SAchim Leubner /* TP:QS sDTypeRate */
496*4e1bc9a0SAchim Leubner smTrace(hpDBG_VERY_LOUD,"QT",agDeviceInfo->it_NexusTimeout);
497*4e1bc9a0SAchim Leubner /* TP:QT agDeviceInfo->it_NexusTimeout */
498*4e1bc9a0SAchim Leubner
499*4e1bc9a0SAchim Leubner OSSA_WRITE_LE_32(agRoot, &payload, OSSA_OFFSET_OF(agsaRegDevCmd_t, phyIdportId), (bit32)(pPort->portId & PORTID_MASK) | phyId);
500*4e1bc9a0SAchim Leubner OSSA_WRITE_LE_32(agRoot, &payload, OSSA_OFFSET_OF(agsaRegDevCmd_t, dTypeLRateAwtHa), sDTypeRate);
501*4e1bc9a0SAchim Leubner OSSA_WRITE_LE_32(agRoot, &payload, OSSA_OFFSET_OF(agsaRegDevCmd_t, ITNexusTimeOut), (agDeviceInfo->it_NexusTimeout));
502*4e1bc9a0SAchim Leubner
503*4e1bc9a0SAchim Leubner smTrace(hpDBG_VERY_LOUD,"QT",(bit32)(pPort->portId & PORTID_MASK) | phyId);
504*4e1bc9a0SAchim Leubner /* TP:QT phyIdportId */
505*4e1bc9a0SAchim Leubner /* no conversion is needed since SAS address is in BE format */
506*4e1bc9a0SAchim Leubner payload.sasAddrHi = *(bit32*)agDeviceInfo->sasAddressHi;
507*4e1bc9a0SAchim Leubner payload.sasAddrLo = *(bit32*)agDeviceInfo->sasAddressLo;
508*4e1bc9a0SAchim Leubner
509*4e1bc9a0SAchim Leubner OSSA_WRITE_LE_32(agRoot, &payload, OSSA_OFFSET_OF(agsaRegDevCmd_t, tag), pRequest->HTag);
510*4e1bc9a0SAchim Leubner OSSA_WRITE_LE_32(agRoot, &payload, OSSA_OFFSET_OF(agsaRegDevCmd_t, DeviceId), ((bit32)hostAssignedDeviceId) << 16);
511*4e1bc9a0SAchim Leubner
512*4e1bc9a0SAchim Leubner if(smIS_SPC(agRoot))
513*4e1bc9a0SAchim Leubner {
514*4e1bc9a0SAchim Leubner ret = mpiBuildCmd(agRoot, (bit32 *)&payload, MPI_CATEGORY_SAS_SATA, OPC_INB_SPC_REG_DEV, IOMB_SIZE64, queueNum);
515*4e1bc9a0SAchim Leubner }
516*4e1bc9a0SAchim Leubner else
517*4e1bc9a0SAchim Leubner {
518*4e1bc9a0SAchim Leubner ret = mpiBuildCmd(agRoot, (bit32 *)&payload, MPI_CATEGORY_SAS_SATA, OPC_INB_REG_DEV, IOMB_SIZE64, queueNum);
519*4e1bc9a0SAchim Leubner }
520*4e1bc9a0SAchim Leubner
521*4e1bc9a0SAchim Leubner if (AGSA_RC_SUCCESS != ret)
522*4e1bc9a0SAchim Leubner {
523*4e1bc9a0SAchim Leubner /* return the request to free pool */
524*4e1bc9a0SAchim Leubner ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
525*4e1bc9a0SAchim Leubner /* remove the request from IOMap */
526*4e1bc9a0SAchim Leubner saRoot->IOMap[pRequest->HTag].Tag = MARK_OFF;
527*4e1bc9a0SAchim Leubner saRoot->IOMap[pRequest->HTag].IORequest = agNULL;
528*4e1bc9a0SAchim Leubner saRoot->IOMap[pRequest->HTag].agContext = agNULL;
529*4e1bc9a0SAchim Leubner pRequest->valid = agFALSE;
530*4e1bc9a0SAchim Leubner
531*4e1bc9a0SAchim Leubner if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
532*4e1bc9a0SAchim Leubner {
533*4e1bc9a0SAchim Leubner SA_DBG1(("saRegisterNewDevice: saving pRequest (%p) for later use\n", pRequest));
534*4e1bc9a0SAchim Leubner saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
535*4e1bc9a0SAchim Leubner }
536*4e1bc9a0SAchim Leubner else
537*4e1bc9a0SAchim Leubner {
538*4e1bc9a0SAchim Leubner /* return the request to free pool */
539*4e1bc9a0SAchim Leubner saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
540*4e1bc9a0SAchim Leubner }
541*4e1bc9a0SAchim Leubner ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
542*4e1bc9a0SAchim Leubner SA_DBG1(("saRegisterNewDevice, sending IOMB failed\n" ));
543*4e1bc9a0SAchim Leubner }
544*4e1bc9a0SAchim Leubner SA_DBG3(("saRegisterNewDevice: end\n"));
545*4e1bc9a0SAchim Leubner
546*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "zd");
547*4e1bc9a0SAchim Leubner return ret;
548*4e1bc9a0SAchim Leubner }
549*4e1bc9a0SAchim Leubner
550*4e1bc9a0SAchim Leubner /******************************************************************************/
551*4e1bc9a0SAchim Leubner /*! \brief Register a callback for a specific event
552*4e1bc9a0SAchim Leubner *
553*4e1bc9a0SAchim Leubner * Register a callback for a Event API
554*4e1bc9a0SAchim Leubner *
555*4e1bc9a0SAchim Leubner * \param agRoot Handles for this instance of SAS/SATA hardware
556*4e1bc9a0SAchim Leubner * \param eventSourceType Event Type
557*4e1bc9a0SAchim Leubner * \param callbackPtr Function pointer to OS layer
558*4e1bc9a0SAchim Leubner *
559*4e1bc9a0SAchim Leubner * \return
560*4e1bc9a0SAchim Leubner * - \e AGSA_RC_SUCCESS
561*4e1bc9a0SAchim Leubner * - \e AGSA_RC_FAILURE
562*4e1bc9a0SAchim Leubner *
563*4e1bc9a0SAchim Leubner */
564*4e1bc9a0SAchim Leubner /*******************************************************************************/
saRegisterEventCallback(agsaRoot_t * agRoot,bit32 eventSourceType,ossaGenericCB_t callbackPtr)565*4e1bc9a0SAchim Leubner GLOBAL bit32 saRegisterEventCallback(
566*4e1bc9a0SAchim Leubner agsaRoot_t *agRoot,
567*4e1bc9a0SAchim Leubner bit32 eventSourceType,
568*4e1bc9a0SAchim Leubner ossaGenericCB_t callbackPtr
569*4e1bc9a0SAchim Leubner )
570*4e1bc9a0SAchim Leubner {
571*4e1bc9a0SAchim Leubner agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
572*4e1bc9a0SAchim Leubner bit32 ret = AGSA_RC_FAILURE;
573*4e1bc9a0SAchim Leubner
574*4e1bc9a0SAchim Leubner SA_DBG3(("saRegisterEventCallback: start\n"));
575*4e1bc9a0SAchim Leubner switch (eventSourceType)
576*4e1bc9a0SAchim Leubner {
577*4e1bc9a0SAchim Leubner case OSSA_EVENT_SOURCE_DEVICE_HANDLE_ADDED:
578*4e1bc9a0SAchim Leubner saRoot->DeviceRegistrationCB = (ossaDeviceRegistrationCB_t)callbackPtr;
579*4e1bc9a0SAchim Leubner ret = AGSA_RC_SUCCESS;
580*4e1bc9a0SAchim Leubner break;
581*4e1bc9a0SAchim Leubner case OSSA_EVENT_SOURCE_DEVICE_HANDLE_REMOVED:
582*4e1bc9a0SAchim Leubner saRoot->DeviceDeregistrationCB = (ossaDeregisterDeviceHandleCB_t) callbackPtr;
583*4e1bc9a0SAchim Leubner ret = AGSA_RC_SUCCESS;
584*4e1bc9a0SAchim Leubner break;
585*4e1bc9a0SAchim Leubner default:
586*4e1bc9a0SAchim Leubner SA_DBG1(("saRegisterEventCallback: not allowed case %d\n", eventSourceType));
587*4e1bc9a0SAchim Leubner ret = AGSA_RC_FAILURE;
588*4e1bc9a0SAchim Leubner break;
589*4e1bc9a0SAchim Leubner }
590*4e1bc9a0SAchim Leubner return ret;
591*4e1bc9a0SAchim Leubner }
592*4e1bc9a0SAchim Leubner
593*4e1bc9a0SAchim Leubner /******************************************************************************/
594*4e1bc9a0SAchim Leubner /*! \brief Get Device Information
595*4e1bc9a0SAchim Leubner *
596*4e1bc9a0SAchim Leubner * Get SAS/SATA device information API
597*4e1bc9a0SAchim Leubner *
598*4e1bc9a0SAchim Leubner * \param agRoot Handles for this instance of SAS/SATA hardware
599*4e1bc9a0SAchim Leubner * \param option device general information or extended information
600*4e1bc9a0SAchim Leubner * \param agDevHandle Pointer of device handle
601*4e1bc9a0SAchim Leubner *
602*4e1bc9a0SAchim Leubner * \return
603*4e1bc9a0SAchim Leubner * - \e AGSA_RC_SUCCESS
604*4e1bc9a0SAchim Leubner * - \e AGSA_RC_FAILURE
605*4e1bc9a0SAchim Leubner *
606*4e1bc9a0SAchim Leubner */
607*4e1bc9a0SAchim Leubner /*******************************************************************************/
saGetDeviceInfo(agsaRoot_t * agRoot,agsaContext_t * agContext,bit32 option,bit32 queueNum,agsaDevHandle_t * agDevHandle)608*4e1bc9a0SAchim Leubner GLOBAL bit32 saGetDeviceInfo(
609*4e1bc9a0SAchim Leubner agsaRoot_t *agRoot,
610*4e1bc9a0SAchim Leubner agsaContext_t *agContext,
611*4e1bc9a0SAchim Leubner bit32 option,
612*4e1bc9a0SAchim Leubner bit32 queueNum,
613*4e1bc9a0SAchim Leubner agsaDevHandle_t *agDevHandle
614*4e1bc9a0SAchim Leubner )
615*4e1bc9a0SAchim Leubner {
616*4e1bc9a0SAchim Leubner agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
617*4e1bc9a0SAchim Leubner agsaDeviceDesc_t *pDevice = (agsaDeviceDesc_t *) (agDevHandle->sdkData);
618*4e1bc9a0SAchim Leubner bit32 deviceid;
619*4e1bc9a0SAchim Leubner bit32 ret = AGSA_RC_FAILURE;
620*4e1bc9a0SAchim Leubner
621*4e1bc9a0SAchim Leubner OS_ASSERT(pDevice != agNULL, "saGetDeviceInfo is NULL");
622*4e1bc9a0SAchim Leubner smTraceFuncEnter(hpDBG_VERY_LOUD,"ze");
623*4e1bc9a0SAchim Leubner
624*4e1bc9a0SAchim Leubner if (pDevice == agNULL)
625*4e1bc9a0SAchim Leubner {
626*4e1bc9a0SAchim Leubner SA_DBG1(("saGetDeviceInfo: pDevice is NULL \n"));
627*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "ze");
628*4e1bc9a0SAchim Leubner return AGSA_RC_FAILURE;
629*4e1bc9a0SAchim Leubner }
630*4e1bc9a0SAchim Leubner
631*4e1bc9a0SAchim Leubner /* Get deviceid */
632*4e1bc9a0SAchim Leubner deviceid = pDevice->DeviceMapIndex;
633*4e1bc9a0SAchim Leubner SA_DBG3(("saGetDeviceInfo: start pDevice %p, deviceId %d\n", pDevice, deviceid));
634*4e1bc9a0SAchim Leubner
635*4e1bc9a0SAchim Leubner /* verify the agDeviceHandle with the one in the deviceMap */
636*4e1bc9a0SAchim Leubner if ((deviceid != saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceIdFromFW) ||
637*4e1bc9a0SAchim Leubner (pDevice != saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceHandle))
638*4e1bc9a0SAchim Leubner {
639*4e1bc9a0SAchim Leubner SA_DBG1(("saGetDeviceInfo: Not match failure or device not exist\n"));
640*4e1bc9a0SAchim Leubner ret = AGSA_RC_FAILURE;
641*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "ze");
642*4e1bc9a0SAchim Leubner return ret;
643*4e1bc9a0SAchim Leubner }
644*4e1bc9a0SAchim Leubner
645*4e1bc9a0SAchim Leubner /* send IOMB to the SPC */
646*4e1bc9a0SAchim Leubner ret = mpiGetDeviceInfoCmd(agRoot, agContext, deviceid, option, queueNum);
647*4e1bc9a0SAchim Leubner
648*4e1bc9a0SAchim Leubner SA_DBG3(("saGetDeviceInfo: end\n"));
649*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "ze");
650*4e1bc9a0SAchim Leubner return ret;
651*4e1bc9a0SAchim Leubner }
652*4e1bc9a0SAchim Leubner
653*4e1bc9a0SAchim Leubner /******************************************************************************/
654*4e1bc9a0SAchim Leubner /*! \brief Set Device Information
655*4e1bc9a0SAchim Leubner *
656*4e1bc9a0SAchim Leubner * Set SAS/SATA device information API
657*4e1bc9a0SAchim Leubner *
658*4e1bc9a0SAchim Leubner * \param agRoot Handles for this instance of SAS/SATA hardware
659*4e1bc9a0SAchim Leubner * \param agContext Pointer to this API context
660*4e1bc9a0SAchim Leubner * \param queueNum IQ/OQ number
661*4e1bc9a0SAchim Leubner * \param agDevHandle Pointer of device handle
662*4e1bc9a0SAchim Leubner * \param option device general information or extended information
663*4e1bc9a0SAchim Leubner * \param param Parameter of Set Device Infomation
664*4e1bc9a0SAchim Leubner *
665*4e1bc9a0SAchim Leubner * \return
666*4e1bc9a0SAchim Leubner * - \e AGSA_RC_SUCCESS
667*4e1bc9a0SAchim Leubner * - \e AGSA_RC_FAILURE
668*4e1bc9a0SAchim Leubner *
669*4e1bc9a0SAchim Leubner */
670*4e1bc9a0SAchim Leubner /*******************************************************************************/
saSetDeviceInfo(agsaRoot_t * agRoot,agsaContext_t * agContext,bit32 queueNum,agsaDevHandle_t * agDevHandle,bit32 option,bit32 param,ossaSetDeviceInfoCB_t agCB)671*4e1bc9a0SAchim Leubner GLOBAL bit32 saSetDeviceInfo(
672*4e1bc9a0SAchim Leubner agsaRoot_t *agRoot,
673*4e1bc9a0SAchim Leubner agsaContext_t *agContext,
674*4e1bc9a0SAchim Leubner bit32 queueNum,
675*4e1bc9a0SAchim Leubner agsaDevHandle_t *agDevHandle,
676*4e1bc9a0SAchim Leubner bit32 option,
677*4e1bc9a0SAchim Leubner bit32 param,
678*4e1bc9a0SAchim Leubner ossaSetDeviceInfoCB_t agCB
679*4e1bc9a0SAchim Leubner )
680*4e1bc9a0SAchim Leubner {
681*4e1bc9a0SAchim Leubner agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
682*4e1bc9a0SAchim Leubner agsaDeviceDesc_t *pDevice = (agsaDeviceDesc_t *) (agDevHandle->sdkData);
683*4e1bc9a0SAchim Leubner bit32 deviceid;
684*4e1bc9a0SAchim Leubner bit32 ret = AGSA_RC_FAILURE;
685*4e1bc9a0SAchim Leubner
686*4e1bc9a0SAchim Leubner OS_ASSERT(pDevice != agNULL, "saSetDeviceInfo is NULL");
687*4e1bc9a0SAchim Leubner smTraceFuncEnter(hpDBG_VERY_LOUD,"zf");
688*4e1bc9a0SAchim Leubner
689*4e1bc9a0SAchim Leubner SA_DBG2(("saSetDeviceInfo: start pDevice %p, option=0x%x param=0x0%x\n", pDevice, option, param));
690*4e1bc9a0SAchim Leubner if(agNULL == pDevice )
691*4e1bc9a0SAchim Leubner {
692*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "zf");
693*4e1bc9a0SAchim Leubner return ret;
694*4e1bc9a0SAchim Leubner }
695*4e1bc9a0SAchim Leubner
696*4e1bc9a0SAchim Leubner
697*4e1bc9a0SAchim Leubner /* Get deviceid */
698*4e1bc9a0SAchim Leubner deviceid = pDevice->DeviceMapIndex;
699*4e1bc9a0SAchim Leubner pDevice->option = option;
700*4e1bc9a0SAchim Leubner pDevice->param = param;
701*4e1bc9a0SAchim Leubner
702*4e1bc9a0SAchim Leubner SA_DBG3(("saSetDeviceInfo: deviceId %d\n", deviceid));
703*4e1bc9a0SAchim Leubner
704*4e1bc9a0SAchim Leubner /* verify the agDeviceHandle with the one in the deviceMap */
705*4e1bc9a0SAchim Leubner if ((deviceid != saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceIdFromFW) ||
706*4e1bc9a0SAchim Leubner (pDevice != saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceHandle))
707*4e1bc9a0SAchim Leubner {
708*4e1bc9a0SAchim Leubner SA_DBG1(("saSetDeviceInfo: Not match failure or device not exist\n"));
709*4e1bc9a0SAchim Leubner ret = AGSA_RC_FAILURE;
710*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "zf");
711*4e1bc9a0SAchim Leubner return ret;
712*4e1bc9a0SAchim Leubner }
713*4e1bc9a0SAchim Leubner
714*4e1bc9a0SAchim Leubner /* send IOMB to the SPC */
715*4e1bc9a0SAchim Leubner ret = mpiSetDeviceInfoCmd(agRoot, agContext, deviceid, option, queueNum, param, agCB);
716*4e1bc9a0SAchim Leubner
717*4e1bc9a0SAchim Leubner SA_DBG3(("saSetDeviceInfo: end\n"));
718*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "zf");
719*4e1bc9a0SAchim Leubner return ret;
720*4e1bc9a0SAchim Leubner }
721*4e1bc9a0SAchim Leubner
722*4e1bc9a0SAchim Leubner /******************************************************************************/
723*4e1bc9a0SAchim Leubner /*! \brief Get Device State
724*4e1bc9a0SAchim Leubner *
725*4e1bc9a0SAchim Leubner * Get SAS/SATA device state API
726*4e1bc9a0SAchim Leubner *
727*4e1bc9a0SAchim Leubner * \param agRoot Handles for this instance of SAS/SATA hardware
728*4e1bc9a0SAchim Leubner * \param agContext Pointer to this API context
729*4e1bc9a0SAchim Leubner * \param queueNum IQ/OQ number
730*4e1bc9a0SAchim Leubner * \param agDevHandle Pointer of device handler
731*4e1bc9a0SAchim Leubner *
732*4e1bc9a0SAchim Leubner * \return
733*4e1bc9a0SAchim Leubner * - \e AGSA_RC_SUCCESS
734*4e1bc9a0SAchim Leubner * - \e AGSA_RC_FAILURE
735*4e1bc9a0SAchim Leubner *
736*4e1bc9a0SAchim Leubner */
737*4e1bc9a0SAchim Leubner /*******************************************************************************/
saGetDeviceState(agsaRoot_t * agRoot,agsaContext_t * agContext,bit32 queueNum,agsaDevHandle_t * agDevHandle)738*4e1bc9a0SAchim Leubner GLOBAL bit32 saGetDeviceState(
739*4e1bc9a0SAchim Leubner agsaRoot_t *agRoot,
740*4e1bc9a0SAchim Leubner agsaContext_t *agContext,
741*4e1bc9a0SAchim Leubner bit32 queueNum,
742*4e1bc9a0SAchim Leubner agsaDevHandle_t *agDevHandle
743*4e1bc9a0SAchim Leubner )
744*4e1bc9a0SAchim Leubner {
745*4e1bc9a0SAchim Leubner agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
746*4e1bc9a0SAchim Leubner agsaDeviceDesc_t *pDevice = (agsaDeviceDesc_t *) (agDevHandle->sdkData);
747*4e1bc9a0SAchim Leubner bit32 deviceid;
748*4e1bc9a0SAchim Leubner bit32 ret = AGSA_RC_FAILURE;
749*4e1bc9a0SAchim Leubner
750*4e1bc9a0SAchim Leubner OS_ASSERT(pDevice != agNULL, "saGetDeviceState is NULL");
751*4e1bc9a0SAchim Leubner smTraceFuncEnter(hpDBG_VERY_LOUD,"zg");
752*4e1bc9a0SAchim Leubner
753*4e1bc9a0SAchim Leubner if (pDevice == agNULL)
754*4e1bc9a0SAchim Leubner {
755*4e1bc9a0SAchim Leubner SA_DBG1(("saGetDeviceState: pDevice is NULL \n"));
756*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "zg");
757*4e1bc9a0SAchim Leubner return AGSA_RC_FAILURE;
758*4e1bc9a0SAchim Leubner }
759*4e1bc9a0SAchim Leubner
760*4e1bc9a0SAchim Leubner SA_DBG3(("saGetDeviceState: start pDevice %p\n", pDevice));
761*4e1bc9a0SAchim Leubner
762*4e1bc9a0SAchim Leubner /* Get deviceid */
763*4e1bc9a0SAchim Leubner deviceid = pDevice->DeviceMapIndex;
764*4e1bc9a0SAchim Leubner
765*4e1bc9a0SAchim Leubner /* verify the agDeviceHandle with the one in the deviceMap */
766*4e1bc9a0SAchim Leubner if ((deviceid != saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceIdFromFW) ||
767*4e1bc9a0SAchim Leubner (pDevice != saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceHandle))
768*4e1bc9a0SAchim Leubner {
769*4e1bc9a0SAchim Leubner SA_DBG1(("saGetDeviceState: Not match failure or device not exist\n"));
770*4e1bc9a0SAchim Leubner ret = AGSA_RC_FAILURE;
771*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "zg");
772*4e1bc9a0SAchim Leubner return ret;
773*4e1bc9a0SAchim Leubner }
774*4e1bc9a0SAchim Leubner
775*4e1bc9a0SAchim Leubner /* send IOMB to the SPC */
776*4e1bc9a0SAchim Leubner ret = mpiGetDeviceStateCmd(agRoot, agContext, deviceid, queueNum);
777*4e1bc9a0SAchim Leubner
778*4e1bc9a0SAchim Leubner SA_DBG3(("saGetDeviceState: end\n"));
779*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "zg");
780*4e1bc9a0SAchim Leubner return ret;
781*4e1bc9a0SAchim Leubner }
782*4e1bc9a0SAchim Leubner
783*4e1bc9a0SAchim Leubner /******************************************************************************/
784*4e1bc9a0SAchim Leubner /*! \brief Set Device State
785*4e1bc9a0SAchim Leubner *
786*4e1bc9a0SAchim Leubner * Set SAS/SATA device state API
787*4e1bc9a0SAchim Leubner *
788*4e1bc9a0SAchim Leubner * \param agRoot Handles for this instance of SAS/SATA hardware
789*4e1bc9a0SAchim Leubner * \param agContext Pointer to this API context
790*4e1bc9a0SAchim Leubner * \param queueNum IQ/OQ number
791*4e1bc9a0SAchim Leubner * \param agDevHandle Pointer of device handler
792*4e1bc9a0SAchim Leubner * \param newDeviceState new device state
793*4e1bc9a0SAchim Leubner *
794*4e1bc9a0SAchim Leubner * \return
795*4e1bc9a0SAchim Leubner * - \e AGSA_RC_SUCCESS
796*4e1bc9a0SAchim Leubner * - \e AGSA_RC_FAILURE
797*4e1bc9a0SAchim Leubner *
798*4e1bc9a0SAchim Leubner */
799*4e1bc9a0SAchim Leubner /*******************************************************************************/
saSetDeviceState(agsaRoot_t * agRoot,agsaContext_t * agContext,bit32 queueNum,agsaDevHandle_t * agDevHandle,bit32 newDeviceState)800*4e1bc9a0SAchim Leubner GLOBAL bit32 saSetDeviceState(
801*4e1bc9a0SAchim Leubner agsaRoot_t *agRoot,
802*4e1bc9a0SAchim Leubner agsaContext_t *agContext,
803*4e1bc9a0SAchim Leubner bit32 queueNum,
804*4e1bc9a0SAchim Leubner agsaDevHandle_t *agDevHandle,
805*4e1bc9a0SAchim Leubner bit32 newDeviceState
806*4e1bc9a0SAchim Leubner )
807*4e1bc9a0SAchim Leubner {
808*4e1bc9a0SAchim Leubner agsaLLRoot_t *saRoot;
809*4e1bc9a0SAchim Leubner agsaDeviceDesc_t *pDevice;
810*4e1bc9a0SAchim Leubner bit32 deviceid;
811*4e1bc9a0SAchim Leubner bit32 ret = AGSA_RC_FAILURE;
812*4e1bc9a0SAchim Leubner
813*4e1bc9a0SAchim Leubner saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
814*4e1bc9a0SAchim Leubner OS_ASSERT(saRoot != agNULL, "saSetDeviceState saRoot");
815*4e1bc9a0SAchim Leubner
816*4e1bc9a0SAchim Leubner if(saRoot == agNULL )
817*4e1bc9a0SAchim Leubner {
818*4e1bc9a0SAchim Leubner SA_DBG1(("saSetDeviceState: saRoot is NULL\n"));
819*4e1bc9a0SAchim Leubner return ret;
820*4e1bc9a0SAchim Leubner }
821*4e1bc9a0SAchim Leubner
822*4e1bc9a0SAchim Leubner OS_ASSERT(agDevHandle != agNULL, "saSetDeviceState agDevHandle is NULL");
823*4e1bc9a0SAchim Leubner
824*4e1bc9a0SAchim Leubner smTraceFuncEnter(hpDBG_VERY_LOUD,"zh");
825*4e1bc9a0SAchim Leubner
826*4e1bc9a0SAchim Leubner if(agDevHandle == agNULL )
827*4e1bc9a0SAchim Leubner {
828*4e1bc9a0SAchim Leubner SA_DBG1(("saSetDeviceState: agDevHandle is NULL\n"));
829*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "zh");
830*4e1bc9a0SAchim Leubner return ret;
831*4e1bc9a0SAchim Leubner }
832*4e1bc9a0SAchim Leubner
833*4e1bc9a0SAchim Leubner pDevice = (agsaDeviceDesc_t *) (agDevHandle->sdkData);
834*4e1bc9a0SAchim Leubner
835*4e1bc9a0SAchim Leubner OS_ASSERT(pDevice != agNULL, "saSetDeviceState pDevice is NULL");
836*4e1bc9a0SAchim Leubner
837*4e1bc9a0SAchim Leubner SA_DBG3(("saSetDeviceState: start pDevice %p\n", pDevice));
838*4e1bc9a0SAchim Leubner
839*4e1bc9a0SAchim Leubner if(pDevice == agNULL )
840*4e1bc9a0SAchim Leubner {
841*4e1bc9a0SAchim Leubner SA_DBG1(("saSetDeviceState: pDevice is NULL\n"));
842*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "zh");
843*4e1bc9a0SAchim Leubner return ret;
844*4e1bc9a0SAchim Leubner }
845*4e1bc9a0SAchim Leubner /* Get deviceid */
846*4e1bc9a0SAchim Leubner deviceid = pDevice->DeviceMapIndex;
847*4e1bc9a0SAchim Leubner
848*4e1bc9a0SAchim Leubner /* verify the agDeviceHandle with the one in the deviceMap */
849*4e1bc9a0SAchim Leubner if ((deviceid != saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceIdFromFW) ||
850*4e1bc9a0SAchim Leubner (pDevice != saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceHandle))
851*4e1bc9a0SAchim Leubner {
852*4e1bc9a0SAchim Leubner SA_DBG1(("saSetDeviceState: Not match failure or device not exist\n"));
853*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "zh");
854*4e1bc9a0SAchim Leubner return ret;
855*4e1bc9a0SAchim Leubner }
856*4e1bc9a0SAchim Leubner
857*4e1bc9a0SAchim Leubner /* send IOMB to the SPC */
858*4e1bc9a0SAchim Leubner ret = mpiSetDeviceStateCmd(agRoot, agContext, deviceid, newDeviceState, queueNum);
859*4e1bc9a0SAchim Leubner
860*4e1bc9a0SAchim Leubner SA_DBG3(("saSetDeviceState: end\n"));
861*4e1bc9a0SAchim Leubner smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "zh");
862*4e1bc9a0SAchim Leubner return ret;
863*4e1bc9a0SAchim Leubner }
864