6198 Let's EOL cachefs
[illumos-gate.git] / usr / src / uts / common / sys / ddimapreq.h
blobc77b44e822ad36732cf9595f1b75b1f34e8e159e
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
23 * Copyright (c) 1991-1994 Sun Microsystems, Inc.
26 #ifndef _SYS_DDIMAPREQ_H
27 #define _SYS_DDIMAPREQ_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include <sys/mman.h>
32 #include <sys/dditypes.h>
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 #ifdef _KERNEL
41 * Mapping requests are for an rnumber or for a regspec.
43 * A regspec is a generic triple, usually representing
44 * type, offset, length
46 * And is interpreted privately between the child and parent.
47 * The triple should be sufficient for representing byte addressable devices.
50 typedef union {
51 int rnumber;
52 struct regspec *rp;
53 } ddi_map_obj_t;
55 typedef enum {
56 DDI_MT_RNUMBER = 0,
57 DDI_MT_REGSPEC
58 } ddi_map_type_t;
61 * Mapping operators:
63 typedef enum {
64 DDI_MO_MAP_UNLOCKED = 0, /* Create mapping, do not lock down */
65 DDI_MO_MAP_LOCKED, /* Create locked down mapping */
66 DDI_MO_MAP_HANDLE, /* Create handle, do not map */
67 DDI_MO_UNMAP, /* Unmap (implies unlock, if locked) */
68 DDI_MO_UNLOCK /* Unlock mapping, do *not* unmap */
69 } ddi_map_op_t;
72 * Mapping request structure...
75 typedef struct {
76 ddi_map_op_t map_op;
77 ddi_map_type_t map_type;
78 ddi_map_obj_t map_obj;
79 int map_flags; /* See below... */
80 int map_prot; /* Prot bits (see sys/mman.h) */
81 ddi_acc_hdl_t *map_handlep;
82 int map_vers;
83 } ddi_map_req_t;
86 * version number
88 #define DDI_MAP_VERSION 0x0001
91 * Mappings subject to the following flags:
95 * Make mapping suitable for user program use.
97 #define DDI_MF_USER_MAPPING 0x1
100 * Make mapping suitable for kernel mapping.
102 #define DDI_MF_KERNEL_MAPPING 0x2
103 #define DDI_MF_DEVICE_MAPPING 0x4
105 #endif /* _KERNEL */
108 * Error (non-zero) return codes from DDI mapping functions...
111 #define DDI_ME_GENERIC (-1) /* Generic un-enumerated error */
112 #define DDI_ME_UNIMPLEMENTED (-2) /* Unimplemented operator */
113 #define DDI_ME_NORESOURCES (-3) /* No resources, try later? */
114 #define DDI_ME_UNSUPPORTED (-4) /* Op is not supported in impl. */
115 #define DDI_ME_REGSPEC_RANGE (-5) /* Addressing range error */
116 #define DDI_ME_RNUMBER_RANGE (-6) /* Addressing range error */
117 #define DDI_ME_INVAL (-7) /* Invalid input parameter */
119 #ifdef __cplusplus
121 #endif
123 #endif /* _SYS_DDIMAPREQ_H */