Hi,

I need to send various SCSI commands to a SAS disk enclosure connected with
LSI SCSI HBA. I read the SPTI sample in DDK and realize I need to use
CreateFile with device name such as \\.\PhysicalDrive0, \\.\scsi1: to get a
handle of the device and then use the handle in the SCSI_PASS_THROUGH IOCTL
call to send SCSI command to the specific SCSI device. But I could not find
the name for the SAS Disk Enclosure. Can anyone give me a hint on the disk
enclosure name and how to discover a disk enclosure?

Thanks,

Ken

Re: SCSI Pass Through to SAS Enclosure by Maxim

Maxim
Fri Mar 21 18:38:14 CDT 2008

Enumerate all physical disks by SetupDiGetClassDevs, open them, send
IOCTL_SCSI_GET_INQUIRY_DATA (or SCSIOP_INQUIRY via SPTI), and get the vendor
name of your enclosure.

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

"KenH" <KenHwang@newsgroup.nospam> wrote in message
news:19C229A9-D772-46A6-8FFA-A2BEA84202E7@microsoft.com...
> Hi,
>
> I need to send various SCSI commands to a SAS disk enclosure connected with
> LSI SCSI HBA. I read the SPTI sample in DDK and realize I need to use
> CreateFile with device name such as \\.\PhysicalDrive0, \\.\scsi1: to get a
> handle of the device and then use the handle in the SCSI_PASS_THROUGH IOCTL
> call to send SCSI command to the specific SCSI device. But I could not find
> the name for the SAS Disk Enclosure. Can anyone give me a hint on the disk
> enclosure name and how to discover a disk enclosure?
>
> Thanks,
>
> Ken


RE: SCSI Pass Through to SAS Enclosure by KenHwang

KenHwang
Fri Mar 21 19:50:00 CDT 2008

Maxim,

Thanks but I didn't get it. As I learned from the ddk spti sample I will
need to use the device name in the CreateFile function call to get the
Windows handle. And then use the handle in the SCSI_PASS_THROUGH,
SCSIOP_INQUIRY IOCTL to get the Inquiry data back. You mentioned get the
enclosure name from the Inquiry data. But I'll need the device name first in
order to use the IOCTL. Or you're talking about discovering? Am I missing
something?

Ken

"KenH" wrote:

> Hi,
>
> I need to send various SCSI commands to a SAS disk enclosure connected with
> LSI SCSI HBA. I read the SPTI sample in DDK and realize I need to use
> CreateFile with device name such as \\.\PhysicalDrive0, \\.\scsi1: to get a
> handle of the device and then use the handle in the SCSI_PASS_THROUGH IOCTL
> call to send SCSI command to the specific SCSI device. But I could not find
> the name for the SAS Disk Enclosure. Can anyone give me a hint on the disk
> enclosure name and how to discover a disk enclosure?
>
> Thanks,
>
> Ken

Re: SCSI Pass Through to SAS Enclosure by Maxim

Maxim
Fri Mar 21 20:28:16 CDT 2008

What I suggest is to list all disk names in the system by
SetupDiGetClassDevs/SetupDiEnumDeviceInterfaces/SetupDiGetDeviceInterfaceDetail
, open each and then determine which of them is your enclosure.

You can also enumerate \\.\PhysicalDrive%d incrementing the counter, but
this is lesser correct.

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

"KenH" <KenHwang@newsgroup.nospam> wrote in message
news:3D2B345D-EB52-4CF6-8CD2-5D30923339FB@microsoft.com...
> Maxim,
>
> Thanks but I didn't get it. As I learned from the ddk spti sample I will
> need to use the device name in the CreateFile function call to get the
> Windows handle. And then use the handle in the SCSI_PASS_THROUGH,
> SCSIOP_INQUIRY IOCTL to get the Inquiry data back. You mentioned get the
> enclosure name from the Inquiry data. But I'll need the device name first in
> order to use the IOCTL. Or you're talking about discovering? Am I missing
> something?
>
> Ken
>
> "KenH" wrote:
>
> > Hi,
> >
> > I need to send various SCSI commands to a SAS disk enclosure connected with
> > LSI SCSI HBA. I read the SPTI sample in DDK and realize I need to use
> > CreateFile with device name such as \\.\PhysicalDrive0, \\.\scsi1: to get a
> > handle of the device and then use the handle in the SCSI_PASS_THROUGH IOCTL
> > call to send SCSI command to the specific SCSI device. But I could not find
> > the name for the SAS Disk Enclosure. Can anyone give me a hint on the disk
> > enclosure name and how to discover a disk enclosure?
> >
> > Thanks,
> >
> > Ken


