From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 2A2AB81EBD for ; Tue, 15 Nov 2016 00:31:33 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 15 Nov 2016 00:31:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,641,1473145200"; d="scan'208";a="1059626665" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga001.jf.intel.com with ESMTP; 15 Nov 2016 00:31:37 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 15 Nov 2016 00:31:36 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 15 Nov 2016 00:31:36 -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; Tue, 15 Nov 2016 16:31:35 +0800 From: "Ni, Ruiyu" To: Ard Biesheuvel , "edk2-devel@lists.01.org" , "leif.lindholm@linaro.org" , "Kinney, Michael D" , "afish@apple.com" CC: "Tian, Feng" , "Zeng, Star" Thread-Topic: [edk2] [PATCH v2 1/5] MdeModulePkg: introduce non-discoverable device protocol Thread-Index: AQHSNcdKFuxbf/2OQEuAJkuROA+AhqDZyCMw Date: Tue, 15 Nov 2016 08:31:34 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D58E78565@SHSMSX104.ccr.corp.intel.com> References: <1478173302-22349-1-git-send-email-ard.biesheuvel@linaro.org> In-Reply-To: <1478173302-22349-1-git-send-email-ard.biesheuvel@linaro.org> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2 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: Tue, 15 Nov 2016 08:31:33 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ard, For the below protocol structure, it assumes that the non-discoverable PCI device contains only one BAR and the type is limited to USB/AHCI/SD/UFS= /NVME devices. Could we have more types of such kind of device in future? Could we have a device that contains multiple BAR? Could we have a device that contains one BAR but the BAR size is non-defaul= t size? I am asking all about this is because I am thinking would it be more flexib= le to have platform provide a ACPI resource descriptors and the NonDiscoverableDxe dri= ver converts the ACPI resource descriptors to PCI BARs? You could refer to PciIo.GetBarAttributes() to see how one ACPI resource de= scriptor is created for one BAR. But please ignore my such concern if there is a spec to describe such non-d= iscoverable PCI device. Thanks/Ray > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Ard Biesheuvel > Sent: Thursday, November 3, 2016 7:42 PM > To: edk2-devel@lists.01.org; leif.lindholm@linaro.org; Kinney, Michael D > ; afish@apple.com > Cc: Tian, Feng ; Zeng, Star ; A= rd > Biesheuvel > Subject: [edk2] [PATCH v2 1/5] MdeModulePkg: introduce non-discoverable > device protocol >=20 > Introduce a protocol that can be exposed by a platform for devices that a= re > not discoverable, usually because they are wired straight to the memory b= us > rather than to an enumerable bus like PCI or USB. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel > --- > MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h | 88 > ++++++++++++++++++++ > MdeModulePkg/MdeModulePkg.dec | 3 + > 2 files changed, 91 insertions(+) >=20 > diff --git a/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h > b/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h > new file mode 100644 > index 000000000000..34388c0f99e3 > --- /dev/null > +++ b/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h > @@ -0,0 +1,88 @@ > +/** @file > + Protocol to describe devices that are not on a discoverable bus > + > + Copyright (c) 2016, Linaro, Ltd. All rights reserved.
> + > + This program and the accompanying materials are licensed and made > + available under the terms and conditions of the BSD License which > + accompanies this distribution. The full text of the license may be > + found at http://opensource.org/licenses/bsd-license.php > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > + > +**/ > + > +#ifndef __NON_DISCOVERABLE_DEVICE_H__ > +#define __NON_DISCOVERABLE_DEVICE_H__ > + > +#define NON_DISCOVERABLE_DEVICE_PROTOCOL_GUID \ > + { 0x0d51905b, 0xb77e, 0x452a, {0xa2, 0xc0, 0xec, 0xa0, 0xcc, 0x8d, > +0x51, 0x4a } } > + > +// > +// Protocol interface structure > +// > +typedef struct _NON_DISCOVERABLE_DEVICE > NON_DISCOVERABLE_DEVICE; > + > +// > +// Data Types > +// > +typedef enum { > + NonDiscoverableDeviceTypeAmba, > + NonDiscoverableDeviceTypeOhci, > + NonDiscoverableDeviceTypeUhci, > + NonDiscoverableDeviceTypeEhci, > + NonDiscoverableDeviceTypeXhci, > + NonDiscoverableDeviceTypeAhci, > + NonDiscoverableDeviceTypeSdhci, > + NonDiscoverableDeviceTypeUfs, > + NonDiscoverableDeviceTypeNvme, > + NonDiscoverableDeviceTypeMax, > +} NON_DISCOVERABLE_DEVICE_TYPE; > + > +typedef enum { > + NonDiscoverableDeviceDmaTypeCoherent, > + NonDiscoverableDeviceDmaTypeNonCoherent, > + NonDiscoverableDeviceDmaTypeMax, > +} NON_DISCOVERABLE_DEVICE_DMA_TYPE; > + > +// > +// Function Prototypes > +// > + > +/** > + Perform device specific initialization before the device is started > + > + @param This The non-discoverable device protocol pointer > + > + @retval EFI_SUCCESS Initialization successful, the device may be use= d > + @retval Other Initialization failed, device should not be star= ted > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *NON_DISCOVERABLE_DEVICE_INIT) ( > + IN NON_DISCOVERABLE_DEVICE *This > + ); > + > +struct _NON_DISCOVERABLE_DEVICE { > + // > + // The MMIO address of the device > + // > + EFI_PHYSICAL_ADDRESS BaseAddress; > + // > + // The type of device > + // > + NON_DISCOVERABLE_DEVICE_TYPE Type; > + // > + // Whether this device is DMA coherent > + // > + NON_DISCOVERABLE_DEVICE_DMA_TYPE DmaType; > + // > + // Initialization function for the device > + // > + NON_DISCOVERABLE_DEVICE_INIT Initialize; > +}; > + > +extern EFI_GUID gNonDiscoverableDeviceProtocolGuid; > + > +#endif > diff --git a/MdeModulePkg/MdeModulePkg.dec > b/MdeModulePkg/MdeModulePkg.dec index 74b870051c67..84b489d3fdb7 > 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -505,6 +505,9 @@ [Protocols] > # Include/Protocol/Ps2Policy.h > gEfiPs2PolicyProtocolGuid =3D { 0x4DF19259, 0xDC71, 0x4D46, { 0xBE, 0x= F1, > 0x35, 0x7B, 0xB5, 0x78, 0xC4, 0x18 } } >=20 > + ## Include/Protocol/NonDiscoverableDevice.h > + gNonDiscoverableDeviceProtocolGuid =3D { 0x0d51905b, 0xb77e, 0x452a, > + {0xa2, 0xc0, 0xec, 0xa0, 0xcc, 0x8d, 0x51, 0x4a } } > + > # > # [Error.gEfiMdeModulePkgTokenSpaceGuid] > # 0x80000001 | Invalid value provided. > -- > 2.7.4 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel