8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / uts / common / xen / io / xpv_autoconfig.c
bloba1a0556df6f44751a935c37973255fbb086a7513
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
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>
33 #include <sys/psw.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);
51 * Interface routines
54 static struct modlmisc modlmisc = {
55 &mod_miscops, "virtual device probe"
58 static struct modlinkage modlinkage = {
59 MODREV_1, (void *)&modlmisc, NULL
62 int
63 _init(void)
65 int err;
67 if ((err = mod_install(&modlinkage)) != 0)
68 return (err);
70 impl_bus_add_probe(xendev_enumerate);
71 return (0);
74 int
75 _fini(void)
77 int err;
79 if (xendev_nounload)
80 return (EBUSY);
82 if ((err = mod_remove(&modlinkage)) != 0)
83 return (err);
85 impl_bus_delete_probe(xendev_enumerate);
86 return (0);
89 int
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
99 * ignored.
101 void
102 xendev_enumerate(int reprogram)
104 dev_info_t *dip;
106 if (reprogram != 0)
107 return;
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);