public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: ExtScsiPassThru support for Logical SCSI devices
       [not found] <CAHPR0Q2RMR2TXUgHchw5X-ojRx7DQL1xBisucHsVxxfc28Hd=w@mail.gmail.com>
@ 2019-06-12  4:00 ` Ravi Kumar Siadri
  2019-06-12  7:55   ` [edk2-devel] " Wu, Hao A
  0 siblings, 1 reply; 12+ messages in thread
From: Ravi Kumar Siadri @ 2019-06-12  4:00 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1816 bytes --]

Hi,

Can someone help me in clarifying my queries ??

Thanks,
Ravi Kumar

On Mon, Jun 10, 2019 at 3:55 PM Ravi Kumar Siadri <
siadriravikumaruefi@gmail.com> wrote:

> Hi all,
>
> I have couple of queries regarding the
> *EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL* attribute support in
> *EFI_EXT_SCSI_PASS_THRU_PROTOCOL*.
>
> *1. *
> *The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface
> tells if the interface is for physical SCSI devices or logical SCSI
> devices. Drivers for non-RAID SCSI controllers will set both the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.*
>
> If the Drivers is for non-RAID SCSI controllers why to set the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any case that
> non-RAID SCSI controllers have Logical devices connected to it ??
>
> *2. *
> *Drivers for RAID controllers that allow access to the physical devices
> and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL
> interfaces:  *
> *One with the just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set
> and another with just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit
> set. One interface can be used to access the physical devices attached to
> the RAID controller, and the other can be used to access the logical
> devices attached to the RAID controller for its current configuration.*
>
> Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2 instances ?
> why can't we install attributes EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL
> and EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL on same Instance ??
> How User locates the Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??
>
> Thanks,
> Ravi Kumar
>
>

[-- Attachment #2: Type: text/html, Size: 2458 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
  2019-06-12  4:00 ` ExtScsiPassThru support for Logical SCSI devices Ravi Kumar Siadri
@ 2019-06-12  7:55   ` Wu, Hao A
  2019-06-13  8:18     ` Ravi Kumar Siadri
  0 siblings, 1 reply; 12+ messages in thread
From: Wu, Hao A @ 2019-06-12  7:55 UTC (permalink / raw)
  To: devel@edk2.groups.io, siadriravikumaruefi@gmail.com

[-- Attachment #1: Type: text/plain, Size: 2528 bytes --]

Hello Ravi Kumar,

Inline comments below:

From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Ravi Kumar Siadri
Sent: Wednesday, June 12, 2019 12:01 PM
To: devel@edk2.groups.io
Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

Hi,

Can someone help me in clarifying my queries ??

Thanks,
Ravi Kumar

On Mon, Jun 10, 2019 at 3:55 PM Ravi Kumar Siadri <siadriravikumaruefi@gmail.com<mailto:siadriravikumaruefi@gmail.com>> wrote:
Hi all,

I have couple of queries regarding the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL attribute support in EFI_EXT_SCSI_PASS_THRU_PROTOCOL.

1.
The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface tells if the interface is for physical SCSI devices or logical SCSI devices. Drivers for non-RAID SCSI controllers will set both the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.

If the Drivers is for non-RAID SCSI controllers why to set the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any case that non-RAID SCSI controllers have Logical devices connected to it ??

Per my understanding, every partition on a physical HW device will be treated
as a logical device by the firmware.

So for non-RAID case, both bits will be set for the PassThru protocol produced
for the physical device.


2.
Drivers for RAID controllers that allow access to the physical devices and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL interfaces:
One with the just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set and another with just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set. One interface can be used to access the physical devices attached to the RAID controller, and the other can be used to access the logical devices attached to the RAID controller for its current configuration.

Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2 instances ? why can't we install attributes EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL and EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL on same Instance ??
How User locates the Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??

UEFI spec allows RAID drivers to only produce one PassThru protocol interface
with just the XXX_PASS_THRU_LOGICAL bit set when the RAID controller select to
not allow direct access to the underlying physical devices.


Thanks,
Ravi Kumar



[-- Attachment #2: Type: text/html, Size: 29670 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
  2019-06-12  7:55   ` [edk2-devel] " Wu, Hao A
@ 2019-06-13  8:18     ` Ravi Kumar Siadri
  2019-06-14  5:51       ` Wu, Hao A
  0 siblings, 1 reply; 12+ messages in thread
From: Ravi Kumar Siadri @ 2019-06-13  8:18 UTC (permalink / raw)
  To: Wu, Hao A; +Cc: devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 4085 bytes --]

Hi Wu Hao A,

Thanks for the response.
I have added my comments in line.

Thanks,
Ravi Kumar




On Wed, Jun 12, 2019 at 1:26 PM Wu, Hao A <hao.a.wu@intel.com> wrote:

> Hello Ravi Kumar,
>
>
>
> Inline comments below:
>
>
>
> *From:* devel@edk2.groups.io [mailto:devel@edk2.groups.io] *On Behalf Of *Ravi
> Kumar Siadri
> *Sent:* Wednesday, June 12, 2019 12:01 PM
> *To:* devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI
> devices
>
>
>
> Hi,
>
>
>
> Can someone help me in clarifying my queries ??
>
>
>
> Thanks,
>
> Ravi Kumar
>
>
>
> On Mon, Jun 10, 2019 at 3:55 PM Ravi Kumar Siadri <
> siadriravikumaruefi@gmail.com> wrote:
>
> Hi all,
>
>
>
> I have couple of queries regarding the
> *EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL* attribute support in
> *EFI_EXT_SCSI_PASS_THRU_PROTOCOL*.
>
>
>
> *1. *
>
> *The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface
> tells if the interface is for physical SCSI devices or logical SCSI
> devices. Drivers for non-RAID SCSI controllers will set both the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.*
>
>
>
> If the Drivers is for non-RAID SCSI controllers why to set the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any case that
> non-RAID SCSI controllers have Logical devices connected to it ??
>
>
>
> Per my understanding, every partition on a physical HW device will be
> treated
>
> as a logical device by the firmware.
>
>
>
> So for non-RAID case, both bits will be set for the PassThru protocol
> produced
>
> for the physical device.
>
>

> Ravi:
>
> As far as i know RAID controller will treat a partition/drive as logical
> device only if has RIS (raid information sector) information in it.  So i
> don't think partition is treated as logical device.
>
>
>
>
>
> *2. *
>
> *Drivers for RAID controllers that allow access to the physical devices
> and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL
> interfaces:  *
>
> *One with the just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set
> and another with just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit
> set. One interface can be used to access the physical devices attached to
> the RAID controller, and the other can be used to access the logical
> devices attached to the RAID controller for its current configuration.*
>
>
>
> Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2 instances ?
> why can't we install attributes EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL
> and EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL on same Instance ??
>
> How User locates the Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??
>
>
>
> UEFI spec allows RAID drivers to only produce one PassThru protocol
> interface
>
> with just the XXX_PASS_THRU_LOGICAL bit set when the RAID controller
> select to
>
> not allow direct access to the underlying physical devices.
>
>
          Ravi:

> If the RAID Driver supports only Logical or Physical Devices then it is
> fine creating only 1 instance and not allowing other devices which Bit is
> not set. (either  EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL or
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL).
>
> But if the RAID driver supports both the Logical and Physical Devices,
> then we have to need 2 instances as per spec. This is going to be an over
> head, while locating instances by the user who want to send commands to
> Target devices connected to RAID controller.
>
> Since each EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance must have an
> associated device path. Only 1 instance can be installed on that particular
> RAID controller handle since the GUID is same for both the instances.
>
> If our intention is to filter the Logical and Physical devices then, we
> can add a parameter in GetNextTartget() function to inform RAID Driver
> which type of targets the user is looking for. (Physical or Logical).
>
>  Right ??
>
>
>
> Thanks,
>
> Ravi Kumar
>
>
>
> 
>

