/*
* 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 FCP module
*/
/* configuration routines */
static int av1394_fcp_ctl_register(av1394_inst_t *);
static int av1394_fcp_tgt_register(av1394_inst_t *);
static int av1394_fcp_ctl_alloc_cmd(av1394_inst_t *);
static void av1394_fcp_ctl_free_cmd(av1394_inst_t *);
static int av1394_fcp_tgt_alloc_cmd(av1394_inst_t *);
static void av1394_fcp_tgt_free_cmd(av1394_inst_t *);
static void av1394_fcp_cleanup(av1394_inst_t *, int);
/* FCP write and completion handling */
static void av1394_fcp_cmd_completion_cb(struct cmd1394_cmd *);
static int av1394_fcp_cmd_write_request_cb(cmd1394_cmd_t *);
static int av1394_fcp_resp_write_request_cb(cmd1394_cmd_t *);
static void av1394_fcp_common_write_request_cb(cmd1394_cmd_t *, int);
/* misc routines */
struct uio *);
/*
*
* --- configuration entry points
*
*/
int
{
int ret;
/* register FCP controller */
return (ret);
}
/* allocate FCP controller command */
return (ret);
}
/* register FCP target */
return (ret);
}
/* allocate FCP target command */
return (ret);
}
return (ret);
}
void
{
}
int
{
int ret;
/* check arguments */
(len % IEEE1394_QUADLET != 0)) {
return (EINVAL);
}
/* block write requires an mblk */
if (len > IEEE1394_QUADLET) {
return (ENOMEM);
}
return (ret);
}
}
/* either FCP command or response */
/* one command at a time */
return (EINTR);
}
}
/* prepare command */
if (len == IEEE1394_QUADLET) {
} else {
}
/* do the write and wait for completion */
/* not busy anymore */
return (ret);
}
/*
*
* --- configuration routines
*
*/
static int
{
int ret;
if (ret != DDI_SUCCESS) {
}
return (ret);
}
static int
{
int ret;
if (ret != DDI_SUCCESS) {
}
return (ret);
}
static int
{
int ret;
if (ret != DDI_SUCCESS) {
}
return (ret);
}
static void
{
int ret;
if (ret != DDI_SUCCESS) {
}
}
static int
{
int ret;
if (ret != DDI_SUCCESS) {
}
return (ret);
}
static void
{
int ret;
if (ret != DDI_SUCCESS) {
}
}
static void
{
switch (level) {
default:
/* FALLTHRU */
case 3:
/* FALLTHRU */
case 2:
/* FALLTHRU */
case 1:
}
}
/*
*
* --- FCP write and completion handling
*
*/
static int
{
int ret = 0;
/* go */
/* immediate error? */
if (ret != DDI_SUCCESS) {
return (EIO);
}
/* wait for completion */
return (EINTR);
}
}
AV1394_TNF_FCP_ERROR, "",
return (EBUSY);
} else {
return (EIO);
}
} else {
return (0);
}
}
static void
{
/* is this FCP command or response */
} else {
}
/* wake the waiter */
}
/*
* av1394_fcp_cmd_write_request_cb()
* Incoming response request from an FCP target
*/
static int
{
return (T1394_REQ_UNCLAIMED);
}
return (T1394_REQ_CLAIMED);
}
/*
* av1394_fcp_cmd_write_request_cb()
* Incoming command request from an FCP controller
*/
static int
{
return (T1394_REQ_UNCLAIMED);
}
return (T1394_REQ_CLAIMED);
}
static void
{
int err;
/* get the data */
} else {
}
/* complete request */
if (err != DDI_SUCCESS) {
}
/* allocate mblk and copy quadlet into it */
AV1394_TNF_FCP_ERROR, "");
return;
}
}
/* queue up the data */
}
/*
*
* --- misc routines
*
*/
static int
{
int copylen;
int ret = 0;
/* first copy ARQ-embedded data */
/* now copyin the rest of the data, if any */
if (copylen > 0) {
if (ret != 0) {
return (ret);
}
}
return (ret);
}