Lines Matching full:scb
86 static void inia100_scb_handler(struct orc_host *host, struct orc_scb *scb);
272 * orc_exec_scb - Queue an SCB with the HA
273 * @host: host adapter the SCB belongs to
274 * @scb: SCB to queue for execution
277 static void orc_exec_scb(struct orc_host * host, struct orc_scb * scb) in orc_exec_scb() argument
279 scb->status = ORCSCB_POST; in orc_exec_scb()
280 outb(scb->scbidx, host->base + ORC_PQUEUE); in orc_exec_scb()
444 struct orc_scb *scb; in setup_SCBs() local
449 /* Setup SCB base and SCB Size registers */ in setup_SCBs()
451 /* SCB base address 0 */ in setup_SCBs()
453 /* SCB base address 1 */ in setup_SCBs()
457 scb = host->scb_virt; in setup_SCBs()
462 scb->sg_addr = cpu_to_le32((u32) escb_phys); in setup_SCBs()
463 scb->sense_addr = cpu_to_le32((u32) escb_phys); in setup_SCBs()
464 scb->escb = escb; in setup_SCBs()
465 scb->scbidx = i; in setup_SCBs()
466 scb++; in setup_SCBs()
515 setup_SCBs(host); /* Setup SCB base and SCB Size registers */ in init_orchid()
521 setup_SCBs(host); /* Setup SCB base and SCB Size registers */ in init_orchid()
528 setup_SCBs(host); /* Setup SCB base and SCB Size registers */ in init_orchid()
597 struct orc_scb *scb; in orc_device_reset() local
604 scb = (struct orc_scb *) NULL; in orc_device_reset()
614 /* Find the scb corresponding to the command */ in orc_device_reset()
623 printk(KERN_ERR "Unable to Reset - No SCB Found\n"); in orc_device_reset()
628 /* Allocate a new SCB for the reset command to the firmware */ in orc_device_reset()
629 if ((scb = __orc_alloc_scb(host)) == NULL) { in orc_device_reset()
635 /* Reset device is handled by the firmware, we fill in an SCB and in orc_device_reset()
637 scb->opcode = ORC_BUSDEVRST; in orc_device_reset()
638 scb->target = target; in orc_device_reset()
639 scb->hastat = 0; in orc_device_reset()
640 scb->tastat = 0; in orc_device_reset()
641 scb->status = 0x0; in orc_device_reset()
642 scb->link = 0xFF; in orc_device_reset()
643 scb->reserved0 = 0; in orc_device_reset()
644 scb->reserved1 = 0; in orc_device_reset()
645 scb->xferlen = cpu_to_le32(0); in orc_device_reset()
646 scb->sg_len = cpu_to_le32(0); in orc_device_reset()
650 orc_exec_scb(host, scb); /* Start execute SCB */ in orc_device_reset()
656 * __orc_alloc_scb - allocate an SCB
659 * Allocate an SCB and return a pointer to the SCB object. NULL
660 * is returned if no SCB is free. The caller must already hold
689 * orc_alloc_scb - allocate an SCB
692 * Allocate an SCB and return a pointer to the SCB object. NULL
693 * is returned if no SCB is free.
698 struct orc_scb *scb; in orc_alloc_scb() local
702 scb = __orc_alloc_scb(host); in orc_alloc_scb()
704 return scb; in orc_alloc_scb()
708 * orc_release_scb - release an SCB
709 * @host: host owning the SCB
710 * @scb: SCB that is now free
712 * Called to return a completed SCB to the allocation pool. Before
713 * calling the SCB must be out of use on both the host and the HA.
716 static void orc_release_scb(struct orc_host *host, struct orc_scb *scb) in orc_release_scb() argument
723 index = scb->scbidx; in orc_release_scb()
738 static int orchid_abort_scb(struct orc_host * host, struct orc_scb * scb) in orchid_abort_scb() argument
747 outb(scb->scbidx, host->base + ORC_HDATA); /* Write address */ in orchid_abort_scb()
765 struct orc_scb *scb; in inia100_abort_cmd() local
771 scb = host->scb_virt; in inia100_abort_cmd()
773 /* Walk the queue until we find the SCB that belongs to the command in inia100_abort_cmd()
777 for (i = 0; i < ORC_MAXQUEUE; i++, scb++) { in inia100_abort_cmd()
778 escb = scb->escb; in inia100_abort_cmd()
779 if (scb->status && escb->srb == cmd) { in inia100_abort_cmd()
780 if (scb->tag_msg == 0) { in inia100_abort_cmd()
784 if (orchid_abort_scb(host, scb)) { in inia100_abort_cmd()
804 * scb's for processing we pull them off the controller, turn the
805 * index into a host address pointer to the scb and call the scb
814 struct orc_scb *scb; in orc_interrupt() local
816 /* Check if we have an SCB queued for servicing */ in orc_interrupt()
821 /* Get the SCB index of the SCB to service */ in orc_interrupt()
825 …scb = (struct orc_scb *) ((unsigned long) host->scb_virt + (unsigned long) (sizeof(struct orc_scb)… in orc_interrupt()
826 scb->status = 0x0; in orc_interrupt()
827 /* Process the SCB */ in orc_interrupt()
828 inia100_scb_handler(host, scb); in orc_interrupt()
834 * inia100_build_scb - build SCB
836 * @scb: control block to use
842 static int inia100_build_scb(struct orc_host * host, struct orc_scb * scb, struct scsi_cmnd * cmd) in inia100_build_scb() argument
843 { /* Create corresponding SCB */ in inia100_build_scb()
849 /* Links between the escb, scb and Linux scsi midlayer cmd */ in inia100_build_scb()
850 escb = scb->escb; in inia100_build_scb()
854 /* Set up the SCB to do a SCSI command block */ in inia100_build_scb()
855 scb->opcode = ORC_EXECSCSI; in inia100_build_scb()
856 scb->flags = SCF_NO_DCHK; /* Clear done bit */ in inia100_build_scb()
857 scb->target = cmd->device->id; in inia100_build_scb()
858 scb->lun = cmd->device->lun; in inia100_build_scb()
859 scb->reserved0 = 0; in inia100_build_scb()
860 scb->reserved1 = 0; in inia100_build_scb()
861 scb->sg_len = cpu_to_le32(0); in inia100_build_scb()
863 scb->xferlen = cpu_to_le32((u32) scsi_bufflen(cmd)); in inia100_build_scb()
873 scb->sg_len = cpu_to_le32((u32) (count_sg * 8)); in inia100_build_scb()
880 scb->sg_len = cpu_to_le32(0); in inia100_build_scb()
884 scb->sg_addr = (u32) scb->sense_addr; /* sense_addr is already little endian */ in inia100_build_scb()
885 scb->hastat = 0; in inia100_build_scb()
886 scb->tastat = 0; in inia100_build_scb()
887 scb->link = 0xFF; in inia100_build_scb()
888 scb->sense_len = SENSE_SIZE; in inia100_build_scb()
889 scb->cdb_len = cmd->cmd_len; in inia100_build_scb()
890 if (scb->cdb_len >= IMAX_CDB) { in inia100_build_scb()
892 scb->cdb_len = IMAX_CDB; in inia100_build_scb()
894 scb->ident = (u8)(cmd->device->lun & 0xff) | DISC_ALLOW; in inia100_build_scb()
896 scb->tag_msg = SIMPLE_QUEUE_TAG; /* Do simple tag only */ in inia100_build_scb()
898 scb->tag_msg = 0; /* No tag support */ in inia100_build_scb()
900 memcpy(scb->cdb, cmd->cmnd, scb->cdb_len); in inia100_build_scb()
909 * block, build the host specific scb structures and if there is room
914 struct orc_scb *scb; in inia100_queue_lck() local
919 if ((scb = orc_alloc_scb(host)) == NULL) in inia100_queue_lck()
922 if (inia100_build_scb(host, scb, cmd)) { in inia100_queue_lck()
923 orc_release_scb(host, scb); in inia100_queue_lck()
926 orc_exec_scb(host, scb); /* Start execute SCB */ in inia100_queue_lck()
981 * @scb: SCB the controller returned as needing processing
985 * the complete with the midlayer and recycle the scb.
988 static void inia100_scb_handler(struct orc_host *host, struct orc_scb *scb) in inia100_scb_handler() argument
993 escb = scb->escb; in inia100_scb_handler()
996 orc_release_scb(host, scb); /* Release SCB for current channel */ in inia100_scb_handler()
1001 switch (scb->hastat) { in inia100_scb_handler()
1005 scb->hastat = 0; in inia100_scb_handler()
1010 scb->hastat = DID_TIME_OUT; in inia100_scb_handler()
1017 scb->hastat = DID_RESET; in inia100_scb_handler()
1020 case 0x1a: /* SCB Aborted. 07/21/98 */ in inia100_scb_handler()
1021 scb->hastat = DID_ABORT; in inia100_scb_handler()
1031 printk(KERN_DEBUG "inia100: %x %x\n", scb->hastat, scb->tastat); in inia100_scb_handler()
1032 scb->hastat = DID_ERROR; /* Couldn't find any better */ in inia100_scb_handler()
1036 if (scb->tastat == 2) { /* Check condition */ in inia100_scb_handler()
1040 cmd->result = scb->tastat | (scb->hastat << 16); in inia100_scb_handler()
1043 orc_release_scb(host, scb); /* Release SCB for current channel */ in inia100_scb_handler()
1119 /* Get total memory needed for SCB */ in inia100_probe_one()
1124 printk("inia100: SCB memory allocation error\n"); in inia100_probe_one()