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, 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 * Copyright (c) 1991-1994 Sun Microsystems, Inc. 24 */ 25 26 #ifndef _SYS_DDIMAPREQ_H 27 #define _SYS_DDIMAPREQ_H 28 29 #include <sys/mman.h> 30 #include <sys/dditypes.h> 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #ifdef _KERNEL 37 38 /* 39 * Mapping requests are for an rnumber or for a regspec. 40 * 41 * A regspec is a generic triple, usually representing 42 * type, offset, length 43 * 44 * And is interpreted privately between the child and parent. 45 * The triple should be sufficient for representing byte addressable devices. 46 */ 47 48 typedef union { 49 int rnumber; 50 struct regspec *rp; 51 } ddi_map_obj_t; 52 53 typedef enum { 54 DDI_MT_RNUMBER = 0, 55 DDI_MT_REGSPEC 56 } ddi_map_type_t; 57 58 /* 59 * Mapping operators: 60 */ 61 typedef enum { 62 DDI_MO_MAP_UNLOCKED = 0, /* Create mapping, do not lock down */ 63 DDI_MO_MAP_LOCKED, /* Create locked down mapping */ 64 DDI_MO_MAP_HANDLE, /* Create handle, do not map */ 65 DDI_MO_UNMAP, /* Unmap (implies unlock, if locked) */ 66 DDI_MO_UNLOCK /* Unlock mapping, do *not* unmap */ 67 } ddi_map_op_t; 68 69 /* 70 * Mapping request structure... 71 */ 72 73 typedef struct { 74 ddi_map_op_t map_op; 75 ddi_map_type_t map_type; 76 ddi_map_obj_t map_obj; 77 int map_flags; /* See below... */ 78 int map_prot; /* Prot bits (see sys/mman.h) */ 79 ddi_acc_hdl_t *map_handlep; 80 int map_vers; 81 } ddi_map_req_t; 82 83 /* 84 * version number 85 */ 86 #define DDI_MAP_VERSION 0x0001 87 88 /* 89 * Mappings subject to the following flags: 90 */ 91 92 /* 93 * Make mapping suitable for user program use. 94 */ 95 #define DDI_MF_USER_MAPPING 0x1 96 97 /* 98 * Make mapping suitable for kernel mapping. 99 */ 100 #define DDI_MF_KERNEL_MAPPING 0x2 101 #define DDI_MF_DEVICE_MAPPING 0x4 102 103 #endif /* _KERNEL */ 104 105 /* 106 * Error (non-zero) return codes from DDI mapping functions... 107 */ 108 109 #define DDI_ME_GENERIC (-1) /* Generic un-enumerated error */ 110 #define DDI_ME_UNIMPLEMENTED (-2) /* Unimplemented operator */ 111 #define DDI_ME_NORESOURCES (-3) /* No resources, try later? */ 112 #define DDI_ME_UNSUPPORTED (-4) /* Op is not supported in impl. */ 113 #define DDI_ME_REGSPEC_RANGE (-5) /* Addressing range error */ 114 #define DDI_ME_RNUMBER_RANGE (-6) /* Addressing range error */ 115 #define DDI_ME_INVAL (-7) /* Invalid input parameter */ 116 117 #ifdef __cplusplus 118 } 119 #endif 120 121 #endif /* _SYS_DDIMAPREQ_H */ 122