Home | History | Annotate | Download | only in IsaIo
      1 /*++
      2 
      3 Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
      4 This program and the accompanying materials
      5 are licensed and made available under the terms and conditions of the BSD License
      6 which accompanies this distribution.  The full text of the license may be found at
      7 http://opensource.org/licenses/bsd-license.php
      8 
      9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11 
     12 Module Name:
     13 
     14     IsaIo.h
     15 
     16 Abstract:
     17 
     18     EFI_ISA_IO_PROTOCOL
     19 
     20 Revision History
     21 
     22 --*/
     23 
     24 #ifndef _EFI_ISA_IO_H
     25 #define _EFI_ISA_IO_H
     26 
     27 //
     28 // Common definitions for Light ISA I/O Protocol and ISA I/O Protocol
     29 //
     30 
     31 #include EFI_PROTOCOL_DEFINITION(IsaAcpi)
     32 
     33 typedef enum {
     34   EfiIsaIoWidthUint8,
     35   EfiIsaIoWidthUint16,
     36   EfiIsaIoWidthUint32,
     37   EfiIsaIoWidthReserved,
     38   EfiIsaIoWidthFifoUint8,
     39   EfiIsaIoWidthFifoUint16,
     40   EfiIsaIoWidthFifoUint32,
     41   EfiIsaIoWidthFifoReserved,
     42   EfiIsaIoWidthFillUint8,
     43   EfiIsaIoWidthFillUint16,
     44   EfiIsaIoWidthFillUint32,
     45   EfiIsaIoWidthFillReserved,
     46   EfiIsaIoWidthMaximum
     47 } EFI_ISA_IO_PROTOCOL_WIDTH;
     48 
     49 //
     50 // Attributes for common buffer allocations
     51 //
     52 #define EFI_ISA_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE  0x080    // Map a memory range so write are combined
     53 #define EFI_ISA_IO_ATTRIBUTE_MEMORY_CACHED         0x800    // Map a memory range so all r/w accesses are cached
     54 #define EFI_ISA_IO_ATTRIBUTE_MEMORY_DISABLE        0x1000   // Disable a memory range
     55 
     56 //
     57 // Channel attribute for DMA operations
     58 //
     59 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_COMPATIBLE  0x001
     60 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_A           0x002
     61 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_B           0x004
     62 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_C           0x008
     63 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8           0x010
     64 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_16          0x020
     65 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE       0x040
     66 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_DEMAND_MODE       0x080
     67 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_AUTO_INITIALIZE   0x100
     68 
     69 typedef enum {
     70   EfiIsaIoOperationBusMasterRead,
     71   EfiIsaIoOperationBusMasterWrite,
     72   EfiIsaIoOperationBusMasterCommonBuffer,
     73   EfiIsaIoOperationSlaveRead,
     74   EfiIsaIoOperationSlaveWrite,
     75   EfiIsaIoOperationMaximum
     76 } EFI_ISA_IO_PROTOCOL_OPERATION;
     77 
     78 //
     79 // Specific for ISA I/O Protocol
     80 //
     81 
     82 #define EFI_INTERFACE_DEFINITION_FOR_ISA_IO EFI_ISA_IO_PROTOCOL
     83 #define EFI_ISA_IO_PROTOCOL_VERSION         &gEfiIsaIoProtocolGuid
     84 #define EFI_ISA_IO_OPERATION_TOKEN          EfiIsaIoOperationBusMasterWrite
     85 
     86 
     87 //
     88 // Global ID for the ISA I/O Protocol
     89 //
     90 
     91 #define EFI_ISA_IO_PROTOCOL_GUID \
     92   { 0x7ee2bd44, 0x3da0, 0x11d4, {0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
     93 
     94 EFI_FORWARD_DECLARATION (EFI_ISA_IO_PROTOCOL);
     95 
     96 typedef
     97 EFI_STATUS
     98 (EFIAPI *EFI_ISA_IO_PROTOCOL_IO_MEM) (
     99   IN EFI_ISA_IO_PROTOCOL  *This,
    100   IN     EFI_ISA_IO_PROTOCOL_WIDTH    Width,
    101   IN     UINT32                       Offset,
    102   IN     UINTN                        Count,
    103   IN OUT VOID                         *Buffer
    104   );
    105 
    106 typedef struct {
    107   EFI_ISA_IO_PROTOCOL_IO_MEM  Read;
    108   EFI_ISA_IO_PROTOCOL_IO_MEM  Write;
    109 } EFI_ISA_IO_PROTOCOL_ACCESS;
    110 
    111 typedef
    112 EFI_STATUS
    113 (EFIAPI *EFI_ISA_IO_PROTOCOL_COPY_MEM) (
    114   IN EFI_ISA_IO_PROTOCOL  *This,
    115   IN     EFI_ISA_IO_PROTOCOL_WIDTH    Width,
    116   IN     UINT32                       DestOffset,
    117   IN     UINT32                       SrcOffset,
    118   IN     UINTN                        Count
    119   );
    120 
    121 typedef
    122 EFI_STATUS
    123 (EFIAPI *EFI_ISA_IO_PROTOCOL_MAP) (
    124   IN EFI_ISA_IO_PROTOCOL    *This,
    125   IN     EFI_ISA_IO_PROTOCOL_OPERATION  Operation,
    126   IN     UINT8                          ChannelNumber      OPTIONAL,
    127   IN     UINT32                         ChannelAttributes,
    128   IN     VOID                           *HostAddress,
    129   IN OUT UINTN                          *NumberOfBytes,
    130   OUT    EFI_PHYSICAL_ADDRESS           *DeviceAddress,
    131   OUT    VOID                           **Mapping
    132   );
    133 
    134 typedef
    135 EFI_STATUS
    136 (EFIAPI *EFI_ISA_IO_PROTOCOL_UNMAP) (
    137   IN EFI_ISA_IO_PROTOCOL  *This,
    138   IN  VOID                         *Mapping
    139   );
    140 
    141 typedef
    142 EFI_STATUS
    143 (EFIAPI *EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER) (
    144   IN EFI_ISA_IO_PROTOCOL  *This,
    145   IN  EFI_ALLOCATE_TYPE            Type,
    146   IN  EFI_MEMORY_TYPE              MemoryType,
    147   IN  UINTN                        Pages,
    148   OUT VOID                         **HostAddress,
    149   IN  UINT64                       Attributes
    150   );
    151 
    152 typedef
    153 EFI_STATUS
    154 (EFIAPI *EFI_ISA_IO_PROTOCOL_FREE_BUFFER) (
    155   IN EFI_ISA_IO_PROTOCOL  *This,
    156   IN  UINTN                        Pages,
    157   IN  VOID                         *HostAddress
    158   );
    159 
    160 typedef
    161 EFI_STATUS
    162 (EFIAPI *EFI_ISA_IO_PROTOCOL_FLUSH) (
    163   IN EFI_ISA_IO_PROTOCOL  *This
    164   );
    165 
    166 //
    167 // Interface structure for the ISA I/O Protocol
    168 //
    169 struct _EFI_ISA_IO_PROTOCOL {
    170   EFI_ISA_IO_PROTOCOL_ACCESS           Mem;
    171   EFI_ISA_IO_PROTOCOL_ACCESS           Io;
    172   EFI_ISA_IO_PROTOCOL_COPY_MEM         CopyMem;
    173   EFI_ISA_IO_PROTOCOL_MAP              Map;
    174   EFI_ISA_IO_PROTOCOL_UNMAP            Unmap;
    175   EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER  AllocateBuffer;
    176   EFI_ISA_IO_PROTOCOL_FREE_BUFFER      FreeBuffer;
    177   EFI_ISA_IO_PROTOCOL_FLUSH            Flush;
    178   EFI_ISA_ACPI_RESOURCE_LIST           *ResourceList;
    179   UINT32                               RomSize;
    180   VOID                                 *RomImage;
    181 };
    182 
    183 extern EFI_GUID gEfiIsaIoProtocolGuid;
    184 
    185 
    186 #endif
    187