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