Also. For 32 bits
CODE
if ( (UInt32) xferDataPtr & 0x01 )
For 64 bits
CODE
if ( (uintptr_t) xferDataPtr & 0x01 )
2. IOMallocContiguous is depricated
Leo codes
CODE
_prdTable = (PRD *) IOMallocContiguous(
/* size */ sizeof(PRD) * kATAMaxDMADesc,
/* align */ 0x10000,
/* phys */ &_prdTablePhysical );
if ( !_prdTable )
{
IOLog("%s: PRD table allocation failed\n", getName());
return false;
}
.........
bool AppleIntelPIIXPATA::freeDMAChannel( void )
{
if ( _prdTable )
{
// make sure the engine is stopped.
stopDMA();
// free the descriptor table.
IOFreeContiguous(_prdTable, sizeof(PRD) * kATAMaxDMADesc);
}
return true;
}
/* size */ sizeof(PRD) * kATAMaxDMADesc,
/* align */ 0x10000,
/* phys */ &_prdTablePhysical );
if ( !_prdTable )
{
IOLog("%s: PRD table allocation failed\n", getName());
return false;
}
.........
bool AppleIntelPIIXPATA::freeDMAChannel( void )
{
if ( _prdTable )
{
// make sure the engine is stopped.
stopDMA();
// free the descriptor table.
IOFreeContiguous(_prdTable, sizeof(PRD) * kATAMaxDMADesc);
}
return true;
}
Snow codes
CODE
_prdBuffer = IOBufferMemoryDescriptor::inTaskWithPhysicalMask(
kernel_task,
kIODirectionInOut | kIOMemoryPhysicallyContiguous,
sizeof(PRD) * kATAMaxDMADesc,
0xFFFF0000UL );
if ( !_prdBuffer )
{
IOLog("%s: PRD buffer allocation failed\n", getName());
return false;
}
_prdBuffer->prepare ( );
_prdTable = (PRD *) _prdBuffer->getBytesNoCopy();
_prdTablePhysical = _prdBuffer->getPhysicalAddress();
............
bool AppleIntelPIIXPATA::freeDMAChannel( void )
{
if ( _prdBuffer )
{
// make sure the engine is stopped.
stopDMA();
// free the descriptor table.
_prdBuffer->complete();
_prdBuffer->release();
_prdBuffer = NULL;
_prdTable = NULL;
_prdTablePhysical = 0;
}
return true;
}
and a new declaration
CODE
#include <IOKit/IOBufferMemoryDescriptor.h>
.........
IOBufferMemoryDescriptor* _prdBuffer;
.........
IOBufferMemoryDescriptor* _prdBuffer;
To be continued.
Please publish your experience





Oct 30 2009, 12:42 PM
