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.
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.
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]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
35 #include <sys/types.h>
38 #define XSVCIOC ('Q'<< 8)
39 #define XSVC_ALLOC_MEM (XSVCIOC | 130)
40 #define XSVC_FREE_MEM (XSVCIOC | 131)
41 #define XSVC_FLUSH_MEM (XSVCIOC | 132)
43 /* arg * struct for ioctls */
44 typedef struct _xsvc_mem_req
{
45 int xsvc_mem_reqid
; /* request ID */
46 uint64_t xsvc_mem_addr_lo
; /* low DMA address range */
47 uint64_t xsvc_mem_addr_hi
; /* high DMA address range */
48 uint64_t xsvc_mem_align
; /* DMA address alignment */
49 int xsvc_mem_sgllen
; /* s/g length */
50 size_t xsvc_mem_size
; /* length of mem in bytes */
51 void *xsvc_sg_list
; /* returned scatter gather list */
54 /* xsvc_sg_list format */
55 typedef struct _xsvc_mloc
{
61 /* *** Driver Private Below *** */
63 /* arg * struct for ioctls from 32-bit app in 64-bit kernel */
65 typedef struct _xsvc_mem_req_32
{
66 int xsvc_mem_reqid
; /* request ID */
67 uint64_t xsvc_mem_addr_lo
; /* low DMA address range */
68 uint64_t xsvc_mem_addr_hi
; /* high DMA address range */
69 uint64_t xsvc_mem_align
; /* DMA address alignment */
70 int xsvc_mem_sgllen
; /* s/g length */
71 uint32_t xsvc_mem_size
; /* length of mem in bytes */
72 uint32_t xsvc_sg_list
; /* returned scatter gather list */
76 /* xsvc_sg_list format */
78 typedef struct _xsvc_mloc_32
{
85 typedef struct xsvc_mnode_s
{
88 struct xsvc_mem_s
*mn_home
;
91 /* track memory allocs */
92 typedef struct xsvc_mem_s
{
93 xsvc_mnode_t xm_mnode
;
96 size_t xm_real_length
;
97 ddi_dma_handle_t xm_dma_handle
;
98 ddi_acc_handle_t xm_mem_handle
;
99 ddi_dma_attr_t xm_dma_attr
;
100 ddi_device_acc_attr_t xm_device_attr
;
101 uint_t xm_cookie_count
;
102 ddi_dma_cookie_t xm_cookie
;
105 /* list of memory allocs */
106 typedef struct xsvc_mlist_s
{
112 typedef struct xsvc_state_s
{
117 * track total memory allocated, mutex only covers
118 * xs_currently_alloced
121 uint64_t xs_currently_alloced
;
123 kmutex_t xs_cookie_mutex
;
125 xsvc_mlist_t xs_mlist
;
134 #endif /* _SYS_XSVC_H */