xref: /illumos-gate/usr/src/uts/sun/io/qfe.c (revision da14cebe459d3275048785f25bd869cb09b5307f)
1f2cd0f02Sgd78059 /*
2f2cd0f02Sgd78059  * CDDL HEADER START
3f2cd0f02Sgd78059  *
4f2cd0f02Sgd78059  * The contents of this file are subject to the terms of the
5f2cd0f02Sgd78059  * Common Development and Distribution License (the "License").
6f2cd0f02Sgd78059  * You may not use this file except in compliance with the License.
7f2cd0f02Sgd78059  *
8f2cd0f02Sgd78059  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9f2cd0f02Sgd78059  * or http://www.opensolaris.org/os/licensing.
10f2cd0f02Sgd78059  * See the License for the specific language governing permissions
11f2cd0f02Sgd78059  * and limitations under the License.
12f2cd0f02Sgd78059  *
13f2cd0f02Sgd78059  * When distributing Covered Code, include this CDDL HEADER in each
14f2cd0f02Sgd78059  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15f2cd0f02Sgd78059  * If applicable, add the following below this CDDL HEADER, with the
16f2cd0f02Sgd78059  * fields enclosed by brackets "[]" replaced with your own identifying
17f2cd0f02Sgd78059  * information: Portions Copyright [yyyy] [name of copyright owner]
18f2cd0f02Sgd78059  *
19f2cd0f02Sgd78059  * CDDL HEADER END
20f2cd0f02Sgd78059  */
2119397407SSherry Moore 
22f2cd0f02Sgd78059 /*
2319397407SSherry Moore  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24f2cd0f02Sgd78059  * Use is subject to license terms.
25f2cd0f02Sgd78059  */
26f2cd0f02Sgd78059 
27f2cd0f02Sgd78059 
28f2cd0f02Sgd78059 /*
29f2cd0f02Sgd78059  * SunOS MT QFE Device Driver (layered above FEPS/Cheerio)
30f2cd0f02Sgd78059  */
31f2cd0f02Sgd78059 
32f2cd0f02Sgd78059 #include	<sys/types.h>
33f2cd0f02Sgd78059 #include	<sys/debug.h>
34f2cd0f02Sgd78059 #include	<sys/stream.h>
35f2cd0f02Sgd78059 #include	<sys/cmn_err.h>
36f2cd0f02Sgd78059 #include	<sys/kmem.h>
37f2cd0f02Sgd78059 #include	<sys/modctl.h>
38f2cd0f02Sgd78059 #include	<sys/conf.h>
39*da14cebeSEric Cheng #include	<sys/mac_provider.h>
40f2cd0f02Sgd78059 #include	<sys/mac_ether.h>
41f2cd0f02Sgd78059 #include	<sys/ddi.h>
42f2cd0f02Sgd78059 #include	<sys/sunddi.h>
43f2cd0f02Sgd78059 
44f2cd0f02Sgd78059 /*
45f2cd0f02Sgd78059  * Function prototypes.
46f2cd0f02Sgd78059  */
47f2cd0f02Sgd78059 extern int hmeattach(dev_info_t *, ddi_attach_cmd_t);
48f2cd0f02Sgd78059 extern int hmedetach(dev_info_t *, ddi_detach_cmd_t);
49f2cd0f02Sgd78059 
50f2cd0f02Sgd78059 DDI_DEFINE_STREAM_OPS(qfe_dev_ops, nulldev, nulldev, hmeattach, hmedetach,
5119397407SSherry Moore     nodev, NULL, D_MP, NULL, ddi_quiesce_not_supported);
52f2cd0f02Sgd78059 
53f2cd0f02Sgd78059 /*
54f2cd0f02Sgd78059  * Module linkage information for the kernel.
55f2cd0f02Sgd78059  */
56f2cd0f02Sgd78059 static struct modldrv modldrv = {
57f2cd0f02Sgd78059 	&mod_driverops,	/* Type of module.  This one is a driver */
58f2cd0f02Sgd78059 	"Sun QFE 10/100 Mb Ethernet",
59f2cd0f02Sgd78059 	&qfe_dev_ops,	/* driver ops */
60f2cd0f02Sgd78059 };
61f2cd0f02Sgd78059 
62f2cd0f02Sgd78059 static struct modlinkage modlinkage = {
63f2cd0f02Sgd78059 	MODREV_1, &modldrv, NULL
64f2cd0f02Sgd78059 };
65f2cd0f02Sgd78059 
66f2cd0f02Sgd78059 /* <<<<<<<<<<<<<<<<<<<<<<<<<<<  LOADABLE ENTRIES  >>>>>>>>>>>>>>>>>>>>>>> */
67f2cd0f02Sgd78059 
68f2cd0f02Sgd78059 int
_init(void)69f2cd0f02Sgd78059 _init(void)
70f2cd0f02Sgd78059 {
71f2cd0f02Sgd78059 	int	status;
72f2cd0f02Sgd78059 
73f2cd0f02Sgd78059 	mac_init_ops(&qfe_dev_ops, "qfe");
74f2cd0f02Sgd78059 	if ((status = mod_install(&modlinkage)) != 0) {
75f2cd0f02Sgd78059 		mac_fini_ops(&qfe_dev_ops);
76f2cd0f02Sgd78059 	}
77f2cd0f02Sgd78059 	return (status);
78f2cd0f02Sgd78059 }
79f2cd0f02Sgd78059 
80f2cd0f02Sgd78059 int
_fini(void)81f2cd0f02Sgd78059 _fini(void)
82f2cd0f02Sgd78059 {
83f2cd0f02Sgd78059 	int	status;
84f2cd0f02Sgd78059 
85f2cd0f02Sgd78059 	if ((status = mod_remove(&modlinkage)) == 0) {
86f2cd0f02Sgd78059 		mac_fini_ops(&qfe_dev_ops);
87f2cd0f02Sgd78059 	}
88f2cd0f02Sgd78059 	return (status);
89f2cd0f02Sgd78059 }
90f2cd0f02Sgd78059 
91f2cd0f02Sgd78059 int
_info(struct modinfo * modinfop)92f2cd0f02Sgd78059 _info(struct modinfo *modinfop)
93f2cd0f02Sgd78059 {
94f2cd0f02Sgd78059 	return (mod_info(&modlinkage, modinfop));
95f2cd0f02Sgd78059 }
96