1898b0535SWarner Losh /*- 28b8a9b1dSJustin T. Gibbs * Data structures and definitions for CAM Control Blocks (CCBs). 38b8a9b1dSJustin T. Gibbs * 48b8a9b1dSJustin T. Gibbs * Copyright (c) 1997, 1998 Justin T. Gibbs. 58b8a9b1dSJustin T. Gibbs * All rights reserved. 68b8a9b1dSJustin T. Gibbs * 78b8a9b1dSJustin T. Gibbs * Redistribution and use in source and binary forms, with or without 88b8a9b1dSJustin T. Gibbs * modification, are permitted provided that the following conditions 98b8a9b1dSJustin T. Gibbs * are met: 108b8a9b1dSJustin T. Gibbs * 1. Redistributions of source code must retain the above copyright 118b8a9b1dSJustin T. Gibbs * notice, this list of conditions, and the following disclaimer, 128b8a9b1dSJustin T. Gibbs * without modification, immediately at the beginning of the file. 138b8a9b1dSJustin T. Gibbs * 2. The name of the author may not be used to endorse or promote products 148b8a9b1dSJustin T. Gibbs * derived from this software without specific prior written permission. 158b8a9b1dSJustin T. Gibbs * 168b8a9b1dSJustin T. Gibbs * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 178b8a9b1dSJustin T. Gibbs * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 188b8a9b1dSJustin T. Gibbs * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 198b8a9b1dSJustin T. Gibbs * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 208b8a9b1dSJustin T. Gibbs * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 218b8a9b1dSJustin T. Gibbs * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 228b8a9b1dSJustin T. Gibbs * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 238b8a9b1dSJustin T. Gibbs * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 248b8a9b1dSJustin T. Gibbs * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 258b8a9b1dSJustin T. Gibbs * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 268b8a9b1dSJustin T. Gibbs * SUCH DAMAGE. 278b8a9b1dSJustin T. Gibbs * 28c3aac50fSPeter Wemm * $FreeBSD$ 298b8a9b1dSJustin T. Gibbs */ 308b8a9b1dSJustin T. Gibbs 318b8a9b1dSJustin T. Gibbs #ifndef _CAM_CAM_CCB_H 328b8a9b1dSJustin T. Gibbs #define _CAM_CAM_CCB_H 1 338b8a9b1dSJustin T. Gibbs 348b8a9b1dSJustin T. Gibbs #include <sys/queue.h> 358b8a9b1dSJustin T. Gibbs #include <sys/cdefs.h> 3687cfaf0eSJustin T. Gibbs #include <sys/time.h> 37104a9b7eSAlexander Kabaev #include <sys/limits.h> 38c4473420SPeter Wemm #ifndef _KERNEL 398b8a9b1dSJustin T. Gibbs #include <sys/callout.h> 408b8a9b1dSJustin T. Gibbs #endif 418b8a9b1dSJustin T. Gibbs #include <cam/cam_debug.h> 428b8a9b1dSJustin T. Gibbs #include <cam/scsi/scsi_all.h> 4352c9ce25SScott Long #include <cam/ata/ata_all.h> 44baabaca3SWarner Losh #include <cam/nvme/nvme_all.h> 45*a94a63f0SWarner Losh #include <cam/mmc/mmc_all.h> 468b8a9b1dSJustin T. Gibbs 478b8a9b1dSJustin T. Gibbs /* General allocation length definitions for CCB structures */ 488b8a9b1dSJustin T. Gibbs #define IOCDBLEN CAM_MAX_CDBLEN /* Space for CDB bytes/pointer */ 498b8a9b1dSJustin T. Gibbs #define VUHBALEN 14 /* Vendor Unique HBA length */ 508b8a9b1dSJustin T. Gibbs #define SIM_IDLEN 16 /* ASCII string len for SIM ID */ 518b8a9b1dSJustin T. Gibbs #define HBA_IDLEN 16 /* ASCII string len for HBA ID */ 528b8a9b1dSJustin T. Gibbs #define DEV_IDLEN 16 /* ASCII string len for device names */ 538b8a9b1dSJustin T. Gibbs #define CCB_PERIPH_PRIV_SIZE 2 /* size of peripheral private area */ 548b8a9b1dSJustin T. Gibbs #define CCB_SIM_PRIV_SIZE 2 /* size of sim private area */ 558b8a9b1dSJustin T. Gibbs 568b8a9b1dSJustin T. Gibbs /* Struct definitions for CAM control blocks */ 578b8a9b1dSJustin T. Gibbs 588b8a9b1dSJustin T. Gibbs /* Common CCB header */ 598b8a9b1dSJustin T. Gibbs /* CAM CCB flags */ 608b8a9b1dSJustin T. Gibbs typedef enum { 618b8a9b1dSJustin T. Gibbs CAM_CDB_POINTER = 0x00000001,/* The CDB field is a pointer */ 628b8a9b1dSJustin T. Gibbs CAM_QUEUE_ENABLE = 0x00000002,/* SIM queue actions are enabled */ 638b8a9b1dSJustin T. Gibbs CAM_CDB_LINKED = 0x00000004,/* CCB contains a linked CDB */ 64dd5bac9dSJustin T. Gibbs CAM_NEGOTIATE = 0x00000008,/* 65dd5bac9dSJustin T. Gibbs * Perform transport negotiation 66dd5bac9dSJustin T. Gibbs * with this command. 67dd5bac9dSJustin T. Gibbs */ 68dd0b4fb6SKonstantin Belousov CAM_DATA_ISPHYS = 0x00000010,/* Data type with physical addrs */ 698b8a9b1dSJustin T. Gibbs CAM_DIS_AUTOSENSE = 0x00000020,/* Disable autosense feature */ 7006e79492SKenneth D. Merry CAM_DIR_BOTH = 0x00000000,/* Data direction (00:IN/OUT) */ 718b8a9b1dSJustin T. Gibbs CAM_DIR_IN = 0x00000040,/* Data direction (01:DATA IN) */ 728b8a9b1dSJustin T. Gibbs CAM_DIR_OUT = 0x00000080,/* Data direction (10:DATA OUT) */ 738b8a9b1dSJustin T. Gibbs CAM_DIR_NONE = 0x000000C0,/* Data direction (11:no data) */ 748b8a9b1dSJustin T. Gibbs CAM_DIR_MASK = 0x000000C0,/* Data direction Mask */ 75dd0b4fb6SKonstantin Belousov CAM_DATA_VADDR = 0x00000000,/* Data type (000:Virtual) */ 76dd0b4fb6SKonstantin Belousov CAM_DATA_PADDR = 0x00000010,/* Data type (001:Physical) */ 77dd0b4fb6SKonstantin Belousov CAM_DATA_SG = 0x00040000,/* Data type (010:sglist) */ 78dd0b4fb6SKonstantin Belousov CAM_DATA_SG_PADDR = 0x00040010,/* Data type (011:sglist phys) */ 79dd0b4fb6SKonstantin Belousov CAM_DATA_BIO = 0x00200000,/* Data type (100:bio) */ 80dd0b4fb6SKonstantin Belousov CAM_DATA_MASK = 0x00240010,/* Data type mask */ 818b8a9b1dSJustin T. Gibbs CAM_SOFT_RST_OP = 0x00000100,/* Use Soft reset alternative */ 828b8a9b1dSJustin T. Gibbs CAM_ENG_SYNC = 0x00000200,/* Flush resid bytes on complete */ 838b8a9b1dSJustin T. Gibbs CAM_DEV_QFRZDIS = 0x00000400,/* Disable DEV Q freezing */ 848b8a9b1dSJustin T. Gibbs CAM_DEV_QFREEZE = 0x00000800,/* Freeze DEV Q on execution */ 858b8a9b1dSJustin T. Gibbs CAM_HIGH_POWER = 0x00001000,/* Command takes a lot of power */ 868b8a9b1dSJustin T. Gibbs CAM_SENSE_PTR = 0x00002000,/* Sense data is a pointer */ 878b8a9b1dSJustin T. Gibbs CAM_SENSE_PHYS = 0x00004000,/* Sense pointer is physical addr*/ 888b8a9b1dSJustin T. Gibbs CAM_TAG_ACTION_VALID = 0x00008000,/* Use the tag action in this ccb*/ 898b8a9b1dSJustin T. Gibbs CAM_PASS_ERR_RECOVER = 0x00010000,/* Pass driver does err. recovery*/ 908b8a9b1dSJustin T. Gibbs CAM_DIS_DISCONNECT = 0x00020000,/* Disable disconnect */ 918b8a9b1dSJustin T. Gibbs CAM_MSG_BUF_PHYS = 0x00080000,/* Message buffer ptr is physical*/ 928b8a9b1dSJustin T. Gibbs CAM_SNS_BUF_PHYS = 0x00100000,/* Autosense data ptr is physical*/ 938b8a9b1dSJustin T. Gibbs CAM_CDB_PHYS = 0x00400000,/* CDB poiner is physical */ 948b8a9b1dSJustin T. Gibbs CAM_ENG_SGLIST = 0x00800000,/* SG list is for the HBA engine */ 958b8a9b1dSJustin T. Gibbs 968b8a9b1dSJustin T. Gibbs /* Phase cognizant mode flags */ 970cdabce0SNick Hibma CAM_DIS_AUTOSRP = 0x01000000,/* Disable autosave/restore ptrs */ 988b8a9b1dSJustin T. Gibbs CAM_DIS_AUTODISC = 0x02000000,/* Disable auto disconnect */ 998b8a9b1dSJustin T. Gibbs CAM_TGT_CCB_AVAIL = 0x04000000,/* Target CCB available */ 1008b8a9b1dSJustin T. Gibbs CAM_TGT_PHASE_MODE = 0x08000000,/* The SIM runs in phase mode */ 101826eb7c8SMatt Jacob CAM_MSGB_VALID = 0x10000000,/* Message buffer valid */ 102826eb7c8SMatt Jacob CAM_STATUS_VALID = 0x20000000,/* Status buffer valid */ 103826eb7c8SMatt Jacob CAM_DATAB_VALID = 0x40000000,/* Data buffer valid */ 1048b8a9b1dSJustin T. Gibbs 1058b8a9b1dSJustin T. Gibbs /* Host target Mode flags */ 106826eb7c8SMatt Jacob CAM_SEND_SENSE = 0x08000000,/* Send sense data with status */ 107826eb7c8SMatt Jacob CAM_TERM_IO = 0x10000000,/* Terminate I/O Message sup. */ 108826eb7c8SMatt Jacob CAM_DISCONNECT = 0x20000000,/* Disconnects are mandatory */ 109227d67aaSAlexander Motin CAM_SEND_STATUS = 0x40000000,/* Send status after data phase */ 110227d67aaSAlexander Motin 111227d67aaSAlexander Motin CAM_UNLOCKED = 0x80000000 /* Call callback without lock. */ 1128b8a9b1dSJustin T. Gibbs } ccb_flags; 1138b8a9b1dSJustin T. Gibbs 114a9934668SKenneth D. Merry typedef enum { 11523d63288SKenneth D. Merry CAM_USER_DATA_ADDR = 0x00000002,/* Userspace data pointers */ 11623d63288SKenneth D. Merry CAM_SG_FORMAT_IOVEC = 0x00000004,/* iovec instead of busdma S/G*/ 11723d63288SKenneth D. Merry CAM_UNMAPPED_BUF = 0x00000008 /* use unmapped I/O */ 118a9934668SKenneth D. Merry } ccb_xflags; 119a9934668SKenneth D. Merry 1208b8a9b1dSJustin T. Gibbs /* XPT Opcodes for xpt_action */ 1218b8a9b1dSJustin T. Gibbs typedef enum { 1229deea857SKenneth D. Merry /* Function code flags are bits greater than 0xff */ 1239deea857SKenneth D. Merry XPT_FC_QUEUED = 0x100, 1249deea857SKenneth D. Merry /* Non-immediate function code */ 1259deea857SKenneth D. Merry XPT_FC_USER_CCB = 0x200, 1269deea857SKenneth D. Merry XPT_FC_XPT_ONLY = 0x400, 1279deea857SKenneth D. Merry /* Only for the transport layer device */ 128bf8bb7acSJustin T. Gibbs XPT_FC_DEV_QUEUED = 0x800 | XPT_FC_QUEUED, 129bf8bb7acSJustin T. Gibbs /* Passes through the device queues */ 1308b8a9b1dSJustin T. Gibbs /* Common function commands: 0x00->0x0F */ 1319deea857SKenneth D. Merry XPT_NOOP = 0x00, 1329deea857SKenneth D. Merry /* Execute Nothing */ 133bf8bb7acSJustin T. Gibbs XPT_SCSI_IO = 0x01 | XPT_FC_DEV_QUEUED, 1349deea857SKenneth D. Merry /* Execute the requested I/O operation */ 1359deea857SKenneth D. Merry XPT_GDEV_TYPE = 0x02, 1369deea857SKenneth D. Merry /* Get type information for specified device */ 1379deea857SKenneth D. Merry XPT_GDEVLIST = 0x03, 1389deea857SKenneth D. Merry /* Get a list of peripheral devices */ 1399deea857SKenneth D. Merry XPT_PATH_INQ = 0x04, 1409deea857SKenneth D. Merry /* Path routing inquiry */ 1419deea857SKenneth D. Merry XPT_REL_SIMQ = 0x05, 14283c5d981SAlexander Motin /* Release a frozen device queue */ 1439deea857SKenneth D. Merry XPT_SASYNC_CB = 0x06, 1449deea857SKenneth D. Merry /* Set Asynchronous Callback Parameters */ 1459deea857SKenneth D. Merry XPT_SDEV_TYPE = 0x07, 1469deea857SKenneth D. Merry /* Set device type information */ 1479deea857SKenneth D. Merry XPT_SCAN_BUS = 0x08 | XPT_FC_QUEUED | XPT_FC_USER_CCB 1489deea857SKenneth D. Merry | XPT_FC_XPT_ONLY, 1499deea857SKenneth D. Merry /* (Re)Scan the SCSI Bus */ 1509deea857SKenneth D. Merry XPT_DEV_MATCH = 0x09 | XPT_FC_XPT_ONLY, 1519deea857SKenneth D. Merry /* Get EDT entries matching the given pattern */ 1529deea857SKenneth D. Merry XPT_DEBUG = 0x0a, 1539deea857SKenneth D. Merry /* Turn on debugging for a bus, target or lun */ 15487cfaf0eSJustin T. Gibbs XPT_PATH_STATS = 0x0b, 15587cfaf0eSJustin T. Gibbs /* Path statistics (error counts, etc.) */ 15687cfaf0eSJustin T. Gibbs XPT_GDEV_STATS = 0x0c, 15787cfaf0eSJustin T. Gibbs /* Device statistics (error counts, etc.) */ 1583501942bSJustin T. Gibbs XPT_DEV_ADVINFO = 0x0e, 1593501942bSJustin T. Gibbs /* Get/Set Device advanced information */ 160227d67aaSAlexander Motin XPT_ASYNC = 0x0f | XPT_FC_QUEUED | XPT_FC_USER_CCB 161227d67aaSAlexander Motin | XPT_FC_XPT_ONLY, 162227d67aaSAlexander Motin /* Asynchronous event */ 1638b8a9b1dSJustin T. Gibbs /* SCSI Control Functions: 0x10->0x1F */ 1649deea857SKenneth D. Merry XPT_ABORT = 0x10, 1659deea857SKenneth D. Merry /* Abort the specified CCB */ 1669deea857SKenneth D. Merry XPT_RESET_BUS = 0x11 | XPT_FC_XPT_ONLY, 1679deea857SKenneth D. Merry /* Reset the specified SCSI bus */ 168bf8bb7acSJustin T. Gibbs XPT_RESET_DEV = 0x12 | XPT_FC_DEV_QUEUED, 1699deea857SKenneth D. Merry /* Bus Device Reset the specified SCSI device */ 1709deea857SKenneth D. Merry XPT_TERM_IO = 0x13, 1719deea857SKenneth D. Merry /* Terminate the I/O process */ 1729deea857SKenneth D. Merry XPT_SCAN_LUN = 0x14 | XPT_FC_QUEUED | XPT_FC_USER_CCB 1739deea857SKenneth D. Merry | XPT_FC_XPT_ONLY, 1749deea857SKenneth D. Merry /* Scan Logical Unit */ 1759deea857SKenneth D. Merry XPT_GET_TRAN_SETTINGS = 0x15, 1769deea857SKenneth D. Merry /* 1778b8a9b1dSJustin T. Gibbs * Get default/user transfer settings 1788b8a9b1dSJustin T. Gibbs * for the target 1798b8a9b1dSJustin T. Gibbs */ 1809deea857SKenneth D. Merry XPT_SET_TRAN_SETTINGS = 0x16, 1819deea857SKenneth D. Merry /* 1828b8a9b1dSJustin T. Gibbs * Set transfer rate/width 1838b8a9b1dSJustin T. Gibbs * negotiation settings 1848b8a9b1dSJustin T. Gibbs */ 1859deea857SKenneth D. Merry XPT_CALC_GEOMETRY = 0x17, 1869deea857SKenneth D. Merry /* 1878b8a9b1dSJustin T. Gibbs * Calculate the geometry parameters for 1888b8a9b1dSJustin T. Gibbs * a device give the sector size and 1898b8a9b1dSJustin T. Gibbs * volume size. 1908b8a9b1dSJustin T. Gibbs */ 19152c9ce25SScott Long XPT_ATA_IO = 0x18 | XPT_FC_DEV_QUEUED, 19252c9ce25SScott Long /* Execute the requested ATA I/O operation */ 1938b8a9b1dSJustin T. Gibbs 194a2531862SWarner Losh XPT_GET_SIM_KNOB_OLD = 0x18, /* Compat only */ 1952df76c16SMatt Jacob 1962df76c16SMatt Jacob XPT_SET_SIM_KNOB = 0x19, 1972df76c16SMatt Jacob /* 1982df76c16SMatt Jacob * Set SIM specific knob values. 1992df76c16SMatt Jacob */ 2000e85f214SMatt Jacob 201a2531862SWarner Losh XPT_GET_SIM_KNOB = 0x1a, 202a2531862SWarner Losh /* 203a2531862SWarner Losh * Get SIM specific knob values. 204a2531862SWarner Losh */ 205a2531862SWarner Losh 20606e79492SKenneth D. Merry XPT_SMP_IO = 0x1b | XPT_FC_DEV_QUEUED, 20706e79492SKenneth D. Merry /* Serial Management Protocol */ 20806e79492SKenneth D. Merry 2097b05c3e3SWarner Losh XPT_NVME_IO = 0x1c | XPT_FC_DEV_QUEUED, 2107b05c3e3SWarner Losh /* Execiute the requestred NVMe I/O operation */ 2117b05c3e3SWarner Losh 212*a94a63f0SWarner Losh XPT_MMC_IO = 0x1d | XPT_FC_DEV_QUEUED, 213bbb19fc7SWarner Losh /* Placeholder for MMC / SD / SDIO I/O stuff */ 214bbb19fc7SWarner Losh 215*a94a63f0SWarner Losh XPT_SCAN_TGT = 0x1e | XPT_FC_QUEUED | XPT_FC_USER_CCB 2160e85f214SMatt Jacob | XPT_FC_XPT_ONLY, 2170e85f214SMatt Jacob /* Scan Target */ 2180e85f214SMatt Jacob 2198b8a9b1dSJustin T. Gibbs /* HBA engine commands 0x20->0x2F */ 2209deea857SKenneth D. Merry XPT_ENG_INQ = 0x20 | XPT_FC_XPT_ONLY, 2219deea857SKenneth D. Merry /* HBA engine feature inquiry */ 2223393f8daSKenneth D. Merry XPT_ENG_EXEC = 0x21 | XPT_FC_DEV_QUEUED, 2239deea857SKenneth D. Merry /* HBA execute engine request */ 2248b8a9b1dSJustin T. Gibbs 2258b8a9b1dSJustin T. Gibbs /* Target mode commands: 0x30->0x3F */ 2269deea857SKenneth D. Merry XPT_EN_LUN = 0x30, 2279deea857SKenneth D. Merry /* Enable LUN as a target */ 228bf8bb7acSJustin T. Gibbs XPT_TARGET_IO = 0x31 | XPT_FC_DEV_QUEUED, 2299deea857SKenneth D. Merry /* Execute target I/O request */ 2309deea857SKenneth D. Merry XPT_ACCEPT_TARGET_IO = 0x32 | XPT_FC_QUEUED | XPT_FC_USER_CCB, 2319deea857SKenneth D. Merry /* Accept Host Target Mode CDB */ 232bf8bb7acSJustin T. Gibbs XPT_CONT_TARGET_IO = 0x33 | XPT_FC_DEV_QUEUED, 2339deea857SKenneth D. Merry /* Continue Host Target I/O Connection */ 2349deea857SKenneth D. Merry XPT_IMMED_NOTIFY = 0x34 | XPT_FC_QUEUED | XPT_FC_USER_CCB, 2352df76c16SMatt Jacob /* Notify Host Target driver of event (obsolete) */ 2369deea857SKenneth D. Merry XPT_NOTIFY_ACK = 0x35, 2372df76c16SMatt Jacob /* Acknowledgement of event (obsolete) */ 2382df76c16SMatt Jacob XPT_IMMEDIATE_NOTIFY = 0x36 | XPT_FC_QUEUED | XPT_FC_USER_CCB, 2392df76c16SMatt Jacob /* Notify Host Target driver of event */ 2402df76c16SMatt Jacob XPT_NOTIFY_ACKNOWLEDGE = 0x37 | XPT_FC_QUEUED | XPT_FC_USER_CCB, 2419deea857SKenneth D. Merry /* Acknowledgement of event */ 242d68fae58SEdward Tomasz Napierala XPT_REPROBE_LUN = 0x38 | XPT_FC_QUEUED | XPT_FC_USER_CCB, 243d68fae58SEdward Tomasz Napierala /* Query device capacity and notify GEOM */ 2448b8a9b1dSJustin T. Gibbs 2458b8a9b1dSJustin T. Gibbs /* Vendor Unique codes: 0x80->0x8F */ 2468b8a9b1dSJustin T. Gibbs XPT_VUNIQUE = 0x80 2478b8a9b1dSJustin T. Gibbs } xpt_opcode; 2488b8a9b1dSJustin T. Gibbs 2499deea857SKenneth D. Merry #define XPT_FC_GROUP_MASK 0xF0 2509deea857SKenneth D. Merry #define XPT_FC_GROUP(op) ((op) & XPT_FC_GROUP_MASK) 2519deea857SKenneth D. Merry #define XPT_FC_GROUP_COMMON 0x00 2529deea857SKenneth D. Merry #define XPT_FC_GROUP_SCSI_CONTROL 0x10 2539deea857SKenneth D. Merry #define XPT_FC_GROUP_HBA_ENGINE 0x20 2549deea857SKenneth D. Merry #define XPT_FC_GROUP_TMODE 0x30 2559deea857SKenneth D. Merry #define XPT_FC_GROUP_VENDOR_UNIQUE 0x80 256a89bb8b4SJustin T. Gibbs 257bf8bb7acSJustin T. Gibbs #define XPT_FC_IS_DEV_QUEUED(ccb) \ 258bf8bb7acSJustin T. Gibbs (((ccb)->ccb_h.func_code & XPT_FC_DEV_QUEUED) == XPT_FC_DEV_QUEUED) 259bf8bb7acSJustin T. Gibbs #define XPT_FC_IS_QUEUED(ccb) \ 260bf8bb7acSJustin T. Gibbs (((ccb)->ccb_h.func_code & XPT_FC_QUEUED) != 0) 2613393f8daSKenneth D. Merry 2623393f8daSKenneth D. Merry typedef enum { 2633393f8daSKenneth D. Merry PROTO_UNKNOWN, 2643393f8daSKenneth D. Merry PROTO_UNSPECIFIED, 2653393f8daSKenneth D. Merry PROTO_SCSI, /* Small Computer System Interface */ 2663393f8daSKenneth D. Merry PROTO_ATA, /* AT Attachment */ 2673393f8daSKenneth D. Merry PROTO_ATAPI, /* AT Attachment Packetized Interface */ 26852c9ce25SScott Long PROTO_SATAPM, /* SATA Port Multiplier */ 2693089bb2eSAlexander Motin PROTO_SEMB, /* SATA Enclosure Management Bridge */ 270baabaca3SWarner Losh PROTO_NVME, /* NVME */ 271*a94a63f0SWarner Losh PROTO_MMCSD, /* MMC, SD, SDIO */ 2723393f8daSKenneth D. Merry } cam_proto; 2733393f8daSKenneth D. Merry 2743393f8daSKenneth D. Merry typedef enum { 2753393f8daSKenneth D. Merry XPORT_UNKNOWN, 2763393f8daSKenneth D. Merry XPORT_UNSPECIFIED, 2773393f8daSKenneth D. Merry XPORT_SPI, /* SCSI Parallel Interface */ 2783393f8daSKenneth D. Merry XPORT_FC, /* Fiber Channel */ 2793393f8daSKenneth D. Merry XPORT_SSA, /* Serial Storage Architecture */ 2803393f8daSKenneth D. Merry XPORT_USB, /* Universal Serial Bus */ 2813393f8daSKenneth D. Merry XPORT_PPB, /* Parallel Port Bus */ 282c4270cb6SMatt Jacob XPORT_ATA, /* AT Attachment */ 283c4270cb6SMatt Jacob XPORT_SAS, /* Serial Attached SCSI */ 28452c9ce25SScott Long XPORT_SATA, /* Serial AT Attachment */ 28533ea30feSAlexander Motin XPORT_ISCSI, /* iSCSI */ 286b5595753SNathan Whitehorn XPORT_SRP, /* SCSI RDMA Protocol */ 287baabaca3SWarner Losh XPORT_NVME, /* NVMe over PCIe */ 288*a94a63f0SWarner Losh XPORT_MMCSD, /* MMC, SD, SDIO card */ 2893393f8daSKenneth D. Merry } cam_xport; 2903393f8daSKenneth D. Merry 291336b7b66SWarner Losh #define XPORT_IS_NVME(t) ((t) == XPORT_NVME) 292b8b6b5d3SAlexander Motin #define XPORT_IS_ATA(t) ((t) == XPORT_ATA || (t) == XPORT_SATA) 293b8b6b5d3SAlexander Motin #define XPORT_IS_SCSI(t) ((t) != XPORT_UNKNOWN && \ 294b8b6b5d3SAlexander Motin (t) != XPORT_UNSPECIFIED && \ 295336b7b66SWarner Losh !XPORT_IS_ATA(t) && !XPORT_IS_NVME(t)) 296b8b6b5d3SAlexander Motin #define XPORT_DEVSTAT_TYPE(t) (XPORT_IS_ATA(t) ? DEVSTAT_TYPE_IF_IDE : \ 297b8b6b5d3SAlexander Motin XPORT_IS_SCSI(t) ? DEVSTAT_TYPE_IF_SCSI : \ 298b8b6b5d3SAlexander Motin DEVSTAT_TYPE_IF_OTHER) 299b8b6b5d3SAlexander Motin 3003393f8daSKenneth D. Merry #define PROTO_VERSION_UNKNOWN (UINT_MAX - 1) 3013393f8daSKenneth D. Merry #define PROTO_VERSION_UNSPECIFIED UINT_MAX 3023393f8daSKenneth D. Merry #define XPORT_VERSION_UNKNOWN (UINT_MAX - 1) 3033393f8daSKenneth D. Merry #define XPORT_VERSION_UNSPECIFIED UINT_MAX 3043393f8daSKenneth D. Merry 3058b8a9b1dSJustin T. Gibbs typedef union { 306e3975643SJake Burkholder LIST_ENTRY(ccb_hdr) le; 307e3975643SJake Burkholder SLIST_ENTRY(ccb_hdr) sle; 308e3975643SJake Burkholder TAILQ_ENTRY(ccb_hdr) tqe; 309e3975643SJake Burkholder STAILQ_ENTRY(ccb_hdr) stqe; 3108b8a9b1dSJustin T. Gibbs } camq_entry; 3118b8a9b1dSJustin T. Gibbs 3128b8a9b1dSJustin T. Gibbs typedef union { 3138b8a9b1dSJustin T. Gibbs void *ptr; 3148b8a9b1dSJustin T. Gibbs u_long field; 3152b83592fSScott Long u_int8_t bytes[sizeof(uintptr_t)]; 3168b8a9b1dSJustin T. Gibbs } ccb_priv_entry; 3178b8a9b1dSJustin T. Gibbs 3188b8a9b1dSJustin T. Gibbs typedef union { 3198b8a9b1dSJustin T. Gibbs ccb_priv_entry entries[CCB_PERIPH_PRIV_SIZE]; 3208b8a9b1dSJustin T. Gibbs u_int8_t bytes[CCB_PERIPH_PRIV_SIZE * sizeof(ccb_priv_entry)]; 3218b8a9b1dSJustin T. Gibbs } ccb_ppriv_area; 3228b8a9b1dSJustin T. Gibbs 3238b8a9b1dSJustin T. Gibbs typedef union { 3248b8a9b1dSJustin T. Gibbs ccb_priv_entry entries[CCB_SIM_PRIV_SIZE]; 3258b8a9b1dSJustin T. Gibbs u_int8_t bytes[CCB_SIM_PRIV_SIZE * sizeof(ccb_priv_entry)]; 3268b8a9b1dSJustin T. Gibbs } ccb_spriv_area; 3278b8a9b1dSJustin T. Gibbs 328f564de00SScott Long typedef struct { 329f564de00SScott Long struct timeval *etime; 330f564de00SScott Long uintptr_t sim_data; 331f564de00SScott Long uintptr_t periph_data; 332f564de00SScott Long } ccb_qos_area; 333f564de00SScott Long 3348b8a9b1dSJustin T. Gibbs struct ccb_hdr { 3358b8a9b1dSJustin T. Gibbs cam_pinfo pinfo; /* Info for priority scheduling */ 3368b8a9b1dSJustin T. Gibbs camq_entry xpt_links; /* For chaining in the XPT layer */ 3378b8a9b1dSJustin T. Gibbs camq_entry sim_links; /* For chaining in the SIM layer */ 3388b8a9b1dSJustin T. Gibbs camq_entry periph_links; /* For chaining in the type driver */ 3398b8a9b1dSJustin T. Gibbs u_int32_t retry_count; 3408b8a9b1dSJustin T. Gibbs void (*cbfcnp)(struct cam_periph *, union ccb *); 341af693a70SScott Long /* Callback on completion function */ 3428b8a9b1dSJustin T. Gibbs xpt_opcode func_code; /* XPT function code */ 3438b8a9b1dSJustin T. Gibbs u_int32_t status; /* Status returned by CAM subsystem */ 344af693a70SScott Long struct cam_path *path; /* Compiled path for this ccb */ 3458b8a9b1dSJustin T. Gibbs path_id_t path_id; /* Path ID for the request */ 3468b8a9b1dSJustin T. Gibbs target_id_t target_id; /* Target device ID */ 3478b8a9b1dSJustin T. Gibbs lun_id_t target_lun; /* Target LUN number */ 348af693a70SScott Long u_int32_t flags; /* ccb_flags */ 349f564de00SScott Long u_int32_t xflags; /* Extended flags */ 3508b8a9b1dSJustin T. Gibbs ccb_ppriv_area periph_priv; 3518b8a9b1dSJustin T. Gibbs ccb_spriv_area sim_priv; 352f564de00SScott Long ccb_qos_area qos; 353f564de00SScott Long u_int32_t timeout; /* Hard timeout value in mseconds */ 354f564de00SScott Long struct timeval softtimeout; /* Soft timeout value in sec + usec */ 3558b8a9b1dSJustin T. Gibbs }; 3568b8a9b1dSJustin T. Gibbs 3578b8a9b1dSJustin T. Gibbs /* Get Device Information CCB */ 3588b8a9b1dSJustin T. Gibbs struct ccb_getdev { 3598b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 36052c9ce25SScott Long cam_proto protocol; 3618b8a9b1dSJustin T. Gibbs struct scsi_inquiry_data inq_data; 36252c9ce25SScott Long struct ata_params ident_data; 3638b8a9b1dSJustin T. Gibbs u_int8_t serial_num[252]; 36430a4094fSAlexander Motin u_int8_t inq_flags; 3658b8a9b1dSJustin T. Gibbs u_int8_t serial_num_len; 366f24c011bSWarner Losh const struct nvme_controller_data *nvme_cdata; 367f24c011bSWarner Losh const struct nvme_namespace_data *nvme_data; 3688b8a9b1dSJustin T. Gibbs }; 3698b8a9b1dSJustin T. Gibbs 37087cfaf0eSJustin T. Gibbs /* Device Statistics CCB */ 37187cfaf0eSJustin T. Gibbs struct ccb_getdevstats { 37287cfaf0eSJustin T. Gibbs struct ccb_hdr ccb_h; 37387cfaf0eSJustin T. Gibbs int dev_openings; /* Space left for more work on device*/ 37487cfaf0eSJustin T. Gibbs int dev_active; /* Transactions running on the device */ 375959ec258SAlexander Motin int allocated; /* CCBs allocated for the device */ 376959ec258SAlexander Motin int queued; /* CCBs queued to be sent to the device */ 37787cfaf0eSJustin T. Gibbs int held; /* 37887cfaf0eSJustin T. Gibbs * CCBs held by peripheral drivers 37987cfaf0eSJustin T. Gibbs * for this device 38087cfaf0eSJustin T. Gibbs */ 38182815562SJustin T. Gibbs int maxtags; /* 38282815562SJustin T. Gibbs * Boundary conditions for number of 38382815562SJustin T. Gibbs * tagged operations 38482815562SJustin T. Gibbs */ 38582815562SJustin T. Gibbs int mintags; 38687cfaf0eSJustin T. Gibbs struct timeval last_reset; /* Time of last bus reset/loop init */ 38787cfaf0eSJustin T. Gibbs }; 3888b8a9b1dSJustin T. Gibbs 3898b8a9b1dSJustin T. Gibbs typedef enum { 3908b8a9b1dSJustin T. Gibbs CAM_GDEVLIST_LAST_DEVICE, 3918b8a9b1dSJustin T. Gibbs CAM_GDEVLIST_LIST_CHANGED, 3928b8a9b1dSJustin T. Gibbs CAM_GDEVLIST_MORE_DEVS, 3938b8a9b1dSJustin T. Gibbs CAM_GDEVLIST_ERROR 3948b8a9b1dSJustin T. Gibbs } ccb_getdevlist_status_e; 3958b8a9b1dSJustin T. Gibbs 3968b8a9b1dSJustin T. Gibbs struct ccb_getdevlist { 3978b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 3988b8a9b1dSJustin T. Gibbs char periph_name[DEV_IDLEN]; 3998b8a9b1dSJustin T. Gibbs u_int32_t unit_number; 4008b8a9b1dSJustin T. Gibbs unsigned int generation; 4018b8a9b1dSJustin T. Gibbs u_int32_t index; 4028b8a9b1dSJustin T. Gibbs ccb_getdevlist_status_e status; 4038b8a9b1dSJustin T. Gibbs }; 4048b8a9b1dSJustin T. Gibbs 4058b8a9b1dSJustin T. Gibbs typedef enum { 4068b8a9b1dSJustin T. Gibbs PERIPH_MATCH_NONE = 0x000, 4078b8a9b1dSJustin T. Gibbs PERIPH_MATCH_PATH = 0x001, 4088b8a9b1dSJustin T. Gibbs PERIPH_MATCH_TARGET = 0x002, 4098b8a9b1dSJustin T. Gibbs PERIPH_MATCH_LUN = 0x004, 4108b8a9b1dSJustin T. Gibbs PERIPH_MATCH_NAME = 0x008, 4118b8a9b1dSJustin T. Gibbs PERIPH_MATCH_UNIT = 0x010, 4128b8a9b1dSJustin T. Gibbs PERIPH_MATCH_ANY = 0x01f 4138b8a9b1dSJustin T. Gibbs } periph_pattern_flags; 4148b8a9b1dSJustin T. Gibbs 4158b8a9b1dSJustin T. Gibbs struct periph_match_pattern { 4168b8a9b1dSJustin T. Gibbs char periph_name[DEV_IDLEN]; 4178b8a9b1dSJustin T. Gibbs u_int32_t unit_number; 4188b8a9b1dSJustin T. Gibbs path_id_t path_id; 4198b8a9b1dSJustin T. Gibbs target_id_t target_id; 4208b8a9b1dSJustin T. Gibbs lun_id_t target_lun; 4218b8a9b1dSJustin T. Gibbs periph_pattern_flags flags; 4228b8a9b1dSJustin T. Gibbs }; 4238b8a9b1dSJustin T. Gibbs 4248b8a9b1dSJustin T. Gibbs typedef enum { 4258b8a9b1dSJustin T. Gibbs DEV_MATCH_NONE = 0x000, 4268b8a9b1dSJustin T. Gibbs DEV_MATCH_PATH = 0x001, 4278b8a9b1dSJustin T. Gibbs DEV_MATCH_TARGET = 0x002, 4288b8a9b1dSJustin T. Gibbs DEV_MATCH_LUN = 0x004, 4298b8a9b1dSJustin T. Gibbs DEV_MATCH_INQUIRY = 0x008, 4303501942bSJustin T. Gibbs DEV_MATCH_DEVID = 0x010, 4318b8a9b1dSJustin T. Gibbs DEV_MATCH_ANY = 0x00f 4328b8a9b1dSJustin T. Gibbs } dev_pattern_flags; 4338b8a9b1dSJustin T. Gibbs 4343501942bSJustin T. Gibbs struct device_id_match_pattern { 4353501942bSJustin T. Gibbs uint8_t id_len; 4363501942bSJustin T. Gibbs uint8_t id[256]; 4373501942bSJustin T. Gibbs }; 4383501942bSJustin T. Gibbs 4398b8a9b1dSJustin T. Gibbs struct device_match_pattern { 4408b8a9b1dSJustin T. Gibbs path_id_t path_id; 4418b8a9b1dSJustin T. Gibbs target_id_t target_id; 4428b8a9b1dSJustin T. Gibbs lun_id_t target_lun; 4438b8a9b1dSJustin T. Gibbs dev_pattern_flags flags; 4443501942bSJustin T. Gibbs union { 4453501942bSJustin T. Gibbs struct scsi_static_inquiry_pattern inq_pat; 4463501942bSJustin T. Gibbs struct device_id_match_pattern devid_pat; 4473501942bSJustin T. Gibbs } data; 4488b8a9b1dSJustin T. Gibbs }; 4498b8a9b1dSJustin T. Gibbs 4508b8a9b1dSJustin T. Gibbs typedef enum { 4518b8a9b1dSJustin T. Gibbs BUS_MATCH_NONE = 0x000, 4528b8a9b1dSJustin T. Gibbs BUS_MATCH_PATH = 0x001, 4538b8a9b1dSJustin T. Gibbs BUS_MATCH_NAME = 0x002, 4548b8a9b1dSJustin T. Gibbs BUS_MATCH_UNIT = 0x004, 4558b8a9b1dSJustin T. Gibbs BUS_MATCH_BUS_ID = 0x008, 4568b8a9b1dSJustin T. Gibbs BUS_MATCH_ANY = 0x00f 4578b8a9b1dSJustin T. Gibbs } bus_pattern_flags; 4588b8a9b1dSJustin T. Gibbs 4598b8a9b1dSJustin T. Gibbs struct bus_match_pattern { 4608b8a9b1dSJustin T. Gibbs path_id_t path_id; 4618b8a9b1dSJustin T. Gibbs char dev_name[DEV_IDLEN]; 4628b8a9b1dSJustin T. Gibbs u_int32_t unit_number; 4638b8a9b1dSJustin T. Gibbs u_int32_t bus_id; 4648b8a9b1dSJustin T. Gibbs bus_pattern_flags flags; 4658b8a9b1dSJustin T. Gibbs }; 4668b8a9b1dSJustin T. Gibbs 4678b8a9b1dSJustin T. Gibbs union match_pattern { 4688b8a9b1dSJustin T. Gibbs struct periph_match_pattern periph_pattern; 4698b8a9b1dSJustin T. Gibbs struct device_match_pattern device_pattern; 4708b8a9b1dSJustin T. Gibbs struct bus_match_pattern bus_pattern; 4718b8a9b1dSJustin T. Gibbs }; 4728b8a9b1dSJustin T. Gibbs 4738b8a9b1dSJustin T. Gibbs typedef enum { 4748b8a9b1dSJustin T. Gibbs DEV_MATCH_PERIPH, 4758b8a9b1dSJustin T. Gibbs DEV_MATCH_DEVICE, 4768b8a9b1dSJustin T. Gibbs DEV_MATCH_BUS 4778b8a9b1dSJustin T. Gibbs } dev_match_type; 4788b8a9b1dSJustin T. Gibbs 4798b8a9b1dSJustin T. Gibbs struct dev_match_pattern { 4808b8a9b1dSJustin T. Gibbs dev_match_type type; 4818b8a9b1dSJustin T. Gibbs union match_pattern pattern; 4828b8a9b1dSJustin T. Gibbs }; 4838b8a9b1dSJustin T. Gibbs 4848b8a9b1dSJustin T. Gibbs struct periph_match_result { 4858b8a9b1dSJustin T. Gibbs char periph_name[DEV_IDLEN]; 4868b8a9b1dSJustin T. Gibbs u_int32_t unit_number; 4878b8a9b1dSJustin T. Gibbs path_id_t path_id; 4888b8a9b1dSJustin T. Gibbs target_id_t target_id; 4898b8a9b1dSJustin T. Gibbs lun_id_t target_lun; 4908b8a9b1dSJustin T. Gibbs }; 4918b8a9b1dSJustin T. Gibbs 4929deea857SKenneth D. Merry typedef enum { 4939deea857SKenneth D. Merry DEV_RESULT_NOFLAG = 0x00, 4949deea857SKenneth D. Merry DEV_RESULT_UNCONFIGURED = 0x01 4959deea857SKenneth D. Merry } dev_result_flags; 4969deea857SKenneth D. Merry 4978b8a9b1dSJustin T. Gibbs struct device_match_result { 4988b8a9b1dSJustin T. Gibbs path_id_t path_id; 4998b8a9b1dSJustin T. Gibbs target_id_t target_id; 5008b8a9b1dSJustin T. Gibbs lun_id_t target_lun; 50152c9ce25SScott Long cam_proto protocol; 5028b8a9b1dSJustin T. Gibbs struct scsi_inquiry_data inq_data; 50352c9ce25SScott Long struct ata_params ident_data; 504*a94a63f0SWarner Losh struct mmc_params mmc_ident_data; 5059deea857SKenneth D. Merry dev_result_flags flags; 5068b8a9b1dSJustin T. Gibbs }; 5078b8a9b1dSJustin T. Gibbs 5088b8a9b1dSJustin T. Gibbs struct bus_match_result { 5098b8a9b1dSJustin T. Gibbs path_id_t path_id; 5108b8a9b1dSJustin T. Gibbs char dev_name[DEV_IDLEN]; 5118b8a9b1dSJustin T. Gibbs u_int32_t unit_number; 5128b8a9b1dSJustin T. Gibbs u_int32_t bus_id; 5138b8a9b1dSJustin T. Gibbs }; 5148b8a9b1dSJustin T. Gibbs 5158b8a9b1dSJustin T. Gibbs union match_result { 5168b8a9b1dSJustin T. Gibbs struct periph_match_result periph_result; 5178b8a9b1dSJustin T. Gibbs struct device_match_result device_result; 5188b8a9b1dSJustin T. Gibbs struct bus_match_result bus_result; 5198b8a9b1dSJustin T. Gibbs }; 5208b8a9b1dSJustin T. Gibbs 5218b8a9b1dSJustin T. Gibbs struct dev_match_result { 5228b8a9b1dSJustin T. Gibbs dev_match_type type; 5238b8a9b1dSJustin T. Gibbs union match_result result; 5248b8a9b1dSJustin T. Gibbs }; 5258b8a9b1dSJustin T. Gibbs 5268b8a9b1dSJustin T. Gibbs typedef enum { 5278b8a9b1dSJustin T. Gibbs CAM_DEV_MATCH_LAST, 5288b8a9b1dSJustin T. Gibbs CAM_DEV_MATCH_MORE, 5298b8a9b1dSJustin T. Gibbs CAM_DEV_MATCH_LIST_CHANGED, 5308b8a9b1dSJustin T. Gibbs CAM_DEV_MATCH_SIZE_ERROR, 5318b8a9b1dSJustin T. Gibbs CAM_DEV_MATCH_ERROR 5328b8a9b1dSJustin T. Gibbs } ccb_dev_match_status; 5338b8a9b1dSJustin T. Gibbs 5348b8a9b1dSJustin T. Gibbs typedef enum { 5358b8a9b1dSJustin T. Gibbs CAM_DEV_POS_NONE = 0x000, 5368b8a9b1dSJustin T. Gibbs CAM_DEV_POS_BUS = 0x001, 5378b8a9b1dSJustin T. Gibbs CAM_DEV_POS_TARGET = 0x002, 5388b8a9b1dSJustin T. Gibbs CAM_DEV_POS_DEVICE = 0x004, 5398b8a9b1dSJustin T. Gibbs CAM_DEV_POS_PERIPH = 0x008, 5408b8a9b1dSJustin T. Gibbs CAM_DEV_POS_PDPTR = 0x010, 5418b8a9b1dSJustin T. Gibbs CAM_DEV_POS_TYPEMASK = 0xf00, 5428b8a9b1dSJustin T. Gibbs CAM_DEV_POS_EDT = 0x100, 5438b8a9b1dSJustin T. Gibbs CAM_DEV_POS_PDRV = 0x200 5448b8a9b1dSJustin T. Gibbs } dev_pos_type; 5458b8a9b1dSJustin T. Gibbs 5468b8a9b1dSJustin T. Gibbs struct ccb_dm_cookie { 5478b8a9b1dSJustin T. Gibbs void *bus; 5488b8a9b1dSJustin T. Gibbs void *target; 5498b8a9b1dSJustin T. Gibbs void *device; 5508b8a9b1dSJustin T. Gibbs void *periph; 5518b8a9b1dSJustin T. Gibbs void *pdrv; 5528b8a9b1dSJustin T. Gibbs }; 5538b8a9b1dSJustin T. Gibbs 5548b8a9b1dSJustin T. Gibbs struct ccb_dev_position { 5558b8a9b1dSJustin T. Gibbs u_int generations[4]; 5568b8a9b1dSJustin T. Gibbs #define CAM_BUS_GENERATION 0x00 5578b8a9b1dSJustin T. Gibbs #define CAM_TARGET_GENERATION 0x01 5588b8a9b1dSJustin T. Gibbs #define CAM_DEV_GENERATION 0x02 5598b8a9b1dSJustin T. Gibbs #define CAM_PERIPH_GENERATION 0x03 5608b8a9b1dSJustin T. Gibbs dev_pos_type position_type; 5618b8a9b1dSJustin T. Gibbs struct ccb_dm_cookie cookie; 5628b8a9b1dSJustin T. Gibbs }; 5638b8a9b1dSJustin T. Gibbs 5648b8a9b1dSJustin T. Gibbs struct ccb_dev_match { 5658b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 5668b8a9b1dSJustin T. Gibbs ccb_dev_match_status status; 5678b8a9b1dSJustin T. Gibbs u_int32_t num_patterns; 5688b8a9b1dSJustin T. Gibbs u_int32_t pattern_buf_len; 5698b8a9b1dSJustin T. Gibbs struct dev_match_pattern *patterns; 5708b8a9b1dSJustin T. Gibbs u_int32_t num_matches; 5718b8a9b1dSJustin T. Gibbs u_int32_t match_buf_len; 5728b8a9b1dSJustin T. Gibbs struct dev_match_result *matches; 5738b8a9b1dSJustin T. Gibbs struct ccb_dev_position pos; 5748b8a9b1dSJustin T. Gibbs }; 5758b8a9b1dSJustin T. Gibbs 5768b8a9b1dSJustin T. Gibbs /* 5778b8a9b1dSJustin T. Gibbs * Definitions for the path inquiry CCB fields. 5788b8a9b1dSJustin T. Gibbs */ 57992be6c51SNathan Whitehorn #define CAM_VERSION 0x19 /* Hex value for current version */ 5808b8a9b1dSJustin T. Gibbs 5818b8a9b1dSJustin T. Gibbs typedef enum { 5828b8a9b1dSJustin T. Gibbs PI_MDP_ABLE = 0x80, /* Supports MDP message */ 5838b8a9b1dSJustin T. Gibbs PI_WIDE_32 = 0x40, /* Supports 32 bit wide SCSI */ 5848b8a9b1dSJustin T. Gibbs PI_WIDE_16 = 0x20, /* Supports 16 bit wide SCSI */ 5858b8a9b1dSJustin T. Gibbs PI_SDTR_ABLE = 0x10, /* Supports SDTR message */ 5868b8a9b1dSJustin T. Gibbs PI_LINKED_CDB = 0x08, /* Supports linked CDBs */ 58752c9ce25SScott Long PI_SATAPM = 0x04, /* Supports SATA PM */ 5888b8a9b1dSJustin T. Gibbs PI_TAG_ABLE = 0x02, /* Supports tag queue messages */ 589273a1a3dSKenneth D. Merry PI_SOFT_RST = 0x01 /* Supports soft reset alternative */ 5908b8a9b1dSJustin T. Gibbs } pi_inqflag; 5918b8a9b1dSJustin T. Gibbs 5928b8a9b1dSJustin T. Gibbs typedef enum { 5938b8a9b1dSJustin T. Gibbs PIT_PROCESSOR = 0x80, /* Target mode processor mode */ 5948b8a9b1dSJustin T. Gibbs PIT_PHASE = 0x40, /* Target mode phase cog. mode */ 5958b8a9b1dSJustin T. Gibbs PIT_DISCONNECT = 0x20, /* Disconnects supported in target mode */ 5968b8a9b1dSJustin T. Gibbs PIT_TERM_IO = 0x10, /* Terminate I/O message supported in TM */ 5978b8a9b1dSJustin T. Gibbs PIT_GRP_6 = 0x08, /* Group 6 commands supported */ 598273a1a3dSKenneth D. Merry PIT_GRP_7 = 0x04 /* Group 7 commands supported */ 5998b8a9b1dSJustin T. Gibbs } pi_tmflag; 6008b8a9b1dSJustin T. Gibbs 6018b8a9b1dSJustin T. Gibbs typedef enum { 602916d57dfSWarner Losh PIM_ATA_EXT = 0x200,/* ATA requests can understand ata_ext requests */ 603f564de00SScott Long PIM_EXTLUNS = 0x100,/* 64bit extended LUNs supported */ 6048b8a9b1dSJustin T. Gibbs PIM_SCANHILO = 0x80, /* Bus scans from high ID to low ID */ 6058b8a9b1dSJustin T. Gibbs PIM_NOREMOVE = 0x40, /* Removeable devices not included in scan */ 60698192658SJustin T. Gibbs PIM_NOINITIATOR = 0x20, /* Initiator role not supported. */ 6071deac581SNate Lawson PIM_NOBUSRESET = 0x10, /* User has disabled initial BUS RESET */ 608c1c3139eSMatt Jacob PIM_NO_6_BYTE = 0x08, /* Do not send 6-byte commands */ 609abc1e60eSKonstantin Belousov PIM_SEQSCAN = 0x04, /* Do bus scans sequentially, not in parallel */ 610abc1e60eSKonstantin Belousov PIM_UNMAPPED = 0x02, 611b01773b0SKenneth D. Merry PIM_NOSCAN = 0x01 /* SIM does its own scanning */ 6128b8a9b1dSJustin T. Gibbs } pi_miscflag; 6138b8a9b1dSJustin T. Gibbs 6148b8a9b1dSJustin T. Gibbs /* Path Inquiry CCB */ 6153393f8daSKenneth D. Merry struct ccb_pathinq_settings_spi { 6163393f8daSKenneth D. Merry u_int8_t ppr_options; 6173393f8daSKenneth D. Merry }; 6182df76c16SMatt Jacob 619fd13aa47SMatt Jacob struct ccb_pathinq_settings_fc { 620fd13aa47SMatt Jacob u_int64_t wwnn; /* world wide node name */ 621fd13aa47SMatt Jacob u_int64_t wwpn; /* world wide port name */ 622fd13aa47SMatt Jacob u_int32_t port; /* 24 bit port id, if known */ 623fd13aa47SMatt Jacob u_int32_t bitrate; /* Mbps */ 624fd13aa47SMatt Jacob }; 6252df76c16SMatt Jacob 626c4270cb6SMatt Jacob struct ccb_pathinq_settings_sas { 627c4270cb6SMatt Jacob u_int32_t bitrate; /* Mbps */ 628c4270cb6SMatt Jacob }; 629f24c011bSWarner Losh 630f24c011bSWarner Losh struct ccb_pathinq_settings_nvme { 631f24c011bSWarner Losh uint16_t nsid; /* Namespace ID for this path */ 632f24c011bSWarner Losh }; 633f24c011bSWarner Losh 634fd13aa47SMatt Jacob #define PATHINQ_SETTINGS_SIZE 128 6353393f8daSKenneth D. Merry 6368b8a9b1dSJustin T. Gibbs struct ccb_pathinq { 6378b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 6388b8a9b1dSJustin T. Gibbs u_int8_t version_num; /* Version number for the SIM/HBA */ 6398b8a9b1dSJustin T. Gibbs u_int8_t hba_inquiry; /* Mimic of INQ byte 7 for the HBA */ 640f564de00SScott Long u_int16_t target_sprt; /* Flags for target mode support */ 641f564de00SScott Long u_int32_t hba_misc; /* Misc HBA features */ 6428b8a9b1dSJustin T. Gibbs u_int16_t hba_eng_cnt; /* HBA engine count */ 6438b8a9b1dSJustin T. Gibbs /* Vendor Unique capabilities */ 6448b8a9b1dSJustin T. Gibbs u_int8_t vuhba_flags[VUHBALEN]; 6458b8a9b1dSJustin T. Gibbs u_int32_t max_target; /* Maximum supported Target */ 6468b8a9b1dSJustin T. Gibbs u_int32_t max_lun; /* Maximum supported Lun */ 6478b8a9b1dSJustin T. Gibbs u_int32_t async_flags; /* Installed Async handlers */ 6488b8a9b1dSJustin T. Gibbs path_id_t hpath_id; /* Highest Path ID in the subsystem */ 6498b8a9b1dSJustin T. Gibbs target_id_t initiator_id; /* ID of the HBA on the SCSI bus */ 6508b8a9b1dSJustin T. Gibbs char sim_vid[SIM_IDLEN]; /* Vendor ID of the SIM */ 6518b8a9b1dSJustin T. Gibbs char hba_vid[HBA_IDLEN]; /* Vendor ID of the HBA */ 6528b8a9b1dSJustin T. Gibbs char dev_name[DEV_IDLEN];/* Device name for SIM */ 6538b8a9b1dSJustin T. Gibbs u_int32_t unit_number; /* Unit number for SIM */ 6548b8a9b1dSJustin T. Gibbs u_int32_t bus_id; /* Bus ID for SIM */ 6559deea857SKenneth D. Merry u_int32_t base_transfer_speed;/* Base bus speed in KB/sec */ 6563393f8daSKenneth D. Merry cam_proto protocol; 6573393f8daSKenneth D. Merry u_int protocol_version; 6583393f8daSKenneth D. Merry cam_xport transport; 6593393f8daSKenneth D. Merry u_int transport_version; 6603393f8daSKenneth D. Merry union { 6613393f8daSKenneth D. Merry struct ccb_pathinq_settings_spi spi; 662fd13aa47SMatt Jacob struct ccb_pathinq_settings_fc fc; 663c4270cb6SMatt Jacob struct ccb_pathinq_settings_sas sas; 664f24c011bSWarner Losh struct ccb_pathinq_settings_nvme nvme; 665fd13aa47SMatt Jacob char ccb_pathinq_settings_opaque[PATHINQ_SETTINGS_SIZE]; 6663393f8daSKenneth D. Merry } xport_specific; 66752c9ce25SScott Long u_int maxio; /* Max supported I/O size, in bytes. */ 6688edcf694SAlexander Motin u_int16_t hba_vendor; /* HBA vendor ID */ 6698edcf694SAlexander Motin u_int16_t hba_device; /* HBA device ID */ 6708edcf694SAlexander Motin u_int16_t hba_subvendor; /* HBA subvendor ID */ 6718edcf694SAlexander Motin u_int16_t hba_subdevice; /* HBA subdevice ID */ 6728b8a9b1dSJustin T. Gibbs }; 6738b8a9b1dSJustin T. Gibbs 67487cfaf0eSJustin T. Gibbs /* Path Statistics CCB */ 67587cfaf0eSJustin T. Gibbs struct ccb_pathstats { 67687cfaf0eSJustin T. Gibbs struct ccb_hdr ccb_h; 67787cfaf0eSJustin T. Gibbs struct timeval last_reset; /* Time of last bus reset/loop init */ 67887cfaf0eSJustin T. Gibbs }; 67987cfaf0eSJustin T. Gibbs 68006e79492SKenneth D. Merry typedef enum { 68106e79492SKenneth D. Merry SMP_FLAG_NONE = 0x00, 68206e79492SKenneth D. Merry SMP_FLAG_REQ_SG = 0x01, 68306e79492SKenneth D. Merry SMP_FLAG_RSP_SG = 0x02 68406e79492SKenneth D. Merry } ccb_smp_pass_flags; 68506e79492SKenneth D. Merry 68606e79492SKenneth D. Merry /* 68706e79492SKenneth D. Merry * Serial Management Protocol CCB 68806e79492SKenneth D. Merry * XXX Currently the semantics for this CCB are that it is executed either 68906e79492SKenneth D. Merry * by the addressed device, or that device's parent (i.e. an expander for 69006e79492SKenneth D. Merry * any device on an expander) if the addressed device doesn't support SMP. 69106e79492SKenneth D. Merry * Later, once we have the ability to probe SMP-only devices and put them 69206e79492SKenneth D. Merry * in CAM's topology, the CCB will only be executed by the addressed device 69306e79492SKenneth D. Merry * if possible. 69406e79492SKenneth D. Merry */ 69506e79492SKenneth D. Merry struct ccb_smpio { 69606e79492SKenneth D. Merry struct ccb_hdr ccb_h; 69706e79492SKenneth D. Merry uint8_t *smp_request; 69806e79492SKenneth D. Merry int smp_request_len; 69906e79492SKenneth D. Merry uint16_t smp_request_sglist_cnt; 70006e79492SKenneth D. Merry uint8_t *smp_response; 70106e79492SKenneth D. Merry int smp_response_len; 70206e79492SKenneth D. Merry uint16_t smp_response_sglist_cnt; 70306e79492SKenneth D. Merry ccb_smp_pass_flags flags; 70406e79492SKenneth D. Merry }; 70506e79492SKenneth D. Merry 7068b8a9b1dSJustin T. Gibbs typedef union { 7078b8a9b1dSJustin T. Gibbs u_int8_t *sense_ptr; /* 7088b8a9b1dSJustin T. Gibbs * Pointer to storage 7098b8a9b1dSJustin T. Gibbs * for sense information 7108b8a9b1dSJustin T. Gibbs */ 7118b8a9b1dSJustin T. Gibbs /* Storage Area for sense information */ 7128b8a9b1dSJustin T. Gibbs struct scsi_sense_data sense_buf; 7138b8a9b1dSJustin T. Gibbs } sense_t; 7148b8a9b1dSJustin T. Gibbs 7158b8a9b1dSJustin T. Gibbs typedef union { 7168b8a9b1dSJustin T. Gibbs u_int8_t *cdb_ptr; /* Pointer to the CDB bytes to send */ 7178b8a9b1dSJustin T. Gibbs /* Area for the CDB send */ 7188b8a9b1dSJustin T. Gibbs u_int8_t cdb_bytes[IOCDBLEN]; 7198b8a9b1dSJustin T. Gibbs } cdb_t; 7208b8a9b1dSJustin T. Gibbs 7218b8a9b1dSJustin T. Gibbs /* 7228b8a9b1dSJustin T. Gibbs * SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO 7238b8a9b1dSJustin T. Gibbs * function codes. 7248b8a9b1dSJustin T. Gibbs */ 7258b8a9b1dSJustin T. Gibbs struct ccb_scsiio { 7268b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 7278b8a9b1dSJustin T. Gibbs union ccb *next_ccb; /* Ptr for next CCB for action */ 7288b8a9b1dSJustin T. Gibbs u_int8_t *req_map; /* Ptr to mapping info */ 7298b8a9b1dSJustin T. Gibbs u_int8_t *data_ptr; /* Ptr to the data buf/SG list */ 7308b8a9b1dSJustin T. Gibbs u_int32_t dxfer_len; /* Data transfer length */ 7318b8a9b1dSJustin T. Gibbs /* Autosense storage */ 7328b8a9b1dSJustin T. Gibbs struct scsi_sense_data sense_data; 7338b8a9b1dSJustin T. Gibbs u_int8_t sense_len; /* Number of bytes to autosense */ 7348b8a9b1dSJustin T. Gibbs u_int8_t cdb_len; /* Number of bytes for the CDB */ 7358b8a9b1dSJustin T. Gibbs u_int16_t sglist_cnt; /* Number of SG list entries */ 7368b8a9b1dSJustin T. Gibbs u_int8_t scsi_status; /* Returned SCSI status */ 7378b8a9b1dSJustin T. Gibbs u_int8_t sense_resid; /* Autosense resid length: 2's comp */ 7388b8a9b1dSJustin T. Gibbs u_int32_t resid; /* Transfer residual length: 2's comp */ 7398b8a9b1dSJustin T. Gibbs cdb_t cdb_io; /* Union for CDB bytes/pointer */ 7408b8a9b1dSJustin T. Gibbs u_int8_t *msg_ptr; /* Pointer to the message buffer */ 7418b8a9b1dSJustin T. Gibbs u_int16_t msg_len; /* Number of bytes for the Message */ 7428b8a9b1dSJustin T. Gibbs u_int8_t tag_action; /* What to do for tag queueing */ 743bb1f2fe4SJustin T. Gibbs /* 744bb1f2fe4SJustin T. Gibbs * The tag action should be either the define below (to send a 745bb1f2fe4SJustin T. Gibbs * non-tagged transaction) or one of the defined scsi tag messages 746bb1f2fe4SJustin T. Gibbs * from scsi_message.h. 747bb1f2fe4SJustin T. Gibbs */ 748bb1f2fe4SJustin T. Gibbs #define CAM_TAG_ACTION_NONE 0x00 749bf8bb7acSJustin T. Gibbs u_int tag_id; /* tag id from initator (target mode) */ 750bf8bb7acSJustin T. Gibbs u_int init_id; /* initiator id of who selected */ 7518532d381SConrad Meyer #if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) 7528532d381SConrad Meyer struct bio *bio; /* Associated bio */ 7538532d381SConrad Meyer #endif 7548b8a9b1dSJustin T. Gibbs }; 7558b8a9b1dSJustin T. Gibbs 7564aa947cbSWarner Losh static __inline uint8_t * 7574aa947cbSWarner Losh scsiio_cdb_ptr(struct ccb_scsiio *ccb) 7584aa947cbSWarner Losh { 7594aa947cbSWarner Losh return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? 7604aa947cbSWarner Losh ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes); 7614aa947cbSWarner Losh } 7624aa947cbSWarner Losh 76352c9ce25SScott Long /* 76452c9ce25SScott Long * ATA I/O Request CCB used for the XPT_ATA_IO function code. 76552c9ce25SScott Long */ 76652c9ce25SScott Long struct ccb_ataio { 76752c9ce25SScott Long struct ccb_hdr ccb_h; 76852c9ce25SScott Long union ccb *next_ccb; /* Ptr for next CCB for action */ 76952c9ce25SScott Long struct ata_cmd cmd; /* ATA command register set */ 77052c9ce25SScott Long struct ata_res res; /* ATA result register set */ 77152c9ce25SScott Long u_int8_t *data_ptr; /* Ptr to the data buf/SG list */ 77252c9ce25SScott Long u_int32_t dxfer_len; /* Data transfer length */ 77352c9ce25SScott Long u_int32_t resid; /* Transfer residual length: 2's comp */ 774e4cc6558SWarner Losh u_int8_t ata_flags; /* Flags for the rest of the buffer */ 775916d57dfSWarner Losh #define ATA_FLAG_AUX 0x1 776916d57dfSWarner Losh uint32_t aux; 777916d57dfSWarner Losh uint32_t unused; 77852c9ce25SScott Long }; 77952c9ce25SScott Long 780*a94a63f0SWarner Losh /* 781*a94a63f0SWarner Losh * MMC I/O Request CCB used for the XPT_MMC_IO function code. 782*a94a63f0SWarner Losh */ 783*a94a63f0SWarner Losh struct ccb_mmcio { 784*a94a63f0SWarner Losh struct ccb_hdr ccb_h; 785*a94a63f0SWarner Losh union ccb *next_ccb; /* Ptr for next CCB for action */ 786*a94a63f0SWarner Losh struct mmc_command cmd; 787*a94a63f0SWarner Losh struct mmc_command stop; 788*a94a63f0SWarner Losh }; 789*a94a63f0SWarner Losh 7908b8a9b1dSJustin T. Gibbs struct ccb_accept_tio { 7918b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 7928b8a9b1dSJustin T. Gibbs cdb_t cdb_io; /* Union for CDB bytes/pointer */ 7938b8a9b1dSJustin T. Gibbs u_int8_t cdb_len; /* Number of bytes for the CDB */ 7948b8a9b1dSJustin T. Gibbs u_int8_t tag_action; /* What to do for tag queueing */ 795826eb7c8SMatt Jacob u_int8_t sense_len; /* Number of bytes of Sense Data */ 7962759b3c7SMatt Jacob u_int tag_id; /* tag id from initator (target mode) */ 7972759b3c7SMatt Jacob u_int init_id; /* initiator id of who selected */ 798826eb7c8SMatt Jacob struct scsi_sense_data sense_data; 7998b8a9b1dSJustin T. Gibbs }; 8008b8a9b1dSJustin T. Gibbs 8014902e14dSAlexander Motin static __inline uint8_t * 8024902e14dSAlexander Motin atio_cdb_ptr(struct ccb_accept_tio *ccb) 8034902e14dSAlexander Motin { 8044902e14dSAlexander Motin return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? 8054902e14dSAlexander Motin ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes); 8064902e14dSAlexander Motin } 8074902e14dSAlexander Motin 8088b8a9b1dSJustin T. Gibbs /* Release SIM Queue */ 8098b8a9b1dSJustin T. Gibbs struct ccb_relsim { 8108b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 8118b8a9b1dSJustin T. Gibbs u_int32_t release_flags; 8128b8a9b1dSJustin T. Gibbs #define RELSIM_ADJUST_OPENINGS 0x01 8138b8a9b1dSJustin T. Gibbs #define RELSIM_RELEASE_AFTER_TIMEOUT 0x02 8148b8a9b1dSJustin T. Gibbs #define RELSIM_RELEASE_AFTER_CMDCMPLT 0x04 8158b8a9b1dSJustin T. Gibbs #define RELSIM_RELEASE_AFTER_QEMPTY 0x08 8168b8a9b1dSJustin T. Gibbs u_int32_t openings; 81783c5d981SAlexander Motin u_int32_t release_timeout; /* Abstract argument. */ 8188b8a9b1dSJustin T. Gibbs u_int32_t qfrozen_cnt; 8198b8a9b1dSJustin T. Gibbs }; 8208b8a9b1dSJustin T. Gibbs 8218b8a9b1dSJustin T. Gibbs /* 822baabaca3SWarner Losh * NVMe I/O Request CCB used for the XPT_NVME_IO function code. 823baabaca3SWarner Losh */ 824baabaca3SWarner Losh struct ccb_nvmeio { 825baabaca3SWarner Losh struct ccb_hdr ccb_h; 826baabaca3SWarner Losh union ccb *next_ccb; /* Ptr for next CCB for action */ 827baabaca3SWarner Losh struct nvme_command cmd; /* NVME command, per NVME standard */ 828baabaca3SWarner Losh struct nvme_completion cpl; /* NVME completion, per NVME standard */ 829baabaca3SWarner Losh uint8_t *data_ptr; /* Ptr to the data buf/SG list */ 830baabaca3SWarner Losh uint32_t dxfer_len; /* Data transfer length */ 831baabaca3SWarner Losh uint32_t resid; /* Transfer residual length: 2's comp unused ?*/ 832baabaca3SWarner Losh }; 833baabaca3SWarner Losh 834baabaca3SWarner Losh /* 8358b8a9b1dSJustin T. Gibbs * Definitions for the asynchronous callback CCB fields. 8368b8a9b1dSJustin T. Gibbs */ 8378b8a9b1dSJustin T. Gibbs typedef enum { 8383631c638SAlexander Motin AC_UNIT_ATTENTION = 0x4000,/* Device reported UNIT ATTENTION */ 8393501942bSJustin T. Gibbs AC_ADVINFO_CHANGED = 0x2000,/* Advance info might have changes */ 8402df76c16SMatt Jacob AC_CONTRACT = 0x1000,/* A contractual callback */ 8418b8a9b1dSJustin T. Gibbs AC_GETDEV_CHANGED = 0x800,/* Getdev info might have changed */ 8428b8a9b1dSJustin T. Gibbs AC_INQ_CHANGED = 0x400,/* Inquiry info might have changed */ 8438b8a9b1dSJustin T. Gibbs AC_TRANSFER_NEG = 0x200,/* New transfer settings in effect */ 8448b8a9b1dSJustin T. Gibbs AC_LOST_DEVICE = 0x100,/* A device went away */ 8458b8a9b1dSJustin T. Gibbs AC_FOUND_DEVICE = 0x080,/* A new device was found */ 8468b8a9b1dSJustin T. Gibbs AC_PATH_DEREGISTERED = 0x040,/* A path has de-registered */ 8478b8a9b1dSJustin T. Gibbs AC_PATH_REGISTERED = 0x020,/* A new path has been registered */ 8488b8a9b1dSJustin T. Gibbs AC_SENT_BDR = 0x010,/* A BDR message was sent to target */ 8498b8a9b1dSJustin T. Gibbs AC_SCSI_AEN = 0x008,/* A SCSI AEN has been received */ 8508b8a9b1dSJustin T. Gibbs AC_UNSOL_RESEL = 0x002,/* Unsolicited reselection occurred */ 8518b8a9b1dSJustin T. Gibbs AC_BUS_RESET = 0x001 /* A SCSI bus reset occurred */ 8528b8a9b1dSJustin T. Gibbs } ac_code; 8538b8a9b1dSJustin T. Gibbs 8548b8a9b1dSJustin T. Gibbs typedef void ac_callback_t (void *softc, u_int32_t code, 8558b8a9b1dSJustin T. Gibbs struct cam_path *path, void *args); 8568b8a9b1dSJustin T. Gibbs 8572df76c16SMatt Jacob /* 8582df76c16SMatt Jacob * Generic Asynchronous callbacks. 8592df76c16SMatt Jacob * 8602df76c16SMatt Jacob * Generic arguments passed bac which are then interpreted between a per-system 8612df76c16SMatt Jacob * contract number. 8622df76c16SMatt Jacob */ 8632df76c16SMatt Jacob #define AC_CONTRACT_DATA_MAX (128 - sizeof (u_int64_t)) 8642df76c16SMatt Jacob struct ac_contract { 8652df76c16SMatt Jacob u_int64_t contract_number; 8662df76c16SMatt Jacob u_int8_t contract_data[AC_CONTRACT_DATA_MAX]; 8672df76c16SMatt Jacob }; 8682df76c16SMatt Jacob 8692df76c16SMatt Jacob #define AC_CONTRACT_DEV_CHG 1 8702df76c16SMatt Jacob struct ac_device_changed { 8712df76c16SMatt Jacob u_int64_t wwpn; 8722df76c16SMatt Jacob u_int32_t port; 8732df76c16SMatt Jacob target_id_t target; 8742df76c16SMatt Jacob u_int8_t arrived; 8752df76c16SMatt Jacob }; 8762df76c16SMatt Jacob 8778b8a9b1dSJustin T. Gibbs /* Set Asynchronous Callback CCB */ 8788b8a9b1dSJustin T. Gibbs struct ccb_setasync { 8798b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 8808b8a9b1dSJustin T. Gibbs u_int32_t event_enable; /* Async Event enables */ 8818b8a9b1dSJustin T. Gibbs ac_callback_t *callback; 8828b8a9b1dSJustin T. Gibbs void *callback_arg; 8838b8a9b1dSJustin T. Gibbs }; 8848b8a9b1dSJustin T. Gibbs 8858b8a9b1dSJustin T. Gibbs /* Set Device Type CCB */ 8868b8a9b1dSJustin T. Gibbs struct ccb_setdev { 8878b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 8888b8a9b1dSJustin T. Gibbs u_int8_t dev_type; /* Value for dev type field in EDT */ 8898b8a9b1dSJustin T. Gibbs }; 8908b8a9b1dSJustin T. Gibbs 8918b8a9b1dSJustin T. Gibbs /* SCSI Control Functions */ 8928b8a9b1dSJustin T. Gibbs 8938b8a9b1dSJustin T. Gibbs /* Abort XPT request CCB */ 8948b8a9b1dSJustin T. Gibbs struct ccb_abort { 8958b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 8968b8a9b1dSJustin T. Gibbs union ccb *abort_ccb; /* Pointer to CCB to abort */ 8978b8a9b1dSJustin T. Gibbs }; 8988b8a9b1dSJustin T. Gibbs 8998b8a9b1dSJustin T. Gibbs /* Reset SCSI Bus CCB */ 9008b8a9b1dSJustin T. Gibbs struct ccb_resetbus { 9018b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 9028b8a9b1dSJustin T. Gibbs }; 9038b8a9b1dSJustin T. Gibbs 9048b8a9b1dSJustin T. Gibbs /* Reset SCSI Device CCB */ 9058b8a9b1dSJustin T. Gibbs struct ccb_resetdev { 9068b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 9078b8a9b1dSJustin T. Gibbs }; 9088b8a9b1dSJustin T. Gibbs 9098b8a9b1dSJustin T. Gibbs /* Terminate I/O Process Request CCB */ 9108b8a9b1dSJustin T. Gibbs struct ccb_termio { 9118b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 9128b8a9b1dSJustin T. Gibbs union ccb *termio_ccb; /* Pointer to CCB to terminate */ 9138b8a9b1dSJustin T. Gibbs }; 9148b8a9b1dSJustin T. Gibbs 9153393f8daSKenneth D. Merry typedef enum { 9163393f8daSKenneth D. Merry CTS_TYPE_CURRENT_SETTINGS, 9173393f8daSKenneth D. Merry CTS_TYPE_USER_SETTINGS 9183393f8daSKenneth D. Merry } cts_type; 9193393f8daSKenneth D. Merry 9203393f8daSKenneth D. Merry struct ccb_trans_settings_scsi 9213393f8daSKenneth D. Merry { 9223393f8daSKenneth D. Merry u_int valid; /* Which fields to honor */ 9233393f8daSKenneth D. Merry #define CTS_SCSI_VALID_TQ 0x01 9243393f8daSKenneth D. Merry u_int flags; 9253393f8daSKenneth D. Merry #define CTS_SCSI_FLAGS_TAG_ENB 0x01 9263393f8daSKenneth D. Merry }; 9273393f8daSKenneth D. Merry 928b9c473b2SAlexander Motin struct ccb_trans_settings_ata 929b9c473b2SAlexander Motin { 930b9c473b2SAlexander Motin u_int valid; /* Which fields to honor */ 931b9c473b2SAlexander Motin #define CTS_ATA_VALID_TQ 0x01 932b9c473b2SAlexander Motin u_int flags; 933b9c473b2SAlexander Motin #define CTS_ATA_FLAGS_TAG_ENB 0x01 934b9c473b2SAlexander Motin }; 935b9c473b2SAlexander Motin 9363393f8daSKenneth D. Merry struct ccb_trans_settings_spi 9373393f8daSKenneth D. Merry { 9383393f8daSKenneth D. Merry u_int valid; /* Which fields to honor */ 9393393f8daSKenneth D. Merry #define CTS_SPI_VALID_SYNC_RATE 0x01 9403393f8daSKenneth D. Merry #define CTS_SPI_VALID_SYNC_OFFSET 0x02 9413393f8daSKenneth D. Merry #define CTS_SPI_VALID_BUS_WIDTH 0x04 9423393f8daSKenneth D. Merry #define CTS_SPI_VALID_DISC 0x08 9433393f8daSKenneth D. Merry #define CTS_SPI_VALID_PPR_OPTIONS 0x10 9443393f8daSKenneth D. Merry u_int flags; 9453393f8daSKenneth D. Merry #define CTS_SPI_FLAGS_DISC_ENB 0x01 9463393f8daSKenneth D. Merry u_int sync_period; 9473393f8daSKenneth D. Merry u_int sync_offset; 9483393f8daSKenneth D. Merry u_int bus_width; 9493393f8daSKenneth D. Merry u_int ppr_options; 9503393f8daSKenneth D. Merry }; 9513393f8daSKenneth D. Merry 952c1c84cd9SMatt Jacob struct ccb_trans_settings_fc { 953c1c84cd9SMatt Jacob u_int valid; /* Which fields to honor */ 954c1c84cd9SMatt Jacob #define CTS_FC_VALID_WWNN 0x8000 955c1c84cd9SMatt Jacob #define CTS_FC_VALID_WWPN 0x4000 956c1c84cd9SMatt Jacob #define CTS_FC_VALID_PORT 0x2000 957c1c84cd9SMatt Jacob #define CTS_FC_VALID_SPEED 0x1000 958c1c84cd9SMatt Jacob u_int64_t wwnn; /* world wide node name */ 959c1c84cd9SMatt Jacob u_int64_t wwpn; /* world wide port name */ 960c1c84cd9SMatt Jacob u_int32_t port; /* 24 bit port id, if known */ 961c1c84cd9SMatt Jacob u_int32_t bitrate; /* Mbps */ 962c1c84cd9SMatt Jacob }; 963c1c84cd9SMatt Jacob 964c4270cb6SMatt Jacob struct ccb_trans_settings_sas { 965c4270cb6SMatt Jacob u_int valid; /* Which fields to honor */ 966c4270cb6SMatt Jacob #define CTS_SAS_VALID_SPEED 0x1000 967c4270cb6SMatt Jacob u_int32_t bitrate; /* Mbps */ 968c4270cb6SMatt Jacob }; 969c4270cb6SMatt Jacob 970b9c473b2SAlexander Motin struct ccb_trans_settings_pata { 9711e637ba6SAlexander Motin u_int valid; /* Which fields to honor */ 9721e637ba6SAlexander Motin #define CTS_ATA_VALID_MODE 0x01 973c8039fc6SAlexander Motin #define CTS_ATA_VALID_BYTECOUNT 0x02 9744cca1530SAlexander Motin #define CTS_ATA_VALID_ATAPI 0x20 9752e1eb332SMarius Strobl #define CTS_ATA_VALID_CAPS 0x40 976c8039fc6SAlexander Motin int mode; /* Mode */ 9771e637ba6SAlexander Motin u_int bytecount; /* Length of PIO transaction */ 9784cca1530SAlexander Motin u_int atapi; /* Length of ATAPI CDB */ 9792e1eb332SMarius Strobl u_int caps; /* Device and host SATA caps. */ 9802e1eb332SMarius Strobl #define CTS_ATA_CAPS_H 0x0000ffff 9812e1eb332SMarius Strobl #define CTS_ATA_CAPS_H_DMA48 0x00000001 /* 48-bit DMA */ 9822e1eb332SMarius Strobl #define CTS_ATA_CAPS_D 0xffff0000 9831e637ba6SAlexander Motin }; 9841e637ba6SAlexander Motin 98552c9ce25SScott Long struct ccb_trans_settings_sata { 98652c9ce25SScott Long u_int valid; /* Which fields to honor */ 987c8039fc6SAlexander Motin #define CTS_SATA_VALID_MODE 0x01 988c8039fc6SAlexander Motin #define CTS_SATA_VALID_BYTECOUNT 0x02 989c8039fc6SAlexander Motin #define CTS_SATA_VALID_REVISION 0x04 990c8039fc6SAlexander Motin #define CTS_SATA_VALID_PM 0x08 991c8039fc6SAlexander Motin #define CTS_SATA_VALID_TAGS 0x10 9924cca1530SAlexander Motin #define CTS_SATA_VALID_ATAPI 0x20 993da6808c1SAlexander Motin #define CTS_SATA_VALID_CAPS 0x40 994c8039fc6SAlexander Motin int mode; /* Legacy PATA mode */ 9951e637ba6SAlexander Motin u_int bytecount; /* Length of PIO transaction */ 996b447e682SAlexander Motin int revision; /* SATA revision */ 997c8039fc6SAlexander Motin u_int pm_present; /* PM is present (XPT->SIM) */ 998c8039fc6SAlexander Motin u_int tags; /* Number of allowed tags */ 9994cca1530SAlexander Motin u_int atapi; /* Length of ATAPI CDB */ 1000da6808c1SAlexander Motin u_int caps; /* Device and host SATA caps. */ 1001da6808c1SAlexander Motin #define CTS_SATA_CAPS_H 0x0000ffff 1002da6808c1SAlexander Motin #define CTS_SATA_CAPS_H_PMREQ 0x00000001 1003da6808c1SAlexander Motin #define CTS_SATA_CAPS_H_APST 0x00000002 1004da6808c1SAlexander Motin #define CTS_SATA_CAPS_H_DMAAA 0x00000010 /* Auto-activation */ 10058d169381SAlexander Motin #define CTS_SATA_CAPS_H_AN 0x00000020 /* Async. notification */ 1006da6808c1SAlexander Motin #define CTS_SATA_CAPS_D 0xffff0000 1007da6808c1SAlexander Motin #define CTS_SATA_CAPS_D_PMREQ 0x00010000 1008da6808c1SAlexander Motin #define CTS_SATA_CAPS_D_APST 0x00020000 100952c9ce25SScott Long }; 1010c4270cb6SMatt Jacob 1011f24c011bSWarner Losh struct ccb_trans_settings_nvme 1012f24c011bSWarner Losh { 1013f24c011bSWarner Losh u_int valid; /* Which fields to honor */ 1014f24c011bSWarner Losh #define CTS_NVME_VALID_SPEC 0x01 1015f24c011bSWarner Losh #define CTS_NVME_VALID_CAPS 0x02 1016f24c011bSWarner Losh u_int spec_major; /* Major version of spec supported */ 1017f24c011bSWarner Losh u_int spec_minor; /* Minor verison of spec supported */ 1018f24c011bSWarner Losh u_int spec_tiny; /* Tiny version of spec supported */ 1019f24c011bSWarner Losh u_int max_xfer; /* Max transfer size (0 -> unlimited */ 1020f24c011bSWarner Losh u_int caps; 1021f24c011bSWarner Losh }; 1022f24c011bSWarner Losh 1023*a94a63f0SWarner Losh #include <cam/mmc/mmc_bus.h> 1024*a94a63f0SWarner Losh struct ccb_trans_settings_mmc { 1025*a94a63f0SWarner Losh struct mmc_ios ios; 1026*a94a63f0SWarner Losh #define MMC_CLK (1 << 1) 1027*a94a63f0SWarner Losh #define MMC_VDD (1 << 2) 1028*a94a63f0SWarner Losh #define MMC_CS (1 << 3) 1029*a94a63f0SWarner Losh #define MMC_BW (1 << 4) 1030*a94a63f0SWarner Losh #define MMC_PM (1 << 5) 1031*a94a63f0SWarner Losh #define MMC_BT (1 << 6) 1032*a94a63f0SWarner Losh #define MMC_BM (1 << 7) 1033*a94a63f0SWarner Losh uint32_t ios_valid; 1034*a94a63f0SWarner Losh /* The folowing is used only for GET_TRAN_SETTINGS */ 1035*a94a63f0SWarner Losh uint32_t host_ocr; 1036*a94a63f0SWarner Losh int host_f_min; 1037*a94a63f0SWarner Losh int host_f_max; 1038*a94a63f0SWarner Losh #define MMC_CAP_4_BIT_DATA (1 << 0) /* Can do 4-bit data transfers */ 1039*a94a63f0SWarner Losh #define MMC_CAP_8_BIT_DATA (1 << 1) /* Can do 8-bit data transfers */ 1040*a94a63f0SWarner Losh #define MMC_CAP_HSPEED (1 << 2) /* Can do High Speed transfers */ 1041*a94a63f0SWarner Losh uint32_t host_caps; 1042*a94a63f0SWarner Losh }; 1043*a94a63f0SWarner Losh 10443393f8daSKenneth D. Merry /* Get/Set transfer rate/width/disconnection/tag queueing settings */ 10453393f8daSKenneth D. Merry struct ccb_trans_settings { 10463393f8daSKenneth D. Merry struct ccb_hdr ccb_h; 10473393f8daSKenneth D. Merry cts_type type; /* Current or User settings */ 10483393f8daSKenneth D. Merry cam_proto protocol; 10493393f8daSKenneth D. Merry u_int protocol_version; 10503393f8daSKenneth D. Merry cam_xport transport; 10513393f8daSKenneth D. Merry u_int transport_version; 10523393f8daSKenneth D. Merry union { 10533393f8daSKenneth D. Merry u_int valid; /* Which fields to honor */ 1054b9c473b2SAlexander Motin struct ccb_trans_settings_ata ata; 10553393f8daSKenneth D. Merry struct ccb_trans_settings_scsi scsi; 1056f24c011bSWarner Losh struct ccb_trans_settings_nvme nvme; 1057*a94a63f0SWarner Losh struct ccb_trans_settings_mmc mmc; 10583393f8daSKenneth D. Merry } proto_specific; 10593393f8daSKenneth D. Merry union { 10603393f8daSKenneth D. Merry u_int valid; /* Which fields to honor */ 10613393f8daSKenneth D. Merry struct ccb_trans_settings_spi spi; 1062c1c84cd9SMatt Jacob struct ccb_trans_settings_fc fc; 1063c4270cb6SMatt Jacob struct ccb_trans_settings_sas sas; 1064b9c473b2SAlexander Motin struct ccb_trans_settings_pata ata; 106552c9ce25SScott Long struct ccb_trans_settings_sata sata; 1066f24c011bSWarner Losh struct ccb_trans_settings_nvme nvme; 10673393f8daSKenneth D. Merry } xport_specific; 10683393f8daSKenneth D. Merry }; 10693393f8daSKenneth D. Merry 10703393f8daSKenneth D. Merry 10718b8a9b1dSJustin T. Gibbs /* 10728b8a9b1dSJustin T. Gibbs * Calculate the geometry parameters for a device 10738b8a9b1dSJustin T. Gibbs * give the block size and volume size in blocks. 10748b8a9b1dSJustin T. Gibbs */ 10758b8a9b1dSJustin T. Gibbs struct ccb_calc_geometry { 10768b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 10778b8a9b1dSJustin T. Gibbs u_int32_t block_size; 1078260cc483SKenneth D. Merry u_int64_t volume_size; 1079260cc483SKenneth D. Merry u_int32_t cylinders; 10808b8a9b1dSJustin T. Gibbs u_int8_t heads; 10818b8a9b1dSJustin T. Gibbs u_int8_t secs_per_track; 10828b8a9b1dSJustin T. Gibbs }; 10838b8a9b1dSJustin T. Gibbs 10848b8a9b1dSJustin T. Gibbs /* 10852df76c16SMatt Jacob * Set or get SIM (and transport) specific knobs 10862df76c16SMatt Jacob */ 10872df76c16SMatt Jacob 10882df76c16SMatt Jacob #define KNOB_VALID_ADDRESS 0x1 10892df76c16SMatt Jacob #define KNOB_VALID_ROLE 0x2 10902df76c16SMatt Jacob 10912df76c16SMatt Jacob 10922df76c16SMatt Jacob #define KNOB_ROLE_NONE 0x0 10932df76c16SMatt Jacob #define KNOB_ROLE_INITIATOR 0x1 10942df76c16SMatt Jacob #define KNOB_ROLE_TARGET 0x2 10952df76c16SMatt Jacob #define KNOB_ROLE_BOTH 0x3 10962df76c16SMatt Jacob 10972df76c16SMatt Jacob struct ccb_sim_knob_settings_spi { 10982df76c16SMatt Jacob u_int valid; 10992df76c16SMatt Jacob u_int initiator_id; 11002df76c16SMatt Jacob u_int role; 11012df76c16SMatt Jacob }; 11022df76c16SMatt Jacob 11032df76c16SMatt Jacob struct ccb_sim_knob_settings_fc { 11042df76c16SMatt Jacob u_int valid; 11052df76c16SMatt Jacob u_int64_t wwnn; /* world wide node name */ 11062df76c16SMatt Jacob u_int64_t wwpn; /* world wide port name */ 11072df76c16SMatt Jacob u_int role; 11082df76c16SMatt Jacob }; 11092df76c16SMatt Jacob 11102df76c16SMatt Jacob struct ccb_sim_knob_settings_sas { 11112df76c16SMatt Jacob u_int valid; 11122df76c16SMatt Jacob u_int64_t wwnn; /* world wide node name */ 11132df76c16SMatt Jacob u_int role; 11142df76c16SMatt Jacob }; 11152df76c16SMatt Jacob #define KNOB_SETTINGS_SIZE 128 11162df76c16SMatt Jacob 11172df76c16SMatt Jacob struct ccb_sim_knob { 11182df76c16SMatt Jacob struct ccb_hdr ccb_h; 11192df76c16SMatt Jacob union { 11202df76c16SMatt Jacob u_int valid; /* Which fields to honor */ 11212df76c16SMatt Jacob struct ccb_sim_knob_settings_spi spi; 11222df76c16SMatt Jacob struct ccb_sim_knob_settings_fc fc; 11232df76c16SMatt Jacob struct ccb_sim_knob_settings_sas sas; 11242df76c16SMatt Jacob char pad[KNOB_SETTINGS_SIZE]; 11252df76c16SMatt Jacob } xport_specific; 11262df76c16SMatt Jacob }; 11272df76c16SMatt Jacob 11282df76c16SMatt Jacob /* 11298b8a9b1dSJustin T. Gibbs * Rescan the given bus, or bus/target/lun 11308b8a9b1dSJustin T. Gibbs */ 11318b8a9b1dSJustin T. Gibbs struct ccb_rescan { 11328b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 11338b8a9b1dSJustin T. Gibbs cam_flags flags; 11348b8a9b1dSJustin T. Gibbs }; 11358b8a9b1dSJustin T. Gibbs 11368b8a9b1dSJustin T. Gibbs /* 11378b8a9b1dSJustin T. Gibbs * Turn on debugging for the given bus, bus/target, or bus/target/lun. 11388b8a9b1dSJustin T. Gibbs */ 11398b8a9b1dSJustin T. Gibbs struct ccb_debug { 11408b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 11418b8a9b1dSJustin T. Gibbs cam_debug_flags flags; 11428b8a9b1dSJustin T. Gibbs }; 11438b8a9b1dSJustin T. Gibbs 11448b8a9b1dSJustin T. Gibbs /* Target mode structures. */ 11458b8a9b1dSJustin T. Gibbs 11468b8a9b1dSJustin T. Gibbs struct ccb_en_lun { 11478b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 11488b8a9b1dSJustin T. Gibbs u_int16_t grp6_len; /* Group 6 VU CDB length */ 11498b8a9b1dSJustin T. Gibbs u_int16_t grp7_len; /* Group 7 VU CDB length */ 11508b8a9b1dSJustin T. Gibbs u_int8_t enable; 11518b8a9b1dSJustin T. Gibbs }; 11528b8a9b1dSJustin T. Gibbs 11532df76c16SMatt Jacob /* old, barely used immediate notify, binary compatibility */ 11548b8a9b1dSJustin T. Gibbs struct ccb_immed_notify { 11558b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 11568b8a9b1dSJustin T. Gibbs struct scsi_sense_data sense_data; 1157826eb7c8SMatt Jacob u_int8_t sense_len; /* Number of bytes in sense buffer */ 11588b8a9b1dSJustin T. Gibbs u_int8_t initiator_id; /* Id of initiator that selected */ 11598b8a9b1dSJustin T. Gibbs u_int8_t message_args[7]; /* Message Arguments */ 11608b8a9b1dSJustin T. Gibbs }; 11618b8a9b1dSJustin T. Gibbs 11628b8a9b1dSJustin T. Gibbs struct ccb_notify_ack { 11638b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 11648b8a9b1dSJustin T. Gibbs u_int16_t seq_id; /* Sequence identifier */ 11658b8a9b1dSJustin T. Gibbs u_int8_t event; /* Event flags */ 11668b8a9b1dSJustin T. Gibbs }; 11678b8a9b1dSJustin T. Gibbs 11682df76c16SMatt Jacob struct ccb_immediate_notify { 11692df76c16SMatt Jacob struct ccb_hdr ccb_h; 11702df76c16SMatt Jacob u_int tag_id; /* Tag for immediate notify */ 11712df76c16SMatt Jacob u_int seq_id; /* Tag for target of notify */ 11722df76c16SMatt Jacob u_int initiator_id; /* Initiator Identifier */ 11732df76c16SMatt Jacob u_int arg; /* Function specific */ 11742df76c16SMatt Jacob }; 11752df76c16SMatt Jacob 11762df76c16SMatt Jacob struct ccb_notify_acknowledge { 11772df76c16SMatt Jacob struct ccb_hdr ccb_h; 11782df76c16SMatt Jacob u_int tag_id; /* Tag for immediate notify */ 11792df76c16SMatt Jacob u_int seq_id; /* Tar for target of notify */ 11802df76c16SMatt Jacob u_int initiator_id; /* Initiator Identifier */ 118196b5475bSAlexander Motin u_int arg; /* Response information */ 118296b5475bSAlexander Motin /* 118396b5475bSAlexander Motin * Lower byte of arg is one of RESPONSE CODE values defined below 118496b5475bSAlexander Motin * (subset of response codes from SPL-4 and FCP-4 specifications), 118596b5475bSAlexander Motin * upper 3 bytes is code-specific ADDITIONAL RESPONSE INFORMATION. 118696b5475bSAlexander Motin */ 118796b5475bSAlexander Motin #define CAM_RSP_TMF_COMPLETE 0x00 118896b5475bSAlexander Motin #define CAM_RSP_TMF_REJECTED 0x04 118996b5475bSAlexander Motin #define CAM_RSP_TMF_FAILED 0x05 119096b5475bSAlexander Motin #define CAM_RSP_TMF_SUCCEEDED 0x08 119196b5475bSAlexander Motin #define CAM_RSP_TMF_INCORRECT_LUN 0x09 11922df76c16SMatt Jacob }; 11932df76c16SMatt Jacob 11948b8a9b1dSJustin T. Gibbs /* HBA engine structures. */ 11958b8a9b1dSJustin T. Gibbs 11968b8a9b1dSJustin T. Gibbs typedef enum { 11978b8a9b1dSJustin T. Gibbs EIT_BUFFER, /* Engine type: buffer memory */ 11988b8a9b1dSJustin T. Gibbs EIT_LOSSLESS, /* Engine type: lossless compression */ 11998b8a9b1dSJustin T. Gibbs EIT_LOSSY, /* Engine type: lossy compression */ 12008b8a9b1dSJustin T. Gibbs EIT_ENCRYPT /* Engine type: encryption */ 12018b8a9b1dSJustin T. Gibbs } ei_type; 12028b8a9b1dSJustin T. Gibbs 12038b8a9b1dSJustin T. Gibbs typedef enum { 12048b8a9b1dSJustin T. Gibbs EAD_VUNIQUE, /* Engine algorithm ID: vendor unique */ 12058b8a9b1dSJustin T. Gibbs EAD_LZ1V1, /* Engine algorithm ID: LZ1 var.1 */ 12068b8a9b1dSJustin T. Gibbs EAD_LZ2V1, /* Engine algorithm ID: LZ2 var.1 */ 1207273a1a3dSKenneth D. Merry EAD_LZ2V2 /* Engine algorithm ID: LZ2 var.2 */ 12088b8a9b1dSJustin T. Gibbs } ei_algo; 12098b8a9b1dSJustin T. Gibbs 12108b8a9b1dSJustin T. Gibbs struct ccb_eng_inq { 12118b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 12128b8a9b1dSJustin T. Gibbs u_int16_t eng_num; /* The engine number for this inquiry */ 12138b8a9b1dSJustin T. Gibbs ei_type eng_type; /* Returned engine type */ 12148b8a9b1dSJustin T. Gibbs ei_algo eng_algo; /* Returned engine algorithm type */ 12158b8a9b1dSJustin T. Gibbs u_int32_t eng_memeory; /* Returned engine memory size */ 12168b8a9b1dSJustin T. Gibbs }; 12178b8a9b1dSJustin T. Gibbs 12188b8a9b1dSJustin T. Gibbs struct ccb_eng_exec { /* This structure must match SCSIIO size */ 12198b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; 12208b8a9b1dSJustin T. Gibbs u_int8_t *pdrv_ptr; /* Ptr used by the peripheral driver */ 12218b8a9b1dSJustin T. Gibbs u_int8_t *req_map; /* Ptr for mapping info on the req. */ 12228b8a9b1dSJustin T. Gibbs u_int8_t *data_ptr; /* Pointer to the data buf/SG list */ 12238b8a9b1dSJustin T. Gibbs u_int32_t dxfer_len; /* Data transfer length */ 12248b8a9b1dSJustin T. Gibbs u_int8_t *engdata_ptr; /* Pointer to the engine buffer data */ 12258b8a9b1dSJustin T. Gibbs u_int16_t sglist_cnt; /* Num of scatter gather list entries */ 12268b8a9b1dSJustin T. Gibbs u_int32_t dmax_len; /* Destination data maximum length */ 12278b8a9b1dSJustin T. Gibbs u_int32_t dest_len; /* Destination data length */ 12288b8a9b1dSJustin T. Gibbs int32_t src_resid; /* Source residual length: 2's comp */ 12298b8a9b1dSJustin T. Gibbs u_int32_t timeout; /* Timeout value */ 12308b8a9b1dSJustin T. Gibbs u_int16_t eng_num; /* Engine number for this request */ 12318b8a9b1dSJustin T. Gibbs u_int16_t vu_flags; /* Vendor Unique flags */ 12328b8a9b1dSJustin T. Gibbs }; 12338b8a9b1dSJustin T. Gibbs 12348b8a9b1dSJustin T. Gibbs /* 12358b8a9b1dSJustin T. Gibbs * Definitions for the timeout field in the SCSI I/O CCB. 12368b8a9b1dSJustin T. Gibbs */ 12378b8a9b1dSJustin T. Gibbs #define CAM_TIME_DEFAULT 0x00000000 /* Use SIM default value */ 12388b8a9b1dSJustin T. Gibbs #define CAM_TIME_INFINITY 0xFFFFFFFF /* Infinite timeout */ 12398b8a9b1dSJustin T. Gibbs 12408b8a9b1dSJustin T. Gibbs #define CAM_SUCCESS 0 /* For signaling general success */ 12418b8a9b1dSJustin T. Gibbs #define CAM_FAILURE 1 /* For signaling general failure */ 12428b8a9b1dSJustin T. Gibbs 12438b8a9b1dSJustin T. Gibbs #define CAM_FALSE 0 12448b8a9b1dSJustin T. Gibbs #define CAM_TRUE 1 12458b8a9b1dSJustin T. Gibbs 12468b8a9b1dSJustin T. Gibbs #define XPT_CCB_INVALID -1 /* for signaling a bad CCB to free */ 12478b8a9b1dSJustin T. Gibbs 12488b8a9b1dSJustin T. Gibbs /* 12493501942bSJustin T. Gibbs * CCB for working with advanced device information. This operates in a fashion 125006e79492SKenneth D. Merry * similar to XPT_GDEV_TYPE. Specify the target in ccb_h, the buffer 125106e79492SKenneth D. Merry * type requested, and provide a buffer size/buffer to write to. If the 12523501942bSJustin T. Gibbs * buffer is too small, provsiz will be larger than bufsiz. 125306e79492SKenneth D. Merry */ 12543501942bSJustin T. Gibbs struct ccb_dev_advinfo { 125506e79492SKenneth D. Merry struct ccb_hdr ccb_h; 125606e79492SKenneth D. Merry uint32_t flags; 1257e8577fb4SKenneth D. Merry #define CDAI_FLAG_NONE 0x0 /* No flags set */ 12583501942bSJustin T. Gibbs #define CDAI_FLAG_STORE 0x1 /* If set, action becomes store */ 125906e79492SKenneth D. Merry uint32_t buftype; /* IN: Type of data being requested */ 126006e79492SKenneth D. Merry /* NB: buftype is interpreted on a per-transport basis */ 12613501942bSJustin T. Gibbs #define CDAI_TYPE_SCSI_DEVID 1 12623501942bSJustin T. Gibbs #define CDAI_TYPE_SERIAL_NUM 2 12633501942bSJustin T. Gibbs #define CDAI_TYPE_PHYS_PATH 3 1264e6bd5983SKenneth D. Merry #define CDAI_TYPE_RCAPLONG 4 12653bba3152SKenneth D. Merry #define CDAI_TYPE_EXT_INQ 5 126606e79492SKenneth D. Merry off_t bufsiz; /* IN: Size of external buffer */ 126706e79492SKenneth D. Merry #define CAM_SCSI_DEVID_MAXLEN 65536 /* length in buffer is an uint16_t */ 126806e79492SKenneth D. Merry off_t provsiz; /* OUT: Size required/used */ 126906e79492SKenneth D. Merry uint8_t *buf; /* IN/OUT: Buffer for requested data */ 127006e79492SKenneth D. Merry }; 127106e79492SKenneth D. Merry 127206e79492SKenneth D. Merry /* 1273227d67aaSAlexander Motin * CCB for sending async events 1274227d67aaSAlexander Motin */ 1275227d67aaSAlexander Motin struct ccb_async { 1276227d67aaSAlexander Motin struct ccb_hdr ccb_h; 1277227d67aaSAlexander Motin uint32_t async_code; 1278227d67aaSAlexander Motin off_t async_arg_size; 1279227d67aaSAlexander Motin void *async_arg_ptr; 1280227d67aaSAlexander Motin }; 1281227d67aaSAlexander Motin 1282227d67aaSAlexander Motin /* 12838b8a9b1dSJustin T. Gibbs * Union of all CCB types for kernel space allocation. This union should 12848b8a9b1dSJustin T. Gibbs * never be used for manipulating CCBs - its only use is for the allocation 12858b8a9b1dSJustin T. Gibbs * and deallocation of raw CCB space and is the return type of xpt_ccb_alloc 12868b8a9b1dSJustin T. Gibbs * and the argument to xpt_ccb_free. 12878b8a9b1dSJustin T. Gibbs */ 12888b8a9b1dSJustin T. Gibbs union ccb { 12898b8a9b1dSJustin T. Gibbs struct ccb_hdr ccb_h; /* For convenience */ 12908b8a9b1dSJustin T. Gibbs struct ccb_scsiio csio; 12918b8a9b1dSJustin T. Gibbs struct ccb_getdev cgd; 12928b8a9b1dSJustin T. Gibbs struct ccb_getdevlist cgdl; 12938b8a9b1dSJustin T. Gibbs struct ccb_pathinq cpi; 12948b8a9b1dSJustin T. Gibbs struct ccb_relsim crs; 12958b8a9b1dSJustin T. Gibbs struct ccb_setasync csa; 12968b8a9b1dSJustin T. Gibbs struct ccb_setdev csd; 129787cfaf0eSJustin T. Gibbs struct ccb_pathstats cpis; 129887cfaf0eSJustin T. Gibbs struct ccb_getdevstats cgds; 12998b8a9b1dSJustin T. Gibbs struct ccb_dev_match cdm; 13008b8a9b1dSJustin T. Gibbs struct ccb_trans_settings cts; 13018b8a9b1dSJustin T. Gibbs struct ccb_calc_geometry ccg; 13022df76c16SMatt Jacob struct ccb_sim_knob knob; 13038b8a9b1dSJustin T. Gibbs struct ccb_abort cab; 13048b8a9b1dSJustin T. Gibbs struct ccb_resetbus crb; 13058b8a9b1dSJustin T. Gibbs struct ccb_resetdev crd; 13068b8a9b1dSJustin T. Gibbs struct ccb_termio tio; 13078b8a9b1dSJustin T. Gibbs struct ccb_accept_tio atio; 13088b8a9b1dSJustin T. Gibbs struct ccb_scsiio ctio; 13098b8a9b1dSJustin T. Gibbs struct ccb_en_lun cel; 13108b8a9b1dSJustin T. Gibbs struct ccb_immed_notify cin; 13118b8a9b1dSJustin T. Gibbs struct ccb_notify_ack cna; 13122df76c16SMatt Jacob struct ccb_immediate_notify cin1; 13132df76c16SMatt Jacob struct ccb_notify_acknowledge cna2; 13148b8a9b1dSJustin T. Gibbs struct ccb_eng_inq cei; 13158b8a9b1dSJustin T. Gibbs struct ccb_eng_exec cee; 131606e79492SKenneth D. Merry struct ccb_smpio smpio; 13178b8a9b1dSJustin T. Gibbs struct ccb_rescan crcn; 13188b8a9b1dSJustin T. Gibbs struct ccb_debug cdbg; 131952c9ce25SScott Long struct ccb_ataio ataio; 13203501942bSJustin T. Gibbs struct ccb_dev_advinfo cdai; 1321227d67aaSAlexander Motin struct ccb_async casync; 1322baabaca3SWarner Losh struct ccb_nvmeio nvmeio; 1323*a94a63f0SWarner Losh struct ccb_mmcio mmcio; 13248b8a9b1dSJustin T. Gibbs }; 13258b8a9b1dSJustin T. Gibbs 132695320aceSDon Lewis #define CCB_CLEAR_ALL_EXCEPT_HDR(ccbp) \ 132795320aceSDon Lewis bzero((char *)(ccbp) + sizeof((ccbp)->ccb_h), \ 132895320aceSDon Lewis sizeof(*(ccbp)) - sizeof((ccbp)->ccb_h)) 132995320aceSDon Lewis 13308b8a9b1dSJustin T. Gibbs __BEGIN_DECLS 13318b8a9b1dSJustin T. Gibbs static __inline void 13328b8a9b1dSJustin T. Gibbs cam_fill_csio(struct ccb_scsiio *csio, u_int32_t retries, 13338b8a9b1dSJustin T. Gibbs void (*cbfcnp)(struct cam_periph *, union ccb *), 13348b8a9b1dSJustin T. Gibbs u_int32_t flags, u_int8_t tag_action, 13358b8a9b1dSJustin T. Gibbs u_int8_t *data_ptr, u_int32_t dxfer_len, 13368b8a9b1dSJustin T. Gibbs u_int8_t sense_len, u_int8_t cdb_len, 13378b8a9b1dSJustin T. Gibbs u_int32_t timeout); 13388b8a9b1dSJustin T. Gibbs 13398b8a9b1dSJustin T. Gibbs static __inline void 1340baabaca3SWarner Losh cam_fill_nvmeio(struct ccb_nvmeio *nvmeio, u_int32_t retries, 1341baabaca3SWarner Losh void (*cbfcnp)(struct cam_periph *, union ccb *), 1342baabaca3SWarner Losh u_int32_t flags, u_int8_t *data_ptr, u_int32_t dxfer_len, 1343baabaca3SWarner Losh u_int32_t timeout); 1344baabaca3SWarner Losh 1345baabaca3SWarner Losh static __inline void 13468b8a9b1dSJustin T. Gibbs cam_fill_ctio(struct ccb_scsiio *csio, u_int32_t retries, 13478b8a9b1dSJustin T. Gibbs void (*cbfcnp)(struct cam_periph *, union ccb *), 13488b8a9b1dSJustin T. Gibbs u_int32_t flags, u_int tag_action, u_int tag_id, 13498b8a9b1dSJustin T. Gibbs u_int init_id, u_int scsi_status, u_int8_t *data_ptr, 13508b8a9b1dSJustin T. Gibbs u_int32_t dxfer_len, u_int32_t timeout); 13518b8a9b1dSJustin T. Gibbs 13528b8a9b1dSJustin T. Gibbs static __inline void 135352c9ce25SScott Long cam_fill_ataio(struct ccb_ataio *ataio, u_int32_t retries, 135452c9ce25SScott Long void (*cbfcnp)(struct cam_periph *, union ccb *), 135552c9ce25SScott Long u_int32_t flags, u_int tag_action, 135652c9ce25SScott Long u_int8_t *data_ptr, u_int32_t dxfer_len, 135752c9ce25SScott Long u_int32_t timeout); 135852c9ce25SScott Long 135952c9ce25SScott Long static __inline void 136006e79492SKenneth D. Merry cam_fill_smpio(struct ccb_smpio *smpio, uint32_t retries, 136106e79492SKenneth D. Merry void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags, 136206e79492SKenneth D. Merry uint8_t *smp_request, int smp_request_len, 136306e79492SKenneth D. Merry uint8_t *smp_response, int smp_response_len, 136406e79492SKenneth D. Merry uint32_t timeout); 136506e79492SKenneth D. Merry 136606e79492SKenneth D. Merry static __inline void 1367*a94a63f0SWarner Losh cam_fill_mmcio(struct ccb_mmcio *mmcio, uint32_t retries, 1368*a94a63f0SWarner Losh void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags, 1369*a94a63f0SWarner Losh uint32_t mmc_opcode, uint32_t mmc_arg, uint32_t mmc_flags, 1370*a94a63f0SWarner Losh struct mmc_data *mmc_d, 1371*a94a63f0SWarner Losh uint32_t timeout); 1372*a94a63f0SWarner Losh 1373*a94a63f0SWarner Losh static __inline void 13748b8a9b1dSJustin T. Gibbs cam_fill_csio(struct ccb_scsiio *csio, u_int32_t retries, 13758b8a9b1dSJustin T. Gibbs void (*cbfcnp)(struct cam_periph *, union ccb *), 13768b8a9b1dSJustin T. Gibbs u_int32_t flags, u_int8_t tag_action, 13778b8a9b1dSJustin T. Gibbs u_int8_t *data_ptr, u_int32_t dxfer_len, 13788b8a9b1dSJustin T. Gibbs u_int8_t sense_len, u_int8_t cdb_len, 13798b8a9b1dSJustin T. Gibbs u_int32_t timeout) 13808b8a9b1dSJustin T. Gibbs { 13818b8a9b1dSJustin T. Gibbs csio->ccb_h.func_code = XPT_SCSI_IO; 13828b8a9b1dSJustin T. Gibbs csio->ccb_h.flags = flags; 1383b5595753SNathan Whitehorn csio->ccb_h.xflags = 0; 13848b8a9b1dSJustin T. Gibbs csio->ccb_h.retry_count = retries; 13858b8a9b1dSJustin T. Gibbs csio->ccb_h.cbfcnp = cbfcnp; 13868b8a9b1dSJustin T. Gibbs csio->ccb_h.timeout = timeout; 13878b8a9b1dSJustin T. Gibbs csio->data_ptr = data_ptr; 13888b8a9b1dSJustin T. Gibbs csio->dxfer_len = dxfer_len; 13898b8a9b1dSJustin T. Gibbs csio->sense_len = sense_len; 13908b8a9b1dSJustin T. Gibbs csio->cdb_len = cdb_len; 13918b8a9b1dSJustin T. Gibbs csio->tag_action = tag_action; 13928532d381SConrad Meyer #if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) 13938532d381SConrad Meyer csio->bio = NULL; 13948532d381SConrad Meyer #endif 13958b8a9b1dSJustin T. Gibbs } 13968b8a9b1dSJustin T. Gibbs 13978b8a9b1dSJustin T. Gibbs static __inline void 13988b8a9b1dSJustin T. Gibbs cam_fill_ctio(struct ccb_scsiio *csio, u_int32_t retries, 13998b8a9b1dSJustin T. Gibbs void (*cbfcnp)(struct cam_periph *, union ccb *), 14008b8a9b1dSJustin T. Gibbs u_int32_t flags, u_int tag_action, u_int tag_id, 14018b8a9b1dSJustin T. Gibbs u_int init_id, u_int scsi_status, u_int8_t *data_ptr, 14028b8a9b1dSJustin T. Gibbs u_int32_t dxfer_len, u_int32_t timeout) 14038b8a9b1dSJustin T. Gibbs { 14048b8a9b1dSJustin T. Gibbs csio->ccb_h.func_code = XPT_CONT_TARGET_IO; 14058b8a9b1dSJustin T. Gibbs csio->ccb_h.flags = flags; 1406b5595753SNathan Whitehorn csio->ccb_h.xflags = 0; 14078b8a9b1dSJustin T. Gibbs csio->ccb_h.retry_count = retries; 14088b8a9b1dSJustin T. Gibbs csio->ccb_h.cbfcnp = cbfcnp; 14098b8a9b1dSJustin T. Gibbs csio->ccb_h.timeout = timeout; 14108b8a9b1dSJustin T. Gibbs csio->data_ptr = data_ptr; 14118b8a9b1dSJustin T. Gibbs csio->dxfer_len = dxfer_len; 14128b8a9b1dSJustin T. Gibbs csio->scsi_status = scsi_status; 14138b8a9b1dSJustin T. Gibbs csio->tag_action = tag_action; 14148b8a9b1dSJustin T. Gibbs csio->tag_id = tag_id; 14158b8a9b1dSJustin T. Gibbs csio->init_id = init_id; 14168b8a9b1dSJustin T. Gibbs } 14178b8a9b1dSJustin T. Gibbs 141852c9ce25SScott Long static __inline void 141952c9ce25SScott Long cam_fill_ataio(struct ccb_ataio *ataio, u_int32_t retries, 142052c9ce25SScott Long void (*cbfcnp)(struct cam_periph *, union ccb *), 1421e4cc6558SWarner Losh u_int32_t flags, u_int tag_action __unused, 142252c9ce25SScott Long u_int8_t *data_ptr, u_int32_t dxfer_len, 142352c9ce25SScott Long u_int32_t timeout) 142452c9ce25SScott Long { 142552c9ce25SScott Long ataio->ccb_h.func_code = XPT_ATA_IO; 142652c9ce25SScott Long ataio->ccb_h.flags = flags; 142752c9ce25SScott Long ataio->ccb_h.retry_count = retries; 142852c9ce25SScott Long ataio->ccb_h.cbfcnp = cbfcnp; 142952c9ce25SScott Long ataio->ccb_h.timeout = timeout; 143052c9ce25SScott Long ataio->data_ptr = data_ptr; 143152c9ce25SScott Long ataio->dxfer_len = dxfer_len; 1432e4cc6558SWarner Losh ataio->ata_flags = 0; 143352c9ce25SScott Long } 143452c9ce25SScott Long 143506e79492SKenneth D. Merry static __inline void 143606e79492SKenneth D. Merry cam_fill_smpio(struct ccb_smpio *smpio, uint32_t retries, 143706e79492SKenneth D. Merry void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags, 143806e79492SKenneth D. Merry uint8_t *smp_request, int smp_request_len, 143906e79492SKenneth D. Merry uint8_t *smp_response, int smp_response_len, 144006e79492SKenneth D. Merry uint32_t timeout) 144106e79492SKenneth D. Merry { 144206e79492SKenneth D. Merry #ifdef _KERNEL 144306e79492SKenneth D. Merry KASSERT((flags & CAM_DIR_MASK) == CAM_DIR_BOTH, 144406e79492SKenneth D. Merry ("direction != CAM_DIR_BOTH")); 144506e79492SKenneth D. Merry KASSERT((smp_request != NULL) && (smp_response != NULL), 144606e79492SKenneth D. Merry ("need valid request and response buffers")); 144706e79492SKenneth D. Merry KASSERT((smp_request_len != 0) && (smp_response_len != 0), 144806e79492SKenneth D. Merry ("need non-zero request and response lengths")); 144906e79492SKenneth D. Merry #endif /*_KERNEL*/ 145006e79492SKenneth D. Merry smpio->ccb_h.func_code = XPT_SMP_IO; 145106e79492SKenneth D. Merry smpio->ccb_h.flags = flags; 145206e79492SKenneth D. Merry smpio->ccb_h.retry_count = retries; 145306e79492SKenneth D. Merry smpio->ccb_h.cbfcnp = cbfcnp; 145406e79492SKenneth D. Merry smpio->ccb_h.timeout = timeout; 145506e79492SKenneth D. Merry smpio->smp_request = smp_request; 145606e79492SKenneth D. Merry smpio->smp_request_len = smp_request_len; 145706e79492SKenneth D. Merry smpio->smp_response = smp_response; 145806e79492SKenneth D. Merry smpio->smp_response_len = smp_response_len; 145906e79492SKenneth D. Merry } 146006e79492SKenneth D. Merry 1461e64112deSScott Long static __inline void 1462*a94a63f0SWarner Losh cam_fill_mmcio(struct ccb_mmcio *mmcio, uint32_t retries, 1463*a94a63f0SWarner Losh void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags, 1464*a94a63f0SWarner Losh uint32_t mmc_opcode, uint32_t mmc_arg, uint32_t mmc_flags, 1465*a94a63f0SWarner Losh struct mmc_data *mmc_d, 1466*a94a63f0SWarner Losh uint32_t timeout) 1467*a94a63f0SWarner Losh { 1468*a94a63f0SWarner Losh mmcio->ccb_h.func_code = XPT_MMC_IO; 1469*a94a63f0SWarner Losh mmcio->ccb_h.flags = flags; 1470*a94a63f0SWarner Losh mmcio->ccb_h.retry_count = retries; 1471*a94a63f0SWarner Losh mmcio->ccb_h.cbfcnp = cbfcnp; 1472*a94a63f0SWarner Losh mmcio->ccb_h.timeout = timeout; 1473*a94a63f0SWarner Losh mmcio->cmd.opcode = mmc_opcode; 1474*a94a63f0SWarner Losh mmcio->cmd.arg = mmc_arg; 1475*a94a63f0SWarner Losh mmcio->cmd.flags = mmc_flags; 1476*a94a63f0SWarner Losh mmcio->stop.opcode = 0; 1477*a94a63f0SWarner Losh mmcio->stop.arg = 0; 1478*a94a63f0SWarner Losh mmcio->stop.flags = 0; 1479*a94a63f0SWarner Losh if (mmc_d != NULL) { 1480*a94a63f0SWarner Losh mmcio->cmd.data = mmc_d; 1481*a94a63f0SWarner Losh } else 1482*a94a63f0SWarner Losh mmcio->cmd.data = NULL; 1483*a94a63f0SWarner Losh mmcio->cmd.resp[0] = 0; 1484*a94a63f0SWarner Losh mmcio->cmd.resp[1] = 0; 1485*a94a63f0SWarner Losh mmcio->cmd.resp[2] = 0; 1486*a94a63f0SWarner Losh mmcio->cmd.resp[3] = 0; 1487*a94a63f0SWarner Losh } 1488*a94a63f0SWarner Losh 1489*a94a63f0SWarner Losh static __inline void 1490e64112deSScott Long cam_set_ccbstatus(union ccb *ccb, cam_status status) 1491e64112deSScott Long { 1492e64112deSScott Long ccb->ccb_h.status &= ~CAM_STATUS_MASK; 1493e64112deSScott Long ccb->ccb_h.status |= status; 1494e64112deSScott Long } 1495e64112deSScott Long 1496e64112deSScott Long static __inline cam_status 1497e64112deSScott Long cam_ccb_status(union ccb *ccb) 1498e64112deSScott Long { 149954eb21dbSJung-uk Kim return ((cam_status)(ccb->ccb_h.status & CAM_STATUS_MASK)); 1500e64112deSScott Long } 1501e64112deSScott Long 1502141bdcc1SNate Lawson void cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended); 1503141bdcc1SNate Lawson 1504baabaca3SWarner Losh static __inline void 1505baabaca3SWarner Losh cam_fill_nvmeio(struct ccb_nvmeio *nvmeio, u_int32_t retries, 1506baabaca3SWarner Losh void (*cbfcnp)(struct cam_periph *, union ccb *), 1507baabaca3SWarner Losh u_int32_t flags, u_int8_t *data_ptr, u_int32_t dxfer_len, 1508baabaca3SWarner Losh u_int32_t timeout) 1509baabaca3SWarner Losh { 1510baabaca3SWarner Losh nvmeio->ccb_h.func_code = XPT_NVME_IO; 1511baabaca3SWarner Losh nvmeio->ccb_h.flags = flags; 1512baabaca3SWarner Losh nvmeio->ccb_h.retry_count = retries; 1513baabaca3SWarner Losh nvmeio->ccb_h.cbfcnp = cbfcnp; 1514baabaca3SWarner Losh nvmeio->ccb_h.timeout = timeout; 1515baabaca3SWarner Losh nvmeio->data_ptr = data_ptr; 1516baabaca3SWarner Losh nvmeio->dxfer_len = dxfer_len; 1517baabaca3SWarner Losh } 15188b8a9b1dSJustin T. Gibbs __END_DECLS 15198b8a9b1dSJustin T. Gibbs 15208b8a9b1dSJustin T. Gibbs #endif /* _CAM_CAM_CCB_H */ 1521