Lines Matching +full:4 +full:- +full:pole

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters
5 * Copyright (c) 1995-2000 Advanced System Products, Inc.
6 * Copyright (c) 2000-2001 ConnectCom Solutions, Inc.
34 #include <linux/dma-mapping.h>
109 #define ASC_CHIP_LATEST_VER_EISA ((ASC_CHIP_MIN_VER_EISA - 1) + 3)
125 * Narrow boards only support 12-byte commands, while wide boards
126 * extend to 16-byte commands.
194 #define ASC_SCSIQ_CPY_BEG 4
200 #define ASC_SCSIQ_B_CNTL 4
223 #define ASC_SGQ_B_SG_CNTL 4
228 #define ASC_DEF_SCSI1_QNG 4
229 #define ASC_MAX_SCSI1_QNG 4
391 #define ASC_IERR_BIST_PRE_TEST 0x0800 /* BIST pre-test error */
412 * is Ultra-capable or not. These tables let us convert from one to the other.
468 #define ASC_DEF_ISA_DMA_SPEED 4
565 * aren't portable between big and little-endian platforms so they are not used.
568 #define ASC_EEP_GET_CHIP_ID(cfg) ((cfg)->id_speed & 0x0f)
569 #define ASC_EEP_GET_DMA_SPD(cfg) (((cfg)->id_speed & 0xf0) >> 4)
571 ((cfg)->id_speed = ((cfg)->id_speed & 0xf0) | ((sid) & ASC_MAX_TID))
573 ((cfg)->id_speed = ((cfg)->id_speed & 0x0f) | ((spd) & 0x0f) << 4)
587 uchar id_speed; /* low order 4 bits is chip scsi id */
588 /* high order 4 bits is isa dma speed */
601 #define ASCV_MSGOUT_SDTR_OFFSET (ASCV_MSGOUT_BEG+4)
605 #define ASCV_MSGIN_SDTR_OFFSET (ASCV_MSGIN_BEG+4)
870 * Define total number of simultaneous maximum element scatter-gather
873 * command uses one or more ADV_SG_BLOCK each with 15 scatter-gather
876 * structures or 255 scatter-gather elements.
881 * Define maximum number of scatter-gather elements per request.
919 /* bit 13 set - Term Polarity Control */
920 /* bit 14 set - BIOS Enable */
921 /* bit 15 set - Big Endian Mode */
939 uchar termination; /* 11 0 - automatic */
940 /* 1 - low off / high off */
941 /* 2 - low off / high on */
942 /* 3 - low on / high on */
952 /* bit 4 BIOS support bootable CD */
988 /* bit 13 set - Load CIS */
989 /* bit 14 set - BIOS Enable */
990 /* bit 15 set - Big Endian Mode */
994 ushort sdtr_speed1; /* 04 SDTR Speed TID 0-3 */
1008 uchar termination_se; /* 11 0 - automatic */
1009 /* 1 - low off / high off */
1010 /* 2 - low off / high on */
1011 /* 3 - low on / high on */
1014 uchar termination_lvd; /* 11 0 - automatic */
1015 /* 1 - low off / high off */
1016 /* 2 - low off / high on */
1017 /* 3 - low on / high on */
1025 /* bit 4 BIOS support bootable CD */
1037 ushort sdtr_speed2; /* 13 SDTR speed TID 4-7 */
1038 ushort sdtr_speed3; /* 14 SDTR speed TID 8-11 */
1042 ushort sdtr_speed4; /* 17 SDTR speed 4 TID 12-15 */
1088 /* bit 11 set - Func. 0 INTB, Func. 1 INTA */
1089 /* clear - Func. 0 INTA, Func. 1 INTB */
1090 /* bit 13 set - Load CIS */
1091 /* bit 14 set - BIOS Enable */
1092 /* bit 15 set - Big Endian Mode */
1096 ushort sdtr_speed1; /* 04 SDTR Speed TID 0-3 */
1110 uchar termination_se; /* 11 0 - automatic */
1111 /* 1 - low off / high off */
1112 /* 2 - low off / high on */
1113 /* 3 - low on / high on */
1116 uchar termination_lvd; /* 11 0 - automatic */
1117 /* 1 - low off / high off */
1118 /* 2 - low off / high on */
1119 /* 3 - low on / high on */
1127 /* bit 4 BIOS support bootable CD */
1139 ushort sdtr_speed2; /* 13 SDTR speed TID 4-7 */
1140 ushort sdtr_speed3; /* 14 SDTR speed TID 8-11 */
1144 ushort sdtr_speed4; /* 17 SDTR speed 4 TID 12-15 */
1210 * XXX - Since ASC38C1600 Rev.3 has a local RAM failure issue, there is
1414 #define DIFF_MODE 0x0100 /* SCSI differential Mode (Read-Only) */
1415 #define DIFF_SENSE 0x0080 /* 1: No SE cables, 0: SE cable (Read-Only) */
1423 * Addendum for ASC-38C0800 Chip
1425 * The ASC-38C1600 Chip uses the same definitions except that the
1428 * SCSI_CFG1 are read-only and always available. Bit 14 (DIS_TERM_DRV)
1429 * is not needed. The [12:10] bits in IOPB_SOFT_OVER_WR are write-only.
1430 * Also each ASC-38C1600 function or channel uses only cable bits [5:4]
1464 #define RAM_SZ_4KB 0x04 /* 4 KB */
1495 * ASC-38C0800 RAM BIST Register bit definitions
1520 * Totem Pole mode. By default Bit 1 is 0 and the interrupt operates in
1544 #define ADV_ERROR (-1)
1569 #define ASC_MC_SDTR_SPEED1 0x0090 /* SDTR Speed for TID 0-3 */
1570 #define ASC_MC_SDTR_SPEED2 0x0092 /* SDTR Speed for TID 4-7 */
1571 #define ASC_MC_SDTR_SPEED3 0x0094 /* SDTR Speed for TID 8-11 */
1572 #define ASC_MC_SDTR_SPEED4 0x0096 /* SDTR Speed for TID 12-15 */
1624 #define ASC_DEF_MIN_DVC_QNG 0x04 /* Min. number commands per device (4) */
1628 #define ASC_QC_START_MOTOR 0x04 /* Send auto-start motor before request. */
1646 * little-endian.
1653 * next_vpa [31:4] Carrier Virtual or Physical Next Pointer
1662 * Mask used to eliminate low 4 bits of carrier 'next_vpa' field.
1681 #define ADV_CHIP_ASC3550 0x01 /* Ultra-Wide IC */
1682 #define ADV_CHIP_ASC38C0800 0x02 /* Ultra2-Wide/LVD IC */
1683 #define ADV_CHIP_ASC38C1600 0x03 /* Ultra3-Wide/LVD2 IC */
1699 uchar termination; /* Term. Ctrl. bits 6-5 of SCSI_CFG1 register */
1724 * ADV_SCSI_REQ_Q - microcode request structure
1751 uchar cdb[12]; /* SCSI CDB bytes 0-11. */
1754 uchar cdb16[4]; /* SCSI CDB bytes 12-15. */
1758 * End of microcode structure - 60 bytes. The rest of the structure
1771 * to the Mid-Level SCSI request structure.
1774 * ADV_SG_BLOCK structure holds 15 scatter-gather elements. Under Linux
1775 * up to 255 scatter-gather elements may be used per request or
1783 struct adv_sgblk *next_sgblkp; /* Next scatter-gather structure. */
1789 struct scsi_cmnd *cmndp; /* Mid-Level SCSI command pointer. */
1791 adv_sgblk_t *sgblkp; /* Adv Library scatter-gather pointer. */
1813 ushort sdtr_speed1; /* EEPROM SDTR Speed for TID 0-3 */
1814 ushort sdtr_speed2; /* EEPROM SDTR Speed for TID 4-7 */
1815 ushort sdtr_speed3; /* EEPROM SDTR Speed for TID 8-11 */
1816 ushort sdtr_speed4; /* EEPROM SDTR Speed for TID 12-15 */
1873 #define ADV_RDMA_IN_CARR_AND_Q_INVALID 0x04 /* RDMAed-in data invalid. */
1893 /* Write dword (4 bytes) to a register. */
1921 /* Write little-endian double word (4 bytes) to LRAM */
1922 /* Because of unspecified C language ordering don't use auto-increment. */
1968 * ADV_TRUE(1) - Queue was successfully aborted.
1969 * ADV_FALSE(0) - Queue was not found on the active queue list.
1982 * ADV_TRUE(1) - All requests on the target are purged.
1983 * ADV_FALSE(0) - Couldn't issue Bus Device Reset Message; Requests
2042 #define QHSTA_M_SGBACKUP_ERROR 0x47 /* Scatter-Gather backup error */
2051 * number of scatter-gather elements the driver supports in a
2057 ((ADV_MAX_SG_LIST + (NO_OF_SG_PER_BLOCK - 1))/NO_OF_SG_PER_BLOCK))
2062 #define ASC_NARROW_BOARD(boardp) (((boardp)->flags & ASC_IS_WIDE_BOARD) == 0)
2073 #define ASC_ERROR (-1)
2080 (((struct asc_board *) shost_priv(shost))->asc_stats.counter += (count))
2086 0 : ((((num) * 10)/(den)) - (10 * ((num)/(den)))))
2139 * 1: High-Level Tracing
2140 * 2-N: Verbose Tracing
2215 unsigned int xfer_elem; /* # scatter-gather elements */
2216 unsigned int xfer_sect; /* # 512-byte blocks */
2225 * field. It is guaranteed to be allocated from DMA-able memory.
2267 struct dma_pool *adv_sgblk_pool; /* Scatter-gather structures. */
2278 #define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev)
2300 "%d,\n", h->iop_base, h->err_code, h->dvc_cntl, h->bug_fix_cntl); in asc_prt_asc_dvc_var()
2302 printk(" bus_type %d, init_sdtr 0x%x,\n", h->bus_type, in asc_prt_asc_dvc_var()
2303 (unsigned)h->init_sdtr); in asc_prt_asc_dvc_var()
2306 "chip_no 0x%x,\n", (unsigned)h->sdtr_done, in asc_prt_asc_dvc_var()
2307 (unsigned)h->use_tagged_qng, (unsigned)h->unit_not_ready, in asc_prt_asc_dvc_var()
2308 (unsigned)h->chip_no); in asc_prt_asc_dvc_var()
2311 "%u,\n", (unsigned)h->queue_full_or_busy, in asc_prt_asc_dvc_var()
2312 (unsigned)h->start_motor, (unsigned)h->scsi_reset_wait); in asc_prt_asc_dvc_var()
2315 "in_critical_cnt %u,\n", (unsigned)h->is_in_int, in asc_prt_asc_dvc_var()
2316 (unsigned)h->max_total_qng, (unsigned)h->cur_total_qng, in asc_prt_asc_dvc_var()
2317 (unsigned)h->in_critical_cnt); in asc_prt_asc_dvc_var()
2320 "pci_fix_asyn_xfer 0x%x,\n", (unsigned)h->last_q_shortage, in asc_prt_asc_dvc_var()
2321 (unsigned)h->init_state, (unsigned)h->no_scam, in asc_prt_asc_dvc_var()
2322 (unsigned)h->pci_fix_asyn_xfer); in asc_prt_asc_dvc_var()
2324 printk(" cfg 0x%lx\n", (ulong)h->cfg); in asc_prt_asc_dvc_var()
2335 h->can_tagged_qng, h->cmd_qng_enabled); in asc_prt_asc_dvc_cfg()
2337 h->disc_enable, h->sdtr_enable); in asc_prt_asc_dvc_cfg()
2340 h->chip_scsi_id, h->chip_version); in asc_prt_asc_dvc_cfg()
2343 h->mcode_date, h->mcode_version); in asc_prt_asc_dvc_cfg()
2356 (ulong)h->iop_base, h->err_code, (unsigned)h->ultra_able); in asc_prt_adv_dvc_var()
2359 (unsigned)h->sdtr_able, (unsigned)h->wdtr_able); in asc_prt_adv_dvc_var()
2362 (unsigned)h->start_motor, (unsigned)h->scsi_reset_wait); in asc_prt_adv_dvc_var()
2365 (unsigned)h->max_host_qng, (unsigned)h->max_dvc_qng, in asc_prt_adv_dvc_var()
2366 h->carr_freelist); in asc_prt_adv_dvc_var()
2368 printk(" icq_sp 0x%p, irq_sp 0x%p\n", h->icq_sp, h->irq_sp); in asc_prt_adv_dvc_var()
2371 (unsigned)h->no_scam, (unsigned)h->tagqng_able); in asc_prt_adv_dvc_var()
2374 (unsigned)h->chip_scsi_id, (ulong)h->cfg); in asc_prt_adv_dvc_var()
2387 h->disc_enable, h->termination); in asc_prt_adv_dvc_cfg()
2390 h->chip_version, h->mcode_date); in asc_prt_adv_dvc_cfg()
2393 h->mcode_version, h->control_flag); in asc_prt_adv_dvc_cfg()
2403 printk("Scsi_Host at addr 0x%p, device %s\n", s, dev_name(boardp->dev)); in asc_prt_scsi_host()
2405 scsi_host_busy(s), s->host_no); in asc_prt_scsi_host()
2408 (ulong)s->base, (ulong)s->io_port, boardp->irq); in asc_prt_scsi_host()
2411 s->dma_channel, s->this_id, s->can_queue); in asc_prt_scsi_host()
2414 s->cmd_per_lun, s->sg_tablesize); in asc_prt_scsi_host()
2417 asc_prt_asc_dvc_var(&boardp->dvc_var.asc_dvc_var); in asc_prt_scsi_host()
2418 asc_prt_asc_dvc_cfg(&boardp->dvc_cfg.asc_dvc_cfg); in asc_prt_scsi_host()
2420 asc_prt_adv_dvc_var(&boardp->dvc_var.adv_dvc_var); in asc_prt_scsi_host()
2421 asc_prt_adv_dvc_cfg(&boardp->dvc_cfg.adv_dvc_cfg); in asc_prt_scsi_host()
2428 * Print hexadecimal output in 4 byte groupings 32 bytes
2429 * or 8 double-words per line.
2442 /* Display a maximum of 8 double-words per line. */ in asc_prt_hex()
2443 if ((k = (l - i) / 4) >= 8) { in asc_prt_hex()
2447 m = (l - i) % 4; in asc_prt_hex()
2452 (unsigned)s[i + (j * 4)], in asc_prt_hex()
2453 (unsigned)s[i + (j * 4) + 1], in asc_prt_hex()
2454 (unsigned)s[i + (j * 4) + 2], in asc_prt_hex()
2455 (unsigned)s[i + (j * 4) + 3]); in asc_prt_hex()
2463 printk(" %2.2X", (unsigned)s[i + (j * 4)]); in asc_prt_hex()
2467 (unsigned)s[i + (j * 4)], in asc_prt_hex()
2468 (unsigned)s[i + (j * 4) + 1]); in asc_prt_hex()
2472 (unsigned)s[i + (j * 4) + 1], in asc_prt_hex()
2473 (unsigned)s[i + (j * 4) + 2], in asc_prt_hex()
2474 (unsigned)s[i + (j * 4) + 3]); in asc_prt_hex()
2494 q->q2.target_ix, q->q1.target_lun, q->q2.srb_tag, in asc_prt_asc_scsi_q()
2495 q->q2.tag_code); in asc_prt_asc_scsi_q()
2499 (ulong)le32_to_cpu(q->q1.data_addr), in asc_prt_asc_scsi_q()
2500 (ulong)le32_to_cpu(q->q1.data_cnt), in asc_prt_asc_scsi_q()
2501 (ulong)le32_to_cpu(q->q1.sense_addr), q->q1.sense_len); in asc_prt_asc_scsi_q()
2504 (ulong)q->cdbptr, q->q2.cdb_len, in asc_prt_asc_scsi_q()
2505 (ulong)q->sg_head, q->q1.sg_queue_cnt); in asc_prt_asc_scsi_q()
2507 if (q->sg_head) { in asc_prt_asc_scsi_q()
2508 sgp = q->sg_head; in asc_prt_asc_scsi_q()
2510 printk(" entry_cnt %u, queue_cnt %u\n", sgp->entry_cnt, in asc_prt_asc_scsi_q()
2511 sgp->queue_cnt); in asc_prt_asc_scsi_q()
2512 for (i = 0; i < sgp->entry_cnt; i++) { in asc_prt_asc_scsi_q()
2514 i, (ulong)le32_to_cpu(sgp->sg_list[i].addr), in asc_prt_asc_scsi_q()
2515 (ulong)le32_to_cpu(sgp->sg_list[i].bytes)); in asc_prt_asc_scsi_q()
2528 q->d2.srb_tag, q->d2.target_ix, q->d2.cdb_len, in asc_prt_asc_qdone_info()
2529 q->d2.tag_code); in asc_prt_asc_qdone_info()
2532 q->d3.done_stat, q->d3.host_stat, q->d3.scsi_stat, q->d3.scsi_msg); in asc_prt_asc_qdone_info()
2547 b->sg_cnt, (u32)le32_to_cpu(b->sg_ptr)); in asc_prt_adv_sgblock()
2548 BUG_ON(b->sg_cnt > NO_OF_SG_PER_BLOCK); in asc_prt_adv_sgblock()
2549 if (b->sg_ptr != 0) in asc_prt_adv_sgblock()
2550 BUG_ON(b->sg_cnt != NO_OF_SG_PER_BLOCK); in asc_prt_adv_sgblock()
2551 for (i = 0; i < b->sg_cnt; i++) { in asc_prt_adv_sgblock()
2553 i, (u32)le32_to_cpu(b->sg_list[i].sg_addr), in asc_prt_adv_sgblock()
2554 (u32)le32_to_cpu(b->sg_list[i].sg_count)); in asc_prt_adv_sgblock()
2572 q->target_id, q->target_lun, q->srb_tag); in asc_prt_adv_scsi_req_q()
2575 q->cntl, (ulong)le32_to_cpu(q->data_addr)); in asc_prt_adv_scsi_req_q()
2578 (ulong)le32_to_cpu(q->data_cnt), in asc_prt_adv_scsi_req_q()
2579 (ulong)le32_to_cpu(q->sense_addr), q->sense_len); in asc_prt_adv_scsi_req_q()
2583 q->cdb_len, q->done_status, q->host_status, q->scsi_status); in asc_prt_adv_scsi_req_q()
2586 q->sg_working_ix, q->target_cmd); in asc_prt_adv_scsi_req_q()
2589 (ulong)le32_to_cpu(q->scsiq_rptr), in asc_prt_adv_scsi_req_q()
2590 (ulong)le32_to_cpu(q->sg_real_addr), (ulong)q->sg_list_ptr); in asc_prt_adv_scsi_req_q()
2593 if (q->sg_list_ptr != NULL) { in asc_prt_adv_scsi_req_q()
2594 sgblkp = container_of(q->sg_list_ptr, adv_sgblk_t, sg_block); in asc_prt_adv_scsi_req_q()
2597 sg_ptr = &sgblkp->sg_block; in asc_prt_adv_scsi_req_q()
2599 if (sg_ptr->sg_ptr == 0) { in asc_prt_adv_scsi_req_q()
2602 sgblkp = sgblkp->next_sgblkp; in asc_prt_adv_scsi_req_q()
2628 asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; in advansys_info()
2631 if (asc_dvc_varp->bus_type & ASC_IS_VL) { in advansys_info()
2633 } else if (asc_dvc_varp->bus_type & ASC_IS_EISA) { in advansys_info()
2635 } else if (asc_dvc_varp->bus_type & ASC_IS_PCI) { in advansys_info()
2636 if ((asc_dvc_varp->bus_type & ASC_IS_PCI_ULTRA) in advansys_info()
2645 "type %d\n", asc_dvc_varp->bus_type); in advansys_info()
2648 "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X", in advansys_info()
2649 ASC_VERSION, busname, (ulong)shost->io_port, in advansys_info()
2650 (ulong)shost->io_port + ASC_IOADR_GAP - 1, in advansys_info()
2651 boardp->irq); in advansys_info()
2656 * Memory-mapped I/O is used instead of I/O space to access in advansys_info()
2660 adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; in advansys_info()
2661 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { in advansys_info()
2662 widename = "Ultra-Wide"; in advansys_info()
2663 } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { in advansys_info()
2664 widename = "Ultra2-Wide"; in advansys_info()
2666 widename = "Ultra3-Wide"; in advansys_info()
2669 "AdvanSys SCSI %s: PCI %s: PCIMEM 0x%lX-0x%lX, IRQ 0x%X", in advansys_info()
2670 ASC_VERSION, widename, (ulong)adv_dvc_varp->iop_base, in advansys_info()
2671 (ulong)adv_dvc_varp->iop_base + boardp->asc_n_io_port - 1, boardp->irq); in advansys_info()
2693 shost->host_no); in asc_prt_board_devices()
2696 chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id; in asc_prt_board_devices()
2698 chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id; in asc_prt_board_devices()
2703 if (boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) in asc_prt_board_devices()
2723 if (boardp->bios_signature != 0x55AA) { in asc_prt_adv_bios()
2724 seq_puts(m, "Disabled or Pre-3.1\n" in asc_prt_adv_bios()
2725 "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n" in asc_prt_adv_bios()
2728 major = (boardp->bios_version >> 12) & 0xF; in asc_prt_adv_bios()
2729 minor = (boardp->bios_version >> 8) & 0xF; in asc_prt_adv_bios()
2730 letter = (boardp->bios_version & 0xFF); in asc_prt_adv_bios()
2741 (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) { in asc_prt_adv_bios()
2750 * is found in at bit 15-9 (7 bits) of word 1.
2752 * Serial Number consists fo 12 alpha-numeric digits.
2754 * 1 - Product type (A,B,C,D..) Word0: 15-13 (3 bits)
2755 * 2 - MFG Location (A,B,C,D..) Word0: 12-10 (3 bits)
2756 * 3-4 - Product ID (0-99) Word0: 9-0 (10 bits)
2757 * 5 - Product revision (A-J) Word0: " "
2759 * Signature Word1: 15-9 (7 bits)
2760 * 6 - Year (0-9) Word1: 8-6 (3 bits) & Word2: 15 (1 bit)
2761 * 7-8 - Week of the year (1-52) Word1: 5-0 (6 bits)
2763 * 9-12 - Serial Number (A001-Z999) Word2: 14-0 (15 bits)
2779 * First word - 6 digits. in asc_get_eeprom_string()
2783 /* Product type - 1st digit. */ in asc_get_eeprom_string()
2790 /* Manufacturing location - 2nd digit. */ in asc_get_eeprom_string()
2793 /* Product ID - 3rd, 4th digits. */ in asc_get_eeprom_string()
2799 /* Product revision - 5th digit. */ in asc_get_eeprom_string()
2808 * Year - 6th digit. in asc_get_eeprom_string()
2819 /* Week of year - 7th, 8th digits. */ in asc_get_eeprom_string()
2830 /* Serial number - 9th digit. */ in asc_get_eeprom_string()
2858 ep = &boardp->eep_config.asc_eep; in asc_prt_asc_board_eeprom()
2862 shost->host_no); in asc_prt_asc_board_eeprom()
2864 if (asc_get_eeprom_string((ushort *)&ep->adapter_info[0], serialstr) in asc_prt_asc_board_eeprom()
2867 else if (ep->adapter_info[5] == 0xBB) in asc_prt_asc_board_eeprom()
2869 " Default Settings Used for EEPROM-less Adapter.\n"); in asc_prt_asc_board_eeprom()
2875 ASC_EEP_GET_CHIP_ID(ep), ep->max_total_qng, in asc_prt_asc_board_eeprom()
2876 ep->max_tag_qng); in asc_prt_asc_board_eeprom()
2879 " cntl 0x%x, no_scam 0x%x\n", ep->cntl, ep->no_scam); in asc_prt_asc_board_eeprom()
2888 (ep->disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); in asc_prt_asc_board_eeprom()
2893 (ep->use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); in asc_prt_asc_board_eeprom()
2898 (ep->start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); in asc_prt_asc_board_eeprom()
2903 (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); in asc_prt_asc_board_eeprom()
2926 adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; in asc_prt_adv_board_eeprom()
2927 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { in asc_prt_adv_board_eeprom()
2928 ep_3550 = &boardp->eep_config.adv_3550_eep; in asc_prt_adv_board_eeprom()
2929 } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { in asc_prt_adv_board_eeprom()
2930 ep_38C0800 = &boardp->eep_config.adv_38C0800_eep; in asc_prt_adv_board_eeprom()
2932 ep_38C1600 = &boardp->eep_config.adv_38C1600_eep; in asc_prt_adv_board_eeprom()
2937 shost->host_no); in asc_prt_adv_board_eeprom()
2939 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { in asc_prt_adv_board_eeprom()
2940 wordp = &ep_3550->serial_number_word1; in asc_prt_adv_board_eeprom()
2941 } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { in asc_prt_adv_board_eeprom()
2942 wordp = &ep_38C0800->serial_number_word1; in asc_prt_adv_board_eeprom()
2944 wordp = &ep_38C1600->serial_number_word1; in asc_prt_adv_board_eeprom()
2952 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) in asc_prt_adv_board_eeprom()
2955 ep_3550->adapter_scsi_id, in asc_prt_adv_board_eeprom()
2956 ep_3550->max_host_qng, ep_3550->max_dvc_qng); in asc_prt_adv_board_eeprom()
2957 else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) in asc_prt_adv_board_eeprom()
2960 ep_38C0800->adapter_scsi_id, in asc_prt_adv_board_eeprom()
2961 ep_38C0800->max_host_qng, in asc_prt_adv_board_eeprom()
2962 ep_38C0800->max_dvc_qng); in asc_prt_adv_board_eeprom()
2966 ep_38C1600->adapter_scsi_id, in asc_prt_adv_board_eeprom()
2967 ep_38C1600->max_host_qng, in asc_prt_adv_board_eeprom()
2968 ep_38C1600->max_dvc_qng); in asc_prt_adv_board_eeprom()
2969 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { in asc_prt_adv_board_eeprom()
2970 word = ep_3550->termination; in asc_prt_adv_board_eeprom()
2971 } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { in asc_prt_adv_board_eeprom()
2972 word = ep_38C0800->termination_lvd; in asc_prt_adv_board_eeprom()
2974 word = ep_38C1600->termination_lvd; in asc_prt_adv_board_eeprom()
2992 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) in asc_prt_adv_board_eeprom()
2995 ep_3550->termination, termstr, in asc_prt_adv_board_eeprom()
2996 ep_3550->bios_ctrl); in asc_prt_adv_board_eeprom()
2997 else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) in asc_prt_adv_board_eeprom()
3000 ep_38C0800->termination_lvd, termstr, in asc_prt_adv_board_eeprom()
3001 ep_38C0800->bios_ctrl); in asc_prt_adv_board_eeprom()
3005 ep_38C1600->termination_lvd, termstr, in asc_prt_adv_board_eeprom()
3006 ep_38C1600->bios_ctrl); in asc_prt_adv_board_eeprom()
3013 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { in asc_prt_adv_board_eeprom()
3014 word = ep_3550->disc_enable; in asc_prt_adv_board_eeprom()
3015 } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { in asc_prt_adv_board_eeprom()
3016 word = ep_38C0800->disc_enable; in asc_prt_adv_board_eeprom()
3018 word = ep_38C1600->disc_enable; in asc_prt_adv_board_eeprom()
3026 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { in asc_prt_adv_board_eeprom()
3027 word = ep_3550->tagqng_able; in asc_prt_adv_board_eeprom()
3028 } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { in asc_prt_adv_board_eeprom()
3029 word = ep_38C0800->tagqng_able; in asc_prt_adv_board_eeprom()
3031 word = ep_38C1600->tagqng_able; in asc_prt_adv_board_eeprom()
3039 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { in asc_prt_adv_board_eeprom()
3040 word = ep_3550->start_motor; in asc_prt_adv_board_eeprom()
3041 } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { in asc_prt_adv_board_eeprom()
3042 word = ep_38C0800->start_motor; in asc_prt_adv_board_eeprom()
3044 word = ep_38C1600->start_motor; in asc_prt_adv_board_eeprom()
3052 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { in asc_prt_adv_board_eeprom()
3056 (ep_3550->sdtr_able & ADV_TID_TO_TIDMASK(i)) ? in asc_prt_adv_board_eeprom()
3061 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { in asc_prt_adv_board_eeprom()
3065 (ep_3550->ultra_able & ADV_TID_TO_TIDMASK(i)) in asc_prt_adv_board_eeprom()
3070 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { in asc_prt_adv_board_eeprom()
3071 word = ep_3550->wdtr_able; in asc_prt_adv_board_eeprom()
3072 } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { in asc_prt_adv_board_eeprom()
3073 word = ep_38C0800->wdtr_able; in asc_prt_adv_board_eeprom()
3075 word = ep_38C1600->wdtr_able; in asc_prt_adv_board_eeprom()
3083 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 || in asc_prt_adv_board_eeprom()
3084 adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) { in asc_prt_adv_board_eeprom()
3090 sdtr_speed = adv_dvc_varp->sdtr_speed1; in asc_prt_adv_board_eeprom()
3091 } else if (i == 4) { in asc_prt_adv_board_eeprom()
3092 sdtr_speed = adv_dvc_varp->sdtr_speed2; in asc_prt_adv_board_eeprom()
3094 sdtr_speed = adv_dvc_varp->sdtr_speed3; in asc_prt_adv_board_eeprom()
3096 sdtr_speed = adv_dvc_varp->sdtr_speed4; in asc_prt_adv_board_eeprom()
3111 case 4: in asc_prt_adv_board_eeprom()
3124 sdtr_speed >>= 4; in asc_prt_adv_board_eeprom()
3139 shost->host_no); in asc_prt_driver_conf()
3143 scsi_host_busy(shost), shost->max_id, in asc_prt_driver_conf()
3144 shost->max_lun, shost->max_channel); in asc_prt_driver_conf()
3148 shost->unique_id, shost->can_queue, shost->this_id, in asc_prt_driver_conf()
3149 shost->sg_tablesize, shost->cmd_per_lun); in asc_prt_driver_conf()
3153 boardp->flags, shost->last_reset, jiffies, in asc_prt_driver_conf()
3154 boardp->asc_n_io_port); in asc_prt_driver_conf()
3156 seq_printf(m, " io_port 0x%lx\n", shost->io_port); in asc_prt_driver_conf()
3173 v = &boardp->dvc_var.asc_dvc_var; in asc_prt_asc_board_info()
3174 c = &boardp->dvc_cfg.asc_dvc_cfg; in asc_prt_asc_board_info()
3175 chip_scsi_id = c->chip_scsi_id; in asc_prt_asc_board_info()
3179 shost->host_no); in asc_prt_asc_board_info()
3183 c->chip_version, c->mcode_date, c->mcode_version, in asc_prt_asc_board_info()
3184 v->err_code); in asc_prt_asc_board_info()
3188 " Total Command Pending: %d\n", v->cur_total_qng); in asc_prt_asc_board_info()
3193 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_asc_board_info()
3198 (v->use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); in asc_prt_asc_board_info()
3205 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_asc_board_info()
3208 seq_printf(m, " %X:%u", i, v->cur_dvc_qng[i]); in asc_prt_asc_board_info()
3215 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_asc_board_info()
3218 seq_printf(m, " %X:%u", i, v->max_dvc_qng[i]); in asc_prt_asc_board_info()
3225 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_asc_board_info()
3228 if (boardp->queue_full & ADV_TID_TO_TIDMASK(i)) in asc_prt_asc_board_info()
3229 seq_printf(m, " %X:Y-%d", in asc_prt_asc_board_info()
3230 i, boardp->queue_full_cnt[i]); in asc_prt_asc_board_info()
3238 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_asc_board_info()
3243 (v->sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); in asc_prt_asc_board_info()
3251 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0) || in asc_prt_asc_board_info()
3252 ((v->init_sdtr & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_asc_board_info()
3258 if ((boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET) == 0) { in asc_prt_asc_board_info()
3262 (boardp->sdtr_data[i] >> 4) & (v->max_sdtr_index - in asc_prt_asc_board_info()
3267 v->sdtr_period_tbl[syn_period_ix], in asc_prt_asc_board_info()
3268 250 / v->sdtr_period_tbl[syn_period_ix], in asc_prt_asc_board_info()
3270 v->sdtr_period_tbl[syn_period_ix])); in asc_prt_asc_board_info()
3273 boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET); in asc_prt_asc_board_info()
3276 if ((v->sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { in asc_prt_asc_board_info()
3285 seq_puts(m, " * = Re-negotiation pending before next command.\n"); in asc_prt_asc_board_info()
3310 v = &boardp->dvc_var.adv_dvc_var; in asc_prt_adv_board_info()
3311 c = &boardp->dvc_cfg.adv_dvc_cfg; in asc_prt_adv_board_info()
3312 iop_base = v->iop_base; in asc_prt_adv_board_info()
3313 chip_scsi_id = v->chip_scsi_id; in asc_prt_adv_board_info()
3317 shost->host_no); in asc_prt_adv_board_info()
3321 v->iop_base, in asc_prt_adv_board_info()
3323 v->err_code); in asc_prt_adv_board_info()
3326 "mcode_version 0x%x\n", c->chip_version, in asc_prt_adv_board_info()
3327 c->mcode_date, c->mcode_version); in asc_prt_adv_board_info()
3333 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_adv_board_info()
3345 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_adv_board_info()
3358 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_adv_board_info()
3373 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_adv_board_info()
3387 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_adv_board_info()
3410 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { in asc_prt_adv_board_info()
3429 ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0) || in asc_prt_adv_board_info()
3447 period = (((lramword >> 8) * 25) + 50) / 4; in asc_prt_adv_board_info()
3472 seq_puts(m, " * = Re-negotiation pending before next command.\n"); in asc_prt_adv_board_info()
3483 struct asc_stats *s = &boardp->asc_stats; in asc_prt_board_stats()
3487 shost->host_no); in asc_prt_board_stats()
3491 s->queuecommand, s->reset, s->biosparam, in asc_prt_board_stats()
3492 s->interrupt); in asc_prt_board_stats()
3496 s->callback, s->done, s->build_error, in asc_prt_board_stats()
3497 s->adv_build_noreq, s->adv_build_nosg); in asc_prt_board_stats()
3501 s->exe_noerror, s->exe_busy, s->exe_error, in asc_prt_board_stats()
3502 s->exe_unknown); in asc_prt_board_stats()
3507 if (s->xfer_cnt > 0) { in asc_prt_board_stats()
3509 s->xfer_cnt, s->xfer_elem); in asc_prt_board_stats()
3512 s->xfer_sect / 2, ASC_TENTHS(s->xfer_sect, 2)); in asc_prt_board_stats()
3516 s->xfer_elem / s->xfer_cnt, in asc_prt_board_stats()
3517 ASC_TENTHS(s->xfer_elem, s->xfer_cnt)); in asc_prt_board_stats()
3520 (s->xfer_sect / 2) / s->xfer_elem, in asc_prt_board_stats()
3521 ASC_TENTHS((s->xfer_sect / 2), s->xfer_elem)); in asc_prt_board_stats()
3524 (s->xfer_sect / 2) / s->xfer_cnt, in asc_prt_board_stats()
3525 ASC_TENTHS((s->xfer_sect / 2), s->xfer_cnt)); in asc_prt_board_stats()
3531 * advansys_show_info() - /proc/scsi/advansys/{0,1,2,3,...}
3603 ASC_STATS(scp->device->host, done); in asc_scsi_done()
3672 iop_base = asc_dvc->iop_base; in AscResetChipAndScsiBus()
3674 && (i-- > 0)) { in AscResetChipAndScsiBus()
3730 AscSetChipLramAddr(iop_base, addr - 1); in AscReadLramByte()
3772 addr--; in AscWriteLramByte()
3787 * The source data is assumed to be in little-endian order in memory
3788 * and is maintained in little-endian order when written to LRAM.
3799 * On a little-endian system the second argument below in AscMemWordCopyPtrToLram()
3800 * produces a little-endian ushort which is written to in AscMemWordCopyPtrToLram()
3801 * LRAM in little-endian order. On a big-endian system in AscMemWordCopyPtrToLram()
3802 * the second argument produces a big-endian ushort which in AscMemWordCopyPtrToLram()
3803 * is "transparently" byte-swapped by outpw() and written in AscMemWordCopyPtrToLram()
3804 * in little-endian order to LRAM. in AscMemWordCopyPtrToLram()
3812 * Copy 4 bytes to LRAM.
3814 * The source data is assumed to be in little-endian order in memory
3815 * and is maintained in little-endian order when written to LRAM.
3824 for (i = 0; i < 4 * dwords; i += 4) { in AscMemDWordCopyPtrToLram()
3833 * The source data is assumed to be in little-endian order in LRAM
3834 * and is maintained in little-endian order when written to memory.
3868 iop_base = asc_dvc->iop_base; in AscInitLram()
3870 (ushort)(((int)(asc_dvc->max_total_qng + 2 + 1) * in AscInitLram()
3877 (uchar)(asc_dvc->max_total_qng)); in AscInitLram()
3882 for (; i < asc_dvc->max_total_qng; i++, s_addr += ASC_QBLK_SIZE) { in AscInitLram()
3886 (uchar)(i - 1)); in AscInitLram()
3893 (uchar)(asc_dvc->max_total_qng - 1)); in AscInitLram()
3895 (uchar)asc_dvc->max_total_qng); in AscInitLram()
3898 for (; i <= (uchar)(asc_dvc->max_total_qng + 3); in AscInitLram()
3926 (ushort)((mcode_size - in AscLoadMicroCode()
3927 s_addr - (ushort) in AscLoadMicroCode()
3942 iop_base = asc_dvc->iop_base; in AscInitQLinkVar()
3944 AscPutRiscVarDoneQTail(iop_base, asc_dvc->max_total_qng); in AscInitQLinkVar()
3946 AscPutVarDoneQTail(iop_base, asc_dvc->max_total_qng); in AscInitQLinkVar()
3948 (uchar)((int)asc_dvc->max_total_qng + 1)); in AscInitQLinkVar()
3950 (uchar)((int)asc_dvc->max_total_qng + 2)); in AscInitQLinkVar()
3952 asc_dvc->max_total_qng); in AscInitQLinkVar()
3974 iop_base = asc_dvc->iop_base; in AscInitMicroCodeVar()
3978 asc_dvc->cfg->sdtr_period_offset[i]); in AscInitMicroCodeVar()
3983 asc_dvc->cfg->disc_enable); in AscInitMicroCodeVar()
3985 ASC_TID_TO_TARGET_ID(asc_dvc->cfg->chip_scsi_id)); in AscInitMicroCodeVar()
3988 BUG_ON((unsigned long)asc_dvc->overrun_buf & 7); in AscInitMicroCodeVar()
3989 asc_dvc->overrun_dma = dma_map_single(board->dev, asc_dvc->overrun_buf, in AscInitMicroCodeVar()
3991 if (dma_mapping_error(board->dev, asc_dvc->overrun_dma)) { in AscInitMicroCodeVar()
3992 warn_code = -ENOMEM; in AscInitMicroCodeVar()
3995 phy_addr = cpu_to_le32(asc_dvc->overrun_dma); in AscInitMicroCodeVar()
4002 asc_dvc->cfg->mcode_date = in AscInitMicroCodeVar()
4004 asc_dvc->cfg->mcode_version = in AscInitMicroCodeVar()
4009 asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR; in AscInitMicroCodeVar()
4010 warn_code = -EINVAL; in AscInitMicroCodeVar()
4014 asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP; in AscInitMicroCodeVar()
4015 warn_code = -EIO; in AscInitMicroCodeVar()
4022 dma_unmap_single(board->dev, asc_dvc->overrun_dma, in AscInitMicroCodeVar()
4025 asc_dvc->overrun_dma = 0; in AscInitMicroCodeVar()
4038 iop_base = asc_dvc->iop_base; in AscInitAsc1000Driver()
4040 if ((asc_dvc->dvc_cntl & ASC_CNTL_RESET_SCSI) && in AscInitAsc1000Driver()
4041 !(asc_dvc->init_state & ASC_INIT_RESET_SCSI_DONE)) { in AscInitAsc1000Driver()
4043 mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */ in AscInitAsc1000Driver()
4045 asc_dvc->init_state |= ASC_INIT_STATE_BEG_LOAD_MC; in AscInitAsc1000Driver()
4046 if (asc_dvc->err_code != 0) in AscInitAsc1000Driver()
4048 if (!AscFindSignature(asc_dvc->iop_base)) { in AscInitAsc1000Driver()
4049 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; in AscInitAsc1000Driver()
4055 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev); in AscInitAsc1000Driver()
4059 asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM; in AscInitAsc1000Driver()
4062 if (fw->size < 4) { in AscInitAsc1000Driver()
4064 fw->size, fwname); in AscInitAsc1000Driver()
4066 asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM; in AscInitAsc1000Driver()
4067 return -EINVAL; in AscInitAsc1000Driver()
4069 chksum = (fw->data[3] << 24) | (fw->data[2] << 16) | in AscInitAsc1000Driver()
4070 (fw->data[1] << 8) | fw->data[0]; in AscInitAsc1000Driver()
4072 if (AscLoadMicroCode(iop_base, 0, &fw->data[4], in AscInitAsc1000Driver()
4073 fw->size - 4) != chksum) { in AscInitAsc1000Driver()
4074 asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM; in AscInitAsc1000Driver()
4080 if (!asc_dvc->overrun_dma) in AscInitAsc1000Driver()
4082 asc_dvc->init_state |= ASC_INIT_STATE_END_LOAD_MC; in AscInitAsc1000Driver()
4097 * 1-Byte Code:
4103 * Multi-Byte Code:
4105 * FF BB WW WW: (4 byte code) Emit BB count times next word WW WW.
4168 carr_paddr = adv_dvc->carrier_addr + carr_offset; in AdvBuildCarrierFreelist()
4170 adv_dvc->carrier[i].carr_pa = cpu_to_le32(carr_paddr); in AdvBuildCarrierFreelist()
4171 adv_dvc->carrier[i].carr_va = cpu_to_le32(carr_offset); in AdvBuildCarrierFreelist()
4172 adv_dvc->carrier[i].areq_vpa = 0; in AdvBuildCarrierFreelist()
4176 adv_dvc->carrier[i].next_vpa = cpu_to_le32(next_offset); in AdvBuildCarrierFreelist()
4184 adv_dvc->carr_freelist = &adv_dvc->carrier[1]; in AdvBuildCarrierFreelist()
4194 return &adv_dvc->carrier[index]; in adv_get_carrier()
4199 ADV_CARR_T *carrp = adv_dvc->carr_freelist; in adv_get_next_carrier()
4200 u32 next_vpa = le32_to_cpu(carrp->next_vpa); in adv_get_next_carrier()
4207 adv_dvc->carr_freelist = adv_get_carrier(adv_dvc, next_vpa); in adv_get_next_carrier()
4211 carrp->next_vpa = cpu_to_le32(ADV_CQ_STOPPER); in adv_get_next_carrier()
4221 struct asc_board *boardp = adv_dvc->drv_ptr; in adv_get_reqp()
4223 BUG_ON(offset > adv_dvc->max_host_qng); in adv_get_reqp()
4224 return &boardp->adv_reqp[offset]; in adv_get_reqp()
4233 * But the function is not re-entrant, so it uses the DvcEnter/LeaveCritical()
4237 * ADV_TRUE - command completed successfully
4238 * ADV_FALSE - command failed
4239 * ADV_ERROR - command timed out
4248 iop_base = asc_dvc->iop_base; in AdvSendIdleCmd()
4252 * to a non-zero value to indicate when the command is completed. in AdvSendIdleCmd()
4253 * The non-zero result is one of the IDLE_CMD_STATUS_* values in AdvSendIdleCmd()
4271 if (asc_dvc->chip_type == ADV_CHIP_ASC3550) { in AdvSendIdleCmd()
4273 * Clear the tickle value. In the ASC-3550 the RISC flag in AdvSendIdleCmd()
4300 * ADV_TRUE(1) - All requests are purged and SCSI Bus is reset.
4301 * ADV_FALSE(0) - Microcode command failed.
4302 * ADV_ERROR(-1) - Microcode command timed-out. Microcode or IC
4327 * Send the SCSI Bus Reset end idle command which de-asserts in AdvResetSB()
4335 mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */ in AdvResetSB()
4341 * Initialize the ASC-3550.
4345 * For a non-fatal error return a warning code. If there are no warnings
4365 ushort bios_mem[ASC_MC_BIOSLEN / 2]; /* BIOS RISC Memory 0x40-0x8F. */ in AdvInitAsc3550Driver()
4370 if (asc_dvc->err_code != 0) in AdvInitAsc3550Driver()
4376 if (asc_dvc->chip_type != ADV_CHIP_ASC3550) { in AdvInitAsc3550Driver()
4377 asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE; in AdvInitAsc3550Driver()
4382 iop_base = asc_dvc->iop_base; in AdvInitAsc3550Driver()
4400 if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] == 0x55AA) { in AdvInitAsc3550Driver()
4404 bios_mem[(ASC_MC_BIOS_VERSION - ASC_MC_BIOSMEM) / 2]; in AdvInitAsc3550Driver()
4421 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev); in AdvInitAsc3550Driver()
4425 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; in AdvInitAsc3550Driver()
4428 if (fw->size < 4) { in AdvInitAsc3550Driver()
4430 fw->size, fwname); in AdvInitAsc3550Driver()
4432 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; in AdvInitAsc3550Driver()
4433 return -EINVAL; in AdvInitAsc3550Driver()
4435 chksum = (fw->data[3] << 24) | (fw->data[2] << 16) | in AdvInitAsc3550Driver()
4436 (fw->data[1] << 8) | fw->data[0]; in AdvInitAsc3550Driver()
4437 asc_dvc->err_code = AdvLoadMicrocode(iop_base, &fw->data[4], in AdvInitAsc3550Driver()
4438 fw->size - 4, ADV_3550_MEMSIZE, in AdvInitAsc3550Driver()
4441 if (asc_dvc->err_code) in AdvInitAsc3550Driver()
4469 asc_dvc->cfg->mcode_date); in AdvInitAsc3550Driver()
4471 asc_dvc->cfg->mcode_version); in AdvInitAsc3550Driver()
4484 if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) { in AdvInitAsc3550Driver()
4491 * For ASC-3550, setting the START_CTL_EMFU [3:2] bits sets a FIFO in AdvInitAsc3550Driver()
4509 if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) { in AdvInitAsc3550Driver()
4511 asc_dvc->wdtr_able); in AdvInitAsc3550Driver()
4513 asc_dvc->sdtr_able); in AdvInitAsc3550Driver()
4526 * 4-bit speed SDTR speed name in AdvInitAsc3550Driver()
4540 if (ADV_TID_TO_TIDMASK(tid) & asc_dvc->ultra_able) { in AdvInitAsc3550Driver()
4542 word |= (0x3 << (4 * (tid % 4))); in AdvInitAsc3550Driver()
4545 word |= (0x2 << (4 * (tid % 4))); in AdvInitAsc3550Driver()
4566 asc_dvc->cfg->disc_enable); in AdvInitAsc3550Driver()
4576 asc_dvc->chip_scsi_id); in AdvInitAsc3550Driver()
4593 asc_dvc->err_code |= ASC_IERR_ILLEGAL_CONNECTION; in AdvInitAsc3550Driver()
4603 asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE; in AdvInitAsc3550Driver()
4608 * If this is a differential board and a single-ended device in AdvInitAsc3550Driver()
4612 asc_dvc->err_code |= ASC_IERR_SINGLE_END_DEVICE; in AdvInitAsc3550Driver()
4621 * then 'termination' was set-up in AdvInitFrom3550EEPROM() and in AdvInitAsc3550Driver()
4624 if (asc_dvc->cfg->termination == 0) { in AdvInitAsc3550Driver()
4629 asc_dvc->cfg->termination |= TERM_CTL_SEL; in AdvInitAsc3550Driver()
4639 asc_dvc->cfg->termination |= (TERM_CTL_H | TERM_CTL_L); in AdvInitAsc3550Driver()
4648 asc_dvc->cfg->termination |= TERM_CTL_H; in AdvInitAsc3550Driver()
4669 scsi_cfg1 |= (TERM_CTL_SEL | (~asc_dvc->cfg->termination & TERM_CTL)); in AdvInitAsc3550Driver()
4689 * MEM_CFG may be accessed as a word or byte, but only bits 0-7 in AdvInitAsc3550Driver()
4692 * ASC-3550 has 8KB internal memory. in AdvInitAsc3550Driver()
4704 ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id)); in AdvInitAsc3550Driver()
4709 * Set-up the Host->RISC Initiator Command Queue (ICQ). in AdvInitAsc3550Driver()
4712 asc_dvc->icq_sp = adv_get_next_carrier(asc_dvc); in AdvInitAsc3550Driver()
4713 if (!asc_dvc->icq_sp) { in AdvInitAsc3550Driver()
4714 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; in AdvInitAsc3550Driver()
4721 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa); in AdvInitAsc3550Driver()
4724 * Set-up the RISC->Host Initiator Response Queue (IRQ). in AdvInitAsc3550Driver()
4726 asc_dvc->irq_sp = adv_get_next_carrier(asc_dvc); in AdvInitAsc3550Driver()
4727 if (!asc_dvc->irq_sp) { in AdvInitAsc3550Driver()
4728 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; in AdvInitAsc3550Driver()
4735 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa); in AdvInitAsc3550Driver()
4736 asc_dvc->carr_pending_cnt = 0; in AdvInitAsc3550Driver()
4753 if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) { in AdvInitAsc3550Driver()
4759 if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] == in AdvInitAsc3550Driver()
4784 * Initialize the ASC-38C0800.
4788 * For a non-fatal error return a warning code. If there are no warnings
4809 ushort bios_mem[ASC_MC_BIOSLEN / 2]; /* BIOS RISC Memory 0x40-0x8F. */ in AdvInitAsc38C0800Driver()
4814 if (asc_dvc->err_code != 0) in AdvInitAsc38C0800Driver()
4820 if (asc_dvc->chip_type != ADV_CHIP_ASC38C0800) { in AdvInitAsc38C0800Driver()
4821 asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE; in AdvInitAsc38C0800Driver()
4826 iop_base = asc_dvc->iop_base; in AdvInitAsc38C0800Driver()
4853 * RAM BIST (RAM Built-In Self Test) in AdvInitAsc38C0800Driver()
4856 * Function: Bit 7-6(RW) : RAM mode in AdvInitAsc38C0800Driver()
4858 * Pre-test Mode : 0x40 in AdvInitAsc38C0800Driver()
4861 * Bit 4(RO) : Done bit in AdvInitAsc38C0800Driver()
4862 * Bit 3-0(RO) : Status in AdvInitAsc38C0800Driver()
4874 * LRAM Pre-test in AdvInitAsc38C0800Driver()
4887 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; in AdvInitAsc38C0800Driver()
4895 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; in AdvInitAsc38C0800Driver()
4901 * LRAM Test - It takes about 1.5 ms to run through the test. in AdvInitAsc38C0800Driver()
4913 asc_dvc->bist_err_code = byte; /* for BIOS display message */ in AdvInitAsc38C0800Driver()
4914 asc_dvc->err_code = ASC_IERR_BIST_RAM_TEST; in AdvInitAsc38C0800Driver()
4921 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev); in AdvInitAsc38C0800Driver()
4925 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; in AdvInitAsc38C0800Driver()
4928 if (fw->size < 4) { in AdvInitAsc38C0800Driver()
4930 fw->size, fwname); in AdvInitAsc38C0800Driver()
4932 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; in AdvInitAsc38C0800Driver()
4933 return -EINVAL; in AdvInitAsc38C0800Driver()
4935 chksum = (fw->data[3] << 24) | (fw->data[2] << 16) | in AdvInitAsc38C0800Driver()
4936 (fw->data[1] << 8) | fw->data[0]; in AdvInitAsc38C0800Driver()
4937 asc_dvc->err_code = AdvLoadMicrocode(iop_base, &fw->data[4], in AdvInitAsc38C0800Driver()
4938 fw->size - 4, ADV_38C0800_MEMSIZE, in AdvInitAsc38C0800Driver()
4941 if (asc_dvc->err_code) in AdvInitAsc38C0800Driver()
4969 asc_dvc->cfg->mcode_date); in AdvInitAsc38C0800Driver()
4971 asc_dvc->cfg->mcode_version); in AdvInitAsc38C0800Driver()
4996 if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) { in AdvInitAsc38C0800Driver()
5003 * For ASC-38C0800, set FIFO_THRESH_80B [6:4] bits and START_CTL_TH [3:2] in AdvInitAsc38C0800Driver()
5006 * Note: ASC-38C0800 FIFO threshold has been changed to 256 bytes. in AdvInitAsc38C0800Driver()
5008 * For DMA Errata #4 set the BC_THRESH_ENB bit. in AdvInitAsc38C0800Driver()
5026 if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) { in AdvInitAsc38C0800Driver()
5028 asc_dvc->wdtr_able); in AdvInitAsc38C0800Driver()
5030 asc_dvc->sdtr_able); in AdvInitAsc38C0800Driver()
5043 asc_dvc->cfg->disc_enable); in AdvInitAsc38C0800Driver()
5044 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1); in AdvInitAsc38C0800Driver()
5045 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2); in AdvInitAsc38C0800Driver()
5046 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3); in AdvInitAsc38C0800Driver()
5047 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4); in AdvInitAsc38C0800Driver()
5057 asc_dvc->chip_scsi_id); in AdvInitAsc38C0800Driver()
5075 asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE; in AdvInitAsc38C0800Driver()
5091 asc_dvc->err_code = ASC_IERR_HVD_DEVICE; in AdvInitAsc38C0800Driver()
5100 * 'termination' was set-up in AdvInitFrom38C0800EEPROM() and is ready in AdvInitAsc38C0800Driver()
5103 if ((asc_dvc->cfg->termination & TERM_SE) == 0) { in AdvInitAsc38C0800Driver()
5110 asc_dvc->cfg->termination |= TERM_SE; in AdvInitAsc38C0800Driver()
5115 asc_dvc->cfg->termination |= TERM_SE_HI; in AdvInitAsc38C0800Driver()
5120 if ((asc_dvc->cfg->termination & TERM_LVD) == 0) { in AdvInitAsc38C0800Driver()
5127 asc_dvc->cfg->termination |= TERM_LVD; in AdvInitAsc38C0800Driver()
5144 scsi_cfg1 |= (~asc_dvc->cfg->termination & 0xF0); in AdvInitAsc38C0800Driver()
5170 * MEM_CFG may be accessed as a word or byte, but only bits 0-7 in AdvInitAsc38C0800Driver()
5173 * ASC-38C0800 has 16KB internal memory. in AdvInitAsc38C0800Driver()
5185 ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id)); in AdvInitAsc38C0800Driver()
5190 * Set-up the Host->RISC Initiator Command Queue (ICQ). in AdvInitAsc38C0800Driver()
5193 asc_dvc->icq_sp = adv_get_next_carrier(asc_dvc); in AdvInitAsc38C0800Driver()
5194 if (!asc_dvc->icq_sp) { in AdvInitAsc38C0800Driver()
5196 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; in AdvInitAsc38C0800Driver()
5204 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa); in AdvInitAsc38C0800Driver()
5207 * Set-up the RISC->Host Initiator Response Queue (IRQ). in AdvInitAsc38C0800Driver()
5209 asc_dvc->irq_sp = adv_get_next_carrier(asc_dvc); in AdvInitAsc38C0800Driver()
5210 if (!asc_dvc->irq_sp) { in AdvInitAsc38C0800Driver()
5212 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; in AdvInitAsc38C0800Driver()
5221 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa); in AdvInitAsc38C0800Driver()
5222 asc_dvc->carr_pending_cnt = 0; in AdvInitAsc38C0800Driver()
5239 if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) { in AdvInitAsc38C0800Driver()
5245 if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] == in AdvInitAsc38C0800Driver()
5270 * Initialize the ASC-38C1600.
5274 * For a non-fatal error return a warning code. If there are no warnings
5295 ushort bios_mem[ASC_MC_BIOSLEN / 2]; /* BIOS RISC Memory 0x40-0x8F. */ in AdvInitAsc38C1600Driver()
5300 if (asc_dvc->err_code != 0) { in AdvInitAsc38C1600Driver()
5307 if (asc_dvc->chip_type != ADV_CHIP_ASC38C1600) { in AdvInitAsc38C1600Driver()
5308 asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE; in AdvInitAsc38C1600Driver()
5313 iop_base = asc_dvc->iop_base; in AdvInitAsc38C1600Driver()
5341 * RAM BIST (Built-In Self Test) in AdvInitAsc38C1600Driver()
5344 * Function: Bit 7-6(RW) : RAM mode in AdvInitAsc38C1600Driver()
5346 * Pre-test Mode : 0x40 in AdvInitAsc38C1600Driver()
5349 * Bit 4(RO) : Done bit in AdvInitAsc38C1600Driver()
5350 * Bit 3-0(RO) : Status in AdvInitAsc38C1600Driver()
5362 * LRAM Pre-test in AdvInitAsc38C1600Driver()
5375 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; in AdvInitAsc38C1600Driver()
5383 asc_dvc->err_code = ASC_IERR_BIST_PRE_TEST; in AdvInitAsc38C1600Driver()
5389 * LRAM Test - It takes about 1.5 ms to run through the test. in AdvInitAsc38C1600Driver()
5401 asc_dvc->bist_err_code = byte; /* for BIOS display message */ in AdvInitAsc38C1600Driver()
5402 asc_dvc->err_code = ASC_IERR_BIST_RAM_TEST; in AdvInitAsc38C1600Driver()
5409 err = request_firmware(&fw, fwname, asc_dvc->drv_ptr->dev); in AdvInitAsc38C1600Driver()
5413 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; in AdvInitAsc38C1600Driver()
5416 if (fw->size < 4) { in AdvInitAsc38C1600Driver()
5418 fw->size, fwname); in AdvInitAsc38C1600Driver()
5420 asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; in AdvInitAsc38C1600Driver()
5421 return -EINVAL; in AdvInitAsc38C1600Driver()
5423 chksum = (fw->data[3] << 24) | (fw->data[2] << 16) | in AdvInitAsc38C1600Driver()
5424 (fw->data[1] << 8) | fw->data[0]; in AdvInitAsc38C1600Driver()
5425 asc_dvc->err_code = AdvLoadMicrocode(iop_base, &fw->data[4], in AdvInitAsc38C1600Driver()
5426 fw->size - 4, ADV_38C1600_MEMSIZE, in AdvInitAsc38C1600Driver()
5429 if (asc_dvc->err_code) in AdvInitAsc38C1600Driver()
5457 asc_dvc->cfg->mcode_date); in AdvInitAsc38C1600Driver()
5459 asc_dvc->cfg->mcode_version); in AdvInitAsc38C1600Driver()
5484 if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) { in AdvInitAsc38C1600Driver()
5496 if ((asc_dvc->bios_ctrl & BIOS_CTRL_AIPP_DIS) == 0) { in AdvInitAsc38C1600Driver()
5503 * For ASC-38C1600 use DMA_CFG0 default values: FIFO_THRESH_80B [6:4], in AdvInitAsc38C1600Driver()
5521 if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) { in AdvInitAsc38C1600Driver()
5523 asc_dvc->wdtr_able); in AdvInitAsc38C1600Driver()
5525 asc_dvc->sdtr_able); in AdvInitAsc38C1600Driver()
5538 asc_dvc->cfg->disc_enable); in AdvInitAsc38C1600Driver()
5539 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1); in AdvInitAsc38C1600Driver()
5540 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2); in AdvInitAsc38C1600Driver()
5541 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3); in AdvInitAsc38C1600Driver()
5542 AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4); in AdvInitAsc38C1600Driver()
5552 asc_dvc->chip_scsi_id); in AdvInitAsc38C1600Driver()
5560 * Each ASC-38C1600 function has only two cable detect bits. in AdvInitAsc38C1600Driver()
5571 asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE; in AdvInitAsc38C1600Driver()
5576 * Each ASC-38C1600 function has two connectors. Only an HVD device in AdvInitAsc38C1600Driver()
5584 asc_dvc->err_code |= ASC_IERR_HVD_DEVICE; in AdvInitAsc38C1600Driver()
5589 * Each function in the ASC-38C1600 uses only the SE cable detect and in AdvInitAsc38C1600Driver()
5598 * then 'termination' was set-up in AscInitFrom38C1600EEPROM() and is in AdvInitAsc38C1600Driver()
5601 if ((asc_dvc->cfg->termination & TERM_SE) == 0) { in AdvInitAsc38C1600Driver()
5609 asc_dvc->cfg->termination |= TERM_SE; in AdvInitAsc38C1600Driver()
5613 if (PCI_FUNC(pdev->devfn) == 0) { in AdvInitAsc38C1600Driver()
5614 /* Function 0 - TERM_SE_HI: off, TERM_SE_LO: off */ in AdvInitAsc38C1600Driver()
5616 /* Function 1 - TERM_SE_HI: on, TERM_SE_LO: off */ in AdvInitAsc38C1600Driver()
5617 asc_dvc->cfg->termination |= TERM_SE_HI; in AdvInitAsc38C1600Driver()
5631 scsi_cfg1 |= (~asc_dvc->cfg->termination & TERM_SE); in AdvInitAsc38C1600Driver()
5659 * MEM_CFG may be accessed as a word or byte, but only bits 0-7 in AdvInitAsc38C1600Driver()
5662 * ASC-38C1600 has 32KB internal memory. in AdvInitAsc38C1600Driver()
5664 * XXX - Since ASC38C1600 Rev.3 has a Local RAM failure issue, we come in AdvInitAsc38C1600Driver()
5682 ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id)); in AdvInitAsc38C1600Driver()
5687 * Set-up the Host->RISC Initiator Command Queue (ICQ). in AdvInitAsc38C1600Driver()
5689 asc_dvc->icq_sp = adv_get_next_carrier(asc_dvc); in AdvInitAsc38C1600Driver()
5690 if (!asc_dvc->icq_sp) { in AdvInitAsc38C1600Driver()
5691 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; in AdvInitAsc38C1600Driver()
5700 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa); in AdvInitAsc38C1600Driver()
5702 le32_to_cpu(asc_dvc->icq_sp->carr_pa)); in AdvInitAsc38C1600Driver()
5705 * Set-up the RISC->Host Initiator Response Queue (IRQ). in AdvInitAsc38C1600Driver()
5707 asc_dvc->irq_sp = adv_get_next_carrier(asc_dvc); in AdvInitAsc38C1600Driver()
5708 if (!asc_dvc->irq_sp) { in AdvInitAsc38C1600Driver()
5709 asc_dvc->err_code |= ASC_IERR_NO_CARRIER; in AdvInitAsc38C1600Driver()
5716 AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa); in AdvInitAsc38C1600Driver()
5717 asc_dvc->carr_pending_cnt = 0; in AdvInitAsc38C1600Driver()
5733 if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) { in AdvInitAsc38C1600Driver()
5738 if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] == in AdvInitAsc38C1600Driver()
5767 * ADV_TRUE(1) - Chip re-initialization and SCSI Bus Reset successful.
5768 * ADV_FALSE(0) - Chip re-initialization and SCSI Bus Reset failure.
5779 iop_base = asc_dvc->iop_base; in AdvResetChipAndSB()
5786 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { in AdvResetChipAndSB()
5815 * re-initializing the chip. in AdvResetChipAndSB()
5817 asc_dvc->err_code = 0; in AdvResetChipAndSB()
5818 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { in AdvResetChipAndSB()
5820 } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { in AdvResetChipAndSB()
5843 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { in AdvResetChipAndSB()
5856 * adv_async_callback() - Adv Library asynchronous event callback function.
5892 * adv_isr_callback() - Second Level Interrupt Handler called by AdvISR().
5898 struct asc_board *boardp = adv_dvc_varp->drv_ptr; in adv_isr_callback()
5914 scp = scsi_host_find_tag(boardp->shost, scsiqp->srb_tag); in adv_isr_callback()
5922 ASC_DBG_PRT_CDB(2, scp->cmnd, scp->cmd_len); in adv_isr_callback()
5924 reqp = (adv_req_t *)scp->host_scribble; in adv_isr_callback()
5934 scp->host_scribble = NULL; in adv_isr_callback()
5935 reqp->cmndp = NULL; in adv_isr_callback()
5937 ASC_STATS(boardp->shost, callback); in adv_isr_callback()
5938 ASC_DBG(1, "shost 0x%p\n", boardp->shost); in adv_isr_callback()
5940 sense_addr = le32_to_cpu(scsiqp->sense_addr); in adv_isr_callback()
5941 dma_unmap_single(boardp->dev, sense_addr, in adv_isr_callback()
5947 scp->result = 0; in adv_isr_callback()
5948 switch (scsiqp->done_status) { in adv_isr_callback()
5958 resid_cnt = le32_to_cpu(scsiqp->data_cnt); in adv_isr_callback()
5969 switch (scsiqp->host_status) { in adv_isr_callback()
5971 set_status_byte(scp, scsiqp->scsi_status); in adv_isr_callback()
5972 if (scsiqp->scsi_status == SAM_STAT_CHECK_CONDITION) { in adv_isr_callback()
5974 ASC_DBG_PRT_SENSE(2, scp->sense_buffer, in adv_isr_callback()
5981 ASC_DBG(1, "host_status 0x%x\n", scsiqp->host_status); in adv_isr_callback()
5989 set_status_byte(scp, scsiqp->scsi_status); in adv_isr_callback()
5994 ASC_DBG(1, "done_status 0x%x\n", scsiqp->done_status); in adv_isr_callback()
5995 set_status_byte(scp, scsiqp->scsi_status); in adv_isr_callback()
6005 if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 && in adv_isr_callback()
6006 scsiqp->done_status == QD_NO_ERROR && in adv_isr_callback()
6007 scsiqp->host_status == QHSTA_NO_ERROR) { in adv_isr_callback()
6008 boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id); in adv_isr_callback()
6016 while ((sgblkp = reqp->sgblkp) != NULL) { in adv_isr_callback()
6018 reqp->sgblkp = sgblkp->next_sgblkp; in adv_isr_callback()
6020 dma_pool_free(boardp->adv_sgblk_pool, sgblkp, in adv_isr_callback()
6021 sgblkp->sg_addr); in adv_isr_callback()
6031 * The function disables and re-enables interrupts.
6043 * ADV_TRUE(1) - interrupt was pending
6044 * ADV_FALSE(0) - no interrupt was pending
6055 iop_base = asc_dvc->iop_base; in AdvISR()
6075 if (asc_dvc->chip_type == ADV_CHIP_ASC3550 || in AdvISR()
6076 asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { in AdvISR()
6078 asc_dvc->carr_pending_cnt != 0) { in AdvISR()
6081 if (asc_dvc->chip_type == ADV_CHIP_ASC3550) { in AdvISR()
6096 le32_to_cpu(asc_dvc->irq_sp->next_vpa)) & ADV_RQ_DONE) != 0) { in AdvISR()
6106 u32 pa_offset = le32_to_cpu(asc_dvc->irq_sp->areq_vpa); in AdvISR()
6108 asc_dvc->irq_sp, pa_offset); in AdvISR()
6110 scsiq = &reqp->scsi_req_q; in AdvISR()
6118 scsiq->done_status = QD_NO_ERROR; in AdvISR()
6119 scsiq->host_status = scsiq->scsi_status = 0; in AdvISR()
6120 scsiq->data_cnt = 0L; in AdvISR()
6128 free_carrp = asc_dvc->irq_sp; in AdvISR()
6129 asc_dvc->irq_sp = adv_get_carrier(asc_dvc, in AdvISR()
6132 free_carrp->next_vpa = asc_dvc->carr_freelist->carr_va; in AdvISR()
6133 asc_dvc->carr_freelist = free_carrp; in AdvISR()
6134 asc_dvc->carr_pending_cnt--; in AdvISR()
6139 scsiq->cntl = 0; in AdvISR()
6159 if (asc_dvc->err_code == 0) { in AscSetLibErrorCode()
6160 asc_dvc->err_code = err_code; in AscSetLibErrorCode()
6161 AscWriteLramWord(asc_dvc->iop_base, ASCV_ASCDVC_ERR_CODE_W, in AscSetLibErrorCode()
6203 period_table = asc_dvc->sdtr_period_tbl; in AscGetSynPeriodIndex()
6204 max_index = (int)asc_dvc->max_sdtr_index; in AscGetSynPeriodIndex()
6205 min_index = (int)asc_dvc->min_sdtr_index; in AscGetSynPeriodIndex()
6207 for (i = min_index; i < (max_index - 1); i++) { in AscGetSynPeriodIndex()
6221 PortAddr iop_base = asc_dvc->iop_base; in AscMsgOutSDTR()
6232 if (sdtr_period_index <= asc_dvc->max_sdtr_index) { in AscMsgOutSDTR()
6236 return ((sdtr_period_index << 4) | sdtr_offset); in AscMsgOutSDTR()
6253 if (sdtr_period_ix > asc_dvc->max_sdtr_index) in AscCalSDTRData()
6255 byte = (sdtr_period_ix << 4) | (syn_offset & ASC_SYN_MAX_OFFSET); in AscCalSDTRData()
6315 BUG_ON(!asc_dvc->drv_ptr); in AscIsrChipHalted()
6316 boardp = asc_dvc->drv_ptr; in AscIsrChipHalted()
6318 iop_base = asc_dvc->iop_base; in AscIsrChipHalted()
6330 if (asc_dvc->pci_fix_asyn_xfer & target_id) { in AscIsrChipHalted()
6336 if (asc_dvc->pci_fix_asyn_xfer & target_id) { in AscIsrChipHalted()
6338 boardp->sdtr_data[tid_no] = 0; in AscIsrChipHalted()
6343 if (asc_dvc->pci_fix_asyn_xfer & target_id) { in AscIsrChipHalted()
6345 boardp->sdtr_data[tid_no] = asyn_sdtr; in AscIsrChipHalted()
6365 asc_dvc->sdtr_period_tbl[asc_dvc->min_sdtr_index]) in AscIsrChipHalted()
6367 asc_dvc->sdtr_period_tbl[asc_dvc-> in AscIsrChipHalted()
6371 asc_dvc->sdtr_period_tbl[asc_dvc-> in AscIsrChipHalted()
6381 asc_dvc->init_sdtr &= ~target_id; in AscIsrChipHalted()
6382 asc_dvc->sdtr_done &= ~target_id; in AscIsrChipHalted()
6385 boardp->sdtr_data[tid_no] = asyn_sdtr; in AscIsrChipHalted()
6391 asc_dvc->init_sdtr &= ~target_id; in AscIsrChipHalted()
6392 asc_dvc->sdtr_done &= ~target_id; in AscIsrChipHalted()
6397 asc_dvc->sdtr_done |= target_id; in AscIsrChipHalted()
6398 asc_dvc->init_sdtr |= target_id; in AscIsrChipHalted()
6399 asc_dvc->pci_fix_asyn_xfer &= in AscIsrChipHalted()
6408 boardp->sdtr_data[tid_no] = sdtr_data; in AscIsrChipHalted()
6414 asc_dvc->pci_fix_asyn_xfer &= in AscIsrChipHalted()
6423 boardp->sdtr_data[tid_no] = sdtr_data; in AscIsrChipHalted()
6424 asc_dvc->sdtr_done |= target_id; in AscIsrChipHalted()
6425 asc_dvc->init_sdtr |= target_id; in AscIsrChipHalted()
6470 if ((asc_dvc->init_sdtr & target_id) != 0) { in AscIsrChipHalted()
6472 asc_dvc->sdtr_done &= ~target_id; in AscIsrChipHalted()
6477 asc_dvc-> in AscIsrChipHalted()
6478 sdtr_period_tbl[(sdtr_data >> 4) & in AscIsrChipHalted()
6479 (uchar)(asc_dvc-> in AscIsrChipHalted()
6480 max_sdtr_index - in AscIsrChipHalted()
6494 if ((asc_dvc->pci_fix_asyn_xfer & target_id) in AscIsrChipHalted()
6495 && !(asc_dvc->pci_fix_asyn_xfer_always & target_id) in AscIsrChipHalted()
6533 asc_dvc->init_sdtr &= ~target_id; in AscIsrChipHalted()
6534 asc_dvc->sdtr_done &= ~target_id; in AscIsrChipHalted()
6536 boardp->sdtr_data[tid_no] = asyn_sdtr; in AscIsrChipHalted()
6554 if ((cur_dvc_qng > 0) && (asc_dvc->cur_dvc_qng[tid_no] > 0)) { in AscIsrChipHalted()
6561 asc_dvc->queue_full_or_busy |= target_id; in AscIsrChipHalted()
6565 cur_dvc_qng -= 1; in AscIsrChipHalted()
6566 asc_dvc->max_dvc_qng[tid_no] = in AscIsrChipHalted()
6581 boardp->queue_full |= target_id; in AscIsrChipHalted()
6582 boardp->queue_full_cnt[tid_no] = in AscIsrChipHalted()
6636 scsiq->q_status = (uchar)_val; in _AscCopyLramScsiDoneQ()
6637 scsiq->q_no = (uchar)(_val >> 8); in _AscCopyLramScsiDoneQ()
6640 scsiq->cntl = (uchar)_val; in _AscCopyLramScsiDoneQ()
6645 scsiq->sense_len = (uchar)_val; in _AscCopyLramScsiDoneQ()
6646 scsiq->extra_bytes = (uchar)(_val >> 8); in _AscCopyLramScsiDoneQ()
6651 scsiq->remain_bytes = (((u32)AscReadLramWord(iop_base, in _AscCopyLramScsiDoneQ()
6659 scsiq->remain_bytes += AscReadLramWord(iop_base, in _AscCopyLramScsiDoneQ()
6663 scsiq->remain_bytes &= max_dma_count; in _AscCopyLramScsiDoneQ()
6668 * asc_isr_callback() - Second Level Interrupt Handler called by AscISR().
6674 struct asc_board *boardp = asc_dvc_varp->drv_ptr; in asc_isr_callback()
6684 srb_tag = qdonep->d2.srb_tag - 1; in asc_isr_callback()
6685 scp = scsi_host_find_tag(boardp->shost, srb_tag); in asc_isr_callback()
6689 ASC_DBG_PRT_CDB(2, scp->cmnd, scp->cmd_len); in asc_isr_callback()
6691 ASC_STATS(boardp->shost, callback); in asc_isr_callback()
6693 dma_unmap_single(boardp->dev, advansys_cmd(scp)->dma_handle, in asc_isr_callback()
6698 scp->result = 0; in asc_isr_callback()
6699 switch (qdonep->d3.done_stat) { in asc_isr_callback()
6709 if (scsi_bufflen(scp) != 0 && qdonep->remain_bytes != 0 && in asc_isr_callback()
6710 qdonep->remain_bytes <= scsi_bufflen(scp)) { in asc_isr_callback()
6712 (unsigned)qdonep->remain_bytes); in asc_isr_callback()
6713 scsi_set_resid(scp, qdonep->remain_bytes); in asc_isr_callback()
6719 switch (qdonep->d3.host_stat) { in asc_isr_callback()
6721 set_status_byte(scp, qdonep->d3.scsi_stat); in asc_isr_callback()
6722 if (qdonep->d3.scsi_stat == SAM_STAT_CHECK_CONDITION) { in asc_isr_callback()
6724 ASC_DBG_PRT_SENSE(2, scp->sense_buffer, in asc_isr_callback()
6731 ASC_DBG(1, "host_stat 0x%x\n", qdonep->d3.host_stat); in asc_isr_callback()
6739 set_status_byte(scp, qdonep->d3.scsi_stat); in asc_isr_callback()
6744 ASC_DBG(1, "done_stat 0x%x\n", qdonep->d3.done_stat); in asc_isr_callback()
6745 set_status_byte(scp, qdonep->d3.scsi_stat); in asc_isr_callback()
6755 if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 && in asc_isr_callback()
6756 qdonep->d3.done_stat == QD_NO_ERROR && in asc_isr_callback()
6757 qdonep->d3.host_stat == QHSTA_NO_ERROR) { in asc_isr_callback()
6758 boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id); in asc_isr_callback()
6783 iop_base = asc_dvc->iop_base; in AscIsrQDone()
6794 asc_dvc->max_dma_count); in AscIsrQDone()
6798 (uchar)(scsiq-> in AscIsrQDone()
6801 tid_no = ASC_TIX_TO_TID(scsiq->d2.target_ix); in AscIsrQDone()
6802 target_id = ASC_TIX_TO_TARGET_ID(scsiq->d2.target_ix); in AscIsrQDone()
6803 if ((scsiq->cntl & QC_SG_HEAD) != 0) { in AscIsrQDone()
6815 scsiq->d3.done_stat = QD_WITH_ERROR; in AscIsrQDone()
6816 scsiq->d3.host_stat = in AscIsrQDone()
6828 if (asc_dvc->queue_full_or_busy & target_id) { in AscIsrQDone()
6833 scsiq->d2. in AscIsrQDone()
6835 if (cur_target_qng < asc_dvc->max_dvc_qng[tid_no]) { in AscIsrQDone()
6842 asc_dvc->queue_full_or_busy &= ~target_id; in AscIsrQDone()
6845 if (asc_dvc->cur_total_qng >= n_q_used) { in AscIsrQDone()
6846 asc_dvc->cur_total_qng -= n_q_used; in AscIsrQDone()
6847 if (asc_dvc->cur_dvc_qng[tid_no] != 0) { in AscIsrQDone()
6848 asc_dvc->cur_dvc_qng[tid_no]--; in AscIsrQDone()
6852 scsiq->d3.done_stat = QD_WITH_ERROR; in AscIsrQDone()
6855 if ((scsiq->d2.srb_tag == 0UL) || in AscIsrQDone()
6856 ((scsiq->q_status & QS_ABORTED) != 0)) { in AscIsrQDone()
6858 } else if (scsiq->q_status == QS_DONE) { in AscIsrQDone()
6864 if (scsiq->extra_bytes != 0) { in AscIsrQDone()
6865 scsiq->remain_bytes += scsiq->extra_bytes; in AscIsrQDone()
6867 if (scsiq->d3.done_stat == QD_WITH_ERROR) { in AscIsrQDone()
6868 if (scsiq->d3.host_stat == in AscIsrQDone()
6870 if ((scsiq-> in AscIsrQDone()
6873 scsiq->d3.done_stat = in AscIsrQDone()
6875 scsiq->d3.host_stat = in AscIsrQDone()
6878 scsiq->d3.done_stat = in AscIsrQDone()
6880 scsiq->d3.host_stat = in AscIsrQDone()
6883 } else if (scsiq->d3.host_stat == in AscIsrQDone()
6897 if ((scsiq->cntl & QC_NO_CALLBACK) == 0) { in AscIsrQDone()
6904 asc_dvc->unit_not_ready &= ~target_id; in AscIsrQDone()
6905 if (scsiq->d3.done_stat != QD_NO_ERROR) { in AscIsrQDone()
6906 asc_dvc->start_motor &= in AscIsrQDone()
6915 if ((scsiq->cntl & QC_NO_CALLBACK) == 0) { in AscIsrQDone()
6935 iop_base = asc_dvc->iop_base; in AscISR()
6941 if ((asc_dvc->init_state & ASC_INIT_STATE_END_LOAD_MC) == 0) { in AscISR()
6944 if (asc_dvc->in_critical_cnt != 0) { in AscISR()
6948 if (asc_dvc->is_in_int) { in AscISR()
6952 asc_dvc->is_in_int = true; in AscISR()
6958 if (!(asc_dvc->bus_type & (ASC_IS_VL | ASC_IS_EISA))) { in AscISR()
6961 asc_dvc->sdtr_done = 0; in AscISR()
6964 CSW_SCSI_RESET_ACTIVE) && (i-- > 0)) { in AscISR()
6987 if ((asc_dvc->dvc_cntl & ASC_CNTL_INT_MULTI_Q) != 0) { in AscISR()
7006 asc_dvc->is_in_int = false; in AscISR()
7021 struct Scsi_Host *shost = scp->device->host; in advansys_reset()
7034 ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; in advansys_reset()
7041 if (asc_dvc->err_code || !asc_dvc->overrun_dma) { in advansys_reset()
7043 "0x%x, status: 0x%x\n", asc_dvc->err_code, in advansys_reset()
7060 ADV_DVC_VAR *adv_dvc = &boardp->dvc_var.adv_dvc_var; in advansys_reset()
7077 spin_lock_irqsave(shost->host_lock, flags); in advansys_reset()
7079 spin_unlock_irqrestore(shost->host_lock, flags); in advansys_reset()
7102 struct asc_board *boardp = shost_priv(sdev->host); in advansys_biosparam()
7105 ASC_STATS(sdev->host, biosparam); in advansys_biosparam()
7107 if ((boardp->dvc_var.asc_dvc_var.dvc_cntl & in advansys_biosparam()
7116 if ((boardp->dvc_var.adv_dvc_var.bios_ctrl & in advansys_biosparam()
7131 * First-level interrupt handler.
7143 spin_lock_irqsave(shost->host_lock, flags); in advansys_interrupt()
7145 if (AscIsIntPending(shost->io_port)) { in advansys_interrupt()
7149 AscISR(&boardp->dvc_var.asc_dvc_var); in advansys_interrupt()
7153 if (AdvISR(&boardp->dvc_var.adv_dvc_var)) { in advansys_interrupt()
7158 spin_unlock_irqrestore(shost->host_lock, flags); in advansys_interrupt()
7200 char type = sdev->type; in AscAsyncFix()
7201 ASC_SCSI_BIT_ID_TYPE tid_bits = 1 << sdev->id; in AscAsyncFix()
7203 if (!(asc_dvc->bug_fix_cntl & ASC_BUG_FIX_ASYN_USE_SYN)) in AscAsyncFix()
7205 if (asc_dvc->init_sdtr & tid_bits) in AscAsyncFix()
7208 if ((type == TYPE_ROM) && (strncmp(sdev->vendor, "HP ", 3) == 0)) in AscAsyncFix()
7209 asc_dvc->pci_fix_asyn_xfer_always |= tid_bits; in AscAsyncFix()
7211 asc_dvc->pci_fix_asyn_xfer |= tid_bits; in AscAsyncFix()
7214 asc_dvc->pci_fix_asyn_xfer &= ~tid_bits; in AscAsyncFix()
7216 if (asc_dvc->pci_fix_asyn_xfer & tid_bits) in AscAsyncFix()
7217 AscSetRunChipSynRegAtID(asc_dvc->iop_base, sdev->id, in AscAsyncFix()
7224 ASC_SCSI_BIT_ID_TYPE tid_bit = 1 << sdev->id; in advansys_narrow_slave_configure()
7225 ASC_SCSI_BIT_ID_TYPE orig_use_tagged_qng = asc_dvc->use_tagged_qng; in advansys_narrow_slave_configure()
7227 if (sdev->lun == 0) { in advansys_narrow_slave_configure()
7228 ASC_SCSI_BIT_ID_TYPE orig_init_sdtr = asc_dvc->init_sdtr; in advansys_narrow_slave_configure()
7229 if ((asc_dvc->cfg->sdtr_enable & tid_bit) && sdev->sdtr) { in advansys_narrow_slave_configure()
7230 asc_dvc->init_sdtr |= tid_bit; in advansys_narrow_slave_configure()
7232 asc_dvc->init_sdtr &= ~tid_bit; in advansys_narrow_slave_configure()
7235 if (orig_init_sdtr != asc_dvc->init_sdtr) in advansys_narrow_slave_configure()
7239 if (sdev->tagged_supported) { in advansys_narrow_slave_configure()
7240 if (asc_dvc->cfg->cmd_qng_enabled & tid_bit) { in advansys_narrow_slave_configure()
7241 if (sdev->lun == 0) { in advansys_narrow_slave_configure()
7242 asc_dvc->cfg->can_tagged_qng |= tid_bit; in advansys_narrow_slave_configure()
7243 asc_dvc->use_tagged_qng |= tid_bit; in advansys_narrow_slave_configure()
7246 asc_dvc->max_dvc_qng[sdev->id]); in advansys_narrow_slave_configure()
7249 if (sdev->lun == 0) { in advansys_narrow_slave_configure()
7250 asc_dvc->cfg->can_tagged_qng &= ~tid_bit; in advansys_narrow_slave_configure()
7251 asc_dvc->use_tagged_qng &= ~tid_bit; in advansys_narrow_slave_configure()
7255 if ((sdev->lun == 0) && in advansys_narrow_slave_configure()
7256 (orig_use_tagged_qng != asc_dvc->use_tagged_qng)) { in advansys_narrow_slave_configure()
7257 AscWriteLramByte(asc_dvc->iop_base, ASCV_DISC_ENABLE_B, in advansys_narrow_slave_configure()
7258 asc_dvc->cfg->disc_enable); in advansys_narrow_slave_configure()
7259 AscWriteLramByte(asc_dvc->iop_base, ASCV_USE_TAGGED_QNG_B, in advansys_narrow_slave_configure()
7260 asc_dvc->use_tagged_qng); in advansys_narrow_slave_configure()
7261 AscWriteLramByte(asc_dvc->iop_base, ASCV_CAN_TAGGED_QNG_B, in advansys_narrow_slave_configure()
7262 asc_dvc->cfg->can_tagged_qng); in advansys_narrow_slave_configure()
7264 asc_dvc->max_dvc_qng[sdev->id] = in advansys_narrow_slave_configure()
7265 asc_dvc->cfg->max_tag_qng[sdev->id]; in advansys_narrow_slave_configure()
7266 AscWriteLramByte(asc_dvc->iop_base, in advansys_narrow_slave_configure()
7267 (ushort)(ASCV_MAX_DVC_QNG_BEG + sdev->id), in advansys_narrow_slave_configure()
7268 asc_dvc->max_dvc_qng[sdev->id]); in advansys_narrow_slave_configure()
7342 AdvReadWordLram(iop_base, ASC_MC_PPR_ABLE, adv_dvc->ppr_able); in advansys_wide_enable_ppr()
7343 adv_dvc->ppr_able |= tidmask; in advansys_wide_enable_ppr()
7344 AdvWriteWordLram(iop_base, ASC_MC_PPR_ABLE, adv_dvc->ppr_able); in advansys_wide_enable_ppr()
7350 AdvPortAddr iop_base = adv_dvc->iop_base; in advansys_wide_slave_configure()
7351 unsigned short tidmask = 1 << sdev->id; in advansys_wide_slave_configure()
7353 if (sdev->lun == 0) { in advansys_wide_slave_configure()
7360 if ((adv_dvc->wdtr_able & tidmask) && sdev->wdtr) in advansys_wide_slave_configure()
7362 if ((adv_dvc->sdtr_able & tidmask) && sdev->sdtr) in advansys_wide_slave_configure()
7364 if (adv_dvc->chip_type == ADV_CHIP_ASC38C1600 && sdev->ppr) in advansys_wide_slave_configure()
7373 if ((adv_dvc->tagqng_able & tidmask) && in advansys_wide_slave_configure()
7374 sdev->tagged_supported) { in advansys_wide_slave_configure()
7381 ASC_MC_NUMBER_OF_MAX_CMD + sdev->id, in advansys_wide_slave_configure()
7382 adv_dvc->max_dvc_qng); in advansys_wide_slave_configure()
7386 if ((adv_dvc->tagqng_able & tidmask) && sdev->tagged_supported) in advansys_wide_slave_configure()
7387 scsi_change_queue_depth(sdev, adv_dvc->max_dvc_qng); in advansys_wide_slave_configure()
7396 struct asc_board *boardp = shost_priv(sdev->host); in advansys_slave_configure()
7400 &boardp->dvc_var.asc_dvc_var); in advansys_slave_configure()
7403 &boardp->dvc_var.adv_dvc_var); in advansys_slave_configure()
7410 struct asc_board *board = shost_priv(scp->device->host); in asc_get_sense_buffer_dma()
7413 acmd->dma_handle = dma_map_single(board->dev, scp->sense_buffer, in asc_get_sense_buffer_dma()
7415 if (dma_mapping_error(board->dev, acmd->dma_handle)) { in asc_get_sense_buffer_dma()
7419 return cpu_to_le32(acmd->dma_handle); in asc_get_sense_buffer_dma()
7425 struct asc_dvc_var *asc_dvc = &boardp->dvc_var.asc_dvc_var; in asc_build_req()
7435 srb_tag = scsi_cmd_to_rq(scp)->tag + 1; in asc_build_req()
7436 asc_scsi_q->q2.srb_tag = srb_tag; in asc_build_req()
7441 asc_scsi_q->cdbptr = &scp->cmnd[0]; in asc_build_req()
7442 asc_scsi_q->q2.cdb_len = scp->cmd_len; in asc_build_req()
7443 asc_scsi_q->q1.target_id = ASC_TID_TO_TARGET_ID(scp->device->id); in asc_build_req()
7444 asc_scsi_q->q1.target_lun = scp->device->lun; in asc_build_req()
7445 asc_scsi_q->q2.target_ix = in asc_build_req()
7446 ASC_TIDLUN_TO_IX(scp->device->id, scp->device->lun); in asc_build_req()
7447 asc_scsi_q->q1.sense_addr = asc_get_sense_buffer_dma(scp); in asc_build_req()
7448 asc_scsi_q->q1.sense_len = SCSI_SENSE_BUFFERSIZE; in asc_build_req()
7449 if (!asc_scsi_q->q1.sense_addr) in asc_build_req()
7463 if ((asc_dvc->cur_dvc_qng[scp->device->id] > 0) && in asc_build_req()
7464 (boardp->reqcnt[scp->device->id] % 255) == 0) { in asc_build_req()
7465 asc_scsi_q->q2.tag_code = ORDERED_QUEUE_TAG; in asc_build_req()
7467 asc_scsi_q->q2.tag_code = SIMPLE_QUEUE_TAG; in asc_build_req()
7480 if (use_sg > scp->device->host->sg_tablesize) { in asc_build_req()
7483 scp->device->host->sg_tablesize); in asc_build_req()
7497 asc_scsi_q->q1.cntl |= QC_SG_HEAD; in asc_build_req()
7498 asc_scsi_q->sg_head = asc_sg_head; in asc_build_req()
7499 asc_scsi_q->q1.data_cnt = 0; in asc_build_req()
7500 asc_scsi_q->q1.data_addr = 0; in asc_build_req()
7502 asc_sg_head->entry_cnt = asc_scsi_q->q1.sg_queue_cnt = use_sg; in asc_build_req()
7503 ASC_STATS_ADD(scp->device->host, xfer_elem, in asc_build_req()
7504 asc_sg_head->entry_cnt); in asc_build_req()
7507 * Convert scatter-gather list into ASC_SG_HEAD list. in asc_build_req()
7510 asc_sg_head->sg_list[sgcnt].addr = in asc_build_req()
7512 asc_sg_head->sg_list[sgcnt].bytes = in asc_build_req()
7514 ASC_STATS_ADD(scp->device->host, xfer_sect, in asc_build_req()
7519 ASC_STATS(scp->device->host, xfer_cnt); in asc_build_req()
7522 ASC_DBG_PRT_CDB(1, scp->cmnd, scp->cmd_len); in asc_build_req()
7528 * Build scatter-gather list for Adv Library (Wide Board).
7531 * if the total number of scatter-gather elements exceeds
7536 * ADV_SUCCESS(1) - SG List successfully created
7537 * ADV_ERROR(-1) - SG List creation failed
7554 reqp->sgblkp = NULL; in adv_get_sglist()
7560 * (15) scatter-gather elements. in adv_get_sglist()
7562 sgblkp = dma_pool_alloc(boardp->adv_sgblk_pool, GFP_ATOMIC, in adv_get_sglist()
7566 ASC_STATS(scp->device->host, adv_build_nosg); in adv_get_sglist()
7572 while ((sgblkp = reqp->sgblkp) != NULL) { in adv_get_sglist()
7574 reqp->sgblkp = sgblkp->next_sgblkp; in adv_get_sglist()
7575 sgblkp->next_sgblkp = NULL; in adv_get_sglist()
7576 dma_pool_free(boardp->adv_sgblk_pool, sgblkp, in adv_get_sglist()
7577 sgblkp->sg_addr); in adv_get_sglist()
7582 sgblkp->sg_addr = sgblk_paddr; in adv_get_sglist()
7583 sgblkp->next_sgblkp = NULL; in adv_get_sglist()
7584 sg_block = &sgblkp->sg_block; in adv_get_sglist()
7590 if (reqp->sgblkp == NULL) { in adv_get_sglist()
7591 /* Request's first scatter-gather block. */ in adv_get_sglist()
7592 reqp->sgblkp = sgblkp; in adv_get_sglist()
7598 scsiqp->sg_list_ptr = sg_block; in adv_get_sglist()
7599 scsiqp->sg_real_addr = cpu_to_le32(sgblk_paddr); in adv_get_sglist()
7601 /* Request's second or later scatter-gather block. */ in adv_get_sglist()
7602 prev_sgblkp->next_sgblkp = sgblkp; in adv_get_sglist()
7608 prev_sg_block->sg_ptr = cpu_to_le32(sgblk_paddr); in adv_get_sglist()
7612 sg_block->sg_list[i].sg_addr = in adv_get_sglist()
7614 sg_block->sg_list[i].sg_count = in adv_get_sglist()
7616 ASC_STATS_ADD(scp->device->host, xfer_sect, in adv_get_sglist()
7619 if (--sg_elem_cnt == 0) { in adv_get_sglist()
7621 * Last ADV_SG_BLOCK and scatter-gather entry. in adv_get_sglist()
7623 sg_block->sg_cnt = i + 1; in adv_get_sglist()
7624 sg_block->sg_ptr = 0L; /* Last ADV_SG_BLOCK in list. */ in adv_get_sglist()
7629 sg_block->sg_cnt = NO_OF_SG_PER_BLOCK; in adv_get_sglist()
7641 * Multi-byte fields in the ADV_SCSI_REQ_Q that are used by the
7643 * to little-endian order.
7649 u32 srb_tag = scsi_cmd_to_rq(scp)->tag; in adv_build_req()
7660 reqp = &boardp->adv_reqp[srb_tag]; in adv_build_req()
7661 if (reqp->cmndp && reqp->cmndp != scp ) { in adv_build_req()
7663 ASC_STATS(scp->device->host, adv_build_noreq); in adv_build_req()
7667 reqp->req_addr = boardp->adv_reqp_addr + (srb_tag * sizeof(adv_req_t)); in adv_build_req()
7669 scsiqp = &reqp->scsi_req_q; in adv_build_req()
7674 scsiqp->cntl = scsiqp->scsi_cntl = scsiqp->done_status = 0; in adv_build_req()
7679 scsiqp->srb_tag = srb_tag; in adv_build_req()
7684 reqp->cmndp = scp; in adv_build_req()
7685 scp->host_scribble = (void *)reqp; in adv_build_req()
7692 scsiqp->cdb_len = scp->cmd_len; in adv_build_req()
7694 memcpy(scsiqp->cdb, scp->cmnd, scp->cmd_len < 12 ? scp->cmd_len : 12); in adv_build_req()
7695 /* Copy last 4 CDB bytes, if present, to cdb16[]. */ in adv_build_req()
7696 if (scp->cmd_len > 12) { in adv_build_req()
7697 int cdb16_len = scp->cmd_len - 12; in adv_build_req()
7699 memcpy(scsiqp->cdb16, &scp->cmnd[12], cdb16_len); in adv_build_req()
7702 scsiqp->target_id = scp->device->id; in adv_build_req()
7703 scsiqp->target_lun = scp->device->lun; in adv_build_req()
7705 sense_addr = dma_map_single(boardp->dev, scp->sense_buffer, in adv_build_req()
7707 if (dma_mapping_error(boardp->dev, sense_addr)) { in adv_build_req()
7709 ASC_STATS(scp->device->host, adv_build_noreq); in adv_build_req()
7712 scsiqp->sense_addr = cpu_to_le32(sense_addr); in adv_build_req()
7713 scsiqp->sense_len = SCSI_SENSE_BUFFERSIZE; in adv_build_req()
7720 ASC_STATS(scp->device->host, adv_build_noreq); in adv_build_req()
7723 /* Zero-length transfer */ in adv_build_req()
7724 reqp->sgblkp = NULL; in adv_build_req()
7725 scsiqp->data_cnt = 0; in adv_build_req()
7727 scsiqp->data_addr = 0; in adv_build_req()
7728 scsiqp->sg_list_ptr = NULL; in adv_build_req()
7729 scsiqp->sg_real_addr = 0; in adv_build_req()
7734 scp->device->host->sg_tablesize); in adv_build_req()
7737 reqp->cmndp = NULL; in adv_build_req()
7738 scp->host_scribble = NULL; in adv_build_req()
7743 scsiqp->data_cnt = cpu_to_le32(scsi_bufflen(scp)); in adv_build_req()
7749 reqp->cmndp = NULL; in adv_build_req()
7750 scp->host_scribble = NULL; in adv_build_req()
7755 ASC_STATS_ADD(scp->device->host, xfer_elem, use_sg); in adv_build_req()
7758 ASC_STATS(scp->device->host, xfer_cnt); in adv_build_req()
7761 ASC_DBG_PRT_CDB(1, scp->cmnd, scp->cmd_len); in adv_build_req()
7772 n_sg_list_qs = ((sg_list - 1) / ASC_SG_LIST_PER_Q); in AscSgListToQueue()
7773 if (((sg_list - 1) % ASC_SG_LIST_PER_Q) != 0) in AscSgListToQueue()
7788 if ((asc_dvc->unit_not_ready & target_id) || in AscGetNumOfFreeQueue()
7789 (asc_dvc->queue_full_or_busy & target_id)) { in AscGetNumOfFreeQueue()
7793 cur_used_qs = (uint) asc_dvc->cur_total_qng + in AscGetNumOfFreeQueue()
7794 (uint) asc_dvc->last_q_shortage + (uint) ASC_MIN_FREE_Q; in AscGetNumOfFreeQueue()
7796 cur_used_qs = (uint) asc_dvc->cur_total_qng + in AscGetNumOfFreeQueue()
7799 if ((uint) (cur_used_qs + n_qs) <= (uint) asc_dvc->max_total_qng) { in AscGetNumOfFreeQueue()
7800 cur_free_qs = (uint) asc_dvc->max_total_qng - cur_used_qs; in AscGetNumOfFreeQueue()
7801 if (asc_dvc->cur_dvc_qng[tid_no] >= in AscGetNumOfFreeQueue()
7802 asc_dvc->max_dvc_qng[tid_no]) { in AscGetNumOfFreeQueue()
7808 if ((n_qs > asc_dvc->last_q_shortage) in AscGetNumOfFreeQueue()
7809 && (n_qs <= (asc_dvc->max_total_qng - ASC_MIN_FREE_Q))) { in AscGetNumOfFreeQueue()
7810 asc_dvc->last_q_shortage = n_qs; in AscGetNumOfFreeQueue()
7863 if (i == 4 || i == 20) { in DvcPutScsiQ()
7880 iop_base = asc_dvc->iop_base; in AscPutReadyQueue()
7881 if (((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) && in AscPutReadyQueue()
7882 ((asc_dvc->sdtr_done & scsiq->q1.target_id) == 0)) { in AscPutReadyQueue()
7883 tid_no = ASC_TIX_TO_TID(scsiq->q2.target_ix); in AscPutReadyQueue()
7886 (sdtr_data >> 4) & (asc_dvc->max_sdtr_index - 1); in AscPutReadyQueue()
7889 asc_dvc->sdtr_period_tbl[syn_period_ix], in AscPutReadyQueue()
7891 scsiq->q1.cntl |= QC_MSG_OUT; in AscPutReadyQueue()
7894 if ((scsiq->q1.target_id & asc_dvc->use_tagged_qng) == 0) { in AscPutReadyQueue()
7895 scsiq->q2.tag_code &= ~SIMPLE_QUEUE_TAG; in AscPutReadyQueue()
7897 scsiq->q1.status = QS_FREE; in AscPutReadyQueue()
7900 (uchar *)scsiq->cdbptr, scsiq->q2.cdb_len >> 1); in AscPutReadyQueue()
7904 (uchar *)&scsiq->q1.cntl, in AscPutReadyQueue()
7905 ((sizeof(ASC_SCSIQ_1) + sizeof(ASC_SCSIQ_2)) / 2) - 1); in AscPutReadyQueue()
7908 (ushort)(((ushort)scsiq->q1. in AscPutReadyQueue()
7929 iop_base = asc_dvc->iop_base; in AscPutReadySgListQueue()
7930 sg_head = scsiq->sg_head; in AscPutReadySgListQueue()
7931 saved_data_addr = scsiq->q1.data_addr; in AscPutReadySgListQueue()
7932 saved_data_cnt = scsiq->q1.data_cnt; in AscPutReadySgListQueue()
7933 scsiq->q1.data_addr = cpu_to_le32(sg_head->sg_list[0].addr); in AscPutReadySgListQueue()
7934 scsiq->q1.data_cnt = cpu_to_le32(sg_head->sg_list[0].bytes); in AscPutReadySgListQueue()
7940 sg_entry_cnt = sg_head->entry_cnt - 1; in AscPutReadySgListQueue()
7943 scsiq->q1.cntl |= QC_SG_HEAD; in AscPutReadySgListQueue()
7946 scsiq->q1.sg_queue_cnt = sg_head->queue_cnt; in AscPutReadySgListQueue()
7949 for (i = 0; i < sg_head->queue_cnt; i++) { in AscPutReadySgListQueue()
7953 sg_entry_cnt -= ASC_SG_LIST_PER_Q; in AscPutReadySgListQueue()
7961 ASC_SG_LIST_PER_Q - 1; in AscPutReadySgListQueue()
7963 ASC_SG_LIST_PER_Q - 1; in AscPutReadySgListQueue()
7974 sg_entry_cnt - 1; in AscPutReadySgListQueue()
7976 sg_entry_cnt - 1; in AscPutReadySgListQueue()
7991 (uchar *)&sg_head-> in AscPutReadySgListQueue()
7995 scsiq->next_sg_index = sg_index; in AscPutReadySgListQueue()
7998 scsiq->q1.cntl &= ~QC_SG_HEAD; in AscPutReadySgListQueue()
8001 scsiq->q1.data_addr = saved_data_addr; in AscPutReadySgListQueue()
8002 scsiq->q1.data_cnt = saved_data_cnt; in AscPutReadySgListQueue()
8016 iop_base = asc_dvc->iop_base; in AscSendScsiQueue()
8017 target_ix = scsiq->q2.target_ix; in AscSendScsiQueue()
8025 asc_dvc->last_q_shortage = 0; in AscSendScsiQueue()
8026 scsiq->sg_head->queue_cnt = n_q_required - 1; in AscSendScsiQueue()
8027 scsiq->q1.q_no = free_q_head; in AscSendScsiQueue()
8034 scsiq->q1.q_no = free_q_head; in AscSendScsiQueue()
8040 asc_dvc->cur_total_qng += n_q_required; in AscSendScsiQueue()
8041 asc_dvc->cur_dvc_qng[tid_no]++; in AscSendScsiQueue()
8085 iop_base = asc_dvc->iop_base; in AscExeScsiQueue()
8086 sg_head = scsiq->sg_head; in AscExeScsiQueue()
8087 if (asc_dvc->err_code != 0) in AscExeScsiQueue()
8089 scsiq->q1.q_no = 0; in AscExeScsiQueue()
8090 if ((scsiq->q2.tag_code & ASC_TAG_FLAG_EXTRA_BYTES) == 0) { in AscExeScsiQueue()
8091 scsiq->q1.extra_bytes = 0; in AscExeScsiQueue()
8094 target_ix = scsiq->q2.target_ix; in AscExeScsiQueue()
8097 if (scsiq->cdbptr[0] == REQUEST_SENSE) { in AscExeScsiQueue()
8098 if ((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) { in AscExeScsiQueue()
8099 asc_dvc->sdtr_done &= ~scsiq->q1.target_id; in AscExeScsiQueue()
8102 asc_dvc-> in AscExeScsiQueue()
8103 sdtr_period_tbl[(sdtr_data >> 4) & in AscExeScsiQueue()
8104 (uchar)(asc_dvc-> in AscExeScsiQueue()
8105 max_sdtr_index - in AscExeScsiQueue()
8109 scsiq->q1.cntl |= (QC_MSG_OUT | QC_URGENT); in AscExeScsiQueue()
8112 if (asc_dvc->in_critical_cnt != 0) { in AscExeScsiQueue()
8116 asc_dvc->in_critical_cnt++; in AscExeScsiQueue()
8117 if ((scsiq->q1.cntl & QC_SG_HEAD) != 0) { in AscExeScsiQueue()
8118 if ((sg_entry_cnt = sg_head->entry_cnt) == 0) { in AscExeScsiQueue()
8119 asc_dvc->in_critical_cnt--; in AscExeScsiQueue()
8123 asc_dvc->in_critical_cnt--; in AscExeScsiQueue()
8127 scsiq->q1.data_addr = cpu_to_le32(sg_head->sg_list[0].addr); in AscExeScsiQueue()
8128 scsiq->q1.data_cnt = cpu_to_le32(sg_head->sg_list[0].bytes); in AscExeScsiQueue()
8129 scsiq->q1.cntl &= ~(QC_SG_HEAD | QC_SG_SWAP_QUEUE); in AscExeScsiQueue()
8131 sg_entry_cnt_minus_one = sg_entry_cnt - 1; in AscExeScsiQueue()
8133 scsi_cmd = scsiq->cdbptr[0]; in AscExeScsiQueue()
8135 if ((asc_dvc->pci_fix_asyn_xfer & scsiq->q1.target_id) && in AscExeScsiQueue()
8136 !(asc_dvc->pci_fix_asyn_xfer_always & scsiq->q1.target_id)) { in AscExeScsiQueue()
8137 if (scsiq->q1.cntl & QC_SG_HEAD) { in AscExeScsiQueue()
8140 data_cnt += le32_to_cpu(sg_head->sg_list[i]. in AscExeScsiQueue()
8144 data_cnt = le32_to_cpu(scsiq->q1.data_cnt); in AscExeScsiQueue()
8167 scsiq->q2.tag_code &= ~SIMPLE_QUEUE_TAG; in AscExeScsiQueue()
8168 scsiq->q2.tag_code |= (ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX | in AscExeScsiQueue()
8171 scsiq->q2.tag_code &= 0x27; in AscExeScsiQueue()
8173 if ((scsiq->q1.cntl & QC_SG_HEAD) != 0) { in AscExeScsiQueue()
8174 if (asc_dvc->bug_fix_cntl) { in AscExeScsiQueue()
8175 if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) { in AscExeScsiQueue()
8178 addr = le32_to_cpu(sg_head-> in AscExeScsiQueue()
8182 le32_to_cpu(sg_head-> in AscExeScsiQueue()
8190 ((scsiq->q2. in AscExeScsiQueue()
8194 scsiq->q2.tag_code |= in AscExeScsiQueue()
8196 scsiq->q1.extra_bytes = in AscExeScsiQueue()
8199 le32_to_cpu(sg_head-> in AscExeScsiQueue()
8203 data_cnt -= extra_bytes; in AscExeScsiQueue()
8204 sg_head-> in AscExeScsiQueue()
8213 sg_head->entry_to_copy = sg_head->entry_cnt; in AscExeScsiQueue()
8217 || ((scsiq->q1.cntl & QC_URGENT) != 0)) { in AscExeScsiQueue()
8221 asc_dvc->in_critical_cnt--; in AscExeScsiQueue()
8226 if (asc_dvc->bug_fix_cntl) { in AscExeScsiQueue()
8227 if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) { in AscExeScsiQueue()
8231 le32_to_cpu(scsiq->q1.data_addr) + in AscExeScsiQueue()
8232 le32_to_cpu(scsiq->q1.data_cnt); in AscExeScsiQueue()
8237 ((scsiq->q2. in AscExeScsiQueue()
8242 le32_to_cpu(scsiq->q1. in AscExeScsiQueue()
8246 scsiq->q2.tag_code |= in AscExeScsiQueue()
8248 data_cnt -= extra_bytes; in AscExeScsiQueue()
8249 scsiq->q1.data_cnt = in AscExeScsiQueue()
8252 scsiq->q1.extra_bytes = in AscExeScsiQueue()
8261 ((scsiq->q1.cntl & QC_URGENT) != 0)) { in AscExeScsiQueue()
8264 asc_dvc->in_critical_cnt--; in AscExeScsiQueue()
8269 asc_dvc->in_critical_cnt--; in AscExeScsiQueue()
8274 * AdvExeScsiQueue() - Send a request to the RISC microcode program.
8283 * Multi-byte fields in the ADV_SCSI_REQ_Q that are used by the microcode
8284 * for DMA addresses or math operations are byte swapped to little-endian
8288 * ADV_SUCCESS(1) - The request was successfully queued.
8289 * ADV_BUSY(0) - Resource unavailable; Retry again after pending
8291 * ADV_ERROR(-1) - Invalid ADV_SCSI_REQ_Q request structure
8298 ADV_SCSI_REQ_Q *scsiq = &reqp->scsi_req_q; in AdvExeScsiQueue()
8303 if (scsiq->target_id > ADV_MAX_TID) { in AdvExeScsiQueue()
8304 scsiq->host_status = QHSTA_M_INVALID_DEVICE; in AdvExeScsiQueue()
8305 scsiq->done_status = QD_WITH_ERROR; in AdvExeScsiQueue()
8309 iop_base = asc_dvc->iop_base; in AdvExeScsiQueue()
8321 asc_dvc->carr_pending_cnt++; in AdvExeScsiQueue()
8324 scsiq->scsiq_ptr = cpu_to_le32(scsiq->srb_tag); in AdvExeScsiQueue()
8325 scsiq->scsiq_rptr = cpu_to_le32(reqp->req_addr); in AdvExeScsiQueue()
8327 scsiq->carr_va = asc_dvc->icq_sp->carr_va; in AdvExeScsiQueue()
8328 scsiq->carr_pa = asc_dvc->icq_sp->carr_pa; in AdvExeScsiQueue()
8335 asc_dvc->icq_sp->areq_vpa = scsiq->scsiq_rptr; in AdvExeScsiQueue()
8342 asc_dvc->icq_sp->next_vpa = new_carrp->carr_pa; in AdvExeScsiQueue()
8347 asc_dvc->icq_sp = new_carrp; in AdvExeScsiQueue()
8349 if (asc_dvc->chip_type == ADV_CHIP_ASC3550 || in AdvExeScsiQueue()
8350 asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { in AdvExeScsiQueue()
8355 if (asc_dvc->chip_type == ADV_CHIP_ASC3550) { in AdvExeScsiQueue()
8357 * Clear the tickle value. In the ASC-3550 the RISC flag in AdvExeScsiQueue()
8364 } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { in AdvExeScsiQueue()
8370 le32_to_cpu(new_carrp->carr_pa)); in AdvExeScsiQueue()
8382 struct asc_board *boardp = shost_priv(scp->device->host); in asc_execute_scsi_cmnd()
8387 ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; in asc_execute_scsi_cmnd()
8392 ASC_STATS(scp->device->host, build_error); in asc_execute_scsi_cmnd()
8398 err_code = asc_dvc->err_code; in asc_execute_scsi_cmnd()
8400 ADV_DVC_VAR *adv_dvc = &boardp->dvc_var.adv_dvc_var; in asc_execute_scsi_cmnd()
8419 ASC_STATS(scp->device->host, build_error); in asc_execute_scsi_cmnd()
8424 err_code = adv_dvc->err_code; in asc_execute_scsi_cmnd()
8429 ASC_STATS(scp->device->host, exe_noerror); in asc_execute_scsi_cmnd()
8434 boardp->reqcnt[scp->device->id]++; in asc_execute_scsi_cmnd()
8439 ASC_STATS(scp->device->host, exe_busy); in asc_execute_scsi_cmnd()
8444 ASC_STATS(scp->device->host, exe_error); in asc_execute_scsi_cmnd()
8450 ASC_STATS(scp->device->host, exe_unknown); in asc_execute_scsi_cmnd()
8460 * advansys_queuecommand() - interrupt-driven I/O entrypoint.
8467 struct Scsi_Host *shost = scp->device->host; in advansys_queuecommand_lck()
8509 * The PCI BIOS is re-located by the motherboard BIOS. Because in AscGetChipBiosAddress()
8561 return ASC_CHIP_MIN_VER_EISA - 1 + revision; in AscGetChipVersion()
8597 iop_base = asc_dvc->iop_base; in AscInitAscDvcVar()
8598 asc_dvc->err_code = 0; in AscInitAscDvcVar()
8599 if ((asc_dvc->bus_type & in AscInitAscDvcVar()
8601 asc_dvc->err_code |= ASC_IERR_NO_BUS_TYPE; in AscInitAscDvcVar()
8605 asc_dvc->bug_fix_cntl = 0; in AscInitAscDvcVar()
8606 asc_dvc->pci_fix_asyn_xfer = 0; in AscInitAscDvcVar()
8607 asc_dvc->pci_fix_asyn_xfer_always = 0; in AscInitAscDvcVar()
8608 /* asc_dvc->init_state initialized in AscInitGetConfig(). */ in AscInitAscDvcVar()
8609 asc_dvc->sdtr_done = 0; in AscInitAscDvcVar()
8610 asc_dvc->cur_total_qng = 0; in AscInitAscDvcVar()
8611 asc_dvc->is_in_int = false; in AscInitAscDvcVar()
8612 asc_dvc->in_critical_cnt = 0; in AscInitAscDvcVar()
8613 asc_dvc->last_q_shortage = 0; in AscInitAscDvcVar()
8614 asc_dvc->use_tagged_qng = 0; in AscInitAscDvcVar()
8615 asc_dvc->no_scam = 0; in AscInitAscDvcVar()
8616 asc_dvc->unit_not_ready = 0; in AscInitAscDvcVar()
8617 asc_dvc->queue_full_or_busy = 0; in AscInitAscDvcVar()
8618 asc_dvc->redo_scam = 0; in AscInitAscDvcVar()
8619 asc_dvc->res2 = 0; in AscInitAscDvcVar()
8620 asc_dvc->min_sdtr_index = 0; in AscInitAscDvcVar()
8621 asc_dvc->cfg->can_tagged_qng = 0; in AscInitAscDvcVar()
8622 asc_dvc->cfg->cmd_qng_enabled = 0; in AscInitAscDvcVar()
8623 asc_dvc->dvc_cntl = ASC_DEF_DVC_CNTL; in AscInitAscDvcVar()
8624 asc_dvc->init_sdtr = 0; in AscInitAscDvcVar()
8625 asc_dvc->max_total_qng = ASC_DEF_MAX_TOTAL_QNG; in AscInitAscDvcVar()
8626 asc_dvc->scsi_reset_wait = 3; in AscInitAscDvcVar()
8627 asc_dvc->start_motor = ASC_SCSI_WIDTH_BIT_SET; in AscInitAscDvcVar()
8628 asc_dvc->max_dma_count = AscGetMaxDmaCount(asc_dvc->bus_type); in AscInitAscDvcVar()
8629 asc_dvc->cfg->sdtr_enable = ASC_SCSI_WIDTH_BIT_SET; in AscInitAscDvcVar()
8630 asc_dvc->cfg->disc_enable = ASC_SCSI_WIDTH_BIT_SET; in AscInitAscDvcVar()
8631 asc_dvc->cfg->chip_scsi_id = ASC_DEF_CHIP_SCSI_ID; in AscInitAscDvcVar()
8632 chip_version = AscGetChipVersion(iop_base, asc_dvc->bus_type); in AscInitAscDvcVar()
8633 asc_dvc->cfg->chip_version = chip_version; in AscInitAscDvcVar()
8634 asc_dvc->sdtr_period_tbl = asc_syn_xfer_period; in AscInitAscDvcVar()
8635 asc_dvc->max_sdtr_index = 7; in AscInitAscDvcVar()
8636 if ((asc_dvc->bus_type & ASC_IS_PCI) && in AscInitAscDvcVar()
8638 asc_dvc->bus_type = ASC_IS_PCI_ULTRA; in AscInitAscDvcVar()
8639 asc_dvc->sdtr_period_tbl = asc_syn_ultra_xfer_period; in AscInitAscDvcVar()
8640 asc_dvc->max_sdtr_index = 15; in AscInitAscDvcVar()
8650 if (asc_dvc->bus_type == ASC_IS_PCI) { in AscInitAscDvcVar()
8656 asc_dvc->cur_dvc_qng[i] = 0; in AscInitAscDvcVar()
8657 asc_dvc->max_dvc_qng[i] = ASC_MAX_SCSI1_QNG; in AscInitAscDvcVar()
8658 asc_dvc->scsiq_busy_head[i] = (ASC_SCSI_Q *)0L; in AscInitAscDvcVar()
8659 asc_dvc->scsiq_busy_tail[i] = (ASC_SCSI_Q *)0L; in AscInitAscDvcVar()
8660 asc_dvc->cfg->max_tag_qng[i] = ASC_MAX_INRAM_TAG_QNG; in AscInitAscDvcVar()
8707 int uchar_end_in_config = ASC_EEP_MAX_DVC_ADDR - 2; in AscGetEEPConfig()
8712 /* Read two config words; Byte-swapping done by AscReadEEPWord(). */ in AscGetEEPConfig()
8724 for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) { in AscGetEEPConfig()
8728 * Swap all char fields - must unswap bytes already swapped in AscGetEEPConfig()
8733 /* Don't swap word field at the end - cntl field. */ in AscGetEEPConfig()
8753 iop_base = asc_dvc->iop_base; in AscTestExternalLram()
8822 int uchar_end_in_config = ASC_EEP_MAX_DVC_ADDR - 2; in AscSetEEPConfigOnce()
8841 for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) { in AscSetEEPConfigOnce()
8853 /* Don't swap word field at the end - cntl field. */ in AscSetEEPConfigOnce()
8870 * Read two config words; Byte-swapping done by AscReadEEPWord(). in AscSetEEPConfigOnce()
8884 for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) { in AscSetEEPConfigOnce()
8894 /* Don't swap word field at the end - cntl field. */ in AscSetEEPConfigOnce()
8938 iop_base = asc_dvc->iop_base; in AscInitFromEEP()
8944 asc_dvc->init_state |= ASC_INIT_RESET_SCSI_DONE; in AscInitFromEEP()
8946 mdelay(asc_dvc->scsi_reset_wait * 1000); /* XXX: msleep? */ in AscInitFromEEP()
8949 asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP; in AscInitFromEEP()
8954 asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR; in AscInitFromEEP()
8965 chksum = AscGetEEPConfig(iop_base, eep_config, asc_dvc->bus_type); in AscInitFromEEP()
8972 if (asc_dvc->cfg->chip_version == 3) { in AscInitFromEEP()
8973 if (eep_config->cfg_lsw != cfg_lsw) { in AscInitFromEEP()
8975 eep_config->cfg_lsw = in AscInitFromEEP()
8978 if (eep_config->cfg_msw != cfg_msw) { in AscInitFromEEP()
8980 eep_config->cfg_msw = in AscInitFromEEP()
8985 eep_config->cfg_msw &= ~ASC_CFG_MSW_CLR_MASK; in AscInitFromEEP()
8986 eep_config->cfg_lsw |= ASC_CFG0_HOST_INT_ON; in AscInitFromEEP()
8987 ASC_DBG(1, "eep_config->chksum 0x%x\n", eep_config->chksum); in AscInitFromEEP()
8988 if (chksum != eep_config->chksum) { in AscInitFromEEP()
8989 if (AscGetChipVersion(iop_base, asc_dvc->bus_type) == in AscInitFromEEP()
8991 ASC_DBG(1, "chksum error ignored; EEPROM-less board\n"); in AscInitFromEEP()
8992 eep_config->init_sdtr = 0xFF; in AscInitFromEEP()
8993 eep_config->disc_enable = 0xFF; in AscInitFromEEP()
8994 eep_config->start_motor = 0xFF; in AscInitFromEEP()
8995 eep_config->use_cmd_qng = 0; in AscInitFromEEP()
8996 eep_config->max_total_qng = 0xF0; in AscInitFromEEP()
8997 eep_config->max_tag_qng = 0x20; in AscInitFromEEP()
8998 eep_config->cntl = 0xBFFF; in AscInitFromEEP()
9000 eep_config->no_scam = 0; in AscInitFromEEP()
9001 eep_config->adapter_info[0] = 0; in AscInitFromEEP()
9002 eep_config->adapter_info[1] = 0; in AscInitFromEEP()
9003 eep_config->adapter_info[2] = 0; in AscInitFromEEP()
9004 eep_config->adapter_info[3] = 0; in AscInitFromEEP()
9005 eep_config->adapter_info[4] = 0; in AscInitFromEEP()
9006 /* Indicate EEPROM-less board. */ in AscInitFromEEP()
9007 eep_config->adapter_info[5] = 0xBB; in AscInitFromEEP()
9010 ("AscInitFromEEP: EEPROM checksum error; Will try to re-write EEPROM.\n"); in AscInitFromEEP()
9015 asc_dvc->cfg->sdtr_enable = eep_config->init_sdtr; in AscInitFromEEP()
9016 asc_dvc->cfg->disc_enable = eep_config->disc_enable; in AscInitFromEEP()
9017 asc_dvc->cfg->cmd_qng_enabled = eep_config->use_cmd_qng; in AscInitFromEEP()
9018 asc_dvc->start_motor = eep_config->start_motor; in AscInitFromEEP()
9019 asc_dvc->dvc_cntl = eep_config->cntl; in AscInitFromEEP()
9020 asc_dvc->no_scam = eep_config->no_scam; in AscInitFromEEP()
9021 asc_dvc->cfg->adapter_info[0] = eep_config->adapter_info[0]; in AscInitFromEEP()
9022 asc_dvc->cfg->adapter_info[1] = eep_config->adapter_info[1]; in AscInitFromEEP()
9023 asc_dvc->cfg->adapter_info[2] = eep_config->adapter_info[2]; in AscInitFromEEP()
9024 asc_dvc->cfg->adapter_info[3] = eep_config->adapter_info[3]; in AscInitFromEEP()
9025 asc_dvc->cfg->adapter_info[4] = eep_config->adapter_info[4]; in AscInitFromEEP()
9026 asc_dvc->cfg->adapter_info[5] = eep_config->adapter_info[5]; in AscInitFromEEP()
9028 if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == in AscInitFromEEP()
9030 eep_config->max_total_qng = in AscInitFromEEP()
9032 eep_config->max_tag_qng = in AscInitFromEEP()
9035 eep_config->cfg_msw |= 0x0800; in AscInitFromEEP()
9038 eep_config->max_total_qng = ASC_MAX_PCI_INRAM_TOTAL_QNG; in AscInitFromEEP()
9039 eep_config->max_tag_qng = ASC_MAX_INRAM_TAG_QNG; in AscInitFromEEP()
9043 if (eep_config->max_total_qng < ASC_MIN_TOTAL_QNG) { in AscInitFromEEP()
9044 eep_config->max_total_qng = ASC_MIN_TOTAL_QNG; in AscInitFromEEP()
9046 if (eep_config->max_total_qng > ASC_MAX_TOTAL_QNG) { in AscInitFromEEP()
9047 eep_config->max_total_qng = ASC_MAX_TOTAL_QNG; in AscInitFromEEP()
9049 if (eep_config->max_tag_qng > eep_config->max_total_qng) { in AscInitFromEEP()
9050 eep_config->max_tag_qng = eep_config->max_total_qng; in AscInitFromEEP()
9052 if (eep_config->max_tag_qng < ASC_MIN_TAG_Q_PER_DVC) { in AscInitFromEEP()
9053 eep_config->max_tag_qng = ASC_MIN_TAG_Q_PER_DVC; in AscInitFromEEP()
9055 asc_dvc->max_total_qng = eep_config->max_total_qng; in AscInitFromEEP()
9056 if ((eep_config->use_cmd_qng & eep_config->disc_enable) != in AscInitFromEEP()
9057 eep_config->use_cmd_qng) { in AscInitFromEEP()
9058 eep_config->disc_enable = eep_config->use_cmd_qng; in AscInitFromEEP()
9063 asc_dvc->cfg->chip_scsi_id = ASC_EEP_GET_CHIP_ID(eep_config); in AscInitFromEEP()
9064 if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) && in AscInitFromEEP()
9065 !(asc_dvc->dvc_cntl & ASC_CNTL_SDTR_ENABLE_ULTRA)) { in AscInitFromEEP()
9066 asc_dvc->min_sdtr_index = ASC_SDTR_ULTRA_PCI_10MB_INDEX; in AscInitFromEEP()
9070 asc_dvc->dos_int13_table[i] = eep_config->dos_int13_table[i]; in AscInitFromEEP()
9071 asc_dvc->cfg->max_tag_qng[i] = eep_config->max_tag_qng; in AscInitFromEEP()
9072 asc_dvc->cfg->sdtr_period_offset[i] = in AscInitFromEEP()
9074 (asc_dvc->min_sdtr_index << 4)); in AscInitFromEEP()
9076 eep_config->cfg_msw = AscGetChipCfgMsw(iop_base); in AscInitFromEEP()
9079 asc_dvc->bus_type)) != 0) { in AscInitFromEEP()
9081 ("AscInitFromEEP: Failed to re-write EEPROM with %d errors.\n", in AscInitFromEEP()
9085 ("AscInitFromEEP: Successfully re-wrote EEPROM.\n"); in AscInitFromEEP()
9094 ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var; in AscInitGetConfig()
9097 asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG; in AscInitGetConfig()
9098 if (asc_dvc->err_code != 0) in AscInitGetConfig()
9099 return asc_dvc->err_code; in AscInitGetConfig()
9101 if (AscFindSignature(asc_dvc->iop_base)) { in AscInitGetConfig()
9104 asc_dvc->init_state |= ASC_INIT_STATE_END_GET_CFG; in AscInitGetConfig()
9105 if (asc_dvc->scsi_reset_wait > ASC_MAX_SCSI_RESET_WAIT) in AscInitGetConfig()
9106 asc_dvc->scsi_reset_wait = ASC_MAX_SCSI_RESET_WAIT; in AscInitGetConfig()
9108 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; in AscInitGetConfig()
9138 if (asc_dvc->err_code != 0) in AscInitGetConfig()
9140 "0x%x\n", asc_dvc->err_code, asc_dvc->init_state); in AscInitGetConfig()
9142 return asc_dvc->err_code; in AscInitGetConfig()
9148 ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var; in AscInitSetConfig()
9149 PortAddr iop_base = asc_dvc->iop_base; in AscInitSetConfig()
9153 asc_dvc->init_state |= ASC_INIT_STATE_BEG_SET_CFG; in AscInitSetConfig()
9154 if (asc_dvc->err_code != 0) in AscInitSetConfig()
9155 return asc_dvc->err_code; in AscInitSetConfig()
9156 if (!AscFindSignature(asc_dvc->iop_base)) { in AscInitSetConfig()
9157 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; in AscInitSetConfig()
9158 return asc_dvc->err_code; in AscInitSetConfig()
9167 if ((asc_dvc->cfg->cmd_qng_enabled & asc_dvc->cfg->disc_enable) != in AscInitSetConfig()
9168 asc_dvc->cfg->cmd_qng_enabled) { in AscInitSetConfig()
9169 asc_dvc->cfg->disc_enable = asc_dvc->cfg->cmd_qng_enabled; in AscInitSetConfig()
9176 if (asc_dvc->bus_type & ASC_IS_PCI) { in AscInitSetConfig()
9179 if ((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) { in AscInitSetConfig()
9181 if ((pdev->device == PCI_DEVICE_ID_ASP_1200A) || in AscInitSetConfig()
9182 (pdev->device == PCI_DEVICE_ID_ASP_ABP940)) { in AscInitSetConfig()
9183 asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_IF_NOT_DWB; in AscInitSetConfig()
9184 asc_dvc->bug_fix_cntl |= in AscInitSetConfig()
9190 if (AscSetChipScsiID(iop_base, asc_dvc->cfg->chip_scsi_id) != in AscInitSetConfig()
9191 asc_dvc->cfg->chip_scsi_id) { in AscInitSetConfig()
9192 asc_dvc->err_code |= ASC_IERR_SET_SCSI_ID; in AscInitSetConfig()
9195 asc_dvc->init_state |= ASC_INIT_STATE_END_SET_CFG; in AscInitSetConfig()
9224 if (asc_dvc->err_code != 0) in AscInitSetConfig()
9226 "0x%x\n", asc_dvc->err_code, asc_dvc->init_state); in AscInitSetConfig()
9228 return asc_dvc->err_code; in AscInitSetConfig()
9244 * on big-endian platforms so char fields read as words are actually being
9245 * unswapped on big-endian platforms.
9289 0, /* -disc_enable */
9352 , /* 22-29 oem_name[16] */
9417 , /* 22-29 oem_name[16] */
9482 , /* 22-29 oem_name[16] */
9547 , /* 22-29 oem_name[16] */
9951 * For a non-fatal error return a warning code. If there are no warnings
9962 iop_base = asc_dvc->iop_base; in AdvInitFrom3550EEP()
9985 AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1); in AdvInitFrom3550EEP()
9988 AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2); in AdvInitFrom3550EEP()
9991 AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3); in AdvInitFrom3550EEP()
10001 asc_dvc->wdtr_able = eep_config.wdtr_able; in AdvInitFrom3550EEP()
10002 asc_dvc->sdtr_able = eep_config.sdtr_able; in AdvInitFrom3550EEP()
10003 asc_dvc->ultra_able = eep_config.ultra_able; in AdvInitFrom3550EEP()
10004 asc_dvc->tagqng_able = eep_config.tagqng_able; in AdvInitFrom3550EEP()
10005 asc_dvc->cfg->disc_enable = eep_config.disc_enable; in AdvInitFrom3550EEP()
10006 asc_dvc->max_host_qng = eep_config.max_host_qng; in AdvInitFrom3550EEP()
10007 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; in AdvInitFrom3550EEP()
10008 asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID); in AdvInitFrom3550EEP()
10009 asc_dvc->start_motor = eep_config.start_motor; in AdvInitFrom3550EEP()
10010 asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay; in AdvInitFrom3550EEP()
10011 asc_dvc->bios_ctrl = eep_config.bios_ctrl; in AdvInitFrom3550EEP()
10012 asc_dvc->no_scam = eep_config.scam_tolerant; in AdvInitFrom3550EEP()
10013 asc_dvc->cfg->serial1 = eep_config.serial_number_word1; in AdvInitFrom3550EEP()
10014 asc_dvc->cfg->serial2 = eep_config.serial_number_word2; in AdvInitFrom3550EEP()
10015 asc_dvc->cfg->serial3 = eep_config.serial_number_word3; in AdvInitFrom3550EEP()
10019 * maximum queuing (max. 63, min. 4). in AdvInitFrom3550EEP()
10055 asc_dvc->max_host_qng = eep_config.max_host_qng; in AdvInitFrom3550EEP()
10056 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; in AdvInitFrom3550EEP()
10062 * If the termination is specified with a non-zero 'termination' in AdvInitFrom3550EEP()
10067 asc_dvc->cfg->termination = 0; /* auto termination */ in AdvInitFrom3550EEP()
10071 asc_dvc->cfg->termination = TERM_CTL_SEL; in AdvInitFrom3550EEP()
10075 asc_dvc->cfg->termination = TERM_CTL_SEL | TERM_CTL_H; in AdvInitFrom3550EEP()
10079 asc_dvc->cfg->termination = in AdvInitFrom3550EEP()
10086 asc_dvc->cfg->termination = 0; in AdvInitFrom3550EEP()
10101 * For a non-fatal error return a warning code. If there are no warnings
10114 iop_base = asc_dvc->iop_base; in AdvInitFrom38C0800EEP()
10138 AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1); in AdvInitFrom38C0800EEP()
10141 AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2); in AdvInitFrom38C0800EEP()
10144 AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3); in AdvInitFrom38C0800EEP()
10154 asc_dvc->wdtr_able = eep_config.wdtr_able; in AdvInitFrom38C0800EEP()
10155 asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1; in AdvInitFrom38C0800EEP()
10156 asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2; in AdvInitFrom38C0800EEP()
10157 asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3; in AdvInitFrom38C0800EEP()
10158 asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4; in AdvInitFrom38C0800EEP()
10159 asc_dvc->tagqng_able = eep_config.tagqng_able; in AdvInitFrom38C0800EEP()
10160 asc_dvc->cfg->disc_enable = eep_config.disc_enable; in AdvInitFrom38C0800EEP()
10161 asc_dvc->max_host_qng = eep_config.max_host_qng; in AdvInitFrom38C0800EEP()
10162 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; in AdvInitFrom38C0800EEP()
10163 asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID); in AdvInitFrom38C0800EEP()
10164 asc_dvc->start_motor = eep_config.start_motor; in AdvInitFrom38C0800EEP()
10165 asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay; in AdvInitFrom38C0800EEP()
10166 asc_dvc->bios_ctrl = eep_config.bios_ctrl; in AdvInitFrom38C0800EEP()
10167 asc_dvc->no_scam = eep_config.scam_tolerant; in AdvInitFrom38C0800EEP()
10168 asc_dvc->cfg->serial1 = eep_config.serial_number_word1; in AdvInitFrom38C0800EEP()
10169 asc_dvc->cfg->serial2 = eep_config.serial_number_word2; in AdvInitFrom38C0800EEP()
10170 asc_dvc->cfg->serial3 = eep_config.serial_number_word3; in AdvInitFrom38C0800EEP()
10176 asc_dvc->sdtr_able = 0; in AdvInitFrom38C0800EEP()
10179 sdtr_speed = asc_dvc->sdtr_speed1; in AdvInitFrom38C0800EEP()
10180 } else if (tid == 4) { in AdvInitFrom38C0800EEP()
10181 sdtr_speed = asc_dvc->sdtr_speed2; in AdvInitFrom38C0800EEP()
10183 sdtr_speed = asc_dvc->sdtr_speed3; in AdvInitFrom38C0800EEP()
10185 sdtr_speed = asc_dvc->sdtr_speed4; in AdvInitFrom38C0800EEP()
10188 asc_dvc->sdtr_able |= (1 << tid); in AdvInitFrom38C0800EEP()
10190 sdtr_speed >>= 4; in AdvInitFrom38C0800EEP()
10195 * maximum queuing (max. 63, min. 4). in AdvInitFrom38C0800EEP()
10231 asc_dvc->max_host_qng = eep_config.max_host_qng; in AdvInitFrom38C0800EEP()
10232 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; in AdvInitFrom38C0800EEP()
10238 * If the termination is specified with a non-zero 'termination' in AdvInitFrom38C0800EEP()
10267 asc_dvc->cfg->termination = termination; /* auto termination for LVD */ in AdvInitFrom38C0800EEP()
10271 asc_dvc->cfg->termination = termination; in AdvInitFrom38C0800EEP()
10275 asc_dvc->cfg->termination = termination | TERM_LVD_HI; in AdvInitFrom38C0800EEP()
10279 asc_dvc->cfg->termination = termination | TERM_LVD; in AdvInitFrom38C0800EEP()
10285 asc_dvc->cfg->termination = termination; in AdvInitFrom38C0800EEP()
10300 * For a non-fatal error return a warning code. If there are no warnings
10313 iop_base = asc_dvc->iop_base; in AdvInitFrom38C1600EEP()
10333 if (PCI_FUNC(pdev->devfn) != 0) { in AdvInitFrom38C1600EEP()
10347 * 1 - Function 1 interrupt line wired to INT A. in AdvInitFrom38C1600EEP()
10348 * 0 - Function 1 interrupt line wired to INT B. in AdvInitFrom38C1600EEP()
10365 AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1); in AdvInitFrom38C1600EEP()
10367 AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2); in AdvInitFrom38C1600EEP()
10369 AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3); in AdvInitFrom38C1600EEP()
10380 asc_dvc->wdtr_able = eep_config.wdtr_able; in AdvInitFrom38C1600EEP()
10381 asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1; in AdvInitFrom38C1600EEP()
10382 asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2; in AdvInitFrom38C1600EEP()
10383 asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3; in AdvInitFrom38C1600EEP()
10384 asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4; in AdvInitFrom38C1600EEP()
10385 asc_dvc->ppr_able = 0; in AdvInitFrom38C1600EEP()
10386 asc_dvc->tagqng_able = eep_config.tagqng_able; in AdvInitFrom38C1600EEP()
10387 asc_dvc->cfg->disc_enable = eep_config.disc_enable; in AdvInitFrom38C1600EEP()
10388 asc_dvc->max_host_qng = eep_config.max_host_qng; in AdvInitFrom38C1600EEP()
10389 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; in AdvInitFrom38C1600EEP()
10390 asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ASC_MAX_TID); in AdvInitFrom38C1600EEP()
10391 asc_dvc->start_motor = eep_config.start_motor; in AdvInitFrom38C1600EEP()
10392 asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay; in AdvInitFrom38C1600EEP()
10393 asc_dvc->bios_ctrl = eep_config.bios_ctrl; in AdvInitFrom38C1600EEP()
10394 asc_dvc->no_scam = eep_config.scam_tolerant; in AdvInitFrom38C1600EEP()
10400 asc_dvc->sdtr_able = 0; in AdvInitFrom38C1600EEP()
10403 sdtr_speed = asc_dvc->sdtr_speed1; in AdvInitFrom38C1600EEP()
10404 } else if (tid == 4) { in AdvInitFrom38C1600EEP()
10405 sdtr_speed = asc_dvc->sdtr_speed2; in AdvInitFrom38C1600EEP()
10407 sdtr_speed = asc_dvc->sdtr_speed3; in AdvInitFrom38C1600EEP()
10409 sdtr_speed = asc_dvc->sdtr_speed4; in AdvInitFrom38C1600EEP()
10412 asc_dvc->sdtr_able |= (1 << tid); in AdvInitFrom38C1600EEP()
10414 sdtr_speed >>= 4; in AdvInitFrom38C1600EEP()
10419 * maximum queuing (max. 63, min. 4). in AdvInitFrom38C1600EEP()
10455 asc_dvc->max_host_qng = eep_config.max_host_qng; in AdvInitFrom38C1600EEP()
10456 asc_dvc->max_dvc_qng = eep_config.max_dvc_qng; in AdvInitFrom38C1600EEP()
10462 * If the termination is specified with a non-zero 'termination' in AdvInitFrom38C1600EEP()
10491 asc_dvc->cfg->termination = termination; /* auto termination for LVD */ in AdvInitFrom38C1600EEP()
10495 asc_dvc->cfg->termination = termination; in AdvInitFrom38C1600EEP()
10499 asc_dvc->cfg->termination = termination | TERM_LVD_HI; in AdvInitFrom38C1600EEP()
10503 asc_dvc->cfg->termination = termination | TERM_LVD; in AdvInitFrom38C1600EEP()
10509 asc_dvc->cfg->termination = termination; in AdvInitFrom38C1600EEP()
10522 * For a non-fatal error return a warning code. If there are no warnings
10528 ADV_DVC_VAR *asc_dvc = &board->dvc_var.adv_dvc_var; in AdvInitGetConfig()
10530 AdvPortAddr iop_base = asc_dvc->iop_base; in AdvInitGetConfig()
10534 asc_dvc->err_code = 0; in AdvInitGetConfig()
10542 asc_dvc->cfg->control_flag = 0; in AdvInitGetConfig()
10545 asc_dvc->cfg->control_flag |= CONTROL_FLAG_IGNORE_PERR; in AdvInitGetConfig()
10547 asc_dvc->cfg->chip_version = in AdvInitGetConfig()
10548 AdvGetChipVersion(iop_base, asc_dvc->bus_type); in AdvInitGetConfig()
10562 asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE; in AdvInitGetConfig()
10568 if (asc_dvc->chip_type != ADV_CHIP_ASC3550 && in AdvInitGetConfig()
10569 asc_dvc->chip_type != ADV_CHIP_ASC38C0800 && in AdvInitGetConfig()
10570 asc_dvc->chip_type != ADV_CHIP_ASC38C1600) { in AdvInitGetConfig()
10571 asc_dvc->err_code |= ASC_IERR_BAD_CHIPTYPE; in AdvInitGetConfig()
10584 if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) { in AdvInitGetConfig()
10586 } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) { in AdvInitGetConfig()
10597 if (asc_dvc->err_code) in AdvInitGetConfig()
10599 asc_dvc->err_code); in AdvInitGetConfig()
10601 return asc_dvc->err_code; in AdvInitGetConfig()
10622 struct adv_dvc_var *adv_dvc = &board->dvc_var.adv_dvc_var; in advansys_wide_init_chip()
10630 adv_dvc->carrier = dma_alloc_coherent(board->dev, in advansys_wide_init_chip()
10631 ADV_CARRIER_BUFSIZE, &adv_dvc->carrier_addr, GFP_KERNEL); in advansys_wide_init_chip()
10632 ASC_DBG(1, "carrier 0x%p\n", adv_dvc->carrier); in advansys_wide_init_chip()
10634 if (!adv_dvc->carrier) in advansys_wide_init_chip()
10642 board->adv_reqp_size = adv_dvc->max_host_qng * sizeof(adv_req_t); in advansys_wide_init_chip()
10643 if (board->adv_reqp_size & 0x1f) { in advansys_wide_init_chip()
10645 board->adv_reqp_size = ADV_32BALIGN(board->adv_reqp_size); in advansys_wide_init_chip()
10647 board->adv_reqp = dma_alloc_coherent(board->dev, board->adv_reqp_size, in advansys_wide_init_chip()
10648 &board->adv_reqp_addr, GFP_KERNEL); in advansys_wide_init_chip()
10650 if (!board->adv_reqp) in advansys_wide_init_chip()
10653 ASC_DBG(1, "reqp 0x%p, req_cnt %d, bytes %lu\n", board->adv_reqp, in advansys_wide_init_chip()
10654 adv_dvc->max_host_qng, board->adv_reqp_size); in advansys_wide_init_chip()
10661 board->adv_sgblk_pool = dma_pool_create("adv_sgblk", board->dev, in advansys_wide_init_chip()
10667 if (!board->adv_sgblk_pool) in advansys_wide_init_chip()
10670 if (adv_dvc->chip_type == ADV_CHIP_ASC3550) { in advansys_wide_init_chip()
10673 } else if (adv_dvc->chip_type == ADV_CHIP_ASC38C0800) { in advansys_wide_init_chip()
10680 err_code = adv_dvc->err_code; in advansys_wide_init_chip()
10698 struct adv_dvc_var *adv_dvc = &board->dvc_var.adv_dvc_var; in advansys_wide_free_mem()
10700 if (adv_dvc->carrier) { in advansys_wide_free_mem()
10701 dma_free_coherent(board->dev, ADV_CARRIER_BUFSIZE, in advansys_wide_free_mem()
10702 adv_dvc->carrier, adv_dvc->carrier_addr); in advansys_wide_free_mem()
10703 adv_dvc->carrier = NULL; in advansys_wide_free_mem()
10705 if (board->adv_reqp) { in advansys_wide_free_mem()
10706 dma_free_coherent(board->dev, board->adv_reqp_size, in advansys_wide_free_mem()
10707 board->adv_reqp, board->adv_reqp_addr); in advansys_wide_free_mem()
10708 board->adv_reqp = NULL; in advansys_wide_free_mem()
10710 if (board->adv_sgblk_pool) { in advansys_wide_free_mem()
10711 dma_pool_destroy(board->adv_sgblk_pool); in advansys_wide_free_mem()
10712 board->adv_sgblk_pool = NULL; in advansys_wide_free_mem()
10725 pdev = (bus_type == ASC_IS_PCI) ? to_pci_dev(boardp->dev) : NULL; in advansys_board_found()
10729 asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; in advansys_board_found()
10730 asc_dvc_varp->bus_type = bus_type; in advansys_board_found()
10731 asc_dvc_varp->drv_ptr = boardp; in advansys_board_found()
10732 asc_dvc_varp->cfg = &boardp->dvc_cfg.asc_dvc_cfg; in advansys_board_found()
10733 asc_dvc_varp->iop_base = iop; in advansys_board_found()
10736 adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; in advansys_board_found()
10737 adv_dvc_varp->drv_ptr = boardp; in advansys_board_found()
10738 adv_dvc_varp->cfg = &boardp->dvc_cfg.adv_dvc_cfg; in advansys_board_found()
10739 if (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW) { in advansys_board_found()
10740 ASC_DBG(1, "wide board ASC-3550\n"); in advansys_board_found()
10741 adv_dvc_varp->chip_type = ADV_CHIP_ASC3550; in advansys_board_found()
10742 } else if (pdev->device == PCI_DEVICE_ID_38C0800_REV1) { in advansys_board_found()
10743 ASC_DBG(1, "wide board ASC-38C0800\n"); in advansys_board_found()
10744 adv_dvc_varp->chip_type = ADV_CHIP_ASC38C0800; in advansys_board_found()
10746 ASC_DBG(1, "wide board ASC-38C1600\n"); in advansys_board_found()
10747 adv_dvc_varp->chip_type = ADV_CHIP_ASC38C1600; in advansys_board_found()
10750 boardp->asc_n_io_port = pci_resource_len(pdev, 1); in advansys_board_found()
10751 boardp->ioremap_addr = pci_ioremap_bar(pdev, 1); in advansys_board_found()
10752 if (!boardp->ioremap_addr) { in advansys_board_found()
10756 boardp->asc_n_io_port); in advansys_board_found()
10757 ret = -ENODEV; in advansys_board_found()
10760 adv_dvc_varp->iop_base = (AdvPortAddr)boardp->ioremap_addr; in advansys_board_found()
10761 ASC_DBG(1, "iop_base: 0x%p\n", adv_dvc_varp->iop_base); in advansys_board_found()
10768 boardp->ioport = iop; in advansys_board_found()
10780 switch (asc_dvc_varp->bus_type) { in advansys_board_found()
10796 "%d\n", asc_dvc_varp->bus_type); in advansys_board_found()
10805 * referenced only use the bit-wise AND operator "&". in advansys_board_found()
10808 ret = AscInitGetConfig(shost) ? -ENODEV : 0; in advansys_board_found()
10818 ret = AdvInitGetConfig(pdev, shost) ? -ENODEV : 0; in advansys_board_found()
10821 ret = -ENODEV; in advansys_board_found()
10839 boardp->init_tidmask |= in advansys_board_found()
10840 ADV_TID_TO_TIDMASK(asc_dvc_varp->cfg->chip_scsi_id); in advansys_board_found()
10845 ep = &boardp->eep_config.asc_eep; in advansys_board_found()
10847 ep->init_sdtr = asc_dvc_varp->cfg->sdtr_enable; in advansys_board_found()
10848 ep->disc_enable = asc_dvc_varp->cfg->disc_enable; in advansys_board_found()
10849 ep->use_cmd_qng = asc_dvc_varp->cfg->cmd_qng_enabled; in advansys_board_found()
10851 ep->start_motor = asc_dvc_varp->start_motor; in advansys_board_found()
10852 ep->cntl = asc_dvc_varp->dvc_cntl; in advansys_board_found()
10853 ep->no_scam = asc_dvc_varp->no_scam; in advansys_board_found()
10854 ep->max_total_qng = asc_dvc_varp->max_total_qng; in advansys_board_found()
10855 ASC_EEP_SET_CHIP_ID(ep, asc_dvc_varp->cfg->chip_scsi_id); in advansys_board_found()
10857 ep->max_tag_qng = asc_dvc_varp->cfg->max_tag_qng[0]; in advansys_board_found()
10858 ep->adapter_info[0] = asc_dvc_varp->cfg->adapter_info[0]; in advansys_board_found()
10859 ep->adapter_info[1] = asc_dvc_varp->cfg->adapter_info[1]; in advansys_board_found()
10860 ep->adapter_info[2] = asc_dvc_varp->cfg->adapter_info[2]; in advansys_board_found()
10861 ep->adapter_info[3] = asc_dvc_varp->cfg->adapter_info[3]; in advansys_board_found()
10862 ep->adapter_info[4] = asc_dvc_varp->cfg->adapter_info[4]; in advansys_board_found()
10863 ep->adapter_info[5] = asc_dvc_varp->cfg->adapter_info[5]; in advansys_board_found()
10869 ret = AscInitSetConfig(pdev, shost) ? -ENODEV : 0; in advansys_board_found()
10880 if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { in advansys_board_found()
10881 ep_3550 = &boardp->eep_config.adv_3550_eep; in advansys_board_found()
10883 ep_3550->adapter_scsi_id = adv_dvc_varp->chip_scsi_id; in advansys_board_found()
10884 ep_3550->max_host_qng = adv_dvc_varp->max_host_qng; in advansys_board_found()
10885 ep_3550->max_dvc_qng = adv_dvc_varp->max_dvc_qng; in advansys_board_found()
10886 ep_3550->termination = adv_dvc_varp->cfg->termination; in advansys_board_found()
10887 ep_3550->disc_enable = adv_dvc_varp->cfg->disc_enable; in advansys_board_found()
10888 ep_3550->bios_ctrl = adv_dvc_varp->bios_ctrl; in advansys_board_found()
10889 ep_3550->wdtr_able = adv_dvc_varp->wdtr_able; in advansys_board_found()
10890 ep_3550->sdtr_able = adv_dvc_varp->sdtr_able; in advansys_board_found()
10891 ep_3550->ultra_able = adv_dvc_varp->ultra_able; in advansys_board_found()
10892 ep_3550->tagqng_able = adv_dvc_varp->tagqng_able; in advansys_board_found()
10893 ep_3550->start_motor = adv_dvc_varp->start_motor; in advansys_board_found()
10894 ep_3550->scsi_reset_delay = in advansys_board_found()
10895 adv_dvc_varp->scsi_reset_wait; in advansys_board_found()
10896 ep_3550->serial_number_word1 = in advansys_board_found()
10897 adv_dvc_varp->cfg->serial1; in advansys_board_found()
10898 ep_3550->serial_number_word2 = in advansys_board_found()
10899 adv_dvc_varp->cfg->serial2; in advansys_board_found()
10900 ep_3550->serial_number_word3 = in advansys_board_found()
10901 adv_dvc_varp->cfg->serial3; in advansys_board_found()
10902 } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { in advansys_board_found()
10903 ep_38C0800 = &boardp->eep_config.adv_38C0800_eep; in advansys_board_found()
10905 ep_38C0800->adapter_scsi_id = in advansys_board_found()
10906 adv_dvc_varp->chip_scsi_id; in advansys_board_found()
10907 ep_38C0800->max_host_qng = adv_dvc_varp->max_host_qng; in advansys_board_found()
10908 ep_38C0800->max_dvc_qng = adv_dvc_varp->max_dvc_qng; in advansys_board_found()
10909 ep_38C0800->termination_lvd = in advansys_board_found()
10910 adv_dvc_varp->cfg->termination; in advansys_board_found()
10911 ep_38C0800->disc_enable = in advansys_board_found()
10912 adv_dvc_varp->cfg->disc_enable; in advansys_board_found()
10913 ep_38C0800->bios_ctrl = adv_dvc_varp->bios_ctrl; in advansys_board_found()
10914 ep_38C0800->wdtr_able = adv_dvc_varp->wdtr_able; in advansys_board_found()
10915 ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able; in advansys_board_found()
10916 ep_38C0800->sdtr_speed1 = adv_dvc_varp->sdtr_speed1; in advansys_board_found()
10917 ep_38C0800->sdtr_speed2 = adv_dvc_varp->sdtr_speed2; in advansys_board_found()
10918 ep_38C0800->sdtr_speed3 = adv_dvc_varp->sdtr_speed3; in advansys_board_found()
10919 ep_38C0800->sdtr_speed4 = adv_dvc_varp->sdtr_speed4; in advansys_board_found()
10920 ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able; in advansys_board_found()
10921 ep_38C0800->start_motor = adv_dvc_varp->start_motor; in advansys_board_found()
10922 ep_38C0800->scsi_reset_delay = in advansys_board_found()
10923 adv_dvc_varp->scsi_reset_wait; in advansys_board_found()
10924 ep_38C0800->serial_number_word1 = in advansys_board_found()
10925 adv_dvc_varp->cfg->serial1; in advansys_board_found()
10926 ep_38C0800->serial_number_word2 = in advansys_board_found()
10927 adv_dvc_varp->cfg->serial2; in advansys_board_found()
10928 ep_38C0800->serial_number_word3 = in advansys_board_found()
10929 adv_dvc_varp->cfg->serial3; in advansys_board_found()
10931 ep_38C1600 = &boardp->eep_config.adv_38C1600_eep; in advansys_board_found()
10933 ep_38C1600->adapter_scsi_id = in advansys_board_found()
10934 adv_dvc_varp->chip_scsi_id; in advansys_board_found()
10935 ep_38C1600->max_host_qng = adv_dvc_varp->max_host_qng; in advansys_board_found()
10936 ep_38C1600->max_dvc_qng = adv_dvc_varp->max_dvc_qng; in advansys_board_found()
10937 ep_38C1600->termination_lvd = in advansys_board_found()
10938 adv_dvc_varp->cfg->termination; in advansys_board_found()
10939 ep_38C1600->disc_enable = in advansys_board_found()
10940 adv_dvc_varp->cfg->disc_enable; in advansys_board_found()
10941 ep_38C1600->bios_ctrl = adv_dvc_varp->bios_ctrl; in advansys_board_found()
10942 ep_38C1600->wdtr_able = adv_dvc_varp->wdtr_able; in advansys_board_found()
10943 ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able; in advansys_board_found()
10944 ep_38C1600->sdtr_speed1 = adv_dvc_varp->sdtr_speed1; in advansys_board_found()
10945 ep_38C1600->sdtr_speed2 = adv_dvc_varp->sdtr_speed2; in advansys_board_found()
10946 ep_38C1600->sdtr_speed3 = adv_dvc_varp->sdtr_speed3; in advansys_board_found()
10947 ep_38C1600->sdtr_speed4 = adv_dvc_varp->sdtr_speed4; in advansys_board_found()
10948 ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able; in advansys_board_found()
10949 ep_38C1600->start_motor = adv_dvc_varp->start_motor; in advansys_board_found()
10950 ep_38C1600->scsi_reset_delay = in advansys_board_found()
10951 adv_dvc_varp->scsi_reset_wait; in advansys_board_found()
10952 ep_38C1600->serial_number_word1 = in advansys_board_found()
10953 adv_dvc_varp->cfg->serial1; in advansys_board_found()
10954 ep_38C1600->serial_number_word2 = in advansys_board_found()
10955 adv_dvc_varp->cfg->serial2; in advansys_board_found()
10956 ep_38C1600->serial_number_word3 = in advansys_board_found()
10957 adv_dvc_varp->cfg->serial3; in advansys_board_found()
10963 boardp->init_tidmask |= in advansys_board_found()
10964 ADV_TID_TO_TIDMASK(adv_dvc_varp->chip_scsi_id); in advansys_board_found()
10969 * structure supports one channel. Multi-channel boards have a in advansys_board_found()
10972 shost->max_channel = 0; in advansys_board_found()
10974 shost->max_id = ASC_MAX_TID + 1; in advansys_board_found()
10975 shost->max_lun = ASC_MAX_LUN + 1; in advansys_board_found()
10976 shost->max_cmd_len = ASC_MAX_CDB_LEN; in advansys_board_found()
10978 shost->io_port = asc_dvc_varp->iop_base; in advansys_board_found()
10979 boardp->asc_n_io_port = ASC_IOADR_GAP; in advansys_board_found()
10980 shost->this_id = asc_dvc_varp->cfg->chip_scsi_id; in advansys_board_found()
10983 shost->can_queue = asc_dvc_varp->max_total_qng; in advansys_board_found()
10985 shost->max_id = ADV_MAX_TID + 1; in advansys_board_found()
10986 shost->max_lun = ADV_MAX_LUN + 1; in advansys_board_found()
10987 shost->max_cmd_len = ADV_MAX_CDB_LEN; in advansys_board_found()
10995 shost->io_port = iop; in advansys_board_found()
10997 shost->this_id = adv_dvc_varp->chip_scsi_id; in advansys_board_found()
11000 shost->can_queue = adv_dvc_varp->max_host_qng; in advansys_board_found()
11004 * Set the maximum number of scatter-gather elements the in advansys_board_found()
11009 * Allow two commands with 'sg_tablesize' scatter-gather in advansys_board_found()
11014 shost->sg_tablesize = in advansys_board_found()
11015 (((asc_dvc_varp->max_total_qng - 2) / 2) * in advansys_board_found()
11018 shost->sg_tablesize = ADV_MAX_SG_LIST; in advansys_board_found()
11023 * mid-level driver definition of SG_ALL. SG_ALL also in advansys_board_found()
11025 * size of the scatter-gather table in 'struct asc_sg_head'. in advansys_board_found()
11027 if (shost->sg_tablesize > SG_ALL) { in advansys_board_found()
11028 shost->sg_tablesize = SG_ALL; in advansys_board_found()
11031 ASC_DBG(1, "sg_tablesize: %d\n", shost->sg_tablesize); in advansys_board_found()
11035 shost->base = AscGetChipBiosAddress(asc_dvc_varp->iop_base, in advansys_board_found()
11036 asc_dvc_varp->bus_type); in advansys_board_found()
11039 * Fill-in BIOS board variables. The Wide BIOS saves in advansys_board_found()
11042 AdvReadWordLram(adv_dvc_varp->iop_base, in advansys_board_found()
11043 BIOS_SIGNATURE, boardp->bios_signature); in advansys_board_found()
11044 AdvReadWordLram(adv_dvc_varp->iop_base, in advansys_board_found()
11045 BIOS_VERSION, boardp->bios_version); in advansys_board_found()
11046 AdvReadWordLram(adv_dvc_varp->iop_base, in advansys_board_found()
11047 BIOS_CODESEG, boardp->bios_codeseg); in advansys_board_found()
11048 AdvReadWordLram(adv_dvc_varp->iop_base, in advansys_board_found()
11049 BIOS_CODELEN, boardp->bios_codelen); in advansys_board_found()
11052 boardp->bios_signature, boardp->bios_version); in advansys_board_found()
11055 boardp->bios_codeseg, boardp->bios_codelen); in advansys_board_found()
11061 if (boardp->bios_signature == 0x55AA) { in advansys_board_found()
11064 * address by shifting left 4. in advansys_board_found()
11066 shost->base = ((ulong)boardp->bios_codeseg << 4); in advansys_board_found()
11068 shost->base = 0; in advansys_board_found()
11073 * Register Board Resources - I/O Port, DMA, IRQ in advansys_board_found()
11077 shost->dma_channel = NO_ISA_DMA; /* Default to no ISA DMA. */ in advansys_board_found()
11080 ASC_DBG(2, "request_irq(%d, %p)\n", boardp->irq, shost); in advansys_board_found()
11082 ret = request_irq(boardp->irq, advansys_interrupt, share_irq, in advansys_board_found()
11086 if (ret == -EBUSY) { in advansys_board_found()
11088 "already in use\n", boardp->irq); in advansys_board_found()
11089 } else if (ret == -EINVAL) { in advansys_board_found()
11091 "not valid\n", boardp->irq); in advansys_board_found()
11094 "failed with %d\n", boardp->irq, ret); in advansys_board_found()
11105 asc_dvc_varp->overrun_buf = kzalloc(ASC_OVERRUN_BSIZE, GFP_KERNEL); in advansys_board_found()
11106 if (!asc_dvc_varp->overrun_buf) { in advansys_board_found()
11107 ret = -ENOMEM; in advansys_board_found()
11112 if (warn_code || asc_dvc_varp->err_code) { in advansys_board_found()
11115 asc_dvc_varp->init_state, warn_code, in advansys_board_found()
11116 asc_dvc_varp->err_code); in advansys_board_found()
11117 if (!asc_dvc_varp->overrun_dma) { in advansys_board_found()
11118 ret = -ENODEV; in advansys_board_found()
11124 ret = -ENODEV; in advansys_board_found()
11131 ret = scsi_add_host(shost, boardp->dev); in advansys_board_found()
11140 if (asc_dvc_varp->overrun_dma) in advansys_board_found()
11141 dma_unmap_single(boardp->dev, asc_dvc_varp->overrun_dma, in advansys_board_found()
11143 kfree(asc_dvc_varp->overrun_buf); in advansys_board_found()
11147 free_irq(boardp->irq, shost); in advansys_board_found()
11149 if (boardp->ioremap_addr) in advansys_board_found()
11150 iounmap(boardp->ioremap_addr); in advansys_board_found()
11167 free_irq(board->irq, shost); in advansys_release()
11170 dma_unmap_single(board->dev, in advansys_release()
11171 board->dvc_var.asc_dvc_var.overrun_dma, in advansys_release()
11173 kfree(board->dvc_var.asc_dvc_var.overrun_buf); in advansys_release()
11175 iounmap(board->ioremap_addr); in advansys_release()
11198 * The VLB IRQ number is found in bits 2 to 4 of the CfgLsw. It decodes as:
11219 int err = -ENODEV; in advansys_vlb_probe()
11226 return -ENODEV; in advansys_vlb_probe()
11239 err = -ENOMEM; in advansys_vlb_probe()
11245 board->irq = advansys_vlb_irq_no(iop_base); in advansys_vlb_probe()
11246 board->dev = dev; in advansys_vlb_probe()
11247 board->shost = shost; in advansys_vlb_probe()
11260 return -ENODEV; in advansys_vlb_probe()
11301 unsigned short cfg_lsw = inw(edev->base_addr + 0xc86); in advansys_eisa_irq_no()
11315 err = -ENOMEM; in advansys_eisa_probe()
11319 ioport = edev->base_addr + 0xc30; in advansys_eisa_probe()
11321 err = -ENODEV; in advansys_eisa_probe()
11326 printk(KERN_WARNING "Region %x-%x busy\n", ioport, in advansys_eisa_probe()
11327 ioport + ASC_IOADR_GAP - 1); in advansys_eisa_probe()
11342 inw(ioport + 4); in advansys_eisa_probe()
11347 err = -ENOMEM; in advansys_eisa_probe()
11353 board->irq = irq; in advansys_eisa_probe()
11354 board->dev = dev; in advansys_eisa_probe()
11355 board->shost = shost; in advansys_eisa_probe()
11359 data->host[i] = shost; in advansys_eisa_probe()
11375 kfree(data->host[0]); in advansys_eisa_probe()
11376 kfree(data->host[1]); in advansys_eisa_probe()
11389 struct Scsi_Host *shost = data->host[i]; in advansys_eisa_remove()
11392 ioport = shost->io_port; in advansys_eisa_remove()
11431 if ((pdev->device == PCI_DEVICE_ID_ASP_1200A) || in advansys_set_latency()
11432 (pdev->device == PCI_DEVICE_ID_ASP_ABP940)) { in advansys_set_latency()
11458 err = -ENODEV; in advansys_pci_probe()
11464 err = -ENOMEM; in advansys_pci_probe()
11470 board->irq = pdev->irq; in advansys_pci_probe()
11471 board->dev = &pdev->dev; in advansys_pci_probe()
11472 board->shost = shost; in advansys_pci_probe()
11474 if (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW || in advansys_pci_probe()
11475 pdev->device == PCI_DEVICE_ID_38C0800_REV1 || in advansys_pci_probe()
11476 pdev->device == PCI_DEVICE_ID_38C1600_REV1) { in advansys_pci_probe()
11477 board->flags |= ASC_IS_WIDE_BOARD; in advansys_pci_probe()