public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/5] MdeModulePkg: introduce non-discoverable device protocol
@ 2016-11-03 11:41 Ard Biesheuvel
  2016-11-03 11:41 ` [PATCH v2 2/5] MdeModule: introduce helper library to register non-discoverable devices Ard Biesheuvel
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Ard Biesheuvel @ 2016-11-03 11:41 UTC (permalink / raw)
  To: edk2-devel, leif.lindholm, michael.d.kinney, afish
  Cc: mw, feng.tian, star.zeng, Ard Biesheuvel

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 <ard.biesheuvel@linaro.org>
---
 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.<BR>
+
+  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



^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-11-16 11:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-03 11:41 [PATCH v2 1/5] MdeModulePkg: introduce non-discoverable device protocol Ard Biesheuvel
2016-11-03 11:41 ` [PATCH v2 2/5] MdeModule: introduce helper library to register non-discoverable devices Ard Biesheuvel
2016-11-03 11:41 ` [PATCH v2 3/5] MdeModulePkg: implement generic PCI I/O driver for " Ard Biesheuvel
2016-11-15  8:40   ` Ni, Ruiyu
2016-11-15 11:30     ` Ard Biesheuvel
2016-11-16 11:43       ` Ard Biesheuvel
2016-11-16 11:47         ` Ni, Ruiyu
2016-11-03 11:41 ` [PATCH v2 4/5] MdeModulePkg/NonDiscoverablePciDeviceDxe: add support for non-coherent DMA Ard Biesheuvel
2016-11-03 11:41 ` [PATCH v2 5/5] Omap35xxPkg/PciEmulation: port to new non-discoverable device infrastructure Ard Biesheuvel
2016-11-15  8:31 ` [PATCH v2 1/5] MdeModulePkg: introduce non-discoverable device protocol Ni, Ruiyu
2016-11-15 11:29   ` Ard Biesheuvel
2016-11-15  8:38 ` Ni, Ruiyu
2016-11-15 11:29   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox