driver.c revision 184cd04c26b064536977dfbb913a1240eaf6f708
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * CDDL HEADER START
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * The contents of this file are subject to the terms of the
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * Common Development and Distribution License (the "License").
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * You may not use this file except in compliance with the License.
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * See the License for the specific language governing permissions
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * and limitations under the License.
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * When distributing Covered Code, include this CDDL HEADER in each
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * If applicable, add the following below this CDDL HEADER, with the
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * fields enclosed by brackets "[]" replaced with your own identifying
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * information: Portions Copyright [yyyy] [name of copyright owner]
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * CDDL HEADER END
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * Use is subject to license terms.
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt#pragma ident "%Z%%M% %I% %E% SMI"
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt/* Don't #include <sys/ddi.h> - it #undef's getmajor() */
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Huntstatic void i_attach_ctlop(dev_info_t *, ddi_attach_cmd_t, ddi_pre_post_t, int);
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Huntstatic void i_detach_ctlop(dev_info_t *, ddi_detach_cmd_t, ddi_pre_post_t, int);
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt/* decide what to do when a double dev_lclose is detected */
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt#else /* DEBUG */
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt#endif /* DEBUG */
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * Configuration-related entry points for nexus and leaf drivers
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt return (-1);
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * probe(9E) in 2.0 implies that you can get
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * away with not writing one of these .. so we
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * pretend we're 'nulldev' if we don't find one (sigh).
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * devi_attach()
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * attach a device instance to the system if the driver supplies an
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * attach(9E) entrypoint.
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Huntdevi_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt if ((error = mdi_pre_attach(devi, cmd)) != DDI_SUCCESS) {
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt if ((cmd == DDI_RESUME || cmd == DDI_PM_RESUME) &&
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * Call the driver's attach(9e) entrypoint
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * devi_detach()
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * detach a device instance from the system if the driver supplies a
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * detach(9E) entrypoint.
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Huntdevi_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt ASSERT(cmd == DDI_SUSPEND || cmd == DDI_PM_SUSPEND ||
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt if ((cmd == DDI_SUSPEND || cmd == DDI_PM_SUSPEND) &&
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt if ((error = mdi_pre_detach(devi, cmd)) != DDI_SUCCESS) {
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt * Call the driver's detach routine
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunti_attach_ctlop(dev_info_t *devi, ddi_attach_cmd_t cmd, ddi_pre_post_t w,
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunt (void) ddi_ctlops(devi, devi, DDI_CTLOPS_ATTACH, &as, &error);
62d63e5f02a5e7fcda59cf361149e3d7c78477beEvan Hunti_detach_ctlop(dev_info_t *devi, ddi_detach_cmd_t cmd, ddi_pre_post_t w,
int error;
return (DDI_FAILURE);
* of the DDI, please use functions defined in <sys/sunldi.h> and driver_lyr.c.
int error;
if (error == 0) {
return (error);
int error;
char *funcname;
return (error);
void *vinstance;
int error;
int *rvalp)
* XXX fix the comment in devops.h that claims that cb_prop_op
return (DDI_PROP_NOT_FOUND);