The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/isci/scil/scif_sas_io_request_states.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
    3  *
    4  * This file is provided under a dual BSD/GPLv2 license.  When using or
    5  * redistributing this file, you may do so under either license.
    6  *
    7  * GPL LICENSE SUMMARY
    8  *
    9  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
   10  *
   11  * This program is free software; you can redistribute it and/or modify
   12  * it under the terms of version 2 of the GNU General Public License as
   13  * published by the Free Software Foundation.
   14  *
   15  * This program is distributed in the hope that it will be useful, but
   16  * WITHOUT ANY WARRANTY; without even the implied warranty of
   17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   18  * General Public License for more details.
   19  *
   20  * You should have received a copy of the GNU General Public License
   21  * along with this program; if not, write to the Free Software
   22  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
   23  * The full GNU General Public License is included in this distribution
   24  * in the file called LICENSE.GPL.
   25  *
   26  * BSD LICENSE
   27  *
   28  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
   29  * All rights reserved.
   30  *
   31  * Redistribution and use in source and binary forms, with or without
   32  * modification, are permitted provided that the following conditions
   33  * are met:
   34  *
   35  *   * Redistributions of source code must retain the above copyright
   36  *     notice, this list of conditions and the following disclaimer.
   37  *   * Redistributions in binary form must reproduce the above copyright
   38  *     notice, this list of conditions and the following disclaimer in
   39  *     the documentation and/or other materials provided with the
   40  *     distribution.
   41  *
   42  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   43  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   44  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   45  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   46  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   47  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   48  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   49  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   50  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   51  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   52  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   53  */
   54 
   55 #include <sys/cdefs.h>
   56 __FBSDID("$FreeBSD$");
   57 
   58 /**
   59  * @file
   60  *
   61  * @brief This file contains all of the SCIF_SAS_IO_REQUEST object
   62  *        state entrance and exit method implementations.
   63  */
   64 
   65 #include <dev/isci/scil/scic_controller.h>
   66 
   67 #include <dev/isci/scil/scif_sas_io_request.h>
   68 #include <dev/isci/scil/scif_sas_domain.h>
   69 #include <dev/isci/scil/scif_sas_controller.h>
   70 #include <dev/isci/scil/scif_sas_logger.h>
   71 
   72 //******************************************************************************
   73 //* P R O T E C T E D   M E T H O D S
   74 //******************************************************************************
   75 
   76 /**
   77  * @brief This method implements the actions taken when entering the
   78  *        INITIAL state.
   79  *
   80  * @param[in]  object This parameter specifies the base object for which
   81  *             the state transition is occurring.  This is cast into a
   82  *             SCIF_SAS_IO_REQUEST object in the method implementation.
   83  *
   84  * @return none
   85  */
   86 static
   87 void scif_sas_io_request_initial_state_enter(
   88    SCI_BASE_OBJECT_T *object
   89 )
   90 {
   91    SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
   92 
   93    SET_STATE_HANDLER(
   94       &fw_io->parent,
   95       scif_sas_io_request_state_handler_table,
   96       SCI_BASE_REQUEST_STATE_INITIAL
   97    );
   98 
   99    // Initial state is a transitional state to the constructed state
  100    sci_base_state_machine_change_state(
  101       &fw_io->parent.parent.state_machine, SCI_BASE_REQUEST_STATE_CONSTRUCTED
  102    );
  103 }
  104 
  105 /**
  106  * @brief This method implements the actions taken when entering the
  107  *        CONSTRUCTED state.
  108  *
  109  * @param[in]  object This parameter specifies the base object for which
  110  *             the state transition is occurring.  This is cast into a
  111  *             SCIF_SAS_IO_REQUEST object in the method implementation.
  112  *
  113  * @return none
  114  */
  115 static
  116 void scif_sas_io_request_constructed_state_enter(
  117    SCI_BASE_OBJECT_T *object
  118 )
  119 {
  120    SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
  121 
  122    SET_STATE_HANDLER(
  123       &fw_io->parent,
  124       scif_sas_io_request_state_handler_table,
  125       SCI_BASE_REQUEST_STATE_CONSTRUCTED
  126    );
  127 }
  128 
  129 /**
  130  * @brief This method implements the actions taken when entering the
  131  *        STARTED state.
  132  *
  133  * @param[in]  object This parameter specifies the base object for which
  134  *             the state transition is occurring.  This is cast into a
  135  *             SCIF_SAS_IO_REQUEST object in the method implementation.
  136  *
  137  * @return none
  138  */
  139 static
  140 void scif_sas_io_request_started_state_enter(
  141    SCI_BASE_OBJECT_T *object
  142 )
  143 {
  144    SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
  145 
  146    SET_STATE_HANDLER(
  147       &fw_io->parent,
  148       scif_sas_io_request_state_handler_table,
  149       SCI_BASE_REQUEST_STATE_STARTED
  150    );
  151 }
  152 
  153 /**
  154  * @brief This method implements the actions taken when entering the
  155  *        COMPLETED state.
  156  *
  157  * @param[in]  object This parameter specifies the base object for which
  158  *             the state transition is occurring.  This is cast into a
  159  *             SCIF_SAS_IO_REQUEST object in the method implementation.
  160  *
  161  * @return none
  162  */
  163 static
  164 void scif_sas_io_request_completed_state_enter(
  165    SCI_BASE_OBJECT_T *object
  166 )
  167 {
  168    SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
  169 
  170    SET_STATE_HANDLER(
  171       &fw_io->parent,
  172       scif_sas_io_request_state_handler_table,
  173       SCI_BASE_REQUEST_STATE_COMPLETED
  174    );
  175 }
  176 
  177 /**
  178  * @brief This method implements the actions taken when entering the
  179  *        ABORTING state.
  180  *
  181  * @param[in]  object This parameter specifies the base object for which
  182  *             the state transition is occurring.  This is cast into a
  183  *             SCIF_SAS_IO_REQUEST object in the method implementation.
  184  *
  185  * @return none
  186  */
  187 static
  188 void scif_sas_io_request_aborting_state_enter(
  189    SCI_BASE_OBJECT_T *object
  190 )
  191 {
  192    SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
  193 
  194    SCIF_LOG_WARNING((
  195       sci_base_object_get_logger(fw_io),
  196       SCIF_LOG_OBJECT_IO_REQUEST | SCIF_LOG_OBJECT_TASK_MANAGEMENT,
  197       "Domain:0x%x Device:0x%x IORequest:0x%x terminating\n",
  198       fw_io->parent.device->domain, fw_io->parent.device, fw_io
  199    ));
  200 
  201    SET_STATE_HANDLER(
  202       &fw_io->parent,
  203       scif_sas_io_request_state_handler_table,
  204       SCI_BASE_REQUEST_STATE_ABORTING
  205    );
  206 
  207    fw_io->parent.status = scif_sas_request_terminate_start(
  208                              &fw_io->parent, fw_io->parent.core_object
  209                           );
  210 }
  211 
  212 /**
  213  * @brief This method implements the actions taken when exiting the
  214  *        ABORTING state.
  215  *
  216  * @param[in]  object This parameter specifies the base object for which
  217  *             the state transition is occurring.  This is cast into a
  218  *             SCIF_SAS_IO_REQUEST object in the method implementation.
  219  *
  220  * @return none
  221  */
  222 static
  223 void scif_sas_io_request_aborting_state_exit(
  224    SCI_BASE_OBJECT_T *object
  225 )
  226 {
  227    SCIF_SAS_REQUEST_T * fw_request = (SCIF_SAS_REQUEST_T *)object;
  228    scif_sas_request_terminate_complete(fw_request);
  229 }
  230 
  231 /**
  232  * @brief This method implements the actions taken when entering the
  233  *        FINAL state.
  234  *
  235  * @param[in]  object This parameter specifies the base object for which
  236  *             the state transition is occurring.  This is cast into a
  237  *             SCIF_SAS_IO_REQUEST object in the method implementation.
  238  *
  239  * @return none
  240  */
  241 static
  242 void scif_sas_io_request_final_state_enter(
  243    SCI_BASE_OBJECT_T *object
  244 )
  245 {
  246    SCIF_SAS_IO_REQUEST_T * fw_io = (SCIF_SAS_IO_REQUEST_T *)object;
  247 
  248    SET_STATE_HANDLER(
  249       &fw_io->parent,
  250       scif_sas_io_request_state_handler_table,
  251       SCI_BASE_REQUEST_STATE_FINAL
  252    );
  253 }
  254 
  255 SCI_BASE_STATE_T scif_sas_io_request_state_table[SCI_BASE_REQUEST_MAX_STATES] =
  256 {
  257    {
  258       SCI_BASE_REQUEST_STATE_INITIAL,
  259       scif_sas_io_request_initial_state_enter,
  260       NULL
  261    },
  262    {
  263       SCI_BASE_REQUEST_STATE_CONSTRUCTED,
  264       scif_sas_io_request_constructed_state_enter,
  265       NULL
  266    },
  267    {
  268       SCI_BASE_REQUEST_STATE_STARTED,
  269       scif_sas_io_request_started_state_enter,
  270       NULL
  271    },
  272    {
  273       SCI_BASE_REQUEST_STATE_COMPLETED,
  274       scif_sas_io_request_completed_state_enter,
  275       NULL
  276    },
  277    {
  278       SCI_BASE_REQUEST_STATE_ABORTING,
  279       scif_sas_io_request_aborting_state_enter,
  280       scif_sas_io_request_aborting_state_exit
  281    },
  282    {
  283       SCI_BASE_REQUEST_STATE_FINAL,
  284       scif_sas_io_request_final_state_enter,
  285       NULL
  286    },
  287 };
  288 

Cache object: c74f3d0daedf3fb0bb02703ab7b4c525


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.