]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/IODeviceTreeSupport.h
6504ccf2c5cdfb5d37b53de6ffb36a0292e49951
[apple/xnu.git] / iokit / IOKit / IODeviceTreeSupport.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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 License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
30 *
31 * HISTORY
32 *
33 */
34
35 #ifndef _IOKIT_IODEVICETREE_H
36 #define _IOKIT_IODEVICETREE_H
37
38 #include <IOKit/IORegistryEntry.h>
39 #include <libkern/c++/OSData.h>
40
41 class IODeviceMemory;
42 class IOService;
43
44 extern const IORegistryPlane * gIODTPlane;
45
46 extern const OSSymbol * gIODTCompatibleKey;
47 extern const OSSymbol * gIODTTypeKey;
48 extern const OSSymbol * gIODTModelKey;
49
50 extern const OSSymbol * gIODTAAPLInterruptsKey;
51 extern const OSSymbol * gIODTDefaultInterruptController;
52 extern const OSSymbol * gIODTNWInterruptMappingKey;
53
54 IORegistryEntry * IODeviceTreeAlloc( void * dtTop );
55
56
57 bool IODTMatchNubWithKeys( IORegistryEntry * nub,
58 const char * keys );
59
60 bool IODTCompareNubName( const IORegistryEntry * regEntry,
61 OSString * name, OSString ** matchingName );
62
63 enum {
64 kIODTRecursive = 0x00000001,
65 kIODTExclusive = 0x00000002
66 };
67
68 OSCollectionIterator * IODTFindMatchingEntries( IORegistryEntry * from,
69 IOOptionBits options, const char * keys );
70
71 typedef SInt32 (*IODTCompareAddressCellFunc)
72 (UInt32 cellCount, UInt32 left[], UInt32 right[]);
73 typedef void (*IODTNVLocationFunc)
74 (IORegistryEntry * entry,
75 UInt8 * busNum, UInt8 * deviceNum, UInt8 * functionNum );
76
77 void IODTSetResolving( IORegistryEntry * regEntry,
78 IODTCompareAddressCellFunc compareFunc,
79 IODTNVLocationFunc locationFunc );
80
81 bool IODTResolveAddressCell( IORegistryEntry * regEntry,
82 UInt32 cellsIn[],
83 IOPhysicalAddress * phys, IOPhysicalLength * len );
84
85 OSArray * IODTResolveAddressing( IORegistryEntry * regEntry,
86 const char * addressPropertyName,
87 IODeviceMemory * parent );
88
89 #pragma options align=mac68k
90
91 struct IONVRAMDescriptor {
92 unsigned int format:4;
93 unsigned int marker:1;
94 unsigned int bridgeCount:3;
95 unsigned int busNum:2;
96 unsigned int bridgeDevices:6 * 5;
97 unsigned int functionNum:3;
98 unsigned int deviceNum:5;
99 };
100
101 #pragma options align=reset
102
103 IOReturn IODTMakeNVDescriptor( IORegistryEntry * regEntry,
104 IONVRAMDescriptor * hdr );
105
106 OSData * IODTFindSlotName( IORegistryEntry * regEntry, UInt32 deviceNumber );
107
108 const OSSymbol * IODTInterruptControllerName(
109 IORegistryEntry * regEntry );
110
111 bool IODTMapInterrupts( IORegistryEntry * regEntry );
112
113 enum {
114 kIODTInterruptShared = 0x00000001
115 };
116 IOReturn IODTGetInterruptOptions( IORegistryEntry * regEntry, int source, IOOptionBits * options );
117
118 #ifdef __cplusplus
119 extern "C" {
120 #endif
121
122 IOReturn IONDRVLibrariesInitialize( IOService * provider );
123
124 #ifdef __cplusplus
125 }
126 #endif
127
128 #endif /* _IOKIT_IODEVICETREE_H */
129