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