4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #include <sys/types.h>
28 #include <sys/hypervisor.h>
29 #include <sys/sunndi.h>
30 #include <sys/sunddi.h>
31 #include <sys/ddi_subrdefs.h>
32 #include <sys/bootconf.h>
34 #include <sys/modctl.h>
35 #include <sys/errno.h>
36 #include <sys/reboot.h>
37 #include <sys/hypervisor.h>
38 #include <xen/sys/xenbus_comms.h>
39 #include <xen/sys/xenbus_impl.h>
40 #include <xen/sys/xendev.h>
42 extern int xen_boot_debug
;
45 * Internal structures and functions
47 int xendev_nounload
= 0;
48 void xendev_enumerate(int);
54 static struct modlmisc modlmisc
= {
55 &mod_miscops
, "virtual device probe"
58 static struct modlinkage modlinkage
= {
59 MODREV_1
, (void *)&modlmisc
, NULL
67 if ((err
= mod_install(&modlinkage
)) != 0)
70 impl_bus_add_probe(xendev_enumerate
);
82 if ((err
= mod_remove(&modlinkage
)) != 0)
85 impl_bus_delete_probe(xendev_enumerate
);
90 _info(struct modinfo
*modinfop
)
92 return (mod_info(&modlinkage
, modinfop
));
97 * This functions is invoked twice, first time with reprogram=0 to
98 * set up the xpvd portion of the device tree. The second time is
102 xendev_enumerate(int reprogram
)
109 ndi_devi_alloc_sleep(ddi_root_node(), "xpvd",
110 (pnode_t
)DEVI_SID_NODEID
, &dip
);
112 (void) ndi_devi_bind_driver(dip
, 0);
115 * Too early to enumerate split device drivers in domU
116 * since we need to create taskq thread during enumeration.
117 * So, we only enumerate softdevs and console here.
119 xendev_enum_all(dip
, B_TRUE
);