qlt_dma.h revision a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard/*
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard * Copyright 2009 QLogic Corporation. All rights reserved.
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard * Use is subject to license terms.
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _QLT_DMA_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _QLT_DMA_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stmf.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct qlt_dmem_bucket;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct qlt_dmem_bctl {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct qlt_dmem_bucket *bctl_bucket;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct qlt_dmem_bctl *bctl_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t bctl_dev_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t bctl_task_ndx;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte stmf_data_buf_t *bctl_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} qlt_dmem_bctl_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct qlt_dmem_bucket {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t dmem_buf_size;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t dmem_nbufs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t dmem_nbufs_free;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t *dmem_host_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t dmem_dev_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_dma_handle_t dmem_dma_handle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_acc_handle_t dmem_acc_handle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t dmem_lock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte qlt_dmem_bctl_t *dmem_bctl_free_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *dmem_bctls_mem;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} qlt_dmem_bucket_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefct_status_t qlt_dmem_init(qlt_state_t *qlt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid qlt_dmem_fini(qlt_state_t *qlt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestmf_data_buf_t *qlt_dmem_alloc(fct_local_port_t *port, uint32_t size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *pminsize, uint32_t flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestmf_data_buf_t *qlt_i_dmem_alloc(qlt_state_t *qlt, uint32_t size,
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard uint32_t *pminsize, uint32_t flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid qlt_dmem_free(fct_dbuf_store_t *fds, stmf_data_buf_t *dbuf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid qlt_i_dmem_free(qlt_state_t *qlt, stmf_data_buf_t *dbuf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid qlt_dmem_dma_sync(stmf_data_buf_t *dbuf, uint_t sync_type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _QLT_DMA_H */