#ifndef __IONDRV__
#define __IONDRV__
#include <IOKit/IORegistryEntry.h>
#include <IOKit/IOInterruptEventSource.h>
#include <IOKit/ndrvsupport/IOMacOSTypes.h>
#include <IOKit/ndrvsupport/IONDRVSupport.h>
#ifndef kAAPLRegEntryIDKey
#define kAAPLRegEntryIDKey "AAPL,RegEntryID"
#endif
#ifndef kAAPLDisableMSIKey
#define kAAPLDisableMSIKey "AAPL,DisableMSI"
#endif
#define MAKE_REG_ENTRY(regEntryID,obj) \
(regEntryID)->opaque[ 0 ] = (void *) obj; \
(regEntryID)->opaque[ 1 ] = (void *) ~(uintptr_t)obj; \
(regEntryID)->opaque[ 2 ] = (void *) 0x53696d65; \
(regEntryID)->opaque[ 3 ] = (void *) 0x52756c7a;
#define REG_ENTRY_TO_OBJ(regEntryID,obj) \
if( (uintptr_t)((obj = ((IORegistryEntry **)regEntryID)[ 0 ])) \
!= ~((uintptr_t *)regEntryID)[ 1 ] ) \
return( -2538);
#define REG_ENTRY_TO_OBJ_RET(regEntryID,obj,ret) \
if( (uintptr_t)((obj = ((IORegistryEntry **)regEntryID)[ 0 ])) \
!= ~((uintptr_t *)regEntryID)[ 1 ] ) \
return( ret);
#define REG_ENTRY_TO_PT(regEntryID,obj) \
IORegistryEntry * obj; \
if( (uintptr_t)((obj = ((IORegistryEntry **)regEntryID)[ 0 ])) \
!= ~((uintptr_t *)regEntryID)[ 1 ] ) \
return( -2538);
#define REG_ENTRY_TO_SERVICE(regEntryID,type,obj) \
IORegistryEntry * regEntry; \
type * obj; \
if( (uintptr_t)((regEntry = ((IORegistryEntry **)regEntryID)[ 0 ])) \
!= ~((uintptr_t *)regEntryID)[ 1 ] ) \
return( -2538); \
if( 0 == (obj = OSDynamicCast( type, regEntry))) \
return( -2542);
class IONDRV : public OSObject
{
OSDeclareAbstractStructors(IONDRV)
public:
virtual IOReturn getSymbol( const char * symbolName,
IOLogicalAddress * address ) = 0;
virtual const char * driverName( void ) = 0;
virtual IOReturn doDriverIO( UInt32 commandID, void * contents,
UInt32 commandCode, UInt32 commandKind ) = 0;
};
#endif