[-- Attachment #2: Type: text/html, Size: 12721 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
  2019-06-13  8:18     ` Ravi Kumar Siadri
@ 2019-06-14  5:51       ` Wu, Hao A
  2019-07-07  6:58         ` Ravi Kumar Siadri
  0 siblings, 1 reply; 12+ messages in thread
From: Wu, Hao A @ 2019-06-14  5:51 UTC (permalink / raw)
  To: devel@edk2.groups.io, siadriravikumaruefi@gmail.com

[-- Attachment #1: Type: text/plain, Size: 5314 bytes --]

Hello Ravi Kumar,
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Ravi Kumar Siadri
Sent: Thursday, June 13, 2019 4:18 PM
To: Wu, Hao A
Cc: devel@edk2.groups.io
Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

Hi Wu Hao A,

Thanks for the response.
I have added my comments in line.

Thanks,
Ravi Kumar




On Wed, Jun 12, 2019 at 1:26 PM Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> wrote:
Hello Ravi Kumar,

Inline comments below:

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> [mailto:devel@edk2.groups.io<mailto:devel@edk2.groups.io>] On Behalf Of Ravi Kumar Siadri
Sent: Wednesday, June 12, 2019 12:01 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

Hi,

Can someone help me in clarifying my queries ??

Thanks,
Ravi Kumar

On Mon, Jun 10, 2019 at 3:55 PM Ravi Kumar Siadri <siadriravikumaruefi@gmail.com<mailto:siadriravikumaruefi@gmail.com>> wrote:
Hi all,

I have couple of queries regarding the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL attribute support in EFI_EXT_SCSI_PASS_THRU_PROTOCOL.

1.
The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface tells if the interface is for physical SCSI devices or logical SCSI devices. Drivers for non-RAID SCSI controllers will set both the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.

If the Drivers is for non-RAID SCSI controllers why to set the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any case that non-RAID SCSI controllers have Logical devices connected to it ??

Per my understanding, every partition on a physical HW device will be treated
as a logical device by the firmware.

So for non-RAID case, both bits will be set for the PassThru protocol produced
for the physical device.

Ravi:
As far as i know RAID controller will treat a partition/drive as logical device only if has RIS (raid information sector) information in it.  So i don't think partition is treated as logical device.

Agree.
Then for the non-RAID case, the hardware is considered as a physical device and a logical one at the same time.
Since media access protocols like the BlockIO protocol will be produced upon the logical instance of the PassThru protocol, it is the reason that both bits are set for this case.
(Refer to function DetermineInstallBlockIo() at MdeModulePkg\Bus\Scsi\ScsiDiskDxe\ScsiDisk.c)

2.
Drivers for RAID controllers that allow access to the physical devices and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL interfaces:
One with the just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set and another with just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set. One interface can be used to access the physical devices attached to the RAID controller, and the other can be used to access the logical devices attached to the RAID controller for its current configuration.

Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2 instances ? why can't we install attributes EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL and EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL on same Instance ??
How User locates the Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??

UEFI spec allows RAID drivers to only produce one PassThru protocol interface
with just the XXX_PASS_THRU_LOGICAL bit set when the RAID controller select to
not allow direct access to the underlying physical devices.

          Ravi:
If the RAID Driver supports only Logical or Physical Devices then it is fine creating only 1 instance and not allowing other devices which Bit is not set. (either  EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL or EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL).
But if the RAID driver supports both the Logical and Physical Devices, then we have to need 2 instances as per spec. This is going to be an over head, while locating instances by the user who want to send commands to Target devices connected to RAID controller.
Since each EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance must have an associated device path. Only 1 instance can be installed on that particular RAID controller handle since the GUID is same for both the instances.
If our intention is to filter the Logical and Physical devices then, we can add a parameter in GetNextTartget() function to inform RAID Driver which type of targets the user is looking for. (Physical or Logical).
 Right ??

My take is that the producer of the physical and logical PassThru protocol may not be the same vender (or driver).
The logical instance (which determines the configuration of the RAID) might have a common logic that applies to common using cases.
The logical one will be used to produce media access protocols, some actual HW may not be accessible (e.g. used for data backup) by this PassThru protocol instance.
While the physical one can be used to send commands to the underlying device for purpose like health/status check or getting device information.
However, I am not an expect for RAID, hope someone else can help to provide comments.

Thanks,
Ravi Kumar



[-- Attachment #2: Type: text/html, Size: 43490 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
  2019-06-14  5:51       ` Wu, Hao A
@ 2019-07-07  6:58         ` Ravi Kumar Siadri
  2019-07-08  3:09           ` Wu, Hao A
  0 siblings, 1 reply; 12+ messages in thread
From: Ravi Kumar Siadri @ 2019-07-07  6:58 UTC (permalink / raw)
  To: Wu, Hao A, stephano; +Cc: devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 6367 bytes --]

Hi All,

*Can somebody, comment on this.?*

Have anyone tried supporting *ExtScsiPassThru *for both Logical and
Physical devices ??

*To avoid 2 instances and creation of 2 device paths here, my proposal is*

*1. To filter the Logical and Physical devices, we can add a parameter in
GetNextTartget() function to inform RAID Driver which type of targets the
user is looking for. (Physical or Logical).*

*2. To know what type of device connected at that particular Target and LUN
combination, we can add one more service like.. GetDeviceType() to inform
the top level user (like UEFI applications/other drivers), to which device
he is sending a command.*



I feel this proposal works well and clear, Please let me know if i am
missing anything here.


Thanks,
Ravi Kumar


On Fri, Jun 14, 2019 at 11:21 AM Wu, Hao A <hao.a.wu@intel.com> wrote:

> Hello Ravi Kumar,
>
> *From:* devel@edk2.groups.io [mailto:devel@edk2.groups.io] *On Behalf Of *Ravi
> Kumar Siadri
> *Sent:* Thursday, June 13, 2019 4:18 PM
> *To:* Wu, Hao A
> *Cc:* devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI
> devices
>
>
>
> Hi Wu Hao A,
>
>
>
> Thanks for the response.
>
> I have added my comments in line.
>
>
>
> Thanks,
>
> Ravi Kumar
>
>
>
>
>
>
>
>
>
> On Wed, Jun 12, 2019 at 1:26 PM Wu, Hao A <hao.a.wu@intel.com> wrote:
>
> Hello Ravi Kumar,
>
>
>
> Inline comments below:
>
>
>
> *From:* devel@edk2.groups.io [mailto:devel@edk2.groups.io] *On Behalf Of *Ravi
> Kumar Siadri
> *Sent:* Wednesday, June 12, 2019 12:01 PM
> *To:* devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI
> devices
>
>
>
> Hi,
>
>
>
> Can someone help me in clarifying my queries ??
>
>
>
> Thanks,
>
> Ravi Kumar
>
>
>
> On Mon, Jun 10, 2019 at 3:55 PM Ravi Kumar Siadri <
> siadriravikumaruefi@gmail.com> wrote:
>
> Hi all,
>
>
>
> I have couple of queries regarding the
> *EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL* attribute support in
> *EFI_EXT_SCSI_PASS_THRU_PROTOCOL*.
>
>
>
> *1. *
>
> *The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface
> tells if the interface is for physical SCSI devices or logical SCSI
> devices. Drivers for non-RAID SCSI controllers will set both the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.*
>
>
>
> If the Drivers is for non-RAID SCSI controllers why to set the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any case that
> non-RAID SCSI controllers have Logical devices connected to it ??
>
>
>
> Per my understanding, every partition on a physical HW device will be
> treated
>
> as a logical device by the firmware.
>
>
>
> So for non-RAID case, both bits will be set for the PassThru protocol
> produced
>
> for the physical device.
>
>
>
> Ravi:
>
> As far as i know RAID controller will treat a partition/drive as logical
> device only if has RIS (raid information sector) information in it.  So i
> don't think partition is treated as logical device.
>
>
>
> Agree.
>
> Then for the non-RAID case, the hardware is considered as a physical
> device and a logical one at the same time.
>
> Since media access protocols like the BlockIO protocol will be produced
> upon the logical instance of the PassThru protocol, it is the reason that
> both bits are set for this case.
>
> (Refer to function DetermineInstallBlockIo() at MdeModulePkg\Bus\Scsi\
> ScsiDiskDxe\ScsiDisk.c)
>
>
>
> *2. *
>
> *Drivers for RAID controllers that allow access to the physical devices
> and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL
> interfaces:  *
>
> *One with the just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set
> and another with just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit
> set. One interface can be used to access the physical devices attached to
> the RAID controller, and the other can be used to access the logical
> devices attached to the RAID controller for its current configuration.*
>
>
>
> Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2 instances ?
> why can't we install attributes EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL
> and EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL on same Instance ??
>
> How User locates the Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??
>
>
>
> UEFI spec allows RAID drivers to only produce one PassThru protocol
> interface
>
> with just the XXX_PASS_THRU_LOGICAL bit set when the RAID controller
> select to
>
> not allow direct access to the underlying physical devices.
>
>
>
>           Ravi:
>
> If the RAID Driver supports only Logical or Physical Devices then it is
> fine creating only 1 instance and not allowing other devices which Bit is
> not set. (either  EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL or
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL).
>
> But if the RAID driver supports both the Logical and Physical Devices,
> then we have to need 2 instances as per spec. This is going to be an over
> head, while locating instances by the user who want to send commands to
> Target devices connected to RAID controller.
>
> Since each EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance must have an
> associated device path. Only 1 instance can be installed on that particular
> RAID controller handle since the GUID is same for both the instances.
>
> If our intention is to filter the Logical and Physical devices then, we
> can add a parameter in GetNextTartget() function to inform RAID Driver
> which type of targets the user is looking for. (Physical or Logical).
>
>  Right ??
>
>
>
> My take is that the producer of the physical and logical PassThru protocol
> may not be the same vender (or driver).
>
> The logical instance (which determines the configuration of the RAID)
> might have a common logic that applies to common using cases.
>
> The logical one will be used to produce media access protocols, some
> actual HW may not be accessible (e.g. used for data backup) by this
> PassThru protocol instance.
>
> While the physical one can be used to send commands to the underlying
> device for purpose like health/status check or getting device information.
>
> However, I am not an expect for RAID, hope someone else can help to
> provide comments.
>
>
>
> Thanks,
>
> Ravi Kumar
>
>
>
> 
>

