Lines Matching refs:ha
119 static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
121 static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index,
123 static int gdth_async_event(gdth_ha_str *ha);
126 static void gdth_putq(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 priority);
127 static void gdth_next(gdth_ha_str *ha);
128 static int gdth_fill_raw_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 b);
129 static int gdth_special_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp);
130 static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, u16 source,
132 static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr);
133 static void gdth_readapp_event(gdth_ha_str *ha, u8 application,
137 static void gdth_copy_internal_data(gdth_ha_str *ha, struct scsi_cmnd *scp,
139 static int gdth_internal_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp);
140 static int gdth_fill_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp,
143 static void gdth_enable_int(gdth_ha_str *ha);
144 static int gdth_test_busy(gdth_ha_str *ha);
145 static int gdth_get_cmd_index(gdth_ha_str *ha);
146 static void gdth_release_event(gdth_ha_str *ha);
147 static int gdth_wait(gdth_ha_str *ha, int index,u32 time);
148 static int gdth_internal_cmd(gdth_ha_str *ha, u8 service, u16 opcode,
150 static int gdth_search_drives(gdth_ha_str *ha);
151 static int gdth_analyse_hdrive(gdth_ha_str *ha, u16 hdrive);
153 static const char *gdth_ctr_name(gdth_ha_str *ha);
160 static void gdth_flush(gdth_ha_str *ha);
162 static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp,
270 gdth_ha_str *ha; in gdth_find_ha() local
272 list_for_each_entry(ha, &gdth_instances, list) in gdth_find_ha()
273 if (hanum == ha->hanum) in gdth_find_ha()
274 return ha; in gdth_find_ha()
279 static struct gdth_cmndinfo *gdth_get_cmndinfo(gdth_ha_str *ha) in gdth_get_cmndinfo() argument
285 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_get_cmndinfo()
288 if (ha->cmndinfo[i].index == 0) { in gdth_get_cmndinfo()
289 priv = &ha->cmndinfo[i]; in gdth_get_cmndinfo()
296 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_get_cmndinfo()
335 gdth_ha_str *ha = shost_priv(sdev->host); in __gdth_execute() local
363 __gdth_queuecommand(ha, scp, &cmndinfo); in __gdth_execute()
421 static void gdth_remove_one(gdth_ha_str *ha);
443 gdth_ha_str *ha = pci_get_drvdata(pdev); in gdth_pci_remove_one() local
445 list_del(&ha->list); in gdth_pci_remove_one()
446 gdth_remove_one(ha); in gdth_pci_remove_one()
459 gdth_ha_str *ha = NULL; in gdth_pci_init_one() local
500 rc = gdth_pci_probe_one(&gdth_pcistr, &ha); in gdth_pci_init_one()
508 gdth_ha_str *ha) in gdth_init_pci() argument
521 ha->oem_id = OEM_ID_INTEL; in gdth_init_pci()
523 ha->oem_id = OEM_ID_ICP; in gdth_init_pci()
524 ha->brd_phys = (pdev->bus->number << 8) | (pdev->devfn & 0xf8); in gdth_init_pci()
525 ha->stype = (u32)pdev->device; in gdth_init_pci()
526 ha->irq = pdev->irq; in gdth_init_pci()
527 ha->pdev = pdev; in gdth_init_pci()
529 if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */ in gdth_init_pci()
530 TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); in gdth_init_pci()
531 ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str)); in gdth_init_pci()
532 if (ha->brd == NULL) { in gdth_init_pci()
537 dp6_ptr = ha->brd; in gdth_init_pci()
544 iounmap(ha->brd); in gdth_init_pci()
545 ha->brd = ioremap(i, sizeof(u16)); in gdth_init_pci()
546 if (ha->brd == NULL) { in gdth_init_pci()
550 if (readw(ha->brd) != 0xffff) { in gdth_init_pci()
554 iounmap(ha->brd); in gdth_init_pci()
556 ha->brd = ioremap(i, sizeof(gdt6_dpram_str)); in gdth_init_pci()
557 if (ha->brd == NULL) { in gdth_init_pci()
561 dp6_ptr = ha->brd; in gdth_init_pci()
571 iounmap(ha->brd); in gdth_init_pci()
578 iounmap(ha->brd); in gdth_init_pci()
596 iounmap(ha->brd); in gdth_init_pci()
606 iounmap(ha->brd); in gdth_init_pci()
610 ha->type = GDT_PCI; in gdth_init_pci()
611 ha->ic_all_size = sizeof(dp6_ptr->u); in gdth_init_pci()
625 iounmap(ha->brd); in gdth_init_pci()
633 ha->dma64_support = 0; in gdth_init_pci()
635 } else if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */ in gdth_init_pci()
636 ha->plx = (gdt6c_plx_regs *)pcistr->io; in gdth_init_pci()
638 pcistr->dpmem,ha->irq)); in gdth_init_pci()
639 ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6c_dpram_str)); in gdth_init_pci()
640 if (ha->brd == NULL) { in gdth_init_pci()
642 iounmap(ha->brd); in gdth_init_pci()
646 dp6c_ptr = ha->brd; in gdth_init_pci()
653 iounmap(ha->brd); in gdth_init_pci()
654 ha->brd = ioremap(i, sizeof(u16)); in gdth_init_pci()
655 if (ha->brd == NULL) { in gdth_init_pci()
659 if (readw(ha->brd) != 0xffff) { in gdth_init_pci()
663 iounmap(ha->brd); in gdth_init_pci()
665 ha->brd = ioremap(i, sizeof(gdt6c_dpram_str)); in gdth_init_pci()
666 if (ha->brd == NULL) { in gdth_init_pci()
670 dp6c_ptr = ha->brd; in gdth_init_pci()
680 iounmap(ha->brd); in gdth_init_pci()
687 iounmap(ha->brd); in gdth_init_pci()
692 outb(0x00,PTR2USHORT(&ha->plx->control1)); in gdth_init_pci()
693 outb(0xff,PTR2USHORT(&ha->plx->edoor_reg)); in gdth_init_pci()
701 outb(1,PTR2USHORT(&ha->plx->ldoor_reg)); in gdth_init_pci()
708 iounmap(ha->brd); in gdth_init_pci()
717 iounmap(ha->brd); in gdth_init_pci()
721 ha->type = GDT_PCINEW; in gdth_init_pci()
722 ha->ic_all_size = sizeof(dp6c_ptr->u); in gdth_init_pci()
731 outb(1,PTR2USHORT(&ha->plx->ldoor_reg)); in gdth_init_pci()
738 iounmap(ha->brd); in gdth_init_pci()
745 ha->dma64_support = 0; in gdth_init_pci()
748 TRACE2(("init_pci_mpr() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); in gdth_init_pci()
749 ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6m_dpram_str)); in gdth_init_pci()
750 if (ha->brd == NULL) { in gdth_init_pci()
761 dp6m_ptr = ha->brd; in gdth_init_pci()
775 iounmap(ha->brd); in gdth_init_pci()
776 ha->brd = ioremap(i, sizeof(u16)); in gdth_init_pci()
777 if (ha->brd == NULL) { in gdth_init_pci()
781 if (readw(ha->brd) != 0xffff) { in gdth_init_pci()
785 iounmap(ha->brd); in gdth_init_pci()
787 ha->brd = ioremap(i, sizeof(gdt6m_dpram_str)); in gdth_init_pci()
788 if (ha->brd == NULL) { in gdth_init_pci()
792 dp6m_ptr = ha->brd; in gdth_init_pci()
802 iounmap(ha->brd); in gdth_init_pci()
823 iounmap(ha->brd); in gdth_init_pci()
832 iounmap(ha->brd); in gdth_init_pci()
836 ha->type = GDT_PCIMPR; in gdth_init_pci()
837 ha->ic_all_size = sizeof(dp6m_ptr->u); in gdth_init_pci()
851 iounmap(ha->brd); in gdth_init_pci()
866 iounmap(ha->brd); in gdth_init_pci()
874 ha->dma64_support = 0; in gdth_init_pci()
876 ha->dma64_support = 1; in gdth_init_pci()
884 static void gdth_enable_int(gdth_ha_str *ha) in gdth_enable_int() argument
890 TRACE(("gdth_enable_int() hanum %d\n",ha->hanum)); in gdth_enable_int()
891 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_enable_int()
893 if (ha->type == GDT_PCI) { in gdth_enable_int()
894 dp6_ptr = ha->brd; in gdth_enable_int()
898 } else if (ha->type == GDT_PCINEW) { in gdth_enable_int()
899 outb(0xff, PTR2USHORT(&ha->plx->edoor_reg)); in gdth_enable_int()
900 outb(0x03, PTR2USHORT(&ha->plx->control1)); in gdth_enable_int()
901 } else if (ha->type == GDT_PCIMPR) { in gdth_enable_int()
902 dp6m_ptr = ha->brd; in gdth_enable_int()
907 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_enable_int()
911 static u8 gdth_get_status(gdth_ha_str *ha) in gdth_get_status() argument
915 TRACE(("gdth_get_status() irq %d ctr_count %d\n", ha->irq, gdth_ctr_count)); in gdth_get_status()
917 if (ha->type == GDT_PCI) in gdth_get_status()
919 readb(&((gdt6_dpram_str __iomem *)ha->brd)->u.ic.Cmd_Index); in gdth_get_status()
920 else if (ha->type == GDT_PCINEW) in gdth_get_status()
921 IStatus = inb(PTR2USHORT(&ha->plx->edoor_reg)); in gdth_get_status()
922 else if (ha->type == GDT_PCIMPR) in gdth_get_status()
924 readb(&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.edoor_reg); in gdth_get_status()
929 static int gdth_test_busy(gdth_ha_str *ha) in gdth_test_busy() argument
933 TRACE(("gdth_test_busy() hanum %d\n", ha->hanum)); in gdth_test_busy()
935 if (ha->type == GDT_PCI) in gdth_test_busy()
936 gdtsema0 = (int)readb(&((gdt6_dpram_str __iomem *)ha->brd)->u.ic.Sema0); in gdth_test_busy()
937 else if (ha->type == GDT_PCINEW) in gdth_test_busy()
938 gdtsema0 = (int)inb(PTR2USHORT(&ha->plx->sema0_reg)); in gdth_test_busy()
939 else if (ha->type == GDT_PCIMPR) in gdth_test_busy()
941 (int)readb(&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.sema0_reg); in gdth_test_busy()
947 static int gdth_get_cmd_index(gdth_ha_str *ha) in gdth_get_cmd_index() argument
951 TRACE(("gdth_get_cmd_index() hanum %d\n", ha->hanum)); in gdth_get_cmd_index()
954 if (ha->cmd_tab[i].cmnd == UNUSED_CMND) { in gdth_get_cmd_index()
955 ha->cmd_tab[i].cmnd = ha->pccb->RequestBuffer; in gdth_get_cmd_index()
956 ha->cmd_tab[i].service = ha->pccb->Service; in gdth_get_cmd_index()
957 ha->pccb->CommandIndex = (u32)i+2; in gdth_get_cmd_index()
965 static void gdth_set_sema0(gdth_ha_str *ha) in gdth_set_sema0() argument
967 TRACE(("gdth_set_sema0() hanum %d\n", ha->hanum)); in gdth_set_sema0()
969 if (ha->type == GDT_PCI) { in gdth_set_sema0()
970 writeb(1, &((gdt6_dpram_str __iomem *)ha->brd)->u.ic.Sema0); in gdth_set_sema0()
971 } else if (ha->type == GDT_PCINEW) { in gdth_set_sema0()
972 outb(1, PTR2USHORT(&ha->plx->sema0_reg)); in gdth_set_sema0()
973 } else if (ha->type == GDT_PCIMPR) { in gdth_set_sema0()
974 writeb(1, &((gdt6m_dpram_str __iomem *)ha->brd)->i960r.sema0_reg); in gdth_set_sema0()
979 static void gdth_copy_command(gdth_ha_str *ha) in gdth_copy_command() argument
987 TRACE(("gdth_copy_command() hanum %d\n", ha->hanum)); in gdth_copy_command()
989 cp_count = ha->cmd_len; in gdth_copy_command()
990 dp_offset= ha->cmd_offs_dpmem; in gdth_copy_command()
991 cmd_no = ha->cmd_cnt; in gdth_copy_command()
992 cmd_ptr = ha->pccb; in gdth_copy_command()
994 ++ha->cmd_cnt; in gdth_copy_command()
1000 ha->cmd_offs_dpmem += cp_count; in gdth_copy_command()
1003 if (ha->type == GDT_PCI) { in gdth_copy_command()
1004 dp6_ptr = ha->brd; in gdth_copy_command()
1010 } else if (ha->type == GDT_PCINEW) { in gdth_copy_command()
1011 dp6c_ptr = ha->brd; in gdth_copy_command()
1017 } else if (ha->type == GDT_PCIMPR) { in gdth_copy_command()
1018 dp6m_ptr = ha->brd; in gdth_copy_command()
1028 static void gdth_release_event(gdth_ha_str *ha) in gdth_release_event() argument
1030 TRACE(("gdth_release_event() hanum %d\n", ha->hanum)); in gdth_release_event()
1036 if (ha->cmd_tab[j].cmnd != UNUSED_CMND) in gdth_release_event()
1046 if (ha->pccb->OpCode == GDT_INIT) in gdth_release_event()
1047 ha->pccb->Service |= 0x80; in gdth_release_event()
1049 if (ha->type == GDT_PCI) { in gdth_release_event()
1050 writeb(0, &((gdt6_dpram_str __iomem *)ha->brd)->io.event); in gdth_release_event()
1051 } else if (ha->type == GDT_PCINEW) { in gdth_release_event()
1052 outb(1, PTR2USHORT(&ha->plx->ldoor_reg)); in gdth_release_event()
1053 } else if (ha->type == GDT_PCIMPR) { in gdth_release_event()
1054 writeb(1, &((gdt6m_dpram_str __iomem *)ha->brd)->i960r.ldoor_reg); in gdth_release_event()
1058 static int gdth_wait(gdth_ha_str *ha, int index, u32 time) in gdth_wait() argument
1063 TRACE(("gdth_wait() hanum %d index %d time %d\n", ha->hanum, index, time)); in gdth_wait()
1069 __gdth_interrupt(ha, true, &wait_index); in gdth_wait()
1077 while (gdth_test_busy(ha)) in gdth_wait()
1084 static int gdth_internal_cmd(gdth_ha_str *ha, u8 service, u16 opcode, in gdth_internal_cmd() argument
1092 cmd_ptr = ha->pccb; in gdth_internal_cmd()
1099 if (!(index=gdth_get_cmd_index(ha))) { in gdth_internal_cmd()
1103 gdth_set_sema0(ha); in gdth_internal_cmd()
1111 cmd_ptr->u.ioctl.p_param = ha->scratch_phys; in gdth_internal_cmd()
1113 if (ha->cache_feat & GDT_64BIT) { in gdth_internal_cmd()
1122 if (ha->raw_feat & GDT_64BIT) { in gdth_internal_cmd()
1140 ha->cmd_len = sizeof(gdth_cmd_str); in gdth_internal_cmd()
1141 ha->cmd_offs_dpmem = 0; in gdth_internal_cmd()
1142 ha->cmd_cnt = 0; in gdth_internal_cmd()
1143 gdth_copy_command(ha); in gdth_internal_cmd()
1144 gdth_release_event(ha); in gdth_internal_cmd()
1146 if (!gdth_wait(ha, index, INIT_TIMEOUT)) { in gdth_internal_cmd()
1150 if (ha->status != S_BSY || --retries == 0) in gdth_internal_cmd()
1155 return (ha->status != S_OK ? 0:1); in gdth_internal_cmd()
1161 static int gdth_search_drives(gdth_ha_str *ha) in gdth_search_drives() argument
1174 TRACE(("gdth_search_drives() hanum %d\n", ha->hanum)); in gdth_search_drives()
1178 ha->screen_feat = 0; in gdth_search_drives()
1180 ok = gdth_internal_cmd(ha, SCREENSERVICE, GDT_X_INIT_SCR, 0, 0, 0); in gdth_search_drives()
1182 ha->screen_feat = GDT_64BIT; in gdth_search_drives()
1184 if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC)) in gdth_search_drives()
1185 ok = gdth_internal_cmd(ha, SCREENSERVICE, GDT_INIT, 0, 0, 0); in gdth_search_drives()
1188 ha->hanum, ha->status); in gdth_search_drives()
1194 gdth_internal_cmd(ha, CACHESERVICE, GDT_UNFREEZE_IO, 0, 0, 0); in gdth_search_drives()
1197 ha->cache_feat = 0; in gdth_search_drives()
1199 ok = gdth_internal_cmd(ha, CACHESERVICE, GDT_X_INIT_HOST, LINUX_OS, in gdth_search_drives()
1202 ha->cache_feat = GDT_64BIT; in gdth_search_drives()
1204 if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC)) in gdth_search_drives()
1205 ok = gdth_internal_cmd(ha, CACHESERVICE, GDT_INIT, LINUX_OS, 0, 0); in gdth_search_drives()
1208 ha->hanum, ha->status); in gdth_search_drives()
1212 cdev_cnt = (u16)ha->info; in gdth_search_drives()
1213 ha->fw_vers = ha->service; in gdth_search_drives()
1216 iocr = (gdth_raw_iochan_str *)ha->pscratch; in gdth_search_drives()
1222 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, IOCHAN_RAW_DESC, in gdth_search_drives()
1225 ha->bus_cnt = iocr->hdr.chan_count; in gdth_search_drives()
1226 for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { in gdth_search_drives()
1228 ha->bus_id[bus_no] = iocr->list[bus_no].proc_id; in gdth_search_drives()
1230 ha->bus_id[bus_no] = 0xff; in gdth_search_drives()
1234 chn = (gdth_getch_str *)ha->pscratch; in gdth_search_drives()
1237 if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, in gdth_search_drives()
1243 ha->hanum, ha->status); in gdth_search_drives()
1249 ha->bus_id[bus_no] = chn->siop_id; in gdth_search_drives()
1251 ha->bus_id[bus_no] = 0xff; in gdth_search_drives()
1253 ha->bus_cnt = (u8)bus_no; in gdth_search_drives()
1255 TRACE2(("gdth_search_drives() %d channels\n",ha->bus_cnt)); in gdth_search_drives()
1258 if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_INFO, in gdth_search_drives()
1261 ha->hanum, ha->status); in gdth_search_drives()
1264 ha->cpar = ((gdth_cinfo_str *)ha->pscratch)->cpar; in gdth_search_drives()
1266 ha->cpar.version,ha->cpar.state,ha->cpar.strategy, in gdth_search_drives()
1267 ha->cpar.write_back,ha->cpar.block_size)); in gdth_search_drives()
1270 ha->more_proc = FALSE; in gdth_search_drives()
1271 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, BOARD_INFO, in gdth_search_drives()
1273 memcpy(&ha->binfo, (gdth_binfo_str *)ha->pscratch, in gdth_search_drives()
1275 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, BOARD_FEATURES, in gdth_search_drives()
1278 ha->bfeat = *(gdth_bfeat_str *)ha->pscratch; in gdth_search_drives()
1279 ha->more_proc = TRUE; in gdth_search_drives()
1283 strcpy(ha->binfo.type_string, gdth_ctr_name(ha)); in gdth_search_drives()
1285 TRACE2(("Controller name: %s\n",ha->binfo.type_string)); in gdth_search_drives()
1288 if (ha->more_proc) { in gdth_search_drives()
1290 ioc = (gdth_iochan_str *)ha->pscratch; in gdth_search_drives()
1296 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, IOCHAN_DESC, in gdth_search_drives()
1298 for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { in gdth_search_drives()
1299 ha->raw[bus_no].address = ioc->list[bus_no].address; in gdth_search_drives()
1300 ha->raw[bus_no].local_no = ioc->list[bus_no].local_no; in gdth_search_drives()
1303 for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { in gdth_search_drives()
1304 ha->raw[bus_no].address = IO_CHANNEL; in gdth_search_drives()
1305 ha->raw[bus_no].local_no = bus_no; in gdth_search_drives()
1308 for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { in gdth_search_drives()
1309 chn = (gdth_getch_str *)ha->pscratch; in gdth_search_drives()
1310 chn->channel_no = ha->raw[bus_no].local_no; in gdth_search_drives()
1311 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, in gdth_search_drives()
1313 ha->raw[bus_no].address | INVALID_CHANNEL, in gdth_search_drives()
1315 ha->raw[bus_no].pdev_cnt = chn->drive_cnt; in gdth_search_drives()
1319 if (ha->raw[bus_no].pdev_cnt > 0) { in gdth_search_drives()
1320 drl = (gdth_drlist_str *)ha->pscratch; in gdth_search_drives()
1321 drl->sc_no = ha->raw[bus_no].local_no; in gdth_search_drives()
1322 drl->sc_cnt = ha->raw[bus_no].pdev_cnt; in gdth_search_drives()
1323 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, in gdth_search_drives()
1325 ha->raw[bus_no].address | INVALID_CHANNEL, in gdth_search_drives()
1327 for (j = 0; j < ha->raw[bus_no].pdev_cnt; ++j) in gdth_search_drives()
1328 ha->raw[bus_no].id_list[j] = drl->sc_list[j]; in gdth_search_drives()
1330 ha->raw[bus_no].pdev_cnt = 0; in gdth_search_drives()
1336 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_DRV_CNT, in gdth_search_drives()
1338 drv_cnt = *(u32 *)ha->pscratch; in gdth_search_drives()
1339 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_DRV_LIST, in gdth_search_drives()
1342 drv_no = ((u32 *)ha->pscratch)[j]; in gdth_search_drives()
1344 ha->hdr[drv_no].is_logdrv = TRUE; in gdth_search_drives()
1349 alst = (gdth_arcdl_str *)ha->pscratch; in gdth_search_drives()
1353 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, in gdth_search_drives()
1358 ha->hdr[j].is_arraydrv = alst->list[j].is_arrayd; in gdth_search_drives()
1359 ha->hdr[j].is_master = alst->list[j].is_master; in gdth_search_drives()
1360 ha->hdr[j].is_parity = alst->list[j].is_parity; in gdth_search_drives()
1361 ha->hdr[j].is_hotfix = alst->list[j].is_hotfix; in gdth_search_drives()
1362 ha->hdr[j].master_no = alst->list[j].cd_handle; in gdth_search_drives()
1364 } else if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, in gdth_search_drives()
1368 alst2 = &((gdth_alist_str *)ha->pscratch)[j]; in gdth_search_drives()
1369 ha->hdr[j].is_arraydrv = alst2->is_arrayd; in gdth_search_drives()
1370 ha->hdr[j].is_master = alst2->is_master; in gdth_search_drives()
1371 ha->hdr[j].is_parity = alst2->is_parity; in gdth_search_drives()
1372 ha->hdr[j].is_hotfix = alst2->is_hotfix; in gdth_search_drives()
1373 ha->hdr[j].master_no = alst2->cd_handle; in gdth_search_drives()
1380 ha->raw_feat = 0; in gdth_search_drives()
1382 ok = gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_X_INIT_RAW, 0, 0, 0); in gdth_search_drives()
1384 ha->raw_feat = GDT_64BIT; in gdth_search_drives()
1386 if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC)) in gdth_search_drives()
1387 ok = gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_INIT, 0, 0, 0); in gdth_search_drives()
1390 ha->hanum, ha->status); in gdth_search_drives()
1396 if (gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_SET_FEAT, SCATTER_GATHER, in gdth_search_drives()
1399 if (gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_GET_FEAT, 0, 0, 0)) { in gdth_search_drives()
1401 ha->info)); in gdth_search_drives()
1402 ha->raw_feat |= (u16)ha->info; in gdth_search_drives()
1407 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_SET_FEAT, 0, in gdth_search_drives()
1410 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_GET_FEAT, 0, 0, 0)) { in gdth_search_drives()
1412 ha->info)); in gdth_search_drives()
1413 ha->cache_feat |= (u16)ha->info; in gdth_search_drives()
1419 gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESERVE_ALL, in gdth_search_drives()
1422 ha->status)); in gdth_search_drives()
1425 if (reserve_list[i] == ha->hanum && reserve_list[i+1] < ha->bus_cnt && in gdth_search_drives()
1426 reserve_list[i+2] < ha->tid_cnt && reserve_list[i+3] < MAXLUN) { in gdth_search_drives()
1430 if (!gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESERVE, 0, in gdth_search_drives()
1434 ha->hanum, ha->status); in gdth_search_drives()
1440 oemstr = (gdth_oem_str_ioctl *)ha->pscratch; in gdth_search_drives()
1443 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, in gdth_search_drives()
1448 ha->hanum, oemstr->text.oem_company_name, ha->binfo.type_string); in gdth_search_drives()
1450 strlcpy(ha->oem_name,oemstr->text.scsi_host_drive_inquiry_vendor_id, in gdth_search_drives()
1451 sizeof(ha->oem_name)); in gdth_search_drives()
1456 ha->hanum, ha->binfo.type_string); in gdth_search_drives()
1457 if (ha->oem_id == OEM_ID_INTEL) in gdth_search_drives()
1458 strlcpy(ha->oem_name,"Intel ", sizeof(ha->oem_name)); in gdth_search_drives()
1460 strlcpy(ha->oem_name,"ICP ", sizeof(ha->oem_name)); in gdth_search_drives()
1465 gdth_analyse_hdrive(ha, i); in gdth_search_drives()
1471 static int gdth_analyse_hdrive(gdth_ha_str *ha, u16 hdrive) in gdth_analyse_hdrive() argument
1476 TRACE(("gdth_analyse_hdrive() hanum %d drive %d\n", ha->hanum, hdrive)); in gdth_analyse_hdrive()
1480 if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_INFO, hdrive, 0, 0)) in gdth_analyse_hdrive()
1482 ha->hdr[hdrive].present = TRUE; in gdth_analyse_hdrive()
1483 ha->hdr[hdrive].size = ha->info; in gdth_analyse_hdrive()
1486 ha->hdr[hdrive].size &= ~SECS32; in gdth_analyse_hdrive()
1487 if (ha->info2 == 0) { in gdth_analyse_hdrive()
1488 gdth_eval_mapping(ha->hdr[hdrive].size,&drv_cyls,&drv_hds,&drv_secs); in gdth_analyse_hdrive()
1490 drv_hds = ha->info2 & 0xff; in gdth_analyse_hdrive()
1491 drv_secs = (ha->info2 >> 8) & 0xff; in gdth_analyse_hdrive()
1492 drv_cyls = (u32)ha->hdr[hdrive].size / drv_hds / drv_secs; in gdth_analyse_hdrive()
1494 ha->hdr[hdrive].heads = (u8)drv_hds; in gdth_analyse_hdrive()
1495 ha->hdr[hdrive].secs = (u8)drv_secs; in gdth_analyse_hdrive()
1497 ha->hdr[hdrive].size = drv_cyls * drv_hds * drv_secs; in gdth_analyse_hdrive()
1499 if (ha->cache_feat & GDT_64BIT) { in gdth_analyse_hdrive()
1500 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_X_INFO, hdrive, 0, 0) in gdth_analyse_hdrive()
1501 && ha->info2 != 0) { in gdth_analyse_hdrive()
1502 ha->hdr[hdrive].size = ((u64)ha->info2 << 32) | ha->info; in gdth_analyse_hdrive()
1506 hdrive,ha->hdr[hdrive].size,drv_hds,drv_secs)); in gdth_analyse_hdrive()
1509 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_DEVTYPE, hdrive, 0, 0)) { in gdth_analyse_hdrive()
1511 hdrive,ha->info)); in gdth_analyse_hdrive()
1512 ha->hdr[hdrive].devtype = (u16)ha->info; in gdth_analyse_hdrive()
1516 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_CLUST_INFO, hdrive, 0, 0)) { in gdth_analyse_hdrive()
1518 hdrive,ha->info)); in gdth_analyse_hdrive()
1520 ha->hdr[hdrive].cluster_type = (u8)ha->info; in gdth_analyse_hdrive()
1524 if (gdth_internal_cmd(ha, CACHESERVICE, GDT_RW_ATTRIBS, hdrive, 0, 0)) { in gdth_analyse_hdrive()
1526 hdrive,ha->info)); in gdth_analyse_hdrive()
1527 ha->hdr[hdrive].rw_attribs = (u8)ha->info; in gdth_analyse_hdrive()
1536 static void gdth_putq(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 priority) in gdth_putq() argument
1544 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_putq()
1549 if (ha->req_first==NULL) { in gdth_putq()
1550 ha->req_first = scp; /* queue was empty */ in gdth_putq()
1553 pscp = ha->req_first; in gdth_putq()
1563 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_putq()
1567 for (nscp=ha->req_first; nscp; nscp=(struct scsi_cmnd*)nscp->SCp.ptr) in gdth_putq()
1576 static void gdth_next(gdth_ha_str *ha) in gdth_next() argument
1585 TRACE(("gdth_next() hanum %d\n", ha->hanum)); in gdth_next()
1587 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_next()
1589 ha->cmd_cnt = ha->cmd_offs_dpmem = 0; in gdth_next()
1594 for (nscp = pscp = ha->req_first; nscp; nscp = (struct scsi_cmnd *)nscp->SCp.ptr) { in gdth_next()
1603 if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) || in gdth_next()
1604 (b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock)) in gdth_next()
1611 if (gdth_test_busy(ha)) { /* controller busy ? */ in gdth_next()
1612 TRACE(("gdth_next() controller %d busy !\n", ha->hanum)); in gdth_next()
1614 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_next()
1617 while (gdth_test_busy(ha)) in gdth_next()
1630 if ((ha->scan_mode & 0x0f) == 0) { in gdth_next()
1632 ha->scan_mode |= 1; in gdth_next()
1633 TRACE2(("Scan mode: 0x%x\n", ha->scan_mode)); in gdth_next()
1635 } else if ((ha->scan_mode & 0x0f) == 1) { in gdth_next()
1639 nscp_cmndinfo->phase = ((ha->scan_mode & 0x10 ? 1:0) << 8) in gdth_next()
1641 ha->scan_mode = 0x12; in gdth_next()
1643 ha->scan_mode)); in gdth_next()
1645 ha->scan_mode &= 0x10; in gdth_next()
1646 TRACE2(("Scan mode: 0x%x\n", ha->scan_mode)); in gdth_next()
1648 } else if (ha->scan_mode == 0x12) { in gdth_next()
1649 if (b == ha->bus_cnt && t == ha->tid_cnt-1) { in gdth_next()
1652 ha->scan_mode &= 0x10; in gdth_next()
1654 ha->scan_mode)); in gdth_next()
1658 if (b == ha->virt_bus && nscp->cmnd[0] != INQUIRY && in gdth_next()
1660 (ha->hdr[t].cluster_type & CLUSTER_DRIVE)) { in gdth_next()
1669 if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) in gdth_next()
1673 if (!(cmd_index=gdth_fill_raw_cmd(ha, nscp, BUS_L2P(ha, b)))) in gdth_next()
1687 if (!(cmd_index=gdth_special_cmd(ha, nscp))) in gdth_next()
1690 } else if (b != ha->virt_bus) { in gdth_next()
1691 if (ha->raw[BUS_L2P(ha,b)].io_cnt[t] >= GDTH_MAX_RAW || in gdth_next()
1692 !(cmd_index=gdth_fill_raw_cmd(ha, nscp, BUS_L2P(ha, b)))) in gdth_next()
1695 ha->raw[BUS_L2P(ha,b)].io_cnt[t]++; in gdth_next()
1696 } else if (t >= MAX_HDRIVES || !ha->hdr[t].present || l != 0) { in gdth_next()
1717 if (ha->hdr[t].media_changed && nscp->cmnd[0] != INQUIRY) { in gdth_next()
1721 ha->hdr[t].media_changed = FALSE; in gdth_next()
1730 } else if (gdth_internal_cache_cmd(ha, nscp)) in gdth_next()
1738 if ( (nscp->cmnd[4]&1) && !(ha->hdr[t].devtype&1) ) { in gdth_next()
1747 nscp->cmnd[3] = (ha->hdr[t].devtype&1) ? 1:0; in gdth_next()
1750 if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) in gdth_next()
1759 if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) in gdth_next()
1769 if (ha->hdr[t].media_changed) { in gdth_next()
1773 ha->hdr[t].media_changed = FALSE; in gdth_next()
1782 } else if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) in gdth_next()
1791 ha->hanum, nscp->cmnd[0]); in gdth_next()
1803 if (nscp == ha->req_first) in gdth_next()
1804 ha->req_first = pscp = (struct scsi_cmnd *)nscp->SCp.ptr; in gdth_next()
1811 if (ha->cmd_cnt > 0) { in gdth_next()
1812 gdth_release_event(ha); in gdth_next()
1816 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_next()
1818 if (gdth_polling && ha->cmd_cnt > 0) { in gdth_next()
1819 if (!gdth_wait(ha, cmd_index, POLL_TIMEOUT)) in gdth_next()
1821 ha->hanum, cmd_index); in gdth_next()
1829 static void gdth_copy_internal_data(gdth_ha_str *ha, struct scsi_cmnd *scp, in gdth_copy_internal_data() argument
1851 ha->hanum); in gdth_copy_internal_data()
1866 ha->hanum); in gdth_copy_internal_data()
1871 static int gdth_internal_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp) in gdth_internal_cache_cmd() argument
1896 t,ha->hdr[t].devtype)); in gdth_internal_cache_cmd()
1897 inq.type_qual = (ha->hdr[t].devtype&4) ? TYPE_ROM:TYPE_DISK; in gdth_internal_cache_cmd()
1901 if ((ha->hdr[t].devtype & 1) || in gdth_internal_cache_cmd()
1902 (ha->hdr[t].cluster_type & CLUSTER_DRIVE)) in gdth_internal_cache_cmd()
1907 strcpy(inq.vendor,ha->oem_name); in gdth_internal_cache_cmd()
1910 gdth_copy_internal_data(ha, scp, (char*)&inq, sizeof(gdth_inq_data)); in gdth_internal_cache_cmd()
1920 gdth_copy_internal_data(ha, scp, (char*)&sd, sizeof(gdth_sense_data)); in gdth_internal_cache_cmd()
1927 mpd.hd.dev_par = (ha->hdr[t].devtype&2) ? 0x80:0; in gdth_internal_cache_cmd()
1932 gdth_copy_internal_data(ha, scp, (char*)&mpd, sizeof(gdth_modep_data)); in gdth_internal_cache_cmd()
1937 if (ha->hdr[t].size > (u64)0xffffffff) in gdth_internal_cache_cmd()
1940 rdc.last_block_no = cpu_to_be32(ha->hdr[t].size-1); in gdth_internal_cache_cmd()
1942 gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data)); in gdth_internal_cache_cmd()
1947 (ha->cache_feat & GDT_64BIT)) { in gdth_internal_cache_cmd()
1951 rdc16.last_block_no = cpu_to_be64(ha->hdr[t].size-1); in gdth_internal_cache_cmd()
1953 gdth_copy_internal_data(ha, scp, (char*)&rdc16, in gdth_internal_cache_cmd()
1973 static int gdth_fill_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp, in gdth_fill_cache_cmd() argument
1982 cmdp = ha->pccb; in gdth_fill_cache_cmd()
1986 mode64 = (ha->cache_feat & GDT_64BIT) ? TRUE : FALSE; in gdth_fill_cache_cmd()
1994 if (!(cmd_index=gdth_get_cmd_index(ha))) { in gdth_fill_cache_cmd()
1999 if (ha->cmd_cnt == 0) in gdth_fill_cache_cmd()
2000 gdth_set_sema0(ha); in gdth_fill_cache_cmd()
2021 if (gdth_write_through || ((ha->hdr[hdrive].rw_attribs & 1) && in gdth_fill_cache_cmd()
2022 (ha->cache_feat & GDT_WR_THROUGH))) in gdth_fill_cache_cmd()
2069 sgcnt = dma_map_sg(&ha->pdev->dev, scsi_sglist(scp), in gdth_fill_cache_cmd()
2108 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache64.sg_lst) + in gdth_fill_cache_cmd()
2117 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache.sg_lst) + in gdth_fill_cache_cmd()
2120 if (ha->cmd_len & 3) in gdth_fill_cache_cmd()
2121 ha->cmd_len += (4 - (ha->cmd_len & 3)); in gdth_fill_cache_cmd()
2123 if (ha->cmd_cnt > 0) { in gdth_fill_cache_cmd()
2124 if ((ha->cmd_offs_dpmem + ha->cmd_len + DPMEM_COMMAND_OFFSET) > in gdth_fill_cache_cmd()
2125 ha->ic_all_size) { in gdth_fill_cache_cmd()
2127 ha->cmd_tab[cmd_index-2].cmnd = UNUSED_CMND; in gdth_fill_cache_cmd()
2133 gdth_copy_command(ha); in gdth_fill_cache_cmd()
2137 static int gdth_fill_raw_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp, u8 b) in gdth_fill_raw_cmd() argument
2148 cmdp = ha->pccb; in gdth_fill_raw_cmd()
2152 mode64 = (ha->raw_feat & GDT_64BIT) ? TRUE : FALSE; in gdth_fill_raw_cmd()
2157 if (!(cmd_index=gdth_get_cmd_index(ha))) { in gdth_fill_raw_cmd()
2162 if (ha->cmd_cnt == 0) in gdth_fill_raw_cmd()
2163 gdth_set_sema0(ha); in gdth_fill_raw_cmd()
2175 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst); in gdth_fill_raw_cmd()
2181 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst); in gdth_fill_raw_cmd()
2185 sense_paddr = dma_map_single(&ha->pdev->dev, scp->sense_buffer, 16, in gdth_fill_raw_cmd()
2228 sgcnt = dma_map_sg(&ha->pdev->dev, scsi_sglist(scp), in gdth_fill_raw_cmd()
2264 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst) + in gdth_fill_raw_cmd()
2272 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst) + in gdth_fill_raw_cmd()
2277 if (ha->cmd_len & 3) in gdth_fill_raw_cmd()
2278 ha->cmd_len += (4 - (ha->cmd_len & 3)); in gdth_fill_raw_cmd()
2280 if (ha->cmd_cnt > 0) { in gdth_fill_raw_cmd()
2281 if ((ha->cmd_offs_dpmem + ha->cmd_len + DPMEM_COMMAND_OFFSET) > in gdth_fill_raw_cmd()
2282 ha->ic_all_size) { in gdth_fill_raw_cmd()
2284 ha->cmd_tab[cmd_index-2].cmnd = UNUSED_CMND; in gdth_fill_raw_cmd()
2290 gdth_copy_command(ha); in gdth_fill_raw_cmd()
2294 static int gdth_special_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp) in gdth_special_cmd() argument
2300 cmdp= ha->pccb; in gdth_special_cmd()
2307 if (!(cmd_index=gdth_get_cmd_index(ha))) { in gdth_special_cmd()
2313 if (ha->cmd_cnt == 0) in gdth_special_cmd()
2314 gdth_set_sema0(ha); in gdth_special_cmd()
2319 ha->cmd_len = in gdth_special_cmd()
2323 if (ha->cache_feat & GDT_64BIT) in gdth_special_cmd()
2324 ha->cmd_len = in gdth_special_cmd()
2327 ha->cmd_len = in gdth_special_cmd()
2331 if (ha->raw_feat & GDT_64BIT) in gdth_special_cmd()
2332 ha->cmd_len = in gdth_special_cmd()
2335 ha->cmd_len = in gdth_special_cmd()
2339 if (ha->cmd_len & 3) in gdth_special_cmd()
2340 ha->cmd_len += (4 - (ha->cmd_len & 3)); in gdth_special_cmd()
2342 if (ha->cmd_cnt > 0) { in gdth_special_cmd()
2343 if ((ha->cmd_offs_dpmem + ha->cmd_len + DPMEM_COMMAND_OFFSET) > in gdth_special_cmd()
2344 ha->ic_all_size) { in gdth_special_cmd()
2346 ha->cmd_tab[cmd_index-2].cmnd = UNUSED_CMND; in gdth_special_cmd()
2352 gdth_copy_command(ha); in gdth_special_cmd()
2358 static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, u16 source, in gdth_store_event() argument
2401 static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr) in gdth_read_event() argument
2408 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_read_event()
2416 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_read_event()
2429 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_read_event()
2433 static void gdth_readapp_event(gdth_ha_str *ha, in gdth_readapp_event() argument
2442 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_readapp_event()
2462 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_readapp_event()
2476 static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, in __gdth_interrupt() argument
2487 TRACE(("gdth_interrupt() IRQ %d\n", ha->irq)); in __gdth_interrupt()
2497 spin_lock_irqsave(&ha->smp_lock, flags); in __gdth_interrupt()
2500 IStatus = gdth_get_status(ha); in __gdth_interrupt()
2504 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
2512 if (ha->type == GDT_PCI) { in __gdth_interrupt()
2513 dp6_ptr = ha->brd; in __gdth_interrupt()
2516 ha->status = readw(&dp6_ptr->u.ic.Status); in __gdth_interrupt()
2517 TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status)); in __gdth_interrupt()
2519 ha->status = S_OK; in __gdth_interrupt()
2520 ha->info = readl(&dp6_ptr->u.ic.Info[0]); in __gdth_interrupt()
2521 ha->service = readw(&dp6_ptr->u.ic.Service); in __gdth_interrupt()
2522 ha->info2 = readl(&dp6_ptr->u.ic.Info[1]); in __gdth_interrupt()
2527 } else if (ha->type == GDT_PCINEW) { in __gdth_interrupt()
2530 ha->status = inw(PTR2USHORT(&ha->plx->status)); in __gdth_interrupt()
2531 TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status)); in __gdth_interrupt()
2533 ha->status = S_OK; in __gdth_interrupt()
2534 ha->info = inl(PTR2USHORT(&ha->plx->info[0])); in __gdth_interrupt()
2535 ha->service = inw(PTR2USHORT(&ha->plx->service)); in __gdth_interrupt()
2536 ha->info2 = inl(PTR2USHORT(&ha->plx->info[1])); in __gdth_interrupt()
2538 outb(0xff, PTR2USHORT(&ha->plx->edoor_reg)); in __gdth_interrupt()
2539 outb(0x00, PTR2USHORT(&ha->plx->sema1_reg)); in __gdth_interrupt()
2540 } else if (ha->type == GDT_PCIMPR) { in __gdth_interrupt()
2541 dp6m_ptr = ha->brd; in __gdth_interrupt()
2544 ha->status = readw(&dp6m_ptr->i960r.status); in __gdth_interrupt()
2545 TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status)); in __gdth_interrupt()
2547 ha->status = S_OK; in __gdth_interrupt()
2549 ha->info = readl(&dp6m_ptr->i960r.info[0]); in __gdth_interrupt()
2550 ha->service = readw(&dp6m_ptr->i960r.service); in __gdth_interrupt()
2551 ha->info2 = readl(&dp6m_ptr->i960r.info[1]); in __gdth_interrupt()
2555 if (ha->service != SCREENSERVICE && in __gdth_interrupt()
2556 (ha->fw_vers & 0xff) >= 0x1a) { in __gdth_interrupt()
2557 ha->dvr.severity = readb in __gdth_interrupt()
2558 (&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.severity); in __gdth_interrupt()
2560 ha->dvr.event_string[i] = readb in __gdth_interrupt()
2561 (&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.evt_str[i]); in __gdth_interrupt()
2562 if (ha->dvr.event_string[i] == 0) in __gdth_interrupt()
2572 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
2577 IStatus,ha->status,ha->info)); in __gdth_interrupt()
2585 gdth_async_event(ha); in __gdth_interrupt()
2587 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
2588 gdth_next(ha); in __gdth_interrupt()
2594 ha->dvr.size = sizeof(ha->dvr.eu.driver); in __gdth_interrupt()
2595 ha->dvr.eu.driver.ionode = ha->hanum; in __gdth_interrupt()
2596 gdth_store_event(ha, ES_DRIVER, 4, &ha->dvr); in __gdth_interrupt()
2598 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
2601 scp = ha->cmd_tab[IStatus-2].cmnd; in __gdth_interrupt()
2602 Service = ha->cmd_tab[IStatus-2].service; in __gdth_interrupt()
2603 ha->cmd_tab[IStatus-2].cmnd = UNUSED_CMND; in __gdth_interrupt()
2606 ha->dvr.size = sizeof(ha->dvr.eu.driver); in __gdth_interrupt()
2607 ha->dvr.eu.driver.ionode = ha->hanum; in __gdth_interrupt()
2608 ha->dvr.eu.driver.index = IStatus; in __gdth_interrupt()
2609 gdth_store_event(ha, ES_DRIVER, 1, &ha->dvr); in __gdth_interrupt()
2611 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
2617 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
2622 rval = gdth_sync_event(ha,Service,IStatus,scp); in __gdth_interrupt()
2624 spin_unlock_irqrestore(&ha->smp_lock, flags); in __gdth_interrupt()
2626 gdth_putq(ha, scp, gdth_cmnd_priv(scp)->priority); in __gdth_interrupt()
2631 gdth_next(ha); in __gdth_interrupt()
2637 gdth_ha_str *ha = dev_id; in gdth_interrupt() local
2639 return __gdth_interrupt(ha, false, NULL); in gdth_interrupt()
2642 static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index, in gdth_sync_event() argument
2650 cmdp = ha->pccb; in gdth_sync_event()
2652 service,ha->status)); in gdth_sync_event()
2655 msg = ha->pmsg; in gdth_sync_event()
2667 while (gdth_test_busy(ha)) in gdth_sync_event()
2671 gdth_get_cmd_index(ha); in gdth_sync_event()
2672 gdth_set_sema0(ha); in gdth_sync_event()
2677 cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; in gdth_sync_event()
2678 ha->cmd_offs_dpmem = 0; in gdth_sync_event()
2679 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) in gdth_sync_event()
2681 ha->cmd_cnt = 0; in gdth_sync_event()
2682 gdth_copy_command(ha); in gdth_sync_event()
2683 gdth_release_event(ha); in gdth_sync_event()
2701 while (gdth_test_busy(ha)) in gdth_sync_event()
2705 gdth_get_cmd_index(ha); in gdth_sync_event()
2706 gdth_set_sema0(ha); in gdth_sync_event()
2711 cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; in gdth_sync_event()
2712 ha->cmd_offs_dpmem = 0; in gdth_sync_event()
2713 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) in gdth_sync_event()
2715 ha->cmd_cnt = 0; in gdth_sync_event()
2716 gdth_copy_command(ha); in gdth_sync_event()
2717 gdth_release_event(ha); in gdth_sync_event()
2725 if (cmndinfo->OpCode == -1 && b != ha->virt_bus) { in gdth_sync_event()
2726 ha->raw[BUS_L2P(ha,b)].io_cnt[t]--; in gdth_sync_event()
2729 if (ha->status == S_BSY) { in gdth_sync_event()
2737 dma_unmap_sg(&ha->pdev->dev, scsi_sglist(scp), scsi_sg_count(scp), in gdth_sync_event()
2741 dma_unmap_page(&ha->pdev->dev, cmndinfo->sense_paddr, 16, in gdth_sync_event()
2744 if (ha->status == S_OK) { in gdth_sync_event()
2746 cmndinfo->info = ha->info; in gdth_sync_event()
2752 ha->hdr[t].cluster_type = (u8)ha->info; in gdth_sync_event()
2753 if (!(ha->hdr[t].cluster_type & in gdth_sync_event()
2757 if (ha->hdr[t].cluster_type & in gdth_sync_event()
2767 ha->hdr[t].cluster_type |= CLUSTER_MOUNTED; in gdth_sync_event()
2768 ha->hdr[t].media_changed = TRUE; in gdth_sync_event()
2770 ha->hdr[t].cluster_type &= ~CLUSTER_MOUNTED; in gdth_sync_event()
2771 ha->hdr[t].media_changed = TRUE; in gdth_sync_event()
2781 ha->hdr[t].cluster_type |= CLUSTER_RESERVED; in gdth_sync_event()
2783 ha->hdr[t].cluster_type &= ~CLUSTER_RESERVED; in gdth_sync_event()
2789 cmndinfo->status = ha->status; in gdth_sync_event()
2790 cmndinfo->info = ha->info; in gdth_sync_event()
2794 cmndinfo->OpCode, ha->status)); in gdth_sync_event()
2807 if (ha->status == S_CACHE_UNKNOWN && in gdth_sync_event()
2808 (ha->hdr[t].cluster_type & in gdth_sync_event()
2811 ha->hdr[t].cluster_type &= ~CLUSTER_RESERVED; in gdth_sync_event()
2814 if (ha->status == (u16)S_CACHE_RESERV) { in gdth_sync_event()
2822 ha->dvr.size = sizeof(ha->dvr.eu.sync); in gdth_sync_event()
2823 ha->dvr.eu.sync.ionode = ha->hanum; in gdth_sync_event()
2824 ha->dvr.eu.sync.service = service; in gdth_sync_event()
2825 ha->dvr.eu.sync.status = ha->status; in gdth_sync_event()
2826 ha->dvr.eu.sync.info = ha->info; in gdth_sync_event()
2827 ha->dvr.eu.sync.hostdrive = t; in gdth_sync_event()
2828 if (ha->status >= 0x8000) in gdth_sync_event()
2829 gdth_store_event(ha, ES_SYNC, 0, &ha->dvr); in gdth_sync_event()
2831 gdth_store_event(ha, ES_SYNC, service, &ha->dvr); in gdth_sync_event()
2835 if (ha->status != S_RAW_SCSI || ha->info >= 0x100) { in gdth_sync_event()
2838 scp->result = (DID_OK << 16) | ha->info; in gdth_sync_event()
3007 static int gdth_async_event(gdth_ha_str *ha) in gdth_async_event() argument
3011 cmdp= ha->pccb; in gdth_async_event()
3013 ha->hanum, ha->service)); in gdth_async_event()
3015 if (ha->service == SCREENSERVICE) { in gdth_async_event()
3016 if (ha->status == MSG_REQUEST) { in gdth_async_event()
3017 while (gdth_test_busy(ha)) in gdth_async_event()
3021 gdth_set_sema0(ha); in gdth_async_event()
3026 cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; in gdth_async_event()
3027 ha->cmd_offs_dpmem = 0; in gdth_async_event()
3028 ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) in gdth_async_event()
3030 ha->cmd_cnt = 0; in gdth_async_event()
3031 gdth_copy_command(ha); in gdth_async_event()
3032 printk("[PCI %d/%d] ",(u16)(ha->brd_phys>>8), in gdth_async_event()
3033 (u16)((ha->brd_phys>>3)&0x1f)); in gdth_async_event()
3034 gdth_release_event(ha); in gdth_async_event()
3038 if (ha->type == GDT_PCIMPR && in gdth_async_event()
3039 (ha->fw_vers & 0xff) >= 0x1a) { in gdth_async_event()
3040 ha->dvr.size = 0; in gdth_async_event()
3041 ha->dvr.eu.async.ionode = ha->hanum; in gdth_async_event()
3042 ha->dvr.eu.async.status = ha->status; in gdth_async_event()
3045 ha->dvr.size = sizeof(ha->dvr.eu.async); in gdth_async_event()
3046 ha->dvr.eu.async.ionode = ha->hanum; in gdth_async_event()
3047 ha->dvr.eu.async.service = ha->service; in gdth_async_event()
3048 ha->dvr.eu.async.status = ha->status; in gdth_async_event()
3049 ha->dvr.eu.async.info = ha->info; in gdth_async_event()
3050 *(u32 *)ha->dvr.eu.async.scsi_coord = ha->info2; in gdth_async_event()
3052 gdth_store_event( ha, ES_ASYNC, ha->service, &ha->dvr ); in gdth_async_event()
3053 gdth_log_event( &ha->dvr, NULL ); in gdth_async_event()
3056 if (ha->service == CACHESERVICE && ha->status == 56) { in gdth_async_event()
3058 (u16)ha->info)); in gdth_async_event()
3128 gdth_ha_str *ha; in gdth_timeout() local
3136 ha = list_first_entry(&gdth_instances, gdth_ha_str, list); in gdth_timeout()
3137 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_timeout()
3140 if (ha->cmd_tab[i].cmnd != UNUSED_CMND) in gdth_timeout()
3144 nscp=ha->req_first; nscp; nscp=(struct scsi_cmnd*)nscp->SCp.ptr) in gdth_timeout()
3153 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_timeout()
3172 static const char *gdth_ctr_name(gdth_ha_str *ha) in gdth_ctr_name() argument
3176 if (ha->type == GDT_PCI) { in gdth_ctr_name()
3177 switch (ha->pdev->device) { in gdth_ctr_name()
3191 gdth_ha_str *ha = shost_priv(shp); in gdth_info() local
3194 return ((const char *)ha->binfo.type_string); in gdth_info()
3199 gdth_ha_str *ha = shost_priv(scp->device->host); in gdth_timed_out() local
3218 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_timed_out()
3219 if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha, b)].lock) || in gdth_timed_out()
3220 (b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock)) { in gdth_timed_out()
3224 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_timed_out()
3232 gdth_ha_str *ha = shost_priv(scp->device->host); in gdth_eh_bus_reset() local
3243 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3245 cmnd = ha->cmd_tab[i].cmnd; in gdth_eh_bus_reset()
3247 ha->cmd_tab[i].cmnd = UNUSED_CMND; in gdth_eh_bus_reset()
3249 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3251 if (b == ha->virt_bus) { in gdth_eh_bus_reset()
3254 if (ha->hdr[i].present) { in gdth_eh_bus_reset()
3255 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3257 while (gdth_test_busy(ha)) in gdth_eh_bus_reset()
3259 if (gdth_internal_cmd(ha, CACHESERVICE, in gdth_eh_bus_reset()
3261 ha->hdr[i].cluster_type &= ~CLUSTER_RESERVED; in gdth_eh_bus_reset()
3263 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3268 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3270 ha->raw[BUS_L2P(ha,b)].io_cnt[i] = 0; in gdth_eh_bus_reset()
3272 while (gdth_test_busy(ha)) in gdth_eh_bus_reset()
3274 gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESET_BUS, in gdth_eh_bus_reset()
3275 BUS_L2P(ha,b), 0, 0); in gdth_eh_bus_reset()
3277 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_eh_bus_reset()
3285 gdth_ha_str *ha = shost_priv(sdev->host); in gdth_bios_param() local
3293 TRACE2(("gdth_bios_param() ha %d bus %d target %d\n", ha->hanum, b, t)); in gdth_bios_param()
3295 if (b != ha->virt_bus || ha->hdr[t].heads == 0) { in gdth_bios_param()
3300 ip[0] = ha->hdr[t].heads; in gdth_bios_param()
3301 ip[1] = ha->hdr[t].secs; in gdth_bios_param()
3314 gdth_ha_str *ha = shost_priv(scp->device->host); in gdth_queuecommand_lck() local
3319 cmndinfo = gdth_get_cmndinfo(ha); in gdth_queuecommand_lck()
3326 return __gdth_queuecommand(ha, scp, cmndinfo); in gdth_queuecommand_lck()
3331 static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, in DEF_SCSI_QCMD()
3343 gdth_putq(ha, scp, cmndinfo->priority); in DEF_SCSI_QCMD()
3344 gdth_next(ha); in DEF_SCSI_QCMD()
3351 gdth_ha_str *ha; in gdth_open() local
3354 list_for_each_entry(ha, &gdth_instances, list) { in gdth_open()
3355 if (!ha->sdev) in gdth_open()
3356 ha->sdev = scsi_get_host_dev(ha->shost); in gdth_open()
3373 gdth_ha_str *ha; in ioc_event() local
3378 ha = gdth_find_ha(evt.ionode); in ioc_event()
3379 if (!ha) in ioc_event()
3391 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_event()
3392 gdth_store_event(ha, evt.event.event_source, evt.event.event_idx, in ioc_event()
3394 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_event()
3398 evt.handle = gdth_read_event(ha, evt.handle, &evt.event); in ioc_event()
3400 gdth_readapp_event(ha, evt.erase, &evt.event); in ioc_event()
3412 gdth_ha_str *ha; in ioc_lockdrv() local
3416 ha = gdth_find_ha(ldrv.ionode); in ioc_lockdrv()
3417 if (!ha) in ioc_lockdrv()
3422 if (j >= MAX_HDRIVES || !ha->hdr[j].present) in ioc_lockdrv()
3425 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_lockdrv()
3426 ha->hdr[j].lock = 1; in ioc_lockdrv()
3427 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_lockdrv()
3428 gdth_wait_completion(ha, ha->bus_cnt, j); in ioc_lockdrv()
3430 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_lockdrv()
3431 ha->hdr[j].lock = 0; in ioc_lockdrv()
3432 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_lockdrv()
3433 gdth_next(ha); in ioc_lockdrv()
3443 gdth_ha_str *ha; in ioc_resetdrv() local
3449 ha = gdth_find_ha(res.ionode); in ioc_resetdrv()
3450 if (!ha) in ioc_resetdrv()
3453 if (!ha->hdr[res.number].present) in ioc_resetdrv()
3458 if (ha->cache_feat & GDT_64BIT) in ioc_resetdrv()
3463 rval = __gdth_execute(ha->sdev, &cmd, cmnd, 30, NULL); in ioc_resetdrv()
3473 static void gdth_ioc_cacheservice(gdth_ha_str *ha, gdth_ioctl_general *gen, in gdth_ioc_cacheservice() argument
3476 if (ha->cache_feat & GDT_64BIT) { in gdth_ioc_cacheservice()
3482 if (ha->cache_feat & SCATTER_GATHER) { in gdth_ioc_cacheservice()
3493 if (ha->cache_feat & SCATTER_GATHER) { in gdth_ioc_cacheservice()
3506 static void gdth_ioc_scsiraw(gdth_ha_str *ha, gdth_ioctl_general *gen, in gdth_ioc_scsiraw() argument
3509 if (ha->raw_feat & GDT_64BIT) { in gdth_ioc_scsiraw()
3524 if (ha->raw_feat & SCATTER_GATHER) { in gdth_ioc_scsiraw()
3537 if (ha->raw_feat & SCATTER_GATHER) { in gdth_ioc_scsiraw()
3555 gdth_ha_str *ha; in ioc_general() local
3562 ha = gdth_find_ha(gen.ionode); in ioc_general()
3563 if (!ha) in ioc_general()
3574 buf = dma_alloc_coherent(&ha->pdev->dev, in ioc_general()
3588 gdth_ioc_cacheservice(ha, &gen, paddr); in ioc_general()
3590 gdth_ioc_scsiraw(ha, &gen, paddr); in ioc_general()
3595 rval = __gdth_execute(ha->sdev, &gen.command, cmnd, gen.timeout, in ioc_general()
3612 dma_free_coherent(&ha->pdev->dev, gen.data_len + gen.sense_len, in ioc_general()
3621 gdth_ha_str *ha; in ioc_hdrlist() local
3632 (NULL == (ha = gdth_find_ha(rsc->ionode)))) { in ioc_hdrlist()
3639 if (!ha->hdr[i].present) { in ioc_hdrlist()
3643 rsc->hdr_list[i].bus = ha->virt_bus; in ioc_hdrlist()
3646 rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type; in ioc_hdrlist()
3647 if (ha->hdr[i].cluster_type & CLUSTER_DRIVE) { in ioc_hdrlist()
3650 if (ha->cache_feat & GDT_64BIT) in ioc_hdrlist()
3654 if (__gdth_execute(ha->sdev, cmd, cmnd, 30, &cluster_type) == S_OK) in ioc_hdrlist()
3679 gdth_ha_str *ha; in ioc_rescan() local
3687 (NULL == (ha = gdth_find_ha(rsc->ionode)))) { in ioc_rescan()
3696 if (ha->cache_feat & GDT_64BIT) { in ioc_rescan()
3704 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); in ioc_rescan()
3715 if (ha->cache_feat & GDT_64BIT) in ioc_rescan()
3720 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); in ioc_rescan()
3722 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_rescan()
3723 rsc->hdr_list[i].bus = ha->virt_bus; in ioc_rescan()
3727 ha->hdr[i].present = FALSE; in ioc_rescan()
3729 ha->hdr[i].present = TRUE; in ioc_rescan()
3730 ha->hdr[i].size = info; in ioc_rescan()
3732 ha->hdr[i].size &= ~SECS32; in ioc_rescan()
3733 gdth_eval_mapping(ha->hdr[i].size,&cyls,&hds,&secs); in ioc_rescan()
3734 ha->hdr[i].heads = hds; in ioc_rescan()
3735 ha->hdr[i].secs = secs; in ioc_rescan()
3737 ha->hdr[i].size = cyls * hds * secs; in ioc_rescan()
3739 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_rescan()
3749 if (ha->cache_feat & GDT_64BIT) in ioc_rescan()
3754 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); in ioc_rescan()
3756 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_rescan()
3757 ha->hdr[i].devtype = (status == S_OK ? (u16)info : 0); in ioc_rescan()
3758 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_rescan()
3762 if (ha->cache_feat & GDT_64BIT) in ioc_rescan()
3767 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); in ioc_rescan()
3769 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_rescan()
3770 ha->hdr[i].cluster_type = in ioc_rescan()
3772 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_rescan()
3773 rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type; in ioc_rescan()
3777 if (ha->cache_feat & GDT_64BIT) in ioc_rescan()
3782 status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); in ioc_rescan()
3784 spin_lock_irqsave(&ha->smp_lock, flags); in ioc_rescan()
3785 ha->hdr[i].rw_attribs = (status == S_OK ? (u16)info : 0); in ioc_rescan()
3786 spin_unlock_irqrestore(&ha->smp_lock, flags); in ioc_rescan()
3802 gdth_ha_str *ha; in gdth_ioctl() local
3846 (NULL == (ha = gdth_find_ha(ctrt.ionode)))) in gdth_ioctl()
3849 if (ha->type != GDT_PCIMPR) { in gdth_ioctl()
3850 ctrt.type = (u8)((ha->stype<<4) + 6); in gdth_ioctl()
3852 ctrt.type = (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe); in gdth_ioctl()
3853 if (ha->stype >= 0x300) in gdth_ioctl()
3854 ctrt.ext_type = 0x6000 | ha->pdev->subsystem_device; in gdth_ioctl()
3856 ctrt.ext_type = 0x6000 | ha->stype; in gdth_ioctl()
3858 ctrt.device_id = ha->pdev->device; in gdth_ioctl()
3859 ctrt.sub_device_id = ha->pdev->subsystem_device; in gdth_ioctl()
3860 ctrt.info = ha->brd_phys; in gdth_ioctl()
3861 ctrt.oem_id = ha->oem_id; in gdth_ioctl()
3882 (NULL == (ha = gdth_find_ha(lchn.ionode)))) in gdth_ioctl()
3886 if (i < ha->bus_cnt) { in gdth_ioctl()
3888 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_ioctl()
3889 ha->raw[i].lock = 1; in gdth_ioctl()
3890 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_ioctl()
3891 for (j = 0; j < ha->tid_cnt; ++j) in gdth_ioctl()
3892 gdth_wait_completion(ha, i, j); in gdth_ioctl()
3894 spin_lock_irqsave(&ha->smp_lock, flags); in gdth_ioctl()
3895 ha->raw[i].lock = 0; in gdth_ioctl()
3896 spin_unlock_irqrestore(&ha->smp_lock, flags); in gdth_ioctl()
3897 for (j = 0; j < ha->tid_cnt; ++j) in gdth_ioctl()
3898 gdth_next(ha); in gdth_ioctl()
3916 (NULL == (ha = gdth_find_ha(res.ionode)))) in gdth_ioctl()
3922 scp->device = ha->sdev; in gdth_ioctl()
3956 static void gdth_flush(gdth_ha_str *ha) in gdth_flush() argument
3963 TRACE2(("gdth_flush() hanum %d\n", ha->hanum)); in gdth_flush()
3966 if (ha->hdr[i].present) { in gdth_flush()
3970 if (ha->cache_feat & GDT_64BIT) { in gdth_flush()
3979 TRACE2(("gdth_flush(): flush ha %d drive %d\n", ha->hanum, i)); in gdth_flush()
3981 gdth_execute(ha->shost, &gdtcmd, cmnd, 30, NULL); in gdth_flush()
4016 gdth_ha_str *ha; in gdth_pci_probe_one() local
4026 ha = shost_priv(shp); in gdth_pci_probe_one()
4029 if (!gdth_init_pci(pdev, pcistr, ha)) in gdth_pci_probe_one()
4036 ha->irq); in gdth_pci_probe_one()
4038 error = request_irq(ha->irq, gdth_interrupt, in gdth_pci_probe_one()
4039 IRQF_SHARED, "gdth", ha); in gdth_pci_probe_one()
4046 shp->irq = ha->irq; in gdth_pci_probe_one()
4049 ha->hanum = gdth_ctr_count++; in gdth_pci_probe_one()
4050 ha->shost = shp; in gdth_pci_probe_one()
4052 ha->pccb = &ha->cmdext; in gdth_pci_probe_one()
4053 ha->ccb_phys = 0L; in gdth_pci_probe_one()
4057 ha->pscratch = dma_alloc_coherent(&ha->pdev->dev, GDTH_SCRATCH, in gdth_pci_probe_one()
4059 if (!ha->pscratch) in gdth_pci_probe_one()
4061 ha->scratch_phys = scratch_dma_handle; in gdth_pci_probe_one()
4063 ha->pmsg = dma_alloc_coherent(&ha->pdev->dev, sizeof(gdth_msg_str), in gdth_pci_probe_one()
4065 if (!ha->pmsg) in gdth_pci_probe_one()
4067 ha->msg_phys = scratch_dma_handle; in gdth_pci_probe_one()
4069 ha->scratch_busy = FALSE; in gdth_pci_probe_one()
4070 ha->req_first = NULL; in gdth_pci_probe_one()
4071 ha->tid_cnt = pdev->device >= 0x200 ? MAXID : MAX_HDRIVES; in gdth_pci_probe_one()
4072 if (max_ids > 0 && max_ids < ha->tid_cnt) in gdth_pci_probe_one()
4073 ha->tid_cnt = max_ids; in gdth_pci_probe_one()
4075 ha->cmd_tab[i].cmnd = UNUSED_CMND; in gdth_pci_probe_one()
4076 ha->scan_mode = rescan ? 0x10 : 0; in gdth_pci_probe_one()
4079 if (!gdth_search_drives(ha)) { in gdth_pci_probe_one()
4080 printk("GDT-PCI %d: Error during device scan\n", ha->hanum); in gdth_pci_probe_one()
4084 if (hdr_channel < 0 || hdr_channel > ha->bus_cnt) in gdth_pci_probe_one()
4085 hdr_channel = ha->bus_cnt; in gdth_pci_probe_one()
4086 ha->virt_bus = hdr_channel; in gdth_pci_probe_one()
4089 if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) || in gdth_pci_probe_one()
4090 !ha->dma64_support) { in gdth_pci_probe_one()
4093 "Unable to set 32-bit DMA\n", ha->hanum); in gdth_pci_probe_one()
4099 printk("GDT-PCI %d: 64-bit DMA enabled\n", ha->hanum); in gdth_pci_probe_one()
4102 "Unable to set 64/32-bit DMA\n", ha->hanum); in gdth_pci_probe_one()
4107 shp->max_id = ha->tid_cnt; in gdth_pci_probe_one()
4109 shp->max_channel = ha->bus_cnt; in gdth_pci_probe_one()
4111 spin_lock_init(&ha->smp_lock); in gdth_pci_probe_one()
4112 gdth_enable_int(ha); in gdth_pci_probe_one()
4117 list_add_tail(&ha->list, &gdth_instances); in gdth_pci_probe_one()
4119 pci_set_drvdata(ha->pdev, ha); in gdth_pci_probe_one()
4124 *ha_out = ha; in gdth_pci_probe_one()
4129 dma_free_coherent(&ha->pdev->dev, sizeof(gdth_msg_str), in gdth_pci_probe_one()
4130 ha->pmsg, ha->msg_phys); in gdth_pci_probe_one()
4132 dma_free_coherent(&ha->pdev->dev, GDTH_SCRATCH, in gdth_pci_probe_one()
4133 ha->pscratch, ha->scratch_phys); in gdth_pci_probe_one()
4135 free_irq(ha->irq, ha); in gdth_pci_probe_one()
4142 static void gdth_remove_one(gdth_ha_str *ha) in gdth_remove_one() argument
4144 struct Scsi_Host *shp = ha->shost; in gdth_remove_one()
4150 gdth_flush(ha); in gdth_remove_one()
4152 if (ha->sdev) { in gdth_remove_one()
4153 scsi_free_host_dev(ha->sdev); in gdth_remove_one()
4154 ha->sdev = NULL; in gdth_remove_one()
4158 free_irq(shp->irq,ha); in gdth_remove_one()
4160 if (ha->pscratch) in gdth_remove_one()
4161 dma_free_coherent(&ha->pdev->dev, GDTH_SCRATCH, in gdth_remove_one()
4162 ha->pscratch, ha->scratch_phys); in gdth_remove_one()
4163 if (ha->pmsg) in gdth_remove_one()
4164 dma_free_coherent(&ha->pdev->dev, sizeof(gdth_msg_str), in gdth_remove_one()
4165 ha->pmsg, ha->msg_phys); in gdth_remove_one()
4166 if (ha->ccb_phys) in gdth_remove_one()
4167 dma_unmap_single(&ha->pdev->dev, ha->ccb_phys, in gdth_remove_one()
4175 gdth_ha_str *ha; in gdth_halt() local
4181 list_for_each_entry(ha, &gdth_instances, list) in gdth_halt()
4182 gdth_flush(ha); in gdth_halt()
4209 gdth_ha_str *ha; in gdth_init() local
4211 list_for_each_entry(ha, &gdth_instances, list) in gdth_init()
4212 gdth_remove_one(ha); in gdth_init()
4226 gdth_ha_str *ha; in gdth_exit() local
4237 list_for_each_entry(ha, &gdth_instances, list) in gdth_exit()
4238 gdth_remove_one(ha); in gdth_exit()