xref: /freebsd/sys/cam/ctl/ctl_ser_table.c (revision 2ff63af9b88c7413b7d71715b5532625752a248e)
1130f4520SKenneth D. Merry /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3bec9534dSPedro F. Giffuni  *
4130f4520SKenneth D. Merry  * Copyright (c) 2003 Silicon Graphics International Corp.
5130f4520SKenneth D. Merry  * All rights reserved.
6130f4520SKenneth D. Merry  *
7130f4520SKenneth D. Merry  * Redistribution and use in source and binary forms, with or without
8130f4520SKenneth D. Merry  * modification, are permitted provided that the following conditions
9130f4520SKenneth D. Merry  * are met:
10130f4520SKenneth D. Merry  * 1. Redistributions of source code must retain the above copyright
11130f4520SKenneth D. Merry  *    notice, this list of conditions, and the following disclaimer,
12130f4520SKenneth D. Merry  *    without modification.
13130f4520SKenneth D. Merry  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14130f4520SKenneth D. Merry  *    substantially similar to the "NO WARRANTY" disclaimer below
15130f4520SKenneth D. Merry  *    ("Disclaimer") and any redistribution must be conditioned upon
16130f4520SKenneth D. Merry  *    including a substantially similar Disclaimer requirement for further
17130f4520SKenneth D. Merry  *    binary redistribution.
18130f4520SKenneth D. Merry  *
19130f4520SKenneth D. Merry  * NO WARRANTY
20130f4520SKenneth D. Merry  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21130f4520SKenneth D. Merry  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22130f4520SKenneth D. Merry  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
23130f4520SKenneth D. Merry  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24130f4520SKenneth D. Merry  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25130f4520SKenneth D. Merry  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26130f4520SKenneth D. Merry  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27130f4520SKenneth D. Merry  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28130f4520SKenneth D. Merry  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29130f4520SKenneth D. Merry  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30130f4520SKenneth D. Merry  * POSSIBILITY OF SUCH DAMAGES.
31130f4520SKenneth D. Merry  *
32130f4520SKenneth D. Merry  * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_ser_table.c#1 $
33130f4520SKenneth D. Merry  */
34130f4520SKenneth D. Merry 
35130f4520SKenneth D. Merry /*
36130f4520SKenneth D. Merry  * CAM Target Layer command serialization table.
37130f4520SKenneth D. Merry  *
38130f4520SKenneth D. Merry  * Author: Kim Le
39130f4520SKenneth D. Merry  */
40130f4520SKenneth D. Merry 
41130f4520SKenneth D. Merry /****************************************************************************/
42130f4520SKenneth D. Merry /* TABLE       ctlSerTbl                                                    */
43130f4520SKenneth D. Merry /*                                                                          */
44130f4520SKenneth D. Merry /*  The matrix which drives the serialization algorithm. The major index    */
459d9fd8b7SAlexander Motin /*  (the first, row) into this table is the new command.  The minor index   */
469d9fd8b7SAlexander Motin /*  (column) is the older, possibly already running, command.               */
47130f4520SKenneth D. Merry /*                                                                          */
48130f4520SKenneth D. Merry /*  Whenever a new value is added to the IDX_T type, this matrix must be    */
49130f4520SKenneth D. Merry /*  expanded by one row AND one column -- Because of this, some effort      */
50130f4520SKenneth D. Merry /*  should be made to re-use the indexes whenever possible.                 */
51130f4520SKenneth D. Merry /*                                                                          */
52130f4520SKenneth D. Merry /****************************************************************************/
53130f4520SKenneth D. Merry 
54ab55ae25SAlexander Motin #define	pS	CTL_SER_PASS		/* Pass */
55130f4520SKenneth D. Merry #define	bK	CTL_SER_BLOCK		/* Blocked */
56ab55ae25SAlexander Motin #define	bO	CTL_SER_BLOCKOPT	/* Optional block */
57130f4520SKenneth D. Merry #define	xT	CTL_SER_EXTENT		/* Extent check */
58ab55ae25SAlexander Motin #define	xO	CTL_SER_EXTENTOPT	/* Optional extent check */
599d9fd8b7SAlexander Motin #define	xS	CTL_SER_SEQ		/* Sequential check */
60130f4520SKenneth D. Merry 
619d9fd8b7SAlexander Motin const static uint8_t
62130f4520SKenneth D. Merry ctl_serialize_table[CTL_SERIDX_COUNT][CTL_SERIDX_COUNT] = {
63f2a20b16SAlexander Motin /**>IDX_ :: 2nd:TUR RD  WRT UNM SYN MDSN MDSL RQSN INQ RDCP RES LSNS FMT STR*/
649d9fd8b7SAlexander Motin /*TUR     */{   pS, pS, pS, pS, pS, bK,  bK,  pS,  pS, pS,  bK, pS,  pS, bK},
659d9fd8b7SAlexander Motin /*READ    */{   pS, xS, xT, xO, pS, bK,  bK,  pS,  pS, pS,  bK, pS,  bK, bK},
669d9fd8b7SAlexander Motin /*WRITE   */{   pS, xT, xT, xO, pS, bK,  bK,  pS,  pS, pS,  bK, pS,  bK, bK},
679d9fd8b7SAlexander Motin /*UNMAP   */{   pS, bO, bO, pS, pS, bK,  bK,  pS,  pS, pS,  bK, pS,  bK, bK},
689d9fd8b7SAlexander Motin /*SYNC    */{   pS, pS, bO, pS, pS, bK,  bK,  pS,  pS, pS,  bK, pS,  bK, bK},
699d9fd8b7SAlexander Motin /*MD_SNS  */{   bK, bK, bK, bK, bK, pS,  bK,  pS,  pS, pS,  bK, pS,  bK, bK},
709d9fd8b7SAlexander Motin /*MD_SEL  */{   bK, bK, bK, bK, bK, bK,  bK,  pS,  pS, pS,  bK, bK,  bK, bK},
719d9fd8b7SAlexander Motin /*RQ_SNS  */{   bK, bK, bK, bK, bK, bK,  bK,  bK,  bK, bK,  bK, bK,  pS, bK},
729d9fd8b7SAlexander Motin /*INQ     */{   pS, pS, pS, pS, pS, pS,  pS,  pS,  pS, pS,  pS, pS,  pS, pS},
739d9fd8b7SAlexander Motin /*RD_CAP  */{   pS, pS, pS, pS, pS, pS,  pS,  pS,  pS, pS,  bK, pS,  bK, bK},
749d9fd8b7SAlexander Motin /*RES     */{   bK, bK, bK, bK, bK, bK,  bK,  bK,  pS, pS,  bK, bK,  bK, bK},
759d9fd8b7SAlexander Motin /*LOG_SNS */{   pS, pS, pS, pS, pS, pS,  pS,  pS,  pS, pS,  bK, pS,  bK, bK},
769d9fd8b7SAlexander Motin /*FORMAT  */{   bK, bK, bK, bK, bK, bK,  bK,  bK,  bK, bK,  bK, bK,  bK, bK},
779d9fd8b7SAlexander Motin /*START   */{   bK, bK, bK, bK, bK, bK,  bK,  bK,  bK, pS,  bK, bK,  bK, bK},
78130f4520SKenneth D. Merry };
799d9fd8b7SAlexander Motin 
80