|
|
1.1 root 1: /*
2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
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.
11: *
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
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
24: *
25: * HISTORY
26: *
27: */
28:
29:
30: #ifndef _IOKIT_IOPCIBRIDGE_H
31: #define _IOKIT_IOPCIBRIDGE_H
32:
33: #include <IOKit/IOService.h>
34: #include <IOKit/IODeviceMemory.h>
35: #include <IOKit/pci/IOAGPDevice.h>
36:
37:
38: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
39:
40: class IOPCIBridge : public IOService
41: {
42: friend IOPCIDevice;
43:
44: OSDeclareAbstractStructors(IOPCIBridge)
45:
46: private:
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 );
52:
53: protected:
54: IORangeAllocator * bridgeMemoryRanges;
55: IORangeAllocator * bridgeIORanges;
56:
57: protected:
58: virtual void probeBus( IOService * provider, UInt8 busNum );
59:
60: virtual UInt8 firstBusNum( void );
61: virtual UInt8 lastBusNum( void );
62:
63: virtual void spaceFromProperties( OSDictionary * propTable,
64: IOPCIAddressSpace * space );
65: virtual OSDictionary * constructProperties( IOPCIAddressSpace space );
66:
67: virtual IOPCIDevice * createNub( OSDictionary * from );
68:
69: virtual bool initializeNub( IOPCIDevice * nub, OSDictionary * from );
70:
71: virtual bool publishNub( IOPCIDevice * nub, UInt32 index );
72:
73: virtual bool addBridgeMemoryRange( IOPhysicalAddress start,
74: IOPhysicalLength length, bool host );
75:
76: virtual bool addBridgeIORange( IOByteCount start, IOByteCount length );
77:
78: virtual bool constructRange( IOPCIAddressSpace * flags,
79: IOPhysicalAddress phys, IOPhysicalLength len,
80: OSArray * array );
81:
82: virtual bool matchNubWithPropertyTable( IOService * nub,
83: OSDictionary * propertyTable );
84:
85: virtual bool compareNubName( const IOService * nub, OSString * name,
86: OSString ** matched = 0 ) const;
87:
88: virtual bool pciMatchNub( IOPCIDevice * nub, OSDictionary * table );
89:
90: virtual bool matchKeys( IOPCIDevice * nub, const char * keys,
91: UInt32 defaultMask, UInt8 regNum );
92:
93: virtual IOReturn getNubResources( IOService * nub );
94:
95: virtual IOReturn getNubAddressing( IOPCIDevice * nub );
96:
97: virtual IOReturn getDTNubAddressing( IOPCIDevice * nub );
98:
99: public:
100:
101: virtual bool start( IOService * provider );
102:
103: virtual bool configure( IOService * provider );
104:
105: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
106:
107: virtual IODeviceMemory * ioDeviceMemory( void ) = 0;
108:
109: virtual UInt32 configRead32( IOPCIAddressSpace space, UInt8 offset ) = 0;
110:
111: virtual void configWrite32( IOPCIAddressSpace space,
112: UInt8 offset, UInt32 data ) = 0;
113:
114: virtual IOPCIAddressSpace getBridgeSpace( void ) = 0;
115:
116: virtual UInt32 findPCICapability( IOPCIAddressSpace space,
117: UInt8 capabilityID );
118:
119: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
120:
121: virtual IOReturn createAGPSpace( IOPCIAddressSpace master,
122: IOOptionBits options,
123: IOPhysicalAddress * address,
124: IOPhysicalLength * length );
125:
126: virtual IOReturn destroyAGPSpace( IOPCIAddressSpace master );
127:
128: virtual IORangeAllocator * getAGPRangeAllocator( IOPCIAddressSpace master );
129:
130: virtual IOOptionBits getAGPStatus( IOPCIAddressSpace master,
131: IOOptionBits options = 0 );
132:
133: virtual IOReturn commitAGPMemory( IOPCIAddressSpace master,
134: IOMemoryDescriptor * memory,
135: IOByteCount agpOffset,
136: IOOptionBits options = 0 );
137:
138: virtual IOReturn releaseAGPMemory( IOPCIAddressSpace master,
139: IOMemoryDescriptor * memory,
140: IOByteCount agpOffset );
141:
142: };
143:
144: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
145:
146: class IOPCI2PCIBridge : public IOPCIBridge
147: {
148: OSDeclareDefaultStructors(IOPCI2PCIBridge)
149:
150: private:
151:
152: IOPCIDevice * bridgeDevice;
153:
154: protected:
155: virtual UInt8 firstBusNum( void );
156: virtual UInt8 lastBusNum( void );
157:
158: public:
159: virtual IOService * probe( IOService * provider,
160: SInt32 * score );
161:
162: virtual bool configure( IOService * provider );
163:
164: virtual bool publishNub( IOPCIDevice * nub, UInt32 index );
165:
166: virtual IODeviceMemory * ioDeviceMemory( void );
167:
168: virtual IOPCIAddressSpace getBridgeSpace( void );
169:
170: virtual UInt32 configRead32( IOPCIAddressSpace space, UInt8 offset );
171:
172: virtual void configWrite32( IOPCIAddressSpace space,
173: UInt8 offset, UInt32 data );
174:
175: };
176:
177: #endif /* ! _IOKIT_IOPCIBRIDGE_H */
178:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.