]> 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 d344058fb903a033878e0654ef3c778b91596190..25427b4329903aad4d756136ae6e2b19896cc020 100644 (file)
-/*++\r
+/** @file\r
+  The header file for EFI_ISA_IO protocol implementation.\r
+  \r
+Copyright (c) 2006 - 2009, Intel Corporation.<BR>\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
 \r
-Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved. \r
-This software and associated documentation (if any) is furnished\r
-under a license and may only be used or copied in accordance\r
-with the terms of the license. Except as permitted by such\r
-license, no part of this software or documentation may be\r
-reproduced, stored in a retrieval system, or transmitted in any\r
-form or by any means without the express written consent of\r
-Intel Corporation.\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
-Module Name:\r
+**/\r
 \r
-  IsaIo.h\r
-  \r
-Abstract:\r
-  \r
-  The header file for EFI_ISA_IO protocol implementation.\r
-  \r
---*/\r
+#ifndef _INTERNAL_ISA_IO_H_\r
+#define _INTERNAL_ISA_IO_H_\r
 \r
-#ifndef _EFI_ISA_IO_LOCAL_H\r
-#define _EFI_ISA_IO_LOCAL_H\r
+#include "InternalIsaBus.h"\r
 \r
 //\r
-// Include common header file for this module.\r
+// Bits definition of PcdIsaBusSupportedFeatures\r
 //\r
-#include "CommonHeader.h"\r
-\r
-#include "InternalIsaBus.h"\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
-  IN     ISA_ACCESS_TYPE            Type,\r
-  IN     EFI_ISA_IO_PROTOCOL_WIDTH  Width,\r
-  IN     UINTN                      Count,\r
-  IN OUT UINT32                     *Offset\r
+  IN ISA_IO_DEVICE              *IsaIoDevice,\r
+  IN ISA_ACCESS_TYPE            Type,\r
+  IN EFI_ISA_IO_PROTOCOL_WIDTH  Width,\r
+  IN UINTN                      Count,\r
+  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
-  IN     EFI_ISA_IO_PROTOCOL                        *This,\r
-  IN     EFI_ISA_IO_PROTOCOL_WIDTH                  Width,\r
-  IN     UINT32                                     Offset,\r
-  IN     UINTN                                      Count,\r
-  IN OUT VOID                                       *Buffer\r
+  IN  EFI_ISA_IO_PROTOCOL        *This,\r
+  IN  EFI_ISA_IO_PROTOCOL_WIDTH  Width,\r
+  IN  UINT32                     Offset,\r
+  IN  UINTN                      Count,\r
+  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
-  IN     EFI_ISA_IO_PROTOCOL                        *This,\r
-  IN     EFI_ISA_IO_PROTOCOL_WIDTH                  Width,\r
-  IN     UINT32                                     Offset,\r
-  IN     UINTN                                      Count,\r
-  IN OUT VOID                                       *Buffer\r
+  IN EFI_ISA_IO_PROTOCOL        *This,\r
+  IN EFI_ISA_IO_PROTOCOL_WIDTH  Width,\r
+  IN UINT32                     Offset,\r
+  IN UINTN                      Count,\r
+  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
-  IN     EFI_ISA_IO_PROTOCOL                               *This,\r
-  IN     EFI_ISA_IO_PROTOCOL_OPERATION                     Operation,\r
-  IN     UINT8                                             ChannelNumber      OPTIONAL,\r
-  IN     UINT32                                            ChannelAttributes,\r
-  IN     VOID                                              *HostAddress,\r
-  IN OUT UINTN                                             *NumberOfBytes,\r
-  OUT    EFI_PHYSICAL_ADDRESS                              *DeviceAddress,\r
-  OUT    VOID                                              **Mapping\r
+  IN     EFI_ISA_IO_PROTOCOL            *This,\r
+  IN     EFI_ISA_IO_PROTOCOL_OPERATION  Operation,\r
+  IN     UINT8                          ChannelNumber  OPTIONAL,\r
+  IN     UINT32                         ChannelAttributes,\r
+  IN     VOID                           *HostAddress,\r
+  IN OUT UINTN                          *NumberOfBytes,\r
+  OUT    EFI_PHYSICAL_ADDRESS           *DeviceAddress,\r
+  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
-  IN EFI_ISA_IO_PROTOCOL                  *This,\r
-  IN VOID                                 *Mapping\r
+  IN EFI_ISA_IO_PROTOCOL  *This,\r
+  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
+  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
-  IN UINT32                               AddrOffset,\r
-  IN UINT32                               PageOffset,\r
-  IN UINT32                               CountOffset,\r
-  IN UINT32                               BaseAddress,\r
-  IN UINT16                               Count\r
+  IN EFI_ISA_IO_PROTOCOL  *This,\r
+  IN UINT32               AddrOffset,\r
+  IN UINT32               PageOffset,\r
+  IN UINT32               CountOffset,\r
+  IN UINT32               BaseAddress,\r
+  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
-  IN UINT32                               Offset,\r
-  IN UINT8                                Value\r
+  IN EFI_ISA_IO_PROTOCOL  *This,\r
+  IN UINT32               Offset,\r
+  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
-  IN     EFI_ISA_IO_PROTOCOL                       *This,\r
-  IN     EFI_ISA_IO_PROTOCOL_WIDTH                 Width,\r
-  IN     UINT32                                    Offset,\r
-  IN     UINTN                                     Count,\r
-  IN OUT VOID                                      *Buffer\r
+  IN  EFI_ISA_IO_PROTOCOL        *This,\r
+  IN  EFI_ISA_IO_PROTOCOL_WIDTH  Width,\r
+  IN  UINT32                     Offset,\r
+  IN  UINTN                      Count,\r
+  OUT VOID                       *Buffer\r
   );\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
