]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Protocol/DeviceIo.h
MdePkg: Clean up source files
[mirror_edk2.git] / MdePkg / Include / Protocol / DeviceIo.h
index 0bc4394904750d14c878b21a7ff9ff93ad29694c..e54b4694e35ed2765a5f5176624660a3efa49186 100644 (file)
@@ -4,14 +4,14 @@
   Device IO is used to abstract hardware access to devices. It includes\r
   memory mapped IO, IO, PCI Config space, and DMA.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
-  All rights reserved. This program and the accompanying materials                          \r
-  are licensed and made available under the terms and conditions of the BSD License         \r
-  which accompanies this distribution.  The full text of the license may be found at        \r
-  http://opensource.org/licenses/bsd-license.php                                            \r
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
 \r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
 \r
 typedef struct _EFI_DEVICE_IO_PROTOCOL EFI_DEVICE_IO_PROTOCOL;\r
 \r
-//\r
-// Protocol GUID name defined in EFI1.1.\r
-// \r
+///\r
+/// Protocol GUID name defined in EFI1.1.\r
+///\r
 #define DEVICE_IO_PROTOCOL  EFI_DEVICE_IO_PROTOCOL_GUID\r
 \r
-//\r
-// Protocol defined in EFI1.1.\r
-// \r
+///\r
+/// Protocol defined in EFI1.1.\r
+///\r
 typedef EFI_DEVICE_IO_PROTOCOL  EFI_DEVICE_IO_INTERFACE;\r
 \r
+///\r
+/// Device IO Access Width\r
+///\r
 typedef enum {\r
-  IO_UINT8,\r
-  IO_UINT16,\r
-  IO_UINT32,\r
-  IO_UINT64,\r
-  MMIO_COPY_UINT8,\r
-  MMIO_COPY_UINT16,\r
-  MMIO_COPY_UINT32,\r
-  MMIO_COPY_UINT64\r
+  IO_UINT8  = 0,\r
+  IO_UINT16 = 1,\r
+  IO_UINT32 = 2,\r
+  IO_UINT64 = 3,\r
+  //\r
+  // Below enumerations are added in "Extensible Firmware Interface Specification,\r
+  // Version 1.10, Specification Update, Version 001".\r
+  //\r
+  MMIO_COPY_UINT8  = 4,\r
+  MMIO_COPY_UINT16 = 5,\r
+  MMIO_COPY_UINT32 = 6,\r
+  MMIO_COPY_UINT64 = 7\r
 } EFI_IO_WIDTH;\r
 \r
