Lines Matching refs:ha
146 static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
148 static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index,
150 static int gdth_async_event(gdth_ha_str *ha);
153 static void gdth_putq(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 priority);
154 static void gdth_next(gdth_ha_str *ha);
155 static int gdth_fill_raw_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 b);
156 static int gdth_special_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp);
157 static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, u16 source,
159 static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr);
160 static void gdth_readapp_event(gdth_ha_str *ha, u8 application,
164 static void gdth_copy_internal_data(gdth_ha_str *ha, struct scsi_cmnd *scp,
166 static int gdth_internal_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp);
167 static int gdth_fill_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp,
170 static void gdth_enable_int(gdth_ha_str *ha);
171 static int gdth_test_busy(gdth_ha_str *ha);
172 static int gdth_get_cmd_index(gdth_ha_str *ha);
173 static void gdth_release_event(gdth_ha_str *ha);
174 static int gdth_wait(gdth_ha_str *ha, int index,u32 time);
175 static int gdth_internal_cmd(gdth_ha_str *ha, u8 service, u16 opcode,
177 static int gdth_search_drives(gdth_ha_str *ha);
178 static int gdth_analyse_hdrive(gdth_ha_str *ha, u16 hdrive);
180 static const char *gdth_ctr_name(gdth_ha_str *ha);
187 static void gdth_flush(gdth_ha_str *ha);
189 static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp,
384 gdth_ha_str *ha; in gdth_find_ha() local
386 list_for_each_entry(ha, &gdth_instances, list) in gdth_find_ha()
387 if (hanum == ha->hanum) in gdth_find_ha()
388 return ha; in gdth_find_ha()
393 static struct gdth_cmndinfo *gdth_get_cmndinfo(gdth_ha_str *ha) in gdth_get_cmndinfo() argument
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()
410 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_get_cmndinfo()
449 gdth_ha_str *ha = shost_priv(sdev->host); in __gdth_execute() local
477 __gdth_queuecommand(ha, scp, &cmndinfo); in __gdth_execute()
574 static void gdth_remove_one(gdth_ha_str *ha);
596 gdth_ha_str *ha = pci_get_drvdata(pdev); in gdth_pci_remove_one() local
598 list_del(&ha->list); in gdth_pci_remove_one()
599 gdth_remove_one(ha); in gdth_pci_remove_one()
612 gdth_ha_str *ha = NULL; in gdth_pci_init_one() local
653 rc = gdth_pci_probe_one(&gdth_pcistr, &ha); in gdth_pci_init_one()
662 static int __init gdth_init_eisa(u16 eisa_adr,gdth_ha_str *ha) in gdth_init_eisa() argument
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()
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()
733 ha->irq); 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()
756 static int __init gdth_init_isa(u32 bios_adr,gdth_ha_str *ha) in gdth_init_isa() argument
765 ha->brd = ioremap(bios_adr, sizeof(gdt2_dpram_str)); in gdth_init_isa()
766 if (ha->brd == NULL) { in gdth_init_isa()
770 dp2_ptr = ha->brd; in gdth_init_isa()
776 iounmap(ha->brd); in gdth_init_isa()
792 ha->drq = gdth_drq_tab[i]; in gdth_init_isa()
800 ha->irq = gdth_irq_tab[i]; in gdth_init_isa()
811 iounmap(ha->brd); 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()
843 iounmap(ha->brd); in gdth_init_isa()
851 ha->dma64_support = 0; in gdth_init_isa()
858 gdth_ha_str *ha) in gdth_init_pci() argument
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()
887 dp6_ptr = ha->brd; 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()
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()
911 dp6_ptr = ha->brd; in gdth_init_pci()
921 iounmap(ha->brd); in gdth_init_pci()
928 iounmap(ha->brd); in gdth_init_pci()
946 iounmap(ha->brd); 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()
975 iounmap(ha->brd); 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()
992 iounmap(ha->brd); in gdth_init_pci()
996 dp6c_ptr = ha->brd; 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()
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()
1020 dp6c_ptr = ha->brd; in gdth_init_pci()
1030 iounmap(ha->brd); 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()
1051 outb(1,PTR2USHORT(&ha->plx->ldoor_reg)); in gdth_init_pci()
1058 iounmap(ha->brd); 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()
1081 outb(1,PTR2USHORT(&ha->plx->ldoor_reg)); in gdth_init_pci()
1088 iounmap(ha->brd); 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()
1111 dp6m_ptr = ha->brd; 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()
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()
1142 dp6m_ptr = ha->brd; in gdth_init_pci()
1152 iounmap(ha->brd); in gdth_init_pci()
1173 iounmap(ha->brd); 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()
1201 iounmap(ha->brd); in gdth_init_pci()
1216 iounmap(ha->brd); in gdth_init_pci()
1224 ha->dma64_support = 0; in gdth_init_pci()
1226 ha->dma64_support = 1; in gdth_init_pci()
1235 static void gdth_enable_int(gdth_ha_str *ha) in gdth_enable_int() argument
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()
1254 } else if (ha->type == GDT_PCI) { in gdth_enable_int()
1255 dp6_ptr = ha->brd; 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()
1268 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_enable_int()
1272 static u8 gdth_get_status(gdth_ha_str *ha) in gdth_get_status() argument
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()
1295 static int gdth_test_busy(gdth_ha_str *ha) in gdth_test_busy() argument
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()
1317 static int gdth_get_cmd_index(gdth_ha_str *ha) in gdth_get_cmd_index() argument
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()
1335 static void gdth_set_sema0(gdth_ha_str *ha) in gdth_set_sema0() argument
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()
1353 static void gdth_copy_command(gdth_ha_str *ha) in gdth_copy_command() argument
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()
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()
1387 } else if (ha->type == GDT_PCI) { in gdth_copy_command()
1388 dp6_ptr = ha->brd; in gdth_copy_command()
1394 } else if (ha->type == GDT_PCINEW) { in gdth_copy_command()
1395 dp6c_ptr = ha->brd; in gdth_copy_command()
1401 } else if (ha->type == GDT_PCIMPR) { in gdth_copy_command()
1402 dp6m_ptr = ha->brd; in gdth_copy_command()
1412 static void gdth_release_event(gdth_ha_str *ha) in gdth_release_event() argument
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()
1448 static int gdth_wait(gdth_ha_str *ha, int index, u32 time) in gdth_wait() argument
1453 TRACE(("gdth_wait() hanum %d index %d time %d\n", ha->hanum, index, time)); in gdth_wait()
1459 __gdth_interrupt(ha, true, &wait_index); in gdth_wait()
1467 while (gdth_test_busy(ha)) in gdth_wait()
1474 static int gdth_internal_cmd(gdth_ha_str *ha, u8 service, u16 opcode, in gdth_internal_cmd() argument
1482 cmd_ptr = ha->pccb; in gdth_internal_cmd()
1489 if (!(index=gdth_get_cmd_index(ha))) { in gdth_internal_cmd()
1493 gdth_set_sema0(ha); 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()
1512 if (ha->raw_feat & GDT_64BIT) { 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()
1533 gdth_copy_command(ha); in gdth_internal_cmd()
1534 gdth_release_event(ha); in gdth_internal_cmd()
1536 if (!gdth_wait(ha, index, INIT_TIMEOUT)) { 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()
1551 static int gdth_search_drives(gdth_ha_str *ha) in gdth_search_drives() argument
1572 TRACE(("gdth_search_drives() hanum %d\n", ha->hanum)); in gdth_search_drives()
1576 ha->screen_feat = 0; in gdth_search_drives()
1578 ok = gdth_internal_cmd(ha, SCREENSERVICE, GDT_X_INIT_SCR, 0, 0, 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()
1583 ok = gdth_internal_cmd(ha, SCREENSERVICE, GDT_INIT, 0, 0, 0); in gdth_search_drives()
1586 ha->hanum, ha->status); in gdth_search_drives()
1610 gdth_internal_cmd(ha, SCREENSERVICE, GDT_REALTIME, *(u32 *)&rtc[0], in gdth_search_drives()
1615 gdth_internal_cmd(ha, CACHESERVICE, GDT_UNFREEZE_IO, 0, 0, 0); in gdth_search_drives()
1618 ha->cache_feat = 0; in gdth_search_drives()
1620 ok = gdth_internal_cmd(ha, CACHESERVICE, GDT_X_INIT_HOST, LINUX_OS, 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()
1626 ok = gdth_internal_cmd(ha, CACHESERVICE, GDT_INIT, LINUX_OS, 0, 0); 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()
1642 *((u64 *)&pmod->st_buff_addr1) = ha->coal_stat_phys; in gdth_search_drives()
1658 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, SET_PERF_MODES, in gdth_search_drives()
1660 printk("GDT-HA %d: Interrupt coalescing activated\n", ha->hanum); in gdth_search_drives()
1666 iocr = (gdth_raw_iochan_str *)ha->pscratch; in gdth_search_drives()
1672 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, IOCHAN_RAW_DESC, 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()
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()
1687 if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, in gdth_search_drives()
1693 ha->hanum, ha->status); 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()
1708 if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_INFO, 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()
1721 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, BOARD_INFO, in gdth_search_drives()
1723 memcpy(&ha->binfo, (gdth_binfo_str *)ha->pscratch, in gdth_search_drives()
1725 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, BOARD_FEATURES, 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()
1746 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, IOCHAN_DESC, 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()
1761 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, 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()
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()
1773 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, 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()
1786 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_DRV_CNT, in gdth_search_drives()
1788 drv_cnt = *(u32 *)ha->pscratch; in gdth_search_drives()
1789 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_DRV_LIST, 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()
1803 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, 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()
1814 } else if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, 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()
1832 ok = gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_X_INIT_RAW, 0, 0, 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()
1837 ok = gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_INIT, 0, 0, 0); in gdth_search_drives()
1840 ha->hanum, ha->status); in gdth_search_drives()
1846 if (gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_SET_FEAT, SCATTER_GATHER, in gdth_search_drives()
1849 if (gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_GET_FEAT, 0, 0, 0)) { in gdth_search_drives()
1851 ha->info)); in gdth_search_drives()
1852 ha->raw_feat |= (u16)ha->info; in gdth_search_drives()
1857 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_SET_FEAT, 0, in gdth_search_drives()
1860 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_GET_FEAT, 0, 0, 0)) { in gdth_search_drives()
1862 ha->info)); in gdth_search_drives()
1863 ha->cache_feat |= (u16)ha->info; in gdth_search_drives()
1869 gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESERVE_ALL, 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()
1880 if (!gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESERVE, 0, 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()
1893 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, 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()
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()
1915 gdth_analyse_hdrive(ha, i); in gdth_search_drives()
1921 static int gdth_analyse_hdrive(gdth_ha_str *ha, u16 hdrive) in gdth_analyse_hdrive() argument
1926 TRACE(("gdth_analyse_hdrive() hanum %d drive %d\n", ha->hanum, hdrive)); in gdth_analyse_hdrive()
1930 if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_INFO, hdrive, 0, 0)) 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()
1950 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_X_INFO, hdrive, 0, 0) 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()
1959 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_DEVTYPE, hdrive, 0, 0)) { in gdth_analyse_hdrive()
1961 hdrive,ha->info)); in gdth_analyse_hdrive()
1962 ha->hdr[hdrive].devtype = (u16)ha->info; in gdth_analyse_hdrive()
1966 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_CLUST_INFO, hdrive, 0, 0)) { 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()
1974 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_RW_ATTRIBS, hdrive, 0, 0)) { 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()
1986 static void gdth_putq(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 priority) in gdth_putq() argument
1994 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_putq()
1999 if (ha->req_first==NULL) { in gdth_putq()
2000 ha->req_first = scp; /* queue was empty */ in gdth_putq()
2003 pscp = ha->req_first; 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()
2026 static void gdth_next(gdth_ha_str *ha) in gdth_next() argument
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()
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()
2061 if (gdth_test_busy(ha)) { /* controller busy ? */ 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()
2067 while (gdth_test_busy(ha)) 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()
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()
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()
2110 (ha->hdr[t].cluster_type & CLUSTER_DRIVE)) { in gdth_next()
2119 if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) in gdth_next()
2123 if (!(cmd_index=gdth_fill_raw_cmd(ha, nscp, BUS_L2P(ha, b)))) in gdth_next()
2137 if (!(cmd_index=gdth_special_cmd(ha, nscp))) 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()
2142 !(cmd_index=gdth_fill_raw_cmd(ha, nscp, BUS_L2P(ha, b)))) 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()
2167 if (ha->hdr[t].media_changed && nscp->cmnd[0] != INQUIRY) { in gdth_next()
2171 ha->hdr[t].media_changed = FALSE; in gdth_next()
2180 } else if (gdth_internal_cache_cmd(ha, nscp)) in gdth_next()
2188 if ( (nscp->cmnd[4]&1) && !(ha->hdr[t].devtype&1) ) { in gdth_next()
2197 nscp->cmnd[3] = (ha->hdr[t].devtype&1) ? 1:0; in gdth_next()
2200 if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) in gdth_next()
2209 if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) in gdth_next()
2219 if (ha->hdr[t].media_changed) { in gdth_next()
2223 ha->hdr[t].media_changed = FALSE; in gdth_next()
2232 } else if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) in gdth_next()
2241 ha->hanum, nscp->cmnd[0]); 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()
2261 if (ha->cmd_cnt > 0) { in gdth_next()
2262 gdth_release_event(ha); 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()
2269 if (!gdth_wait(ha, cmd_index, POLL_TIMEOUT)) in gdth_next()
2271 ha->hanum, cmd_index); in gdth_next()
2279 static void gdth_copy_internal_data(gdth_ha_str *ha, struct scsi_cmnd *scp, in gdth_copy_internal_data() argument
2301 ha->hanum); in gdth_copy_internal_data()
2316 ha->hanum); in gdth_copy_internal_data()
2321 static int gdth_internal_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp) in gdth_internal_cache_cmd() argument
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()
2360 gdth_copy_internal_data(ha, scp, (char*)&inq, sizeof(gdth_inq_data)); in gdth_internal_cache_cmd()
2370 gdth_copy_internal_data(ha, scp, (char*)&sd, sizeof(gdth_sense_data)); in gdth_internal_cache_cmd()
2377 mpd.hd.dev_par = (ha->hdr[t].devtype&2) ? 0x80:0; in gdth_internal_cache_cmd()
2382 gdth_copy_internal_data(ha, scp, (char*)&mpd, sizeof(gdth_modep_data)); 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()
2392 gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data)); 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()
2403 gdth_copy_internal_data(ha, scp, (char*)&rdc16, in gdth_internal_cache_cmd()
2423 static int gdth_fill_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp, in gdth_fill_cache_cmd() argument
2432 cmdp = ha->pccb; 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()
2447 if (!(cmd_index=gdth_get_cmd_index(ha))) { in gdth_fill_cache_cmd()
2452 if (ha->cmd_cnt == 0) in gdth_fill_cache_cmd()
2453 gdth_set_sema0(ha); 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()
2522 sgcnt = pci_map_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), in gdth_fill_cache_cmd()
2533 ha->dma64_cnt++; in gdth_fill_cache_cmd()
2535 ha->dma32_cnt++; in gdth_fill_cache_cmd()
2547 ha->dma32_cnt++; in gdth_fill_cache_cmd()
2570 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache64.sg_lst) + in gdth_fill_cache_cmd()
2579 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache.sg_lst) + 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()
2595 gdth_copy_command(ha); in gdth_fill_cache_cmd()
2599 static int gdth_fill_raw_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 b) in gdth_fill_raw_cmd() argument
2612 cmdp = ha->pccb; 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()
2624 if (!(cmd_index=gdth_get_cmd_index(ha))) { in gdth_fill_raw_cmd()
2629 if (ha->cmd_cnt == 0) in gdth_fill_raw_cmd()
2630 gdth_set_sema0(ha); in gdth_fill_raw_cmd()
2642 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst); in gdth_fill_raw_cmd()
2648 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst); in gdth_fill_raw_cmd()
2654 sense_paddr = pci_map_page(ha->pdev,page,offset, in gdth_fill_raw_cmd()
2697 sgcnt = pci_map_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), in gdth_fill_raw_cmd()
2708 ha->dma64_cnt++; in gdth_fill_raw_cmd()
2710 ha->dma32_cnt++; in gdth_fill_raw_cmd()
2722 ha->dma32_cnt++; in gdth_fill_raw_cmd()
2742 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst) + in gdth_fill_raw_cmd()
2750 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst) + 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()
2768 gdth_copy_command(ha); in gdth_fill_raw_cmd()
2772 static int gdth_special_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp) in gdth_special_cmd() argument
2778 cmdp= ha->pccb; in gdth_special_cmd()
2781 if (ha->type==GDT_EISA && ha->cmd_cnt>0) in gdth_special_cmd()
2788 if (!(cmd_index=gdth_get_cmd_index(ha))) { in gdth_special_cmd()
2794 if (ha->cmd_cnt == 0) in gdth_special_cmd()
2795 gdth_set_sema0(ha); in gdth_special_cmd()
2800 ha->cmd_len = 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()
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()
2833 gdth_copy_command(ha); in gdth_special_cmd()
2839 static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, u16 source, in gdth_store_event() argument
2882 static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr) in gdth_read_event() argument
2889 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_read_event()
2897 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_read_event()
2910 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_read_event()
2914 static void gdth_readapp_event(gdth_ha_str *ha, in gdth_readapp_event() argument
2923 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_readapp_event()
2943 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_readapp_event()
2957 static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, in __gdth_interrupt() argument
2975 TRACE(("gdth_interrupt() IRQ %d\n", ha->irq)); in __gdth_interrupt()
2985 spin_lock_irqsave(&ha->smp_lock, flags); in __gdth_interrupt()
2988 IStatus = gdth_get_status(ha); in __gdth_interrupt()
2992 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
3005 pcs = ha->coal_stat; 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()
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()
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()
3126 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
3131 IStatus,ha->status,ha->info)); in __gdth_interrupt()
3139 gdth_async_event(ha); in __gdth_interrupt()
3141 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
3142 gdth_next(ha); 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()
3176 rval = gdth_sync_event(ha,Service,IStatus,scp); 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()
3204 if (ha->type == GDT_PCIMPR && coalesced) { in __gdth_interrupt()
3210 gdth_next(ha); in __gdth_interrupt()
3216 gdth_ha_str *ha = dev_id; in gdth_interrupt() local
3218 return __gdth_interrupt(ha, false, NULL); in gdth_interrupt()
3221 static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index, in gdth_sync_event() argument
3229 cmdp = ha->pccb; in gdth_sync_event()
3231 service,ha->status)); in gdth_sync_event()
3234 msg = ha->pmsg; in gdth_sync_event()
3246 while (gdth_test_busy(ha)) in gdth_sync_event()
3250 gdth_get_cmd_index(ha); in gdth_sync_event()
3251 gdth_set_sema0(ha); 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()
3261 gdth_copy_command(ha); in gdth_sync_event()
3262 gdth_release_event(ha); in gdth_sync_event()
3280 while (gdth_test_busy(ha)) in gdth_sync_event()
3284 gdth_get_cmd_index(ha); in gdth_sync_event()
3285 gdth_set_sema0(ha); 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()
3295 gdth_copy_command(ha); in gdth_sync_event()
3296 gdth_release_event(ha); 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()
3316 pci_unmap_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), 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()
3325 cmndinfo->info = ha->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()
3336 if (ha->hdr[t].cluster_type & 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()
3349 ha->hdr[t].cluster_type &= ~CLUSTER_MOUNTED; in gdth_sync_event()
3350 ha->hdr[t].media_changed = TRUE; in gdth_sync_event()
3360 ha->hdr[t].cluster_type |= CLUSTER_RESERVED; in gdth_sync_event()
3362 ha->hdr[t].cluster_type &= ~CLUSTER_RESERVED; in gdth_sync_event()
3368 cmndinfo->status = ha->status; in gdth_sync_event()
3369 cmndinfo->info = ha->info; in gdth_sync_event()
3373 cmndinfo->OpCode, ha->status)); 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()
3390 ha->hdr[t].cluster_type &= ~CLUSTER_RESERVED; in gdth_sync_event()
3393 if (ha->status == (u16)S_CACHE_RESERV) { 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()
3417 scp->result = (DID_OK << 16) | ha->info; in gdth_sync_event()
3586 static int gdth_async_event(gdth_ha_str *ha) in gdth_async_event() argument
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()
3597 while (gdth_test_busy(ha)) in gdth_async_event()
3601 cmd_index = gdth_get_cmd_index(ha); in gdth_async_event()
3602 gdth_set_sema0(ha); 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()
3612 gdth_copy_command(ha); 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()
3620 gdth_release_event(ha); 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()
3714 gdth_ha_str *ha; in gdth_timeout() local
3722 ha = list_first_entry(&gdth_instances, gdth_ha_str, list); in gdth_timeout()
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()
3846 static const char *gdth_ctr_name(gdth_ha_str *ha) in gdth_ctr_name() argument
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()
3876 gdth_ha_str *ha = shost_priv(shp); in gdth_info() local
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() local
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() local
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()
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()
3942 while (gdth_test_busy(ha)) in gdth_eh_bus_reset()
3944 if (gdth_internal_cmd(ha, CACHESERVICE, 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()
3957 while (gdth_test_busy(ha)) in gdth_eh_bus_reset()
3959 gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESET_BUS, in gdth_eh_bus_reset()
3960 BUS_L2P(ha,b), 0, 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() local
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() local
4004 cmndinfo = gdth_get_cmndinfo(ha); in gdth_queuecommand_lck()
4011 return __gdth_queuecommand(ha, scp, cmndinfo); in gdth_queuecommand_lck()
4016 static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, in DEF_SCSI_QCMD()
4028 gdth_putq(ha, scp, cmndinfo->priority); in DEF_SCSI_QCMD()
4029 gdth_next(ha); in DEF_SCSI_QCMD()
4036 gdth_ha_str *ha; in gdth_open() local
4039 list_for_each_entry(ha, &gdth_instances, list) { in gdth_open()
4040 if (!ha->sdev) in gdth_open()
4041 ha->sdev = scsi_get_host_dev(ha->shost); in gdth_open()
4058 gdth_ha_str *ha; in ioc_event() local
4063 ha = gdth_find_ha(evt.ionode); in ioc_event()
4064 if (!ha) in ioc_event()
4076 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_event()
4077 gdth_store_event(ha, evt.event.event_source, evt.event.event_idx, in ioc_event()
4079 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_event()
4083 evt.handle = gdth_read_event(ha, evt.handle, &evt.event); in ioc_event()
4085 gdth_readapp_event(ha, evt.erase, &evt.event); in ioc_event()
4097 gdth_ha_str *ha; in ioc_lockdrv() local
4101 ha = gdth_find_ha(ldrv.ionode); in ioc_lockdrv()
4102 if (!ha) 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()
4118 gdth_next(ha); in ioc_lockdrv()
4128 gdth_ha_str *ha; in ioc_resetdrv() local
4134 ha = gdth_find_ha(res.ionode); in ioc_resetdrv()
4135 if (!ha) 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()
4163 gdth_ha_str *ha; in ioc_general() local
4168 ha = gdth_find_ha(gen.ionode); in ioc_general()
4169 if (!ha) in ioc_general()
4180 if (!(buf = gdth_ioctl_alloc(ha, 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()
4192 if (ha->cache_feat & GDT_64BIT) { in ioc_general()
4198 if (ha->cache_feat & SCATTER_GATHER) { in ioc_general()
4209 if (ha->cache_feat & SCATTER_GATHER) { in ioc_general()
4221 if (ha->raw_feat & GDT_64BIT) { in ioc_general()
4234 if (ha->raw_feat & SCATTER_GATHER) { in ioc_general()
4246 if (ha->raw_feat & SCATTER_GATHER) { in ioc_general()
4259 gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); 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()
4273 gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); in ioc_general()
4278 gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); in ioc_general()
4281 gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); in ioc_general()
4289 gdth_ha_str *ha; in ioc_hdrlist() local
4300 (NULL == (ha = gdth_find_ha(rsc->ionode)))) { in ioc_hdrlist()
4307 if (!ha->hdr[i].present) { in ioc_hdrlist()
4311 rsc->hdr_list[i].bus = ha->virt_bus; 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()
4318 if (ha->cache_feat & GDT_64BIT) in ioc_hdrlist()
4322 if (__gdth_execute(ha->sdev, cmd, cmnd, 30, &cluster_type) == S_OK) in ioc_hdrlist()
4347 gdth_ha_str *ha; in ioc_rescan() local
4355 (NULL == (ha = gdth_find_ha(rsc->ionode)))) { in ioc_rescan()
4364 if (ha->cache_feat & GDT_64BIT) { in ioc_rescan()
4372 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); in ioc_rescan()
4383 if (ha->cache_feat & GDT_64BIT) 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()
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()
4417 if (ha->cache_feat & GDT_64BIT) 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()
4430 if (ha->cache_feat & GDT_64BIT) 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()
4445 if (ha->cache_feat & GDT_64BIT) 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()
4470 gdth_ha_str *ha; in gdth_ioctl() local
4514 (NULL == (ha = gdth_find_ha(ctrt.ionode)))) 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()
4555 (NULL == (ha = gdth_find_ha(lchn.ionode)))) 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()
4565 gdth_wait_completion(ha, i, 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()
4571 gdth_next(ha); in gdth_ioctl()
4589 (NULL == (ha = gdth_find_ha(res.ionode)))) in gdth_ioctl()
4595 scp->device = ha->sdev; in gdth_ioctl()
4629 static void gdth_flush(gdth_ha_str *ha) in gdth_flush() argument
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()
4691 gdth_ha_str *ha; in gdth_isa_probe_one() local
4701 ha = shost_priv(shp); in gdth_isa_probe_one()
4704 if (!gdth_init_isa(isa_bios,ha)) 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()
4717 error = request_dma(ha->drq, "gdth"); 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()
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()
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()
4769 if (!gdth_search_drives(ha)) { 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()
4781 shp->max_id = ha->tid_cnt; 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()
4786 gdth_enable_int(ha); 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()
4812 free_irq(ha->irq, ha); in gdth_isa_probe_one()
4823 gdth_ha_str *ha; in gdth_eisa_probe_one() local
4833 ha = shost_priv(shp); in gdth_eisa_probe_one()
4836 if (!gdth_init_eisa(eisa_slot,ha)) 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()
4850 shp->irq = ha->irq; 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()
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()
4899 if (!gdth_search_drives(ha)) { 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()
4912 shp->max_id = ha->tid_cnt; 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()
4917 gdth_enable_int(ha); 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()
4956 gdth_ha_str *ha; in gdth_pci_probe_one() local
4966 ha = shost_priv(shp); in gdth_pci_probe_one()
4969 if (!gdth_init_pci(pdev, pcistr, ha)) 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()
4979 IRQF_SHARED, "gdth", ha); in gdth_pci_probe_one()
4986 shp->irq = ha->irq; 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()
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()
5028 if (!gdth_search_drives(ha)) { 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()
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()
5042 "Unable to set 32-bit DMA\n", ha->hanum); in gdth_pci_probe_one()
5048 printk("GDT-PCI %d: 64-bit DMA enabled\n", ha->hanum); 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()
5058 shp->max_channel = ha->bus_cnt; in gdth_pci_probe_one()
5060 spin_lock_init(&ha->smp_lock); in gdth_pci_probe_one()
5061 gdth_enable_int(ha); 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()
5073 *ha_out = 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()
5097 static void gdth_remove_one(gdth_ha_str *ha) in gdth_remove_one() argument
5099 struct Scsi_Host *shp = ha->shost; in gdth_remove_one()
5105 gdth_flush(ha); 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()
5113 free_irq(shp->irq,ha); 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()
5139 gdth_ha_str *ha; in gdth_halt() local
5145 list_for_each_entry(ha, &gdth_instances, list) in gdth_halt()
5146 gdth_flush(ha); in gdth_halt()
5193 gdth_ha_str *ha; in gdth_init() local
5195 list_for_each_entry(ha, &gdth_instances, list) in gdth_init()
5196 gdth_remove_one(ha); in gdth_init()
5211 gdth_ha_str *ha; in gdth_exit() local
5224 list_for_each_entry(ha, &gdth_instances, list) in gdth_exit()
5225 gdth_remove_one(ha); in gdth_exit()