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