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* $FreeBSD$
22285809Sscottl*
23285809Sscottl*******************************************************************************/
24285809Sscottl/*****************************************************************************
25285809Sscottl*
26285809Sscottl*   tdioctl.h
27285809Sscottl*
28285809Sscottl*   Abstract:   This module contains data structure definition used
29285809Sscottl*               by the Transport Dependent (TD) Layer IOCTL.
30285809Sscottl*
31285809Sscottl*
32285809Sscottl*   Notes:
33285809Sscottl*
34285809Sscottl*
35285809Sscottl** MODIFICATION HISTORY ******************************************************
36285809Sscottl*
37285809Sscottl* NAME        DATE        DESCRIPTION
38285809Sscottl* ----        ----        -----------
39285809Sscottl* IWN         12/11/02     Initial creation.
40285809Sscottl*
41285809Sscottl*
42285809Sscottl*****************************************************************************/
43285809Sscottl
44285809Sscottl
45285809Sscottl#ifndef TD_IOCTL_H
46285809Sscottl
47285809Sscottl#define TD_IOCTL_H
48285809Sscottl
49285809Sscottl//#include "global.h"
50285809Sscottl
51285809Sscottl/*
52285809Sscottl * PMC-Sierra IOCTL signature
53285809Sscottl */
54285809Sscottl#define PMC_SIERRA_SIGNATURE                0x1234
55285809Sscottl#define PMC_SIERRA_IOCTL_SIGNATURE          "PMC-STRG"
56285809Sscottl
57285809Sscottl/*
58285809Sscottl * Major function code of IOCTL functions, common to target and initiator.
59285809Sscottl */
60285809Sscottl#define IOCTL_MJ_CARD_PARAMETER             0x01
61285809Sscottl#define IOCTL_MJ_FW_CONTROL                 0x02
62285809Sscottl#define IOCTL_MJ_NVMD_GET                   0x03
63285809Sscottl#define IOCTL_MJ_NVMD_SET                   0x04
64285809Sscottl#define IOCTL_MJ_GET_EVENT_LOG1             0x05
65285809Sscottl#define IOCTL_MJ_GET_EVENT_LOG2             0x06
66285809Sscottl#define IOCTL_MJ_GET_CORE_DUMP              0x07
67285809Sscottl#define IOCTL_MJ_LL_TRACING                 0x08
68285809Sscottl#define IOCTL_MJ_FW_PROFILE                 0x09
69285809Sscottl#define IOCTL_MJ_MNID                       0x0A
70285809Sscottl#define IOCTL_MJ_ENCRYPTION_CTL             0x0B
71285809Sscottl
72285809Sscottl#define IOCTL_MJ_FW_INFO                    0x0C
73285809Sscottl
74285809Sscottl#define IOCTL_MJ_LL_API_TEST                0x11
75285809Sscottl#define IOCTL_MJ_CHECK_DPMC_EVENT           0x16
76285809Sscottl#define IOCTL_MJ_GET_FW_REV                 0x1A
77285809Sscottl#define IOCTL_MJ_GET_DEVICE_INFO            0x1B
78285809Sscottl#define IOCTL_MJ_GET_IO_ERROR_STATISTIC     0x1C
79285809Sscottl#define IOCTL_MJ_GET_IO_EVENT_STATISTIC     0x1D
80285809Sscottl#define IOCTL_MJ_GET_FORENSIC_DATA          0x1E
81285809Sscottl#define IOCTL_MJ_GET_DEVICE_LIST            0x1F
82285809Sscottl#define IOCTL_MJ_SMP_REQUEST				0x6D
83285809Sscottl#define IOCTL_MJ_GET_DEVICE_LUN               0x7A1
84285809Sscottl#define IOCTL_MJ_PHY_GENERAL_STATUS           0x7A6
85285809Sscottl#define IOCTL_MJ_PHY_DETAILS           	      0x7A7
86285809Sscottl#define IOCTL_MJ_SEND_BIST                  0x20
87285809Sscottl#define IOCTL_MJ_CHECK_FATAL_ERROR          0x70
88285809Sscottl#define IOCTL_MJ_FATAL_ERROR_DUMP_COMPLETE  0x71
89285809Sscottl#define IOCTL_MJ_GPIO                       0x41
90285809Sscottl#define IOCTL_MJ_SGPIO                      0x42
91285809Sscottl#define IOCTL_MJ_SEND_TMF					0x6E
92285809Sscottl#define	IOCTL_MJ_FATAL_ERROR_SOFT_RESET_TRIG 0x72
93285809Sscottl#define	IOCTL_MJ_FATAL_ERR_CHK_RET_FALSE    0x76
94285809Sscottl#define	IOCTL_MJ_FATAL_ERR_CHK_SEND_FALSE   0x76
95285809Sscottl#define	IOCTL_MJ_FATAL_ERR_CHK_SEND_TRUE    0x77
96285809Sscottl
97285809Sscottl
98285809Sscottl/*
99285809Sscottl * Major function code of IOCTL functions, specific to initiator.
100285809Sscottl */
101285809Sscottl#define IOCTL_MJ_INI_ISCSI_DISCOVERY        0x21
102285809Sscottl#define IOCTL_MJ_INI_SESSION_CONTROL        0x22
103285809Sscottl#define IOCTL_MJ_INI_SNIA_IMA               0x23
104285809Sscottl#define IOCTL_MJ_INI_SCSI                   0x24
105285809Sscottl#define IOCTL_MJ_INI_WMI                    0x25
106285809Sscottl#define IOCTL_MJ_INI_DRIVER_EVENT_LOG       0x26
107285809Sscottl#define IOCTL_MJ_INI_PERSISTENT_BINDING     0x27
108285809Sscottl#define IOCTL_MJ_INI_DRIVER_IDENTIFY        0x28
109285809Sscottl
110285809Sscottl/* temp */
111285809Sscottl#define IOCTL_MJ_PORT_STOP        0x29
112285809Sscottl#define IOCTL_MJ_PORT_START       0x30
113285809Sscottl
114285809Sscottl/* SPCv controller configuration page commands */
115285809Sscottl#define IOCTL_MJ_MODE_CTL_PAGE              0x40
116285809Sscottl
117285809Sscottl#define IOCTL_MJ_SET_OR_GET_REGISTER        0x41
118285809Sscottl
119285809Sscottl#define IOCTL_MJ_GET_PHY_PROFILE            0x44
120285809Sscottl#define IOCTL_MJ_SET_PHY_PROFILE            0x43
121285809Sscottl
122285809Sscottl#define IOCTL_MJ_GET_DRIVER_VERSION         0x101
123285809Sscottl
124285809Sscottl#define IOCTL_MN_PHY_PROFILE_COUNTERS        0x01
125285809Sscottl#define IOCTL_MN_PHY_PROFILE_COUNTERS_CLR    0x02
126285809Sscottl#define IOCTL_MN_PHY_PROFILE_BW_COUNTERS     0x03
127285809Sscottl#define IOCTL_MN_PHY_PROFILE_ANALOG_SETTINGS 0x04
128285809Sscottl
129285809Sscottl/*
130285809Sscottl * Minor functions for Card parameter IOCTL functions.
131285809Sscottl */
132285809Sscottl#define IOCTL_MN_CARD_GET_VPD_INFO              0x01
133285809Sscottl#define IOCTL_MN_CARD_GET_PORTSTART_INFO        0x02
134285809Sscottl#define IOCTL_MN_CARD_GET_INTERRUPT_CONFIG      0x03
135285809Sscottl#define IOCTL_MN_CARD_GET_PHY_ANALOGSETTING     0x04
136285809Sscottl#define IOCTL_MN_CARD_GET_TIMER_CONFIG          0x05
137285809Sscottl#define IOCTL_MN_CARD_GET_TYPE_FATAL_DUMP       0x06
138285809Sscottl
139285809Sscottl/*
140285809Sscottl * Minor functions for FW control IOCTL functions.
141285809Sscottl */
142285809Sscottl
143285809Sscottl/* Send FW data requests.
144285809Sscottl */
145285809Sscottl#define IOCTL_MN_FW_DOWNLOAD_DATA         0x01
146285809Sscottl
147285809Sscottl/* Send the request for burning the new firmware.
148285809Sscottl */
149285809Sscottl#define IOCTL_MN_FW_DOWNLOAD_BURN         0x02
150285809Sscottl
151285809Sscottl/* Poll for the flash burn phases. Sequences of poll function calls are
152285809Sscottl * needed following the IOCTL_MN_FW_DOWNLOAD_BURN, IOCTL_MN_FW_BURN_OSPD
153285809Sscottl * and IOCTL_MN_FW_ROLL_BACK_FW functions.
154285809Sscottl */
155285809Sscottl#define IOCTL_MN_FW_BURN_POLL             0x03
156285809Sscottl
157285809Sscottl/* Instruct the FW to roll back FW to prior revision.
158285809Sscottl */
159285809Sscottl#define IOCTL_MN_FW_ROLL_BACK_FW          0x04
160285809Sscottl
161285809Sscottl/* Instruct the FW to return the current firmware revision number.
162285809Sscottl */
163285809Sscottl#define IOCTL_MN_FW_VERSION               0x05
164285809Sscottl
165285809Sscottl/* Retrieve the maximum size of the OS Persistent Data stored on the card.
166285809Sscottl */
167285809Sscottl#define IOCTL_MN_FW_GET_OSPD_SIZE   0x06
168285809Sscottl
169285809Sscottl/*  Retrieve the OS Persistent Data from the card.
170285809Sscottl */
171285809Sscottl#define IOCTL_MN_FW_GET_OSPD              0x07
172285809Sscottl
173285809Sscottl/* Send a new OS Persistent Data to the card and burn in flash.
174285809Sscottl */
175285809Sscottl#define IOCTL_MN_FW_BURN_OSPD           0x08
176285809Sscottl
177285809Sscottl/* Retrieve the trace buffer from the card FW. Only available on the debug
178285809Sscottl * version of the FW.
179285809Sscottl */
180285809Sscottl#define IOCTL_MN_FW_GET_TRACE_BUFFER            0x0f
181285809Sscottl
182285809Sscottl#define IOCTL_MN_NVMD_GET_CONFIG                0x0A
183285809Sscottl#define IOCTL_MN_NVMD_SET_CONFIG                0x0B
184285809Sscottl
185285809Sscottl#define IOCTL_MN_FW_GET_CORE_DUMP_AAP1          0x0C
186285809Sscottl#define IOCTL_MN_FW_GET_CORE_DUMP_IOP           0x0D
187285809Sscottl#define IOCTL_MN_FW_GET_CORE_DUMP_FLASH_AAP1    0x12
188285809Sscottl#define IOCTL_MN_FW_GET_CORE_DUMP_FLASH_IOP     0x13
189285809Sscottl
190285809Sscottl#define IOCTL_MN_LL_RESET_TRACE_INDEX           0x0e
191285809Sscottl#define IOCTL_MN_LL_GET_TRACE_BUFFER_INFO       0x0f
192285809Sscottl#define IOCTL_MN_LL_GET_TRACE_BUFFER            0x10
193285809Sscottl
194285809Sscottl#define IOCTL_MN_ENCRYPTION_GET_INFO          0x13
195285809Sscottl#define IOCTL_MN_ENCRYPTION_SET_MODE          0x14
196285809Sscottl#define IOCTL_MN_ENCRYPTION_KEK_ADD           0x15
197285809Sscottl#define IOCTL_MN_ENCRYPTION_DEK_ADD           0x16
198285809Sscottl#define IOCTL_MN_ENCRYPTION_DEK_INVALID       0x17
199285809Sscottl#define IOCTL_MN_ENCRYPTION_KEK_NVRAM         0x18
200285809Sscottl#define IOCTL_MN_ENCRYPTION_DEK_ASSIGN        0x19
201285809Sscottl#define IOCTL_MN_ENCRYPTION_LUN_QUERY         0x1A
202285809Sscottl#define IOCTL_MN_ENCRYPTION_KEK_LOAD_NVRAM    0x1B
203285809Sscottl#define IOCTL_MN_ENCRYPTION_ERROR_QUERY       0x1C
204285809Sscottl#define IOCTL_MN_ENCRYPTION_DEK_TABLE_INIT    0x1D
205285809Sscottl#define IOCTL_MN_ENCRYPT_LUN_VERIFY           0x1E
206285809Sscottl#define IOCTL_MN_ENCRYPT_OPERATOR_MGMT        0x1F
207285809Sscottl#define IOCTL_MN_ENCRYPT_SET_DEK_CONFIG_PAGE  0x21
208285809Sscottl#define IOCTL_MN_ENCRYPT_SET_CONTROL_PAGE     0x22
209285809Sscottl#define IOCTL_MN_ENCRYPT_SET_OPERATOR_CMD     0x23
210285809Sscottl#define IOCTL_MN_ENCRYPT_TEST_EXECUTE         0x24
211285809Sscottl#define IOCTL_MN_ENCRYPT_SET_HMAC_CONFIG_PAGE 0x25
212285809Sscottl#define IOCTL_MN_ENCRYPT_GET_OPERATOR_CMD     0x26
213285809Sscottl#define IOCTL_MN_ENCRYPT_RESCAN               0x27
214285809Sscottl#ifdef SOFT_RESET_TEST
215285809Sscottl#define IOCTL_MN_SOFT_RESET                   0x28
216285809Sscottl#endif
217285809Sscottl/* SPCv configuration pages */
218285809Sscottl#define IOCTL_MN_MODE_SENSE                   0x30
219285809Sscottl#define IOCTL_MN_MODE_SELECT                  0x31
220285809Sscottl
221285809Sscottl#define IOCTL_MN_TISA_TEST_ENCRYPT_DEK_DUMP   0x51
222285809Sscottl
223285809Sscottl#define IOCTL_MN_FW_GET_EVENT_FLASH_LOG1        0x5A
224285809Sscottl#define IOCTL_MN_FW_GET_EVENT_FLASH_LOG2        0x6A
225285809Sscottl#define IOCTL_MN_GET_EVENT_LOG1                 0x5B
226285809Sscottl#define IOCTL_MN_GET_EVENT_LOG2                 0x6B
227285809Sscottl
228285809Sscottl#define IOCTL_MN_GPIO_PINSETUP	            	0x01
229285809Sscottl#define IOCTL_MN_GPIO_EVENTSETUP             	0x02
230285809Sscottl#define IOCTL_MN_GPIO_READ 		                0x03
231285809Sscottl#define IOCTL_MN_GPIO_WRITE	                	0x04
232285809Sscottl
233285809Sscottl#define IOCTL_MN_TMF_DEVICE_RESET				0x6F
234285809Sscottl#define IOCTL_MN_TMF_LUN_RESET					0x70
235285809Sscottltypedef struct tdFWControl
236285809Sscottl{
237285809Sscottl  bit32   retcode;    /* ret code (status) = (bit32)oscmCtrlEvnt_e      */
238285809Sscottl  bit32   phase;      /* ret code phase    = (bit32)agcmCtrlFwPhase_e   */
239285809Sscottl  bit32   phaseCmplt; /* percent complete for the current update phase  */
240285809Sscottl  bit32   version;    /* Hex encoded firmware version number            */
241285809Sscottl  bit32   offset;     /* Used for downloading firmware                  */
242285809Sscottl  bit32   len;        /* len of buffer                                  */
243285809Sscottl  bit32   size;       /* Used in OS VPD and Trace get size operations.  */
244285809Sscottl  bit32   reserved;   /* padding required for 64 bit alignment          */
245285809Sscottl  bit8    buffer[1];  /* Start of buffer                                */
246285809Sscottl} tdFWControl_t;
247285809Sscottl
248285809Sscottl
249285809Sscottltypedef struct tdFWControlEx
250285809Sscottl{
251285809Sscottl  tdFWControl_t *tdFWControl;
252285809Sscottl  bit8    *buffer;    // keep buffer pointer to be freed when the responce comes
253285809Sscottl  bit8    *virtAddr;  /* keep virtual address of the data */
254285809Sscottl  bit8    *usrAddr;   /* keep virtual address of the user data */
255285809Sscottl  bit32   len;        /* len of buffer                                  */
256285809Sscottl  void    *payload;   /* pointer to IOCTL Payload */
257285809Sscottl  bit8    inProgress;  /* if 1 - the IOCTL request is in progress */
258285809Sscottl  void    *param1;
259285809Sscottl  void    *param2;
260285809Sscottl  void    *param3;
261285809Sscottl} tdFWControlEx_t;
262285809Sscottl
263285809Sscottl/************************************************************/
264285809Sscottl//This flag and datastructure are specific for fw profiling, Now defined as
265285809Sscottl// compiler flag
266285809Sscottl//#define SPC_ENABLE_PROFILE
267285809Sscottl
268285809Sscottl#ifdef SPC_ENABLE_PROFILE
269285809Sscottltypedef struct tdFWProfile
270285809Sscottl{
271285809Sscottl    bit32   status;
272285809Sscottl    bit32   tcid;
273285809Sscottl    bit32   processor;  /* processor name "iop/aap1"      */
274285809Sscottl    bit32   cmd;        /* cmd to fw   */
275285809Sscottl    bit32   len;        /* len of buffer                                  */
276285809Sscottl    bit32   codeStartAdd;
277285809Sscottl    bit32   codeEndAdd;
278285809Sscottl    bit32   reserved;   /* padding required for 64 bit alignment          */
279285809Sscottl    bit8    buffer[1];  /* Start of buffer                                */
280285809Sscottl} tdFWProfile_t;
281285809Sscottl
282285809Sscottl/************************************************/
283285809Sscottl/**Definations for FW profile*/
284285809Sscottl#define FW_PROFILE_PROCESSOR_ID_IOP  0x00
285285809Sscottl#define FW_PROFILE_PROCESSOR_ID_AAP1 0x02
286285809Sscottl/* definitions for sub operation */
287285809Sscottl#define START_TIMER_PROFILE          0x01
288285809Sscottl#define START_CODE_PROFILE           0x02
289285809Sscottl#define STOP_TIMER_PROFILE           0x81
290285809Sscottl#define STOP_CODE_PROFILE            0x82
291285809Sscottl/************************************************/
292285809Sscottl
293285809Sscottltypedef struct tdFWProfileEx
294285809Sscottl{
295285809Sscottl  tdFWProfile_t *tdFWProfile;
296285809Sscottl  bit8    *buffer;    // keep buffer pointer to be freed when the responce comes
297285809Sscottl  bit8    *virtAddr;  /* keep virtual address of the data */
298285809Sscottl  bit8    *usrAddr;   /* keep virtual address of the user data */
299285809Sscottl  bit32   len;        /* len of buffer                                  */
300285809Sscottl  void    *payload;   /* pointer to IOCTL Payload */
301285809Sscottl  bit8    inProgress;  /* if 1 - the IOCTL request is in progress */
302285809Sscottl  void    *param1;
303285809Sscottl  void    *param2;
304285809Sscottl  void    *param3;
305285809Sscottl} tdFWProfileEx_t;
306285809Sscottl#endif
307285809Sscottl/************************************************************/
308285809Sscottltypedef struct tdVPDControl
309285809Sscottl{
310285809Sscottl  bit32   retcode;    /* ret code (status)                              */
311285809Sscottl  bit32   phase;      /* ret code phase                                 */
312285809Sscottl  bit32   phaseCmplt; /* percent complete for the current update phase  */
313285809Sscottl  bit32   version;    /* Hex encoded firmware version number            */
314285809Sscottl  bit32   offset;     /* Used for downloading firmware                  */
315285809Sscottl  bit32   len;        /* len of buffer                                  */
316285809Sscottl  bit32   size;       /* Used in OS VPD and Trace get size operations.  */
317285809Sscottl  bit8    deviceID;   /* padding required for 64 bit alignment          */
318285809Sscottl  bit8    reserved1;
319285809Sscottl  bit16   reserved2;
320285809Sscottl  bit32   signature;
321285809Sscottl  bit8    buffer[1];  /* Start of buffer                                */
322285809Sscottl} tdVPDControl_t;
323285809Sscottl
324285809Sscottltypedef struct tdDeviceInfoIOCTL_s
325285809Sscottl{
326285809Sscottl  bit8       deviceType;   // TD_SATA_DEVICE or TD_SAS_DEVICE
327285809Sscottl  bit8       linkRate;     // 0x08: 1.5 Gbit/s; 0x09: 3.0; 0x0A: 6.0 Gbit/s.
328285809Sscottl  bit8       phyId;
329285809Sscottl  bit8       reserved;
330285809Sscottl  bit32      sasAddressHi; // SAS address high
331285809Sscottl  bit32      sasAddressLo; // SAS address low
332285809Sscottl  bit32      up_sasAddressHi; // upstream SAS address high
333285809Sscottl  bit32      up_sasAddressLo; // upstream SAS address low
334285809Sscottl  bit32      ishost;
335285809Sscottl  bit32      isEncryption;    // is encryption enabled
336285809Sscottl  bit32      isDIF;           // is DIF enabled
337285809Sscottl  unsigned long DeviceHandle;
338285809Sscottl  bit32      host_num;
339285809Sscottl  bit32      channel;
340285809Sscottl  bit32      id;
341285809Sscottl  bit32      lun;
342285809Sscottl}tdDeviceInfoIOCTL_t;
343285809Sscottl
344285809Sscottl/* Payload of IOCTL dump device list at OS layer */
345285809Sscottltypedef struct tdDeviceInfoPayload_s
346285809Sscottl{
347285809Sscottl  bit32      PathId;
348285809Sscottl  bit32      TargetId;
349285809Sscottl  bit32      Lun;
350285809Sscottl  bit32      Reserved;         /* Had better aligned to 64-bit. */
351285809Sscottl
352285809Sscottl  /* output */
353285809Sscottl  tdDeviceInfoIOCTL_t  devInfo;
354285809Sscottl}tdDeviceInfoPayload_t;
355285809Sscottl
356285809Sscottltypedef struct tdDeviceListPayload_s
357285809Sscottl{
358285809Sscottl  bit32  realDeviceCount;// the real device out in the array, returned by driver
359285809Sscottl  bit32  deviceLength;   // the length of tdDeviceInfoIOCTL_t array
360285809Sscottl  bit8   pDeviceInfo[1]; // point to tdDeviceInfoIOCTL_t array
361285809Sscottl}tdDeviceListPayload_t;
362285809Sscottl
363285809Sscottl// Payload of IO error and event statistic IOCTL.
364285809Sscottltypedef struct tdIoErrorEventStatisticIOCTL_s
365285809Sscottl{
366285809Sscottl  bit32  agOSSA_IO_COMPLETED_ERROR_SCSI_STATUS;
367285809Sscottl  bit32  agOSSA_IO_ABORTED;
368285809Sscottl  bit32  agOSSA_IO_OVERFLOW;
369285809Sscottl  bit32  agOSSA_IO_UNDERFLOW;
370285809Sscottl  bit32  agOSSA_IO_FAILED;
371285809Sscottl  bit32  agOSSA_IO_ABORT_RESET;
372285809Sscottl  bit32  agOSSA_IO_NOT_VALID;
373285809Sscottl  bit32  agOSSA_IO_NO_DEVICE;
374285809Sscottl  bit32  agOSSA_IO_ILLEGAL_PARAMETER;
375285809Sscottl  bit32  agOSSA_IO_LINK_FAILURE;
376285809Sscottl  bit32  agOSSA_IO_PROG_ERROR;
377285809Sscottl  bit32  agOSSA_IO_DIF_IN_ERROR;
378285809Sscottl  bit32  agOSSA_IO_DIF_OUT_ERROR;
379285809Sscottl  bit32  agOSSA_IO_ERROR_HW_TIMEOUT;
380285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_BREAK;
381285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_PHY_NOT_READY;
382285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED;
383285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION;
384285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_BREAK;
385285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS;
386285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION;
387285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED;
388285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY;
389285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION;
390285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_UNKNOWN_ERROR;
391285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_NAK_RECEIVED;
392285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_ACK_NAK_TIMEOUT;
393285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_PEER_ABORTED;
394285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_RX_FRAME;
395285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_DMA;
396285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_CREDIT_TIMEOUT;
397285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_SATA_LINK_TIMEOUT;
398285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_SATA;
399285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_ABORTED_DUE_TO_SRST;
400285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_REJECTED_NCQ_MODE;
401285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_ABORTED_NCQ_MODE;
402285809Sscottl  bit32  agOSSA_IO_XFER_OPEN_RETRY_TIMEOUT;
403285809Sscottl  bit32  agOSSA_IO_XFER_SMP_RESP_CONNECTION_ERROR;
404285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_UNEXPECTED_PHASE;
405285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_XFER_RDY_OVERRUN;
406285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED;
407285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT;
408285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_CMD_ISSUE_BREAK_BEFORE_ACK_NAK;
409285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_CMD_ISSUE_PHY_DOWN_BEFORE_ACK_NAK;
410285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_OFFSET_MISMATCH;
411285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_XFER_ZERO_DATA_LEN;
412285809Sscottl  bit32  agOSSA_IO_XFER_CMD_FRAME_ISSUED;
413285809Sscottl  bit32  agOSSA_IO_ERROR_INTERNAL_SMP_RESOURCE;
414285809Sscottl  bit32  agOSSA_IO_PORT_IN_RESET;
415285809Sscottl  bit32  agOSSA_IO_DS_NON_OPERATIONAL;
416285809Sscottl  bit32  agOSSA_IO_DS_IN_RECOVERY;
417285809Sscottl  bit32  agOSSA_IO_TM_TAG_NOT_FOUND;
418285809Sscottl  bit32  agOSSA_IO_XFER_PIO_SETUP_ERROR;
419285809Sscottl  bit32  agOSSA_IO_SSP_EXT_IU_ZERO_LEN_ERROR;
420285809Sscottl  bit32  agOSSA_IO_DS_IN_ERROR;
421285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY;
422285809Sscottl  bit32  agOSSA_IO_ABORT_IN_PROGRESS;
423285809Sscottl  bit32  agOSSA_IO_ABORT_DELAYED;
424285809Sscottl  bit32  agOSSA_IO_INVALID_LENGTH;
425285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY_ALT;
426285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED;
427285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO;
428285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST;
429285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE;
430285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED;
431285809Sscottl  bit32  agOSSA_IO_DS_INVALID;
432285809Sscottl  bit32  agOSSA_IO_XFER_READ_COMPL_ERR;
433285809Sscottl  bit32  agOSSA_IO_XFER_ERR_LAST_PIO_DATAIN_CRC_ERR;
434285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_INTERNAL_CRC_ERROR;
435285809Sscottl  bit32  agOSSA_MPI_IO_RQE_BUSY_FULL;
436285809Sscottl  bit32  agOSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE;
437285809Sscottl  bit32  agOSSA_MPI_ERR_ATAPI_DEVICE_BUSY;
438285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS;
439285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH;
440285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_CIPHER_MODE_INVALID;
441285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_DEK_IV_MISMATCH;
442285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_DEK_RAM_INTERFACE_ERROR;
443285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_INTERNAL_RAM;
444285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_DIF_MISMATCH;
445285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH;
446285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH;
447285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_DIF_CRC_MISMATCH;
448285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_INVALID_SSP_RSP_FRAME;
449285809Sscottl  bit32  agOSSA_IO_XFER_ERR_EOB_DATA_OVERRUN;
450285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS;
451285809Sscottl  bit32  agOSSA_IO_OPEN_CNX_ERROR_OPEN_PREEMPTED;
452285809Sscottl  bit32  agOSSA_IO_XFR_ERROR_DEK_ILLEGAL_TABLE;
453285809Sscottl  bit32  agOSSA_IO_XFER_ERROR_DIF_INTERNAL_ERROR;
454285809Sscottl  bit32  agOSSA_MPI_ERR_OFFLOAD_DIF_OR_ENC_NOT_ENABLED;
455285809Sscottl  bit32  agOSSA_IO_UNKNOWN_ERROR;
456285809Sscottl
457285809Sscottl} tdIoErrorEventStatisticIOCTL_t;
458285809Sscottl
459285809Sscottl/*
460285809Sscottl01: soft error
461285809Sscottl02: not ready
462285809Sscottl03: medium error
463285809Sscottl04: hardware error
464285809Sscottl05: illegal request
465285809Sscottl06: unit attention
466285809Sscottl0b: abort command
467285809Sscottl*/
468285809Sscottltypedef struct tdSenseKeyCount_s{
469285809Sscottl  bit32     SoftError;
470285809Sscottl  bit32     MediumNotReady;
471285809Sscottl  bit32     MediumError;
472285809Sscottl  bit32     HardwareError;
473285809Sscottl  bit32     IllegalRequest;
474285809Sscottl  bit32     UnitAttention;
475285809Sscottl  bit32     AbortCommand;
476285809Sscottl  bit32     OtherKeyType;
477285809Sscottl}tdSenseKeyCount_t;
478285809Sscottl
479285809Sscottl/*
480285809SscottlCode Status Command  completed Service response
481285809Sscottl00h GOOD Yes COMMAND COMPLETE
482285809Sscottl02h CHECK CONDITION Yes COMMAND COMPLETE
483285809Sscottl04h CONDITION MET Yes COMMAND COMPLETE
484285809Sscottl08h BUSY Yes COMMAND COMPLETE
485285809Sscottl10h Obsolete
486285809Sscottl14h Obsolete
487285809Sscottl18h RESERVATION CONFLICT Yes COMMAND COMPLETE
488285809Sscottl22h Obsolete
489285809Sscottl28h TASK SET FULL Yes COMMAND COMPLETE
490285809Sscottl30h ACA ACTIVE Yes COMMAND COMPLETE
491285809Sscottl40h TASK ABORTED Yes COMMAND COMPLETE
492285809Sscottl*/
493285809Sscottltypedef struct tdSCSIStatusCount_s{
494285809Sscottl  bit32     GoodStatus;
495285809Sscottl  bit32     CheckCondition;
496285809Sscottl  bit32     ConditionMet;
497285809Sscottl  bit32     BusyStatus;
498285809Sscottl  bit32     ResvConflict;
499285809Sscottl  bit32     TaskSetFull;
500285809Sscottl  bit32     AcaActive;
501285809Sscottl  bit32     TaskAborted;
502285809Sscottl  bit32     ObsoleteStatus;
503285809Sscottl}tdSCSIStatusCount_t;
504285809Sscottl
505285809Sscottl/* Payload of Io Error Statistic IOCTL. */
506285809Sscottltypedef struct tdIoErrorStatisticPayload_s
507285809Sscottl{
508285809Sscottl  bit32         flag;
509285809Sscottl  bit32         Reserved;         /* Had better aligned to 64-bit. */
510285809Sscottl
511285809Sscottl  /* output */
512285809Sscottl  tdIoErrorEventStatisticIOCTL_t  IoError;
513285809Sscottl  tdSCSIStatusCount_t             ScsiStatusCounter;
514285809Sscottl  tdSenseKeyCount_t               SenseKeyCounter;
515285809Sscottl} tdIoErrorStatisticPayload_t;
516285809Sscottl
517285809Sscottl/* Payload of Io Error Statistic IOCTL. */
518285809Sscottltypedef struct tdIoEventStatisticPayload_s
519285809Sscottl{
520285809Sscottl  bit32         flag;
521285809Sscottl  bit32         Reserved;         /* Had better aligned to 64-bit. */
522285809Sscottl
523285809Sscottl  /* output */
524285809Sscottl  tdIoErrorEventStatisticIOCTL_t  IoEvent;
525285809Sscottl} tdIoEventStatisticPayload_t;
526285809Sscottl
527285809Sscottl/* Payload of Register IOCTL. */
528285809Sscottltypedef struct tdRegisterPayload_s
529285809Sscottl{
530285809Sscottl  bit32         flag;
531285809Sscottl  bit32         busNum;
532285809Sscottl  bit32         RegAddr;         /* Register address */
533285809Sscottl  bit32         RegValue;        /* Register value */
534285809Sscottl
535285809Sscottl} tdRegisterPayload_t;
536285809Sscottl
537285809Sscottl
538285809Sscottl#define FORENSIC_DATA_TYPE_GSM_SPACE        1
539285809Sscottl#define FORENSIC_DATA_TYPE_QUEUE            2
540285809Sscottl#define FORENSIC_DATA_TYPE_FATAL            3
541285809Sscottl#define FORENSIC_DATA_TYPE_NON_FATAL        4
542285809Sscottl#define FORENSIC_DATA_TYPE_IB_QUEUE         5
543285809Sscottl#define FORENSIC_DATA_TYPE_OB_QUEUE          6
544285809Sscottl#define FORENSIC_DATA_TYPE_CHECK_FATAL      0x70
545285809Sscottl
546285809Sscottl#define FORENSIC_Q_TYPE_INBOUND          1
547285809Sscottl#define FORENSIC_Q_TYPE_OUTBOUND         2
548285809Sscottl
549285809Sscottl/* get forensic data IOCTL payload */
550285809Sscottltypedef struct tdForensicDataPayload_s
551285809Sscottl{
552285809Sscottl  bit32   DataType;
553285809Sscottl  union
554285809Sscottl  {
555285809Sscottl    struct
556285809Sscottl    {
557285809Sscottl      bit32   directLen;
558285809Sscottl      bit32   directOffset;
559285809Sscottl      bit32   readLen;
560285809Sscottl      bit8   directData[1];
561285809Sscottl    } gsmBuffer;
562285809Sscottl
563285809Sscottl    struct
564285809Sscottl    {
565285809Sscottl      bit16  queueType;
566285809Sscottl      bit16  queueIndex;
567285809Sscottl      bit32  directLen;
568285809Sscottl      bit8   directData[1];
569285809Sscottl    } queueBuffer;
570285809Sscottl
571285809Sscottl    struct
572285809Sscottl    {
573285809Sscottl      bit32 directLen;
574285809Sscottl      bit32 directOffset;
575285809Sscottl      bit32 readLen;
576285809Sscottl      bit8  directData[1];
577285809Sscottl    } dataBuffer;
578285809Sscottl  };
579285809Sscottl}tdForensicDataPayload_t;
580285809Sscottl
581285809Sscottltypedef struct tdBistPayload_s
582285809Sscottl{
583285809Sscottl  bit32  testType;
584285809Sscottl  bit32  testLength;
585285809Sscottl  bit32  testData[29];
586285809Sscottl}tdBistPayload_t;
587285809Sscottl
588285809Sscottltypedef struct _TSTMTID_CARD_LOCATION_INFO
589285809Sscottl{
590285809Sscottl  bit32               CardNo;
591285809Sscottl  bit32               Bus;
592285809Sscottl  bit32               Slot;
593285809Sscottl  bit32               Device;
594285809Sscottl  bit32               Function;
595285809Sscottl  bit32               IOLower;
596285809Sscottl  bit32               IO_Upper;
597285809Sscottl  bit32               VidDid;
598285809Sscottl  bit32               PhyMem;
599285809Sscottl  bit32               Flag;
600285809Sscottl
601285809Sscottl} TSTMTID_CARD_LOCATION_INFO;
602285809Sscottl
603285809Sscottltypedef struct _TSTMTID_TRACE_BUFFER_INFO
604285809Sscottl{
605285809Sscottl  bit32               CardNo;
606285809Sscottl  bit32               TraceCompiled;
607285809Sscottl  bit32               BufferSize;
608285809Sscottl  bit32               CurrentIndex;
609285809Sscottl  bit32               TraceWrap;
610285809Sscottl  bit32               CurrentTraceIndexWrapCount;
611285809Sscottl  bit32               TraceMask;
612285809Sscottl  bit32               Flag;
613285809Sscottl
614285809Sscottl} TSTMTID_TRACE_BUFFER_INFO;
615285809Sscottl
616285809Sscottl#define FetchBufferSIZE  32
617285809Sscottl#define LowFence32Bits   0xFCFD1234
618285809Sscottl#define HighFence32Bits  0x5678ABDC
619285809Sscottl
620285809Sscottltypedef struct _TSTMTID_TRACE_BUFFER_FETCH
621285809Sscottl{
622285809Sscottl  bit32               CardNo;
623285809Sscottl  bit32               BufferOffsetBegin;
624285809Sscottl  bit32               LowFence;
625285809Sscottl  bit8                Data[FetchBufferSIZE];
626285809Sscottl  bit32               HighFence;
627285809Sscottl  bit32               Flag;
628285809Sscottl
629285809Sscottl} TSTMTID_TRACE_BUFFER_FETCH;
630285809Sscottl
631285809Sscottl
632285809Sscottltypedef struct _TSTMTID_TRACE_BUFFER_RESET
633285809Sscottl{
634285809Sscottl  bit32               CardNo;
635285809Sscottl  bit32               Reset;
636285809Sscottl  bit32               TraceMask;
637285809Sscottl  bit32               Flag;
638285809Sscottl
639285809Sscottl} TSTMTID_TRACE_BUFFER_RESET;
640285809Sscottl
641285809Sscottl
642285809Sscottl
643285809Sscottltypedef struct tdPhyCount_s{
644285809Sscottl  bit32 Phy;
645285809Sscottl  bit32 BW_tx;
646285809Sscottl  bit32 BW_rx;
647285809Sscottl  bit32 InvalidDword;
648285809Sscottl  bit32 runningDisparityError;
649285809Sscottl  bit32 codeViolation;
650285809Sscottl  bit32 LossOfSyncDW;
651285809Sscottl  bit32 phyResetProblem;
652285809Sscottl  bit32 inboundCRCError;
653285809Sscottl}tdPhyCount_t;
654285809Sscottl
655285809Sscottl
656285809Sscottltypedef struct _PHY_GENERAL_STATE
657285809Sscottl{
658285809Sscottl	bit32 Dword0;
659285809Sscottl	bit32 Dword1;
660285809Sscottl
661285809Sscottl}GetPhyGenState_t;
662285809Sscottltypedef struct agsaPhyGeneralState_s
663285809Sscottl{
664285809Sscottl  GetPhyGenState_t  PhyGenData[16];
665285809Sscottl  bit32 Reserved1;
666285809Sscottl  bit32 Reserved2;
667285809Sscottl} agsaPhyGeneralState_t;
668285809Sscottl
669285809Sscottltypedef struct _PHY_DETAILS_
670285809Sscottl{
671285809Sscottl  bit8    sasAddressLo[4];
672285809Sscottl  bit8    sasAddressHi[4];
673285809Sscottl  bit8    attached_sasAddressLo[4];
674285809Sscottl  bit8    attached_sasAddressHi[4];
675285809Sscottl  bit8    attached_phy;
676285809Sscottl  bit8    attached_dev_type ;
677285809Sscottl}PhyDetails_t;
678285809Sscottl
679285809Sscottlenum SAS_SATA_DEVICE_TYPE {
680285809Sscottl  SAS_PHY_NO_DEVICE ,
681285809Sscottl  SAS_PHY_END_DEVICE,
682285809Sscottl  SAS_PHY_EXPANDER_DEVICE,
683285809Sscottl  SAS_PHY_SATA_DEVICE = 0x11,
684285809Sscottl};
685285809Sscottl#define PHY_SETTINGS_LEN   1024
686285809Sscottl
687285809Sscottl#endif  /* TD_IOCTL_H */
688