1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 #ifndef _QLT_DMA_H 26 #define _QLT_DMA_H 27 28 #include <stmf.h> 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 struct qlt_dmem_bucket; 35 36 typedef struct qlt_dmem_bctl { 37 struct qlt_dmem_bucket *bctl_bucket; 38 struct qlt_dmem_bctl *bctl_next; 39 uint64_t bctl_dev_addr; 40 uint8_t bctl_task_ndx; 41 stmf_data_buf_t *bctl_buf; 42 } qlt_dmem_bctl_t; 43 44 typedef struct qlt_dmem_bucket { 45 uint32_t dmem_buf_size; 46 uint32_t dmem_nbufs; 47 uint32_t dmem_nbufs_free; 48 uint8_t *dmem_host_addr; 49 uint64_t dmem_dev_addr; 50 ddi_dma_handle_t dmem_dma_handle; 51 ddi_acc_handle_t dmem_acc_handle; 52 kmutex_t dmem_lock; 53 qlt_dmem_bctl_t *dmem_bctl_free_list; 54 void *dmem_bctls_mem; 55 } qlt_dmem_bucket_t; 56 57 fct_status_t qlt_dmem_init(qlt_state_t *qlt); 58 void qlt_dmem_fini(qlt_state_t *qlt); 59 stmf_data_buf_t *qlt_dmem_alloc(fct_local_port_t *port, uint32_t size, 60 uint32_t *pminsize, uint32_t flags); 61 stmf_data_buf_t *qlt_i_dmem_alloc(qlt_state_t *qlt, uint32_t size, 62 uint32_t *pminsize, uint32_t flags); 63 void qlt_dmem_free(fct_dbuf_store_t *fds, stmf_data_buf_t *dbuf); 64 void qlt_i_dmem_free(qlt_state_t *qlt, stmf_data_buf_t *dbuf); 65 void qlt_dmem_dma_sync(stmf_data_buf_t *dbuf, uint_t sync_type); 66 67 #ifdef __cplusplus 68 } 69 #endif 70 71 #endif /* _QLT_DMA_H */ 72