X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/43866e378188c25dd1e2208016ab3cbeb086ae6c..55e303ae13a4cf49d70f2294092726f2fffb9ef2:/iokit/IOKit/IOLib.h diff --git a/iokit/IOKit/IOLib.h b/iokit/IOKit/IOLib.h index 74757b7d1..3c42748a7 100644 --- a/iokit/IOKit/IOLib.h +++ b/iokit/IOKit/IOLib.h @@ -36,6 +36,8 @@ #error IOLib.h is for kernel use only #endif +#include + #include #include @@ -46,9 +48,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif +__BEGIN_DECLS #include #include @@ -146,6 +146,78 @@ void IOFreePageable(void * address, vm_size_t size); #define IONew(type,number) (type*)IOMalloc(sizeof(type) * (number) ) #define IODelete(ptr,type,number) IOFree( (ptr) , sizeof(type) * (number) ) +///////////////////////////////////////////////////////////////////////////// +// +// +// These functions are now implemented in IOMapper.cpp +// +// +///////////////////////////////////////////////////////////////////////////// + +/*! @function IOMappedRead8 + @abstract Read one byte from the desired "Physical" IOSpace address. + @discussion Read one byte from the desired "Physical" IOSpace address. This function allows the developer to read an address returned from any memory descriptor's getPhysicalSegment routine. It can then be used by segmenting a physical page slightly to tag the physical page with its kernel space virtual address. + @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment. + @result Data contained at that location */ + +UInt8 IOMappedRead8(IOPhysicalAddress address); + +/*! @function IOMappedRead16 + @abstract Read two bytes from the desired "Physical" IOSpace address. + @discussion Read two bytes from the desired "Physical" IOSpace address. This function allows the developer to read an address returned from any memory descriptor's getPhysicalSegment routine. It can then be used by segmenting a physical page slightly to tag the physical page with its kernel space virtual address. + @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment. + @result Data contained at that location */ + +UInt16 IOMappedRead16(IOPhysicalAddress address); + +/*! @function IOMappedRead32 + @abstract Read four bytes from the desired "Physical" IOSpace address. + @discussion Read four bytes from the desired "Physical" IOSpace address. This function allows the developer to read an address returned from any memory descriptor's getPhysicalSegment routine. It can then be used by segmenting a physical page slightly to tag the physical page with its kernel space virtual address. + @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment. + @result Data contained at that location */ + +UInt32 IOMappedRead32(IOPhysicalAddress address); + +/*! @function IOMappedRead64 + @abstract Read eight bytes from the desired "Physical" IOSpace address. + @discussion Read eight bytes from the desired "Physical" IOSpace address. This function allows the developer to read an address returned from any memory descriptor's getPhysicalSegment routine. It can then be used by segmenting a physical page slightly to tag the physical page with its kernel space virtual address. + @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment. + @result Data contained at that location */ + +UInt64 IOMappedRead64(IOPhysicalAddress address); + +/*! @function IOMappedWrite8 + @abstract Write one byte to the desired "Physical" IOSpace address. + @discussion Write one byte to the desired "Physical" IOSpace address. This function allows the developer to write to an address returned from any memory descriptor's getPhysicalSegment routine. + @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment. + @param value Data to be writen to the desired location */ + +void IOMappedWrite8(IOPhysicalAddress address, UInt8 value); + +/*! @function IOMappedWrite16 + @abstract Write two bytes to the desired "Physical" IOSpace address. + @discussion Write two bytes to the desired "Physical" IOSpace address. This function allows the developer to write to an address returned from any memory descriptor's getPhysicalSegment routine. + @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment. + @param value Data to be writen to the desired location */ + +void IOMappedWrite16(IOPhysicalAddress address, UInt16 value); + +/*! @function IOMappedWrite32 + @abstract Write four bytes to the desired "Physical" IOSpace address. + @discussion Write four bytes to the desired "Physical" IOSpace address. This function allows the developer to write to an address returned from any memory descriptor's getPhysicalSegment routine. + @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment. + @param value Data to be writen to the desired location */ + +void IOMappedWrite32(IOPhysicalAddress address, UInt32 value); + +/*! @function IOMappedWrite64 + @abstract Write eight bytes to the desired "Physical" IOSpace address. + @discussion Write eight bytes to the desired "Physical" IOSpace address. This function allows the developer to write to an address returned from any memory descriptor's getPhysicalSegment routine. + @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment. + @param value Data to be writen to the desired location */ + +void IOMappedWrite64(IOPhysicalAddress address, UInt64 value); + /*! @function IOSetProcessorCacheMode @abstract Sets the processor cache mode for mapped memory. @discussion This function sets the cache mode of an already mapped & wired memory range. Note this may not be supported on I/O mappings or shared memory - it is far preferable to set the cache mode as mappings are created with the IOMemoryDescriptor::map method. @@ -292,8 +364,6 @@ extern mach_timespec_t IOZeroTvalspec; #endif /* __APPLE_API_OBSOLETE */ -#ifdef __cplusplus -} /* extern "C" */ -#endif +__END_DECLS #endif /* !__IOKIT_IOLIB_H */