[-- Attachment #2: Type: text/html, Size: 19644 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
  2019-07-07  6:58         ` Ravi Kumar Siadri
@ 2019-07-08  3:09           ` Wu, Hao A
  2019-07-08  8:35             ` Ravi Kumar Siadri
  0 siblings, 1 reply; 12+ messages in thread
From: Wu, Hao A @ 2019-07-08  3:09 UTC (permalink / raw)
  To: Ravi Kumar Siadri, stephano; +Cc: devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 7500 bytes --]

Hello Ravi Kumar,

May I know the specific issue you met when 2 ExtScsiPassThru instances are
provided for the device?

For some of your previous questions:

·         “Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2 instances ?”
The logical protocol instance is used to produce media access protocols (like
BlockIO protocol). Some physical HW may not be visible/accessible (e.g. HW used
for data backup, depending on the RAID configuration) by this logical protocol
instance.

The physical one is used to directly send commands to all the managing devices.


·         “How User locates the Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??”
Users can always use the EFI Boot Service 'LocateHandleBuffer' to get all the
EFI_EXT_SCSI_PASS_THRU_PROTOCOL instances. Then, users can evaluate each
instance to see if it is the one they needed.

Best Regards,
Hao Wu

From: Ravi Kumar Siadri [mailto:siadriravikumaruefi@gmail.com]
Sent: Sunday, July 07, 2019 2:58 PM
To: Wu, Hao A; stephano
Cc: devel@edk2.groups.io
Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

Hi All,

Can somebody, comment on this.?

Have anyone tried supporting ExtScsiPassThru for both Logical and Physical devices ??

To avoid 2 instances and creation of 2 device paths here, my proposal is
1. To filter the Logical and Physical devices, we can add a parameter in GetNextTartget() function to inform RAID Driver which type of targets the user is looking for. (Physical or Logical).
2. To know what type of device connected at that particular Target and LUN combination, we can add one more service like.. GetDeviceType() to inform the top level user (like UEFI applications/other drivers), to which device he is sending a command.

I feel this proposal works well and clear, Please let me know if i am missing anything here.

Thanks,
Ravi Kumar


On Fri, Jun 14, 2019 at 11:21 AM Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> wrote:
Hello Ravi Kumar,
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> [mailto:devel@edk2.groups.io<mailto:devel@edk2.groups.io>] On Behalf Of Ravi Kumar Siadri
Sent: Thursday, June 13, 2019 4:18 PM
To: Wu, Hao A
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

Hi Wu Hao A,

Thanks for the response.
I have added my comments in line.

Thanks,
Ravi Kumar




On Wed, Jun 12, 2019 at 1:26 PM Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> wrote:
Hello Ravi Kumar,

Inline comments below:

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> [mailto:devel@edk2.groups.io<mailto:devel@edk2.groups.io>] On Behalf Of Ravi Kumar Siadri
Sent: Wednesday, June 12, 2019 12:01 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

Hi,

Can someone help me in clarifying my queries ??

Thanks,
Ravi Kumar

On Mon, Jun 10, 2019 at 3:55 PM Ravi Kumar Siadri <siadriravikumaruefi@gmail.com<mailto:siadriravikumaruefi@gmail.com>> wrote:
Hi all,

I have couple of queries regarding the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL attribute support in EFI_EXT_SCSI_PASS_THRU_PROTOCOL.

1.
The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface tells if the interface is for physical SCSI devices or logical SCSI devices. Drivers for non-RAID SCSI controllers will set both the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.

If the Drivers is for non-RAID SCSI controllers why to set the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any case that non-RAID SCSI controllers have Logical devices connected to it ??

Per my understanding, every partition on a physical HW device will be treated
as a logical device by the firmware.

So for non-RAID case, both bits will be set for the PassThru protocol produced
for the physical device.

Ravi:
As far as i know RAID controller will treat a partition/drive as logical device only if has RIS (raid information sector) information in it.  So i don't think partition is treated as logical device.

Agree.
Then for the non-RAID case, the hardware is considered as a physical device and a logical one at the same time.
Since media access protocols like the BlockIO protocol will be produced upon the logical instance of the PassThru protocol, it is the reason that both bits are set for this case.
(Refer to function DetermineInstallBlockIo() at MdeModulePkg\Bus\Scsi\ScsiDiskDxe\ScsiDisk.c)

2.
Drivers for RAID controllers that allow access to the physical devices and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL interfaces:
One with the just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set and another with just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set. One interface can be used to access the physical devices attached to the RAID controller, and the other can be used to access the logical devices attached to the RAID controller for its current configuration.

Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2 instances ? why can't we install attributes EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL and EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL on same Instance ??
How User locates the Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??

UEFI spec allows RAID drivers to only produce one PassThru protocol interface
with just the XXX_PASS_THRU_LOGICAL bit set when the RAID controller select to
not allow direct access to the underlying physical devices.

          Ravi:
If the RAID Driver supports only Logical or Physical Devices then it is fine creating only 1 instance and not allowing other devices which Bit is not set. (either  EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL or EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL).
But if the RAID driver supports both the Logical and Physical Devices, then we have to need 2 instances as per spec. This is going to be an over head, while locating instances by the user who want to send commands to Target devices connected to RAID controller.
Since each EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance must have an associated device path. Only 1 instance can be installed on that particular RAID controller handle since the GUID is same for both the instances.
If our intention is to filter the Logical and Physical devices then, we can add a parameter in GetNextTartget() function to inform RAID Driver which type of targets the user is looking for. (Physical or Logical).
 Right ??

My take is that the producer of the physical and logical PassThru protocol may not be the same vender (or driver).
The logical instance (which determines the configuration of the RAID) might have a common logic that applies to common using cases.
The logical one will be used to produce media access protocols, some actual HW may not be accessible (e.g. used for data backup) by this PassThru protocol instance.
While the physical one can be used to send commands to the underlying device for purpose like health/status check or getting device information.
However, I am not an expect for RAID, hope someone else can help to provide comments.

Thanks,
Ravi Kumar



[-- Attachment #2: Type: text/html, Size: 58259 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
  2019-07-08  3:09           ` Wu, Hao A
@ 2019-07-08  8:35             ` Ravi Kumar Siadri
  2019-07-11 12:59               ` Wu, Hao A
  0 siblings, 1 reply; 12+ messages in thread
From: Ravi Kumar Siadri @ 2019-07-08  8:35 UTC (permalink / raw)
  To: Wu, Hao A; +Cc: devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 10318 bytes --]

Hi Hao Wu,

If a Controller supports both Logical and Physical Devices, as per spec we
need to create 2 instances.
1. Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set.
2.  Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set.

And Each EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance must have an associated
device path.

Now the issue is, The same GUID cannot be installed more than once onto the
same handle (Controller handle).
So to support 2nd instance we need to create new device path (virtual
device path) for that.

Once more issue is, how do we associate this newly created device path and
SCSI PassThru instance with actual controller . ?


*The logical protocol instance is used to produce media access protocols
(like BlockIO protocol). Some physical HW may not be visible/accessible
(e.g. HW used*

*for data backup, depending on the RAID configuration) by this logical
protocol instance. **The physical one is used to directly send commands to
all the managing devices.*

I dont think, because if any driver supports only Instance with
EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set, can't they create child
handles ??

As far as i know, Logical or Physical Instances are no where related to
media access protocols. Even without SCSI passthru protocol on controller
handle also, Block Io protocol can be installed on Controller Child
devices. (Its the uefi driver wish, how it passes commands to the Child's
of controller). Logical Instance is to interact with Logical Device and
Physical Instance is to interact with Physical devices as per spec.

*Users can always use the EFI Boot Service 'LocateHandleBuffer' to get all
the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instances. Then, users can evaluate
each instance to see if it is the one they needed.*

Yes user can get the list of EFI_EXT_SCSI_PASS_THRU_PROTOCOL instances by
querying, but how the user can relate a particular instance with a
controller. ? Because the 2nd of SCSI PassThru is created on new device
path.(which will not have any other protocols, other than device path and
ext scsi pass thru).

