]>
git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/pci/IOPCIDevice.h
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 #ifndef _IOKIT_IOPCIDEVICE_H
27 #define _IOKIT_IOPCIDEVICE_H
29 #warning IOPCIDevice.h moved to IOPCIFamily project
30 #warning IOPCIDevice.h will be removed from xnu; do not edit or add new usage
32 #include <IOKit/IOService.h>
34 union IOPCIAddressSpace
{
39 unsigned int prefetch
:1;
43 unsigned int busNum
:8;
44 unsigned int deviceNum
:5;
45 unsigned int functionNum
:3;
46 unsigned int registerNum
:8;
47 #elif __LITTLE_ENDIAN__
48 unsigned int registerNum
:8;
49 unsigned int functionNum
:3;
50 unsigned int deviceNum
:5;
51 unsigned int busNum
:8;
55 unsigned int prefetch
:1;
61 class IOPCIDevice
: public IOService
63 OSDeclareDefaultStructors(IOPCIDevice
)
65 friend class IOPCIBridge
;
66 friend class IOPCI2PCIBridge
;
71 OSObject
* slotNameProperty
;
73 struct ExpansionData
{ };
75 ExpansionData
*reserved
;
78 IOPCIAddressSpace space
;
83 virtual bool attach( IOService
* provider
);
84 virtual void detach( IOService
* provider
);
85 virtual IOReturn
setPowerState( unsigned long, IOService
* );
86 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
87 virtual bool matchPropertyTable( OSDictionary
* table
,
89 virtual IOService
* matchLocation( IOService
* client
);
90 virtual IOReturn
getResources( void );
92 /* Config space accessors */
94 virtual UInt32
configRead32( IOPCIAddressSpace space
, UInt8 offset
);
95 virtual void configWrite32( IOPCIAddressSpace space
,
96 UInt8 offset
, UInt32 data
);
97 virtual UInt16
configRead16( IOPCIAddressSpace space
, UInt8 offset
);
98 virtual void configWrite16( IOPCIAddressSpace space
,
99 UInt8 offset
, UInt16 data
);
100 virtual UInt8
configRead8( IOPCIAddressSpace space
, UInt8 offset
);
101 virtual void configWrite8( IOPCIAddressSpace space
,
102 UInt8 offset
, UInt8 data
);
104 virtual UInt32
configRead32( UInt8 offset
);
105 virtual UInt16
configRead16( UInt8 offset
);
106 virtual UInt8
configRead8( UInt8 offset
);
107 virtual void configWrite32( UInt8 offset
, UInt32 data
);
108 virtual void configWrite16( UInt8 offset
, UInt16 data
);
109 virtual void configWrite8( UInt8 offset
, UInt8 data
);
111 virtual IOReturn
saveDeviceState( IOOptionBits options
= 0 );
112 virtual IOReturn
restoreDeviceState( IOOptionBits options
= 0 );
113 virtual UInt32
setConfigBits( UInt8 offset
, UInt32 mask
, UInt32 value
);
115 virtual bool setMemoryEnable( bool enable
);
116 virtual bool setIOEnable( bool enable
, bool exclusive
= false );
117 virtual bool setBusMasterEnable( bool enable
);
118 virtual UInt32
findPCICapability( UInt8 capabilityID
, UInt8
* offset
= 0 );
119 virtual UInt8
getBusNumber( void );
120 virtual UInt8
getDeviceNumber( void );
121 virtual UInt8
getFunctionNumber( void );
122 virtual IODeviceMemory
* getDeviceMemoryWithRegister( UInt8 reg
);
123 virtual IOMemoryMap
* mapDeviceMemoryWithRegister( UInt8 reg
,
124 IOOptionBits options
= 0 );
125 virtual IODeviceMemory
* ioDeviceMemory( void );
126 virtual void ioWrite32( UInt16 offset
, UInt32 value
,
127 IOMemoryMap
* map
= 0 );
128 virtual void ioWrite16( UInt16 offset
, UInt16 value
,
129 IOMemoryMap
* map
= 0 );
130 virtual void ioWrite8( UInt16 offset
, UInt8 value
,
131 IOMemoryMap
* map
= 0 );
132 virtual UInt32
ioRead32( UInt16 offset
, IOMemoryMap
* map
= 0 );
133 virtual UInt16
ioRead16( UInt16 offset
, IOMemoryMap
* map
= 0 );
134 virtual UInt8
ioRead8( UInt16 offset
, IOMemoryMap
* map
= 0 );
137 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 0);
138 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 1);
139 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 2);
140 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 3);
141 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 4);
142 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 5);
143 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 6);
144 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 7);
145 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 8);
146 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 9);
147 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 10);
148 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 11);
149 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 12);
150 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 13);
151 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 14);
152 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 15);
155 #endif /* ! _IOKIT_IOPCIDEVICE_H */