2 Internal include file of CPU I/O DXE Driver.
4 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __CPU_IO_DXE_H__
10 #define __CPU_IO_DXE_H__
15 #include <Protocol/CpuIo.h>
17 #include <Library/BaseLib.h>
18 #include <Library/DebugLib.h>
19 #include <Library/IoLib.h>
20 #include <Library/UefiBootServicesTableLib.h>
22 #define MAX_IO_PORT_ADDRESS 0xFFFF
25 Reads memory-mapped registers.
27 The I/O operations are carried out exactly as requested. The caller is responsible
28 for satisfying any alignment and I/O width restrictions that a PI System on a
29 platform might require. For example on some platforms, width requests of
30 EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will
31 be handled by the driver.
33 If Width is EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, EfiCpuIoWidthUint32,
34 or EfiCpuIoWidthUint64, then both Address and Buffer are incremented for
35 each of the Count operations that is performed.
37 If Width is EfiCpuIoWidthFifoUint8, EfiCpuIoWidthFifoUint16,
38 EfiCpuIoWidthFifoUint32, or EfiCpuIoWidthFifoUint64, then only Buffer is
39 incremented for each of the Count operations that is performed. The read or
40 write operation is performed Count times on the same Address.
42 If Width is EfiCpuIoWidthFillUint8, EfiCpuIoWidthFillUint16,
43 EfiCpuIoWidthFillUint32, or EfiCpuIoWidthFillUint64, then only Address is
44 incremented for each of the Count operations that is performed. The read or
45 write operation is performed Count times from the first element of Buffer.
47 @param[in] This A pointer to the EFI_CPU_IO_PROTOCOL instance.
48 @param[in] Width Signifies the width of the I/O or Memory operation.
49 @param[in] Address The base address of the I/O operation.
50 @param[in] Count The number of I/O operations to perform. The number of
51 bytes moved is Width size * Count, starting at Address.
52 @param[out] Buffer For read operations, the destination buffer to store the results.
53 For write operations, the source buffer from which to write data.
55 @retval EFI_SUCCESS The data was read from or written to the PI system.
56 @retval EFI_INVALID_PARAMETER Width is invalid for this PI system.
57 @retval EFI_INVALID_PARAMETER Buffer is NULL.
58 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
59 @retval EFI_UNSUPPORTED The address range specified by Address, Width,
60 and Count is not valid for this PI system.
65 CpuMemoryServiceRead (
66 IN EFI_CPU_IO_PROTOCOL
*This
,
67 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
74 Writes memory-mapped registers.
76 The I/O operations are carried out exactly as requested. The caller is responsible
77 for satisfying any alignment and I/O width restrictions that a PI System on a
78 platform might require. For example on some platforms, width requests of
79 EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will
80 be handled by the driver.
82 If Width is EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, EfiCpuIoWidthUint32,
83 or EfiCpuIoWidthUint64, then both Address and Buffer are incremented for
84 each of the Count operations that is performed.
86 If Width is EfiCpuIoWidthFifoUint8, EfiCpuIoWidthFifoUint16,
87 EfiCpuIoWidthFifoUint32, or EfiCpuIoWidthFifoUint64, then only Buffer is
88 incremented for each of the Count operations that is performed. The read or
89 write operation is performed Count times on the same Address.
91 If Width is EfiCpuIoWidthFillUint8, EfiCpuIoWidthFillUint16,
92 EfiCpuIoWidthFillUint32, or EfiCpuIoWidthFillUint64, then only Address is
93 incremented for each of the Count operations that is performed. The read or
94 write operation is performed Count times from the first element of Buffer.
96 @param[in] This A pointer to the EFI_CPU_IO_PROTOCOL instance.
97 @param[in] Width Signifies the width of the I/O or Memory operation.
98 @param[in] Address The base address of the I/O operation.
99 @param[in] Count The number of I/O operations to perform. The number of
100 bytes moved is Width size * Count, starting at Address.
101 @param[in] Buffer For read operations, the destination buffer to store the results.
102 For write operations, the source buffer from which to write data.
104 @retval EFI_SUCCESS The data was read from or written to the PI system.
105 @retval EFI_INVALID_PARAMETER Width is invalid for this PI system.
106 @retval EFI_INVALID_PARAMETER Buffer is NULL.
107 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
108 @retval EFI_UNSUPPORTED The address range specified by Address, Width,
109 and Count is not valid for this PI system.
114 CpuMemoryServiceWrite (
115 IN EFI_CPU_IO_PROTOCOL
*This
,
116 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
125 The I/O operations are carried out exactly as requested. The caller is responsible
126 for satisfying any alignment and I/O width restrictions that a PI System on a
127 platform might require. For example on some platforms, width requests of
128 EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will
129 be handled by the driver.
131 If Width is EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, EfiCpuIoWidthUint32,
132 or EfiCpuIoWidthUint64, then both Address and Buffer are incremented for
133 each of the Count operations that is performed.
135 If Width is EfiCpuIoWidthFifoUint8, EfiCpuIoWidthFifoUint16,
136 EfiCpuIoWidthFifoUint32, or EfiCpuIoWidthFifoUint64, then only Buffer is
137 incremented for each of the Count operations that is performed. The read or
138 write operation is performed Count times on the same Address.
140 If Width is EfiCpuIoWidthFillUint8, EfiCpuIoWidthFillUint16,
141 EfiCpuIoWidthFillUint32, or EfiCpuIoWidthFillUint64, then only Address is
142 incremented for each of the Count operations that is performed. The read or
143 write operation is performed Count times from the first element of Buffer.
145 @param[in] This A pointer to the EFI_CPU_IO_PROTOCOL instance.
146 @param[in] Width Signifies the width of the I/O or Memory operation.
147 @param[in] Address The base address of the I/O operation.
148 @param[in] Count The number of I/O operations to perform. The number of
149 bytes moved is Width size * Count, starting at Address.
150 @param[out] Buffer For read operations, the destination buffer to store the results.
151 For write operations, the source buffer from which to write data.
153 @retval EFI_SUCCESS The data was read from or written to the PI system.
154 @retval EFI_INVALID_PARAMETER Width is invalid for this PI system.
155 @retval EFI_INVALID_PARAMETER Buffer is NULL.
156 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
157 @retval EFI_UNSUPPORTED The address range specified by Address, Width,
158 and Count is not valid for this PI system.
164 IN EFI_CPU_IO_PROTOCOL
*This
,
165 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
174 The I/O operations are carried out exactly as requested. The caller is responsible
175 for satisfying any alignment and I/O width restrictions that a PI System on a
176 platform might require. For example on some platforms, width requests of
177 EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will
178 be handled by the driver.
180 If Width is EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, EfiCpuIoWidthUint32,
181 or EfiCpuIoWidthUint64, then both Address and Buffer are incremented for
182 each of the Count operations that is performed.
184 If Width is EfiCpuIoWidthFifoUint8, EfiCpuIoWidthFifoUint16,
185 EfiCpuIoWidthFifoUint32, or EfiCpuIoWidthFifoUint64, then only Buffer is
186 incremented for each of the Count operations that is performed. The read or
187 write operation is performed Count times on the same Address.
189 If Width is EfiCpuIoWidthFillUint8, EfiCpuIoWidthFillUint16,
190 EfiCpuIoWidthFillUint32, or EfiCpuIoWidthFillUint64, then only Address is
191 incremented for each of the Count operations that is performed. The read or
192 write operation is performed Count times from the first element of Buffer.
194 @param[in] This A pointer to the EFI_CPU_IO_PROTOCOL instance.
195 @param[in] Width Signifies the width of the I/O or Memory operation.
196 @param[in] Address The base address of the I/O operation.
197 @param[in] Count The number of I/O operations to perform. The number of
198 bytes moved is Width size * Count, starting at Address.
199 @param[in] Buffer For read operations, the destination buffer to store the results.
200 For write operations, the source buffer from which to write data.
202 @retval EFI_SUCCESS The data was read from or written to the PI system.
203 @retval EFI_INVALID_PARAMETER Width is invalid for this PI system.
204 @retval EFI_INVALID_PARAMETER Buffer is NULL.
205 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.
206 @retval EFI_UNSUPPORTED The address range specified by Address, Width,
207 and Count is not valid for this PI system.
213 IN EFI_CPU_IO_PROTOCOL
*This
,
214 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,