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