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