• Home
  • Raw
  • Download

Lines Matching refs:mvi

99 static void __devinit mvs_phy_init(struct mvs_info *mvi, int phy_id)  in mvs_phy_init()  argument
101 struct mvs_phy *phy = &mvi->phy[phy_id]; in mvs_phy_init()
104 phy->mvi = mvi; in mvs_phy_init()
107 sas_phy->enabled = (phy_id < mvi->chip->n_phy) ? 1 : 0; in mvs_phy_init()
117 sas_phy->sas_addr = &mvi->sas_addr[0]; in mvs_phy_init()
119 sas_phy->ha = (struct sas_ha_struct *)mvi->shost->hostdata; in mvs_phy_init()
123 static void mvs_free(struct mvs_info *mvi) in mvs_free() argument
128 if (!mvi) in mvs_free()
131 if (mvi->flags & MVF_FLAG_SOC) in mvs_free()
136 if (mvi->dma_pool) in mvs_free()
137 pci_pool_destroy(mvi->dma_pool); in mvs_free()
139 if (mvi->tx) in mvs_free()
140 dma_free_coherent(mvi->dev, in mvs_free()
141 sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ, in mvs_free()
142 mvi->tx, mvi->tx_dma); in mvs_free()
143 if (mvi->rx_fis) in mvs_free()
144 dma_free_coherent(mvi->dev, MVS_RX_FISL_SZ, in mvs_free()
145 mvi->rx_fis, mvi->rx_fis_dma); in mvs_free()
146 if (mvi->rx) in mvs_free()
147 dma_free_coherent(mvi->dev, in mvs_free()
148 sizeof(*mvi->rx) * (MVS_RX_RING_SZ + 1), in mvs_free()
149 mvi->rx, mvi->rx_dma); in mvs_free()
150 if (mvi->slot) in mvs_free()
151 dma_free_coherent(mvi->dev, in mvs_free()
152 sizeof(*mvi->slot) * slot_nr, in mvs_free()
153 mvi->slot, mvi->slot_dma); in mvs_free()
155 if (mvi->bulk_buffer) in mvs_free()
156 dma_free_coherent(mvi->dev, TRASH_BUCKET_SIZE, in mvs_free()
157 mvi->bulk_buffer, mvi->bulk_buffer_dma); in mvs_free()
158 if (mvi->bulk_buffer1) in mvs_free()
159 dma_free_coherent(mvi->dev, TRASH_BUCKET_SIZE, in mvs_free()
160 mvi->bulk_buffer1, mvi->bulk_buffer_dma1); in mvs_free()
162 MVS_CHIP_DISP->chip_iounmap(mvi); in mvs_free()
163 if (mvi->shost) in mvs_free()
164 scsi_host_put(mvi->shost); in mvs_free()
165 list_for_each_entry(mwq, &mvi->wq_list, entry) in mvs_free()
167 kfree(mvi->tags); in mvs_free()
168 kfree(mvi); in mvs_free()
177 struct mvs_info *mvi; in mvs_tasklet() local
181 mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[0]; in mvs_tasklet()
183 if (unlikely(!mvi)) in mvs_tasklet()
186 stat = MVS_CHIP_DISP->isr_status(mvi, mvi->pdev->irq); in mvs_tasklet()
191 mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[i]; in mvs_tasklet()
192 MVS_CHIP_DISP->isr(mvi, mvi->pdev->irq, stat); in mvs_tasklet()
195 MVS_CHIP_DISP->interrupt_enable(mvi); in mvs_tasklet()
204 struct mvs_info *mvi; in mvs_interrupt() local
211 mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[0]; in mvs_interrupt()
213 if (unlikely(!mvi)) in mvs_interrupt()
216 MVS_CHIP_DISP->interrupt_disable(mvi); in mvs_interrupt()
219 stat = MVS_CHIP_DISP->isr_status(mvi, irq); in mvs_interrupt()
222 MVS_CHIP_DISP->interrupt_enable(mvi); in mvs_interrupt()
231 mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[i]; in mvs_interrupt()
232 MVS_CHIP_DISP->isr(mvi, irq, stat); in mvs_interrupt()
238 static int __devinit mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost) in mvs_alloc() argument
243 if (mvi->flags & MVF_FLAG_SOC) in mvs_alloc()
248 spin_lock_init(&mvi->lock); in mvs_alloc()
249 for (i = 0; i < mvi->chip->n_phy; i++) { in mvs_alloc()
250 mvs_phy_init(mvi, i); in mvs_alloc()
251 mvi->port[i].wide_port_phymap = 0; in mvs_alloc()
252 mvi->port[i].port_attached = 0; in mvs_alloc()
253 INIT_LIST_HEAD(&mvi->port[i].list); in mvs_alloc()
256 mvi->devices[i].taskfileset = MVS_ID_NOT_MAPPED; in mvs_alloc()
257 mvi->devices[i].dev_type = NO_DEVICE; in mvs_alloc()
258 mvi->devices[i].device_id = i; in mvs_alloc()
259 mvi->devices[i].dev_status = MVS_DEV_NORMAL; in mvs_alloc()
260 init_timer(&mvi->devices[i].timer); in mvs_alloc()
266 mvi->tx = dma_alloc_coherent(mvi->dev, in mvs_alloc()
267 sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ, in mvs_alloc()
268 &mvi->tx_dma, GFP_KERNEL); in mvs_alloc()
269 if (!mvi->tx) in mvs_alloc()
271 memset(mvi->tx, 0, sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ); in mvs_alloc()
272 mvi->rx_fis = dma_alloc_coherent(mvi->dev, MVS_RX_FISL_SZ, in mvs_alloc()
273 &mvi->rx_fis_dma, GFP_KERNEL); in mvs_alloc()
274 if (!mvi->rx_fis) in mvs_alloc()
276 memset(mvi->rx_fis, 0, MVS_RX_FISL_SZ); in mvs_alloc()
278 mvi->rx = dma_alloc_coherent(mvi->dev, in mvs_alloc()
279 sizeof(*mvi->rx) * (MVS_RX_RING_SZ + 1), in mvs_alloc()
280 &mvi->rx_dma, GFP_KERNEL); in mvs_alloc()
281 if (!mvi->rx) in mvs_alloc()
283 memset(mvi->rx, 0, sizeof(*mvi->rx) * (MVS_RX_RING_SZ + 1)); in mvs_alloc()
284 mvi->rx[0] = cpu_to_le32(0xfff); in mvs_alloc()
285 mvi->rx_cons = 0xfff; in mvs_alloc()
287 mvi->slot = dma_alloc_coherent(mvi->dev, in mvs_alloc()
288 sizeof(*mvi->slot) * slot_nr, in mvs_alloc()
289 &mvi->slot_dma, GFP_KERNEL); in mvs_alloc()
290 if (!mvi->slot) in mvs_alloc()
292 memset(mvi->slot, 0, sizeof(*mvi->slot) * slot_nr); in mvs_alloc()
294 mvi->bulk_buffer = dma_alloc_coherent(mvi->dev, in mvs_alloc()
296 &mvi->bulk_buffer_dma, GFP_KERNEL); in mvs_alloc()
297 if (!mvi->bulk_buffer) in mvs_alloc()
300 mvi->bulk_buffer1 = dma_alloc_coherent(mvi->dev, in mvs_alloc()
302 &mvi->bulk_buffer_dma1, GFP_KERNEL); in mvs_alloc()
303 if (!mvi->bulk_buffer1) in mvs_alloc()
306 sprintf(pool_name, "%s%d", "mvs_dma_pool", mvi->id); in mvs_alloc()
307 mvi->dma_pool = pci_pool_create(pool_name, mvi->pdev, MVS_SLOT_BUF_SZ, 16, 0); in mvs_alloc()
308 if (!mvi->dma_pool) { in mvs_alloc()
312 mvi->tags_num = slot_nr; in mvs_alloc()
315 mvs_tag_init(mvi); in mvs_alloc()
322 int mvs_ioremap(struct mvs_info *mvi, int bar, int bar_ex) in mvs_ioremap() argument
325 struct pci_dev *pdev = mvi->pdev; in mvs_ioremap()
338 mvi->regs_ex = ioremap(res_start, res_len); in mvs_ioremap()
340 mvi->regs_ex = ioremap_nocache(res_start, in mvs_ioremap()
343 mvi->regs_ex = (void *)res_start; in mvs_ioremap()
344 if (!mvi->regs_ex) in mvs_ioremap()
355 mvi->regs = ioremap(res_start, res_len); in mvs_ioremap()
357 mvi->regs = ioremap_nocache(res_start, res_len); in mvs_ioremap()
359 if (!mvi->regs) { in mvs_ioremap()
360 if (mvi->regs_ex && (res_flag_ex & IORESOURCE_MEM)) in mvs_ioremap()
361 iounmap(mvi->regs_ex); in mvs_ioremap()
362 mvi->regs_ex = NULL; in mvs_ioremap()
380 struct mvs_info *mvi = NULL; in mvs_pci_alloc() local
383 mvi = kzalloc(sizeof(*mvi) + in mvs_pci_alloc()
386 if (!mvi) in mvs_pci_alloc()
389 mvi->pdev = pdev; in mvs_pci_alloc()
390 mvi->dev = &pdev->dev; in mvs_pci_alloc()
391 mvi->chip_id = ent->driver_data; in mvs_pci_alloc()
392 mvi->chip = &mvs_chips[mvi->chip_id]; in mvs_pci_alloc()
393 INIT_LIST_HEAD(&mvi->wq_list); in mvs_pci_alloc()
395 ((struct mvs_prv_info *)sha->lldd_ha)->mvi[id] = mvi; in mvs_pci_alloc()
396 ((struct mvs_prv_info *)sha->lldd_ha)->n_phy = mvi->chip->n_phy; in mvs_pci_alloc()
398 mvi->id = id; in mvs_pci_alloc()
399 mvi->sas = sha; in mvs_pci_alloc()
400 mvi->shost = shost; in mvs_pci_alloc()
402 mvi->tags = kzalloc(MVS_CHIP_SLOT_SZ>>3, GFP_KERNEL); in mvs_pci_alloc()
403 if (!mvi->tags) in mvs_pci_alloc()
406 if (MVS_CHIP_DISP->chip_ioremap(mvi)) in mvs_pci_alloc()
408 if (!mvs_alloc(mvi, shost)) in mvs_pci_alloc()
409 return mvi; in mvs_pci_alloc()
411 mvs_free(mvi); in mvs_pci_alloc()
493 struct mvs_info *mvi = NULL; in mvs_post_sas_ha_init() local
498 mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[j]; in mvs_post_sas_ha_init()
501 &mvi->phy[i].sas_phy; in mvs_post_sas_ha_init()
503 &mvi->port[i].sas_port; in mvs_post_sas_ha_init()
508 sha->dev = mvi->dev; in mvs_post_sas_ha_init()
510 sha->sas_addr = &mvi->sas_addr[0]; in mvs_post_sas_ha_init()
516 if (mvi->flags & MVF_FLAG_SOC) in mvs_post_sas_ha_init()
524 mvi->shost->cmd_per_lun = MVS_QUEUE_SIZE; in mvs_post_sas_ha_init()
525 sha->core.shost = mvi->shost; in mvs_post_sas_ha_init()
528 static void mvs_init_sas_add(struct mvs_info *mvi) in mvs_init_sas_add() argument
531 for (i = 0; i < mvi->chip->n_phy; i++) { in mvs_init_sas_add()
532 mvi->phy[i].dev_sas_addr = 0x5005043011ab0000ULL; in mvs_init_sas_add()
533 mvi->phy[i].dev_sas_addr = in mvs_init_sas_add()
534 cpu_to_be64((u64)(*(u64 *)&mvi->phy[i].dev_sas_addr)); in mvs_init_sas_add()
537 memcpy(mvi->sas_addr, &mvi->phy[0].dev_sas_addr, SAS_ADDR_SIZE); in mvs_init_sas_add()
544 struct mvs_info *mvi; in mvs_pci_init() local
591 mvi = mvs_pci_alloc(pdev, ent, shost, nhost); in mvs_pci_init()
592 if (!mvi) { in mvs_pci_init()
597 memset(&mvi->hba_info_param, 0xFF, in mvs_pci_init()
600 mvs_init_sas_add(mvi); in mvs_pci_init()
602 mvi->instance = nhost; in mvs_pci_init()
603 rc = MVS_CHIP_DISP->chip_init(mvi); in mvs_pci_init()
605 mvs_free(mvi); in mvs_pci_init()
630 MVS_CHIP_DISP->interrupt_enable(mvi); in mvs_pci_init()
632 scsi_scan_host(mvi->shost); in mvs_pci_init()
639 scsi_remove_host(mvi->shost); in mvs_pci_init()
652 struct mvs_info *mvi = NULL; in mvs_pci_remove() local
655 mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[0]; in mvs_pci_remove()
663 sas_remove_host(mvi->shost); in mvs_pci_remove()
664 scsi_remove_host(mvi->shost); in mvs_pci_remove()
666 MVS_CHIP_DISP->interrupt_disable(mvi); in mvs_pci_remove()
667 free_irq(mvi->pdev->irq, sha); in mvs_pci_remove()
669 mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[i]; in mvs_pci_remove()
670 mvs_free(mvi); in mvs_pci_remove()
772 struct mvs_info *mvi = NULL; in mvs_store_interrupt_coalescing() local
791 mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[0]; in mvs_store_interrupt_coalescing()
793 if (unlikely(!mvi)) in mvs_store_interrupt_coalescing()
797 mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[i]; in mvs_store_interrupt_coalescing()
799 MVS_CHIP_DISP->tune_interrupt(mvi, in mvs_store_interrupt_coalescing()