/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* 1394 mass storage SBP-2 bus routines
*/
static ddi_iblock_cookie_t scsa1394_bus_get_iblock_cookie(void *);
static uint_t scsa1394_bus_get_node_id(void *);
static int scsa1394_bus_alloc_cmd(void *, void **, int);
static void scsa1394_bus_free_cmd(void *, void *);
int *);
int *);
static int scsa1394_bus_alloc_buf(void *, sbp2_bus_buf_t *);
static int scsa1394_bus_alloc_buf_phys(void *, sbp2_bus_buf_t *);
static void scsa1394_bus_free_buf_phys(void *, sbp2_bus_buf_t *);
static int scsa1394_bus_alloc_buf_normal(void *, sbp2_bus_buf_t *,
static void scsa1394_bus_free_buf_normal(void *, sbp2_bus_buf_t *);
static void scsa1394_bus_free_buf(void *, sbp2_bus_buf_t *);
int);
static void scsa1394_bus_buf_rw_done(void *, sbp2_bus_buf_t *, void *, int);
/* callbacks */
static void scsa1394_bus_recv_read_request(cmd1394_cmd_t *);
static void scsa1394_bus_recv_write_request(cmd1394_cmd_t *);
SBP2_BUS_REV, /* rev */
0xFFFFF0000000LL, /* csr_base */
IEEE1394_CONFIG_ROM_ADDR, /* cfgrom_addr */
scsa1394_bus_get_iblock_cookie, /* get_iblock_cookie */
scsa1394_bus_get_node_id, /* get_node_id */
scsa1394_bus_alloc_buf, /* alloc_buf */
scsa1394_bus_free_buf, /* free_buf */
scsa1394_bus_sync_buf, /* sync_buf */
scsa1394_bus_buf_rw_done, /* buf_rd_done */
scsa1394_bus_buf_rw_done, /* buf_wr_done */
scsa1394_bus_alloc_cmd, /* alloc_cmd */
scsa1394_bus_free_cmd, /* free_cmd */
scsa1394_bus_rq, /* rq */
scsa1394_bus_rb, /* rb */
scsa1394_bus_wq, /* wq */
scsa1394_bus_wb /* wb */
};
/*
* fault injector
*
*/
int scsa1394_bus_fi_on = 0;
/* fault probabilities per operation, in tenths of percent, i.e. 10 is 1% */
((p) > 0) && ((gethrtime() % (p)) == 0))
/*
* translate command result to SBP2 error code
*/
static int
{
int code;
switch (result) {
case CMD1394_EDEVICE_BUSY:
code = SBP2_EBUSY;
break;
case CMD1394_EADDRESS_ERROR:
code = SBP2_EADDR;
break;
case CMD1394_ETIMEOUT:
break;
case CMD1394_EDEVICE_REMOVED:
code = SBP2_ENODEV;
break;
default:
break;
}
return (code);
}
static ddi_iblock_cookie_t
{
}
static uint_t
{
}
/*ARGSUSED*/
static int
{
return (SBP2_ENOMEM);
}
return (SBP2_ENOMEM);
}
return (SBP2_SUCCESS);
}
static void
{
}
/*ARGSUSED*/
static int
{
return (SBP2_EIO);
}
}
return (SBP2_SUCCESS);
}
/*ARGSUSED*/
static int
int *berr)
{
/* caller wants us to allocate memory */
return (SBP2_ENOMEM);
}
}
return (SBP2_SUCCESS);
}
/*ARGSUSED*/
static int
{
}
return (SBP2_SUCCESS);
}
/*ARGSUSED*/
static int
int *berr)
{
}
return (SBP2_SUCCESS);
}
/*ARGSUSED*/
static int
{
return (SBP2_ENOMEM);
}
} else {
}
}
static void
{
} else {
}
}
static int
{
int result;
/* allocate bus private structure */
/* allocate DMA resources */
return (SBP2_ENOMEM);
}
return (SBP2_ENOMEM);
}
return (SBP2_ENOMEM);
}
/* allocate 1394 resources */
}
}
return (SBP2_ENOMEM);
}
return (SBP2_SUCCESS);
}
static void
{
}
static int
{
int result;
/* allocate bus private structure */
/* allocate 1394 resources */
}
}
return (SBP2_ENOMEM);
}
return (SBP2_SUCCESS);
}
static void
{
}
/*ARGSUSED*/
static int
{
} else {
return (SBP2_SUCCESS);
}
}
/*ARGSUSED*/
static void
{
/* complete request */
switch (error) {
case SBP2_BUS_BUF_SUCCESS:
break;
case SBP2_BUS_BUF_ELENGTH:
break;
case SBP2_BUS_BUF_EBUSY:
break;
default:
}
}
/*
*
* --- callbacks
*
*/
static void
{
/* XXX sanity checks: addr, etc */
return;
}
} else {
return;
}
}
}
static void
{
/* XXX sanity checks: addr, etc */
return;
}
} else {
return;
}
}
}