From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: afish@apple.com, mw@semihalf.com, leif.lindholm@linaro.org, Ard Biesheuvel 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: [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 16:59:38 -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 | 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, + 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