1/* iig(DriverKit-286) generated from IOMemoryMap.iig */
2
3/* IOMemoryMap.iig:1-46 */
4/*
5 * Copyright (c) 2019-2019 Apple Inc. All rights reserved.
6 *
7 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
8 *
9 * This file contains Original Code and/or Modifications of Original Code
10 * as defined in and that are subject to the Apple Public Source License
11 * Version 2.0 (the 'License'). You may not use this file except in
12 * compliance with the License. The rights granted to you under the License
13 * may not be used to create, or enable the creation or redistribution of,
14 * unlawful or unlicensed copies of an Apple operating system, or to
15 * circumvent, violate, or enable the circumvention or violation of, any
16 * terms of an Apple operating system software license agreement.
17 *
18 * Please obtain a copy of the License at
19 * http://www.opensource.apple.com/apsl/ and read it before using this file.
20 *
21 * The Original Code and all software distributed under the License are
22 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
23 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
24 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
26 * Please see the License for the specific language governing rights and
27 * limitations under the License.
28 *
29 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
30 */
31
32#if !__IIG
33#if KERNEL
34#include <IOKit/IOMemoryDescriptor.h>
35#endif
36#endif
37
38#ifndef _IOKIT_UIOMEMORYMAP_H
39#define _IOKIT_UIOMEMORYMAP_H
40
41#include <DriverKit/OSObject.h> /* .iig include */
42
43struct _IOMemoryMapPrivateState {
44 uint64_t length;
45 uint64_t offset;
46 uint64_t options;
47 uint64_t address;
48};
49
50/* source class IOMemoryMap IOMemoryMap.iig:47-87 */
51
52#if __DOCUMENTATION__
53#define KERNEL IIG_KERNEL
54
55/*!
56 * @class IOMemoryMap
57 *
58 * @abstract
59 * IOMemoryMap describes a memory mapping created with IOMemoryDescriptor::CreateMapping()
60 *
61 * @discussion
62 * To allocate memory for I/O or sharing, use IOBufferMemoryDescriptor::Create()
63 * Methods in this class are used for memory that was supplied as a parameter.
64 */
65
66class KERNEL IOMemoryMap : public OSObject
67{
68public:
69
70 virtual bool
71 init() override;
72
73 virtual void
74 free() override;
75
76 /*!
77 * @brief Obtain the address of the memory mapping.
78 * @return Address.
79 */
80 uint64_t
81 GetAddress() LOCALONLY;
82
83 /*!
84 * @brief Obtain the length of the memory mapping.
85 * @return Length.
86 */
87 uint64_t
88 GetLength() LOCALONLY;
89
90 /*!
91 * @brief Obtain the offset of the memory mapping.
92 * @return Offset.
93 */
94 uint64_t
95 GetOffset() LOCALONLY;
96};
97
98#undef KERNEL
99#else /* __DOCUMENTATION__ */
100
101/* generated class IOMemoryMap IOMemoryMap.iig:47-87 */
102
103#define IOMemoryMap__CopyState_ID 0xfc92b3d7f2d48ec7ULL
104
105#define IOMemoryMap__CopyState_Args \
106 _IOMemoryMapPrivateState * state
107
108#define IOMemoryMap_Methods \
109\
110public:\
111\
112 virtual kern_return_t\
113 Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
114\
115 static kern_return_t\
116 _Dispatch(IOMemoryMap * self, const IORPC rpc);\
117\
118 kern_return_t\
119 _CopyState(\
120 _IOMemoryMapPrivateState * state,\
121 OSDispatchMethod supermethod = NULL);\
122\
123 uint64_t\
124 GetAddress(\
125);\
126\
127 uint64_t\
128 GetLength(\
129);\
130\
131 uint64_t\
132 GetOffset(\
133);\
134\
135\
136protected:\
137 /* _Impl methods */\
138\
139\
140public:\
141 /* _Invoke methods */\
142\
143 typedef kern_return_t (*_CopyState_Handler)(OSMetaClassBase * target, IOMemoryMap__CopyState_Args);\
144 static kern_return_t\
145 _CopyState_Invoke(const IORPC rpc,\
146 OSMetaClassBase * target,\
147 _CopyState_Handler func);\
148\
149
150
151#define IOMemoryMap_KernelMethods \
152\
153protected:\
154 /* _Impl methods */\
155\
156 kern_return_t\
157 _CopyState_Impl(IOMemoryMap__CopyState_Args);\
158\
159
160
161#define IOMemoryMap_VirtualMethods \
162\
163public:\
164\
165 virtual bool\
166 init(\
167) APPLE_KEXT_OVERRIDE;\
168\
169 virtual void\
170 free(\
171) APPLE_KEXT_OVERRIDE;\
172\
173
174
175#if !KERNEL
176
177extern OSMetaClass * gIOMemoryMapMetaClass;
178extern const OSClassLoadInformation IOMemoryMap_Class;
179
180class IOMemoryMapMetaClass : public OSMetaClass
181{
182public:
183 virtual kern_return_t
184 New(OSObject * instance) override;
185 virtual kern_return_t
186 Dispatch(const IORPC rpc) override;
187};
188
189#endif /* !KERNEL */
190
191#if !KERNEL
192
193class IOMemoryMapInterface : public OSInterface
194{
195public:
196};
197
198struct IOMemoryMap_IVars;
199struct IOMemoryMap_LocalIVars;
200
201class IOMemoryMap : public OSObject, public IOMemoryMapInterface
202{
203#if !KERNEL
204 friend class IOMemoryMapMetaClass;
205#endif /* !KERNEL */
206
207#if !KERNEL
208public:
209#ifdef IOMemoryMap_DECLARE_IVARS
210IOMemoryMap_DECLARE_IVARS
211#else /* IOMemoryMap_DECLARE_IVARS */
212 union
213 {
214 IOMemoryMap_IVars * ivars;
215 IOMemoryMap_LocalIVars * lvars;
216 };
217#endif /* IOMemoryMap_DECLARE_IVARS */
218#endif /* !KERNEL */
219
220#if !KERNEL
221 static OSMetaClass *
222 sGetMetaClass() { return gIOMemoryMapMetaClass; };
223#endif /* KERNEL */
224
225 using super = OSObject;
226
227#if !KERNEL
228 IOMemoryMap_Methods
229 IOMemoryMap_VirtualMethods
230#endif /* !KERNEL */
231
232};
233#endif /* !KERNEL */
234
235
236#endif /* !__DOCUMENTATION__ */
237
238
239/* IOMemoryMap.iig:96- */
240
241#endif /* ! _IOKIT_UIOMEMORYMAP_H */
242