Re: SCSI Pass Through to SAS Enclosure by Gary

Gary
Mon Mar 24 11:51:15 CDT 2008

Ken,

You may not have the granularity you need to acquire what you need using
standard SCSI pass through. To get and manage the enclosure, you need to
send an LSI MPI formatted message to the IOC, and there is no way, that I
know of, via standard pass through to do that. If you have the MPI 1.5.4
spec you will see the mesasages you need in the IOC Config section detailing
the messages that you need to send to the IOC. There are only two ways I
know of that you can send those messages to the IOC: 1. write your own port
driver, not recommended. 2. use the "back door", IOCTL_SCSI_MINIPORT. #2
allows you to send any formatted MPI message to the IOC and get the IOC
reply back in your application. To use that "back door" you must go to your
LSI rep and get their specifications and development kit.

It is doable. I currently use both 1 and 2 for a hard drive diagnostic
application.

--
The personal opinion of
Gary G. Little


"KenH" <KenHwang@newsgroup.nospam> wrote in message
news:19C229A9-D772-46A6-8FFA-A2BEA84202E7@microsoft.com...
> Hi,
>
> I need to send various SCSI commands to a SAS disk enclosure connected
> with
> LSI SCSI HBA. I read the SPTI sample in DDK and realize I need to use
> CreateFile with device name such as \\.\PhysicalDrive0, \\.\scsi1: to get
> a
> handle of the device and then use the handle in the SCSI_PASS_THROUGH
> IOCTL
> call to send SCSI command to the specific SCSI device. But I could not
> find
> the name for the SAS Disk Enclosure. Can anyone give me a hint on the disk
> enclosure name and how to discover a disk enclosure?
>
> Thanks,
>
> Ken



Re: SCSI Pass Through to SAS Enclosure by KenHwang

KenHwang
Mon Mar 24 18:34:01 CDT 2008

Gary,

Thanks and that's what I am afraid of. Because the program I'm working on
needs to work with multiple vendors HBA/Enclosure. By using LSI MPI then I'll
need to re-write for other vendors due to they have different SDK. That's why
I'm trying to find a single solution for multiple vendors product. But it
seems like I may not be able to save the effort. Or I have a wrong assumption?

Thanks,

Ken

"Gary G. Little" wrote:

> Ken,
>
> You may not have the granularity you need to acquire what you need using
> standard SCSI pass through. To get and manage the enclosure, you need to
> send an LSI MPI formatted message to the IOC, and there is no way, that I
> know of, via standard pass through to do that. If you have the MPI 1.5.4
> spec you will see the mesasages you need in the IOC Config section detailing
> the messages that you need to send to the IOC. There are only two ways I
> know of that you can send those messages to the IOC: 1. write your own port
> driver, not recommended. 2. use the "back door", IOCTL_SCSI_MINIPORT. #2
> allows you to send any formatted MPI message to the IOC and get the IOC
> reply back in your application. To use that "back door" you must go to your
> LSI rep and get their specifications and development kit.
>
> It is doable. I currently use both 1 and 2 for a hard drive diagnostic
> application.
>
> --
> The personal opinion of
> Gary G. Little
>
>
> "KenH" <KenHwang@newsgroup.nospam> wrote in message
> news:19C229A9-D772-46A6-8FFA-A2BEA84202E7@microsoft.com...
> > Hi,
> >
> > I need to send various SCSI commands to a SAS disk enclosure connected
> > with
> > LSI SCSI HBA. I read the SPTI sample in DDK and realize I need to use
> > CreateFile with device name such as \\.\PhysicalDrive0, \\.\scsi1: to get
> > a
> > handle of the device and then use the handle in the SCSI_PASS_THROUGH
> > IOCTL
> > call to send SCSI command to the specific SCSI device. But I could not
> > find
> > the name for the SAS Disk Enclosure. Can anyone give me a hint on the disk
> > enclosure name and how to discover a disk enclosure?
> >
> > Thanks,
> >
> > Ken
>
>
>

