Lines Matching refs:cmd

178 inline void eata_latency_out(struct eata_ccb *cp, Scsi_Cmnd *cmd)  in eata_latency_out()  argument
185 switch(cmd->cmnd[0]) { in eata_latency_out()
187 x = cmd->cmnd[4]/2; in eata_latency_out()
191 x = cmd->cmnd[4]/2; in eata_latency_out()
195 sho = (short *) &cmd->cmnd[7]; in eata_latency_out()
200 sho = (short *) &cmd->cmnd[7]; in eata_latency_out()
205 lon = (long *) &cmd->cmnd[6]; in eata_latency_out()
210 lon = (long *) &cmd->cmnd[6]; in eata_latency_out()
218 if (cmd->cmnd[0] == WRITE_6 || cmd->cmnd[0] == WRITE_10 || in eata_latency_out()
219 cmd->cmnd[0] == WRITE_12 || cmd->cmnd[0] == READ_6 || in eata_latency_out()
220 cmd->cmnd[0] == READ_10 || cmd->cmnd[0] == READ_12) { in eata_latency_out()
242 Scsi_Cmnd *cmd; in eata_int_handler() local
270 cmd = ccb->cmd; in eata_int_handler()
271 base = (uint) cmd->host->base; in eata_int_handler()
283 cmd->result = DID_ERROR << 16; in eata_int_handler()
285 cmd->scsi_done(cmd); in eata_int_handler()
293 "\n", cmd->pid); in eata_int_handler()
300 "%#.2x \n", irq, base, cmd->pid, cmd->target, in eata_int_handler()
301 cmd->lun, eata_stat, hba_stat)); in eata_int_handler()
305 if(HD(cmd)->do_latency == TRUE && ccb->timestamp) in eata_int_handler()
306 eata_latency_in(ccb, HD(cmd)); in eata_int_handler()
317 HD(cmd)->HBA_number, cmd->pid)); in eata_int_handler()
320 if (cmd->device->type != TYPE_TAPE) in eata_int_handler()
328 HD(cmd)->HBA_number, cmd->pid)); in eata_int_handler()
334 "returned\n", HD(cmd)->HBA_number)); in eata_int_handler()
338 HD(cmd)->resetlevel[cmd->channel] = 0; in eata_int_handler()
342 HD(cmd)->HBA_number, cmd->pid)); in eata_int_handler()
344 printk(KERN_ERR "scsi%d: SCSI hung\n", HD(cmd)->HBA_number); in eata_int_handler()
349 "Failed\n", HD(cmd)->HBA_number)); in eata_int_handler()
362 cmd->result = result | (scsi_stat << 1); in eata_int_handler()
366 || cmd->scsi_done == NULL || cmd->device->id == 7) in eata_int_handler()
370 cmd->device->channel, cmd->device->id, cmd->device->lun, in eata_int_handler()
371 cmd->pid, eata_stat, hba_stat, scsi_stat, in eata_int_handler()
372 cmd->sense_buffer[2] & 0xf, cmd->result); in eata_int_handler()
377 cmd->scsi_done(cmd); in eata_int_handler()
453 int eata_queue(Scsi_Cmnd * cmd, void (* done) (Scsi_Cmnd *)) in eata_queue() argument
478 hd = HD(cmd); in eata_queue()
479 sh = cmd->host; in eata_queue()
481 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->sense_buffer[0] != 0) { in eata_queue()
483 cmd->result = DID_OK << 16; in eata_queue()
484 done(cmd); in eata_queue()
501 cmd->result = DID_BUS_BUSY << 16; in eata_queue()
504 "returning DID_BUS_BUSY\n", cmd->pid)); in eata_queue()
505 done(cmd); in eata_queue()
518 cmd->pid, cmd->target, cmd->lun, y)); in eata_queue()
522 eata_latency_out(ccb, cmd); in eata_queue()
524 cmd->scsi_done = (void *)done; in eata_queue()
526 switch (cmd->cmnd[0]) { in eata_queue()
548 if (cmd->target == sh->this_id) in eata_queue()
551 if (cmd->use_sg) { in eata_queue()
564 cmd->result = DID_BUS_BUSY << 16; in eata_queue()
566 done(cmd); in eata_queue()
571 ccb->cp_datalen = htonl(cmd->use_sg * sizeof(struct eata_sg_list)); in eata_queue()
572 sl=(struct scatterlist *)cmd->request_buffer; in eata_queue()
573 for(i = 0; i < cmd->use_sg; i++, sl++){ in eata_queue()
579 ccb->cp_datalen = htonl(cmd->request_bufflen); in eata_queue()
580 ccb->cp_dataDMA = htonl(virt_to_bus(cmd->request_buffer)); in eata_queue()
584 ccb->cp_reqDMA = htonl(virt_to_bus(cmd->sense_buffer)); in eata_queue()
585 ccb->reqlen = sizeof(cmd->sense_buffer); in eata_queue()
587 ccb->cp_id = cmd->target; in eata_queue()
588 ccb->cp_channel = cmd->channel; in eata_queue()
589 ccb->cp_lun = cmd->lun; in eata_queue()
592 memcpy(ccb->cp_cdb, cmd->cmnd, cmd->cmd_len); in eata_queue()
598 ccb->cmd = cmd; in eata_queue()
599 cmd->host_scribble = (char *)&hd->ccb[y]; in eata_queue()
602 cmd->result = DID_BUS_BUSY << 16; in eata_queue()
605 "returning DID_BUS_BUSY\n",cmd->target, cmd->pid)); in eata_queue()
607 done(cmd); in eata_queue()
611 "slot %d irq %d\n", (s32)sh->base, cmd->pid, in eata_queue()
612 cmd->target, cmd->lun, y, sh->irq)); in eata_queue()
619 int eata_abort(Scsi_Cmnd * cmd) in eata_abort() argument
630 " reason %x\n", cmd->pid, cmd->target, cmd->lun, in eata_abort()
631 cmd->abort_reason)); in eata_abort()
643 while (inb((u32)(cmd->host->base) + HA_RAUXSTAT) & HA_ABUSY) { in eata_abort()
651 if (CD(cmd)->status == RESET) { in eata_abort()
657 if (CD(cmd)->status == LOCKED) { in eata_abort()
663 if (CD(cmd)->status == USED) { in eata_abort()
668 if (CD(cmd)->status == FREE) { in eata_abort()
677 int eata_reset(Scsi_Cmnd * cmd, unsigned int resetflags) in eata_reset() argument
691 " reason %x\n", cmd->pid, cmd->target, cmd->lun, in eata_reset()
692 cmd->abort_reason)); in eata_reset()
702 if (HD(cmd)->state == RESET) { in eata_reset()
709 while (inb((u32)(cmd->host->base) + HA_RAUXSTAT) & HA_ABUSY) in eata_reset()
717 for (x = 0; x < cmd->host->can_queue; x++) { in eata_reset()
718 if (HD(cmd)->ccb[x].status == FREE) in eata_reset()
721 if (HD(cmd)->ccb[x].status == LOCKED) { in eata_reset()
722 HD(cmd)->ccb[x].status = FREE; in eata_reset()
729 sp = HD(cmd)->ccb[x].cmd; in eata_reset()
730 HD(cmd)->ccb[x].status = RESET; in eata_reset()
739 if (sp == cmd) in eata_reset()
744 inb((u32) (cmd->host->base) + HA_RSTATUS); /* This might cause trouble */ in eata_reset()
745 eata_send_command(0, (u32) cmd->host->base, EATA_CMD_RESET); in eata_reset()
747 HD(cmd)->state = RESET; in eata_reset()
758 for (x = 0; x < cmd->host->can_queue; x++) { in eata_reset()
762 if (HD(cmd)->ccb[x].status != RESET) in eata_reset()
765 sp = HD(cmd)->ccb[x].cmd; in eata_reset()
769 HD(cmd)->ccb[x].status = LOCKED; in eata_reset()
778 HD(cmd)->state = FALSE; in eata_reset()