Exemplo n.º 1
0
static int os_buildsgl(PCOMMAND pCmd, PSG pSg, int logical)
{
	POS_CMDEXT ext = (POS_CMDEXT)pCmd->priv;
	union ccb *ccb = ext->ccb;
	bus_dma_segment_t *sgList = (bus_dma_segment_t *)ccb->csio.data_ptr;
	int idx;

	if(logical)	{
		if (ccb->ccb_h.flags & CAM_DATA_PHYS)
			panic("physical address unsupported");

		if (ccb->ccb_h.flags & CAM_SCATTER_VALID) {
			if (ccb->ccb_h.flags & CAM_SG_LIST_PHYS)
				panic("physical address unsupported");
	
			for (idx = 0; idx < ccb->csio.sglist_cnt; idx++) {
				os_set_sgptr(&pSg[idx], (HPT_U8 *)(HPT_UPTR)sgList[idx].ds_addr);
				pSg[idx].size = sgList[idx].ds_len;
				pSg[idx].eot = (idx==ccb->csio.sglist_cnt-1)? 1 : 0;
			}
		}
		else {
			os_set_sgptr(pSg, (HPT_U8 *)ccb->csio.data_ptr);
			pSg->size = ccb->csio.dxfer_len;
			pSg->eot = 1;
		}
		return TRUE;
	}

	/* since we have provided physical sg, nobody will ask us to build physical sg */
	HPT_ASSERT(0);
	return FALSE;
}
Exemplo n.º 2
0
static int os_buildsgl(PCOMMAND pCmd, PSG pSg, int logical)
{
	POS_CMDEXT ext = (POS_CMDEXT)pCmd->priv;
	union ccb *ccb = ext->ccb;

	if (logical) {
		os_set_sgptr(pSg, (HPT_U8 *)ccb->csio.data_ptr);
		pSg->size = ccb->csio.dxfer_len;
		pSg->eot = 1;
		return TRUE;
	}

	/* since we have provided physical sg, nobody will ask us to build physical sg */
	HPT_ASSERT(0);
	return FALSE;
}