|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: File: PCI.h
27:
28: Contains: PCI Bus Interfaces.
29:
30: Version: PowerSurge 1.0.2
31:
32: DRI: Matthew Nelson
33:
34: Copyright: � 1993-1998 by Apple Computer, Inc., all rights reserved.
35:
36: Warning: *** APPLE INTERNAL USE ONLY ***
37: This file may contain unreleased API's
38:
39: BuildInfo: Built by: Naga Pappireddi
40: With Interfacer: 3.0d9 (PowerPC native)
41: From: PCI.i
42: Revision: 22
43: Dated: 1/22/98
44: Last change by: ngk
45: Last comment: Change Types.i to MacTypes.i
46:
47: Bugs: Report bugs to Radar component "System Interfaces", "Latest"
48: List the version information (from above) in the Problem Description.
49:
50: */
51: #ifndef __PCI__
52: #define __PCI__
53:
54: #ifndef __MACTYPES__
55: //#include <MacTypes.h>
56: #endif
57: #ifndef __NAMEREGISTRY__
58: //#include <NameRegistry.h>
59: #endif
60:
61:
62:
63: #if PRAGMA_ONCE
64: #pragma once
65: #endif
66:
67: #ifdef __cplusplus
68: extern "C" {
69: #endif
70:
71: #if PRAGMA_IMPORT
72: #pragma import on
73: #endif
74:
75: #if PRAGMA_STRUCT_ALIGN
76: #pragma options align=mac68k
77: #elif PRAGMA_STRUCT_PACKPUSH
78: #pragma pack(push, 2)
79: #elif PRAGMA_STRUCT_PACK
80: #pragma pack(2)
81: #endif
82:
83:
84: #if TARGET_CPU_68K && defined(IGNORE68KTRAPGLUE)
85: #undef ONEWORDINLINE
86: #undef TWOWORDINLINE
87: #undef THREEWORDINLINE
88: #undef FOURWORDINLINE
89: #undef FIVEWORDINLINE
90: #undef SIXWORDINLINE
91: #undef SEVENWORDINLINE
92: #undef EIGHTWORDINLINE
93: #undef NINEWORDINLINE
94: #undef TENWORDINLINE
95: #undef ELEVENWORDINLINE
96: #undef TWELVEWORDINLINE
97:
98: #define ONEWORDINLINE(w1)
99: #define TWOWORDINLINE(w1,w2)
100: #define THREEWORDINLINE(w1,w2,w3)
101: #define FOURWORDINLINE(w1,w2,w3,w4)
102: #define FIVEWORDINLINE(w1,w2,w3,w4,w5)
103: #define SIXWORDINLINE(w1,w2,w3,w4,w5,w6)
104: #define SEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7)
105: #define EIGHTWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8)
106: #define NINEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9)
107: #define TENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10)
108: #define ELEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11)
109: #define TWELVEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12)
110: #endif
111:
112: /* Types and structures for accessing the PCI Assigned-Address property.*/
113:
114: #define kPCIAssignedAddressProperty "assigned-addresses"
115:
116: enum {
117: kPCIRelocatableSpace = 0x80,
118: kPCIPrefetchableSpace = 0x40,
119: kPCIAliasedSpace = 0x20,
120: kPCIAddressTypeCodeMask = 0x03,
121: kPCIConfigSpace = 0,
122: kPCIIOSpace = 1,
123: kPCI32BitMemorySpace = 2,
124: kPCI64BitMemorySpace = 3
125: };
126:
127: typedef UInt8 PCIAddressSpaceFlags;
128:
129: enum {
130: kPCIDeviceNumberMask = 0x1F,
131: kPCIFunctionNumberMask = 0x07
132: };
133:
134: typedef UInt8 PCIDeviceFunction;
135: typedef UInt8 PCIBusNumber;
136: typedef UInt8 PCIRegisterNumber;
137:
138: struct PCIAssignedAddress {
139: PCIAddressSpaceFlags addressSpaceFlags;
140: PCIBusNumber busNumber;
141: PCIDeviceFunction deviceFunctionNumber;
142: PCIRegisterNumber registerNumber;
143: UnsignedWide address;
144: UnsignedWide size;
145: };
146: typedef struct PCIAssignedAddress PCIAssignedAddress;
147: typedef PCIAssignedAddress * PCIAssignedAddressPtr;
148: #define GetPCIIsRelocatable( AssignedAddressPtr ) ((AssignedAddressPtr)->addressSpaceFlags & kPCIRelocatableSpace)
149: #define GetPCIIsPrefetchable( AssignedAddressPtr ) ((AssignedAddressPtr)->addressSpaceFlags & kPCIPrefetchableSpace)
150: #define GetPCIIsAliased( AssignedAddressPtr ) ((AssignedAddressPtr)->addressSpaceFlags & kPCIAliasedSpace)
151: #define GetPCIAddressSpaceType( AssignedAddressPtr ) ((AssignedAddressPtr)->addressSpaceFlags & kPCIAddressTypeCodeMask)
152: #define GetPCIBusNumber( AssignedAddressPtr ) ((AssignedAddressPtr)->busNumber)
153: #define GetPCIDeviceNumber( AssignedAddressPtr ) (((AssignedAddressPtr)->deviceFunctionNumber >> 3) & kPCIDeviceNumberMask)
154: #define GetPCIFunctionNumber( AssignedAddressPtr ) ((AssignedAddressPtr)->deviceFunctionNumber & kPCIFunctionNumberMask)
155: #define GetPCIRegisterNumber( AssignedAddressPtr ) ((AssignedAddressPtr)->registerNumber)
156:
157: #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
158: #pragma parameter __D0 EndianSwap16Bit(__D0)
159: #endif
160: EXTERN_API( UInt16 )
161: EndianSwap16Bit (UInt16 data16) ONEWORDINLINE(0xE158);
162:
163: #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
164: #pragma parameter __D0 EndianSwap32Bit(__D0)
165: #endif
166: EXTERN_API( UInt32 )
167: EndianSwap32Bit (UInt32 data32) THREEWORDINLINE(0xE158, 0x4840, 0xE158);
168:
169: EXTERN_API( OSErr )
170: ExpMgrConfigReadByte (RegEntryIDPtr node,
171: LogicalAddress configAddr,
172: UInt8 * valuePtr) THREEWORDINLINE(0x303C, 0x0620, 0xAAF3);
173:
174: EXTERN_API( OSErr )
175: ExpMgrConfigReadWord (RegEntryIDPtr node,
176: LogicalAddress configAddr,
177: UInt16 * valuePtr) THREEWORDINLINE(0x303C, 0x0621, 0xAAF3);
178:
179: EXTERN_API( OSErr )
180: ExpMgrConfigReadLong (RegEntryIDPtr node,
181: LogicalAddress configAddr,
182: UInt32 * valuePtr) THREEWORDINLINE(0x303C, 0x0622, 0xAAF3);
183:
184: EXTERN_API( OSErr )
185: ExpMgrConfigWriteByte (RegEntryIDPtr node,
186: LogicalAddress configAddr,
187: UInt8 value) THREEWORDINLINE(0x303C, 0x0523, 0xAAF3);
188:
189: EXTERN_API( OSErr )
190: ExpMgrConfigWriteWord (RegEntryIDPtr node,
191: LogicalAddress configAddr,
192: UInt16 value) THREEWORDINLINE(0x303C, 0x0524, 0xAAF3);
193:
194: EXTERN_API( OSErr )
195: ExpMgrConfigWriteLong (RegEntryIDPtr node,
196: LogicalAddress configAddr,
197: UInt32 value) THREEWORDINLINE(0x303C, 0x0625, 0xAAF3);
198:
199: EXTERN_API( OSErr )
200: ExpMgrIOReadByte (RegEntryIDPtr node,
201: LogicalAddress ioAddr,
202: UInt8 * valuePtr) THREEWORDINLINE(0x303C, 0x0626, 0xAAF3);
203:
204: EXTERN_API( OSErr )
205: ExpMgrIOReadWord (RegEntryIDPtr node,
206: LogicalAddress ioAddr,
207: UInt16 * valuePtr) THREEWORDINLINE(0x303C, 0x0627, 0xAAF3);
208:
209: EXTERN_API( OSErr )
210: ExpMgrIOReadLong (RegEntryIDPtr node,
211: LogicalAddress ioAddr,
212: UInt32 * valuePtr) THREEWORDINLINE(0x303C, 0x0628, 0xAAF3);
213:
214: EXTERN_API( OSErr )
215: ExpMgrIOWriteByte (RegEntryIDPtr node,
216: LogicalAddress ioAddr,
217: UInt8 value) THREEWORDINLINE(0x303C, 0x0529, 0xAAF3);
218:
219: EXTERN_API( OSErr )
220: ExpMgrIOWriteWord (RegEntryIDPtr node,
221: LogicalAddress ioAddr,
222: UInt16 value) THREEWORDINLINE(0x303C, 0x052A, 0xAAF3);
223:
224: EXTERN_API( OSErr )
225: ExpMgrIOWriteLong (RegEntryIDPtr node,
226: LogicalAddress ioAddr,
227: UInt32 value) THREEWORDINLINE(0x303C, 0x062B, 0xAAF3);
228:
229: EXTERN_API( OSErr )
230: ExpMgrInterruptAcknowledgeReadByte (RegEntryIDPtr entry,
231: UInt8 * valuePtr) THREEWORDINLINE(0x303C, 0x0411, 0xAAF3);
232:
233: EXTERN_API( OSErr )
234: ExpMgrInterruptAcknowledgeReadWord (RegEntryIDPtr entry,
235: UInt16 * valuePtr) THREEWORDINLINE(0x303C, 0x0412, 0xAAF3);
236:
237: EXTERN_API( OSErr )
238: ExpMgrInterruptAcknowledgeReadLong (RegEntryIDPtr entry,
239: UInt32 * valuePtr) THREEWORDINLINE(0x303C, 0x0413, 0xAAF3);
240:
241: EXTERN_API( OSErr )
242: ExpMgrSpecialCycleWriteLong (RegEntryIDPtr entry,
243: UInt32 value) THREEWORDINLINE(0x303C, 0x0419, 0xAAF3);
244:
245: EXTERN_API( OSErr )
246: ExpMgrSpecialCycleBroadcastLong (UInt32 value) THREEWORDINLINE(0x303C, 0x021A, 0xAAF3);
247:
248:
249: #if TARGET_CPU_68K && defined(IGNORE68KTRAPGLUE)
250: #if TARGET_OS_MAC && !TARGET_RT_MAC_CFM
251: #undef ONEWORDINLINE
252: #undef TWOWORDINLINE
253: #undef THREEWORDINLINE
254: #undef FOURWORDINLINE
255: #undef FIVEWORDINLINE
256: #undef SIXWORDINLINE
257: #undef SEVENWORDINLINE
258: #undef EIGHTWORDINLINE
259: #undef NINEWORDINLINE
260: #undef TENWORDINLINE
261: #undef ELEVENWORDINLINE
262: #undef TWELVEWORDINLINE
263:
264: #define ONEWORDINLINE(w1) = w1
265: #define TWOWORDINLINE(w1,w2) = {w1,w2}
266: #define THREEWORDINLINE(w1,w2,w3) = {w1,w2,w3}
267: #define FOURWORDINLINE(w1,w2,w3,w4) = {w1,w2,w3,w4}
268: #define FIVEWORDINLINE(w1,w2,w3,w4,w5) = {w1,w2,w3,w4,w5}
269: #define SIXWORDINLINE(w1,w2,w3,w4,w5,w6) = {w1,w2,w3,w4,w5,w6}
270: #define SEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7) = {w1,w2,w3,w4,w5,w6,w7}
271: #define EIGHTWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8) = {w1,w2,w3,w4,w5,w6,w7,w8}
272: #define NINEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9) = {w1,w2,w3,w4,w5,w6,w7,w8,w9}
273: #define TENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10}
274: #define ELEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11}
275: #define TWELVEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12}
276: #endif
277: #endif
278:
279:
280: #if PRAGMA_STRUCT_ALIGN
281: #pragma options align=reset
282: #elif PRAGMA_STRUCT_PACKPUSH
283: #pragma pack(pop)
284: #elif PRAGMA_STRUCT_PACK
285: #pragma pack()
286: #endif
287:
288: #ifdef PRAGMA_IMPORT_OFF
289: #pragma import off
290: #elif PRAGMA_IMPORT
291: #pragma import reset
292: #endif
293:
294: #ifdef __cplusplus
295: }
296: #endif
297:
298: #endif /* __PCI__ */
299:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.