• Home
  • Raw
  • Download

Lines Matching refs:ntb

31 int ntb_msi_init(struct ntb_dev *ntb,  in ntb_msi_init()  argument
42 peers = ntb_peer_port_count(ntb); in ntb_msi_init()
46 struct_size = sizeof(*ntb->msi) + sizeof(*ntb->msi->peer_mws) * peers; in ntb_msi_init()
48 ntb->msi = devm_kzalloc(&ntb->dev, struct_size, GFP_KERNEL); in ntb_msi_init()
49 if (!ntb->msi) in ntb_msi_init()
52 ntb->msi->desc_changed = desc_changed; in ntb_msi_init()
55 peer_widx = ntb_peer_mw_count(ntb) - 1 - i; in ntb_msi_init()
57 ret = ntb_peer_mw_get_addr(ntb, peer_widx, &mw_phys_addr, in ntb_msi_init()
62 ntb->msi->peer_mws[i] = devm_ioremap(&ntb->dev, mw_phys_addr, in ntb_msi_init()
64 if (!ntb->msi->peer_mws[i]) { in ntb_msi_init()
74 if (ntb->msi->peer_mws[i]) in ntb_msi_init()
75 devm_iounmap(&ntb->dev, ntb->msi->peer_mws[i]); in ntb_msi_init()
77 devm_kfree(&ntb->dev, ntb->msi); in ntb_msi_init()
78 ntb->msi = NULL; in ntb_msi_init()
97 int ntb_msi_setup_mws(struct ntb_dev *ntb) in ntb_msi_setup_mws() argument
108 if (!ntb->msi) in ntb_msi_setup_mws()
111 desc = first_msi_entry(&ntb->pdev->dev); in ntb_msi_setup_mws()
114 for (peer = 0; peer < ntb_peer_port_count(ntb); peer++) { in ntb_msi_setup_mws()
115 peer_widx = ntb_peer_highest_mw_idx(ntb, peer); in ntb_msi_setup_mws()
119 ret = ntb_mw_get_align(ntb, peer, peer_widx, &addr_align, in ntb_msi_setup_mws()
127 for (peer = 0; peer < ntb_peer_port_count(ntb); peer++) { in ntb_msi_setup_mws()
128 peer_widx = ntb_peer_highest_mw_idx(ntb, peer); in ntb_msi_setup_mws()
134 ret = ntb_mw_get_align(ntb, peer, peer_widx, NULL, in ntb_msi_setup_mws()
144 ret = ntb_mw_set_trans(ntb, peer, peer_widx, in ntb_msi_setup_mws()
150 ntb->msi->base_addr = addr; in ntb_msi_setup_mws()
151 ntb->msi->end_addr = addr + mw_min_size; in ntb_msi_setup_mws()
157 peer_widx = ntb_peer_highest_mw_idx(ntb, peer); in ntb_msi_setup_mws()
161 ntb_mw_clear_trans(ntb, i, peer_widx); in ntb_msi_setup_mws()
174 void ntb_msi_clear_mws(struct ntb_dev *ntb) in ntb_msi_clear_mws() argument
179 for (peer = 0; peer < ntb_peer_port_count(ntb); peer++) { in ntb_msi_clear_mws()
180 peer_widx = ntb_peer_highest_mw_idx(ntb, peer); in ntb_msi_clear_mws()
184 ntb_mw_clear_trans(ntb, peer, peer_widx); in ntb_msi_clear_mws()
190 struct ntb_dev *ntb; member
195 static int ntb_msi_set_desc(struct ntb_dev *ntb, struct msi_desc *entry, in ntb_msi_set_desc() argument
203 if (addr < ntb->msi->base_addr || addr >= ntb->msi->end_addr) { in ntb_msi_set_desc()
204 dev_warn_once(&ntb->dev, in ntb_msi_set_desc()
206 entry->irq, addr, ntb->msi->base_addr, in ntb_msi_set_desc()
207 ntb->msi->end_addr); in ntb_msi_set_desc()
211 msi_desc->addr_offset = addr - ntb->msi->base_addr; in ntb_msi_set_desc()
221 WARN_ON(ntb_msi_set_desc(dr->ntb, entry, dr->msi_desc)); in ntb_msi_write_msg()
223 if (dr->ntb->msi->desc_changed) in ntb_msi_write_msg()
224 dr->ntb->msi->desc_changed(dr->ntb->ctx); in ntb_msi_write_msg()
235 static int ntbm_msi_setup_callback(struct ntb_dev *ntb, struct msi_desc *entry, in ntbm_msi_setup_callback() argument
245 dr->ntb = ntb; in ntbm_msi_setup_callback()
249 devres_add(&ntb->dev, dr); in ntbm_msi_setup_callback()
279 int ntbm_msi_request_threaded_irq(struct ntb_dev *ntb, irq_handler_t handler, in ntbm_msi_request_threaded_irq() argument
288 if (!ntb->msi) in ntbm_msi_request_threaded_irq()
291 for_each_pci_msi_entry(entry, ntb->pdev) { in ntbm_msi_request_threaded_irq()
296 ret = devm_request_threaded_irq(&ntb->dev, entry->irq, handler, in ntbm_msi_request_threaded_irq()
301 if (ntb_msi_set_desc(ntb, entry, msi_desc)) { in ntbm_msi_request_threaded_irq()
302 devm_free_irq(&ntb->dev, entry->irq, dev_id); in ntbm_msi_request_threaded_irq()
306 ret = ntbm_msi_setup_callback(ntb, entry, msi_desc); in ntbm_msi_request_threaded_irq()
308 devm_free_irq(&ntb->dev, entry->irq, dev_id); in ntbm_msi_request_threaded_irq()
322 struct ntb_dev *ntb = dev_ntb(dev); in ntbm_msi_callback_match() local
325 return dr->ntb == ntb && dr->entry == data; in ntbm_msi_callback_match()
337 void ntbm_msi_free_irq(struct ntb_dev *ntb, unsigned int irq, void *dev_id) in ntbm_msi_free_irq() argument
344 WARN_ON(devres_destroy(&ntb->dev, ntbm_msi_callback_release, in ntbm_msi_free_irq()
347 devm_free_irq(&ntb->dev, irq, dev_id); in ntbm_msi_free_irq()
363 int ntb_msi_peer_trigger(struct ntb_dev *ntb, int peer, in ntb_msi_peer_trigger() argument
368 if (!ntb->msi) in ntb_msi_peer_trigger()
371 idx = desc->addr_offset / sizeof(*ntb->msi->peer_mws[peer]); in ntb_msi_peer_trigger()
373 iowrite32(desc->data, &ntb->msi->peer_mws[peer][idx]); in ntb_msi_peer_trigger()
393 int ntb_msi_peer_addr(struct ntb_dev *ntb, int peer, in ntb_msi_peer_addr() argument
397 int peer_widx = ntb_peer_mw_count(ntb) - 1 - peer; in ntb_msi_peer_addr()
401 ret = ntb_peer_mw_get_addr(ntb, peer_widx, &mw_phys_addr, NULL); in ntb_msi_peer_addr()