Thanks,
Ravi Kumar


On Mon, Jul 8, 2019 at 8:39 AM Wu, Hao A <hao.a.wu@intel.com> wrote:

> Hello Ravi Kumar,
>
>
>
> May I know the specific issue you met when 2 ExtScsiPassThru instances are
>
> provided for the device?
>
>
>
> For some of your previous questions:
>
> ·         “Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2
> instances ?”
>
> The logical protocol instance is used to produce media access protocols
> (like
>
> BlockIO protocol). Some physical HW may not be visible/accessible (e.g. HW
> used
>
> for data backup, depending on the RAID configuration) by this logical
> protocol
>
> instance.
>
>
>
> The physical one is used to directly send commands to all the managing
> devices.
>
>
>
> ·         “How User locates the Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??”
>
> Users can always use the EFI Boot Service 'LocateHandleBuffer' to get all
> the
>
> EFI_EXT_SCSI_PASS_THRU_PROTOCOL instances. Then, users can evaluate each
>
> instance to see if it is the one they needed.
>
>
>
> Best Regards,
>
> Hao Wu
>
>
>
> *From:* Ravi Kumar Siadri [mailto:siadriravikumaruefi@gmail.com]
> *Sent:* Sunday, July 07, 2019 2:58 PM
> *To:* Wu, Hao A; stephano
> *Cc:* devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI
> devices
>
>
>
> Hi All,
>
>
>
> *Can somebody, comment on this.?*
>
>
>
> Have anyone tried supporting *ExtScsiPassThru* for both Logical and
> Physical devices ??
>
>
>
> *To avoid 2 instances and creation of 2 device paths here, my proposal is*
>
> *1. To filter the Logical and Physical devices, we can add a parameter in
> GetNextTartget() function to inform RAID Driver which type of targets the
> user is looking for. (Physical or Logical).*
>
> *2. To know what type of device connected at that particular Target and
> LUN combination, we can add one more service like.. GetDeviceType() to
> inform the top level user (like UEFI applications/other drivers), to which
> device he is sending a command.*
>
>
>
> I feel this proposal works well and clear, Please let me know if i am
> missing anything here.
>
>
>
> Thanks,
>
> Ravi Kumar
>
>
>
>
>
> On Fri, Jun 14, 2019 at 11:21 AM Wu, Hao A <hao.a.wu@intel.com> wrote:
>
> Hello Ravi Kumar,
>
> *From:* devel@edk2.groups.io [mailto:devel@edk2.groups.io] *On Behalf Of *Ravi
> Kumar Siadri
> *Sent:* Thursday, June 13, 2019 4:18 PM
> *To:* Wu, Hao A
> *Cc:* devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI
> devices
>
>
>
> Hi Wu Hao A,
>
>
>
> Thanks for the response.
>
> I have added my comments in line.
>
>
>
> Thanks,
>
> Ravi Kumar
>
>
>
>
>
>
>
>
>
> On Wed, Jun 12, 2019 at 1:26 PM Wu, Hao A <hao.a.wu@intel.com> wrote:
>
> Hello Ravi Kumar,
>
>
>
> Inline comments below:
>
>
>
> *From:* devel@edk2.groups.io [mailto:devel@edk2.groups.io] *On Behalf Of *Ravi
> Kumar Siadri
> *Sent:* Wednesday, June 12, 2019 12:01 PM
> *To:* devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI
> devices
>
>
>
> Hi,
>
>
>
> Can someone help me in clarifying my queries ??
>
>
>
> Thanks,
>
> Ravi Kumar
>
>
>
> On Mon, Jun 10, 2019 at 3:55 PM Ravi Kumar Siadri <
> siadriravikumaruefi@gmail.com> wrote:
>
> Hi all,
>
>
>
> I have couple of queries regarding the
> *EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL* attribute support in
> *EFI_EXT_SCSI_PASS_THRU_PROTOCOL*.
>
>
>
> *1. *
>
> *The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface
> tells if the interface is for physical SCSI devices or logical SCSI
> devices. Drivers for non-RAID SCSI controllers will set both the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.*
>
>
>
> If the Drivers is for non-RAID SCSI controllers why to set the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any case that
> non-RAID SCSI controllers have Logical devices connected to it ??
>
>
>
> Per my understanding, every partition on a physical HW device will be
> treated
>
> as a logical device by the firmware.
>
>
>
> So for non-RAID case, both bits will be set for the PassThru protocol
> produced
>
> for the physical device.
>
>
>
> Ravi:
>
> As far as i know RAID controller will treat a partition/drive as logical
> device only if has RIS (raid information sector) information in it.  So i
> don't think partition is treated as logical device.
>
>
>
> Agree.
>
> Then for the non-RAID case, the hardware is considered as a physical
> device and a logical one at the same time.
>
> Since media access protocols like the BlockIO protocol will be produced
> upon the logical instance of the PassThru protocol, it is the reason that
> both bits are set for this case.
>
> (Refer to function DetermineInstallBlockIo() at MdeModulePkg\Bus\Scsi\
> ScsiDiskDxe\ScsiDisk.c)
>
>
>
> *2. *
>
> *Drivers for RAID controllers that allow access to the physical devices
> and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL
> interfaces:  *
>
> *One with the just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set
> and another with just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit
> set. One interface can be used to access the physical devices attached to
> the RAID controller, and the other can be used to access the logical
> devices attached to the RAID controller for its current configuration.*
>
>
>
> Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2 instances ?
> why can't we install attributes EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL
> and EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL on same Instance ??
>
> How User locates the Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??
>
>
>
> UEFI spec allows RAID drivers to only produce one PassThru protocol
> interface
>
> with just the XXX_PASS_THRU_LOGICAL bit set when the RAID controller
> select to
>
> not allow direct access to the underlying physical devices.
>
>
>
>           Ravi:
>
> If the RAID Driver supports only Logical or Physical Devices then it is
> fine creating only 1 instance and not allowing other devices which Bit is
> not set. (either  EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL or
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL).
>
> But if the RAID driver supports both the Logical and Physical Devices,
> then we have to need 2 instances as per spec. This is going to be an over
> head, while locating instances by the user who want to send commands to
> Target devices connected to RAID controller.
>
> Since each EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance must have an
> associated device path. Only 1 instance can be installed on that particular
> RAID controller handle since the GUID is same for both the instances.
>
> If our intention is to filter the Logical and Physical devices then, we
> can add a parameter in GetNextTartget() function to inform RAID Driver
> which type of targets the user is looking for. (Physical or Logical).
>
>  Right ??
>
>
>
> My take is that the producer of the physical and logical PassThru protocol
> may not be the same vender (or driver).
>
> The logical instance (which determines the configuration of the RAID)
> might have a common logic that applies to common using cases.
>
> The logical one will be used to produce media access protocols, some
> actual HW may not be accessible (e.g. used for data backup) by this
> PassThru protocol instance.
>
> While the physical one can be used to send commands to the underlying
> device for purpose like health/status check or getting device information.
>
> However, I am not an expect for RAID, hope someone else can help to
> provide comments.
>
>
>
> Thanks,
>
> Ravi Kumar
>
>
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 33518 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
  2019-07-08  8:35             ` Ravi Kumar Siadri
@ 2019-07-11 12:59               ` Wu, Hao A
  0 siblings, 0 replies; 12+ messages in thread
From: Wu, Hao A @ 2019-07-11 12:59 UTC (permalink / raw)
  To: 'siadriravikumaruefi@gmail.com'; +Cc: devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 12010 bytes --]

Hello Ravi Kumar,

For: Now the issue is, The same GUID cannot be installed more than once onto the same handle (Controller handle).
So to support 2nd instance we need to create new device path (virtual device path) for that.
Yes. A new handled is needed for the ExtScsiPassThru protocol logical instance.

For: Once more issue is, how do we associate this newly created device path and SCSI PassThru instance with actual controller . ?
I think we can either:
Use OpenProtocol() on behalf of the new handle with an attribute of BY_CHILD_CONTROLLER to create a parent-child relationship.
Or use device path (append nodes after the actual controller’s device path when constructing the device path of the new handle)
to associate them.

For: I dont think, because if any driver supports only Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set, can't they create child handles ??
As far as i know, Logical or Physical Instances are no where related to media access protocols.
Per my understanding, the media device drivers in edk2 are written in a manner to only produce media access protocols upon logical instance of the PassThru protocols.
Some examples are:
MdeModulePkg\Bus\Ata\AtaBusDxe\AtaBus.c - Function AtaBusDriverBindingSupported()
MdeModulePkg\Bus\Scsi\ScsiDiskDxe\ScsiDisk.c - Function DetermineInstallBlockIo()

