]> git.saurik.com Git - apple/xnu.git/blame - iokit/IOKit/IODeviceTreeSupport.h
xnu-6153.141.1.tar.gz
[apple/xnu.git] / iokit / IOKit / IODeviceTreeSupport.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
0a7de745 5 *
2d21ac55
A
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.
0a7de745 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
0a7de745 17 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
0a7de745 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
0a7de745 29 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
1c79356b
A
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
41class IODeviceMemory;
42class IOService;
43
0a7de745 44extern const IORegistryPlane * gIODTPlane;
1c79356b 45
0a7de745 46extern const OSSymbol * gIODTPHandleKey;
2d21ac55 47
0a7de745
A
48extern const OSSymbol * gIODTCompatibleKey;
49extern const OSSymbol * gIODTTypeKey;
50extern const OSSymbol * gIODTModelKey;
51extern const OSSymbol * gIODTTargetTypeKey;
1c79356b 52
0a7de745
A
53extern const OSSymbol * gIODTAAPLInterruptsKey;
54extern const OSSymbol * gIODTDefaultInterruptController;
55extern const OSSymbol * gIODTNWInterruptMappingKey;
1c79356b 56
0a7de745 57LIBKERN_RETURNS_NOT_RETAINED IORegistryEntry * IODeviceTreeAlloc( void * dtTop );
1c79356b
A
58
59
60bool IODTMatchNubWithKeys( IORegistryEntry * nub,
0a7de745 61 const char * keys );
1c79356b
A
62
63bool IODTCompareNubName( const IORegistryEntry * regEntry,
cb323159
A
64 OSString * name,
65 LIBKERN_RETURNS_RETAINED_ON_NONZERO OSString ** matchingName );
1c79356b
A
66
67enum {
0a7de745
A
68 kIODTRecursive = 0x00000001,
69 kIODTExclusive = 0x00000002
1c79356b
A
70};
71
72OSCollectionIterator * IODTFindMatchingEntries( IORegistryEntry * from,
0a7de745 73 IOOptionBits options, const char * keys );
1c79356b 74
5ba3f43e 75#if !defined(__arm64__)
1c79356b 76typedef SInt32 (*IODTCompareAddressCellFunc)
0a7de745 77(UInt32 cellCount, UInt32 left[], UInt32 right[]);
5ba3f43e
A
78#else
79typedef SInt64 (*IODTCompareAddressCellFunc)
0a7de745 80(UInt32 cellCount, UInt32 left[], UInt32 right[]);
5ba3f43e 81#endif
316670eb 82
1c79356b 83typedef void (*IODTNVLocationFunc)
0a7de745
A
84(IORegistryEntry * entry,
85 UInt8 * busNum, UInt8 * deviceNum, UInt8 * functionNum );
1c79356b 86
0a7de745
A
87void IODTSetResolving( IORegistryEntry * regEntry,
88 IODTCompareAddressCellFunc compareFunc,
89 IODTNVLocationFunc locationFunc );
1c79356b 90
39236c6e 91void IODTGetCellCounts( IORegistryEntry * regEntry,
0a7de745 92 UInt32 * sizeCount, UInt32 * addressCount);
39236c6e 93
1c79356b 94bool IODTResolveAddressCell( IORegistryEntry * regEntry,
0a7de745
A
95 UInt32 cellsIn[],
96 IOPhysicalAddress * phys, IOPhysicalLength * len );
1c79356b 97
0a7de745
A
98LIBKERN_RETURNS_NOT_RETAINED OSArray *
99IODTResolveAddressing( IORegistryEntry * regEntry,
100 const char * addressPropertyName,
101 IODeviceMemory * parent );
1c79356b 102
1c79356b 103struct IONVRAMDescriptor {
0a7de745
A
104 unsigned int format:4;
105 unsigned int marker:1;
106 unsigned int bridgeCount:3;
107 unsigned int busNum:2;
108 unsigned int bridgeDevices:6 * 5;
109 unsigned int functionNum:3;
110 unsigned int deviceNum:5;
b0d623f7 111} __attribute__((aligned(2), packed));
1c79356b
A
112
113IOReturn IODTMakeNVDescriptor( IORegistryEntry * regEntry,
0a7de745 114 IONVRAMDescriptor * hdr );
1c79356b 115
0a7de745
A
116LIBKERN_RETURNS_NOT_RETAINED OSData *
117IODTFindSlotName( IORegistryEntry * regEntry, UInt32 deviceNumber );
1c79356b
A
118
119const OSSymbol * IODTInterruptControllerName(
0a7de745 120 IORegistryEntry * regEntry );
1c79356b
A
121
122bool IODTMapInterrupts( IORegistryEntry * regEntry );
123
91447636 124enum {
0a7de745 125 kIODTInterruptShared = 0x00000001
91447636
A
126};
127IOReturn IODTGetInterruptOptions( IORegistryEntry * regEntry, int source, IOOptionBits * options );
128
1c79356b
A
129#ifdef __cplusplus
130extern "C" {
131#endif
132
133IOReturn IONDRVLibrariesInitialize( IOService * provider );
134
135#ifdef __cplusplus
136}
137#endif
138
139#endif /* _IOKIT_IODEVICETREE_H */