]> git.saurik.com Git - apple/xnu.git/blob - iokit/Drivers/pci/drvApplePCI/AppleMacRiscPCI.h
xnu-124.13.tar.gz
[apple/xnu.git] / iokit / Drivers / pci / drvApplePCI / AppleMacRiscPCI.h
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_APPLEMACRISCPCI_H
31 #define _IOKIT_APPLEMACRISCPCI_H
32
33 #include <IOKit/pci/IOPCIBridge.h>
34
35 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
36
37 enum {
38 kBridgeSelfDevice = 11
39 };
40
41 enum {
42 kMacRISCAddressSelect = 0x48
43 };
44
45 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
46
47 class AppleMacRiscPCI : public IOPCIBridge
48 {
49 OSDeclareDefaultStructors(AppleMacRiscPCI)
50
51 protected:
52 IOSimpleLock * lock;
53 IODeviceMemory * ioMemory;
54 IOMemoryMap * configAddrMap;
55 IOMemoryMap * configDataMap;
56
57 volatile UInt32 * configAddr;
58 volatile UInt8 * configData;
59
60 UInt16 coarseAddressMask;
61 UInt16 fineAddressMask;
62 UInt8 primaryBus;
63 UInt8 configDataOffsetMask;
64
65 inline bool setConfigSpace( IOPCIAddressSpace space, UInt8 offset );
66 virtual UInt8 firstBusNum( void );
67 virtual UInt8 lastBusNum( void );
68
69 public:
70 virtual bool start( IOService * provider );
71 virtual bool configure( IOService * provider );
72
73 virtual void free();
74
75 virtual IODeviceMemory * ioDeviceMemory( void );
76
77 virtual UInt32 configRead32( IOPCIAddressSpace space, UInt8 offset );
78 virtual void configWrite32( IOPCIAddressSpace space,
79 UInt8 offset, UInt32 data );
80 virtual UInt16 configRead16( IOPCIAddressSpace space, UInt8 offset );
81 virtual void configWrite16( IOPCIAddressSpace space,
82 UInt8 offset, UInt16 data );
83 virtual UInt8 configRead8( IOPCIAddressSpace space, UInt8 offset );
84 virtual void configWrite8( IOPCIAddressSpace space,
85 UInt8 offset, UInt8 data );
86
87 virtual IOPCIAddressSpace getBridgeSpace( void );
88 };
89
90 class AppleMacRiscVCI : public AppleMacRiscPCI
91 {
92 OSDeclareDefaultStructors(AppleMacRiscVCI)
93
94 public:
95 virtual bool configure( IOService * provider );
96
97 virtual IODeviceMemory * ioDeviceMemory( void );
98
99 };
100
101 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
102
103 /* Definitions of UniNorth Target config registers */
104 enum {
105 kUniNGART_BASE = 0x8c,
106 kUniNAGP_BASE = 0x90,
107 kUniNGART_CTRL = 0x94,
108 kUniNINTERNAL_STATUS = 0x98
109 };
110 enum {
111 kGART_INV = 0x00000001,
112 kGART_EN = 0x00000100,
113 kGART_2xRESET = 0x00010000
114 };
115
116 class IORangeAllocator;
117
118 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
119
120 class AppleMacRiscAGP : public AppleMacRiscPCI
121 {
122 OSDeclareDefaultStructors(AppleMacRiscAGP)
123
124 protected:
125 IORangeAllocator * agpRange;
126 UInt32 agpBaseIndex;
127 IOPhysicalAddress systemBase;
128 IOPhysicalLength systemLength;
129 volatile UInt32 * gartArray;
130 IOByteCount gartLength;
131 UInt8 targetAGPRegisters;
132
133 private:
134 virtual IOReturn setAGPEnable( IOAGPDevice * master, bool enable,
135 IOOptionBits options = 0 );
136
137 public:
138
139 virtual bool configure( IOService * provider );
140
141 virtual IOPCIDevice * createNub( OSDictionary * from );
142
143 virtual IOReturn saveDeviceState( IOPCIDevice * device,
144 IOOptionBits options = 0 );
145 virtual IOReturn restoreDeviceState( IOPCIDevice * device,
146 IOOptionBits options = 0 );
147
148 virtual IOReturn createAGPSpace( IOAGPDevice * master,
149 IOOptionBits options,
150 IOPhysicalAddress * address,
151 IOPhysicalLength * length );
152
153 virtual IOReturn destroyAGPSpace( IOAGPDevice * master );
154
155 virtual IORangeAllocator * getAGPRangeAllocator( IOAGPDevice * master );
156
157 virtual IOOptionBits getAGPStatus( IOAGPDevice * master,
158 IOOptionBits options = 0 );
159 virtual IOReturn resetAGPDevice( IOAGPDevice * master,
160 IOOptionBits options = 0 );
161
162 virtual IOReturn getAGPSpace( IOAGPDevice * master,
163 IOPhysicalAddress * address,
164 IOPhysicalLength * length );
165
166 virtual IOReturn commitAGPMemory( IOAGPDevice * master,
167 IOMemoryDescriptor * memory,
168 IOByteCount agpOffset,
169 IOOptionBits options = 0 );
170
171 virtual IOReturn releaseAGPMemory( IOAGPDevice * master,
172 IOMemoryDescriptor * memory,
173 IOByteCount agpOffset,
174 IOOptionBits options = 0 );
175 };
176
177 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
178
179 #endif /* ! _IOKIT_APPLEMACRISCPCI_H */
180