For: Yes user can get the list of EFI_EXT_SCSI_PASS_THRU_PROTOCOL instances by querying, but how the user can relate a particular instance with a controller. ? Because the 2nd of SCSI PassThru is created on new device path.(which will not have any other protocols, other than device path and ext scsi pass thru).
In my opinion, the device path together with the attribute of the PassThru protocol instance will be sufficient for consumers.
The physical one will be used for device management, while the logical one will be used to further produce upper-layer protocols.


Best Regards,
Hao Wu

From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Ravi Kumar Siadri
Sent: Monday, July 08, 2019 4:36 PM
To: Wu, Hao A
Cc: devel@edk2.groups.io
Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

Hi Hao Wu,

If a Controller supports both Logical and Physical Devices, as per spec we need to create 2 instances.
1. Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set.
2.  Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set.

And Each EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance must have an associated device path.

Now the issue is, The same GUID cannot be installed more than once onto the same handle (Controller handle).
So to support 2nd instance we need to create new device path (virtual device path) for that.

Once more issue is, how do we associate this newly created device path and SCSI PassThru instance with actual controller . ?


The logical protocol instance is used to produce media access protocols (like BlockIO protocol). Some physical HW may not be visible/accessible (e.g. HW used
for data backup, depending on the RAID configuration) by this logical protocol instance. The physical one is used to directly send commands to all the managing devices.

I dont think, because if any driver supports only Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set, can't they create child handles ??