-  IN     EFI_ISA_IO_PROTOCOL                        *This,\r
-  IN     EFI_ISA_IO_PROTOCOL_WIDTH                  Width,\r
-  IN     UINT32                                     Offset,\r
-  IN     UINTN                                      Count,\r
-  IN OUT VOID                                       *Buffer\r
+  IN EFI_ISA_IO_PROTOCOL        *This,\r
+  IN EFI_ISA_IO_PROTOCOL_WIDTH  Width,\r
+  IN UINT32                     Offset,\r
+  IN UINTN                      Count,\r
+  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
-  IN EFI_ISA_IO_PROTOCOL                        *This,\r
-  IN EFI_ISA_IO_PROTOCOL_WIDTH                  Width,\r
-  IN UINT32                                     DestOffset,\r
-  IN UINT32                                     SrcOffset,\r
-  IN UINTN                                      Count\r
+  IN EFI_ISA_IO_PROTOCOL        *This,\r
+  IN EFI_ISA_IO_PROTOCOL_WIDTH  Width,\r
+  IN UINT32                     DestOffset,\r
+  IN UINT32                     SrcOffset,\r
+  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
-  IN  EFI_ISA_IO_PROTOCOL                  *This,\r
-  IN  EFI_ALLOCATE_TYPE                    Type,\r
-  IN  EFI_MEMORY_TYPE                      MemoryType,\r
-  IN  UINTN                                Pages,\r
-  OUT VOID                                 **HostAddress,\r
-  IN  UINT64                               Attributes\r
+  IN  EFI_ISA_IO_PROTOCOL  *This,\r
+  IN  EFI_ALLOCATE_TYPE    Type,\r
+  IN  EFI_MEMORY_TYPE      MemoryType,\r
+  IN  UINTN                Pages,\r
+  OUT VOID                 **HostAddress,\r
+  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
-  IN EFI_ISA_IO_PROTOCOL                  *This,\r
-  IN UINTN                                Pages,\r
-  IN VOID                                 *HostAddress\r
+  IN EFI_ISA_IO_PROTOCOL  *This,\r
+  IN UINTN                Pages,\r
+  IN VOID                 *HostAddress\r
   );\r
 \r
 #endif\r
+\r