722 if (cmd != DDI_ATTACH)
723 return (DDI_FAILURE);
724
725 if (ddi_create_minor_node(dip, ddi_get_name(dip), S_IFCHR,
726 ddi_get_instance(dip), DDI_PSEUDO, 0) != DDI_SUCCESS)
727 return (DDI_FAILURE);
728
729 xpv_dip = dip;
730
731 if (xpv_drv_init() != 0)
732 return (DDI_FAILURE);
733
734 ddi_report_dev(dip);
735
736 /*
737 * If the memscrubber attempts to scrub the pages we hand to Xen,
738 * the domain will panic.
739 */
740 memscrub_disable();
741
742 /*
743 * Report our version to dom0.
744 */
745 if (xenbus_printf(XBT_NULL, "guest/xpv", "version", "%d",
746 HVMPV_XPV_VERS))
747 cmn_err(CE_WARN, "xpv: couldn't write version\n");
748
749 return (DDI_SUCCESS);
750 }
751
752 /*
753 * Attempts to reload the PV driver plumbing hang on Intel platforms, so
754 * we don't want to unload the framework by accident.
755 */
756 int xpv_allow_detach = 0;
757
758 static int
759 xpv_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
760 {
761 if (cmd != DDI_DETACH || xpv_allow_detach == 0)
762 return (DDI_FAILURE);
763
764 if (xpv_dip != NULL) {
765 xen_pv_fini();
766 ddi_remove_minor_node(dip, NULL);
767 xpv_dip = NULL;
|
722 if (cmd != DDI_ATTACH)
723 return (DDI_FAILURE);
724
725 if (ddi_create_minor_node(dip, ddi_get_name(dip), S_IFCHR,
726 ddi_get_instance(dip), DDI_PSEUDO, 0) != DDI_SUCCESS)
727 return (DDI_FAILURE);
728
729 xpv_dip = dip;
730
731 if (xpv_drv_init() != 0)
732 return (DDI_FAILURE);
733
734 ddi_report_dev(dip);
735
736 /*
737 * If the memscrubber attempts to scrub the pages we hand to Xen,
738 * the domain will panic.
739 */
740 memscrub_disable();
741
742 /* Report our version to dom0 */
743 (void) xenbus_printf(XBT_NULL, "guest/xpv", "version", "%d",
744 HVMPV_XPV_VERS);
745
746 return (DDI_SUCCESS);
747 }
748
749 /*
750 * Attempts to reload the PV driver plumbing hang on Intel platforms, so
751 * we don't want to unload the framework by accident.
752 */
753 int xpv_allow_detach = 0;
754
755 static int
756 xpv_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
757 {
758 if (cmd != DDI_DETACH || xpv_allow_detach == 0)
759 return (DDI_FAILURE);
760
761 if (xpv_dip != NULL) {
762 xen_pv_fini();
763 ddi_remove_minor_node(dip, NULL);
764 xpv_dip = NULL;
|