As far as i know, Logical or Physical Instances are no where related to media access protocols. Even without SCSI passthru protocol on controller handle also, Block Io protocol can be installed on Controller Child devices. (Its the uefi driver wish, how it passes commands to the Child's of controller). Logical Instance is to interact with Logical Device and Physical Instance is to interact with Physical devices as per spec.

Users can always use the EFI Boot Service 'LocateHandleBuffer' to get all the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instances. Then, users can evaluate each instance to see if it is the one they needed.

Yes user can get the list of EFI_EXT_SCSI_PASS_THRU_PROTOCOL instances by querying, but how the user can relate a particular instance with a controller. ? Because the 2nd of SCSI PassThru is created on new device path.(which will not have any other protocols, other than device path and ext scsi pass thru).

Thanks,
Ravi Kumar


On Mon, Jul 8, 2019 at 8:39 AM Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> wrote:
Hello Ravi Kumar,

May I know the specific issue you met when 2 ExtScsiPassThru instances are
provided for the device?

For some of your previous questions:

•         “Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2 instances ?”
The logical protocol instance is used to produce media access protocols (like
BlockIO protocol). Some physical HW may not be visible/accessible (e.g. HW used
for data backup, depending on the RAID configuration) by this logical protocol
instance.

The physical one is used to directly send commands to all the managing devices.


•         “How User locates the Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??”
Users can always use the EFI Boot Service 'LocateHandleBuffer' to get all the
EFI_EXT_SCSI_PASS_THRU_PROTOCOL instances. Then, users can evaluate each
instance to see if it is the one they needed.

Best Regards,
Hao Wu

From: Ravi Kumar Siadri [mailto:siadriravikumaruefi@gmail.com<mailto:siadriravikumaruefi@gmail.com>]
Sent: Sunday, July 07, 2019 2:58 PM
To: Wu, Hao A; stephano
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

Hi All,

Can somebody, comment on this.?

Have anyone tried supporting ExtScsiPassThru for both Logical and Physical devices ??

To avoid 2 instances and creation of 2 device paths here, my proposal is
1. To filter the Logical and Physical devices, we can add a parameter in GetNextTartget() function to inform RAID Driver which type of targets the user is looking for. (Physical or Logical).
2. To know what type of device connected at that particular Target and LUN combination, we can add one more service like.. GetDeviceType() to inform the top level user (like UEFI applications/other drivers), to which device he is sending a command.

I feel this proposal works well and clear, Please let me know if i am missing anything here.

Thanks,
Ravi Kumar


On Fri, Jun 14, 2019 at 11:21 AM Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> wrote:
Hello Ravi Kumar,
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> [mailto:devel@edk2.groups.io<mailto:devel@edk2.groups.io>] On Behalf Of Ravi Kumar Siadri
Sent: Thursday, June 13, 2019 4:18 PM
To: Wu, Hao A
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

Hi Wu Hao A,

Thanks for the response.
I have added my comments in line.

Thanks,
Ravi Kumar




On Wed, Jun 12, 2019 at 1:26 PM Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> wrote:
Hello Ravi Kumar,

Inline comments below:

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> [mailto:devel@edk2.groups.io<mailto:devel@edk2.groups.io>] On Behalf Of Ravi Kumar Siadri
Sent: Wednesday, June 12, 2019 12:01 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices

Hi,

Can someone help me in clarifying my queries ??

Thanks,
Ravi Kumar

On Mon, Jun 10, 2019 at 3:55 PM Ravi Kumar Siadri <siadriravikumaruefi@gmail.com<mailto:siadriravikumaruefi@gmail.com>> wrote:
Hi all,

I have couple of queries regarding the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL attribute support in EFI_EXT_SCSI_PASS_THRU_PROTOCOL.

1.
The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface tells if the interface is for physical SCSI devices or logical SCSI devices. Drivers for non-RAID SCSI controllers will set both the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.

If the Drivers is for non-RAID SCSI controllers why to set the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any case that non-RAID SCSI controllers have Logical devices connected to it ??

Per my understanding, every partition on a physical HW device will be treated
as a logical device by the firmware.

So for non-RAID case, both bits will be set for the PassThru protocol produced
for the physical device.

Ravi:
As far as i know RAID controller will treat a partition/drive as logical device only if has RIS (raid information sector) information in it.  So i don't think partition is treated as logical device.

Agree.
Then for the non-RAID case, the hardware is considered as a physical device and a logical one at the same time.
Since media access protocols like the BlockIO protocol will be produced upon the logical instance of the PassThru protocol, it is the reason that both bits are set for this case.
(Refer to function DetermineInstallBlockIo() at MdeModulePkg\Bus\Scsi\ScsiDiskDxe\ScsiDisk.c)

2.
Drivers for RAID controllers that allow access to the physical devices and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL interfaces:
One with the just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set and another with just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set. One interface can be used to access the physical devices attached to the RAID controller, and the other can be used to access the logical devices attached to the RAID controller for its current configuration.

Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2 instances ? why can't we install attributes EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL and EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL on same Instance ??
How User locates the Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??

UEFI spec allows RAID drivers to only produce one PassThru protocol interface
with just the XXX_PASS_THRU_LOGICAL bit set when the RAID controller select to
not allow direct access to the underlying physical devices.

          Ravi:
If the RAID Driver supports only Logical or Physical Devices then it is fine creating only 1 instance and not allowing other devices which Bit is not set. (either  EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL or EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL).
But if the RAID driver supports both the Logical and Physical Devices, then we have to need 2 instances as per spec. This is going to be an over head, while locating instances by the user who want to send commands to Target devices connected to RAID controller.
Since each EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance must have an associated device path. Only 1 instance can be installed on that particular RAID controller handle since the GUID is same for both the instances.
If our intention is to filter the Logical and Physical devices then, we can add a parameter in GetNextTartget() function to inform RAID Driver which type of targets the user is looking for. (Physical or Logical).
 Right ??

My take is that the producer of the physical and logical PassThru protocol may not be the same vender (or driver).
The logical instance (which determines the configuration of the RAID) might have a common logic that applies to common using cases.
The logical one will be used to produce media access protocols, some actual HW may not be accessible (e.g. used for data backup) by this PassThru protocol instance.
While the physical one can be used to send commands to the underlying device for purpose like health/status check or getting device information.
However, I am not an expect for RAID, hope someone else can help to provide comments.

Thanks,
Ravi Kumar



[-- Attachment #2: Type: text/html, Size: 75215 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
  2019-06-10 12:32 Ravi Kumar Siadri
@ 2019-07-12 22:10 ` Laszlo Ersek
  2019-07-15  5:25   ` Wu, Hao A
  0 siblings, 1 reply; 12+ messages in thread
From: Laszlo Ersek @ 2019-07-12 22:10 UTC (permalink / raw)
  To: siadriravikumaruefi; +Cc: devel, Hao A Wu, Stephano Cetola

On 06/10/19 14:32, Ravi Kumar Siadri wrote:
> Hi all,
>
> I have couple of queries regarding the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL attribute support in
> EFI_EXT_SCSI_PASS_THRU_PROTOCOL.
>
> 1.
> The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface
> tells if the interface is for physical SCSI devices or logical SCSI
> devices. Drivers for non-RAID SCSI controllers will set both the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.
>
> If the Drivers is for non-RAID SCSI controllers why to set the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any case
> that non-RAID SCSI controllers have Logical devices connected to it ??
>
> 2.
> Drivers for RAID controllers that allow access to the physical devices
> and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL
> interfaces: One with the just the
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set and another with
> just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set. One
> interface can be used to access the physical devices attached to the
> RAID controller, and the other can be used to access the logical
> devices attached to the RAID controller for its current configuration.
>
> Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2 instances
> ? why can't we install attributes
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL and
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL on same Instance ?? How
> User locates the Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with
> EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??

Please consult the UEFI Driver Writer's Guide on these questions. (What
I have on my disk now is Version 1.01, for UEFI 2.3.1, released
03/08/2012.)

Excerpts:

> 6.3 Hybrid drivers
>
> [...]
>
> A driver for a multi-channel RAID SCSI host controller is a hybrid
> driver. It produces the Extended SCSI Pass Thru Protocol (with the
> logical bit on) on the controller handle and creates child handles
> with Extended SCSI Pass Thru Protocol for each physical channel (with
> the logical bit off).

> 20.1.3 SCSI Adapters with RAID
>
> A SCSI host controller driver may also support SCSI adapters with RAID
> capability. The following figure shows an example implementation with
> two physical SCSI channels and one logical channel. The two physical
> channels are implemented on the SCSI adapter. The RAID component then
> configures these two channels to produce a logical SCSI channel. The
> two physical channels each have Extended SCSI Pass Thru installed, but
> these are not be used except for diagnostic use. For the logical
> channel, the SCSI host controller driver produces another Extended
> SCSI Pass Thru Protocol (with physical bit turned off) instance based
> on the RAID configuration. Requests sent to the Extended SCSI Pass
> Thru protocol for the logical channel are processed by the SCSI host
> controller drivers and converted into requests on the physical SCSI
> channels. The platform firmware must only enumerate and boot from SCSI
> targets present on the logical SCSI channel.
>
> The SCSI adapter hardware may not be able to expose the physical SCSI
> channel(s) to upper-level software when implementing RAID. If the
> physical SCSI channel cannot be exposed to upper software, then the
> SCSI host controller driver is only required to produce a single
> logical channel for the RAID.
>
> Although the basic theory is the same as the one on a physical
> channel, it is different from a manufacturing and diagnostic
> perspective. If the physical SCSI channels are exposed, any SCSI
> command, including diagnostic ones, can be sent to an individual
> channel, which is very helpful on manufacturing lines. Furthermore,
> the diagnostic command can be sent simultaneously to all physical
> channels using the non-blocking mode that is supported by Extended
> SCSI Pass Thru Protocol. The diagnostic process may considerably
> benefit from the performance gain. In summary, it is suggested to
> expose physical SCSI channel whenever possible.

> 20.1.4.2 Start()
>
> [...]
>
> The Start() function tells the SCSI host controller driver to start
> managing the SCSI host controller. In this function, a single channel
> SCSI host controller driver uses chip-specific knowledge to perform
> the following tasks:
> * Initialize the SCSI host controller.
> * Enable the PCI device.
> * Allocate resources.
> * Construct data structures for the driver to use.
> * Install the Extended SCSI Pass Thru Protocol instance on the same
>   handle that has the PCI I/O Protocol.
>
> If the SCSI adapter is a multi-channel adapter, then the driver should
> also do the following:
>
> Enumerate the SCSI channels that are supported by the SCSI host
> controller.
> * Create child handles for each physical SCSI channel.
> * Append the device path for each channel handle.
> * Install the Device Path Protocol and Extended SCSI Pass Thru
>   Protocol on every newly created channel handle.

---------

So the trick is that the parent controller is the logical one (the
combined device -- the array), and the child controllers are the
physical ones (the individual "inexpensive" disks). The platform
firmware will ignore the individual physical disks for all intents and
purposes, but on "manufacturing lines", exposing the physical disks is
good for diagnosing problems.

Regarding the device paths of the child controllers: you can build the
device path for each child controller for example by appending a
VenMsg() device path node to the parent controller's device path. The
opaque data bytes in the VenMsg() node would carry hardware specific
identifying information for the individual physical disk.

If you don't want to expose the physical ("inexpensive") disks for any
purpose, then don't write a hybrid driver -- write a device driver.
Install EFI_ATA_PASS_THRU_PROTOCOL only on the "parent" handle (the one
with PciIo), produce no child handles, and set only the logical
attribute bit.

Thanks
Laszlo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
  2019-07-12 22:10 ` [edk2-devel] " Laszlo Ersek
@ 2019-07-15  5:25   ` Wu, Hao A
  2019-07-18 16:02     ` Ravi Kumar Siadri
  0 siblings, 1 reply; 12+ messages in thread
From: Wu, Hao A @ 2019-07-15  5:25 UTC (permalink / raw)
  To: Laszlo Ersek, siadriravikumaruefi@gmail.com
  Cc: devel@edk2.groups.io, Cetola, Stephano

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Saturday, July 13, 2019 6:11 AM
> To: siadriravikumaruefi@gmail.com
> Cc: devel@edk2.groups.io; Wu, Hao A; Cetola, Stephano
> Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
> 
> On 06/10/19 14:32, Ravi Kumar Siadri wrote:
> > Hi all,
> >
> > I have couple of queries regarding the
> > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL attribute support in
> > EFI_EXT_SCSI_PASS_THRU_PROTOCOL.
> >
> > 1.
> > The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface
> > tells if the interface is for physical SCSI devices or logical SCSI
> > devices. Drivers for non-RAID SCSI controllers will set both the
> > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the
> > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.
> >
> > If the Drivers is for non-RAID SCSI controllers why to set the
> > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any
> case
> > that non-RAID SCSI controllers have Logical devices connected to it ??
> >
> > 2.
> > Drivers for RAID controllers that allow access to the physical devices
> > and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL
> > interfaces: One with the just the
> > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set and another
> with
> > just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set. One
> > interface can be used to access the physical devices attached to the
> > RAID controller, and the other can be used to access the logical
> > devices attached to the RAID controller for its current configuration.
> >
> > Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2
> instances
> > ? why can't we install attributes
> > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL and
> > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL on same Instance ??
> How
> > User locates the Instance with
> > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with
> > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??
> 
> Please consult the UEFI Driver Writer's Guide on these questions. (What
> I have on my disk now is Version 1.01, for UEFI 2.3.1, released
> 03/08/2012.)

Thanks Laszlo,

The information mentioned above is really helpful.

As a supplementary, the UEFI Driver Writer's Guide is also available online at:
https://edk2-docs.gitbooks.io/edk-ii-uefi-driver-writer-s-guide/

Best Regards,
Hao Wu

> 
> Excerpts:
> 
> > 6.3 Hybrid drivers
> >
> > [...]
> >
> > A driver for a multi-channel RAID SCSI host controller is a hybrid
> > driver. It produces the Extended SCSI Pass Thru Protocol (with the
> > logical bit on) on the controller handle and creates child handles
> > with Extended SCSI Pass Thru Protocol for each physical channel (with
> > the logical bit off).
> 
> > 20.1.3 SCSI Adapters with RAID
> >
> > A SCSI host controller driver may also support SCSI adapters with RAID
> > capability. The following figure shows an example implementation with
> > two physical SCSI channels and one logical channel. The two physical
> > channels are implemented on the SCSI adapter. The RAID component then
> > configures these two channels to produce a logical SCSI channel. The
> > two physical channels each have Extended SCSI Pass Thru installed, but
> > these are not be used except for diagnostic use. For the logical
> > channel, the SCSI host controller driver produces another Extended
> > SCSI Pass Thru Protocol (with physical bit turned off) instance based
> > on the RAID configuration. Requests sent to the Extended SCSI Pass
> > Thru protocol for the logical channel are processed by the SCSI host
> > controller drivers and converted into requests on the physical SCSI
> > channels. The platform firmware must only enumerate and boot from SCSI
> > targets present on the logical SCSI channel.
> >
> > The SCSI adapter hardware may not be able to expose the physical SCSI
> > channel(s) to upper-level software when implementing RAID. If the
> > physical SCSI channel cannot be exposed to upper software, then the
> > SCSI host controller driver is only required to produce a single
> > logical channel for the RAID.
> >
> > Although the basic theory is the same as the one on a physical
> > channel, it is different from a manufacturing and diagnostic
> > perspective. If the physical SCSI channels are exposed, any SCSI
> > command, including diagnostic ones, can be sent to an individual
> > channel, which is very helpful on manufacturing lines. Furthermore,
> > the diagnostic command can be sent simultaneously to all physical
> > channels using the non-blocking mode that is supported by Extended
> > SCSI Pass Thru Protocol. The diagnostic process may considerably
> > benefit from the performance gain. In summary, it is suggested to
> > expose physical SCSI channel whenever possible.
> 
> > 20.1.4.2 Start()
> >
> > [...]
> >
> > The Start() function tells the SCSI host controller driver to start
> > managing the SCSI host controller. In this function, a single channel
> > SCSI host controller driver uses chip-specific knowledge to perform
> > the following tasks:
> > * Initialize the SCSI host controller.
> > * Enable the PCI device.
> > * Allocate resources.
> > * Construct data structures for the driver to use.
> > * Install the Extended SCSI Pass Thru Protocol instance on the same
> >   handle that has the PCI I/O Protocol.
> >
> > If the SCSI adapter is a multi-channel adapter, then the driver should
> > also do the following:
> >
> > Enumerate the SCSI channels that are supported by the SCSI host
> > controller.
> > * Create child handles for each physical SCSI channel.
> > * Append the device path for each channel handle.
> > * Install the Device Path Protocol and Extended SCSI Pass Thru
> >   Protocol on every newly created channel handle.
> 
> ---------
> 
> So the trick is that the parent controller is the logical one (the
> combined device -- the array), and the child controllers are the
> physical ones (the individual "inexpensive" disks). The platform
> firmware will ignore the individual physical disks for all intents and
> purposes, but on "manufacturing lines", exposing the physical disks is
> good for diagnosing problems.
> 
> Regarding the device paths of the child controllers: you can build the
> device path for each child controller for example by appending a
> VenMsg() device path node to the parent controller's device path. The
> opaque data bytes in the VenMsg() node would carry hardware specific
> identifying information for the individual physical disk.
> 
> If you don't want to expose the physical ("inexpensive") disks for any
> purpose, then don't write a hybrid driver -- write a device driver.
> Install EFI_ATA_PASS_THRU_PROTOCOL only on the "parent" handle (the
> one
> with PciIo), produce no child handles, and set only the logical
> attribute bit.
> 
> Thanks
> Laszlo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
  2019-07-15  5:25   ` Wu, Hao A
@ 2019-07-18 16:02     ` Ravi Kumar Siadri
  2019-07-18 21:10       ` Laszlo Ersek
  0 siblings, 1 reply; 12+ messages in thread
From: Ravi Kumar Siadri @ 2019-07-18 16:02 UTC (permalink / raw)
  To: Laszlo Ersek, michael.d.kinney, Leif Lindholm, Wu, Hao A,
	Cetola, Stephano
  Cc: devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 10612 bytes --]

