linux-kernel.vger.kernel.org archive mirror
 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; 8+ 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] 8+ messages in thread

* Re: libata extension
  2007-03-11  7:22 libata extension Vitaliyi
@ 2007-03-11 14:09 ` Bartlomiej Zolnierkiewicz
  2007-03-12 14:47 ` Mark Lord
  1 sibling, 0 replies; 8+ 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] 8+ messages in thread

* Re: libata extension
  2007-03-11  7:22 libata extension Vitaliyi
  2007-03-11 14:09 ` Bartlomiej Zolnierkiewicz
@ 2007-03-12 14:47 ` Mark Lord
       [not found]   ` <3aac340703121003l43685599t8dbffe6247879a91@mail.gmail.com>
  1 sibling, 1 reply; 8+ 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] 8+ messages in thread

* Fwd: libata extension
       [not found]   ` <3aac340703121003l43685599t8dbffe6247879a91@mail.gmail.com>
@ 2007-03-12 17:12     ` Vitaliyi
       [not found]     ` <3aac340703121007q35c7acf7t648e0ed7608be04d@mail.gmail.com>
  1 sibling, 0 replies; 8+ messages in thread
From: Vitaliyi @ 2007-03-12 17:12 UTC (permalink / raw)
  To: linux-kernel

---------- Forwarded message ----------
From: Vitaliyi <imgrey@gmail.com>
Date: Mar 12, 2007 7:03 PM
Subject: Re: libata extension
To: Mark Lord <lkml@rtr.ca>


> 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.

How about soft-reset, is it possible to reach Device Control Register ?
Seems not. I was thinking about patch to libata which allow to use
Control Register.
In the perfect case i would like to be able to execute vendor command
set (reverse engineered).

Is it possible to control timeouts in user space precisely enough and
get rid of unnecessary kernel error messages without touching
syslogd/klogd?

By the way, how to make libata to not probe some ide channel or drive ?

> 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.

Could you please send me this patch once it's ready ?


Thank you

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

* Re: Fwd: libata extension
       [not found]       ` <200703122106.39669.bzolnier@gmail.com>
@ 2007-03-13  2:36         ` Vitaliyi
  2007-03-13 11:23           ` Jeff Garzik
  0 siblings, 1 reply; 8+ messages in thread
From: Vitaliyi @ 2007-03-13  2:36 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-kernel, linux-ide

> Why is the access to Control register needed?

To execute soft reset for example.

> > In the perfect case i would like to be able to execute vendor command
> > set (reverse engineered).
>
> Sounds interesting. :-)
>
> Could you give some more details on what are you going to implement?

Reading/writing service area, uploading, downloading modules, working
with flash etc.

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

* Re: Fwd: libata extension
  2007-03-13  2:36         ` Vitaliyi
@ 2007-03-13 11:23           ` Jeff Garzik
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2007-03-13 11:23 UTC (permalink / raw)
  To: Vitaliyi; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel, linux-ide

Vitaliyi wrote:
>> Why is the access to Control register needed?
> 
> To execute soft reset for example.
> 
>> > In the perfect case i would like to be able to execute vendor command
>> > set (reverse engineered).
>>
>> Sounds interesting. :-)
>>
>> Could you give some more details on what are you going to implement?
> 
> Reading/writing service area, uploading, downloading modules, working
> with flash etc.

SAT (aka ATA passthru) defines how to do soft-reset.

SG_IO supports the ATA_12 and ATA_16 commands which permit soft-reset 
and similar tasks.  libata supports this interface, but does not yet 
support soft-reset and similar non-comment-oriented tasks.  This would 
be the best area to add such features, though.

	Jeff




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

* Re: libata extension
  2007-03-11  8:04 ` Robert Hancock
@ 2007-03-11 13:31   ` Alan Cox
  0 siblings, 0 replies; 8+ 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] 8+ 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; 8+ 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] 8+ messages in thread

end of thread, other threads:[~2007-03-13 11:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-11  7:22 libata extension Vitaliyi
2007-03-11 14:09 ` Bartlomiej Zolnierkiewicz
2007-03-12 14:47 ` Mark Lord
     [not found]   ` <3aac340703121003l43685599t8dbffe6247879a91@mail.gmail.com>
2007-03-12 17:12     ` Fwd: " Vitaliyi
     [not found]     ` <3aac340703121007q35c7acf7t648e0ed7608be04d@mail.gmail.com>
     [not found]       ` <200703122106.39669.bzolnier@gmail.com>
2007-03-13  2:36         ` Vitaliyi
2007-03-13 11:23           ` Jeff Garzik
     [not found] <fa.tUT8ZqaAp2RZveBFqwzUhq3UYGI@ifi.uio.no>
2007-03-11  8:04 ` Robert Hancock
2007-03-11 13:31   ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).