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_high_priority_request_queue.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 method implementations specific to
   62  *        the high priority request queue (HPRQ).  See the
   63  *        scif_sas_high_priority_request_queue.h file for additional
   64  *        information.
   65  */
   66 
   67 #include <dev/isci/scil/scif_sas_high_priority_request_queue.h>
   68 
   69 #include <dev/isci/scil/scif_sas_logger.h>
   70 #include <dev/isci/scil/scif_sas_io_request.h>
   71 #include <dev/isci/scil/scif_sas_controller.h>
   72 
   73 /**
   74  * @brief This method initializes the fields of the HPRQ.  It should be
   75  *        called during the construction of the object containing or
   76  *        utilizing it (i.e. SCIF_SAS_CONTROLLER).
   77  *
   78  * @param[in] fw_hprq This parameter specific the high priority request
   79  *            queue object being constructed.
   80  *
   81  * @return none
   82  */
   83 void scif_sas_high_priority_request_queue_construct(
   84    SCIF_SAS_HIGH_PRIORITY_REQUEST_QUEUE_T * fw_hprq,
   85    SCI_BASE_LOGGER_T                      * logger
   86 )
   87 {
   88    SCIF_LOG_TRACE((
   89       logger,
   90       SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_DOMAIN_DISCOVERY,
   91       "scif_sas_high_priority_request_queue_construct(0x%x,0x%x) enter\n",
   92       fw_hprq, logger
   93    ));
   94 
   95    sci_base_object_construct((SCI_BASE_OBJECT_T*) &fw_hprq->lock, logger);
   96    fw_hprq->lock.level = SCI_LOCK_LEVEL_NONE;
   97 
   98    sci_pool_initialize(fw_hprq->pool);
   99 }
  100 
  101 /**
  102  * @brief This method will ensure all internal requests destined for
  103  *        devices contained in the supplied domain are properly removed
  104  *        from the high priority request queue.
  105  *
  106  * @param[in] fw_hprq This parameter specifies the high priority request
  107  *            queue object for which to attempt to remove elements.
  108  * @param[in] fw_domain This parameter specifies the domain for which to
  109  *            remove all high priority requests.
  110  *
  111  * @return none
  112  */
  113 void scif_sas_high_priority_request_queue_purge_domain(
  114    SCIF_SAS_HIGH_PRIORITY_REQUEST_QUEUE_T * fw_hprq,
  115    SCIF_SAS_DOMAIN_T                      * fw_domain
  116 )
  117 {
  118    SCIF_SAS_IO_REQUEST_T * fw_io;
  119    POINTER_UINT            io_address;
  120    U32                     index;
  121    U32                     element_count;
  122 
  123    SCIF_LOG_TRACE((
  124       sci_base_object_get_logger(&fw_hprq->lock),
  125       SCIF_LOG_OBJECT_CONTROLLER | SCIF_LOG_OBJECT_DOMAIN_DISCOVERY,
  126       "scif_sas_high_priority_request_queue_purge_domain(0x%x,0x%x) enter\n",
  127       fw_hprq, fw_domain
  128    ));
  129 
  130    element_count = sci_pool_count(fw_hprq->pool);
  131 
  132    scif_cb_lock_acquire(fw_domain->controller, &fw_hprq->lock);
  133 
  134    for (index = 0; index < element_count; index++)
  135    {
  136       sci_pool_get(fw_hprq->pool, io_address);
  137 
  138       fw_io = (SCIF_SAS_IO_REQUEST_T*) io_address;
  139 
  140       // If the high priority request is not intended for this domain,
  141       // then it can be left in the pool.
  142       if (fw_io->parent.device->domain != fw_domain)
  143       {
  144          sci_pool_put(fw_hprq->pool, io_address);
  145       }
  146       else
  147       {
  148          if (fw_io->parent.is_internal)
  149          {
  150             SCIF_SAS_INTERNAL_IO_REQUEST_T * fw_internal_io =
  151                (SCIF_SAS_INTERNAL_IO_REQUEST_T *)fw_io;
  152 
  153             // The request was intended for a device in the domain.  Put it
  154             // back in the pool of freely available internal request memory
  155             // objects. The internal IO's timer is to be destoyed.
  156             scif_sas_internal_io_request_destruct(fw_domain->controller, fw_internal_io);
  157          }
  158       }
  159    }
  160 
  161    scif_cb_lock_release(fw_domain->controller, &fw_hprq->lock);
  162 }
  163 

Cache object: 1c453313abda4ebefbbb5f061a340e14


[ 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.