From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::231]) (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 EBBFF81CF5 for ; Thu, 3 Nov 2016 04:41:47 -0700 (PDT) Received: by mail-wm0-x231.google.com with SMTP id t79so94877395wmt.0 for ; Thu, 03 Nov 2016 04:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=R6tU3t3Bk5Ew02gtJSve+tJEtWKmrFVapfzQdvZD2KU=; b=ic9105JBHmUVnAjoovda1+mRy76l1j0W125eR6Q2g3Ov2RH2UXnt7WnbL/beb9pHXd mkep8xUBQFkslCA4W5evHTOaaoUkn6HOJTSNrBJzM0v5CUeD9EjKmb8xb3fFuiYvswcS ytfQreqEm7E6vf2tHycJNvNy5hGrL5/MJ1b18= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=R6tU3t3Bk5Ew02gtJSve+tJEtWKmrFVapfzQdvZD2KU=; b=Aw+GTIU0VteMPSyizcutMq3S/rRDl2sJ6GfCAVwWKaoOu4g2UCDktG8OblYyq8z1Jk na75Gr5PrxEpXXvUzA4vW6XvJNIdfFcQmhla+Qrzgi9FxASoCYRdIqqSVjehuXKL4r+d h2hEP7ht9Rn5D+8sOWvE8Af9YSS7VW30Kd9O3qJsOTkABj5ods05v3LCFjEOB2yYEhTF F2iFfIytzHsq8JKGOZ+vsd+NpkiEERNhQJV9khm5eCftIVq1aY9D0veM8rnk/5Dmernb WcIpBb15nB4gfme+Rqi4f6gU/CbAa570IggkNieBdf9oemTHqmi5TR9QjguGHJPafHjb 2yYw== X-Gm-Message-State: ABUngvfoOcvUKkr4Nr/KCtdy/SVyt5qHu+sJe1BTGJGCts9EEK2HwUWkYO2SWk/r8AM1hcxX X-Received: by 10.28.47.15 with SMTP id v15mr8424370wmv.76.1478173308431; Thu, 03 Nov 2016 04:41:48 -0700 (PDT) Received: from localhost.localdomain ([105.151.153.127]) by smtp.gmail.com with ESMTPSA id za1sm8108371wjb.8.2016.11.03.04.41.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Nov 2016 04:41:47 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, michael.d.kinney@intel.com, afish@apple.com Cc: mw@semihalf.com, feng.tian@intel.com, star.zeng@intel.com, Ard Biesheuvel Date: Thu, 3 Nov 2016 11:41:38 +0000 Message-Id: <1478173302-22349-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [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: Thu, 03 Nov 2016 11:41:48 -0000 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 | 88 ++++++++++++++++++++ MdeModulePkg/MdeModulePkg.dec | 3 + 2 files changed, 91 insertions(+) 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 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 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 = { 0x4DF19259, 0xDC71, 0x4D46, { 0xBE, 0xF1, 0x35, 0x7B, 0xB5, 0x78, 0xC4, 0x18 } } + ## Include/Protocol/NonDiscoverableDevice.h + gNonDiscoverableDeviceProtocolGuid = { 0x0d51905b, 0xb77e, 0x452a, {0xa2, 0xc0, 0xec, 0xa0, 0xcc, 0x8d, 0x51, 0x4a } } + # # [Error.gEfiMdeModulePkgTokenSpaceGuid] # 0x80000001 | Invalid value provided. -- 2.7.4