-/**                                                                 \r
+/**\r
   Enables a driver to access device registers in the appropriate memory or I/O space.\r
-    \r
+\r
   @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
-  @param  Width                 Signifies the width of the I/O operations.                                                                   \r
-  @param  Address               The base address of the I/O operations. \r
+  @param  Width                 Signifies the width of the I/O operations.\r
+  @param  Address               The base address of the I/O operations.\r
   @param  Count                 The number of I/O operations to perform.\r
   @param  Buffer                For read operations, the destination buffer to store the results. For write\r
-                                operations, the source buffer to write data from.                \r
+                                operations, the source buffer to write data from. If\r
+                                Width is MMIO_COPY_UINT8, MMIO_COPY_UINT16,\r
+                                MMIO_COPY_UINT32, or MMIO_COPY_UINT64, then\r
+                                Buffer is interpreted as a base address of an I/O operation such as Address.\r
 \r
   @retval EFI_SUCCESS           The data was read from or written to the device.\r
-  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.      \r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
   @retval EFI_INVALID_PARAMETER Width is invalid.\r
-                                   \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -76,19 +86,19 @@ typedef struct {
   EFI_DEVICE_IO Write;\r
 } EFI_IO_ACCESS;\r
 \r
-/**                                                                 \r
+/**\r
   Provides an EFI Device Path for a PCI device with the given PCI configuration space address.\r
-    \r
+\r
   @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
   @param  PciAddress            The PCI configuration space address of the device whose Device Path\r
-                                is going to be returned.  \r
+                                is going to be returned.\r
   @param  PciDevicePath         A pointer to the pointer for the EFI Device Path for PciAddress.\r
-                                Memory for the Device Path is allocated from the pool.          \r
+                                Memory for the Device Path is allocated from the pool.\r
 \r
   @retval EFI_SUCCESS           The PciDevicePath returns a pointer to a valid EFI Device Path.\r
-  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.      \r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
   @retval EFI_UNSUPPORTED       The PciAddress does not map to a valid EFI Device Path.\r
-                                   \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -99,28 +109,43 @@ EFI_STATUS
   );\r
 \r
 typedef enum {\r
+  ///\r
+  /// A read operation from system memory by a bus master.\r
+  ///\r
   EfiBusMasterRead,\r
+\r
+  ///\r
+  /// A write operation to system memory by a bus master.\r
+  ///\r
   EfiBusMasterWrite,\r
+\r
+  ///\r
+  /// Provides both read and write access to system memory\r
+  /// by both the processor and a bus master. The buffer is\r
+  /// coherent from both the processor's and the bus master's\r
+  /// point of view.\r
+  ///\r
   EfiBusMasterCommonBuffer\r
 } EFI_IO_OPERATION_TYPE;\r
 \r
-/**                                                                 \r
+/**\r
   Provides the device-specific addresses needed to access system memory.\r
-    \r
+\r
   @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
   @param  Operation             Indicates if the bus master is going to read or write to system memory.\r
   @param  HostAddress           The system memory address to map to the device.\r
-  @param  NumberOfBytes         On input the number of bytes to map.\r
+  @param  NumberOfBytes         On input, the number of bytes to map.\r
+                                On output, the number of bytes that were mapped.\r
   @param  DeviceAddress         The resulting map address for the bus master device to use to access the\r
                                 hosts HostAddress.\r
   @param  Mapping               A resulting value to pass to Unmap().\r
 \r
   @retval EFI_SUCCESS           The range was mapped for the returned NumberOfBytes.\r
-  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.      \r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
   @retval EFI_UNSUPPORTED       The HostAddress cannot be mapped as a common buffer.\r
   @retval EFI_INVALID_PARAMETER The Operation or HostAddress is undefined.\r
   @retval EFI_DEVICE_ERROR      The system hardware could not map the requested address.\r
-                                   \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -133,15 +158,15 @@ EFI_STATUS
   OUT VOID                            **Mapping\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Completes the Map() operation and releases any corresponding resources.\r
-    \r
+\r
   @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
   @param  Mapping               A resulting value to pass to Unmap().\r
 \r
   @retval EFI_SUCCESS           The range was mapped for the returned NumberOfBytes.\r
   @retval EFI_DEVICE_ERROR      The system hardware could not map the requested address.\r
-                                   \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -150,22 +175,22 @@ EFI_STATUS
   IN VOID                             *Mapping\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Allocates pages that are suitable for an EFIBusMasterCommonBuffer mapping.\r
-    \r
+\r
   @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
   @param  Type                  The type allocation to perform.\r
   @param  MemoryType            The type of memory to allocate, EfiBootServicesData or\r
                                 EfiRuntimeServicesData.\r
   @param  Pages                 The number of pages to allocate.\r
-  @param  HostAddress           A pointer to store the base address of the allocated range.                                \r
+  @param  HostAddress           A pointer to store the base address of the allocated range.\r
 \r
   @retval EFI_SUCCESS           The requested memory pages were allocated.\r
   @retval EFI_OUT_OF_RESOURCES  The memory pages could not be allocated.\r
   @retval EFI_INVALID_PARAMETER The requested memory type is invalid.\r
   @retval EFI_UNSUPPORTED       The requested HostAddress is not supported on\r
-                                this platform.                               \r
-                                   \r
+                                this platform.\r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -177,14 +202,14 @@ EFI_STATUS
   IN OUT EFI_PHYSICAL_ADDRESS         *HostAddress\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Flushes any posted write data to the device.\r
-    \r
+\r
   @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
 \r
   @retval EFI_SUCCESS           The buffers were flushed.\r
-  @retval EFI_DEVICE_ERROR      The buffers were not flushed due to a hardware error.                                 \r
-  \r
+  @retval EFI_DEVICE_ERROR      The buffers were not flushed due to a hardware error.\r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -192,18 +217,18 @@ EFI_STATUS
   IN EFI_DEVICE_IO_PROTOCOL  *This\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Frees pages that were allocated with AllocateBuffer().\r
-    \r
-  @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.  \r
+\r
+  @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
   @param  Pages                 The number of pages to free.\r
   @param  HostAddress           The base address of the range to free.\r
 \r
   @retval EFI_SUCCESS           The requested memory pages were allocated.\r
   @retval EFI_NOT_FOUND         The requested memory pages were not allocated with\r
-                                AllocateBuffer().  \r
+                                AllocateBuffer().\r
   @retval EFI_INVALID_PARAMETER HostAddress is not page aligned or Pages is invalid.\r
-  \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -213,43 +238,22 @@ EFI_STATUS
   IN EFI_PHYSICAL_ADDRESS             HostAddress\r
   );\r
 \r
-/**\r
-  @par Protocol Description:\r
-  This protocol provides the basic Memory, I/O, and PCI interfaces that \r
-  are used to abstract accesses to devices.\r
-\r
-  @param Mem \r
-  Allows reads and writes to memory mapped I/O space.\r
-\r
-  @param Io \r
-  Allows reads and writes to I/O space.\r
-\r
-  @param Pci \r
-  Allows reads and writes to PCI configuration space.\r
-\r
-  @param Map \r
-  Provides the device specific addresses needed to access system memory for DMA. \r
-\r
-  @param PciDevicePath \r
-  Provides an EFI Device Path for a PCI device with the given PCI\r
-  configuration space address.\r
-\r
-  @param Unmap \r
-  Releases any resources allocated by Map(). \r
-\r
-  @param AllocateBuffer \r
-  Allocates pages that are suitable for a common buffer mapping. \r
-\r
-  @param Flush \r
-  Flushes any posted write data to the device. \r
-\r
-  @param FreeBuffer \r
-  Free pages that were allocated with AllocateBuffer(). \r
-\r
-**/ \r
+///\r
+/// This protocol provides the basic Memory, I/O, and PCI interfaces that\r
+/// are used to abstract accesses to devices.\r
+///\r
 struct _EFI_DEVICE_IO_PROTOCOL {\r
+  ///\r
+  /// Allows reads and writes to memory mapped I/O space.\r
+  ///\r
   EFI_IO_ACCESS           Mem;\r
+  ///\r
+  /// Allows reads and writes to I/O space.\r
+  ///\r
   EFI_IO_ACCESS           Io;\r
+  ///\r
+  /// Allows reads and writes to PCI configuration space.\r
+  ///\r
   EFI_IO_ACCESS           Pci;\r
   EFI_IO_MAP              Map;\r
   EFI_PCI_DEVICE_PATH     PciDevicePath;\r