/*
* 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
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/sysmacros.h>
#include <sys/tnf_probe.h>
#include <sys/ddi_impldefs.h>
#include <sys/ndi_impldefs.h>
#include <sys/autoconf.h>
#include <sys/instance.h>
/* decide what to do when a double dev_lclose is detected */
#ifdef DEBUG
#else /* DEBUG */
#endif /* DEBUG */
/*
* Configuration-related entry points for nexus and leaf drivers
*/
int
{
int (*fn)(dev_info_t *);
return (-1);
}
int
{
int (*fn)(dev_info_t *);
/*
* probe(9E) in 2.0 implies that you can get
* away with not writing one of these .. so we
* pretend we're 'nulldev' if we don't find one (sigh).
*/
else
} else
switch (rv) {
case DDI_PROBE_DONTCARE:
case DDI_PROBE_SUCCESS:
probe_failed = 0;
break;
default:
probe_failed = 1;
break;
}
return (rv);
}
/*
* devi_attach()
* attach a device instance to the system if the driver supplies an
* attach(9E) entrypoint.
*/
int
{
int error;
return (error);
}
goto done;
}
error = DDI_FAILURE;
goto done;
}
/*
* Call the driver's attach(9e) entrypoint
*/
done:
return (error);
}
/*
* devi_detach()
* detach a device instance from the system if the driver supplies a
* detach(9E) entrypoint.
*/
int
{
int error;
cmd == DDI_DETACH);
}
return (DDI_FAILURE);
return (error);
}
/*
* Call the driver's detach routine
*/
return (error);
}
static void
int ret)
{
int error;
}
static void
int ret)
{
int error;
}
/*
* its inclusion here is somewhat moot.
*/
int
{
return (DDI_FAILURE);
}
int
{
int (*fn)(dev_info_t *);
return (DDI_FAILURE);
}
/*
* Leaf driver entry points. The following [cb]dev_* functions are *not* part
* of the DDI, please use functions defined in <sys/sunldi.h> and driver_lyr.c.
*/
int
{
}
int
{
}
/*
* New Leaf driver open entry point. We make a vnode and go through specfs
* in order to obtain open close exclusions guarantees. Note that we drop
* OTYP_LYR if it was specified - we are going through specfs and it provides
* last close semantics (FKLYR is provided to open(9E)). Also, since
* spec_open will drive attach via e_ddi_hold_devi_by_dev for a makespecvp
* vnode with no SDIP_SET on the common snode, the dev_lopen caller no longer
* needs to call ddi_hold_installed_driver.
*/
int
{
int error;
if (error == 0) {
/* Pick up the (possibly) new dev_t value. */
/*
* Place extra hold on the common vnode, which contains the
* open count, so that it is not destroyed by the VN_RELE of
* the shadow makespecvp vnode below.
*/
}
/* release the shadow makespecvp vnode. */
return (error);
}
/*
* Leaf driver close entry point. We make a vnode and go through specfs in
* order to obtain open close exclusions guarantees. Note that we drop
* OTYP_LYR if it was specified - we are going through specfs and it provides
* last close semantics (FLKYR is provided to close(9E)).
*/
int
{
int error;
char *funcname;
/*
* Release the extra dev_lopen hold on the common vnode. We inline a
* VN_RELE(cvp) call so that we can detect more dev_lclose calls than
* dev_lopen calls without panic. See vn_rele. If our inline of
* vn_rele called VOP_INACTIVE(cvp, CRED(), ...) we would panic on the
* "release the makespecvp vnode" VN_RELE(vp) that follows - so
* instead we diagnose this situation. Note that the driver has
* still seen a double close(9E), but that would have occurred with
* the old dev_close implementation too.
*/
default:
break;
case 0:
/*FALLTHROUGH*/
case 1:
/*
* The following message indicates a serious problem in the
* identified driver, the driver should be fixed. If obtaining
* a panic dump is needed to diagnose the driver problem then
* panic when this occurs.
*/
break;
}
/* release the makespecvp vnode. */
return (error);
}
/*
* Returns -1 or the instance number of the given dev_t as
* interpreted by the device driver. The code may load the driver
* but it does not attach any instances.
*
* Instance is supposed to be a int but drivers have assumed that
* the pointer was a pointer to "void *" instead of a pointer to
* "int *" so we now explicitly pass a pointer to "void *" and then
* cast the result to an int when returning the value.
*/
int
{
void *vinstance;
int error;
/* verify that the driver is loaded */
return (-1);
/* verify that it supports the getinfo(9E) entry point */
return (-1);
}
/* ask the driver to extract the instance number from the devt */
/* release the driver */
if (error != DDI_SUCCESS)
return (-1);
}
static void
{
/* Kernel probe */
}
int
{
/*
* Before we hit the io:::start probe, we need to fill in the b_dip
* field of the buf structure. This should be -- for the most part --
* incredibly cheap. If you're in this code looking to bum cycles,
* there is almost certainly bigger game further down the I/O path...
*/
/*
* Call the TNF probe here instead of the inline code
* to force our compiler to use the tail call optimization.
*/
}
int
{
}
/*
* Return number of DEV_BSIZE byte blocks.
*/
int
{
return (-1);
/* Get blksize, default to DEV_BSIZE */
else
}
/*
* Same for 64-bit Nblocks property
*/
{
return (-1);
/* Get blksize, default to DEV_BSIZE */
else
}
int
{
}
int
{
}
int
{
}
int
int *rvalp)
{
}
int
{
}
int
{
}
int
{
}
int
{
}
/*
* A 'size' property can be provided by a VCHR device.
*
* Since it's defined as zero for STREAMS devices, so we avoid the
* overhead of looking it up. Note also that we don't force an
* unused driver into memory simply to ask about it's size. We also
* don't bother to ask it its size unless it's already been attached
* (the attach routine is the earliest place the property will be created)
*
* XXX In an ideal world, we'd call this at VOP_GETATTR() time.
*/
int
{
return (0);
DDI_PROP_NOTPROM | DDI_PROP_DONTPASS, 0));
}
return (0);
}
/*
* same for 64-bit Size property
*/
{
return (0);
DDI_PROP_NOTPROM | DDI_PROP_DONTPASS, 0));
}
return (0);
}
/*
* XXX This routine is poorly named, because block devices can and do
* have properties (see bdev_size() above).
*
* XXX fix the comment in devops.h that claims that cb_prop_op
* is character-only.
*/
int
{
return (DDI_PROP_NOT_FOUND);
}