1 2#include <IOKit/IOUserClient.h> 3#include <IOKit/IOBufferMemoryDescriptor.h> 4#include <IOKit/pci/IOPCIDevice.h> 5 6#if IOMEMORYDESCRIPTOR_SUPPORTS_DMACOMMAND 7#include <IOKit/IODMACommand.h> 8#endif 9 10#include "AppleSamplePCIShared.h" 11 12class AppleSamplePCI : public IOService 13{ 14 /* 15 * Declare the metaclass information that is used for runtime 16 * typechecking of IOKit objects. 17 */ 18 19 OSDeclareDefaultStructors( AppleSamplePCI ); 20 21private: 22 IOPCIDevice * fPCIDevice; 23 IOMemoryDescriptor * fLowMemory; 24 25public: 26 /* IOService overrides */ 27 virtual bool start( IOService * provider ); 28 virtual void stop( IOService * provider ); 29 /* Other methods */ 30 IOMemoryDescriptor * copyGlobalMemory( void ); 31 IOReturn generateDMAAddresses( IOMemoryDescriptor * memDesc ); 32}; 33 34class AppleSamplePCIUserClient : public IOUserClient 35{ 36 /* 37 * Declare the metaclass information that is used for runtime 38 * typechecking of IOKit objects. 39 */ 40 41 OSDeclareDefaultStructors( AppleSamplePCIUserClient ); 42 43private: 44 AppleSamplePCI * fDriver; 45 IOBufferMemoryDescriptor * fClientSharedMemory; 46 AppleSampleSharedMemory * fClientShared; 47 task_t fTask; 48 SInt32 fOpenCount; 49 50public: 51 /* IOService overrides */ 52 virtual bool start( IOService * provider ); 53 virtual void stop( IOService * provider ); 54 55 /* IOUserClient overrides */ 56 virtual bool initWithTask( task_t owningTask, void * securityID, 57 UInt32 type, OSDictionary * properties ); 58 virtual IOReturn clientClose( void ); 59 60 virtual IOExternalMethod * getTargetAndMethodForIndex( 61 IOService ** targetP, UInt32 index ); 62 63 virtual IOReturn externalMethod( uint32_t selector, IOExternalMethodArguments * arguments, 64 IOExternalMethodDispatch * dispatch = 0, OSObject * target = 0, void * reference = 0 ); 65 66 67 virtual IOReturn clientMemoryForType( UInt32 type, 68 IOOptionBits * options, 69 IOMemoryDescriptor ** memory ); 70 /* External methods */ 71 virtual IOReturn method1( UInt32 * dataIn, UInt32 * dataOut, 72 IOByteCount inputCount, IOByteCount * outputCount ); 73 virtual IOReturn method2( AppleSampleStructForMethod2 * structIn, 74 AppleSampleResultsForMethod2 * structOut, 75 IOByteCount inputSize, IOByteCount * outputSize ); 76}; 77 78