xref: /titanic_50/usr/src/uts/sun/io/qfe.c (revision ff17c8bf86c3e567734be83f90267edee20f580f)
1  /*
2   * CDDL HEADER START
3   *
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.
7   *
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.
12   *
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]
18   *
19   * CDDL HEADER END
20   */
21  /*
22   * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23   * Use is subject to license terms.
24   */
25  
26  #pragma ident	"%Z%%M%	%I%	%E% SMI"
27  
28  /*
29   * SunOS MT QFE Device Driver (layered above FEPS/Cheerio)
30   */
31  
32  #include	<sys/types.h>
33  #include	<sys/debug.h>
34  #include	<sys/stream.h>
35  #include	<sys/cmn_err.h>
36  #include	<sys/kmem.h>
37  #include	<sys/modctl.h>
38  #include	<sys/conf.h>
39  #include	<sys/mac.h>
40  #include	<sys/mac_ether.h>
41  #include	<sys/ddi.h>
42  #include	<sys/sunddi.h>
43  
44  /*
45   * Function prototypes.
46   */
47  extern int hmeattach(dev_info_t *, ddi_attach_cmd_t);
48  extern int hmedetach(dev_info_t *, ddi_detach_cmd_t);
49  
50  DDI_DEFINE_STREAM_OPS(qfe_dev_ops, nulldev, nulldev, hmeattach, hmedetach,
51      nodev, NULL, D_MP, NULL);
52  
53  /*
54   * Module linkage information for the kernel.
55   */
56  static struct modldrv modldrv = {
57  	&mod_driverops,	/* Type of module.  This one is a driver */
58  	"Sun QFE 10/100 Mb Ethernet",
59  	&qfe_dev_ops,	/* driver ops */
60  };
61  
62  static struct modlinkage modlinkage = {
63  	MODREV_1, &modldrv, NULL
64  };
65  
66  /* <<<<<<<<<<<<<<<<<<<<<<<<<<<  LOADABLE ENTRIES  >>>>>>>>>>>>>>>>>>>>>>> */
67  
68  int
69  _init(void)
70  {
71  	int	status;
72  
73  	mac_init_ops(&qfe_dev_ops, "qfe");
74  	if ((status = mod_install(&modlinkage)) != 0) {
75  		mac_fini_ops(&qfe_dev_ops);
76  	}
77  	return (status);
78  }
79  
80  int
81  _fini(void)
82  {
83  	int	status;
84  
85  	if ((status = mod_remove(&modlinkage)) == 0) {
86  		mac_fini_ops(&qfe_dev_ops);
87  	}
88  	return (status);
89  }
90  
91  int
92  _info(struct modinfo *modinfop)
93  {
94  	return (mod_info(&modlinkage, modinfop));
95  }
96