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