Serial attached SCSI driver interface

Hello Experts,
I have a problem with SAS drives while I am trying to get their serial number. I can open the device with CreateFile, but when I send the control code with DeviceIoControl I get the following error: 87 ERROR_INVALID_PARAMETER. I use the IOCTL_SCSI_MINIPORT control code which works fine on SATA and older SCSI drives. If anybody knows which control code should I use or how can I get SAS serial through SDI please let me know.
Thank you in advance!

Try using INQUIRY and MODE SENSE to get this info.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hello Experts,
> I have a problem with SAS drives while I am trying to get their serial
number. I can open the device with CreateFile, but when I send the control code
with DeviceIoControl I get the following error: 87 ERROR_INVALID_PARAMETER. I
use the IOCTL_SCSI_MINIPORT control code which works fine on SATA and older
SCSI drives. If anybody knows which control code should I use or how can I get
SAS serial through SDI please let me know.
> Thank you in advance!
>
>

Thank you for the quick answer! I will give it a try!

Did you mean the IOCTL_SCSI_GET_INQUIRY_DATA command? I wrote a small program which gets the SCSI_INQUIRY_DATA structure but it does not contains the serial number.

IIRC the serial number is either in Vital Product Data INQUIRY (read the
SCSI spec) or some mode page.

You need IOCTL_SCSI_PASS_THROUGH to send the necessary commands.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Did you mean the IOCTL_SCSI_GET_INQUIRY_DATA command? I wrote a small program
which gets the SCSI_INQUIRY_DATA structure but it does not contains the serial
number.
>

Now I send the IOCTL_SCSI_PASS_THROUGH control code with a SCSI_PASS_THROUGH structure. The structure contains the following values: CdbLength = CDB6GENERIC_LENGTH, DataIn = SCSI_IOCTL_DATA_IN, Cdb[0] = SCSIOP_INQUIRY, Cdb[1] = CDB_INQUIRY_EVPD, Cdb[2] = 0x80 (Pagecode). When I call the DeviceIOControl funtion I allways gets error code 87 ERROR_INVALID_PARAMETER. I open the device with CreateFile \.\Scsi0:. Any suggestion?

>I open the device with CreateFile \.\Scsi0:.

Try using \.\PhysicalDrive0 instead


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

If I try with \.\PhysicalDrive0 I can get some drive info from Pagecode 0x00, but I get error code 5 ERROR_ACCESS_DENIED if I want to read the serial from Pagecode 0x80.

Are you an administrator?


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> If I try with \.\PhysicalDrive0 I can get some drive info from Pagecode
0x00, but I get error code 5 ERROR_ACCESS_DENIED if I want to read the serial
from Pagecode 0x80.
>

Of course! Now I can get it to work (don’t get error message) if I don’t read anything from the Pagecode 0x00 before reading the serial from Pagecode 0x80, but the returning buffer doesn’t contain anything. What could be the problem?

I have searched for SCSI mode pages and I have not found mode page with code 0x80, but every sample code on the internet try to get the serial number from there. I don’t understand! In my case I can get only the vendor specific informations.

xxxxx@freemail.hu wrote:

I have searched for SCSI mode pages and I have not found mode page
with code 0x80, but every sample code on the internet try to get the
serial number from there. I don’t understand! In my case I can get
only the vendor specific informations.

Its not a mode page. Thats is an INQUIRY VPD page. In my draft 32 of the
SPC 3standard you can find it docuemented in sections 6.4.4 & 7.6.

Its listed as optional but most devices I’ve encountered (including SAS
devices) do seem to provide a serial number here. VPD page 0 lists the
pages supported by the device so you can find out if the device you are
querying has the serial number page or not.

Mike


Mike Pumford, Senior Software Engineer
MPC Data Limited
e-mail: xxxxx@mpc-data.co.uk web: www.mpc-data.co.uk
tel: +44 (0) 1225 710600 fax: +44 (0) 1225 710601
ddi: +44 (0) 1225 710635

