av1394.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* av1394 driver
*/
/* configuration routines */
static void av1394_cleanup(av1394_inst_t *, int);
static void av1394_t1394_detach(av1394_inst_t *);
static int av1394_add_events(av1394_inst_t *);
static void av1394_remove_events(av1394_inst_t *);
/* CPR */
static int av1394_cpr_suspend(av1394_inst_t *);
static int av1394_cpr_resume(av1394_inst_t *);
/* callbacks */
void *);
void *);
void *);
extern struct mod_ops mod_driverops;
struct cb_ops av1394_cb_ops = {
av1394_open, /* open */
av1394_close, /* close */
nulldev, /* strategy */
nulldev, /* print */
nulldev, /* dump */
av1394_read, /* read */
av1394_write, /* write */
av1394_ioctl, /* ioctl */
av1394_devmap, /* devmap */
nulldev, /* mmap */
nulldev, /* segmap */
av1394_poll, /* poll */
ddi_prop_op, /* cb_prop_op */
NULL, /* streamtab */
};
static struct dev_ops av1394_ops = {
DEVO_REV, /* devo_rev */
0, /* refcnt */
av1394_getinfo, /* getinfo */
nulldev, /* identify */
nulldev, /* probe */
av1394_attach, /* attach */
av1394_detach, /* detach */
nodev, /* reset */
&av1394_cb_ops, /* driver operations */
NULL, /* bus operations */
NULL /* power */
};
static struct modldrv av1394_modldrv = {
"IEEE 1394 AV driver %I%",
};
static struct modlinkage av1394_modlinkage = {
NULL,
};
static void *av1394_statep;
#ifndef NPROBE
extern int tnf_mod_load(void);
#endif
#define AV1394_DEV2STATE(dev) \
#define AV1394_TNF_ENTER(func) \
#define AV1394_TNF_EXIT(func) \
/*
*
*
*/
int
_init(void)
{
int error;
#ifndef NPROBE
(void) tnf_mod_load();
#endif
if (error != 0) {
#ifndef NPROBE
(void) tnf_mod_unload(&av1394_modlinkage);
#endif
return (error);
}
#ifndef NPROBE
(void) tnf_mod_unload(&av1394_modlinkage);
#endif
}
return (error);
}
int
_fini(void)
{
int error;
#ifndef NPROBE
(void) tnf_mod_unload(&av1394_modlinkage);
#endif
}
return (error);
}
int
{
}
/*
* attach
*/
static int
{
switch (cmd) {
case DDI_ATTACH:
break;
case DDI_RESUME:
return (DDI_FAILURE);
}
return (av1394_cpr_resume(avp));
default:
return (DDI_FAILURE);
}
AV1394_TNF_INST_ERROR, "");
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
#ifndef __lock_lint
#endif
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
#ifndef __lock_lint
#endif
return (DDI_SUCCESS);
}
static int
{
AV1394_TNF_INST_ERROR, "");
return (DDI_FAILURE);
}
switch (cmd) {
case DDI_DETACH:
return (DDI_SUCCESS);
case DDI_SUSPEND:
return (av1394_cpr_suspend(avp));
default:
return (DDI_FAILURE);
}
}
/*ARGSUSED*/
static int
void **result)
{
int rval = DDI_FAILURE;
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
rval = DDI_SUCCESS;
} else {
}
break;
case DDI_INFO_DEVT2INSTANCE:
rval = DDI_SUCCESS;
break;
}
return (rval);
}
/*ARGSUSED*/
static int
{
if (AV1394_DEV_IS_ISOCH(*dev)) {
ret = 0;
} else if (AV1394_DEV_IS_ASYNC(*dev)) {
}
}
return (ret);
}
/*ARGSUSED*/
static int
{
if (AV1394_DEV_IS_ISOCH(dev)) {
} else if (AV1394_DEV_IS_ASYNC(dev)) {
}
}
return (ret);
}
/*ARGSUSED*/
static int
{
if (AV1394_DEV_IS_ISOCH(dev)) {
} else if (AV1394_DEV_IS_ASYNC(dev)) {
}
}
return (ret);
}
/*ARGSUSED*/
static int
{
if (AV1394_DEV_IS_ISOCH(dev)) {
} else if (AV1394_DEV_IS_ASYNC(dev)) {
}
}
return (ret);
}
/*ARGSUSED*/
static int
{
if (AV1394_DEV_IS_ISOCH(dev)) {
} else if (AV1394_DEV_IS_ASYNC(dev)) {
}
}
return (ret);
}
/*ARGSUSED*/
static int
{
}
return (ret);
}
static int
{
}
return (ret);
}
/*
*
* --- configuration routines
*
* av1394_cleanup()
* Cleanup after attach
*/
static void
{
switch (level) {
default:
/* FALLTHRU */
case 4:
/* FALLTHRU */
case 3:
/* FALLTHRU */
case 2:
/* FALLTHRU */
case 1:
}
}
static int
{
int ret;
&avp->av_t1394_hdl);
if (ret != DDI_SUCCESS) {
}
return (ret);
}
static void
{
}
static int
{
&br_evc) != DDI_SUCCESS) {
AV1394_TNF_INST_ERROR, "");
return (DDI_FAILURE);
}
AV1394_TNF_INST_ERROR, "");
return (DDI_FAILURE);
}
&rem_evc) != DDI_SUCCESS) {
AV1394_TNF_INST_ERROR, "");
return (DDI_FAILURE);
}
AV1394_TNF_INST_ERROR, "");
return (DDI_FAILURE);
}
&ins_evc) != DDI_SUCCESS) {
AV1394_TNF_INST_ERROR, "");
return (DDI_FAILURE);
}
AV1394_TNF_INST_ERROR, "");
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static void
{
&evc) == DDI_SUCCESS) {
}
&evc) == DDI_SUCCESS) {
}
&evc) == DDI_SUCCESS) {
}
}
/*
*
* --- CPR
*
*/
static int
{
int ret;
if (ret == DDI_SUCCESS) {
}
return (ret);
}
/*
* CPR resume should always succeed
*/
static int
{
(void) av1394_async_cpr_resume(avp);
return (DDI_SUCCESS);
}
/*
*
* --- callbacks
*
*/
/*ARGSUSED*/
static void
{
return;
}
}
/*ARGSUSED*/
static void
{
return;
}
}
/*ARGSUSED*/
static void
{
return;
}
}