Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/cam_compat.c
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
#include <cam/scsi/scsi_pass.h> | #include <cam/scsi/scsi_pass.h> | ||||
#include "opt_cam.h" | #include "opt_cam.h" | ||||
static int cam_compat_handle_0x17(struct cdev *dev, u_long cmd, caddr_t addr, | static int cam_compat_handle_0x17(struct cdev *dev, u_long cmd, caddr_t addr, | ||||
int flag, struct thread *td, d_ioctl_t *cbfnp); | int flag, struct thread *td, d_ioctl_t *cbfnp); | ||||
static int cam_compat_handle_0x18(struct cdev *dev, u_long cmd, caddr_t addr, | static int cam_compat_handle_0x18(struct cdev *dev, u_long cmd, caddr_t addr, | ||||
int flag, struct thread *td, d_ioctl_t *cbfnp); | int flag, struct thread *td, d_ioctl_t *cbfnp); | ||||
static int cam_compat_handle_0x19(struct cdev *dev, u_long cmd, caddr_t addr, | |||||
int flag, struct thread *td, d_ioctl_t *cbfnp); | |||||
static int cam_compat_translate_dev_match_0x18(union ccb *ccb); | static int cam_compat_translate_dev_match_0x18(union ccb *ccb); | ||||
int | int | ||||
cam_compat_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, | cam_compat_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, | ||||
struct thread *td, d_ioctl_t *cbfnp) | struct thread *td, d_ioctl_t *cbfnp) | ||||
{ | { | ||||
int error; | int error; | ||||
Show All 34 Lines | cam_compat_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, | ||||
case CAMIOCOMMAND_0x18: | case CAMIOCOMMAND_0x18: | ||||
cmd = CAMIOCOMMAND; | cmd = CAMIOCOMMAND; | ||||
error = cam_compat_handle_0x18(dev, cmd, addr, flag, td, cbfnp); | error = cam_compat_handle_0x18(dev, cmd, addr, flag, td, cbfnp); | ||||
break; | break; | ||||
case CAMGETPASSTHRU_0x18: | case CAMGETPASSTHRU_0x18: | ||||
cmd = CAMGETPASSTHRU; | cmd = CAMGETPASSTHRU; | ||||
error = cam_compat_handle_0x18(dev, cmd, addr, flag, td, cbfnp); | error = cam_compat_handle_0x18(dev, cmd, addr, flag, td, cbfnp); | ||||
break; | break; | ||||
case CAMIOCOMMAND_0x19: | |||||
cmd = CAMIOCOMMAND; | |||||
error = cam_compat_handle_0x19(dev, cmd, addr, flag, td, cbfnp); | |||||
break; | |||||
case CAMGETPASSTHRU_0x19: | |||||
cmd = CAMGETPASSTHRU; | |||||
error = cam_compat_handle_0x19(dev, cmd, addr, flag, td, cbfnp); | |||||
break; | |||||
case CAMIOQUEUE_0x19: | |||||
cmd = CAMIOQUEUE; | |||||
error = cam_compat_handle_0x19(dev, cmd, addr, flag, td, cbfnp); | |||||
break; | |||||
case CAMIOGET_0x19: | |||||
cmd = CAMIOGET; | |||||
error = cam_compat_handle_0x19(dev, cmd, addr, flag, td, cbfnp); | |||||
break; | |||||
default: | default: | ||||
error = ENOTTY; | error = ENOTTY; | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if (ccb->ccb_h.func_code == XPT_SET_TRAN_SETTINGS) { | ||||
bcopy(&cts17->proto_specific, &cts->proto_specific, | bcopy(&cts17->proto_specific, &cts->proto_specific, | ||||
sizeof(cts17->proto_specific)); | sizeof(cts17->proto_specific)); | ||||
bcopy(&cts17->xport_specific, &cts->xport_specific, | bcopy(&cts17->xport_specific, &cts->xport_specific, | ||||
sizeof(cts17->xport_specific)); | sizeof(cts17->xport_specific)); | ||||
} else { | } else { | ||||
bcopy(ccbb17, ccbb, CAM_0X17_DATA_LEN); | bcopy(ccbb17, ccbb, CAM_0X17_DATA_LEN); | ||||
} | } | ||||
error = (cbfnp)(dev, cmd, (caddr_t)ccb, flag, td); | error = cam_compat_handle_0x19(dev, cmd, (caddr_t)ccb, flag, td, cbfnp); | ||||
hdr17->pinfo = hdr->pinfo; | hdr17->pinfo = hdr->pinfo; | ||||
hdr17->xpt_links = hdr->xpt_links; | hdr17->xpt_links = hdr->xpt_links; | ||||
hdr17->sim_links = hdr->sim_links; | hdr17->sim_links = hdr->sim_links; | ||||
hdr17->periph_links = hdr->periph_links; | hdr17->periph_links = hdr->periph_links; | ||||
hdr17->retry_count = hdr->retry_count; | hdr17->retry_count = hdr->retry_count; | ||||
hdr17->cbfcnp = hdr->cbfcnp; | hdr17->cbfcnp = hdr->cbfcnp; | ||||
hdr17->func_code = hdr->func_code; | hdr17->func_code = hdr->func_code; | ||||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | if (ccb->ccb_h.func_code == XPT_SET_TRAN_SETTINGS) { | ||||
bcopy(&cts18->proto_specific, &cts->proto_specific, | bcopy(&cts18->proto_specific, &cts->proto_specific, | ||||
sizeof(cts18->proto_specific)); | sizeof(cts18->proto_specific)); | ||||
bcopy(&cts18->xport_specific, &cts->xport_specific, | bcopy(&cts18->xport_specific, &cts->xport_specific, | ||||
sizeof(cts18->xport_specific)); | sizeof(cts18->xport_specific)); | ||||
} else { | } else { | ||||
bcopy(ccbb18, ccbb, CAM_0X18_DATA_LEN); | bcopy(ccbb18, ccbb, CAM_0X18_DATA_LEN); | ||||
} | } | ||||
error = (cbfnp)(dev, cmd, (caddr_t)ccb, flag, td); | error = cam_compat_handle_0x19(dev, cmd, (caddr_t)ccb, flag, td, cbfnp); | ||||
hdr18->pinfo = hdr->pinfo; | hdr18->pinfo = hdr->pinfo; | ||||
hdr18->xpt_links = hdr->xpt_links; | hdr18->xpt_links = hdr->xpt_links; | ||||
hdr18->sim_links = hdr->sim_links; | hdr18->sim_links = hdr->sim_links; | ||||
hdr18->periph_links = hdr->periph_links; | hdr18->periph_links = hdr->periph_links; | ||||
hdr18->retry_count = hdr->retry_count; | hdr18->retry_count = hdr->retry_count; | ||||
hdr18->cbfcnp = hdr->cbfcnp; | hdr18->cbfcnp = hdr->cbfcnp; | ||||
hdr18->func_code = hdr->func_code; | hdr18->func_code = hdr->func_code; | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | case DEV_MATCH_BUS: | ||||
sizeof(struct bus_match_result)); | sizeof(struct bus_match_result)); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
cam_periph_unmapmem(ccb, &mapinfo); | cam_periph_unmapmem(ccb, &mapinfo); | ||||
return (0); | return (0); | ||||
} | |||||
static int | |||||
cam_compat_handle_0x19(struct cdev *dev, u_long cmd, caddr_t addr, int flag, | |||||
struct thread *td, d_ioctl_t *cbfnp) | |||||
{ | |||||
union ccb *ccb = (union ccb *)addr; | |||||
struct cam_periph_map_info mapinfo; | |||||
if (cmd == CAMIOCOMMAND && ccb->ccb_h.func_code == XPT_DEV_MATCH) { | |||||
bzero(&mapinfo, sizeof(mapinfo)); | |||||
cam_periph_mapmem(ccb, &mapinfo, maxphys); | |||||
for (int i = 0; i < ccb->cdm.num_patterns; i++) { | |||||
struct dev_match_pattern *p = &ccb->cdm.patterns[i]; | |||||
if (p->type == DEV_MATCH_BUS && | |||||
p->pattern.bus_pattern.flags == 0x00f) | |||||
p->pattern.bus_pattern.flags = BUS_MATCH_ANY; | |||||
if (p->type == DEV_MATCH_DEVICE && | |||||
p->pattern.device_pattern.flags == 0x00f) | |||||
p->pattern.device_pattern.flags = DEV_MATCH_ANY; | |||||
if (p->type == DEV_MATCH_PERIPH && | |||||
p->pattern.periph_pattern.flags == 0x01f) | |||||
p->pattern.periph_pattern.flags = PERIPH_MATCH_ANY; | |||||
} | |||||
cam_periph_unmapmem(ccb, &mapinfo); | |||||
} | |||||
return ((cbfnp)(dev, cmd, addr, flag, td)); | |||||
} | } |