]>
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_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 #ifndef __IOKIT_IOMAPPER_H
27 #define __IOKIT_IOMAPPER_H
29 #include <sys/cdefs.h>
32 #include <IOKit/IOTypes.h>
33 #include <mach/vm_types.h>
35 // These are C accessors to the system mapper for non-IOKit clients
36 ppnum_t
IOMapperIOVMAlloc(unsigned pages
);
37 void IOMapperIOVMFree(ppnum_t addr
, unsigned pages
);
39 ppnum_t
IOMapperInsertPage(ppnum_t addr
, unsigned offset
, ppnum_t page
);
40 void IOMapperInsertPPNPages(ppnum_t addr
, unsigned offset
,
41 ppnum_t
*pageList
, unsigned pageCount
);
42 void IOMapperInsertUPLPages(ppnum_t addr
, unsigned offset
,
43 upl_page_info_t
*pageList
, unsigned pageCount
);
48 #include <IOKit/IOService.h>
49 #include <IOKit/IOMemoryDescriptor.h>
53 class IOMapper
: public IOService
55 OSDeclareAbstractStructors(IOMapper
);
57 // Give the platform expert access to setMapperRequired();
58 friend class IOPlatformExpert
;
61 enum SystemMapperState
{
64 kHasMapper
= 2, // Any other value is pointer to a live mapper
70 IOItemCount fTableSize
;
74 virtual bool start(IOService
*provider
);
77 static void setMapperRequired(bool hasMapper
);
78 static void waitForSystemMapper();
80 virtual bool initHardware(IOService
*provider
) = 0;
82 virtual bool allocTable(IOByteCount size
);
85 // Static routines capable of allocating tables that are physically
86 // contiguous in real memory space.
87 static OSData
* NewARTTable(IOByteCount size
,
88 void ** virtAddrP
, ppnum_t
*physAddrP
);
89 static void FreeARTTable(OSData
*handle
, IOByteCount size
);
92 // To get access to the system mapper IOMapper::gSystem
93 static IOMapper
*gSystem
;
95 virtual ppnum_t
iovmAlloc(IOItemCount pages
) = 0;
96 virtual void iovmFree(ppnum_t addr
, IOItemCount pages
) = 0;
98 virtual void iovmInsert(ppnum_t addr
, IOItemCount offset
, ppnum_t page
) = 0;
99 virtual void iovmInsert(ppnum_t addr
, IOItemCount offset
,
100 ppnum_t
*pageList
, IOItemCount pageCount
);
101 virtual void iovmInsert(ppnum_t addr
, IOItemCount offset
,
102 upl_page_info_t
*pageList
, IOItemCount pageCount
);
103 static void checkForSystemMapper()
104 { if ((vm_address_t
) gSystem
& kWaitMask
) waitForSystemMapper(); };
106 // Function will panic if the given address is not found in a valid
108 virtual addr64_t
mapAddr(IOPhysicalAddress addr
) = 0;
111 OSMetaClassDeclareReservedUnused(IOMapper
, 0);
112 OSMetaClassDeclareReservedUnused(IOMapper
, 1);
113 OSMetaClassDeclareReservedUnused(IOMapper
, 2);
114 OSMetaClassDeclareReservedUnused(IOMapper
, 3);
115 OSMetaClassDeclareReservedUnused(IOMapper
, 4);
116 OSMetaClassDeclareReservedUnused(IOMapper
, 5);
117 OSMetaClassDeclareReservedUnused(IOMapper
, 6);
118 OSMetaClassDeclareReservedUnused(IOMapper
, 7);
119 OSMetaClassDeclareReservedUnused(IOMapper
, 8);
120 OSMetaClassDeclareReservedUnused(IOMapper
, 9);
121 OSMetaClassDeclareReservedUnused(IOMapper
, 10);
122 OSMetaClassDeclareReservedUnused(IOMapper
, 11);
123 OSMetaClassDeclareReservedUnused(IOMapper
, 12);
124 OSMetaClassDeclareReservedUnused(IOMapper
, 13);
125 OSMetaClassDeclareReservedUnused(IOMapper
, 14);
126 OSMetaClassDeclareReservedUnused(IOMapper
, 15);
129 #endif /* __cplusplus */
131 #endif /* !__IOKIT_IOMAPPER_H */