From patchwork Wed Nov 16 16:59:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 82567 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp303365obn; Wed, 16 Nov 2016 08:59:46 -0800 (PST) X-Received: by 10.98.70.74 with SMTP id t71mr5951423pfa.47.1479315586111; Wed, 16 Nov 2016 08:59:46 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id e5si32637368pgg.98.2016.11.16.08.59.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Nov 2016 08:59:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9A7B081EF4; Wed, 16 Nov 2016 08:59:40 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (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 DDBF681E4E for ; Wed, 16 Nov 2016 08:59:37 -0800 (PST) Received: by mail-wm0-x236.google.com with SMTP id f82so86114251wmf.1 for ; Wed, 16 Nov 2016 08:59:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5FLPufA2esJPHQyAaIFZHK97Ofz071at7ikXQdI+5QQ=; b=LUaEYhjkahbzdBhcoDytc+tOmFpmbcEtU+c1Is25ywajv0K2AySHSBbwa5ZFORxuMD zdshgNJTJDziFNjGHeP9ybTlXgXhfca60jLzB/Vs9r5uEmC0gJcwBsERlpfFljDcqQat +JSZcR/qkTFJ0Q0G6VRGCEvi8JWACaN+LwJnk= 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:in-reply-to :references; bh=5FLPufA2esJPHQyAaIFZHK97Ofz071at7ikXQdI+5QQ=; b=DpHomVGRT+vSDs5FUxHgKwDwJFPT+QXnkiJm8TMRNCO1X/Ht0gu+3nipRWd2Udl/2F GpvD4NWxyNN70Ur5u/fHpa6ruzqPdp7Up46VoQpseLMyyk+oc5Gz4zwLVV/urUkh18/5 oVKdJqlWRSPgrGTNeY45qz75grj0NOc6wAM/qeAoGp4an5zzt2IKbLfWLfC/U46/JCHV n9vm/+bU4EmUCLYcfnRcyS3ste5ryc4xd4bstmCXUIi8KLqXBqRMYDJH33fWXsHB4XgC dMu+QulT1wzG4H6jUuzv/y5kydCz0m4p4K5Ds2FFPLOKPmpS9joSKSE4BKgCmbeDDuwS 9dHA== X-Gm-Message-State: ABUngvf7d1QpJcHeEgRRxA9+SfYUli46qMi/FRBCBjRXo9GPKLPYvK7jhDjD9rwe/Hi1C+aq X-Received: by 10.28.52.76 with SMTP id b73mr11854468wma.8.1479315581571; Wed, 16 Nov 2016 08:59:41 -0800 (PST) Received: from localhost.localdomain ([105.137.104.147]) by smtp.gmail.com with ESMTPSA id gk6sm41485516wjc.21.2016.11.16.08.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Nov 2016 08:59:40 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, liming.gao@intel.com, ruiyu.ni@intel.com, michael.d.kinney@intel.com Date: Wed, 16 Nov 2016 16:59:27 +0000 Message-Id: <1479315571-14953-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479315571-14953-1-git-send-email-ard.biesheuvel@linaro.org> References: <1479315571-14953-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [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: , Cc: afish@apple.com, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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, + 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.