public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* libata extension
@ 2007-03-11  7:22 Vitaliyi
  2007-03-11 14:09 ` Bartlomiej Zolnierkiewicz
  2007-03-12 14:47 ` Mark Lord
  0 siblings, 2 replies; 5+ messages in thread
From: Vitaliyi @ 2007-03-11  7:22 UTC (permalink / raw)
  To: linux-kernel

Good Day

Say i want to implement extended set of ATA commands available to
userspace for building diagnostic tools.
I need 0x40 -- read verify and 0x32 -- write long with error handling,
for example. I was trying ide driver through ioctl's, but seems it
lack of functionality and full of gotchas. Furthermore it oopses
sometimes.

Is it possible to use libata for such purpose or i need to write
separate IDE driver ?
By the way, i'm sure it should be done in kernel space since i'm going
to deal with some hdd manufacturer commands.

P.S. I was looking through libata and ide sources and documentation
but still dont have broad picture.


Thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libata extension
       [not found] <fa.tUT8ZqaAp2RZveBFqwzUhq3UYGI@ifi.uio.no>
@ 2007-03-11  8:04 ` Robert Hancock
  2007-03-11 13:31   ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Hancock @ 2007-03-11  8:04 UTC (permalink / raw)
  To: Vitaliyi; +Cc: linux-kernel

Vitaliyi wrote:
> Good Day
> 
> Say i want to implement extended set of ATA commands available to
> userspace for building diagnostic tools.
> I need 0x40 -- read verify and 0x32 -- write long with error handling,
> for example. I was trying ide driver through ioctl's, but seems it
> lack of functionality and full of gotchas. Furthermore it oopses
> sometimes.
> 
> Is it possible to use libata for such purpose or i need to write
> separate IDE driver ?
> By the way, i'm sure it should be done in kernel space since i'm going
> to deal with some hdd manufacturer commands.
> 
> P.S. I was looking through libata and ide sources and documentation
> but still dont have broad picture.

I believe you should be able to do this by sending ATA pass-through SCSI 
commands into the device using SG_IO, without any kernel changes. It's 
really the mechanism that's meant for this..

-- 
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libata extension
  2007-03-11  8:04 ` libata extension Robert Hancock
@ 2007-03-11 13:31   ` Alan Cox
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2007-03-11 13:31 UTC (permalink / raw)
  To: Robert Hancock; +Cc: Vitaliyi, linux-kernel

> I believe you should be able to do this by sending ATA pass-through SCSI 
> commands into the device using SG_IO, without any kernel changes. It's 
> really the mechanism that's meant for this..

It should work, but Mark Lord reported some problems with READ_LONG on
PIIX/ICH intel chipsets. I don't know if he ever resolved them but if not
I have a patch that ought to.

Alan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libata extension
  2007-03-11  7:22 Vitaliyi
@ 2007-03-11 14:09 ` Bartlomiej Zolnierkiewicz
  2007-03-12 14:47 ` Mark Lord
  1 sibling, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-03-11 14:09 UTC (permalink / raw)
  To: Vitaliyi; +Cc: linux-kernel


Hi,

On Sunday 11 March 2007, Vitaliyi wrote:
> Good Day
> 
> Say i want to implement extended set of ATA commands available to
> userspace for building diagnostic tools.
> I need 0x40 -- read verify and 0x32 -- write long with error handling,

Mark Lord is working on READ/WRITE_LONG support for libata,
he has posted draft patch recently on linux-ide mailing list.

[ Please consider reading/joining linux-ide@vger.kernel.org ML,
  it is where Linux ATA discussion happens... ]

> for example. I was trying ide driver through ioctl's, but seems it
> lack of functionality and full of gotchas. Furthermore it oopses
> sometimes.

READ/WRITE_LONG is unsupported and as you've already noticed
TASKFILE ioctls are full of gotchas...

> Is it possible to use libata for such purpose or i need to write
> separate IDE driver ?

It should be possible using ATA pass-through, some libata changes
may be required but it is the right way to go IMO.

Bart

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libata extension
  2007-03-11  7:22 Vitaliyi
  2007-03-11 14:09 ` Bartlomiej Zolnierkiewicz
@ 2007-03-12 14:47 ` Mark Lord
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Lord @ 2007-03-12 14:47 UTC (permalink / raw)
  To: Vitaliyi; +Cc: linux-kernel, IDE/ATA development list

Vitaliyi wrote:
> Good Day
> 
> Say i want to implement extended set of ATA commands available to
> userspace for building diagnostic tools.
> I need 0x40 -- read verify and 0x32 -- write long with error handling,
> for example. I was trying ide driver through ioctl's, but seems it
> lack of functionality and full of gotchas. Furthermore it oopses
> sometimes.

Use the SCSI SG_IO ioctl() with opcode=ATA_16,
which gives you access to the ATA Passthrough mechanism.
This will work for most ATA commands.

I already use it in hdparm and in some other utilities
for scanning/repairing drives.

A notable exeception are the READ/WRITE LONG opcodes,
which require an extra kernel patch from me,
awaiting merge into libata some year.

Cheers

-ml

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-03-12 14:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <fa.tUT8ZqaAp2RZveBFqwzUhq3UYGI@ifi.uio.no>
2007-03-11  8:04 ` libata extension Robert Hancock
2007-03-11 13:31   ` Alan Cox
2007-03-11  7:22 Vitaliyi
2007-03-11 14:09 ` Bartlomiej Zolnierkiewicz
2007-03-12 14:47 ` Mark Lord

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox