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