Lines Matching refs:xdev

37 static struct xen_pcibk_device *alloc_pdev(struct xenbus_device *xdev)  in alloc_pdev()  argument
44 dev_dbg(&xdev->dev, "allocated pdev @ 0x%p\n", pdev); in alloc_pdev()
46 pdev->xdev = xdev; in alloc_pdev()
61 dev_set_drvdata(&xdev->dev, pdev); in alloc_pdev()
82 xenbus_unmap_ring_vfree(pdev->xdev, pdev->sh_info); in xen_pcibk_disconnect()
101 dev_set_drvdata(&pdev->xdev->dev, NULL); in free_pdev()
102 pdev->xdev = NULL; in free_pdev()
113 dev_dbg(&pdev->xdev->dev, in xen_pcibk_do_attach()
117 err = xenbus_map_ring_valloc(pdev->xdev, &gnt_ref, 1, &vaddr); in xen_pcibk_do_attach()
119 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_do_attach()
127 pdev->xdev, remote_evtchn, xen_pcibk_handle_event, in xen_pcibk_do_attach()
130 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_do_attach()
137 dev_dbg(&pdev->xdev->dev, "Attached!\n"); in xen_pcibk_do_attach()
152 if (xenbus_read_driver_state(pdev->xdev->nodename) != in xen_pcibk_attach()
157 if (xenbus_read_driver_state(pdev->xdev->otherend) != in xen_pcibk_attach()
161 dev_dbg(&pdev->xdev->dev, "Reading frontend config\n"); in xen_pcibk_attach()
163 err = xenbus_gather(XBT_NIL, pdev->xdev->otherend, in xen_pcibk_attach()
169 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_attach()
175 xenbus_dev_fatal(pdev->xdev, -EFAULT, in xen_pcibk_attach()
187 dev_dbg(&pdev->xdev->dev, "Connecting...\n"); in xen_pcibk_attach()
189 err = xenbus_switch_state(pdev->xdev, XenbusStateConnected); in xen_pcibk_attach()
191 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_attach()
194 dev_dbg(&pdev->xdev->dev, "Connected? %d\n", err); in xen_pcibk_attach()
218 err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, str, in xen_pcibk_publish_pci_dev()
233 dev_dbg(&pdev->xdev->dev, "exporting dom %x bus %x slot %x func %x\n", in xen_pcibk_export_device()
239 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_export_device()
252 dev_info(&dev->dev, "registering for %d\n", pdev->xdev->otherend_id); in xen_pcibk_export_device()
254 pdev->xdev->otherend_id) != 0) { in xen_pcibk_export_device()
258 xen_register_device_domain_owner(dev, pdev->xdev->otherend_id); in xen_pcibk_export_device()
279 dev_dbg(&pdev->xdev->dev, "removing dom %x bus %x slot %x func %x\n", in xen_pcibk_remove_device()
285 dev_dbg(&pdev->xdev->dev, "Couldn't locate PCI device " in xen_pcibk_remove_device()
291 dev_dbg(&dev->dev, "unregistering for %d\n", pdev->xdev->otherend_id); in xen_pcibk_remove_device()
309 dev_dbg(&pdev->xdev->dev, "Publishing pci roots\n"); in xen_pcibk_publish_pci_root()
311 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, in xen_pcibk_publish_pci_root()
326 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, in xen_pcibk_publish_pci_root()
347 dev_dbg(&pdev->xdev->dev, "writing root %d at %04x:%02x\n", in xen_pcibk_publish_pci_root()
350 err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, str, in xen_pcibk_publish_pci_root()
355 err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, in xen_pcibk_publish_pci_root()
374 dev_dbg(&pdev->xdev->dev, "Reconfiguring device ...\n"); in xen_pcibk_reconfigure()
377 if (xenbus_read_driver_state(pdev->xdev->nodename) != state) in xen_pcibk_reconfigure()
380 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, "num_devs", "%d", in xen_pcibk_reconfigure()
385 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
394 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
399 substate = xenbus_read_unsigned(pdev->xdev->nodename, state_str, in xen_pcibk_reconfigure()
404 dev_dbg(&pdev->xdev->dev, "Attaching dev-%d ...\n", i); in xen_pcibk_reconfigure()
409 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
414 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, in xen_pcibk_reconfigure()
418 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
425 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
440 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
446 err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, in xen_pcibk_reconfigure()
450 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
458 dev_dbg(&pdev->xdev->dev, "Detaching dev-%d ...\n", i); in xen_pcibk_reconfigure()
463 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
468 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, in xen_pcibk_reconfigure()
472 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
479 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
506 err = xenbus_switch_state(pdev->xdev, XenbusStateReconfigured); in xen_pcibk_reconfigure()
508 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
518 static void xen_pcibk_frontend_changed(struct xenbus_device *xdev, in xen_pcibk_frontend_changed() argument
521 struct xen_pcibk_device *pdev = dev_get_drvdata(&xdev->dev); in xen_pcibk_frontend_changed()
523 dev_dbg(&xdev->dev, "fe state changed %d\n", fe_state); in xen_pcibk_frontend_changed()
538 xenbus_switch_state(xdev, XenbusStateConnected); in xen_pcibk_frontend_changed()
543 xenbus_switch_state(xdev, XenbusStateClosing); in xen_pcibk_frontend_changed()
548 xenbus_switch_state(xdev, XenbusStateClosed); in xen_pcibk_frontend_changed()
549 if (xenbus_dev_is_online(xdev)) in xen_pcibk_frontend_changed()
553 dev_dbg(&xdev->dev, "frontend is gone! unregister device\n"); in xen_pcibk_frontend_changed()
554 device_unregister(&xdev->dev); in xen_pcibk_frontend_changed()
575 if (xenbus_read_driver_state(pdev->xdev->nodename) != in xen_pcibk_setup_backend()
579 dev_dbg(&pdev->xdev->dev, "getting be setup\n"); in xen_pcibk_setup_backend()
581 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, "num_devs", "%d", in xen_pcibk_setup_backend()
586 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
595 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
601 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, dev_str, in xen_pcibk_setup_backend()
604 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
610 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
624 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
629 err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, state_str, in xen_pcibk_setup_backend()
632 xenbus_dev_fatal(pdev->xdev, err, "Error switching " in xen_pcibk_setup_backend()
640 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
646 err = xenbus_switch_state(pdev->xdev, XenbusStateInitialised); in xen_pcibk_setup_backend()
648 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
665 switch (xenbus_read_driver_state(pdev->xdev->nodename)) { in xen_pcibk_be_watch()