]>
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 * 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.
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
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 #ifndef _IOKIT_IOPCIDEVICE_H
24 #define _IOKIT_IOPCIDEVICE_H
26 #warning IOPCIDevice.h moved to IOPCIFamily project
27 #warning IOPCIDevice.h will be removed from xnu; do not edit or add new usage
29 #include <IOKit/IOService.h>
31 union IOPCIAddressSpace
{
36 unsigned int prefetch
:1;
40 unsigned int busNum
:8;
41 unsigned int deviceNum
:5;
42 unsigned int functionNum
:3;
43 unsigned int registerNum
:8;
44 #elif defined(__LITTLE_ENDIAN__)
45 unsigned int registerNum
:8;
46 unsigned int functionNum
:3;
47 unsigned int deviceNum
:5;
48 unsigned int busNum
:8;
52 unsigned int prefetch
:1;
58 class IOPCIDevice
: public IOService
60 OSDeclareDefaultStructors(IOPCIDevice
)
62 friend class IOPCIBridge
;
63 friend class IOPCI2PCIBridge
;
68 OSObject
* slotNameProperty
;
70 struct ExpansionData
{ };
72 ExpansionData
*reserved
;
75 IOPCIAddressSpace space
;
80 virtual bool attach( IOService
* provider
);
81 virtual void detach( IOService
* provider
);
82 virtual IOReturn
setPowerState( unsigned long, IOService
* );
83 virtual bool compareName( OSString
* name
, OSString
** matched
= 0 ) const;
84 virtual bool matchPropertyTable( OSDictionary
* table
,
86 virtual IOService
* matchLocation( IOService
* client
);
87 virtual IOReturn
getResources( void );
89 /* Config space accessors */
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
);
101 virtual UInt32
configRead32( UInt8 offset
);
102 virtual UInt16
configRead16( UInt8 offset
);
103 virtual UInt8
configRead8( UInt8 offset
);
104 virtual void configWrite32( UInt8 offset
, UInt32 data
);
105 virtual void configWrite16( UInt8 offset
, UInt16 data
);
106 virtual void configWrite8( UInt8 offset
, UInt8 data
);
108 virtual IOReturn
saveDeviceState( IOOptionBits options
= 0 );
109 virtual IOReturn
restoreDeviceState( IOOptionBits options
= 0 );
110 virtual UInt32
setConfigBits( UInt8 offset
, UInt32 mask
, UInt32 value
);
112 virtual bool setMemoryEnable( bool enable
);
113 virtual bool setIOEnable( bool enable
, bool exclusive
= false );
114 virtual bool setBusMasterEnable( bool enable
);
115 virtual UInt32
findPCICapability( UInt8 capabilityID
, UInt8
* offset
= 0 );
116 virtual UInt8
getBusNumber( void );
117 virtual UInt8
getDeviceNumber( void );
118 virtual UInt8
getFunctionNumber( void );
119 virtual IODeviceMemory
* getDeviceMemoryWithRegister( UInt8 reg
);
120 virtual IOMemoryMap
* mapDeviceMemoryWithRegister( UInt8 reg
,
121 IOOptionBits options
= 0 );
122 virtual IODeviceMemory
* ioDeviceMemory( void );
123 virtual void ioWrite32( UInt16 offset
, UInt32 value
,
124 IOMemoryMap
* map
= 0 );
125 virtual void ioWrite16( UInt16 offset
, UInt16 value
,
126 IOMemoryMap
* map
= 0 );
127 virtual void ioWrite8( UInt16 offset
, UInt8 value
,
128 IOMemoryMap
* map
= 0 );
129 virtual UInt32
ioRead32( UInt16 offset
, IOMemoryMap
* map
= 0 );
130 virtual UInt16
ioRead16( UInt16 offset
, IOMemoryMap
* map
= 0 );
131 virtual UInt8
ioRead8( UInt16 offset
, IOMemoryMap
* map
= 0 );
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);
152 #endif /* ! _IOKIT_IOPCIDEVICE_H */