Skip to content

Commit

Permalink
Version 0.4. More 64-bit changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kasbert committed May 2, 2012
1 parent 2ec0dd4 commit cbeb205
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 44 deletions.
Binary file added SATSMARTDriver-0.4.dmg
Binary file not shown.
2 changes: 1 addition & 1 deletion SATSMARTDriver/IOSATDriver.cpp
Expand Up @@ -490,7 +490,7 @@ org_dungeon_driver_IOSATDriver::Send_ATA_IDENTIFY ( void )
trimcpy(model, (char*)(ataIdentify+kATAIdentifyModelNumber), sizeof(model));

// TODO get from build
IOLog("SATSMARTDriver v0.3: disk serial '%s', revision '%s', model '%s'\n",serial, revision, model);
IOLog("SATSMARTDriver v0.4: disk serial '%s', revision '%s', model '%s'\n",serial, revision, model);
//DEBUG_LOG("capabilities %04x %04x %04x\n",ataIdentify[kATAIdentifyDriveCapabilities],
// ataIdentify[kATAIdentifyDriveCapabilitiesExtended],
// ataIdentify[kATAIdentifyCommandSetSupported]);
Expand Down
56 changes: 33 additions & 23 deletions SATSMARTDriver/UserClient/SATSMARTUserClient.cpp
Expand Up @@ -168,17 +168,17 @@ SATSMARTUserClient::sMethods[kIOATASMARTMethodCount] =
// Method #4 ReadData
0,
( IOMethod ) &SATSMARTUserClient::ReadData,
kIOUCScalarIScalarO,
1,
0
kIOUCStructIStructO,
0,
sizeof ( ATASMARTData )
},
{
// Method #5 ReadDataThresholds
0,
( IOMethod ) &SATSMARTUserClient::ReadDataThresholds,
kIOUCScalarIScalarO,
1,
0
kIOUCStructIStructO,
0,
sizeof ( ATASMARTDataThresholds )
},
{
// Method #6 ReadLogAtAddress
Expand All @@ -192,9 +192,9 @@ SATSMARTUserClient::sMethods[kIOATASMARTMethodCount] =
// Method #7 WriteLogAtAddress
0,
( IOMethod ) &SATSMARTUserClient::WriteLogAtAddress,
kIOUCScalarIStructI,
0,
sizeof ( ATASMARTWriteLogStruct )
kIOUCStructIStructO,
sizeof ( ATASMARTWriteLogStruct ),
0
},
{
// Method #8 GetIdentifyData
Expand Down Expand Up @@ -772,13 +772,18 @@ SATSMARTUserClient::ExecuteOfflineImmediate ( UInt32 extendedTest )
//ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ

IOReturn
SATSMARTUserClient::ReadData ( vm_address_t data )
SATSMARTUserClient::ReadData (UInt32 * dataOut,
IOByteCount * outputSize)
{

IOReturn status = kIOReturnSuccess;
IOSATCommand * command = NULL;
IOMemoryDescriptor * buffer = NULL;
DEBUG_LOG("%s[%p]::%s data = %p\n", getClassName(), this, __FUNCTION__, (void*)data);
IOBufferMemoryDescriptor * buffer = NULL;
DEBUG_LOG("%s[%p]::%s data = %p\n", getClassName(), this, __FUNCTION__, (void*)dataOut);

if (!dataOut, !outputSize || *outputSize != sizeof ( ATASMARTData ) ) {
return kIOReturnBadArgument;
}

fOutstandingCommands++;

Expand All @@ -799,10 +804,7 @@ SATSMARTUserClient::ReadData ( vm_address_t data )
goto ReleaseProvider;
}

buffer = IOMemoryDescriptor::withAddressRange ( data,
sizeof ( ATASMARTData ),
kIODirectionIn,
fTask );
buffer = IOBufferMemoryDescriptor::withCapacity ( sizeof ( ATASMARTData ), kIODirectionIn, false );

if ( buffer == NULL )
{
Expand Down Expand Up @@ -853,6 +855,9 @@ SATSMARTUserClient::ReadData ( vm_address_t data )

}

memcpy(dataOut, buffer->getBytesNoCopy ( ), buffer->getLength());
*outputSize = buffer->getLength();

buffer->complete ( );


Expand Down Expand Up @@ -892,14 +897,19 @@ SATSMARTUserClient::ReadData ( vm_address_t data )
//ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ

IOReturn
SATSMARTUserClient::ReadDataThresholds ( vm_address_t data )
SATSMARTUserClient::ReadDataThresholds (UInt32 * dataOut,
IOByteCount * outputSize)
{

IOReturn status = kIOReturnSuccess;
IOSATCommand * command = NULL;
IOMemoryDescriptor * buffer = NULL;
IOBufferMemoryDescriptor * buffer = NULL;
DEBUG_LOG("%s[%p]::%s\n", getClassName(), this, __FUNCTION__);

if (!dataOut, !outputSize || *outputSize != sizeof ( ATASMARTDataThresholds ) ) {
return kIOReturnBadArgument;
}

fOutstandingCommands++;

if ( isInactive ( ) )
Expand All @@ -921,11 +931,8 @@ SATSMARTUserClient::ReadDataThresholds ( vm_address_t data )

}

buffer = IOMemoryDescriptor::withAddressRange ( data,
sizeof ( ATASMARTDataThresholds ),
kIODirectionIn,
fTask );

buffer = IOBufferMemoryDescriptor::withCapacity ( sizeof ( ATASMARTDataThresholds ), kIODirectionIn, false );

if ( buffer == NULL )
{

Expand Down Expand Up @@ -974,6 +981,9 @@ SATSMARTUserClient::ReadDataThresholds ( vm_address_t data )

}

memcpy(dataOut, buffer->getBytesNoCopy ( ), buffer->getLength());
*outputSize = buffer->getLength();

buffer->complete ( );


Expand Down
6 changes: 4 additions & 2 deletions SATSMARTDriver/UserClient/SATSMARTUserClient.h
Expand Up @@ -91,8 +91,10 @@ IOReturn EnableDisableOperations ( UInt32 enable );
IOReturn EnableDisableAutoSave ( UInt32 enable );
IOReturn ReturnStatus ( UInt32 * exceedsCondition );
IOReturn ExecuteOfflineImmediate ( UInt32 extendedTest );
IOReturn ReadData ( vm_address_t data );
IOReturn ReadDataThresholds ( vm_address_t data );
IOReturn ReadData ( UInt32 * dataOut,
IOByteCount * outputSize );
IOReturn ReadDataThresholds ( UInt32 * dataOut,
IOByteCount * outputSize );
IOReturn ReadLogAtAddress ( ATASMARTReadLogStruct * structIn,
void * structOut,
IOByteCount inStructSize,
Expand Down
34 changes: 18 additions & 16 deletions SATSMARTDriver/UserClientLib/SATSMARTClient.cpp
Expand Up @@ -446,7 +446,7 @@ SATSMARTClient::Start ( CFDictionaryRef propertyTable, io_service_t service )
status = kIOReturnNoDevice;

PRINT ( ( "SATSMARTClient : IOServiceOpen status = 0x%08lx, connection = %d\n",
( UInt32 ) status, fConnection ) );
( long ) status, fConnection ) );

