• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/linux/linux-2.6/drivers/scsi/

Lines Matching defs:ha

259           DMA addresses that are kept in each ha
419 #define IS_ISP1040(ha) (ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1020)
420 #define IS_ISP1x40(ha) (ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1020 || \
421 ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1240)
422 #define IS_ISP1x160(ha) (ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP10160 || \
423 ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP12160)
613 static int qla1280_read_nvram(struct scsi_qla_host *ha)
625 printk(KERN_INFO "scsi(%ld): Reading NVRAM\n", ha->host_no);
627 wptr = (uint16_t *)&ha->nvram;
628 nv = &ha->nvram;
631 *wptr = qla1280_get_nvram_word(ha, cnt);
643 *wptr = qla1280_get_nvram_word(ha, cnt);
659 "settings\n", ha->host_no);
660 ha->nvram_valid = 0;
662 ha->nvram_valid = 1;
701 struct scsi_qla_host *ha;
705 ha = (struct scsi_qla_host *)host->hostdata;
706 bdp = &ql1280_board_tbl[ha->devnum];
732 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata;
749 status = qla1280_64bit_start_scsi(ha, sp);
751 status = qla1280_32bit_start_scsi(ha, sp);
776 struct scsi_qla_host *ha = (struct scsi_qla_host *)__data;
778 reg = ha->iobase;
780 ha->mailbox_out[0] = RD_REG_WORD(&reg->mailbox0);
782 "ictrl %04x, istatus %04x\n", ha->host_no, ha->mailbox_out[0],
784 complete(ha->mailbox_wait);
809 struct scsi_qla_host *ha;
818 ha = (struct scsi_qla_host *)(CMD_HOST(cmd)->hostdata);
821 RD_REG_WORD(&ha->iobase->istatus));
824 RD_REG_WORD(&ha->iobase->host_cmd),
825 RD_REG_WORD(&ha->iobase->ictrl), jiffies);
831 ha->host_no, cmd, CMD_HANDLE(cmd), action);
840 ha = (struct scsi_qla_host *)cmd->device->host->hostdata;
845 data = qla1280_debounce_register(&ha->iobase->istatus);
852 qla1280_isr(ha, &ha->done_q);
891 if (sp == ha->outstanding_cmds[i]) {
893 if (qla1280_abort_command(ha, sp, i) == 0)
907 ha->host_no, bus, target, lun);
917 "command.\n", ha->host_no, bus, target, lun);
918 if (qla1280_abort_device(ha, bus, target, lun) == 0)
926 "command.\n", ha->host_no, bus, target, lun);
927 if (qla1280_device_reset(ha, bus, target) == 0)
934 "reset.\n", ha->host_no, bus);
935 if (qla1280_bus_reset(ha, bus) == 0)
944 ha->host_no);
946 "continue automatically\n", ha->host_no);
948 ha->flags.reset_active = 1;
953 if (qla1280_abort_isp(ha) == 0)
956 ha->flags.reset_active = 0;
959 if (!list_empty(&ha->done_q))
960 qla1280_done(ha);
983 spin_unlock_irq(ha->host->host_lock);
986 spin_lock_irq(ha->host->host_lock);
1095 qla1280_disable_intrs(struct scsi_qla_host *ha)
1097 WRT_REG_WORD(&ha->iobase->ictrl, 0);
1098 RD_REG_WORD(&ha->iobase->ictrl); /* PCI Posted Write flush */
1103 qla1280_enable_intrs(struct scsi_qla_host *ha)
1105 WRT_REG_WORD(&ha->iobase->ictrl, (ISP_EN_INT | ISP_EN_RISC));
1106 RD_REG_WORD(&ha->iobase->ictrl); /* PCI Posted Write flush */
1116 struct scsi_qla_host *ha;
1122 ha = (struct scsi_qla_host *)dev_id;
1124 spin_lock(ha->host->host_lock);
1126 ha->isr_count++;
1127 reg = ha->iobase;
1129 qla1280_disable_intrs(ha);
1134 qla1280_isr(ha, &ha->done_q);
1137 if (!list_empty(&ha->done_q))
1138 qla1280_done(ha);
1140 spin_unlock(ha->host->host_lock);
1142 qla1280_enable_intrs(ha);
1150 qla1280_set_target_parameters(struct scsi_qla_host *ha, int bus, int target)
1157 nv = &ha->nvram;
1173 if (IS_ISP1x160(ha)) {
1184 status = qla1280_mailbox_command(ha, mr, mb);
1193 status |= qla1280_mailbox_command(ha, 0x0f, mb);
1199 ha->host_no, bus, target);
1218 struct scsi_qla_host *ha;
1226 ha = (struct scsi_qla_host *)device->host->hostdata;
1227 nv = &ha->nvram;
1229 if (qla1280_check_for_dead_scsi_bus(ha, bus))
1233 (ha->bus_settings[bus].qtag_enables & (BIT_0 << target))) {
1235 ha->bus_settings[bus].hiwat);
1252 if (IS_ISP1x160(ha)) {
1259 spin_lock_irqsave(ha->host->host_lock, flags);
1261 status = qla1280_set_target_parameters(ha, bus, target);
1262 qla1280_get_target_parameters(ha, device);
1263 spin_unlock_irqrestore(ha->host->host_lock, flags);
1273 * ha = adapter block pointer.
1276 qla1280_done(struct scsi_qla_host *ha)
1285 done_q = &ha->done_q;
1300 qla1280_marker(ha, bus, target, 0, MK_SYNC_ID);
1314 pci_unmap_sg(ha->pdev, cmd->request_buffer,
1317 pci_unmap_single(ha->pdev, sp->saved_dma_handle,
1324 ha->actthreads--;
1445 * ha = adapter block pointer.
1451 qla1280_initialize_adapter(struct scsi_qla_host *ha)
1461 ha->flags.online = 0;
1462 ha->flags.disable_host_adapter = 0;
1463 ha->flags.reset_active = 0;
1464 ha->flags.abort_isp_active = 0;
1469 "dual channel lockup workaround\n", ha->host_no);
1470 ha->flags.use_pci_vchannel = 1;
1476 if (IS_ISP1040(ha))
1481 reg = ha->iobase;
1489 if (qla1280_read_nvram(ha)) {
1499 spin_lock_irqsave(ha->host->host_lock, flags);
1501 status = qla1280_load_firmware(ha);
1504 ha->host_no);
1509 dprintk(1, "scsi(%ld): Configure NVRAM parameters\n", ha->host_no);
1510 qla1280_nvram_config(ha);
1512 if (ha->flags.disable_host_adapter) {
1517 status = qla1280_init_rings(ha);
1522 for (bus = 0; bus < ha->ports; bus++) {
1523 if (!ha->bus_settings[bus].disable_scsi_reset &&
1524 qla1280_bus_reset(ha, bus) &&
1525 qla1280_bus_reset(ha, bus))
1526 ha->bus_settings[bus].scsi_bus_dead = 1;
1529 ha->flags.online = 1;
1531 spin_unlock_irqrestore(ha->host->host_lock, flags);
1545 * ha = adapter block pointer.
1551 qla1280_chip_diag(struct scsi_qla_host *ha)
1554 struct device_reg __iomem *reg = ha->iobase;
1560 dprintk(1, "scsi(%ld): Verifying chip\n", ha->host_no);
1629 qla1280_enable_intrs(ha);
1642 status = qla1280_mailbox_command(ha, 0xff, mb);
1661 qla1280_load_firmware_pio(struct scsi_qla_host *ha)
1668 risc_address = *ql1280_board_tbl[ha->devnum].fwstart;
1669 risc_code_address = ql1280_board_tbl[ha->devnum].fwcode;
1670 risc_code_size = *ql1280_board_tbl[ha->devnum].fwlen;
1677 err = qla1280_mailbox_command(ha, BIT_0 | BIT_1 | BIT_2, mb);
1680 ha->host_no);
1690 qla1280_load_firmware_dma(struct scsi_qla_host *ha)
1699 tbuf = pci_alloc_consistent(ha->pdev, 8000, &p_tbuf);
1705 risc_address = *ql1280_board_tbl[ha->devnum].fwstart;
1706 risc_code_address = ql1280_board_tbl[ha->devnum].fwcode;
1707 risc_code_size = *ql1280_board_tbl[ha->devnum].fwlen;
1725 ((__le16 *)ha->request_ring)[i] =
1731 mb[3] = ha->request_dma & 0xffff;
1732 mb[2] = (ha->request_dma >> 16) & 0xffff;
1733 mb[7] = pci_dma_hi32(ha->request_dma) & 0xffff;
1734 mb[6] = pci_dma_hi32(ha->request_dma) >> 16;
1737 (void *)(long)ha->request_dma,
1739 err = qla1280_mailbox_command(ha, BIT_4 | BIT_3 | BIT_2 |
1743 "segment of f\n", ha->host_no);
1756 err = qla1280_mailbox_command(ha, BIT_4 | BIT_3 | BIT_2 |
1763 sp = (uint8_t *)ha->request_ring;
1784 pci_free_consistent(ha->pdev, 8000, tbuf, p_tbuf);
1790 qla1280_start_firmware(struct scsi_qla_host *ha)
1801 mb[1] = *ql1280_board_tbl[ha->devnum].fwstart;
1802 err = qla1280_mailbox_command(ha, BIT_1 | BIT_0, mb);
1804 printk(KERN_ERR "scsi(%li): RISC checksum failed.\n", ha->host_no);
1811 mb[1] = *ql1280_board_tbl[ha->devnum].fwstart;
1812 err = qla1280_mailbox_command(ha, BIT_1 | BIT_0, &mb[0]);
1815 ha->host_no);
1822 qla1280_load_firmware(struct scsi_qla_host *ha)
1826 err = qla1280_chip_diag(ha);
1829 if (IS_ISP1040(ha))
1830 err = qla1280_load_firmware_pio(ha);
1832 err = qla1280_load_firmware_dma(ha);
1835 err = qla1280_start_firmware(ha);
1844 * ha = adapter block pointer.
1845 * ha->request_ring = request ring virtual address
1846 * ha->response_ring = response ring virtual address
1847 * ha->request_dma = request ring physical address
1848 * ha->response_dma = response ring physical address
1854 qla1280_init_rings(struct scsi_qla_host *ha)
1862 memset(ha->outstanding_cmds, 0,
1866 ha->request_ring_ptr = ha->request_ring;
1867 ha->req_ring_index = 0;
1868 ha->req_q_cnt = REQUEST_ENTRY_CNT;
1872 mb[3] = ha->request_dma & 0xffff;
1873 mb[2] = (ha->request_dma >> 16) & 0xffff;
1875 mb[7] = pci_dma_hi32(ha->request_dma) & 0xffff;
1876 mb[6] = pci_dma_hi32(ha->request_dma) >> 16;
1877 if (!(status = qla1280_mailbox_command(ha, BIT_7 | BIT_6 | BIT_4 |
1881 ha->response_ring_ptr = ha->response_ring;
1882 ha->rsp_ring_index = 0;
1886 mb[3] = ha->response_dma & 0xffff;
1887 mb[2] = (ha->response_dma >> 16) & 0xffff;
1889 mb[7] = pci_dma_hi32(ha->response_dma) & 0xffff;
1890 mb[6] = pci_dma_hi32(ha->response_dma) >> 16;
1891 status = qla1280_mailbox_command(ha, BIT_7 | BIT_6 | BIT_5 |
1954 qla1280_set_target_defaults(struct scsi_qla_host *ha, int bus, int target)
1956 struct nvram *nv = &ha->nvram;
1968 if (IS_ISP1x160(ha)) {
1983 qla1280_set_defaults(struct scsi_qla_host *ha)
1985 struct nvram *nv = &ha->nvram;
2007 if (IS_ISP1040(ha))
2012 if (IS_ISP1x160(ha))
2022 if (IS_ISP1040(ha)) {
2032 qla1280_set_target_defaults(ha, bus, target);
2037 qla1280_config_target(struct scsi_qla_host *ha, int bus, int target)
2039 struct nvram *nv = &ha->nvram;
2056 if (IS_ISP1x160(ha))
2061 status = qla1280_mailbox_command(ha, 0x0f, mb);
2066 ha->bus_settings[bus].qtag_enables |= flag;
2069 if (IS_ISP1x160(ha)) {
2071 ha->bus_settings[bus].device_enables |= flag;
2072 ha->bus_settings[bus].lun_disables |= 0;
2075 ha->bus_settings[bus].device_enables |= flag;
2078 ha->bus_settings[bus].lun_disables |= flag;
2088 status |= qla1280_mailbox_command(ha, 0x0f, mb);
2095 qla1280_config_bus(struct scsi_qla_host *ha, int bus)
2097 struct nvram *nv = &ha->nvram;
2102 ha->bus_settings[bus].disable_scsi_reset =
2106 ha->bus_settings[bus].id = nv->bus[bus].config_1.initiator_id;
2108 mb[1] = bus ? ha->bus_settings[bus].id | BIT_7 :
2109 ha->bus_settings[bus].id;
2110 status = qla1280_mailbox_command(ha, BIT_1 | BIT_0, &mb[0]);
2113 ha->bus_settings[bus].bus_reset_delay =
2117 ha->bus_settings[bus].hiwat = nv->bus[bus].max_queue_depth - 1;
2121 status |= qla1280_config_target(ha, bus, target);
2127 qla1280_nvram_config(struct scsi_qla_host *ha)
2129 struct device_reg __iomem *reg = ha->iobase;
2130 struct nvram *nv = &ha->nvram;
2136 if (ha->nvram_valid) {
2144 qla1280_set_defaults(ha);
2150 ha->flags.disable_risc_code_load =
2153 if (IS_ISP1040(ha)) {
2178 if (ha->ports > 1)
2196 status |= qla1280_mailbox_command(ha, BIT_1 | BIT_0, &mb[0]);
2198 if (IS_ISP1x40(ha)) {
2202 status |= qla1280_mailbox_command(ha, BIT_1 | BIT_0, mb);
2213 "workaround\n", ha->host_no);
2217 status |= qla1280_mailbox_command(ha, BIT_1 | BIT_0, mb);
2225 status |= qla1280_mailbox_command(ha, BIT_7 | BIT_6 | BIT_2 |
2232 status |= qla1280_mailbox_command(ha, BIT_2 | BIT_1 | BIT_0, &mb[0]);
2246 status |= qla1280_mailbox_command(ha, BIT_2 | BIT_1 | BIT_0, mb);
2250 status |= qla1280_mailbox_command(ha, BIT_1 | BIT_0, mb);
2256 status |= qla1280_mailbox_command(ha, BIT_2 | BIT_1 | BIT_0, mb);
2260 status |= qla1280_mailbox_command(ha, BIT_1 | BIT_0, mb);
2266 status |= qla1280_mailbox_command(ha, BIT_2 | BIT_1 | BIT_0, mb);
2268 for (bus = 0; bus < ha->ports; bus++)
2269 status |= qla1280_config_bus(ha, bus);
2284 * ha = adapter block pointer.
2291 qla1280_get_nvram_word(struct scsi_qla_host *ha, uint32_t address)
2299 data = le16_to_cpu(qla1280_nvram_request(ha, nv_cmd));
2312 * ha = adapter block pointer.
2322 qla1280_nvram_request(struct scsi_qla_host *ha, uint32_t nv_cmd)
2324 struct device_reg __iomem *reg = ha->iobase;
2334 qla1280_nv_write(ha, NV_DATA_OUT);
2336 qla1280_nv_write(ha, 0);
2365 qla1280_nv_write(struct scsi_qla_host *ha, uint16_t data)
2367 struct device_reg __iomem *reg = ha->iobase;
2385 * ha = adapter block pointer.
2396 qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb)
2398 struct device_reg __iomem *reg = ha->iobase;
2409 if (ha->mailbox_wait) {
2412 ha->mailbox_wait = &wait;
2436 timer.data = (unsigned long)ha;
2440 spin_unlock_irq(ha->host->host_lock);
2447 spin_lock_irq(ha->host->host_lock);
2449 ha->mailbox_wait = NULL;
2452 if (ha->mailbox_out[0] != MBS_CMD_CMP) {
2456 mb[0], ha->mailbox_out[0], RD_REG_WORD(&reg->istatus));
2468 iptr = (uint16_t *) &ha->mailbox_out[0];
2473 if (ha->flags.reset_marker)
2474 qla1280_rst_aen(ha);
2490 * ha = adapter block pointer.
2493 qla1280_poll(struct scsi_qla_host *ha)
2495 struct device_reg __iomem *reg = ha->iobase;
2504 qla1280_isr(ha, &done_q);
2506 if (!ha->mailbox_wait) {
2507 if (ha->flags.reset_marker)
2508 qla1280_rst_aen(ha);
2512 qla1280_done(ha);
2522 * ha = adapter block pointer.
2529 qla1280_bus_reset(struct scsi_qla_host *ha, int bus)
2539 ha->host_no, bus);
2541 reset_delay = ha->bus_settings[bus].bus_reset_delay;
2545 status = qla1280_mailbox_command(ha, BIT_2 | BIT_1 | BIT_0, &mb[0]);
2548 if (ha->bus_settings[bus].failed_reset_count > 2)
2549 ha->bus_settings[bus].scsi_bus_dead = 1;
2550 ha->bus_settings[bus].failed_reset_count++;
2552 spin_unlock_irq(ha->host->host_lock);
2554 spin_lock_irq(ha->host->host_lock);
2556 ha->bus_settings[bus].scsi_bus_dead = 0;
2557 ha->bus_settings[bus].failed_reset_count = 0;
2558 ha->bus_settings[bus].reset_marker = 0;
2560 qla1280_marker(ha, bus, 0, 0, MK_SYNC_ALL);
2581 * ha = adapter block pointer.
2589 qla1280_device_reset(struct scsi_qla_host *ha, int bus, int target)
2599 status = qla1280_mailbox_command(ha, BIT_2 | BIT_1 | BIT_0, &mb[0]);
2602 qla1280_marker(ha, bus, target, 0, MK_SYNC_ID);
2616 * ha = adapter block pointer.
2625 qla1280_abort_device(struct scsi_qla_host *ha, int bus, int target, int lun)
2634 status = qla1280_mailbox_command(ha, BIT_1 | BIT_0, &mb[0]);
2637 qla1280_marker(ha, bus, target, lun, MK_SYNC_ID_LUN);
2651 * ha = adapter block pointer.
2658 qla1280_abort_command(struct scsi_qla_host *ha, struct srb * sp, int handle)
2676 status = qla1280_mailbox_command(ha, 0x0f, &mb[0]);
2693 * ha = adapter block pointer.
2696 qla1280_reset_adapter(struct scsi_qla_host *ha)
2698 struct device_reg __iomem *reg = ha->iobase;
2703 ha->flags.online = 0;
2717 * ha = adapter block pointer.
2724 qla1280_marker(struct scsi_qla_host *ha, int bus, int id, int lun, u8 type)
2731 if ((pkt = (struct mrk_entry *) qla1280_req_pkt(ha))) {
2739 qla1280_isp_cmd(ha);
2752 * ha = adapter block pointer.
2760 qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
2762 struct device_reg __iomem *reg = ha->iobase;
2780 seg_cnt = pci_map_sg(ha->pdev, sg, cmd->use_sg,
2794 if ((req_cnt + 2) >= ha->req_q_cnt) {
2797 if (ha->req_ring_index < cnt)
2798 ha->req_q_cnt = cnt - ha->req_ring_index;
2800 ha->req_q_cnt =
2801 REQUEST_ENTRY_CNT - (ha->req_ring_index - cnt);
2805 ha->req_q_cnt, seg_cnt);
2808 if ((req_cnt + 2) >= ha->req_q_cnt) {
2811 "0x%xreq_cnt=0x%x", ha->req_ring_index, ha->req_q_cnt,
2818 ha->outstanding_cmds[cnt] != 0; cnt++);
2823 "OUTSTANDING ARRAY, req_q_cnt=0x%x", ha->req_q_cnt);
2827 ha->outstanding_cmds[cnt] = sp;
2828 ha->req_q_cnt -= req_cnt;
2840 pkt = (cmd_a64_entry_t *) ha->request_ring_ptr;
2844 pkt->sys_define = (uint8_t) ha->req_ring_index;
2887 if (ha->flags.use_pci_vchannel)
2888 sn_pci_set_vchan(ha->pdev,
2918 ha->req_ring_index++;
2919 if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
2920 ha->req_ring_index = 0;
2921 ha->request_ring_ptr =
2922 ha->request_ring;
2924 ha->request_ring_ptr++;
2926 pkt = (cmd_a64_entry_t *)ha->request_ring_ptr;
2936 (uint8_t)ha->req_ring_index;
2946 if (ha->flags.use_pci_vchannel)
2947 sn_pci_set_vchan(ha->pdev,
2971 dma_handle = pci_map_single(ha->pdev,
2978 if (ha->flags.use_pci_vchannel)
2979 sn_pci_set_vchan(ha->pdev,
3001 ha->req_ring_index++;
3002 if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
3003 ha->req_ring_index = 0;
3004 ha->request_ring_ptr = ha->request_ring;
3006 ha->request_ring_ptr++;
3012 ha->actthreads++;
3013 WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index);
3040 * ha = adapter block pointer.
3047 qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3049 struct device_reg __iomem *reg = ha->iobase;
3076 seg_cnt = pci_map_sg(ha->pdev, sg, cmd->use_sg,
3100 if ((req_cnt + 2) >= ha->req_q_cnt) {
3103 if (ha->req_ring_index < cnt)
3104 ha->req_q_cnt = cnt - ha->req_ring_index;
3106 ha->req_q_cnt =
3107 REQUEST_ENTRY_CNT - (ha->req_ring_index - cnt);
3111 ha->req_q_cnt, seg_cnt);
3113 if ((req_cnt + 2) >= ha->req_q_cnt) {
3116 "req_q_cnt=0x%x, req_cnt=0x%x", ha->req_ring_index,
3117 ha->req_q_cnt, req_cnt);
3123 (ha->outstanding_cmds[cnt] != 0); cnt++) ;
3128 "ARRAY, req_q_cnt=0x%x\n", ha->req_q_cnt);
3133 ha->outstanding_cmds[cnt] = sp;
3134 ha->req_q_cnt -= req_cnt;
3139 pkt = (struct cmd_entry *) ha->request_ring_ptr;
3143 pkt->sys_define = (uint8_t) ha->req_ring_index;
3203 ha->req_ring_index++;
3204 if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
3205 ha->req_ring_index = 0;
3206 ha->request_ring_ptr =
3207 ha->request_ring;
3209 ha->request_ring_ptr++;
3211 pkt = (struct cmd_entry *)ha->request_ring_ptr;
3222 (uint8_t) ha->req_ring_index;
3250 dma_handle = pci_map_single(ha->pdev,
3265 qla1280_dump_buffer(5, (char *)ha->request_ring_ptr,
3269 ha->req_ring_index++;
3270 if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
3271 ha->req_ring_index = 0;
3272 ha->request_ring_ptr = ha->request_ring;
3274 ha->request_ring_ptr++;
3280 ha->actthreads++;
3281 WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index);
3301 * ha = adapter block pointer.
3307 qla1280_req_pkt(struct scsi_qla_host *ha)
3309 struct device_reg __iomem *reg = ha->iobase;
3321 if (ha->req_q_cnt > 0) {
3324 if (ha->req_ring_index < cnt)
3325 ha->req_q_cnt = cnt - ha->req_ring_index;
3327 ha->req_q_cnt =
3328 REQUEST_ENTRY_CNT - (ha->req_ring_index - cnt);
3332 if (ha->req_q_cnt > 0) {
3333 ha->req_q_cnt--;
3334 pkt = ha->request_ring_ptr;
3344 pkt->sys_define = (uint8_t) ha->req_ring_index;
3355 qla1280_poll(ha);
3372 * ha = adapter block pointer.
3375 qla1280_isp_cmd(struct scsi_qla_host *ha)
3377 struct device_reg __iomem *reg = ha->iobase;
3382 qla1280_dump_buffer(5, (char *)ha->request_ring_ptr,
3386 ha->req_ring_index++;
3387 if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
3388 ha->req_ring_index = 0;
3389 ha->request_ring_ptr = ha->request_ring;
3391 ha->request_ring_ptr++;
3406 WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index);
3421 * ha = adapter block pointer.
3425 qla1280_isr(struct scsi_qla_host *ha, struct list_head *done_q)
3427 struct device_reg __iomem *reg = ha->iobase;
3479 if (ha->flags.online) {
3485 sp = ha->outstanding_cmds[index];
3491 ha->outstanding_cmds[index] = NULL;
3509 ha->flags.reset_marker = 1;
3511 ha->bus_settings[index].reset_marker = 1;
3547 ha->flags.reset_marker = 1;
3549 ha->bus_settings[index].reset_marker = 1;
3561 memcpy((uint16_t *) ha->mailbox_out, wptr,
3565 if(ha->mailbox_wait != NULL)
3566 complete(ha->mailbox_wait);
3578 if (!(ha->flags.online && !ha->mailbox_wait)) {
3586 while (ha->rsp_ring_index != mailbox[5]) {
3587 pkt = ha->response_ring_ptr;
3589 dprintk(5, "qla1280_isr: ha->rsp_ring_index = 0x%x, mailbox[5]"
3590 " = 0x%x\n", ha->rsp_ring_index, mailbox[5]);
3597 dprintk(2, "qla1280_isr: ha->rsp_ring_index = "
3600 ha->rsp_ring_index, mailbox[5],
3605 dprintk(2, "qla1280_isr: ha->rsp_ring_index = "
3607 ha->rsp_ring_index, mailbox[5]);
3615 ha->outstanding_cmds[pkt->handle]->cmd,
3618 qla1280_status_entry(ha, pkt, done_q);
3620 qla1280_error_entry(ha, pkt, done_q);
3622 ha->rsp_ring_index++;
3623 if (ha->rsp_ring_index == RESPONSE_ENTRY_CNT) {
3624 ha->rsp_ring_index = 0;
3625 ha->response_ring_ptr = ha->response_ring;
3627 ha->response_ring_ptr++;
3628 WRT_REG_WORD(&reg->mailbox5, ha->rsp_ring_index);
3641 * ha = adapter block pointer.
3644 qla1280_rst_aen(struct scsi_qla_host *ha)
3650 if (ha->flags.online && !ha->flags.reset_active &&
3651 !ha->flags.abort_isp_active) {
3652 ha->flags.reset_active = 1;
3653 while (ha->flags.reset_marker) {
3655 ha->flags.reset_marker = 0;
3656 for (bus = 0; bus < ha->ports &&
3657 !ha->flags.reset_marker; bus++) {
3658 if (ha->bus_settings[bus].reset_marker) {
3659 ha->bus_settings[bus].reset_marker = 0;
3660 qla1280_marker(ha, bus, 0, 0,
3676 * ha = adapter block pointer.
3681 qla1280_status_entry(struct scsi_qla_host *ha, struct response *pkt,
3696 sp = ha->outstanding_cmds[handle];
3706 ha->outstanding_cmds[handle] = NULL;
3772 * ha = adapter block pointer.
3777 qla1280_error_entry(struct scsi_qla_host *ha, struct response *pkt,
3796 sp = ha->outstanding_cmds[handle];
3802 ha->outstanding_cmds[handle] = NULL;
3833 * ha = adapter block pointer.
3839 qla1280_abort_isp(struct scsi_qla_host *ha)
3841 struct device_reg __iomem *reg = ha->iobase;
3849 if (ha->flags.abort_isp_active || !ha->flags.online)
3852 ha->flags.abort_isp_active = 1;
3855 qla1280_disable_intrs(ha);
3860 ha->host_no);
3864 sp = ha->outstanding_cmds[cnt];
3871 ha->outstanding_cmds[cnt] = NULL;
3879 status = qla1280_load_firmware(ha);
3884 qla1280_nvram_config (ha);
3886 status = qla1280_init_rings(ha);
3891 for (bus = 0; bus < ha->ports; bus++)
3892 qla1280_bus_reset(ha, bus);
3894 ha->flags.abort_isp_active = 0;
3899 qla1280_reset_adapter(ha);
3948 qla1280_check_for_dead_scsi_bus(struct scsi_qla_host *ha, unsigned int bus)
3951 struct device_reg __iomem *reg = ha->iobase;
3953 if (ha->bus_settings[bus].scsi_bus_dead) {
3962 ha->bus_settings[bus].scsi_bus_dead = 1;
3965 ha->bus_settings[bus].scsi_bus_dead = 0;
3966 ha->bus_settings[bus].failed_reset_count = 0;
3973 qla1280_get_target_parameters(struct scsi_qla_host *ha,
3987 qla1280_mailbox_command(ha, BIT_6 | BIT_3 | BIT_2 | BIT_1 | BIT_0,
3990 printk(KERN_INFO "scsi(%li:%d:%d:%d):", ha->host_no, bus, target, lun);
4041 struct scsi_qla_host *ha;
4047 ha = (struct scsi_qla_host *)host->hostdata;
4079 ql1280_dump_device(struct scsi_qla_host *ha)
4089 if ((sp = ha->outstanding_cmds[i]) == NULL)
4240 struct scsi_qla_host *ha;
4262 host = scsi_host_alloc(&qla1280_driver_template, sizeof(*ha));
4269 ha = (struct scsi_qla_host *)host->hostdata;
4270 memset(ha, 0, sizeof(struct scsi_qla_host));
4272 ha->pdev = pdev;
4273 ha->devnum = devnum; /* specifies microcode load address */
4276 if (pci_set_dma_mask(ha->pdev, DMA_64BIT_MASK)) {
4277 if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK)) {
4279 "suitable DMA mask - aborting\n", ha->host_no);
4285 ha->host_no);
4287 if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK)) {
4289 "suitable DMA mask - aborting\n", ha->host_no);
4295 ha->request_ring = pci_alloc_consistent(ha->pdev,
4297 &ha->request_dma);
4298 if (!ha->request_ring) {
4303 ha->response_ring = pci_alloc_consistent(ha->pdev,
4305 &ha->response_dma);
4306 if (!ha->response_ring) {
4311 ha->ports = bdp->numPorts;
4313 ha->host = host;
4314 ha->host_no = host->host_no;
4326 ha->mmpbase = ioremap(pci_resource_start(ha->pdev, 1),
4327 pci_resource_len(ha->pdev, 1));
4328 if (!ha->mmpbase) {
4333 host->base = (unsigned long)ha->mmpbase;
4334 ha->iobase = (struct device_reg __iomem *)ha->mmpbase;
4336 host->io_port = pci_resource_start(ha->pdev, 0);
4344 ha->iobase = (struct device_reg *)host->io_port;
4347 INIT_LIST_HEAD(&ha->done_q);
4350 qla1280_disable_intrs(ha);
4353 "qla1280", ha)) {
4360 if (qla1280_initialize_adapter(ha)) {
4366 host->this_id = ha->bus_settings[0].id;
4378 qla1280_disable_intrs(ha);
4380 free_irq(pdev->irq, ha);
4383 iounmap(ha->mmpbase);
4388 pci_free_consistent(ha->pdev,
4390 ha->response_ring, ha->response_dma);
4392 pci_free_consistent(ha->pdev,
4394 ha->request_ring, ha->request_dma);
4408 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata;
4412 qla1280_disable_intrs(ha);
4414 free_irq(pdev->irq, ha);
4417 iounmap(ha->mmpbase);
4422 pci_free_consistent(ha->pdev,
4424 ha->request_ring, ha->request_dma);
4425 pci_free_consistent(ha->pdev,
4427 ha->response_ring, ha->response_dma);