]>
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 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 #ifndef __IOKIT_IOMAPPER_H
24 #define __IOKIT_IOMAPPER_H
26 #include <sys/cdefs.h>
29 #include <IOKit/IOTypes.h>
30 #include <mach/vm_types.h>
32 // These are C accessors to the system mapper for non-IOKit clients
33 ppnum_t
IOMapperIOVMAlloc(unsigned pages
);
34 void IOMapperIOVMFree(ppnum_t addr
, unsigned pages
);
36 ppnum_t
IOMapperInsertPage(ppnum_t addr
, unsigned offset
, ppnum_t page
);
37 void IOMapperInsertPPNPages(ppnum_t addr
, unsigned offset
,
38 ppnum_t
*pageList
, unsigned pageCount
);
39 void IOMapperInsertUPLPages(ppnum_t addr
, unsigned offset
,
40 upl_page_info_t
*pageList
, unsigned pageCount
);
45 #include <IOKit/IOService.h>
46 #include <IOKit/IOMemoryDescriptor.h>
50 class IOMapper
: public IOService
52 OSDeclareAbstractStructors(IOMapper
);
54 // Give the platform expert access to setMapperRequired();
55 friend class IOPlatformExpert
;
58 enum SystemMapperState
{
61 kHasMapper
= 2, // Any other value is pointer to a live mapper
67 IOItemCount fTableSize
;
71 virtual bool start(IOService
*provider
);
74 static void setMapperRequired(bool hasMapper
);
75 static void waitForSystemMapper();
77 virtual bool initHardware(IOService
*provider
) = 0;
79 virtual bool allocTable(IOByteCount size
);
82 // Static routines capable of allocating tables that are physically
83 // contiguous in real memory space.
84 static OSData
* NewARTTable(IOByteCount size
,
85 void ** virtAddrP
, ppnum_t
*physAddrP
);
86 static void FreeARTTable(OSData
*handle
, IOByteCount size
);
89 // To get access to the system mapper IOMapper::gSystem
90 static IOMapper
*gSystem
;
92 virtual ppnum_t
iovmAlloc(IOItemCount pages
) = 0;
93 virtual void iovmFree(ppnum_t addr
, IOItemCount pages
) = 0;
95 virtual void iovmInsert(ppnum_t addr
, IOItemCount offset
, ppnum_t page
) = 0;
96 virtual void iovmInsert(ppnum_t addr
, IOItemCount offset
,
97 ppnum_t
*pageList
, IOItemCount pageCount
);
98 virtual void iovmInsert(ppnum_t addr
, IOItemCount offset
,
99 upl_page_info_t
*pageList
, IOItemCount pageCount
);
100 static void checkForSystemMapper()
101 { if ((vm_address_t
) gSystem
& kWaitMask
) waitForSystemMapper(); };
103 // Function will panic if the given address is not found in a valid
105 virtual addr64_t
mapAddr(IOPhysicalAddress addr
) = 0;
108 OSMetaClassDeclareReservedUnused(IOMapper
, 0);
109 OSMetaClassDeclareReservedUnused(IOMapper
, 1);
110 OSMetaClassDeclareReservedUnused(IOMapper
, 2);
111 OSMetaClassDeclareReservedUnused(IOMapper
, 3);
112 OSMetaClassDeclareReservedUnused(IOMapper
, 4);
113 OSMetaClassDeclareReservedUnused(IOMapper
, 5);
114 OSMetaClassDeclareReservedUnused(IOMapper
, 6);
115 OSMetaClassDeclareReservedUnused(IOMapper
, 7);
116 OSMetaClassDeclareReservedUnused(IOMapper
, 8);
117 OSMetaClassDeclareReservedUnused(IOMapper
, 9);
118 OSMetaClassDeclareReservedUnused(IOMapper
, 10);
119 OSMetaClassDeclareReservedUnused(IOMapper
, 11);
120 OSMetaClassDeclareReservedUnused(IOMapper
, 12);
121 OSMetaClassDeclareReservedUnused(IOMapper
, 13);
122 OSMetaClassDeclareReservedUnused(IOMapper
, 14);
123 OSMetaClassDeclareReservedUnused(IOMapper
, 15);
126 #endif /* __cplusplus */
128 #endif /* !__IOKIT_IOMAPPER_H */