Introduce a protocol that can be exposed by a platform for devices that
can be driven by a PCI driver, (e.g., AHCI, XHCI), but do not live on a
PCI bus. This used to be called 'PCI emulation' but given that we only
emulate the PCI config space and nothing else, it tends to be a bit
confusing so this introduces the term 'platform PCI I/O' instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
---
 EmbeddedPkg/EmbeddedPkg.dec                  |  1 +
 EmbeddedPkg/Include/Protocol/PlatformPciIo.h | 74 ++++++++++++++++++++
 2 files changed, 75 insertions(+)

diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index 2c2cf41103c2..84a6f4d01077 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -69,6 +69,7 @@ [Protocols.common]
   gAndroidFastbootPlatformProtocolGuid =  { 0x524685a0, 0x89a0, 0x11e3, {0x9d, 
0x4d, 0xbf, 0xa9, 0xf6, 0xa4, 0x03, 0x08}}
   gUsbDeviceProtocolGuid =  { 0x021bd2ca, 0x51d2, 0x11e3, {0x8e, 0x56, 0xb7, 
0x54, 0x17, 0xc7,  0x0b, 0x44 }}
   gPlatformGpioProtocolGuid = { 0x52ce9845, 0x5af4, 0x43e2, {0xba, 0xfd, 0x23, 
0x08, 0x12, 0x54, 0x7a, 0xc2 }}
+  gPlatformPciIoProtocolGuid = { 0x0d51905b, 0xb77e, 0x452a, {0xa2, 0xc0, 
0xec, 0xa0, 0xcc, 0x8d, 0x51, 0x4a }}
 
 [PcdsFeatureFlag.common]
   gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|FALSE|BOOLEAN|0x00000001
diff --git a/EmbeddedPkg/Include/Protocol/PlatformPciIo.h 
b/EmbeddedPkg/Include/Protocol/PlatformPciIo.h
new file mode 100644
index 000000000000..a7bd584049ac
--- /dev/null
+++ b/EmbeddedPkg/Include/Protocol/PlatformPciIo.h
@@ -0,0 +1,74 @@
+/** @file
+
+  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 __PLATFORM_PCI_IO_H__
+#define __PLATFORM_PCI_IO_H__
+
+#define PLATFORM_PCI_IO_PROTOCOL_GUID \
+  { 0x0d51905b, 0xb77e, 0x452a, {0xa2, 0xc0, 0xec, 0xa0, 0xcc, 0x8d, 0x51, 
0x4a } }
+
+//
+// Protocol interface structure
+//
+typedef struct _PLATFORM_PCI_IO PLATFORM_PCI_IO;
+
+//
+// Data Types
+//
+typedef enum {
+  PlatformPciIoDeviceOhci,
+  PlatformPciIoDeviceUhci,
+  PlatformPciIoDeviceEhci,
+  PlatformPciIoDeviceXhci,
+  PlatformPciIoDeviceAhci,
+  PlatformPciIoDeviceMax,
+} PLATFORM_PCI_IO_DEVICE_TYPE;
+
+typedef enum {
+  PlatformPciIoDmaCoherent,
+  PlatformPciIoDmaNonCoherent,
+  PlatformPciIoDmaMax,
+} PLATFORM_PCI_IO_DMA_TYPE;
+
+//
+// Function Prototypes
+//
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_PCI_IO_INIT) (
+  IN  PLATFORM_PCI_IO     *This
+  );
+
+struct _PLATFORM_PCI_IO {
+  //
+  // The MMIO address of the device
+  //
+  EFI_PHYSICAL_ADDRESS          BaseAddress;
+  //
+  // The type of device
+  //
+  PLATFORM_PCI_IO_DEVICE_TYPE   DeviceType;
+  //
+  // Whether this device is DMA coherent
+  //
+  PLATFORM_PCI_IO_DMA_TYPE      DmaType;
+  //
+  // Initialization function for the device
+  //
+  PLATFORM_PCI_IO_INIT          Initialize;
+};
+
+extern EFI_GUID gPlatformPciIoProtocolGuid;
+
+#endif
-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to