linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* usage of WIN_SMART
@ 2004-11-24  9:54 Jagadeesh Bhaskar P
       [not found] ` <8783be6604112611137bcbfb61@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Jagadeesh Bhaskar P @ 2004-11-24  9:54 UTC (permalink / raw)
  To: LKML

I have seen SMART system's code containing WIN_SMART directive in ioctl
sprinkled through out the code? What does that mean? What is its proper
usage? Is there a proper documentation for it?

Thanks in advance for all replies

-- 
With regards,

Jagadeesh Bhaskar P


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

* Re: usage of WIN_SMART
       [not found] ` <8783be6604112611137bcbfb61@mail.gmail.com>
@ 2004-11-30  0:05   ` Edward Falk
  2004-11-30  3:10     ` Jagadeesh Bhaskar P
  0 siblings, 1 reply; 4+ messages in thread
From: Edward Falk @ 2004-11-30  0:05 UTC (permalink / raw)
  To: LKML, Jagadeesh Bhaskar P


> I have seen SMART system's code containing WIN_SMART directive in ioctl
> sprinkled through out the code? What does that mean? What is its proper
> usage? Is there a proper documentation for it?
> 
> Thanks in advance for all replies

Hi Jagadeesh; I'm not entirely sure what your question is, so I'll see 
if I can provide a vague enough answer to cover it :)

Executive summary:  The SMART data is used to obtain information about 
the state of the drive hardware, for the purpose of predicting or 
diagnosing failures.  What little documentation there is exists in the 
ATA/ATAPI specification, but most of the data is vendor-specific and 
undocumented.  The easiest way to access SMART data is by cat'ing the 
appropriate file in /proc/ide/hdX




Long answer:

Many (all?) modern disk drives provide what is known as "SMART" 
(Self-Monitoring, Analysis, and Reporting Technology) data.  This 
includes information about the performance of the drive, including how 
many errors the drive has corrected, what the drive temperature has 
been, and so on.  The WIN_SMART command has a number of sub-commands 
(specified through the features register), which are described in the 
ATA spec under "Command descriptions".

AFAIK, there are no ioctls directly corresponding to the SMART commands, 
but the SMART commands can be accessed via the HDIO_DRIVE_TASKFILE 
ioctl.  (NOTE:  do not attempt this without a copy of the ATA spec in 
front of you.)

An even easier way to obtain the SMART data is to cat 
/proc/ide/hdX/smart_values or /proc/ide/hdX/smart_thresholds.

(At Google, we've added "smart_logs" and "smart_status" entries to 
/proc.  We'll be submitting those patches Real Soon Now.)

The interesting SMART subcommands are:

SMART READ DATA

   Read and return the 512-byte SMART data structure.
   The ATA spec describes this structure, but most of the
   interesting fields are vendor-specific.  Several of the
   vendors have adopted a number of common data fields,
   such as spinup time, reallocation count, seek error
   rate, and so on.  In general though, the information is
   really private to the vendor, intended for the vendor
   to diagnose the drive.

SMART READ LOG

   Returns one of a number of available logs, including log
   directory, summary error log, comprehensive error log,
   and so on, including a few vendor-specific logs.

SMART WRITE LOG

   Write data to a log.

SMART RETURN STATUS

   Returns a simple yes/no status indicating whether or
   not any of the device's thresholds have been exceeded.



I hope this helps answer your questions.

	-ed falk

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

* Re: usage of WIN_SMART
  2004-11-30  0:05   ` Edward Falk
@ 2004-11-30  3:10     ` Jagadeesh Bhaskar P
  2004-11-30 14:31       ` Ross Biro
  0 siblings, 1 reply; 4+ messages in thread
From: Jagadeesh Bhaskar P @ 2004-11-30  3:10 UTC (permalink / raw)
  To: Edward Falk; +Cc: LKML

Dear Edward,
	I am grateful for such a descriptive reply. I was exploring through the
ide-disk driver interface, which provides the SMART readings through the
ioctl, using WIN_SMART. At the end its calling an inb and an outb to the
regs, like u said, feature regs and all. Is it possible to do it
directly with an inb and outb from a C program, avoiding the
complexities involved in the WIN_SMART command.

And, can u help me out with the syntax of WIN_SMART class of ioctl?
I know that a buffer like

	buffer = {WIN_SMART, 0, SMART_READ_VALUES, 1};
and it is passed to the ioctl.

I have seen the significance of 1st element(WIN_SMART) and 3rd element
(SMART_READ_VALUES) in the ide-disk module's code.

What does the second argument and the fourth argument signify?


Can u help me with this also, coz I've been digging for this a long
time, and haven't been that successfull!!




-- 
Thanks & Regards,

Jagadeesh Bhaskar P
R&D Engineer
HCL Infosystems Ltd
Pondicherry
INDIA


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

* Re: usage of WIN_SMART
  2004-11-30  3:10     ` Jagadeesh Bhaskar P
@ 2004-11-30 14:31       ` Ross Biro
  0 siblings, 0 replies; 4+ messages in thread
From: Ross Biro @ 2004-11-30 14:31 UTC (permalink / raw)
  To: Jagadeesh Bhaskar P; +Cc: Edward Falk, LKML

As Ed said, you need the ATA spec to make sense of all that. 
Fortunately, a draft copy is available online at t13.org.  In
particular at http://www.t13.org/#Project_drafts  The docs will
explain the register settings, but not the meanings of the output.

You can avoid the driver is you wish, but it's a really bad idea to do
so since you will change the state of the drive when the driver is not
expecting it.  To safely access the drive from user space, you would
have to make sure the driver is disabled, disable interrupts, and then
poll the controller directly.  The exact method would of course be
controller specific.  You need to look at the ioperm man page and
/dev/port.

Finally, if all you want to do is access the SMART data, you should
look at smartsuite http://sourceforge.net/projects/smartsuite/  or
something similiar.  It already includes much of the vendor specific
information and knows how to get along with the kernel.

    Ross


On Tue, 30 Nov 2004 08:40:40 +0530, Jagadeesh Bhaskar P
<jbhaskar@hclinsys.com> wrote:
> Dear Edward,
>         I am grateful for such a descriptive reply. I was exploring through the
> ide-disk driver interface, which provides the SMART readings through the
> ioctl, using WIN_SMART. At the end its calling an inb and an outb to the
> regs, like u said, feature regs and all. Is it possible to do it
> directly with an inb and outb from a C program, avoiding the
> complexities involved in the WIN_SMART command.
> 
> And, can u help me out with the syntax of WIN_SMART class of ioctl?
> I know that a buffer like
> 
>         buffer = {WIN_SMART, 0, SMART_READ_VALUES, 1};
> and it is passed to the ioctl.
> 
> I have seen the significance of 1st element(WIN_SMART) and 3rd element
> (SMART_READ_VALUES) in the ide-disk module's code.
> 
> What does the second argument and the fourth argument signify?
> 
> Can u help me with this also, coz I've been digging for this a long
> time, and haven't been that successfull!!
> 
> --
> Thanks & Regards,
> 
> Jagadeesh Bhaskar P
> R&D Engineer
> HCL Infosystems Ltd
> Pondicherry
> INDIA
> 
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

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

end of thread, other threads:[~2004-11-30 14:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-24  9:54 usage of WIN_SMART Jagadeesh Bhaskar P
     [not found] ` <8783be6604112611137bcbfb61@mail.gmail.com>
2004-11-30  0:05   ` Edward Falk
2004-11-30  3:10     ` Jagadeesh Bhaskar P
2004-11-30 14:31       ` Ross Biro

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