]>
git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/pci/IOPCIBridge.h
2 * Copyright (c) 1998-2000 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 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
30 #ifndef _IOKIT_IOPCIBRIDGE_H
31 #define _IOKIT_IOPCIBRIDGE_H
33 #include <IOKit/IOService.h>
34 #include <IOKit/IODeviceMemory.h>
35 #include <IOKit/pci/IOAGPDevice.h>
38 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
40 class IOPCIBridge
: public IOService
44 OSDeclareAbstractStructors(IOPCIBridge
)
47 IORegistryEntry
* findMatching( OSIterator
* in
, IOPCIAddressSpace space
);
48 void publishNubs( OSIterator
* kids
, UInt32 index
);
49 virtual bool isDTNub( IOPCIDevice
* nub
);
50 static void nvLocation( IORegistryEntry
* entry
,
51 UInt8
* busNum
, UInt8
* deviceNum
, UInt8
* functionNum
);
54 IORangeAllocator
* bridgeMemoryRanges
;
55 IORangeAllocator
* bridgeIORanges
;
57 /*! @struct ExpansionData
58 @discussion This structure will be used to expand the capablilties of the IOWorkLoop in the future.
60 struct ExpansionData
{ };
63 Reserved for future use. (Internal use only) */
64 ExpansionData
*reserved
;
67 virtual void probeBus( IOService
* provider
, UInt8 busNum
);
69 virtual UInt8
firstBusNum( void );
70 virtual UInt8
lastBusNum( void );
72 virtual void spaceFromProperties( OSDictionary
* propTable
,
73 IOPCIAddressSpace
* space
);
74 virtual OSDictionary
* constructProperties( IOPCIAddressSpace space
);
76 virtual IOPCIDevice
* createNub( OSDictionary
* from
);
78 virtual bool initializeNub( IOPCIDevice
* nub
, OSDictionary
* from
);
80 virtual bool publishNub( IOPCIDevice
* nub
, UInt32 index
);
82 virtual bool addBridgeMemoryRange( IOPhysicalAddress start
,
83 IOPhysicalLength length
, bool host
);
85 virtual bool addBridgeIORange( IOByteCount start
, IOByteCount length
);
87 virtual bool constructRange( IOPCIAddressSpace
* flags
,
88 IOPhysicalAddress phys
, IOPhysicalLength len
,
91 virtual bool matchNubWithPropertyTable( IOService
* nub
,
92 OSDictionary
* propertyTable
,
95 virtual bool compareNubName( const IOService
* nub
, OSString
* name
,
96 OSString
** matched
= 0 ) const;
98 virtual bool pciMatchNub( IOPCIDevice
* nub
,
99 OSDictionary
* table
, SInt32
* score
);
101 virtual bool matchKeys( IOPCIDevice
* nub
, const char * keys
,
102 UInt32 defaultMask
, UInt8 regNum
);
104 virtual IOReturn
getNubResources( IOService
* nub
);
106 virtual IOReturn
getNubAddressing( IOPCIDevice
* nub
);
108 virtual IOReturn
getDTNubAddressing( IOPCIDevice
* nub
);
112 virtual bool start( IOService
* provider
);
114 virtual bool configure( IOService
* provider
);
116 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
118 virtual IODeviceMemory
* ioDeviceMemory( void ) = 0;
120 virtual UInt32
configRead32( IOPCIAddressSpace space
, UInt8 offset
) = 0;
121 virtual void configWrite32( IOPCIAddressSpace space
,
122 UInt8 offset
, UInt32 data
) = 0;
123 virtual UInt16
configRead16( IOPCIAddressSpace space
, UInt8 offset
) = 0;
124 virtual void configWrite16( IOPCIAddressSpace space
,
125 UInt8 offset
, UInt16 data
) = 0;
126 virtual UInt8
configRead8( IOPCIAddressSpace space
, UInt8 offset
) = 0;
127 virtual void configWrite8( IOPCIAddressSpace space
,
128 UInt8 offset
, UInt8 data
) = 0;
130 virtual IOPCIAddressSpace
getBridgeSpace( void ) = 0;
132 virtual UInt32
findPCICapability( IOPCIAddressSpace space
,
133 UInt8 capabilityID
, UInt8
* offset
= 0 );
135 virtual IOReturn
setDevicePowerState( IOPCIDevice
* device
,
136 unsigned long whatToDo
);
137 virtual IOReturn
saveDeviceState( IOPCIDevice
* device
,
138 IOOptionBits options
= 0 );
139 virtual IOReturn
restoreDeviceState( IOPCIDevice
* device
,
140 IOOptionBits options
= 0 );
142 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
144 virtual IOReturn
createAGPSpace( IOAGPDevice
* master
,
145 IOOptionBits options
,
146 IOPhysicalAddress
* address
,
147 IOPhysicalLength
* length
);
149 virtual IOReturn
destroyAGPSpace( IOAGPDevice
* master
);
151 virtual IORangeAllocator
* getAGPRangeAllocator( IOAGPDevice
* master
);
153 virtual IOOptionBits
getAGPStatus( IOAGPDevice
* master
,
154 IOOptionBits options
= 0 );
155 virtual IOReturn
resetAGPDevice( IOAGPDevice
* master
,
156 IOOptionBits options
= 0 );
158 virtual IOReturn
getAGPSpace( IOAGPDevice
* master
,
159 IOPhysicalAddress
* address
,
160 IOPhysicalLength
* length
);
162 virtual IOReturn
commitAGPMemory( IOAGPDevice
* master
,
163 IOMemoryDescriptor
* memory
,
164 IOByteCount agpOffset
,
165 IOOptionBits options
);
167 virtual IOReturn
releaseAGPMemory( IOAGPDevice
* master
,
168 IOMemoryDescriptor
* memory
,
169 IOByteCount agpOffset
,
170 IOOptionBits options
);
173 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 0);
174 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 1);
175 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 2);
176 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 3);
177 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 4);
178 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 5);
179 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 6);
180 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 7);
181 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 8);
182 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 9);
183 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 10);
184 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 11);
185 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 12);
186 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 13);
187 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 14);
188 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 15);
189 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 16);
190 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 17);
191 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 18);
192 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 19);
193 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 20);
194 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 21);
195 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 22);
196 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 23);
197 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 24);
198 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 25);
199 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 26);
200 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 27);
201 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 28);
202 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 29);
203 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 30);
204 OSMetaClassDeclareReservedUnused(IOPCIBridge
, 31);
207 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
209 #define kIOPCIBridgeRegs (32)
211 class IOPCI2PCIBridge
: public IOPCIBridge
213 OSDeclareDefaultStructors(IOPCI2PCIBridge
)
217 IOPCIDevice
* bridgeDevice
;
218 UInt32 bridgeState
[kIOPCIBridgeRegs
];
221 /*! @struct ExpansionData
222 @discussion This structure will be used to expand the capablilties of the IOWorkLoop in the future.
224 struct ExpansionData
{ };
227 Reserved for future use. (Internal use only) */
228 ExpansionData
*reserved
;
230 virtual UInt8
firstBusNum( void );
231 virtual UInt8
lastBusNum( void );
234 virtual IOService
* probe( IOService
* provider
,
237 virtual bool configure( IOService
* provider
);
239 virtual void saveBridgeState( void );
241 virtual void restoreBridgeState( void );
243 virtual bool publishNub( IOPCIDevice
* nub
, UInt32 index
);
245 virtual IODeviceMemory
* ioDeviceMemory( void );
247 virtual IOPCIAddressSpace
getBridgeSpace( void );
249 virtual UInt32
configRead32( IOPCIAddressSpace space
, UInt8 offset
);
250 virtual void configWrite32( IOPCIAddressSpace space
,
251 UInt8 offset
, UInt32 data
);
252 virtual UInt16
configRead16( IOPCIAddressSpace space
, UInt8 offset
);
253 virtual void configWrite16( IOPCIAddressSpace space
,
254 UInt8 offset
, UInt16 data
);
255 virtual UInt8
configRead8( IOPCIAddressSpace space
, UInt8 offset
);
256 virtual void configWrite8( IOPCIAddressSpace space
,
257 UInt8 offset
, UInt8 data
);
260 OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge
, 0);
261 OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge
, 1);
262 OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge
, 2);
263 OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge
, 3);
264 OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge
, 4);
265 OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge
, 5);
266 OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge
, 6);
267 OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge
, 7);
268 OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge
, 8);
271 #endif /* ! _IOKIT_IOPCIBRIDGE_H */