Lines Matching refs:SCpnt

86 static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt);
329 static int sr_done(struct scsi_cmnd *SCpnt) in sr_done() argument
331 int result = SCpnt->result; in sr_done()
332 int this_count = scsi_bufflen(SCpnt); in sr_done()
336 struct request *rq = scsi_cmd_to_rq(SCpnt); in sr_done()
340 scmd_printk(KERN_INFO, SCpnt, "done: %x\n", result); in sr_done()
350 (SCpnt->sense_buffer[0] & 0x7f) == 0x70) { /* Sense current */ in sr_done()
351 switch (SCpnt->sense_buffer[2]) { in sr_done()
355 if (!(SCpnt->sense_buffer[0] & 0x90)) in sr_done()
358 get_unaligned_be32(&SCpnt->sense_buffer[3]); in sr_done()
394 static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt) in sr_init_command() argument
398 struct request *rq = scsi_cmd_to_rq(SCpnt); in sr_init_command()
401 ret = scsi_alloc_sgtables(SCpnt); in sr_init_command()
406 SCSI_LOG_HLQUEUE(1, scmd_printk(KERN_INFO, SCpnt, in sr_init_command()
410 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sr_init_command()
412 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sr_init_command()
413 "Retry with 0x%p\n", SCpnt)); in sr_init_command()
427 scmd_printk(KERN_ERR, SCpnt, "bad sector size %d\n", s_size); in sr_init_command()
435 SCpnt->cmnd[0] = WRITE_10; in sr_init_command()
439 SCpnt->cmnd[0] = READ_10; in sr_init_command()
448 int i, size = 0, sg_count = scsi_sg_count(SCpnt); in sr_init_command()
450 scsi_for_each_sg(SCpnt, sg, sg_count, i) in sr_init_command()
453 if (size != scsi_bufflen(SCpnt)) { in sr_init_command()
454 scmd_printk(KERN_ERR, SCpnt, in sr_init_command()
456 size, scsi_bufflen(SCpnt)); in sr_init_command()
457 if (scsi_bufflen(SCpnt) > size) in sr_init_command()
458 SCpnt->sdb.length = size; in sr_init_command()
466 (scsi_bufflen(SCpnt) % s_size)) { in sr_init_command()
467 scmd_printk(KERN_NOTICE, SCpnt, "unaligned transfer\n"); in sr_init_command()
471 this_count = (scsi_bufflen(SCpnt) >> 9) / (s_size >> 9); in sr_init_command()
474 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sr_init_command()
480 SCpnt->cmnd[1] = 0; in sr_init_command()
485 SCpnt->sdb.length = this_count * s_size; in sr_init_command()
488 put_unaligned_be32(block, &SCpnt->cmnd[2]); in sr_init_command()
489 SCpnt->cmnd[6] = SCpnt->cmnd[9] = 0; in sr_init_command()
490 put_unaligned_be16(this_count, &SCpnt->cmnd[7]); in sr_init_command()
497 SCpnt->transfersize = cd->device->sector_size; in sr_init_command()
498 SCpnt->underflow = this_count << 9; in sr_init_command()
499 SCpnt->allowed = MAX_RETRIES; in sr_init_command()
500 SCpnt->cmd_len = 10; in sr_init_command()
507 scsi_free_sgtables(SCpnt); in sr_init_command()