Re: [edk2] SAS/SCSI controller: End Device Details

Subject: Re: [edk2] SAS/SCSI controller: End Device Details

From: Murali Selvaraj <Murali.Selvaraj@lntinfotech.com>

To: "Tian, Feng" <feng.tian@intel.com>

Date: 2013-11-20 07:57:56

Hi Feng,

Thanks so much for your time and help.

I have installed EXT_SCSI_PASS_THRU protocol and from scsibus driver is scanning the SCSI Bus to discover the device, and attach ScsiIoProtocol to it with the help of ScsiScanCreateDevice().

Snippet code : 

if (ScsiBusDev->ExtScsiSupport){
    Status = ScsiBusDev->ExtScsiInterface->BuildDevicePath (
                                             ScsiBusDev->ExtScsiInterface,
                                             &TargetId->ScsiId.ExtScsi[0],
                                             Lun,
                                             &ScsiDevicePath
                                             );
  }


The above mentioned code will call BuildDevicePath() for ExtScsiSupport and it is used to allocate and build a device path node for a SCSI device on a SCSI channel.

AtapiExtScsiPassThruBuildDevicePath()

{
  EFI_DEV_PATH                   *Node;
  UINT8                          TargetId;

  TargetId = Target[0];

  //
  // Validate parameters passed in.
  //

  Print(L" executed AtapiExtScsiPassThruBuildDevicePath  \n");  =========> /* This debug statement is executed and it is displayed on the screen */
  if (DevicePath == NULL) {
    Print(L"DevicePath is NULL \n"); ================>          /* This is not displayed on the screen */
    return EFI_INVALID_PARAMETER;
  }

  //
  // can not build device path for the SCSI Host Controller.
  //
  if ((TargetId > (MAX_TARGET_ID - 1)) || (Lun != 0)) {
    return EFI_NOT_FOUND;
  }

  Node = AllocateZeroPool (sizeof (EFI_DEV_PATH));
  if (Node == NULL) {
    Print(L"Unable to allocate Devicepath \n");     =============>   /* This is not displayed on the screen */
    return EFI_OUT_OF_RESOURCES;
  }

 Print(L"Successfully allocate DevicePath \n");   ================>   /* This is not displayed on the screen */
  Node->DevPath.Type    = MESSAGING_DEVICE_PATH;
  Node->DevPath.SubType = MSG_ATAPI_DP;
  SetDevicePathNodeLength (&Node->DevPath, sizeof (ATAPI_DEVICE_PATH));

  Node->Atapi.PrimarySecondary  = (UINT8) (TargetId / 2);
  Node->Atapi.SlaveMaster       = (UINT8) (TargetId % 2);
  Node->Atapi.Lun               = (UINT16) Lun;

  *DevicePath                   = (EFI_DEVICE_PATH_PROTOCOL *) Node;

  return EFI_SUCCESS;
}


The above AtapiExtScsiPassThruBuildDevicePath() returns EFI_SUCCESS.But I couldn't see my above debug statements except the first one.

Can you please explain what could be the root cause ? and How does it return EFI_SUCCESS .

Please help me to resolve this issues.


Thanks
Murali.S
 
________________________________________
From: Tian, Feng [feng.tian@intel.com]
Sent: Tuesday, November 19, 2013 8:42 AM
To: Murali Selvaraj
Cc: edk2-devel@lists.sourceforge.net; Tian, Feng
Subject: RE: [edk2] SAS/SCSI controller: End Device Details

Same answer, That's because your SAS driver doesn't implement EXT_SCSI_PASS_THRU correctly.

If your SAS controller supports hot-plug operation, then you have to create a timer to periodically poll the connect status. When you find a device attached, then connect all drivers to this device handle, when you find this device detached, then disconnect all drivers.

UsbBus in MdeModulePkg would be a sample for you.

