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.
29 * Xen network backend - ioemu version.
31 * HVM guest domains use an emulated network device (typically the
32 * rtl8139) to access the physical network via IO emulation running in
33 * a backend domain (generally domain 0).
35 * The IO emulation code sends and receives packets using DLPI, usually
36 * through a virtual NIC (vnic).
38 * The creation of the relevant vnic to correspond to the network interface
39 * in the guest domain requires the use of 'hotplug' scripts in the backend
40 * domain. This driver ensures that the hotplug scripts are run when
41 * such guest domains are created.
43 * It is used as a result of the 'compatible' property associated with
44 * IO emulated devices. See /etc/driver_aliases and common/xen/os/xvdi.c.
51 #include <sys/types.h>
53 #include <sys/sunddi.h>
54 #include <sys/modctl.h>
55 #include <xen/sys/xendev.h>
57 #include <sys/cmn_err.h>
58 #endif /* XNBE_DEBUG */
62 #endif /* XNBE_DEBUG */
65 xnbe_attach(dev_info_t
*dip
, ddi_attach_cmd_t cmd
)
69 cmn_err(CE_NOTE
, "xnbe_attach: dip 0x%p, cmd %d",
71 #endif /* XNBE_DEBUG */
82 (void) xvdi_post_event(dip
, XEN_HP_ADD
);
88 xnbe_detach(dev_info_t
*dip
, ddi_detach_cmd_t cmd
)
92 cmn_err(CE_NOTE
, "detach: dip 0x%p, cmd %d",
94 #endif /* XNBE_DEBUG */
100 return (DDI_SUCCESS
);
102 return (DDI_FAILURE
);
106 static struct cb_ops cb_ops
= {
109 nodev
, /* strategy */
119 ddi_prop_op
, /* cb_prop_op */
121 D_NEW
| D_MP
| D_64BIT
/* Driver compatibility flag */
124 static struct dev_ops ops
= {
125 DEVO_REV
, /* devo_rev */
127 nulldev
, /* devo_getinfo */
128 nulldev
, /* devo_identify */
129 nulldev
, /* devo_probe */
130 xnbe_attach
, /* devo_attach */
131 xnbe_detach
, /* devo_detach */
132 nodev
, /* devo_reset */
133 &cb_ops
, /* devo_cb_ops */
134 NULL
, /* devo_bus_ops */
135 NULL
, /* devo_power */
136 ddi_quiesce_not_needed
, /* devo_quiesce */
139 static struct modldrv modldrv
= {
140 &mod_driverops
, "xnbe driver", &ops
,
143 static struct modlinkage modlinkage
= {
144 MODREV_1
, &modldrv
, NULL
150 return (mod_install(&modlinkage
));
154 _info(struct modinfo
*modinfop
)
156 return (mod_info(&modlinkage
, modinfop
));
162 return (mod_remove(&modlinkage
));