2 Internal include file for the CPU I/O 2 Protocol.
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _CPU_IO2_DXE_H_
10 #define _CPU_IO2_DXE_H_
14 #include <Protocol/CpuIo2.h>
16 #include <Library/BaseLib.h>
17 #include <Library/DebugLib.h>
18 #include <Library/IoLib.h>
19 #include <Library/UefiBootServicesTableLib.h>
21 #define MAX_IO_PORT_ADDRESS 0xFFFF
24 Reads memory-mapped registers.
26 The I/O operations are carried out exactly as requested. The caller is responsible
27 for satisfying any alignment and I/O width restrictions that a PI System on a
28 platform might require. For example on some platforms, width requests of
29 EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will
30 be handled by the driver.
32 If Width is EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, EfiCpuIoWidthUint32,
33 or EfiCpuIoWidthUint64, then both Address and Buffer are incremented for
34 each of the Count operations that is performed.
36 If Width is EfiCpuIoWidthFifoUint8, EfiCpuIoWidthFifoUint16,
37 EfiCpuIoWidthFifoUint32, or EfiCpuIoWidthFifoUint64, then only Buffer is
38 incremented for each of the Count operations that is performed. The read or
39 write operation is performed Count times on the same Address.
41 If Width is EfiCpuIoWidthFillUint8, EfiCpuIoWidthFillUint16,
42 EfiCpuIoWidthFillUint32, or EfiCpuIoWidthFillUint64, then only Address is
43 incremented for each of the Count operations that is performed. The read or
44 write operation is performed Count times from the first element of Buffer.
46 @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
47 @param[in] Width Signifies the width of the I/O or Memory operation.
48 @param[in] Address The base address of the I/O operation.
49 @param[in] Count The number of I/O operations to perform. The number of
50 bytes moved is Width size * Count, starting at Address.
51 @param[out] Buffer For read operations, the destination buffer to store the results.
52 For write operations, the source buffer from which to write data.
54 @retval EFI_SUCCESS The data was read from or written to the PI system.
55 @retval EFI_INVALID_PARAMETER Width is invalid for this PI system.
56 @retval EFI_INVALID_PARAMETER Buffer is NULL.
57 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
58 @retval EFI_UNSUPPORTED The address range specified by Address, Width,
59 and Count is not valid for this PI system.
64 CpuMemoryServiceRead (
65 IN EFI_CPU_IO2_PROTOCOL
*This
,
66 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
73 Writes memory-mapped registers.
75 The I/O operations are carried out exactly as requested. The caller is responsible
76 for satisfying any alignment and I/O width restrictions that a PI System on a
77 platform might require. For example on some platforms, width requests of
78 EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will
79 be handled by the driver.
81 If Width is EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, EfiCpuIoWidthUint32,
82 or EfiCpuIoWidthUint64, then both Address and Buffer are incremented for
83 each of the Count operations that is performed.
85 If Width is EfiCpuIoWidthFifoUint8, EfiCpuIoWidthFifoUint16,
86 EfiCpuIoWidthFifoUint32, or EfiCpuIoWidthFifoUint64, then only Buffer is
87 incremented for each of the Count operations that is performed. The read or
88 write operation is performed Count times on the same Address.
90 If Width is EfiCpuIoWidthFillUint8, EfiCpuIoWidthFillUint16,
91 EfiCpuIoWidthFillUint32, or EfiCpuIoWidthFillUint64, then only Address is
92 incremented for each of the Count operations that is performed. The read or
93 write operation is performed Count times from the first element of Buffer.
95 @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
96 @param[in] Width Signifies the width of the I/O or Memory operation.
97 @param[in] Address The base address of the I/O operation.
98 @param[in] Count The number of I/O operations to perform. The number of
99 bytes moved is Width size * Count, starting at Address.
100 @param[in] Buffer For read operations, the destination buffer to store the results.
101 For write operations, the source buffer from which to write data.
103 @retval EFI_SUCCESS The data was read from or written to the PI system.
104 @retval EFI_INVALID_PARAMETER Width is invalid for this PI system.
105 @retval EFI_INVALID_PARAMETER Buffer is NULL.
106 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
107 @retval EFI_UNSUPPORTED The address range specified by Address, Width,
108 and Count is not valid for this PI system.
113 CpuMemoryServiceWrite (
114 IN EFI_CPU_IO2_PROTOCOL
*This
,
115 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
124 The I/O operations are carried out exactly as requested. The caller is responsible
125 for satisfying any alignment and I/O width restrictions that a PI System on a
126 platform might require. For example on some platforms, width requests of
127 EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will
128 be handled by the driver.
130 If Width is EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, EfiCpuIoWidthUint32,
131 or EfiCpuIoWidthUint64, then both Address and Buffer are incremented for
132 each of the Count operations that is performed.
134 If Width is EfiCpuIoWidthFifoUint8, EfiCpuIoWidthFifoUint16,
135 EfiCpuIoWidthFifoUint32, or EfiCpuIoWidthFifoUint64, then only Buffer is
136 incremented for each of the Count operations that is performed. The read or
137 write operation is performed Count times on the same Address.
139 If Width is EfiCpuIoWidthFillUint8, EfiCpuIoWidthFillUint16,
140 EfiCpuIoWidthFillUint32, or EfiCpuIoWidthFillUint64, then only Address is
141 incremented for each of the Count operations that is performed. The read or
142 write operation is performed Count times from the first element of Buffer.
144 @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
145 @param[in] Width Signifies the width of the I/O or Memory operation.
146 @param[in] Address The base address of the I/O operation.
147 @param[in] Count The number of I/O operations to perform. The number of
148 bytes moved is Width size * Count, starting at Address.
149 @param[out] Buffer For read operations, the destination buffer to store the results.
150 For write operations, the source buffer from which to write data.
152 @retval EFI_SUCCESS The data was read from or written to the PI system.
153 @retval EFI_INVALID_PARAMETER Width is invalid for this PI system.
154 @retval EFI_INVALID_PARAMETER Buffer is NULL.
155 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
156 @retval EFI_UNSUPPORTED The address range specified by Address, Width,
157 and Count is not valid for this PI system.
163 IN EFI_CPU_IO2_PROTOCOL
*This
,
164 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
173 The I/O operations are carried out exactly as requested. The caller is responsible
174 for satisfying any alignment and I/O width restrictions that a PI System on a
175 platform might require. For example on some platforms, width requests of
176 EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will
177 be handled by the driver.
179 If Width is EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, EfiCpuIoWidthUint32,
180 or EfiCpuIoWidthUint64, then both Address and Buffer are incremented for
181 each of the Count operations that is performed.
183 If Width is EfiCpuIoWidthFifoUint8, EfiCpuIoWidthFifoUint16,
184 EfiCpuIoWidthFifoUint32, or EfiCpuIoWidthFifoUint64, then only Buffer is
185 incremented for each of the Count operations that is performed. The read or
186 write operation is performed Count times on the same Address.
188 If Width is EfiCpuIoWidthFillUint8, EfiCpuIoWidthFillUint16,
189 EfiCpuIoWidthFillUint32, or EfiCpuIoWidthFillUint64, then only Address is
190 incremented for each of the Count operations that is performed. The read or
191 write operation is performed Count times from the first element of Buffer.
193 @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.
194 @param[in] Width Signifies the width of the I/O or Memory operation.
195 @param[in] Address The base address of the I/O operation.
196 @param[in] Count The number of I/O operations to perform. The number of
197 bytes moved is Width size * Count, starting at Address.
198 @param[in] Buffer For read operations, the destination buffer to store the results.
199 For write operations, the source buffer from which to write data.
201 @retval EFI_SUCCESS The data was read from or written to the PI system.
202 @retval EFI_INVALID_PARAMETER Width is invalid for this PI system.
203 @retval EFI_INVALID_PARAMETER Buffer is NULL.
204 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
205 @retval EFI_UNSUPPORTED The address range specified by Address, Width,
206 and Count is not valid for this PI system.
212 IN EFI_CPU_IO2_PROTOCOL
*This
,
213 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,