-----Original Message-----
From: Murali Selvaraj [mailto:Murali.Selvaraj@lntinfotech.com]
Sent: Tuesday, November 19, 2013 10:41
To: Tian, Feng
Cc: edk2-devel@lists.sourceforge.net
Subject: RE: [edk2] SAS/SCSI controller: End Device Details

Hi Feng,

Thanks for your valuable inputs and guidance.

a) I have installed EXT_PASS_THROUGH protocol properly. Later I installed scsibus and scsidisk driver.

b) I have faced one strange issue on my set up, SAS/SCSI controller has connected with one end device (ATA).
   From our scsidisk driver we could find DeviceType as EFI_SCSI_TYPE_DISK and always gets the same DeviceType even when I connect/disconnect my
  ATA device from SAS/SCSI controller.

what could be the reason for this issue? Please share your inputs.

Thanks
Murali.S


-----Original Message-----
From: Tian, Feng [mailto:feng.tian@intel.com]
Sent: 18 November 2013 08:00
To: Murali Selvaraj
Cc: edk2-devel@lists.sourceforge.net; Tian, Feng
Subject: RE: [edk2] SAS/SCSI controller: End Device Details

It means you didn't implement EXT_SCSI_PASS_THRU. GetNextTargetLun() correctly.

Please read UEFI Spec EXT_SCSI_PASS_THRU section at first. OptionRomPkg\AtapiPassThruDxe is also a sample for you.

-----Original Message-----
From: Murali Selvaraj [mailto:Murali.Selvaraj@lntinfotech.com]
Sent: Monday, November 18, 2013 10:07
To: Tian, Feng
Cc: edk2-devel@lists.sourceforge.net
Subject: FW: [edk2] SAS/SCSI controller: End Device Details

Hi Feng,

Thanks for your support.

  For example, which device type does your SAS driver return? EDKII ScsiDisk only manages EFI_SCSI_TYPE_DISK and EFI_SCSI_TYPE_CDROM.

 My SAS driver returns device type as DISK. I could install EXT_SCSI_PASS_THRU and EFI_DEVICE_PATH_PROTOCOL in  my sas driver.


I have been trying to integrate ScsiBus driver to my SAS driver. I am facing lot of challenges and I have added traces to debug the code.

>From ScsiBus.c

if (ScsiBusDev->ExtScsiSupport) {
        Status = ScsiBusDev->ExtScsiInterface->GetNextTargetLun (ScsiBusDev->ExtScsiInterface, &TargetId, &Lun);  ----> < My code does not any values from this line of code. >
        Print (L" Status is %r \n", Status);
      } else {
        Status = ScsiBusDev->ScsiInterface->GetNextDevice (ScsiBusDev->ScsiInterface, &ScsiTargetId.ScsiId.Scsi, &Lun);
      }

The above mentioned code, body of the if () condition does not returned any values. Can please guide me to resolve the issue? and what could be the reason?


Note :  One Scsi Device is connected to SAS controller.

Thanks
Murali.S
________________________________________
From: Tian, Feng [feng.tian@intel.com]
Sent: Friday, November 15, 2013 12:08 PM
To: Murali Selvaraj; edk2-devel@lists.sourceforge.net
Cc: Tian, Feng
Subject: RE: [edk2] SAS/SCSI controller: End Device Details

You need evaluate EDKII ScsiBus and ScsiDisk driver to see if they meet your requirement. For example, which device type does your SAS driver return? EDKII ScsiDisk only manages EFI_SCSI_TYPE_DISK and EFI_SCSI_TYPE_CDROM.

If they meet your requirement and do same thing of what you would like to do, then you can leverage them. You just need produce EXT_SCSI_PASS_THRU and EFI_DEVICE_PATH_PROTOCOL at SAS controller handle.

If you dont like them (quality or functionality),  you can implement those logic at your SAS driver.

From: Murali Selvaraj [mailto:Murali.Selvaraj@lntinfotech.com]
Sent: Friday, November 15, 2013 13:16
To: Tian, Feng; edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] SAS/SCSI controller: End Device Details