Hi Laszlo Ersek / Hao Wu,

I have gone through the Guide, i can see some points which are not very
clear..

*1.  *
*Single-Channel SCSI Adapters*
*If the SCSI adapter supports one channel, then the SCSI host controller
driver*
*performs the following:*
*• Install Extended SCSI Pass Thru Protocol onto the controller handle for
the*
*SCSI host controller.*
*• Set the logical attribute for the SCSI channel in the mode structure.*
*• Set the physical attribute for the SCSI channel in the mode structure.*

*The platform firmware must only enumerate and boot from SCSI targets
present on the logical SCSI channel.*

Suppose a HBA controller (non RAID) has only Physical Devices connected to
it.(logical devices cannot be created on it).
What is the point in setting *logical attribute *in SCSI passthru handle,
when a controller cannot produce logical devices (as it is non RAID) ??

UEFI spec say logical SCSI passthru handle is to access the logical devices
attached to the RAID controller. Then what is the dependency here to
produce child handles (Block IO protocol) of Physical devices with the
logical SCSI passthru handle, when the controller cannot produce a logical
devices ??


*2. *
*EFI_EXT_SCSI_PASS_THRU_PROTOCOL.Mode is a structure that describes the
intrinsic*
*attributes of Extended SCSI Pass Thru Protocol instance. Note that a
non-RAID SCSI*
*channel sets both the physical and logical attributes. A physical channel
on the RAID*
*adapter only sets the physical attribute, and the logical channel on the
RAID adapter*
*only sets the logical attribute. If the channel supports non-blocking I/O,
the nonblocking attribute is also set*

*Of course, there are many possible designs for implementing SCSI RAID
functionality.*
*The point is that an SCSI host controller driver may be designed and
implemented for a*
*wide variety of SCSI adapters types, and those SCSI host controller
drivers can*
*produce the Extended SCSI Pass Thru Protocol for SCSI channels that
contain SCSI*
*targets that may be used as UEFI boot devices.*

All the implementations recommended are hacks/tricks to achieve the spec
defined way of SCSI pass Thru. To acheive this each Producers of scsi pass
thru protocol can follow a multiple ways. If this happens how a Consumer of
scsi pass thru (application or other drivers) can figure out the
implementation of producer if it is not defined in any standard
specification ?? how the producer and consumer of SCSI passthru are inline
??

I feel the current design is an over head and not cleary defined by UEFI
specification. Can't we update the way of implementation ??
I have a new design proposal which can make a scsi pass thru protocol more
clear and simple. Can you please check and comment on this.
https://edk2.groups.io/g/devel/files/Designs/2019/0710
<https://edk2.groups.io/g/devel/files/Designs/2019/0710>

I think the Driver Writer's Guide is designed by assuming the RAID
controllers will expose/produce only Logical Devices, but a there are some
RAID controllers which exposes a mix of Physical and Logical Devices (RAID
devices) as well.

Thanks,
Ravi Kumar

On Mon, Jul 15, 2019 at 10:55 AM Wu, Hao A <hao.a.wu@intel.com> wrote:

> > -----Original Message-----
> > From: Laszlo Ersek [mailto:lersek@redhat.com]
> > Sent: Saturday, July 13, 2019 6:11 AM
> > To: siadriravikumaruefi@gmail.com
> > Cc: devel@edk2.groups.io; Wu, Hao A; Cetola, Stephano
> > Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI
> devices
> >
> > On 06/10/19 14:32, Ravi Kumar Siadri wrote:
> > > Hi all,
> > >
> > > I have couple of queries regarding the
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL attribute support in
> > > EFI_EXT_SCSI_PASS_THRU_PROTOCOL.
> > >
> > > 1.
> > > The Attributes field of the EFI_EXT_SCSI_PASS_THRU_PROTOCOL interface
> > > tells if the interface is for physical SCSI devices or logical SCSI
> > > devices. Drivers for non-RAID SCSI controllers will set both the
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL, and the
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bits.
> > >
> > > If the Drivers is for non-RAID SCSI controllers why to set the
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit. Will there be any
> > case
> > > that non-RAID SCSI controllers have Logical devices connected to it ??
> > >
> > > 2.
> > > Drivers for RAID controllers that allow access to the physical devices
> > > and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTOCOL
> > > interfaces: One with the just the
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set and another
> > with
> > > just the EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set. One
> > > interface can be used to access the physical devices attached to the
> > > RAID controller, and the other can be used to access the logical
> > > devices attached to the RAID controller for its current configuration.
> > >
> > > Any background why EFI_EXT_SCSI_PASS_THRU_PROTOCOL needed 2
> > instances
> > > ? why can't we install attributes
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL and
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL on same Instance ??
> > How
> > > User locates the Instance with
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL bit set and Instance with
> > > EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL bit set. ??
> >
> > Please consult the UEFI Driver Writer's Guide on these questions. (What
> > I have on my disk now is Version 1.01, for UEFI 2.3.1, released
> > 03/08/2012.)
>
> Thanks Laszlo,
>
> The information mentioned above is really helpful.
>
> As a supplementary, the UEFI Driver Writer's Guide is also available
> online at:
> https://edk2-docs.gitbooks.io/edk-ii-uefi-driver-writer-s-guide/
>
> Best Regards,
> Hao Wu
>
> >
> > Excerpts:
> >
> > > 6.3 Hybrid drivers
> > >
> > > [...]
> > >
> > > A driver for a multi-channel RAID SCSI host controller is a hybrid
> > > driver. It produces the Extended SCSI Pass Thru Protocol (with the
> > > logical bit on) on the controller handle and creates child handles
> > > with Extended SCSI Pass Thru Protocol for each physical channel (with
> > > the logical bit off).
> >
> > > 20.1.3 SCSI Adapters with RAID
> > >
> > > A SCSI host controller driver may also support SCSI adapters with RAID
> > > capability. The following figure shows an example implementation with
> > > two physical SCSI channels and one logical channel. The two physical
> > > channels are implemented on the SCSI adapter. The RAID component then
> > > configures these two channels to produce a logical SCSI channel. The
> > > two physical channels each have Extended SCSI Pass Thru installed, but
> > > these are not be used except for diagnostic use. For the logical
> > > channel, the SCSI host controller driver produces another Extended
> > > SCSI Pass Thru Protocol (with physical bit turned off) instance based
> > > on the RAID configuration. Requests sent to the Extended SCSI Pass
> > > Thru protocol for the logical channel are processed by the SCSI host
> > > controller drivers and converted into requests on the physical SCSI
> > > channels. The platform firmware must only enumerate and boot from SCSI
> > > targets present on the logical SCSI channel.
> > >
> > > The SCSI adapter hardware may not be able to expose the physical SCSI
> > > channel(s) to upper-level software when implementing RAID. If the
> > > physical SCSI channel cannot be exposed to upper software, then the
> > > SCSI host controller driver is only required to produce a single
> > > logical channel for the RAID.
> > >
> > > Although the basic theory is the same as the one on a physical
> > > channel, it is different from a manufacturing and diagnostic
> > > perspective. If the physical SCSI channels are exposed, any SCSI
> > > command, including diagnostic ones, can be sent to an individual
> > > channel, which is very helpful on manufacturing lines. Furthermore,
> > > the diagnostic command can be sent simultaneously to all physical
> > > channels using the non-blocking mode that is supported by Extended
> > > SCSI Pass Thru Protocol. The diagnostic process may considerably
> > > benefit from the performance gain. In summary, it is suggested to
> > > expose physical SCSI channel whenever possible.
> >
> > > 20.1.4.2 Start()
> > >
> > > [...]
> > >
> > > The Start() function tells the SCSI host controller driver to start
> > > managing the SCSI host controller. In this function, a single channel
> > > SCSI host controller driver uses chip-specific knowledge to perform
> > > the following tasks:
> > > * Initialize the SCSI host controller.
> > > * Enable the PCI device.
> > > * Allocate resources.
> > > * Construct data structures for the driver to use.
> > > * Install the Extended SCSI Pass Thru Protocol instance on the same
> > >   handle that has the PCI I/O Protocol.
> > >
> > > If the SCSI adapter is a multi-channel adapter, then the driver should
> > > also do the following:
> > >
> > > Enumerate the SCSI channels that are supported by the SCSI host
> > > controller.
> > > * Create child handles for each physical SCSI channel.
> > > * Append the device path for each channel handle.
> > > * Install the Device Path Protocol and Extended SCSI Pass Thru
> > >   Protocol on every newly created channel handle.
> >
> > ---------
> >
> > So the trick is that the parent controller is the logical one (the
> > combined device -- the array), and the child controllers are the
> > physical ones (the individual "inexpensive" disks). The platform
> > firmware will ignore the individual physical disks for all intents and
> > purposes, but on "manufacturing lines", exposing the physical disks is
> > good for diagnosing problems.
> >
> > Regarding the device paths of the child controllers: you can build the
> > device path for each child controller for example by appending a
> > VenMsg() device path node to the parent controller's device path. The
> > opaque data bytes in the VenMsg() node would carry hardware specific
> > identifying information for the individual physical disk.
> >
> > If you don't want to expose the physical ("inexpensive") disks for any
> > purpose, then don't write a hybrid driver -- write a device driver.
> > Install EFI_ATA_PASS_THRU_PROTOCOL only on the "parent" handle (the
> > one
> > with PciIo), produce no child handles, and set only the logical
> > attribute bit.
> >
> > Thanks
> > Laszlo
>

