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_compat.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  * CAM ioctl compatibility shims
    3  *
    4  * Copyright (c) 2013 Scott Long
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions, and the following disclaimer,
   12  *    without modification, immediately at the beginning of the file.
   13  * 2. The name of the author may not be used to endorse or promote products
   14  *    derived from this software without specific prior written permission.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   19  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
   20  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   26  * SUCH DAMAGE.
   27  *
   28  * $FreeBSD$
   29  */
   30 
   31 #ifndef _CAM_CAM_COMPAT_H
   32 #define _CAM_CAM_COMPAT_H
   33 
   34 /* No user-servicable parts in here. */
   35 #ifdef _KERNEL
   36 
   37 int cam_compat_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
   38     struct thread *td, int(*cbfnp)(struct cdev *, u_long, caddr_t, int,
   39     struct thread *));
   40 
   41 
   42 /* Version 0x16 compatibility */
   43 #define CAM_VERSION_0x16        0x16
   44 
   45 /* The size of the union ccb didn't change when going to 0x17 */
   46 #define CAMIOCOMMAND_0x16       _IOC(IOC_INOUT, CAM_VERSION_0x16, 2, CAM_0X17_LEN)
   47 #define CAMGETPASSTHRU_0x16     _IOC(IOC_INOUT, CAM_VERSION_0x16, 3, CAM_0X17_LEN)
   48 
   49 #define CAM_SCATTER_VALID_0x16  0x00000010
   50 #define CAM_SG_LIST_PHYS_0x16   0x00040000
   51 #define CAM_DATA_PHYS_0x16      0x00200000
   52 
   53 /* Version 0x17 compatibility */
   54 #define CAM_VERSION_0x17        0x17
   55 
   56 struct ccb_hdr_0x17 {
   57         cam_pinfo       pinfo;          /* Info for priority scheduling */
   58         camq_entry      xpt_links;      /* For chaining in the XPT layer */     
   59         camq_entry      sim_links;      /* For chaining in the SIM layer */     
   60         camq_entry      periph_links;   /* For chaining in the type driver */
   61         u_int32_t       retry_count;
   62         void            (*cbfcnp)(struct cam_periph *, union ccb *);
   63         xpt_opcode      func_code;      /* XPT function code */
   64         u_int32_t       status;         /* Status returned by CAM subsystem */
   65         struct          cam_path *path; /* Compiled path for this ccb */
   66         path_id_t       path_id;        /* Path ID for the request */
   67         target_id_t     target_id;      /* Target device ID */
   68         lun_id_t        target_lun;     /* Target LUN number */
   69         u_int32_t       flags;          /* ccb_flags */
   70         ccb_ppriv_area  periph_priv;
   71         ccb_spriv_area  sim_priv;
   72         u_int32_t       timeout;        /* Hard timeout value in seconds */
   73         struct callout_handle timeout_ch;
   74 };
   75 
   76 struct ccb_pathinq_0x17 {
   77         struct ccb_hdr_0x17 ccb_h;
   78         u_int8_t    version_num;        /* Version number for the SIM/HBA */
   79         u_int8_t    hba_inquiry;        /* Mimic of INQ byte 7 for the HBA */
   80         u_int8_t    target_sprt;        /* Flags for target mode support */
   81         u_int8_t    hba_misc;           /* Misc HBA features */
   82         u_int16_t   hba_eng_cnt;        /* HBA engine count */
   83                                         /* Vendor Unique capabilities */
   84         u_int8_t    vuhba_flags[VUHBALEN];
   85         u_int32_t   max_target;         /* Maximum supported Target */
   86         u_int32_t   max_lun;            /* Maximum supported Lun */
   87         u_int32_t   async_flags;        /* Installed Async handlers */
   88         path_id_t   hpath_id;           /* Highest Path ID in the subsystem */
   89         target_id_t initiator_id;       /* ID of the HBA on the SCSI bus */
   90         char        sim_vid[SIM_IDLEN]; /* Vendor ID of the SIM */
   91         char        hba_vid[HBA_IDLEN]; /* Vendor ID of the HBA */
   92         char        dev_name[DEV_IDLEN];/* Device name for SIM */
   93         u_int32_t   unit_number;        /* Unit number for SIM */
   94         u_int32_t   bus_id;             /* Bus ID for SIM */
   95         u_int32_t   base_transfer_speed;/* Base bus speed in KB/sec */
   96         cam_proto   protocol;
   97         u_int       protocol_version;
   98         cam_xport   transport;
   99         u_int       transport_version;
  100         union {
  101                 struct ccb_pathinq_settings_spi spi;
  102                 struct ccb_pathinq_settings_fc fc;
  103                 struct ccb_pathinq_settings_sas sas;
  104                 char ccb_pathinq_settings_opaque[PATHINQ_SETTINGS_SIZE];
  105         } xport_specific;
  106         u_int           maxio;          /* Max supported I/O size, in bytes. */
  107         u_int16_t       hba_vendor;     /* HBA vendor ID */
  108         u_int16_t       hba_device;     /* HBA device ID */
  109         u_int16_t       hba_subvendor;  /* HBA subvendor ID */
  110         u_int16_t       hba_subdevice;  /* HBA subdevice ID */
  111 };
  112 
  113 #define CAM_0X17_DATA_LEN       (sizeof(union ccb) - sizeof(struct ccb_hdr))
  114 #define CAM_0X17_LEN            (sizeof(struct ccb_hdr_0x17) + CAM_0X17_DATA_LEN)
  115 
  116 #define CAMIOCOMMAND_0x17       _IOC(IOC_INOUT, CAM_VERSION_0x17, 2, CAM_0X17_LEN)
  117 #define CAMGETPASSTHRU_0x17     _IOC(IOC_INOUT, CAM_VERSION_0x17, 3, CAM_0X17_LEN)
  118 
  119 #endif
  120 #endif

Cache object: 7e42c082cba8d29eed54d202bdb638cf


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