Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/cam_xpt.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
int error; | int error; | ||||
if ((error = xptdoioctl(dev, cmd, addr, flag, td)) == ENOTTY) { | if ((error = xptdoioctl(dev, cmd, addr, flag, td)) == ENOTTY) { | ||||
error = cam_compat_ioctl(dev, cmd, addr, flag, td, xptdoioctl); | error = cam_compat_ioctl(dev, cmd, addr, flag, td, xptdoioctl); | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
xptdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) | xptdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) | ||||
{ | { | ||||
int error; | int error; | ||||
error = 0; | error = 0; | ||||
switch(cmd) { | switch(cmd) { | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
if (path->device->protocol == PROTO_SCSI) | if (path->device->protocol == PROTO_SCSI) | ||||
scsi_print_inquiry(&path->device->inq_data); | scsi_print_inquiry(&path->device->inq_data); | ||||
else if (path->device->protocol == PROTO_ATA || | else if (path->device->protocol == PROTO_ATA || | ||||
path->device->protocol == PROTO_SATAPM) | path->device->protocol == PROTO_SATAPM) | ||||
ata_print_ident(&path->device->ident_data); | ata_print_ident(&path->device->ident_data); | ||||
else if (path->device->protocol == PROTO_SEMB) | else if (path->device->protocol == PROTO_SEMB) | ||||
semb_print_ident( | semb_print_ident( | ||||
(struct sep_identify_data *)&path->device->ident_data); | (struct sep_identify_data *)&path->device->ident_data); | ||||
else if (path->device->protocol == PROTO_MMCSD) | |||||
mmc_print_ident(&path->device->mmc_ident_data); | |||||
else | else | ||||
printf("Unknown protocol device\n"); | printf("Unknown protocol device\n"); | ||||
if (path->device->serial_num_len > 0) { | if (path->device->serial_num_len > 0) { | ||||
/* Don't wrap the screen - print only the first 60 chars */ | /* Don't wrap the screen - print only the first 60 chars */ | ||||
printf("%s%d: Serial Number %.60s\n", periph->periph_name, | printf("%s%d: Serial Number %.60s\n", periph->periph_name, | ||||
periph->unit_number, path->device->serial_num); | periph->unit_number, path->device->serial_num); | ||||
} | } | ||||
/* Announce transport details. */ | /* Announce transport details. */ | ||||
Show All 37 Lines | |||||
if (path->device->protocol == PROTO_SCSI) | if (path->device->protocol == PROTO_SCSI) | ||||
scsi_print_inquiry_short(&path->device->inq_data); | scsi_print_inquiry_short(&path->device->inq_data); | ||||
else if (path->device->protocol == PROTO_ATA || | else if (path->device->protocol == PROTO_ATA || | ||||
path->device->protocol == PROTO_SATAPM) | path->device->protocol == PROTO_SATAPM) | ||||
ata_print_ident_short(&path->device->ident_data); | ata_print_ident_short(&path->device->ident_data); | ||||
else if (path->device->protocol == PROTO_SEMB) | else if (path->device->protocol == PROTO_SEMB) | ||||
semb_print_ident_short( | semb_print_ident_short( | ||||
(struct sep_identify_data *)&path->device->ident_data); | (struct sep_identify_data *)&path->device->ident_data); | ||||
else if (path->device->protocol == PROTO_MMCSD) | |||||
mmc_print_ident(&path->device->mmc_ident_data); | |||||
else | else | ||||
printf("Unknown protocol device"); | printf("Unknown protocol device"); | ||||
if (path->device->serial_num_len > 0) | if (path->device->serial_num_len > 0) | ||||
printf(" s/n %.60s", path->device->serial_num); | printf(" s/n %.60s", path->device->serial_num); | ||||
printf(" detached\n"); | printf(" detached\n"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
if ((patterns[i].type == DEV_MATCH_PERIPH) | if ((patterns[i].type == DEV_MATCH_PERIPH) | ||||
&& ((retval & DM_RET_ACTION_MASK) == DM_RET_NONE)) | && ((retval & DM_RET_ACTION_MASK) == DM_RET_NONE)) | ||||
retval |= DM_RET_DESCEND; | retval |= DM_RET_DESCEND; | ||||
continue; | continue; | ||||
} | } | ||||
cur_pattern = &patterns[i].pattern.device_pattern; | cur_pattern = &patterns[i].pattern.device_pattern; | ||||
/* Error out if mutually exclusive options are specified. */ | /* Error out if mutually exclusive options are specified. */ | ||||
if ((cur_pattern->flags & (DEV_MATCH_INQUIRY|DEV_MATCH_DEVID)) | if ((cur_pattern->flags & (DEV_MATCH_INQUIRY|DEV_MATCH_DEVID)) | ||||
== (DEV_MATCH_INQUIRY|DEV_MATCH_DEVID)) | == (DEV_MATCH_INQUIRY|DEV_MATCH_DEVID)) | ||||
return(DM_RET_ERROR); | return(DM_RET_ERROR); | ||||
/* | /* | ||||
* If they want to match any device node, we give them any | * If they want to match any device node, we give them any | ||||
* device node. | * device node. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
cdm->matches[j].result.device_result.protocol = | cdm->matches[j].result.device_result.protocol = | ||||
device->protocol; | device->protocol; | ||||
bcopy(&device->inq_data, | bcopy(&device->inq_data, | ||||
&cdm->matches[j].result.device_result.inq_data, | &cdm->matches[j].result.device_result.inq_data, | ||||
sizeof(struct scsi_inquiry_data)); | sizeof(struct scsi_inquiry_data)); | ||||
bcopy(&device->ident_data, | bcopy(&device->ident_data, | ||||
&cdm->matches[j].result.device_result.ident_data, | &cdm->matches[j].result.device_result.ident_data, | ||||
sizeof(struct ata_params)); | sizeof(struct ata_params)); | ||||
bcopy(&device->mmc_ident_data, | |||||
&cdm->matches[j].result.device_result.mmc_ident_data, | |||||
sizeof(struct mmc_params)); | |||||
/* Let the user know whether this device is unconfigured */ | /* Let the user know whether this device is unconfigured */ | ||||
if (device->flags & CAM_DEV_UNCONFIGURED) | if (device->flags & CAM_DEV_UNCONFIGURED) | ||||
cdm->matches[j].result.device_result.flags = | cdm->matches[j].result.device_result.flags = | ||||
DEV_RESULT_UNCONFIGURED; | DEV_RESULT_UNCONFIGURED; | ||||
else | else | ||||
cdm->matches[j].result.device_result.flags = | cdm->matches[j].result.device_result.flags = | ||||
DEV_RESULT_NOFLAG; | DEV_RESULT_NOFLAG; | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
case XPT_CONT_TARGET_IO: | case XPT_CONT_TARGET_IO: | ||||
start_ccb->csio.sense_resid = 0; | start_ccb->csio.sense_resid = 0; | ||||
start_ccb->csio.resid = 0; | start_ccb->csio.resid = 0; | ||||
/* FALLTHROUGH */ | /* FALLTHROUGH */ | ||||
case XPT_ATA_IO: | case XPT_ATA_IO: | ||||
if (start_ccb->ccb_h.func_code == XPT_ATA_IO) | if (start_ccb->ccb_h.func_code == XPT_ATA_IO) | ||||
start_ccb->ataio.resid = 0; | start_ccb->ataio.resid = 0; | ||||
/* FALLTHROUGH */ | /* FALLTHROUGH */ | ||||
case XPT_MMC_IO: | |||||
case XPT_RESET_DEV: | case XPT_RESET_DEV: | ||||
case XPT_ENG_EXEC: | case XPT_ENG_EXEC: | ||||
case XPT_SMP_IO: | case XPT_SMP_IO: | ||||
{ | { | ||||
struct cam_devq *devq; | struct cam_devq *devq; | ||||
devq = path->bus->sim->devq; | devq = path->bus->sim->devq; | ||||
mtx_lock(&devq->send_mtx); | mtx_lock(&devq->send_mtx); | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
case XPORT_SRP: | case XPORT_SRP: | ||||
case XPORT_PPB: | case XPORT_PPB: | ||||
new_bus->xport = scsi_get_xport(); | new_bus->xport = scsi_get_xport(); | ||||
break; | break; | ||||
case XPORT_ATA: | case XPORT_ATA: | ||||
case XPORT_SATA: | case XPORT_SATA: | ||||
new_bus->xport = ata_get_xport(); | new_bus->xport = ata_get_xport(); | ||||
break; | break; | ||||
case XPORT_MMCSD: | |||||
new_bus->xport = mmc_get_xport(); | |||||
break; | |||||
default: | default: | ||||
new_bus->xport = &xport_default; | new_bus->xport = &xport_default; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
/* Notify interested parties */ | /* Notify interested parties */ | ||||
if (sim->path_id != CAM_XPT_PATH_ID) { | if (sim->path_id != CAM_XPT_PATH_ID) { | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |