<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#000066">Thanks for your inputs.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#000066">

I am opening the handle to disk. I'll try with \\.\ScsiXxx and get back to you.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#000066"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#000066">

Regards,</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#000066">Sai</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Mar 22, 2014 at 2:27 AM, Jeff Glass <span dir="ltr"><<a href="mailto:akyros000@gmail.com" target="_blank">akyros000@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>If he has a handle to the disk device
      he should be able to send IOCTL_SCSI_GET_ADDRESS to determine the
      ScsiXxx name of the HBA device.  The "PortNumber" field of the
      returned SCSI_ADDRESS structure is the Xxx portion of \\.\ScsiXxx.<div><div class="h5"><br>
      <br>
      <br>
      <br>
      On 3/21/2014 1:11 PM, Robles, Raymond C wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      
      
      
      <div>
        <p class="MsoNormal"><span style="font-size:10.0pt;color:#44546a">Agreed with Jeff… but
            you will also want to make sure you are opening the correct
            ScsiXxx handle. This varies depending on the system. Many
            times it’s Scsi1or Scsi2, but essentially, you’ll have to
            walk through opening handles and upon opening one
            successfully, seeing the Identify succeed.
            <u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-size:10.0pt;color:#44546a"><u></u> <u></u></span></p>
        <div>
          <div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">
                <a href="mailto:nvmewin-bounces@lists.openfabrics.org" target="_blank">nvmewin-bounces@lists.openfabrics.org</a>
                [<a href="mailto:nvmewin-bounces@lists.openfabrics.org" target="_blank">mailto:nvmewin-bounces@lists.openfabrics.org</a>]
                <b>On Behalf Of </b>Jeff Glass<br>
                <b>Sent:</b> Friday, March 21, 2014 9:09 AM<br>
                <b>To:</b> <a href="mailto:nvmewin@lists.openfabrics.org" target="_blank">nvmewin@lists.openfabrics.org</a><br>
                <b>Subject:</b> Re: [nvmewin] Handling NVMe Passthrough
                IOCTLs<u></u><u></u></span></p>
          </div>
        </div>
        <p class="MsoNormal"><u></u> <u></u></p>
        <div>
          <p class="MsoNormal">You said "Note: I am getting proper
            handle from CreateFile for my NVMe Device."  Did you open
            <a>\\.\PhysicalDriveXxxx</a>
            or <a>
              \\.\ScsiXxxx</a>?<br>
            <br>
            You need to open a handle to the adapter (i.e. Scsi) and not
            the disk (i.e. PhysicalDrive) for IOCTL_SCSI_MINIPORT. 
            That's the most common mistake I've seen that causes this
            error.<br>
            <br>
            <br>
            On 3/21/201 8:57 AM, Saikrishna Ravikanti wrote:<u></u><u></u></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">Hi
                  Team,<u></u><u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u> <u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">By
                  referring PT_IOCTL.Doc and WDK SPTI Sample, I am
                  developing an application to send IOCTLs<u></u><u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">using
                  _NVME_PASS_THROUGH_IOCTL structure.<u></u><u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u> <u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">I
                  am facing some problem.<u></u><u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">DeviceIoControl
                  routine returning Error code 1 (Incorrect Function).<u></u><u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u> <u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">Code
                  shown below :<u></u><u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u> <u></u></span></p>
            </div>
            <div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">PNVME_PASS_THROUGH_IOCTL
                    pInBuffer = NULL;</span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">PNVME_PASS_THROUGH_IOCTL
                    pOutBuffer = NULL;</span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">ULONG
                      ByteSizeTX =4096;</span><u></u><u></u></p>
              </div>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u> <u></u></span></p>
            </div>
            <div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">/*
                    Allocate input buffer to accommodate size of
                    NVME_PASS_THRUGH_IOCTL only */</span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">InputBufLen
                    = sizeof(NVME_PASS_THROUGH_IOCTL);</span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">pInBuffer
                    = (PNVME_PASS_THROUGH_IOCTL) malloc(InputBufLen); </span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">/*
                    Allocate output buffer to accommodate size of
                    NVME_PASS_THRUGH_IOCTL and data */</span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">OutputBufLen
                    = sizeof(NVME_PASS_THROUGH_IOCTL)+ ByteSizeTX - 1;</span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">pOutBuffer
                    = (PNVME_PASS_THROUGH_IOCTL) malloc(OutputBufLen); </span><u></u><u></u></p>
              </div>
            </div>
            <div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">if
                    (pInBuffer == NULL || pOutBuffer == NULL)</span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">return;</span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u> <u></u></span></p>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">           
                    /* Zero out the buffers */</span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">memset(pInBuffer,
                    0, InputBufLen);</span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">memset(pOutBuffer,
                    0, OutputBufLen);</span><u></u><u></u></p>
              </div>
              <div>
                <p class="MsoNormal"><u></u> <u></u></p>
              </div>
              <div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">pInBuffer->SrbIoCtrl.HeaderLength
                      = sizeof(SRB_IO_CONTROL);<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">memcpy((UCHAR*)(&pInBuffer->SrbIoCtrl.Signature[0]),
                      NVME_SIG_STR, NVME_SIG_STR_LEN);<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">pInBuffer->SrbIoCtrl.Timeout
                      = NVME_PT_TIMEOUT;<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">pInBuffer->SrbIoCtrl.ControlCode
                      = (ULONG)NVME_PASS_THROUGH_SRB_IO_CODE;<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">pInBuffer->SrbIoCtrl.Length
                      = InputBufLen - sizeof(SRB_IO_CONTROL);<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u> <u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">pInBuffer->NVMeCmd[0]=ADMIN_IDENTIFY;<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">pInBuffer->NVMeCmd[1]=0;<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">pInBuffer->NVMeCmd[10]=
                      1; //Return corresponding controller data
                      structure<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u> <u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">pInBuffer->DataBufferLen
                      = 0;<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">pInBuffer->ReturnBufferLen
                      = sizeof(NVME_PASS_THROUGH_IOCTL) + ByteSizeTX -
                      1;<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u> <u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"> status
                      = DeviceIoControl(<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"> 
                                              fileHandle,              
                                  /* Handle to
                      <a>\\.\scsi</a>
                      device via CreateFile */<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"> 
                                              IOCTL_SCSI_MINIPORT,   /*
                      IO control function to a miniport driver */<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"> 
                                              pInBuffer       ,        
                                   /* Input buffer with data sent to
                      driver */<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"> 
                                              InputBufLen,              
                              /* Length of data sent to driver (in
                      bytes) */<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"> 
                                              pOutBuffer,              
                         /* Output buffer with data received from driver
                      */<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"> 
                                              OutputBufLen,            
                                /* Length of data received from driver
                      */<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"> 
                                              &Count,              
                                         /* Bytes placed in DataBuffer
                      */<u></u><u></u></span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"> 
                                              NULL);                 <u></u><u></u></span></p>
                </div>
              </div>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"> <u></u><u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">Kindly
                  let me know your valuable inputs about this behavior.<u></u><u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u> <u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">Note:
                  I am getting proper handle from CreateFile for my NVMe
                  Device.<u></u><u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066"><u></u> <u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">Regards,<u></u><u></u></span></p>
            </div>
            <div>
              <p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif";color:#000066">Sai<u></u><u></u></span></p>
            </div>
          </div>
          <p class="MsoNormal"><br>
            <br>
            <br>
            <u></u><u></u></p>
          <pre>_______________________________________________<u></u><u></u></pre>
          <pre>nvmewin mailing list<u></u><u></u></pre>
          <pre><a href="mailto:nvmewin@lists.openfabrics.org" target="_blank">nvmewin@lists.openfabrics.org</a><u></u><u></u></pre>
          <pre><a href="http://lists.openfabrics.org/cgi-bin/mailman/listinfo/nvmewin" target="_blank">http://lists.openfabrics.org/cgi-bin/mailman/listinfo/nvmewin</a><u></u><u></u></pre>
        </blockquote>
        <p class="MsoNormal"><u></u> <u></u></p>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
nvmewin mailing list
<a href="mailto:nvmewin@lists.openfabrics.org" target="_blank">nvmewin@lists.openfabrics.org</a>
<a href="http://lists.openfabrics.org/cgi-bin/mailman/listinfo/nvmewin" target="_blank">http://lists.openfabrics.org/cgi-bin/mailman/listinfo/nvmewin</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
nvmewin mailing list<br>
<a href="mailto:nvmewin@lists.openfabrics.org">nvmewin@lists.openfabrics.org</a><br>
<a href="http://lists.openfabrics.org/cgi-bin/mailman/listinfo/nvmewin" target="_blank">http://lists.openfabrics.org/cgi-bin/mailman/listinfo/nvmewin</a><br>
<br></blockquote></div><br></div>