public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: "Ni, Ruiyu" <ruiyu.ni@intel.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"Gao, Liming" <liming.gao@intel.com>,
	"afish@apple.com" <afish@apple.com>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH v3 1/5] MdeModulePkg: introduce non-discoverable device protocol
Date: Fri, 18 Nov 2016 14:50:40 +0100	[thread overview]
Message-ID: <5DD889BC-CC56-4FFE-929E-C547515D0573@linaro.org> (raw)
In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D58E804E1@SHSMSX104.ccr.corp.intel.com>


On 18 Nov 2016, at 14:39, Ni, Ruiyu <ruiyu.ni@intel.com> wrote:

>>>>>>>>> 1. Can you add "PCI" keyword into the protocol name?
>>>>>>>>> e.g.: EDKII_NON_DISCOVERABLE_PCI_DEVICE_PROTOCOL_GUID
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> No. This protocol does not describe pci devices, and it is a peculiarity of the
>>>>>>>> edk2 driver stack that some non-pci devices can only be driven by pci drivers.
>>>>>>>> 
>>>>>>>> in other words, pci is part of the /driver/ side, and it is perfectly possible for,
>>>>>>>> e.g., a non-discoverable ahci device to be driven by a different non-pci driver
>>>>>>>> in the future.
>>>>>>>> 
>>>>>>> 
>>>>>>> I see. So some types of devices are handled by the current
>>>>>>> NonDiscoveablePciDevice driver, and some other types of devices may be
>>>>>>> handled by a future NonDiscoverableXXXDevice driver.
>>>>>>> Now since the AHCI type is already handled by the NonDiscoverablePciDevice
>>>>>>> driver, when there is a new NonDiscoverableXXXDevice driver, how can the two
>>>>>>> know whether it should manage the AHCI type device or not?
>>>>>> 
>>>>>> Good question. But how does the UEFI driver model deal with that? What happens if i have two drivers that both support
>>>> the
>>>>>> Ahci Pci class codes?
>>>>> PCI CFG header contains VendorID/DeviceID fields which can be used to distinguish
>>>>> them.
>>>>> 
>>>> 
>>>> No, that is not what I mean.
>>>> 
>>>> Your question is how we should deal with multiple drivers that
>>>> support, for instance, the AHCI non-discoverable device type. My
>>>> answer is that this is not any different from a platform configuration
>>>> that has more than one PCI I/O based driver that supports the AHCI PCI
>>>> class codes. The UEFI driver model has priority rules and protocols to
>>>> decide which driver gets precedence. I don't see how it should be any
>>>> different here.
>>> 
>>> I see they are different. Based on PciIo, the *HCI drivers can query
>>> additional information from PCI CFG header, instead of just using
>>> the PCI class code.
>>> 
>>> But with the NonDiscoverableDevice protocol, there is no additional
>>> information can help the *HCI drivers decide which to manage.
>>> 
>>> I don't see any practical negative point which prevents degrading
>>> NonDiscoverableDevice protocol to NonDiscoverable*Pci*Protocol.
>>> After all, as I said, all *HCI drivers are based on PciIo.
>>> 
>> 
>> Yes the *drivers* are based on PCI. But that does not make the
>> *devices* PCI devices. That is the whole problem we are trying to deal
>> with. So describing the non-PCI devices as PCI devices is incorrect
>> imo. The fact that we will use PCI drivers to drive non-PCI devices is
>> an implementation detail of EDK2, and is a property of the *driver*
>> side not the *device* side. So using PCI class codes etc to wire up
>> the correct driver should be local to the driver, and not pollute the
>> description of the device.
>> 
>> For example, if we would ever split the AHCI driver into a AHCI part
>> and a PCI part (which I know is unlikely to occur), I would want the
>> non-PCI AHCI driver to be used with the same protocol. Perhaps that
>> means we need a protocol for each type of device rather than an enum?
>> In any case, putting PCI-specific metadata into the device description
>> makes the situation worse, because now both the *device* and the
>> *driver* side are forced to use PCI internals to describe devices that
>> have nothing to do with PCI
> 
> If I understand correctly, you want the protocol producer can simply
> produce such protocol without the knowledge of PCI. I agree!
> But we do need to make the protocol definition stable enough. I do not
> like to see the enum type being extended in future to support more types
> of devices.
> 1. Can you use different GUIDs for different types of devices?

Yes that seems like a reasonable approach, in the spirit of EDK2 :-)

> 2. As I replied as comment #2 to patch 3/5, do you have better way to
> deal with the SDHCI Host controller driver access?


I need to think about this

  reply	other threads:[~2016-11-18 13:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-16 16:59 [PATCH v3 0/5] MdeModulePkg: add support for non-discoverable devices Ard Biesheuvel
2016-11-16 16:59 ` [PATCH v3 1/5] MdeModulePkg: introduce non-discoverable device protocol Ard Biesheuvel
2016-11-16 17:48   ` Leif Lindholm
2016-11-17  2:53     ` Ni, Ruiyu
2016-11-17  6:07       ` Ard Biesheuvel
2016-11-17  7:52         ` Ni, Ruiyu
2016-11-17 10:43           ` Ard Biesheuvel
2016-11-18  2:11             ` Ni, Ruiyu
2016-11-18  4:59               ` Ard Biesheuvel
2016-11-18  5:24                 ` Tian, Feng
2016-11-18  6:57                   ` Ard Biesheuvel
2016-11-18  8:39                     ` Tian, Feng
2016-11-18  8:52                       ` Ard Biesheuvel
2016-11-18  6:13                 ` Ni, Ruiyu
2016-11-18  7:04                   ` Ard Biesheuvel
2016-11-18 13:39                     ` Ni, Ruiyu
2016-11-18 13:50                       ` Ard Biesheuvel [this message]
2016-11-25 15:21                         ` Ard Biesheuvel
2016-11-16 16:59 ` [PATCH v3 2/5] MdeModule: introduce helper library to register non-discoverable devices Ard Biesheuvel
2016-11-16 16:59 ` [PATCH v3 3/5] MdeModulePkg: implement generic PCI I/O driver for " Ard Biesheuvel
2016-11-17  3:29   ` Ni, Ruiyu
2016-11-18 12:30     ` Ard Biesheuvel
2016-11-24 18:14       ` Ard Biesheuvel
2016-11-16 16:59 ` [PATCH v3 4/5] MdeModulePkg/NonDiscoverablePciDeviceDxe: add support for non-coherent DMA Ard Biesheuvel
2016-11-16 16:59 ` [PATCH v3 5/5] Omap35xxPkg/PciEmulation: port to new non-discoverable device infrastructure Ard Biesheuvel
2016-11-17  4:36 ` [PATCH v3 0/5] MdeModulePkg: add support for non-discoverable devices Marcin Wojtas
2016-11-23 14:31   ` Marcin Wojtas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5DD889BC-CC56-4FFE-929E-C547515D0573@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox