xref: /freebsd/sys/cam/ctl/ctl_ser_table.c (revision 130f4520cba830cc6da47c9f871fed78710a4709)
1*130f4520SKenneth D. Merry /*-
2*130f4520SKenneth D. Merry  * Copyright (c) 2003 Silicon Graphics International Corp.
3*130f4520SKenneth D. Merry  * All rights reserved.
4*130f4520SKenneth D. Merry  *
5*130f4520SKenneth D. Merry  * Redistribution and use in source and binary forms, with or without
6*130f4520SKenneth D. Merry  * modification, are permitted provided that the following conditions
7*130f4520SKenneth D. Merry  * are met:
8*130f4520SKenneth D. Merry  * 1. Redistributions of source code must retain the above copyright
9*130f4520SKenneth D. Merry  *    notice, this list of conditions, and the following disclaimer,
10*130f4520SKenneth D. Merry  *    without modification.
11*130f4520SKenneth D. Merry  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12*130f4520SKenneth D. Merry  *    substantially similar to the "NO WARRANTY" disclaimer below
13*130f4520SKenneth D. Merry  *    ("Disclaimer") and any redistribution must be conditioned upon
14*130f4520SKenneth D. Merry  *    including a substantially similar Disclaimer requirement for further
15*130f4520SKenneth D. Merry  *    binary redistribution.
16*130f4520SKenneth D. Merry  *
17*130f4520SKenneth D. Merry  * NO WARRANTY
18*130f4520SKenneth D. Merry  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19*130f4520SKenneth D. Merry  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20*130f4520SKenneth D. Merry  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
21*130f4520SKenneth D. Merry  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22*130f4520SKenneth D. Merry  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23*130f4520SKenneth D. Merry  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24*130f4520SKenneth D. Merry  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25*130f4520SKenneth D. Merry  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26*130f4520SKenneth D. Merry  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27*130f4520SKenneth D. Merry  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28*130f4520SKenneth D. Merry  * POSSIBILITY OF SUCH DAMAGES.
29*130f4520SKenneth D. Merry  *
30*130f4520SKenneth D. Merry  * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_ser_table.c#1 $
31*130f4520SKenneth D. Merry  * $FreeBSD$
32*130f4520SKenneth D. Merry  */
33*130f4520SKenneth D. Merry 
34*130f4520SKenneth D. Merry /*
35*130f4520SKenneth D. Merry  * CAM Target Layer command serialization table.
36*130f4520SKenneth D. Merry  *
37*130f4520SKenneth D. Merry  * Author: Kim Le
38*130f4520SKenneth D. Merry  */
39*130f4520SKenneth D. Merry 
40*130f4520SKenneth D. Merry /****************************************************************************/
41*130f4520SKenneth D. Merry /* TABLE       ctlSerTbl                                                    */
42*130f4520SKenneth D. Merry /*                                                                          */
43*130f4520SKenneth D. Merry /*  The matrix which drives the serialization algorithm. The major index    */
44*130f4520SKenneth D. Merry /*  (the first) into this table is the command being checked and the minor  */
45*130f4520SKenneth D. Merry /*  index is the command against which the first command is being checked.  */
46*130f4520SKenneth D. Merry /*  i.e., the major index (row) command is ahead of the minor index command */
47*130f4520SKenneth D. Merry /*  (column) in the queue.  This allows the code to optimize by capturing   */
48*130f4520SKenneth D. Merry /*  the result of the first indexing operation into a pointer.              */
49*130f4520SKenneth D. Merry /*                                                                          */
50*130f4520SKenneth D. Merry /*  Whenever a new value is added to the IDX_T type, this matrix must be    */
51*130f4520SKenneth D. Merry /*  expanded by one row AND one column -- Because of this, some effort      */
52*130f4520SKenneth D. Merry /*  should be made to re-use the indexes whenever possible.                 */
53*130f4520SKenneth D. Merry /*                                                                          */
54*130f4520SKenneth D. Merry /****************************************************************************/
55*130f4520SKenneth D. Merry 
56*130f4520SKenneth D. Merry #define	sK	CTL_SER_SKIP		/* Skip */
57*130f4520SKenneth D. Merry #define	pS	CTL_SER_PASS		/* pS */
58*130f4520SKenneth D. Merry #define	bK	CTL_SER_BLOCK		/* Blocked */
59*130f4520SKenneth D. Merry #define	xT	CTL_SER_EXTENT		/* Extent check */
60*130f4520SKenneth D. Merry 
61*130f4520SKenneth D. Merry static ctl_serialize_action
62*130f4520SKenneth D. Merry ctl_serialize_table[CTL_SERIDX_COUNT][CTL_SERIDX_COUNT] = {
63*130f4520SKenneth D. Merry /**>IDX_ :: 2nd:TUR RD  WRT  MDSN MDSL RQSN INQ  RDCP RES  REL LSNS FMT STR PRIN PROT MAININ*/
64*130f4520SKenneth D. Merry /*TUR     */{   pS, pS, pS,  bK,  bK,  bK,  pS,  pS,  bK,  bK, pS,  bK, bK, bK,  bK,  bK},
65*130f4520SKenneth D. Merry /*READ    */{   pS, pS, xT,  bK,  bK,  bK,  pS,  pS,  bK,  bK, pS,  bK, bK, bK,  bK,  bK},
66*130f4520SKenneth D. Merry /*WRITE   */{   pS, xT, xT,  bK,  bK,  bK,  pS,  pS,  bK,  bK, pS,  bK, bK, bK,  bK,  bK},
67*130f4520SKenneth D. Merry /*MD_SNS  */{   bK, bK, bK,  pS,  bK,  bK,  pS,  pS,  bK,  bK, pS,  bK, bK, bK,  bK,  bK},
68*130f4520SKenneth D. Merry /*MD_SEL  */{   bK, bK, bK,  bK,  bK,  bK,  pS,  pS,  bK,  bK, pS,  bK, bK, bK,  bK,  bK},
69*130f4520SKenneth D. Merry /*RQ_SNS  */{   pS, pS, pS,  pS,  pS,  bK,  pS,  pS,  bK,  bK, pS,  bK, bK, bK,  bK,  bK},
70*130f4520SKenneth D. Merry /*INQ     */{   pS, pS, pS,  pS,  pS,  bK,  pS,  pS,  bK,  bK, pS,  bK, bK, bK,  bK,  bK},
71*130f4520SKenneth D. Merry /*RD_CAP  */{   pS, pS, pS,  pS,  pS,  bK,  pS,  pS,  bK,  bK, pS,  bK, bK, bK,  bK,  bK},
72*130f4520SKenneth D. Merry /*RESV    */{   bK, bK, bK,  bK,  bK,  bK,  bK,  bK,  bK,  bK, bK,  bK, bK, bK,  bK,  bK},
73*130f4520SKenneth D. Merry /*REL     */{   bK, bK, bK,  bK,  bK,  bK,  bK,  bK,  bK,  bK, bK,  bK, bK, bK,  bK,  bK},
74*130f4520SKenneth D. Merry /*LOG_SNS */{   pS, pS, pS,  pS,  bK,  bK,  pS,  pS,  bK,  bK, pS,  bK, bK, bK,  bK,  bK},
75*130f4520SKenneth D. Merry /*FORMAT  */{   pS, bK, bK,  bK,  bK,  pS,  pS,  bK,  bK,  bK, bK,  bK, bK, bK,  bK,  bK},
76*130f4520SKenneth D. Merry /*START   */{   bK, bK, bK,  bK,  bK,  bK,  pS,  bK,  bK,  bK, bK,  bK, bK, bK,  bK,  bK},
77*130f4520SKenneth D. Merry /*PRES_IN */{   bK, bK, bK,  bK,  bK,  bK,  bK,  bK,  bK,  bK, bK,  bK, bK, bK,  bK,  bK},
78*130f4520SKenneth D. Merry /*PRES_OUT*/{   bK, bK, bK,  bK,  bK,  bK,  bK,  bK,  bK,  bK, bK,  bK, bK, bK,  bK,  bK},
79*130f4520SKenneth D. Merry /*MAIN_IN */{   bK, bK, bK,  bK,  bK,  bK,  pS,  bK,  bK,  bK, bK,  bK, bK, bK,  bK,  pS}
80*130f4520SKenneth D. Merry };
81*130f4520SKenneth D. Merry 
82