• Home
  • Raw
  • Download

Lines Matching +full:ext +full:- +full:gen

7  * Copyright (C) 1995-06 ICP vortex GmbH, Achim Leubner                 *
8 * Copyright (C) 2002-04 Intel Corporation *
9 * Copyright (C) 2003-06 Adaptec Inc. *
52 * h- controller no., b- channel no.,
53 * t- target ID, l- LUN
56 * max_ids:x x - target ID count per channel (1..MAXID)
59 * hdr_channel:x x - number of virtual bus for host drives
121 #include <linux/dma-mapping.h>
284 #define GDTOFFSOF(a,b) (size_t)&(((a*)0)->b)
287 #define BUS_L2P(a,b) ((b)>(a)->virt_bus ? (b-1):(b))
387 if (hanum == ha->hanum) in gdth_find_ha()
399 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_get_cmndinfo()
402 if (ha->cmndinfo[i].index == 0) { in gdth_get_cmndinfo()
403 priv = &ha->cmndinfo[i]; in gdth_get_cmndinfo()
405 priv->index = i+1; in gdth_get_cmndinfo()
410 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_get_cmndinfo()
418 priv->index = 0; in gdth_put_cmndinfo()
433 int internal_command = cmndinfo->internal_command; in gdth_scsi_done()
438 scp->host_scribble = NULL; in gdth_scsi_done()
441 complete((struct completion *)scp->request); in gdth_scsi_done()
443 scp->scsi_done(scp); in gdth_scsi_done()
449 gdth_ha_str *ha = shost_priv(sdev->host); in __gdth_execute()
457 return -ENOMEM; in __gdth_execute()
459 scp->sense_buffer = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); in __gdth_execute()
460 if (!scp->sense_buffer) { in __gdth_execute()
462 return -ENOMEM; in __gdth_execute()
465 scp->device = sdev; in __gdth_execute()
469 scp->request = (struct request *)&wait; in __gdth_execute()
470 scp->cmd_len = 12; in __gdth_execute()
471 scp->cmnd = cmnd; in __gdth_execute()
476 TRACE(("__gdth_execute() cmd 0x%x\n", scp->cmnd[0])); in __gdth_execute()
484 kfree(scp->sense_buffer); in __gdth_execute()
598 list_del(&ha->list); in gdth_pci_remove_one()
607 u16 vendor = pdev->vendor; in gdth_pci_init_one()
608 u16 device = pdev->device; in gdth_pci_init_one()
620 return -ENODEV; in gdth_pci_init_one()
627 return -EBUSY; in gdth_pci_init_one()
637 return -ENODEV; in gdth_pci_init_one()
643 return -ENODEV; in gdth_pci_init_one()
648 gdth_pcistr.pdev->bus->number, in gdth_pci_init_one()
649 PCI_SLOT(gdth_pcistr.pdev->devfn), in gdth_pci_init_one()
678 if (--retries == 0) { in gdth_init_eisa()
679 printk("GDT-EISA: Initialization error (DEINIT failed)\n"); in gdth_init_eisa()
688 printk("GDT-EISA: Illegal protocol version\n"); in gdth_init_eisa()
691 ha->bmic = eisa_adr; in gdth_init_eisa()
692 ha->brd_phys = (u32)eisa_adr >> 12; in gdth_init_eisa()
701 ha->oem_id = OEM_ID_ICP; in gdth_init_eisa()
702 ha->type = GDT_EISA; in gdth_init_eisa()
703 ha->stype = id; in gdth_init_eisa()
709 if (--retries == 0) { in gdth_init_eisa()
710 printk("GDT-EISA: Initialization error (get IRQ failed)\n"); in gdth_init_eisa()
715 ha->irq = inb(eisa_adr+MAILBOXREG); in gdth_init_eisa()
717 TRACE2(("GDT3000/3020: IRQ=%d\n",ha->irq)); in gdth_init_eisa()
719 if (ha->irq == 0) { in gdth_init_eisa()
729 ha->irq = irq[i]; in gdth_init_eisa()
731 printk("GDT-EISA: Can not detect controller IRQ,\n"); in gdth_init_eisa()
733 ha->irq); in gdth_init_eisa()
735 printk("GDT-EISA: Initialization error (unknown IRQ), Enable\n"); in gdth_init_eisa()
743 eisacf -= 4; in gdth_init_eisa()
744 ha->irq = gdth_irq_tab[eisacf]; in gdth_init_eisa()
745 ha->oem_id = OEM_ID_ICP; in gdth_init_eisa()
746 ha->type = GDT_EISA; in gdth_init_eisa()
747 ha->stype = id; in gdth_init_eisa()
750 ha->dma64_support = 0; in gdth_init_eisa()
765 ha->brd = ioremap(bios_adr, sizeof(gdt2_dpram_str)); in gdth_init_isa()
766 if (ha->brd == NULL) { in gdth_init_isa()
767 printk("GDT-ISA: Initialization error (DPMEM remap error)\n"); in gdth_init_isa()
770 dp2_ptr = ha->brd; in gdth_init_isa()
771 writeb(1, &dp2_ptr->io.memlock); /* switch off write protection */ in gdth_init_isa()
773 memset_io(&dp2_ptr->u, 0, sizeof(dp2_ptr->u)); in gdth_init_isa()
774 if (readl(&dp2_ptr->u) != 0) { in gdth_init_isa()
775 printk("GDT-ISA: Initialization error (DPMEM write error)\n"); in gdth_init_isa()
776 iounmap(ha->brd); in gdth_init_isa()
781 writeb(0xff, &dp2_ptr->io.irqdel); in gdth_init_isa()
782 writeb(0x00, &dp2_ptr->io.irqen); in gdth_init_isa()
783 writeb(0x00, &dp2_ptr->u.ic.S_Status); in gdth_init_isa()
784 writeb(0x00, &dp2_ptr->u.ic.Cmd_Index); in gdth_init_isa()
786 irq_drq = readb(&dp2_ptr->io.rq); in gdth_init_isa()
792 ha->drq = gdth_drq_tab[i]; in gdth_init_isa()
794 irq_drq = readb(&dp2_ptr->io.rq) >> 3; in gdth_init_isa()
800 ha->irq = gdth_irq_tab[i]; in gdth_init_isa()
803 writel(bios_adr, &dp2_ptr->u.ic.S_Info[0]); in gdth_init_isa()
804 writeb(0xff, &dp2_ptr->u.ic.S_Cmd_Indx); in gdth_init_isa()
805 writeb(0, &dp2_ptr->io.event); in gdth_init_isa()
808 while (readb(&dp2_ptr->u.ic.S_Status) != 0xff) { in gdth_init_isa()
809 if (--retries == 0) { in gdth_init_isa()
810 printk("GDT-ISA: Initialization error (DEINIT failed)\n"); in gdth_init_isa()
811 iounmap(ha->brd); in gdth_init_isa()
816 prot_ver = (u8)readl(&dp2_ptr->u.ic.S_Info[0]); in gdth_init_isa()
817 writeb(0, &dp2_ptr->u.ic.Status); in gdth_init_isa()
818 writeb(0xff, &dp2_ptr->io.irqdel); in gdth_init_isa()
820 printk("GDT-ISA: Illegal protocol version\n"); in gdth_init_isa()
821 iounmap(ha->brd); in gdth_init_isa()
825 ha->oem_id = OEM_ID_ICP; in gdth_init_isa()
826 ha->type = GDT_ISA; in gdth_init_isa()
827 ha->ic_all_size = sizeof(dp2_ptr->u); in gdth_init_isa()
828 ha->stype= GDT2_ID; in gdth_init_isa()
829 ha->brd_phys = bios_adr >> 4; in gdth_init_isa()
832 writel(0x00, &dp2_ptr->u.ic.S_Info[0]); in gdth_init_isa()
833 writel(0x00, &dp2_ptr->u.ic.S_Info[1]); in gdth_init_isa()
834 writel(0x01, &dp2_ptr->u.ic.S_Info[2]); in gdth_init_isa()
835 writel(0x00, &dp2_ptr->u.ic.S_Info[3]); in gdth_init_isa()
836 writeb(0xfe, &dp2_ptr->u.ic.S_Cmd_Indx); in gdth_init_isa()
837 writeb(0, &dp2_ptr->io.event); in gdth_init_isa()
840 while (readb(&dp2_ptr->u.ic.S_Status) != 0xfe) { in gdth_init_isa()
841 if (--retries == 0) { in gdth_init_isa()
842 printk("GDT-ISA: Initialization error\n"); in gdth_init_isa()
843 iounmap(ha->brd); in gdth_init_isa()
848 writeb(0, &dp2_ptr->u.ic.Status); in gdth_init_isa()
849 writeb(0xff, &dp2_ptr->io.irqdel); in gdth_init_isa()
851 ha->dma64_support = 0; in gdth_init_isa()
870 if (pdev->vendor == PCI_VENDOR_ID_INTEL) in gdth_init_pci()
871 ha->oem_id = OEM_ID_INTEL; in gdth_init_pci()
873 ha->oem_id = OEM_ID_ICP; in gdth_init_pci()
874 ha->brd_phys = (pdev->bus->number << 8) | (pdev->devfn & 0xf8); in gdth_init_pci()
875 ha->stype = (u32)pdev->device; in gdth_init_pci()
876 ha->irq = pdev->irq; in gdth_init_pci()
877 ha->pdev = pdev; in gdth_init_pci()
879 if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */ in gdth_init_pci()
880 TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); in gdth_init_pci()
881 ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str)); in gdth_init_pci()
882 if (ha->brd == NULL) { in gdth_init_pci()
883 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); in gdth_init_pci()
887 dp6_ptr = ha->brd; in gdth_init_pci()
888 writel(DPMEM_MAGIC, &dp6_ptr->u); in gdth_init_pci()
889 if (readl(&dp6_ptr->u) != DPMEM_MAGIC) { in gdth_init_pci()
890 printk("GDT-PCI: Cannot access DPMEM at 0x%lx (shadowed?)\n", in gdth_init_pci()
891 pcistr->dpmem); in gdth_init_pci()
894 iounmap(ha->brd); in gdth_init_pci()
895 ha->brd = ioremap(i, sizeof(u16)); in gdth_init_pci()
896 if (ha->brd == NULL) { in gdth_init_pci()
897 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); in gdth_init_pci()
900 if (readw(ha->brd) != 0xffff) { in gdth_init_pci()
904 iounmap(ha->brd); in gdth_init_pci()
906 ha->brd = ioremap(i, sizeof(gdt6_dpram_str)); in gdth_init_pci()
907 if (ha->brd == NULL) { in gdth_init_pci()
908 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); in gdth_init_pci()
911 dp6_ptr = ha->brd; in gdth_init_pci()
912 writel(DPMEM_MAGIC, &dp6_ptr->u); in gdth_init_pci()
913 if (readl(&dp6_ptr->u) == DPMEM_MAGIC) { in gdth_init_pci()
914 printk("GDT-PCI: Use free address at 0x%x\n", i); in gdth_init_pci()
920 printk("GDT-PCI: No free address found!\n"); in gdth_init_pci()
921 iounmap(ha->brd); in gdth_init_pci()
925 memset_io(&dp6_ptr->u, 0, sizeof(dp6_ptr->u)); in gdth_init_pci()
926 if (readl(&dp6_ptr->u) != 0) { in gdth_init_pci()
927 printk("GDT-PCI: Initialization error (DPMEM write error)\n"); in gdth_init_pci()
928 iounmap(ha->brd); in gdth_init_pci()
933 writeb(0xff, &dp6_ptr->io.irqdel); in gdth_init_pci()
934 writeb(0x00, &dp6_ptr->io.irqen); in gdth_init_pci()
935 writeb(0x00, &dp6_ptr->u.ic.S_Status); in gdth_init_pci()
936 writeb(0x00, &dp6_ptr->u.ic.Cmd_Index); in gdth_init_pci()
938 writel(pcistr->dpmem, &dp6_ptr->u.ic.S_Info[0]); in gdth_init_pci()
939 writeb(0xff, &dp6_ptr->u.ic.S_Cmd_Indx); in gdth_init_pci()
940 writeb(0, &dp6_ptr->io.event); in gdth_init_pci()
943 while (readb(&dp6_ptr->u.ic.S_Status) != 0xff) { in gdth_init_pci()
944 if (--retries == 0) { in gdth_init_pci()
945 printk("GDT-PCI: Initialization error (DEINIT failed)\n"); in gdth_init_pci()
946 iounmap(ha->brd); in gdth_init_pci()
951 prot_ver = (u8)readl(&dp6_ptr->u.ic.S_Info[0]); in gdth_init_pci()
952 writeb(0, &dp6_ptr->u.ic.S_Status); in gdth_init_pci()
953 writeb(0xff, &dp6_ptr->io.irqdel); in gdth_init_pci()
955 printk("GDT-PCI: Illegal protocol version\n"); in gdth_init_pci()
956 iounmap(ha->brd); in gdth_init_pci()
960 ha->type = GDT_PCI; in gdth_init_pci()
961 ha->ic_all_size = sizeof(dp6_ptr->u); in gdth_init_pci()
964 writel(0x00, &dp6_ptr->u.ic.S_Info[0]); in gdth_init_pci()
965 writel(0x00, &dp6_ptr->u.ic.S_Info[1]); in gdth_init_pci()
966 writel(0x00, &dp6_ptr->u.ic.S_Info[2]); in gdth_init_pci()
967 writel(0x00, &dp6_ptr->u.ic.S_Info[3]); in gdth_init_pci()
968 writeb(0xfe, &dp6_ptr->u.ic.S_Cmd_Indx); in gdth_init_pci()
969 writeb(0, &dp6_ptr->io.event); in gdth_init_pci()
972 while (readb(&dp6_ptr->u.ic.S_Status) != 0xfe) { in gdth_init_pci()
973 if (--retries == 0) { in gdth_init_pci()
974 printk("GDT-PCI: Initialization error\n"); in gdth_init_pci()
975 iounmap(ha->brd); in gdth_init_pci()
980 writeb(0, &dp6_ptr->u.ic.S_Status); in gdth_init_pci()
981 writeb(0xff, &dp6_ptr->io.irqdel); in gdth_init_pci()
983 ha->dma64_support = 0; in gdth_init_pci()
985 } else if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */ in gdth_init_pci()
986 ha->plx = (gdt6c_plx_regs *)pcistr->io; in gdth_init_pci()
988 pcistr->dpmem,ha->irq)); in gdth_init_pci()
989 ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6c_dpram_str)); in gdth_init_pci()
990 if (ha->brd == NULL) { in gdth_init_pci()
991 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); in gdth_init_pci()
992 iounmap(ha->brd); in gdth_init_pci()
996 dp6c_ptr = ha->brd; in gdth_init_pci()
997 writel(DPMEM_MAGIC, &dp6c_ptr->u); in gdth_init_pci()
998 if (readl(&dp6c_ptr->u) != DPMEM_MAGIC) { in gdth_init_pci()
999 printk("GDT-PCI: Cannot access DPMEM at 0x%lx (shadowed?)\n", in gdth_init_pci()
1000 pcistr->dpmem); in gdth_init_pci()
1003 iounmap(ha->brd); in gdth_init_pci()
1004 ha->brd = ioremap(i, sizeof(u16)); in gdth_init_pci()
1005 if (ha->brd == NULL) { in gdth_init_pci()
1006 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); in gdth_init_pci()
1009 if (readw(ha->brd) != 0xffff) { in gdth_init_pci()
1013 iounmap(ha->brd); in gdth_init_pci()
1015 ha->brd = ioremap(i, sizeof(gdt6c_dpram_str)); in gdth_init_pci()
1016 if (ha->brd == NULL) { in gdth_init_pci()
1017 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); in gdth_init_pci()
1020 dp6c_ptr = ha->brd; in gdth_init_pci()
1021 writel(DPMEM_MAGIC, &dp6c_ptr->u); in gdth_init_pci()
1022 if (readl(&dp6c_ptr->u) == DPMEM_MAGIC) { in gdth_init_pci()
1023 printk("GDT-PCI: Use free address at 0x%x\n", i); in gdth_init_pci()
1029 printk("GDT-PCI: No free address found!\n"); in gdth_init_pci()
1030 iounmap(ha->brd); in gdth_init_pci()
1034 memset_io(&dp6c_ptr->u, 0, sizeof(dp6c_ptr->u)); in gdth_init_pci()
1035 if (readl(&dp6c_ptr->u) != 0) { in gdth_init_pci()
1036 printk("GDT-PCI: Initialization error (DPMEM write error)\n"); in gdth_init_pci()
1037 iounmap(ha->brd); in gdth_init_pci()
1042 outb(0x00,PTR2USHORT(&ha->plx->control1)); in gdth_init_pci()
1043 outb(0xff,PTR2USHORT(&ha->plx->edoor_reg)); in gdth_init_pci()
1045 writeb(0x00, &dp6c_ptr->u.ic.S_Status); in gdth_init_pci()
1046 writeb(0x00, &dp6c_ptr->u.ic.Cmd_Index); in gdth_init_pci()
1048 writel(pcistr->dpmem, &dp6c_ptr->u.ic.S_Info[0]); in gdth_init_pci()
1049 writeb(0xff, &dp6c_ptr->u.ic.S_Cmd_Indx); in gdth_init_pci()
1051 outb(1,PTR2USHORT(&ha->plx->ldoor_reg)); in gdth_init_pci()
1055 while (readb(&dp6c_ptr->u.ic.S_Status) != 0xff) { in gdth_init_pci()
1056 if (--retries == 0) { in gdth_init_pci()
1057 printk("GDT-PCI: Initialization error (DEINIT failed)\n"); in gdth_init_pci()
1058 iounmap(ha->brd); in gdth_init_pci()
1063 prot_ver = (u8)readl(&dp6c_ptr->u.ic.S_Info[0]); in gdth_init_pci()
1064 writeb(0, &dp6c_ptr->u.ic.Status); in gdth_init_pci()
1066 printk("GDT-PCI: Illegal protocol version\n"); in gdth_init_pci()
1067 iounmap(ha->brd); in gdth_init_pci()
1071 ha->type = GDT_PCINEW; in gdth_init_pci()
1072 ha->ic_all_size = sizeof(dp6c_ptr->u); in gdth_init_pci()
1075 writel(0x00, &dp6c_ptr->u.ic.S_Info[0]); in gdth_init_pci()
1076 writel(0x00, &dp6c_ptr->u.ic.S_Info[1]); in gdth_init_pci()
1077 writel(0x00, &dp6c_ptr->u.ic.S_Info[2]); in gdth_init_pci()
1078 writel(0x00, &dp6c_ptr->u.ic.S_Info[3]); in gdth_init_pci()
1079 writeb(0xfe, &dp6c_ptr->u.ic.S_Cmd_Indx); in gdth_init_pci()
1081 outb(1,PTR2USHORT(&ha->plx->ldoor_reg)); in gdth_init_pci()
1085 while (readb(&dp6c_ptr->u.ic.S_Status) != 0xfe) { in gdth_init_pci()
1086 if (--retries == 0) { in gdth_init_pci()
1087 printk("GDT-PCI: Initialization error\n"); in gdth_init_pci()
1088 iounmap(ha->brd); in gdth_init_pci()
1093 writeb(0, &dp6c_ptr->u.ic.S_Status); in gdth_init_pci()
1095 ha->dma64_support = 0; in gdth_init_pci()
1098 TRACE2(("init_pci_mpr() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); in gdth_init_pci()
1099 ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6m_dpram_str)); in gdth_init_pci()
1100 if (ha->brd == NULL) { in gdth_init_pci()
1101 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); in gdth_init_pci()
1111 dp6m_ptr = ha->brd; in gdth_init_pci()
1115 while( ((int)readb(&dp6m_ptr->i960r.sema0_reg) ) & 3 ) in gdth_init_pci()
1119 writel(DPMEM_MAGIC, &dp6m_ptr->u); in gdth_init_pci()
1120 if (readl(&dp6m_ptr->u) != DPMEM_MAGIC) { in gdth_init_pci()
1121 printk("GDT-PCI: Cannot access DPMEM at 0x%lx (shadowed?)\n", in gdth_init_pci()
1122 pcistr->dpmem); in gdth_init_pci()
1125 iounmap(ha->brd); in gdth_init_pci()
1126 ha->brd = ioremap(i, sizeof(u16)); in gdth_init_pci()
1127 if (ha->brd == NULL) { in gdth_init_pci()
1128 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); in gdth_init_pci()
1131 if (readw(ha->brd) != 0xffff) { in gdth_init_pci()
1135 iounmap(ha->brd); in gdth_init_pci()
1137 ha->brd = ioremap(i, sizeof(gdt6m_dpram_str)); in gdth_init_pci()
1138 if (ha->brd == NULL) { in gdth_init_pci()
1139 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); in gdth_init_pci()
1142 dp6m_ptr = ha->brd; in gdth_init_pci()
1143 writel(DPMEM_MAGIC, &dp6m_ptr->u); in gdth_init_pci()
1144 if (readl(&dp6m_ptr->u) == DPMEM_MAGIC) { in gdth_init_pci()
1145 printk("GDT-PCI: Use free address at 0x%x\n", i); in gdth_init_pci()
1151 printk("GDT-PCI: No free address found!\n"); in gdth_init_pci()
1152 iounmap(ha->brd); in gdth_init_pci()
1156 memset_io(&dp6m_ptr->u, 0, sizeof(dp6m_ptr->u)); in gdth_init_pci()
1159 writeb(readb(&dp6m_ptr->i960r.edoor_en_reg) | 4, in gdth_init_pci()
1160 &dp6m_ptr->i960r.edoor_en_reg); in gdth_init_pci()
1161 writeb(0xff, &dp6m_ptr->i960r.edoor_reg); in gdth_init_pci()
1162 writeb(0x00, &dp6m_ptr->u.ic.S_Status); in gdth_init_pci()
1163 writeb(0x00, &dp6m_ptr->u.ic.Cmd_Index); in gdth_init_pci()
1165 writel(pcistr->dpmem, &dp6m_ptr->u.ic.S_Info[0]); in gdth_init_pci()
1166 writeb(0xff, &dp6m_ptr->u.ic.S_Cmd_Indx); in gdth_init_pci()
1167 writeb(1, &dp6m_ptr->i960r.ldoor_reg); in gdth_init_pci()
1170 while (readb(&dp6m_ptr->u.ic.S_Status) != 0xff) { in gdth_init_pci()
1171 if (--retries == 0) { in gdth_init_pci()
1172 printk("GDT-PCI: Initialization error (DEINIT failed)\n"); in gdth_init_pci()
1173 iounmap(ha->brd); in gdth_init_pci()
1178 prot_ver = (u8)readl(&dp6m_ptr->u.ic.S_Info[0]); in gdth_init_pci()
1179 writeb(0, &dp6m_ptr->u.ic.S_Status); in gdth_init_pci()
1181 printk("GDT-PCI: Illegal protocol version\n"); in gdth_init_pci()
1182 iounmap(ha->brd); in gdth_init_pci()
1186 ha->type = GDT_PCIMPR; in gdth_init_pci()
1187 ha->ic_all_size = sizeof(dp6m_ptr->u); in gdth_init_pci()
1190 writel(0x00, &dp6m_ptr->u.ic.S_Info[0]); in gdth_init_pci()
1191 writel(0x00, &dp6m_ptr->u.ic.S_Info[1]); in gdth_init_pci()
1192 writel(0x00, &dp6m_ptr->u.ic.S_Info[2]); in gdth_init_pci()
1193 writel(0x00, &dp6m_ptr->u.ic.S_Info[3]); in gdth_init_pci()
1194 writeb(0xfe, &dp6m_ptr->u.ic.S_Cmd_Indx); in gdth_init_pci()
1195 writeb(1, &dp6m_ptr->i960r.ldoor_reg); in gdth_init_pci()
1198 while (readb(&dp6m_ptr->u.ic.S_Status) != 0xfe) { in gdth_init_pci()
1199 if (--retries == 0) { in gdth_init_pci()
1200 printk("GDT-PCI: Initialization error\n"); in gdth_init_pci()
1201 iounmap(ha->brd); in gdth_init_pci()
1206 writeb(0, &dp6m_ptr->u.ic.S_Status); in gdth_init_pci()
1208 /* read FW version to detect 64-bit DMA support */ in gdth_init_pci()
1209 writeb(0xfd, &dp6m_ptr->u.ic.S_Cmd_Indx); in gdth_init_pci()
1210 writeb(1, &dp6m_ptr->i960r.ldoor_reg); in gdth_init_pci()
1213 while (readb(&dp6m_ptr->u.ic.S_Status) != 0xfd) { in gdth_init_pci()
1214 if (--retries == 0) { in gdth_init_pci()
1215 printk("GDT-PCI: Initialization error (DEINIT failed)\n"); in gdth_init_pci()
1216 iounmap(ha->brd); in gdth_init_pci()
1221 prot_ver = (u8)(readl(&dp6m_ptr->u.ic.S_Info[0]) >> 16); in gdth_init_pci()
1222 writeb(0, &dp6m_ptr->u.ic.S_Status); in gdth_init_pci()
1223 if (prot_ver < 0x2b) /* FW < x.43: no 64-bit DMA support */ in gdth_init_pci()
1224 ha->dma64_support = 0; in gdth_init_pci()
1226 ha->dma64_support = 1; in gdth_init_pci()
1242 TRACE(("gdth_enable_int() hanum %d\n",ha->hanum)); in gdth_enable_int()
1243 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_enable_int()
1245 if (ha->type == GDT_EISA) { in gdth_enable_int()
1246 outb(0xff, ha->bmic + EDOORREG); in gdth_enable_int()
1247 outb(0xff, ha->bmic + EDENABREG); in gdth_enable_int()
1248 outb(0x01, ha->bmic + EINTENABREG); in gdth_enable_int()
1249 } else if (ha->type == GDT_ISA) { in gdth_enable_int()
1250 dp2_ptr = ha->brd; in gdth_enable_int()
1251 writeb(1, &dp2_ptr->io.irqdel); in gdth_enable_int()
1252 writeb(0, &dp2_ptr->u.ic.Cmd_Index); in gdth_enable_int()
1253 writeb(1, &dp2_ptr->io.irqen); in gdth_enable_int()
1254 } else if (ha->type == GDT_PCI) { in gdth_enable_int()
1255 dp6_ptr = ha->brd; in gdth_enable_int()
1256 writeb(1, &dp6_ptr->io.irqdel); in gdth_enable_int()
1257 writeb(0, &dp6_ptr->u.ic.Cmd_Index); in gdth_enable_int()
1258 writeb(1, &dp6_ptr->io.irqen); in gdth_enable_int()
1259 } else if (ha->type == GDT_PCINEW) { in gdth_enable_int()
1260 outb(0xff, PTR2USHORT(&ha->plx->edoor_reg)); in gdth_enable_int()
1261 outb(0x03, PTR2USHORT(&ha->plx->control1)); in gdth_enable_int()
1262 } else if (ha->type == GDT_PCIMPR) { in gdth_enable_int()
1263 dp6m_ptr = ha->brd; in gdth_enable_int()
1264 writeb(0xff, &dp6m_ptr->i960r.edoor_reg); in gdth_enable_int()
1265 writeb(readb(&dp6m_ptr->i960r.edoor_en_reg) & ~4, in gdth_enable_int()
1266 &dp6m_ptr->i960r.edoor_en_reg); in gdth_enable_int()
1268 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_enable_int()
1276 TRACE(("gdth_get_status() irq %d ctr_count %d\n", ha->irq, gdth_ctr_count)); in gdth_get_status()
1278 if (ha->type == GDT_EISA) in gdth_get_status()
1279 IStatus = inb((u16)ha->bmic + EDOORREG); in gdth_get_status()
1280 else if (ha->type == GDT_ISA) in gdth_get_status()
1282 readb(&((gdt2_dpram_str __iomem *)ha->brd)->u.ic.Cmd_Index); in gdth_get_status()
1283 else if (ha->type == GDT_PCI) in gdth_get_status()
1285 readb(&((gdt6_dpram_str __iomem *)ha->brd)->u.ic.Cmd_Index); in gdth_get_status()
1286 else if (ha->type == GDT_PCINEW) in gdth_get_status()
1287 IStatus = inb(PTR2USHORT(&ha->plx->edoor_reg)); in gdth_get_status()
1288 else if (ha->type == GDT_PCIMPR) in gdth_get_status()
1290 readb(&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.edoor_reg); in gdth_get_status()
1299 TRACE(("gdth_test_busy() hanum %d\n", ha->hanum)); in gdth_test_busy()
1301 if (ha->type == GDT_EISA) in gdth_test_busy()
1302 gdtsema0 = (int)inb(ha->bmic + SEMA0REG); in gdth_test_busy()
1303 else if (ha->type == GDT_ISA) in gdth_test_busy()
1304 gdtsema0 = (int)readb(&((gdt2_dpram_str __iomem *)ha->brd)->u.ic.Sema0); in gdth_test_busy()
1305 else if (ha->type == GDT_PCI) in gdth_test_busy()
1306 gdtsema0 = (int)readb(&((gdt6_dpram_str __iomem *)ha->brd)->u.ic.Sema0); in gdth_test_busy()
1307 else if (ha->type == GDT_PCINEW) in gdth_test_busy()
1308 gdtsema0 = (int)inb(PTR2USHORT(&ha->plx->sema0_reg)); in gdth_test_busy()
1309 else if (ha->type == GDT_PCIMPR) in gdth_test_busy()
1311 (int)readb(&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.sema0_reg); in gdth_test_busy()
1321 TRACE(("gdth_get_cmd_index() hanum %d\n", ha->hanum)); in gdth_get_cmd_index()
1324 if (ha->cmd_tab[i].cmnd == UNUSED_CMND) { in gdth_get_cmd_index()
1325 ha->cmd_tab[i].cmnd = ha->pccb->RequestBuffer; in gdth_get_cmd_index()
1326 ha->cmd_tab[i].service = ha->pccb->Service; in gdth_get_cmd_index()
1327 ha->pccb->CommandIndex = (u32)i+2; in gdth_get_cmd_index()
1337 TRACE(("gdth_set_sema0() hanum %d\n", ha->hanum)); in gdth_set_sema0()
1339 if (ha->type == GDT_EISA) { in gdth_set_sema0()
1340 outb(1, ha->bmic + SEMA0REG); in gdth_set_sema0()
1341 } else if (ha->type == GDT_ISA) { in gdth_set_sema0()
1342 writeb(1, &((gdt2_dpram_str __iomem *)ha->brd)->u.ic.Sema0); in gdth_set_sema0()
1343 } else if (ha->type == GDT_PCI) { in gdth_set_sema0()
1344 writeb(1, &((gdt6_dpram_str __iomem *)ha->brd)->u.ic.Sema0); in gdth_set_sema0()
1345 } else if (ha->type == GDT_PCINEW) { in gdth_set_sema0()
1346 outb(1, PTR2USHORT(&ha->plx->sema0_reg)); in gdth_set_sema0()
1347 } else if (ha->type == GDT_PCIMPR) { in gdth_set_sema0()
1348 writeb(1, &((gdt6m_dpram_str __iomem *)ha->brd)->i960r.sema0_reg); in gdth_set_sema0()
1362 TRACE(("gdth_copy_command() hanum %d\n", ha->hanum)); in gdth_copy_command()
1364 cp_count = ha->cmd_len; in gdth_copy_command()
1365 dp_offset= ha->cmd_offs_dpmem; in gdth_copy_command()
1366 cmd_no = ha->cmd_cnt; in gdth_copy_command()
1367 cmd_ptr = ha->pccb; in gdth_copy_command()
1369 ++ha->cmd_cnt; in gdth_copy_command()
1370 if (ha->type == GDT_EISA) in gdth_copy_command()
1375 cp_count += (4 - (cp_count & 3)); in gdth_copy_command()
1377 ha->cmd_offs_dpmem += cp_count; in gdth_copy_command()
1380 if (ha->type == GDT_ISA) { in gdth_copy_command()
1381 dp2_ptr = ha->brd; in gdth_copy_command()
1383 &dp2_ptr->u.ic.comm_queue[cmd_no].offset); in gdth_copy_command()
1384 writew((u16)cmd_ptr->Service, in gdth_copy_command()
1385 &dp2_ptr->u.ic.comm_queue[cmd_no].serv_id); in gdth_copy_command()
1386 memcpy_toio(&dp2_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count); in gdth_copy_command()
1387 } else if (ha->type == GDT_PCI) { in gdth_copy_command()
1388 dp6_ptr = ha->brd; in gdth_copy_command()
1390 &dp6_ptr->u.ic.comm_queue[cmd_no].offset); in gdth_copy_command()
1391 writew((u16)cmd_ptr->Service, in gdth_copy_command()
1392 &dp6_ptr->u.ic.comm_queue[cmd_no].serv_id); in gdth_copy_command()
1393 memcpy_toio(&dp6_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count); in gdth_copy_command()
1394 } else if (ha->type == GDT_PCINEW) { in gdth_copy_command()
1395 dp6c_ptr = ha->brd; in gdth_copy_command()
1397 &dp6c_ptr->u.ic.comm_queue[cmd_no].offset); in gdth_copy_command()
1398 writew((u16)cmd_ptr->Service, in gdth_copy_command()
1399 &dp6c_ptr->u.ic.comm_queue[cmd_no].serv_id); in gdth_copy_command()
1400 memcpy_toio(&dp6c_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count); in gdth_copy_command()
1401 } else if (ha->type == GDT_PCIMPR) { in gdth_copy_command()
1402 dp6m_ptr = ha->brd; in gdth_copy_command()
1404 &dp6m_ptr->u.ic.comm_queue[cmd_no].offset); in gdth_copy_command()
1405 writew((u16)cmd_ptr->Service, in gdth_copy_command()
1406 &dp6m_ptr->u.ic.comm_queue[cmd_no].serv_id); in gdth_copy_command()
1407 memcpy_toio(&dp6m_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count); in gdth_copy_command()
1414 TRACE(("gdth_release_event() hanum %d\n", ha->hanum)); in gdth_release_event()
1420 if (ha->cmd_tab[j].cmnd != UNUSED_CMND) in gdth_release_event()
1430 if (ha->pccb->OpCode == GDT_INIT) in gdth_release_event()
1431 ha->pccb->Service |= 0x80; in gdth_release_event()
1433 if (ha->type == GDT_EISA) { in gdth_release_event()
1434 if (ha->pccb->OpCode == GDT_INIT) /* store DMA buffer */ in gdth_release_event()
1435 outl(ha->ccb_phys, ha->bmic + MAILBOXREG); in gdth_release_event()
1436 outb(ha->pccb->Service, ha->bmic + LDOORREG); in gdth_release_event()
1437 } else if (ha->type == GDT_ISA) { in gdth_release_event()
1438 writeb(0, &((gdt2_dpram_str __iomem *)ha->brd)->io.event); in gdth_release_event()
1439 } else if (ha->type == GDT_PCI) { in gdth_release_event()
1440 writeb(0, &((gdt6_dpram_str __iomem *)ha->brd)->io.event); in gdth_release_event()
1441 } else if (ha->type == GDT_PCINEW) { in gdth_release_event()
1442 outb(1, PTR2USHORT(&ha->plx->ldoor_reg)); in gdth_release_event()
1443 } else if (ha->type == GDT_PCIMPR) { in gdth_release_event()
1444 writeb(1, &((gdt6m_dpram_str __iomem *)ha->brd)->i960r.ldoor_reg); in gdth_release_event()
1453 TRACE(("gdth_wait() hanum %d index %d time %d\n", ha->hanum, index, time)); in gdth_wait()
1465 } while (--time); in gdth_wait()
1482 cmd_ptr = ha->pccb; in gdth_internal_cmd()
1487 cmd_ptr->Service = service; in gdth_internal_cmd()
1488 cmd_ptr->RequestBuffer = INTERNAL_CMND; in gdth_internal_cmd()
1494 cmd_ptr->OpCode = opcode; in gdth_internal_cmd()
1495 cmd_ptr->BoardNode = LOCALBOARD; in gdth_internal_cmd()
1498 cmd_ptr->u.ioctl.subfunc = p1; in gdth_internal_cmd()
1499 cmd_ptr->u.ioctl.channel = (u32)p2; in gdth_internal_cmd()
1500 cmd_ptr->u.ioctl.param_size = (u16)p3; in gdth_internal_cmd()
1501 cmd_ptr->u.ioctl.p_param = ha->scratch_phys; in gdth_internal_cmd()
1503 if (ha->cache_feat & GDT_64BIT) { in gdth_internal_cmd()
1504 cmd_ptr->u.cache64.DeviceNo = (u16)p1; in gdth_internal_cmd()
1505 cmd_ptr->u.cache64.BlockNo = p2; in gdth_internal_cmd()
1507 cmd_ptr->u.cache.DeviceNo = (u16)p1; in gdth_internal_cmd()
1508 cmd_ptr->u.cache.BlockNo = (u32)p2; in gdth_internal_cmd()
1512 if (ha->raw_feat & GDT_64BIT) { in gdth_internal_cmd()
1513 cmd_ptr->u.raw64.direction = p1; in gdth_internal_cmd()
1514 cmd_ptr->u.raw64.bus = (u8)p2; in gdth_internal_cmd()
1515 cmd_ptr->u.raw64.target = (u8)p3; in gdth_internal_cmd()
1516 cmd_ptr->u.raw64.lun = (u8)(p3 >> 8); in gdth_internal_cmd()
1518 cmd_ptr->u.raw.direction = p1; in gdth_internal_cmd()
1519 cmd_ptr->u.raw.bus = (u8)p2; in gdth_internal_cmd()
1520 cmd_ptr->u.raw.target = (u8)p3; in gdth_internal_cmd()
1521 cmd_ptr->u.raw.lun = (u8)(p3 >> 8); in gdth_internal_cmd()
1525 *(u32 *)&cmd_ptr->u.screen.su.data[0] = p1; in gdth_internal_cmd()
1526 *(u32 *)&cmd_ptr->u.screen.su.data[4] = (u32)p2; in gdth_internal_cmd()
1527 *(u32 *)&cmd_ptr->u.screen.su.data[8] = (u32)p3; in gdth_internal_cmd()
1530 ha->cmd_len = sizeof(gdth_cmd_str); in gdth_internal_cmd()
1531 ha->cmd_offs_dpmem = 0; in gdth_internal_cmd()
1532 ha->cmd_cnt = 0; in gdth_internal_cmd()
1540 if (ha->status != S_BSY || --retries == 0) in gdth_internal_cmd()
1545 return (ha->status != S_OK ? 0:1); in gdth_internal_cmd()
1572 TRACE(("gdth_search_drives() hanum %d\n", ha->hanum)); in gdth_search_drives()
1576 ha->screen_feat = 0; in gdth_search_drives()
1580 ha->screen_feat = GDT_64BIT; in gdth_search_drives()
1582 if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC)) in gdth_search_drives()
1585 printk("GDT-HA %d: Initialization error screen service (code %d)\n", in gdth_search_drives()
1586 ha->hanum, ha->status); in gdth_search_drives()
1618 ha->cache_feat = 0; in gdth_search_drives()
1623 ha->cache_feat = GDT_64BIT; in gdth_search_drives()
1625 if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC)) in gdth_search_drives()
1628 printk("GDT-HA %d: Initialization error cache service (code %d)\n", in gdth_search_drives()
1629 ha->hanum, ha->status); in gdth_search_drives()
1633 cdev_cnt = (u16)ha->info; in gdth_search_drives()
1634 ha->fw_vers = ha->service; in gdth_search_drives()
1637 if (ha->type == GDT_PCIMPR) { in gdth_search_drives()
1639 pmod = (gdth_perf_modes *)ha->pscratch; in gdth_search_drives()
1640 pmod->version = 1; in gdth_search_drives()
1641 pmod->st_mode = 1; /* enable one status buffer */ in gdth_search_drives()
1642 *((u64 *)&pmod->st_buff_addr1) = ha->coal_stat_phys; in gdth_search_drives()
1643 pmod->st_buff_indx1 = COALINDEX; in gdth_search_drives()
1644 pmod->st_buff_addr2 = 0; in gdth_search_drives()
1645 pmod->st_buff_u_addr2 = 0; in gdth_search_drives()
1646 pmod->st_buff_indx2 = 0; in gdth_search_drives()
1647 pmod->st_buff_size = sizeof(gdth_coal_status) * MAXOFFSETS; in gdth_search_drives()
1648 pmod->cmd_mode = 0; // disable all cmd buffers in gdth_search_drives()
1649 pmod->cmd_buff_addr1 = 0; in gdth_search_drives()
1650 pmod->cmd_buff_u_addr1 = 0; in gdth_search_drives()
1651 pmod->cmd_buff_indx1 = 0; in gdth_search_drives()
1652 pmod->cmd_buff_addr2 = 0; in gdth_search_drives()
1653 pmod->cmd_buff_u_addr2 = 0; in gdth_search_drives()
1654 pmod->cmd_buff_indx2 = 0; in gdth_search_drives()
1655 pmod->cmd_buff_size = 0; in gdth_search_drives()
1656 pmod->reserved1 = 0; in gdth_search_drives()
1657 pmod->reserved2 = 0; in gdth_search_drives()
1660 printk("GDT-HA %d: Interrupt coalescing activated\n", ha->hanum); in gdth_search_drives()
1665 /* detect number of buses - try new IOCTL */ in gdth_search_drives()
1666 iocr = (gdth_raw_iochan_str *)ha->pscratch; in gdth_search_drives()
1667 iocr->hdr.version = 0xffffffff; in gdth_search_drives()
1668 iocr->hdr.list_entries = MAXBUS; in gdth_search_drives()
1669 iocr->hdr.first_chan = 0; in gdth_search_drives()
1670 iocr->hdr.last_chan = MAXBUS-1; in gdth_search_drives()
1671 iocr->hdr.list_offset = GDTOFFSOF(gdth_raw_iochan_str, list[0]); in gdth_search_drives()
1675 ha->bus_cnt = iocr->hdr.chan_count; in gdth_search_drives()
1676 for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { in gdth_search_drives()
1677 if (iocr->list[bus_no].proc_id < MAXID) in gdth_search_drives()
1678 ha->bus_id[bus_no] = iocr->list[bus_no].proc_id; in gdth_search_drives()
1680 ha->bus_id[bus_no] = 0xff; in gdth_search_drives()
1684 chn = (gdth_getch_str *)ha->pscratch; in gdth_search_drives()
1686 chn->channel_no = bus_no; in gdth_search_drives()
1692 printk("GDT-HA %d: Error detecting channel count (0x%x)\n", in gdth_search_drives()
1693 ha->hanum, ha->status); in gdth_search_drives()
1698 if (chn->siop_id < MAXID) in gdth_search_drives()
1699 ha->bus_id[bus_no] = chn->siop_id; in gdth_search_drives()
1701 ha->bus_id[bus_no] = 0xff; in gdth_search_drives()
1703 ha->bus_cnt = (u8)bus_no; in gdth_search_drives()
1705 TRACE2(("gdth_search_drives() %d channels\n",ha->bus_cnt)); in gdth_search_drives()
1710 printk("GDT-HA %d: Initialization error cache service (code %d)\n", in gdth_search_drives()
1711 ha->hanum, ha->status); in gdth_search_drives()
1714 ha->cpar = ((gdth_cinfo_str *)ha->pscratch)->cpar; in gdth_search_drives()
1716 ha->cpar.version,ha->cpar.state,ha->cpar.strategy, in gdth_search_drives()
1717 ha->cpar.write_back,ha->cpar.block_size)); in gdth_search_drives()
1720 ha->more_proc = FALSE; in gdth_search_drives()
1723 memcpy(&ha->binfo, (gdth_binfo_str *)ha->pscratch, in gdth_search_drives()
1728 ha->bfeat = *(gdth_bfeat_str *)ha->pscratch; in gdth_search_drives()
1729 ha->more_proc = TRUE; in gdth_search_drives()
1733 strcpy(ha->binfo.type_string, gdth_ctr_name(ha)); in gdth_search_drives()
1735 TRACE2(("Controller name: %s\n",ha->binfo.type_string)); in gdth_search_drives()
1738 if (ha->more_proc) { in gdth_search_drives()
1740 ioc = (gdth_iochan_str *)ha->pscratch; in gdth_search_drives()
1741 ioc->hdr.version = 0xffffffff; in gdth_search_drives()
1742 ioc->hdr.list_entries = MAXBUS; in gdth_search_drives()
1743 ioc->hdr.first_chan = 0; in gdth_search_drives()
1744 ioc->hdr.last_chan = MAXBUS-1; in gdth_search_drives()
1745 ioc->hdr.list_offset = GDTOFFSOF(gdth_iochan_str, list[0]); in gdth_search_drives()
1748 for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { in gdth_search_drives()
1749 ha->raw[bus_no].address = ioc->list[bus_no].address; in gdth_search_drives()
1750 ha->raw[bus_no].local_no = ioc->list[bus_no].local_no; in gdth_search_drives()
1753 for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { in gdth_search_drives()
1754 ha->raw[bus_no].address = IO_CHANNEL; in gdth_search_drives()
1755 ha->raw[bus_no].local_no = bus_no; in gdth_search_drives()
1758 for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { in gdth_search_drives()
1759 chn = (gdth_getch_str *)ha->pscratch; in gdth_search_drives()
1760 chn->channel_no = ha->raw[bus_no].local_no; in gdth_search_drives()
1763 ha->raw[bus_no].address | INVALID_CHANNEL, in gdth_search_drives()
1765 ha->raw[bus_no].pdev_cnt = chn->drive_cnt; in gdth_search_drives()
1767 bus_no,chn->drive_cnt)); in gdth_search_drives()
1769 if (ha->raw[bus_no].pdev_cnt > 0) { in gdth_search_drives()
1770 drl = (gdth_drlist_str *)ha->pscratch; in gdth_search_drives()
1771 drl->sc_no = ha->raw[bus_no].local_no; in gdth_search_drives()
1772 drl->sc_cnt = ha->raw[bus_no].pdev_cnt; in gdth_search_drives()
1775 ha->raw[bus_no].address | INVALID_CHANNEL, in gdth_search_drives()
1777 for (j = 0; j < ha->raw[bus_no].pdev_cnt; ++j) in gdth_search_drives()
1778 ha->raw[bus_no].id_list[j] = drl->sc_list[j]; in gdth_search_drives()
1780 ha->raw[bus_no].pdev_cnt = 0; in gdth_search_drives()
1788 drv_cnt = *(u32 *)ha->pscratch; in gdth_search_drives()
1792 drv_no = ((u32 *)ha->pscratch)[j]; in gdth_search_drives()
1794 ha->hdr[drv_no].is_logdrv = TRUE; in gdth_search_drives()
1799 alst = (gdth_arcdl_str *)ha->pscratch; in gdth_search_drives()
1800 alst->entries_avail = MAX_LDRIVES; in gdth_search_drives()
1801 alst->first_entry = 0; in gdth_search_drives()
1802 alst->list_offset = GDTOFFSOF(gdth_arcdl_str, list[0]); in gdth_search_drives()
1806 (alst->entries_avail-1) * sizeof(gdth_alist_str))) { in gdth_search_drives()
1807 for (j = 0; j < alst->entries_init; ++j) { in gdth_search_drives()
1808 ha->hdr[j].is_arraydrv = alst->list[j].is_arrayd; in gdth_search_drives()
1809 ha->hdr[j].is_master = alst->list[j].is_master; in gdth_search_drives()
1810 ha->hdr[j].is_parity = alst->list[j].is_parity; in gdth_search_drives()
1811 ha->hdr[j].is_hotfix = alst->list[j].is_hotfix; in gdth_search_drives()
1812 ha->hdr[j].master_no = alst->list[j].cd_handle; in gdth_search_drives()
1818 alst2 = &((gdth_alist_str *)ha->pscratch)[j]; in gdth_search_drives()
1819 ha->hdr[j].is_arraydrv = alst2->is_arrayd; in gdth_search_drives()
1820 ha->hdr[j].is_master = alst2->is_master; in gdth_search_drives()
1821 ha->hdr[j].is_parity = alst2->is_parity; in gdth_search_drives()
1822 ha->hdr[j].is_hotfix = alst2->is_hotfix; in gdth_search_drives()
1823 ha->hdr[j].master_no = alst2->cd_handle; in gdth_search_drives()
1830 ha->raw_feat = 0; in gdth_search_drives()
1834 ha->raw_feat = GDT_64BIT; in gdth_search_drives()
1836 if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC)) in gdth_search_drives()
1839 printk("GDT-HA %d: Initialization error raw service (code %d)\n", in gdth_search_drives()
1840 ha->hanum, ha->status); in gdth_search_drives()
1851 ha->info)); in gdth_search_drives()
1852 ha->raw_feat |= (u16)ha->info; in gdth_search_drives()
1862 ha->info)); in gdth_search_drives()
1863 ha->cache_feat |= (u16)ha->info; in gdth_search_drives()
1872 ha->status)); in gdth_search_drives()
1875 if (reserve_list[i] == ha->hanum && reserve_list[i+1] < ha->bus_cnt && in gdth_search_drives()
1876 reserve_list[i+2] < ha->tid_cnt && reserve_list[i+3] < MAXLUN) { in gdth_search_drives()
1883 printk("GDT-HA %d: Error raw service (RESERVE, code %d)\n", in gdth_search_drives()
1884 ha->hanum, ha->status); in gdth_search_drives()
1890 oemstr = (gdth_oem_str_ioctl *)ha->pscratch; in gdth_search_drives()
1891 oemstr->params.ctl_version = 0x01; in gdth_search_drives()
1892 oemstr->params.buffer_size = sizeof(oemstr->text); in gdth_search_drives()
1897 printk("GDT-HA %d: Vendor: %s Name: %s\n", in gdth_search_drives()
1898 ha->hanum, oemstr->text.oem_company_name, ha->binfo.type_string); in gdth_search_drives()
1900 strlcpy(ha->oem_name,oemstr->text.scsi_host_drive_inquiry_vendor_id, in gdth_search_drives()
1901 sizeof(ha->oem_name)); in gdth_search_drives()
1905 printk("GDT-HA %d: Name: %s\n", in gdth_search_drives()
1906 ha->hanum, ha->binfo.type_string); in gdth_search_drives()
1907 if (ha->oem_id == OEM_ID_INTEL) in gdth_search_drives()
1908 strlcpy(ha->oem_name,"Intel ", sizeof(ha->oem_name)); in gdth_search_drives()
1910 strlcpy(ha->oem_name,"ICP ", sizeof(ha->oem_name)); in gdth_search_drives()
1926 TRACE(("gdth_analyse_hdrive() hanum %d drive %d\n", ha->hanum, hdrive)); in gdth_analyse_hdrive()
1932 ha->hdr[hdrive].present = TRUE; in gdth_analyse_hdrive()
1933 ha->hdr[hdrive].size = ha->info; in gdth_analyse_hdrive()
1936 ha->hdr[hdrive].size &= ~SECS32; in gdth_analyse_hdrive()
1937 if (ha->info2 == 0) { in gdth_analyse_hdrive()
1938 gdth_eval_mapping(ha->hdr[hdrive].size,&drv_cyls,&drv_hds,&drv_secs); in gdth_analyse_hdrive()
1940 drv_hds = ha->info2 & 0xff; in gdth_analyse_hdrive()
1941 drv_secs = (ha->info2 >> 8) & 0xff; in gdth_analyse_hdrive()
1942 drv_cyls = (u32)ha->hdr[hdrive].size / drv_hds / drv_secs; in gdth_analyse_hdrive()
1944 ha->hdr[hdrive].heads = (u8)drv_hds; in gdth_analyse_hdrive()
1945 ha->hdr[hdrive].secs = (u8)drv_secs; in gdth_analyse_hdrive()
1947 ha->hdr[hdrive].size = drv_cyls * drv_hds * drv_secs; in gdth_analyse_hdrive()
1949 if (ha->cache_feat & GDT_64BIT) { in gdth_analyse_hdrive()
1951 && ha->info2 != 0) { in gdth_analyse_hdrive()
1952 ha->hdr[hdrive].size = ((u64)ha->info2 << 32) | ha->info; in gdth_analyse_hdrive()
1956 hdrive,ha->hdr[hdrive].size,drv_hds,drv_secs)); in gdth_analyse_hdrive()
1961 hdrive,ha->info)); in gdth_analyse_hdrive()
1962 ha->hdr[hdrive].devtype = (u16)ha->info; in gdth_analyse_hdrive()
1968 hdrive,ha->info)); in gdth_analyse_hdrive()
1970 ha->hdr[hdrive].cluster_type = (u8)ha->info; in gdth_analyse_hdrive()
1976 hdrive,ha->info)); in gdth_analyse_hdrive()
1977 ha->hdr[hdrive].rw_attribs = (u8)ha->info; in gdth_analyse_hdrive()
1994 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_putq()
1996 if (!cmndinfo->internal_command) in gdth_putq()
1997 cmndinfo->priority = priority; in gdth_putq()
1999 if (ha->req_first==NULL) { in gdth_putq()
2000 ha->req_first = scp; /* queue was empty */ in gdth_putq()
2001 scp->SCp.ptr = NULL; in gdth_putq()
2003 pscp = ha->req_first; in gdth_putq()
2004 nscp = (struct scsi_cmnd *)pscp->SCp.ptr; in gdth_putq()
2005 /* priority: 0-highest,..,0xff-lowest */ in gdth_putq()
2006 while (nscp && gdth_cmnd_priv(nscp)->priority <= priority) { in gdth_putq()
2008 nscp = (struct scsi_cmnd *)pscp->SCp.ptr; in gdth_putq()
2010 pscp->SCp.ptr = (char *)scp; in gdth_putq()
2011 scp->SCp.ptr = (char *)nscp; in gdth_putq()
2013 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_putq()
2017 for (nscp=ha->req_first; nscp; nscp=(struct scsi_cmnd*)nscp->SCp.ptr) in gdth_putq()
2035 TRACE(("gdth_next() hanum %d\n", ha->hanum)); in gdth_next()
2037 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_next()
2039 ha->cmd_cnt = ha->cmd_offs_dpmem = 0; in gdth_next()
2044 for (nscp = pscp = ha->req_first; nscp; nscp = (struct scsi_cmnd *)nscp->SCp.ptr) { in gdth_next()
2046 if (nscp != pscp && nscp != (struct scsi_cmnd *)pscp->SCp.ptr) in gdth_next()
2047 pscp = (struct scsi_cmnd *)pscp->SCp.ptr; in gdth_next()
2048 if (!nscp_cmndinfo->internal_command) { in gdth_next()
2049 b = nscp->device->channel; in gdth_next()
2050 t = nscp->device->id; in gdth_next()
2051 l = nscp->device->lun; in gdth_next()
2052 if (nscp_cmndinfo->priority >= DEFAULT_PRI) { in gdth_next()
2053 if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) || in gdth_next()
2054 (b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock)) in gdth_next()
2062 TRACE(("gdth_next() controller %d busy !\n", ha->hanum)); in gdth_next()
2064 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_next()
2073 if (!nscp_cmndinfo->internal_command) { in gdth_next()
2074 if (nscp_cmndinfo->phase == -1) { in gdth_next()
2075 nscp_cmndinfo->phase = CACHESERVICE; /* default: cache svc. */ in gdth_next()
2076 if (nscp->cmnd[0] == TEST_UNIT_READY) { in gdth_next()
2079 /* TEST_UNIT_READY -> set scan mode */ in gdth_next()
2080 if ((ha->scan_mode & 0x0f) == 0) { in gdth_next()
2082 ha->scan_mode |= 1; in gdth_next()
2083 TRACE2(("Scan mode: 0x%x\n", ha->scan_mode)); in gdth_next()
2085 } else if ((ha->scan_mode & 0x0f) == 1) { in gdth_next()
2088 nscp_cmndinfo->OpCode = GDT_SCAN_START; in gdth_next()
2089 nscp_cmndinfo->phase = ((ha->scan_mode & 0x10 ? 1:0) << 8) in gdth_next()
2091 ha->scan_mode = 0x12; in gdth_next()
2093 ha->scan_mode)); in gdth_next()
2095 ha->scan_mode &= 0x10; in gdth_next()
2096 TRACE2(("Scan mode: 0x%x\n", ha->scan_mode)); in gdth_next()
2098 } else if (ha->scan_mode == 0x12) { in gdth_next()
2099 if (b == ha->bus_cnt && t == ha->tid_cnt-1) { in gdth_next()
2100 nscp_cmndinfo->phase = SCSIRAWSERVICE; in gdth_next()
2101 nscp_cmndinfo->OpCode = GDT_SCAN_END; in gdth_next()
2102 ha->scan_mode &= 0x10; in gdth_next()
2104 ha->scan_mode)); in gdth_next()
2108 if (b == ha->virt_bus && nscp->cmnd[0] != INQUIRY && in gdth_next()
2109 nscp->cmnd[0] != READ_CAPACITY && nscp->cmnd[0] != MODE_SENSE && in gdth_next()
2110 (ha->hdr[t].cluster_type & CLUSTER_DRIVE)) { in gdth_next()
2112 nscp_cmndinfo->OpCode = GDT_CLUST_INFO; in gdth_next()
2117 if (nscp_cmndinfo->OpCode != -1) { in gdth_next()
2118 if ((nscp_cmndinfo->phase & 0xff) == CACHESERVICE) { in gdth_next()
2122 } else if ((nscp_cmndinfo->phase & 0xff) == SCSIRAWSERVICE) { in gdth_next()
2127 memset((char*)nscp->sense_buffer,0,16); in gdth_next()
2128 nscp->sense_buffer[0] = 0x70; in gdth_next()
2129 nscp->sense_buffer[2] = NOT_READY; in gdth_next()
2130 nscp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); in gdth_next()
2131 if (!nscp_cmndinfo->wait_for_completion) in gdth_next()
2132 nscp_cmndinfo->wait_for_completion++; in gdth_next()
2136 } else if (gdth_cmnd_priv(nscp)->internal_command) { in gdth_next()
2140 } else if (b != ha->virt_bus) { in gdth_next()
2141 if (ha->raw[BUS_L2P(ha,b)].io_cnt[t] >= GDTH_MAX_RAW || in gdth_next()
2145 ha->raw[BUS_L2P(ha,b)].io_cnt[t]++; in gdth_next()
2146 } else if (t >= MAX_HDRIVES || !ha->hdr[t].present || l != 0) { in gdth_next()
2147 TRACE2(("Command 0x%x to bus %d id %d lun %d -> IGNORE\n", in gdth_next()
2148 nscp->cmnd[0], b, t, l)); in gdth_next()
2149 nscp->result = DID_BAD_TARGET << 16; in gdth_next()
2150 if (!nscp_cmndinfo->wait_for_completion) in gdth_next()
2151 nscp_cmndinfo->wait_for_completion++; in gdth_next()
2155 switch (nscp->cmnd[0]) { in gdth_next()
2164 TRACE(("cache cmd %x/%x/%x/%x/%x/%x\n",nscp->cmnd[0], in gdth_next()
2165 nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], in gdth_next()
2166 nscp->cmnd[4],nscp->cmnd[5])); in gdth_next()
2167 if (ha->hdr[t].media_changed && nscp->cmnd[0] != INQUIRY) { in gdth_next()
2170 nscp->cmnd[0], t)); in gdth_next()
2171 ha->hdr[t].media_changed = FALSE; in gdth_next()
2172 memset((char*)nscp->sense_buffer,0,16); in gdth_next()
2173 nscp->sense_buffer[0] = 0x70; in gdth_next()
2174 nscp->sense_buffer[2] = UNIT_ATTENTION; in gdth_next()
2175 nscp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); in gdth_next()
2176 if (!nscp_cmndinfo->wait_for_completion) in gdth_next()
2177 nscp_cmndinfo->wait_for_completion++; in gdth_next()
2185 TRACE(("cache cmd %x/%x/%x/%x/%x/%x\n",nscp->cmnd[0], in gdth_next()
2186 nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], in gdth_next()
2187 nscp->cmnd[4],nscp->cmnd[5])); in gdth_next()
2188 if ( (nscp->cmnd[4]&1) && !(ha->hdr[t].devtype&1) ) { in gdth_next()
2189 TRACE(("Prevent r. nonremov. drive->do nothing\n")); in gdth_next()
2190 nscp->result = DID_OK << 16; in gdth_next()
2191 nscp->sense_buffer[0] = 0; in gdth_next()
2192 if (!nscp_cmndinfo->wait_for_completion) in gdth_next()
2193 nscp_cmndinfo->wait_for_completion++; in gdth_next()
2197 nscp->cmnd[3] = (ha->hdr[t].devtype&1) ? 1:0; in gdth_next()
2199 nscp->cmnd[4],nscp->cmnd[3])); in gdth_next()
2207 TRACE2(("cache cmd %s\n",nscp->cmnd[0] == RESERVE ? in gdth_next()
2219 if (ha->hdr[t].media_changed) { in gdth_next()
2222 nscp->cmnd[0], t)); in gdth_next()
2223 ha->hdr[t].media_changed = FALSE; in gdth_next()
2224 memset((char*)nscp->sense_buffer,0,16); in gdth_next()
2225 nscp->sense_buffer[0] = 0x70; in gdth_next()
2226 nscp->sense_buffer[2] = UNIT_ATTENTION; in gdth_next()
2227 nscp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); in gdth_next()
2228 if (!nscp_cmndinfo->wait_for_completion) in gdth_next()
2229 nscp_cmndinfo->wait_for_completion++; in gdth_next()
2237 TRACE2(("cache cmd %x/%x/%x/%x/%x/%x unknown\n",nscp->cmnd[0], in gdth_next()
2238 nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], in gdth_next()
2239 nscp->cmnd[4],nscp->cmnd[5])); in gdth_next()
2240 printk("GDT-HA %d: Unknown SCSI command 0x%x to cache service !\n", in gdth_next()
2241 ha->hanum, nscp->cmnd[0]); in gdth_next()
2242 nscp->result = DID_ABORT << 16; in gdth_next()
2243 if (!nscp_cmndinfo->wait_for_completion) in gdth_next()
2244 nscp_cmndinfo->wait_for_completion++; in gdth_next()
2253 if (nscp == ha->req_first) in gdth_next()
2254 ha->req_first = pscp = (struct scsi_cmnd *)nscp->SCp.ptr; in gdth_next()
2256 pscp->SCp.ptr = nscp->SCp.ptr; in gdth_next()
2261 if (ha->cmd_cnt > 0) { in gdth_next()
2266 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_next()
2268 if (gdth_polling && ha->cmd_cnt > 0) { in gdth_next()
2270 printk("GDT-HA %d: Command %d timed out !\n", in gdth_next()
2271 ha->hanum, cmd_index); in gdth_next()
2276 * gdth_copy_internal_data() - copy to/from a buffer onto a scsi_cmnd's
2293 cpnow = (u16)sl->length; in gdth_copy_internal_data()
2297 cpnow = cpcount - cpsum; in gdth_copy_internal_data()
2300 printk("GDT-HA %d: invalid sc/gt element in gdth_copy_internal_data()\n", in gdth_copy_internal_data()
2301 ha->hanum); in gdth_copy_internal_data()
2305 address = kmap_atomic(sg_page(sl)) + sl->offset; in gdth_copy_internal_data()
2315 printk("GDT-HA %d: SCSI command with no buffers but data transfer expected!\n", in gdth_copy_internal_data()
2316 ha->hanum); in gdth_copy_internal_data()
2330 t = scp->device->id; in gdth_internal_cache_cmd()
2332 scp->cmnd[0],t)); in gdth_internal_cache_cmd()
2334 scp->result = DID_OK << 16; in gdth_internal_cache_cmd()
2335 scp->sense_buffer[0] = 0; in gdth_internal_cache_cmd()
2337 switch (scp->cmnd[0]) { in gdth_internal_cache_cmd()
2346 t,ha->hdr[t].devtype)); in gdth_internal_cache_cmd()
2347 inq.type_qual = (ha->hdr[t].devtype&4) ? TYPE_ROM:TYPE_DISK; in gdth_internal_cache_cmd()
2351 if ((ha->hdr[t].devtype & 1) || in gdth_internal_cache_cmd()
2352 (ha->hdr[t].cluster_type & CLUSTER_DRIVE)) in gdth_internal_cache_cmd()
2357 strcpy(inq.vendor,ha->oem_name); in gdth_internal_cache_cmd()
2377 mpd.hd.dev_par = (ha->hdr[t].devtype&2) ? 0x80:0; in gdth_internal_cache_cmd()
2387 if (ha->hdr[t].size > (u64)0xffffffff) in gdth_internal_cache_cmd()
2390 rdc.last_block_no = cpu_to_be32(ha->hdr[t].size-1); in gdth_internal_cache_cmd()
2396 if ((scp->cmnd[1] & 0x1f) == SAI_READ_CAPACITY_16 && in gdth_internal_cache_cmd()
2397 (ha->cache_feat & GDT_64BIT)) { in gdth_internal_cache_cmd()
2401 rdc16.last_block_no = cpu_to_be64(ha->hdr[t].size-1); in gdth_internal_cache_cmd()
2406 scp->result = DID_ABORT << 16; in gdth_internal_cache_cmd()
2411 TRACE2(("Internal cache cmd 0x%x unknown\n",scp->cmnd[0])); in gdth_internal_cache_cmd()
2415 if (!cmndinfo->wait_for_completion) in gdth_internal_cache_cmd()
2416 cmndinfo->wait_for_completion++; in gdth_internal_cache_cmd()
2432 cmdp = ha->pccb; in gdth_fill_cache_cmd()
2434 scp->cmnd[0],scp->cmd_len,hdrive)); in gdth_fill_cache_cmd()
2436 if (ha->type==GDT_EISA && ha->cmd_cnt>0) in gdth_fill_cache_cmd()
2439 mode64 = (ha->cache_feat & GDT_64BIT) ? TRUE : FALSE; in gdth_fill_cache_cmd()
2440 /* test for READ_16, WRITE_16 if !mode64 ? --- in gdth_fill_cache_cmd()
2444 cmdp->Service = CACHESERVICE; in gdth_fill_cache_cmd()
2445 cmdp->RequestBuffer = scp; in gdth_fill_cache_cmd()
2452 if (ha->cmd_cnt == 0) in gdth_fill_cache_cmd()
2457 if (cmndinfo->OpCode != -1) in gdth_fill_cache_cmd()
2458 cmdp->OpCode = cmndinfo->OpCode; /* special cache cmd. */ in gdth_fill_cache_cmd()
2459 else if (scp->cmnd[0] == RESERVE) in gdth_fill_cache_cmd()
2460 cmdp->OpCode = GDT_RESERVE_DRV; in gdth_fill_cache_cmd()
2461 else if (scp->cmnd[0] == RELEASE) in gdth_fill_cache_cmd()
2462 cmdp->OpCode = GDT_RELEASE_DRV; in gdth_fill_cache_cmd()
2463 else if (scp->cmnd[0] == ALLOW_MEDIUM_REMOVAL) { in gdth_fill_cache_cmd()
2464 if (scp->cmnd[4] & 1) /* prevent ? */ in gdth_fill_cache_cmd()
2465 cmdp->OpCode = GDT_MOUNT; in gdth_fill_cache_cmd()
2466 else if (scp->cmnd[3] & 1) /* removable drive ? */ in gdth_fill_cache_cmd()
2467 cmdp->OpCode = GDT_UNMOUNT; in gdth_fill_cache_cmd()
2469 cmdp->OpCode = GDT_FLUSH; in gdth_fill_cache_cmd()
2470 } else if (scp->cmnd[0] == WRITE_6 || scp->cmnd[0] == WRITE_10 || in gdth_fill_cache_cmd()
2471 scp->cmnd[0] == WRITE_12 || scp->cmnd[0] == WRITE_16 in gdth_fill_cache_cmd()
2474 if (gdth_write_through || ((ha->hdr[hdrive].rw_attribs & 1) && in gdth_fill_cache_cmd()
2475 (ha->cache_feat & GDT_WR_THROUGH))) in gdth_fill_cache_cmd()
2476 cmdp->OpCode = GDT_WRITE_THR; in gdth_fill_cache_cmd()
2478 cmdp->OpCode = GDT_WRITE; in gdth_fill_cache_cmd()
2481 cmdp->OpCode = GDT_READ; in gdth_fill_cache_cmd()
2484 cmdp->BoardNode = LOCALBOARD; in gdth_fill_cache_cmd()
2486 cmdp->u.cache64.DeviceNo = hdrive; in gdth_fill_cache_cmd()
2487 cmdp->u.cache64.BlockNo = 1; in gdth_fill_cache_cmd()
2488 cmdp->u.cache64.sg_canz = 0; in gdth_fill_cache_cmd()
2490 cmdp->u.cache.DeviceNo = hdrive; in gdth_fill_cache_cmd()
2491 cmdp->u.cache.BlockNo = 1; in gdth_fill_cache_cmd()
2492 cmdp->u.cache.sg_canz = 0; in gdth_fill_cache_cmd()
2496 if (scp->cmd_len == 16) { in gdth_fill_cache_cmd()
2497 memcpy(&no, &scp->cmnd[2], sizeof(u64)); in gdth_fill_cache_cmd()
2499 memcpy(&cnt, &scp->cmnd[10], sizeof(u32)); in gdth_fill_cache_cmd()
2501 } else if (scp->cmd_len == 10) { in gdth_fill_cache_cmd()
2502 memcpy(&no, &scp->cmnd[2], sizeof(u32)); in gdth_fill_cache_cmd()
2504 memcpy(&cnt, &scp->cmnd[7], sizeof(u16)); in gdth_fill_cache_cmd()
2507 memcpy(&no, &scp->cmnd[0], sizeof(u32)); in gdth_fill_cache_cmd()
2509 blockcnt= scp->cmnd[4]==0 ? 0x100 : scp->cmnd[4]; in gdth_fill_cache_cmd()
2512 cmdp->u.cache64.BlockNo = blockno; in gdth_fill_cache_cmd()
2513 cmdp->u.cache64.BlockCnt = blockcnt; in gdth_fill_cache_cmd()
2515 cmdp->u.cache.BlockNo = (u32)blockno; in gdth_fill_cache_cmd()
2516 cmdp->u.cache.BlockCnt = blockcnt; in gdth_fill_cache_cmd()
2520 cmndinfo->dma_dir = (read_write == 1 ? in gdth_fill_cache_cmd()
2522 sgcnt = pci_map_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), in gdth_fill_cache_cmd()
2523 cmndinfo->dma_dir); in gdth_fill_cache_cmd()
2527 cmdp->u.cache64.DestAddr= (u64)-1; in gdth_fill_cache_cmd()
2528 cmdp->u.cache64.sg_canz = sgcnt; in gdth_fill_cache_cmd()
2530 cmdp->u.cache64.sg_lst[i].sg_ptr = sg_dma_address(sl); in gdth_fill_cache_cmd()
2532 if (cmdp->u.cache64.sg_lst[i].sg_ptr > (u64)0xffffffff) in gdth_fill_cache_cmd()
2533 ha->dma64_cnt++; in gdth_fill_cache_cmd()
2535 ha->dma32_cnt++; in gdth_fill_cache_cmd()
2537 cmdp->u.cache64.sg_lst[i].sg_len = sg_dma_len(sl); in gdth_fill_cache_cmd()
2542 cmdp->u.cache.DestAddr= 0xffffffff; in gdth_fill_cache_cmd()
2543 cmdp->u.cache.sg_canz = sgcnt; in gdth_fill_cache_cmd()
2545 cmdp->u.cache.sg_lst[i].sg_ptr = sg_dma_address(sl); in gdth_fill_cache_cmd()
2547 ha->dma32_cnt++; in gdth_fill_cache_cmd()
2549 cmdp->u.cache.sg_lst[i].sg_len = sg_dma_len(sl); in gdth_fill_cache_cmd()
2565 cmdp->u.cache64.DestAddr,cmdp->u.cache64.sg_canz, in gdth_fill_cache_cmd()
2566 cmdp->u.cache64.sg_lst[0].sg_ptr, in gdth_fill_cache_cmd()
2567 cmdp->u.cache64.sg_lst[0].sg_len)); in gdth_fill_cache_cmd()
2569 cmdp->OpCode,cmdp->u.cache64.BlockNo,cmdp->u.cache64.BlockCnt)); in gdth_fill_cache_cmd()
2570 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache64.sg_lst) + in gdth_fill_cache_cmd()
2571 (u16)cmdp->u.cache64.sg_canz * sizeof(gdth_sg64_str); in gdth_fill_cache_cmd()
2574 cmdp->u.cache.DestAddr,cmdp->u.cache.sg_canz, in gdth_fill_cache_cmd()
2575 cmdp->u.cache.sg_lst[0].sg_ptr, in gdth_fill_cache_cmd()
2576 cmdp->u.cache.sg_lst[0].sg_len)); in gdth_fill_cache_cmd()
2578 cmdp->OpCode,cmdp->u.cache.BlockNo,cmdp->u.cache.BlockCnt)); in gdth_fill_cache_cmd()
2579 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache.sg_lst) + in gdth_fill_cache_cmd()
2580 (u16)cmdp->u.cache.sg_canz * sizeof(gdth_sg_str); in gdth_fill_cache_cmd()
2582 if (ha->cmd_len & 3) in gdth_fill_cache_cmd()
2583 ha->cmd_len += (4 - (ha->cmd_len & 3)); in gdth_fill_cache_cmd()
2585 if (ha->cmd_cnt > 0) { in gdth_fill_cache_cmd()
2586 if ((ha->cmd_offs_dpmem + ha->cmd_len + DPMEM_COMMAND_OFFSET) > in gdth_fill_cache_cmd()
2587 ha->ic_all_size) { in gdth_fill_cache_cmd()
2589 ha->cmd_tab[cmd_index-2].cmnd = UNUSED_CMND; in gdth_fill_cache_cmd()
2610 t = scp->device->id; in gdth_fill_raw_cmd()
2611 l = scp->device->lun; in gdth_fill_raw_cmd()
2612 cmdp = ha->pccb; in gdth_fill_raw_cmd()
2614 scp->cmnd[0],b,t,l)); in gdth_fill_raw_cmd()
2616 if (ha->type==GDT_EISA && ha->cmd_cnt>0) in gdth_fill_raw_cmd()
2619 mode64 = (ha->raw_feat & GDT_64BIT) ? TRUE : FALSE; in gdth_fill_raw_cmd()
2621 cmdp->Service = SCSIRAWSERVICE; in gdth_fill_raw_cmd()
2622 cmdp->RequestBuffer = scp; in gdth_fill_raw_cmd()
2629 if (ha->cmd_cnt == 0) in gdth_fill_raw_cmd()
2634 if (cmndinfo->OpCode != -1) { in gdth_fill_raw_cmd()
2635 cmdp->OpCode = cmndinfo->OpCode; /* special raw cmd. */ in gdth_fill_raw_cmd()
2636 cmdp->BoardNode = LOCALBOARD; in gdth_fill_raw_cmd()
2638 cmdp->u.raw64.direction = (cmndinfo->phase >> 8); in gdth_fill_raw_cmd()
2640 cmdp->OpCode, cmdp->u.raw64.direction)); in gdth_fill_raw_cmd()
2642 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst); in gdth_fill_raw_cmd()
2644 cmdp->u.raw.direction = (cmndinfo->phase >> 8); in gdth_fill_raw_cmd()
2646 cmdp->OpCode, cmdp->u.raw.direction)); in gdth_fill_raw_cmd()
2648 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst); in gdth_fill_raw_cmd()
2652 page = virt_to_page(scp->sense_buffer); in gdth_fill_raw_cmd()
2653 offset = (unsigned long)scp->sense_buffer & ~PAGE_MASK; in gdth_fill_raw_cmd()
2654 sense_paddr = pci_map_page(ha->pdev,page,offset, in gdth_fill_raw_cmd()
2657 cmndinfo->sense_paddr = sense_paddr; in gdth_fill_raw_cmd()
2658 cmdp->OpCode = GDT_WRITE; /* always */ in gdth_fill_raw_cmd()
2659 cmdp->BoardNode = LOCALBOARD; in gdth_fill_raw_cmd()
2661 cmdp->u.raw64.reserved = 0; in gdth_fill_raw_cmd()
2662 cmdp->u.raw64.mdisc_time = 0; in gdth_fill_raw_cmd()
2663 cmdp->u.raw64.mcon_time = 0; in gdth_fill_raw_cmd()
2664 cmdp->u.raw64.clen = scp->cmd_len; in gdth_fill_raw_cmd()
2665 cmdp->u.raw64.target = t; in gdth_fill_raw_cmd()
2666 cmdp->u.raw64.lun = l; in gdth_fill_raw_cmd()
2667 cmdp->u.raw64.bus = b; in gdth_fill_raw_cmd()
2668 cmdp->u.raw64.priority = 0; in gdth_fill_raw_cmd()
2669 cmdp->u.raw64.sdlen = scsi_bufflen(scp); in gdth_fill_raw_cmd()
2670 cmdp->u.raw64.sense_len = 16; in gdth_fill_raw_cmd()
2671 cmdp->u.raw64.sense_data = sense_paddr; in gdth_fill_raw_cmd()
2672 cmdp->u.raw64.direction = in gdth_fill_raw_cmd()
2673 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; in gdth_fill_raw_cmd()
2674 memcpy(cmdp->u.raw64.cmd,scp->cmnd,16); in gdth_fill_raw_cmd()
2675 cmdp->u.raw64.sg_ranz = 0; in gdth_fill_raw_cmd()
2677 cmdp->u.raw.reserved = 0; in gdth_fill_raw_cmd()
2678 cmdp->u.raw.mdisc_time = 0; in gdth_fill_raw_cmd()
2679 cmdp->u.raw.mcon_time = 0; in gdth_fill_raw_cmd()
2680 cmdp->u.raw.clen = scp->cmd_len; in gdth_fill_raw_cmd()
2681 cmdp->u.raw.target = t; in gdth_fill_raw_cmd()
2682 cmdp->u.raw.lun = l; in gdth_fill_raw_cmd()
2683 cmdp->u.raw.bus = b; in gdth_fill_raw_cmd()
2684 cmdp->u.raw.priority = 0; in gdth_fill_raw_cmd()
2685 cmdp->u.raw.link_p = 0; in gdth_fill_raw_cmd()
2686 cmdp->u.raw.sdlen = scsi_bufflen(scp); in gdth_fill_raw_cmd()
2687 cmdp->u.raw.sense_len = 16; in gdth_fill_raw_cmd()
2688 cmdp->u.raw.sense_data = sense_paddr; in gdth_fill_raw_cmd()
2689 cmdp->u.raw.direction = in gdth_fill_raw_cmd()
2690 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; in gdth_fill_raw_cmd()
2691 memcpy(cmdp->u.raw.cmd,scp->cmnd,12); in gdth_fill_raw_cmd()
2692 cmdp->u.raw.sg_ranz = 0; in gdth_fill_raw_cmd()
2696 cmndinfo->dma_dir = PCI_DMA_BIDIRECTIONAL; in gdth_fill_raw_cmd()
2697 sgcnt = pci_map_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), in gdth_fill_raw_cmd()
2698 cmndinfo->dma_dir); in gdth_fill_raw_cmd()
2702 cmdp->u.raw64.sdata = (u64)-1; in gdth_fill_raw_cmd()
2703 cmdp->u.raw64.sg_ranz = sgcnt; in gdth_fill_raw_cmd()
2705 cmdp->u.raw64.sg_lst[i].sg_ptr = sg_dma_address(sl); in gdth_fill_raw_cmd()
2707 if (cmdp->u.raw64.sg_lst[i].sg_ptr > (u64)0xffffffff) in gdth_fill_raw_cmd()
2708 ha->dma64_cnt++; in gdth_fill_raw_cmd()
2710 ha->dma32_cnt++; in gdth_fill_raw_cmd()
2712 cmdp->u.raw64.sg_lst[i].sg_len = sg_dma_len(sl); in gdth_fill_raw_cmd()
2717 cmdp->u.raw.sdata = 0xffffffff; in gdth_fill_raw_cmd()
2718 cmdp->u.raw.sg_ranz = sgcnt; in gdth_fill_raw_cmd()
2720 cmdp->u.raw.sg_lst[i].sg_ptr = sg_dma_address(sl); in gdth_fill_raw_cmd()
2722 ha->dma32_cnt++; in gdth_fill_raw_cmd()
2724 cmdp->u.raw.sg_lst[i].sg_len = sg_dma_len(sl); in gdth_fill_raw_cmd()
2738 cmdp->u.raw64.sdata,cmdp->u.raw64.sg_ranz, in gdth_fill_raw_cmd()
2739 cmdp->u.raw64.sg_lst[0].sg_ptr, in gdth_fill_raw_cmd()
2740 cmdp->u.raw64.sg_lst[0].sg_len)); in gdth_fill_raw_cmd()
2742 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst) + in gdth_fill_raw_cmd()
2743 (u16)cmdp->u.raw64.sg_ranz * sizeof(gdth_sg64_str); in gdth_fill_raw_cmd()
2746 cmdp->u.raw.sdata,cmdp->u.raw.sg_ranz, in gdth_fill_raw_cmd()
2747 cmdp->u.raw.sg_lst[0].sg_ptr, in gdth_fill_raw_cmd()
2748 cmdp->u.raw.sg_lst[0].sg_len)); in gdth_fill_raw_cmd()
2750 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst) + in gdth_fill_raw_cmd()
2751 (u16)cmdp->u.raw.sg_ranz * sizeof(gdth_sg_str); in gdth_fill_raw_cmd()
2755 if (ha->cmd_len & 3) in gdth_fill_raw_cmd()
2756 ha->cmd_len += (4 - (ha->cmd_len & 3)); in gdth_fill_raw_cmd()
2758 if (ha->cmd_cnt > 0) { in gdth_fill_raw_cmd()
2759 if ((ha->cmd_offs_dpmem + ha->cmd_len + DPMEM_COMMAND_OFFSET) > in gdth_fill_raw_cmd()
2760 ha->ic_all_size) { in gdth_fill_raw_cmd()
2762 ha->cmd_tab[cmd_index-2].cmnd = UNUSED_CMND; in gdth_fill_raw_cmd()
2778 cmdp= ha->pccb; in gdth_special_cmd()
2781 if (ha->type==GDT_EISA && ha->cmd_cnt>0) in gdth_special_cmd()
2784 *cmdp = *cmndinfo->internal_cmd_str; in gdth_special_cmd()
2785 cmdp->RequestBuffer = scp; in gdth_special_cmd()
2794 if (ha->cmd_cnt == 0) in gdth_special_cmd()
2798 if (cmdp->OpCode == GDT_IOCTL) { in gdth_special_cmd()
2800 ha->cmd_len = in gdth_special_cmd()
2802 } else if (cmdp->Service == CACHESERVICE) { in gdth_special_cmd()
2803 TRACE2(("cache command %d\n",cmdp->OpCode)); in gdth_special_cmd()
2804 if (ha->cache_feat & GDT_64BIT) in gdth_special_cmd()
2805 ha->cmd_len = in gdth_special_cmd()
2808 ha->cmd_len = in gdth_special_cmd()
2810 } else if (cmdp->Service == SCSIRAWSERVICE) { in gdth_special_cmd()
2811 TRACE2(("raw command %d\n",cmdp->OpCode)); in gdth_special_cmd()
2812 if (ha->raw_feat & GDT_64BIT) in gdth_special_cmd()
2813 ha->cmd_len = in gdth_special_cmd()
2816 ha->cmd_len = in gdth_special_cmd()
2820 if (ha->cmd_len & 3) in gdth_special_cmd()
2821 ha->cmd_len += (4 - (ha->cmd_len & 3)); in gdth_special_cmd()
2823 if (ha->cmd_cnt > 0) { in gdth_special_cmd()
2824 if ((ha->cmd_offs_dpmem + ha->cmd_len + DPMEM_COMMAND_OFFSET) > in gdth_special_cmd()
2825 ha->ic_all_size) { in gdth_special_cmd()
2827 ha->cmd_tab[cmd_index-2].cmnd = UNUSED_CMND; in gdth_special_cmd()
2846 if (source == 0) /* no source -> no event */ in gdth_store_event()
2851 ((evt->size != 0 && ebuffer[elastidx].event_data.size != 0 && in gdth_store_event()
2853 (char *)&evt->eu, evt->size)) || in gdth_store_event()
2854 (evt->size == 0 && ebuffer[elastidx].event_data.size == 0 && in gdth_store_event()
2856 (char *)&evt->event_string)))) { in gdth_store_event()
2858 e->last_stamp = (u32)ktime_get_real_seconds(); in gdth_store_event()
2859 ++e->same_count; in gdth_store_event()
2872 e->event_source = source; in gdth_store_event()
2873 e->event_idx = idx; in gdth_store_event()
2874 e->first_stamp = e->last_stamp = (u32)ktime_get_real_seconds(); in gdth_store_event()
2875 e->same_count = 1; in gdth_store_event()
2876 e->event_data = *evt; in gdth_store_event()
2877 e->application = 0; in gdth_store_event()
2889 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_read_event()
2890 if (handle == -1) in gdth_read_event()
2894 estr->event_source = 0; in gdth_read_event()
2897 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_read_event()
2901 if (e->event_source != 0) { in gdth_read_event()
2906 eindex = -1; in gdth_read_event()
2910 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_read_event()
2923 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_readapp_event()
2927 if (e->event_source == 0) in gdth_readapp_event()
2929 if ((e->application & application) == 0) { in gdth_readapp_event()
2930 e->application |= application; in gdth_readapp_event()
2942 estr->event_source = 0; in gdth_readapp_event()
2943 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_readapp_event()
2975 TRACE(("gdth_interrupt() IRQ %d\n", ha->irq)); in __gdth_interrupt()
2977 /* if polling and not from gdth_wait() -> return */ in __gdth_interrupt()
2985 spin_lock_irqsave(&ha->smp_lock, flags); in __gdth_interrupt()
2992 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
3005 pcs = ha->coal_stat; in __gdth_interrupt()
3014 IStatus = (u8)(pcs->status & 0xff); in __gdth_interrupt()
3018 if (ha->type == GDT_EISA) { in __gdth_interrupt()
3021 ha->status = inw(ha->bmic + MAILBOXREG+8); in __gdth_interrupt()
3022 TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status)); in __gdth_interrupt()
3024 ha->status = S_OK; in __gdth_interrupt()
3025 ha->info = inl(ha->bmic + MAILBOXREG+12); in __gdth_interrupt()
3026 ha->service = inw(ha->bmic + MAILBOXREG+10); in __gdth_interrupt()
3027 ha->info2 = inl(ha->bmic + MAILBOXREG+4); in __gdth_interrupt()
3029 outb(0xff, ha->bmic + EDOORREG); /* acknowledge interrupt */ in __gdth_interrupt()
3030 outb(0x00, ha->bmic + SEMA1REG); /* reset status semaphore */ in __gdth_interrupt()
3031 } else if (ha->type == GDT_ISA) { in __gdth_interrupt()
3032 dp2_ptr = ha->brd; in __gdth_interrupt()
3035 ha->status = readw(&dp2_ptr->u.ic.Status); in __gdth_interrupt()
3036 TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status)); in __gdth_interrupt()
3038 ha->status = S_OK; in __gdth_interrupt()
3039 ha->info = readl(&dp2_ptr->u.ic.Info[0]); in __gdth_interrupt()
3040 ha->service = readw(&dp2_ptr->u.ic.Service); in __gdth_interrupt()
3041 ha->info2 = readl(&dp2_ptr->u.ic.Info[1]); in __gdth_interrupt()
3043 writeb(0xff, &dp2_ptr->io.irqdel); /* acknowledge interrupt */ in __gdth_interrupt()
3044 writeb(0, &dp2_ptr->u.ic.Cmd_Index);/* reset command index */ in __gdth_interrupt()
3045 writeb(0, &dp2_ptr->io.Sema1); /* reset status semaphore */ in __gdth_interrupt()
3046 } else if (ha->type == GDT_PCI) { in __gdth_interrupt()
3047 dp6_ptr = ha->brd; in __gdth_interrupt()
3050 ha->status = readw(&dp6_ptr->u.ic.Status); in __gdth_interrupt()
3051 TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status)); in __gdth_interrupt()
3053 ha->status = S_OK; in __gdth_interrupt()
3054 ha->info = readl(&dp6_ptr->u.ic.Info[0]); in __gdth_interrupt()
3055 ha->service = readw(&dp6_ptr->u.ic.Service); in __gdth_interrupt()
3056 ha->info2 = readl(&dp6_ptr->u.ic.Info[1]); in __gdth_interrupt()
3058 writeb(0xff, &dp6_ptr->io.irqdel); /* acknowledge interrupt */ in __gdth_interrupt()
3059 writeb(0, &dp6_ptr->u.ic.Cmd_Index);/* reset command index */ in __gdth_interrupt()
3060 writeb(0, &dp6_ptr->io.Sema1); /* reset status semaphore */ in __gdth_interrupt()
3061 } else if (ha->type == GDT_PCINEW) { in __gdth_interrupt()
3064 ha->status = inw(PTR2USHORT(&ha->plx->status)); in __gdth_interrupt()
3065 TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status)); in __gdth_interrupt()
3067 ha->status = S_OK; in __gdth_interrupt()
3068 ha->info = inl(PTR2USHORT(&ha->plx->info[0])); in __gdth_interrupt()
3069 ha->service = inw(PTR2USHORT(&ha->plx->service)); in __gdth_interrupt()
3070 ha->info2 = inl(PTR2USHORT(&ha->plx->info[1])); in __gdth_interrupt()
3072 outb(0xff, PTR2USHORT(&ha->plx->edoor_reg)); in __gdth_interrupt()
3073 outb(0x00, PTR2USHORT(&ha->plx->sema1_reg)); in __gdth_interrupt()
3074 } else if (ha->type == GDT_PCIMPR) { in __gdth_interrupt()
3075 dp6m_ptr = ha->brd; in __gdth_interrupt()
3080 ha->status = pcs->ext_status & 0xffff; in __gdth_interrupt()
3083 ha->status = readw(&dp6m_ptr->i960r.status); in __gdth_interrupt()
3084 TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status)); in __gdth_interrupt()
3086 ha->status = S_OK; in __gdth_interrupt()
3090 ha->info = pcs->info0; in __gdth_interrupt()
3091 ha->info2 = pcs->info1; in __gdth_interrupt()
3092 ha->service = (pcs->ext_status >> 16) & 0xffff; in __gdth_interrupt()
3096 ha->info = readl(&dp6m_ptr->i960r.info[0]); in __gdth_interrupt()
3097 ha->service = readw(&dp6m_ptr->i960r.service); in __gdth_interrupt()
3098 ha->info2 = readl(&dp6m_ptr->i960r.info[1]); in __gdth_interrupt()
3102 if (ha->service != SCREENSERVICE && in __gdth_interrupt()
3103 (ha->fw_vers & 0xff) >= 0x1a) { in __gdth_interrupt()
3104 ha->dvr.severity = readb in __gdth_interrupt()
3105 (&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.severity); in __gdth_interrupt()
3107 ha->dvr.event_string[i] = readb in __gdth_interrupt()
3108 (&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.evt_str[i]); in __gdth_interrupt()
3109 if (ha->dvr.event_string[i] == 0) in __gdth_interrupt()
3120 writeb(0xff, &dp6m_ptr->i960r.edoor_reg); in __gdth_interrupt()
3121 writeb(0, &dp6m_ptr->i960r.sema1_reg); in __gdth_interrupt()
3126 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
3131 IStatus,ha->status,ha->info)); in __gdth_interrupt()
3141 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
3148 ha->dvr.size = sizeof(ha->dvr.eu.driver); in __gdth_interrupt()
3149 ha->dvr.eu.driver.ionode = ha->hanum; in __gdth_interrupt()
3150 gdth_store_event(ha, ES_DRIVER, 4, &ha->dvr); in __gdth_interrupt()
3152 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
3155 scp = ha->cmd_tab[IStatus-2].cmnd; in __gdth_interrupt()
3156 Service = ha->cmd_tab[IStatus-2].service; in __gdth_interrupt()
3157 ha->cmd_tab[IStatus-2].cmnd = UNUSED_CMND; in __gdth_interrupt()
3160 ha->dvr.size = sizeof(ha->dvr.eu.driver); in __gdth_interrupt()
3161 ha->dvr.eu.driver.ionode = ha->hanum; in __gdth_interrupt()
3162 ha->dvr.eu.driver.index = IStatus; in __gdth_interrupt()
3163 gdth_store_event(ha, ES_DRIVER, 1, &ha->dvr); in __gdth_interrupt()
3165 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
3171 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
3178 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
3180 gdth_putq(ha, scp, gdth_cmnd_priv(scp)->priority); in __gdth_interrupt()
3197 if (pcs->status == 0) in __gdth_interrupt()
3204 if (ha->type == GDT_PCIMPR && coalesced) { in __gdth_interrupt()
3205 writeb(0xff, &dp6m_ptr->i960r.edoor_reg); in __gdth_interrupt()
3206 writeb(0, &dp6m_ptr->i960r.sema1_reg); in __gdth_interrupt()
3229 cmdp = ha->pccb; in gdth_sync_event()
3231 service,ha->status)); in gdth_sync_event()
3234 msg = ha->pmsg; in gdth_sync_event()
3235 TRACE(("len: %d, answer: %d, ext: %d, alen: %d\n", in gdth_sync_event()
3236 msg->msg_len,msg->msg_answer,msg->msg_ext,msg->msg_alen)); in gdth_sync_event()
3237 if (msg->msg_len > MSGLEN+1) in gdth_sync_event()
3238 msg->msg_len = MSGLEN+1; in gdth_sync_event()
3239 if (msg->msg_len) in gdth_sync_event()
3240 if (!(msg->msg_answer && msg->msg_ext)) { in gdth_sync_event()
3241 msg->msg_text[msg->msg_len] = '\0'; in gdth_sync_event()
3242 printk("%s",msg->msg_text); in gdth_sync_event()
3245 if (msg->msg_ext && !msg->msg_answer) { in gdth_sync_event()
3248 cmdp->Service = SCREENSERVICE; in gdth_sync_event()
3249 cmdp->RequestBuffer = SCREEN_CMND; in gdth_sync_event()
3252 cmdp->OpCode = GDT_READ; in gdth_sync_event()
3253 cmdp->BoardNode = LOCALBOARD; in gdth_sync_event()
3254 cmdp->u.screen.reserved = 0; in gdth_sync_event()
3255 cmdp->u.screen.su.msg.msg_handle= msg->msg_handle; in gdth_sync_event()
3256 cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; in gdth_sync_event()
3257 ha->cmd_offs_dpmem = 0; in gdth_sync_event()
3258 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) in gdth_sync_event()
3260 ha->cmd_cnt = 0; in gdth_sync_event()
3266 if (msg->msg_answer && msg->msg_alen) { in gdth_sync_event()
3268 if (msg->msg_alen == 1) { in gdth_sync_event()
3269 msg->msg_alen = 0; in gdth_sync_event()
3270 msg->msg_len = 1; in gdth_sync_event()
3271 msg->msg_text[0] = 0; in gdth_sync_event()
3273 msg->msg_alen -= 2; in gdth_sync_event()
3274 msg->msg_len = 2; in gdth_sync_event()
3275 msg->msg_text[0] = 1; in gdth_sync_event()
3276 msg->msg_text[1] = 0; in gdth_sync_event()
3278 msg->msg_ext = 0; in gdth_sync_event()
3279 msg->msg_answer = 0; in gdth_sync_event()
3282 cmdp->Service = SCREENSERVICE; in gdth_sync_event()
3283 cmdp->RequestBuffer = SCREEN_CMND; in gdth_sync_event()
3286 cmdp->OpCode = GDT_WRITE; in gdth_sync_event()
3287 cmdp->BoardNode = LOCALBOARD; in gdth_sync_event()
3288 cmdp->u.screen.reserved = 0; in gdth_sync_event()
3289 cmdp->u.screen.su.msg.msg_handle= msg->msg_handle; in gdth_sync_event()
3290 cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; in gdth_sync_event()
3291 ha->cmd_offs_dpmem = 0; in gdth_sync_event()
3292 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) in gdth_sync_event()
3294 ha->cmd_cnt = 0; in gdth_sync_event()
3302 b = scp->device->channel; in gdth_sync_event()
3303 t = scp->device->id; in gdth_sync_event()
3304 if (cmndinfo->OpCode == -1 && b != ha->virt_bus) { in gdth_sync_event()
3305 ha->raw[BUS_L2P(ha,b)].io_cnt[t]--; in gdth_sync_event()
3308 if (ha->status == S_BSY) { in gdth_sync_event()
3309 TRACE2(("Controller busy -> retry !\n")); in gdth_sync_event()
3310 if (cmndinfo->OpCode == GDT_MOUNT) in gdth_sync_event()
3311 cmndinfo->OpCode = GDT_CLUST_INFO; in gdth_sync_event()
3316 pci_unmap_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), in gdth_sync_event()
3317 cmndinfo->dma_dir); in gdth_sync_event()
3319 if (cmndinfo->sense_paddr) in gdth_sync_event()
3320 pci_unmap_page(ha->pdev, cmndinfo->sense_paddr, 16, in gdth_sync_event()
3323 if (ha->status == S_OK) { in gdth_sync_event()
3324 cmndinfo->status = S_OK; in gdth_sync_event()
3325 cmndinfo->info = ha->info; in gdth_sync_event()
3326 if (cmndinfo->OpCode != -1) { in gdth_sync_event()
3328 cmndinfo->OpCode)); in gdth_sync_event()
3330 if (cmndinfo->OpCode == GDT_CLUST_INFO) { in gdth_sync_event()
3331 ha->hdr[t].cluster_type = (u8)ha->info; in gdth_sync_event()
3332 if (!(ha->hdr[t].cluster_type & in gdth_sync_event()
3334 /* NOT MOUNTED -> MOUNT */ in gdth_sync_event()
3335 cmndinfo->OpCode = GDT_MOUNT; in gdth_sync_event()
3336 if (ha->hdr[t].cluster_type & in gdth_sync_event()
3339 cmndinfo->phase = -2; /* reservation conflict */ in gdth_sync_event()
3342 cmndinfo->OpCode = -1; in gdth_sync_event()
3345 if (cmndinfo->OpCode == GDT_MOUNT) { in gdth_sync_event()
3346 ha->hdr[t].cluster_type |= CLUSTER_MOUNTED; in gdth_sync_event()
3347 ha->hdr[t].media_changed = TRUE; in gdth_sync_event()
3348 } else if (cmndinfo->OpCode == GDT_UNMOUNT) { in gdth_sync_event()
3349 ha->hdr[t].cluster_type &= ~CLUSTER_MOUNTED; in gdth_sync_event()
3350 ha->hdr[t].media_changed = TRUE; in gdth_sync_event()
3352 cmndinfo->OpCode = -1; in gdth_sync_event()
3355 cmndinfo->priority = HIGH_PRI; in gdth_sync_event()
3359 if (scp->cmnd[0] == RESERVE) { in gdth_sync_event()
3360 ha->hdr[t].cluster_type |= CLUSTER_RESERVED; in gdth_sync_event()
3361 } else if (scp->cmnd[0] == RELEASE) { in gdth_sync_event()
3362 ha->hdr[t].cluster_type &= ~CLUSTER_RESERVED; in gdth_sync_event()
3364 scp->result = DID_OK << 16; in gdth_sync_event()
3365 scp->sense_buffer[0] = 0; in gdth_sync_event()
3368 cmndinfo->status = ha->status; in gdth_sync_event()
3369 cmndinfo->info = ha->info; in gdth_sync_event()
3371 if (cmndinfo->OpCode != -1) { in gdth_sync_event()
3373 cmndinfo->OpCode, ha->status)); in gdth_sync_event()
3374 if (cmndinfo->OpCode == GDT_SCAN_START || in gdth_sync_event()
3375 cmndinfo->OpCode == GDT_SCAN_END) { in gdth_sync_event()
3376 cmndinfo->OpCode = -1; in gdth_sync_event()
3378 cmndinfo->priority = HIGH_PRI; in gdth_sync_event()
3381 memset((char*)scp->sense_buffer,0,16); in gdth_sync_event()
3382 scp->sense_buffer[0] = 0x70; in gdth_sync_event()
3383 scp->sense_buffer[2] = NOT_READY; in gdth_sync_event()
3384 scp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); in gdth_sync_event()
3386 if (ha->status == S_CACHE_UNKNOWN && in gdth_sync_event()
3387 (ha->hdr[t].cluster_type & in gdth_sync_event()
3389 /* bus reset -> force GDT_CLUST_INFO */ in gdth_sync_event()
3390 ha->hdr[t].cluster_type &= ~CLUSTER_RESERVED; in gdth_sync_event()
3392 memset((char*)scp->sense_buffer,0,16); in gdth_sync_event()
3393 if (ha->status == (u16)S_CACHE_RESERV) { in gdth_sync_event()
3394 scp->result = (DID_OK << 16) | (RESERVATION_CONFLICT << 1); in gdth_sync_event()
3396 scp->sense_buffer[0] = 0x70; in gdth_sync_event()
3397 scp->sense_buffer[2] = NOT_READY; in gdth_sync_event()
3398 scp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); in gdth_sync_event()
3400 if (!cmndinfo->internal_command) { in gdth_sync_event()
3401 ha->dvr.size = sizeof(ha->dvr.eu.sync); in gdth_sync_event()
3402 ha->dvr.eu.sync.ionode = ha->hanum; in gdth_sync_event()
3403 ha->dvr.eu.sync.service = service; in gdth_sync_event()
3404 ha->dvr.eu.sync.status = ha->status; in gdth_sync_event()
3405 ha->dvr.eu.sync.info = ha->info; in gdth_sync_event()
3406 ha->dvr.eu.sync.hostdrive = t; in gdth_sync_event()
3407 if (ha->status >= 0x8000) in gdth_sync_event()
3408 gdth_store_event(ha, ES_SYNC, 0, &ha->dvr); in gdth_sync_event()
3410 gdth_store_event(ha, ES_SYNC, service, &ha->dvr); in gdth_sync_event()
3414 if (ha->status != S_RAW_SCSI || ha->info >= 0x100) { in gdth_sync_event()
3415 scp->result = DID_BAD_TARGET << 16; in gdth_sync_event()
3417 scp->result = (DID_OK << 16) | ha->info; in gdth_sync_event()
3421 if (!cmndinfo->wait_for_completion) in gdth_sync_event()
3422 cmndinfo->wait_for_completion++; in gdth_sync_event()
3591 cmdp= ha->pccb; in gdth_async_event()
3593 ha->hanum, ha->service)); in gdth_async_event()
3595 if (ha->service == SCREENSERVICE) { in gdth_async_event()
3596 if (ha->status == MSG_REQUEST) { in gdth_async_event()
3599 cmdp->Service = SCREENSERVICE; in gdth_async_event()
3600 cmdp->RequestBuffer = SCREEN_CMND; in gdth_async_event()
3603 cmdp->OpCode = GDT_READ; in gdth_async_event()
3604 cmdp->BoardNode = LOCALBOARD; in gdth_async_event()
3605 cmdp->u.screen.reserved = 0; in gdth_async_event()
3606 cmdp->u.screen.su.msg.msg_handle= MSG_INV_HANDLE; in gdth_async_event()
3607 cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; in gdth_async_event()
3608 ha->cmd_offs_dpmem = 0; in gdth_async_event()
3609 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) in gdth_async_event()
3611 ha->cmd_cnt = 0; in gdth_async_event()
3613 if (ha->type == GDT_EISA) in gdth_async_event()
3614 printk("[EISA slot %d] ",(u16)ha->brd_phys); in gdth_async_event()
3615 else if (ha->type == GDT_ISA) in gdth_async_event()
3616 printk("[DPMEM 0x%4X] ",(u16)ha->brd_phys); in gdth_async_event()
3618 printk("[PCI %d/%d] ",(u16)(ha->brd_phys>>8), in gdth_async_event()
3619 (u16)((ha->brd_phys>>3)&0x1f)); in gdth_async_event()
3624 if (ha->type == GDT_PCIMPR && in gdth_async_event()
3625 (ha->fw_vers & 0xff) >= 0x1a) { in gdth_async_event()
3626 ha->dvr.size = 0; in gdth_async_event()
3627 ha->dvr.eu.async.ionode = ha->hanum; in gdth_async_event()
3628 ha->dvr.eu.async.status = ha->status; in gdth_async_event()
3631 ha->dvr.size = sizeof(ha->dvr.eu.async); in gdth_async_event()
3632 ha->dvr.eu.async.ionode = ha->hanum; in gdth_async_event()
3633 ha->dvr.eu.async.service = ha->service; in gdth_async_event()
3634 ha->dvr.eu.async.status = ha->status; in gdth_async_event()
3635 ha->dvr.eu.async.info = ha->info; in gdth_async_event()
3636 *(u32 *)ha->dvr.eu.async.scsi_coord = ha->info2; in gdth_async_event()
3638 gdth_store_event( ha, ES_ASYNC, ha->service, &ha->dvr ); in gdth_async_event()
3639 gdth_log_event( &ha->dvr, NULL ); in gdth_async_event()
3642 if (ha->service == CACHESERVICE && ha->status == 56) { in gdth_async_event()
3644 (u16)ha->info)); in gdth_async_event()
3645 /* gdth_analyse_hdrive(hanum, (u16)ha->info); */ in gdth_async_event()
3658 if (dvr->size == 0) { in gdth_log_event()
3660 printk("Adapter %d: %s\n",dvr->eu.async.ionode,dvr->event_string); in gdth_log_event()
3663 dvr->eu.async.ionode,dvr->event_string); in gdth_log_event()
3665 } else if (dvr->eu.async.service == CACHESERVICE && in gdth_log_event()
3666 INDEX_OK(dvr->eu.async.status, async_cache_tab)) { in gdth_log_event()
3668 dvr->eu.async.status)); in gdth_log_event()
3670 f = async_cache_tab[dvr->eu.async.status]; in gdth_log_event()
3676 stack.b[j++] = *(u32*)&dvr->eu.stream[(int)f[i]]; in gdth_log_event()
3679 stack.b[j++] = *(u16*)&dvr->eu.stream[(int)f[i]]; in gdth_log_event()
3682 stack.b[j++] = *(u8*)&dvr->eu.stream[(int)f[i]]; in gdth_log_event()
3699 dvr->eu.async.ionode,dvr->eu.async.service,dvr->eu.async.status); in gdth_log_event()
3702 dvr->eu.async.ionode,dvr->eu.async.service,dvr->eu.async.status); in gdth_log_event()
3723 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_timeout()
3726 if (ha->cmd_tab[i].cmnd != UNUSED_CMND) in gdth_timeout()
3730 nscp=ha->req_first; nscp; nscp=(struct scsi_cmnd*)nscp->SCp.ptr) in gdth_timeout()
3739 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_timeout()
3811 --cur_str; in internal_setup()
3841 ints[0] = i - 1; in option_setup()
3850 if (ha->type == GDT_EISA) { in gdth_ctr_name()
3851 switch (ha->stype) { in gdth_ctr_name()
3859 } else if (ha->type == GDT_ISA) { in gdth_ctr_name()
3861 } else if (ha->type == GDT_PCI) { in gdth_ctr_name()
3862 switch (ha->pdev->device) { in gdth_ctr_name()
3879 return ((const char *)ha->binfo.type_string); in gdth_info()
3884 gdth_ha_str *ha = shost_priv(scp->device->host); in gdth_timed_out()
3890 TRACE(("%s() cmd 0x%x\n", scp->cmnd[0], __func__)); in gdth_timed_out()
3891 b = scp->device->channel; in gdth_timed_out()
3892 t = scp->device->id; in gdth_timed_out()
3899 if (++cmndinfo->timeout_count < 6) in gdth_timed_out()
3903 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_timed_out()
3904 if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha, b)].lock) || in gdth_timed_out()
3905 (b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock)) { in gdth_timed_out()
3909 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_timed_out()
3917 gdth_ha_str *ha = shost_priv(scp->device->host); in gdth_eh_bus_reset()
3925 b = scp->device->channel; in gdth_eh_bus_reset()
3928 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3930 cmnd = ha->cmd_tab[i].cmnd; in gdth_eh_bus_reset()
3931 if (!SPECIAL_SCP(cmnd) && cmnd->device->channel == b) in gdth_eh_bus_reset()
3932 ha->cmd_tab[i].cmnd = UNUSED_CMND; in gdth_eh_bus_reset()
3934 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3936 if (b == ha->virt_bus) { in gdth_eh_bus_reset()
3939 if (ha->hdr[i].present) { in gdth_eh_bus_reset()
3940 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3946 ha->hdr[i].cluster_type &= ~CLUSTER_RESERVED; in gdth_eh_bus_reset()
3948 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3953 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3955 ha->raw[BUS_L2P(ha,b)].io_cnt[i] = 0; in gdth_eh_bus_reset()
3962 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3970 gdth_ha_str *ha = shost_priv(sdev->host); in gdth_bios_param()
3976 b = sd->channel; in gdth_bios_param()
3977 t = sd->id; in gdth_bios_param()
3978 TRACE2(("gdth_bios_param() ha %d bus %d target %d\n", ha->hanum, b, t)); in gdth_bios_param()
3980 if (b != ha->virt_bus || ha->hdr[t].heads == 0) { in gdth_bios_param()
3985 ip[0] = ha->hdr[t].heads; in gdth_bios_param()
3986 ip[1] = ha->hdr[t].secs; in gdth_bios_param()
3999 gdth_ha_str *ha = shost_priv(scp->device->host); in gdth_queuecommand_lck()
4002 TRACE(("gdth_queuecommand() cmd 0x%x\n", scp->cmnd[0])); in gdth_queuecommand_lck()
4007 scp->scsi_done = done; in gdth_queuecommand_lck()
4008 cmndinfo->timeout_count = 0; in gdth_queuecommand_lck()
4009 cmndinfo->priority = DEFAULT_PRI; in gdth_queuecommand_lck()
4019 scp->host_scribble = (unsigned char *)cmndinfo; in DEF_SCSI_QCMD()
4020 cmndinfo->wait_for_completion = 1; in DEF_SCSI_QCMD()
4021 cmndinfo->phase = -1; in DEF_SCSI_QCMD()
4022 cmndinfo->OpCode = -1; in DEF_SCSI_QCMD()
4028 gdth_putq(ha, scp, cmndinfo->priority); in DEF_SCSI_QCMD()
4040 if (!ha->sdev) in gdth_open()
4041 ha->sdev = scsi_get_host_dev(ha->shost); in gdth_open()
4062 return -EFAULT; in ioc_event()
4065 return -EFAULT; in ioc_event()
4076 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_event()
4079 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_event()
4088 return -EFAULT; in ioc_event()
4100 return -EFAULT; in ioc_lockdrv()
4103 return -EFAULT; in ioc_lockdrv()
4107 if (j >= MAX_HDRIVES || !ha->hdr[j].present) in ioc_lockdrv()
4110 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_lockdrv()
4111 ha->hdr[j].lock = 1; in ioc_lockdrv()
4112 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_lockdrv()
4113 gdth_wait_completion(ha, ha->bus_cnt, j); in ioc_lockdrv()
4115 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_lockdrv()
4116 ha->hdr[j].lock = 0; in ioc_lockdrv()
4117 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_lockdrv()
4133 return -EFAULT; in ioc_resetdrv()
4136 return -EFAULT; in ioc_resetdrv()
4138 if (!ha->hdr[res.number].present) in ioc_resetdrv()
4143 if (ha->cache_feat & GDT_64BIT) in ioc_resetdrv()
4148 rval = __gdth_execute(ha->sdev, &cmd, cmnd, 30, NULL); in ioc_resetdrv()
4154 return -EFAULT; in ioc_resetdrv()
4160 gdth_ioctl_general gen; in ioc_general() local
4166 if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general))) in ioc_general()
4167 return -EFAULT; in ioc_general()
4168 ha = gdth_find_ha(gen.ionode); in ioc_general()
4170 return -EFAULT; in ioc_general()
4172 if (gen.data_len > INT_MAX) in ioc_general()
4173 return -EINVAL; in ioc_general()
4174 if (gen.sense_len > INT_MAX) in ioc_general()
4175 return -EINVAL; in ioc_general()
4176 if (gen.data_len + gen.sense_len > INT_MAX) in ioc_general()
4177 return -EINVAL; in ioc_general()
4179 if (gen.data_len + gen.sense_len != 0) { in ioc_general()
4180 if (!(buf = gdth_ioctl_alloc(ha, gen.data_len + gen.sense_len, in ioc_general()
4182 return -EFAULT; in ioc_general()
4184 gen.data_len + gen.sense_len)) { in ioc_general()
4185 gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); in ioc_general()
4186 return -EFAULT; in ioc_general()
4189 if (gen.command.OpCode == GDT_IOCTL) { in ioc_general()
4190 gen.command.u.ioctl.p_param = paddr; in ioc_general()
4191 } else if (gen.command.Service == CACHESERVICE) { in ioc_general()
4192 if (ha->cache_feat & GDT_64BIT) { in ioc_general()
4193 /* copy elements from 32-bit IOCTL structure */ in ioc_general()
4194 gen.command.u.cache64.BlockCnt = gen.command.u.cache.BlockCnt; in ioc_general()
4195 gen.command.u.cache64.BlockNo = gen.command.u.cache.BlockNo; in ioc_general()
4196 gen.command.u.cache64.DeviceNo = gen.command.u.cache.DeviceNo; in ioc_general()
4198 if (ha->cache_feat & SCATTER_GATHER) { in ioc_general()
4199 gen.command.u.cache64.DestAddr = (u64)-1; in ioc_general()
4200 gen.command.u.cache64.sg_canz = 1; in ioc_general()
4201 gen.command.u.cache64.sg_lst[0].sg_ptr = paddr; in ioc_general()
4202 gen.command.u.cache64.sg_lst[0].sg_len = gen.data_len; in ioc_general()
4203 gen.command.u.cache64.sg_lst[1].sg_len = 0; in ioc_general()
4205 gen.command.u.cache64.DestAddr = paddr; in ioc_general()
4206 gen.command.u.cache64.sg_canz = 0; in ioc_general()
4209 if (ha->cache_feat & SCATTER_GATHER) { in ioc_general()
4210 gen.command.u.cache.DestAddr = 0xffffffff; in ioc_general()
4211 gen.command.u.cache.sg_canz = 1; in ioc_general()
4212 gen.command.u.cache.sg_lst[0].sg_ptr = (u32)paddr; in ioc_general()
4213 gen.command.u.cache.sg_lst[0].sg_len = gen.data_len; in ioc_general()
4214 gen.command.u.cache.sg_lst[1].sg_len = 0; in ioc_general()
4216 gen.command.u.cache.DestAddr = paddr; in ioc_general()
4217 gen.command.u.cache.sg_canz = 0; in ioc_general()
4220 } else if (gen.command.Service == SCSIRAWSERVICE) { in ioc_general()
4221 if (ha->raw_feat & GDT_64BIT) { in ioc_general()
4222 /* copy elements from 32-bit IOCTL structure */ in ioc_general()
4224 gen.command.u.raw64.sense_len = gen.command.u.raw.sense_len; in ioc_general()
4225 gen.command.u.raw64.bus = gen.command.u.raw.bus; in ioc_general()
4226 gen.command.u.raw64.lun = gen.command.u.raw.lun; in ioc_general()
4227 gen.command.u.raw64.target = gen.command.u.raw.target; in ioc_general()
4228 memcpy(cmd, gen.command.u.raw.cmd, 16); in ioc_general()
4229 memcpy(gen.command.u.raw64.cmd, cmd, 16); in ioc_general()
4230 gen.command.u.raw64.clen = gen.command.u.raw.clen; in ioc_general()
4231 gen.command.u.raw64.sdlen = gen.command.u.raw.sdlen; in ioc_general()
4232 gen.command.u.raw64.direction = gen.command.u.raw.direction; in ioc_general()
4234 if (ha->raw_feat & SCATTER_GATHER) { in ioc_general()
4235 gen.command.u.raw64.sdata = (u64)-1; in ioc_general()
4236 gen.command.u.raw64.sg_ranz = 1; in ioc_general()
4237 gen.command.u.raw64.sg_lst[0].sg_ptr = paddr; in ioc_general()
4238 gen.command.u.raw64.sg_lst[0].sg_len = gen.data_len; in ioc_general()
4239 gen.command.u.raw64.sg_lst[1].sg_len = 0; in ioc_general()
4241 gen.command.u.raw64.sdata = paddr; in ioc_general()
4242 gen.command.u.raw64.sg_ranz = 0; in ioc_general()
4244 gen.command.u.raw64.sense_data = paddr + gen.data_len; in ioc_general()
4246 if (ha->raw_feat & SCATTER_GATHER) { in ioc_general()
4247 gen.command.u.raw.sdata = 0xffffffff; in ioc_general()
4248 gen.command.u.raw.sg_ranz = 1; in ioc_general()
4249 gen.command.u.raw.sg_lst[0].sg_ptr = (u32)paddr; in ioc_general()
4250 gen.command.u.raw.sg_lst[0].sg_len = gen.data_len; in ioc_general()
4251 gen.command.u.raw.sg_lst[1].sg_len = 0; in ioc_general()
4253 gen.command.u.raw.sdata = paddr; in ioc_general()
4254 gen.command.u.raw.sg_ranz = 0; in ioc_general()
4256 gen.command.u.raw.sense_data = (u32)paddr + gen.data_len; in ioc_general()
4259 gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); in ioc_general()
4260 return -EFAULT; in ioc_general()
4264 rval = __gdth_execute(ha->sdev, &gen.command, cmnd, gen.timeout, &gen.info); in ioc_general()
4266 gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); in ioc_general()
4269 gen.status = rval; in ioc_general()
4272 gen.data_len + gen.sense_len)) { in ioc_general()
4273 gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); in ioc_general()
4274 return -EFAULT; in ioc_general()
4276 if (copy_to_user(arg, &gen, in ioc_general()
4277 sizeof(gdth_ioctl_general) - sizeof(gdth_cmd_str))) { in ioc_general()
4278 gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); in ioc_general()
4279 return -EFAULT; in ioc_general()
4281 gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); in ioc_general()
4291 int rc = -ENOMEM; in ioc_hdrlist()
4300 (NULL == (ha = gdth_find_ha(rsc->ionode)))) { in ioc_hdrlist()
4301 rc = -EFAULT; in ioc_hdrlist()
4307 if (!ha->hdr[i].present) { in ioc_hdrlist()
4308 rsc->hdr_list[i].bus = 0xff; in ioc_hdrlist()
4311 rsc->hdr_list[i].bus = ha->virt_bus; in ioc_hdrlist()
4312 rsc->hdr_list[i].target = i; in ioc_hdrlist()
4313 rsc->hdr_list[i].lun = 0; in ioc_hdrlist()
4314 rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type; in ioc_hdrlist()
4315 if (ha->hdr[i].cluster_type & CLUSTER_DRIVE) { in ioc_hdrlist()
4316 cmd->Service = CACHESERVICE; in ioc_hdrlist()
4317 cmd->OpCode = GDT_CLUST_INFO; in ioc_hdrlist()
4318 if (ha->cache_feat & GDT_64BIT) in ioc_hdrlist()
4319 cmd->u.cache64.DeviceNo = i; in ioc_hdrlist()
4321 cmd->u.cache.DeviceNo = i; in ioc_hdrlist()
4322 if (__gdth_execute(ha->sdev, cmd, cmnd, 30, &cluster_type) == S_OK) in ioc_hdrlist()
4323 rsc->hdr_list[i].cluster_type = cluster_type; in ioc_hdrlist()
4328 rc = -EFAULT; in ioc_hdrlist()
4345 int rc = -ENOMEM; in ioc_rescan()
4355 (NULL == (ha = gdth_find_ha(rsc->ionode)))) { in ioc_rescan()
4356 rc = -EFAULT; in ioc_rescan()
4361 if (rsc->flag == 0) { in ioc_rescan()
4362 /* old method: re-init. cache service */ in ioc_rescan()
4363 cmd->Service = CACHESERVICE; in ioc_rescan()
4364 if (ha->cache_feat & GDT_64BIT) { in ioc_rescan()
4365 cmd->OpCode = GDT_X_INIT_HOST; in ioc_rescan()
4366 cmd->u.cache64.DeviceNo = LINUX_OS; in ioc_rescan()
4368 cmd->OpCode = GDT_INIT; in ioc_rescan()
4369 cmd->u.cache.DeviceNo = LINUX_OS; in ioc_rescan()
4372 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); in ioc_rescan()
4376 i = rsc->hdr_no; in ioc_rescan()
4381 cmd->Service = CACHESERVICE; in ioc_rescan()
4382 cmd->OpCode = GDT_INFO; in ioc_rescan()
4383 if (ha->cache_feat & GDT_64BIT) in ioc_rescan()
4384 cmd->u.cache64.DeviceNo = i; in ioc_rescan()
4386 cmd->u.cache.DeviceNo = i; in ioc_rescan()
4388 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); in ioc_rescan()
4390 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_rescan()
4391 rsc->hdr_list[i].bus = ha->virt_bus; in ioc_rescan()
4392 rsc->hdr_list[i].target = i; in ioc_rescan()
4393 rsc->hdr_list[i].lun = 0; in ioc_rescan()
4395 ha->hdr[i].present = FALSE; in ioc_rescan()
4397 ha->hdr[i].present = TRUE; in ioc_rescan()
4398 ha->hdr[i].size = info; in ioc_rescan()
4400 ha->hdr[i].size &= ~SECS32; in ioc_rescan()
4401 gdth_eval_mapping(ha->hdr[i].size,&cyls,&hds,&secs); in ioc_rescan()
4402 ha->hdr[i].heads = hds; in ioc_rescan()
4403 ha->hdr[i].secs = secs; in ioc_rescan()
4405 ha->hdr[i].size = cyls * hds * secs; in ioc_rescan()
4407 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_rescan()
4412 /* but we need ha->info2, not yet stored in scp->SCp */ in ioc_rescan()
4415 cmd->Service = CACHESERVICE; in ioc_rescan()
4416 cmd->OpCode = GDT_DEVTYPE; in ioc_rescan()
4417 if (ha->cache_feat & GDT_64BIT) in ioc_rescan()
4418 cmd->u.cache64.DeviceNo = i; in ioc_rescan()
4420 cmd->u.cache.DeviceNo = i; in ioc_rescan()
4422 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); in ioc_rescan()
4424 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_rescan()
4425 ha->hdr[i].devtype = (status == S_OK ? (u16)info : 0); in ioc_rescan()
4426 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_rescan()
4428 cmd->Service = CACHESERVICE; in ioc_rescan()
4429 cmd->OpCode = GDT_CLUST_INFO; in ioc_rescan()
4430 if (ha->cache_feat & GDT_64BIT) in ioc_rescan()
4431 cmd->u.cache64.DeviceNo = i; in ioc_rescan()
4433 cmd->u.cache.DeviceNo = i; in ioc_rescan()
4435 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); in ioc_rescan()
4437 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_rescan()
4438 ha->hdr[i].cluster_type = in ioc_rescan()
4440 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_rescan()
4441 rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type; in ioc_rescan()
4443 cmd->Service = CACHESERVICE; in ioc_rescan()
4444 cmd->OpCode = GDT_RW_ATTRIBS; in ioc_rescan()
4445 if (ha->cache_feat & GDT_64BIT) in ioc_rescan()
4446 cmd->u.cache64.DeviceNo = i; in ioc_rescan()
4448 cmd->u.cache.DeviceNo = i; in ioc_rescan()
4450 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); in ioc_rescan()
4452 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_rescan()
4453 ha->hdr[i].rw_attribs = (status == S_OK ? (u16)info : 0); in ioc_rescan()
4454 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_rescan()
4458 rc = -EFAULT; in ioc_rescan()
4485 return -EFAULT; in gdth_ioctl()
4493 return -EFAULT; in gdth_ioctl()
4505 return -EFAULT; in gdth_ioctl()
4515 return -EFAULT; in gdth_ioctl()
4517 if (ha->type == GDT_ISA || ha->type == GDT_EISA) { in gdth_ioctl()
4518 ctrt.type = (u8)((ha->stype>>20) - 0x10); in gdth_ioctl()
4520 if (ha->type != GDT_PCIMPR) { in gdth_ioctl()
4521 ctrt.type = (u8)((ha->stype<<4) + 6); in gdth_ioctl()
4524 (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe); in gdth_ioctl()
4525 if (ha->stype >= 0x300) in gdth_ioctl()
4526 ctrt.ext_type = 0x6000 | ha->pdev->subsystem_device; in gdth_ioctl()
4528 ctrt.ext_type = 0x6000 | ha->stype; in gdth_ioctl()
4530 ctrt.device_id = ha->pdev->device; in gdth_ioctl()
4531 ctrt.sub_device_id = ha->pdev->subsystem_device; in gdth_ioctl()
4533 ctrt.info = ha->brd_phys; in gdth_ioctl()
4534 ctrt.oem_id = ha->oem_id; in gdth_ioctl()
4536 return -EFAULT; in gdth_ioctl()
4556 return -EFAULT; in gdth_ioctl()
4559 if (i < ha->bus_cnt) { in gdth_ioctl()
4561 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_ioctl()
4562 ha->raw[i].lock = 1; in gdth_ioctl()
4563 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_ioctl()
4564 for (j = 0; j < ha->tid_cnt; ++j) in gdth_ioctl()
4567 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_ioctl()
4568 ha->raw[i].lock = 0; in gdth_ioctl()
4569 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_ioctl()
4570 for (j = 0; j < ha->tid_cnt; ++j) in gdth_ioctl()
4590 return -EFAULT; in gdth_ioctl()
4594 return -ENOMEM; in gdth_ioctl()
4595 scp->device = ha->sdev; in gdth_ioctl()
4596 scp->cmd_len = 12; in gdth_ioctl()
4597 scp->device->channel = res.number; in gdth_ioctl()
4603 return -EFAULT; in gdth_ioctl()
4636 TRACE2(("gdth_flush() hanum %d\n", ha->hanum)); in gdth_flush()
4639 if (ha->hdr[i].present) { in gdth_flush()
4643 if (ha->cache_feat & GDT_64BIT) { in gdth_flush()
4652 TRACE2(("gdth_flush(): flush ha %d drive %d\n", ha->hanum, i)); in gdth_flush()
4654 gdth_execute(ha->shost, &gdtcmd, cmnd, 30, NULL); in gdth_flush()
4662 sdev->skip_ms_page_3f = 1; in gdth_slave_configure()
4663 sdev->skip_ms_page_8 = 1; in gdth_slave_configure()
4679 .this_id = -1,
4696 return -ENXIO; in gdth_isa_probe_one()
4700 return -ENOMEM; in gdth_isa_probe_one()
4703 error = -ENODEV; in gdth_isa_probe_one()
4708 printk("Configuring GDT-ISA HA at BIOS 0x%05X IRQ %u DRQ %u\n", in gdth_isa_probe_one()
4709 isa_bios, ha->irq, ha->drq); in gdth_isa_probe_one()
4711 error = request_irq(ha->irq, gdth_interrupt, 0, "gdth", ha); in gdth_isa_probe_one()
4713 printk("GDT-ISA: Unable to allocate IRQ\n"); in gdth_isa_probe_one()
4717 error = request_dma(ha->drq, "gdth"); in gdth_isa_probe_one()
4719 printk("GDT-ISA: Unable to allocate DMA channel\n"); in gdth_isa_probe_one()
4723 set_dma_mode(ha->drq,DMA_MODE_CASCADE); in gdth_isa_probe_one()
4724 enable_dma(ha->drq); in gdth_isa_probe_one()
4725 shp->unchecked_isa_dma = 1; in gdth_isa_probe_one()
4726 shp->irq = ha->irq; in gdth_isa_probe_one()
4727 shp->dma_channel = ha->drq; in gdth_isa_probe_one()
4729 ha->hanum = gdth_ctr_count++; in gdth_isa_probe_one()
4730 ha->shost = shp; in gdth_isa_probe_one()
4732 ha->pccb = &ha->cmdext; in gdth_isa_probe_one()
4733 ha->ccb_phys = 0L; in gdth_isa_probe_one()
4734 ha->pdev = NULL; in gdth_isa_probe_one()
4736 error = -ENOMEM; in gdth_isa_probe_one()
4738 ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, in gdth_isa_probe_one()
4740 if (!ha->pscratch) in gdth_isa_probe_one()
4742 ha->scratch_phys = scratch_dma_handle; in gdth_isa_probe_one()
4744 ha->pmsg = pci_alloc_consistent(ha->pdev, sizeof(gdth_msg_str), in gdth_isa_probe_one()
4746 if (!ha->pmsg) in gdth_isa_probe_one()
4748 ha->msg_phys = scratch_dma_handle; in gdth_isa_probe_one()
4751 ha->coal_stat = pci_alloc_consistent(ha->pdev, in gdth_isa_probe_one()
4754 if (!ha->coal_stat) in gdth_isa_probe_one()
4756 ha->coal_stat_phys = scratch_dma_handle; in gdth_isa_probe_one()
4759 ha->scratch_busy = FALSE; in gdth_isa_probe_one()
4760 ha->req_first = NULL; in gdth_isa_probe_one()
4761 ha->tid_cnt = MAX_HDRIVES; in gdth_isa_probe_one()
4762 if (max_ids > 0 && max_ids < ha->tid_cnt) in gdth_isa_probe_one()
4763 ha->tid_cnt = max_ids; in gdth_isa_probe_one()
4765 ha->cmd_tab[i].cmnd = UNUSED_CMND; in gdth_isa_probe_one()
4766 ha->scan_mode = rescan ? 0x10 : 0; in gdth_isa_probe_one()
4768 error = -ENODEV; in gdth_isa_probe_one()
4770 printk("GDT-ISA: Error during device scan\n"); in gdth_isa_probe_one()
4774 if (hdr_channel < 0 || hdr_channel > ha->bus_cnt) in gdth_isa_probe_one()
4775 hdr_channel = ha->bus_cnt; in gdth_isa_probe_one()
4776 ha->virt_bus = hdr_channel; in gdth_isa_probe_one()
4778 if (ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) in gdth_isa_probe_one()
4779 shp->max_cmd_len = 16; in gdth_isa_probe_one()
4781 shp->max_id = ha->tid_cnt; in gdth_isa_probe_one()
4782 shp->max_lun = MAXLUN; in gdth_isa_probe_one()
4783 shp->max_channel = ha->bus_cnt; in gdth_isa_probe_one()
4785 spin_lock_init(&ha->smp_lock); in gdth_isa_probe_one()
4791 list_add_tail(&ha->list, &gdth_instances); in gdth_isa_probe_one()
4800 pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * MAXOFFSETS, in gdth_isa_probe_one()
4801 ha->coal_stat, ha->coal_stat_phys); in gdth_isa_probe_one()
4804 pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), in gdth_isa_probe_one()
4805 ha->pmsg, ha->msg_phys); in gdth_isa_probe_one()
4807 pci_free_consistent(ha->pdev, GDTH_SCRATCH, in gdth_isa_probe_one()
4808 ha->pscratch, ha->scratch_phys); in gdth_isa_probe_one()
4810 gdth_ctr_count--; in gdth_isa_probe_one()
4812 free_irq(ha->irq, ha); in gdth_isa_probe_one()
4828 return -ENXIO; in gdth_eisa_probe_one()
4832 return -ENOMEM; in gdth_eisa_probe_one()
4835 error = -ENODEV; in gdth_eisa_probe_one()
4840 printk("Configuring GDT-EISA HA at Slot %d IRQ %u\n", in gdth_eisa_probe_one()
4841 eisa_slot >> 12, ha->irq); in gdth_eisa_probe_one()
4843 error = request_irq(ha->irq, gdth_interrupt, 0, "gdth", ha); in gdth_eisa_probe_one()
4845 printk("GDT-EISA: Unable to allocate IRQ\n"); in gdth_eisa_probe_one()
4849 shp->unchecked_isa_dma = 0; in gdth_eisa_probe_one()
4850 shp->irq = ha->irq; in gdth_eisa_probe_one()
4851 shp->dma_channel = 0xff; in gdth_eisa_probe_one()
4853 ha->hanum = gdth_ctr_count++; in gdth_eisa_probe_one()
4854 ha->shost = shp; in gdth_eisa_probe_one()
4856 TRACE2(("EISA detect Bus 0: hanum %d\n", ha->hanum)); in gdth_eisa_probe_one()
4858 ha->pccb = &ha->cmdext; in gdth_eisa_probe_one()
4859 ha->ccb_phys = 0L; in gdth_eisa_probe_one()
4861 error = -ENOMEM; in gdth_eisa_probe_one()
4863 ha->pdev = NULL; in gdth_eisa_probe_one()
4864 ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, in gdth_eisa_probe_one()
4866 if (!ha->pscratch) in gdth_eisa_probe_one()
4868 ha->scratch_phys = scratch_dma_handle; in gdth_eisa_probe_one()
4870 ha->pmsg = pci_alloc_consistent(ha->pdev, sizeof(gdth_msg_str), in gdth_eisa_probe_one()
4872 if (!ha->pmsg) in gdth_eisa_probe_one()
4874 ha->msg_phys = scratch_dma_handle; in gdth_eisa_probe_one()
4877 ha->coal_stat = pci_alloc_consistent(ha->pdev, in gdth_eisa_probe_one()
4880 if (!ha->coal_stat) in gdth_eisa_probe_one()
4882 ha->coal_stat_phys = scratch_dma_handle; in gdth_eisa_probe_one()
4885 ha->ccb_phys = pci_map_single(ha->pdev,ha->pccb, in gdth_eisa_probe_one()
4887 if (!ha->ccb_phys) in gdth_eisa_probe_one()
4890 ha->scratch_busy = FALSE; in gdth_eisa_probe_one()
4891 ha->req_first = NULL; in gdth_eisa_probe_one()
4892 ha->tid_cnt = MAX_HDRIVES; in gdth_eisa_probe_one()
4893 if (max_ids > 0 && max_ids < ha->tid_cnt) in gdth_eisa_probe_one()
4894 ha->tid_cnt = max_ids; in gdth_eisa_probe_one()
4896 ha->cmd_tab[i].cmnd = UNUSED_CMND; in gdth_eisa_probe_one()
4897 ha->scan_mode = rescan ? 0x10 : 0; in gdth_eisa_probe_one()
4900 printk("GDT-EISA: Error during device scan\n"); in gdth_eisa_probe_one()
4901 error = -ENODEV; in gdth_eisa_probe_one()
4905 if (hdr_channel < 0 || hdr_channel > ha->bus_cnt) in gdth_eisa_probe_one()
4906 hdr_channel = ha->bus_cnt; in gdth_eisa_probe_one()
4907 ha->virt_bus = hdr_channel; in gdth_eisa_probe_one()
4909 if (ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) in gdth_eisa_probe_one()
4910 shp->max_cmd_len = 16; in gdth_eisa_probe_one()
4912 shp->max_id = ha->tid_cnt; in gdth_eisa_probe_one()
4913 shp->max_lun = MAXLUN; in gdth_eisa_probe_one()
4914 shp->max_channel = ha->bus_cnt; in gdth_eisa_probe_one()
4916 spin_lock_init(&ha->smp_lock); in gdth_eisa_probe_one()
4922 list_add_tail(&ha->list, &gdth_instances); in gdth_eisa_probe_one()
4930 pci_unmap_single(ha->pdev,ha->ccb_phys, sizeof(gdth_cmd_str), in gdth_eisa_probe_one()
4934 pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * MAXOFFSETS, in gdth_eisa_probe_one()
4935 ha->coal_stat, ha->coal_stat_phys); in gdth_eisa_probe_one()
4938 pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), in gdth_eisa_probe_one()
4939 ha->pmsg, ha->msg_phys); in gdth_eisa_probe_one()
4941 pci_free_consistent(ha->pdev, GDTH_SCRATCH, in gdth_eisa_probe_one()
4942 ha->pscratch, ha->scratch_phys); in gdth_eisa_probe_one()
4944 free_irq(ha->irq, ha); in gdth_eisa_probe_one()
4945 gdth_ctr_count--; in gdth_eisa_probe_one()
4959 struct pci_dev *pdev = pcistr->pdev; in gdth_pci_probe_one()
4965 return -ENOMEM; in gdth_pci_probe_one()
4968 error = -ENODEV; in gdth_pci_probe_one()
4973 printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n", in gdth_pci_probe_one()
4974 pdev->bus->number, in gdth_pci_probe_one()
4975 PCI_SLOT(pdev->devfn), in gdth_pci_probe_one()
4976 ha->irq); in gdth_pci_probe_one()
4978 error = request_irq(ha->irq, gdth_interrupt, in gdth_pci_probe_one()
4981 printk("GDT-PCI: Unable to allocate IRQ\n"); in gdth_pci_probe_one()
4985 shp->unchecked_isa_dma = 0; in gdth_pci_probe_one()
4986 shp->irq = ha->irq; in gdth_pci_probe_one()
4987 shp->dma_channel = 0xff; in gdth_pci_probe_one()
4989 ha->hanum = gdth_ctr_count++; in gdth_pci_probe_one()
4990 ha->shost = shp; in gdth_pci_probe_one()
4992 ha->pccb = &ha->cmdext; in gdth_pci_probe_one()
4993 ha->ccb_phys = 0L; in gdth_pci_probe_one()
4995 error = -ENOMEM; in gdth_pci_probe_one()
4997 ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, in gdth_pci_probe_one()
4999 if (!ha->pscratch) in gdth_pci_probe_one()
5001 ha->scratch_phys = scratch_dma_handle; in gdth_pci_probe_one()
5003 ha->pmsg = pci_alloc_consistent(ha->pdev, sizeof(gdth_msg_str), in gdth_pci_probe_one()
5005 if (!ha->pmsg) in gdth_pci_probe_one()
5007 ha->msg_phys = scratch_dma_handle; in gdth_pci_probe_one()
5010 ha->coal_stat = pci_alloc_consistent(ha->pdev, in gdth_pci_probe_one()
5013 if (!ha->coal_stat) in gdth_pci_probe_one()
5015 ha->coal_stat_phys = scratch_dma_handle; in gdth_pci_probe_one()
5018 ha->scratch_busy = FALSE; in gdth_pci_probe_one()
5019 ha->req_first = NULL; in gdth_pci_probe_one()
5020 ha->tid_cnt = pdev->device >= 0x200 ? MAXID : MAX_HDRIVES; in gdth_pci_probe_one()
5021 if (max_ids > 0 && max_ids < ha->tid_cnt) in gdth_pci_probe_one()
5022 ha->tid_cnt = max_ids; in gdth_pci_probe_one()
5024 ha->cmd_tab[i].cmnd = UNUSED_CMND; in gdth_pci_probe_one()
5025 ha->scan_mode = rescan ? 0x10 : 0; in gdth_pci_probe_one()
5027 error = -ENODEV; in gdth_pci_probe_one()
5029 printk("GDT-PCI %d: Error during device scan\n", ha->hanum); in gdth_pci_probe_one()
5033 if (hdr_channel < 0 || hdr_channel > ha->bus_cnt) in gdth_pci_probe_one()
5034 hdr_channel = ha->bus_cnt; in gdth_pci_probe_one()
5035 ha->virt_bus = hdr_channel; in gdth_pci_probe_one()
5037 /* 64-bit DMA only supported from FW >= x.43 */ in gdth_pci_probe_one()
5038 if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) || in gdth_pci_probe_one()
5039 !ha->dma64_support) { in gdth_pci_probe_one()
5041 printk(KERN_WARNING "GDT-PCI %d: " in gdth_pci_probe_one()
5042 "Unable to set 32-bit DMA\n", ha->hanum); in gdth_pci_probe_one()
5046 shp->max_cmd_len = 16; in gdth_pci_probe_one()
5048 printk("GDT-PCI %d: 64-bit DMA enabled\n", ha->hanum); in gdth_pci_probe_one()
5050 printk(KERN_WARNING "GDT-PCI %d: " in gdth_pci_probe_one()
5051 "Unable to set 64/32-bit DMA\n", ha->hanum); in gdth_pci_probe_one()
5056 shp->max_id = ha->tid_cnt; in gdth_pci_probe_one()
5057 shp->max_lun = MAXLUN; in gdth_pci_probe_one()
5058 shp->max_channel = ha->bus_cnt; in gdth_pci_probe_one()
5060 spin_lock_init(&ha->smp_lock); in gdth_pci_probe_one()
5063 error = scsi_add_host(shp, &pdev->dev); in gdth_pci_probe_one()
5066 list_add_tail(&ha->list, &gdth_instances); in gdth_pci_probe_one()
5068 pci_set_drvdata(ha->pdev, ha); in gdth_pci_probe_one()
5079 pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * MAXOFFSETS, in gdth_pci_probe_one()
5080 ha->coal_stat, ha->coal_stat_phys); in gdth_pci_probe_one()
5083 pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), in gdth_pci_probe_one()
5084 ha->pmsg, ha->msg_phys); in gdth_pci_probe_one()
5086 pci_free_consistent(ha->pdev, GDTH_SCRATCH, in gdth_pci_probe_one()
5087 ha->pscratch, ha->scratch_phys); in gdth_pci_probe_one()
5089 free_irq(ha->irq, ha); in gdth_pci_probe_one()
5090 gdth_ctr_count--; in gdth_pci_probe_one()
5099 struct Scsi_Host *shp = ha->shost; in gdth_remove_one()
5107 if (ha->sdev) { in gdth_remove_one()
5108 scsi_free_host_dev(ha->sdev); in gdth_remove_one()
5109 ha->sdev = NULL; in gdth_remove_one()
5112 if (shp->irq) in gdth_remove_one()
5113 free_irq(shp->irq,ha); in gdth_remove_one()
5116 if (shp->dma_channel != 0xff) in gdth_remove_one()
5117 free_dma(shp->dma_channel); in gdth_remove_one()
5120 if (ha->coal_stat) in gdth_remove_one()
5121 pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * in gdth_remove_one()
5122 MAXOFFSETS, ha->coal_stat, ha->coal_stat_phys); in gdth_remove_one()
5124 if (ha->pscratch) in gdth_remove_one()
5125 pci_free_consistent(ha->pdev, GDTH_SCRATCH, in gdth_remove_one()
5126 ha->pscratch, ha->scratch_phys); in gdth_remove_one()
5127 if (ha->pmsg) in gdth_remove_one()
5128 pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), in gdth_remove_one()
5129 ha->pmsg, ha->msg_phys); in gdth_remove_one()
5130 if (ha->ccb_phys) in gdth_remove_one()
5131 pci_unmap_single(ha->pdev,ha->ccb_phys, in gdth_remove_one()
5158 printk("GDT-HA: Controller driver disabled from" in gdth_init()
5163 printk("GDT-HA: Storage RAID Controller Driver. Version: %s\n", in gdth_init()
5197 return -ENODEV; in gdth_init()