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()
83 xenbus_unmap_ring_vfree(pdev->xdev, pdev->sh_info); in xen_pcibk_disconnect()
102 dev_set_drvdata(&pdev->xdev->dev, NULL); in free_pdev()
103 pdev->xdev = NULL; in free_pdev()
114 dev_dbg(&pdev->xdev->dev, in xen_pcibk_do_attach()
118 err = xenbus_map_ring_valloc(pdev->xdev, &gnt_ref, 1, &vaddr); in xen_pcibk_do_attach()
120 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_do_attach()
128 pdev->xdev->otherend_id, remote_evtchn, xen_pcibk_handle_event, in xen_pcibk_do_attach()
131 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_do_attach()
138 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()
373 dev_dbg(&pdev->xdev->dev, "Reconfiguring device ...\n"); in xen_pcibk_reconfigure()
377 if (xenbus_read_driver_state(pdev->xdev->nodename) != in xen_pcibk_reconfigure()
381 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, "num_devs", "%d", in xen_pcibk_reconfigure()
386 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
395 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
400 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, state_str, in xen_pcibk_reconfigure()
407 dev_dbg(&pdev->xdev->dev, "Attaching dev-%d ...\n", i); in xen_pcibk_reconfigure()
412 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
417 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, in xen_pcibk_reconfigure()
421 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
428 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
443 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
449 err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, in xen_pcibk_reconfigure()
453 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
461 dev_dbg(&pdev->xdev->dev, "Detaching dev-%d ...\n", i); in xen_pcibk_reconfigure()
466 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
471 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, in xen_pcibk_reconfigure()
475 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
482 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
505 err = xenbus_switch_state(pdev->xdev, XenbusStateReconfigured); in xen_pcibk_reconfigure()
507 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_reconfigure()
517 static void xen_pcibk_frontend_changed(struct xenbus_device *xdev, in xen_pcibk_frontend_changed() argument
520 struct xen_pcibk_device *pdev = dev_get_drvdata(&xdev->dev); in xen_pcibk_frontend_changed()
522 dev_dbg(&xdev->dev, "fe state changed %d\n", fe_state); in xen_pcibk_frontend_changed()
537 xenbus_switch_state(xdev, XenbusStateConnected); in xen_pcibk_frontend_changed()
542 xenbus_switch_state(xdev, XenbusStateClosing); in xen_pcibk_frontend_changed()
547 xenbus_switch_state(xdev, XenbusStateClosed); in xen_pcibk_frontend_changed()
548 if (xenbus_dev_is_online(xdev)) in xen_pcibk_frontend_changed()
552 dev_dbg(&xdev->dev, "frontend is gone! unregister device\n"); in xen_pcibk_frontend_changed()
553 device_unregister(&xdev->dev); in xen_pcibk_frontend_changed()
574 if (xenbus_read_driver_state(pdev->xdev->nodename) != in xen_pcibk_setup_backend()
578 dev_dbg(&pdev->xdev->dev, "getting be setup\n"); in xen_pcibk_setup_backend()
580 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, "num_devs", "%d", in xen_pcibk_setup_backend()
585 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
594 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
600 err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, dev_str, in xen_pcibk_setup_backend()
603 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
609 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
623 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
628 err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, state_str, in xen_pcibk_setup_backend()
631 xenbus_dev_fatal(pdev->xdev, err, "Error switching " in xen_pcibk_setup_backend()
639 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
645 err = xenbus_switch_state(pdev->xdev, XenbusStateInitialised); in xen_pcibk_setup_backend()
647 xenbus_dev_fatal(pdev->xdev, err, in xen_pcibk_setup_backend()
664 switch (xenbus_read_driver_state(pdev->xdev->nodename)) { in xen_pcibk_be_watch()