Lines Matching refs:adapter

136 static void blogic_announce_drvr(struct blogic_adapter *adapter)  in blogic_announce_drvr()  argument
138 …** BusLogic SCSI Driver Version " blogic_drvr_version " of " blogic_drvr_date " *****\n", adapter); in blogic_announce_drvr()
139 blogic_announce("Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>\n", adapter); in blogic_announce_drvr()
150 struct blogic_adapter *adapter = in blogic_drvr_info() local
152 return adapter->full_model; in blogic_drvr_info()
161 static void blogic_init_ccbs(struct blogic_adapter *adapter, void *blk_pointer, in blogic_init_ccbs() argument
171 ccb->adapter = adapter; in blogic_init_ccbs()
173 if (blogic_flashpoint_type(adapter)) { in blogic_init_ccbs()
175 ccb->base_addr = adapter->fpinfo.base_addr; in blogic_init_ccbs()
177 ccb->next = adapter->free_ccbs; in blogic_init_ccbs()
178 ccb->next_all = adapter->all_ccbs; in blogic_init_ccbs()
179 adapter->free_ccbs = ccb; in blogic_init_ccbs()
180 adapter->all_ccbs = ccb; in blogic_init_ccbs()
181 adapter->alloc_ccbs++; in blogic_init_ccbs()
192 static bool __init blogic_create_initccbs(struct blogic_adapter *adapter) in blogic_create_initccbs() argument
198 while (adapter->alloc_ccbs < adapter->initccbs) { in blogic_create_initccbs()
199 blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev, in blogic_create_initccbs()
203 adapter); in blogic_create_initccbs()
206 blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp); in blogic_create_initccbs()
216 static void blogic_destroy_ccbs(struct blogic_adapter *adapter) in blogic_destroy_ccbs() argument
218 struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL; in blogic_destroy_ccbs()
219 adapter->all_ccbs = NULL; in blogic_destroy_ccbs()
220 adapter->free_ccbs = NULL; in blogic_destroy_ccbs()
225 dma_free_coherent(&adapter->pci_device->dev, in blogic_destroy_ccbs()
232 dma_free_coherent(&adapter->pci_device->dev, in blogic_destroy_ccbs()
245 static void blogic_create_addlccbs(struct blogic_adapter *adapter, in blogic_create_addlccbs() argument
249 int prev_alloc = adapter->alloc_ccbs; in blogic_create_addlccbs()
254 while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) { in blogic_create_addlccbs()
255 blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev, in blogic_create_addlccbs()
259 blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp); in blogic_create_addlccbs()
261 if (adapter->alloc_ccbs > prev_alloc) { in blogic_create_addlccbs()
263 …e("Allocated %d additional CCBs (total now %d)\n", adapter, adapter->alloc_ccbs - prev_alloc, adap… in blogic_create_addlccbs()
266 blogic_notice("Failed to allocate additional CCBs\n", adapter); in blogic_create_addlccbs()
267 if (adapter->drvr_qdepth > adapter->alloc_ccbs - adapter->tgt_count) { in blogic_create_addlccbs()
268 adapter->drvr_qdepth = adapter->alloc_ccbs - adapter->tgt_count; in blogic_create_addlccbs()
269 adapter->scsi_host->can_queue = adapter->drvr_qdepth; in blogic_create_addlccbs()
279 static struct blogic_ccb *blogic_alloc_ccb(struct blogic_adapter *adapter) in blogic_alloc_ccb() argument
283 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
286 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
288 if (adapter->free_ccbs == NULL) in blogic_alloc_ccb()
289 blogic_create_addlccbs(adapter, adapter->inc_ccbs, in blogic_alloc_ccb()
293 blogic_create_addlccbs(adapter, adapter->inc_ccbs, true); in blogic_alloc_ccb()
294 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
298 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
312 struct blogic_adapter *adapter = ccb->adapter; in blogic_dealloc_ccb() local
317 dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata, in blogic_dealloc_ccb()
322 ccb->next = adapter->free_ccbs; in blogic_dealloc_ccb()
323 adapter->free_ccbs = ccb; in blogic_dealloc_ccb()
345 static int blogic_cmd(struct blogic_adapter *adapter, enum blogic_opcode opcode, in blogic_cmd() argument
367 if (!adapter->irq_acquired) in blogic_cmd()
376 statusreg.all = blogic_rdstatus(adapter); in blogic_cmd()
390 adapter->adapter_cmd_complete = false; in blogic_cmd()
391 blogic_setcmdparam(adapter, opcode); in blogic_cmd()
413 intreg.all = blogic_rdint(adapter); in blogic_cmd()
414 statusreg.all = blogic_rdstatus(adapter); in blogic_cmd()
417 if (adapter->adapter_cmd_complete) in blogic_cmd()
423 blogic_setcmdparam(adapter, *param_p++); in blogic_cmd()
437 statusreg.all = blogic_rdstatus(adapter); in blogic_cmd()
445 …blogic_notice("blogic_cmd(%02X) Status = %02X: (Modify I/O Address)\n", adapter, opcode, statusreg… in blogic_cmd()
471 intreg.all = blogic_rdint(adapter); in blogic_cmd()
472 statusreg.all = blogic_rdstatus(adapter); in blogic_cmd()
475 if (adapter->adapter_cmd_complete) in blogic_cmd()
479 *reply_p++ = blogic_rddatain(adapter); in blogic_cmd()
481 blogic_rddatain(adapter); in blogic_cmd()
497 blogic_intreset(adapter); in blogic_cmd()
504 adapter, opcode, statusreg.all, replylen, in blogic_cmd()
509 blogic_notice(" %02X", adapter, in blogic_cmd()
511 blogic_notice("\n", adapter); in blogic_cmd()
527 statusreg.all = blogic_rdstatus(adapter); in blogic_cmd()
535 blogic_softreset(adapter); in blogic_cmd()
559 if (!adapter->irq_acquired) in blogic_cmd()
609 static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter) in blogic_init_mm_probeinfo() argument
640 struct blogic_adapter *host_adapter = adapter; in blogic_init_mm_probeinfo()
831 static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter) in blogic_init_fp_probeinfo() argument
923 static void __init blogic_init_probeinfo_list(struct blogic_adapter *adapter) in blogic_init_probeinfo_list() argument
932 blogic_init_mm_probeinfo(adapter); in blogic_init_probeinfo_list()
933 blogic_init_fp_probeinfo(adapter); in blogic_init_probeinfo_list()
935 blogic_init_fp_probeinfo(adapter); in blogic_init_probeinfo_list()
936 blogic_init_mm_probeinfo(adapter); in blogic_init_probeinfo_list()
938 int fpcount = blogic_init_fp_probeinfo(adapter); in blogic_init_probeinfo_list()
939 int mmcount = blogic_init_mm_probeinfo(adapter); in blogic_init_probeinfo_list()
943 struct blogic_adapter *myadapter = adapter; in blogic_init_probeinfo_list()
991 static bool blogic_failure(struct blogic_adapter *adapter, char *msg) in blogic_failure() argument
993 blogic_announce_drvr(adapter); in blogic_failure()
994 if (adapter->adapter_bus_type == BLOGIC_PCI_BUS) { in blogic_failure()
996 adapter); in blogic_failure()
997 … %d I/O Address 0x%lX PCI Address 0x%lX:\n", adapter, adapter->bus, adapter->dev, adapter->io_addr… in blogic_failure()
999 …blogic_err("While configuring BusLogic Host Adapter at I/O Address 0x%lX:\n", adapter, adapter->io… in blogic_failure()
1000 blogic_err("%s FAILED - DETACHING\n", adapter, msg); in blogic_failure()
1002 blogic_err("ADDITIONAL FAILURE INFO - %s\n", adapter, in blogic_failure()
1012 static bool __init blogic_probe(struct blogic_adapter *adapter) in blogic_probe() argument
1020 if (blogic_flashpoint_type(adapter)) { in blogic_probe()
1021 struct fpoint_info *fpinfo = &adapter->fpinfo; in blogic_probe()
1022 fpinfo->base_addr = (u32) adapter->io_addr; in blogic_probe()
1023 fpinfo->irq_ch = adapter->irq_ch; in blogic_probe()
1027 … FlashPoint Host Adapter detected at PCI Bus %d Device %d\n", adapter, adapter->bus, adapter->dev); in blogic_probe()
1028 …c: I/O Address 0x%lX PCI Address 0x%lX, but FlashPoint\n", adapter, adapter->io_addr, adapter->pci… in blogic_probe()
1029 blogic_err("BusLogic: Probe Function failed to validate it.\n", adapter); in blogic_probe()
1033 blogic_notice("BusLogic_Probe(0x%lX): FlashPoint Found\n", adapter, adapter->io_addr); in blogic_probe()
1046 statusreg.all = blogic_rdstatus(adapter); in blogic_probe()
1047 intreg.all = blogic_rdint(adapter); in blogic_probe()
1048 georeg.all = blogic_rdgeom(adapter); in blogic_probe()
1050 …_Probe(0x%lX): Status 0x%02X, Interrupt 0x%02X, Geometry 0x%02X\n", adapter, adapter->io_addr, sta… in blogic_probe()
1088 static bool blogic_hwreset(struct blogic_adapter *adapter, bool hard_reset) in blogic_hwreset() argument
1096 if (blogic_flashpoint_type(adapter)) { in blogic_hwreset()
1097 struct fpoint_info *fpinfo = &adapter->fpinfo; in blogic_hwreset()
1100 adapter->cardhandle = in blogic_hwreset()
1102 if (adapter->cardhandle == (void *)FPOINT_BADCARD_HANDLE) in blogic_hwreset()
1115 blogic_hardreset(adapter); in blogic_hwreset()
1117 blogic_softreset(adapter); in blogic_hwreset()
1123 statusreg.all = blogic_rdstatus(adapter); in blogic_hwreset()
1129 …BusLogic_HardwareReset(0x%lX): Diagnostic Active, Status 0x%02X\n", adapter, adapter->io_addr, sta… in blogic_hwreset()
1143 statusreg.all = blogic_rdstatus(adapter); in blogic_hwreset()
1149 …Logic_HardwareReset(0x%lX): Diagnostic Completed, Status 0x%02X\n", adapter, adapter->io_addr, sta… in blogic_hwreset()
1158 statusreg.all = blogic_rdstatus(adapter); in blogic_hwreset()
1165 …usLogic_HardwareReset(0x%lX): Host Adapter Ready, Status 0x%02X\n", adapter, adapter->io_addr, sta… in blogic_hwreset()
1176 blogic_failure(adapter, "HARD RESET DIAGNOSTICS"); in blogic_hwreset()
1177 blogic_err("HOST ADAPTER STATUS REGISTER = %02X\n", adapter, in blogic_hwreset()
1180 blogic_err("HOST ADAPTER ERROR CODE = %d\n", adapter, in blogic_hwreset()
1181 blogic_rddatain(adapter)); in blogic_hwreset()
1196 static bool __init blogic_checkadapter(struct blogic_adapter *adapter) in blogic_checkadapter() argument
1204 if (blogic_flashpoint_type(adapter)) in blogic_checkadapter()
1213 if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen, in blogic_checkadapter()
1221 blogic_notice("BusLogic_Check(0x%lX): MultiMaster %s\n", adapter, in blogic_checkadapter()
1222 adapter->io_addr, in blogic_checkadapter()
1233 static bool __init blogic_rdconfig(struct blogic_adapter *adapter) in blogic_rdconfig() argument
1255 if (blogic_flashpoint_type(adapter)) { in blogic_rdconfig()
1256 struct fpoint_info *fpinfo = &adapter->fpinfo; in blogic_rdconfig()
1257 tgt = adapter->model; in blogic_rdconfig()
1264 strcpy(adapter->fw_ver, FLASHPOINT_FW_VER); in blogic_rdconfig()
1265 adapter->scsi_id = fpinfo->scsi_id; in blogic_rdconfig()
1266 adapter->ext_trans_enable = fpinfo->ext_trans_enable; in blogic_rdconfig()
1267 adapter->parity = fpinfo->parity; in blogic_rdconfig()
1268 adapter->reset_enabled = !fpinfo->softreset; in blogic_rdconfig()
1269 adapter->level_int = true; in blogic_rdconfig()
1270 adapter->wide = fpinfo->wide; in blogic_rdconfig()
1271 adapter->differential = false; in blogic_rdconfig()
1272 adapter->scam = true; in blogic_rdconfig()
1273 adapter->ultra = true; in blogic_rdconfig()
1274 adapter->ext_lun = true; in blogic_rdconfig()
1275 adapter->terminfo_valid = true; in blogic_rdconfig()
1276 adapter->low_term = fpinfo->low_term; in blogic_rdconfig()
1277 adapter->high_term = fpinfo->high_term; in blogic_rdconfig()
1278 adapter->scam_enabled = fpinfo->scam_enabled; in blogic_rdconfig()
1279 adapter->scam_lev2 = fpinfo->scam_lev2; in blogic_rdconfig()
1280 adapter->drvr_sglimit = BLOGIC_SG_LIMIT; in blogic_rdconfig()
1281 adapter->maxdev = (adapter->wide ? 16 : 8); in blogic_rdconfig()
1282 adapter->maxlun = 32; in blogic_rdconfig()
1283 adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1284 adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1285 adapter->drvr_qdepth = 255; in blogic_rdconfig()
1286 adapter->adapter_qdepth = adapter->drvr_qdepth; in blogic_rdconfig()
1287 adapter->sync_ok = fpinfo->sync_ok; in blogic_rdconfig()
1288 adapter->fast_ok = fpinfo->fast_ok; in blogic_rdconfig()
1289 adapter->ultra_ok = fpinfo->ultra_ok; in blogic_rdconfig()
1290 adapter->wide_ok = fpinfo->wide_ok; in blogic_rdconfig()
1291 adapter->discon_ok = fpinfo->discon_ok; in blogic_rdconfig()
1292 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1298 if (blogic_cmd(adapter, BLOGIC_GET_BOARD_ID, NULL, 0, &id, in blogic_rdconfig()
1300 return blogic_failure(adapter, "INQUIRE BOARD ID"); in blogic_rdconfig()
1304 if (blogic_cmd(adapter, BLOGIC_INQ_CONFIG, NULL, 0, &config, in blogic_rdconfig()
1307 return blogic_failure(adapter, "INQUIRE CONFIGURATION"); in blogic_rdconfig()
1312 if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen, in blogic_rdconfig()
1315 return blogic_failure(adapter, "INQUIRE SETUP INFORMATION"); in blogic_rdconfig()
1320 if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen, in blogic_rdconfig()
1323 return blogic_failure(adapter, in blogic_rdconfig()
1330 if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_D3, NULL, 0, in blogic_rdconfig()
1333 return blogic_failure(adapter, in blogic_rdconfig()
1351 if (blogic_cmd(adapter, BLOGIC_INQ_MODELNO, &req_replylen, in blogic_rdconfig()
1354 return blogic_failure(adapter, in blogic_rdconfig()
1377 tgt = adapter->model; in blogic_rdconfig()
1391 tgt = adapter->fw_ver; in blogic_rdconfig()
1401 if (strcmp(adapter->fw_ver, "3.3") >= 0) { in blogic_rdconfig()
1402 if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_LETTER, NULL, 0, in blogic_rdconfig()
1405 return blogic_failure(adapter, in blogic_rdconfig()
1414 adapter->scsi_id = config.id; in blogic_rdconfig()
1420 adapter->adapter_bus_type = in blogic_rdconfig()
1421 blogic_adater_bus_types[adapter->model[3] - '4']; in blogic_rdconfig()
1422 if (adapter->irq_ch == 0) { in blogic_rdconfig()
1424 adapter->irq_ch = 9; in blogic_rdconfig()
1426 adapter->irq_ch = 10; in blogic_rdconfig()
1428 adapter->irq_ch = 11; in blogic_rdconfig()
1430 adapter->irq_ch = 12; in blogic_rdconfig()
1432 adapter->irq_ch = 14; in blogic_rdconfig()
1434 adapter->irq_ch = 15; in blogic_rdconfig()
1440 georeg.all = blogic_rdgeom(adapter); in blogic_rdconfig()
1441 adapter->ext_trans_enable = georeg.gr.ext_trans_enable; in blogic_rdconfig()
1447 adapter->adapter_sglimit = ext_setupinfo.sg_limit; in blogic_rdconfig()
1448 adapter->drvr_sglimit = adapter->adapter_sglimit; in blogic_rdconfig()
1449 if (adapter->adapter_sglimit > BLOGIC_SG_LIMIT) in blogic_rdconfig()
1450 adapter->drvr_sglimit = BLOGIC_SG_LIMIT; in blogic_rdconfig()
1452 adapter->level_int = true; in blogic_rdconfig()
1453 adapter->wide = ext_setupinfo.wide; in blogic_rdconfig()
1454 adapter->differential = ext_setupinfo.differential; in blogic_rdconfig()
1455 adapter->scam = ext_setupinfo.scam; in blogic_rdconfig()
1456 adapter->ultra = ext_setupinfo.ultra; in blogic_rdconfig()
1461 if (adapter->fw_ver[0] == '5' || (adapter->fw_ver[0] == '4' && in blogic_rdconfig()
1462 adapter->wide)) in blogic_rdconfig()
1463 adapter->ext_lun = true; in blogic_rdconfig()
1468 if (adapter->fw_ver[0] == '5') { in blogic_rdconfig()
1469 if (blogic_cmd(adapter, BLOGIC_INQ_PCI_INFO, NULL, 0, in blogic_rdconfig()
1472 return blogic_failure(adapter, in blogic_rdconfig()
1479 adapter->terminfo_valid = true; in blogic_rdconfig()
1480 adapter->low_term = adapter_info.low_term; in blogic_rdconfig()
1481 adapter->high_term = adapter_info.high_term; in blogic_rdconfig()
1488 if (adapter->fw_ver[0] >= '4') { in blogic_rdconfig()
1491 if (blogic_cmd(adapter, BLOGIC_FETCH_LOCALRAM, &fetch_localram, in blogic_rdconfig()
1494 return blogic_failure(adapter, in blogic_rdconfig()
1500 adapter->parity = autoscsi.parity; in blogic_rdconfig()
1501 adapter->reset_enabled = autoscsi.reset_enabled; in blogic_rdconfig()
1502 if (adapter->fw_ver[0] == '4') { in blogic_rdconfig()
1503 adapter->terminfo_valid = true; in blogic_rdconfig()
1504 adapter->low_term = autoscsi.low_term; in blogic_rdconfig()
1505 adapter->high_term = autoscsi.high_term; in blogic_rdconfig()
1512 adapter->wide_ok = autoscsi.wide_ok; in blogic_rdconfig()
1513 adapter->fast_ok = autoscsi.fast_ok; in blogic_rdconfig()
1514 adapter->sync_ok = autoscsi.sync_ok; in blogic_rdconfig()
1515 adapter->discon_ok = autoscsi.discon_ok; in blogic_rdconfig()
1516 if (adapter->ultra) in blogic_rdconfig()
1517 adapter->ultra_ok = autoscsi.ultra_ok; in blogic_rdconfig()
1518 if (adapter->scam) { in blogic_rdconfig()
1519 adapter->scam_enabled = autoscsi.scam_enabled; in blogic_rdconfig()
1520 adapter->scam_lev2 = autoscsi.scam_lev2; in blogic_rdconfig()
1527 if (adapter->fw_ver[0] < '4') { in blogic_rdconfig()
1529 adapter->sync_ok = 0xFF; in blogic_rdconfig()
1530 if (adapter->adapter_bus_type == BLOGIC_EISA_BUS) { in blogic_rdconfig()
1532 adapter->fast_ok = 0xFF; in blogic_rdconfig()
1533 if (strcmp(adapter->model, "BT-757") == 0) in blogic_rdconfig()
1534 adapter->wide_ok = 0xFF; in blogic_rdconfig()
1537 adapter->discon_ok = 0xFF; in blogic_rdconfig()
1538 adapter->parity = setupinfo.parity; in blogic_rdconfig()
1539 adapter->reset_enabled = true; in blogic_rdconfig()
1545 adapter->maxdev = (adapter->wide ? 16 : 8); in blogic_rdconfig()
1546 adapter->maxlun = (adapter->ext_lun ? 32 : 8); in blogic_rdconfig()
1572 if (adapter->fw_ver[0] == '5') in blogic_rdconfig()
1573 adapter->adapter_qdepth = 192; in blogic_rdconfig()
1574 else if (adapter->fw_ver[0] == '4') in blogic_rdconfig()
1575 adapter->adapter_qdepth = 100; in blogic_rdconfig()
1577 adapter->adapter_qdepth = 30; in blogic_rdconfig()
1578 if (strcmp(adapter->fw_ver, "3.31") >= 0) { in blogic_rdconfig()
1579 adapter->strict_rr = true; in blogic_rdconfig()
1580 adapter->mbox_count = BLOGIC_MAX_MAILBOX; in blogic_rdconfig()
1582 adapter->strict_rr = false; in blogic_rdconfig()
1583 adapter->mbox_count = 32; in blogic_rdconfig()
1585 adapter->drvr_qdepth = adapter->mbox_count; in blogic_rdconfig()
1586 adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1587 adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1595 adapter->tagq_ok = 0; in blogic_rdconfig()
1596 switch (adapter->fw_ver[0]) { in blogic_rdconfig()
1598 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1601 if (strcmp(adapter->fw_ver, "4.22") >= 0) in blogic_rdconfig()
1602 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1605 if (strcmp(adapter->fw_ver, "3.35") >= 0) in blogic_rdconfig()
1606 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1614 adapter->bios_addr = ext_setupinfo.bios_addr << 12; in blogic_rdconfig()
1622 if (adapter->bios_addr > 0 && in blogic_rdconfig()
1623 strcmp(adapter->model, "BT-445S") == 0 && in blogic_rdconfig()
1624 strcmp(adapter->fw_ver, "3.37") < 0) in blogic_rdconfig()
1625 return blogic_failure(adapter, "Too old firmware"); in blogic_rdconfig()
1634 strcpy(adapter->full_model, "BusLogic "); in blogic_rdconfig()
1635 strcat(adapter->full_model, adapter->model); in blogic_rdconfig()
1645 if (adapter->drvr_opts != NULL && in blogic_rdconfig()
1646 adapter->drvr_opts->qdepth[tgt_id] > 0) in blogic_rdconfig()
1647 qdepth = adapter->drvr_opts->qdepth[tgt_id]; in blogic_rdconfig()
1648 adapter->qdepth[tgt_id] = qdepth; in blogic_rdconfig()
1650 adapter->untag_qdepth = BLOGIC_UNTAG_DEPTH; in blogic_rdconfig()
1651 if (adapter->drvr_opts != NULL) in blogic_rdconfig()
1652 adapter->common_qdepth = adapter->drvr_opts->common_qdepth; in blogic_rdconfig()
1653 if (adapter->common_qdepth > 0 && in blogic_rdconfig()
1654 adapter->common_qdepth < adapter->untag_qdepth) in blogic_rdconfig()
1655 adapter->untag_qdepth = adapter->common_qdepth; in blogic_rdconfig()
1661 adapter->tagq_ok &= adapter->discon_ok; in blogic_rdconfig()
1666 if (adapter->drvr_opts != NULL) in blogic_rdconfig()
1667 adapter->tagq_ok = (adapter->drvr_opts->tagq_ok & in blogic_rdconfig()
1668 adapter->drvr_opts->tagq_ok_mask) | in blogic_rdconfig()
1669 (adapter->tagq_ok & ~adapter->drvr_opts->tagq_ok_mask); in blogic_rdconfig()
1676 if (adapter->drvr_opts != NULL && in blogic_rdconfig()
1677 adapter->drvr_opts->bus_settle_time > 0) in blogic_rdconfig()
1678 adapter->bus_settle_time = adapter->drvr_opts->bus_settle_time; in blogic_rdconfig()
1680 adapter->bus_settle_time = BLOGIC_BUS_SETTLE_TIME; in blogic_rdconfig()
1693 static bool __init blogic_reportconfig(struct blogic_adapter *adapter) in blogic_reportconfig() argument
1695 unsigned short alltgt_mask = (1 << adapter->maxdev) - 1; in blogic_reportconfig()
1710adapter, adapter->model, blogic_adapter_busnames[adapter->adapter_bus_type], (adapter->wide ? " Wi… in blogic_reportconfig()
1711 …/O Address: 0x%lX, IRQ Channel: %d/%s\n", adapter, adapter->fw_ver, adapter->io_addr, adapter->irq… in blogic_reportconfig()
1712 if (adapter->adapter_bus_type != BLOGIC_PCI_BUS) { in blogic_reportconfig()
1713 blogic_info(" DMA Channel: None, ", adapter); in blogic_reportconfig()
1714 if (adapter->bios_addr > 0) in blogic_reportconfig()
1715 blogic_info("BIOS Address: 0x%X, ", adapter, in blogic_reportconfig()
1716 adapter->bios_addr); in blogic_reportconfig()
1718 blogic_info("BIOS Address: None, ", adapter); in blogic_reportconfig()
1720 blogic_info(" PCI Bus: %d, Device: %d, Address: ", adapter, in blogic_reportconfig()
1721 adapter->bus, adapter->dev); in blogic_reportconfig()
1722 if (adapter->pci_addr > 0) in blogic_reportconfig()
1723 blogic_info("0x%lX, ", adapter, adapter->pci_addr); in blogic_reportconfig()
1725 blogic_info("Unassigned, ", adapter); in blogic_reportconfig()
1727 blogic_info("Host Adapter SCSI ID: %d\n", adapter, adapter->scsi_id); in blogic_reportconfig()
1729 adapter, (adapter->parity ? "Enabled" : "Disabled"), in blogic_reportconfig()
1730 (adapter->ext_trans_enable ? "Enabled" : "Disabled")); in blogic_reportconfig()
1731 alltgt_mask &= ~(1 << adapter->scsi_id); in blogic_reportconfig()
1732 sync_ok = adapter->sync_ok & alltgt_mask; in blogic_reportconfig()
1733 fast_ok = adapter->fast_ok & alltgt_mask; in blogic_reportconfig()
1734 ultra_ok = adapter->ultra_ok & alltgt_mask; in blogic_reportconfig()
1735 if ((blogic_multimaster_type(adapter) && in blogic_reportconfig()
1736 (adapter->fw_ver[0] >= '4' || in blogic_reportconfig()
1737 adapter->adapter_bus_type == BLOGIC_EISA_BUS)) || in blogic_reportconfig()
1738 blogic_flashpoint_type(adapter)) { in blogic_reportconfig()
1758 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1760 syncstr[adapter->scsi_id] = '#'; in blogic_reportconfig()
1761 syncstr[adapter->maxdev] = '\0'; in blogic_reportconfig()
1765 wide_ok = adapter->wide_ok & alltgt_mask; in blogic_reportconfig()
1771 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1773 widestr[adapter->scsi_id] = '#'; in blogic_reportconfig()
1774 widestr[adapter->maxdev] = '\0'; in blogic_reportconfig()
1776 discon_ok = adapter->discon_ok & alltgt_mask; in blogic_reportconfig()
1782 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1784 discon_str[adapter->scsi_id] = '#'; in blogic_reportconfig()
1785 discon_str[adapter->maxdev] = '\0'; in blogic_reportconfig()
1787 tagq_ok = adapter->tagq_ok & alltgt_mask; in blogic_reportconfig()
1793 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1795 tagq_str[adapter->scsi_id] = '#'; in blogic_reportconfig()
1796 tagq_str[adapter->maxdev] = '\0'; in blogic_reportconfig()
1799 adapter, syncmsg, widemsg); in blogic_reportconfig()
1800 blogic_info(" Disconnect/Reconnect: %s, Tagged Queuing: %s\n", adapter, in blogic_reportconfig()
1802 if (blogic_multimaster_type(adapter)) { in blogic_reportconfig()
1803 …Limit: %d of %d segments, Mailboxes: %d\n", adapter, adapter->drvr_sglimit, adapter->adapter_sglim… in blogic_reportconfig()
1804 …Driver Queue Depth: %d, Host Adapter Queue Depth: %d\n", adapter, adapter->drvr_qdepth, adapter->a… in blogic_reportconfig()
1806 …r Queue Depth: %d, Scatter/Gather Limit: %d segments\n", adapter, adapter->drvr_qdepth, adapter->d… in blogic_reportconfig()
1807 blogic_info(" Tagged Queue Depth: ", adapter); in blogic_reportconfig()
1809 for (tgt_id = 1; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1810 if (adapter->qdepth[tgt_id] != adapter->qdepth[0]) { in blogic_reportconfig()
1815 if (adapter->qdepth[0] > 0) in blogic_reportconfig()
1816 blogic_info("%d", adapter, adapter->qdepth[0]); in blogic_reportconfig()
1818 blogic_info("Automatic", adapter); in blogic_reportconfig()
1820 blogic_info("Individual", adapter); in blogic_reportconfig()
1821 blogic_info(", Untagged Queue Depth: %d\n", adapter, in blogic_reportconfig()
1822 adapter->untag_qdepth); in blogic_reportconfig()
1823 if (adapter->terminfo_valid) { in blogic_reportconfig()
1824 if (adapter->wide) in blogic_reportconfig()
1825 blogic_info(" SCSI Bus Termination: %s", adapter, in blogic_reportconfig()
1826 …(adapter->low_term ? (adapter->high_term ? "Both Enabled" : "Low Enabled") : (adapter->high_term ?… in blogic_reportconfig()
1828 blogic_info(" SCSI Bus Termination: %s", adapter, in blogic_reportconfig()
1829 (adapter->low_term ? "Enabled" : "Disabled")); in blogic_reportconfig()
1830 if (adapter->scam) in blogic_reportconfig()
1831 blogic_info(", SCAM: %s", adapter, in blogic_reportconfig()
1832 …(adapter->scam_enabled ? (adapter->scam_lev2 ? "Enabled, Level 2" : "Enabled, Level 1") : "Disable… in blogic_reportconfig()
1833 blogic_info("\n", adapter); in blogic_reportconfig()
1848 static bool __init blogic_getres(struct blogic_adapter *adapter) in blogic_getres() argument
1850 if (adapter->irq_ch == 0) { in blogic_getres()
1852 adapter); in blogic_getres()
1858 if (request_irq(adapter->irq_ch, blogic_inthandler, IRQF_SHARED, in blogic_getres()
1859 adapter->full_model, adapter) < 0) { in blogic_getres()
1861 adapter, adapter->irq_ch); in blogic_getres()
1864 adapter->irq_acquired = true; in blogic_getres()
1877 static void blogic_relres(struct blogic_adapter *adapter) in blogic_relres() argument
1882 if (adapter->irq_acquired) in blogic_relres()
1883 free_irq(adapter->irq_ch, adapter); in blogic_relres()
1887 if (adapter->mbox_space) in blogic_relres()
1888 dma_free_coherent(&adapter->pci_device->dev, adapter->mbox_sz, in blogic_relres()
1889 adapter->mbox_space, adapter->mbox_space_handle); in blogic_relres()
1890 pci_dev_put(adapter->pci_device); in blogic_relres()
1891 adapter->mbox_space = NULL; in blogic_relres()
1892 adapter->mbox_space_handle = 0; in blogic_relres()
1893 adapter->mbox_sz = 0; in blogic_relres()
1903 static bool blogic_initadapter(struct blogic_adapter *adapter) in blogic_initadapter() argument
1914 adapter->firstccb = NULL; in blogic_initadapter()
1915 adapter->lastccb = NULL; in blogic_initadapter()
1922 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) { in blogic_initadapter()
1923 adapter->bdr_pend[tgt_id] = NULL; in blogic_initadapter()
1924 adapter->tgt_flags[tgt_id].tagq_active = false; in blogic_initadapter()
1925 adapter->tgt_flags[tgt_id].cmd_good = false; in blogic_initadapter()
1926 adapter->active_cmds[tgt_id] = 0; in blogic_initadapter()
1927 adapter->cmds_since_rst[tgt_id] = 0; in blogic_initadapter()
1933 if (blogic_flashpoint_type(adapter)) in blogic_initadapter()
1939adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbo… in blogic_initadapter()
1940 adapter->mbox_space = dma_alloc_coherent(&adapter->pci_device->dev, in blogic_initadapter()
1941 adapter->mbox_sz, &adapter->mbox_space_handle, in blogic_initadapter()
1943 if (adapter->mbox_space == NULL) in blogic_initadapter()
1944 return blogic_failure(adapter, "MAILBOX ALLOCATION"); in blogic_initadapter()
1945 adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space; in blogic_initadapter()
1946 adapter->last_outbox = adapter->first_outbox + adapter->mbox_count - 1; in blogic_initadapter()
1947 adapter->next_outbox = adapter->first_outbox; in blogic_initadapter()
1948 adapter->first_inbox = (struct blogic_inbox *) (adapter->last_outbox + 1); in blogic_initadapter()
1949 adapter->last_inbox = adapter->first_inbox + adapter->mbox_count - 1; in blogic_initadapter()
1950 adapter->next_inbox = adapter->first_inbox; in blogic_initadapter()
1955 memset(adapter->first_outbox, 0, in blogic_initadapter()
1956 adapter->mbox_count * sizeof(struct blogic_outbox)); in blogic_initadapter()
1957 memset(adapter->first_inbox, 0, in blogic_initadapter()
1958 adapter->mbox_count * sizeof(struct blogic_inbox)); in blogic_initadapter()
1964 extmbox_req.mbox_count = adapter->mbox_count; in blogic_initadapter()
1965 extmbox_req.base_mbox_addr = (u32) adapter->mbox_space_handle; in blogic_initadapter()
1966 if (blogic_cmd(adapter, BLOGIC_INIT_EXT_MBOX, &extmbox_req, in blogic_initadapter()
1968 return blogic_failure(adapter, "MAILBOX INITIALIZATION"); in blogic_initadapter()
1977 if (adapter->strict_rr) { in blogic_initadapter()
1979 if (blogic_cmd(adapter, BLOGIC_STRICT_RR, &rr_req, in blogic_initadapter()
1981 return blogic_failure(adapter, in blogic_initadapter()
1989 if (adapter->ext_lun) { in blogic_initadapter()
1991 if (blogic_cmd(adapter, BLOGIC_SETCCB_FMT, &setccb_fmt, in blogic_initadapter()
1993 return blogic_failure(adapter, "SET CCB FORMAT"); in blogic_initadapter()
2000 if (!adapter->adapter_initd) { in blogic_initadapter()
2001 blogic_info("*** %s Initialized Successfully ***\n", adapter, in blogic_initadapter()
2002 adapter->full_model); in blogic_initadapter()
2003 blogic_info("\n", adapter); in blogic_initadapter()
2005 blogic_warn("*** %s Initialized Successfully ***\n", adapter, in blogic_initadapter()
2006 adapter->full_model); in blogic_initadapter()
2007 adapter->adapter_initd = true; in blogic_initadapter()
2021 static bool __init blogic_inquiry(struct blogic_adapter *adapter) in blogic_inquiry() argument
2036 blogic_delay(adapter->bus_settle_time); in blogic_inquiry()
2040 if (blogic_flashpoint_type(adapter)) in blogic_inquiry()
2045 if (adapter->drvr_opts != NULL && adapter->drvr_opts->stop_tgt_inquiry) in blogic_inquiry()
2057 if (strcmp(adapter->fw_ver, "4.25") >= 0) { in blogic_inquiry()
2067 if (blogic_cmd(adapter, BLOGIC_INQ_DEV, NULL, 0, in blogic_inquiry()
2070 return blogic_failure(adapter, "INQUIRE TARGET DEVICES"); in blogic_inquiry()
2071 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2072 adapter->tgt_flags[tgt_id].tgt_exists = in blogic_inquiry()
2083 if (blogic_cmd(adapter, BLOGIC_INQ_DEV0TO7, NULL, 0, in blogic_inquiry()
2086 return blogic_failure(adapter, in blogic_inquiry()
2089 adapter->tgt_flags[tgt_id].tgt_exists = in blogic_inquiry()
2096 if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen, in blogic_inquiry()
2099 return blogic_failure(adapter, "INQUIRE SETUP INFORMATION"); in blogic_inquiry()
2100 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2101adapter->sync_offset[tgt_id] = (tgt_id < 8 ? setupinfo.sync0to7[tgt_id].offset : setupinfo.sync8to… in blogic_inquiry()
2102 if (strcmp(adapter->fw_ver, "5.06L") >= 0) in blogic_inquiry()
2103 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2104adapter->tgt_flags[tgt_id].wide_active = (tgt_id < 8 ? (setupinfo.wide_tx_active0to7 & (1 << tgt_i… in blogic_inquiry()
2108 if (adapter->fw_ver[0] >= '3') { in blogic_inquiry()
2116 if (blogic_cmd(adapter, BLOGIC_INQ_SYNC_PERIOD, &req_replylen, in blogic_inquiry()
2119 return blogic_failure(adapter, in blogic_inquiry()
2121 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2122 adapter->sync_period[tgt_id] = sync_period[tgt_id]; in blogic_inquiry()
2124 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2126 adapter->sync_period[tgt_id] = 20 + 5 * setupinfo.sync0to7[tgt_id].tx_period; in blogic_inquiry()
2142 static void __init blogic_inithoststruct(struct blogic_adapter *adapter, in blogic_inithoststruct() argument
2145 host->max_id = adapter->maxdev; in blogic_inithoststruct()
2146 host->max_lun = adapter->maxlun; in blogic_inithoststruct()
2148 host->unique_id = adapter->io_addr; in blogic_inithoststruct()
2149 host->this_id = adapter->scsi_id; in blogic_inithoststruct()
2150 host->can_queue = adapter->drvr_qdepth; in blogic_inithoststruct()
2151 host->sg_tablesize = adapter->drvr_sglimit; in blogic_inithoststruct()
2152 host->cmd_per_lun = adapter->untag_qdepth; in blogic_inithoststruct()
2165 struct blogic_adapter *adapter = in blogic_slaveconfig() local
2168 int qdepth = adapter->qdepth[tgt_id]; in blogic_slaveconfig()
2170 if (adapter->tgt_flags[tgt_id].tagq_ok && in blogic_slaveconfig()
2171 (adapter->tagq_ok & (1 << tgt_id))) { in blogic_slaveconfig()
2174 adapter->qdepth[tgt_id] = qdepth; in blogic_slaveconfig()
2177 adapter->tagq_ok &= ~(1 << tgt_id); in blogic_slaveconfig()
2178 qdepth = adapter->untag_qdepth; in blogic_slaveconfig()
2179 adapter->qdepth[tgt_id] = qdepth; in blogic_slaveconfig()
2183 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_slaveconfig()
2184 if (adapter->tgt_flags[tgt_id].tgt_exists) in blogic_slaveconfig()
2185 qdepth += adapter->qdepth[tgt_id]; in blogic_slaveconfig()
2186 if (qdepth > adapter->alloc_ccbs) in blogic_slaveconfig()
2187 blogic_create_addlccbs(adapter, qdepth - adapter->alloc_ccbs, in blogic_slaveconfig()
2203 struct blogic_adapter *adapter; in blogic_init() local
2222 adapter = kzalloc(sizeof(struct blogic_adapter), GFP_KERNEL); in blogic_init()
2223 if (adapter == NULL) { in blogic_init()
2233 blogic_init_probeinfo_list(adapter); in blogic_init()
2237 struct blogic_adapter *myadapter = adapter; in blogic_init()
2310 memcpy(myadapter, adapter, sizeof(struct blogic_adapter)); in blogic_init()
2393 kfree(adapter); in blogic_init()
2406 static int __exit blogic_deladapter(struct blogic_adapter *adapter) in blogic_deladapter() argument
2408 struct Scsi_Host *host = adapter->scsi_host; in blogic_deladapter()
2416 if (blogic_flashpoint_type(adapter)) in blogic_deladapter()
2417 FlashPoint_ReleaseHostAdapter(adapter->cardhandle); in blogic_deladapter()
2422 blogic_destroy_ccbs(adapter); in blogic_deladapter()
2423 blogic_relres(adapter); in blogic_deladapter()
2427 release_region(adapter->io_addr, adapter->addr_count); in blogic_deladapter()
2432 list_del(&adapter->host_list); in blogic_deladapter()
2445 struct blogic_adapter *adapter = ccb->adapter; in blogic_qcompleted_ccb() local
2449 if (adapter->firstccb == NULL) { in blogic_qcompleted_ccb()
2450 adapter->firstccb = ccb; in blogic_qcompleted_ccb()
2451 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2453 adapter->lastccb->next = ccb; in blogic_qcompleted_ccb()
2454 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2456 adapter->active_cmds[ccb->tgt_id]--; in blogic_qcompleted_ccb()
2465 static int blogic_resultcode(struct blogic_adapter *adapter, in blogic_resultcode() argument
2484 adapter, adapter_status); in blogic_resultcode()
2509 blogic_warn("Unknown Host Adapter Status 0x%02X\n", adapter, in blogic_resultcode()
2522 blogic_inbox_to_ccb(struct blogic_adapter *adapter, struct blogic_inbox *inbox) in blogic_inbox_to_ccb() argument
2526 for (ccb = adapter->all_ccbs; ccb; ccb = ccb->next_all) in blogic_inbox_to_ccb()
2537 static void blogic_scan_inbox(struct blogic_adapter *adapter) in blogic_scan_inbox() argument
2552 struct blogic_inbox *next_inbox = adapter->next_inbox; in blogic_scan_inbox()
2556 struct blogic_ccb *ccb = blogic_inbox_to_ccb(adapter, next_inbox); in blogic_scan_inbox()
2562 blogic_warn("Could not find CCB for dma address %x\n", adapter, next_inbox->ccb); in blogic_scan_inbox()
2579 …blogic_warn("Illegal CCB #%ld status %d in Incoming Mailbox\n", adapter, ccb->serial, ccb->status); in blogic_scan_inbox()
2583 if (++next_inbox > adapter->last_inbox) in blogic_scan_inbox()
2584 next_inbox = adapter->first_inbox; in blogic_scan_inbox()
2586 adapter->next_inbox = next_inbox; in blogic_scan_inbox()
2597 static void blogic_process_ccbs(struct blogic_adapter *adapter) in blogic_process_ccbs() argument
2599 if (adapter->processing_ccbs) in blogic_process_ccbs()
2601 adapter->processing_ccbs = true; in blogic_process_ccbs()
2602 while (adapter->firstccb != NULL) { in blogic_process_ccbs()
2603 struct blogic_ccb *ccb = adapter->firstccb; in blogic_process_ccbs()
2605 adapter->firstccb = ccb->next; in blogic_process_ccbs()
2606 if (adapter->firstccb == NULL) in blogic_process_ccbs()
2607 adapter->lastccb = NULL; in blogic_process_ccbs()
2614 blogic_warn("Bus Device Reset CCB #%ld to Target %d Completed\n", adapter, ccb->serial, tgt_id); in blogic_process_ccbs()
2615 blogic_inc_count(&adapter->tgt_stats[tgt_id].bdr_done); in blogic_process_ccbs()
2616 adapter->tgt_flags[tgt_id].tagq_active = false; in blogic_process_ccbs()
2617 adapter->cmds_since_rst[tgt_id] = 0; in blogic_process_ccbs()
2618 adapter->last_resetdone[tgt_id] = jiffies; in blogic_process_ccbs()
2646 for (ccb = adapter->all_ccbs; ccb != NULL; in blogic_process_ccbs()
2652 adapter->active_cmds[tgt_id]--; in blogic_process_ccbs()
2656 adapter->bdr_pend[tgt_id] = NULL; in blogic_process_ccbs()
2667 blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2670 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2672 adapter->tgt_flags[ccb->tgt_id] in blogic_process_ccbs()
2678 adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2679 blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done); in blogic_process_ccbs()
2683 command->result = blogic_resultcode(adapter, in blogic_process_ccbs()
2686 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2691 …"Adapter Status %02X Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result, cc… in blogic_process_ccbs()
2692 blogic_notice("CDB ", adapter); in blogic_process_ccbs()
2694 blogic_notice(" %02X", adapter, ccb->cdb[i]); in blogic_process_ccbs()
2695 blogic_notice("\n", adapter); in blogic_process_ccbs()
2696 blogic_notice("Sense ", adapter); in blogic_process_ccbs()
2698 blogic_notice(" %02X", adapter, command->sense_buffer[i]); in blogic_process_ccbs()
2699 blogic_notice("\n", adapter); in blogic_process_ccbs()
2712 &adapter->tgt_flags[ccb->tgt_id]; in blogic_process_ccbs()
2729 adapter->processing_ccbs = false; in blogic_process_ccbs()
2740 struct blogic_adapter *adapter = (struct blogic_adapter *) devid; in blogic_inthandler() local
2745 spin_lock_irqsave(adapter->scsi_host->host_lock, processor_flag); in blogic_inthandler()
2749 if (blogic_multimaster_type(adapter)) { in blogic_inthandler()
2754 intreg.all = blogic_rdint(adapter); in blogic_inthandler()
2760 blogic_intreset(adapter); in blogic_inthandler()
2768 adapter->adapter_extreset = true; in blogic_inthandler()
2770 blogic_scan_inbox(adapter); in blogic_inthandler()
2772 adapter->adapter_cmd_complete = true; in blogic_inthandler()
2778 if (FlashPoint_InterruptPending(adapter->cardhandle)) in blogic_inthandler()
2779 switch (FlashPoint_HandleInterrupt(adapter->cardhandle)) { in blogic_inthandler()
2783 adapter->adapter_extreset = true; in blogic_inthandler()
2786 blogic_warn("Internal FlashPoint Error detected - Resetting Host Adapter\n", adapter); in blogic_inthandler()
2787 adapter->adapter_intern_err = true; in blogic_inthandler()
2794 if (adapter->firstccb != NULL) in blogic_inthandler()
2795 blogic_process_ccbs(adapter); in blogic_inthandler()
2799 if (adapter->adapter_extreset) { in blogic_inthandler()
2800 blogic_warn("Resetting %s due to External SCSI Bus Reset\n", adapter, adapter->full_model); in blogic_inthandler()
2801 blogic_inc_count(&adapter->ext_resets); in blogic_inthandler()
2802 blogic_resetadapter(adapter, false); in blogic_inthandler()
2803 adapter->adapter_extreset = false; in blogic_inthandler()
2804 } else if (adapter->adapter_intern_err) { in blogic_inthandler()
2805 blogic_warn("Resetting %s due to Host Adapter Internal Error\n", adapter, adapter->full_model); in blogic_inthandler()
2806 blogic_inc_count(&adapter->adapter_intern_errors); in blogic_inthandler()
2807 blogic_resetadapter(adapter, true); in blogic_inthandler()
2808 adapter->adapter_intern_err = false; in blogic_inthandler()
2813 spin_unlock_irqrestore(adapter->scsi_host->host_lock, processor_flag); in blogic_inthandler()
2824 static bool blogic_write_outbox(struct blogic_adapter *adapter, in blogic_write_outbox() argument
2829 next_outbox = adapter->next_outbox; in blogic_write_outbox()
2840 blogic_execmbox(adapter); in blogic_write_outbox()
2841 if (++next_outbox > adapter->last_outbox) in blogic_write_outbox()
2842 next_outbox = adapter->first_outbox; in blogic_write_outbox()
2843 adapter->next_outbox = next_outbox; in blogic_write_outbox()
2845 adapter->active_cmds[ccb->tgt_id]++; in blogic_write_outbox()
2847 adapter->tgt_stats[ccb->tgt_id].cmds_tried++; in blogic_write_outbox()
2858 struct blogic_adapter *adapter = in blogic_hostreset() local
2862 struct blogic_tgt_stats *stats = &adapter->tgt_stats[id]; in blogic_hostreset()
2869 rc = blogic_resetadapter(adapter, false); in blogic_hostreset()
2882 struct blogic_adapter *adapter = in blogic_qcmd_lck() local
2885 &adapter->tgt_flags[command->device->id]; in blogic_qcmd_lck()
2886 struct blogic_tgt_stats *tgt_stats = adapter->tgt_stats; in blogic_qcmd_lck()
2914 ccb = blogic_alloc_ccb(adapter); in blogic_qcmd_lck()
2916 spin_unlock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
2918 spin_lock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
2919 ccb = blogic_alloc_ccb(adapter); in blogic_qcmd_lck()
2938 if (blogic_multimaster_type(adapter)) in blogic_qcmd_lck()
2997 if (adapter->cmds_since_rst[tgt_id]++ >= BLOGIC_MAX_TAG_DEPTH && in blogic_qcmd_lck()
2999 adapter->active_cmds[tgt_id] == 0 in blogic_qcmd_lck()
3001 (adapter->tagq_ok & (1 << tgt_id))) { in blogic_qcmd_lck()
3004 adapter, tgt_id); in blogic_qcmd_lck()
3023 if (adapter->active_cmds[tgt_id] == 0) in blogic_qcmd_lck()
3024 adapter->last_seqpoint[tgt_id] = jiffies; in blogic_qcmd_lck()
3026 adapter->last_seqpoint[tgt_id] + 4 * HZ)) { in blogic_qcmd_lck()
3027 adapter->last_seqpoint[tgt_id] = jiffies; in blogic_qcmd_lck()
3030 if (adapter->ext_lun) { in blogic_qcmd_lck()
3041 sense_buf = dma_map_single(&adapter->pci_device->dev, in blogic_qcmd_lck()
3044 if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) { in blogic_qcmd_lck()
3046 adapter); in blogic_qcmd_lck()
3051 if (blogic_multimaster_type(adapter)) { in blogic_qcmd_lck()
3062 if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) { in blogic_qcmd_lck()
3063 spin_unlock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
3064 blogic_warn("Unable to write Outgoing Mailbox - Pausing for 1 second\n", adapter); in blogic_qcmd_lck()
3066 spin_lock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
3067 if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, in blogic_qcmd_lck()
3069 blogic_warn("Still unable to write Outgoing Mailbox - Host Adapter Dead?\n", adapter); in blogic_qcmd_lck()
3081 adapter->active_cmds[tgt_id]++; in blogic_qcmd_lck()
3083 FlashPoint_StartCCB(adapter->cardhandle, ccb); in blogic_qcmd_lck()
3090 blogic_process_ccbs(adapter); in blogic_qcmd_lck()
3104 struct blogic_adapter *adapter = in DEF_SCSI_QCMD()
3109 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_request); in DEF_SCSI_QCMD()
3115 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all) in DEF_SCSI_QCMD()
3119 blogic_warn("Unable to Abort Command to Target %d - No CCB Found\n", adapter, tgt_id); in DEF_SCSI_QCMD()
3122 blogic_warn("Unable to Abort Command to Target %d - CCB Completed\n", adapter, tgt_id); in DEF_SCSI_QCMD()
3125 blogic_warn("Unable to Abort Command to Target %d - CCB Reset\n", adapter, tgt_id); in DEF_SCSI_QCMD()
3128 if (blogic_multimaster_type(adapter)) { in DEF_SCSI_QCMD()
3141 if (adapter->tgt_flags[tgt_id].tagq_active && in DEF_SCSI_QCMD()
3142 adapter->fw_ver[0] < '5') { in DEF_SCSI_QCMD()
3143 …blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->ser… in DEF_SCSI_QCMD()
3145 } else if (blogic_write_outbox(adapter, BLOGIC_MBOX_ABORT, in DEF_SCSI_QCMD()
3148 adapter, ccb->serial, tgt_id); in DEF_SCSI_QCMD()
3149 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried); in DEF_SCSI_QCMD()
3152 …blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->seria… in DEF_SCSI_QCMD()
3160 blogic_warn("Aborting CCB #%ld to Target %d\n", adapter, in DEF_SCSI_QCMD()
3162 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried); in DEF_SCSI_QCMD()
3163 FlashPoint_AbortCCB(adapter->cardhandle, ccb); in DEF_SCSI_QCMD()
3170 blogic_process_ccbs(adapter); in DEF_SCSI_QCMD()
3182 static int blogic_resetadapter(struct blogic_adapter *adapter, bool hard_reset)
3191 if (!(blogic_hwreset(adapter, hard_reset) &&
3192 blogic_initadapter(adapter))) {
3193 blogic_err("Resetting %s Failed\n", adapter,
3194 adapter->full_model);
3202 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
3213 spin_unlock_irq(adapter->scsi_host->host_lock);
3214 blogic_delay(adapter->bus_settle_time);
3215 spin_lock_irq(adapter->scsi_host->host_lock);
3218 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
3219 adapter->last_resettried[tgt_id] = jiffies;
3220 adapter->last_resetdone[tgt_id] = jiffies;
3245 struct blogic_adapter *adapter = in blogic_diskparam() local
3250 if (adapter->ext_trans_enable && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */) { in blogic_diskparam()
3303 …blogic_warn("Adopting Geometry %d/%d from Partition Table\n", adapter, diskparam->heads, diskparam… in blogic_diskparam()
3305 …blogic_warn("Warning: Partition Table appears to have Geometry %d/%d which is\n", adapter, part_en… in blogic_diskparam()
3306 …blogic_warn("not compatible with current BusLogic Host Adapter Geometry %d/%d\n", adapter, diskpar… in blogic_diskparam()
3321 struct blogic_adapter *adapter = in blogic_write_info() local
3325 tgt_stats = adapter->tgt_stats; in blogic_write_info()
3326 adapter->ext_resets = 0; in blogic_write_info()
3327 adapter->adapter_intern_errors = 0; in blogic_write_info()
3334 struct blogic_adapter *adapter = (struct blogic_adapter *) shost->hostdata; in blogic_show_info() local
3338 tgt_stats = adapter->tgt_stats; in blogic_show_info()
3339 seq_write(m, adapter->msgbuf, adapter->msgbuflen); in blogic_show_info()
3342 Currently Allocated CCBs: %d\n", adapter->drvr_qdepth, adapter->alloc_ccbs); in blogic_show_info()
3348 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3349 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3352 …s", tgt, (tgt_flags->tagq_ok ? (tgt_flags->tagq_active ? " Active" : (adapter->tagq_ok & (1 << … in blogic_show_info()
3356 …" %3d %3u %9u %9u\n", adapter->qdepth[tgt], adapter->active_cmds[tgt], tgt_stats[tgt]… in blogic_show_info()
3361 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3362 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3378 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3379 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3394 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3395 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3414 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3415 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3429 seq_printf(m, "\nExternal Host Adapter Resets: %d\n", adapter->ext_resets); in blogic_show_info()
3430 seq_printf(m, "Host Adapter Internal Errors: %d\n", adapter->adapter_intern_errors); in blogic_show_info()
3440 struct blogic_adapter *adapter, ...) in blogic_msg() argument
3447 va_start(args, adapter); in blogic_msg()
3452 strcpy(&adapter->msgbuf[adapter->msgbuflen], buf); in blogic_msg()
3453 adapter->msgbuflen += len; in blogic_msg()
3457 strcpy(&adapter->msgbuf[adapter->msgbuflen], buf); in blogic_msg()
3458 adapter->msgbuflen += len; in blogic_msg()
3461 printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf); in blogic_msg()
3466 if (adapter != NULL && adapter->adapter_initd) in blogic_msg()
3467 printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf); in blogic_msg()