sd: remove 'ssd' driver support
[unleashed/tickless.git] / usr / src / uts / common / xen / io / xnbe.c
blobf584d5b982c3216daf4bcb5023cb58d57d6c2196
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.
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.
47 #ifdef DEBUG
48 #define XNBE_DEBUG 1
49 #endif /* DEBUG */
51 #include <sys/types.h>
52 #include <sys/conf.h>
53 #include <sys/sunddi.h>
54 #include <sys/modctl.h>
55 #include <xen/sys/xendev.h>
56 #ifdef XNBE_DEBUG
57 #include <sys/cmn_err.h>
58 #endif /* XNBE_DEBUG */
60 #ifdef XNBE_DEBUG
61 int xnbe_debug = 0;
62 #endif /* XNBE_DEBUG */
64 static int
65 xnbe_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
67 #ifdef XNBE_DEBUG
68 if (xnbe_debug > 0)
69 cmn_err(CE_NOTE, "xnbe_attach: dip 0x%p, cmd %d",
70 (void *)dip, cmd);
71 #endif /* XNBE_DEBUG */
73 switch (cmd) {
74 case DDI_ATTACH:
75 break;
76 case DDI_RESUME:
77 return (DDI_SUCCESS);
78 default:
79 return (DDI_FAILURE);
82 (void) xvdi_post_event(dip, XEN_HP_ADD);
84 return (DDI_SUCCESS);
87 static int
88 xnbe_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
90 #ifdef XNBE_DEBUG
91 if (xnbe_debug > 0)
92 cmn_err(CE_NOTE, "detach: dip 0x%p, cmd %d",
93 (void *)dip, cmd);
94 #endif /* XNBE_DEBUG */
96 switch (cmd) {
97 case DDI_DETACH:
98 return (DDI_SUCCESS);
99 case DDI_SUSPEND:
100 return (DDI_SUCCESS);
101 default:
102 return (DDI_FAILURE);
106 static struct cb_ops cb_ops = {
107 nulldev, /* open */
108 nulldev, /* close */
109 nodev, /* strategy */
110 nodev, /* print */
111 nodev, /* dump */
112 nodev, /* read */
113 nodev, /* write */
114 nodev, /* ioctl */
115 nodev, /* devmap */
116 nodev, /* mmap */
117 nodev, /* segmap */
118 nochpoll, /* poll */
119 ddi_prop_op, /* cb_prop_op */
120 0, /* streamtab */
121 D_NEW | D_MP | D_64BIT /* Driver compatibility flag */
124 static struct dev_ops ops = {
125 DEVO_REV, /* devo_rev */
126 0, /* devo_refcnt */
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
148 _init(void)
150 return (mod_install(&modlinkage));
154 _info(struct modinfo *modinfop)
156 return (mod_info(&modlinkage, modinfop));
160 _fini(void)
162 return (mod_remove(&modlinkage));