From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F+oeBeW3; spf=pass (domain: gmail.com, ip: 209.85.219.172, mailfrom: siadriravikumaruefi@gmail.com) Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by groups.io with SMTP; Thu, 18 Jul 2019 09:02:47 -0700 Received: by mail-yb1-f172.google.com with SMTP id d9so4980169ybf.3 for ; Thu, 18 Jul 2019 09:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=haqifgOynq3O+4d8UiMzH8rucMRY9MsKZKMLL4ILFWc=; b=F+oeBeW3O2IJwQWmie/1Gtb7vvKr8+uWYrxaGalYMXf/X4CQdwPr6qoTs/O2lxWji4 pDQVLPn2Mhjs1KkXUHzO178u50guVjSOYiu+2sIzJo3SOuR7VRvA33Dkf8CfOf/WRVkR WvCBw8hUIeqArja9HMHHyXtWxfLT4INmW+2OiSGoWlNaCzz9qqsW33Z1pOqHn3GZpEZu lts0GeoEE2XzFxAFjlcAMZGZ5fL319/ZHMraLi/CzDs3WUYnIakLlH7KJJd24YoNph0c rLusykKmemzKtCQHSDvt7ddgdoWu8kItgRuyCW0RgODLX11S3JkBSif4LzbmDkHFVkIZ vMrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=haqifgOynq3O+4d8UiMzH8rucMRY9MsKZKMLL4ILFWc=; b=kn44a6GqOhX1E2MOQIqkLd1sPnHXISM3VIJ3d0Fk66DDf2GCU5MDHUYqwssVEHuZ8B DioEy5QhS18MQOH8IeFPOQZB3OpBgAyChShY6n2C1X6V4wjFuL8ks79nZB7RC/18sAky KcA8wfl/APY8nR21WoQESknTuSfs/VQAfO6Bq7uflgeZ7j5cdI2dQDEgzHzKoMRvZxgb gLeZCJzbfMKfIeyUa1Bu71oZtxhMlOGt4sNvL1Q4O58+bKNHBy+hH7LsLkTxHcM32Wly 9jnLn6SkNsKHlnCw2lDO6QkIoOY9e4rw1gvieJaALJDPbWuQI00Z2GeTerQC/8DV+u8/ v2/w== X-Gm-Message-State: APjAAAXFixbYPcNPfLdQvn6E0aUjITyRbBZgs9ob/F+w54N0zkTUGAfX Mc5Lnk0rrCy6vv93ffQuQo2XuFzBwqMaZSK49UE= X-Google-Smtp-Source: APXvYqxKd2+LhhE0tUzbaIQkuYO3HdHqVjXSpmYEFonfu7du8P+27FOrEP4M1/fvWQSLmM0dW7CBdXebvnd/BEO/rI0= X-Received: by 2002:a25:910a:: with SMTP id v10mr31443662ybl.33.1563465766678; Thu, 18 Jul 2019 09:02:46 -0700 (PDT) MIME-Version: 1.0 References: <15109.1560169952219160072@groups.io> <20b41687-a450-b81e-2393-96549100b13d@redhat.com> In-Reply-To: From: "Ravi Kumar Siadri" Date: Thu, 18 Jul 2019 21:32:35 +0530 Message-ID: Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices To: Laszlo Ersek , michael.d.kinney@intel.com, Leif Lindholm , "Wu, Hao A" , "Cetola, Stephano" Cc: "devel@edk2.groups.io" Content-Type: multipart/alternative; boundary="000000000000a432f1058df6bd9f" --000000000000a432f1058df6bd9f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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:* *=E2=80=A2 Install Extended SCSI Pass Thru Protocol onto the controller han= dle for the* *SCSI host controller.* *=E2=80=A2 Set the logical attribute for the SCSI channel in the mode struc= ture.* *=E2=80=A2 Set the physical attribute for the SCSI channel in the mode stru= cture.* *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 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 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 device= s > > > 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 RAI= D > > > 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, bu= t > > > 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 SCS= I > > > 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 shoul= d > > > 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 > --000000000000a432f1058df6bd9f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Laszlo Ersek / Hao Wu,

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

1.=C2=A0=C2=A0
Single= -Channel SCSI Adapters
If the SCSI adapter supports one ch= annel, then the SCSI host controller driver
performs the f= ollowing:
=E2=80=A2 Install Extended SCSI Pass Thru Protoc= ol onto the controller handle for the
SCSI host controller= .
=E2=80=A2 Set the logical attribute for the SCSI channel= in the mode structure.
=E2=80=A2 Set the physical attribu= te for the SCSI channel in the mode structure.

