• Home
  • Raw
  • Download

Lines Matching refs:zdev

86 	struct zpci_dev *tmp, *zdev = NULL;  in get_zdev_by_fid()  local
91 zdev = tmp; in get_zdev_by_fid()
96 return zdev; in get_zdev_by_fid()
117 static int zpci_set_airq(struct zpci_dev *zdev) in zpci_set_airq() argument
119 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_REG_INT); in zpci_set_airq()
124 fib.noi = airq_iv_end(zdev->aibv); in zpci_set_airq()
125 fib.aibv = (unsigned long) zdev->aibv->vector; in zpci_set_airq()
127 fib.aisb = (unsigned long) zpci_aisb_iv->vector + (zdev->aisb/64)*8; in zpci_set_airq()
128 fib.aisbo = zdev->aisb & 63; in zpci_set_airq()
140 static int mod_pci(struct zpci_dev *zdev, int fn, u8 dmaas, struct mod_pci_args *args) in mod_pci() argument
142 u64 req = ZPCI_CREATE_REQ(zdev->fh, dmaas, fn); in mod_pci()
154 int zpci_register_ioat(struct zpci_dev *zdev, u8 dmaas, in zpci_register_ioat() argument
161 return mod_pci(zdev, ZPCI_MOD_FC_REG_IOAT, dmaas, &args); in zpci_register_ioat()
165 int zpci_unregister_ioat(struct zpci_dev *zdev, u8 dmaas) in zpci_unregister_ioat() argument
169 return mod_pci(zdev, ZPCI_MOD_FC_DEREG_IOAT, dmaas, &args); in zpci_unregister_ioat()
173 static int zpci_clear_airq(struct zpci_dev *zdev) in zpci_clear_airq() argument
177 return mod_pci(zdev, ZPCI_MOD_FC_DEREG_INT, 0, &args); in zpci_clear_airq()
181 int zpci_fmb_enable_device(struct zpci_dev *zdev) in zpci_fmb_enable_device() argument
185 if (zdev->fmb) in zpci_fmb_enable_device()
188 zdev->fmb = kmem_cache_zalloc(zdev_fmb_cache, GFP_KERNEL); in zpci_fmb_enable_device()
189 if (!zdev->fmb) in zpci_fmb_enable_device()
191 WARN_ON((u64) zdev->fmb & 0xf); in zpci_fmb_enable_device()
194 atomic64_set(&zdev->allocated_pages, 0); in zpci_fmb_enable_device()
195 atomic64_set(&zdev->mapped_pages, 0); in zpci_fmb_enable_device()
196 atomic64_set(&zdev->unmapped_pages, 0); in zpci_fmb_enable_device()
198 args.fmb_addr = virt_to_phys(zdev->fmb); in zpci_fmb_enable_device()
199 return mod_pci(zdev, ZPCI_MOD_FC_SET_MEASURE, 0, &args); in zpci_fmb_enable_device()
203 int zpci_fmb_disable_device(struct zpci_dev *zdev) in zpci_fmb_disable_device() argument
208 if (!zdev->fmb) in zpci_fmb_disable_device()
212 rc = mod_pci(zdev, ZPCI_MOD_FC_SET_MEASURE, 0, &args); in zpci_fmb_disable_device()
214 kmem_cache_free(zdev_fmb_cache, zdev->fmb); in zpci_fmb_disable_device()
215 zdev->fmb = NULL; in zpci_fmb_disable_device()
221 static int zpci_cfg_load(struct zpci_dev *zdev, int offset, u32 *val, u8 len) in zpci_cfg_load() argument
223 u64 req = ZPCI_CREATE_REQ(zdev->fh, ZPCI_PCIAS_CFGSPC, len); in zpci_cfg_load()
237 static int zpci_cfg_store(struct zpci_dev *zdev, int offset, u32 val, u8 len) in zpci_cfg_store() argument
239 u64 req = ZPCI_CREATE_REQ(zdev->fh, ZPCI_PCIAS_CFGSPC, len); in zpci_cfg_store()
269 struct zpci_dev *zdev = get_zdev(pdev); in pci_iomap() local
276 idx = zdev->bars[bar].map_idx; in pci_iomap()
278 zpci_iomap_start[idx].fh = zdev->fh; in pci_iomap()
302 struct zpci_dev *zdev = get_zdev_by_bus(bus); in pci_read() local
305 if (!zdev || devfn != ZPCI_DEVFN) in pci_read()
308 ret = zpci_cfg_load(zdev, where, val, size); in pci_read()
316 struct zpci_dev *zdev = get_zdev_by_bus(bus); in pci_write() local
319 if (!zdev || devfn != ZPCI_DEVFN) in pci_write()
322 ret = zpci_cfg_store(zdev, where, val, size); in pci_write()
368 struct zpci_dev *zdev = get_zdev(pdev); in arch_setup_msi_irqs() local
385 zdev->aisb = aisb; in arch_setup_msi_irqs()
389 zdev->aibv = airq_iv_create(msi_vecs, AIRQ_IV_DATA | AIRQ_IV_BITLOCK); in arch_setup_msi_irqs()
390 if (!zdev->aibv) in arch_setup_msi_irqs()
394 zpci_aibv[aisb] = zdev->aibv; in arch_setup_msi_irqs()
409 msg.address_lo = zdev->msi_addr & 0xffffffff; in arch_setup_msi_irqs()
410 msg.address_hi = zdev->msi_addr >> 32; in arch_setup_msi_irqs()
412 airq_iv_set_data(zdev->aibv, hwirq, irq); in arch_setup_msi_irqs()
417 rc = zpci_set_airq(zdev); in arch_setup_msi_irqs()
435 airq_iv_release(zdev->aibv); in arch_setup_msi_irqs()
444 struct zpci_dev *zdev = get_zdev(pdev); in arch_teardown_msi_irqs() local
449 rc = zpci_clear_airq(zdev); in arch_teardown_msi_irqs()
467 zpci_aibv[zdev->aisb] = NULL; in arch_teardown_msi_irqs()
468 airq_iv_release(zdev->aibv); in arch_teardown_msi_irqs()
469 airq_iv_free_bit(zpci_aisb_iv, zdev->aisb); in arch_teardown_msi_irqs()
472 static void zpci_map_resources(struct zpci_dev *zdev) in zpci_map_resources() argument
474 struct pci_dev *pdev = zdev->pdev; in zpci_map_resources()
487 static void zpci_unmap_resources(struct zpci_dev *zdev) in zpci_unmap_resources() argument
489 struct pci_dev *pdev = zdev->pdev; in zpci_unmap_resources()
531 static int zpci_alloc_iomap(struct zpci_dev *zdev) in zpci_alloc_iomap() argument
546 static void zpci_free_iomap(struct zpci_dev *zdev, int entry) in zpci_free_iomap() argument
554 static struct resource *__alloc_res(struct zpci_dev *zdev, unsigned long start, in __alloc_res() argument
566 r->name = zdev->res_name; in __alloc_res()
575 static int zpci_setup_bus_resources(struct zpci_dev *zdev, in zpci_setup_bus_resources() argument
582 snprintf(zdev->res_name, sizeof(zdev->res_name), in zpci_setup_bus_resources()
583 "PCI Bus %04x:%02x", zdev->domain, ZPCI_BUS_NR); in zpci_setup_bus_resources()
586 if (!zdev->bars[i].size) in zpci_setup_bus_resources()
588 entry = zpci_alloc_iomap(zdev); in zpci_setup_bus_resources()
591 zdev->bars[i].map_idx = entry; in zpci_setup_bus_resources()
595 if (zdev->bars[i].val & 8) in zpci_setup_bus_resources()
597 if (zdev->bars[i].val & 4) in zpci_setup_bus_resources()
602 size = 1UL << zdev->bars[i].size; in zpci_setup_bus_resources()
604 res = __alloc_res(zdev, addr, size, flags); in zpci_setup_bus_resources()
606 zpci_free_iomap(zdev, entry); in zpci_setup_bus_resources()
609 zdev->bars[i].res = res; in zpci_setup_bus_resources()
616 static void zpci_cleanup_bus_resources(struct zpci_dev *zdev) in zpci_cleanup_bus_resources() argument
621 if (!zdev->bars[i].size) in zpci_cleanup_bus_resources()
624 zpci_free_iomap(zdev, zdev->bars[i].map_idx); in zpci_cleanup_bus_resources()
625 release_resource(zdev->bars[i].res); in zpci_cleanup_bus_resources()
626 kfree(zdev->bars[i].res); in zpci_cleanup_bus_resources()
632 struct zpci_dev *zdev = get_zdev(pdev); in pcibios_add_device() local
636 zdev->pdev = pdev; in pcibios_add_device()
638 zpci_map_resources(zdev); in pcibios_add_device()
652 struct zpci_dev *zdev = get_zdev(pdev); in pcibios_enable_device() local
654 zdev->pdev = pdev; in pcibios_enable_device()
655 zpci_debug_init_device(zdev); in pcibios_enable_device()
656 zpci_fmb_enable_device(zdev); in pcibios_enable_device()
657 zpci_map_resources(zdev); in pcibios_enable_device()
664 struct zpci_dev *zdev = get_zdev(pdev); in pcibios_disable_device() local
666 zpci_unmap_resources(zdev); in pcibios_disable_device()
667 zpci_fmb_disable_device(zdev); in pcibios_disable_device()
668 zpci_debug_exit_device(zdev); in pcibios_disable_device()
669 zdev->pdev = NULL; in pcibios_disable_device()
675 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); in zpci_restore() local
678 if (zdev->state != ZPCI_FN_STATE_ONLINE) in zpci_restore()
681 ret = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES); in zpci_restore()
685 zpci_map_resources(zdev); in zpci_restore()
686 zpci_register_ioat(zdev, 0, zdev->start_dma + PAGE_OFFSET, in zpci_restore()
687 zdev->start_dma + zdev->iommu_size - 1, in zpci_restore()
688 (u64) zdev->dma_table); in zpci_restore()
696 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); in zpci_freeze() local
698 if (zdev->state != ZPCI_FN_STATE_ONLINE) in zpci_freeze()
701 zpci_unregister_ioat(zdev, 0); in zpci_freeze()
702 return clp_disable_fh(zdev); in zpci_freeze()
713 static int zpci_alloc_domain(struct zpci_dev *zdev) in zpci_alloc_domain() argument
716 zdev->domain = find_first_zero_bit(zpci_domain, ZPCI_NR_DEVICES); in zpci_alloc_domain()
717 if (zdev->domain == ZPCI_NR_DEVICES) { in zpci_alloc_domain()
721 set_bit(zdev->domain, zpci_domain); in zpci_alloc_domain()
726 static void zpci_free_domain(struct zpci_dev *zdev) in zpci_free_domain() argument
729 clear_bit(zdev->domain, zpci_domain); in zpci_free_domain()
735 struct zpci_dev *zdev = get_zdev_by_bus(bus); in pcibios_remove_bus() local
737 zpci_exit_slot(zdev); in pcibios_remove_bus()
738 zpci_cleanup_bus_resources(zdev); in pcibios_remove_bus()
739 zpci_free_domain(zdev); in pcibios_remove_bus()
742 list_del(&zdev->entry); in pcibios_remove_bus()
745 kfree(zdev); in pcibios_remove_bus()
748 static int zpci_scan_bus(struct zpci_dev *zdev) in zpci_scan_bus() argument
753 ret = zpci_setup_bus_resources(zdev, &resources); in zpci_scan_bus()
757 zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops, in zpci_scan_bus()
758 zdev, &resources); in zpci_scan_bus()
759 if (!zdev->bus) { in zpci_scan_bus()
760 zpci_cleanup_bus_resources(zdev); in zpci_scan_bus()
764 zdev->bus->max_bus_speed = zdev->max_bus_speed; in zpci_scan_bus()
768 int zpci_enable_device(struct zpci_dev *zdev) in zpci_enable_device() argument
772 rc = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES); in zpci_enable_device()
776 rc = zpci_dma_init_device(zdev); in zpci_enable_device()
780 zdev->state = ZPCI_FN_STATE_ONLINE; in zpci_enable_device()
784 clp_disable_fh(zdev); in zpci_enable_device()
790 int zpci_disable_device(struct zpci_dev *zdev) in zpci_disable_device() argument
792 zpci_dma_exit_device(zdev); in zpci_disable_device()
793 return clp_disable_fh(zdev); in zpci_disable_device()
797 int zpci_create_device(struct zpci_dev *zdev) in zpci_create_device() argument
801 rc = zpci_alloc_domain(zdev); in zpci_create_device()
805 if (zdev->state == ZPCI_FN_STATE_CONFIGURED) { in zpci_create_device()
806 rc = zpci_enable_device(zdev); in zpci_create_device()
810 rc = zpci_scan_bus(zdev); in zpci_create_device()
815 list_add_tail(&zdev->entry, &zpci_list); in zpci_create_device()
818 zpci_init_slot(zdev); in zpci_create_device()
823 if (zdev->state == ZPCI_FN_STATE_ONLINE) in zpci_create_device()
824 zpci_disable_device(zdev); in zpci_create_device()
826 zpci_free_domain(zdev); in zpci_create_device()
831 void zpci_stop_device(struct zpci_dev *zdev) in zpci_stop_device() argument
833 zpci_dma_exit_device(zdev); in zpci_stop_device()