1285809Sscottl/*******************************************************************************
2285809Sscottl*Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
3285809Sscottl*
4285809Sscottl*Redistribution and use in source and binary forms, with or without modification, are permitted provided
5285809Sscottl*that the following conditions are met:
6285809Sscottl*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7285809Sscottl*following disclaimer.
8285809Sscottl*2. Redistributions in binary form must reproduce the above copyright notice,
9285809Sscottl*this list of conditions and the following disclaimer in the documentation and/or other materials provided
10285809Sscottl*with the distribution.
11285809Sscottl*
12285809Sscottl*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13285809Sscottl*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14285809Sscottl*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15285809Sscottl*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16285809Sscottl*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17285809Sscottl*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18285809Sscottl*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19285809Sscottl*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20285809Sscottl
21285809Sscottl********************************************************************************/
22285809Sscottl/*******************************************************************************/
23285809Sscottl/** \file
24285809Sscottl *
25285809Sscottl * $RCSfile: ttdsmp.c,v $
26285809Sscottl *
27285809Sscottl * Copyright 2006 PMC-Sierra, Inc.
28285809Sscottl *
29285809Sscottl * $Author: hasungwo $
30285809Sscottl * $Revision: 112322 $
31285809Sscottl * $Date: 2012-01-04 19:23:42 -0800 (Wed, 04 Jan 2012) $
32285809Sscottl *
33285809Sscottl * This file contains initiator IO related functions in TD layer
34285809Sscottl *
35285809Sscottl */
36285809Sscottl#include <osenv.h>
37285809Sscottl#include <ostypes.h>
38285809Sscottl#include <osdebug.h>
39285809Sscottl
40285809Sscottl#include <sa.h>
41285809Sscottl#include <saapi.h>
42285809Sscottl#include <saosapi.h>
43285809Sscottl
44285809Sscottl#include <titypes.h>
45285809Sscottl#include <ostiapi.h>
46285809Sscottl#include <tiapi.h>
47285809Sscottl#include <tiglobal.h>
48285809Sscottl
49285809Sscottl#include <tdtypes.h>
50285809Sscottl#include <osstring.h>
51285809Sscottl#include <tdutil.h>
52285809Sscottl
53285809Sscottl#ifdef INITIATOR_DRIVER
54285809Sscottl#include <itdtypes.h>
55285809Sscottl#include <itddefs.h>
56285809Sscottl#include <itdglobl.h>
57285809Sscottl#endif
58285809Sscottl
59285809Sscottl#ifdef TARGET_DRIVER
60285809Sscottl#include "ttdglobl.h"
61285809Sscottl#include "ttdtxchg.h"
62285809Sscottl#include "ttdtypes.h"
63285809Sscottl#endif
64285809Sscottl
65285809Sscottl#include <tdsatypes.h>
66285809Sscottl#include <tdproto.h>
67285809Sscottl
68285809SscottlosGLOBAL void
69285809SscottlttdsaSMPCompleted(
70285809Sscottl                  agsaRoot_t            *agRoot,
71285809Sscottl                  agsaIORequest_t       *agIORequest,
72285809Sscottl                  bit32                 agIOStatus,
73285809Sscottl                  //agsaSMPFrameHeader_t  *agFrameHeader, //(TP)
74285809Sscottl                  bit32                 agIOInfoLen,
75285809Sscottl                  agsaFrameHandle_t     agFrameHandle
76285809Sscottl                 )
77285809Sscottl{
78285809Sscottl  tdsaRootOsData_t       *osData = (tdsaRootOsData_t *)agRoot->osData;
79285809Sscottl  tiRoot_t               *tiRoot = (tiRoot_t *)osData->tiRoot;
80285809Sscottl  ttdsaXchg_t            *ttdsaXchg    = (ttdsaXchg_t *)agIORequest->osData;
81285809Sscottl
82285809Sscottl  /* cf) ttdsaIOCompleted */
83285809Sscottl  TI_DBG1(("ttdsaSMPCompleted: start\n"));
84285809Sscottl  if (tiRoot == agNULL)
85285809Sscottl  {
86285809Sscottl    TI_DBG1(("ttdsaSMPCompleted: tiRoot is NULL, wrong\n"));
87285809Sscottl    return;
88285809Sscottl  }
89285809Sscottl
90285809Sscottl  if (ttdsaXchg == agNULL)
91285809Sscottl  {
92285809Sscottl    TI_DBG1(("ttdsaSMPCompleted: ttdsaXchg is NULL, wrong\n"));
93285809Sscottl    return;
94285809Sscottl  }
95285809Sscottl
96285809Sscottl  ttdsaXchgFreeStruct(tiRoot,ttdsaXchg);
97285809Sscottl
98285809Sscottl
99285809Sscottl  /* to-do: no callback to OS layer */
100285809Sscottl  return;
101285809Sscottl}
102285809Sscottl
103285809SscottlosGLOBAL void
104285809SscottlttdsaNotSupportRespSend(
105285809Sscottl                        agsaRoot_t            *agRoot,
106285809Sscottl                        agsaDevHandle_t       *agDevHandle,
107285809Sscottl                        ttdsaXchg_t           *ttdsaXchg,
108285809Sscottl                        bit8                  smpfn
109285809Sscottl                        )
110285809Sscottl{
111285809Sscottl  bit32                     agRequestType;
112285809Sscottl  agsaSASRequestBody_t      *agSASRequestBody;
113285809Sscottl  agsaSMPFrame_t            *agSMPFrame;
114285809Sscottl  agsaIORequest_t           *agIORequest;
115285809Sscottl  bit8                       SMPPayload[SMP_DIRECT_PAYLOAD_LIMIT];    /*(TP)*/
116285809Sscottl  tdssSMPFrameHeader_t       tdSMPFrameHeader;              /*(TP)*/
117285809Sscottl
118285809Sscottl  TI_DBG1(("ttdsaNotSupportSend:\n"));
119285809Sscottl  agRequestType = AGSA_SMP_TGT_RESPONSE;
120285809Sscottl
121285809Sscottl  agIORequest = &(ttdsaXchg->SMPRequestBody.agIORequest);
122285809Sscottl
123285809Sscottl  agSASRequestBody = &(ttdsaXchg->SMPRequestBody.agSASRequestBody);
124285809Sscottl  agSMPFrame = &(agSASRequestBody->smpFrame);
125285809Sscottl
126285809Sscottl  osti_memset(&tdSMPFrameHeader, 0, sizeof(tdssSMPFrameHeader_t));    /*(TP)*/
127285809Sscottl
128285809Sscottl  /* smp header */                            /*(TP)*/
129285809Sscottl  tdSMPFrameHeader.smpFrameType = SMP_RESPONSE; /* SMP response */
130285809Sscottl  tdSMPFrameHeader.smpFunction = smpfn;
131285809Sscottl  tdSMPFrameHeader.smpFunctionResult = UNKNOWN_SMP_FUNCTION; /* unknown smp */
132285809Sscottl  tdSMPFrameHeader.smpReserved = 0;
133285809Sscottl
134285809Sscottl  /*old*/
135285809Sscottl  //agSMPFrame->frameHeader.smpFrameType = SMP_RESPONSE; /* SMP response */
136285809Sscottl  //agSMPFrame->frameHeader.smpFunction = smpfn;
137285809Sscottl  //agSMPFrame->frameHeader.smpFunctionResult = UNKNOWN_SMP_FUNCTION; /* unknown smp */
138285809Sscottl
139285809Sscottl  osti_memcpy(SMPPayload, &tdSMPFrameHeader, 4);            /*TP)*/
140285809Sscottl
141285809Sscottl  agSMPFrame->outFrameBuf = SMPPayload;                 /*(TP)*/
142285809Sscottl  agSMPFrame->outFrameAddrUpper32 = ttdsaXchg->smpresp.phyAddrUpper;
143285809Sscottl  agSMPFrame->outFrameAddrLower32 = ttdsaXchg->smpresp.phyAddrLower;
144285809Sscottl  agSMPFrame->outFrameLen = 0; /* no smp response payload */
145285809Sscottl
146285809Sscottl  //agSMPFrame->phyId = ttdsaXchg->SMPphyId;
147285809Sscottl
148285809Sscottl#ifdef RPM_SOC
149285809Sscottl  /* not work yet because of high priority q */
150285809Sscottl  saSMPStart(
151285809Sscottl             agRoot,
152285809Sscottl             agIORequest,
153285809Sscottl             agDevHandle,
154285809Sscottl             agRequestType,
155285809Sscottl             agSASRequestBody,
156285809Sscottl             &ossaSMPCompleted
157285809Sscottl             );
158285809Sscottl#else
159285809Sscottl  saSMPStart(
160285809Sscottl             agRoot,
161285809Sscottl             agIORequest,
162285809Sscottl             0, /* queue number */
163285809Sscottl             agDevHandle,
164285809Sscottl             agRequestType,
165285809Sscottl             agSASRequestBody,
166285809Sscottl             &ossaSMPCompleted
167285809Sscottl             );
168285809Sscottl#endif
169285809Sscottl  return;
170285809Sscottl}
171285809Sscottl
172285809SscottlosGLOBAL void
173285809SscottlttdsaDiscoverRespSend(
174285809Sscottl                      agsaRoot_t            *agRoot,
175285809Sscottl                      agsaDevHandle_t       *agDevHandle,
176285809Sscottl                      ttdsaXchg_t           *ttdsaXchg
177285809Sscottl                      )
178285809Sscottl{
179285809Sscottl  bit32                     agRequestType;
180285809Sscottl  agsaSASRequestBody_t      *agSASRequestBody;
181285809Sscottl  agsaSMPFrame_t            *agSMPFrame;
182285809Sscottl  smpRespDiscover_t         *Resp;
183285809Sscottl  smp_resp_t                *SMPResp;
184285809Sscottl  agsaIORequest_t           *agIORequest;
185285809Sscottl  bit8                       SMPPayload[SMP_DIRECT_PAYLOAD_LIMIT];    /*(TP)*/
186285809Sscottl  tdssSMPFrameHeader_t       tdSMPFrameHeader;              /*(TP)*/
187285809Sscottl
188285809Sscottl  TI_DBG1(("ttdsaDiscoverRespSend:\n"));
189285809Sscottl
190285809Sscottl  agRequestType = AGSA_SMP_TGT_RESPONSE;
191285809Sscottl
192285809Sscottl  SMPResp = (smp_resp_t *)ttdsaXchg->smpresp.virtAddr;
193285809Sscottl
194285809Sscottl  agIORequest = &(ttdsaXchg->SMPRequestBody.agIORequest);
195285809Sscottl
196285809Sscottl  agSASRequestBody = &(ttdsaXchg->SMPRequestBody.agSASRequestBody);
197285809Sscottl  agSMPFrame = &(agSASRequestBody->smpFrame);
198285809Sscottl
199285809Sscottl  osti_memset(&tdSMPFrameHeader, 0, sizeof(tdssSMPFrameHeader_t));    /*(TP)*/
200285809Sscottl
201285809Sscottl  /* smp header */                          /*(TP)*/
202285809Sscottl  tdSMPFrameHeader.smpFrameType = SMP_RESPONSE; /* SMP response */
203285809Sscottl  tdSMPFrameHeader.smpFunction = SMP_DISCOVER; /* discover */
204285809Sscottl  tdSMPFrameHeader.smpFunctionResult = SMP_FUNCTION_ACCEPTED;
205285809Sscottl  tdSMPFrameHeader.smpReserved = 0;
206285809Sscottl
207285809Sscottl  /*old*/
208285809Sscottl  //agSMPFrame->frameHeader.smpFrameType = SMP_RESPONSE; /* SMP response */
209285809Sscottl  //agSMPFrame->frameHeader.smpFunction = SMP_DISCOVER; /* discover */
210285809Sscottl  //agSMPFrame->frameHeader.smpFunctionResult = SMP_FUNCTION_ACCEPTED;
211285809Sscottl
212285809Sscottl  osti_memcpy(SMPPayload, &tdSMPFrameHeader, 4);            /*TP)*/
213285809Sscottl
214285809Sscottl  agSMPFrame->outFrameBuf = SMPPayload;                 /*(TP)*/
215285809Sscottl  agSMPFrame->outFrameAddrUpper32 = ttdsaXchg->smpresp.phyAddrUpper;
216285809Sscottl  agSMPFrame->outFrameAddrLower32 = ttdsaXchg->smpresp.phyAddrLower;
217285809Sscottl  agSMPFrame->outFrameLen = sizeof(smpRespDiscover_t);
218285809Sscottl
219285809Sscottl  //agSMPFrame->phyId = ttdsaXchg->SMPphyId;
220285809Sscottl
221285809Sscottl  /* smp response payload */
222285809Sscottl  Resp = (smpRespDiscover_t *)&(SMPResp->RespData);
223285809Sscottl  osti_memset(Resp, 0, sizeof(smpRespDiscover_t));
224285809Sscottl  /* temp, hardcode smp discover response */
225285809Sscottl  /* needs to read contents from ID frame */
226285809Sscottl  /* assumption: for now, attached to edge expander */
227285809Sscottl  Resp->phyIdentifier = 0;
228285809Sscottl  Resp->attachedDeviceType = SAS_EDGE_EXPANDER_DEVICE;
229285809Sscottl  Resp->negotiatedPhyLinkRate = 0x9; /* enabled, 1.5G */
230285809Sscottl  Resp->attached_Ssp_Stp_Smp_Sata_Initiator = 0;
231285809Sscottl  Resp->attached_SataPS_Ssp_Stp_Smp_Sata_Target = 0x2; /* SMP target */
232285809Sscottl  Resp->sasAddressHi[3] = 0x01;
233285809Sscottl  Resp->sasAddressHi[2] = 0x02;
234285809Sscottl  Resp->sasAddressHi[1] = 0x03;
235285809Sscottl  Resp->sasAddressHi[0] = 0x04;
236285809Sscottl  Resp->sasAddressLo[3] = 0x05;
237285809Sscottl  Resp->sasAddressLo[2] = 0x06;
238285809Sscottl  Resp->sasAddressLo[1] = 0x07;
239285809Sscottl  Resp->sasAddressLo[0] = 0x08;
240285809Sscottl
241285809Sscottl  Resp->attachedSasAddressHi[3] = 0x01;
242285809Sscottl  Resp->attachedSasAddressHi[2] = 0x01;
243285809Sscottl  Resp->attachedSasAddressHi[1] = 0x01;
244285809Sscottl  Resp->attachedSasAddressHi[0] = 0x01;
245285809Sscottl  Resp->attachedSasAddressLo[3] = 0x02;
246285809Sscottl  Resp->attachedSasAddressLo[2] = 0x02;
247285809Sscottl  Resp->attachedSasAddressLo[1] = 0x02;
248285809Sscottl  Resp->attachedSasAddressLo[0] = 0x02;
249285809Sscottl
250285809Sscottl  Resp->attachedPhyIdentifier = 0;
251285809Sscottl  Resp->programmedAndHardware_MinPhyLinkRate = 0x8; /* not programmable and 1.5 G */
252285809Sscottl  Resp->programmedAndHardware_MaxPhyLinkRate = 0x8; /* not programmable and 1.5 G */
253285809Sscottl  Resp->phyChangeCount = 0; /* No broadcast(Change) received */
254285809Sscottl  Resp->virtualPhy_partialPathwayTimeout = 0x7; /* no virutal phy and see spec 10.4.3.5, p 404 rev 7 */
255285809Sscottl  Resp->routingAttribute = 0;
256285809Sscottl  osti_memset(&Resp->reserved13, 0, 5);
257285809Sscottl  osti_memset(&Resp->vendorSpecific, 0, 2);
258285809Sscottl
259285809Sscottl#ifdef RPM_SOC
260285809Sscottl  /* not work yet because of high priority q */
261285809Sscottl  saSMPStart(
262285809Sscottl             agRoot,
263285809Sscottl             agIORequest,
264285809Sscottl             agDevHandle,
265285809Sscottl             agRequestType,
266285809Sscottl             agSASRequestBody,
267285809Sscottl             &ossaSMPCompleted
268285809Sscottl             );
269285809Sscottl#else
270285809Sscottl  saSMPStart(
271285809Sscottl             agRoot,
272285809Sscottl             agIORequest,
273285809Sscottl             0, /* queue number */
274285809Sscottl             agDevHandle,
275285809Sscottl             agRequestType,
276285809Sscottl             agSASRequestBody,
277285809Sscottl             &ossaSMPCompleted
278285809Sscottl             );
279285809Sscottl#endif
280285809Sscottl  return;
281285809Sscottl}
282285809Sscottl
283285809SscottlosGLOBAL void
284285809SscottlttdsaReportGeneralRespSend(
285285809Sscottl                           agsaRoot_t            *agRoot,
286285809Sscottl                           agsaDevHandle_t       *agDevHandle,
287285809Sscottl                           ttdsaXchg_t           *ttdsaXchg
288285809Sscottl                           )
289285809Sscottl{
290285809Sscottl  bit32                     agRequestType;
291285809Sscottl  agsaSASRequestBody_t      *agSASRequestBody;
292285809Sscottl  agsaSMPFrame_t            *agSMPFrame;
293285809Sscottl  smpRespReportGeneral_t    *Resp;
294285809Sscottl  smp_resp_t                *SMPResp;
295285809Sscottl  agsaIORequest_t           *agIORequest;
296285809Sscottl  bit8                       SMPPayload[SMP_DIRECT_PAYLOAD_LIMIT];    /*(TP)*/
297285809Sscottl  tdssSMPFrameHeader_t       tdSMPFrameHeader;              /*(TP)*/
298285809Sscottl
299285809Sscottl  TI_DBG1(("ttdsaReportGeneralRespSend:\n"));
300285809Sscottl
301285809Sscottl  agRequestType = AGSA_SMP_TGT_RESPONSE;
302285809Sscottl
303285809Sscottl  SMPResp = (smp_resp_t *)ttdsaXchg->smpresp.virtAddr;
304285809Sscottl
305285809Sscottl  agIORequest = &(ttdsaXchg->SMPRequestBody.agIORequest);
306285809Sscottl
307285809Sscottl  agSASRequestBody = &(ttdsaXchg->SMPRequestBody.agSASRequestBody);
308285809Sscottl  agSMPFrame = &(agSASRequestBody->smpFrame);
309285809Sscottl
310285809Sscottl  osti_memset(&tdSMPFrameHeader, 0, sizeof(tdssSMPFrameHeader_t));    /*(TP)*/
311285809Sscottl
312285809Sscottl  tdSMPFrameHeader.smpFrameType = SMP_RESPONSE; /* SMP response */
313285809Sscottl  tdSMPFrameHeader.smpFunction = SMP_REPORT_GENERAL; /* report general */
314285809Sscottl  tdSMPFrameHeader.smpFunctionResult = SMP_FUNCTION_ACCEPTED;
315285809Sscottl  tdSMPFrameHeader.smpReserved = 0;
316285809Sscottl
317285809Sscottl  /*old*/
318285809Sscottl  //agSMPFrame->frameHeader.smpFrameType = SMP_RESPONSE; /* SMP response */
319285809Sscottl  //agSMPFrame->frameHeader.smpFunction = SMP_REPORT_GENERAL; /* report general */
320285809Sscottl  //agSMPFrame->frameHeader.smpFunctionResult = SMP_FUNCTION_ACCEPTED;
321285809Sscottl
322285809Sscottl  osti_memcpy(SMPPayload, &tdSMPFrameHeader, 4);            /*(TP)*/
323285809Sscottl
324285809Sscottl  agSMPFrame->outFrameBuf = SMPPayload;                 /*(TP)*/
325285809Sscottl  agSMPFrame->outFrameAddrUpper32 = ttdsaXchg->smpresp.phyAddrUpper;
326285809Sscottl  agSMPFrame->outFrameAddrLower32 = ttdsaXchg->smpresp.phyAddrLower;
327285809Sscottl  agSMPFrame->outFrameLen = sizeof(smpRespReportGeneral_t);
328285809Sscottl
329285809Sscottl  //agSMPFrame->phyId = ttdsaXchg->SMPphyId;
330285809Sscottl
331285809Sscottl  /* smp response payload */
332285809Sscottl  Resp = (smpRespReportGeneral_t *)&(SMPResp->RespData);
333285809Sscottl  osti_memset(Resp, 0, sizeof(smpRespReportGeneral_t));
334285809Sscottl  /* temp, hardcode smp general response */
335285809Sscottl  Resp->expanderChangeCount16[0] = 1;
336285809Sscottl  Resp->expanderRouteIndexes16[0] = 2;
337285809Sscottl  Resp->numOfPhys = 0x5; /* 0x1; */
338285809Sscottl  Resp->configuring_configurable = 0;
339285809Sscottl  tdhexdump("smp general response", (bit8 *)Resp, sizeof(smpRespReportGeneral_t));
340285809Sscottl
341285809Sscottl#ifdef RPM_SOC
342285809Sscottl  /* not work yet because of high priority q */
343285809Sscottl  saSMPStart(
344285809Sscottl             agRoot,
345285809Sscottl             agIORequest,
346285809Sscottl             agDevHandle,
347285809Sscottl             agRequestType,
348285809Sscottl             agSASRequestBody,
349285809Sscottl              &ossaSMPCompleted
350285809Sscottl             );
351285809Sscottl #else
352285809Sscottl  saSMPStart(
353285809Sscottl             agRoot,
354285809Sscottl             agIORequest,
355285809Sscottl             0, /* queue number */
356285809Sscottl             agDevHandle,
357285809Sscottl             agRequestType,
358285809Sscottl             agSASRequestBody,
359285809Sscottl             &ossaSMPCompleted
360285809Sscottl             );
361285809Sscottl#endif
362285809Sscottl  return;
363285809Sscottl}
364285809Sscottl
365285809Sscottl
366285809SscottlosGLOBAL void
367285809SscottlttdsaSMPReqReceived(
368285809Sscottl                    agsaRoot_t            *agRoot,
369285809Sscottl                    agsaDevHandle_t       *agDevHandle,
370285809Sscottl                    agsaSMPFrameHeader_t  *agFrameHeader,
371285809Sscottl                    agsaFrameHandle_t     agFrameHandle,
372285809Sscottl                    bit32                 agFrameLength,
373285809Sscottl                    bit32                 phyId
374285809Sscottl                    )
375285809Sscottl{
376285809Sscottl  tdsaRootOsData_t       *osData = (tdsaRootOsData_t *)agRoot->osData;
377285809Sscottl  tiRoot_t               *tiRoot = (tiRoot_t *)osData->tiRoot;
378285809Sscottl  ttdsaXchg_t            *ttdsaXchg;
379285809Sscottl  tdsaDeviceData_t       *oneDeviceData = agNULL;
380285809Sscottl
381285809Sscottl
382285809Sscottl  TI_DBG1(("ttdsaSMPReqReceived: start\n"));
383285809Sscottl
384285809Sscottl  oneDeviceData = (tdsaDeviceData_t *)agDevHandle->osData;
385285809Sscottl
386285809Sscottl  if (oneDeviceData == agNULL)
387285809Sscottl  {
388285809Sscottl    TI_DBG1(("ttdsaSMPReqReceived: no device data\n"));
389285809Sscottl    return;
390285809Sscottl  }
391285809Sscottl
392285809Sscottl  ttdsaXchg = ttdsaXchgGetStruct(agRoot);
393285809Sscottl
394285809Sscottl  if (ttdsaXchg == agNULL)
395285809Sscottl  {
396285809Sscottl    TI_DBG1(("ttdsaSMPReqReceived: no free xchg structures\n"));
397285809Sscottl    return;
398285809Sscottl  }
399285809Sscottl
400285809Sscottl
401285809Sscottl  oneDeviceData->agDevHandle = agDevHandle;
402285809Sscottl  oneDeviceData->agRoot = agRoot;
403285809Sscottl
404285809Sscottl  /* saving the device */
405285809Sscottl  ttdsaXchg->DeviceData = oneDeviceData;
406285809Sscottl
407285809Sscottl  ttdsaXchg->agRoot  = agRoot;
408285809Sscottl  ttdsaXchg->tiRoot  = tiRoot;
409285809Sscottl
410285809Sscottl  ttdsaXchg->SMPRequestBody.agIORequest.sdkData = agNULL;
411285809Sscottl
412285809Sscottl  ttdsaXchg->SMPphyId = phyId;
413285809Sscottl
414285809Sscottl  switch ( agFrameHeader->smpFunction )
415285809Sscottl  {
416285809Sscottl  case SMP_REPORT_GENERAL:
417285809Sscottl  {
418285809Sscottl    /* must spec p392, rev7*/
419285809Sscottl    TI_DBG1(("ttdsaSMPReqReceived: REPORT_GENERAL\n"));
420285809Sscottl    ttdsaReportGeneralRespSend(agRoot, agDevHandle, ttdsaXchg);
421285809Sscottl    break;
422285809Sscottl  }
423285809Sscottl  case SMP_REPORT_MANUFACTURE_INFORMATION:
424285809Sscottl  {
425285809Sscottl    /* optional, spec p394, rev7*/
426285809Sscottl    TI_DBG1(("ttdsaSMPReqReceived: REPORT_MANUFACTURE_INFORMATION\n"));
427285809Sscottl    ttdsaNotSupportRespSend(agRoot, agDevHandle, ttdsaXchg, SMP_REPORT_MANUFACTURE_INFORMATION);
428285809Sscottl    break;
429285809Sscottl  }
430285809Sscottl  case SMP_DISCOVER:
431285809Sscottl  {
432285809Sscottl    /* must, spec p398, rev7*/
433285809Sscottl    TI_DBG1(("ttdsaSMPReqReceived: DISCOVER\n"));
434285809Sscottl    ttdsaDiscoverRespSend(agRoot, agDevHandle, ttdsaXchg);
435285809Sscottl    break;
436285809Sscottl  }
437285809Sscottl  default:
438285809Sscottl  {
439285809Sscottl    TI_DBG1(("ttdsaSMPReqReceived: UKNOWN or not yet supported 0x%x\n", agFrameHeader->smpFunction));
440285809Sscottl    ttdsaNotSupportRespSend(agRoot, agDevHandle, ttdsaXchg, (bit8) agFrameHeader->smpFunction);
441285809Sscottl    break;
442285809Sscottl  }
443285809Sscottl  }
444285809Sscottl
445285809Sscottl  return;
446285809Sscottl}
447