Hi Feng,



Thanks for your inputs.



  It depends on your usage model. Where do you want to get such info? Is in SAS driver or a UEFI driver or Platform BDS or Shell?



 I am planning to get those information from SAS driver.



 For example, your SAS driver could consume PCI_IO to produce EXT_SCSI_PASS_THRU protocol. Then EDKII ScsiBus and ScsiDisk driver could run on it to produce BLOCK_IO and DISK_INFO protocol.



 Do I need to integrate ScsiBus and ScsiDisk driver implementation into my SAS driver ? or Shall I install the driver as follows.



                                load 



                               load 



                               load 



                  Consider the above assumption, Do we need to install EXT_SCSI_PASS_THRU protocol from my SAS driver ? Also any other protocol to be installed in my SAS driver.



Thanks,

Murali.S





Hi, Murali.S



It depends on your usage model. Where do you want to get such info? Is in SAS driver or a UEFI driver or Platform BDS or Shell?



For example, your SAS driver could consume PCI_IO to produce EXT_SCSI_PASS_THRU protocol. Then EDKII ScsiBus and ScsiDisk driver could run on it to produce BLOCK_IO and DISK_INFO protocol. Here UEFI driver, Platform BDS or Application could locate DISK_INFO instance to use DISK_INFO.Inquiry() API to get attributes you care.



If you would to get such info at the internal of your SAS driver, then it?s yourself implementation.



Thanks

Feng



From: Murali Selvaraj [mailto:Murali.Selvaraj@lntinfotech.com]

Sent: Thursday, November 14, 2013 22:31

To: edk2-devel@lists.sourceforge.net

Subject: [edk2] SAS/SCSI controller: End Device Details



Hi ,



I am working on PCIe based SCSI/SAS controller card. I have written a EFI driver to bring up my SAS controller. It?s confirmed that SAS card is up and running properly.



Next, I would like to obtain end device details Vendor, Model and rev attributes from scsi device structure. AS of my understanding, the following steps to be done.



?         Send an INQUIRY (0x12) scsi cmd to the target device.



?         If command request succeeds, we could dump Vendor, Model and rev fields from response data buffer.





To implement the above mentioned requirement, can we start an UEFI application instead of other new EFI driver to send scsi command to my SAS/SCSI controller?



My Query:



>From our EDK2 source, we have MdeModulePkg/Bus/Scsi/ScsiDiskDxe

>packages. Shall we use this driver for my requirement (to send scsi

>command)

Does it work ? If yes, Do I need to install any specific scsi protocol?



Please suggests me your valuable inputs.



Thanks

Murali.S


________________________________
The contents of this e-mail and any attachment(s) may contain confidential or privileged information for the intended recipient(s). Unintended recipients are prohibited from taking action on the basis of information in this e-mail and using or disseminating the information, and must notify the sender and delete it from their system. L&T Infotech will not accept responsibility or liability for the accuracy or completeness of, or the presence of any virus or disabling code in this e-mail"

*************************************************************************



 This email and attachments have been scanned for



 potential proprietary or sensitive information leakage.



 Websense Data Security, Protecting Your Information from the Inside Out.



 www.websense.com



 *************************************************************************
*************************************************************************

 This email and attachments have been scanned for

 potential proprietary or sensitive information leakage.

 Websense Data Security, Protecting Your Information from the Inside Out.

 www.websense.com

 *************************************************************************
*************************************************************************

 This email and attachments have been scanned for

 potential proprietary or sensitive information leakage.

 Websense Data Security, Protecting Your Information from the Inside Out.

 www.websense.com

 **************************************************************************************************************************************************
 This email and attachments have been scanned for
 potential proprietary or sensitive information leakage.
 Websense Data Security, Protecting Your Information from the Inside Out.
 www.websense.com
 *************************************************************************

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel