]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/IODeviceTreeSupport.h
xnu-4903.270.47.tar.gz
[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 * gIODTPHandleKey;
47
48 extern const OSSymbol * gIODTCompatibleKey;
49 extern const OSSymbol * gIODTTypeKey;
50 extern const OSSymbol * gIODTModelKey;
51 extern const OSSymbol * gIODTTargetTypeKey;
52
53 extern const OSSymbol * gIODTAAPLInterruptsKey;
54 extern const OSSymbol * gIODTDefaultInterruptController;
55 extern const OSSymbol * gIODTNWInterruptMappingKey;
56
57 LIBKERN_RETURNS_NOT_RETAINED IORegistryEntry * IODeviceTreeAlloc( void * dtTop );
58
59
60 bool IODTMatchNubWithKeys( IORegistryEntry * nub,
61 const char * keys );
62
63 bool IODTCompareNubName( const IORegistryEntry * regEntry,
64 OSString * name, OSString ** matchingName );
65
66 enum {
67 kIODTRecursive = 0x00000001,
68 kIODTExclusive = 0x00000002
69 };
70
71 OSCollectionIterator * IODTFindMatchingEntries( IORegistryEntry * from,
72 IOOptionBits options, const char * keys );
73
74 #if !defined(__arm64__)
75 typedef SInt32 (*IODTCompareAddressCellFunc)
76 (UInt32 cellCount, UInt32 left[], UInt32 right[]);
77 #else
78 typedef SInt64 (*IODTCompareAddressCellFunc)
79 (UInt32 cellCount, UInt32 left[], UInt32 right[]);
80 #endif
81
82 typedef void (*IODTNVLocationFunc)
83 (IORegistryEntry * entry,
84 UInt8 * busNum, UInt8 * deviceNum, UInt8 * functionNum );
85
86 void IODTSetResolving( IORegistryEntry * regEntry,
87 IODTCompareAddressCellFunc compareFunc,
88 IODTNVLocationFunc locationFunc );
89
90 void IODTGetCellCounts( IORegistryEntry * regEntry,
91 UInt32 * sizeCount, UInt32 * addressCount);
92
93 bool IODTResolveAddressCell( IORegistryEntry * regEntry,
94 UInt32 cellsIn[],
95 IOPhysicalAddress * phys, IOPhysicalLength * len );
96
97 LIBKERN_RETURNS_NOT_RETAINED OSArray *
98 IODTResolveAddressing( IORegistryEntry * regEntry,
99 const char * addressPropertyName,
100 IODeviceMemory * parent );
101
102 struct IONVRAMDescriptor {
103 unsigned int format:4;
104 unsigned int marker:1;
105 unsigned int bridgeCount:3;
106 unsigned int busNum:2;
107 unsigned int bridgeDevices:6 * 5;
108 unsigned int functionNum:3;
109 unsigned int deviceNum:5;
110 } __attribute__((aligned(2), packed));
111
112 IOReturn IODTMakeNVDescriptor( IORegistryEntry * regEntry,
113 IONVRAMDescriptor * hdr );
114
115 LIBKERN_RETURNS_NOT_RETAINED OSData *
116 IODTFindSlotName( IORegistryEntry * regEntry, UInt32 deviceNumber );
117
118 const OSSymbol * IODTInterruptControllerName(
119 IORegistryEntry * regEntry );
120
121 bool IODTMapInterrupts( IORegistryEntry * regEntry );
122
123 enum {
124 kIODTInterruptShared = 0x00000001
125 };
126 IOReturn IODTGetInterruptOptions( IORegistryEntry * regEntry, int source, IOOptionBits * options );
127
128 #ifdef __cplusplus
129 extern "C" {
130 #endif
131
132 IOReturn IONDRVLibrariesInitialize( IOService * provider );
133
134 #ifdef __cplusplus
135 }
136 #endif
137
138 #endif /* _IOKIT_IODEVICETREE_H */