From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CBC1A81EBF for ; Wed, 16 Nov 2016 09:48:46 -0800 (PST) Received: by mail-wm0-x230.google.com with SMTP id f82so89159930wmf.1 for ; Wed, 16 Nov 2016 09:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=IFZBNIOxc1Fa8nr9ip0WTgv/f5li5OgOeOJ8G9mqYf4=; b=PJTcizCRxT3YtFli1NJfc21eSubJ/kpxoXbRhH+2HFh//imssOU20bmOKsqmcWhWy8 xJJQqem56in+jhsRglAbzSk9+YXu2j0fzIcnNRN40f6qFnG91hr0J1rw2Vb7d44Ywym/ 3NsYxgUn7A45fo03kVIWHoNCB8puWhiT7hzVw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=IFZBNIOxc1Fa8nr9ip0WTgv/f5li5OgOeOJ8G9mqYf4=; b=bkLK/GfjTu4oyS5qk9BHhHpJccWCMVKeHFW9V/ZObvsHtMA/EAJEQHZ71HIrUq1i/F Gx0b3H34NzloPFL775wvxWxBi8giZ1kbWTZSYAZoO1XQu8NeIfFaBq0wfcLebeGb2nKa cjZq+YryhPcn5uvN883EYSxJU4o+k11CSVTCkYJ2czGrmqLRylT3PNzp2p/YY1u1/3jv ffzecnMtvh34/mCBqLFD54kH3xSgm/4j4zBLkgzXbFi4L04e1TAXEejOvZguc7KT81na Gxj+w1Y9dB33N+/F00YKpMMwkkY/KvOvdwytG1EzMDMRomWugw6VproYn/LKgTEmrAR7 CHMQ== X-Gm-Message-State: ABUngvfKJKLaLmBeMFmkeab5KAs+ZFbeX9oo0enmpOzKhIe42XdFm0vw4GnnMXXjwHdpjw+a X-Received: by 10.28.19.196 with SMTP id 187mr11966573wmt.81.1479318530482; Wed, 16 Nov 2016 09:48:50 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id xu5sm19207373wjc.49.2016.11.16.09.48.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Nov 2016 09:48:49 -0800 (PST) Date: Wed, 16 Nov 2016 17:48:48 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, liming.gao@intel.com, ruiyu.ni@intel.com, michael.d.kinney@intel.com, afish@apple.com, mw@semihalf.com Message-ID: <20161116174848.GC27644@bivouac.eciton.net> References: <1479315571-14953-1-git-send-email-ard.biesheuvel@linaro.org> <1479315571-14953-2-git-send-email-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <1479315571-14953-2-git-send-email-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) 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: Wed, 16 Nov 2016 17:48:47 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Nov 16, 2016 at 04:59:27PM +0000, Ard Biesheuvel wrote: > Introduce a protocol that can be exposed by a platform for devices that > are not discoverable, usually because they are wired straight to the > memory bus rather than to an enumerable bus like PCI or USB. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel > --- > MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h | 90 ++++++++++++++++++++ > MdeModulePkg/MdeModulePkg.dec | 3 + > 2 files changed, 93 insertions(+) > > diff --git a/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h b/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h > new file mode 100644 > index 000000000000..47ed841b407b > --- /dev/null > +++ b/MdeModulePkg/Include/Protocol/NonDiscoverableDevice.h > @@ -0,0 +1,90 @@ > +/** @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__ > + > +#include > + > +#define EDKII_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, Just one OCD comment/question left: Can we keep these sorted alphabetically? (Also in switch statements in later patches?) Other than that, I'm (very) happy with this series. / Leif > + 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 used > + @retval Other Initialization failed, device should not be started > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *NON_DISCOVERABLE_DEVICE_INIT) ( > + IN NON_DISCOVERABLE_DEVICE *This > + ); > + > +struct _NON_DISCOVERABLE_DEVICE { > + // > + // 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; > + // > + // The MMIO and I/O regions owned by the device > + // > + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Resources; > +}; > + > +extern EFI_GUID gEdkiiNonDiscoverableDeviceProtocolGuid; > + > +#endif > diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec > index 74b870051c67..6b956fc80c93 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -505,6 +505,9 @@ [Protocols] > # Include/Protocol/Ps2Policy.h > gEfiPs2PolicyProtocolGuid = { 0x4DF19259, 0xDC71, 0x4D46, { 0xBE, 0xF1, 0x35, 0x7B, 0xB5, 0x78, 0xC4, 0x18 } } > > + ## Include/Protocol/NonDiscoverableDevice.h > + gEdkiiNonDiscoverableDeviceProtocolGuid = { 0x0d51905b, 0xb77e, 0x452a, {0xa2, 0xc0, 0xec, 0xa0, 0xcc, 0x8d, 0x51, 0x4a } } > + > # > # [Error.gEfiMdeModulePkgTokenSpaceGuid] > # 0x80000001 | Invalid value provided. > -- > 2.7.4 >