]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/InternalIsaIo.h
Merge 3 PCDs for the ISA Bus Driver to a single PCD that is a bitmask of features.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / IsaBusDxe / InternalIsaIo.h
index b5e6694ca22fd42f5d24fb72a67e1d627ff93404..25427b4329903aad4d756136ae6e2b19896cc020 100644 (file)
@@ -1,4 +1,4 @@
-/**@file\r
+/** @file\r
   The header file for EFI_ISA_IO protocol implementation.\r
   \r
 Copyright (c) 2006 - 2009, Intel Corporation.<BR>\r
@@ -17,10 +17,30 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "InternalIsaBus.h"\r
 \r
+//\r
+// Bits definition of PcdIsaBusSupportedFeatures\r
+//\r
+#define PCD_ISA_BUS_SUPPORT_DMA                  BIT0\r
+#define PCD_ISA_BUS_ONLY_SUPPORT_SLAVE_DMA       BIT1\r
+#define PCD_ISA_BUS_SUPPORT_ISA_MEMORY           BIT2\r
+\r
 //\r
 // ISA I/O Support Function Prototypes\r
 //\r
 \r
+/**\r
+  Verifies access to an ISA device\r
+\r
+  @param[in] IsaIoDevice         The ISA device to be verified.\r
+  @param[in] Type                The Access type. The input must be either IsaAccessTypeMem or IsaAccessTypeIo.\r
+  @param[in] Width               The width of the memory operation.\r
+  @param[in] Count               The number of memory operations to perform. \r
+  @param[in] Offset              The offset in ISA memory space to start the memory operation.  \r
+  \r
+  @retval EFI_SUCCESS            Verify success.\r
+  @retval EFI_INVALID_PARAMETER  One of the parameters has an invalid value.\r
+  @retval EFI_UNSUPPORTED        The device ont support the access type.\r
+**/\r
 EFI_STATUS\r
 IsaIoVerifyAccess (\r
   IN ISA_IO_DEVICE              *IsaIoDevice,\r
@@ -30,6 +50,20 @@ IsaIoVerifyAccess (
   IN UINT32                     Offset\r
   );\r
   \r
+/**\r
+  Performs an ISA I/O Read Cycle\r
+\r
+  @param[in]  This              A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+  @param[in]  Width             Specifies the width of the I/O operation.\r
+  @param[in]  Offset            The offset in ISA I/O space to start the I/O operation.  \r
+  @param[in]  Count             The number of I/O operations to perform. \r
+  @param[out] Buffer            The destination buffer to store the results\r
+\r
+  @retval EFI_SUCCESS           The data was read from the device sucessfully.\r
+  @retval EFI_UNSUPPORTED       The Offset is not valid for this device.\r
+  @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaIoIoRead (\r
@@ -40,6 +74,20 @@ IsaIoIoRead (
   OUT VOID                       *Buffer\r
   );\r
 \r
+/**\r
+  Performs an ISA I/O Write Cycle\r
+\r
+  @param[in] This                A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+  @param[in] Width               Specifies the width of the I/O operation.\r
+  @param[in] Offset              The offset in ISA I/O space to start the I/O operation.  \r
+  @param[in] Count               The number of I/O operations to perform. \r
+  @param[in] Buffer              The source buffer to write data from\r
+\r
+  @retval EFI_SUCCESS            The data was writen to the device sucessfully.\r
+  @retval EFI_UNSUPPORTED        The Offset is not valid for this device.\r
+  @retval EFI_INVALID_PARAMETER  Width or Count, or both, were invalid.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaIoIoWrite (\r
@@ -50,6 +98,30 @@ IsaIoIoWrite (
   IN VOID                       *Buffer\r
   );\r
 \r
+/**\r
+  Maps a memory region for DMA\r
+\r
+  @param This                    A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+  @param Operation               Indicates the type of DMA (slave or bus master), and if \r
+                                 the DMA operation is going to read or write to system memory. \r
+  @param ChannelNumber           The slave channel number to use for this DMA operation. \r
+                                 If Operation and ChannelAttributes shows that this device \r
+                                 performs bus mastering DMA, then this field is ignored.  \r
+                                 The legal range for this field is 0..7.  \r
+  @param ChannelAttributes       The attributes of the DMA channel to use for this DMA operation\r
+  @param HostAddress             The system memory address to map to the device.  \r
+  @param NumberOfBytes           On input the number of bytes to map.  On output the number \r
+                                 of bytes that were mapped.\r
+  @param DeviceAddress           The resulting map address for the bus master device to use \r
+                                 to access the hosts HostAddress.  \r
+  @param Mapping                 A resulting value to pass to EFI_ISA_IO.Unmap().\r
+\r
+  @retval EFI_SUCCESS            The range was mapped for the returned NumberOfBytes.\r
+  @retval EFI_INVALID_PARAMETER  The Operation or HostAddress is undefined.\r
+  @retval EFI_UNSUPPORTED        The HostAddress can not be mapped as a common buffer.\r
+  @retval EFI_DEVICE_ERROR       The system hardware could not map the requested address.\r
+  @retval EFI_OUT_OF_RESOURCES   The memory pages could not be allocated.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaIoMap (\r
@@ -63,6 +135,15 @@ IsaIoMap (
   OUT    VOID                           **Mapping\r
   );\r
 \r
+/**\r
+  Unmaps a memory region for DMA\r
+\r
+  @param[in] This           A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+  @param[in] Mapping        The mapping value returned from EFI_ISA_IO.Map().\r
+\r
+  @retval EFI_SUCCESS       The range was unmapped.\r
+  @retval EFI_DEVICE_ERROR  The data was not committed to the target system memory.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaIoUnmap (\r
@@ -70,17 +151,47 @@ IsaIoUnmap (
   IN VOID                 *Mapping\r
   );\r
 \r
+/**\r
+  Flushes any posted write data to the system memory.\r
+\r
+  @param[in] This             A pointer to the EFI_ISA_IO_PROTOCOL 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
 EFI_STATUS\r
 EFIAPI\r
 IsaIoFlush (\r
   IN EFI_ISA_IO_PROTOCOL  *This\r
   );\r
 \r
+/**\r
+  report a error Status code\r
+\r
+  @param Code          The error status code.\r
+  \r
+  @return EFI_SUCCESS  Success to report status code.\r
+**/\r
 EFI_STATUS\r
 ReportErrorStatusCode (\r
-  EFI_STATUS_CODE_VALUE code\r
+  EFI_STATUS_CODE_VALUE Code\r
   );\r
 \r
+/**\r
+  Writes I/O operation base address and count number to a 8 bit I/O Port.\r
+\r
+  @param[in] This                A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+  @param[in] AddrOffset          The address' offset.\r
+  @param[in] PageOffset          The page's offest.\r
+  @param[in] CountOffset         The count's offset.\r
+  @param[in] BaseAddress         The base address.\r
+  @param[in] Count               The number of I/O operations to perform. \r
+  \r
+  @retval EFI_SUCCESS            Success.\r
+  @retval EFI_INVALID_PARAMETER  Parameter is invalid.\r
+  @retval EFI_UNSUPPORTED        The address range specified by these Offsets and Count is not valid.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+**/\r
 EFI_STATUS\r
 WriteDmaPort (\r
   IN EFI_ISA_IO_PROTOCOL  *This,\r
@@ -91,6 +202,18 @@ WriteDmaPort (
   IN UINT16               Count\r
   );\r
 \r
+/**\r
+  Writes an 8-bit I/O Port\r
+\r
+  @param[in] This                A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+  @param[in] Offset              The offset in ISA IO space to start the IO operation.  \r
+  @param[in] Value               The data to write port.\r
+\r
+  @retval EFI_SUCCESS            Success.\r
+  @retval EFI_INVALID_PARAMETER  Parameter is invalid.\r
+  @retval EFI_UNSUPPORTED        The address range specified by Offset is not valid.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+**/\r
 EFI_STATUS\r
 WritePort (\r
   IN EFI_ISA_IO_PROTOCOL  *This,\r
@@ -98,6 +221,20 @@ WritePort (
   IN UINT8                Value\r
   );    \r
 \r
+/**\r
+  Performs an ISA Memory Read Cycle\r
+\r
+  @param[in]  This               A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+  @param[in]  Width              Specifies the width of the memory operation.\r
+  @param[in]  Offset             The offset in ISA memory space to start the memory operation.  \r
+  @param[in]  Count              The number of memory operations to perform. \r
+  @param[out] Buffer             The destination buffer to store the results\r
\r
+  @retval EFI_SUCCESS            The data was read from the device successfully.\r
+  @retval EFI_UNSUPPORTED        The Offset is not valid for this device.\r
+  @retval EFI_INVALID_PARAMETER  Width or Count, or both, were invalid.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaIoMemRead (\r
@@ -109,6 +246,20 @@ IsaIoMemRead (
   );\r
 \r
 \r
+/**\r
+  Performs an ISA Memory Write Cycle\r
+\r
+  @param[in] This                A pointer to the EFI_ISA_IO_PROTOCOL instance.  \r
+  @param[in] Width               Specifies the width of the memory operation.\r
+  @param[in] Offset              The offset in ISA memory space to start the memory operation.  \r
+  @param[in] Count               The number of memory operations to perform. \r
+  @param[in] Buffer              The source buffer to write data from\r
+\r
+  @retval EFI_SUCCESS            The data was written to the device sucessfully.\r
+  @retval EFI_UNSUPPORTED        The Offset is not valid for this device.\r
+  @retval EFI_INVALID_PARAMETER  Width or Count, or both, were invalid.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaIoMemWrite (\r
@@ -119,6 +270,20 @@ IsaIoMemWrite (
   IN VOID                       *Buffer\r
   );\r
 \r
+/**\r
+  Copy one region of ISA memory space to another region of ISA memory space on the ISA controller.\r
+\r
+  @param[in]  This               A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+  @param[in]  Width              Specifies the width of the memory copy operation.\r
+  @param[in]  DestOffset         The offset of the destination \r
+  @param[in]  SrcOffset          The offset of the source\r
+  @param[in]  Count              The number of memory copy  operations to perform\r
+\r
+  @retval EFI_SUCCESS            The data was copied sucessfully.\r
+  @retval EFI_UNSUPPORTED        The DestOffset or SrcOffset is not valid for this device.\r
+  @retval EFI_INVALID_PARAMETER  Width or Count, or both, were invalid.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack of resources.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaIoCopyMem (\r
@@ -129,6 +294,22 @@ IsaIoCopyMem (
   IN UINTN                      Count\r
   );\r
 \r
+/**\r
+  Allocates pages that are suitable for an EfiIsaIoOperationBusMasterCommonBuffer mapping.\r
+\r
+  @param[in]  This               A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+  @param[in]  Type               The type allocation to perform.\r
+  @param[in]  MemoryType         The type of memory to allocate.\r
+  @param[in]  Pages              The number of pages to allocate.\r
+  @param[out] HostAddress        A pointer to store the base address of the allocated range.\r
+  @param[in]  Attributes         The requested bit mask of attributes for the allocated range.\r
+\r
+  @retval EFI_SUCCESS            The requested memory pages were allocated.\r
+  @retval EFI_INVALID_PARAMETER  Type is invalid or MemoryType is invalid or HostAddress is NULL\r
+  @retval EFI_UNSUPPORTED        Attributes is unsupported or the memory range specified \r
+                                 by HostAddress, Pages, and Type is not available for common buffer use.\r
+  @retval EFI_OUT_OF_RESOURCES   The memory pages could not be allocated.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaIoAllocateBuffer (\r
@@ -140,6 +321,16 @@ IsaIoAllocateBuffer (
   IN  UINT64               Attributes\r
   );\r
 \r
+/**\r
+  Frees memory that was allocated with EFI_ISA_IO.AllocateBuffer(). \r
+\r
+  @param[in] This                A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+  @param[in] Pages               The number of pages to free.\r
+  @param[in] HostAddress         The base address of the allocated range.\r
+\r
+  @retval EFI_SUCCESS            The requested memory pages were freed.\r
+  @retval EFI_INVALID_PARAMETER  The memory was not allocated with EFI_ISA_IO.AllocateBufer().\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaIoFreeBuffer (\r