]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
6601e61a | 4 | * @APPLE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
6601e61a A |
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. | |
8f6c56a5 | 11 | * |
6601e61a A |
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 | |
8f6c56a5 A |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
6601e61a A |
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. | |
8f6c56a5 | 19 | * |
6601e61a | 20 | * @APPLE_LICENSE_HEADER_END@ |
1c79356b | 21 | */ |
1c79356b A |
22 | |
23 | #ifndef _IOKIT_IOPCIDEVICE_H | |
24 | #define _IOKIT_IOPCIDEVICE_H | |
25 | ||
43866e37 A |
26 | #warning IOPCIDevice.h moved to IOPCIFamily project |
27 | #warning IOPCIDevice.h will be removed from xnu; do not edit or add new usage | |
de355530 | 28 | |
43866e37 | 29 | #include <IOKit/IOService.h> |
de355530 | 30 | |
1c79356b A |
31 | union IOPCIAddressSpace { |
32 | UInt32 bits; | |
33 | struct { | |
55e303ae | 34 | #ifdef __BIG_ENDIAN__ |
1c79356b A |
35 | unsigned int reloc:1; |
36 | unsigned int prefetch:1; | |
37 | unsigned int t:1; | |
38 | unsigned int resv:3; | |
39 | unsigned int space:2; | |
40 | unsigned int busNum:8; | |
41 | unsigned int deviceNum:5; | |
42 | unsigned int functionNum:3; | |
43 | unsigned int registerNum:8; | |
55e303ae | 44 | #elif defined(__LITTLE_ENDIAN__) |
1c79356b A |
45 | unsigned int registerNum:8; |
46 | unsigned int functionNum:3; | |
47 | unsigned int deviceNum:5; | |
48 | unsigned int busNum:8; | |
49 | unsigned int space:2; | |
50 | unsigned int resv:3; | |
51 | unsigned int t:1; | |
52 | unsigned int prefetch:1; | |
53 | unsigned int reloc:1; | |
54 | #endif | |
55 | } s; | |
56 | }; | |
57 | ||
1c79356b A |
58 | class IOPCIDevice : public IOService |
59 | { | |
60 | OSDeclareDefaultStructors(IOPCIDevice) | |
61 | ||
62 | friend class IOPCIBridge; | |
63 | friend class IOPCI2PCIBridge; | |
64 | ||
65 | protected: | |
66 | IOPCIBridge * parent; | |
67 | IOMemoryMap * ioMap; | |
68 | OSObject * slotNameProperty; | |
69 | ||
1c79356b A |
70 | struct ExpansionData { }; |
71 | ||
1c79356b A |
72 | ExpansionData *reserved; |
73 | ||
74 | public: | |
43866e37 | 75 | IOPCIAddressSpace space; |
1c79356b A |
76 | UInt32 * savedConfig; |
77 | ||
78 | public: | |
1c79356b A |
79 | |
80 | virtual bool attach( IOService * provider ); | |
0b4e3aa0 | 81 | virtual void detach( IOService * provider ); |
1c79356b | 82 | virtual IOReturn setPowerState( unsigned long, IOService * ); |
1c79356b A |
83 | virtual bool compareName( OSString * name, OSString ** matched = 0 ) const; |
84 | virtual bool matchPropertyTable( OSDictionary * table, | |
85 | SInt32 * score ); | |
86 | virtual IOService * matchLocation( IOService * client ); | |
87 | virtual IOReturn getResources( void ); | |
88 | ||
89 | /* Config space accessors */ | |
90 | ||
91 | virtual UInt32 configRead32( IOPCIAddressSpace space, UInt8 offset ); | |
92 | virtual void configWrite32( IOPCIAddressSpace space, | |
93 | UInt8 offset, UInt32 data ); | |
94 | virtual UInt16 configRead16( IOPCIAddressSpace space, UInt8 offset ); | |
95 | virtual void configWrite16( IOPCIAddressSpace space, | |
96 | UInt8 offset, UInt16 data ); | |
97 | virtual UInt8 configRead8( IOPCIAddressSpace space, UInt8 offset ); | |
98 | virtual void configWrite8( IOPCIAddressSpace space, | |
99 | UInt8 offset, UInt8 data ); | |
100 | ||
1c79356b | 101 | virtual UInt32 configRead32( UInt8 offset ); |
1c79356b | 102 | virtual UInt16 configRead16( UInt8 offset ); |
1c79356b | 103 | virtual UInt8 configRead8( UInt8 offset ); |
1c79356b | 104 | virtual void configWrite32( UInt8 offset, UInt32 data ); |
1c79356b | 105 | virtual void configWrite16( UInt8 offset, UInt16 data ); |
1c79356b A |
106 | virtual void configWrite8( UInt8 offset, UInt8 data ); |
107 | ||
108 | virtual IOReturn saveDeviceState( IOOptionBits options = 0 ); | |
109 | virtual IOReturn restoreDeviceState( IOOptionBits options = 0 ); | |
1c79356b A |
110 | virtual UInt32 setConfigBits( UInt8 offset, UInt32 mask, UInt32 value ); |
111 | ||
1c79356b | 112 | virtual bool setMemoryEnable( bool enable ); |
1c79356b | 113 | virtual bool setIOEnable( bool enable, bool exclusive = false ); |
1c79356b | 114 | virtual bool setBusMasterEnable( bool enable ); |
1c79356b | 115 | virtual UInt32 findPCICapability( UInt8 capabilityID, UInt8 * offset = 0 ); |
1c79356b | 116 | virtual UInt8 getBusNumber( void ); |
1c79356b | 117 | virtual UInt8 getDeviceNumber( void ); |
1c79356b | 118 | virtual UInt8 getFunctionNumber( void ); |
1c79356b | 119 | virtual IODeviceMemory * getDeviceMemoryWithRegister( UInt8 reg ); |
1c79356b A |
120 | virtual IOMemoryMap * mapDeviceMemoryWithRegister( UInt8 reg, |
121 | IOOptionBits options = 0 ); | |
1c79356b | 122 | virtual IODeviceMemory * ioDeviceMemory( void ); |
1c79356b A |
123 | virtual void ioWrite32( UInt16 offset, UInt32 value, |
124 | IOMemoryMap * map = 0 ); | |
1c79356b A |
125 | virtual void ioWrite16( UInt16 offset, UInt16 value, |
126 | IOMemoryMap * map = 0 ); | |
1c79356b A |
127 | virtual void ioWrite8( UInt16 offset, UInt8 value, |
128 | IOMemoryMap * map = 0 ); | |
1c79356b | 129 | virtual UInt32 ioRead32( UInt16 offset, IOMemoryMap * map = 0 ); |
1c79356b | 130 | virtual UInt16 ioRead16( UInt16 offset, IOMemoryMap * map = 0 ); |
1c79356b A |
131 | virtual UInt8 ioRead8( UInt16 offset, IOMemoryMap * map = 0 ); |
132 | ||
133 | // Unused Padding | |
134 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 0); | |
135 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 1); | |
136 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 2); | |
137 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 3); | |
138 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 4); | |
139 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 5); | |
140 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 6); | |
141 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 7); | |
142 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 8); | |
143 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 9); | |
144 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 10); | |
145 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 11); | |
146 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 12); | |
147 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 13); | |
148 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 14); | |
149 | OSMetaClassDeclareReservedUnused(IOPCIDevice, 15); | |
150 | }; | |
151 | ||
152 | #endif /* ! _IOKIT_IOPCIDEVICE_H */ |