]>
Commit | Line | Data |
---|---|---|
e1f414b6 | 1 | /** @file\r |
2 | High-level Io/Mmio functions.\r | |
3 | \r | |
4 | All assertions for bit field operations are handled bit field functions in the\r | |
5 | Base Library.\r | |
6 | \r | |
9095d37b | 7 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
e1f414b6 | 9 | \r |
2bfb6009 | 10 | The following IoLib instances contain the same copy of this file:\r |
e1f414b6 | 11 | \r |
12 | BaseIoLibIntrinsic\r | |
13 | DxeIoLibCpuIo\r | |
14 | PeiIoLibCpuIo\r | |
15 | \r | |
16 | **/\r | |
17 | \r | |
f734a10a | 18 | #include "BaseIoLibIntrinsicInternal.h"\r |
e1f414b6 | 19 | \r |
20 | /**\r | |
62991af2 | 21 | Reads an 8-bit I/O port, performs a bitwise OR, and writes the\r |
e1f414b6 | 22 | result back to the 8-bit I/O port.\r |
23 | \r | |
62991af2 | 24 | Reads the 8-bit I/O port specified by Port, performs a bitwise OR\r |
e1f414b6 | 25 | between the read result and the value specified by OrData, and writes the\r |
26 | result to the 8-bit I/O port specified by Port. The value written to the I/O\r | |
27 | port is returned. This function must guarantee that all I/O read and write\r | |
28 | operations are serialized.\r | |
29 | \r | |
30 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
31 | \r | |
32 | @param Port The I/O port to write.\r | |
33 | @param OrData The value to OR with the read value from the I/O port.\r | |
34 | \r | |
35 | @return The value written back to the I/O port.\r | |
36 | \r | |
37 | **/\r | |
38 | UINT8\r | |
39 | EFIAPI\r | |
40 | IoOr8 (\r | |
2f88bd3a MK |
41 | IN UINTN Port,\r |
42 | IN UINT8 OrData\r | |
e1f414b6 | 43 | )\r |
44 | {\r | |
2f88bd3a | 45 | return IoWrite8 (Port, (UINT8)(IoRead8 (Port) | OrData));\r |
e1f414b6 | 46 | }\r |
47 | \r | |
48 | /**\r | |
49 | Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back\r | |
50 | to the 8-bit I/O port.\r | |
51 | \r | |
52 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r | |
53 | the read result and the value specified by AndData, and writes the result to\r | |
54 | the 8-bit I/O port specified by Port. The value written to the I/O port is\r | |
55 | returned. This function must guarantee that all I/O read and write operations\r | |
56 | are serialized.\r | |
57 | \r | |
58 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
59 | \r | |
60 | @param Port The I/O port to write.\r | |
61 | @param AndData The value to AND with the read value from the I/O port.\r | |
62 | \r | |
63 | @return The value written back to the I/O port.\r | |
64 | \r | |
65 | **/\r | |
66 | UINT8\r | |
67 | EFIAPI\r | |
68 | IoAnd8 (\r | |
2f88bd3a MK |
69 | IN UINTN Port,\r |
70 | IN UINT8 AndData\r | |
e1f414b6 | 71 | )\r |
72 | {\r | |
2f88bd3a | 73 | return IoWrite8 (Port, (UINT8)(IoRead8 (Port) & AndData));\r |
e1f414b6 | 74 | }\r |
75 | \r | |
76 | /**\r | |
9095d37b | 77 | Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 78 | OR, and writes the result back to the 8-bit I/O port.\r |
e1f414b6 | 79 | \r |
80 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r | |
81 | the read result and the value specified by AndData, performs a bitwise OR\r | |
82 | between the result of the AND operation and the value specified by OrData,\r | |
83 | and writes the result to the 8-bit I/O port specified by Port. The value\r | |
84 | written to the I/O port is returned. This function must guarantee that all\r | |
85 | I/O read and write operations are serialized.\r | |
86 | \r | |
87 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
88 | \r | |
89 | @param Port The I/O port to write.\r | |
90 | @param AndData The value to AND with the read value from the I/O port.\r | |
91 | @param OrData The value to OR with the result of the AND operation.\r | |
92 | \r | |
93 | @return The value written back to the I/O port.\r | |
94 | \r | |
95 | **/\r | |
96 | UINT8\r | |
97 | EFIAPI\r | |
98 | IoAndThenOr8 (\r | |
2f88bd3a MK |
99 | IN UINTN Port,\r |
100 | IN UINT8 AndData,\r | |
101 | IN UINT8 OrData\r | |
e1f414b6 | 102 | )\r |
103 | {\r | |
2f88bd3a | 104 | return IoWrite8 (Port, (UINT8)((IoRead8 (Port) & AndData) | OrData));\r |
e1f414b6 | 105 | }\r |
106 | \r | |
107 | /**\r | |
108 | Reads a bit field of an I/O register.\r | |
109 | \r | |
110 | Reads the bit field in an 8-bit I/O register. The bit field is specified by\r | |
111 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
112 | \r | |
113 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
114 | If StartBit is greater than 7, then ASSERT().\r | |
115 | If EndBit is greater than 7, then ASSERT().\r | |
116 | If EndBit is less than StartBit, then ASSERT().\r | |
117 | \r | |
118 | @param Port The I/O port to read.\r | |
119 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
120 | Range 0..7.\r | |
121 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
122 | Range 0..7.\r | |
123 | \r | |
2281e7a9 | 124 | @return The value read.\r |
e1f414b6 | 125 | \r |
126 | **/\r | |
127 | UINT8\r | |
128 | EFIAPI\r | |
129 | IoBitFieldRead8 (\r | |
2f88bd3a MK |
130 | IN UINTN Port,\r |
131 | IN UINTN StartBit,\r | |
132 | IN UINTN EndBit\r | |
e1f414b6 | 133 | )\r |
134 | {\r | |
135 | return BitFieldRead8 (IoRead8 (Port), StartBit, EndBit);\r | |
136 | }\r | |
137 | \r | |
138 | /**\r | |
139 | Writes a bit field to an I/O register.\r | |
140 | \r | |
141 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
142 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
9095d37b | 143 | register are preserved. The value written to the I/O port is returned.\r |
e1f414b6 | 144 | \r |
145 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
146 | If StartBit is greater than 7, then ASSERT().\r | |
147 | If EndBit is greater than 7, then ASSERT().\r | |
148 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 149 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 150 | \r |
151 | @param Port The I/O port to write.\r | |
152 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
153 | Range 0..7.\r | |
154 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
155 | Range 0..7.\r | |
2fc59a00 | 156 | @param Value The new value of the bit field.\r |
e1f414b6 | 157 | \r |
158 | @return The value written back to the I/O port.\r | |
159 | \r | |
160 | **/\r | |
161 | UINT8\r | |
162 | EFIAPI\r | |
163 | IoBitFieldWrite8 (\r | |
2f88bd3a MK |
164 | IN UINTN Port,\r |
165 | IN UINTN StartBit,\r | |
166 | IN UINTN EndBit,\r | |
167 | IN UINT8 Value\r | |
e1f414b6 | 168 | )\r |
169 | {\r | |
170 | return IoWrite8 (\r | |
171 | Port,\r | |
172 | BitFieldWrite8 (IoRead8 (Port), StartBit, EndBit, Value)\r | |
173 | );\r | |
174 | }\r | |
175 | \r | |
176 | /**\r | |
177 | Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the\r | |
178 | result back to the bit field in the 8-bit port.\r | |
179 | \r | |
62991af2 | 180 | Reads the 8-bit I/O port specified by Port, performs a bitwise OR\r |
e1f414b6 | 181 | between the read result and the value specified by OrData, and writes the\r |
182 | result to the 8-bit I/O port specified by Port. The value written to the I/O\r | |
183 | port is returned. This function must guarantee that all I/O read and write\r | |
35a17154 | 184 | operations are serialized. Extra bits left in OrData are stripped.\r |
e1f414b6 | 185 | \r |
186 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
187 | If StartBit is greater than 7, then ASSERT().\r | |
188 | If EndBit is greater than 7, then ASSERT().\r | |
189 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 190 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 191 | \r |
192 | @param Port The I/O port to write.\r | |
193 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
194 | Range 0..7.\r | |
195 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
196 | Range 0..7.\r | |
197 | @param OrData The value to OR with the read value from the I/O port.\r | |
198 | \r | |
199 | @return The value written back to the I/O port.\r | |
200 | \r | |
201 | **/\r | |
202 | UINT8\r | |
203 | EFIAPI\r | |
204 | IoBitFieldOr8 (\r | |
2f88bd3a MK |
205 | IN UINTN Port,\r |
206 | IN UINTN StartBit,\r | |
207 | IN UINTN EndBit,\r | |
208 | IN UINT8 OrData\r | |
e1f414b6 | 209 | )\r |
210 | {\r | |
211 | return IoWrite8 (\r | |
212 | Port,\r | |
213 | BitFieldOr8 (IoRead8 (Port), StartBit, EndBit, OrData)\r | |
214 | );\r | |
215 | }\r | |
216 | \r | |
217 | /**\r | |
218 | Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the\r | |
219 | result back to the bit field in the 8-bit port.\r | |
220 | \r | |
221 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r | |
222 | the read result and the value specified by AndData, and writes the result to\r | |
223 | the 8-bit I/O port specified by Port. The value written to the I/O port is\r | |
224 | returned. This function must guarantee that all I/O read and write operations\r | |
35a17154 | 225 | are serialized. Extra bits left in AndData are stripped.\r |
e1f414b6 | 226 | \r |
227 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
228 | If StartBit is greater than 7, then ASSERT().\r | |
229 | If EndBit is greater than 7, then ASSERT().\r | |
230 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 231 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 232 | \r |
233 | @param Port The I/O port to write.\r | |
234 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
235 | Range 0..7.\r | |
236 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
237 | Range 0..7.\r | |
238 | @param AndData The value to AND with the read value from the I/O port.\r | |
239 | \r | |
240 | @return The value written back to the I/O port.\r | |
241 | \r | |
242 | **/\r | |
243 | UINT8\r | |
244 | EFIAPI\r | |
245 | IoBitFieldAnd8 (\r | |
2f88bd3a MK |
246 | IN UINTN Port,\r |
247 | IN UINTN StartBit,\r | |
248 | IN UINTN EndBit,\r | |
249 | IN UINT8 AndData\r | |
e1f414b6 | 250 | )\r |
251 | {\r | |
252 | return IoWrite8 (\r | |
253 | Port,\r | |
254 | BitFieldAnd8 (IoRead8 (Port), StartBit, EndBit, AndData)\r | |
255 | );\r | |
256 | }\r | |
257 | \r | |
258 | /**\r | |
259 | Reads a bit field in an 8-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 260 | bitwise OR, and writes the result back to the bit field in the\r |
e1f414b6 | 261 | 8-bit port.\r |
262 | \r | |
263 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 264 | by a bitwise OR between the read result and the value specified by\r |
e1f414b6 | 265 | AndData, and writes the result to the 8-bit I/O port specified by Port. The\r |
266 | value written to the I/O port is returned. This function must guarantee that\r | |
35a17154 | 267 | all I/O read and write operations are serialized. Extra bits left in both\r |
e1f414b6 | 268 | AndData and OrData are stripped.\r |
269 | \r | |
270 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
271 | If StartBit is greater than 7, then ASSERT().\r | |
272 | If EndBit is greater than 7, then ASSERT().\r | |
273 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
274 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
275 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
e1f414b6 | 276 | \r |
277 | @param Port The I/O port to write.\r | |
278 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
279 | Range 0..7.\r | |
280 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
281 | Range 0..7.\r | |
282 | @param AndData The value to AND with the read value from the I/O port.\r | |
283 | @param OrData The value to OR with the result of the AND operation.\r | |
284 | \r | |
285 | @return The value written back to the I/O port.\r | |
286 | \r | |
287 | **/\r | |
288 | UINT8\r | |
289 | EFIAPI\r | |
290 | IoBitFieldAndThenOr8 (\r | |
2f88bd3a MK |
291 | IN UINTN Port,\r |
292 | IN UINTN StartBit,\r | |
293 | IN UINTN EndBit,\r | |
294 | IN UINT8 AndData,\r | |
295 | IN UINT8 OrData\r | |
e1f414b6 | 296 | )\r |
297 | {\r | |
298 | return IoWrite8 (\r | |
299 | Port,\r | |
300 | BitFieldAndThenOr8 (IoRead8 (Port), StartBit, EndBit, AndData, OrData)\r | |
301 | );\r | |
302 | }\r | |
303 | \r | |
304 | /**\r | |
62991af2 | 305 | Reads a 16-bit I/O port, performs a bitwise OR, and writes the\r |
e1f414b6 | 306 | result back to the 16-bit I/O port.\r |
307 | \r | |
62991af2 | 308 | Reads the 16-bit I/O port specified by Port, performs a bitwise OR\r |
e1f414b6 | 309 | between the read result and the value specified by OrData, and writes the\r |
310 | result to the 16-bit I/O port specified by Port. The value written to the I/O\r | |
311 | port is returned. This function must guarantee that all I/O read and write\r | |
312 | operations are serialized.\r | |
313 | \r | |
314 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 315 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 316 | \r |
317 | @param Port The I/O port to write.\r | |
318 | @param OrData The value to OR with the read value from the I/O port.\r | |
319 | \r | |
320 | @return The value written back to the I/O port.\r | |
321 | \r | |
322 | **/\r | |
323 | UINT16\r | |
324 | EFIAPI\r | |
325 | IoOr16 (\r | |
2f88bd3a MK |
326 | IN UINTN Port,\r |
327 | IN UINT16 OrData\r | |
e1f414b6 | 328 | )\r |
329 | {\r | |
2f88bd3a | 330 | return IoWrite16 (Port, (UINT16)(IoRead16 (Port) | OrData));\r |
e1f414b6 | 331 | }\r |
332 | \r | |
333 | /**\r | |
334 | Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back\r | |
335 | to the 16-bit I/O port.\r | |
336 | \r | |
337 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r | |
338 | the read result and the value specified by AndData, and writes the result to\r | |
339 | the 16-bit I/O port specified by Port. The value written to the I/O port is\r | |
340 | returned. This function must guarantee that all I/O read and write operations\r | |
341 | are serialized.\r | |
342 | \r | |
343 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 344 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
9095d37b | 345 | \r |
e1f414b6 | 346 | @param Port The I/O port to write.\r |
347 | @param AndData The value to AND with the read value from the I/O port.\r | |
348 | \r | |
349 | @return The value written back to the I/O port.\r | |
350 | \r | |
351 | **/\r | |
352 | UINT16\r | |
353 | EFIAPI\r | |
354 | IoAnd16 (\r | |
2f88bd3a MK |
355 | IN UINTN Port,\r |
356 | IN UINT16 AndData\r | |
e1f414b6 | 357 | )\r |
358 | {\r | |
2f88bd3a | 359 | return IoWrite16 (Port, (UINT16)(IoRead16 (Port) & AndData));\r |
e1f414b6 | 360 | }\r |
361 | \r | |
362 | /**\r | |
9095d37b | 363 | Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 364 | OR, and writes the result back to the 16-bit I/O port.\r |
e1f414b6 | 365 | \r |
366 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r | |
367 | the read result and the value specified by AndData, performs a bitwise OR\r | |
368 | between the result of the AND operation and the value specified by OrData,\r | |
369 | and writes the result to the 16-bit I/O port specified by Port. The value\r | |
370 | written to the I/O port is returned. This function must guarantee that all\r | |
371 | I/O read and write operations are serialized.\r | |
372 | \r | |
373 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 374 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
9095d37b | 375 | \r |
e1f414b6 | 376 | @param Port The I/O port to write.\r |
377 | @param AndData The value to AND with the read value from the I/O port.\r | |
378 | @param OrData The value to OR with the result of the AND operation.\r | |
379 | \r | |
380 | @return The value written back to the I/O port.\r | |
381 | \r | |
382 | **/\r | |
383 | UINT16\r | |
384 | EFIAPI\r | |
385 | IoAndThenOr16 (\r | |
2f88bd3a MK |
386 | IN UINTN Port,\r |
387 | IN UINT16 AndData,\r | |
388 | IN UINT16 OrData\r | |
e1f414b6 | 389 | )\r |
390 | {\r | |
2f88bd3a | 391 | return IoWrite16 (Port, (UINT16)((IoRead16 (Port) & AndData) | OrData));\r |
e1f414b6 | 392 | }\r |
393 | \r | |
394 | /**\r | |
395 | Reads a bit field of an I/O register.\r | |
396 | \r | |
397 | Reads the bit field in a 16-bit I/O register. The bit field is specified by\r | |
398 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
399 | \r | |
400 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 401 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 402 | If StartBit is greater than 15, then ASSERT().\r |
403 | If EndBit is greater than 15, then ASSERT().\r | |
404 | If EndBit is less than StartBit, then ASSERT().\r | |
405 | \r | |
406 | @param Port The I/O port to read.\r | |
407 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
408 | Range 0..15.\r | |
409 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
410 | Range 0..15.\r | |
411 | \r | |
2281e7a9 | 412 | @return The value read.\r |
e1f414b6 | 413 | \r |
414 | **/\r | |
415 | UINT16\r | |
416 | EFIAPI\r | |
417 | IoBitFieldRead16 (\r | |
2f88bd3a MK |
418 | IN UINTN Port,\r |
419 | IN UINTN StartBit,\r | |
420 | IN UINTN EndBit\r | |
e1f414b6 | 421 | )\r |
422 | {\r | |
423 | return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit);\r | |
424 | }\r | |
425 | \r | |
426 | /**\r | |
427 | Writes a bit field to an I/O register.\r | |
428 | \r | |
429 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
430 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
431 | register are preserved. The value written to the I/O port is returned. Extra\r | |
35a17154 | 432 | bits left in Value are stripped.\r |
e1f414b6 | 433 | \r |
434 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 435 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 436 | If StartBit is greater than 15, then ASSERT().\r |
437 | If EndBit is greater than 15, then ASSERT().\r | |
438 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 439 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 440 | \r |
441 | @param Port The I/O port to write.\r | |
442 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
443 | Range 0..15.\r | |
444 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
445 | Range 0..15.\r | |
2fc59a00 | 446 | @param Value The new value of the bit field.\r |
e1f414b6 | 447 | \r |
448 | @return The value written back to the I/O port.\r | |
449 | \r | |
450 | **/\r | |
451 | UINT16\r | |
452 | EFIAPI\r | |
453 | IoBitFieldWrite16 (\r | |
2f88bd3a MK |
454 | IN UINTN Port,\r |
455 | IN UINTN StartBit,\r | |
456 | IN UINTN EndBit,\r | |
457 | IN UINT16 Value\r | |
e1f414b6 | 458 | )\r |
459 | {\r | |
460 | return IoWrite16 (\r | |
461 | Port,\r | |
462 | BitFieldWrite16 (IoRead16 (Port), StartBit, EndBit, Value)\r | |
463 | );\r | |
464 | }\r | |
465 | \r | |
466 | /**\r | |
467 | Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the\r | |
468 | result back to the bit field in the 16-bit port.\r | |
469 | \r | |
62991af2 | 470 | Reads the 16-bit I/O port specified by Port, performs a bitwise OR\r |
e1f414b6 | 471 | between the read result and the value specified by OrData, and writes the\r |
472 | result to the 16-bit I/O port specified by Port. The value written to the I/O\r | |
473 | port is returned. This function must guarantee that all I/O read and write\r | |
35a17154 | 474 | operations are serialized. Extra bits left in OrData are stripped.\r |
e1f414b6 | 475 | \r |
476 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 477 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 478 | If StartBit is greater than 15, then ASSERT().\r |
479 | If EndBit is greater than 15, then ASSERT().\r | |
480 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 481 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 482 | \r |
483 | @param Port The I/O port to write.\r | |
484 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
485 | Range 0..15.\r | |
486 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
487 | Range 0..15.\r | |
488 | @param OrData The value to OR with the read value from the I/O port.\r | |
489 | \r | |
490 | @return The value written back to the I/O port.\r | |
491 | \r | |
492 | **/\r | |
493 | UINT16\r | |
494 | EFIAPI\r | |
495 | IoBitFieldOr16 (\r | |
2f88bd3a MK |
496 | IN UINTN Port,\r |
497 | IN UINTN StartBit,\r | |
498 | IN UINTN EndBit,\r | |
499 | IN UINT16 OrData\r | |
e1f414b6 | 500 | )\r |
501 | {\r | |
502 | return IoWrite16 (\r | |
503 | Port,\r | |
504 | BitFieldOr16 (IoRead16 (Port), StartBit, EndBit, OrData)\r | |
505 | );\r | |
506 | }\r | |
507 | \r | |
508 | /**\r | |
509 | Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the\r | |
510 | result back to the bit field in the 16-bit port.\r | |
511 | \r | |
512 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r | |
513 | the read result and the value specified by AndData, and writes the result to\r | |
514 | the 16-bit I/O port specified by Port. The value written to the I/O port is\r | |
515 | returned. This function must guarantee that all I/O read and write operations\r | |
35a17154 | 516 | are serialized. Extra bits left in AndData are stripped.\r |
e1f414b6 | 517 | \r |
518 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 519 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 520 | If StartBit is greater than 15, then ASSERT().\r |
521 | If EndBit is greater than 15, then ASSERT().\r | |
522 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 523 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 524 | \r |
525 | @param Port The I/O port to write.\r | |
526 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
527 | Range 0..15.\r | |
528 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
529 | Range 0..15.\r | |
530 | @param AndData The value to AND with the read value from the I/O port.\r | |
531 | \r | |
532 | @return The value written back to the I/O port.\r | |
533 | \r | |
534 | **/\r | |
535 | UINT16\r | |
536 | EFIAPI\r | |
537 | IoBitFieldAnd16 (\r | |
2f88bd3a MK |
538 | IN UINTN Port,\r |
539 | IN UINTN StartBit,\r | |
540 | IN UINTN EndBit,\r | |
541 | IN UINT16 AndData\r | |
e1f414b6 | 542 | )\r |
543 | {\r | |
544 | return IoWrite16 (\r | |
545 | Port,\r | |
546 | BitFieldAnd16 (IoRead16 (Port), StartBit, EndBit, AndData)\r | |
547 | );\r | |
548 | }\r | |
549 | \r | |
550 | /**\r | |
551 | Reads a bit field in a 16-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 552 | bitwise OR, and writes the result back to the bit field in the\r |
e1f414b6 | 553 | 16-bit port.\r |
554 | \r | |
555 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 556 | by a bitwise OR between the read result and the value specified by\r |
e1f414b6 | 557 | AndData, and writes the result to the 16-bit I/O port specified by Port. The\r |
558 | value written to the I/O port is returned. This function must guarantee that\r | |
35a17154 | 559 | all I/O read and write operations are serialized. Extra bits left in both\r |
e1f414b6 | 560 | AndData and OrData are stripped.\r |
561 | \r | |
562 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 563 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 564 | If StartBit is greater than 15, then ASSERT().\r |
565 | If EndBit is greater than 15, then ASSERT().\r | |
566 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
567 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
568 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
e1f414b6 | 569 | \r |
570 | @param Port The I/O port to write.\r | |
571 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
572 | Range 0..15.\r | |
573 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
574 | Range 0..15.\r | |
575 | @param AndData The value to AND with the read value from the I/O port.\r | |
576 | @param OrData The value to OR with the result of the AND operation.\r | |
577 | \r | |
578 | @return The value written back to the I/O port.\r | |
579 | \r | |
580 | **/\r | |
581 | UINT16\r | |
582 | EFIAPI\r | |
583 | IoBitFieldAndThenOr16 (\r | |
2f88bd3a MK |
584 | IN UINTN Port,\r |
585 | IN UINTN StartBit,\r | |
586 | IN UINTN EndBit,\r | |
587 | IN UINT16 AndData,\r | |
588 | IN UINT16 OrData\r | |
e1f414b6 | 589 | )\r |
590 | {\r | |
591 | return IoWrite16 (\r | |
592 | Port,\r | |
593 | BitFieldAndThenOr16 (IoRead16 (Port), StartBit, EndBit, AndData, OrData)\r | |
594 | );\r | |
595 | }\r | |
596 | \r | |
597 | /**\r | |
62991af2 | 598 | Reads a 32-bit I/O port, performs a bitwise OR, and writes the\r |
e1f414b6 | 599 | result back to the 32-bit I/O port.\r |
600 | \r | |
62991af2 | 601 | Reads the 32-bit I/O port specified by Port, performs a bitwise OR\r |
e1f414b6 | 602 | between the read result and the value specified by OrData, and writes the\r |
603 | result to the 32-bit I/O port specified by Port. The value written to the I/O\r | |
604 | port is returned. This function must guarantee that all I/O read and write\r | |
605 | operations are serialized.\r | |
606 | \r | |
607 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 608 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 609 | \r |
610 | @param Port The I/O port to write.\r | |
611 | @param OrData The value to OR with the read value from the I/O port.\r | |
612 | \r | |
613 | @return The value written back to the I/O port.\r | |
614 | \r | |
615 | **/\r | |
616 | UINT32\r | |
617 | EFIAPI\r | |
618 | IoOr32 (\r | |
2f88bd3a MK |
619 | IN UINTN Port,\r |
620 | IN UINT32 OrData\r | |
e1f414b6 | 621 | )\r |
622 | {\r | |
623 | return IoWrite32 (Port, IoRead32 (Port) | OrData);\r | |
624 | }\r | |
625 | \r | |
626 | /**\r | |
627 | Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back\r | |
628 | to the 32-bit I/O port.\r | |
629 | \r | |
630 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r | |
631 | the read result and the value specified by AndData, and writes the result to\r | |
632 | the 32-bit I/O port specified by Port. The value written to the I/O port is\r | |
633 | returned. This function must guarantee that all I/O read and write operations\r | |
634 | are serialized.\r | |
635 | \r | |
636 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 637 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 638 | \r |
639 | @param Port The I/O port to write.\r | |
640 | @param AndData The value to AND with the read value from the I/O port.\r | |
641 | \r | |
642 | @return The value written back to the I/O port.\r | |
643 | \r | |
644 | **/\r | |
645 | UINT32\r | |
646 | EFIAPI\r | |
647 | IoAnd32 (\r | |
2f88bd3a MK |
648 | IN UINTN Port,\r |
649 | IN UINT32 AndData\r | |
e1f414b6 | 650 | )\r |
651 | {\r | |
652 | return IoWrite32 (Port, IoRead32 (Port) & AndData);\r | |
653 | }\r | |
654 | \r | |
655 | /**\r | |
9095d37b | 656 | Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 657 | OR, and writes the result back to the 32-bit I/O port.\r |
e1f414b6 | 658 | \r |
659 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r | |
660 | the read result and the value specified by AndData, performs a bitwise OR\r | |
661 | between the result of the AND operation and the value specified by OrData,\r | |
662 | and writes the result to the 32-bit I/O port specified by Port. The value\r | |
663 | written to the I/O port is returned. This function must guarantee that all\r | |
664 | I/O read and write operations are serialized.\r | |
665 | \r | |
666 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 667 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 668 | \r |
669 | @param Port The I/O port to write.\r | |
670 | @param AndData The value to AND with the read value from the I/O port.\r | |
671 | @param OrData The value to OR with the result of the AND operation.\r | |
672 | \r | |
673 | @return The value written back to the I/O port.\r | |
674 | \r | |
675 | **/\r | |
676 | UINT32\r | |
677 | EFIAPI\r | |
678 | IoAndThenOr32 (\r | |
2f88bd3a MK |
679 | IN UINTN Port,\r |
680 | IN UINT32 AndData,\r | |
681 | IN UINT32 OrData\r | |
e1f414b6 | 682 | )\r |
683 | {\r | |
684 | return IoWrite32 (Port, (IoRead32 (Port) & AndData) | OrData);\r | |
685 | }\r | |
686 | \r | |
687 | /**\r | |
688 | Reads a bit field of an I/O register.\r | |
689 | \r | |
690 | Reads the bit field in a 32-bit I/O register. The bit field is specified by\r | |
691 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
692 | \r | |
693 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 694 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 695 | If StartBit is greater than 31, then ASSERT().\r |
696 | If EndBit is greater than 31, then ASSERT().\r | |
697 | If EndBit is less than StartBit, then ASSERT().\r | |
698 | \r | |
699 | @param Port The I/O port to read.\r | |
700 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
701 | Range 0..31.\r | |
702 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
703 | Range 0..31.\r | |
704 | \r | |
2281e7a9 | 705 | @return The value read.\r |
e1f414b6 | 706 | \r |
707 | **/\r | |
708 | UINT32\r | |
709 | EFIAPI\r | |
710 | IoBitFieldRead32 (\r | |
2f88bd3a MK |
711 | IN UINTN Port,\r |
712 | IN UINTN StartBit,\r | |
713 | IN UINTN EndBit\r | |
e1f414b6 | 714 | )\r |
715 | {\r | |
716 | return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit);\r | |
717 | }\r | |
718 | \r | |
719 | /**\r | |
720 | Writes a bit field to an I/O register.\r | |
721 | \r | |
722 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
723 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
724 | register are preserved. The value written to the I/O port is returned. Extra\r | |
35a17154 | 725 | bits left in Value are stripped.\r |
e1f414b6 | 726 | \r |
727 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 728 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 729 | If StartBit is greater than 31, then ASSERT().\r |
730 | If EndBit is greater than 31, then ASSERT().\r | |
731 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 732 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 733 | \r |
734 | @param Port The I/O port to write.\r | |
735 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
736 | Range 0..31.\r | |
737 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
738 | Range 0..31.\r | |
2fc59a00 | 739 | @param Value The new value of the bit field.\r |
e1f414b6 | 740 | \r |
741 | @return The value written back to the I/O port.\r | |
742 | \r | |
743 | **/\r | |
744 | UINT32\r | |
745 | EFIAPI\r | |
746 | IoBitFieldWrite32 (\r | |
2f88bd3a MK |
747 | IN UINTN Port,\r |
748 | IN UINTN StartBit,\r | |
749 | IN UINTN EndBit,\r | |
750 | IN UINT32 Value\r | |
e1f414b6 | 751 | )\r |
752 | {\r | |
753 | return IoWrite32 (\r | |
754 | Port,\r | |
755 | BitFieldWrite32 (IoRead32 (Port), StartBit, EndBit, Value)\r | |
756 | );\r | |
757 | }\r | |
758 | \r | |
759 | /**\r | |
760 | Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the\r | |
761 | result back to the bit field in the 32-bit port.\r | |
762 | \r | |
62991af2 | 763 | Reads the 32-bit I/O port specified by Port, performs a bitwise OR\r |
e1f414b6 | 764 | between the read result and the value specified by OrData, and writes the\r |
765 | result to the 32-bit I/O port specified by Port. The value written to the I/O\r | |
766 | port is returned. This function must guarantee that all I/O read and write\r | |
35a17154 | 767 | operations are serialized. Extra bits left in OrData are stripped.\r |
e1f414b6 | 768 | \r |
769 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 770 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 771 | If StartBit is greater than 31, then ASSERT().\r |
772 | If EndBit is greater than 31, then ASSERT().\r | |
773 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 774 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 775 | \r |
776 | @param Port The I/O port to write.\r | |
777 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
778 | Range 0..31.\r | |
779 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
780 | Range 0..31.\r | |
781 | @param OrData The value to OR with the read value from the I/O port.\r | |
782 | \r | |
783 | @return The value written back to the I/O port.\r | |
784 | \r | |
785 | **/\r | |
786 | UINT32\r | |
787 | EFIAPI\r | |
788 | IoBitFieldOr32 (\r | |
2f88bd3a MK |
789 | IN UINTN Port,\r |
790 | IN UINTN StartBit,\r | |
791 | IN UINTN EndBit,\r | |
792 | IN UINT32 OrData\r | |
e1f414b6 | 793 | )\r |
794 | {\r | |
795 | return IoWrite32 (\r | |
796 | Port,\r | |
797 | BitFieldOr32 (IoRead32 (Port), StartBit, EndBit, OrData)\r | |
798 | );\r | |
799 | }\r | |
800 | \r | |
801 | /**\r | |
802 | Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the\r | |
803 | result back to the bit field in the 32-bit port.\r | |
804 | \r | |
805 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r | |
806 | the read result and the value specified by AndData, and writes the result to\r | |
807 | the 32-bit I/O port specified by Port. The value written to the I/O port is\r | |
808 | returned. This function must guarantee that all I/O read and write operations\r | |
35a17154 | 809 | are serialized. Extra bits left in AndData are stripped.\r |
e1f414b6 | 810 | \r |
811 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 812 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 813 | If StartBit is greater than 31, then ASSERT().\r |
814 | If EndBit is greater than 31, then ASSERT().\r | |
815 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 816 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 817 | \r |
818 | @param Port The I/O port to write.\r | |
819 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
820 | Range 0..31.\r | |
821 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
822 | Range 0..31.\r | |
823 | @param AndData The value to AND with the read value from the I/O port.\r | |
824 | \r | |
825 | @return The value written back to the I/O port.\r | |
826 | \r | |
827 | **/\r | |
828 | UINT32\r | |
829 | EFIAPI\r | |
830 | IoBitFieldAnd32 (\r | |
2f88bd3a MK |
831 | IN UINTN Port,\r |
832 | IN UINTN StartBit,\r | |
833 | IN UINTN EndBit,\r | |
834 | IN UINT32 AndData\r | |
e1f414b6 | 835 | )\r |
836 | {\r | |
837 | return IoWrite32 (\r | |
838 | Port,\r | |
839 | BitFieldAnd32 (IoRead32 (Port), StartBit, EndBit, AndData)\r | |
840 | );\r | |
841 | }\r | |
842 | \r | |
843 | /**\r | |
844 | Reads a bit field in a 32-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 845 | bitwise OR, and writes the result back to the bit field in the\r |
e1f414b6 | 846 | 32-bit port.\r |
847 | \r | |
848 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 849 | by a bitwise OR between the read result and the value specified by\r |
e1f414b6 | 850 | AndData, and writes the result to the 32-bit I/O port specified by Port. The\r |
851 | value written to the I/O port is returned. This function must guarantee that\r | |
35a17154 | 852 | all I/O read and write operations are serialized. Extra bits left in both\r |
e1f414b6 | 853 | AndData and OrData are stripped.\r |
854 | \r | |
855 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 856 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 857 | If StartBit is greater than 31, then ASSERT().\r |
858 | If EndBit is greater than 31, then ASSERT().\r | |
859 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
860 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
861 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
e1f414b6 | 862 | \r |
863 | @param Port The I/O port to write.\r | |
864 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
865 | Range 0..31.\r | |
866 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
867 | Range 0..31.\r | |
868 | @param AndData The value to AND with the read value from the I/O port.\r | |
869 | @param OrData The value to OR with the result of the AND operation.\r | |
870 | \r | |
871 | @return The value written back to the I/O port.\r | |
872 | \r | |
873 | **/\r | |
874 | UINT32\r | |
875 | EFIAPI\r | |
876 | IoBitFieldAndThenOr32 (\r | |
2f88bd3a MK |
877 | IN UINTN Port,\r |
878 | IN UINTN StartBit,\r | |
879 | IN UINTN EndBit,\r | |
880 | IN UINT32 AndData,\r | |
881 | IN UINT32 OrData\r | |
e1f414b6 | 882 | )\r |
883 | {\r | |
884 | return IoWrite32 (\r | |
885 | Port,\r | |
886 | BitFieldAndThenOr32 (IoRead32 (Port), StartBit, EndBit, AndData, OrData)\r | |
887 | );\r | |
888 | }\r | |
889 | \r | |
890 | /**\r | |
62991af2 | 891 | Reads a 64-bit I/O port, performs a bitwise OR, and writes the\r |
e1f414b6 | 892 | result back to the 64-bit I/O port.\r |
893 | \r | |
62991af2 | 894 | Reads the 64-bit I/O port specified by Port, performs a bitwise OR\r |
e1f414b6 | 895 | between the read result and the value specified by OrData, and writes the\r |
896 | result to the 64-bit I/O port specified by Port. The value written to the I/O\r | |
897 | port is returned. This function must guarantee that all I/O read and write\r | |
898 | operations are serialized.\r | |
899 | \r | |
900 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 901 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 902 | \r |
903 | @param Port The I/O port to write.\r | |
904 | @param OrData The value to OR with the read value from the I/O port.\r | |
905 | \r | |
906 | @return The value written back to the I/O port.\r | |
907 | \r | |
908 | **/\r | |
909 | UINT64\r | |
910 | EFIAPI\r | |
911 | IoOr64 (\r | |
2f88bd3a MK |
912 | IN UINTN Port,\r |
913 | IN UINT64 OrData\r | |
e1f414b6 | 914 | )\r |
915 | {\r | |
916 | return IoWrite64 (Port, IoRead64 (Port) | OrData);\r | |
917 | }\r | |
918 | \r | |
919 | /**\r | |
920 | Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back\r | |
921 | to the 64-bit I/O port.\r | |
922 | \r | |
923 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r | |
924 | the read result and the value specified by AndData, and writes the result to\r | |
925 | the 64-bit I/O port specified by Port. The value written to the I/O port is\r | |
926 | returned. This function must guarantee that all I/O read and write operations\r | |
927 | are serialized.\r | |
928 | \r | |
929 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 930 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 931 | \r |
932 | @param Port The I/O port to write.\r | |
933 | @param AndData The value to AND with the read value from the I/O port.\r | |
934 | \r | |
935 | @return The value written back to the I/O port.\r | |
936 | \r | |
937 | **/\r | |
938 | UINT64\r | |
939 | EFIAPI\r | |
940 | IoAnd64 (\r | |
2f88bd3a MK |
941 | IN UINTN Port,\r |
942 | IN UINT64 AndData\r | |
e1f414b6 | 943 | )\r |
944 | {\r | |
945 | return IoWrite64 (Port, IoRead64 (Port) & AndData);\r | |
946 | }\r | |
947 | \r | |
948 | /**\r | |
9095d37b | 949 | Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 950 | OR, and writes the result back to the 64-bit I/O port.\r |
e1f414b6 | 951 | \r |
952 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r | |
953 | the read result and the value specified by AndData, performs a bitwise OR\r | |
954 | between the result of the AND operation and the value specified by OrData,\r | |
955 | and writes the result to the 64-bit I/O port specified by Port. The value\r | |
956 | written to the I/O port is returned. This function must guarantee that all\r | |
957 | I/O read and write operations are serialized.\r | |
958 | \r | |
959 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 960 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 961 | \r |
962 | @param Port The I/O port to write.\r | |
963 | @param AndData The value to AND with the read value from the I/O port.\r | |
964 | @param OrData The value to OR with the result of the AND operation.\r | |
965 | \r | |
966 | @return The value written back to the I/O port.\r | |
967 | \r | |
968 | **/\r | |
969 | UINT64\r | |
970 | EFIAPI\r | |
971 | IoAndThenOr64 (\r | |
2f88bd3a MK |
972 | IN UINTN Port,\r |
973 | IN UINT64 AndData,\r | |
974 | IN UINT64 OrData\r | |
e1f414b6 | 975 | )\r |
976 | {\r | |
977 | return IoWrite64 (Port, (IoRead64 (Port) & AndData) | OrData);\r | |
978 | }\r | |
979 | \r | |
980 | /**\r | |
981 | Reads a bit field of an I/O register.\r | |
982 | \r | |
983 | Reads the bit field in a 64-bit I/O register. The bit field is specified by\r | |
984 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
985 | \r | |
986 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 987 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 988 | If StartBit is greater than 63, then ASSERT().\r |
989 | If EndBit is greater than 63, then ASSERT().\r | |
990 | If EndBit is less than StartBit, then ASSERT().\r | |
991 | \r | |
992 | @param Port The I/O port to read.\r | |
993 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
994 | Range 0..63.\r | |
995 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
996 | Range 0..63.\r | |
997 | \r | |
2281e7a9 | 998 | @return The value read.\r |
e1f414b6 | 999 | \r |
1000 | **/\r | |
1001 | UINT64\r | |
1002 | EFIAPI\r | |
1003 | IoBitFieldRead64 (\r | |
2f88bd3a MK |
1004 | IN UINTN Port,\r |
1005 | IN UINTN StartBit,\r | |
1006 | IN UINTN EndBit\r | |
e1f414b6 | 1007 | )\r |
1008 | {\r | |
1009 | return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit);\r | |
1010 | }\r | |
1011 | \r | |
1012 | /**\r | |
1013 | Writes a bit field to an I/O register.\r | |
1014 | \r | |
1015 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
1016 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
1017 | register are preserved. The value written to the I/O port is returned. Extra\r | |
35a17154 | 1018 | bits left in Value are stripped.\r |
e1f414b6 | 1019 | \r |
1020 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 1021 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 1022 | If StartBit is greater than 63, then ASSERT().\r |
1023 | If EndBit is greater than 63, then ASSERT().\r | |
1024 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1025 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1026 | \r |
1027 | @param Port The I/O port to write.\r | |
1028 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1029 | Range 0..63.\r | |
1030 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1031 | Range 0..63.\r | |
2fc59a00 | 1032 | @param Value The new value of the bit field.\r |
e1f414b6 | 1033 | \r |
1034 | @return The value written back to the I/O port.\r | |
1035 | \r | |
1036 | **/\r | |
1037 | UINT64\r | |
1038 | EFIAPI\r | |
1039 | IoBitFieldWrite64 (\r | |
2f88bd3a MK |
1040 | IN UINTN Port,\r |
1041 | IN UINTN StartBit,\r | |
1042 | IN UINTN EndBit,\r | |
1043 | IN UINT64 Value\r | |
e1f414b6 | 1044 | )\r |
1045 | {\r | |
1046 | return IoWrite64 (\r | |
1047 | Port,\r | |
1048 | BitFieldWrite64 (IoRead64 (Port), StartBit, EndBit, Value)\r | |
1049 | );\r | |
1050 | }\r | |
1051 | \r | |
1052 | /**\r | |
1053 | Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the\r | |
1054 | result back to the bit field in the 64-bit port.\r | |
1055 | \r | |
62991af2 | 1056 | Reads the 64-bit I/O port specified by Port, performs a bitwise OR\r |
e1f414b6 | 1057 | between the read result and the value specified by OrData, and writes the\r |
1058 | result to the 64-bit I/O port specified by Port. The value written to the I/O\r | |
1059 | port is returned. This function must guarantee that all I/O read and write\r | |
35a17154 | 1060 | operations are serialized. Extra bits left in OrData are stripped.\r |
e1f414b6 | 1061 | \r |
1062 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 1063 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 1064 | If StartBit is greater than 63, then ASSERT().\r |
1065 | If EndBit is greater than 63, then ASSERT().\r | |
1066 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1067 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1068 | \r |
1069 | @param Port The I/O port to write.\r | |
1070 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1071 | Range 0..63.\r | |
1072 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1073 | Range 0..63.\r | |
1074 | @param OrData The value to OR with the read value from the I/O port.\r | |
1075 | \r | |
1076 | @return The value written back to the I/O port.\r | |
1077 | \r | |
1078 | **/\r | |
1079 | UINT64\r | |
1080 | EFIAPI\r | |
1081 | IoBitFieldOr64 (\r | |
2f88bd3a MK |
1082 | IN UINTN Port,\r |
1083 | IN UINTN StartBit,\r | |
1084 | IN UINTN EndBit,\r | |
1085 | IN UINT64 OrData\r | |
e1f414b6 | 1086 | )\r |
1087 | {\r | |
1088 | return IoWrite64 (\r | |
1089 | Port,\r | |
1090 | BitFieldOr64 (IoRead64 (Port), StartBit, EndBit, OrData)\r | |
1091 | );\r | |
1092 | }\r | |
1093 | \r | |
1094 | /**\r | |
1095 | Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the\r | |
1096 | result back to the bit field in the 64-bit port.\r | |
1097 | \r | |
1098 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r | |
1099 | the read result and the value specified by AndData, and writes the result to\r | |
1100 | the 64-bit I/O port specified by Port. The value written to the I/O port is\r | |
1101 | returned. This function must guarantee that all I/O read and write operations\r | |
35a17154 | 1102 | are serialized. Extra bits left in AndData are stripped.\r |
e1f414b6 | 1103 | \r |
1104 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 1105 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 1106 | If StartBit is greater than 63, then ASSERT().\r |
1107 | If EndBit is greater than 63, then ASSERT().\r | |
1108 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1109 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1110 | \r |
1111 | @param Port The I/O port to write.\r | |
1112 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1113 | Range 0..63.\r | |
1114 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1115 | Range 0..63.\r | |
1116 | @param AndData The value to AND with the read value from the I/O port.\r | |
1117 | \r | |
1118 | @return The value written back to the I/O port.\r | |
1119 | \r | |
1120 | **/\r | |
1121 | UINT64\r | |
1122 | EFIAPI\r | |
1123 | IoBitFieldAnd64 (\r | |
2f88bd3a MK |
1124 | IN UINTN Port,\r |
1125 | IN UINTN StartBit,\r | |
1126 | IN UINTN EndBit,\r | |
1127 | IN UINT64 AndData\r | |
e1f414b6 | 1128 | )\r |
1129 | {\r | |
1130 | return IoWrite64 (\r | |
1131 | Port,\r | |
1132 | BitFieldAnd64 (IoRead64 (Port), StartBit, EndBit, AndData)\r | |
1133 | );\r | |
1134 | }\r | |
1135 | \r | |
1136 | /**\r | |
1137 | Reads a bit field in a 64-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 1138 | bitwise OR, and writes the result back to the bit field in the\r |
e1f414b6 | 1139 | 64-bit port.\r |
1140 | \r | |
1141 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 1142 | by a bitwise OR between the read result and the value specified by\r |
e1f414b6 | 1143 | AndData, and writes the result to the 64-bit I/O port specified by Port. The\r |
1144 | value written to the I/O port is returned. This function must guarantee that\r | |
35a17154 | 1145 | all I/O read and write operations are serialized. Extra bits left in both\r |
e1f414b6 | 1146 | AndData and OrData are stripped.\r |
1147 | \r | |
1148 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
2281e7a9 | 1149 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 1150 | If StartBit is greater than 63, then ASSERT().\r |
1151 | If EndBit is greater than 63, then ASSERT().\r | |
1152 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
1153 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
1154 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
e1f414b6 | 1155 | \r |
1156 | @param Port The I/O port to write.\r | |
1157 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1158 | Range 0..63.\r | |
1159 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1160 | Range 0..63.\r | |
1161 | @param AndData The value to AND with the read value from the I/O port.\r | |
1162 | @param OrData The value to OR with the result of the AND operation.\r | |
1163 | \r | |
1164 | @return The value written back to the I/O port.\r | |
1165 | \r | |
1166 | **/\r | |
1167 | UINT64\r | |
1168 | EFIAPI\r | |
1169 | IoBitFieldAndThenOr64 (\r | |
2f88bd3a MK |
1170 | IN UINTN Port,\r |
1171 | IN UINTN StartBit,\r | |
1172 | IN UINTN EndBit,\r | |
1173 | IN UINT64 AndData,\r | |
1174 | IN UINT64 OrData\r | |
e1f414b6 | 1175 | )\r |
1176 | {\r | |
1177 | return IoWrite64 (\r | |
1178 | Port,\r | |
1179 | BitFieldAndThenOr64 (IoRead64 (Port), StartBit, EndBit, AndData, OrData)\r | |
1180 | );\r | |
1181 | }\r | |
1182 | \r | |
1183 | /**\r | |
62991af2 | 1184 | Reads an 8-bit MMIO register, performs a bitwise OR, and writes the\r |
e1f414b6 | 1185 | result back to the 8-bit MMIO register.\r |
1186 | \r | |
9095d37b | 1187 | Reads the 8-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1188 | OR between the read result and the value specified by OrData, and\r |
e1f414b6 | 1189 | writes the result to the 8-bit MMIO register specified by Address. The value\r |
1190 | written to the MMIO register is returned. This function must guarantee that\r | |
1191 | all MMIO read and write operations are serialized.\r | |
1192 | \r | |
1193 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1194 | \r | |
1195 | @param Address The MMIO register to write.\r | |
1196 | @param OrData The value to OR with the read value from the MMIO register.\r | |
1197 | \r | |
1198 | @return The value written back to the MMIO register.\r | |
1199 | \r | |
1200 | **/\r | |
1201 | UINT8\r | |
1202 | EFIAPI\r | |
1203 | MmioOr8 (\r | |
2f88bd3a MK |
1204 | IN UINTN Address,\r |
1205 | IN UINT8 OrData\r | |
e1f414b6 | 1206 | )\r |
1207 | {\r | |
2f88bd3a | 1208 | return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) | OrData));\r |
e1f414b6 | 1209 | }\r |
1210 | \r | |
1211 | /**\r | |
1212 | Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result\r | |
1213 | back to the 8-bit MMIO register.\r | |
1214 | \r | |
1215 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
1216 | between the read result and the value specified by AndData, and writes the\r | |
1217 | result to the 8-bit MMIO register specified by Address. The value written to\r | |
1218 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1219 | read and write operations are serialized.\r | |
1220 | \r | |
1221 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1222 | \r | |
1223 | @param Address The MMIO register to write.\r | |
1224 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1225 | \r | |
1226 | @return The value written back to the MMIO register.\r | |
1227 | \r | |
1228 | **/\r | |
1229 | UINT8\r | |
1230 | EFIAPI\r | |
1231 | MmioAnd8 (\r | |
2f88bd3a MK |
1232 | IN UINTN Address,\r |
1233 | IN UINT8 AndData\r | |
e1f414b6 | 1234 | )\r |
1235 | {\r | |
2f88bd3a | 1236 | return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) & AndData));\r |
e1f414b6 | 1237 | }\r |
1238 | \r | |
1239 | /**\r | |
9095d37b | 1240 | Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 1241 | OR, and writes the result back to the 8-bit MMIO register.\r |
e1f414b6 | 1242 | \r |
1243 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
1244 | between the read result and the value specified by AndData, performs a\r | |
1245 | bitwise OR between the result of the AND operation and the value specified by\r | |
1246 | OrData, and writes the result to the 8-bit MMIO register specified by\r | |
1247 | Address. The value written to the MMIO register is returned. This function\r | |
1248 | must guarantee that all MMIO read and write operations are serialized.\r | |
1249 | \r | |
1250 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1251 | \r | |
1252 | \r | |
1253 | @param Address The MMIO register to write.\r | |
1254 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1255 | @param OrData The value to OR with the result of the AND operation.\r | |
1256 | \r | |
1257 | @return The value written back to the MMIO register.\r | |
1258 | \r | |
1259 | **/\r | |
1260 | UINT8\r | |
1261 | EFIAPI\r | |
1262 | MmioAndThenOr8 (\r | |
2f88bd3a MK |
1263 | IN UINTN Address,\r |
1264 | IN UINT8 AndData,\r | |
1265 | IN UINT8 OrData\r | |
e1f414b6 | 1266 | )\r |
1267 | {\r | |
2f88bd3a | 1268 | return MmioWrite8 (Address, (UINT8)((MmioRead8 (Address) & AndData) | OrData));\r |
e1f414b6 | 1269 | }\r |
1270 | \r | |
1271 | /**\r | |
1272 | Reads a bit field of a MMIO register.\r | |
1273 | \r | |
1274 | Reads the bit field in an 8-bit MMIO register. The bit field is specified by\r | |
1275 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
1276 | \r | |
1277 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1278 | If StartBit is greater than 7, then ASSERT().\r | |
1279 | If EndBit is greater than 7, then ASSERT().\r | |
1280 | If EndBit is less than StartBit, then ASSERT().\r | |
1281 | \r | |
35a17154 | 1282 | @param Address The MMIO register to read.\r |
e1f414b6 | 1283 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1284 | Range 0..7.\r | |
1285 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1286 | Range 0..7.\r | |
1287 | \r | |
2281e7a9 | 1288 | @return The value read.\r |
e1f414b6 | 1289 | \r |
1290 | **/\r | |
1291 | UINT8\r | |
1292 | EFIAPI\r | |
1293 | MmioBitFieldRead8 (\r | |
2f88bd3a MK |
1294 | IN UINTN Address,\r |
1295 | IN UINTN StartBit,\r | |
1296 | IN UINTN EndBit\r | |
e1f414b6 | 1297 | )\r |
1298 | {\r | |
1299 | return BitFieldRead8 (MmioRead8 (Address), StartBit, EndBit);\r | |
1300 | }\r | |
1301 | \r | |
1302 | /**\r | |
1303 | Writes a bit field to a MMIO register.\r | |
1304 | \r | |
1305 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
1306 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
1307 | MMIO register are preserved. The new value of the 8-bit register is returned.\r | |
1308 | \r | |
1309 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1310 | If StartBit is greater than 7, then ASSERT().\r | |
1311 | If EndBit is greater than 7, then ASSERT().\r | |
1312 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1313 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1314 | \r |
35a17154 | 1315 | @param Address The MMIO register to write.\r |
e1f414b6 | 1316 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1317 | Range 0..7.\r | |
1318 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1319 | Range 0..7.\r | |
2fc59a00 | 1320 | @param Value The new value of the bit field.\r |
e1f414b6 | 1321 | \r |
1322 | @return The value written back to the MMIO register.\r | |
1323 | \r | |
1324 | **/\r | |
1325 | UINT8\r | |
1326 | EFIAPI\r | |
1327 | MmioBitFieldWrite8 (\r | |
2f88bd3a MK |
1328 | IN UINTN Address,\r |
1329 | IN UINTN StartBit,\r | |
1330 | IN UINTN EndBit,\r | |
1331 | IN UINT8 Value\r | |
e1f414b6 | 1332 | )\r |
1333 | {\r | |
1334 | return MmioWrite8 (\r | |
1335 | Address,\r | |
1336 | BitFieldWrite8 (MmioRead8 (Address), StartBit, EndBit, Value)\r | |
1337 | );\r | |
1338 | }\r | |
1339 | \r | |
1340 | /**\r | |
1341 | Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and\r | |
1342 | writes the result back to the bit field in the 8-bit MMIO register.\r | |
1343 | \r | |
9095d37b | 1344 | Reads the 8-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1345 | OR between the read result and the value specified by OrData, and\r |
e1f414b6 | 1346 | writes the result to the 8-bit MMIO register specified by Address. The value\r |
1347 | written to the MMIO register is returned. This function must guarantee that\r | |
35a17154 | 1348 | all MMIO read and write operations are serialized. Extra bits left in OrData\r |
e1f414b6 | 1349 | are stripped.\r |
1350 | \r | |
1351 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1352 | If StartBit is greater than 7, then ASSERT().\r | |
1353 | If EndBit is greater than 7, then ASSERT().\r | |
1354 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1355 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1356 | \r |
35a17154 | 1357 | @param Address The MMIO register to write.\r |
e1f414b6 | 1358 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1359 | Range 0..7.\r | |
1360 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1361 | Range 0..7.\r | |
1362 | @param OrData The value to OR with read value from the MMIO register.\r | |
1363 | \r | |
1364 | @return The value written back to the MMIO register.\r | |
1365 | \r | |
1366 | **/\r | |
1367 | UINT8\r | |
1368 | EFIAPI\r | |
1369 | MmioBitFieldOr8 (\r | |
2f88bd3a MK |
1370 | IN UINTN Address,\r |
1371 | IN UINTN StartBit,\r | |
1372 | IN UINTN EndBit,\r | |
1373 | IN UINT8 OrData\r | |
e1f414b6 | 1374 | )\r |
1375 | {\r | |
1376 | return MmioWrite8 (\r | |
1377 | Address,\r | |
1378 | BitFieldOr8 (MmioRead8 (Address), StartBit, EndBit, OrData)\r | |
1379 | );\r | |
1380 | }\r | |
1381 | \r | |
1382 | /**\r | |
1383 | Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and\r | |
1384 | writes the result back to the bit field in the 8-bit MMIO register.\r | |
1385 | \r | |
1386 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
1387 | between the read result and the value specified by AndData, and writes the\r | |
1388 | result to the 8-bit MMIO register specified by Address. The value written to\r | |
1389 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
35a17154 | 1390 | read and write operations are serialized. Extra bits left in AndData are\r |
e1f414b6 | 1391 | stripped.\r |
1392 | \r | |
1393 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1394 | If StartBit is greater than 7, then ASSERT().\r | |
1395 | If EndBit is greater than 7, then ASSERT().\r | |
1396 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1397 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1398 | \r |
35a17154 | 1399 | @param Address The MMIO register to write.\r |
e1f414b6 | 1400 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1401 | Range 0..7.\r | |
1402 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1403 | Range 0..7.\r | |
1404 | @param AndData The value to AND with read value from the MMIO register.\r | |
1405 | \r | |
1406 | @return The value written back to the MMIO register.\r | |
1407 | \r | |
1408 | **/\r | |
1409 | UINT8\r | |
1410 | EFIAPI\r | |
1411 | MmioBitFieldAnd8 (\r | |
2f88bd3a MK |
1412 | IN UINTN Address,\r |
1413 | IN UINTN StartBit,\r | |
1414 | IN UINTN EndBit,\r | |
1415 | IN UINT8 AndData\r | |
e1f414b6 | 1416 | )\r |
1417 | {\r | |
1418 | return MmioWrite8 (\r | |
1419 | Address,\r | |
1420 | BitFieldAnd8 (MmioRead8 (Address), StartBit, EndBit, AndData)\r | |
1421 | );\r | |
1422 | }\r | |
1423 | \r | |
1424 | /**\r | |
1425 | Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 1426 | by a bitwise OR, and writes the result back to the bit field in the\r |
e1f414b6 | 1427 | 8-bit MMIO register.\r |
1428 | \r | |
1429 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 1430 | followed by a bitwise OR between the read result and the value\r |
e1f414b6 | 1431 | specified by AndData, and writes the result to the 8-bit MMIO register\r |
1432 | specified by Address. The value written to the MMIO register is returned.\r | |
1433 | This function must guarantee that all MMIO read and write operations are\r | |
35a17154 | 1434 | serialized. Extra bits left in both AndData and OrData are stripped.\r |
e1f414b6 | 1435 | \r |
1436 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1437 | If StartBit is greater than 7, then ASSERT().\r | |
1438 | If EndBit is greater than 7, then ASSERT().\r | |
1439 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
1440 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
1441 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
e1f414b6 | 1442 | \r |
35a17154 | 1443 | @param Address The MMIO register to write.\r |
e1f414b6 | 1444 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1445 | Range 0..7.\r | |
1446 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1447 | Range 0..7.\r | |
1448 | @param AndData The value to AND with read value from the MMIO register.\r | |
1449 | @param OrData The value to OR with the result of the AND operation.\r | |
1450 | \r | |
1451 | @return The value written back to the MMIO register.\r | |
1452 | \r | |
1453 | **/\r | |
1454 | UINT8\r | |
1455 | EFIAPI\r | |
1456 | MmioBitFieldAndThenOr8 (\r | |
2f88bd3a MK |
1457 | IN UINTN Address,\r |
1458 | IN UINTN StartBit,\r | |
1459 | IN UINTN EndBit,\r | |
1460 | IN UINT8 AndData,\r | |
1461 | IN UINT8 OrData\r | |
e1f414b6 | 1462 | )\r |
1463 | {\r | |
1464 | return MmioWrite8 (\r | |
1465 | Address,\r | |
1466 | BitFieldAndThenOr8 (MmioRead8 (Address), StartBit, EndBit, AndData, OrData)\r | |
1467 | );\r | |
1468 | }\r | |
1469 | \r | |
1470 | /**\r | |
62991af2 | 1471 | Reads a 16-bit MMIO register, performs a bitwise OR, and writes the\r |
e1f414b6 | 1472 | result back to the 16-bit MMIO register.\r |
1473 | \r | |
9095d37b | 1474 | Reads the 16-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1475 | OR between the read result and the value specified by OrData, and\r |
e1f414b6 | 1476 | writes the result to the 16-bit MMIO register specified by Address. The value\r |
1477 | written to the MMIO register is returned. This function must guarantee that\r | |
1478 | all MMIO read and write operations are serialized.\r | |
1479 | \r | |
1480 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1481 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 1482 | \r |
1483 | @param Address The MMIO register to write.\r | |
1484 | @param OrData The value to OR with the read value from the MMIO register.\r | |
1485 | \r | |
1486 | @return The value written back to the MMIO register.\r | |
1487 | \r | |
1488 | **/\r | |
1489 | UINT16\r | |
1490 | EFIAPI\r | |
1491 | MmioOr16 (\r | |
2f88bd3a MK |
1492 | IN UINTN Address,\r |
1493 | IN UINT16 OrData\r | |
e1f414b6 | 1494 | )\r |
1495 | {\r | |
2f88bd3a | 1496 | return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) | OrData));\r |
e1f414b6 | 1497 | }\r |
1498 | \r | |
1499 | /**\r | |
1500 | Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result\r | |
1501 | back to the 16-bit MMIO register.\r | |
1502 | \r | |
1503 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
1504 | between the read result and the value specified by AndData, and writes the\r | |
1505 | result to the 16-bit MMIO register specified by Address. The value written to\r | |
1506 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1507 | read and write operations are serialized.\r | |
1508 | \r | |
1509 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1510 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 1511 | \r |
1512 | @param Address The MMIO register to write.\r | |
1513 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1514 | \r | |
1515 | @return The value written back to the MMIO register.\r | |
1516 | \r | |
1517 | **/\r | |
1518 | UINT16\r | |
1519 | EFIAPI\r | |
1520 | MmioAnd16 (\r | |
2f88bd3a MK |
1521 | IN UINTN Address,\r |
1522 | IN UINT16 AndData\r | |
e1f414b6 | 1523 | )\r |
1524 | {\r | |
2f88bd3a | 1525 | return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) & AndData));\r |
e1f414b6 | 1526 | }\r |
1527 | \r | |
1528 | /**\r | |
9095d37b | 1529 | Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 1530 | OR, and writes the result back to the 16-bit MMIO register.\r |
e1f414b6 | 1531 | \r |
1532 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
1533 | between the read result and the value specified by AndData, performs a\r | |
1534 | bitwise OR between the result of the AND operation and the value specified by\r | |
1535 | OrData, and writes the result to the 16-bit MMIO register specified by\r | |
1536 | Address. The value written to the MMIO register is returned. This function\r | |
1537 | must guarantee that all MMIO read and write operations are serialized.\r | |
1538 | \r | |
1539 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1540 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 1541 | \r |
1542 | @param Address The MMIO register to write.\r | |
1543 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1544 | @param OrData The value to OR with the result of the AND operation.\r | |
1545 | \r | |
1546 | @return The value written back to the MMIO register.\r | |
1547 | \r | |
1548 | **/\r | |
1549 | UINT16\r | |
1550 | EFIAPI\r | |
1551 | MmioAndThenOr16 (\r | |
2f88bd3a MK |
1552 | IN UINTN Address,\r |
1553 | IN UINT16 AndData,\r | |
1554 | IN UINT16 OrData\r | |
e1f414b6 | 1555 | )\r |
1556 | {\r | |
2f88bd3a | 1557 | return MmioWrite16 (Address, (UINT16)((MmioRead16 (Address) & AndData) | OrData));\r |
e1f414b6 | 1558 | }\r |
1559 | \r | |
1560 | /**\r | |
1561 | Reads a bit field of a MMIO register.\r | |
1562 | \r | |
1563 | Reads the bit field in a 16-bit MMIO register. The bit field is specified by\r | |
1564 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
1565 | \r | |
1566 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1567 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 1568 | If StartBit is greater than 15, then ASSERT().\r |
1569 | If EndBit is greater than 15, then ASSERT().\r | |
1570 | If EndBit is less than StartBit, then ASSERT().\r | |
1571 | \r | |
35a17154 | 1572 | @param Address The MMIO register to read.\r |
e1f414b6 | 1573 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1574 | Range 0..15.\r | |
1575 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1576 | Range 0..15.\r | |
1577 | \r | |
2281e7a9 | 1578 | @return The value read.\r |
e1f414b6 | 1579 | \r |
1580 | **/\r | |
1581 | UINT16\r | |
1582 | EFIAPI\r | |
1583 | MmioBitFieldRead16 (\r | |
2f88bd3a MK |
1584 | IN UINTN Address,\r |
1585 | IN UINTN StartBit,\r | |
1586 | IN UINTN EndBit\r | |
e1f414b6 | 1587 | )\r |
1588 | {\r | |
1589 | return BitFieldRead16 (MmioRead16 (Address), StartBit, EndBit);\r | |
1590 | }\r | |
1591 | \r | |
1592 | /**\r | |
1593 | Writes a bit field to a MMIO register.\r | |
1594 | \r | |
1595 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
1596 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
1597 | MMIO register are preserved. The new value of the 16-bit register is returned.\r | |
1598 | \r | |
1599 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1600 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 1601 | If StartBit is greater than 15, then ASSERT().\r |
1602 | If EndBit is greater than 15, then ASSERT().\r | |
1603 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1604 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1605 | \r |
35a17154 | 1606 | @param Address The MMIO register to write.\r |
e1f414b6 | 1607 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1608 | Range 0..15.\r | |
1609 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1610 | Range 0..15.\r | |
2fc59a00 | 1611 | @param Value The new value of the bit field.\r |
e1f414b6 | 1612 | \r |
1613 | @return The value written back to the MMIO register.\r | |
1614 | \r | |
1615 | **/\r | |
1616 | UINT16\r | |
1617 | EFIAPI\r | |
1618 | MmioBitFieldWrite16 (\r | |
2f88bd3a MK |
1619 | IN UINTN Address,\r |
1620 | IN UINTN StartBit,\r | |
1621 | IN UINTN EndBit,\r | |
1622 | IN UINT16 Value\r | |
e1f414b6 | 1623 | )\r |
1624 | {\r | |
1625 | return MmioWrite16 (\r | |
1626 | Address,\r | |
1627 | BitFieldWrite16 (MmioRead16 (Address), StartBit, EndBit, Value)\r | |
1628 | );\r | |
1629 | }\r | |
1630 | \r | |
1631 | /**\r | |
1632 | Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and\r | |
1633 | writes the result back to the bit field in the 16-bit MMIO register.\r | |
1634 | \r | |
9095d37b | 1635 | Reads the 16-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1636 | OR between the read result and the value specified by OrData, and\r |
e1f414b6 | 1637 | writes the result to the 16-bit MMIO register specified by Address. The value\r |
1638 | written to the MMIO register is returned. This function must guarantee that\r | |
35a17154 | 1639 | all MMIO read and write operations are serialized. Extra bits left in OrData\r |
e1f414b6 | 1640 | are stripped.\r |
1641 | \r | |
1642 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1643 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 1644 | If StartBit is greater than 15, then ASSERT().\r |
1645 | If EndBit is greater than 15, then ASSERT().\r | |
1646 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1647 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1648 | \r |
35a17154 | 1649 | @param Address The MMIO register to write.\r |
e1f414b6 | 1650 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1651 | Range 0..15.\r | |
1652 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1653 | Range 0..15.\r | |
1654 | @param OrData The value to OR with read value from the MMIO register.\r | |
1655 | \r | |
1656 | @return The value written back to the MMIO register.\r | |
1657 | \r | |
1658 | **/\r | |
1659 | UINT16\r | |
1660 | EFIAPI\r | |
1661 | MmioBitFieldOr16 (\r | |
2f88bd3a MK |
1662 | IN UINTN Address,\r |
1663 | IN UINTN StartBit,\r | |
1664 | IN UINTN EndBit,\r | |
1665 | IN UINT16 OrData\r | |
e1f414b6 | 1666 | )\r |
1667 | {\r | |
1668 | return MmioWrite16 (\r | |
1669 | Address,\r | |
1670 | BitFieldOr16 (MmioRead16 (Address), StartBit, EndBit, OrData)\r | |
1671 | );\r | |
1672 | }\r | |
1673 | \r | |
1674 | /**\r | |
1675 | Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and\r | |
1676 | writes the result back to the bit field in the 16-bit MMIO register.\r | |
1677 | \r | |
1678 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
1679 | between the read result and the value specified by AndData, and writes the\r | |
1680 | result to the 16-bit MMIO register specified by Address. The value written to\r | |
1681 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
35a17154 | 1682 | read and write operations are serialized. Extra bits left in AndData are\r |
e1f414b6 | 1683 | stripped.\r |
1684 | \r | |
1685 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1686 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 1687 | If StartBit is greater than 15, then ASSERT().\r |
1688 | If EndBit is greater than 15, then ASSERT().\r | |
1689 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1690 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1691 | \r |
35a17154 | 1692 | @param Address The MMIO register to write.\r |
e1f414b6 | 1693 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1694 | Range 0..15.\r | |
1695 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1696 | Range 0..15.\r | |
1697 | @param AndData The value to AND with read value from the MMIO register.\r | |
1698 | \r | |
1699 | @return The value written back to the MMIO register.\r | |
1700 | \r | |
1701 | **/\r | |
1702 | UINT16\r | |
1703 | EFIAPI\r | |
1704 | MmioBitFieldAnd16 (\r | |
2f88bd3a MK |
1705 | IN UINTN Address,\r |
1706 | IN UINTN StartBit,\r | |
1707 | IN UINTN EndBit,\r | |
1708 | IN UINT16 AndData\r | |
e1f414b6 | 1709 | )\r |
1710 | {\r | |
1711 | return MmioWrite16 (\r | |
1712 | Address,\r | |
1713 | BitFieldAnd16 (MmioRead16 (Address), StartBit, EndBit, AndData)\r | |
1714 | );\r | |
1715 | }\r | |
1716 | \r | |
1717 | /**\r | |
1718 | Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 1719 | by a bitwise OR, and writes the result back to the bit field in the\r |
e1f414b6 | 1720 | 16-bit MMIO register.\r |
1721 | \r | |
1722 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 1723 | followed by a bitwise OR between the read result and the value\r |
e1f414b6 | 1724 | specified by AndData, and writes the result to the 16-bit MMIO register\r |
1725 | specified by Address. The value written to the MMIO register is returned.\r | |
1726 | This function must guarantee that all MMIO read and write operations are\r | |
35a17154 | 1727 | serialized. Extra bits left in both AndData and OrData are stripped.\r |
e1f414b6 | 1728 | \r |
1729 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1730 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
e1f414b6 | 1731 | If StartBit is greater than 15, then ASSERT().\r |
1732 | If EndBit is greater than 15, then ASSERT().\r | |
1733 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
1734 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
1735 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
e1f414b6 | 1736 | \r |
35a17154 | 1737 | @param Address The MMIO register to write.\r |
e1f414b6 | 1738 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1739 | Range 0..15.\r | |
1740 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1741 | Range 0..15.\r | |
1742 | @param AndData The value to AND with read value from the MMIO register.\r | |
1743 | @param OrData The value to OR with the result of the AND operation.\r | |
1744 | \r | |
1745 | @return The value written back to the MMIO register.\r | |
1746 | \r | |
1747 | **/\r | |
1748 | UINT16\r | |
1749 | EFIAPI\r | |
1750 | MmioBitFieldAndThenOr16 (\r | |
2f88bd3a MK |
1751 | IN UINTN Address,\r |
1752 | IN UINTN StartBit,\r | |
1753 | IN UINTN EndBit,\r | |
1754 | IN UINT16 AndData,\r | |
1755 | IN UINT16 OrData\r | |
e1f414b6 | 1756 | )\r |
1757 | {\r | |
1758 | return MmioWrite16 (\r | |
1759 | Address,\r | |
1760 | BitFieldAndThenOr16 (MmioRead16 (Address), StartBit, EndBit, AndData, OrData)\r | |
1761 | );\r | |
1762 | }\r | |
1763 | \r | |
1764 | /**\r | |
62991af2 | 1765 | Reads a 32-bit MMIO register, performs a bitwise OR, and writes the\r |
e1f414b6 | 1766 | result back to the 32-bit MMIO register.\r |
1767 | \r | |
9095d37b | 1768 | Reads the 32-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1769 | OR between the read result and the value specified by OrData, and\r |
e1f414b6 | 1770 | writes the result to the 32-bit MMIO register specified by Address. The value\r |
1771 | written to the MMIO register is returned. This function must guarantee that\r | |
1772 | all MMIO read and write operations are serialized.\r | |
1773 | \r | |
1774 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1775 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 1776 | \r |
1777 | @param Address The MMIO register to write.\r | |
1778 | @param OrData The value to OR with the read value from the MMIO register.\r | |
1779 | \r | |
1780 | @return The value written back to the MMIO register.\r | |
1781 | \r | |
1782 | **/\r | |
1783 | UINT32\r | |
1784 | EFIAPI\r | |
1785 | MmioOr32 (\r | |
2f88bd3a MK |
1786 | IN UINTN Address,\r |
1787 | IN UINT32 OrData\r | |
e1f414b6 | 1788 | )\r |
1789 | {\r | |
1790 | return MmioWrite32 (Address, MmioRead32 (Address) | OrData);\r | |
1791 | }\r | |
1792 | \r | |
1793 | /**\r | |
1794 | Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result\r | |
1795 | back to the 32-bit MMIO register.\r | |
1796 | \r | |
1797 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
1798 | between the read result and the value specified by AndData, and writes the\r | |
1799 | result to the 32-bit MMIO register specified by Address. The value written to\r | |
1800 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1801 | read and write operations are serialized.\r | |
1802 | \r | |
1803 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1804 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 1805 | \r |
1806 | @param Address The MMIO register to write.\r | |
1807 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1808 | \r | |
1809 | @return The value written back to the MMIO register.\r | |
1810 | \r | |
1811 | **/\r | |
1812 | UINT32\r | |
1813 | EFIAPI\r | |
1814 | MmioAnd32 (\r | |
2f88bd3a MK |
1815 | IN UINTN Address,\r |
1816 | IN UINT32 AndData\r | |
e1f414b6 | 1817 | )\r |
1818 | {\r | |
1819 | return MmioWrite32 (Address, MmioRead32 (Address) & AndData);\r | |
1820 | }\r | |
1821 | \r | |
1822 | /**\r | |
9095d37b | 1823 | Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 1824 | OR, and writes the result back to the 32-bit MMIO register.\r |
e1f414b6 | 1825 | \r |
1826 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
1827 | between the read result and the value specified by AndData, performs a\r | |
1828 | bitwise OR between the result of the AND operation and the value specified by\r | |
1829 | OrData, and writes the result to the 32-bit MMIO register specified by\r | |
1830 | Address. The value written to the MMIO register is returned. This function\r | |
1831 | must guarantee that all MMIO read and write operations are serialized.\r | |
1832 | \r | |
1833 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1834 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 1835 | \r |
1836 | @param Address The MMIO register to write.\r | |
1837 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1838 | @param OrData The value to OR with the result of the AND operation.\r | |
1839 | \r | |
1840 | @return The value written back to the MMIO register.\r | |
1841 | \r | |
1842 | **/\r | |
1843 | UINT32\r | |
1844 | EFIAPI\r | |
1845 | MmioAndThenOr32 (\r | |
2f88bd3a MK |
1846 | IN UINTN Address,\r |
1847 | IN UINT32 AndData,\r | |
1848 | IN UINT32 OrData\r | |
e1f414b6 | 1849 | )\r |
1850 | {\r | |
1851 | return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData);\r | |
1852 | }\r | |
1853 | \r | |
1854 | /**\r | |
1855 | Reads a bit field of a MMIO register.\r | |
1856 | \r | |
1857 | Reads the bit field in a 32-bit MMIO register. The bit field is specified by\r | |
1858 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
1859 | \r | |
1860 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1861 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 1862 | If StartBit is greater than 31, then ASSERT().\r |
1863 | If EndBit is greater than 31, then ASSERT().\r | |
1864 | If EndBit is less than StartBit, then ASSERT().\r | |
1865 | \r | |
35a17154 | 1866 | @param Address The MMIO register to read.\r |
e1f414b6 | 1867 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1868 | Range 0..31.\r | |
1869 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1870 | Range 0..31.\r | |
1871 | \r | |
2281e7a9 | 1872 | @return The value read.\r |
e1f414b6 | 1873 | \r |
1874 | **/\r | |
1875 | UINT32\r | |
1876 | EFIAPI\r | |
1877 | MmioBitFieldRead32 (\r | |
2f88bd3a MK |
1878 | IN UINTN Address,\r |
1879 | IN UINTN StartBit,\r | |
1880 | IN UINTN EndBit\r | |
e1f414b6 | 1881 | )\r |
1882 | {\r | |
1883 | return BitFieldRead32 (MmioRead32 (Address), StartBit, EndBit);\r | |
1884 | }\r | |
1885 | \r | |
1886 | /**\r | |
1887 | Writes a bit field to a MMIO register.\r | |
1888 | \r | |
1889 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
1890 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
1891 | MMIO register are preserved. The new value of the 32-bit register is returned.\r | |
1892 | \r | |
1893 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1894 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 1895 | If StartBit is greater than 31, then ASSERT().\r |
1896 | If EndBit is greater than 31, then ASSERT().\r | |
1897 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1898 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1899 | \r |
35a17154 | 1900 | @param Address The MMIO register to write.\r |
e1f414b6 | 1901 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1902 | Range 0..31.\r | |
1903 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1904 | Range 0..31.\r | |
2fc59a00 | 1905 | @param Value The new value of the bit field.\r |
e1f414b6 | 1906 | \r |
1907 | @return The value written back to the MMIO register.\r | |
1908 | \r | |
1909 | **/\r | |
1910 | UINT32\r | |
1911 | EFIAPI\r | |
1912 | MmioBitFieldWrite32 (\r | |
2f88bd3a MK |
1913 | IN UINTN Address,\r |
1914 | IN UINTN StartBit,\r | |
1915 | IN UINTN EndBit,\r | |
1916 | IN UINT32 Value\r | |
e1f414b6 | 1917 | )\r |
1918 | {\r | |
1919 | return MmioWrite32 (\r | |
1920 | Address,\r | |
1921 | BitFieldWrite32 (MmioRead32 (Address), StartBit, EndBit, Value)\r | |
1922 | );\r | |
1923 | }\r | |
1924 | \r | |
1925 | /**\r | |
1926 | Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and\r | |
1927 | writes the result back to the bit field in the 32-bit MMIO register.\r | |
1928 | \r | |
9095d37b | 1929 | Reads the 32-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1930 | OR between the read result and the value specified by OrData, and\r |
e1f414b6 | 1931 | writes the result to the 32-bit MMIO register specified by Address. The value\r |
1932 | written to the MMIO register is returned. This function must guarantee that\r | |
35a17154 | 1933 | all MMIO read and write operations are serialized. Extra bits left in OrData\r |
e1f414b6 | 1934 | are stripped.\r |
1935 | \r | |
1936 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1937 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 1938 | If StartBit is greater than 31, then ASSERT().\r |
1939 | If EndBit is greater than 31, then ASSERT().\r | |
1940 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1941 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1942 | \r |
35a17154 | 1943 | @param Address The MMIO register to write.\r |
e1f414b6 | 1944 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1945 | Range 0..31.\r | |
1946 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1947 | Range 0..31.\r | |
1948 | @param OrData The value to OR with read value from the MMIO register.\r | |
1949 | \r | |
1950 | @return The value written back to the MMIO register.\r | |
1951 | \r | |
1952 | **/\r | |
1953 | UINT32\r | |
1954 | EFIAPI\r | |
1955 | MmioBitFieldOr32 (\r | |
2f88bd3a MK |
1956 | IN UINTN Address,\r |
1957 | IN UINTN StartBit,\r | |
1958 | IN UINTN EndBit,\r | |
1959 | IN UINT32 OrData\r | |
e1f414b6 | 1960 | )\r |
1961 | {\r | |
1962 | return MmioWrite32 (\r | |
1963 | Address,\r | |
1964 | BitFieldOr32 (MmioRead32 (Address), StartBit, EndBit, OrData)\r | |
1965 | );\r | |
1966 | }\r | |
1967 | \r | |
1968 | /**\r | |
1969 | Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and\r | |
1970 | writes the result back to the bit field in the 32-bit MMIO register.\r | |
1971 | \r | |
1972 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
1973 | between the read result and the value specified by AndData, and writes the\r | |
1974 | result to the 32-bit MMIO register specified by Address. The value written to\r | |
1975 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
35a17154 | 1976 | read and write operations are serialized. Extra bits left in AndData are\r |
e1f414b6 | 1977 | stripped.\r |
1978 | \r | |
1979 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 1980 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 1981 | If StartBit is greater than 31, then ASSERT().\r |
1982 | If EndBit is greater than 31, then ASSERT().\r | |
1983 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1984 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 1985 | \r |
35a17154 | 1986 | @param Address The MMIO register to write.\r |
e1f414b6 | 1987 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1988 | Range 0..31.\r | |
1989 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1990 | Range 0..31.\r | |
1991 | @param AndData The value to AND with read value from the MMIO register.\r | |
1992 | \r | |
1993 | @return The value written back to the MMIO register.\r | |
1994 | \r | |
1995 | **/\r | |
1996 | UINT32\r | |
1997 | EFIAPI\r | |
1998 | MmioBitFieldAnd32 (\r | |
2f88bd3a MK |
1999 | IN UINTN Address,\r |
2000 | IN UINTN StartBit,\r | |
2001 | IN UINTN EndBit,\r | |
2002 | IN UINT32 AndData\r | |
e1f414b6 | 2003 | )\r |
2004 | {\r | |
2005 | return MmioWrite32 (\r | |
2006 | Address,\r | |
2007 | BitFieldAnd32 (MmioRead32 (Address), StartBit, EndBit, AndData)\r | |
2008 | );\r | |
2009 | }\r | |
2010 | \r | |
2011 | /**\r | |
2012 | Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 2013 | by a bitwise OR, and writes the result back to the bit field in the\r |
e1f414b6 | 2014 | 32-bit MMIO register.\r |
2015 | \r | |
2016 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 2017 | followed by a bitwise OR between the read result and the value\r |
e1f414b6 | 2018 | specified by AndData, and writes the result to the 32-bit MMIO register\r |
2019 | specified by Address. The value written to the MMIO register is returned.\r | |
2020 | This function must guarantee that all MMIO read and write operations are\r | |
35a17154 | 2021 | serialized. Extra bits left in both AndData and OrData are stripped.\r |
e1f414b6 | 2022 | \r |
2023 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 2024 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
e1f414b6 | 2025 | If StartBit is greater than 31, then ASSERT().\r |
2026 | If EndBit is greater than 31, then ASSERT().\r | |
2027 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
2028 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
2029 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
e1f414b6 | 2030 | \r |
35a17154 | 2031 | @param Address The MMIO register to write.\r |
e1f414b6 | 2032 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
2033 | Range 0..31.\r | |
2034 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2035 | Range 0..31.\r | |
2036 | @param AndData The value to AND with read value from the MMIO register.\r | |
2037 | @param OrData The value to OR with the result of the AND operation.\r | |
2038 | \r | |
2039 | @return The value written back to the MMIO register.\r | |
2040 | \r | |
2041 | **/\r | |
2042 | UINT32\r | |
2043 | EFIAPI\r | |
2044 | MmioBitFieldAndThenOr32 (\r | |
2f88bd3a MK |
2045 | IN UINTN Address,\r |
2046 | IN UINTN StartBit,\r | |
2047 | IN UINTN EndBit,\r | |
2048 | IN UINT32 AndData,\r | |
2049 | IN UINT32 OrData\r | |
e1f414b6 | 2050 | )\r |
2051 | {\r | |
2052 | return MmioWrite32 (\r | |
2053 | Address,\r | |
2054 | BitFieldAndThenOr32 (MmioRead32 (Address), StartBit, EndBit, AndData, OrData)\r | |
2055 | );\r | |
2056 | }\r | |
2057 | \r | |
2058 | /**\r | |
62991af2 | 2059 | Reads a 64-bit MMIO register, performs a bitwise OR, and writes the\r |
e1f414b6 | 2060 | result back to the 64-bit MMIO register.\r |
2061 | \r | |
9095d37b | 2062 | Reads the 64-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 2063 | OR between the read result and the value specified by OrData, and\r |
e1f414b6 | 2064 | writes the result to the 64-bit MMIO register specified by Address. The value\r |
2065 | written to the MMIO register is returned. This function must guarantee that\r | |
2066 | all MMIO read and write operations are serialized.\r | |
2067 | \r | |
2068 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 2069 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 2070 | \r |
2071 | @param Address The MMIO register to write.\r | |
2072 | @param OrData The value to OR with the read value from the MMIO register.\r | |
2073 | \r | |
2074 | @return The value written back to the MMIO register.\r | |
2075 | \r | |
2076 | **/\r | |
2077 | UINT64\r | |
2078 | EFIAPI\r | |
2079 | MmioOr64 (\r | |
2f88bd3a MK |
2080 | IN UINTN Address,\r |
2081 | IN UINT64 OrData\r | |
e1f414b6 | 2082 | )\r |
2083 | {\r | |
2084 | return MmioWrite64 (Address, MmioRead64 (Address) | OrData);\r | |
2085 | }\r | |
2086 | \r | |
2087 | /**\r | |
2088 | Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result\r | |
2089 | back to the 64-bit MMIO register.\r | |
2090 | \r | |
2091 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
2092 | between the read result and the value specified by AndData, and writes the\r | |
2093 | result to the 64-bit MMIO register specified by Address. The value written to\r | |
2094 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
2095 | read and write operations are serialized.\r | |
2096 | \r | |
2097 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 2098 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 2099 | \r |
2100 | @param Address The MMIO register to write.\r | |
2101 | @param AndData The value to AND with the read value from the MMIO register.\r | |
2102 | \r | |
2103 | @return The value written back to the MMIO register.\r | |
2104 | \r | |
2105 | **/\r | |
2106 | UINT64\r | |
2107 | EFIAPI\r | |
2108 | MmioAnd64 (\r | |
2f88bd3a MK |
2109 | IN UINTN Address,\r |
2110 | IN UINT64 AndData\r | |
e1f414b6 | 2111 | )\r |
2112 | {\r | |
2113 | return MmioWrite64 (Address, MmioRead64 (Address) & AndData);\r | |
2114 | }\r | |
2115 | \r | |
2116 | /**\r | |
9095d37b | 2117 | Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 2118 | OR, and writes the result back to the 64-bit MMIO register.\r |
e1f414b6 | 2119 | \r |
2120 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
2121 | between the read result and the value specified by AndData, performs a\r | |
2122 | bitwise OR between the result of the AND operation and the value specified by\r | |
2123 | OrData, and writes the result to the 64-bit MMIO register specified by\r | |
2124 | Address. The value written to the MMIO register is returned. This function\r | |
2125 | must guarantee that all MMIO read and write operations are serialized.\r | |
2126 | \r | |
2127 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 2128 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 2129 | \r |
2130 | @param Address The MMIO register to write.\r | |
2131 | @param AndData The value to AND with the read value from the MMIO register.\r | |
2132 | @param OrData The value to OR with the result of the AND operation.\r | |
2133 | \r | |
2134 | @return The value written back to the MMIO register.\r | |
2135 | \r | |
2136 | **/\r | |
2137 | UINT64\r | |
2138 | EFIAPI\r | |
2139 | MmioAndThenOr64 (\r | |
2f88bd3a MK |
2140 | IN UINTN Address,\r |
2141 | IN UINT64 AndData,\r | |
2142 | IN UINT64 OrData\r | |
e1f414b6 | 2143 | )\r |
2144 | {\r | |
2145 | return MmioWrite64 (Address, (MmioRead64 (Address) & AndData) | OrData);\r | |
2146 | }\r | |
2147 | \r | |
2148 | /**\r | |
2149 | Reads a bit field of a MMIO register.\r | |
2150 | \r | |
2151 | Reads the bit field in a 64-bit MMIO register. The bit field is specified by\r | |
2152 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
2153 | \r | |
2154 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 2155 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 2156 | If StartBit is greater than 63, then ASSERT().\r |
2157 | If EndBit is greater than 63, then ASSERT().\r | |
2158 | If EndBit is less than StartBit, then ASSERT().\r | |
2159 | \r | |
35a17154 | 2160 | @param Address The MMIO register to read.\r |
e1f414b6 | 2161 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
2162 | Range 0..63.\r | |
2163 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2164 | Range 0..63.\r | |
2165 | \r | |
2281e7a9 | 2166 | @return The value read.\r |
e1f414b6 | 2167 | \r |
2168 | **/\r | |
2169 | UINT64\r | |
2170 | EFIAPI\r | |
2171 | MmioBitFieldRead64 (\r | |
2f88bd3a MK |
2172 | IN UINTN Address,\r |
2173 | IN UINTN StartBit,\r | |
2174 | IN UINTN EndBit\r | |
e1f414b6 | 2175 | )\r |
2176 | {\r | |
2177 | return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit);\r | |
2178 | }\r | |
2179 | \r | |
2180 | /**\r | |
2181 | Writes a bit field to a MMIO register.\r | |
2182 | \r | |
2183 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
2184 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
2185 | MMIO register are preserved. The new value of the 64-bit register is returned.\r | |
2186 | \r | |
2187 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 2188 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 2189 | If StartBit is greater than 63, then ASSERT().\r |
2190 | If EndBit is greater than 63, then ASSERT().\r | |
2191 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2192 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 2193 | \r |
35a17154 | 2194 | @param Address The MMIO register to write.\r |
e1f414b6 | 2195 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
2196 | Range 0..63.\r | |
2197 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2198 | Range 0..63.\r | |
2fc59a00 | 2199 | @param Value The new value of the bit field.\r |
e1f414b6 | 2200 | \r |
2201 | @return The value written back to the MMIO register.\r | |
2202 | \r | |
2203 | **/\r | |
2204 | UINT64\r | |
2205 | EFIAPI\r | |
2206 | MmioBitFieldWrite64 (\r | |
2f88bd3a MK |
2207 | IN UINTN Address,\r |
2208 | IN UINTN StartBit,\r | |
2209 | IN UINTN EndBit,\r | |
2210 | IN UINT64 Value\r | |
e1f414b6 | 2211 | )\r |
2212 | {\r | |
2213 | return MmioWrite64 (\r | |
2214 | Address,\r | |
2215 | BitFieldWrite64 (MmioRead64 (Address), StartBit, EndBit, Value)\r | |
2216 | );\r | |
2217 | }\r | |
2218 | \r | |
2219 | /**\r | |
2220 | Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and\r | |
2221 | writes the result back to the bit field in the 64-bit MMIO register.\r | |
2222 | \r | |
9095d37b | 2223 | Reads the 64-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 2224 | OR between the read result and the value specified by OrData, and\r |
e1f414b6 | 2225 | writes the result to the 64-bit MMIO register specified by Address. The value\r |
2226 | written to the MMIO register is returned. This function must guarantee that\r | |
35a17154 | 2227 | all MMIO read and write operations are serialized. Extra bits left in OrData\r |
e1f414b6 | 2228 | are stripped.\r |
2229 | \r | |
2230 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 2231 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 2232 | If StartBit is greater than 63, then ASSERT().\r |
2233 | If EndBit is greater than 63, then ASSERT().\r | |
2234 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2235 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 2236 | \r |
35a17154 | 2237 | @param Address The MMIO register to write.\r |
e1f414b6 | 2238 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
2239 | Range 0..63.\r | |
2240 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2241 | Range 0..63.\r | |
2242 | @param OrData The value to OR with read value from the MMIO register.\r | |
2243 | \r | |
2244 | @return The value written back to the MMIO register.\r | |
2245 | \r | |
2246 | **/\r | |
2247 | UINT64\r | |
2248 | EFIAPI\r | |
2249 | MmioBitFieldOr64 (\r | |
2f88bd3a MK |
2250 | IN UINTN Address,\r |
2251 | IN UINTN StartBit,\r | |
2252 | IN UINTN EndBit,\r | |
2253 | IN UINT64 OrData\r | |
e1f414b6 | 2254 | )\r |
2255 | {\r | |
2256 | return MmioWrite64 (\r | |
2257 | Address,\r | |
2258 | BitFieldOr64 (MmioRead64 (Address), StartBit, EndBit, OrData)\r | |
2259 | );\r | |
2260 | }\r | |
2261 | \r | |
2262 | /**\r | |
2263 | Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and\r | |
2264 | writes the result back to the bit field in the 64-bit MMIO register.\r | |
2265 | \r | |
2266 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
2267 | between the read result and the value specified by AndData, and writes the\r | |
2268 | result to the 64-bit MMIO register specified by Address. The value written to\r | |
2269 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
35a17154 | 2270 | read and write operations are serialized. Extra bits left in AndData are\r |
e1f414b6 | 2271 | stripped.\r |
2272 | \r | |
2273 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 2274 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 2275 | If StartBit is greater than 63, then ASSERT().\r |
2276 | If EndBit is greater than 63, then ASSERT().\r | |
2277 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2278 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
e1f414b6 | 2279 | \r |
35a17154 | 2280 | @param Address The MMIO register to write.\r |
e1f414b6 | 2281 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
2282 | Range 0..63.\r | |
2283 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2284 | Range 0..63.\r | |
2285 | @param AndData The value to AND with read value from the MMIO register.\r | |
2286 | \r | |
2287 | @return The value written back to the MMIO register.\r | |
2288 | \r | |
2289 | **/\r | |
2290 | UINT64\r | |
2291 | EFIAPI\r | |
2292 | MmioBitFieldAnd64 (\r | |
2f88bd3a MK |
2293 | IN UINTN Address,\r |
2294 | IN UINTN StartBit,\r | |
2295 | IN UINTN EndBit,\r | |
2296 | IN UINT64 AndData\r | |
e1f414b6 | 2297 | )\r |
2298 | {\r | |
2299 | return MmioWrite64 (\r | |
2300 | Address,\r | |
2301 | BitFieldAnd64 (MmioRead64 (Address), StartBit, EndBit, AndData)\r | |
2302 | );\r | |
2303 | }\r | |
2304 | \r | |
2305 | /**\r | |
2306 | Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 2307 | by a bitwise OR, and writes the result back to the bit field in the\r |
e1f414b6 | 2308 | 64-bit MMIO register.\r |
2309 | \r | |
2310 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 2311 | followed by a bitwise OR between the read result and the value\r |
e1f414b6 | 2312 | specified by AndData, and writes the result to the 64-bit MMIO register\r |
2313 | specified by Address. The value written to the MMIO register is returned.\r | |
2314 | This function must guarantee that all MMIO read and write operations are\r | |
35a17154 | 2315 | serialized. Extra bits left in both AndData and OrData are stripped.\r |
e1f414b6 | 2316 | \r |
2317 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
2281e7a9 | 2318 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
e1f414b6 | 2319 | If StartBit is greater than 63, then ASSERT().\r |
2320 | If EndBit is greater than 63, then ASSERT().\r | |
2321 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
2322 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
2323 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
e1f414b6 | 2324 | \r |
35a17154 | 2325 | @param Address The MMIO register to write.\r |
e1f414b6 | 2326 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
2327 | Range 0..63.\r | |
2328 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2329 | Range 0..63.\r | |
2330 | @param AndData The value to AND with read value from the MMIO register.\r | |
2331 | @param OrData The value to OR with the result of the AND operation.\r | |
2332 | \r | |
2333 | @return The value written back to the MMIO register.\r | |
2334 | \r | |
2335 | **/\r | |
2336 | UINT64\r | |
2337 | EFIAPI\r | |
2338 | MmioBitFieldAndThenOr64 (\r | |
2f88bd3a MK |
2339 | IN UINTN Address,\r |
2340 | IN UINTN StartBit,\r | |
2341 | IN UINTN EndBit,\r | |
2342 | IN UINT64 AndData,\r | |
2343 | IN UINT64 OrData\r | |
e1f414b6 | 2344 | )\r |
2345 | {\r | |
2346 | return MmioWrite64 (\r | |
2347 | Address,\r | |
2348 | BitFieldAndThenOr64 (MmioRead64 (Address), StartBit, EndBit, AndData, OrData)\r | |
2349 | );\r | |
2350 | }\r |