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