4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22
23 /*
24 * Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved.
25 */
26
27 /*
28 * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
29 * Use is subject to license terms.
30 */
31
32 /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
33 /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
34 /* All Rights Reserved */
35
36 /* Copyright (c) 1988, 1989 Intel Corp. */
37 /* All Rights Reserved */
38
39 #ifndef _SYS_DMAENGINE_H
40 #define _SYS_DMAENGINE_H
41
42 #include <sys/types.h>
43 #include <sys/dditypes.h>
44
121 extern void i_dmae_get_chan_stat(dev_info_t *dip, int chnl,
122 ulong_t *addressp, int *countp);
123
124 /*
125 * the DMA Channel Block structure
126 */
127 struct dmae_chnl {
128 ksema_t dch_lock; /* semaphore for this channel */
129 ddi_dma_cookie_t *dch_cookiep; /* current dma mapping cookie */
130 ddi_dma_cookie_t *(*proc)(); /* address of application call */
131 /* routine */
132 void *procparms; /* parameter buffer for appl call */
133 };
134
135
136 /*
137 * DMA Engine DDI functions
138 */
139
140 /*
141 * Get DMA engine limits
142 *
143 * The limits of the DMA engine of the parent bus-nexus are copied into the
144 * provided structure. This should be called at driver attach time,
145 * rather than for each dma setup (breakup).
146 */
147
148 int ddi_dmae_getlim(dev_info_t *dip, ddi_dma_lim_t *limitsp);
149
150 /*
151 * Get DMA engine attributes
152 *
153 * The attributes of the DMA engine of the parent bus-nexus are copied into
154 * the provided structure. This should be called at driver attach time,
155 * rather than for each DMA bind.
156 */
157
158 int ddi_dmae_getattr(dev_info_t *dip, ddi_dma_attr_t *attrp);
159
160 /*
161 * DMA channel allocation
162 *
163 * The allocation function must be called prior to any other DMA engine
164 * function on a channel. The channel should be freed after completion of the
165 * DMA / device operation if the channel is to be shared.
166 *
167 * Specifics of arguments to ddi_dmae_alloc:
168 *
169 * dip - dev_info pointer, which identifies the base device that wishes
170 * to use the DMA channel.
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22
23 /*
24 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
25 */
26
27 /*
28 * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
29 * Use is subject to license terms.
30 */
31
32 /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
33 /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
34 /* All Rights Reserved */
35
36 /* Copyright (c) 1988, 1989 Intel Corp. */
37 /* All Rights Reserved */
38
39 #ifndef _SYS_DMAENGINE_H
40 #define _SYS_DMAENGINE_H
41
42 #include <sys/types.h>
43 #include <sys/dditypes.h>
44
121 extern void i_dmae_get_chan_stat(dev_info_t *dip, int chnl,
122 ulong_t *addressp, int *countp);
123
124 /*
125 * the DMA Channel Block structure
126 */
127 struct dmae_chnl {
128 ksema_t dch_lock; /* semaphore for this channel */
129 ddi_dma_cookie_t *dch_cookiep; /* current dma mapping cookie */
130 ddi_dma_cookie_t *(*proc)(); /* address of application call */
131 /* routine */
132 void *procparms; /* parameter buffer for appl call */
133 };
134
135
136 /*
137 * DMA Engine DDI functions
138 */
139
140 /*
141 * Get DMA engine attributes
142 *
143 * The attributes of the DMA engine of the parent bus-nexus are copied into
144 * the provided structure. This should be called at driver attach time,
145 * rather than for each DMA bind.
146 */
147
148 int ddi_dmae_getattr(dev_info_t *dip, ddi_dma_attr_t *attrp);
149
150 /*
151 * DMA channel allocation
152 *
153 * The allocation function must be called prior to any other DMA engine
154 * function on a channel. The channel should be freed after completion of the
155 * DMA / device operation if the channel is to be shared.
156 *
157 * Specifics of arguments to ddi_dmae_alloc:
158 *
159 * dip - dev_info pointer, which identifies the base device that wishes
160 * to use the DMA channel.
|