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/cam/cam_xpt_internal.h

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  * Copyright 2009 Scott Long
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions, and the following disclaimer,
   10  *    without modification, immediately at the beginning of the file.
   11  * 2. The name of the author may not be used to endorse or promote products
   12  *    derived from this software without specific prior written permission.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
   18  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/11.2/sys/cam/cam_xpt_internal.h 328820 2018-02-02 23:22:58Z mav $
   27  */
   28 
   29 #ifndef _CAM_CAM_XPT_INTERNAL_H
   30 #define _CAM_CAM_XPT_INTERNAL_H 1
   31 
   32 #include <sys/taskqueue.h>
   33 
   34 /* Forward Declarations */
   35 struct cam_eb;
   36 struct cam_et;
   37 struct cam_ed;
   38 
   39 typedef struct cam_ed * (*xpt_alloc_device_func)(struct cam_eb *bus,
   40                                                  struct cam_et *target,
   41                                                  lun_id_t lun_id);
   42 typedef void (*xpt_release_device_func)(struct cam_ed *device);
   43 typedef void (*xpt_action_func)(union ccb *start_ccb);
   44 typedef void (*xpt_dev_async_func)(u_int32_t async_code,
   45                                    struct cam_eb *bus,
   46                                    struct cam_et *target,
   47                                    struct cam_ed *device,
   48                                    void *async_arg);
   49 typedef void (*xpt_announce_periph_func)(struct cam_periph *periph);
   50 
   51 struct xpt_xport_ops {
   52         xpt_alloc_device_func   alloc_device;
   53         xpt_release_device_func reldev;
   54         xpt_action_func         action;
   55         xpt_dev_async_func      async;
   56         xpt_announce_periph_func announce;
   57 };
   58 
   59 struct xpt_xport {
   60         cam_xport               xport;
   61         const char              *name;
   62         struct xpt_xport_ops    *ops;
   63 };
   64 
   65 SET_DECLARE(cam_xpt_xport_set, struct xpt_xport);
   66 #define CAM_XPT_XPORT(data)                             \
   67         DATA_SET(cam_xpt_xport_set, data)
   68 
   69 typedef void (*xpt_proto_announce_func)(struct cam_ed *);
   70 typedef void (*xpt_proto_debug_out_func)(union ccb *);
   71 
   72 struct xpt_proto_ops {
   73         xpt_proto_announce_func announce;
   74         xpt_proto_announce_func denounce;
   75         xpt_proto_debug_out_func debug_out;
   76 };
   77 
   78 struct xpt_proto {
   79         cam_proto               proto;
   80         const char              *name;
   81         struct xpt_proto_ops    *ops;
   82 };
   83 
   84 SET_DECLARE(cam_xpt_proto_set, struct xpt_proto);
   85 #define CAM_XPT_PROTO(data)                             \
   86         DATA_SET(cam_xpt_proto_set, data)
   87 
   88 
   89 /*
   90  * The CAM EDT (Existing Device Table) contains the device information for
   91  * all devices for all busses in the system.  The table contains a
   92  * cam_ed structure for each device on the bus.
   93  */
   94 struct cam_ed {
   95         cam_pinfo        devq_entry;
   96         TAILQ_ENTRY(cam_ed) links;
   97         struct  cam_et   *target;
   98         struct  cam_sim  *sim;
   99         lun_id_t         lun_id;
  100         struct  cam_ccbq ccbq;          /* Queue of pending ccbs */
  101         struct  async_list asyncs;      /* Async callback info for this B/T/L */
  102         struct  periph_list periphs;    /* All attached devices */
  103         u_int   generation;             /* Generation number */
  104         void             *quirk;        /* Oddities about this device */
  105         u_int            maxtags;
  106         u_int            mintags;
  107         cam_proto        protocol;
  108         u_int            protocol_version;
  109         cam_xport        transport;
  110         u_int            transport_version;
  111         struct           scsi_inquiry_data inq_data;
  112         uint8_t          *supported_vpds;
  113         uint8_t          supported_vpds_len;
  114         uint32_t         device_id_len;
  115         uint8_t          *device_id;
  116         uint32_t         ext_inq_len;
  117         uint8_t          *ext_inq;
  118         uint8_t          physpath_len;
  119         uint8_t          *physpath;     /* physical path string form */
  120         uint32_t         rcap_len;
  121         uint8_t          *rcap_buf;
  122         struct           ata_params ident_data;
  123         u_int8_t         inq_flags;     /*
  124                                          * Current settings for inquiry flags.
  125                                          * This allows us to override settings
  126                                          * like disconnection and tagged
  127                                          * queuing for a device.
  128                                          */
  129         u_int8_t         queue_flags;   /* Queue flags from the control page */
  130         u_int8_t         serial_num_len;
  131         u_int8_t        *serial_num;
  132         u_int32_t        flags;
  133 #define CAM_DEV_UNCONFIGURED            0x01
  134 #define CAM_DEV_REL_TIMEOUT_PENDING     0x02
  135 #define CAM_DEV_REL_ON_COMPLETE         0x04
  136 #define CAM_DEV_REL_ON_QUEUE_EMPTY      0x08
  137 #define CAM_DEV_TAG_AFTER_COUNT         0x20
  138 #define CAM_DEV_INQUIRY_DATA_VALID      0x40
  139 #define CAM_DEV_IN_DV                   0x80
  140 #define CAM_DEV_DV_HIT_BOTTOM           0x100
  141 #define CAM_DEV_IDENTIFY_DATA_VALID     0x200
  142         u_int32_t        tag_delay_count;
  143 #define CAM_TAG_DELAY_COUNT             5
  144         u_int32_t        tag_saved_openings;
  145         u_int32_t        refcount;
  146         struct callout   callout;
  147         STAILQ_ENTRY(cam_ed) highpowerq_entry;
  148         struct mtx       device_mtx;
  149         struct task      device_destroy_task;
  150         const struct     nvme_controller_data *nvme_cdata;
  151         const struct     nvme_namespace_data *nvme_data;
  152 };
  153 
  154 /*
  155  * Each target is represented by an ET (Existing Target).  These
  156  * entries are created when a target is successfully probed with an
  157  * identify, and removed when a device fails to respond after a number
  158  * of retries, or a bus rescan finds the device missing.
  159  */
  160 struct cam_et {
  161         TAILQ_HEAD(, cam_ed) ed_entries;
  162         TAILQ_ENTRY(cam_et) links;
  163         struct  cam_eb  *bus;
  164         target_id_t     target_id;
  165         u_int32_t       refcount;
  166         u_int           generation;
  167         struct          timeval last_reset;
  168         u_int           rpl_size;
  169         struct scsi_report_luns_data *luns;
  170         struct mtx      luns_mtx;       /* Protection for luns field. */
  171 };
  172 
  173 /*
  174  * Each bus is represented by an EB (Existing Bus).  These entries
  175  * are created by calls to xpt_bus_register and deleted by calls to
  176  * xpt_bus_deregister.
  177  */
  178 struct cam_eb {
  179         TAILQ_HEAD(, cam_et) et_entries;
  180         TAILQ_ENTRY(cam_eb)  links;
  181         path_id_t            path_id;
  182         struct cam_sim       *sim;
  183         struct timeval       last_reset;
  184         u_int32_t            flags;
  185 #define CAM_EB_RUNQ_SCHEDULED   0x01
  186         u_int32_t            refcount;
  187         u_int                generation;
  188         device_t             parent_dev;
  189         struct xpt_xport     *xport;
  190         struct mtx           eb_mtx;    /* Bus topology mutex. */
  191 };
  192 
  193 struct cam_path {
  194         struct cam_periph *periph;
  195         struct cam_eb     *bus;
  196         struct cam_et     *target;
  197         struct cam_ed     *device;
  198 };
  199 
  200 struct cam_ed *         xpt_alloc_device(struct cam_eb *bus,
  201                                          struct cam_et *target,
  202                                          lun_id_t lun_id);
  203 void                    xpt_acquire_device(struct cam_ed *device);
  204 void                    xpt_release_device(struct cam_ed *device);
  205 u_int32_t               xpt_dev_ccbq_resize(struct cam_path *path, int newopenings);
  206 void                    xpt_start_tags(struct cam_path *path);
  207 void                    xpt_stop_tags(struct cam_path *path);
  208 
  209 MALLOC_DECLARE(M_CAMXPT);
  210 
  211 #endif

Cache object: 63e739009df3e3ad4d702eff131ec101


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