return status;

Expand Down Expand Up @@ -607,14 +607,16 @@ SATSMARTClient::SMARTReadData ( ATASMARTData * data )
{

IOReturn status;
size_t bytesTransferred = sizeof ( ATASMARTData );

PRINT ( ( "SATSMARTClient::SMARTReadData called\n" ) );

status = IOConnectCallScalarMethod ( fConnection,
kIOATASMARTReadData,
( uint64_t * ) &data, 1,
0, 0);

status = IOConnectCallStructMethod ( fConnection,
kIOATASMARTReadData,
( void * ) 0, 0,
data, &bytesTransferred
);

PRINT ( ( "SATSMARTClient::SMARTReadData status = %d\n", status ) );

#if 0
Expand Down Expand Up @@ -652,13 +654,15 @@ SATSMARTClient::SMARTReadDataThresholds ( ATASMARTDataThresholds * data )
{

IOReturn status;
size_t bytesTransferred = sizeof ( ATASMARTDataThresholds );

PRINT ( ( "SATSMARTClient::SMARTReadDataThresholds called\n" ) );

status = IOConnectCallScalarMethod ( fConnection,
kIOATASMARTReadDataThresholds,
( uint64_t * ) &data, 1,
0, 0);
status = IOConnectCallStructMethod ( fConnection,
kIOATASMARTReadDataThresholds,
( void * ) 0, 0,
data, &bytesTransferred
);

PRINT ( ( "SATSMARTClient::SMARTReadDataThresholds status = %d\n", status ) );

Expand Down Expand Up @@ -765,7 +769,7 @@ SATSMARTClient::SMARTReadLogAtAddress ( UInt32 address,
goto Exit;
}

PRINT ( ( "SATSMARTClient::SMARTReadLogAtAddress address = %ld\n", address));
PRINT ( ( "SATSMARTClient::SMARTReadLogAtAddress address = %ld\n",( long )address));

status = IOConnectCallStructMethod ( fConnection,
kIOATASMARTReadLogAtAddress,
Expand Down Expand Up @@ -818,7 +822,7 @@ SATSMARTClient::SMARTWriteLogAtAddress ( UInt32 address,

}

PRINT ( ( "SATSMARTClient::SMARTWriteLogAtAddress address = %ld\n", address ) );
PRINT ( ( "SATSMARTClient::SMARTWriteLogAtAddress address = %ld\n",( long )address ) );

status = IOConnectCallStructMethod ( fConnection,
kIOATASMARTWriteLogAtAddress,
Expand Down Expand Up @@ -867,10 +871,8 @@ SATSMARTClient::GetATAIdentifyData ( void * buffer, UInt32 inSize, UInt32 * outS

status = IOConnectCallStructMethod ( fConnection,
kIOATASMARTGetIdentifyData,
( void * ) 0,
0,
buffer,
&bytesTransferred
( void * ) 0, 0,
buffer, &bytesTransferred
);

if ( outSize != NULL )
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Expand Up @@ -17,7 +17,7 @@ rm -fr satsmartdriver.pkg
size=550
title="SATSMARTDriver"
source=SATSMARTDriver.pkg
finalDMGName=SATSMARTDriver-0.3.dmg
finalDMGName=SATSMARTDriver-0.4.dmg
applicationName=applicationName

#Create a R/W DMG. It must be larger than the result will be. In this example, the bash variable "size" contains the size in Kb and the contents of the folder in the "source" bash variable will be copied into the DMG:
Expand Down Expand Up @@ -74,7 +74,7 @@ exit 0

# Create dmg
VOL="SATSMARTDriver"
VER="0.3"
VER="0.4"
FILES="SATSMARTDriver.pkg"

DMG="tmp-$VOL.dmg"
Expand Down

0 comments on commit cbeb205

Please sign in to comment.