From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Fri, 12 Jul 2019 15:10:41 -0700 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B4F72285AE; Fri, 12 Jul 2019 22:10:40 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-65.ams2.redhat.com [10.36.116.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 444A55DE62; Fri, 12 Jul 2019 22:10:39 +0000 (UTC) Subject: Re: [edk2-devel] ExtScsiPassThru support for Logical SCSI devices To: siadriravikumaruefi@gmail.com References: <15109.1560169952219160072@groups.io> From: "Laszlo Ersek" Cc: devel@edk2.groups.io, Hao A Wu , Stephano Cetola Message-ID: <20b41687-a450-b81e-2393-96549100b13d@redhat.com> Date: Sat, 13 Jul 2019 00:10:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <15109.1560169952219160072@groups.io> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 12 Jul 2019 22:10:40 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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