/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "ghd.h"
void
{
"unbind handle failed");
GDBG_DMA(("ghd_dma_attr_free: ddi_dma_free 0x%p\n",
(void *)gcmdp));
gcmdp->cmd_ccount = 0;
gcmdp->cmd_totxfer = 0;
}
}
int
int dma_flags,
int (*callback)(),
{
int status;
GDBG_DMA(("ghd_dma_attr_get: start: gcmdp 0x%p sg_attrp 0x%p\n",
/*
* First time, need to establish the handle.
*/
if (status != DDI_SUCCESS) {
return (FALSE);
}
GDBG_DMA(("ghd_dma_attr_get: setup: gcmdp 0x%p status %d h 0x%p "
gcmdp->cmd_ccount));
switch (status) {
case DDI_DMA_MAPPED:
/* enable first (and only) call to ddi_dma_getwin */
break;
case DDI_DMA_PARTIAL_MAP:
/* enable first call to ddi_dma_getwin */
DDI_SUCCESS) {
return (FALSE);
}
break;
case DDI_DMA_NORESOURCES:
return (FALSE);
case DDI_DMA_TOOBIG:
return (FALSE);
case DDI_DMA_NOMAPPING:
case DDI_DMA_INUSE:
default:
return (FALSE);
}
/* initialize the loop controls for ghd_dmaget_next_attr() */
gcmdp->cmd_windex = 0;
gcmdp->cmd_cindex = 0;
gcmdp->cmd_totxfer = 0;
return (TRUE);
}
{
int num_segs = 0;
int single_seg;
GDBG_DMA(("ghd_dma_attr_get: start: gcmdp 0x%p h 0x%p c 0x%x\n",
/*
* if can't do this transfer in a single segment,
*/
single_seg = FALSE;
} else {
single_seg = TRUE;
}
for (;;) {
/*
* call the controller specific S/G function
*/
/* take care of the loop-bookkeeping */
num_segs++;
gcmdp->cmd_cindex++;
/*
* if this was the last cookie in the current window
* set the loop controls start the next window and
* exit so the HBA can do this partial transfer
*/
gcmdp->cmd_windex++;
gcmdp->cmd_cindex = 0;
break;
}
if (toxfer >= max_transfer_cnt)
break;
break;
}
}
int
long count,
int sg_size,
{
int status;
*xfer = 0;
/*
* reached the end of buffer. This should not happen.
*/
return (FALSE);
} else if (gcmdp->cmd_cindex == 0) {
/*
* start the next window, and get its first cookie
*/
if (status != DDI_SUCCESS)
return (FALSE);
} else {
/*
* get the next cookie in the current window
*/
}
/*
* cookie obtained above
*/
return (TRUE);
}