Re: SCSI Pass Through to SAS Enclosure by Gary

Gary
Tue Mar 25 11:33:42 CDT 2008

No, you basically have the right assumption.

Every vendor may or may not support the IOCTL_SCSI_MINIPORT, and if they do
you have to go to them to get the information you need. However, that said
... there is a lot of commonality. For instance, SRB_IO_CONTROL is fixed as
to format. You need specific vendor information for two fields within that
structure, but handling it and passing it to a DeviceIoControl call won't
change from vendor to vendor. The fact that it is the header portion of the
total buffer you send via that interface won't change. Thus all you really
need is a class that defines the common header and then overloads the
methods needed to build the vendor control area and the data portion. Don't
expect blinding speed since you are not going to define really huge buffers
since your using METHOD_BUFFERED and everything gets copied. However, for
mode pages, IOC control config for LSI, or another vendors control and
config, the speed is going to be negligible since your dealing with less
than 1 page. For most mode pages, you should be using the system defined
IOCTLs or at a minimum standard pass through. The backdoor lets you control
a RAID, look at a disc in a RAID, or do what you want to do which is look at
or control the SAS topology using a specific set of LSI messages to the IOC.

--
The personal opinion of
Gary G. Little

"KenH" <KenHwang@newsgroup.nospam> wrote in message
news:98AE2A2D-C715-4579-8976-C45F90A18A4B@microsoft.com...
> Gary,
>
> Thanks and that's what I am afraid of. Because the program I'm working on
> needs to work with multiple vendors HBA/Enclosure. By using LSI MPI then
> I'll
> need to re-write for other vendors due to they have different SDK. That's
> why
> I'm trying to find a single solution for multiple vendors product. But it
> seems like I may not be able to save the effort. Or I have a wrong
> assumption?
>
> Thanks,
>
> Ken
>
> "Gary G. Little" wrote:
>
>> Ken,
>>
>> You may not have the granularity you need to acquire what you need using
>> standard SCSI pass through. To get and manage the enclosure, you need to
>> send an LSI MPI formatted message to the IOC, and there is no way, that I
>> know of, via standard pass through to do that. If you have the MPI 1.5.4
>> spec you will see the mesasages you need in the IOC Config section
>> detailing
>> the messages that you need to send to the IOC. There are only two ways I
>> know of that you can send those messages to the IOC: 1. write your own
>> port
>> driver, not recommended. 2. use the "back door", IOCTL_SCSI_MINIPORT. #2
>> allows you to send any formatted MPI message to the IOC and get the IOC
>> reply back in your application. To use that "back door" you must go to
>> your
>> LSI rep and get their specifications and development kit.
>>
>> It is doable. I currently use both 1 and 2 for a hard drive diagnostic
>> application.
>>
>> --
>> The personal opinion of
>> Gary G. Little
>>
>>
>> "KenH" <KenHwang@newsgroup.nospam> wrote in message
>> news:19C229A9-D772-46A6-8FFA-A2BEA84202E7@microsoft.com...
>> > Hi,
>> >
>> > I need to send various SCSI commands to a SAS disk enclosure connected
>> > with
>> > LSI SCSI HBA. I read the SPTI sample in DDK and realize I need to use
>> > CreateFile with device name such as \\.\PhysicalDrive0, \\.\scsi1: to
>> > get
>> > a
>> > handle of the device and then use the handle in the SCSI_PASS_THROUGH
>> > IOCTL
>> > call to send SCSI command to the specific SCSI device. But I could not
>> > find
>> > the name for the SAS Disk Enclosure. Can anyone give me a hint on the
>> > disk
>> > enclosure name and how to discover a disk enclosure?
>> >
>> > Thanks,
>> >
>> > Ken
>>
>>
>>