vldc_impl.h revision 592b39e7880f85dc37f53ec4651955413b7c1d23
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * CDDL HEADER START
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * The contents of this file are subject to the terms of the
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * Common Development and Distribution License (the "License").
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * You may not use this file except in compliance with the License.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * See the License for the specific language governing permissions
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * and limitations under the License.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * When distributing Covered Code, include this CDDL HEADER in each
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * If applicable, add the following below this CDDL HEADER, with the
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * fields enclosed by brackets "[]" replaced with your own identifying
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * information: Portions Copyright [yyyy] [name of copyright owner]
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * CDDL HEADER END
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * Use is subject to license terms.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#pragma ident "%Z%%M% %I% %E% SMI"
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppoextern "C" {
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo/* default values */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo/* VLDC limits */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#define VLDC_MAX_COOKIE 0x40000 /* max. size of xfer to/from HV */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo/* get port number from minor number */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo ((vldcp)->minor_tbl[(minor) & VLDC_MINOR_MASK].portno)
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo/* get minor table entry from minor number */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo/* get instance number from minor number */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo/* indicates an invalid port number */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * Minor node number to port number mapping table.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * The lock field in the vldc_minor structure is used to serialize operations
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * on the port associated with the minor node. It also protects the minor node
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * in_use field which is used to track the number of active users of the minor
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * node. Driver ops will either hold the lock over the whole operation or
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * will increment (and then decrement) the in use count if they need to
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * release and re-acquire the lock, e.g. when copying data in from or out to
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * userland. When the MDEG framework calls into the driver via the callback to
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * remove a port, the driver must wait until the in use count for the minor
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * node associated with the port drops to zero, before it can remove the
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppotypedef struct vldc_minor {
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppotypedef struct vldc_port {
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * vldc driver's soft state structure
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppotypedef struct vldc {
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo mdeg_node_spec_t *inst_spec; /* vldc instance specifier */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo /* table for assigned minors */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo /* number of minors already assigned */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#endif /* _VLDC_IMPL_H */