MPC Data Limited is a company registered in England and Wales with
company number 05507446
Registered Address: County Gate, County Way, Trowbridge, Wiltshire,
BA14 7FJ
VAT no: 850625238

The information in this email and in the attached documents is
confidential and may be legally privileged. Any unauthorized review,
copying, disclosure or distribution is prohibited and may be unlawful.
It is intended solely for the addressee. Access to this email by anyone
else is unauthorized. If you are not the intended recipient, please
contact the sender by reply email and destroy all copies of the original
message. When addressed to our clients any opinions or advice contained
in this email is subject to the terms and conditions expressed in the
governing contract.

Have you tried using IOCTL_STORAGE_QUERY_PROPERTY to get the STORAGE_DEVICE_DESCRIPTOR? That should contain the serial number.

-p

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@freemail.hu
Sent: Tuesday, January 29, 2008 5:24 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Serial attached SCSI driver interface

I have searched for SCSI mode pages and I have not found mode page with code 0x80, but every sample code on the internet try to get the serial number from there. I don’t understand! In my case I can get only the vendor specific informations.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Don’t you want page 0x83 data ?
Send an inquiry with evpd enabled and ask for page 0x83
It will return back the device identifier.

Harish

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-313172-
xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, January 29, 2008 10:50 AM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] Serial attached SCSI driver interface

Have you tried using IOCTL_STORAGE_QUERY_PROPERTY to get the
STORAGE_DEVICE_DESCRIPTOR? That should contain the serial number.

-p

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-313124-
xxxxx@lists.osr.com] On Behalf Of xxxxx@freemail.hu
Sent: Tuesday, January 29, 2008 5:24 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Serial attached SCSI driver interface

I have searched for SCSI mode pages and I have not found mode page
with
code 0x80, but every sample code on the internet try to get the serial
number from there. I don’t understand! In my case I can get only the
vendor specific informations.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thank you for everybody! I have read the SPC 3 draft and now I understand the mechanism clearly, but there is a little problem. When I get the supported VPD pages from page 0x00 it seems that my device supports only the 0x83 VPD page (it is a mandatory page like 0x00), and there are no optional VPD pages supported (0x80 needed to get the serial). The 0x83 page does not contain the device serial number so I cannot get it this way.
I will give a try to IOCTL_STORAGE_QUERY_PROPERTY and STORAGE_DEVICE_DESCRIPTOR. Any other idea if it does not work?

xxxxx@freemail.hu wrote:

Thank you for everybody! I have read the SPC 3 draft and now I
understand the mechanism clearly, but there is a little problem. When
I get the supported VPD pages from page 0x00 it seems that my device
supports only the 0x83 VPD page (it is a mandatory page like 0x00),
and there are no optional VPD pages supported (0x80 needed to get the
serial). The 0x83 page does not contain the device serial number so I
cannot get it this way. I will give a try to
IOCTL_STORAGE_QUERY_PROPERTY and STORAGE_DEVICE_DESCRIPTOR. Any other
idea if it does not work?

Well one of the identifiers return from a SAS device in Page 0x83 may
well be the WWN of the device. This is at least a globably unique number
that identifies the device. While not a serial number its almost as good
for identifying the device. It depends what you want to use the serial
number for.

Mike

Mike Pumford, Senior Software Engineer
MPC Data Limited
e-mail: xxxxx@mpc-data.co.uk web: www.mpc-data.co.uk
tel: +44 (0) 1225 710600 fax: +44 (0) 1225 710601
ddi: +44 (0) 1225 710635

MPC Data Limited is a company registered in England and Wales with
company number 05507446
Registered Address: County Gate, County Way, Trowbridge, Wiltshire,
BA14 7FJ
VAT no: 850625238

The information in this email and in the attached documents is
confidential and may be legally privileged. Any unauthorized review,
copying, disclosure or distribution is prohibited and may be unlawful.
It is intended solely for the addressee. Access to this email by anyone
else is unauthorized. If you are not the intended recipient, please
contact the sender by reply email and destroy all copies of the original
message. When addressed to our clients any opinions or advice contained
in this email is subject to the terms and conditions expressed in the
governing contract.