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 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #include <sys/conf.h>
28 #include <sys/kmem.h>
29 #include <sys/ddi_impldefs.h>
30 #include <sys/ddi.h>
31 #include <sys/sunddi.h>
32 #include <sys/ddifm.h>
33 #include <sys/fm/io/ddi.h>
34 #include <sys/fm/protocol.h>
35 #include <sys/ontrap.h>
36
37
38 /*
39 * DDI DMA Engine functions for x86.
40 * These functions are more naturally generic, but do not apply to SPARC.
41 */
42
43 int
44 ddi_dmae_alloc(dev_info_t *dip, int chnl, int (*dmae_waitfp)(), caddr_t arg)
45 {
46 return (ddi_dma_mctl(dip, dip, 0, DDI_DMA_E_ACQUIRE,
47 (off_t *)dmae_waitfp, (size_t *)arg,
48 (caddr_t *)(uintptr_t)chnl, 0));
49 }
50
51 int
52 ddi_dmae_release(dev_info_t *dip, int chnl)
53 {
54 return (ddi_dma_mctl(dip, dip, 0, DDI_DMA_E_FREE, 0, 0,
55 (caddr_t *)(uintptr_t)chnl, 0));
56 }
57
58 int
59 ddi_dmae_getlim(dev_info_t *dip, ddi_dma_lim_t *limitsp)
60 {
61 return (ddi_dma_mctl(dip, dip, 0, DDI_DMA_E_GETLIM, 0, 0,
62 (caddr_t *)limitsp, 0));
63 }
64
65 int
66 ddi_dmae_getattr(dev_info_t *dip, ddi_dma_attr_t *attrp)
67 {
68 return (ddi_dma_mctl(dip, dip, 0, DDI_DMA_E_GETATTR, 0, 0,
69 (caddr_t *)attrp, 0));
70 }
71
72 int
73 ddi_dmae_1stparty(dev_info_t *dip, int chnl)
74 {
75 return (ddi_dma_mctl(dip, dip, 0, DDI_DMA_E_1STPTY, 0, 0,
76 (caddr_t *)(uintptr_t)chnl, 0));
77 }
78
79 int
80 ddi_dmae_prog(dev_info_t *dip, struct ddi_dmae_req *dmaereqp,
81 ddi_dma_cookie_t *cookiep, int chnl)
82 {
83 return (ddi_dma_mctl(dip, dip, 0, DDI_DMA_E_PROG, (off_t *)dmaereqp,
84 (size_t *)cookiep, (caddr_t *)(uintptr_t)chnl, 0));
|
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 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26 /*
27 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 */
29
30 #include <sys/conf.h>
31 #include <sys/kmem.h>
32 #include <sys/ddi_impldefs.h>
33 #include <sys/ddi.h>
34 #include <sys/sunddi.h>
35 #include <sys/ddifm.h>
36 #include <sys/fm/io/ddi.h>
37 #include <sys/fm/protocol.h>
38 #include <sys/ontrap.h>
39
40
41 /*
42 * DDI DMA Engine functions for x86.
43 * These functions are more naturally generic, but do not apply to SPARC.
44 */
45
46 int
47 ddi_dmae_alloc(dev_info_t *dip, int chnl, int (*dmae_waitfp)(), caddr_t arg)
48 {
49 return (ddi_dma_mctl(dip, dip, 0, DDI_DMA_E_ACQUIRE,
50 (off_t *)dmae_waitfp, (size_t *)arg,
51 (caddr_t *)(uintptr_t)chnl, 0));
52 }
53
54 int
55 ddi_dmae_release(dev_info_t *dip, int chnl)
56 {
57 return (ddi_dma_mctl(dip, dip, 0, DDI_DMA_E_FREE, 0, 0,
58 (caddr_t *)(uintptr_t)chnl, 0));
59 }
60
61 int
62 ddi_dmae_getattr(dev_info_t *dip, ddi_dma_attr_t *attrp)
63 {
64 return (ddi_dma_mctl(dip, dip, 0, DDI_DMA_E_GETATTR, 0, 0,
65 (caddr_t *)attrp, 0));
66 }
67
68 int
69 ddi_dmae_1stparty(dev_info_t *dip, int chnl)
70 {
71 return (ddi_dma_mctl(dip, dip, 0, DDI_DMA_E_1STPTY, 0, 0,
72 (caddr_t *)(uintptr_t)chnl, 0));
73 }
74
75 int
76 ddi_dmae_prog(dev_info_t *dip, struct ddi_dmae_req *dmaereqp,
77 ddi_dma_cookie_t *cookiep, int chnl)
78 {
79 return (ddi_dma_mctl(dip, dip, 0, DDI_DMA_E_PROG, (off_t *)dmaereqp,
80 (size_t *)cookiep, (caddr_t *)(uintptr_t)chnl, 0));
|