Lines Matching refs:dev

121 	struct ata_device *dev;
139 ata_for_each_dev(dev, &ap->link, ENABLED) {
140 if (dev->horkage & ATA_HORKAGE_NOLPM) {
154 static ssize_t ata_scsi_lpm_show(struct device *dev,
157 struct Scsi_Host *shost = class_to_shost(dev);
176 struct ata_device *dev;
184 dev = ata_scsi_find_dev(ap, sdev);
185 if (!dev) {
189 if (dev->flags & ATA_DFLAG_NO_UNLOAD) {
194 link = dev->link;
197 link->eh_context.unloaded_mask & (1 << dev->devno) &&
198 time_after(dev->unpark_deadline, now))
199 msecs = jiffies_to_msecs(dev->unpark_deadline - now);
215 struct ata_device *dev;
233 dev = ata_scsi_find_dev(ap, sdev);
234 if (unlikely(!dev)) {
238 if (dev->class != ATA_DEV_ATA) {
244 if (dev->flags & ATA_DFLAG_NO_UNLOAD) {
249 dev->unpark_deadline = ata_deadline(jiffies, input);
250 dev->link->eh_info.dev_action[dev->devno] |= ATA_EH_PARK;
256 dev->flags &= ~ATA_DFLAG_NO_UNLOAD;
259 dev->flags |= ATA_DFLAG_NO_UNLOAD;
280 ata_scsi_em_message_store(struct device *dev, struct device_attribute *attr,
283 struct Scsi_Host *shost = class_to_shost(dev);
291 ata_scsi_em_message_show(struct device *dev, struct device_attribute *attr,
294 struct Scsi_Host *shost = class_to_shost(dev);
306 ata_scsi_em_message_type_show(struct device *dev, struct device_attribute *attr,
309 struct Scsi_Host *shost = class_to_shost(dev);
319 ata_scsi_activity_show(struct device *dev, struct device_attribute *attr,
322 struct scsi_device *sdev = to_scsi_device(dev);
333 ata_scsi_activity_store(struct device *dev, struct device_attribute *attr,
336 struct scsi_device *sdev = to_scsi_device(dev);
415 struct ata_device *dev;
420 dev = ata_scsi_find_dev(ap, sdev);
421 if (dev && dev->n_sectors < dev->n_native_sectors) {
422 dev->flags |= ATA_DFLAG_UNLOCK_HPA;
423 dev->link->eh_info.action |= ATA_EH_RESET;
446 struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
450 if (!dev)
453 if (copy_to_user(dst, dev->id, ATA_ID_WORDS * sizeof(u16)))
456 ata_id_string(dev->id, buf, ATA_ID_PROD, ATA_ID_PROD_LEN);
460 ata_id_string(dev->id, buf, ATA_ID_FW_REV, ATA_ID_FW_REV_LEN);
464 ata_id_string(dev->id, buf, ATA_ID_SERNO, ATA_ID_SERNO_LEN);
512 scsi_cmd[2] = 0x0e; /* no off.line or cc, read from dev,
736 * @dev: ATA device to which the new command is attached
753 static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
758 qc = ata_qc_new_init(dev);
1031 struct ata_device *dev = qc->dev;
1056 block = ata_tf_read_block(&qc->result_tf, dev);
1114 struct ata_device *dev)
1118 if (!ata_id_has_unload(dev->id))
1119 dev->flags |= ATA_DFLAG_NO_UNLOAD;
1122 blk_queue_max_hw_sectors(q, dev->max_sectors);
1124 if (dev->class == ATA_DEV_ATAPI) {
1135 ata_dev_err(dev, "drain buffer allocation failed\n");
1141 sdev->sector_size = ata_id_logical_sector_size(dev->id);
1153 ata_dev_warn(dev,
1159 if (dev->flags & ATA_DFLAG_AN)
1162 if (dev->flags & ATA_DFLAG_NCQ) {
1165 depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id));
1172 dev->sdev = sdev;
1191 struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
1196 if (dev)
1197 rc = ata_scsi_dev_config(sdev, dev);
1208 * dev->sdev, this function doesn't have to do anything.
1210 * Clear dev->sdev, schedule the device for ATA detach and invoke
1221 struct ata_device *dev;
1227 dev = __ata_scsi_find_dev(ap, sdev);
1228 if (dev && dev->sdev) {
1230 dev->sdev = NULL;
1231 dev->flags |= ATA_DFLAG_DETACH;
1255 struct ata_device *dev;
1264 dev = ata_scsi_find_dev(ap, sdev);
1265 if (!dev || !ata_dev_enabled(dev))
1270 dev->flags &= ~ATA_DFLAG_NCQ_OFF;
1271 if (queue_depth == 1 || !ata_ncq_enabled(dev)) {
1272 dev->flags |= ATA_DFLAG_NCQ_OFF;
1279 queue_depth = min(queue_depth, ata_id_queue_depth(dev->id));
1350 if (qc->dev->flags & ATA_DFLAG_LBA) {
1420 if (qc->dev->flags & ATA_DFLAG_FLUSH_EXT)
1538 struct ata_device *dev = qc->dev;
1539 u64 dev_sectors = qc->dev->n_sectors;
1565 if (dev->flags & ATA_DFLAG_LBA) {
1573 if (!(dev->flags & ATA_DFLAG_LBA48))
1604 track = (u32)block / dev->sectors;
1605 cyl = track / dev->heads;
1606 head = track % dev->heads;
1607 sect = (u32)block % dev->sectors + 1;
1723 rc = ata_build_rw_tf(&qc->tf, qc->dev, block, n_block, tf_flags,
1789 * @dev: ATA device to which the command is addressed
1813 static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
1816 struct ata_port *ap = dev->link->ap;
1822 qc = ata_scsi_qc_new(dev, cmd);
1830 ata_dev_warn(dev, "WARNING: zero len r/w req\n");
2352 struct ata_device *dev = args->dev;
2421 if (ata_dev_supports_fua(args->id) && (dev->flags & ATA_DFLAG_LBA48) &&
2422 (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count))
2468 struct ata_device *dev = args->dev;
2469 u64 last_lba = dev->n_sectors - 1; /* LBA of the last block */
2474 sector_size = ata_id_logical_sector_size(dev->id);
2475 log2_per_phys = ata_id_log2_per_physical_sector(dev->id);
2476 lowest_aligned = ata_id_logical_sector_offset(dev->id, log2_per_phys);
2593 memset(&qc->cdb, 0, qc->dev->cdb_len);
2648 * sure qc->dev->sdev isn't NULL before dereferencing.
2650 if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev)
2651 qc->dev->sdev->locked = 0;
2715 struct ata_device *dev = qc->dev;
2717 int using_pio = !nodata && (dev->flags & ATA_DFLAG_PIO);
2720 memset(qc->cdb, 0, dev->cdb_len);
2784 if ((dev->flags & ATA_DFLAG_DMADIR) &&
2847 struct ata_device *dev = __ata_scsi_find_dev(ap, scsidev);
2849 if (unlikely(!dev || !ata_dev_enabled(dev)))
2852 return dev;
2905 struct ata_device *dev = qc->dev;
2957 tf->device = dev->devno ?
3030 if (tf->protocol == ATA_PROT_DMA && dev->dma_mode == 0)
3043 if (multi_count != dev->multi_count)
3044 ata_dev_warn(dev, "invalid multi_count %u ignored\n",
3089 struct ata_device *dev = qc->dev;
3097 if (unlikely(!dev->dma_mode))
3118 if (ata_ncq_enabled(dev) && ata_fpdma_dsm_supported(dev)) {
3165 struct ata_device *dev = qc->dev;
3182 ata_msense_caching(dev->id, mpage, false);
3334 * @dev: ATA device
3344 static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd)
3360 if (ata_try_flush_cache(dev))
3409 struct ata_device *dev)
3415 if (dev->class == ATA_DEV_ATA) {
3416 if (unlikely(!scmd->cmd_len || scmd->cmd_len > dev->cdb_len))
3419 xlat_func = ata_get_xlat_func(dev, scsi_op);
3428 if (unlikely(len > scmd->cmd_len || len > dev->cdb_len))
3437 xlat_func = ata_get_xlat_func(dev, scsi_op);
3442 rc = ata_scsi_translate(dev, scmd, xlat_func);
3444 ata_scsi_simulate(dev, scmd);
3450 scmd->cmd_len, scsi_op, dev->cdb_len);
3478 struct ata_device *dev;
3489 dev = ata_scsi_find_dev(ap, scsidev);
3490 if (likely(dev))
3491 rc = __ata_scsi_queuecmd(cmd, dev);
3504 * @dev: the target device
3514 void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
3520 args.dev = dev;
3521 args.id = dev->id;
3654 &ap->tdev, ap->host->dev);
3678 struct ata_device *dev;
3682 ata_for_each_dev(dev, link, ENABLED) {
3686 if (dev->sdev)
3690 id = dev->devno;
3697 dev->sdev = sdev;
3700 dev->sdev = NULL;
3710 ata_for_each_dev(dev, link, ENABLED) {
3711 if (!dev->sdev)
3724 if (dev != last_failed_dev) {
3726 last_failed_dev = dev;
3748 * @dev: ATA device to offline attached SCSI device for
3751 * for taking the SCSI device attached to @dev offline. This
3752 * function is called with host lock which protects dev->sdev
3761 int ata_scsi_offline_dev(struct ata_device *dev)
3763 if (dev->sdev) {
3764 scsi_device_set_state(dev->sdev, SDEV_OFFLINE);
3772 * @dev: ATA device to remove attached SCSI device for
3775 * responsible for removing the SCSI device attached to @dev.
3780 static void ata_scsi_remove_dev(struct ata_device *dev)
3782 struct ata_port *ap = dev->link->ap;
3795 /* clearing dev->sdev is protected by host lock */
3796 sdev = dev->sdev;
3797 dev->sdev = NULL;
3821 ata_dev_info(dev, "detaching (SCSI %s)\n",
3832 struct ata_device *dev;
3834 ata_for_each_dev(dev, link, ALL) {
3837 if (!(dev->flags & ATA_DFLAG_DETACHED))
3841 dev->flags &= ~ATA_DFLAG_DETACHED;
3844 if (zpodd_dev_enabled(dev))
3845 zpodd_exit(dev);
3847 ata_scsi_remove_dev(dev);
3853 * @dev: Pointer to the disk device with media change event
3861 void ata_scsi_media_change_notify(struct ata_device *dev)
3863 if (dev->sdev)
3864 sdev_evt_send_simple(dev->sdev, SDEV_EVT_MEDIA_CHANGE,
3981 struct ata_device *dev = ata_find_dev(ap, devno);
3983 if (dev) {
3984 struct ata_eh_info *ehi = &dev->link->eh_info;
3985 ehi->probe_mask |= 1 << dev->devno;
4016 struct ata_device *dev;
4023 ata_for_each_dev(dev, link, ENABLED) {
4024 struct scsi_device *sdev = dev->sdev;