[-- Attachment #2: Type: text/html, Size: 12916 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices
  2019-07-18 16:02     ` Ravi Kumar Siadri
@ 2019-07-18 21:10       ` Laszlo Ersek
  0 siblings, 0 replies; 12+ messages in thread
From: Laszlo Ersek @ 2019-07-18 21:10 UTC (permalink / raw)
  To: Ravi Kumar Siadri, michael.d.kinney, Leif Lindholm, Wu, Hao A,
	Cetola, Stephano
  Cc: devel@edk2.groups.io

On 07/18/19 18:02, Ravi Kumar Siadri wrote:
> Hi Laszlo Ersek / Hao Wu,
>
> I have gone through the Guide, i can see some points which are not
> very clear..
>
> [...]

Perhaps some examples will help.

In advance, I should mention a few things:

- This is just my interpretation of the spec, and of the guide.

- In my last email, the VenMsg suggestion was wrong. The device paths
  for the physical channel(s) are built by appending Ctrl(n) --
  "controller" -- hardware device path nodes, and not VenMsg() nodes.

- "Logical" means "channel with abstract devices, suitable for data
  access & booting", "Physical" means "channel with physical devices,
  used for diagnostics". A channel may be *both*, if each device on it
  is both physical and logical simultaneously -- that is, it can be used
  for data access / booting, and for low-level diagnostics.

So, the examples:

(A) non-RAID HBA

* Summary:

Handle#1: PciRoot(0x0)/Pci(0x1,0x0)               -- channel where each device is (L + P)
Handle#2: PciRoot(0x0)/Pci(0x1,0x0)/Scsi(0x1,0x0) -- disk that is (L + P)

* Details:

Handle#1:

- device path: PciRoot(0x0)/Pci(0x1,0x0)
- handle created by PciBusDxe [= platform firmware]
- device path protocol installed by PciBusDxe
- PciIo protocol installed by PciBusDxe
- ExtScsiPassThru protocol installed by the SCSI HBA driver, through
  consuming PciIo
- Logical bit set in ExtScsiPassThru: meaning that devices enumerated on
  this channel can be used for data access & booting
- Physical bit set in ExtScsiPassThru: meaning that devices enumerated
  on this channel can be sent diagnostic commands

Handle#2:

- device path: PciRoot(0x0)/Pci(0x1,0x0)/Scsi(0x1,0x0)
- handle created by ScsiBusDxe [= platform firmware]
- device path protocol installed by ScsiBusDxe (here: Target=1, Lun=0)
- ScsiIo protocol installed by ScsiBusDxe [= platform firmware], through
  consuming ExtScsiPassThru on Handle#1
- BlockIo protocol installed by ScsiDiskDxe [= platform firmware],
  through consuming ScsiIo on the same handle (= Handle#2)


(B) RAID HBA

* Summary:

Handle#1: PciRoot(0x0)/Pci(0x1,0x0)                         -- logical channel
Handle#2: PciRoot(0x0)/Pci(0x1,0x0)/Scsi(0x1,0x0)           -- logical disk
Handle#3: PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0)               -- physical channel
Handle#4: PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0)/Scsi(0x4,0x0) -- physical disk #0
Handle#5  PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0)/Scsi(0x4,0x1) -- physical disk #1

* Details:

Handle#1:

- The same as Handle#1 from (A), except the Physical bit is clear in the
  ExtScsiPassThru protocol instance.
- This handle stands for the logical channel.

Handle#2:
- The same as Handle#2 from (A).
- This handle stands for the logical disk.

Handle#3:
- Device path: PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0).
- Handle created by the SCSI HBA driver.
- Device path installed by the SCSI HBA driver.
- ExtScsiPassThru protocol installed by the SCSI HBA driver, through
  consuming PciIo on Handle#1.
- Logical bit is clear in ExtScsiPassThru.
- Physical bit is set in ExtScsiPassThru.
- This handle stands for the physical channel.

Handle#4:
- Device path: PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0)/Scsi(0x4,0x0)
- Handle created by ScsiBusDxe [= platform firmware].
- Device path protocol installed by ScsiBusDxe (here: Target=4, Lun=0).
- ScsiIo protocol installed by ScsiBusDxe [= platform firmware], through
  consuming ExtScsiPassThru on Handle#3.
- BlockIo protocol is *NOT* installed by ScsiDiskDxe [= platform
  firmware], due to the Logical bit being clear in ExtScsiPassThru on
  Handle#3.
- This handle stands for the first physical disk in the array.

Handle#5:
- Same as Handle#4, with the following differences:
- Device path: PciRoot(0x0)/Pci(0x1,0x0)/Ctrl(0x0)/Scsi(0x4,0x1).
- This handle stands for the second physical disk in the array.

Hope this helps,
Laszlo

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-07-18 21:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAHPR0Q2RMR2TXUgHchw5X-ojRx7DQL1xBisucHsVxxfc28Hd=w@mail.gmail.com>
2019-06-12  4:00 ` ExtScsiPassThru support for Logical SCSI devices Ravi Kumar Siadri
2019-06-12  7:55   ` [edk2-devel] " Wu, Hao A
2019-06-13  8:18     ` Ravi Kumar Siadri
2019-06-14  5:51       ` Wu, Hao A
2019-07-07  6:58         ` Ravi Kumar Siadri
2019-07-08  3:09           ` Wu, Hao A
2019-07-08  8:35             ` Ravi Kumar Siadri
2019-07-11 12:59               ` Wu, Hao A
2019-06-10 12:32 Ravi Kumar Siadri
2019-07-12 22:10 ` [edk2-devel] " Laszlo Ersek
2019-07-15  5:25   ` Wu, Hao A
2019-07-18 16:02     ` Ravi Kumar Siadri
2019-07-18 21:10       ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox