• Home
  • Raw
  • Download

Lines Matching refs:adapter

141 static void blogic_announce_drvr(struct blogic_adapter *adapter)  in blogic_announce_drvr()  argument
143 …** BusLogic SCSI Driver Version " blogic_drvr_version " of " blogic_drvr_date " *****\n", adapter); in blogic_announce_drvr()
144 blogic_announce("Copyright 1995-1998 by Leonard N. Zubkoff " "<lnz@dandelion.com>\n", adapter); in blogic_announce_drvr()
155 struct blogic_adapter *adapter = in blogic_drvr_info() local
157 return adapter->full_model; in blogic_drvr_info()
166 static void blogic_init_ccbs(struct blogic_adapter *adapter, void *blk_pointer, in blogic_init_ccbs() argument
176 ccb->adapter = adapter; in blogic_init_ccbs()
178 if (blogic_flashpoint_type(adapter)) { in blogic_init_ccbs()
180 ccb->base_addr = adapter->fpinfo.base_addr; in blogic_init_ccbs()
182 ccb->next = adapter->free_ccbs; in blogic_init_ccbs()
183 ccb->next_all = adapter->all_ccbs; in blogic_init_ccbs()
184 adapter->free_ccbs = ccb; in blogic_init_ccbs()
185 adapter->all_ccbs = ccb; in blogic_init_ccbs()
186 adapter->alloc_ccbs++; in blogic_init_ccbs()
197 static bool __init blogic_create_initccbs(struct blogic_adapter *adapter) in blogic_create_initccbs() argument
203 while (adapter->alloc_ccbs < adapter->initccbs) { in blogic_create_initccbs()
204 blk_pointer = pci_alloc_consistent(adapter->pci_device, in blogic_create_initccbs()
208 adapter); in blogic_create_initccbs()
211 blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp); in blogic_create_initccbs()
221 static void blogic_destroy_ccbs(struct blogic_adapter *adapter) in blogic_destroy_ccbs() argument
223 struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL; in blogic_destroy_ccbs()
224 adapter->all_ccbs = NULL; in blogic_destroy_ccbs()
225 adapter->free_ccbs = NULL; in blogic_destroy_ccbs()
230 pci_free_consistent(adapter->pci_device, in blogic_destroy_ccbs()
237 pci_free_consistent(adapter->pci_device, lastccb->allocgrp_size, in blogic_destroy_ccbs()
249 static void blogic_create_addlccbs(struct blogic_adapter *adapter, in blogic_create_addlccbs() argument
253 int prev_alloc = adapter->alloc_ccbs; in blogic_create_addlccbs()
258 while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) { in blogic_create_addlccbs()
259 blk_pointer = pci_alloc_consistent(adapter->pci_device, in blogic_create_addlccbs()
263 blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp); in blogic_create_addlccbs()
265 if (adapter->alloc_ccbs > prev_alloc) { in blogic_create_addlccbs()
267 …e("Allocated %d additional CCBs (total now %d)\n", adapter, adapter->alloc_ccbs - prev_alloc, adap… in blogic_create_addlccbs()
270 blogic_notice("Failed to allocate additional CCBs\n", adapter); in blogic_create_addlccbs()
271 if (adapter->drvr_qdepth > adapter->alloc_ccbs - adapter->tgt_count) { in blogic_create_addlccbs()
272 adapter->drvr_qdepth = adapter->alloc_ccbs - adapter->tgt_count; in blogic_create_addlccbs()
273 adapter->scsi_host->can_queue = adapter->drvr_qdepth; in blogic_create_addlccbs()
283 static struct blogic_ccb *blogic_alloc_ccb(struct blogic_adapter *adapter) in blogic_alloc_ccb() argument
287 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
290 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
292 if (adapter->free_ccbs == NULL) in blogic_alloc_ccb()
293 blogic_create_addlccbs(adapter, adapter->inc_ccbs, in blogic_alloc_ccb()
297 blogic_create_addlccbs(adapter, adapter->inc_ccbs, true); in blogic_alloc_ccb()
298 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
302 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
316 struct blogic_adapter *adapter = ccb->adapter; in blogic_dealloc_ccb() local
321 pci_unmap_single(adapter->pci_device, ccb->sensedata, in blogic_dealloc_ccb()
326 ccb->next = adapter->free_ccbs; in blogic_dealloc_ccb()
327 adapter->free_ccbs = ccb; in blogic_dealloc_ccb()
349 static int blogic_cmd(struct blogic_adapter *adapter, enum blogic_opcode opcode, in blogic_cmd() argument
371 if (!adapter->irq_acquired) in blogic_cmd()
380 statusreg.all = blogic_rdstatus(adapter); in blogic_cmd()
394 adapter->adapter_cmd_complete = false; in blogic_cmd()
395 blogic_setcmdparam(adapter, opcode); in blogic_cmd()
417 intreg.all = blogic_rdint(adapter); in blogic_cmd()
418 statusreg.all = blogic_rdstatus(adapter); in blogic_cmd()
421 if (adapter->adapter_cmd_complete) in blogic_cmd()
427 blogic_setcmdparam(adapter, *param_p++); in blogic_cmd()
441 statusreg.all = blogic_rdstatus(adapter); in blogic_cmd()
449 …blogic_notice("blogic_cmd(%02X) Status = %02X: " "(Modify I/O Address)\n", adapter, opcode, status… in blogic_cmd()
475 intreg.all = blogic_rdint(adapter); in blogic_cmd()
476 statusreg.all = blogic_rdstatus(adapter); in blogic_cmd()
479 if (adapter->adapter_cmd_complete) in blogic_cmd()
483 *reply_p++ = blogic_rddatain(adapter); in blogic_cmd()
485 blogic_rddatain(adapter); in blogic_cmd()
501 blogic_intreset(adapter); in blogic_cmd()
508 adapter, opcode, statusreg.all, replylen, in blogic_cmd()
513 blogic_notice(" %02X", adapter, in blogic_cmd()
515 blogic_notice("\n", adapter); in blogic_cmd()
531 statusreg.all = blogic_rdstatus(adapter); in blogic_cmd()
539 blogic_softreset(adapter); in blogic_cmd()
563 if (!adapter->irq_acquired) in blogic_cmd()
594 static void __init blogic_init_probeinfo_isa(struct blogic_adapter *adapter) in blogic_init_probeinfo_isa() argument
667 static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter) in blogic_init_mm_probeinfo() argument
701 struct blogic_adapter *host_adapter = adapter; in blogic_init_mm_probeinfo()
934 static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter) in blogic_init_fp_probeinfo() argument
1026 static void __init blogic_init_probeinfo_list(struct blogic_adapter *adapter) in blogic_init_probeinfo_list() argument
1035 blogic_init_mm_probeinfo(adapter); in blogic_init_probeinfo_list()
1036 blogic_init_fp_probeinfo(adapter); in blogic_init_probeinfo_list()
1038 blogic_init_fp_probeinfo(adapter); in blogic_init_probeinfo_list()
1039 blogic_init_mm_probeinfo(adapter); in blogic_init_probeinfo_list()
1041 int fpcount = blogic_init_fp_probeinfo(adapter); in blogic_init_probeinfo_list()
1042 int mmcount = blogic_init_mm_probeinfo(adapter); in blogic_init_probeinfo_list()
1046 struct blogic_adapter *myadapter = adapter; in blogic_init_probeinfo_list()
1087 blogic_init_probeinfo_isa(adapter); in blogic_init_probeinfo_list()
1093 #define blogic_init_probeinfo_list(adapter) \ argument
1094 blogic_init_probeinfo_isa(adapter)
1102 static bool blogic_failure(struct blogic_adapter *adapter, char *msg) in blogic_failure() argument
1104 blogic_announce_drvr(adapter); in blogic_failure()
1105 if (adapter->adapter_bus_type == BLOGIC_PCI_BUS) { in blogic_failure()
1107 adapter); in blogic_failure()
1108 …ce %d I/O Address 0x%X PCI Address 0x%X:\n", adapter, adapter->bus, adapter->dev, adapter->io_addr… in blogic_failure()
1110 …blogic_err("While configuring BusLogic Host Adapter at " "I/O Address 0x%X:\n", adapter, adapter->… in blogic_failure()
1111 blogic_err("%s FAILED - DETACHING\n", adapter, msg); in blogic_failure()
1113 blogic_err("ADDITIONAL FAILURE INFO - %s\n", adapter, in blogic_failure()
1123 static bool __init blogic_probe(struct blogic_adapter *adapter) in blogic_probe() argument
1131 if (blogic_flashpoint_type(adapter)) { in blogic_probe()
1132 struct fpoint_info *fpinfo = &adapter->fpinfo; in blogic_probe()
1133 fpinfo->base_addr = (u32) adapter->io_addr; in blogic_probe()
1134 fpinfo->irq_ch = adapter->irq_ch; in blogic_probe()
1138 …ashPoint Host Adapter detected at " "PCI Bus %d Device %d\n", adapter, adapter->bus, adapter->dev); in blogic_probe()
1139 …: I/O Address 0x%X PCI Address 0x%X, " "but FlashPoint\n", adapter, adapter->io_addr, adapter->pci… in blogic_probe()
1140 blogic_err("BusLogic: Probe Function failed to validate it.\n", adapter); in blogic_probe()
1144 blogic_notice("BusLogic_Probe(0x%X): FlashPoint Found\n", adapter, adapter->io_addr); in blogic_probe()
1157 statusreg.all = blogic_rdstatus(adapter); in blogic_probe()
1158 intreg.all = blogic_rdint(adapter); in blogic_probe()
1159 georeg.all = blogic_rdgeom(adapter); in blogic_probe()
1161 …robe(0x%X): Status 0x%02X, Interrupt 0x%02X, " "Geometry 0x%02X\n", adapter, adapter->io_addr, sta… in blogic_probe()
1199 static bool blogic_hwreset(struct blogic_adapter *adapter, bool hard_reset) in blogic_hwreset() argument
1207 if (blogic_flashpoint_type(adapter)) { in blogic_hwreset()
1208 struct fpoint_info *fpinfo = &adapter->fpinfo; in blogic_hwreset()
1211 adapter->cardhandle = in blogic_hwreset()
1213 if (adapter->cardhandle == (void *)FPOINT_BADCARD_HANDLE) in blogic_hwreset()
1226 blogic_hardreset(adapter); in blogic_hwreset()
1228 blogic_softreset(adapter); in blogic_hwreset()
1234 statusreg.all = blogic_rdstatus(adapter); in blogic_hwreset()
1240 …sLogic_HardwareReset(0x%X): Diagnostic Active, " "Status 0x%02X\n", adapter, adapter->io_addr, sta… in blogic_hwreset()
1254 statusreg.all = blogic_rdstatus(adapter); in blogic_hwreset()
1260 …gic_HardwareReset(0x%X): Diagnostic Completed, " "Status 0x%02X\n", adapter, adapter->io_addr, sta… in blogic_hwreset()
1269 statusreg.all = blogic_rdstatus(adapter); in blogic_hwreset()
1276 …Logic_HardwareReset(0x%X): Host Adapter Ready, " "Status 0x%02X\n", adapter, adapter->io_addr, sta… in blogic_hwreset()
1287 blogic_failure(adapter, "HARD RESET DIAGNOSTICS"); in blogic_hwreset()
1288 blogic_err("HOST ADAPTER STATUS REGISTER = %02X\n", adapter, in blogic_hwreset()
1291 blogic_err("HOST ADAPTER ERROR CODE = %d\n", adapter, in blogic_hwreset()
1292 blogic_rddatain(adapter)); in blogic_hwreset()
1307 static bool __init blogic_checkadapter(struct blogic_adapter *adapter) in blogic_checkadapter() argument
1315 if (blogic_flashpoint_type(adapter)) in blogic_checkadapter()
1324 if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen, in blogic_checkadapter()
1332 blogic_notice("BusLogic_Check(0x%X): MultiMaster %s\n", adapter, in blogic_checkadapter()
1333 adapter->io_addr, in blogic_checkadapter()
1344 static bool __init blogic_rdconfig(struct blogic_adapter *adapter) in blogic_rdconfig() argument
1366 if (blogic_flashpoint_type(adapter)) { in blogic_rdconfig()
1367 struct fpoint_info *fpinfo = &adapter->fpinfo; in blogic_rdconfig()
1368 tgt = adapter->model; in blogic_rdconfig()
1375 strcpy(adapter->fw_ver, FLASHPOINT_FW_VER); in blogic_rdconfig()
1376 adapter->scsi_id = fpinfo->scsi_id; in blogic_rdconfig()
1377 adapter->ext_trans_enable = fpinfo->ext_trans_enable; in blogic_rdconfig()
1378 adapter->parity = fpinfo->parity; in blogic_rdconfig()
1379 adapter->reset_enabled = !fpinfo->softreset; in blogic_rdconfig()
1380 adapter->level_int = true; in blogic_rdconfig()
1381 adapter->wide = fpinfo->wide; in blogic_rdconfig()
1382 adapter->differential = false; in blogic_rdconfig()
1383 adapter->scam = true; in blogic_rdconfig()
1384 adapter->ultra = true; in blogic_rdconfig()
1385 adapter->ext_lun = true; in blogic_rdconfig()
1386 adapter->terminfo_valid = true; in blogic_rdconfig()
1387 adapter->low_term = fpinfo->low_term; in blogic_rdconfig()
1388 adapter->high_term = fpinfo->high_term; in blogic_rdconfig()
1389 adapter->scam_enabled = fpinfo->scam_enabled; in blogic_rdconfig()
1390 adapter->scam_lev2 = fpinfo->scam_lev2; in blogic_rdconfig()
1391 adapter->drvr_sglimit = BLOGIC_SG_LIMIT; in blogic_rdconfig()
1392 adapter->maxdev = (adapter->wide ? 16 : 8); in blogic_rdconfig()
1393 adapter->maxlun = 32; in blogic_rdconfig()
1394 adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1395 adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1396 adapter->drvr_qdepth = 255; in blogic_rdconfig()
1397 adapter->adapter_qdepth = adapter->drvr_qdepth; in blogic_rdconfig()
1398 adapter->sync_ok = fpinfo->sync_ok; in blogic_rdconfig()
1399 adapter->fast_ok = fpinfo->fast_ok; in blogic_rdconfig()
1400 adapter->ultra_ok = fpinfo->ultra_ok; in blogic_rdconfig()
1401 adapter->wide_ok = fpinfo->wide_ok; in blogic_rdconfig()
1402 adapter->discon_ok = fpinfo->discon_ok; in blogic_rdconfig()
1403 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1409 if (blogic_cmd(adapter, BLOGIC_GET_BOARD_ID, NULL, 0, &id, in blogic_rdconfig()
1411 return blogic_failure(adapter, "INQUIRE BOARD ID"); in blogic_rdconfig()
1415 if (blogic_cmd(adapter, BLOGIC_INQ_CONFIG, NULL, 0, &config, in blogic_rdconfig()
1418 return blogic_failure(adapter, "INQUIRE CONFIGURATION"); in blogic_rdconfig()
1423 if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen, in blogic_rdconfig()
1426 return blogic_failure(adapter, "INQUIRE SETUP INFORMATION"); in blogic_rdconfig()
1431 if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen, in blogic_rdconfig()
1434 return blogic_failure(adapter, in blogic_rdconfig()
1441 if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_D3, NULL, 0, in blogic_rdconfig()
1444 return blogic_failure(adapter, in blogic_rdconfig()
1462 if (blogic_cmd(adapter, BLOGIC_INQ_MODELNO, &req_replylen, in blogic_rdconfig()
1465 return blogic_failure(adapter, in blogic_rdconfig()
1488 tgt = adapter->model; in blogic_rdconfig()
1502 tgt = adapter->fw_ver; in blogic_rdconfig()
1512 if (strcmp(adapter->fw_ver, "3.3") >= 0) { in blogic_rdconfig()
1513 if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_LETTER, NULL, 0, in blogic_rdconfig()
1516 return blogic_failure(adapter, in blogic_rdconfig()
1525 adapter->scsi_id = config.id; in blogic_rdconfig()
1531 adapter->adapter_bus_type = in blogic_rdconfig()
1532 blogic_adater_bus_types[adapter->model[3] - '4']; in blogic_rdconfig()
1533 if (adapter->irq_ch == 0) { in blogic_rdconfig()
1535 adapter->irq_ch = 9; in blogic_rdconfig()
1537 adapter->irq_ch = 10; in blogic_rdconfig()
1539 adapter->irq_ch = 11; in blogic_rdconfig()
1541 adapter->irq_ch = 12; in blogic_rdconfig()
1543 adapter->irq_ch = 14; in blogic_rdconfig()
1545 adapter->irq_ch = 15; in blogic_rdconfig()
1547 if (adapter->adapter_bus_type == BLOGIC_ISA_BUS) { in blogic_rdconfig()
1549 adapter->dma_ch = 5; in blogic_rdconfig()
1551 adapter->dma_ch = 6; in blogic_rdconfig()
1553 adapter->dma_ch = 7; in blogic_rdconfig()
1559 georeg.all = blogic_rdgeom(adapter); in blogic_rdconfig()
1560 adapter->ext_trans_enable = georeg.gr.ext_trans_enable; in blogic_rdconfig()
1566 adapter->adapter_sglimit = ext_setupinfo.sg_limit; in blogic_rdconfig()
1567 adapter->drvr_sglimit = adapter->adapter_sglimit; in blogic_rdconfig()
1568 if (adapter->adapter_sglimit > BLOGIC_SG_LIMIT) in blogic_rdconfig()
1569 adapter->drvr_sglimit = BLOGIC_SG_LIMIT; in blogic_rdconfig()
1571 adapter->level_int = true; in blogic_rdconfig()
1572 adapter->wide = ext_setupinfo.wide; in blogic_rdconfig()
1573 adapter->differential = ext_setupinfo.differential; in blogic_rdconfig()
1574 adapter->scam = ext_setupinfo.scam; in blogic_rdconfig()
1575 adapter->ultra = ext_setupinfo.ultra; in blogic_rdconfig()
1580 if (adapter->fw_ver[0] == '5' || (adapter->fw_ver[0] == '4' && in blogic_rdconfig()
1581 adapter->wide)) in blogic_rdconfig()
1582 adapter->ext_lun = true; in blogic_rdconfig()
1587 if (adapter->fw_ver[0] == '5') { in blogic_rdconfig()
1588 if (blogic_cmd(adapter, BLOGIC_INQ_PCI_INFO, NULL, 0, in blogic_rdconfig()
1591 return blogic_failure(adapter, in blogic_rdconfig()
1598 adapter->terminfo_valid = true; in blogic_rdconfig()
1599 adapter->low_term = adapter_info.low_term; in blogic_rdconfig()
1600 adapter->high_term = adapter_info.high_term; in blogic_rdconfig()
1607 if (adapter->fw_ver[0] >= '4') { in blogic_rdconfig()
1610 if (blogic_cmd(adapter, BLOGIC_FETCH_LOCALRAM, &fetch_localram, in blogic_rdconfig()
1613 return blogic_failure(adapter, in blogic_rdconfig()
1619 adapter->parity = autoscsi.parity; in blogic_rdconfig()
1620 adapter->reset_enabled = autoscsi.reset_enabled; in blogic_rdconfig()
1621 if (adapter->fw_ver[0] == '4') { in blogic_rdconfig()
1622 adapter->terminfo_valid = true; in blogic_rdconfig()
1623 adapter->low_term = autoscsi.low_term; in blogic_rdconfig()
1624 adapter->high_term = autoscsi.high_term; in blogic_rdconfig()
1631 adapter->wide_ok = autoscsi.wide_ok; in blogic_rdconfig()
1632 adapter->fast_ok = autoscsi.fast_ok; in blogic_rdconfig()
1633 adapter->sync_ok = autoscsi.sync_ok; in blogic_rdconfig()
1634 adapter->discon_ok = autoscsi.discon_ok; in blogic_rdconfig()
1635 if (adapter->ultra) in blogic_rdconfig()
1636 adapter->ultra_ok = autoscsi.ultra_ok; in blogic_rdconfig()
1637 if (adapter->scam) { in blogic_rdconfig()
1638 adapter->scam_enabled = autoscsi.scam_enabled; in blogic_rdconfig()
1639 adapter->scam_lev2 = autoscsi.scam_lev2; in blogic_rdconfig()
1646 if (adapter->fw_ver[0] < '4') { in blogic_rdconfig()
1648 adapter->sync_ok = 0xFF; in blogic_rdconfig()
1649 if (adapter->adapter_bus_type == BLOGIC_EISA_BUS) { in blogic_rdconfig()
1651 adapter->fast_ok = 0xFF; in blogic_rdconfig()
1652 if (strcmp(adapter->model, "BT-757") == 0) in blogic_rdconfig()
1653 adapter->wide_ok = 0xFF; in blogic_rdconfig()
1656 adapter->discon_ok = 0xFF; in blogic_rdconfig()
1657 adapter->parity = setupinfo.parity; in blogic_rdconfig()
1658 adapter->reset_enabled = true; in blogic_rdconfig()
1664 adapter->maxdev = (adapter->wide ? 16 : 8); in blogic_rdconfig()
1665 adapter->maxlun = (adapter->ext_lun ? 32 : 8); in blogic_rdconfig()
1691 if (adapter->fw_ver[0] == '5') in blogic_rdconfig()
1692 adapter->adapter_qdepth = 192; in blogic_rdconfig()
1693 else if (adapter->fw_ver[0] == '4') in blogic_rdconfig()
1694 adapter->adapter_qdepth = (adapter->adapter_bus_type != in blogic_rdconfig()
1697 adapter->adapter_qdepth = 30; in blogic_rdconfig()
1698 if (strcmp(adapter->fw_ver, "3.31") >= 0) { in blogic_rdconfig()
1699 adapter->strict_rr = true; in blogic_rdconfig()
1700 adapter->mbox_count = BLOGIC_MAX_MAILBOX; in blogic_rdconfig()
1702 adapter->strict_rr = false; in blogic_rdconfig()
1703 adapter->mbox_count = 32; in blogic_rdconfig()
1705 adapter->drvr_qdepth = adapter->mbox_count; in blogic_rdconfig()
1706 adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1707 adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE; in blogic_rdconfig()
1715 adapter->tagq_ok = 0; in blogic_rdconfig()
1716 switch (adapter->fw_ver[0]) { in blogic_rdconfig()
1718 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1721 if (strcmp(adapter->fw_ver, "4.22") >= 0) in blogic_rdconfig()
1722 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1725 if (strcmp(adapter->fw_ver, "3.35") >= 0) in blogic_rdconfig()
1726 adapter->tagq_ok = 0xFFFF; in blogic_rdconfig()
1734 adapter->bios_addr = ext_setupinfo.bios_addr << 12; in blogic_rdconfig()
1739 if (adapter->adapter_bus_type == BLOGIC_ISA_BUS && in blogic_rdconfig()
1741 adapter->need_bouncebuf = true; in blogic_rdconfig()
1751 if (adapter->bios_addr > 0 && strcmp(adapter->model, "BT-445S") == 0 && in blogic_rdconfig()
1752 strcmp(adapter->fw_ver, "3.37") < 0 && in blogic_rdconfig()
1754 adapter->need_bouncebuf = true; in blogic_rdconfig()
1763 strcpy(adapter->full_model, "BusLogic "); in blogic_rdconfig()
1764 strcat(adapter->full_model, adapter->model); in blogic_rdconfig()
1774 if (adapter->drvr_opts != NULL && in blogic_rdconfig()
1775 adapter->drvr_opts->qdepth[tgt_id] > 0) in blogic_rdconfig()
1776 qdepth = adapter->drvr_opts->qdepth[tgt_id]; in blogic_rdconfig()
1777 else if (adapter->need_bouncebuf) in blogic_rdconfig()
1779 adapter->qdepth[tgt_id] = qdepth; in blogic_rdconfig()
1781 if (adapter->need_bouncebuf) in blogic_rdconfig()
1782 adapter->untag_qdepth = BLOGIC_UNTAG_DEPTH_BB; in blogic_rdconfig()
1784 adapter->untag_qdepth = BLOGIC_UNTAG_DEPTH; in blogic_rdconfig()
1785 if (adapter->drvr_opts != NULL) in blogic_rdconfig()
1786 adapter->common_qdepth = adapter->drvr_opts->common_qdepth; in blogic_rdconfig()
1787 if (adapter->common_qdepth > 0 && in blogic_rdconfig()
1788 adapter->common_qdepth < adapter->untag_qdepth) in blogic_rdconfig()
1789 adapter->untag_qdepth = adapter->common_qdepth; in blogic_rdconfig()
1795 adapter->tagq_ok &= adapter->discon_ok; in blogic_rdconfig()
1800 if (adapter->drvr_opts != NULL) in blogic_rdconfig()
1801 adapter->tagq_ok = (adapter->drvr_opts->tagq_ok & in blogic_rdconfig()
1802 adapter->drvr_opts->tagq_ok_mask) | in blogic_rdconfig()
1803 (adapter->tagq_ok & ~adapter->drvr_opts->tagq_ok_mask); in blogic_rdconfig()
1810 if (adapter->drvr_opts != NULL && in blogic_rdconfig()
1811 adapter->drvr_opts->bus_settle_time > 0) in blogic_rdconfig()
1812 adapter->bus_settle_time = adapter->drvr_opts->bus_settle_time; in blogic_rdconfig()
1814 adapter->bus_settle_time = BLOGIC_BUS_SETTLE_TIME; in blogic_rdconfig()
1827 static bool __init blogic_reportconfig(struct blogic_adapter *adapter) in blogic_reportconfig() argument
1829 unsigned short alltgt_mask = (1 << adapter->maxdev) - 1; in blogic_reportconfig()
1844adapter, adapter->model, blogic_adapter_busnames[adapter->adapter_bus_type], (adapter->wide ? " Wi… in blogic_reportconfig()
1845 … Address: 0x%X, " "IRQ Channel: %d/%s\n", adapter, adapter->fw_ver, adapter->io_addr, adapter->irq… in blogic_reportconfig()
1846 if (adapter->adapter_bus_type != BLOGIC_PCI_BUS) { in blogic_reportconfig()
1847 blogic_info(" DMA Channel: ", adapter); in blogic_reportconfig()
1848 if (adapter->dma_ch > 0) in blogic_reportconfig()
1849 blogic_info("%d, ", adapter, adapter->dma_ch); in blogic_reportconfig()
1851 blogic_info("None, ", adapter); in blogic_reportconfig()
1852 if (adapter->bios_addr > 0) in blogic_reportconfig()
1853 blogic_info("BIOS Address: 0x%X, ", adapter, in blogic_reportconfig()
1854 adapter->bios_addr); in blogic_reportconfig()
1856 blogic_info("BIOS Address: None, ", adapter); in blogic_reportconfig()
1858 blogic_info(" PCI Bus: %d, Device: %d, Address: ", adapter, in blogic_reportconfig()
1859 adapter->bus, adapter->dev); in blogic_reportconfig()
1860 if (adapter->pci_addr > 0) in blogic_reportconfig()
1861 blogic_info("0x%X, ", adapter, adapter->pci_addr); in blogic_reportconfig()
1863 blogic_info("Unassigned, ", adapter); in blogic_reportconfig()
1865 blogic_info("Host Adapter SCSI ID: %d\n", adapter, adapter->scsi_id); in blogic_reportconfig()
1867 adapter, (adapter->parity ? "Enabled" : "Disabled"), in blogic_reportconfig()
1868 (adapter->ext_trans_enable ? "Enabled" : "Disabled")); in blogic_reportconfig()
1869 alltgt_mask &= ~(1 << adapter->scsi_id); in blogic_reportconfig()
1870 sync_ok = adapter->sync_ok & alltgt_mask; in blogic_reportconfig()
1871 fast_ok = adapter->fast_ok & alltgt_mask; in blogic_reportconfig()
1872 ultra_ok = adapter->ultra_ok & alltgt_mask; in blogic_reportconfig()
1873 if ((blogic_multimaster_type(adapter) && in blogic_reportconfig()
1874 (adapter->fw_ver[0] >= '4' || in blogic_reportconfig()
1875 adapter->adapter_bus_type == BLOGIC_EISA_BUS)) || in blogic_reportconfig()
1876 blogic_flashpoint_type(adapter)) { in blogic_reportconfig()
1896 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1898 syncstr[adapter->scsi_id] = '#'; in blogic_reportconfig()
1899 syncstr[adapter->maxdev] = '\0'; in blogic_reportconfig()
1903 wide_ok = adapter->wide_ok & alltgt_mask; in blogic_reportconfig()
1909 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1911 widestr[adapter->scsi_id] = '#'; in blogic_reportconfig()
1912 widestr[adapter->maxdev] = '\0'; in blogic_reportconfig()
1914 discon_ok = adapter->discon_ok & alltgt_mask; in blogic_reportconfig()
1920 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1922 discon_str[adapter->scsi_id] = '#'; in blogic_reportconfig()
1923 discon_str[adapter->maxdev] = '\0'; in blogic_reportconfig()
1925 tagq_ok = adapter->tagq_ok & alltgt_mask; in blogic_reportconfig()
1931 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1933 tagq_str[adapter->scsi_id] = '#'; in blogic_reportconfig()
1934 tagq_str[adapter->maxdev] = '\0'; in blogic_reportconfig()
1937 adapter, syncmsg, widemsg); in blogic_reportconfig()
1938 blogic_info(" Disconnect/Reconnect: %s, Tagged Queuing: %s\n", adapter, in blogic_reportconfig()
1940 if (blogic_multimaster_type(adapter)) { in blogic_reportconfig()
1941 …it: %d of %d segments, " "Mailboxes: %d\n", adapter, adapter->drvr_sglimit, adapter->adapter_sglim… in blogic_reportconfig()
1942 …ver Queue Depth: %d, " "Host Adapter Queue Depth: %d\n", adapter, adapter->drvr_qdepth, adapter->a… in blogic_reportconfig()
1944 …ueue Depth: %d, " "Scatter/Gather Limit: %d segments\n", adapter, adapter->drvr_qdepth, adapter->d… in blogic_reportconfig()
1945 blogic_info(" Tagged Queue Depth: ", adapter); in blogic_reportconfig()
1947 for (tgt_id = 1; tgt_id < adapter->maxdev; tgt_id++) in blogic_reportconfig()
1948 if (adapter->qdepth[tgt_id] != adapter->qdepth[0]) { in blogic_reportconfig()
1953 if (adapter->qdepth[0] > 0) in blogic_reportconfig()
1954 blogic_info("%d", adapter, adapter->qdepth[0]); in blogic_reportconfig()
1956 blogic_info("Automatic", adapter); in blogic_reportconfig()
1958 blogic_info("Individual", adapter); in blogic_reportconfig()
1959 blogic_info(", Untagged Queue Depth: %d\n", adapter, in blogic_reportconfig()
1960 adapter->untag_qdepth); in blogic_reportconfig()
1961 if (adapter->terminfo_valid) { in blogic_reportconfig()
1962 if (adapter->wide) in blogic_reportconfig()
1963 blogic_info(" SCSI Bus Termination: %s", adapter, in blogic_reportconfig()
1964 …(adapter->low_term ? (adapter->high_term ? "Both Enabled" : "Low Enabled") : (adapter->high_term ?… in blogic_reportconfig()
1966 blogic_info(" SCSI Bus Termination: %s", adapter, in blogic_reportconfig()
1967 (adapter->low_term ? "Enabled" : "Disabled")); in blogic_reportconfig()
1968 if (adapter->scam) in blogic_reportconfig()
1969 blogic_info(", SCAM: %s", adapter, in blogic_reportconfig()
1970 …(adapter->scam_enabled ? (adapter->scam_lev2 ? "Enabled, Level 2" : "Enabled, Level 1") : "Disable… in blogic_reportconfig()
1971 blogic_info("\n", adapter); in blogic_reportconfig()
1986 static bool __init blogic_getres(struct blogic_adapter *adapter) in blogic_getres() argument
1988 if (adapter->irq_ch == 0) { in blogic_getres()
1990 adapter); in blogic_getres()
1996 if (request_irq(adapter->irq_ch, blogic_inthandler, IRQF_SHARED, in blogic_getres()
1997 adapter->full_model, adapter) < 0) { in blogic_getres()
1999 adapter, adapter->irq_ch); in blogic_getres()
2002 adapter->irq_acquired = true; in blogic_getres()
2006 if (adapter->dma_ch > 0) { in blogic_getres()
2007 if (request_dma(adapter->dma_ch, adapter->full_model) < 0) { in blogic_getres()
2008 blogic_err("UNABLE TO ACQUIRE DMA CHANNEL %d - DETACHING\n", adapter, adapter->dma_ch); in blogic_getres()
2011 set_dma_mode(adapter->dma_ch, DMA_MODE_CASCADE); in blogic_getres()
2012 enable_dma(adapter->dma_ch); in blogic_getres()
2013 adapter->dma_chan_acquired = true; in blogic_getres()
2027 static void blogic_relres(struct blogic_adapter *adapter) in blogic_relres() argument
2032 if (adapter->irq_acquired) in blogic_relres()
2033 free_irq(adapter->irq_ch, adapter); in blogic_relres()
2037 if (adapter->dma_chan_acquired) in blogic_relres()
2038 free_dma(adapter->dma_ch); in blogic_relres()
2042 if (adapter->mbox_space) in blogic_relres()
2043 pci_free_consistent(adapter->pci_device, adapter->mbox_sz, in blogic_relres()
2044 adapter->mbox_space, adapter->mbox_space_handle); in blogic_relres()
2045 pci_dev_put(adapter->pci_device); in blogic_relres()
2046 adapter->mbox_space = NULL; in blogic_relres()
2047 adapter->mbox_space_handle = 0; in blogic_relres()
2048 adapter->mbox_sz = 0; in blogic_relres()
2058 static bool blogic_initadapter(struct blogic_adapter *adapter) in blogic_initadapter() argument
2069 adapter->firstccb = NULL; in blogic_initadapter()
2070 adapter->lastccb = NULL; in blogic_initadapter()
2077 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) { in blogic_initadapter()
2078 adapter->bdr_pend[tgt_id] = NULL; in blogic_initadapter()
2079 adapter->tgt_flags[tgt_id].tagq_active = false; in blogic_initadapter()
2080 adapter->tgt_flags[tgt_id].cmd_good = false; in blogic_initadapter()
2081 adapter->active_cmds[tgt_id] = 0; in blogic_initadapter()
2082 adapter->cmds_since_rst[tgt_id] = 0; in blogic_initadapter()
2088 if (blogic_flashpoint_type(adapter)) in blogic_initadapter()
2094adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbo… in blogic_initadapter()
2095 adapter->mbox_space = pci_alloc_consistent(adapter->pci_device, in blogic_initadapter()
2096 adapter->mbox_sz, &adapter->mbox_space_handle); in blogic_initadapter()
2097 if (adapter->mbox_space == NULL) in blogic_initadapter()
2098 return blogic_failure(adapter, "MAILBOX ALLOCATION"); in blogic_initadapter()
2099 adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space; in blogic_initadapter()
2100 adapter->last_outbox = adapter->first_outbox + adapter->mbox_count - 1; in blogic_initadapter()
2101 adapter->next_outbox = adapter->first_outbox; in blogic_initadapter()
2102 adapter->first_inbox = (struct blogic_inbox *) (adapter->last_outbox + 1); in blogic_initadapter()
2103 adapter->last_inbox = adapter->first_inbox + adapter->mbox_count - 1; in blogic_initadapter()
2104 adapter->next_inbox = adapter->first_inbox; in blogic_initadapter()
2109 memset(adapter->first_outbox, 0, in blogic_initadapter()
2110 adapter->mbox_count * sizeof(struct blogic_outbox)); in blogic_initadapter()
2111 memset(adapter->first_inbox, 0, in blogic_initadapter()
2112 adapter->mbox_count * sizeof(struct blogic_inbox)); in blogic_initadapter()
2118 extmbox_req.mbox_count = adapter->mbox_count; in blogic_initadapter()
2119 extmbox_req.base_mbox_addr = (u32) adapter->mbox_space_handle; in blogic_initadapter()
2120 if (blogic_cmd(adapter, BLOGIC_INIT_EXT_MBOX, &extmbox_req, in blogic_initadapter()
2122 return blogic_failure(adapter, "MAILBOX INITIALIZATION"); in blogic_initadapter()
2131 if (adapter->strict_rr) { in blogic_initadapter()
2133 if (blogic_cmd(adapter, BLOGIC_STRICT_RR, &rr_req, in blogic_initadapter()
2135 return blogic_failure(adapter, in blogic_initadapter()
2143 if (adapter->ext_lun) { in blogic_initadapter()
2145 if (blogic_cmd(adapter, BLOGIC_SETCCB_FMT, &setccb_fmt, in blogic_initadapter()
2147 return blogic_failure(adapter, "SET CCB FORMAT"); in blogic_initadapter()
2154 if (!adapter->adapter_initd) { in blogic_initadapter()
2155 blogic_info("*** %s Initialized Successfully ***\n", adapter, in blogic_initadapter()
2156 adapter->full_model); in blogic_initadapter()
2157 blogic_info("\n", adapter); in blogic_initadapter()
2159 blogic_warn("*** %s Initialized Successfully ***\n", adapter, in blogic_initadapter()
2160 adapter->full_model); in blogic_initadapter()
2161 adapter->adapter_initd = true; in blogic_initadapter()
2175 static bool __init blogic_inquiry(struct blogic_adapter *adapter) in blogic_inquiry() argument
2190 blogic_delay(adapter->bus_settle_time); in blogic_inquiry()
2194 if (blogic_flashpoint_type(adapter)) in blogic_inquiry()
2199 if (adapter->drvr_opts != NULL && adapter->drvr_opts->stop_tgt_inquiry) in blogic_inquiry()
2211 if (strcmp(adapter->fw_ver, "4.25") >= 0) { in blogic_inquiry()
2221 if (blogic_cmd(adapter, BLOGIC_INQ_DEV, NULL, 0, in blogic_inquiry()
2224 return blogic_failure(adapter, "INQUIRE TARGET DEVICES"); in blogic_inquiry()
2225 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2226 adapter->tgt_flags[tgt_id].tgt_exists = in blogic_inquiry()
2237 if (blogic_cmd(adapter, BLOGIC_INQ_DEV0TO7, NULL, 0, in blogic_inquiry()
2240 return blogic_failure(adapter, in blogic_inquiry()
2243 adapter->tgt_flags[tgt_id].tgt_exists = in blogic_inquiry()
2250 if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen, in blogic_inquiry()
2253 return blogic_failure(adapter, "INQUIRE SETUP INFORMATION"); in blogic_inquiry()
2254 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2255adapter->sync_offset[tgt_id] = (tgt_id < 8 ? setupinfo.sync0to7[tgt_id].offset : setupinfo.sync8to… in blogic_inquiry()
2256 if (strcmp(adapter->fw_ver, "5.06L") >= 0) in blogic_inquiry()
2257 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2258adapter->tgt_flags[tgt_id].wide_active = (tgt_id < 8 ? (setupinfo.wide_tx_active0to7 & (1 << tgt_i… in blogic_inquiry()
2262 if (adapter->fw_ver[0] >= '3') { in blogic_inquiry()
2270 if (blogic_cmd(adapter, BLOGIC_INQ_SYNC_PERIOD, &req_replylen, in blogic_inquiry()
2273 return blogic_failure(adapter, in blogic_inquiry()
2275 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2276 adapter->sync_period[tgt_id] = sync_period[tgt_id]; in blogic_inquiry()
2278 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_inquiry()
2280 adapter->sync_period[tgt_id] = 20 + 5 * setupinfo.sync0to7[tgt_id].tx_period; in blogic_inquiry()
2296 static void __init blogic_inithoststruct(struct blogic_adapter *adapter, in blogic_inithoststruct() argument
2299 host->max_id = adapter->maxdev; in blogic_inithoststruct()
2300 host->max_lun = adapter->maxlun; in blogic_inithoststruct()
2302 host->unique_id = adapter->io_addr; in blogic_inithoststruct()
2303 host->this_id = adapter->scsi_id; in blogic_inithoststruct()
2304 host->can_queue = adapter->drvr_qdepth; in blogic_inithoststruct()
2305 host->sg_tablesize = adapter->drvr_sglimit; in blogic_inithoststruct()
2306 host->unchecked_isa_dma = adapter->need_bouncebuf; in blogic_inithoststruct()
2307 host->cmd_per_lun = adapter->untag_qdepth; in blogic_inithoststruct()
2320 struct blogic_adapter *adapter = in blogic_slaveconfig() local
2323 int qdepth = adapter->qdepth[tgt_id]; in blogic_slaveconfig()
2325 if (adapter->tgt_flags[tgt_id].tagq_ok && in blogic_slaveconfig()
2326 (adapter->tagq_ok & (1 << tgt_id))) { in blogic_slaveconfig()
2329 adapter->qdepth[tgt_id] = qdepth; in blogic_slaveconfig()
2332 adapter->tagq_ok &= ~(1 << tgt_id); in blogic_slaveconfig()
2333 qdepth = adapter->untag_qdepth; in blogic_slaveconfig()
2334 adapter->qdepth[tgt_id] = qdepth; in blogic_slaveconfig()
2338 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) in blogic_slaveconfig()
2339 if (adapter->tgt_flags[tgt_id].tgt_exists) in blogic_slaveconfig()
2340 qdepth += adapter->qdepth[tgt_id]; in blogic_slaveconfig()
2341 if (qdepth > adapter->alloc_ccbs) in blogic_slaveconfig()
2342 blogic_create_addlccbs(adapter, qdepth - adapter->alloc_ccbs, in blogic_slaveconfig()
2358 struct blogic_adapter *adapter; in blogic_init() local
2377 adapter = kzalloc(sizeof(struct blogic_adapter), GFP_KERNEL); in blogic_init()
2378 if (adapter == NULL) { in blogic_init()
2388 blogic_init_probeinfo_list(adapter); in blogic_init()
2392 struct blogic_adapter *myadapter = adapter; in blogic_init()
2465 memcpy(myadapter, adapter, sizeof(struct blogic_adapter)); in blogic_init()
2550 kfree(adapter); in blogic_init()
2563 static int __exit blogic_deladapter(struct blogic_adapter *adapter) in blogic_deladapter() argument
2565 struct Scsi_Host *host = adapter->scsi_host; in blogic_deladapter()
2573 if (blogic_flashpoint_type(adapter)) in blogic_deladapter()
2574 FlashPoint_ReleaseHostAdapter(adapter->cardhandle); in blogic_deladapter()
2579 blogic_destroy_ccbs(adapter); in blogic_deladapter()
2580 blogic_relres(adapter); in blogic_deladapter()
2584 release_region(adapter->io_addr, adapter->addr_count); in blogic_deladapter()
2589 list_del(&adapter->host_list); in blogic_deladapter()
2602 struct blogic_adapter *adapter = ccb->adapter; in blogic_qcompleted_ccb() local
2606 if (adapter->firstccb == NULL) { in blogic_qcompleted_ccb()
2607 adapter->firstccb = ccb; in blogic_qcompleted_ccb()
2608 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2610 adapter->lastccb->next = ccb; in blogic_qcompleted_ccb()
2611 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2613 adapter->active_cmds[ccb->tgt_id]--; in blogic_qcompleted_ccb()
2622 static int blogic_resultcode(struct blogic_adapter *adapter, in blogic_resultcode() argument
2641 adapter, adapter_status); in blogic_resultcode()
2665 blogic_warn("Unknown Host Adapter Status 0x%02X\n", adapter, in blogic_resultcode()
2679 static void blogic_scan_inbox(struct blogic_adapter *adapter) in blogic_scan_inbox() argument
2694 struct blogic_inbox *next_inbox = adapter->next_inbox; in blogic_scan_inbox()
2724 …blogic_warn("Illegal CCB #%ld status %d in " "Incoming Mailbox\n", adapter, ccb->serial, ccb->stat… in blogic_scan_inbox()
2728 if (++next_inbox > adapter->last_inbox) in blogic_scan_inbox()
2729 next_inbox = adapter->first_inbox; in blogic_scan_inbox()
2731 adapter->next_inbox = next_inbox; in blogic_scan_inbox()
2742 static void blogic_process_ccbs(struct blogic_adapter *adapter) in blogic_process_ccbs() argument
2744 if (adapter->processing_ccbs) in blogic_process_ccbs()
2746 adapter->processing_ccbs = true; in blogic_process_ccbs()
2747 while (adapter->firstccb != NULL) { in blogic_process_ccbs()
2748 struct blogic_ccb *ccb = adapter->firstccb; in blogic_process_ccbs()
2750 adapter->firstccb = ccb->next; in blogic_process_ccbs()
2751 if (adapter->firstccb == NULL) in blogic_process_ccbs()
2752 adapter->lastccb = NULL; in blogic_process_ccbs()
2759 …blogic_warn("Bus Device Reset CCB #%ld to Target " "%d Completed\n", adapter, ccb->serial, tgt_id); in blogic_process_ccbs()
2760 blogic_inc_count(&adapter->tgt_stats[tgt_id].bdr_done); in blogic_process_ccbs()
2761 adapter->tgt_flags[tgt_id].tagq_active = false; in blogic_process_ccbs()
2762 adapter->cmds_since_rst[tgt_id] = 0; in blogic_process_ccbs()
2763 adapter->last_resetdone[tgt_id] = jiffies; in blogic_process_ccbs()
2791 for (ccb = adapter->all_ccbs; ccb != NULL; in blogic_process_ccbs()
2797 adapter->active_cmds[tgt_id]--; in blogic_process_ccbs()
2801 adapter->bdr_pend[tgt_id] = NULL; in blogic_process_ccbs()
2812 blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2815 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2817 adapter->tgt_flags[ccb->tgt_id] in blogic_process_ccbs()
2823 adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2824 blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done); in blogic_process_ccbs()
2828 command->result = blogic_resultcode(adapter, in blogic_process_ccbs()
2831 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2836 …"Adapter Status %02X " "Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result,… in blogic_process_ccbs()
2837 blogic_notice("CDB ", adapter); in blogic_process_ccbs()
2839 blogic_notice(" %02X", adapter, ccb->cdb[i]); in blogic_process_ccbs()
2840 blogic_notice("\n", adapter); in blogic_process_ccbs()
2841 blogic_notice("Sense ", adapter); in blogic_process_ccbs()
2843 blogic_notice(" %02X", adapter, command->sense_buffer[i]); in blogic_process_ccbs()
2844 blogic_notice("\n", adapter); in blogic_process_ccbs()
2857 &adapter->tgt_flags[ccb->tgt_id]; in blogic_process_ccbs()
2874 adapter->processing_ccbs = false; in blogic_process_ccbs()
2885 struct blogic_adapter *adapter = (struct blogic_adapter *) devid; in blogic_inthandler() local
2890 spin_lock_irqsave(adapter->scsi_host->host_lock, processor_flag); in blogic_inthandler()
2894 if (blogic_multimaster_type(adapter)) { in blogic_inthandler()
2899 intreg.all = blogic_rdint(adapter); in blogic_inthandler()
2905 blogic_intreset(adapter); in blogic_inthandler()
2913 adapter->adapter_extreset = true; in blogic_inthandler()
2915 blogic_scan_inbox(adapter); in blogic_inthandler()
2917 adapter->adapter_cmd_complete = true; in blogic_inthandler()
2923 if (FlashPoint_InterruptPending(adapter->cardhandle)) in blogic_inthandler()
2924 switch (FlashPoint_HandleInterrupt(adapter->cardhandle)) { in blogic_inthandler()
2928 adapter->adapter_extreset = true; in blogic_inthandler()
2931 blogic_warn("Internal FlashPoint Error detected - Resetting Host Adapter\n", adapter); in blogic_inthandler()
2932 adapter->adapter_intern_err = true; in blogic_inthandler()
2939 if (adapter->firstccb != NULL) in blogic_inthandler()
2940 blogic_process_ccbs(adapter); in blogic_inthandler()
2944 if (adapter->adapter_extreset) { in blogic_inthandler()
2945 blogic_warn("Resetting %s due to External SCSI Bus Reset\n", adapter, adapter->full_model); in blogic_inthandler()
2946 blogic_inc_count(&adapter->ext_resets); in blogic_inthandler()
2947 blogic_resetadapter(adapter, false); in blogic_inthandler()
2948 adapter->adapter_extreset = false; in blogic_inthandler()
2949 } else if (adapter->adapter_intern_err) { in blogic_inthandler()
2950 blogic_warn("Resetting %s due to Host Adapter Internal Error\n", adapter, adapter->full_model); in blogic_inthandler()
2951 blogic_inc_count(&adapter->adapter_intern_errors); in blogic_inthandler()
2952 blogic_resetadapter(adapter, true); in blogic_inthandler()
2953 adapter->adapter_intern_err = false; in blogic_inthandler()
2958 spin_unlock_irqrestore(adapter->scsi_host->host_lock, processor_flag); in blogic_inthandler()
2969 static bool blogic_write_outbox(struct blogic_adapter *adapter, in blogic_write_outbox() argument
2974 next_outbox = adapter->next_outbox; in blogic_write_outbox()
2985 blogic_execmbox(adapter); in blogic_write_outbox()
2986 if (++next_outbox > adapter->last_outbox) in blogic_write_outbox()
2987 next_outbox = adapter->first_outbox; in blogic_write_outbox()
2988 adapter->next_outbox = next_outbox; in blogic_write_outbox()
2990 adapter->active_cmds[ccb->tgt_id]++; in blogic_write_outbox()
2992 adapter->tgt_stats[ccb->tgt_id].cmds_tried++; in blogic_write_outbox()
3003 struct blogic_adapter *adapter = in blogic_hostreset() local
3007 struct blogic_tgt_stats *stats = &adapter->tgt_stats[id]; in blogic_hostreset()
3014 rc = blogic_resetadapter(adapter, false); in blogic_hostreset()
3027 struct blogic_adapter *adapter = in blogic_qcmd_lck() local
3030 &adapter->tgt_flags[command->device->id]; in blogic_qcmd_lck()
3031 struct blogic_tgt_stats *tgt_stats = adapter->tgt_stats; in blogic_qcmd_lck()
3059 ccb = blogic_alloc_ccb(adapter); in blogic_qcmd_lck()
3061 spin_unlock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
3063 spin_lock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
3064 ccb = blogic_alloc_ccb(adapter); in blogic_qcmd_lck()
3083 if (blogic_multimaster_type(adapter)) in blogic_qcmd_lck()
3142 if (adapter->cmds_since_rst[tgt_id]++ >= BLOGIC_MAX_TAG_DEPTH && in blogic_qcmd_lck()
3144 adapter->active_cmds[tgt_id] == 0 in blogic_qcmd_lck()
3146 (adapter->tagq_ok & (1 << tgt_id))) { in blogic_qcmd_lck()
3149 adapter, tgt_id); in blogic_qcmd_lck()
3168 if (adapter->active_cmds[tgt_id] == 0) in blogic_qcmd_lck()
3169 adapter->last_seqpoint[tgt_id] = jiffies; in blogic_qcmd_lck()
3171 adapter->last_seqpoint[tgt_id] + 4 * HZ)) { in blogic_qcmd_lck()
3172 adapter->last_seqpoint[tgt_id] = jiffies; in blogic_qcmd_lck()
3175 if (adapter->ext_lun) { in blogic_qcmd_lck()
3186 sense_buf = pci_map_single(adapter->pci_device, in blogic_qcmd_lck()
3189 if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) { in blogic_qcmd_lck()
3191 adapter); in blogic_qcmd_lck()
3197 if (blogic_multimaster_type(adapter)) { in blogic_qcmd_lck()
3208 if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) { in blogic_qcmd_lck()
3209 spin_unlock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
3210 blogic_warn("Unable to write Outgoing Mailbox - " "Pausing for 1 second\n", adapter); in blogic_qcmd_lck()
3212 spin_lock_irq(adapter->scsi_host->host_lock); in blogic_qcmd_lck()
3213 if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, in blogic_qcmd_lck()
3215 blogic_warn("Still unable to write Outgoing Mailbox - " "Host Adapter Dead?\n", adapter); in blogic_qcmd_lck()
3227 adapter->active_cmds[tgt_id]++; in blogic_qcmd_lck()
3229 FlashPoint_StartCCB(adapter->cardhandle, ccb); in blogic_qcmd_lck()
3236 blogic_process_ccbs(adapter); in blogic_qcmd_lck()
3250 struct blogic_adapter *adapter = in DEF_SCSI_QCMD()
3255 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_request); in DEF_SCSI_QCMD()
3261 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all) in DEF_SCSI_QCMD()
3265 blogic_warn("Unable to Abort Command to Target %d - No CCB Found\n", adapter, tgt_id); in DEF_SCSI_QCMD()
3268 blogic_warn("Unable to Abort Command to Target %d - CCB Completed\n", adapter, tgt_id); in DEF_SCSI_QCMD()
3271 blogic_warn("Unable to Abort Command to Target %d - CCB Reset\n", adapter, tgt_id); in DEF_SCSI_QCMD()
3274 if (blogic_multimaster_type(adapter)) { in DEF_SCSI_QCMD()
3287 if (adapter->tgt_flags[tgt_id].tagq_active && in DEF_SCSI_QCMD()
3288 adapter->fw_ver[0] < '5') { in DEF_SCSI_QCMD()
3289 …blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->ser… in DEF_SCSI_QCMD()
3291 } else if (blogic_write_outbox(adapter, BLOGIC_MBOX_ABORT, in DEF_SCSI_QCMD()
3294 adapter, ccb->serial, tgt_id); in DEF_SCSI_QCMD()
3295 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried); in DEF_SCSI_QCMD()
3298 …blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->seria… in DEF_SCSI_QCMD()
3306 blogic_warn("Aborting CCB #%ld to Target %d\n", adapter, in DEF_SCSI_QCMD()
3308 blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried); in DEF_SCSI_QCMD()
3309 FlashPoint_AbortCCB(adapter->cardhandle, ccb); in DEF_SCSI_QCMD()
3316 blogic_process_ccbs(adapter); in DEF_SCSI_QCMD()
3328 static int blogic_resetadapter(struct blogic_adapter *adapter, bool hard_reset)
3337 if (!(blogic_hwreset(adapter, hard_reset) &&
3338 blogic_initadapter(adapter))) {
3339 blogic_err("Resetting %s Failed\n", adapter,
3340 adapter->full_model);
3348 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
3359 spin_unlock_irq(adapter->scsi_host->host_lock);
3360 blogic_delay(adapter->bus_settle_time);
3361 spin_lock_irq(adapter->scsi_host->host_lock);
3364 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
3365 adapter->last_resettried[tgt_id] = jiffies;
3366 adapter->last_resetdone[tgt_id] = jiffies;
3391 struct blogic_adapter *adapter = in blogic_diskparam() local
3396 if (adapter->ext_trans_enable && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */) { in blogic_diskparam()
3448 …blogic_warn("Adopting Geometry %d/%d from Partition Table\n", adapter, diskparam->heads, diskparam… in blogic_diskparam()
3450 …blogic_warn("Warning: Partition Table appears to " "have Geometry %d/%d which is\n", adapter, part… in blogic_diskparam()
3451 …blogic_warn("not compatible with current BusLogic " "Host Adapter Geometry %d/%d\n", adapter, disk… in blogic_diskparam()
3466 struct blogic_adapter *adapter = in blogic_write_info() local
3470 tgt_stats = adapter->tgt_stats; in blogic_write_info()
3471 adapter->ext_resets = 0; in blogic_write_info()
3472 adapter->adapter_intern_errors = 0; in blogic_write_info()
3479 struct blogic_adapter *adapter = (struct blogic_adapter *) shost->hostdata; in blogic_show_info() local
3483 tgt_stats = adapter->tgt_stats; in blogic_show_info()
3484 seq_write(m, adapter->msgbuf, adapter->msgbuflen); in blogic_show_info()
3487 Currently Allocated CCBs: %d\n", adapter->drvr_qdepth, adapter->alloc_ccbs); in blogic_show_info()
3493 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3494 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3497 …s", tgt, (tgt_flags->tagq_ok ? (tgt_flags->tagq_active ? " Active" : (adapter->tagq_ok & (1 << … in blogic_show_info()
3501 …" %3d %3u %9u %9u\n", adapter->qdepth[tgt], adapter->active_cmds[tgt], tgt_stats[tgt]… in blogic_show_info()
3506 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3507 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3523 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3524 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3539 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3540 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3559 for (tgt = 0; tgt < adapter->maxdev; tgt++) { in blogic_show_info()
3560 struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; in blogic_show_info()
3566 seq_printf(m, "\nExternal Host Adapter Resets: %d\n", adapter->ext_resets); in blogic_show_info()
3567 seq_printf(m, "Host Adapter Internal Errors: %d\n", adapter->adapter_intern_errors); in blogic_show_info()
3577 struct blogic_adapter *adapter, ...) in blogic_msg() argument
3584 va_start(args, adapter); in blogic_msg()
3589 strcpy(&adapter->msgbuf[adapter->msgbuflen], buf); in blogic_msg()
3590 adapter->msgbuflen += len; in blogic_msg()
3594 strcpy(&adapter->msgbuf[adapter->msgbuflen], buf); in blogic_msg()
3595 adapter->msgbuflen += len; in blogic_msg()
3598 printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf); in blogic_msg()
3603 if (adapter != NULL && adapter->adapter_initd) in blogic_msg()
3604 printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf); in blogic_msg()