]>
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_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 #ifndef _IOKIT_IOPCIDEVICE_H
30 #define _IOKIT_IOPCIDEVICE_H
32 #warning IOPCIDevice.h moved to IOPCIFamily project
33 #warning IOPCIDevice.h will be removed from xnu; do not edit or add new usage
35 #include <IOKit/IOService.h>
37 union IOPCIAddressSpace
{
42 unsigned int prefetch
:1;
46 unsigned int busNum
:8;
47 unsigned int deviceNum
:5;
48 unsigned int functionNum
:3;
49 unsigned int registerNum
:8;
50 #elif defined(__LITTLE_ENDIAN__)
51 unsigned int registerNum
:8;
52 unsigned int functionNum
:3;
53 unsigned int deviceNum
:5;
54 unsigned int busNum
:8;
58 unsigned int prefetch
:1;
65 class IOPCI2PCIBridge
;
67 class IOPCIDevice
: public IOService
69 OSDeclareDefaultStructors(IOPCIDevice
)
71 friend class IOPCIBridge
;
72 friend class IOPCI2PCIBridge
;
77 OSObject
* slotNameProperty
;
79 struct ExpansionData
{ };
81 ExpansionData
*reserved
;
84 IOPCIAddressSpace space
;
89 virtual bool attach( IOService
* provider
);
90 virtual void detach( IOService
* provider
);
91 virtual IOReturn
setPowerState( unsigned long, IOService
* );
92 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
93 virtual bool matchPropertyTable( OSDictionary
* table
,
95 virtual IOService
* matchLocation( IOService
* client
);
96 virtual IOReturn
getResources( void );
98 /* Config space accessors */
100 virtual UInt32
configRead32( IOPCIAddressSpace space
, UInt8 offset
);
101 virtual void configWrite32( IOPCIAddressSpace space
,
102 UInt8 offset
, UInt32 data
);
103 virtual UInt16
configRead16( IOPCIAddressSpace space
, UInt8 offset
);
104 virtual void configWrite16( IOPCIAddressSpace space
,
105 UInt8 offset
, UInt16 data
);
106 virtual UInt8
configRead8( IOPCIAddressSpace space
, UInt8 offset
);
107 virtual void configWrite8( IOPCIAddressSpace space
,
108 UInt8 offset
, UInt8 data
);
110 virtual UInt32
configRead32( UInt8 offset
);
111 virtual UInt16
configRead16( UInt8 offset
);
112 virtual UInt8
configRead8( UInt8 offset
);
113 virtual void configWrite32( UInt8 offset
, UInt32 data
);
114 virtual void configWrite16( UInt8 offset
, UInt16 data
);
115 virtual void configWrite8( UInt8 offset
, UInt8 data
);
117 virtual IOReturn
saveDeviceState( IOOptionBits options
= 0 );
118 virtual IOReturn
restoreDeviceState( IOOptionBits options
= 0 );
119 virtual UInt32
setConfigBits( UInt8 offset
, UInt32 mask
, UInt32 value
);
121 virtual bool setMemoryEnable( bool enable
);
122 virtual bool setIOEnable( bool enable
, bool exclusive
= false );
123 virtual bool setBusMasterEnable( bool enable
);
124 virtual UInt32
findPCICapability( UInt8 capabilityID
, UInt8
* offset
= 0 );
125 virtual UInt8
getBusNumber( void );
126 virtual UInt8
getDeviceNumber( void );
127 virtual UInt8
getFunctionNumber( void );
128 virtual IODeviceMemory
* getDeviceMemoryWithRegister( UInt8 reg
);
129 virtual IOMemoryMap
* mapDeviceMemoryWithRegister( UInt8 reg
,
130 IOOptionBits options
= 0 );
131 virtual IODeviceMemory
* ioDeviceMemory( void );
132 virtual void ioWrite32( UInt16 offset
, UInt32 value
,
133 IOMemoryMap
* map
= 0 );
134 virtual void ioWrite16( UInt16 offset
, UInt16 value
,
135 IOMemoryMap
* map
= 0 );
136 virtual void ioWrite8( UInt16 offset
, UInt8 value
,
137 IOMemoryMap
* map
= 0 );
138 virtual UInt32
ioRead32( UInt16 offset
, IOMemoryMap
* map
= 0 );
139 virtual UInt16
ioRead16( UInt16 offset
, IOMemoryMap
* map
= 0 );
140 virtual UInt8
ioRead8( UInt16 offset
, IOMemoryMap
* map
= 0 );
143 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 0);
144 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 1);
145 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 2);
146 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 3);
147 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 4);
148 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 5);
149 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 6);
150 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 7);
151 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 8);
152 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 9);
153 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 10);
154 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 11);
155 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 12);
156 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 13);
157 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 14);
158 OSMetaClassDeclareReservedUnused(IOPCIDevice
, 15);
161 #endif /* ! _IOKIT_IOPCIDEVICE_H */