• Home
  • Raw
  • Download

Lines Matching refs:sh

207 static int aha1542_test_port(struct Scsi_Host *sh)  in aha1542_test_port()  argument
212 if (inb(STATUS(sh->io_port)) == 0xff) in aha1542_test_port()
218 aha1542_intr_reset(sh->io_port); /* reset interrupts, so they don't block */ in aha1542_test_port()
220 outb(SRST | IRST /*|SCRST */ , CONTROL(sh->io_port)); in aha1542_test_port()
225 if (!wait_mask(STATUS(sh->io_port), STATMASK, INIT | IDLE, STST | DIAGF | INVDCMD | DF | CDF, 0)) in aha1542_test_port()
229 if (inb(INTRFLAGS(sh->io_port)) & INTRMASK) in aha1542_test_port()
237 aha1542_outb(sh->io_port, CMD_INQUIRY); in aha1542_test_port()
240 if (!wait_mask(STATUS(sh->io_port), DF, DF, 0, 0)) in aha1542_test_port()
242 (void)inb(DATA(sh->io_port)); in aha1542_test_port()
246 if (inb(STATUS(sh->io_port)) & DF) in aha1542_test_port()
250 if (!wait_mask(INTRFLAGS(sh->io_port), HACC, HACC, 0, 0)) in aha1542_test_port()
254 outb(IRST, CONTROL(sh->io_port)); in aha1542_test_port()
280 struct Scsi_Host *sh = dev_id; in aha1542_interrupt() local
281 struct aha1542_hostdata *aha1542 = shost_priv(sh); in aha1542_interrupt()
292 flag = inb(INTRFLAGS(sh->io_port)); in aha1542_interrupt()
293 shost_printk(KERN_DEBUG, sh, "aha1542_intr_handle: "); in aha1542_interrupt()
304 printk("status %02x\n", inb(STATUS(sh->io_port))); in aha1542_interrupt()
309 spin_lock_irqsave(sh->host_lock, flags); in aha1542_interrupt()
311 flag = inb(INTRFLAGS(sh->io_port)); in aha1542_interrupt()
327 aha1542_intr_reset(sh->io_port); in aha1542_interrupt()
342 spin_unlock_irqrestore(sh->host_lock, flags); in aha1542_interrupt()
345 shost_printk(KERN_WARNING, sh, "interrupt received, but no mail.\n"); in aha1542_interrupt()
356 shost_printk(KERN_DEBUG, sh, "aha1542_command: returning %x (status %d)\n", in aha1542_interrupt()
364 shost_printk(KERN_DEBUG, sh, "...done %d %d\n", mbo, mbi); in aha1542_interrupt()
370 spin_unlock_irqrestore(sh->host_lock, flags); in aha1542_interrupt()
371 shost_printk(KERN_WARNING, sh, "Unexpected interrupt\n"); in aha1542_interrupt()
372 shost_printk(KERN_WARNING, sh, "tarstat=%x, hastat=%x idlun=%x ccb#=%d\n", ccb[mbo].tarstat, in aha1542_interrupt()
398 shost_printk(KERN_DEBUG, sh, "(aha1542 error:%x %x %x) ", errstatus, in aha1542_interrupt()
414 static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd) in aha1542_queuecommand() argument
417 struct aha1542_hostdata *aha1542 = shost_priv(sh); in aha1542_queuecommand()
440 shost_printk(KERN_DEBUG, sh, "aha1542_queuecommand: dev %d cmd %02x pos %d len %d", in aha1542_queuecommand()
463 spin_lock_irqsave(sh->host_lock, flags); in aha1542_queuecommand()
486 shost_printk(KERN_DEBUG, sh, "Sending command (%d)...", mbo); in aha1542_queuecommand()
520 spin_unlock_irqrestore(sh->host_lock, flags); in aha1542_queuecommand()
526 static void setup_mailboxes(struct Scsi_Host *sh) in setup_mailboxes() argument
528 struct aha1542_hostdata *aha1542 = shost_priv(sh); in setup_mailboxes()
538 aha1542_intr_reset(sh->io_port); /* reset interrupts, so they don't block */ in setup_mailboxes()
540 if (aha1542_out(sh->io_port, mb_cmd, 5)) in setup_mailboxes()
541 shost_printk(KERN_ERR, sh, "failed setting up mailboxes\n"); in setup_mailboxes()
542 aha1542_intr_reset(sh->io_port); in setup_mailboxes()
545 static int aha1542_getconfig(struct Scsi_Host *sh) in aha1542_getconfig() argument
549 i = inb(STATUS(sh->io_port)); in aha1542_getconfig()
551 i = inb(DATA(sh->io_port)); in aha1542_getconfig()
553 aha1542_outb(sh->io_port, CMD_RETCONF); in aha1542_getconfig()
554 aha1542_in(sh->io_port, inquiry_result, 3, 0); in aha1542_getconfig()
555 if (!wait_mask(INTRFLAGS(sh->io_port), INTRMASK, HACC, 0, 0)) in aha1542_getconfig()
556 shost_printk(KERN_ERR, sh, "error querying board settings\n"); in aha1542_getconfig()
557 aha1542_intr_reset(sh->io_port); in aha1542_getconfig()
560 sh->dma_channel = 7; in aha1542_getconfig()
563 sh->dma_channel = 6; in aha1542_getconfig()
566 sh->dma_channel = 5; in aha1542_getconfig()
569 sh->dma_channel = 0; in aha1542_getconfig()
576 sh->dma_channel = 0xFF; in aha1542_getconfig()
579 shost_printk(KERN_ERR, sh, "Unable to determine DMA channel.\n"); in aha1542_getconfig()
584 sh->irq = 15; in aha1542_getconfig()
587 sh->irq = 14; in aha1542_getconfig()
590 sh->irq = 12; in aha1542_getconfig()
593 sh->irq = 11; in aha1542_getconfig()
596 sh->irq = 10; in aha1542_getconfig()
599 sh->irq = 9; in aha1542_getconfig()
602 shost_printk(KERN_ERR, sh, "Unable to determine IRQ level.\n"); in aha1542_getconfig()
605 sh->this_id = inquiry_result[2] & 7; in aha1542_getconfig()
614 static int aha1542_mbenable(struct Scsi_Host *sh) in aha1542_mbenable() argument
622 aha1542_outb(sh->io_port, CMD_EXTBIOS); in aha1542_mbenable()
623 if (aha1542_in(sh->io_port, mbenable_result, 2, 100)) in aha1542_mbenable()
625 if (!wait_mask(INTRFLAGS(sh->io_port), INTRMASK, HACC, 0, 100)) in aha1542_mbenable()
627 aha1542_intr_reset(sh->io_port); in aha1542_mbenable()
637 if (aha1542_out(sh->io_port, mbenable_cmd, 3)) in aha1542_mbenable()
642 shost_printk(KERN_ERR, sh, "Mailbox init failed\n"); in aha1542_mbenable()
644 aha1542_intr_reset(sh->io_port); in aha1542_mbenable()
649 static int aha1542_query(struct Scsi_Host *sh) in aha1542_query() argument
651 struct aha1542_hostdata *aha1542 = shost_priv(sh); in aha1542_query()
654 i = inb(STATUS(sh->io_port)); in aha1542_query()
656 i = inb(DATA(sh->io_port)); in aha1542_query()
658 aha1542_outb(sh->io_port, CMD_INQUIRY); in aha1542_query()
659 aha1542_in(sh->io_port, inquiry_result, 4, 0); in aha1542_query()
660 if (!wait_mask(INTRFLAGS(sh->io_port), INTRMASK, HACC, 0, 0)) in aha1542_query()
661 shost_printk(KERN_ERR, sh, "error querying card type\n"); in aha1542_query()
662 aha1542_intr_reset(sh->io_port); in aha1542_query()
674 …shost_printk(KERN_INFO, sh, "Emulation mode not supported for AHA-1740 hardware, use aha1740 drive… in aha1542_query()
683 aha1542->bios_translation = aha1542_mbenable(sh); in aha1542_query()
707 static void aha1542_set_bus_times(struct Scsi_Host *sh, int bus_on, int bus_off, int dma_speed) in aha1542_set_bus_times() argument
712 aha1542_intr_reset(sh->io_port); in aha1542_set_bus_times()
713 if (aha1542_out(sh->io_port, oncmd, 2)) in aha1542_set_bus_times()
720 aha1542_intr_reset(sh->io_port); in aha1542_set_bus_times()
721 if (aha1542_out(sh->io_port, offcmd, 2)) in aha1542_set_bus_times()
728 aha1542_intr_reset(sh->io_port); in aha1542_set_bus_times()
729 if (aha1542_out(sh->io_port, dmacmd, 2)) in aha1542_set_bus_times()
732 aha1542_intr_reset(sh->io_port); in aha1542_set_bus_times()
735 shost_printk(KERN_ERR, sh, "setting bus on/off-time failed\n"); in aha1542_set_bus_times()
736 aha1542_intr_reset(sh->io_port); in aha1542_set_bus_times()
744 struct Scsi_Host *sh; in aha1542_hw_init() local
754 sh = scsi_host_alloc(tpnt, sizeof(struct aha1542_hostdata)); in aha1542_hw_init()
755 if (!sh) in aha1542_hw_init()
757 aha1542 = shost_priv(sh); in aha1542_hw_init()
759 sh->unique_id = base_io; in aha1542_hw_init()
760 sh->io_port = base_io; in aha1542_hw_init()
761 sh->n_io_port = AHA1542_REGION_SIZE; in aha1542_hw_init()
765 if (!aha1542_test_port(sh)) in aha1542_hw_init()
768 aha1542_set_bus_times(sh, bus_on[indx], bus_off[indx], dma_speed[indx]); in aha1542_hw_init()
769 if (aha1542_query(sh)) in aha1542_hw_init()
771 if (aha1542_getconfig(sh) == -1) in aha1542_hw_init()
774 if (sh->dma_channel != 0xFF) in aha1542_hw_init()
775 snprintf(dma_info, sizeof(dma_info), "DMA %d", sh->dma_channel); in aha1542_hw_init()
776 shost_printk(KERN_INFO, sh, "Adaptec AHA-1542 (SCSI-ID %d) at IO 0x%x, IRQ %d, %s\n", in aha1542_hw_init()
777 sh->this_id, base_io, sh->irq, dma_info); in aha1542_hw_init()
779 shost_printk(KERN_INFO, sh, "Using extended bios translation\n"); in aha1542_hw_init()
796 setup_mailboxes(sh); in aha1542_hw_init()
798 if (request_irq(sh->irq, aha1542_interrupt, 0, "aha1542", sh)) { in aha1542_hw_init()
799 shost_printk(KERN_ERR, sh, "Unable to allocate IRQ.\n"); in aha1542_hw_init()
802 if (sh->dma_channel != 0xFF) { in aha1542_hw_init()
803 if (request_dma(sh->dma_channel, "aha1542")) { in aha1542_hw_init()
804 shost_printk(KERN_ERR, sh, "Unable to allocate DMA channel.\n"); in aha1542_hw_init()
807 if (sh->dma_channel == 0 || sh->dma_channel >= 5) { in aha1542_hw_init()
808 set_dma_mode(sh->dma_channel, DMA_MODE_CASCADE); in aha1542_hw_init()
809 enable_dma(sh->dma_channel); in aha1542_hw_init()
813 if (scsi_add_host(sh, pdev)) in aha1542_hw_init()
816 scsi_scan_host(sh); in aha1542_hw_init()
818 return sh; in aha1542_hw_init()
821 if (sh->dma_channel != 0xff) in aha1542_hw_init()
822 free_dma(sh->dma_channel); in aha1542_hw_init()
824 free_irq(sh->irq, sh); in aha1542_hw_init()
832 scsi_host_put(sh); in aha1542_hw_init()
839 static int aha1542_release(struct Scsi_Host *sh) in aha1542_release() argument
841 struct aha1542_hostdata *aha1542 = shost_priv(sh); in aha1542_release()
842 struct device *dev = sh->dma_dev; in aha1542_release()
844 scsi_remove_host(sh); in aha1542_release()
845 if (sh->dma_channel != 0xff) in aha1542_release()
846 free_dma(sh->dma_channel); in aha1542_release()
851 if (sh->irq) in aha1542_release()
852 free_irq(sh->irq, sh); in aha1542_release()
853 if (sh->io_port && sh->n_io_port) in aha1542_release()
854 release_region(sh->io_port, sh->n_io_port); in aha1542_release()
855 scsi_host_put(sh); in aha1542_release()
866 struct Scsi_Host *sh = cmd->device->host; in aha1542_dev_reset() local
867 struct aha1542_hostdata *aha1542 = shost_priv(sh); in aha1542_dev_reset()
875 spin_lock_irqsave(sh->host_lock, flags); in aha1542_dev_reset()
914 aha1542_outb(sh->io_port, CMD_START_SCSI); in aha1542_dev_reset()
915 spin_unlock_irqrestore(sh->host_lock, flags); in aha1542_dev_reset()
925 struct Scsi_Host *sh = cmd->device->host; in aha1542_reset() local
926 struct aha1542_hostdata *aha1542 = shost_priv(sh); in aha1542_reset()
930 spin_lock_irqsave(sh->host_lock, flags); in aha1542_reset()
941 spin_unlock_irqrestore(sh->host_lock, flags); in aha1542_reset()
980 spin_unlock_irqrestore(sh->host_lock, flags); in aha1542_reset()
1055 struct Scsi_Host *sh = aha1542_hw_init(&driver_template, pdev, ndev); in aha1542_isa_match() local
1057 if (!sh) in aha1542_isa_match()
1060 dev_set_drvdata(pdev, sh); in aha1542_isa_match()
1090 struct Scsi_Host *sh; in aha1542_pnp_probe() local
1109 sh = aha1542_hw_init(&driver_template, &pdev->dev, indx); in aha1542_pnp_probe()
1110 if (!sh) in aha1542_pnp_probe()
1113 pnp_set_drvdata(pdev, sh); in aha1542_pnp_probe()