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