1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright (c) 1991-1994 Sun Microsystems, Inc. 24*0Sstevel@tonic-gate */ 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate #ifndef _SYS_DDIMAPREQ_H 27*0Sstevel@tonic-gate #define _SYS_DDIMAPREQ_H 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate #include <sys/mman.h> 32*0Sstevel@tonic-gate #include <sys/dditypes.h> 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate #ifdef __cplusplus 35*0Sstevel@tonic-gate extern "C" { 36*0Sstevel@tonic-gate #endif 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate #ifdef _KERNEL 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate /* 41*0Sstevel@tonic-gate * Mapping requests are for an rnumber or for a regspec. 42*0Sstevel@tonic-gate * 43*0Sstevel@tonic-gate * A regspec is a generic triple, usually representing 44*0Sstevel@tonic-gate * type, offset, length 45*0Sstevel@tonic-gate * 46*0Sstevel@tonic-gate * And is interpreted privately between the child and parent. 47*0Sstevel@tonic-gate * The triple should be sufficient for representing byte addressable devices. 48*0Sstevel@tonic-gate */ 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate typedef union { 51*0Sstevel@tonic-gate int rnumber; 52*0Sstevel@tonic-gate struct regspec *rp; 53*0Sstevel@tonic-gate } ddi_map_obj_t; 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate typedef enum { 56*0Sstevel@tonic-gate DDI_MT_RNUMBER = 0, 57*0Sstevel@tonic-gate DDI_MT_REGSPEC 58*0Sstevel@tonic-gate } ddi_map_type_t; 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate /* 61*0Sstevel@tonic-gate * Mapping operators: 62*0Sstevel@tonic-gate */ 63*0Sstevel@tonic-gate typedef enum { 64*0Sstevel@tonic-gate DDI_MO_MAP_UNLOCKED = 0, /* Create mapping, do not lock down */ 65*0Sstevel@tonic-gate DDI_MO_MAP_LOCKED, /* Create locked down mapping */ 66*0Sstevel@tonic-gate DDI_MO_MAP_HANDLE, /* Create handle, do not map */ 67*0Sstevel@tonic-gate DDI_MO_UNMAP, /* Unmap (implies unlock, if locked) */ 68*0Sstevel@tonic-gate DDI_MO_UNLOCK /* Unlock mapping, do *not* unmap */ 69*0Sstevel@tonic-gate } ddi_map_op_t; 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate /* 72*0Sstevel@tonic-gate * Mapping request structure... 73*0Sstevel@tonic-gate */ 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate typedef struct { 76*0Sstevel@tonic-gate ddi_map_op_t map_op; 77*0Sstevel@tonic-gate ddi_map_type_t map_type; 78*0Sstevel@tonic-gate ddi_map_obj_t map_obj; 79*0Sstevel@tonic-gate int map_flags; /* See below... */ 80*0Sstevel@tonic-gate int map_prot; /* Prot bits (see sys/mman.h) */ 81*0Sstevel@tonic-gate ddi_acc_hdl_t *map_handlep; 82*0Sstevel@tonic-gate int map_vers; 83*0Sstevel@tonic-gate } ddi_map_req_t; 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate /* 86*0Sstevel@tonic-gate * version number 87*0Sstevel@tonic-gate */ 88*0Sstevel@tonic-gate #define DDI_MAP_VERSION 0x0001 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate /* 91*0Sstevel@tonic-gate * Mappings subject to the following flags: 92*0Sstevel@tonic-gate */ 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gate /* 95*0Sstevel@tonic-gate * Make mapping suitable for user program use. 96*0Sstevel@tonic-gate */ 97*0Sstevel@tonic-gate #define DDI_MF_USER_MAPPING 0x1 98*0Sstevel@tonic-gate 99*0Sstevel@tonic-gate /* 100*0Sstevel@tonic-gate * Make mapping suitable for kernel mapping. 101*0Sstevel@tonic-gate */ 102*0Sstevel@tonic-gate #define DDI_MF_KERNEL_MAPPING 0x2 103*0Sstevel@tonic-gate #define DDI_MF_DEVICE_MAPPING 0x4 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate #endif /* _KERNEL */ 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate /* 108*0Sstevel@tonic-gate * Error (non-zero) return codes from DDI mapping functions... 109*0Sstevel@tonic-gate */ 110*0Sstevel@tonic-gate 111*0Sstevel@tonic-gate #define DDI_ME_GENERIC (-1) /* Generic un-enumerated error */ 112*0Sstevel@tonic-gate #define DDI_ME_UNIMPLEMENTED (-2) /* Unimplemented operator */ 113*0Sstevel@tonic-gate #define DDI_ME_NORESOURCES (-3) /* No resources, try later? */ 114*0Sstevel@tonic-gate #define DDI_ME_UNSUPPORTED (-4) /* Op is not supported in impl. */ 115*0Sstevel@tonic-gate #define DDI_ME_REGSPEC_RANGE (-5) /* Addressing range error */ 116*0Sstevel@tonic-gate #define DDI_ME_RNUMBER_RANGE (-6) /* Addressing range error */ 117*0Sstevel@tonic-gate #define DDI_ME_INVAL (-7) /* Invalid input parameter */ 118*0Sstevel@tonic-gate 119*0Sstevel@tonic-gate #ifdef __cplusplus 120*0Sstevel@tonic-gate } 121*0Sstevel@tonic-gate #endif 122*0Sstevel@tonic-gate 123*0Sstevel@tonic-gate #endif /* _SYS_DDIMAPREQ_H */ 124