diff options
author | gd78059 <none@none> | 2007-08-24 17:45:12 -0700 |
---|---|---|
committer | gd78059 <none@none> | 2007-08-24 17:45:12 -0700 |
commit | f2cd0f027a2c872a297e602d646cc147ce718534 (patch) | |
tree | 7852ea1ee840807b7c22aa669591c94df50b9b79 | |
parent | 2b53ee1c340ee52002820de130898b975457d65c (diff) | |
download | illumos-gate-f2cd0f027a2c872a297e602d646cc147ce718534.tar.gz |
PSARC 2007/404 QFE/HME merge
6590092 qfe should use common hme GLDv3 code
-rw-r--r-- | usr/src/pkgdefs/Makefile | 1 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWqfed/Makefile | 36 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWqfed/depend | 52 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWqfed/pkginfo.tmpl | 59 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWqfed/postinstall | 130 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWqfed/postremove | 38 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWqfed/prototype_com | 46 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWqfed/prototype_sparc | 54 | ||||
-rw-r--r-- | usr/src/uts/sparc/Makefile.sparc.shared | 2 | ||||
-rw-r--r-- | usr/src/uts/sparc/qfe/Makefile | 88 | ||||
-rw-r--r-- | usr/src/uts/sun/Makefile.files | 2 | ||||
-rw-r--r-- | usr/src/uts/sun/io/hme.c | 17 | ||||
-rw-r--r-- | usr/src/uts/sun/io/qfe.c | 95 |
13 files changed, 612 insertions, 8 deletions
diff --git a/usr/src/pkgdefs/Makefile b/usr/src/pkgdefs/Makefile index f3d97d538d..5b96fbc18e 100644 --- a/usr/src/pkgdefs/Makefile +++ b/usr/src/pkgdefs/Makefile @@ -86,6 +86,7 @@ sparc_SUBDIRS= \ SUNWiopc.v \ SUNWpdu \ SUNWpstl.u \ + SUNWqfed \ SUNWsckmr \ SUNWsckmu.u \ SUNWsckm.u \ diff --git a/usr/src/pkgdefs/SUNWqfed/Makefile b/usr/src/pkgdefs/SUNWqfed/Makefile new file mode 100644 index 0000000000..104bff450d --- /dev/null +++ b/usr/src/pkgdefs/SUNWqfed/Makefile @@ -0,0 +1,36 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +#ident "%Z%%M% %I% %E% SMI" +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +include ../Makefile.com + +.KEEP_STATE: + +all: $(FILES) depend +install: all pkg + +include ../Makefile.targ + diff --git a/usr/src/pkgdefs/SUNWqfed/depend b/usr/src/pkgdefs/SUNWqfed/depend new file mode 100644 index 0000000000..caac0ad63a --- /dev/null +++ b/usr/src/pkgdefs/SUNWqfed/depend @@ -0,0 +1,52 @@ +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# ident "%Z%%M% %I% %E% SMI" +# +# This package information file defines software dependencies associated +# with the pkg. You can define three types of pkg dependencies with this file: +# P indicates a prerequisite for installation +# I indicates an incompatible package +# R indicates a reverse dependency +# <pkg.abbr> see pkginfo(4), PKG parameter +# <name> see pkginfo(4), NAME parameter +# <version> see pkginfo(4), VERSION parameter +# <arch> see pkginfo(4), ARCH parameter +# <type> <pkg.abbr> <name> +# (<arch>)<version> +# (<arch>)<version> +# ... +# <type> <pkg.abbr> <name> +# ... +# + +P SUNWcar Core Architecture, (Root) +P SUNWcakr Core Solaris Kernel Architecture (Root) +P SUNWkvm Core Architecture, (Kvm) +P SUNWcsr Core Solaris, (Root) +P SUNWckr Core Solaris Kernel (Root) +P SUNWcnetr Core Solaris Network Infrastructure (Root) +P SUNWcsu Core Solaris, (Usr) +P SUNWcsd Core Solaris Devices +P SUNWcsl Core Solaris Libraries +P SUNWhmd SunSwift Adapter Drivers diff --git a/usr/src/pkgdefs/SUNWqfed/pkginfo.tmpl b/usr/src/pkgdefs/SUNWqfed/pkginfo.tmpl new file mode 100644 index 0000000000..31c364d716 --- /dev/null +++ b/usr/src/pkgdefs/SUNWqfed/pkginfo.tmpl @@ -0,0 +1,59 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +# +# This required package information file describes characteristics of the +# package, such as package abbreviation, full package name, package version, +# and package architecture. +# +PKG="SUNWqfed" +NAME="Sun Quad FastEthernet Adapter Driver" +ARCH="sparc" +VERSION="ONVERS,REV=0.0.0" +SUNW_PRODNAME="SunOS" +SUNW_PRODVERS="RELEASE/VERSION" +SUNW_PKGTYPE="root" +MAXINST="1000" +CATEGORY="system" +DESC="Sun Quad FastEtherent PCI/SBus Adapter" +VENDOR="Sun Microsystems, Inc." +HOTLINE="Please contact your local service provider" +EMAIL="" +CLASSES="none" +BASEDIR=/ +SUNW_PKGVERS="1.0" +SUNW_PKG_ALLZONES="true" +SUNW_PKG_HOLLOW="true" +SUNW_PKG_THISZONE="false" +#VSTOCK="<reserved by Release Engineering for package part #>" +#ISTATES="<developer defined>" +#RSTATES='<developer defined>' +#ULIMIT="<developer defined>" +#ORDER="<developer defined>" +#PSTAMP="<developer defined>" +#INTONLY="<developer defined>" diff --git a/usr/src/pkgdefs/SUNWqfed/postinstall b/usr/src/pkgdefs/SUNWqfed/postinstall new file mode 100644 index 0000000000..fe34b84b19 --- /dev/null +++ b/usr/src/pkgdefs/SUNWqfed/postinstall @@ -0,0 +1,130 @@ +#!/sbin/sh +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +# Function: check_add_drv() +# +# This function will check if the module has an entry in etc/name_to_major +# If not simply calls add_drv with the arguments given. If there is +# such an entry in name_to_major file, it adds entries in driver_aliases +# driver_classes and minor_perm if necessary. +# The syntax of this function is the same as add_drv. + +check_add_drv() +{ + if [ "$BASEDIR" = "" ] + then + BASEDIR=/ + fi + alias="" + class="" + ADD_ALIAS=0 + ADD_CLASS=0 + ADD_MINOR=0 + OPTIND=1 + IS_NET_DRIVER=0 + + cmd="add_drv" + + NO_CMD= + while getopts i:b:m:c:N opt + do + case $opt in + N ) NO_CMD=1;; + i ) ADD_ALIAS=1 + alias=$OPTARG + cmd=$cmd" -i '$alias'" + ;; + m ) ADD_MINOR=1 + minor=$OPTARG + cmd=$cmd" -m '$minor'" + ;; + c) ADD_CLASS=1 + class=$OPTARG + cmd=$cmd" -c $class" + ;; + b) BASEDIR=$OPTARG + cmd=$cmd" -b $BASEDIR" + ;; + \?) echo "check_add_drv can not handle this option" + return + ;; + esac + done + shift `/usr/bin/expr $OPTIND - 1` + + drvname=$1 + + cmd=$cmd" "$drvname + + drvname=`echo $drvname | /usr/bin/sed 's;.*/;;g'` + + /usr/bin/grep "^$drvname[ ]" $BASEDIR/etc/name_to_major > /dev/null 2>&1 + + if [ "$NO_CMD" = "" -a $? -ne 0 ] + then + eval $cmd + else + # entry already in name_to_major, add alias, class, minorperm + # if necessary + if [ $ADD_ALIAS = 1 ] + then + for i in $alias + do + /usr/bin/egrep "^$drvname[ ]+$i" $BASEDIR/etc/driver_aliases>/dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "$drvname $i" >> $BASEDIR/etc/driver_aliases + fi + done + fi + + if [ $ADD_CLASS = 1 ] + then + /usr/bin/egrep "^$drvname[ ]+$class( | |$)" $BASEDIR/etc/driver_classes > /dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "$drvname\t$class" >> $BASEDIR/etc/driver_classes + fi + fi + + if [ $ADD_MINOR = 1 ] + then + /usr/bin/grep "^$drvname:" $BASEDIR/etc/minor_perm > /dev/null 2>&1 + if [ $? -ne 0 ] + then + minorentry="$drvname:$minor" + echo $minorentry >> $BASEDIR/etc/minor_perm + fi + fi + + fi + + +} + +check_add_drv -i '"SUNW,qfe"' -b "$BASEDIR" qfe diff --git a/usr/src/pkgdefs/SUNWqfed/postremove b/usr/src/pkgdefs/SUNWqfed/postremove new file mode 100644 index 0000000000..9759696b5b --- /dev/null +++ b/usr/src/pkgdefs/SUNWqfed/postremove @@ -0,0 +1,38 @@ +#!/sbin/sh +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +BD=${BASEDIR:-/} +if grep -w qfe $BD/etc/name_to_major > /dev/null 2>&1 +then + rem_drv -b ${BD} qfe + if [ $? -ne 0 ] + then + exit 1 + fi +fi +exit 0 diff --git a/usr/src/pkgdefs/SUNWqfed/prototype_com b/usr/src/pkgdefs/SUNWqfed/prototype_com new file mode 100644 index 0000000000..81f72de116 --- /dev/null +++ b/usr/src/pkgdefs/SUNWqfed/prototype_com @@ -0,0 +1,46 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +# This required package information file contains a list of package contents. +# The 'pkgmk' command uses this file to identify the contents of a package +# and their location on the development machine when building the package. +# Can be created via a text editor or through use of the 'pkgproto' command. + +#!search <pathname pathname ...> # where to find pkg objects +#!include <filename> # include another 'prototype' file +#!default <mode> <owner> <group> # default used if not specified on entry +#!<param>=<value> # puts parameter in pkg environment + +# packaging files +i pkginfo +i copyright +i depend +i postinstall +i postremove +# +# source locations relative to the prototype file +# +# SUNWqfed +# diff --git a/usr/src/pkgdefs/SUNWqfed/prototype_sparc b/usr/src/pkgdefs/SUNWqfed/prototype_sparc new file mode 100644 index 0000000000..3634259638 --- /dev/null +++ b/usr/src/pkgdefs/SUNWqfed/prototype_sparc @@ -0,0 +1,54 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +# This required package information file contains a list of package contents. +# The 'pkgmk' command uses this file to identify the contents of a package +# and their location on the development machine when building the package. +# Can be created via a text editor or through use of the 'pkgproto' command. + +#!search <pathname pathname ...> # where to find pkg objects +#!include <filename> # include another 'prototype' file +#!default <mode> <owner> <group> # default used if not specified on entry +#!<param>=<value> # puts parameter in pkg environment + +# +# Include ISA independent files (prototype_com) +# +!include prototype_com +# +# +# +# List files which are SPARC specific here +# +# source locations relative to the prototype file +# +# +# SUNWqfed +# +d none kernel 755 root sys +d none kernel/drv 755 root sys +d none kernel/drv/sparcv9 755 root sys +f none kernel/drv/sparcv9/qfe 755 root sys diff --git a/usr/src/uts/sparc/Makefile.sparc.shared b/usr/src/uts/sparc/Makefile.sparc.shared index 9b63ec1a5b..88a00c2c36 100644 --- a/usr/src/uts/sparc/Makefile.sparc.shared +++ b/usr/src/uts/sparc/Makefile.sparc.shared @@ -268,7 +268,7 @@ $(CLOSED_BUILD)CLOSED_DRV_KMODS += ixgb # Machine Specific Driver Modules (/kernel/drv): # DRV_KMODS += audio1575 audio810 audiohd audiocs audiots -DRV_KMODS += bge bpp eri esp fas hme +DRV_KMODS += bge bpp eri esp fas hme qfe DRV_KMODS += openeepr options sd ses st DRV_KMODS += ssd DRV_KMODS += ecpp diff --git a/usr/src/uts/sparc/qfe/Makefile b/usr/src/uts/sparc/qfe/Makefile new file mode 100644 index 0000000000..99f2d1bc60 --- /dev/null +++ b/usr/src/uts/sparc/qfe/Makefile @@ -0,0 +1,88 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# uts/sparc/qfe/Makefile +# +# ident "%Z%%M% %I% %E% SMI" +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# This makefile drives the production of the qfe driver +# kernel module. +# + +# +# Path to the base of the uts directory tree (usually /usr/src/uts). +# +UTSBASE = ../.. + +# +# Define the module and object file sets. +# +MODULE = qfe +OBJECTS = $(QFE_OBJS:%=$(OBJS_DIR)/%) +LINTS = $(QFE_OBJS:%.o=$(LINTS_DIR)/%.ln) +ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE) + +# +# Include common rules. +# +include $(UTSBASE)/sparc/Makefile.sparc + +# +# Define targets +# +ALL_TARGET = $(BINARY) +LINT_TARGET = $(MODULE).lint +INSTALL_TARGET = $(BINARY) $(ROOTMODULE) + +# +# Overrides. +# +CFLAGS += $(CCVERBOSE) +LDFLAGS += -dy -Nmisc/mac -Ndrv/hme + +# +# Default build targets. +# +.KEEP_STATE: + +def: $(DEF_DEPS) + +all: $(ALL_DEPS) + +clean: $(CLEAN_DEPS) + +clobber: $(CLOBBER_DEPS) + +lint: $(LINT_DEPS) + +modlintlib: $(MODLINTLIB_DEPS) + +clean.lint: $(CLEAN_LINT_DEPS) + +install: $(INSTALL_DEPS) + +# +# Include common targets. +# +include $(UTSBASE)/sparc/Makefile.targ diff --git a/usr/src/uts/sun/Makefile.files b/usr/src/uts/sun/Makefile.files index 5db6a35462..b8da4818f3 100644 --- a/usr/src/uts/sun/Makefile.files +++ b/usr/src/uts/sun/Makefile.files @@ -70,6 +70,8 @@ HME_OBJS += hme.o ERI_OBJS += eri.o +QFE_OBJS += qfe.o + SBUSMEM_OBJS += sbusmem.o SD_OBJS += sd.o sd_xbuf.o diff --git a/usr/src/uts/sun/io/hme.c b/usr/src/uts/sun/io/hme.c index af3164f612..b5512c0f98 100644 --- a/usr/src/uts/sun/io/hme.c +++ b/usr/src/uts/sun/io/hme.c @@ -400,8 +400,9 @@ static char *autoneg_speed_bad_msg = /* * Function prototypes. */ -static int hmeattach(dev_info_t *, ddi_attach_cmd_t); -static int hmedetach(dev_info_t *, ddi_detach_cmd_t); +/* these two are global so that qfe can use them */ +int hmeattach(dev_info_t *, ddi_attach_cmd_t); +int hmedetach(dev_info_t *, ddi_detach_cmd_t); static boolean_t hmeinit_xfer_params(struct hme *); static uint_t hmestop(struct hme *); static void hmestatinit(struct hme *); @@ -2720,7 +2721,7 @@ hmeget_hm_rev_property(struct hme *hmep) * record. System will initialize the interface when it is ready * to accept packets. */ -static int +int hmeattach(dev_info_t *dip, ddi_attach_cmd_t cmd) { struct hme *hmep; @@ -3104,7 +3105,7 @@ error_state: return (DDI_FAILURE); } -static int +int hmedetach(dev_info_t *dip, ddi_detach_cmd_t cmd) { struct hme *hmep; @@ -3495,12 +3496,14 @@ hmestatinit(struct hme *hmep) { struct kstat *ksp; struct hmekstat *hkp; + const char *driver; int instance; char buf[16]; instance = hmep->instance; + driver = ddi_driver_name(hmep->dip); - if ((ksp = kstat_create("hme", instance, + if ((ksp = kstat_create(driver, instance, "driver_info", "net", KSTAT_TYPE_NAMED, sizeof (struct hmekstat) / sizeof (kstat_named_t), 0)) == NULL) { HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, INIT_MSG, @@ -3508,8 +3511,8 @@ hmestatinit(struct hme *hmep) return; } - (void) sprintf(buf, "hmec%d", instance); - hmep->hme_intrstats = kstat_create("hme", instance, buf, "controller", + (void) snprintf(buf, sizeof (buf), "%sc%d", driver, instance); + hmep->hme_intrstats = kstat_create(driver, instance, buf, "controller", KSTAT_TYPE_INTR, 1, KSTAT_FLAG_PERSISTENT); if (hmep->hme_intrstats) kstat_install(hmep->hme_intrstats); diff --git a/usr/src/uts/sun/io/qfe.c b/usr/src/uts/sun/io/qfe.c new file mode 100644 index 0000000000..f213c60fbb --- /dev/null +++ b/usr/src/uts/sun/io/qfe.c @@ -0,0 +1,95 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * SunOS MT QFE Device Driver (layered above FEPS/Cheerio) + */ + +#include <sys/types.h> +#include <sys/debug.h> +#include <sys/stream.h> +#include <sys/cmn_err.h> +#include <sys/kmem.h> +#include <sys/modctl.h> +#include <sys/conf.h> +#include <sys/mac.h> +#include <sys/mac_ether.h> +#include <sys/ddi.h> +#include <sys/sunddi.h> + +/* + * Function prototypes. + */ +extern int hmeattach(dev_info_t *, ddi_attach_cmd_t); +extern int hmedetach(dev_info_t *, ddi_detach_cmd_t); + +DDI_DEFINE_STREAM_OPS(qfe_dev_ops, nulldev, nulldev, hmeattach, hmedetach, + nodev, NULL, D_MP, NULL); + +/* + * Module linkage information for the kernel. + */ +static struct modldrv modldrv = { + &mod_driverops, /* Type of module. This one is a driver */ + "Sun QFE 10/100 Mb Ethernet", + &qfe_dev_ops, /* driver ops */ +}; + +static struct modlinkage modlinkage = { + MODREV_1, &modldrv, NULL +}; + +/* <<<<<<<<<<<<<<<<<<<<<<<<<<< LOADABLE ENTRIES >>>>>>>>>>>>>>>>>>>>>>> */ + +int +_init(void) +{ + int status; + + mac_init_ops(&qfe_dev_ops, "qfe"); + if ((status = mod_install(&modlinkage)) != 0) { + mac_fini_ops(&qfe_dev_ops); + } + return (status); +} + +int +_fini(void) +{ + int status; + + if ((status = mod_remove(&modlinkage)) == 0) { + mac_fini_ops(&qfe_dev_ops); + } + return (status); +} + +int +_info(struct modinfo *modinfop) +{ + return (mod_info(&modlinkage, modinfop)); +} |