From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DF26D81EA7 for ; Fri, 18 Nov 2016 05:39:57 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 18 Nov 2016 05:40:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,509,1473145200"; d="scan'208";a="788001194" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by FMSMGA003.fm.intel.com with ESMTP; 18 Nov 2016 05:40:03 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 18 Nov 2016 05:40:02 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 18 Nov 2016 05:40:02 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.142]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.138]) with mapi id 14.03.0248.002; Fri, 18 Nov 2016 21:40:00 +0800 From: "Ni, Ruiyu" To: Ard Biesheuvel CC: "Kinney, Michael D" , "edk2-devel@lists.01.org" , "Gao, Liming" , "afish@apple.com" , Leif Lindholm Thread-Topic: [edk2] [PATCH v3 1/5] MdeModulePkg: introduce non-discoverable device protocol Thread-Index: AQHSQCraEwMvOFFyHUuvZ27kFPDix6DbXOsAgAEaWfD//7PxAIAAoCmg//+s9wCAAYc2YP//qxiAABMmGKD//4mqAP//WuVA Date: Fri, 18 Nov 2016 13:39:59 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D58E804E1@SHSMSX104.ccr.corp.intel.com> References: <1479315571-14953-1-git-send-email-ard.biesheuvel@linaro.org> <1479315571-14953-2-git-send-email-ard.biesheuvel@linaro.org> <20161116174848.GC27644@bivouac.eciton.net> <734D49CCEBEEF84792F5B80ED585239D58E7C6D4@SHSMSX104.ccr.corp.intel.com> <4E810E45-F1CC-429C-B3F4-FC6182F7D9B2@linaro.org> <734D49CCEBEEF84792F5B80ED585239D58E7D6F5@SHSMSX104.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D58E7FCF6@SHSMSX104.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D58E80120@SHSMSX104.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzNjYmFlZjQtNGIzYS00YjUyLTlhZDYtNzQzYWY0MzMzZmRmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX1BVQkxJQyJ9XX1dfSwiU3ViamVjdExhYmVscyI6W10sIlRNQ1ZlcnNpb24iOiIxNS45LjYuNiIsIlRydXN0ZWRMYWJlbEhhc2giOiJHVk9TdEh4bFwvaERIWjVSXC9sZnJtZmlvYWpUbEd3bHFYSG1OZEthcWxuTlE9In0= x-ctpclassification: CTP_PUBLIC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3 1/5] MdeModulePkg: introduce non-discoverable device protocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2016 13:39:58 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable >>>>>>>> 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 peculi= arity of the >>>>>>> edk2 driver stack that some non-pci devices can only be driven by p= ci drivers. >>>>>>> >>>>>>> in other words, pci is part of the /driver/ side, and it is perfect= ly possible for, >>>>>>> e.g., a non-discoverable ahci device to be driven by a different no= n-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 NonDiscoverablePci= Device >>>>>> 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? 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? > >Thanks, >Ard.