]>
git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/IOMapper.h
2 * Copyright (c) 1998-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 #ifndef __IOKIT_IOMAPPER_H
32 #define __IOKIT_IOMAPPER_H
34 #include <sys/cdefs.h>
37 #include <IOKit/IOTypes.h>
38 #include <mach/vm_types.h>
40 // These are C accessors to the system mapper for non-IOKit clients
41 ppnum_t
IOMapperIOVMAlloc(unsigned pages
);
42 void IOMapperIOVMFree(ppnum_t addr
, unsigned pages
);
44 ppnum_t
IOMapperInsertPage(ppnum_t addr
, unsigned offset
, ppnum_t page
);
45 void IOMapperInsertPPNPages(ppnum_t addr
, unsigned offset
,
46 ppnum_t
*pageList
, unsigned pageCount
);
47 void IOMapperInsertUPLPages(ppnum_t addr
, unsigned offset
,
48 upl_page_info_t
*pageList
, unsigned pageCount
);
53 #include <IOKit/IOService.h>
54 #include <IOKit/IOMemoryDescriptor.h>
58 class IOMapper
: public IOService
60 OSDeclareAbstractStructors(IOMapper
);
62 // Give the platform expert access to setMapperRequired();
63 friend class IOPlatformExpert
;
66 enum SystemMapperState
{
69 kHasMapper
= 2, // Any other value is pointer to a live mapper
75 IOItemCount fTableSize
;
79 virtual bool start(IOService
*provider
);
82 static void setMapperRequired(bool hasMapper
);
83 static void waitForSystemMapper();
85 virtual bool initHardware(IOService
*provider
) = 0;
87 virtual bool allocTable(IOByteCount size
);
90 // Static routines capable of allocating tables that are physically
91 // contiguous in real memory space.
92 static OSData
* NewARTTable(IOByteCount size
,
93 void ** virtAddrP
, ppnum_t
*physAddrP
);
94 static void FreeARTTable(OSData
*handle
, IOByteCount size
);
97 // To get access to the system mapper IOMapper::gSystem
98 static IOMapper
*gSystem
;
100 virtual ppnum_t
iovmAlloc(IOItemCount pages
) = 0;
101 virtual void iovmFree(ppnum_t addr
, IOItemCount pages
) = 0;
103 virtual void iovmInsert(ppnum_t addr
, IOItemCount offset
, ppnum_t page
) = 0;
104 virtual void iovmInsert(ppnum_t addr
, IOItemCount offset
,
105 ppnum_t
*pageList
, IOItemCount pageCount
);
106 virtual void iovmInsert(ppnum_t addr
, IOItemCount offset
,
107 upl_page_info_t
*pageList
, IOItemCount pageCount
);
108 static void checkForSystemMapper()
109 { if ((vm_address_t
) gSystem
& kWaitMask
) waitForSystemMapper(); };
111 // Function will panic if the given address is not found in a valid
113 virtual addr64_t
mapAddr(IOPhysicalAddress addr
) = 0;
116 OSMetaClassDeclareReservedUnused(IOMapper
, 0);
117 OSMetaClassDeclareReservedUnused(IOMapper
, 1);
118 OSMetaClassDeclareReservedUnused(IOMapper
, 2);
119 OSMetaClassDeclareReservedUnused(IOMapper
, 3);
120 OSMetaClassDeclareReservedUnused(IOMapper
, 4);
121 OSMetaClassDeclareReservedUnused(IOMapper
, 5);
122 OSMetaClassDeclareReservedUnused(IOMapper
, 6);
123 OSMetaClassDeclareReservedUnused(IOMapper
, 7);
124 OSMetaClassDeclareReservedUnused(IOMapper
, 8);
125 OSMetaClassDeclareReservedUnused(IOMapper
, 9);
126 OSMetaClassDeclareReservedUnused(IOMapper
, 10);
127 OSMetaClassDeclareReservedUnused(IOMapper
, 11);
128 OSMetaClassDeclareReservedUnused(IOMapper
, 12);
129 OSMetaClassDeclareReservedUnused(IOMapper
, 13);
130 OSMetaClassDeclareReservedUnused(IOMapper
, 14);
131 OSMetaClassDeclareReservedUnused(IOMapper
, 15);
134 #endif /* __cplusplus */
136 #endif /* !__IOKIT_IOMAPPER_H */