1251837Sscottl/*- 2251837Sscottl * CAM ioctl compatibility shims 3251837Sscottl * 4251837Sscottl * Copyright (c) 2013 Scott Long 5251837Sscottl * All rights reserved. 6251837Sscottl * 7251837Sscottl * Redistribution and use in source and binary forms, with or without 8251837Sscottl * modification, are permitted provided that the following conditions 9251837Sscottl * are met: 10251837Sscottl * 1. Redistributions of source code must retain the above copyright 11251837Sscottl * notice, this list of conditions, and the following disclaimer, 12251837Sscottl * without modification, immediately at the beginning of the file. 13251837Sscottl * 2. The name of the author may not be used to endorse or promote products 14251837Sscottl * derived from this software without specific prior written permission. 15251837Sscottl * 16251837Sscottl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17251837Sscottl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18251837Sscottl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19251837Sscottl * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20251837Sscottl * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21251837Sscottl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22251837Sscottl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23251837Sscottl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24251837Sscottl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25251837Sscottl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26251837Sscottl * SUCH DAMAGE. 27251837Sscottl * 28251837Sscottl */ 29251837Sscottl 30251837Sscottl#include <sys/cdefs.h> 31251837Sscottl__FBSDID("$FreeBSD: stable/11/sys/cam/cam_compat.c 307264 2016-10-14 06:56:06Z mav $"); 32251837Sscottl 33251837Sscottl#include <sys/param.h> 34251837Sscottl#include <sys/systm.h> 35251837Sscottl#include <sys/types.h> 36251837Sscottl#include <sys/kernel.h> 37251837Sscottl#include <sys/conf.h> 38251837Sscottl#include <sys/fcntl.h> 39251837Sscottl 40251837Sscottl#include <sys/lock.h> 41251837Sscottl#include <sys/mutex.h> 42251837Sscottl#include <sys/sysctl.h> 43251837Sscottl#include <sys/kthread.h> 44251837Sscottl 45251837Sscottl#include <cam/cam.h> 46251837Sscottl#include <cam/cam_ccb.h> 47255870Sscottl#include <cam/cam_xpt.h> 48251837Sscottl#include <cam/cam_compat.h> 49259397Snwhitehorn#include <cam/cam_periph.h> 50251837Sscottl 51251837Sscottl#include <cam/scsi/scsi_pass.h> 52251837Sscottl 53251837Sscottl#include "opt_cam.h" 54251837Sscottl 55255870Sscottlstatic int cam_compat_handle_0x17(struct cdev *dev, u_long cmd, caddr_t addr, 56255870Sscottl int flag, struct thread *td, d_ioctl_t *cbfnp); 57259397Snwhitehornstatic int cam_compat_handle_0x18(struct cdev *dev, u_long cmd, caddr_t addr, 58259397Snwhitehorn int flag, struct thread *td, d_ioctl_t *cbfnp); 59259397Snwhitehornstatic int cam_compat_translate_dev_match_0x18(union ccb *ccb); 60255870Sscottl 61251837Sscottlint 62255870Sscottlcam_compat_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, 63255870Sscottl struct thread *td, d_ioctl_t *cbfnp) 64251837Sscottl{ 65251837Sscottl int error; 66251837Sscottl 67255870Sscottl switch (cmd) { 68251837Sscottl case CAMIOCOMMAND_0x16: 69251837Sscottl { 70259397Snwhitehorn struct ccb_hdr_0x17 *hdr17; 71251837Sscottl 72259397Snwhitehorn hdr17 = (struct ccb_hdr_0x17 *)addr; 73259397Snwhitehorn if (hdr17->flags & CAM_SG_LIST_PHYS_0x16) { 74259397Snwhitehorn hdr17->flags &= ~CAM_SG_LIST_PHYS_0x16; 75259397Snwhitehorn hdr17->flags |= CAM_DATA_SG_PADDR; 76251837Sscottl } 77259397Snwhitehorn if (hdr17->flags & CAM_DATA_PHYS_0x16) { 78259397Snwhitehorn hdr17->flags &= ~CAM_DATA_PHYS_0x16; 79259397Snwhitehorn hdr17->flags |= CAM_DATA_PADDR; 80251837Sscottl } 81259397Snwhitehorn if (hdr17->flags & CAM_SCATTER_VALID_0x16) { 82259397Snwhitehorn hdr17->flags &= CAM_SCATTER_VALID_0x16; 83259397Snwhitehorn hdr17->flags |= CAM_DATA_SG; 84251837Sscottl } 85255870Sscottl cmd = CAMIOCOMMAND; 86259397Snwhitehorn error = cam_compat_handle_0x17(dev, cmd, addr, flag, td, cbfnp); 87251837Sscottl break; 88251837Sscottl } 89251837Sscottl case CAMGETPASSTHRU_0x16: 90255870Sscottl cmd = CAMGETPASSTHRU; 91259397Snwhitehorn error = cam_compat_handle_0x17(dev, cmd, addr, flag, td, cbfnp); 92251837Sscottl break; 93255870Sscottl case CAMIOCOMMAND_0x17: 94255870Sscottl cmd = CAMIOCOMMAND; 95255870Sscottl error = cam_compat_handle_0x17(dev, cmd, addr, flag, td, cbfnp); 96255870Sscottl break; 97255870Sscottl case CAMGETPASSTHRU_0x17: 98255870Sscottl cmd = CAMGETPASSTHRU; 99255870Sscottl error = cam_compat_handle_0x17(dev, cmd, addr, flag, td, cbfnp); 100255870Sscottl break; 101259397Snwhitehorn case CAMIOCOMMAND_0x18: 102259397Snwhitehorn cmd = CAMIOCOMMAND; 103259397Snwhitehorn error = cam_compat_handle_0x18(dev, cmd, addr, flag, td, cbfnp); 104259397Snwhitehorn break; 105259397Snwhitehorn case CAMGETPASSTHRU_0x18: 106259397Snwhitehorn cmd = CAMGETPASSTHRU; 107259397Snwhitehorn error = cam_compat_handle_0x18(dev, cmd, addr, flag, td, cbfnp); 108259397Snwhitehorn break; 109251837Sscottl default: 110251837Sscottl error = ENOTTY; 111251837Sscottl } 112251837Sscottl 113251837Sscottl return (error); 114251837Sscottl} 115255870Sscottl 116255870Sscottlstatic int 117255870Sscottlcam_compat_handle_0x17(struct cdev *dev, u_long cmd, caddr_t addr, int flag, 118255870Sscottl struct thread *td, d_ioctl_t *cbfnp) 119255870Sscottl{ 120255870Sscottl union ccb *ccb; 121255870Sscottl struct ccb_hdr *hdr; 122255870Sscottl struct ccb_hdr_0x17 *hdr17; 123255870Sscottl uint8_t *ccbb, *ccbb17; 124255870Sscottl u_int error; 125255870Sscottl 126255870Sscottl hdr17 = (struct ccb_hdr_0x17 *)addr; 127255870Sscottl ccb = xpt_alloc_ccb(); 128255870Sscottl hdr = &ccb->ccb_h; 129255870Sscottl 130255870Sscottl hdr->pinfo = hdr17->pinfo; 131255870Sscottl hdr->xpt_links = hdr17->xpt_links; 132255870Sscottl hdr->sim_links = hdr17->sim_links; 133255870Sscottl hdr->periph_links = hdr17->periph_links; 134255870Sscottl hdr->retry_count = hdr17->retry_count; 135255870Sscottl hdr->cbfcnp = hdr17->cbfcnp; 136255870Sscottl hdr->func_code = hdr17->func_code; 137255870Sscottl hdr->status = hdr17->status; 138255870Sscottl hdr->path = hdr17->path; 139255870Sscottl hdr->path_id = hdr17->path_id; 140255870Sscottl hdr->target_id = hdr17->target_id; 141255870Sscottl hdr->target_lun = hdr17->target_lun; 142255870Sscottl hdr->flags = hdr17->flags; 143255870Sscottl hdr->xflags = 0; 144255870Sscottl hdr->periph_priv = hdr17->periph_priv; 145255870Sscottl hdr->sim_priv = hdr17->sim_priv; 146255870Sscottl hdr->timeout = hdr17->timeout; 147255870Sscottl hdr->softtimeout.tv_sec = 0; 148255870Sscottl hdr->softtimeout.tv_usec = 0; 149255870Sscottl 150255870Sscottl ccbb = (uint8_t *)&hdr[1]; 151255870Sscottl ccbb17 = (uint8_t *)&hdr17[1]; 152307264Smav if (ccb->ccb_h.func_code == XPT_SET_TRAN_SETTINGS) { 153307264Smav struct ccb_trans_settings *cts; 154307264Smav struct ccb_trans_settings_0x17 *cts17; 155255870Sscottl 156307264Smav cts = &ccb->cts; 157307264Smav cts17 = (struct ccb_trans_settings_0x17 *)hdr17; 158307264Smav cts->type = cts17->type; 159307264Smav cts->protocol = cts17->protocol; 160307264Smav cts->protocol_version = cts17->protocol_version; 161307264Smav cts->transport = cts17->transport; 162307264Smav cts->transport_version = cts17->transport_version; 163307264Smav bcopy(&cts17->proto_specific, &cts->proto_specific, 164307264Smav sizeof(cts17->proto_specific)); 165307264Smav bcopy(&cts17->xport_specific, &cts->xport_specific, 166307264Smav sizeof(cts17->xport_specific)); 167307264Smav } else { 168307264Smav bcopy(ccbb17, ccbb, CAM_0X17_DATA_LEN); 169307264Smav } 170307264Smav 171255870Sscottl error = (cbfnp)(dev, cmd, (caddr_t)ccb, flag, td); 172255870Sscottl 173255870Sscottl hdr17->pinfo = hdr->pinfo; 174255870Sscottl hdr17->xpt_links = hdr->xpt_links; 175255870Sscottl hdr17->sim_links = hdr->sim_links; 176255870Sscottl hdr17->periph_links = hdr->periph_links; 177255870Sscottl hdr17->retry_count = hdr->retry_count; 178255870Sscottl hdr17->cbfcnp = hdr->cbfcnp; 179255870Sscottl hdr17->func_code = hdr->func_code; 180255870Sscottl hdr17->status = hdr->status; 181255870Sscottl hdr17->path = hdr->path; 182255870Sscottl hdr17->path_id = hdr->path_id; 183255870Sscottl hdr17->target_id = hdr->target_id; 184255870Sscottl hdr17->target_lun = hdr->target_lun; 185255870Sscottl hdr17->flags = hdr->flags; 186255870Sscottl hdr17->periph_priv = hdr->periph_priv; 187255870Sscottl hdr17->sim_priv = hdr->sim_priv; 188255870Sscottl hdr17->timeout = hdr->timeout; 189255870Sscottl 190259397Snwhitehorn if (ccb->ccb_h.func_code == XPT_PATH_INQ) { 191255870Sscottl struct ccb_pathinq *cpi; 192255870Sscottl struct ccb_pathinq_0x17 *cpi17; 193255870Sscottl 194259397Snwhitehorn /* The PATH_INQ only needs special handling on the way out */ 195255870Sscottl cpi = &ccb->cpi; 196255870Sscottl cpi17 = (struct ccb_pathinq_0x17 *)hdr17; 197255870Sscottl cpi17->version_num = cpi->version_num; 198255870Sscottl cpi17->hba_inquiry = cpi->hba_inquiry; 199255870Sscottl cpi17->target_sprt = (u_int8_t)cpi->target_sprt; 200255870Sscottl cpi17->hba_misc = (u_int8_t)cpi->hba_misc; 201255870Sscottl cpi17->hba_eng_cnt = cpi->hba_eng_cnt; 202255870Sscottl bcopy(&cpi->vuhba_flags[0], &cpi17->vuhba_flags[0], VUHBALEN); 203255870Sscottl cpi17->max_target = cpi->max_target; 204255870Sscottl cpi17->max_lun = cpi->max_lun; 205255870Sscottl cpi17->async_flags = cpi->async_flags; 206255870Sscottl cpi17->hpath_id = cpi->hpath_id; 207255870Sscottl cpi17->initiator_id = cpi->initiator_id; 208255870Sscottl bcopy(&cpi->sim_vid[0], &cpi17->sim_vid[0], SIM_IDLEN); 209255870Sscottl bcopy(&cpi->hba_vid[0], &cpi17->hba_vid[0], HBA_IDLEN); 210255870Sscottl bcopy(&cpi->dev_name[0], &cpi17->dev_name[0], DEV_IDLEN); 211255870Sscottl cpi17->unit_number = cpi->unit_number; 212255870Sscottl cpi17->bus_id = cpi->bus_id; 213255870Sscottl cpi17->base_transfer_speed = cpi->base_transfer_speed; 214255870Sscottl cpi17->protocol = cpi->protocol; 215255870Sscottl cpi17->protocol_version = cpi->protocol_version; 216255870Sscottl cpi17->transport = cpi->transport; 217255870Sscottl cpi17->transport_version = cpi->transport_version; 218255870Sscottl bcopy(&cpi->xport_specific, &cpi17->xport_specific, 219255870Sscottl PATHINQ_SETTINGS_SIZE); 220255870Sscottl cpi17->maxio = cpi->maxio; 221255870Sscottl cpi17->hba_vendor = cpi->hba_vendor; 222255870Sscottl cpi17->hba_device = cpi->hba_device; 223255870Sscottl cpi17->hba_subvendor = cpi->hba_subvendor; 224255870Sscottl cpi17->hba_subdevice = cpi->hba_subdevice; 225307264Smav } else if (ccb->ccb_h.func_code == XPT_GET_TRAN_SETTINGS) { 226307264Smav struct ccb_trans_settings *cts; 227307264Smav struct ccb_trans_settings_0x17 *cts17; 228307264Smav 229307264Smav cts = &ccb->cts; 230307264Smav cts17 = (struct ccb_trans_settings_0x17 *)hdr17; 231307264Smav cts17->type = cts->type; 232307264Smav cts17->protocol = cts->protocol; 233307264Smav cts17->protocol_version = cts->protocol_version; 234307264Smav cts17->transport = cts->transport; 235307264Smav cts17->transport_version = cts->transport_version; 236307264Smav bcopy(&cts->proto_specific, &cts17->proto_specific, 237307264Smav sizeof(cts17->proto_specific)); 238307264Smav bcopy(&cts->xport_specific, &cts17->xport_specific, 239307264Smav sizeof(cts17->xport_specific)); 240259397Snwhitehorn } else if (ccb->ccb_h.func_code == XPT_DEV_MATCH) { 241259397Snwhitehorn /* Copy the rest of the header over */ 242259397Snwhitehorn bcopy(ccbb, ccbb17, CAM_0X17_DATA_LEN); 243259397Snwhitehorn 244259397Snwhitehorn cam_compat_translate_dev_match_0x18(ccb); 245259397Snwhitehorn } else { 246259397Snwhitehorn bcopy(ccbb, ccbb17, CAM_0X17_DATA_LEN); 247255870Sscottl } 248255870Sscottl 249255870Sscottl xpt_free_ccb(ccb); 250255870Sscottl 251255870Sscottl return (error); 252255870Sscottl} 253259397Snwhitehorn 254259397Snwhitehornstatic int 255259397Snwhitehorncam_compat_handle_0x18(struct cdev *dev, u_long cmd, caddr_t addr, int flag, 256259397Snwhitehorn struct thread *td, d_ioctl_t *cbfnp) 257259397Snwhitehorn{ 258259397Snwhitehorn union ccb *ccb; 259259397Snwhitehorn struct ccb_hdr *hdr; 260259397Snwhitehorn struct ccb_hdr_0x18 *hdr18; 261259397Snwhitehorn uint8_t *ccbb, *ccbb18; 262259397Snwhitehorn u_int error; 263259397Snwhitehorn 264259397Snwhitehorn hdr18 = (struct ccb_hdr_0x18 *)addr; 265259397Snwhitehorn ccb = xpt_alloc_ccb(); 266259397Snwhitehorn hdr = &ccb->ccb_h; 267259397Snwhitehorn 268259397Snwhitehorn hdr->pinfo = hdr18->pinfo; 269259397Snwhitehorn hdr->xpt_links = hdr18->xpt_links; 270259397Snwhitehorn hdr->sim_links = hdr18->sim_links; 271259397Snwhitehorn hdr->periph_links = hdr18->periph_links; 272259397Snwhitehorn hdr->retry_count = hdr18->retry_count; 273259397Snwhitehorn hdr->cbfcnp = hdr18->cbfcnp; 274259397Snwhitehorn hdr->func_code = hdr18->func_code; 275259397Snwhitehorn hdr->status = hdr18->status; 276259397Snwhitehorn hdr->path = hdr18->path; 277259397Snwhitehorn hdr->path_id = hdr18->path_id; 278259397Snwhitehorn hdr->target_id = hdr18->target_id; 279259397Snwhitehorn hdr->target_lun = hdr18->target_lun; 280259397Snwhitehorn if (hdr18->xflags & CAM_EXTLUN_VALID_0x18) 281259397Snwhitehorn hdr->target_lun = hdr18->ext_lun; 282259397Snwhitehorn hdr->flags = hdr18->flags; 283259397Snwhitehorn hdr->xflags = hdr18->xflags; 284259397Snwhitehorn hdr->periph_priv = hdr18->periph_priv; 285259397Snwhitehorn hdr->sim_priv = hdr18->sim_priv; 286259397Snwhitehorn hdr->timeout = hdr18->timeout; 287259397Snwhitehorn hdr->softtimeout.tv_sec = 0; 288259397Snwhitehorn hdr->softtimeout.tv_usec = 0; 289259397Snwhitehorn 290259397Snwhitehorn ccbb = (uint8_t *)&hdr[1]; 291259397Snwhitehorn ccbb18 = (uint8_t *)&hdr18[1]; 292307264Smav if (ccb->ccb_h.func_code == XPT_SET_TRAN_SETTINGS) { 293307264Smav struct ccb_trans_settings *cts; 294307264Smav struct ccb_trans_settings_0x18 *cts18; 295259397Snwhitehorn 296307264Smav cts = &ccb->cts; 297307264Smav cts18 = (struct ccb_trans_settings_0x18 *)hdr18; 298307264Smav cts->type = cts18->type; 299307264Smav cts->protocol = cts18->protocol; 300307264Smav cts->protocol_version = cts18->protocol_version; 301307264Smav cts->transport = cts18->transport; 302307264Smav cts->transport_version = cts18->transport_version; 303307264Smav bcopy(&cts18->proto_specific, &cts->proto_specific, 304307264Smav sizeof(cts18->proto_specific)); 305307264Smav bcopy(&cts18->xport_specific, &cts->xport_specific, 306307264Smav sizeof(cts18->xport_specific)); 307307264Smav } else { 308307264Smav bcopy(ccbb18, ccbb, CAM_0X18_DATA_LEN); 309307264Smav } 310307264Smav 311259397Snwhitehorn error = (cbfnp)(dev, cmd, (caddr_t)ccb, flag, td); 312259397Snwhitehorn 313259397Snwhitehorn hdr18->pinfo = hdr->pinfo; 314259397Snwhitehorn hdr18->xpt_links = hdr->xpt_links; 315259397Snwhitehorn hdr18->sim_links = hdr->sim_links; 316259397Snwhitehorn hdr18->periph_links = hdr->periph_links; 317259397Snwhitehorn hdr18->retry_count = hdr->retry_count; 318259397Snwhitehorn hdr18->cbfcnp = hdr->cbfcnp; 319259397Snwhitehorn hdr18->func_code = hdr->func_code; 320259397Snwhitehorn hdr18->status = hdr->status; 321259397Snwhitehorn hdr18->path = hdr->path; 322259397Snwhitehorn hdr18->path_id = hdr->path_id; 323259397Snwhitehorn hdr18->target_id = hdr->target_id; 324259397Snwhitehorn hdr18->target_lun = hdr->target_lun; 325259397Snwhitehorn hdr18->ext_lun = hdr->target_lun; 326259397Snwhitehorn hdr18->flags = hdr->flags; 327259397Snwhitehorn hdr18->xflags = hdr->xflags | CAM_EXTLUN_VALID_0x18; 328259397Snwhitehorn hdr18->periph_priv = hdr->periph_priv; 329259397Snwhitehorn hdr18->sim_priv = hdr->sim_priv; 330259397Snwhitehorn hdr18->timeout = hdr->timeout; 331259397Snwhitehorn 332307264Smav if (ccb->ccb_h.func_code == XPT_GET_TRAN_SETTINGS) { 333307264Smav struct ccb_trans_settings *cts; 334307264Smav struct ccb_trans_settings_0x18 *cts18; 335259397Snwhitehorn 336307264Smav cts = &ccb->cts; 337307264Smav cts18 = (struct ccb_trans_settings_0x18 *)hdr18; 338307264Smav cts18->type = cts->type; 339307264Smav cts18->protocol = cts->protocol; 340307264Smav cts18->protocol_version = cts->protocol_version; 341307264Smav cts18->transport = cts->transport; 342307264Smav cts18->transport_version = cts->transport_version; 343307264Smav bcopy(&cts->proto_specific, &cts18->proto_specific, 344307264Smav sizeof(cts18->proto_specific)); 345307264Smav bcopy(&cts->xport_specific, &cts18->xport_specific, 346307264Smav sizeof(cts18->xport_specific)); 347307264Smav } else if (ccb->ccb_h.func_code == XPT_DEV_MATCH) { 348307264Smav bcopy(ccbb, ccbb18, CAM_0X18_DATA_LEN); 349259397Snwhitehorn cam_compat_translate_dev_match_0x18(ccb); 350307264Smav } else { 351307264Smav bcopy(ccbb, ccbb18, CAM_0X18_DATA_LEN); 352307264Smav } 353259397Snwhitehorn 354259397Snwhitehorn xpt_free_ccb(ccb); 355259397Snwhitehorn 356259397Snwhitehorn return (error); 357259397Snwhitehorn} 358259397Snwhitehorn 359259397Snwhitehornstatic int 360259397Snwhitehorncam_compat_translate_dev_match_0x18(union ccb *ccb) 361259397Snwhitehorn{ 362259397Snwhitehorn struct dev_match_result *dm; 363259397Snwhitehorn struct dev_match_result_0x18 *dm18; 364259397Snwhitehorn struct cam_periph_map_info mapinfo; 365259397Snwhitehorn int i; 366259397Snwhitehorn 367259397Snwhitehorn /* Remap the CCB into kernel address space */ 368259397Snwhitehorn bzero(&mapinfo, sizeof(mapinfo)); 369288420Smav cam_periph_mapmem(ccb, &mapinfo, MAXPHYS); 370259397Snwhitehorn 371259397Snwhitehorn dm = ccb->cdm.matches; 372259397Snwhitehorn /* Translate in-place: old fields are smaller */ 373259397Snwhitehorn dm18 = (struct dev_match_result_0x18 *)(dm); 374259397Snwhitehorn 375259397Snwhitehorn for (i = 0; i < ccb->cdm.num_matches; i++) { 376259397Snwhitehorn dm18[i].type = dm[i].type; 377259397Snwhitehorn switch (dm[i].type) { 378259397Snwhitehorn case DEV_MATCH_PERIPH: 379259397Snwhitehorn memcpy(&dm18[i].result.periph_result.periph_name, 380259397Snwhitehorn &dm[i].result.periph_result.periph_name, 381259397Snwhitehorn DEV_IDLEN); 382259397Snwhitehorn dm18[i].result.periph_result.unit_number = 383259397Snwhitehorn dm[i].result.periph_result.unit_number; 384259397Snwhitehorn dm18[i].result.periph_result.path_id = 385259397Snwhitehorn dm[i].result.periph_result.path_id; 386259397Snwhitehorn dm18[i].result.periph_result.target_id = 387259397Snwhitehorn dm[i].result.periph_result.target_id; 388259397Snwhitehorn dm18[i].result.periph_result.target_lun = 389259397Snwhitehorn dm[i].result.periph_result.target_lun; 390259397Snwhitehorn break; 391259397Snwhitehorn case DEV_MATCH_DEVICE: 392259397Snwhitehorn dm18[i].result.device_result.path_id = 393259397Snwhitehorn dm[i].result.device_result.path_id; 394259397Snwhitehorn dm18[i].result.device_result.target_id = 395259397Snwhitehorn dm[i].result.device_result.target_id; 396259397Snwhitehorn dm18[i].result.device_result.target_lun = 397259397Snwhitehorn dm[i].result.device_result.target_lun; 398259397Snwhitehorn dm18[i].result.device_result.protocol = 399259397Snwhitehorn dm[i].result.device_result.protocol; 400259397Snwhitehorn memcpy(&dm18[i].result.device_result.inq_data, 401259397Snwhitehorn &dm[i].result.device_result.inq_data, 402259397Snwhitehorn sizeof(struct scsi_inquiry_data)); 403259397Snwhitehorn memcpy(&dm18[i].result.device_result.ident_data, 404259397Snwhitehorn &dm[i].result.device_result.ident_data, 405259397Snwhitehorn sizeof(struct ata_params)); 406259397Snwhitehorn dm18[i].result.device_result.flags = 407259397Snwhitehorn dm[i].result.device_result.flags; 408259397Snwhitehorn break; 409259397Snwhitehorn case DEV_MATCH_BUS: 410259397Snwhitehorn memcpy(&dm18[i].result.bus_result, 411259397Snwhitehorn &dm[i].result.bus_result, 412259397Snwhitehorn sizeof(struct bus_match_result)); 413259397Snwhitehorn break; 414259397Snwhitehorn } 415259397Snwhitehorn } 416259397Snwhitehorn 417259397Snwhitehorn cam_periph_unmapmem(ccb, &mapinfo); 418259397Snwhitehorn 419259397Snwhitehorn return (0); 420259397Snwhitehorn} 421259397Snwhitehorn 422