Lines Matching +full:segment +full:- +full:no +full:- +full:remap
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * of PCI-SCSI IO processors.
6 * Copyright (C) 1999-2001 Gerard Roudier <groudier@free.fr>
7 * Copyright (c) 2003-2005 Matthew Wilcox <matthew@wil.cx>
10 * Copyright (C) 1998-2000 Gerard Roudier
13 * a port of the FreeBSD ncr driver to Linux-1.2.13.
17 * Stefan Esser <se@mi.Uni-Koeln.de>
25 *-----------------------------------------------------------------------------
65 MODULE_PARM_DESC(diff, "0 for no differential mode, 1 for BIOS, 2 for always, 3 for not GPIO3");
122 #define SYM_SOFTC_PTR(cmd) sym_get_hcb(cmd->device->host)
131 if (ucmd->eh_done) in sym_xpt_done()
132 complete(ucmd->eh_done); in sym_xpt_done()
144 np->s.settle_time = jiffies + sym_driver_setup.settle_delay * HZ; in sym_xpt_async_bus_reset()
145 np->s.settle_time_valid = 1; in sym_xpt_async_bus_reset()
167 * Build CAM result for a failed or auto-sensed IO.
171 struct scsi_cmnd *cmd = cp->cmd; in sym_set_cam_result_error()
175 scsi_status = cp->ssss_status; in sym_set_cam_result_error()
177 if (cp->host_flags & HF_SENSE) { in sym_set_cam_result_error()
178 scsi_status = cp->sv_scsi_status; in sym_set_cam_result_error()
179 resid = cp->sv_resid; in sym_set_cam_result_error()
180 if (sym_verbose && cp->sv_xerr_status) in sym_set_cam_result_error()
181 sym_print_xerr(cmd, cp->sv_xerr_status); in sym_set_cam_result_error()
182 if (cp->host_status == HS_COMPLETE && in sym_set_cam_result_error()
183 cp->ssss_status == S_GOOD && in sym_set_cam_result_error()
184 cp->xerr_status == 0) { in sym_set_cam_result_error()
186 cp->sv_xerr_status); in sym_set_cam_result_error()
190 memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); in sym_set_cam_result_error()
191 memcpy(cmd->sense_buffer, cp->sns_bbuf, in sym_set_cam_result_error()
201 p = (u_char *) cmd->sense_data; in sym_set_cam_result_error()
204 cp->target,cp->lun, -1); in sym_set_cam_result_error()
214 sym_reset_scsi_target(np, cmd->device->id); in sym_set_cam_result_error()
217 } else if (cp->host_status == HS_COMPLETE) /* Bad SCSI status */ in sym_set_cam_result_error()
219 else if (cp->host_status == HS_SEL_TIMEOUT) /* Selection timeout */ in sym_set_cam_result_error()
221 else if (cp->host_status == HS_UNEXPECTED) /* Unexpected BUS FREE*/ in sym_set_cam_result_error()
226 cp->host_status, cp->ssss_status, in sym_set_cam_result_error()
227 cp->xerr_status); in sym_set_cam_result_error()
232 cam_status = sym_xerr_cam_status(DID_ERROR, cp->xerr_status); in sym_set_cam_result_error()
235 cmd->result = (cam_status << 16) | scsi_status; in sym_set_cam_result_error()
240 int segment; in sym_scatter() local
243 cp->data_len = 0; in sym_scatter()
248 struct sym_tcb *tp = &np->target[cp->target]; in sym_scatter()
253 return -1; in sym_scatter()
256 data = &cp->phys.data[SYM_CONF_MAX_SG - use_sg]; in sym_scatter()
258 scsi_for_each_sg(cmd, sg, use_sg, segment) { in sym_scatter()
262 if ((len & 1) && (tp->head.wval & EWS)) { in sym_scatter()
264 cp->odd_byte_adjustment++; in sym_scatter()
267 sym_build_sge(np, &data[segment], baddr, len); in sym_scatter()
268 cp->data_len += len; in sym_scatter()
271 segment = -2; in sym_scatter()
274 return segment; in sym_scatter()
282 struct scsi_device *sdev = cmd->device; in sym_queue_command()
291 tp = &np->target[sdev->id]; in sym_queue_command()
296 lp = sym_lp(tp, sdev->lun); in sym_queue_command()
297 order = (lp && lp->s.reqtags) ? M_SIMPLE_TAG : 0; in sym_queue_command()
314 memcpy(cp->cdb_buf, cmd->cmnd, cmd->cmd_len); in sym_setup_cdb()
316 cp->phys.cmd.addr = CCB_BA(cp, cdb_buf[0]); in sym_setup_cdb()
317 cp->phys.cmd.size = cpu_to_scr(cmd->cmd_len); in sym_setup_cdb()
337 * No direction means no data. in sym_setup_data_and_start()
339 dir = cmd->sc_data_direction; in sym_setup_data_and_start()
341 cp->segments = sym_scatter(np, cp, cmd); in sym_setup_data_and_start()
342 if (cp->segments < 0) { in sym_setup_data_and_start()
348 * No segments means no data. in sym_setup_data_and_start()
350 if (!cp->segments) in sym_setup_data_and_start()
353 cp->data_len = 0; in sym_setup_data_and_start()
354 cp->segments = 0; in sym_setup_data_and_start()
367 lastp = goalp - 8 - (cp->segments * (2*4)); in sym_setup_data_and_start()
370 cp->host_flags |= HF_DATA_IN; in sym_setup_data_and_start()
372 lastp = goalp - 8 - (cp->segments * (2*4)); in sym_setup_data_and_start()
383 cp->phys.head.lastp = cpu_to_scr(lastp); in sym_setup_data_and_start()
384 cp->phys.head.savep = cpu_to_scr(lastp); in sym_setup_data_and_start()
385 cp->startp = cp->phys.head.savep; in sym_setup_data_and_start()
386 cp->goalp = cpu_to_scr(goalp); in sym_setup_data_and_start()
395 switch (cp->cdb_buf[0]) { in sym_setup_data_and_start()
430 np->s.timer.expires = thistime + SYM_CONF_TIMER_INTERVAL; in sym_timer()
431 add_timer(&np->s.timer); in sym_timer()
437 if (np->s.settle_time_valid) { in sym_timer()
438 if (time_before_eq(np->s.settle_time, thistime)) { in sym_timer()
442 np->s.settle_time_valid = 0; in sym_timer()
450 if (np->s.lasttime + 4*HZ < thistime) { in sym_timer()
451 np->s.lasttime = thistime; in sym_timer()
456 * Some way-broken PCI bridges may lead to in sym_timer()
474 struct pci_dev *pdev = sym_data->pdev; in sym_log_bus_error()
500 if (np->s.settle_time_valid && scsi_cmd_to_rq(cmd)->timeout) { in sym53c8xx_queue_command_lck()
501 unsigned long tlimit = jiffies + scsi_cmd_to_rq(cmd)->timeout; in sym53c8xx_queue_command_lck()
502 tlimit -= SYM_CONF_TIMER_INTERVAL*2; in sym53c8xx_queue_command_lck()
503 if (time_after(np->s.settle_time, tlimit)) { in sym53c8xx_queue_command_lck()
504 np->s.settle_time = tlimit; in sym53c8xx_queue_command_lck()
508 if (np->s.settle_time_valid) in sym53c8xx_queue_command_lck()
529 if (pci_channel_offline(sym_data->pdev)) in DEF_SCSI_QCMD()
534 spin_lock(shost->host_lock); in DEF_SCSI_QCMD()
536 spin_unlock(shost->host_lock); in DEF_SCSI_QCMD()
551 spin_lock_irqsave(np->s.host->host_lock, flags); in sym53c8xx_timer()
553 spin_unlock_irqrestore(np->s.host->host_lock, flags); in sym53c8xx_timer()
572 struct Scsi_Host *shost = cmd->device->host; in sym_eh_handler()
574 struct pci_dev *pdev = sym_data->pdev; in sym_eh_handler()
575 struct sym_hcb *np = sym_data->ncb; in sym_eh_handler()
578 int sts = -1; in sym_eh_handler()
586 * proceed with the scsi error recovery. There's no in sym_eh_handler()
593 spin_lock_irq(shost->host_lock); in sym_eh_handler()
596 BUG_ON(sym_data->io_reset); in sym_eh_handler()
597 sym_data->io_reset = &eh_done; in sym_eh_handler()
601 spin_unlock_irq(shost->host_lock); in sym_eh_handler()
604 (sym_data->io_reset, in sym_eh_handler()
606 spin_lock_irq(shost->host_lock); in sym_eh_handler()
607 sym_data->io_reset = NULL; in sym_eh_handler()
608 spin_unlock_irq(shost->host_lock); in sym_eh_handler()
613 spin_lock_irq(shost->host_lock); in sym_eh_handler()
614 /* This one is queued in some place -> to wait for completion */ in sym_eh_handler()
615 FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { in sym_eh_handler()
617 if (cp->cmd == cmd) { in sym_eh_handler()
624 sts = -1; in sym_eh_handler()
630 sts = sym_reset_scsi_target(np, cmd->device->id); in sym_eh_handler()
651 ucmd->eh_done = &eh_done; in sym_eh_handler()
652 spin_unlock_irq(shost->host_lock); in sym_eh_handler()
654 ucmd->eh_done = NULL; in sym_eh_handler()
655 sts = -2; in sym_eh_handler()
658 spin_unlock_irq(shost->host_lock); in sym_eh_handler()
661 dev_warn(&cmd->device->sdev_gendev, "%s operation %s.\n", opname, in sym_eh_handler()
662 sts==0 ? "complete" :sts==-2 ? "timed-out" : "failed"); in sym_eh_handler()
701 oldtags = lp->s.reqtags; in sym_tune_dev_queuing()
703 if (reqtags > lp->s.scdev_depth) in sym_tune_dev_queuing()
704 reqtags = lp->s.scdev_depth; in sym_tune_dev_queuing()
706 lp->s.reqtags = reqtags; in sym_tune_dev_queuing()
709 dev_info(&tp->starget->dev, in sym_tune_dev_queuing()
711 lp->s.reqtags ? "enabled" : "disabled", reqtags); in sym_tune_dev_queuing()
717 struct sym_hcb *np = sym_get_hcb(sdev->host); in sym53c8xx_slave_alloc()
718 struct sym_tcb *tp = &np->target[sdev->id]; in sym53c8xx_slave_alloc()
723 if (sdev->id >= SYM_CONF_MAX_TARGET || sdev->lun >= SYM_CONF_MAX_LUN) in sym53c8xx_slave_alloc()
724 return -ENXIO; in sym53c8xx_slave_alloc()
726 spin_lock_irqsave(np->s.host->host_lock, flags); in sym53c8xx_slave_alloc()
737 if (tp->usrflags & SYM_SCAN_BOOT_DISABLED) { in sym53c8xx_slave_alloc()
738 tp->usrflags &= ~SYM_SCAN_BOOT_DISABLED; in sym53c8xx_slave_alloc()
739 starget_printk(KERN_INFO, sdev->sdev_target, in sym53c8xx_slave_alloc()
741 error = -ENXIO; in sym53c8xx_slave_alloc()
745 if (tp->usrflags & SYM_SCAN_LUNS_DISABLED) { in sym53c8xx_slave_alloc()
746 if (sdev->lun != 0) { in sym53c8xx_slave_alloc()
747 error = -ENXIO; in sym53c8xx_slave_alloc()
750 starget_printk(KERN_INFO, sdev->sdev_target, in sym53c8xx_slave_alloc()
754 lp = sym_alloc_lcb(np, sdev->id, sdev->lun); in sym53c8xx_slave_alloc()
756 error = -ENOMEM; in sym53c8xx_slave_alloc()
759 if (tp->nlcb == 1) in sym53c8xx_slave_alloc()
760 tp->starget = sdev->sdev_target; in sym53c8xx_slave_alloc()
762 spi_min_period(tp->starget) = tp->usr_period; in sym53c8xx_slave_alloc()
763 spi_max_width(tp->starget) = tp->usr_width; in sym53c8xx_slave_alloc()
767 spin_unlock_irqrestore(np->s.host->host_lock, flags); in sym53c8xx_slave_alloc()
777 struct sym_hcb *np = sym_get_hcb(sdev->host); in sym53c8xx_slave_configure()
778 struct sym_tcb *tp = &np->target[sdev->id]; in sym53c8xx_slave_configure()
779 struct sym_lcb *lp = sym_lp(tp, sdev->lun); in sym53c8xx_slave_configure()
785 lp->curr_flags = lp->user_flags; in sym53c8xx_slave_configure()
794 if (reqtags > tp->usrtags) in sym53c8xx_slave_configure()
795 reqtags = tp->usrtags; in sym53c8xx_slave_configure()
796 if (!sdev->tagged_supported) in sym53c8xx_slave_configure()
802 lp->s.scdev_depth = depth_to_use; in sym53c8xx_slave_configure()
803 sym_tune_dev_queuing(tp, sdev->lun, reqtags); in sym53c8xx_slave_configure()
805 if (!spi_initial_dv(sdev->sdev_target)) in sym53c8xx_slave_configure()
813 struct sym_hcb *np = sym_get_hcb(sdev->host); in sym53c8xx_slave_destroy()
814 struct sym_tcb *tp = &np->target[sdev->id]; in sym53c8xx_slave_destroy()
815 struct sym_lcb *lp = sym_lp(tp, sdev->lun); in sym53c8xx_slave_destroy()
822 spin_lock_irqsave(np->s.host->host_lock, flags); in sym53c8xx_slave_destroy()
824 if (lp->busy_itlq || lp->busy_itl) { in sym53c8xx_slave_destroy()
827 * so let's try to stop all on-going I/O. in sym53c8xx_slave_destroy()
829 starget_printk(KERN_WARNING, tp->starget, in sym53c8xx_slave_destroy()
830 "Removing busy LCB (%d)\n", (u8)sdev->lun); in sym53c8xx_slave_destroy()
834 if (sym_free_lcb(np, sdev->id, sdev->lun) == 0) { in sym53c8xx_slave_destroy()
838 tp->head.sval = 0; in sym53c8xx_slave_destroy()
839 tp->head.wval = np->rv_scntl3; in sym53c8xx_slave_destroy()
840 tp->head.uval = 0; in sym53c8xx_slave_destroy()
841 tp->tgoal.check_nego = 1; in sym53c8xx_slave_destroy()
842 tp->starget = NULL; in sym53c8xx_slave_destroy()
845 spin_unlock_irqrestore(np->s.host->host_lock, flags); in sym53c8xx_slave_destroy()
890 switch (uc->cmd) { in sym_exec_user_command()
895 sym_debug_flags = uc->data; in sym_exec_user_command()
899 np->verbose = uc->data; in sym_exec_user_command()
908 if (!((uc->target >> t) & 1)) in sym_exec_user_command()
910 tp = &np->target[t]; in sym_exec_user_command()
911 if (!tp->nlcb) in sym_exec_user_command()
914 switch (uc->cmd) { in sym_exec_user_command()
917 if (!uc->data || uc->data >= 255) { in sym_exec_user_command()
918 tp->tgoal.iu = tp->tgoal.dt = in sym_exec_user_command()
919 tp->tgoal.qas = 0; in sym_exec_user_command()
920 tp->tgoal.offset = 0; in sym_exec_user_command()
921 } else if (uc->data <= 9 && np->minsync_dt) { in sym_exec_user_command()
922 if (uc->data < np->minsync_dt) in sym_exec_user_command()
923 uc->data = np->minsync_dt; in sym_exec_user_command()
924 tp->tgoal.iu = tp->tgoal.dt = in sym_exec_user_command()
925 tp->tgoal.qas = 1; in sym_exec_user_command()
926 tp->tgoal.width = 1; in sym_exec_user_command()
927 tp->tgoal.period = uc->data; in sym_exec_user_command()
928 tp->tgoal.offset = np->maxoffs_dt; in sym_exec_user_command()
930 if (uc->data < np->minsync) in sym_exec_user_command()
931 uc->data = np->minsync; in sym_exec_user_command()
932 tp->tgoal.iu = tp->tgoal.dt = in sym_exec_user_command()
933 tp->tgoal.qas = 0; in sym_exec_user_command()
934 tp->tgoal.period = uc->data; in sym_exec_user_command()
935 tp->tgoal.offset = np->maxoffs; in sym_exec_user_command()
937 tp->tgoal.check_nego = 1; in sym_exec_user_command()
940 tp->tgoal.width = uc->data ? 1 : 0; in sym_exec_user_command()
941 tp->tgoal.check_nego = 1; in sym_exec_user_command()
945 sym_tune_dev_queuing(tp, l, uc->data); in sym_exec_user_command()
948 tp->to_reset = 1; in sym_exec_user_command()
949 np->istat_sem = SEM; in sym_exec_user_command()
955 if (lp) lp->to_clear = 1; in sym_exec_user_command()
957 np->istat_sem = SEM; in sym_exec_user_command()
961 tp->usrflags = uc->data; in sym_exec_user_command()
973 for (cnt = len; cnt > 0 && (c = *ptr++) && isspace(c); cnt--); in sym_skip_spaces()
975 return (len - cnt); in sym_skip_spaces()
983 return (end - ptr); in get_int_arg()
998 return -EINVAL; \
999 ptr += arg_len; len -= arg_len;
1003 return -EINVAL; \
1004 ptr += arg_len; len -= arg_len;
1022 if (len > 0 && ptr[len-1] == '\n') in sym_user_command()
1023 --len; in sym_user_command()
1026 uc->cmd = UC_SETSYNC; in sym_user_command()
1028 uc->cmd = UC_SETTAGS; in sym_user_command()
1030 uc->cmd = UC_SETVERBOSE; in sym_user_command()
1032 uc->cmd = UC_SETWIDE; in sym_user_command()
1035 uc->cmd = UC_SETDEBUG; in sym_user_command()
1038 uc->cmd = UC_SETFLAG; in sym_user_command()
1040 uc->cmd = UC_RESETDEV; in sym_user_command()
1042 uc->cmd = UC_CLEARDEV; in sym_user_command()
1047 printk("sym_user_command: arg_len=%d, cmd=%ld\n", arg_len, uc->cmd); in sym_user_command()
1051 return -EINVAL; in sym_user_command()
1052 ptr += arg_len; len -= arg_len; in sym_user_command()
1054 switch(uc->cmd) { in sym_user_command()
1063 ptr += arg_len; len -= arg_len; in sym_user_command()
1064 uc->target = ~0; in sym_user_command()
1067 uc->target = (1<<target); in sym_user_command()
1075 switch(uc->cmd) { in sym_user_command()
1081 GET_INT_ARG(ptr, len, uc->data); in sym_user_command()
1083 printk("sym_user_command: data=%ld\n", uc->data); in sym_user_command()
1091 uc->data |= DEBUG_ALLOC; in sym_user_command()
1093 uc->data |= DEBUG_PHASE; in sym_user_command()
1095 uc->data |= DEBUG_QUEUE; in sym_user_command()
1097 uc->data |= DEBUG_RESULT; in sym_user_command()
1099 uc->data |= DEBUG_SCATTER; in sym_user_command()
1101 uc->data |= DEBUG_SCRIPT; in sym_user_command()
1103 uc->data |= DEBUG_TINY; in sym_user_command()
1105 uc->data |= DEBUG_TIMING; in sym_user_command()
1107 uc->data |= DEBUG_NEGO; in sym_user_command()
1109 uc->data |= DEBUG_TAGS; in sym_user_command()
1111 uc->data |= DEBUG_POINTER; in sym_user_command()
1113 return -EINVAL; in sym_user_command()
1114 ptr += arg_len; len -= arg_len; in sym_user_command()
1117 printk("sym_user_command: data=%ld\n", uc->data); in sym_user_command()
1125 uc->data &= ~SYM_DISC_ENABLED; in sym_user_command()
1127 return -EINVAL; in sym_user_command()
1128 ptr += arg_len; len -= arg_len; in sym_user_command()
1136 return -EINVAL; in sym_user_command()
1140 spin_lock_irqsave(shost->host_lock, flags); in sym_user_command()
1142 spin_unlock_irqrestore(shost->host_lock, flags); in sym_user_command()
1157 struct pci_dev *pdev = sym_data->pdev; in sym_show_info()
1158 struct sym_hcb *np = sym_data->ncb; in sym_show_info()
1161 "revision id 0x%x\n", np->s.chip_name, in sym_show_info()
1162 pdev->device, pdev->revision); in sym_show_info()
1164 pci_name(pdev), pdev->irq); in sym_show_info()
1166 (int) (np->minsync_dt ? np->minsync_dt : np->minsync), in sym_show_info()
1167 np->maxwide ? "Wide" : "Narrow", in sym_show_info()
1168 np->minsync_dt ? ", DT capable" : ""); in sym_show_info()
1176 return -EINVAL; in sym_show_info()
1189 if (device->s.ioaddr) in sym_iounmap_device()
1190 pci_iounmap(device->pdev, device->s.ioaddr); in sym_iounmap_device()
1191 if (device->s.ramaddr) in sym_iounmap_device()
1192 pci_iounmap(device->pdev, device->s.ramaddr); in sym_iounmap_device()
1205 free_irq(pdev->irq, np->s.host); in sym_free_resources()
1206 if (np->s.ioaddr) in sym_free_resources()
1207 pci_iounmap(pdev, np->s.ioaddr); in sym_free_resources()
1208 if (np->s.ramaddr) in sym_free_resources()
1209 pci_iounmap(pdev, np->s.ramaddr); in sym_free_resources()
1222 * Remap MMIO region.
1233 struct pci_dev *pdev = dev->pdev; in sym_attach()
1239 unit, dev->chip.name, pdev->revision, pci_name(pdev), in sym_attach()
1240 pdev->irq); in sym_attach()
1245 fw = sym_find_firmware(&dev->chip); in sym_attach()
1260 np = __sym_calloc_dma(&pdev->dev, sizeof(*np), "HCB"); in sym_attach()
1263 np->bus_dmat = &pdev->dev; /* Result in 1 DMA pool per HBA */ in sym_attach()
1264 sym_data->ncb = np; in sym_attach()
1265 sym_data->pdev = pdev; in sym_attach()
1266 np->s.host = shost; in sym_attach()
1273 np->hcb_ba = vtobus(np); in sym_attach()
1274 np->verbose = sym_driver_setup.verbose; in sym_attach()
1275 np->s.unit = unit; in sym_attach()
1276 np->features = dev->chip.features; in sym_attach()
1277 np->clock_divn = dev->chip.nr_divisor; in sym_attach()
1278 np->maxoffs = dev->chip.offset_max; in sym_attach()
1279 np->maxburst = dev->chip.burst_max; in sym_attach()
1280 np->myaddr = dev->host_id; in sym_attach()
1281 np->mmio_ba = (u32)dev->mmio_base; in sym_attach()
1282 np->ram_ba = (u32)dev->ram_base; in sym_attach()
1283 np->s.ioaddr = dev->s.ioaddr; in sym_attach()
1284 np->s.ramaddr = dev->s.ramaddr; in sym_attach()
1289 strlcpy(np->s.chip_name, dev->chip.name, sizeof(np->s.chip_name)); in sym_attach()
1290 sprintf(np->s.inst_name, "sym%d", np->s.unit); in sym_attach()
1292 if ((SYM_CONF_DMA_ADDRESSING_MODE > 0) && (np->features & FE_DAC) && in sym_attach()
1293 !dma_set_mask(&pdev->dev, DMA_DAC_MASK)) { in sym_attach()
1295 } else if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { in sym_attach()
1296 printf_warning("%s: No suitable DMA available\n", sym_name(np)); in sym_attach()
1300 if (sym_hcb_attach(shost, fw, dev->nvram)) in sym_attach()
1308 if (request_irq(pdev->irq, sym53c8xx_intr, IRQF_SHARED, NAME53C8XX, in sym_attach()
1311 sym_name(np), pdev->irq); in sym_attach()
1320 spin_lock_irqsave(shost->host_lock, flags); in sym_attach()
1332 timer_setup(&np->s.timer, sym53c8xx_timer, 0); in sym_attach()
1333 np->s.lasttime=0; in sym_attach()
1340 shost->max_channel = 0; in sym_attach()
1341 shost->this_id = np->myaddr; in sym_attach()
1342 shost->max_id = np->maxwide ? 16 : 8; in sym_attach()
1343 shost->max_lun = SYM_CONF_MAX_LUN; in sym_attach()
1344 shost->unique_id = pci_resource_start(pdev, 0); in sym_attach()
1345 shost->cmd_per_lun = SYM_CONF_MAX_TAG; in sym_attach()
1346 shost->can_queue = (SYM_CONF_MAX_START-2); in sym_attach()
1347 shost->sg_tablesize = SYM_CONF_MAX_SG; in sym_attach()
1348 shost->max_cmd_len = 16; in sym_attach()
1350 shost->transportt = sym2_transport_template; in sym_attach()
1353 if (pdev->device == PCI_DEVICE_ID_NCR_53C896 && pdev->revision < 2) in sym_attach()
1354 shost->dma_boundary = 0xFFFFFF; in sym_attach()
1356 spin_unlock_irqrestore(shost->host_lock, flags); in sym_attach()
1361 printf_err("%s: FATAL ERROR: CHECK SCSI BUS - CABLES, " in sym_attach()
1363 spin_unlock_irqrestore(shost->host_lock, flags); in sym_attach()
1383 devp->nvram = nvp; in sym_get_nvram()
1384 nvp->type = 0; in sym_get_nvram()
1397 struct pci_dev *pdev = device->pdev; in sym_check_supported()
1408 return -ENODEV; in sym_check_supported()
1417 chip = sym_lookup_chip_table(pdev->device, pdev->revision); in sym_check_supported()
1419 dev_info(&pdev->dev, "device not supported\n"); in sym_check_supported()
1420 return -ENODEV; in sym_check_supported()
1422 memcpy(&device->chip, chip, sizeof(device->chip)); in sym_check_supported()
1429 * These controllers set value 0x52414944 at RAM end - 16.
1435 if (!device->s.ramaddr) in sym_check_raid()
1438 if (device->chip.features & FE_RAM8K) in sym_check_raid()
1443 ram_val = readl(device->s.ramaddr + ram_size - 16); in sym_check_raid()
1447 dev_info(&device->pdev->dev, in sym_check_raid()
1449 return -ENODEV; in sym_check_raid()
1454 struct sym_chip *chip = &device->chip; in sym_set_workarounds()
1455 struct pci_dev *pdev = device->pdev; in sym_set_workarounds()
1463 if (pdev->device == PCI_DEVICE_ID_NCR_53C896 && pdev->revision < 0x4) { in sym_set_workarounds()
1464 chip->features |= (FE_WRIE | FE_CLSE); in sym_set_workarounds()
1468 if (chip->features & FE_WRIE) { in sym_set_workarounds()
1470 return -ENODEV; in sym_set_workarounds()
1480 * Recall: writes are not normal to status register - in sym_set_workarounds()
1485 if (chip->features & FE_66MHZ) { in sym_set_workarounds()
1487 chip->features &= ~FE_66MHZ; in sym_set_workarounds()
1500 * Map HBA registers and on-chip SRAM (if present).
1504 struct pci_dev *pdev = device->pdev; in sym_iomap_device()
1508 pcibios_resource_to_bus(pdev->bus, &bus_addr, &pdev->resource[1]); in sym_iomap_device()
1509 device->mmio_base = bus_addr.start; in sym_iomap_device()
1511 if (device->chip.features & FE_RAM) { in sym_iomap_device()
1513 * If the BAR is 64-bit, resource 2 will be occupied by the in sym_iomap_device()
1516 if (!pdev->resource[i].flags) in sym_iomap_device()
1518 pcibios_resource_to_bus(pdev->bus, &bus_addr, in sym_iomap_device()
1519 &pdev->resource[i]); in sym_iomap_device()
1520 device->ram_base = bus_addr.start; in sym_iomap_device()
1524 if (device->mmio_base) in sym_iomap_device()
1525 device->s.ioaddr = pci_iomap(pdev, 1, in sym_iomap_device()
1528 if (!device->s.ioaddr) in sym_iomap_device()
1529 device->s.ioaddr = pci_iomap(pdev, 0, in sym_iomap_device()
1531 if (!device->s.ioaddr) { in sym_iomap_device()
1532 dev_err(&pdev->dev, "could not map registers; giving up.\n"); in sym_iomap_device()
1533 return -EIO; in sym_iomap_device()
1535 if (device->ram_base) { in sym_iomap_device()
1536 device->s.ramaddr = pci_iomap(pdev, i, in sym_iomap_device()
1538 if (!device->s.ramaddr) { in sym_iomap_device()
1539 dev_warn(&pdev->dev, in sym_iomap_device()
1541 device->ram_base = 0; in sym_iomap_device()
1567 struct pci_dev *memc = pci_get_slot(pdev->bus, slot); in sym_config_pqs()
1569 if (!memc || memc->vendor != 0x101a || memc->device == 0x0009) { in sym_config_pqs()
1593 sym_dev->host_id = tmp; in sym_config_pqs()
1606 del_timer_sync(&np->s.timer); in sym_detach()
1699 if (scsi_add_host(shost, &pdev->dev)) in sym2_probe()
1717 return -ENODEV; in sym2_probe()
1729 attach_count--; in sym2_remove()
1733 * sym2_io_error_detected() - called when PCI error is detected
1746 disable_irq(pdev->irq); in sym2_io_error_detected()
1754 * sym2_io_slot_dump - Enable MMIO and dump debug registers
1768 * sym2_reset_workarounds - hardware-specific work-arounds
1774 * of the steps taken there are un-needed here.
1781 chip = sym_lookup_chip_table(pdev->device, pdev->revision); in sym2_reset_workarounds()
1787 if (!(chip->features & FE_66MHZ) && (status_reg & PCI_STATUS_66MHZ)) { in sym2_reset_workarounds()
1795 * sym2_io_slot_reset() - called when the pci bus has been reset.
1815 enable_irq(pdev->irq); in sym2_io_slot_reset()
1818 if (np->features & FE_WRIE) { in sym2_io_slot_reset()
1823 /* Perform work-arounds, analogous to sym_set_workarounds() */ in sym2_io_slot_reset()
1827 if (PCI_FUNC(pdev->devfn) == 0) { in sym2_io_slot_reset()
1840 * sym2_io_resume() - resume normal ops after PCI reset
1852 spin_lock_irq(shost->host_lock); in sym2_io_resume()
1853 if (sym_data->io_reset) in sym2_io_resume()
1854 complete(sym_data->io_reset); in sym2_io_resume()
1855 spin_unlock_irq(shost->host_lock); in sym2_io_resume()
1863 switch (np->scsi_mode) { in sym2_get_signalling()
1882 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in sym2_set_offset()
1884 struct sym_tcb *tp = &np->target[starget->id]; in sym2_set_offset()
1886 tp->tgoal.offset = offset; in sym2_set_offset()
1887 tp->tgoal.check_nego = 1; in sym2_set_offset()
1892 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in sym2_set_period()
1894 struct sym_tcb *tp = &np->target[starget->id]; in sym2_set_period()
1898 if (period <= np->minsync && spi_width(starget)) in sym2_set_period()
1899 tp->tgoal.dt = 1; in sym2_set_period()
1901 tp->tgoal.period = period; in sym2_set_period()
1902 tp->tgoal.check_nego = 1; in sym2_set_period()
1907 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in sym2_set_width()
1909 struct sym_tcb *tp = &np->target[starget->id]; in sym2_set_width()
1914 tp->tgoal.iu = tp->tgoal.dt = tp->tgoal.qas = 0; in sym2_set_width()
1916 tp->tgoal.width = width; in sym2_set_width()
1917 tp->tgoal.check_nego = 1; in sym2_set_width()
1922 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in sym2_set_dt()
1924 struct sym_tcb *tp = &np->target[starget->id]; in sym2_set_dt()
1928 tp->tgoal.dt = 1; in sym2_set_dt()
1930 tp->tgoal.iu = tp->tgoal.dt = tp->tgoal.qas = 0; in sym2_set_dt()
1931 tp->tgoal.check_nego = 1; in sym2_set_dt()
1937 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1939 struct sym_tcb *tp = &np->target[starget->id];
1942 tp->tgoal.iu = tp->tgoal.dt = 1;
1944 tp->tgoal.iu = 0;
1945 tp->tgoal.check_nego = 1;
1950 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1952 struct sym_tcb *tp = &np->target[starget->id];
1955 tp->tgoal.dt = tp->tgoal.qas = 1;
1957 tp->tgoal.qas = 0;
1958 tp->tgoal.check_nego = 1;
2042 return -ENODEV; in sym2_init()