/*
* 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.
*/
/*
* av1394 CMP (Connection Management Procedures)
*/
/* configuration routines */
/* ioctl routines */
static int av1394_ioctl_plug_init_local(av1394_inst_t *,
static int av1394_ioctl_plug_init_remote(av1394_inst_t *,
/* local PCR routines */
static void av1394_pcr_fini(av1394_inst_t *, int);
static int av1394_pcr_make_ph(int, int, int);
static int av1394_pcr_ph2idx(int);
static uint64_t av1394_pcr_idx2addr(int);
static int av1394_pcr_idx2num(int);
static boolean_t av1394_pcr_idx_is_mpr(int);
static boolean_t av1394_pcr_ph_is_mpr(int);
static boolean_t av1394_pcr_ph_is_remote(int);
/* callbacks */
static void av1394_pcr_recv_read_request(cmd1394_cmd_t *);
static void av1394_pcr_recv_lock_request(cmd1394_cmd_t *);
/* remote PCR routines */
int
{
int ret;
if (ret == DDI_SUCCESS) {
}
return (ret);
}
void
{
}
void
{
int i;
/* reset PCR values */
if ((i == AV1394_OMPR_IDX) || (i == AV1394_IMPR_IDX)) {
continue;
}
if (i < AV1394_IMPR_IDX) {
} else {
}
}
}
}
/*
* on close, free iPCRs and oPCRs not finalized by application
*/
void
{
int i;
if ((i == AV1394_OMPR_IDX) || (i == AV1394_IMPR_IDX)) {
continue;
}
av1394_pcr_fini(avp, i);
}
}
}
/*
*
* --- ioctls
*
* IEC61883_PLUG_INIT
*/
int
{
int ret = 0;
return (EFAULT);
}
/* check arguments */
return (EINVAL);
}
} else {
}
if (ret == 0) {
}
}
return (ret);
}
/*
* IEC61883_PLUG_FINI
*/
/*ARGSUSED*/
int
{
int ret;
int ph;
return (0);
}
ret = 0;
} else {
}
return (ret);
}
/*
* IEC61883_PLUG_REG_READ
*/
int
{
int ret = 0;
int ph;
return (EFAULT);
}
if (av1394_pcr_ph_is_remote(ph)) {
} else {
switch (av1394_pcr_ph2idx(ph)) {
case AV1394_OMPR_IDX:
break;
case AV1394_IMPR_IDX:
break;
default:
} else {
}
}
}
if (ret == 0) {
}
}
return (ret);
}
/*
* IEC61883_PLUG_REG_CAS
*/
int
{
int ret = 0;
int ph;
return (EFAULT);
}
if (av1394_pcr_ph_is_remote(ph)) {
} else {
switch (av1394_pcr_ph2idx(ph)) {
case AV1394_OMPR_IDX:
break;
case AV1394_IMPR_IDX:
break;
default:
/* compare_swap */
}
} else {
}
}
}
if (ret == 0) {
}
}
return (ret);
}
/*
*
* --- configuration routines
*
*/
static void
{
int i;
av1394_pcr_fini(avp, i);
}
}
}
/*
*
* --- ioctl routines
*
* IEC61883_PLUG_INIT for local plugs
*/
static int
{
int err;
/* MPR's are a special case */
return (0);
}
/* PCR */
} else {
}
/* find unused PCR */
continue;
}
if (err == DDI_SUCCESS) {
break;
}
}
} else {
/* create PCR if not already */
}
}
return (EBUSY);
}
return (0);
}
/*
* IEC61883_PLUG_INIT for remote plugs
*/
static int
{
int ph;
int ret;
return (EINVAL);
}
/* check PCR existance by attempting to read it */
}
return (ret);
}
/*
*
* --- plug routines
*
* initialize a PCR
*/
static int
{
int ret;
if (ret != DDI_SUCCESS) {
}
return (ret);
}
/*
* finalize a PCR
*/
static void
{
}
/*
* allocate CSR address for a PCR
*/
static int
{
int ret;
int result;
if (ret != DDI_SUCCESS) {
} else {
}
return (ret);
}
/*
* free CSR address occupied by a PCR
*/
static void
{
int ret;
if (ret != DDI_SUCCESS) {
}
}
/*
* make plug handle. range checking should be performed by caller
*/
static int
{
int ph;
switch (type) {
case IEC61883_PLUG_IN:
break;
case IEC61883_PLUG_OUT:
break;
case IEC61883_PLUG_MASTER_IN:
break;
case IEC61883_PLUG_MASTER_OUT:
break;
default:
ASSERT(0);
}
if (loc == IEC61883_LOC_REMOTE) {
ph |= AV1394_PCR_REMOTE;
}
return (ph);
}
/*
* convert plug handle to PCR index
*/
static int
{
return (ph & ~AV1394_PCR_REMOTE);
}
/*
* convert plug handle to PCR pointer
*/
static av1394_pcr_t *
{
} else {
return (NULL);
}
}
/*
* convert PCR index to CSR address
*/
static uint64_t
{
}
/*
* convert PCR index to number
*/
static int
{
}
/*
* returns B_TRUE if a master plug
*/
static boolean_t
{
return (idx % 32 == 0);
}
static boolean_t
{
}
/*
* returns B_TRUE if a remote plug
*/
static boolean_t
{
return ((ph & AV1394_PCR_REMOTE) != 0);
}
/*
*
* --- callbacks
*
*/
static void
{
int err;
} else {
/* read */
}
if (err != DDI_SUCCESS) {
}
}
static void
{
int err;
} else {
/* compare_swap */
}
}
if (err != DDI_SUCCESS) {
}
}
/*
*
* --- remote PCR routines
*
* read specified PCR on the remote node
*/
static int
{
int ret = 0;
int err;
if (ret != DDI_SUCCESS) {
return (ENOMEM);
}
} else {
}
return (ret);
}
/*
* compare_swap specified PCR on the remote node
*/
static int
{
int ret = 0;
int err;
if (ret != DDI_SUCCESS) {
return (ENOMEM);
}
} else {
}
return (ret);
}