Lines Matching +full:mbox +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0
5 * This driver supports the newer, SCSI-based firmware interface only.
10 * Copyright 1998-2001 by Leonard N. Zubkoff <lnz@dandelion.com>
32 char *name; member
54 return entry[i].name; in myrs_devstate_name()
61 char *name; member
85 return entry[i].name; in myrs_raid_level_name()
91 * myrs_reset_cmd - clears critical fields in struct myrs_cmdblk
95 union myrs_cmd_mbox *mbox = &cmd_blk->mbox; in myrs_reset_cmd() local
97 memset(mbox, 0, sizeof(union myrs_cmd_mbox)); in myrs_reset_cmd()
98 cmd_blk->status = 0; in myrs_reset_cmd()
102 * myrs_qcmd - queues Command for DAC960 V2 Series Controllers.
106 void __iomem *base = cs->io_base; in myrs_qcmd()
107 union myrs_cmd_mbox *mbox = &cmd_blk->mbox; in myrs_qcmd() local
108 union myrs_cmd_mbox *next_mbox = cs->next_cmd_mbox; in myrs_qcmd()
110 cs->write_cmd_mbox(next_mbox, mbox); in myrs_qcmd()
112 if (cs->prev_cmd_mbox1->words[0] == 0 || in myrs_qcmd()
113 cs->prev_cmd_mbox2->words[0] == 0) in myrs_qcmd()
114 cs->get_cmd_mbox(base); in myrs_qcmd()
116 cs->prev_cmd_mbox2 = cs->prev_cmd_mbox1; in myrs_qcmd()
117 cs->prev_cmd_mbox1 = next_mbox; in myrs_qcmd()
119 if (++next_mbox > cs->last_cmd_mbox) in myrs_qcmd()
120 next_mbox = cs->first_cmd_mbox; in myrs_qcmd()
122 cs->next_cmd_mbox = next_mbox; in myrs_qcmd()
126 * myrs_exec_cmd - executes V2 Command and waits for completion.
134 cmd_blk->complete = &complete; in myrs_exec_cmd()
135 spin_lock_irqsave(&cs->queue_lock, flags); in myrs_exec_cmd()
137 spin_unlock_irqrestore(&cs->queue_lock, flags); in myrs_exec_cmd()
143 * myrs_report_progress - prints progress message
149 shost_printk(KERN_INFO, cs->host, in myrs_report_progress()
156 * myrs_get_ctlr_info - executes a Controller Information IOCTL Command
160 struct myrs_cmdblk *cmd_blk = &cs->dcmd_blk; in myrs_get_ctlr_info()
161 union myrs_cmd_mbox *mbox = &cmd_blk->mbox; in myrs_get_ctlr_info() local
167 ldev_present = cs->ctlr_info->ldev_present; in myrs_get_ctlr_info()
168 ldev_critical = cs->ctlr_info->ldev_critical; in myrs_get_ctlr_info()
169 ldev_offline = cs->ctlr_info->ldev_offline; in myrs_get_ctlr_info()
171 ctlr_info_addr = dma_map_single(&cs->pdev->dev, cs->ctlr_info, in myrs_get_ctlr_info()
174 if (dma_mapping_error(&cs->pdev->dev, ctlr_info_addr)) in myrs_get_ctlr_info()
177 mutex_lock(&cs->dcmd_mutex); in myrs_get_ctlr_info()
179 mbox->ctlr_info.id = MYRS_DCMD_TAG; in myrs_get_ctlr_info()
180 mbox->ctlr_info.opcode = MYRS_CMD_OP_IOCTL; in myrs_get_ctlr_info()
181 mbox->ctlr_info.control.dma_ctrl_to_host = true; in myrs_get_ctlr_info()
182 mbox->ctlr_info.control.no_autosense = true; in myrs_get_ctlr_info()
183 mbox->ctlr_info.dma_size = sizeof(struct myrs_ctlr_info); in myrs_get_ctlr_info()
184 mbox->ctlr_info.ctlr_num = 0; in myrs_get_ctlr_info()
185 mbox->ctlr_info.ioctl_opcode = MYRS_IOCTL_GET_CTLR_INFO; in myrs_get_ctlr_info()
186 sgl = &mbox->ctlr_info.dma_addr; in myrs_get_ctlr_info()
187 sgl->sge[0].sge_addr = ctlr_info_addr; in myrs_get_ctlr_info()
188 sgl->sge[0].sge_count = mbox->ctlr_info.dma_size; in myrs_get_ctlr_info()
189 dev_dbg(&cs->host->shost_gendev, "Sending GetControllerInfo\n"); in myrs_get_ctlr_info()
191 status = cmd_blk->status; in myrs_get_ctlr_info()
192 mutex_unlock(&cs->dcmd_mutex); in myrs_get_ctlr_info()
193 dma_unmap_single(&cs->pdev->dev, ctlr_info_addr, in myrs_get_ctlr_info()
196 if (cs->ctlr_info->bg_init_active + in myrs_get_ctlr_info()
197 cs->ctlr_info->ldev_init_active + in myrs_get_ctlr_info()
198 cs->ctlr_info->pdev_init_active + in myrs_get_ctlr_info()
199 cs->ctlr_info->cc_active + in myrs_get_ctlr_info()
200 cs->ctlr_info->rbld_active + in myrs_get_ctlr_info()
201 cs->ctlr_info->exp_active != 0) in myrs_get_ctlr_info()
202 cs->needs_update = true; in myrs_get_ctlr_info()
203 if (cs->ctlr_info->ldev_present != ldev_present || in myrs_get_ctlr_info()
204 cs->ctlr_info->ldev_critical != ldev_critical || in myrs_get_ctlr_info()
205 cs->ctlr_info->ldev_offline != ldev_offline) in myrs_get_ctlr_info()
206 shost_printk(KERN_INFO, cs->host, in myrs_get_ctlr_info()
208 cs->ctlr_info->ldev_critical, in myrs_get_ctlr_info()
209 cs->ctlr_info->ldev_offline, in myrs_get_ctlr_info()
210 cs->ctlr_info->ldev_present); in myrs_get_ctlr_info()
217 * myrs_get_ldev_info - executes a Logical Device Information IOCTL Command
222 struct myrs_cmdblk *cmd_blk = &cs->dcmd_blk; in myrs_get_ldev_info()
223 union myrs_cmd_mbox *mbox = &cmd_blk->mbox; in myrs_get_ldev_info() local
230 ldev_info_addr = dma_map_single(&cs->pdev->dev, ldev_info, in myrs_get_ldev_info()
233 if (dma_mapping_error(&cs->pdev->dev, ldev_info_addr)) in myrs_get_ldev_info()
236 mutex_lock(&cs->dcmd_mutex); in myrs_get_ldev_info()
238 mbox->ldev_info.id = MYRS_DCMD_TAG; in myrs_get_ldev_info()
239 mbox->ldev_info.opcode = MYRS_CMD_OP_IOCTL; in myrs_get_ldev_info()
240 mbox->ldev_info.control.dma_ctrl_to_host = true; in myrs_get_ldev_info()
241 mbox->ldev_info.control.no_autosense = true; in myrs_get_ldev_info()
242 mbox->ldev_info.dma_size = sizeof(struct myrs_ldev_info); in myrs_get_ldev_info()
243 mbox->ldev_info.ldev.ldev_num = ldev_num; in myrs_get_ldev_info()
244 mbox->ldev_info.ioctl_opcode = MYRS_IOCTL_GET_LDEV_INFO_VALID; in myrs_get_ldev_info()
245 sgl = &mbox->ldev_info.dma_addr; in myrs_get_ldev_info()
246 sgl->sge[0].sge_addr = ldev_info_addr; in myrs_get_ldev_info()
247 sgl->sge[0].sge_count = mbox->ldev_info.dma_size; in myrs_get_ldev_info()
248 dev_dbg(&cs->host->shost_gendev, in myrs_get_ldev_info()
251 status = cmd_blk->status; in myrs_get_ldev_info()
252 mutex_unlock(&cs->dcmd_mutex); in myrs_get_ldev_info()
253 dma_unmap_single(&cs->pdev->dev, ldev_info_addr, in myrs_get_ldev_info()
256 unsigned short ldev_num = ldev_info->ldev_num; in myrs_get_ldev_info()
259 unsigned long ldev_size = new->cfg_devsize; in myrs_get_ldev_info()
261 if (new->dev_state != old->dev_state) { in myrs_get_ldev_info()
262 const char *name; in myrs_get_ldev_info() local
264 name = myrs_devstate_name(new->dev_state); in myrs_get_ldev_info()
265 shost_printk(KERN_INFO, cs->host, in myrs_get_ldev_info()
267 ldev_num, name ? name : "Invalid"); in myrs_get_ldev_info()
269 if ((new->soft_errs != old->soft_errs) || in myrs_get_ldev_info()
270 (new->cmds_failed != old->cmds_failed) || in myrs_get_ldev_info()
271 (new->deferred_write_errs != old->deferred_write_errs)) in myrs_get_ldev_info()
272 shost_printk(KERN_INFO, cs->host, in myrs_get_ldev_info()
274 ldev_num, new->soft_errs, in myrs_get_ldev_info()
275 new->cmds_failed, in myrs_get_ldev_info()
276 new->deferred_write_errs); in myrs_get_ldev_info()
277 if (new->bg_init_active) in myrs_get_ldev_info()
280 new->bg_init_lba, ldev_size); in myrs_get_ldev_info()
281 else if (new->fg_init_active) in myrs_get_ldev_info()
284 new->fg_init_lba, ldev_size); in myrs_get_ldev_info()
285 else if (new->migration_active) in myrs_get_ldev_info()
288 new->migration_lba, ldev_size); in myrs_get_ldev_info()
289 else if (new->patrol_active) in myrs_get_ldev_info()
292 new->patrol_lba, ldev_size); in myrs_get_ldev_info()
293 if (old->bg_init_active && !new->bg_init_active) in myrs_get_ldev_info()
294 shost_printk(KERN_INFO, cs->host, in myrs_get_ldev_info()
297 (new->ldev_control.ldev_init_done ? in myrs_get_ldev_info()
304 * myrs_get_pdev_info - executes a "Read Physical Device Information" Command
310 struct myrs_cmdblk *cmd_blk = &cs->dcmd_blk; in myrs_get_pdev_info()
311 union myrs_cmd_mbox *mbox = &cmd_blk->mbox; in myrs_get_pdev_info() local
316 pdev_info_addr = dma_map_single(&cs->pdev->dev, pdev_info, in myrs_get_pdev_info()
319 if (dma_mapping_error(&cs->pdev->dev, pdev_info_addr)) in myrs_get_pdev_info()
322 mutex_lock(&cs->dcmd_mutex); in myrs_get_pdev_info()
324 mbox->pdev_info.opcode = MYRS_CMD_OP_IOCTL; in myrs_get_pdev_info()
325 mbox->pdev_info.id = MYRS_DCMD_TAG; in myrs_get_pdev_info()
326 mbox->pdev_info.control.dma_ctrl_to_host = true; in myrs_get_pdev_info()
327 mbox->pdev_info.control.no_autosense = true; in myrs_get_pdev_info()
328 mbox->pdev_info.dma_size = sizeof(struct myrs_pdev_info); in myrs_get_pdev_info()
329 mbox->pdev_info.pdev.lun = lun; in myrs_get_pdev_info()
330 mbox->pdev_info.pdev.target = target; in myrs_get_pdev_info()
331 mbox->pdev_info.pdev.channel = channel; in myrs_get_pdev_info()
332 mbox->pdev_info.ioctl_opcode = MYRS_IOCTL_GET_PDEV_INFO_VALID; in myrs_get_pdev_info()
333 sgl = &mbox->pdev_info.dma_addr; in myrs_get_pdev_info()
334 sgl->sge[0].sge_addr = pdev_info_addr; in myrs_get_pdev_info()
335 sgl->sge[0].sge_count = mbox->pdev_info.dma_size; in myrs_get_pdev_info()
336 dev_dbg(&cs->host->shost_gendev, in myrs_get_pdev_info()
340 status = cmd_blk->status; in myrs_get_pdev_info()
341 mutex_unlock(&cs->dcmd_mutex); in myrs_get_pdev_info()
342 dma_unmap_single(&cs->pdev->dev, pdev_info_addr, in myrs_get_pdev_info()
348 * myrs_dev_op - executes a "Device Operation" Command
353 struct myrs_cmdblk *cmd_blk = &cs->dcmd_blk; in myrs_dev_op()
354 union myrs_cmd_mbox *mbox = &cmd_blk->mbox; in myrs_dev_op() local
357 mutex_lock(&cs->dcmd_mutex); in myrs_dev_op()
359 mbox->dev_op.opcode = MYRS_CMD_OP_IOCTL; in myrs_dev_op()
360 mbox->dev_op.id = MYRS_DCMD_TAG; in myrs_dev_op()
361 mbox->dev_op.control.dma_ctrl_to_host = true; in myrs_dev_op()
362 mbox->dev_op.control.no_autosense = true; in myrs_dev_op()
363 mbox->dev_op.ioctl_opcode = opcode; in myrs_dev_op()
364 mbox->dev_op.opdev = opdev; in myrs_dev_op()
366 status = cmd_blk->status; in myrs_dev_op()
367 mutex_unlock(&cs->dcmd_mutex); in myrs_dev_op()
372 * myrs_translate_pdev - translates a Physical Device Channel and
379 struct pci_dev *pdev = cs->pdev; in myrs_translate_pdev()
382 union myrs_cmd_mbox *mbox; in myrs_translate_pdev() local
387 devmap_addr = dma_map_single(&pdev->dev, devmap, in myrs_translate_pdev()
390 if (dma_mapping_error(&pdev->dev, devmap_addr)) in myrs_translate_pdev()
393 mutex_lock(&cs->dcmd_mutex); in myrs_translate_pdev()
394 cmd_blk = &cs->dcmd_blk; in myrs_translate_pdev()
395 mbox = &cmd_blk->mbox; in myrs_translate_pdev()
396 mbox->pdev_info.opcode = MYRS_CMD_OP_IOCTL; in myrs_translate_pdev()
397 mbox->pdev_info.control.dma_ctrl_to_host = true; in myrs_translate_pdev()
398 mbox->pdev_info.control.no_autosense = true; in myrs_translate_pdev()
399 mbox->pdev_info.dma_size = sizeof(struct myrs_devmap); in myrs_translate_pdev()
400 mbox->pdev_info.pdev.target = target; in myrs_translate_pdev()
401 mbox->pdev_info.pdev.channel = channel; in myrs_translate_pdev()
402 mbox->pdev_info.pdev.lun = lun; in myrs_translate_pdev()
403 mbox->pdev_info.ioctl_opcode = MYRS_IOCTL_XLATE_PDEV_TO_LDEV; in myrs_translate_pdev()
404 sgl = &mbox->pdev_info.dma_addr; in myrs_translate_pdev()
405 sgl->sge[0].sge_addr = devmap_addr; in myrs_translate_pdev()
406 sgl->sge[0].sge_count = mbox->pdev_info.dma_size; in myrs_translate_pdev()
409 status = cmd_blk->status; in myrs_translate_pdev()
410 mutex_unlock(&cs->dcmd_mutex); in myrs_translate_pdev()
411 dma_unmap_single(&pdev->dev, devmap_addr, in myrs_translate_pdev()
417 * myrs_get_event - executes a Get Event Command
422 struct pci_dev *pdev = cs->pdev; in myrs_get_event()
424 struct myrs_cmdblk *cmd_blk = &cs->mcmd_blk; in myrs_get_event()
425 union myrs_cmd_mbox *mbox = &cmd_blk->mbox; in myrs_get_event() local
429 event_addr = dma_map_single(&pdev->dev, event_buf, in myrs_get_event()
431 if (dma_mapping_error(&pdev->dev, event_addr)) in myrs_get_event()
434 mbox->get_event.opcode = MYRS_CMD_OP_IOCTL; in myrs_get_event()
435 mbox->get_event.dma_size = sizeof(struct myrs_event); in myrs_get_event()
436 mbox->get_event.evnum_upper = event_num >> 16; in myrs_get_event()
437 mbox->get_event.ctlr_num = 0; in myrs_get_event()
438 mbox->get_event.ioctl_opcode = MYRS_IOCTL_GET_EVENT; in myrs_get_event()
439 mbox->get_event.evnum_lower = event_num & 0xFFFF; in myrs_get_event()
440 sgl = &mbox->get_event.dma_addr; in myrs_get_event()
441 sgl->sge[0].sge_addr = event_addr; in myrs_get_event()
442 sgl->sge[0].sge_count = mbox->get_event.dma_size; in myrs_get_event()
444 status = cmd_blk->status; in myrs_get_event()
445 dma_unmap_single(&pdev->dev, event_addr, in myrs_get_event()
452 * myrs_get_fwstatus - executes a Get Health Status Command
456 struct myrs_cmdblk *cmd_blk = &cs->mcmd_blk; in myrs_get_fwstatus()
457 union myrs_cmd_mbox *mbox = &cmd_blk->mbox; in myrs_get_fwstatus() local
459 unsigned char status = cmd_blk->status; in myrs_get_fwstatus()
462 mbox->common.opcode = MYRS_CMD_OP_IOCTL; in myrs_get_fwstatus()
463 mbox->common.id = MYRS_MCMD_TAG; in myrs_get_fwstatus()
464 mbox->common.control.dma_ctrl_to_host = true; in myrs_get_fwstatus()
465 mbox->common.control.no_autosense = true; in myrs_get_fwstatus()
466 mbox->common.dma_size = sizeof(struct myrs_fwstat); in myrs_get_fwstatus()
467 mbox->common.ioctl_opcode = MYRS_IOCTL_GET_HEALTH_STATUS; in myrs_get_fwstatus()
468 sgl = &mbox->common.dma_addr; in myrs_get_fwstatus()
469 sgl->sge[0].sge_addr = cs->fwstat_addr; in myrs_get_fwstatus()
470 sgl->sge[0].sge_count = mbox->ctlr_info.dma_size; in myrs_get_fwstatus()
471 dev_dbg(&cs->host->shost_gendev, "Sending GetHealthStatus\n"); in myrs_get_fwstatus()
473 status = cmd_blk->status; in myrs_get_fwstatus()
479 * myrs_enable_mmio_mbox - enables the Memory Mailbox Interface
484 void __iomem *base = cs->io_base; in myrs_enable_mmio_mbox()
485 struct pci_dev *pdev = cs->pdev; in myrs_enable_mmio_mbox()
488 union myrs_cmd_mbox *mbox; in myrs_enable_mmio_mbox() local
492 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) in myrs_enable_mmio_mbox()
493 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { in myrs_enable_mmio_mbox()
494 dev_err(&pdev->dev, "DMA mask out of range\n"); in myrs_enable_mmio_mbox()
499 mbox = dma_alloc_coherent(&pdev->dev, sizeof(union myrs_cmd_mbox), in myrs_enable_mmio_mbox()
501 if (dma_mapping_error(&pdev->dev, mbox_addr)) in myrs_enable_mmio_mbox()
505 cs->cmd_mbox_size = MYRS_MAX_CMD_MBOX * sizeof(union myrs_cmd_mbox); in myrs_enable_mmio_mbox()
506 cmd_mbox = dma_alloc_coherent(&pdev->dev, cs->cmd_mbox_size, in myrs_enable_mmio_mbox()
507 &cs->cmd_mbox_addr, GFP_KERNEL); in myrs_enable_mmio_mbox()
508 if (dma_mapping_error(&pdev->dev, cs->cmd_mbox_addr)) { in myrs_enable_mmio_mbox()
509 dev_err(&pdev->dev, "Failed to map command mailbox\n"); in myrs_enable_mmio_mbox()
512 cs->first_cmd_mbox = cmd_mbox; in myrs_enable_mmio_mbox()
513 cmd_mbox += MYRS_MAX_CMD_MBOX - 1; in myrs_enable_mmio_mbox()
514 cs->last_cmd_mbox = cmd_mbox; in myrs_enable_mmio_mbox()
515 cs->next_cmd_mbox = cs->first_cmd_mbox; in myrs_enable_mmio_mbox()
516 cs->prev_cmd_mbox1 = cs->last_cmd_mbox; in myrs_enable_mmio_mbox()
517 cs->prev_cmd_mbox2 = cs->last_cmd_mbox - 1; in myrs_enable_mmio_mbox()
520 cs->stat_mbox_size = MYRS_MAX_STAT_MBOX * sizeof(struct myrs_stat_mbox); in myrs_enable_mmio_mbox()
521 stat_mbox = dma_alloc_coherent(&pdev->dev, cs->stat_mbox_size, in myrs_enable_mmio_mbox()
522 &cs->stat_mbox_addr, GFP_KERNEL); in myrs_enable_mmio_mbox()
523 if (dma_mapping_error(&pdev->dev, cs->stat_mbox_addr)) { in myrs_enable_mmio_mbox()
524 dev_err(&pdev->dev, "Failed to map status mailbox\n"); in myrs_enable_mmio_mbox()
528 cs->first_stat_mbox = stat_mbox; in myrs_enable_mmio_mbox()
529 stat_mbox += MYRS_MAX_STAT_MBOX - 1; in myrs_enable_mmio_mbox()
530 cs->last_stat_mbox = stat_mbox; in myrs_enable_mmio_mbox()
531 cs->next_stat_mbox = cs->first_stat_mbox; in myrs_enable_mmio_mbox()
533 cs->fwstat_buf = dma_alloc_coherent(&pdev->dev, in myrs_enable_mmio_mbox()
535 &cs->fwstat_addr, GFP_KERNEL); in myrs_enable_mmio_mbox()
536 if (dma_mapping_error(&pdev->dev, cs->fwstat_addr)) { in myrs_enable_mmio_mbox()
537 dev_err(&pdev->dev, "Failed to map firmware health buffer\n"); in myrs_enable_mmio_mbox()
538 cs->fwstat_buf = NULL; in myrs_enable_mmio_mbox()
541 cs->ctlr_info = kzalloc(sizeof(struct myrs_ctlr_info), GFP_KERNEL); in myrs_enable_mmio_mbox()
542 if (!cs->ctlr_info) in myrs_enable_mmio_mbox()
545 cs->event_buf = kzalloc(sizeof(struct myrs_event), GFP_KERNEL); in myrs_enable_mmio_mbox()
546 if (!cs->event_buf) in myrs_enable_mmio_mbox()
550 memset(mbox, 0, sizeof(union myrs_cmd_mbox)); in myrs_enable_mmio_mbox()
551 mbox->set_mbox.id = 1; in myrs_enable_mmio_mbox()
552 mbox->set_mbox.opcode = MYRS_CMD_OP_IOCTL; in myrs_enable_mmio_mbox()
553 mbox->set_mbox.control.no_autosense = true; in myrs_enable_mmio_mbox()
554 mbox->set_mbox.first_cmd_mbox_size_kb = in myrs_enable_mmio_mbox()
556 mbox->set_mbox.first_stat_mbox_size_kb = in myrs_enable_mmio_mbox()
558 mbox->set_mbox.second_cmd_mbox_size_kb = 0; in myrs_enable_mmio_mbox()
559 mbox->set_mbox.second_stat_mbox_size_kb = 0; in myrs_enable_mmio_mbox()
560 mbox->set_mbox.sense_len = 0; in myrs_enable_mmio_mbox()
561 mbox->set_mbox.ioctl_opcode = MYRS_IOCTL_SET_MEM_MBOX; in myrs_enable_mmio_mbox()
562 mbox->set_mbox.fwstat_buf_size_kb = 1; in myrs_enable_mmio_mbox()
563 mbox->set_mbox.fwstat_buf_addr = cs->fwstat_addr; in myrs_enable_mmio_mbox()
564 mbox->set_mbox.first_cmd_mbox_addr = cs->cmd_mbox_addr; in myrs_enable_mmio_mbox()
565 mbox->set_mbox.first_stat_mbox_addr = cs->stat_mbox_addr; in myrs_enable_mmio_mbox()
569 dma_free_coherent(&pdev->dev, sizeof(union myrs_cmd_mbox), in myrs_enable_mmio_mbox()
570 mbox, mbox_addr); in myrs_enable_mmio_mbox()
572 dev_err(&pdev->dev, "Failed to enable mailbox, status %X\n", in myrs_enable_mmio_mbox()
578 * myrs_get_config - reads the Configuration Information
582 struct myrs_ctlr_info *info = cs->ctlr_info; in myrs_get_config()
583 struct Scsi_Host *shost = cs->host; in myrs_get_config()
589 /* Get data into dma-able area, then copy into permanent location */ in myrs_get_config()
590 mutex_lock(&cs->cinfo_mutex); in myrs_get_config()
592 mutex_unlock(&cs->cinfo_mutex); in myrs_get_config()
596 return -ENODEV; in myrs_get_config()
599 /* Initialize the Controller Model Name and Full Model Name fields. */ in myrs_get_config()
600 model_len = sizeof(info->ctlr_name); in myrs_get_config()
601 if (model_len > sizeof(model)-1) in myrs_get_config()
602 model_len = sizeof(model)-1; in myrs_get_config()
603 memcpy(model, info->ctlr_name, model_len); in myrs_get_config()
604 model_len--; in myrs_get_config()
606 model_len--; in myrs_get_config()
608 strcpy(cs->model_name, "DAC960 "); in myrs_get_config()
609 strcat(cs->model_name, model); in myrs_get_config()
611 sprintf(fw_version, "%d.%02d-%02d", in myrs_get_config()
612 info->fw_major_version, info->fw_minor_version, in myrs_get_config()
613 info->fw_turn_number); in myrs_get_config()
614 if (info->fw_major_version == 6 && in myrs_get_config()
615 info->fw_minor_version == 0 && in myrs_get_config()
616 info->fw_turn_number < 1) { in myrs_get_config()
620 "PLEASE UPGRADE TO VERSION 6.00-01 OR ABOVE.\n", in myrs_get_config()
622 return -ENODEV; in myrs_get_config()
625 shost->max_channel = info->physchan_present + info->virtchan_present; in myrs_get_config()
626 shost->max_id = info->max_targets[0]; in myrs_get_config()
628 if (!info->max_targets[i]) in myrs_get_config()
630 if (shost->max_id < info->max_targets[i]) in myrs_get_config()
631 shost->max_id = info->max_targets[i]; in myrs_get_config()
642 shost->can_queue = info->max_tcq - 3; in myrs_get_config()
643 if (shost->can_queue > MYRS_MAX_CMD_MBOX - 3) in myrs_get_config()
644 shost->can_queue = MYRS_MAX_CMD_MBOX - 3; in myrs_get_config()
645 shost->max_sectors = info->max_transfer_size; in myrs_get_config()
646 shost->sg_tablesize = info->max_sge; in myrs_get_config()
647 if (shost->sg_tablesize > MYRS_SG_LIMIT) in myrs_get_config()
648 shost->sg_tablesize = MYRS_SG_LIMIT; in myrs_get_config()
654 fw_version, info->physchan_present, info->mem_size_mb); in myrs_get_config()
658 shost->can_queue, shost->max_sectors); in myrs_get_config()
662 shost->can_queue, shost->sg_tablesize, MYRS_SG_LIMIT); in myrs_get_config()
663 for (i = 0; i < info->physchan_max; i++) { in myrs_get_config()
664 if (!info->max_targets[i]) in myrs_get_config()
668 i, info->max_targets[i]); in myrs_get_config()
672 info->physchan_present, info->physchan_max, in myrs_get_config()
673 info->pdisk_present, info->pdev_present); in myrs_get_config()
677 info->virtchan_present, info->virtchan_max, in myrs_get_config()
678 info->ldev_present); in myrs_get_config()
683 * myrs_log_event - prints a Controller Event message
689 /* Physical Device Events (0x0000 - 0x007F) */
741 /* Logical Device Events (0x0080 - 0x00FF) */
773 { 0x00A0, "L Temporarily Offline RAID-5/3 Drive Made Online" },
774 { 0x00A1, "L Temporarily Offline RAID-6/1/0/7 Drive Made Online" },
776 /* Fault Management Events (0x0100 - 0x017F) */
790 /* Controller Events (0x0180 - 0x01FF) */
816 struct Scsi_Host *shost = cs->host; in myrs_log_event()
822 if (ev->ev_code == 0x1C) { in myrs_log_event()
823 if (!scsi_normalize_sense(ev->sense_data, 40, &sshdr)) { in myrs_log_event()
828 memcpy(sense_info, &ev->sense_data[3], 4); in myrs_log_event()
829 memcpy(cmd_specific, &ev->sense_data[7], 4); in myrs_log_event()
834 ev->ev_code = ((sshdr.asc - 0x80) << 8 | sshdr.ascq); in myrs_log_event()
837 if (ev_code == ev->ev_code || ev_code == 0) in myrs_log_event()
846 ev->ev_code); in myrs_log_event()
851 sdev = scsi_device_lookup(shost, ev->channel, in myrs_log_event()
852 ev->target, 0); in myrs_log_event()
854 ev->ev_seq, ev_msg); in myrs_log_event()
855 if (sdev && sdev->hostdata && in myrs_log_event()
856 sdev->channel < cs->ctlr_info->physchan_present) { in myrs_log_event()
857 struct myrs_pdev_info *pdev_info = sdev->hostdata; in myrs_log_event()
859 switch (ev->ev_code) { in myrs_log_event()
862 pdev_info->dev_state = MYRS_DEVICE_ONLINE; in myrs_log_event()
865 pdev_info->dev_state = MYRS_DEVICE_STANDBY; in myrs_log_event()
868 pdev_info->dev_state = MYRS_DEVICE_OFFLINE; in myrs_log_event()
871 pdev_info->dev_state = MYRS_DEVICE_MISSING; in myrs_log_event()
874 pdev_info->dev_state = MYRS_DEVICE_UNCONFIGURED; in myrs_log_event()
882 ev->ev_seq, ev->lun, ev_msg); in myrs_log_event()
883 cs->needs_update = true; in myrs_log_event()
888 ev->ev_seq, ev->lun, ev_msg); in myrs_log_event()
889 cs->needs_update = true; in myrs_log_event()
899 ev->ev_seq, ev->channel, ev->target, ev_msg); in myrs_log_event()
902 ev->channel, ev->target, in myrs_log_event()
906 ev->channel, ev->target, in myrs_log_event()
913 if (cs->disable_enc_msg) in myrs_log_event()
915 sprintf(msg_buf, ev_msg, ev->lun); in myrs_log_event()
917 ev->ev_seq, ev->target, msg_buf); in myrs_log_event()
921 ev->ev_seq, ev_msg); in myrs_log_event()
926 ev->ev_seq, ev->ev_code); in myrs_log_event()
938 struct myrs_hba *cs = shost_priv(sdev->host); in raid_state_show()
941 if (!sdev->hostdata) in raid_state_show()
944 if (sdev->channel >= cs->ctlr_info->physchan_present) { in raid_state_show()
945 struct myrs_ldev_info *ldev_info = sdev->hostdata; in raid_state_show()
946 const char *name; in raid_state_show() local
948 name = myrs_devstate_name(ldev_info->dev_state); in raid_state_show()
949 if (name) in raid_state_show()
950 ret = snprintf(buf, 64, "%s\n", name); in raid_state_show()
953 ldev_info->dev_state); in raid_state_show()
956 const char *name; in raid_state_show() local
958 pdev_info = sdev->hostdata; in raid_state_show()
959 name = myrs_devstate_name(pdev_info->dev_state); in raid_state_show()
960 if (name) in raid_state_show()
961 ret = snprintf(buf, 64, "%s\n", name); in raid_state_show()
964 pdev_info->dev_state); in raid_state_show()
973 struct myrs_hba *cs = shost_priv(sdev->host); in raid_state_store()
975 union myrs_cmd_mbox *mbox; in raid_state_store() local
988 return -EINVAL; in raid_state_store()
990 if (sdev->channel < cs->ctlr_info->physchan_present) { in raid_state_store()
991 struct myrs_pdev_info *pdev_info = sdev->hostdata; in raid_state_store()
993 (struct myrs_devmap *)&pdev_info->rsvd13; in raid_state_store()
995 if (pdev_info->dev_state == new_state) { in raid_state_store()
1001 status = myrs_translate_pdev(cs, sdev->channel, sdev->id, in raid_state_store()
1002 sdev->lun, pdev_devmap); in raid_state_store()
1004 return -ENXIO; in raid_state_store()
1005 ldev_num = pdev_devmap->ldev_num; in raid_state_store()
1007 struct myrs_ldev_info *ldev_info = sdev->hostdata; in raid_state_store()
1009 if (ldev_info->dev_state == new_state) { in raid_state_store()
1015 ldev_num = ldev_info->ldev_num; in raid_state_store()
1017 mutex_lock(&cs->dcmd_mutex); in raid_state_store()
1018 cmd_blk = &cs->dcmd_blk; in raid_state_store()
1020 mbox = &cmd_blk->mbox; in raid_state_store()
1021 mbox->common.opcode = MYRS_CMD_OP_IOCTL; in raid_state_store()
1022 mbox->common.id = MYRS_DCMD_TAG; in raid_state_store()
1023 mbox->common.control.dma_ctrl_to_host = true; in raid_state_store()
1024 mbox->common.control.no_autosense = true; in raid_state_store()
1025 mbox->set_devstate.ioctl_opcode = MYRS_IOCTL_SET_DEVICE_STATE; in raid_state_store()
1026 mbox->set_devstate.state = new_state; in raid_state_store()
1027 mbox->set_devstate.ldev.ldev_num = ldev_num; in raid_state_store()
1029 status = cmd_blk->status; in raid_state_store()
1030 mutex_unlock(&cs->dcmd_mutex); in raid_state_store()
1032 if (sdev->channel < cs->ctlr_info->physchan_present) { in raid_state_store()
1033 struct myrs_pdev_info *pdev_info = sdev->hostdata; in raid_state_store()
1035 pdev_info->dev_state = new_state; in raid_state_store()
1037 struct myrs_ldev_info *ldev_info = sdev->hostdata; in raid_state_store()
1039 ldev_info->dev_state = new_state; in raid_state_store()
1049 return -EINVAL; in raid_state_store()
1057 struct myrs_hba *cs = shost_priv(sdev->host); in raid_level_show()
1058 const char *name = NULL; in raid_level_show() local
1060 if (!sdev->hostdata) in raid_level_show()
1063 if (sdev->channel >= cs->ctlr_info->physchan_present) { in raid_level_show()
1066 ldev_info = sdev->hostdata; in raid_level_show()
1067 name = myrs_raid_level_name(ldev_info->raid_level); in raid_level_show()
1068 if (!name) in raid_level_show()
1070 ldev_info->dev_state); in raid_level_show()
1073 name = myrs_raid_level_name(MYRS_RAID_PHYSICAL); in raid_level_show()
1075 return snprintf(buf, 64, "%s\n", name); in raid_level_show()
1083 struct myrs_hba *cs = shost_priv(sdev->host); in rebuild_show()
1088 if (sdev->channel < cs->ctlr_info->physchan_present) in rebuild_show()
1089 return snprintf(buf, 64, "physical device - not rebuilding\n"); in rebuild_show()
1091 ldev_info = sdev->hostdata; in rebuild_show()
1092 ldev_num = ldev_info->ldev_num; in rebuild_show()
1098 return -EIO; in rebuild_show()
1100 if (ldev_info->rbld_active) { in rebuild_show()
1102 (size_t)ldev_info->rbld_lba, in rebuild_show()
1103 (size_t)ldev_info->cfg_devsize); in rebuild_show()
1112 struct myrs_hba *cs = shost_priv(sdev->host); in rebuild_store()
1115 union myrs_cmd_mbox *mbox; in rebuild_store() local
1120 if (sdev->channel < cs->ctlr_info->physchan_present) in rebuild_store()
1121 return -EINVAL; in rebuild_store()
1123 ldev_info = sdev->hostdata; in rebuild_store()
1125 return -ENXIO; in rebuild_store()
1126 ldev_num = ldev_info->ldev_num; in rebuild_store()
1137 return -EIO; in rebuild_store()
1140 if (rebuild && ldev_info->rbld_active) { in rebuild_store()
1143 return -EALREADY; in rebuild_store()
1145 if (!rebuild && !ldev_info->rbld_active) { in rebuild_store()
1151 mutex_lock(&cs->dcmd_mutex); in rebuild_store()
1152 cmd_blk = &cs->dcmd_blk; in rebuild_store()
1154 mbox = &cmd_blk->mbox; in rebuild_store()
1155 mbox->common.opcode = MYRS_CMD_OP_IOCTL; in rebuild_store()
1156 mbox->common.id = MYRS_DCMD_TAG; in rebuild_store()
1157 mbox->common.control.dma_ctrl_to_host = true; in rebuild_store()
1158 mbox->common.control.no_autosense = true; in rebuild_store()
1160 mbox->ldev_info.ldev.ldev_num = ldev_num; in rebuild_store()
1161 mbox->ldev_info.ioctl_opcode = MYRS_IOCTL_RBLD_DEVICE_START; in rebuild_store()
1163 mbox->ldev_info.ldev.ldev_num = ldev_num; in rebuild_store()
1164 mbox->ldev_info.ioctl_opcode = MYRS_IOCTL_RBLD_DEVICE_STOP; in rebuild_store()
1167 status = cmd_blk->status; in rebuild_store()
1168 mutex_unlock(&cs->dcmd_mutex); in rebuild_store()
1173 ret = -EIO; in rebuild_store()
1188 struct myrs_hba *cs = shost_priv(sdev->host); in consistency_check_show()
1192 if (sdev->channel < cs->ctlr_info->physchan_present) in consistency_check_show()
1193 return snprintf(buf, 64, "physical device - not checking\n"); in consistency_check_show()
1195 ldev_info = sdev->hostdata; in consistency_check_show()
1197 return -ENXIO; in consistency_check_show()
1198 ldev_num = ldev_info->ldev_num; in consistency_check_show()
1200 if (ldev_info->cc_active) in consistency_check_show()
1202 (size_t)ldev_info->cc_lba, in consistency_check_show()
1203 (size_t)ldev_info->cfg_devsize); in consistency_check_show()
1212 struct myrs_hba *cs = shost_priv(sdev->host); in consistency_check_store()
1215 union myrs_cmd_mbox *mbox; in consistency_check_store() local
1220 if (sdev->channel < cs->ctlr_info->physchan_present) in consistency_check_store()
1221 return -EINVAL; in consistency_check_store()
1223 ldev_info = sdev->hostdata; in consistency_check_store()
1225 return -ENXIO; in consistency_check_store()
1226 ldev_num = ldev_info->ldev_num; in consistency_check_store()
1237 return -EIO; in consistency_check_store()
1239 if (check && ldev_info->cc_active) { in consistency_check_store()
1243 return -EALREADY; in consistency_check_store()
1245 if (!check && !ldev_info->cc_active) { in consistency_check_store()
1252 mutex_lock(&cs->dcmd_mutex); in consistency_check_store()
1253 cmd_blk = &cs->dcmd_blk; in consistency_check_store()
1255 mbox = &cmd_blk->mbox; in consistency_check_store()
1256 mbox->common.opcode = MYRS_CMD_OP_IOCTL; in consistency_check_store()
1257 mbox->common.id = MYRS_DCMD_TAG; in consistency_check_store()
1258 mbox->common.control.dma_ctrl_to_host = true; in consistency_check_store()
1259 mbox->common.control.no_autosense = true; in consistency_check_store()
1261 mbox->cc.ldev.ldev_num = ldev_num; in consistency_check_store()
1262 mbox->cc.ioctl_opcode = MYRS_IOCTL_CC_START; in consistency_check_store()
1263 mbox->cc.restore_consistency = true; in consistency_check_store()
1264 mbox->cc.initialized_area_only = false; in consistency_check_store()
1266 mbox->cc.ldev.ldev_num = ldev_num; in consistency_check_store()
1267 mbox->cc.ioctl_opcode = MYRS_IOCTL_CC_STOP; in consistency_check_store()
1270 status = cmd_blk->status; in consistency_check_store()
1271 mutex_unlock(&cs->dcmd_mutex); in consistency_check_store()
1276 ret = -EIO; in consistency_check_store()
1304 memcpy(serial, cs->ctlr_info->serial_number, 16); in serial_show()
1316 return snprintf(buf, 20, "%d\n", cs->host->host_no); in ctlr_num_show()
1322 char *name; member
1341 struct myrs_ctlr_info *info = cs->ctlr_info; in processor_show()
1345 if (info->cpu[0].cpu_count) { in processor_show()
1348 if (tbl[i].type == info->cpu[0].cpu_type) { in processor_show()
1349 first_processor = tbl[i].name; in processor_show()
1354 if (info->cpu[1].cpu_count) { in processor_show()
1357 if (tbl[i].type == info->cpu[1].cpu_type) { in processor_show()
1358 second_processor = tbl[i].name; in processor_show()
1366 info->cpu[0].cpu_name, in processor_show()
1367 first_processor, info->cpu[0].cpu_count, in processor_show()
1368 info->cpu[1].cpu_name, in processor_show()
1369 second_processor, info->cpu[1].cpu_count); in processor_show()
1372 info->cpu[0].cpu_name, in processor_show()
1373 first_processor, info->cpu[0].cpu_count); in processor_show()
1376 info->cpu[1].cpu_name, in processor_show()
1377 second_processor, info->cpu[1].cpu_count); in processor_show()
1391 return snprintf(buf, 28, "%s\n", cs->model_name); in model_show()
1401 return snprintf(buf, 4, "%d\n", cs->ctlr_info->ctlr_type); in ctlr_type_show()
1411 return snprintf(buf, 8, "%d MB\n", cs->ctlr_info->cache_size_mb); in cache_size_show()
1421 return snprintf(buf, 16, "%d.%02d-%02d\n", in firmware_show()
1422 cs->ctlr_info->fw_major_version, in firmware_show()
1423 cs->ctlr_info->fw_minor_version, in firmware_show()
1424 cs->ctlr_info->fw_turn_number); in firmware_show()
1434 union myrs_cmd_mbox *mbox; in discovery_store() local
1437 mutex_lock(&cs->dcmd_mutex); in discovery_store()
1438 cmd_blk = &cs->dcmd_blk; in discovery_store()
1440 mbox = &cmd_blk->mbox; in discovery_store()
1441 mbox->common.opcode = MYRS_CMD_OP_IOCTL; in discovery_store()
1442 mbox->common.id = MYRS_DCMD_TAG; in discovery_store()
1443 mbox->common.control.dma_ctrl_to_host = true; in discovery_store()
1444 mbox->common.control.no_autosense = true; in discovery_store()
1445 mbox->common.ioctl_opcode = MYRS_IOCTL_START_DISCOVERY; in discovery_store()
1447 status = cmd_blk->status; in discovery_store()
1448 mutex_unlock(&cs->dcmd_mutex); in discovery_store()
1453 return -EINVAL; in discovery_store()
1456 cs->next_evseq = 0; in discovery_store()
1457 cs->needs_update = true; in discovery_store()
1458 queue_delayed_work(cs->work_q, &cs->monitor_work, 1); in discovery_store()
1459 flush_delayed_work(&cs->monitor_work); in discovery_store()
1481 return -EIO; in flush_cache_store()
1491 return snprintf(buf, 3, "%d\n", cs->disable_enc_msg); in disable_enclosure_messages_show()
1498 struct myrs_hba *cs = shost_priv(sdev->host); in disable_enclosure_messages_store()
1506 return -EINVAL; in disable_enclosure_messages_store()
1508 cs->disable_enc_msg = value; in disable_enclosure_messages_store()
1534 struct Scsi_Host *shost = scmd->device->host; in myrs_host_reset()
1537 cs->reset(cs->io_base); in myrs_host_reset()
1548 dbd = (scmd->cmnd[1] & 0x08) == 0x08; in myrs_mode_sense()
1557 modes[0] = mode_len - 1; in myrs_mode_sense()
1559 if (ldev_info->ldev_control.wce == MYRS_LOGICALDEVICE_RO) in myrs_mode_sense()
1565 put_unaligned_be32(ldev_info->cfg_devsize, &block_desc[0]); in myrs_mode_sense()
1566 put_unaligned_be32(ldev_info->devsize_bytes, &block_desc[5]); in myrs_mode_sense()
1570 if (ldev_info->ldev_control.rce == MYRS_READCACHE_DISABLED) in myrs_mode_sense()
1572 if (ldev_info->ldev_control.wce == MYRS_WRITECACHE_ENABLED || in myrs_mode_sense()
1573 ldev_info->ldev_control.wce == MYRS_INTELLIGENT_WRITECACHE_ENABLED) in myrs_mode_sense()
1575 if (ldev_info->cacheline_size) { in myrs_mode_sense()
1577 put_unaligned_be16(1 << ldev_info->cacheline_size, in myrs_mode_sense()
1590 union myrs_cmd_mbox *mbox = &cmd_blk->mbox; in myrs_queuecommand() local
1591 struct scsi_device *sdev = scmd->device; in myrs_queuecommand()
1598 if (!scmd->device->hostdata) { in myrs_queuecommand()
1599 scmd->result = (DID_NO_CONNECT << 16); in myrs_queuecommand()
1604 switch (scmd->cmnd[0]) { in myrs_queuecommand()
1610 if (scmd->device->channel >= cs->ctlr_info->physchan_present) { in myrs_queuecommand()
1611 struct myrs_ldev_info *ldev_info = sdev->hostdata; in myrs_queuecommand()
1613 if ((scmd->cmnd[2] & 0x3F) != 0x3F && in myrs_queuecommand()
1614 (scmd->cmnd[2] & 0x3F) != 0x08) { in myrs_queuecommand()
1619 scmd->result = (DID_OK << 16); in myrs_queuecommand()
1628 cmd_blk->sense = dma_pool_alloc(cs->sense_pool, GFP_ATOMIC, in myrs_queuecommand()
1630 if (!cmd_blk->sense) in myrs_queuecommand()
1632 cmd_blk->sense_addr = sense_addr; in myrs_queuecommand()
1634 timeout = rq->timeout; in myrs_queuecommand()
1635 if (scmd->cmd_len <= 10) { in myrs_queuecommand()
1636 if (scmd->device->channel >= cs->ctlr_info->physchan_present) { in myrs_queuecommand()
1637 struct myrs_ldev_info *ldev_info = sdev->hostdata; in myrs_queuecommand()
1639 mbox->SCSI_10.opcode = MYRS_CMD_OP_SCSI_10; in myrs_queuecommand()
1640 mbox->SCSI_10.pdev.lun = ldev_info->lun; in myrs_queuecommand()
1641 mbox->SCSI_10.pdev.target = ldev_info->target; in myrs_queuecommand()
1642 mbox->SCSI_10.pdev.channel = ldev_info->channel; in myrs_queuecommand()
1643 mbox->SCSI_10.pdev.ctlr = 0; in myrs_queuecommand()
1645 mbox->SCSI_10.opcode = MYRS_CMD_OP_SCSI_10_PASSTHRU; in myrs_queuecommand()
1646 mbox->SCSI_10.pdev.lun = sdev->lun; in myrs_queuecommand()
1647 mbox->SCSI_10.pdev.target = sdev->id; in myrs_queuecommand()
1648 mbox->SCSI_10.pdev.channel = sdev->channel; in myrs_queuecommand()
1650 mbox->SCSI_10.id = rq->tag + 3; in myrs_queuecommand()
1651 mbox->SCSI_10.control.dma_ctrl_to_host = in myrs_queuecommand()
1652 (scmd->sc_data_direction == DMA_FROM_DEVICE); in myrs_queuecommand()
1653 if (rq->cmd_flags & REQ_FUA) in myrs_queuecommand()
1654 mbox->SCSI_10.control.fua = true; in myrs_queuecommand()
1655 mbox->SCSI_10.dma_size = scsi_bufflen(scmd); in myrs_queuecommand()
1656 mbox->SCSI_10.sense_addr = cmd_blk->sense_addr; in myrs_queuecommand()
1657 mbox->SCSI_10.sense_len = MYRS_SENSE_SIZE; in myrs_queuecommand()
1658 mbox->SCSI_10.cdb_len = scmd->cmd_len; in myrs_queuecommand()
1660 mbox->SCSI_10.tmo.tmo_scale = MYRS_TMO_SCALE_MINUTES; in myrs_queuecommand()
1661 mbox->SCSI_10.tmo.tmo_val = timeout / 60; in myrs_queuecommand()
1663 mbox->SCSI_10.tmo.tmo_scale = MYRS_TMO_SCALE_SECONDS; in myrs_queuecommand()
1664 mbox->SCSI_10.tmo.tmo_val = timeout; in myrs_queuecommand()
1666 memcpy(&mbox->SCSI_10.cdb, scmd->cmnd, scmd->cmd_len); in myrs_queuecommand()
1667 hw_sge = &mbox->SCSI_10.dma_addr; in myrs_queuecommand()
1668 cmd_blk->dcdb = NULL; in myrs_queuecommand()
1672 cmd_blk->dcdb = dma_pool_alloc(cs->dcdb_pool, GFP_ATOMIC, in myrs_queuecommand()
1674 if (!cmd_blk->dcdb) { in myrs_queuecommand()
1675 dma_pool_free(cs->sense_pool, cmd_blk->sense, in myrs_queuecommand()
1676 cmd_blk->sense_addr); in myrs_queuecommand()
1677 cmd_blk->sense = NULL; in myrs_queuecommand()
1678 cmd_blk->sense_addr = 0; in myrs_queuecommand()
1681 cmd_blk->dcdb_dma = dcdb_dma; in myrs_queuecommand()
1682 if (scmd->device->channel >= cs->ctlr_info->physchan_present) { in myrs_queuecommand()
1683 struct myrs_ldev_info *ldev_info = sdev->hostdata; in myrs_queuecommand()
1685 mbox->SCSI_255.opcode = MYRS_CMD_OP_SCSI_256; in myrs_queuecommand()
1686 mbox->SCSI_255.pdev.lun = ldev_info->lun; in myrs_queuecommand()
1687 mbox->SCSI_255.pdev.target = ldev_info->target; in myrs_queuecommand()
1688 mbox->SCSI_255.pdev.channel = ldev_info->channel; in myrs_queuecommand()
1689 mbox->SCSI_255.pdev.ctlr = 0; in myrs_queuecommand()
1691 mbox->SCSI_255.opcode = MYRS_CMD_OP_SCSI_255_PASSTHRU; in myrs_queuecommand()
1692 mbox->SCSI_255.pdev.lun = sdev->lun; in myrs_queuecommand()
1693 mbox->SCSI_255.pdev.target = sdev->id; in myrs_queuecommand()
1694 mbox->SCSI_255.pdev.channel = sdev->channel; in myrs_queuecommand()
1696 mbox->SCSI_255.id = rq->tag + 3; in myrs_queuecommand()
1697 mbox->SCSI_255.control.dma_ctrl_to_host = in myrs_queuecommand()
1698 (scmd->sc_data_direction == DMA_FROM_DEVICE); in myrs_queuecommand()
1699 if (rq->cmd_flags & REQ_FUA) in myrs_queuecommand()
1700 mbox->SCSI_255.control.fua = true; in myrs_queuecommand()
1701 mbox->SCSI_255.dma_size = scsi_bufflen(scmd); in myrs_queuecommand()
1702 mbox->SCSI_255.sense_addr = cmd_blk->sense_addr; in myrs_queuecommand()
1703 mbox->SCSI_255.sense_len = MYRS_SENSE_SIZE; in myrs_queuecommand()
1704 mbox->SCSI_255.cdb_len = scmd->cmd_len; in myrs_queuecommand()
1705 mbox->SCSI_255.cdb_addr = cmd_blk->dcdb_dma; in myrs_queuecommand()
1707 mbox->SCSI_255.tmo.tmo_scale = MYRS_TMO_SCALE_MINUTES; in myrs_queuecommand()
1708 mbox->SCSI_255.tmo.tmo_val = timeout / 60; in myrs_queuecommand()
1710 mbox->SCSI_255.tmo.tmo_scale = MYRS_TMO_SCALE_SECONDS; in myrs_queuecommand()
1711 mbox->SCSI_255.tmo.tmo_val = timeout; in myrs_queuecommand()
1713 memcpy(cmd_blk->dcdb, scmd->cmnd, scmd->cmd_len); in myrs_queuecommand()
1714 hw_sge = &mbox->SCSI_255.dma_addr; in myrs_queuecommand()
1716 if (scmd->sc_data_direction == DMA_NONE) in myrs_queuecommand()
1721 hw_sge->sge[0].sge_addr = (u64)sg_dma_address(sgl); in myrs_queuecommand()
1722 hw_sge->sge[0].sge_count = (u64)sg_dma_len(sgl); in myrs_queuecommand()
1729 hw_sgl = dma_pool_alloc(cs->sg_pool, GFP_ATOMIC, in myrs_queuecommand()
1732 if (cmd_blk->dcdb) { in myrs_queuecommand()
1733 dma_pool_free(cs->dcdb_pool, in myrs_queuecommand()
1734 cmd_blk->dcdb, in myrs_queuecommand()
1735 cmd_blk->dcdb_dma); in myrs_queuecommand()
1736 cmd_blk->dcdb = NULL; in myrs_queuecommand()
1737 cmd_blk->dcdb_dma = 0; in myrs_queuecommand()
1739 dma_pool_free(cs->sense_pool, in myrs_queuecommand()
1740 cmd_blk->sense, in myrs_queuecommand()
1741 cmd_blk->sense_addr); in myrs_queuecommand()
1742 cmd_blk->sense = NULL; in myrs_queuecommand()
1743 cmd_blk->sense_addr = 0; in myrs_queuecommand()
1746 cmd_blk->sgl = hw_sgl; in myrs_queuecommand()
1747 cmd_blk->sgl_addr = hw_sgl_addr; in myrs_queuecommand()
1748 if (scmd->cmd_len <= 10) in myrs_queuecommand()
1749 mbox->SCSI_10.control.add_sge_mem = true; in myrs_queuecommand()
1751 mbox->SCSI_255.control.add_sge_mem = true; in myrs_queuecommand()
1752 hw_sge->ext.sge0_len = nsge; in myrs_queuecommand()
1753 hw_sge->ext.sge0_addr = cmd_blk->sgl_addr; in myrs_queuecommand()
1755 hw_sgl = hw_sge->sge; in myrs_queuecommand()
1760 scmd->result = (DID_ERROR << 16); in myrs_queuecommand()
1764 hw_sgl->sge_addr = (u64)sg_dma_address(sgl); in myrs_queuecommand()
1765 hw_sgl->sge_count = (u64)sg_dma_len(sgl); in myrs_queuecommand()
1770 spin_lock_irqsave(&cs->queue_lock, flags); in myrs_queuecommand()
1772 spin_unlock_irqrestore(&cs->queue_lock, flags); in myrs_queuecommand()
1782 sdev->channel - cs->ctlr_info->physchan_present; in myrs_translate_ldev()
1784 ldev_num = sdev->id + chan_offset * sdev->host->max_id; in myrs_translate_ldev()
1791 struct myrs_hba *cs = shost_priv(sdev->host); in myrs_slave_alloc()
1794 if (sdev->channel > sdev->host->max_channel) in myrs_slave_alloc()
1797 if (sdev->channel >= cs->ctlr_info->physchan_present) { in myrs_slave_alloc()
1801 if (sdev->lun > 0) in myrs_slave_alloc()
1802 return -ENXIO; in myrs_slave_alloc()
1808 return -ENOMEM; in myrs_slave_alloc()
1812 sdev->hostdata = NULL; in myrs_slave_alloc()
1817 dev_dbg(&sdev->sdev_gendev, in myrs_slave_alloc()
1818 "Logical device mapping %d:%d:%d -> %d\n", in myrs_slave_alloc()
1819 ldev_info->channel, ldev_info->target, in myrs_slave_alloc()
1820 ldev_info->lun, ldev_info->ldev_num); in myrs_slave_alloc()
1822 sdev->hostdata = ldev_info; in myrs_slave_alloc()
1823 switch (ldev_info->raid_level) { in myrs_slave_alloc()
1855 &sdev->sdev_gendev, level); in myrs_slave_alloc()
1856 if (ldev_info->dev_state != MYRS_DEVICE_ONLINE) { in myrs_slave_alloc()
1857 const char *name; in myrs_slave_alloc() local
1859 name = myrs_devstate_name(ldev_info->dev_state); in myrs_slave_alloc()
1862 name ? name : "Invalid"); in myrs_slave_alloc()
1870 return -ENOMEM; in myrs_slave_alloc()
1872 status = myrs_get_pdev_info(cs, sdev->channel, in myrs_slave_alloc()
1873 sdev->id, sdev->lun, in myrs_slave_alloc()
1876 sdev->hostdata = NULL; in myrs_slave_alloc()
1878 return -ENXIO; in myrs_slave_alloc()
1880 sdev->hostdata = pdev_info; in myrs_slave_alloc()
1887 struct myrs_hba *cs = shost_priv(sdev->host); in myrs_slave_configure()
1890 if (sdev->channel > sdev->host->max_channel) in myrs_slave_configure()
1891 return -ENXIO; in myrs_slave_configure()
1893 if (sdev->channel < cs->ctlr_info->physchan_present) { in myrs_slave_configure()
1895 if (sdev->type == TYPE_RAID) in myrs_slave_configure()
1896 return -ENXIO; in myrs_slave_configure()
1897 sdev->no_uld_attach = 1; in myrs_slave_configure()
1900 if (sdev->lun != 0) in myrs_slave_configure()
1901 return -ENXIO; in myrs_slave_configure()
1903 ldev_info = sdev->hostdata; in myrs_slave_configure()
1905 return -ENXIO; in myrs_slave_configure()
1906 if (ldev_info->ldev_control.wce == MYRS_WRITECACHE_ENABLED || in myrs_slave_configure()
1907 ldev_info->ldev_control.wce == MYRS_INTELLIGENT_WRITECACHE_ENABLED) in myrs_slave_configure()
1908 sdev->wce_default_on = 1; in myrs_slave_configure()
1909 sdev->tagged_supported = 1; in myrs_slave_configure()
1915 kfree(sdev->hostdata); in myrs_slave_destroy()
1920 .name = "DAC960",
1930 .this_id = -1,
1943 shost->max_cmd_len = 16; in myrs_alloc_host()
1944 shost->max_lun = 256; in myrs_alloc_host()
1946 mutex_init(&cs->dcmd_mutex); in myrs_alloc_host()
1947 mutex_init(&cs->cinfo_mutex); in myrs_alloc_host()
1948 cs->host = shost; in myrs_alloc_host()
1958 * myrs_is_raid - return boolean indicating device is raid volume
1965 struct myrs_hba *cs = shost_priv(sdev->host); in myrs_is_raid()
1967 return (sdev->channel >= cs->ctlr_info->physchan_present) ? 1 : 0; in myrs_is_raid()
1971 * myrs_get_resync - get raid volume resync percent complete
1978 struct myrs_hba *cs = shost_priv(sdev->host); in myrs_get_resync()
1979 struct myrs_ldev_info *ldev_info = sdev->hostdata; in myrs_get_resync()
1982 if (sdev->channel < cs->ctlr_info->physchan_present || !ldev_info) in myrs_get_resync()
1984 if (ldev_info->rbld_active) { in myrs_get_resync()
1985 unsigned short ldev_num = ldev_info->ldev_num; in myrs_get_resync()
1988 percent_complete = ldev_info->rbld_lba * 100; in myrs_get_resync()
1989 do_div(percent_complete, ldev_info->cfg_devsize); in myrs_get_resync()
1995 * myrs_get_state - get raid volume status
2002 struct myrs_hba *cs = shost_priv(sdev->host); in myrs_get_state()
2003 struct myrs_ldev_info *ldev_info = sdev->hostdata; in myrs_get_state()
2006 if (sdev->channel < cs->ctlr_info->physchan_present || !ldev_info) in myrs_get_state()
2009 switch (ldev_info->dev_state) { in myrs_get_state()
2055 status = cmd_blk->status; in myrs_handle_scsi()
2056 if (cmd_blk->sense) { in myrs_handle_scsi()
2057 if (status == MYRS_STATUS_FAILED && cmd_blk->sense_len) { in myrs_handle_scsi()
2060 if (sense_len > cmd_blk->sense_len) in myrs_handle_scsi()
2061 sense_len = cmd_blk->sense_len; in myrs_handle_scsi()
2062 memcpy(scmd->sense_buffer, cmd_blk->sense, sense_len); in myrs_handle_scsi()
2064 dma_pool_free(cs->sense_pool, cmd_blk->sense, in myrs_handle_scsi()
2065 cmd_blk->sense_addr); in myrs_handle_scsi()
2066 cmd_blk->sense = NULL; in myrs_handle_scsi()
2067 cmd_blk->sense_addr = 0; in myrs_handle_scsi()
2069 if (cmd_blk->dcdb) { in myrs_handle_scsi()
2070 dma_pool_free(cs->dcdb_pool, cmd_blk->dcdb, in myrs_handle_scsi()
2071 cmd_blk->dcdb_dma); in myrs_handle_scsi()
2072 cmd_blk->dcdb = NULL; in myrs_handle_scsi()
2073 cmd_blk->dcdb_dma = 0; in myrs_handle_scsi()
2075 if (cmd_blk->sgl) { in myrs_handle_scsi()
2076 dma_pool_free(cs->sg_pool, cmd_blk->sgl, in myrs_handle_scsi()
2077 cmd_blk->sgl_addr); in myrs_handle_scsi()
2078 cmd_blk->sgl = NULL; in myrs_handle_scsi()
2079 cmd_blk->sgl_addr = 0; in myrs_handle_scsi()
2081 if (cmd_blk->residual) in myrs_handle_scsi()
2082 scsi_set_resid(scmd, cmd_blk->residual); in myrs_handle_scsi()
2085 scmd->result = (DID_BAD_TARGET << 16); in myrs_handle_scsi()
2087 scmd->result = (DID_OK << 16) | status; in myrs_handle_scsi()
2096 if (cmd_blk->complete) { in myrs_handle_cmdblk()
2097 complete(cmd_blk->complete); in myrs_handle_cmdblk()
2098 cmd_blk->complete = NULL; in myrs_handle_cmdblk()
2106 struct Scsi_Host *shost = cs->host; in myrs_monitor()
2107 struct myrs_ctlr_info *info = cs->ctlr_info; in myrs_monitor()
2108 unsigned int epoch = cs->fwstat_buf->epoch; in myrs_monitor()
2112 dev_dbg(&shost->shost_gendev, "monitor tick\n"); in myrs_monitor()
2116 if (cs->needs_update) { in myrs_monitor()
2117 cs->needs_update = false; in myrs_monitor()
2118 mutex_lock(&cs->cinfo_mutex); in myrs_monitor()
2120 mutex_unlock(&cs->cinfo_mutex); in myrs_monitor()
2122 if (cs->fwstat_buf->next_evseq - cs->next_evseq > 0) { in myrs_monitor()
2123 status = myrs_get_event(cs, cs->next_evseq, in myrs_monitor()
2124 cs->event_buf); in myrs_monitor()
2126 myrs_log_event(cs, cs->event_buf); in myrs_monitor()
2127 cs->next_evseq++; in myrs_monitor()
2132 if (time_after(jiffies, cs->secondary_monitor_time in myrs_monitor()
2134 cs->secondary_monitor_time = jiffies; in myrs_monitor()
2136 if (info->bg_init_active + in myrs_monitor()
2137 info->ldev_init_active + in myrs_monitor()
2138 info->pdev_init_active + in myrs_monitor()
2139 info->cc_active + in myrs_monitor()
2140 info->rbld_active + in myrs_monitor()
2141 info->exp_active != 0) { in myrs_monitor()
2148 if (sdev->channel < info->physchan_present) in myrs_monitor()
2150 ldev_info = sdev->hostdata; in myrs_monitor()
2153 ldev_num = ldev_info->ldev_num; in myrs_monitor()
2156 cs->needs_update = true; in myrs_monitor()
2158 if (epoch == cs->epoch && in myrs_monitor()
2159 cs->fwstat_buf->next_evseq == cs->next_evseq && in myrs_monitor()
2160 (cs->needs_update == false || in myrs_monitor()
2161 time_before(jiffies, cs->primary_monitor_time in myrs_monitor()
2167 cs->primary_monitor_time = jiffies; in myrs_monitor()
2168 queue_delayed_work(cs->work_q, &cs->monitor_work, interval); in myrs_monitor()
2173 struct Scsi_Host *shost = cs->host; in myrs_create_mempools()
2177 elem_size = shost->sg_tablesize * elem_align; in myrs_create_mempools()
2178 cs->sg_pool = dma_pool_create("myrs_sg", &pdev->dev, in myrs_create_mempools()
2180 if (cs->sg_pool == NULL) { in myrs_create_mempools()
2186 cs->sense_pool = dma_pool_create("myrs_sense", &pdev->dev, in myrs_create_mempools()
2188 if (cs->sense_pool == NULL) { in myrs_create_mempools()
2189 dma_pool_destroy(cs->sg_pool); in myrs_create_mempools()
2190 cs->sg_pool = NULL; in myrs_create_mempools()
2196 cs->dcdb_pool = dma_pool_create("myrs_dcdb", &pdev->dev, in myrs_create_mempools()
2199 if (!cs->dcdb_pool) { in myrs_create_mempools()
2200 dma_pool_destroy(cs->sg_pool); in myrs_create_mempools()
2201 cs->sg_pool = NULL; in myrs_create_mempools()
2202 dma_pool_destroy(cs->sense_pool); in myrs_create_mempools()
2203 cs->sense_pool = NULL; in myrs_create_mempools()
2209 cs->work_q = alloc_ordered_workqueue("myrs_wq_%d", WQ_MEM_RECLAIM, in myrs_create_mempools()
2210 shost->host_no); in myrs_create_mempools()
2211 if (!cs->work_q) { in myrs_create_mempools()
2212 dma_pool_destroy(cs->dcdb_pool); in myrs_create_mempools()
2213 cs->dcdb_pool = NULL; in myrs_create_mempools()
2214 dma_pool_destroy(cs->sg_pool); in myrs_create_mempools()
2215 cs->sg_pool = NULL; in myrs_create_mempools()
2216 dma_pool_destroy(cs->sense_pool); in myrs_create_mempools()
2217 cs->sense_pool = NULL; in myrs_create_mempools()
2224 INIT_DELAYED_WORK(&cs->monitor_work, myrs_monitor); in myrs_create_mempools()
2225 queue_delayed_work(cs->work_q, &cs->monitor_work, 1); in myrs_create_mempools()
2232 cancel_delayed_work_sync(&cs->monitor_work); in myrs_destroy_mempools()
2233 destroy_workqueue(cs->work_q); in myrs_destroy_mempools()
2235 dma_pool_destroy(cs->sg_pool); in myrs_destroy_mempools()
2236 dma_pool_destroy(cs->dcdb_pool); in myrs_destroy_mempools()
2237 dma_pool_destroy(cs->sense_pool); in myrs_destroy_mempools()
2242 kfree(cs->event_buf); in myrs_unmap()
2243 kfree(cs->ctlr_info); in myrs_unmap()
2244 if (cs->fwstat_buf) { in myrs_unmap()
2245 dma_free_coherent(&cs->pdev->dev, sizeof(struct myrs_fwstat), in myrs_unmap()
2246 cs->fwstat_buf, cs->fwstat_addr); in myrs_unmap()
2247 cs->fwstat_buf = NULL; in myrs_unmap()
2249 if (cs->first_stat_mbox) { in myrs_unmap()
2250 dma_free_coherent(&cs->pdev->dev, cs->stat_mbox_size, in myrs_unmap()
2251 cs->first_stat_mbox, cs->stat_mbox_addr); in myrs_unmap()
2252 cs->first_stat_mbox = NULL; in myrs_unmap()
2254 if (cs->first_cmd_mbox) { in myrs_unmap()
2255 dma_free_coherent(&cs->pdev->dev, cs->cmd_mbox_size, in myrs_unmap()
2256 cs->first_cmd_mbox, cs->cmd_mbox_addr); in myrs_unmap()
2257 cs->first_cmd_mbox = NULL; in myrs_unmap()
2263 struct pci_dev *pdev = cs->pdev; in myrs_cleanup()
2268 if (cs->mmio_base) { in myrs_cleanup()
2269 if (cs->disable_intr) in myrs_cleanup()
2270 cs->disable_intr(cs); in myrs_cleanup()
2271 iounmap(cs->mmio_base); in myrs_cleanup()
2272 cs->mmio_base = NULL; in myrs_cleanup()
2274 if (cs->irq) in myrs_cleanup()
2275 free_irq(cs->irq, cs); in myrs_cleanup()
2276 if (cs->io_addr) in myrs_cleanup()
2277 release_region(cs->io_addr, 0x80); in myrs_cleanup()
2280 scsi_host_put(cs->host); in myrs_cleanup()
2287 (struct myrs_privdata *)entry->driver_data; in myrs_detect()
2288 irq_handler_t irq_handler = privdata->irq_handler; in myrs_detect()
2289 unsigned int mmio_size = privdata->mmio_size; in myrs_detect()
2294 dev_err(&pdev->dev, "Unable to allocate Controller\n"); in myrs_detect()
2297 cs->pdev = pdev; in myrs_detect()
2302 cs->pci_addr = pci_resource_start(pdev, 0); in myrs_detect()
2305 spin_lock_init(&cs->queue_lock); in myrs_detect()
2309 cs->mmio_base = ioremap(cs->pci_addr & PAGE_MASK, mmio_size); in myrs_detect()
2310 if (cs->mmio_base == NULL) { in myrs_detect()
2311 dev_err(&pdev->dev, in myrs_detect()
2316 cs->io_base = cs->mmio_base + (cs->pci_addr & ~PAGE_MASK); in myrs_detect()
2317 if (privdata->hw_init(pdev, cs, cs->io_base)) in myrs_detect()
2321 if (request_irq(pdev->irq, irq_handler, IRQF_SHARED, "myrs", cs) < 0) { in myrs_detect()
2322 dev_err(&pdev->dev, in myrs_detect()
2323 "Unable to acquire IRQ Channel %d\n", pdev->irq); in myrs_detect()
2326 cs->irq = pdev->irq; in myrs_detect()
2330 dev_err(&pdev->dev, in myrs_detect()
2345 struct pci_dev *pdev = cs->pdev; in myrs_err_status()
2349 dev_info(&pdev->dev, in myrs_err_status()
2354 dev_notice(&pdev->dev, "Spinning Up Drives\n"); in myrs_err_status()
2357 dev_notice(&pdev->dev, "Configuration Checksum Error\n"); in myrs_err_status()
2360 dev_notice(&pdev->dev, "Mirror Race Recovery Failed\n"); in myrs_err_status()
2363 dev_notice(&pdev->dev, "Mirror Race Recovery In Progress\n"); in myrs_err_status()
2366 dev_notice(&pdev->dev, "Physical Device %d:%d COD Mismatch\n", in myrs_err_status()
2370 dev_notice(&pdev->dev, "Logical Drive Installation Aborted\n"); in myrs_err_status()
2373 dev_notice(&pdev->dev, "Mirror Race On A Critical Logical Drive\n"); in myrs_err_status()
2376 dev_notice(&pdev->dev, "New Controller Configuration Found\n"); in myrs_err_status()
2379 dev_err(&pdev->dev, "Fatal Memory Parity Error\n"); in myrs_err_status()
2382 dev_err(&pdev->dev, "Unknown Initialization Error %02X\n", in myrs_err_status()
2390 * Hardware-specific functions
2479 union myrs_cmd_mbox *mbox) in DAC960_GEM_write_cmd_mbox() argument
2481 memcpy(&mem_mbox->words[1], &mbox->words[1], in DAC960_GEM_write_cmd_mbox()
2482 sizeof(union myrs_cmd_mbox) - sizeof(unsigned int)); in DAC960_GEM_write_cmd_mbox()
2485 mem_mbox->words[0] = mbox->words[0]; in DAC960_GEM_write_cmd_mbox()
2549 return -EIO; in DAC960_GEM_hw_init()
2554 dev_err(&pdev->dev, in DAC960_GEM_hw_init()
2556 return -ETIMEDOUT; in DAC960_GEM_hw_init()
2559 dev_err(&pdev->dev, in DAC960_GEM_hw_init()
2562 return -EAGAIN; in DAC960_GEM_hw_init()
2565 cs->write_cmd_mbox = DAC960_GEM_write_cmd_mbox; in DAC960_GEM_hw_init()
2566 cs->get_cmd_mbox = DAC960_GEM_mem_mbox_new_cmd; in DAC960_GEM_hw_init()
2567 cs->disable_intr = DAC960_GEM_disable_intr; in DAC960_GEM_hw_init()
2568 cs->reset = DAC960_GEM_reset_ctrl; in DAC960_GEM_hw_init()
2575 void __iomem *base = cs->io_base; in DAC960_GEM_intr_handler()
2579 spin_lock_irqsave(&cs->queue_lock, flags); in DAC960_GEM_intr_handler()
2581 next_stat_mbox = cs->next_stat_mbox; in DAC960_GEM_intr_handler()
2582 while (next_stat_mbox->id > 0) { in DAC960_GEM_intr_handler()
2583 unsigned short id = next_stat_mbox->id; in DAC960_GEM_intr_handler()
2588 cmd_blk = &cs->dcmd_blk; in DAC960_GEM_intr_handler()
2590 cmd_blk = &cs->mcmd_blk; in DAC960_GEM_intr_handler()
2592 scmd = scsi_host_find_tag(cs->host, id - 3); in DAC960_GEM_intr_handler()
2597 cmd_blk->status = next_stat_mbox->status; in DAC960_GEM_intr_handler()
2598 cmd_blk->sense_len = next_stat_mbox->sense_len; in DAC960_GEM_intr_handler()
2599 cmd_blk->residual = next_stat_mbox->residual; in DAC960_GEM_intr_handler()
2601 dev_err(&cs->pdev->dev, in DAC960_GEM_intr_handler()
2605 if (++next_stat_mbox > cs->last_stat_mbox) in DAC960_GEM_intr_handler()
2606 next_stat_mbox = cs->first_stat_mbox; in DAC960_GEM_intr_handler()
2615 cs->next_stat_mbox = next_stat_mbox; in DAC960_GEM_intr_handler()
2616 spin_unlock_irqrestore(&cs->queue_lock, flags); in DAC960_GEM_intr_handler()
2696 union myrs_cmd_mbox *mbox) in DAC960_BA_write_cmd_mbox() argument
2698 memcpy(&mem_mbox->words[1], &mbox->words[1], in DAC960_BA_write_cmd_mbox()
2699 sizeof(union myrs_cmd_mbox) - sizeof(unsigned int)); in DAC960_BA_write_cmd_mbox()
2702 mem_mbox->words[0] = mbox->words[0]; in DAC960_BA_write_cmd_mbox()
2768 return -EIO; in DAC960_BA_hw_init()
2773 dev_err(&pdev->dev, in DAC960_BA_hw_init()
2775 return -ETIMEDOUT; in DAC960_BA_hw_init()
2778 dev_err(&pdev->dev, in DAC960_BA_hw_init()
2781 return -EAGAIN; in DAC960_BA_hw_init()
2784 cs->write_cmd_mbox = DAC960_BA_write_cmd_mbox; in DAC960_BA_hw_init()
2785 cs->get_cmd_mbox = DAC960_BA_mem_mbox_new_cmd; in DAC960_BA_hw_init()
2786 cs->disable_intr = DAC960_BA_disable_intr; in DAC960_BA_hw_init()
2787 cs->reset = DAC960_BA_reset_ctrl; in DAC960_BA_hw_init()
2794 void __iomem *base = cs->io_base; in DAC960_BA_intr_handler()
2798 spin_lock_irqsave(&cs->queue_lock, flags); in DAC960_BA_intr_handler()
2800 next_stat_mbox = cs->next_stat_mbox; in DAC960_BA_intr_handler()
2801 while (next_stat_mbox->id > 0) { in DAC960_BA_intr_handler()
2802 unsigned short id = next_stat_mbox->id; in DAC960_BA_intr_handler()
2807 cmd_blk = &cs->dcmd_blk; in DAC960_BA_intr_handler()
2809 cmd_blk = &cs->mcmd_blk; in DAC960_BA_intr_handler()
2811 scmd = scsi_host_find_tag(cs->host, id - 3); in DAC960_BA_intr_handler()
2816 cmd_blk->status = next_stat_mbox->status; in DAC960_BA_intr_handler()
2817 cmd_blk->sense_len = next_stat_mbox->sense_len; in DAC960_BA_intr_handler()
2818 cmd_blk->residual = next_stat_mbox->residual; in DAC960_BA_intr_handler()
2820 dev_err(&cs->pdev->dev, in DAC960_BA_intr_handler()
2824 if (++next_stat_mbox > cs->last_stat_mbox) in DAC960_BA_intr_handler()
2825 next_stat_mbox = cs->first_stat_mbox; in DAC960_BA_intr_handler()
2834 cs->next_stat_mbox = next_stat_mbox; in DAC960_BA_intr_handler()
2835 spin_unlock_irqrestore(&cs->queue_lock, flags); in DAC960_BA_intr_handler()
2915 union myrs_cmd_mbox *mbox) in DAC960_LP_write_cmd_mbox() argument
2917 memcpy(&mem_mbox->words[1], &mbox->words[1], in DAC960_LP_write_cmd_mbox()
2918 sizeof(union myrs_cmd_mbox) - sizeof(unsigned int)); in DAC960_LP_write_cmd_mbox()
2921 mem_mbox->words[0] = mbox->words[0]; in DAC960_LP_write_cmd_mbox()
2986 return -EIO; in DAC960_LP_hw_init()
2991 dev_err(&pdev->dev, in DAC960_LP_hw_init()
2993 return -ETIMEDOUT; in DAC960_LP_hw_init()
2996 dev_err(&pdev->dev, in DAC960_LP_hw_init()
2999 return -ENODEV; in DAC960_LP_hw_init()
3002 cs->write_cmd_mbox = DAC960_LP_write_cmd_mbox; in DAC960_LP_hw_init()
3003 cs->get_cmd_mbox = DAC960_LP_mem_mbox_new_cmd; in DAC960_LP_hw_init()
3004 cs->disable_intr = DAC960_LP_disable_intr; in DAC960_LP_hw_init()
3005 cs->reset = DAC960_LP_reset_ctrl; in DAC960_LP_hw_init()
3013 void __iomem *base = cs->io_base; in DAC960_LP_intr_handler()
3017 spin_lock_irqsave(&cs->queue_lock, flags); in DAC960_LP_intr_handler()
3019 next_stat_mbox = cs->next_stat_mbox; in DAC960_LP_intr_handler()
3020 while (next_stat_mbox->id > 0) { in DAC960_LP_intr_handler()
3021 unsigned short id = next_stat_mbox->id; in DAC960_LP_intr_handler()
3026 cmd_blk = &cs->dcmd_blk; in DAC960_LP_intr_handler()
3028 cmd_blk = &cs->mcmd_blk; in DAC960_LP_intr_handler()
3030 scmd = scsi_host_find_tag(cs->host, id - 3); in DAC960_LP_intr_handler()
3035 cmd_blk->status = next_stat_mbox->status; in DAC960_LP_intr_handler()
3036 cmd_blk->sense_len = next_stat_mbox->sense_len; in DAC960_LP_intr_handler()
3037 cmd_blk->residual = next_stat_mbox->residual; in DAC960_LP_intr_handler()
3039 dev_err(&cs->pdev->dev, in DAC960_LP_intr_handler()
3043 if (++next_stat_mbox > cs->last_stat_mbox) in DAC960_LP_intr_handler()
3044 next_stat_mbox = cs->first_stat_mbox; in DAC960_LP_intr_handler()
3053 cs->next_stat_mbox = next_stat_mbox; in DAC960_LP_intr_handler()
3054 spin_unlock_irqrestore(&cs->queue_lock, flags); in DAC960_LP_intr_handler()
3075 return -ENODEV; in myrs_probe()
3084 ret = -ENOMEM; in myrs_probe()
3088 ret = scsi_add_host(cs->host, &dev->dev); in myrs_probe()
3090 dev_err(&dev->dev, "scsi_add_host failed with %d\n", ret); in myrs_probe()
3094 scsi_scan_host(cs->host); in myrs_probe()
3109 shost_printk(KERN_NOTICE, cs->host, "Flushing Cache..."); in myrs_remove()
3135 .name = "myrs",
3147 return -ENODEV; in myrs_init_module()