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 (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24 /*
25 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
26 */
27
28 #ifndef _SYS_DDIDMAREQ_H
29 #define _SYS_DDIDMAREQ_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /*
36 * Memory Objects
37 *
38 * Definitions of structures that can describe
39 * an object that can be mapped for DMA.
40 */
41
42 /*
43 * Structure describing a virtual address
44 */
45 struct v_address {
46 caddr_t v_addr; /* base virtual address */
492 int (*dmar_fp)();
493
494 caddr_t dmar_arg; /* Callback function argument */
495
496 /*
497 * Description of the object to be mapped for DMA.
498 * Must be last in this structure in case that the
499 * union ddi_dma_obj_t changes in the future.
500 */
501 ddi_dma_obj_t dmar_object;
502
503 } ddi_dma_req_t;
504
505 /*
506 * Defines for the DMA mapping allocation functions
507 *
508 * If a DMA callback funtion is set to anything other than the following
509 * defines then it is assumed that one wishes a callback and is providing
510 * a function address.
511 */
512 #ifdef __STDC__
513 #define DDI_DMA_DONTWAIT ((int (*)(caddr_t))0)
514 #define DDI_DMA_SLEEP ((int (*)(caddr_t))1)
515 #else
516 #define DDI_DMA_DONTWAIT ((int (*)())0)
517 #define DDI_DMA_SLEEP ((int (*)())1)
518 #endif
519
520 /*
521 * Return values from callback functions.
522 */
523 #define DDI_DMA_CALLBACK_RUNOUT 0
524 #define DDI_DMA_CALLBACK_DONE 1
525
526 /*
527 * Flag definitions for the allocation functions.
528 */
529 #define DDI_DMA_WRITE 0x0001 /* Direction memory --> IO */
530 #define DDI_DMA_READ 0x0002 /* Direction IO --> memory */
531 #define DDI_DMA_RDWR (DDI_DMA_READ | DDI_DMA_WRITE)
532
533 /*
534 * If possible, establish a MMU redzone after the mapping (to protect
535 * against cheap DMA hardware that might get out of control).
536 */
537 #define DDI_DMA_REDZONE 0x0004
538
|
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 2014 Garrett D'Amore <garrett@damore.org>
23 *
24 * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
25 */
26
27 #ifndef _SYS_DDIDMAREQ_H
28 #define _SYS_DDIDMAREQ_H
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /*
35 * Memory Objects
36 *
37 * Definitions of structures that can describe
38 * an object that can be mapped for DMA.
39 */
40
41 /*
42 * Structure describing a virtual address
43 */
44 struct v_address {
45 caddr_t v_addr; /* base virtual address */
491 int (*dmar_fp)();
492
493 caddr_t dmar_arg; /* Callback function argument */
494
495 /*
496 * Description of the object to be mapped for DMA.
497 * Must be last in this structure in case that the
498 * union ddi_dma_obj_t changes in the future.
499 */
500 ddi_dma_obj_t dmar_object;
501
502 } ddi_dma_req_t;
503
504 /*
505 * Defines for the DMA mapping allocation functions
506 *
507 * If a DMA callback funtion is set to anything other than the following
508 * defines then it is assumed that one wishes a callback and is providing
509 * a function address.
510 */
511 #define DDI_DMA_DONTWAIT ((int (*)(caddr_t))0)
512 #define DDI_DMA_SLEEP ((int (*)(caddr_t))1)
513
514 /*
515 * Return values from callback functions.
516 */
517 #define DDI_DMA_CALLBACK_RUNOUT 0
518 #define DDI_DMA_CALLBACK_DONE 1
519
520 /*
521 * Flag definitions for the allocation functions.
522 */
523 #define DDI_DMA_WRITE 0x0001 /* Direction memory --> IO */
524 #define DDI_DMA_READ 0x0002 /* Direction IO --> memory */
525 #define DDI_DMA_RDWR (DDI_DMA_READ | DDI_DMA_WRITE)
526
527 /*
528 * If possible, establish a MMU redzone after the mapping (to protect
529 * against cheap DMA hardware that might get out of control).
530 */
531 #define DDI_DMA_REDZONE 0x0004
532
|