The platform firmware must only enumerate and boot from SCSI tar= gets present on the logical SCSI channel.

Supp= ose a HBA controller (non RAID) has only Physical Devices connected to it.(= logical devices cannot be created on it).
What is the point in se= tting=C2=A0logical attribute=C2=A0in SCSI passthru handle, when a co= ntroller cannot produce logical devices (as it is non RAID) ??
UEFI spec say logical SCSI passthru handle is to access the lo= gical 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 logi= cal devices ??


2.=C2=A0
EFI_EXT_SCSI_PASS_THRU_PROTOCOL.Mode is a structure that describes= the intrinsic
attributes of Extended SCSI Pass Thru Proto= col 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 t= he channel supports non-blocking I/O, the nonblocking attribute is also set=

Of course, there are many poss= ible designs for implementing SCSI RAID functionality.
The= point is that an SCSI host controller driver may be designed and implement= ed for a
wide variety of SCSI adapters types, and those SC= SI host controller drivers can
produce the Extended SCSI P= ass Thru Protocol for SCSI channels that contain SCSI
targ= ets that may be used as UEFI boot devices.

All the implementations recommended are hacks/tricks to achieve the spec= =C2=A0 defined way of SCSI pass Thru. To acheive this each Producers of scs= i pass thru protocol can follow a multiple ways. If this happens how a Cons= umer of scsi pass thru (application or other drivers) can figure out the im= plementation 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 def= ined by UEFI specification. Can't we update the way of implementation ?= ?
I have a new design proposal which can make a scsi pass thru pr= otocol more clear and simple. Can you please check and comment on this.=C2= =A0https://edk2.groups.io/g/devel/files/Designs/2019/0710=C2=A0



> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Saturday, July 13, 2019 6:11 AM
> To: siadriravikumaruefi@gmail.com
> Cc: devel@ed= k2.groups.io; Wu, Hao A; Cetola, Stephano
> Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI dev= ices
>
> 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 inter= face
> > tells if the interface is for physical SCSI devices or logical SC= SI
> > devices. Drivers for non-RAID SCSI controllers will set both the<= br> > > 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<= br> > case
> > that non-RAID SCSI controllers have Logical devices connected to = it ??
> >
> > 2.
> > Drivers for RAID controllers that allow access to the physical de= vices
> > and logical devices will produce two EFI_EXT_SCSI_PASS_THRU_PROTO= COL
> > 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<= br> > > devices attached to the RAID controller for its current configura= tion.
> >
> > 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 wi= th
> > 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 on= line 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 hybri= d
> > driver. It produces the Extended SCSI Pass Thru Protocol (with th= e
> > logical bit on) on the controller handle and creates child handle= s
> > 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 physi= cal
> > 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<= br> > > channel, the SCSI host controller driver produces another Extende= d
> > SCSI Pass Thru Protocol (with physical bit turned off) instance b= ased
> > on the RAID configuration. Requests sent to the Extended SCSI Pas= s
> > Thru protocol for the logical channel are processed by the SCSI h= ost
> > controller drivers and converted into requests on the physical SC= SI
> > 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 t= he
> > SCSI host controller driver is only required to produce a single<= br> > > 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<= br> > > command, including diagnostic ones, can be sent to an individual<= br> > > channel, which is very helpful on manufacturing lines. Furthermor= e,
> > the diagnostic command can be sent simultaneously to all physical=
> > channels using the non-blocking mode that is supported by Extende= d
> > SCSI Pass Thru Protocol. The diagnostic process may considerably<= br> > > 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 sta= rt
> > managing the SCSI host controller. In this function, a single cha= nnel
> > SCSI host controller driver uses chip-specific knowledge to perfo= rm
> > 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 sa= me
> >=C2=A0 =C2=A0handle that has the PCI I/O Protocol.
> >
> > If the SCSI adapter is a multi-channel adapter, then the driver s= hould
> > 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 > >=C2=A0 =C2=A0Protocol 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 plat= form
> firmware will ignore the individual physical disks for all intents and=
> purposes, but on "manufacturing lines", exposing the physica= l 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" hand= le (the
> one
> with PciIo), produce no child handles, and set only the logical
> attribute bit.
>
> Thanks
> Laszlo
--000000000000a432f1058df6bd9f--