xref: /freebsd/sys/dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdglobl.h (revision f4b37ed0f8b307b1f3f0f630ca725d68f1dff30d)
1 /*******************************************************************************
2 *Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
3 *
4 *Redistribution and use in source and binary forms, with or without modification, are permitted provided
5 *that the following conditions are met:
6 *1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7 *following disclaimer.
8 *2. Redistributions in binary form must reproduce the above copyright notice,
9 *this list of conditions and the following disclaimer in the documentation and/or other materials provided
10 *with the distribution.
11 *
12 *THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 *WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 *FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15 *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 *NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17 *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18 *LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19 *SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20 
21 ********************************************************************************/
22 /*******************************************************************************/
23 /** \file
24  *
25  * $RCSfile: ttdglobl.h,v $
26  *
27  * Copyright 2006 PMC-Sierra, Inc.
28  *
29  * $Author: vempatin $
30  * $Revision: 113679 $
31  * $Date: 2012-04-16 14:35:19 -0700 (Mon, 16 Apr 2012) $
32  *
33  * #define for SAS target in SAS/SATA TD layer
34  *
35  */
36 
37 
38 #ifndef __TTD_GLOBALS_H__
39 
40 #define __TTD_GLOBALS_H__
41 
42 /*
43  * Transport Target specific default parameters.
44  */
45 #define DEFAULT_XCHGS                   256
46 #define DEFAULT_TGT_TIMER_TICK          1000000     /* 1 second */
47 #define DEFAULT_MAX_TARGETS             256
48 #define DEFAULT_BLOCK_SIZE              512
49 
50 
51 /* Exchange field accessors */
52 #define TD_XCHG_CONTEXT(ti_root)                    (&TD_GET_TITGT_CONTEXT(ti_root)->ttdsaXchgData)
53 #define TD_XCHG_CONTEXT_MAX_NUM_XCHGS(ti_root)      (TD_XCHG_CONTEXT(ti_root)->maxNumXchgs)
54 #define TD_XCHG_CONTEXT_NO_USED(ti_root)            (TD_XCHG_CONTEXT(ti_root)->noUsed)
55 #define TD_XCHG_CONTEXT_NO_FREED(ti_root)           (TD_XCHG_CONTEXT(ti_root)->noFreed)
56 #define TD_XCHG_CONTEXT_NO_CMD_RCVD(ti_root)        (TD_XCHG_CONTEXT(ti_root)->noCmdRcvd)
57 #define TD_XCHG_CONTEXT_NO_START_IO(ti_root)        (TD_XCHG_CONTEXT(ti_root)->noStartIo)
58 #define TD_XCHG_CONTEXT_NO_SEND_RSP(ti_root)        (TD_XCHG_CONTEXT(ti_root)->noSendRsp)
59 #define TD_XCHG_CONTEXT_NO_IO_COMPLETED(ti_root)    (TD_XCHG_CONTEXT(ti_root)->noCompleted)
60 
61 #define TD_XCHG_GET_CONTEXT(ti_request)             ((ttdsaXchg_t *)(ti_request)->tdData)
62 #define TD_XCHG_GET_STATE(xchg)                     (xchg->state)
63 #define TD_XCHG_SET_STATE(xchg, val)                (xchg->state) = (val)
64 
65 #define TD_XCHG_STATE_ACTIVE                        1
66 #define TD_XCHG_STATE_INACTIVE                      0
67 
68 #define READ_GOOD_RESPONSE                          0x1
69 #define WRITE_GOOD_RESPONSE                         0x2
70 
71 #endif  /* __TTD_GLOBALS_H__ */
72