You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ata-sc...@lists.apple.com
I introduced a version of this topic a few months
ago and since then have been following the advice that I received at that
time. I currently have a KEXT with a Client that loads via kextutil. Once
loaded, "ioreg" shows my kext sitting between IOAHCIBlockStorageDevice
and IOBlockStorageDriver, which sits on top of the two WDC hard drives
to which I want to send ATA commands. After loading my kext with client,
I can send commands down to the client using IOConnectCallStructMethod,
and can tnen pass the data and structures to the kext. The kext simply
returns a success to the client and then back up to the app.
My kext sits where I think it should, but I have been
unable to fathom how to link or attach to the lower ecehlons, which I assume
would be the IOBlockStorageDriver. Perhaps my thinking is to Windows-centric
since I've done this same tasks dozens of times on Windows systems, but
when I attempt to take the IOService parameter and use OSDynamicCast to
cast it to an IOATADevice pointer, I get a null returned. In my kext's
attach method I have also attempted to simply cast the IOService* parameter
to a IOATADevice* and then call (IOATADevie*)->getDeviceType(), but
that simply returns kIOReturnUnsupported. I've also attempted to do the
same kind of casting to IOBlockStorageDriver, as well attempted to use
ATADeviceNub, but so far nothing works ... well there have been attempts
the did indeed crash the test machines kernel, requiring a reboot call
from gdb I had running on another Mac.
The kext currently has the following methods defined:
init() start() attach() detach()
My system stats:
2012 MacPro running Mountain Lion 10.8.3
1
TB WDC formatted as Macintosh HDD
1
TB WDC formatted but empty
1
TB WDC FireWire, formatted for alternate boot
Xcode
4.6
MacPorts
2.1.3
Boost
1.52.0
For testing I boot the test machine to the 10.8.3 installed on the FireWire
1 TB drive. I build my code on a development Mac-mini using Xcode 4.6,
copy it to a directory on the test system, and then use "sudo cp -R
myKext.kext /tmp/." to prepare it for kextutil.
HGST stands for Hitachi Global Storage Technologies,
and is currently owned by Western Digital. We really really do want to
be able to talk to our harddrives and other online storage media.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ata-sc...@lists.apple.com
You're not dealing with an IOATADevice.
If I take a look at the IOService plane on my Mac,
IOAHCIDevice (which is an IOService) attaches
-- AppleAHCIDiskDriver (which is an IOAHCIBlockStorageDriver, which is an
IOService), attaches
-- IOAHCIBlockStorageDevice (which is an IOBlockStorageDevice, which is
an IOService)
there's no IOATADevice here. That's why OSDynamicCast returns NULL. If you
cast to IOATADevice* nevertheless, you end up calling a function at some
offset from your pointer, which may or may not crash.
The IOAHCI* headers and sources are not public in the Darwin code.
The AppleAHCIDiskDriver is not intended to be subclassed.
You should ask DTS for help. They may not be able to. People have asked
this question numerous times on various Apple mailing lists and there has
never been an answer.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ata-sc...@lists.apple.com
Hi Gary,
On Feb 14, 2013, at 3:03 PM, Stuart Smith <stu...@elgato.com> wrote:
> You're not dealing with an IOATADevice.
>
> If I take a look at the IOService plane on my Mac,
> IOAHCIDevice (which is an IOService) attaches
> -- AppleAHCIDiskDriver (which is an IOAHCIBlockStorageDriver, which is an
> IOService), attaches
> -- IOAHCIBlockStorageDevice (which is an IOBlockStorageDevice, which is
> an IOService)
>
> there's no IOATADevice here. That's why OSDynamicCast returns NULL. If you
> cast to IOATADevice* nevertheless, you end up calling a function at some
> offset from your pointer, which may or may not crash.
>
> The IOAHCI* headers and sources are not public in the Darwin code.
> The AppleAHCIDiskDriver is not intended to be subclassed.
>
> You should ask DTS for help. They may not be able to. People have asked
> this question numerous times on various Apple mailing lists and there has
> never been an answer.
>
>
> Stuart
Please file a bug report. DTS won't be able to help you here because IOAHCI* is not public API.