Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Jens Axboe <axboe@kernel.dk>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>
Cc: linux-ide@vger.kernel.org, linux-hwmon@vger.kernel.org,
	smartmontools-support@listi.jpberlin.de,
	linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH v4] libata: Add hwmon support for SMART temperature sensors
Date: Fri, 14 Sep 2018 15:38:36 -0400	[thread overview]
Message-ID: <e669e4ff-a09f-0bfd-4a52-22a5f66487a2@interlog.com> (raw)
In-Reply-To: <1536949216.3531.35.camel@HansenPartnership.com>

On 2018-09-14 02:20 PM, James Bottomley wrote:
> On Thu, 2018-09-13 at 16:22 +0200, Linus Walleij wrote:
> [...]
>> +	/* Send ATA command to read SMART values */
>> +	memset(scsi_cmd, 0, sizeof(scsi_cmd));
>> +	scsi_cmd[0] = ATA_16;
>> +	scsi_cmd[1] = (4 << 1); /* PIO Data-in */
>> +	/*
>> +	 * No off.line or cc, read from dev, block count in sector
>> count
>> +	 * field.
>> +	 */
>> +	scsi_cmd[2] = 0x0e;
>> +	scsi_cmd[4] = ATA_SMART_READ_VALUES;
>> +	scsi_cmd[6] = 1; /* Read 1 sector */
>> +	scsi_cmd[8] = 0; /* args[1]; */
>> +	scsi_cmd[10] = ATA_SMART_LBAM_PASS;
>> +	scsi_cmd[12] = ATA_SMART_LBAH_PASS;
>> +	scsi_cmd[14] = ATA_CMD_SMART;
>> +
>> +	cmd_result = scsi_execute(ata->sdev, scsi_cmd,
>> DMA_FROM_DEVICE,
>> +				  buf, ATA_SECT_SIZE,
>> +				  NULL, &sshdr, 10 * HZ, 5, 0, 0,
>> NULL);
> 
> Given that you're using scsi_execute and this would work on most SAS
> drives as well as SATA ones, why not use the SAS mode pages and we'll
> translate it to SATA in the existing libata-scsi SAT?

Fetch the SCSI Temperature Log page [0xd] with the LOG SENSE SCSI command.
See sat5r01a.pdf chapter 10.3.8 for how that should be translated
to ATA commands by libata and other SATLs.

Doug Gilbert

> That way this can work on all SCSI devices that support SMART not just
> the SATA subset.
> 
> If you can't figure out how to do this initially, then simply
> separating smart from libata is a good first start so we can build on
> it in SCSI as well.
> 
> James
> 
> 

  reply	other threads:[~2018-09-14 19:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-13 14:22 [PATCH v4] libata: Add hwmon support for SMART temperature sensors Linus Walleij
2018-09-14 18:20 ` James Bottomley
2018-09-14 19:38   ` Douglas Gilbert [this message]
2018-09-15 16:38     ` [smartmontools-support] " Christian Franke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e669e4ff-a09f-0bfd-4a52-22a5f66487a2@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=axboe@kernel.dk \
    --cc=b.zolnierkie@samsung.com \
    --cc=jdelvare@suse.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=smartmontools-support@listi.jpberlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox