]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/IoLib.h
Update the copyright notice format
[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 - 2009, Intel Corporation. All rights reserved.<BR>
5 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 @return Value.
1242
1243 **/
1244 UINT8
1245 EFIAPI
1246 MmioWrite8 (
1247 IN UINTN Address,
1248 IN UINT8 Value
1249 );
1250
1251 /**
1252 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1253 result back to the 8-bit MMIO register.
1254
1255 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1256 OR between the read result and the value specified by OrData, and
1257 writes the result to the 8-bit MMIO register specified by Address. The value
1258 written to the MMIO register is returned. This function must guarantee that
1259 all MMIO read and write operations are serialized.
1260
1261 If 8-bit MMIO register operations are not supported, then ASSERT().
1262
1263 @param Address The MMIO register to write.
1264 @param OrData The value to OR with the read value from the MMIO register.
1265
1266 @return The value written back to the MMIO register.
1267
1268 **/
1269 UINT8
1270 EFIAPI
1271 MmioOr8 (
1272 IN UINTN Address,
1273 IN UINT8 OrData
1274 );
1275
1276 /**
1277 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1278 back to the 8-bit MMIO register.
1279
1280 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1281 between the read result and the value specified by AndData, and writes the
1282 result to the 8-bit MMIO register specified by Address. The value written to
1283 the MMIO register is returned. This function must guarantee that all MMIO
1284 read and write operations are serialized.
1285
1286 If 8-bit MMIO register operations are not supported, then ASSERT().
1287
1288 @param Address The MMIO register to write.
1289 @param AndData The value to AND with the read value from the MMIO register.
1290
1291 @return The value written back to the MMIO register.
1292
1293 **/
1294 UINT8
1295 EFIAPI
1296 MmioAnd8 (
1297 IN UINTN Address,
1298 IN UINT8 AndData
1299 );
1300
1301 /**
1302 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1303 OR, and writes the result back to the 8-bit MMIO register.
1304
1305 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1306 between the read result and the value specified by AndData, performs a
1307 bitwise OR between the result of the AND operation and the value specified by
1308 OrData, and writes the result to the 8-bit MMIO register specified by
1309 Address. The value written to the MMIO register is returned. This function
1310 must guarantee that all MMIO read and write operations are serialized.
1311
1312 If 8-bit MMIO register operations are not supported, then ASSERT().
1313
1314
1315 @param Address The MMIO register to write.
1316 @param AndData The value to AND with the read value from the MMIO register.
1317 @param OrData The value to OR with the result of the AND operation.
1318
1319 @return The value written back to the MMIO register.
1320
1321 **/
1322 UINT8
1323 EFIAPI
1324 MmioAndThenOr8 (
1325 IN UINTN Address,
1326 IN UINT8 AndData,
1327 IN UINT8 OrData
1328 );
1329
1330 /**
1331 Reads a bit field of a MMIO register.
1332
1333 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1334 the StartBit and the EndBit. The value of the bit field is returned.
1335
1336 If 8-bit MMIO register operations are not supported, then ASSERT().
1337 If StartBit is greater than 7, then ASSERT().
1338 If EndBit is greater than 7, then ASSERT().
1339 If EndBit is less than StartBit, then ASSERT().
1340
1341 @param Address MMIO register to read.
1342 @param StartBit The ordinal of the least significant bit in the bit field.
1343 Range 0..7.
1344 @param EndBit The ordinal of the most significant bit in the bit field.
1345 Range 0..7.
1346
1347 @return The value read.
1348
1349 **/
1350 UINT8
1351 EFIAPI
1352 MmioBitFieldRead8 (
1353 IN UINTN Address,
1354 IN UINTN StartBit,
1355 IN UINTN EndBit
1356 );
1357
1358 /**
1359 Writes a bit field to a MMIO register.
1360
1361 Writes Value to the bit field of the MMIO register. The bit field is
1362 specified by the StartBit and the EndBit. All other bits in the destination
1363 MMIO register are preserved. The new value of the 8-bit register is returned.
1364
1365 If 8-bit MMIO register operations are not supported, then ASSERT().
1366 If StartBit is greater than 7, then ASSERT().
1367 If EndBit is greater than 7, then ASSERT().
1368 If EndBit is less than StartBit, then ASSERT().
1369
1370 @param Address MMIO register to write.
1371 @param StartBit The ordinal of the least significant bit in the bit field.
1372 Range 0..7.
1373 @param EndBit The ordinal of the most significant bit in the bit field.
1374 Range 0..7.
1375 @param Value New value of the bit field.
1376
1377 @return The value written back to the MMIO register.
1378
1379 **/
1380 UINT8
1381 EFIAPI
1382 MmioBitFieldWrite8 (
1383 IN UINTN Address,
1384 IN UINTN StartBit,
1385 IN UINTN EndBit,
1386 IN UINT8 Value
1387 );
1388
1389 /**
1390 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1391 writes the result back to the bit field in the 8-bit MMIO register.
1392
1393 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1394 OR between the read result and the value specified by OrData, and
1395 writes the result to the 8-bit MMIO register specified by Address. The value
1396 written to the MMIO register is returned. This function must guarantee that
1397 all MMIO read and write operations are serialized. Extra left bits in OrData
1398 are stripped.
1399
1400 If 8-bit MMIO register operations are not supported, then ASSERT().
1401 If StartBit is greater than 7, then ASSERT().
1402 If EndBit is greater than 7, then ASSERT().
1403 If EndBit is less than StartBit, then ASSERT().
1404
1405 @param Address MMIO register to write.
1406 @param StartBit The ordinal of the least significant bit in the bit field.
1407 Range 0..7.
1408 @param EndBit The ordinal of the most significant bit in the bit field.
1409 Range 0..7.
1410 @param OrData The value to OR with read value from the MMIO register.
1411
1412 @return The value written back to the MMIO register.
1413
1414 **/
1415 UINT8
1416 EFIAPI
1417 MmioBitFieldOr8 (
1418 IN UINTN Address,
1419 IN UINTN StartBit,
1420 IN UINTN EndBit,
1421 IN UINT8 OrData
1422 );
1423
1424 /**
1425 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1426 writes the result back to the bit field in the 8-bit MMIO register.
1427
1428 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1429 between the read result and the value specified by AndData, and writes the
1430 result to the 8-bit MMIO register specified by Address. The value written to
1431 the MMIO register is returned. This function must guarantee that all MMIO
1432 read and write operations are serialized. Extra left bits in AndData are
1433 stripped.
1434
1435 If 8-bit MMIO register operations are not supported, then ASSERT().
1436 If StartBit is greater than 7, then ASSERT().
1437 If EndBit is greater than 7, then ASSERT().
1438 If EndBit is less than StartBit, then ASSERT().
1439
1440 @param Address MMIO register to write.
1441 @param StartBit The ordinal of the least significant bit in the bit field.
1442 Range 0..7.
1443 @param EndBit The ordinal of the most significant bit in the bit field.
1444 Range 0..7.
1445 @param AndData The value to AND with read value from the MMIO register.
1446
1447 @return The value written back to the MMIO register.
1448
1449 **/
1450 UINT8
1451 EFIAPI
1452 MmioBitFieldAnd8 (
1453 IN UINTN Address,
1454 IN UINTN StartBit,
1455 IN UINTN EndBit,
1456 IN UINT8 AndData
1457 );
1458
1459 /**
1460 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1461 by a bitwise OR, and writes the result back to the bit field in the
1462 8-bit MMIO register.
1463
1464 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1465 followed by a bitwise OR between the read result and the value
1466 specified by AndData, and writes the result to the 8-bit MMIO register
1467 specified by Address. The value written to the MMIO register is returned.
1468 This function must guarantee that all MMIO read and write operations are
1469 serialized. Extra left bits in both AndData and OrData are stripped.
1470
1471 If 8-bit MMIO register operations are not supported, then ASSERT().
1472 If StartBit is greater than 7, then ASSERT().
1473 If EndBit is greater than 7, then ASSERT().
1474 If EndBit is less than StartBit, then ASSERT().
1475
1476 @param Address MMIO register to write.
1477 @param StartBit The ordinal of the least significant bit in the bit field.
1478 Range 0..7.
1479 @param EndBit The ordinal of the most significant bit in the bit field.
1480 Range 0..7.
1481 @param AndData The value to AND with read value from the MMIO register.
1482 @param OrData The value to OR with the result of the AND operation.
1483
1484 @return The value written back to the MMIO register.
1485
1486 **/
1487 UINT8
1488 EFIAPI
1489 MmioBitFieldAndThenOr8 (
1490 IN UINTN Address,
1491 IN UINTN StartBit,
1492 IN UINTN EndBit,
1493 IN UINT8 AndData,
1494 IN UINT8 OrData
1495 );
1496
1497 /**
1498 Reads a 16-bit MMIO register.
1499
1500 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
1501 returned. This function must guarantee that all MMIO read and write
1502 operations are serialized.
1503
1504 If 16-bit MMIO register operations are not supported, then ASSERT().
1505 If Address is not aligned on a 16-bit boundary, then ASSERT().
1506
1507 @param Address The MMIO register to read.
1508
1509 @return The value read.
1510
1511 **/
1512 UINT16
1513 EFIAPI
1514 MmioRead16 (
1515 IN UINTN Address
1516 );
1517
1518 /**
1519 Writes a 16-bit MMIO register.
1520
1521 Writes the 16-bit MMIO register specified by Address with the value specified
1522 by Value and returns Value. This function must guarantee that all MMIO read
1523 and write operations are serialized.
1524
1525 If 16-bit MMIO register operations are not supported, then ASSERT().
1526 If Address is not aligned on a 16-bit boundary, then ASSERT().
1527
1528 @param Address The MMIO register to write.
1529 @param Value The value to write to the MMIO register.
1530
1531 @return Value.
1532
1533 **/
1534 UINT16
1535 EFIAPI
1536 MmioWrite16 (
1537 IN UINTN Address,
1538 IN UINT16 Value
1539 );
1540
1541 /**
1542 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1543 result back to the 16-bit MMIO register.
1544
1545 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1546 OR between the read result and the value specified by OrData, and
1547 writes the result to the 16-bit MMIO register specified by Address. The value
1548 written to the MMIO register is returned. This function must guarantee that
1549 all MMIO read and write operations are serialized.
1550
1551 If 16-bit MMIO register operations are not supported, then ASSERT().
1552 If Address is not aligned on a 16-bit boundary, then ASSERT().
1553
1554 @param Address The MMIO register to write.
1555 @param OrData The value to OR with the read value from the MMIO register.
1556
1557 @return The value written back to the MMIO register.
1558
1559 **/
1560 UINT16
1561 EFIAPI
1562 MmioOr16 (
1563 IN UINTN Address,
1564 IN UINT16 OrData
1565 );
1566
1567 /**
1568 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1569 back to the 16-bit MMIO register.
1570
1571 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1572 between the read result and the value specified by AndData, and writes the
1573 result to the 16-bit MMIO register specified by Address. The value written to
1574 the MMIO register is returned. This function must guarantee that all MMIO
1575 read and write operations are serialized.
1576
1577 If 16-bit MMIO register operations are not supported, then ASSERT().
1578 If Address is not aligned on a 16-bit boundary, then ASSERT().
1579
1580 @param Address The MMIO register to write.
1581 @param AndData The value to AND with the read value from the MMIO register.
1582
1583 @return The value written back to the MMIO register.
1584
1585 **/
1586 UINT16
1587 EFIAPI
1588 MmioAnd16 (
1589 IN UINTN Address,
1590 IN UINT16 AndData
1591 );
1592
1593 /**
1594 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1595 OR, and writes the result back to the 16-bit MMIO register.
1596
1597 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1598 between the read result and the value specified by AndData, performs a
1599 bitwise OR between the result of the AND operation and the value specified by
1600 OrData, and writes the result to the 16-bit MMIO register specified by
1601 Address. The value written to the MMIO register is returned. This function
1602 must guarantee that all MMIO read and write operations are serialized.
1603
1604 If 16-bit MMIO register operations are not supported, then ASSERT().
1605 If Address is not aligned on a 16-bit boundary, then ASSERT().
1606
1607 @param Address The MMIO register to write.
1608 @param AndData The value to AND with the read value from the MMIO register.
1609 @param OrData The value to OR with the result of the AND operation.
1610
1611 @return The value written back to the MMIO register.
1612
1613 **/
1614 UINT16
1615 EFIAPI
1616 MmioAndThenOr16 (
1617 IN UINTN Address,
1618 IN UINT16 AndData,
1619 IN UINT16 OrData
1620 );
1621
1622 /**
1623 Reads a bit field of a MMIO register.
1624
1625 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1626 the StartBit and the EndBit. The value of the bit field is returned.
1627
1628 If 16-bit MMIO register operations are not supported, then ASSERT().
1629 If Address is not aligned on a 16-bit boundary, then ASSERT().
1630 If StartBit is greater than 15, then ASSERT().
1631 If EndBit is greater than 15, then ASSERT().
1632 If EndBit is less than StartBit, then ASSERT().
1633
1634 @param Address MMIO register to read.
1635 @param StartBit The ordinal of the least significant bit in the bit field.
1636 Range 0..15.
1637 @param EndBit The ordinal of the most significant bit in the bit field.
1638 Range 0..15.
1639
1640 @return The value read.
1641
1642 **/
1643 UINT16
1644 EFIAPI
1645 MmioBitFieldRead16 (
1646 IN UINTN Address,
1647 IN UINTN StartBit,
1648 IN UINTN EndBit
1649 );
1650
1651 /**
1652 Writes a bit field to a MMIO register.
1653
1654 Writes Value to the bit field of the MMIO register. The bit field is
1655 specified by the StartBit and the EndBit. All other bits in the destination
1656 MMIO register are preserved. The new value of the 16-bit register is returned.
1657
1658 If 16-bit MMIO register operations are not supported, then ASSERT().
1659 If Address is not aligned on a 16-bit boundary, then ASSERT().
1660 If StartBit is greater than 15, then ASSERT().
1661 If EndBit is greater than 15, then ASSERT().
1662 If EndBit is less than StartBit, then ASSERT().
1663
1664 @param Address MMIO register to write.
1665 @param StartBit The ordinal of the least significant bit in the bit field.
1666 Range 0..15.
1667 @param EndBit The ordinal of the most significant bit in the bit field.
1668 Range 0..15.
1669 @param Value New value of the bit field.
1670
1671 @return The value written back to the MMIO register.
1672
1673 **/
1674 UINT16
1675 EFIAPI
1676 MmioBitFieldWrite16 (
1677 IN UINTN Address,
1678 IN UINTN StartBit,
1679 IN UINTN EndBit,
1680 IN UINT16 Value
1681 );
1682
1683 /**
1684 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1685 writes the result back to the bit field in the 16-bit MMIO register.
1686
1687 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1688 OR between the read result and the value specified by OrData, and
1689 writes the result to the 16-bit MMIO register specified by Address. The value
1690 written to the MMIO register is returned. This function must guarantee that
1691 all MMIO read and write operations are serialized. Extra left bits in OrData
1692 are stripped.
1693
1694 If 16-bit MMIO register operations are not supported, then ASSERT().
1695 If Address is not aligned on a 16-bit boundary, then ASSERT().
1696 If StartBit is greater than 15, then ASSERT().
1697 If EndBit is greater than 15, then ASSERT().
1698 If EndBit is less than StartBit, then ASSERT().
1699
1700 @param Address MMIO register to write.
1701 @param StartBit The ordinal of the least significant bit in the bit field.
1702 Range 0..15.
1703 @param EndBit The ordinal of the most significant bit in the bit field.
1704 Range 0..15.
1705 @param OrData The value to OR with read value from the MMIO register.
1706
1707 @return The value written back to the MMIO register.
1708
1709 **/
1710 UINT16
1711 EFIAPI
1712 MmioBitFieldOr16 (
1713 IN UINTN Address,
1714 IN UINTN StartBit,
1715 IN UINTN EndBit,
1716 IN UINT16 OrData
1717 );
1718
1719 /**
1720 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1721 writes the result back to the bit field in the 16-bit MMIO register.
1722
1723 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1724 between the read result and the value specified by AndData, and writes the
1725 result to the 16-bit MMIO register specified by Address. The value written to
1726 the MMIO register is returned. This function must guarantee that all MMIO
1727 read and write operations are serialized. Extra left bits in AndData are
1728 stripped.
1729
1730 If 16-bit MMIO register operations are not supported, then ASSERT().
1731 If Address is not aligned on a 16-bit boundary, then ASSERT().
1732 If StartBit is greater than 15, then ASSERT().
1733 If EndBit is greater than 15, then ASSERT().
1734 If EndBit is less than StartBit, then ASSERT().
1735
1736 @param Address MMIO register to write.
1737 @param StartBit The ordinal of the least significant bit in the bit field.
1738 Range 0..15.
1739 @param EndBit The ordinal of the most significant bit in the bit field.
1740 Range 0..15.
1741 @param AndData The value to AND with read value from the MMIO register.
1742
1743 @return The value written back to the MMIO register.
1744
1745 **/
1746 UINT16
1747 EFIAPI
1748 MmioBitFieldAnd16 (
1749 IN UINTN Address,
1750 IN UINTN StartBit,
1751 IN UINTN EndBit,
1752 IN UINT16 AndData
1753 );
1754
1755 /**
1756 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1757 by a bitwise OR, and writes the result back to the bit field in the
1758 16-bit MMIO register.
1759
1760 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1761 followed by a bitwise OR between the read result and the value
1762 specified by AndData, and writes the result to the 16-bit MMIO register
1763 specified by Address. The value written to the MMIO register is returned.
1764 This function must guarantee that all MMIO read and write operations are
1765 serialized. Extra left bits in both AndData and OrData are stripped.
1766
1767 If 16-bit MMIO register operations are not supported, then ASSERT().
1768 If Address is not aligned on a 16-bit boundary, then ASSERT().
1769 If StartBit is greater than 15, then ASSERT().
1770 If EndBit is greater than 15, then ASSERT().
1771 If EndBit is less than StartBit, then ASSERT().
1772
1773 @param Address MMIO register to write.
1774 @param StartBit The ordinal of the least significant bit in the bit field.
1775 Range 0..15.
1776 @param EndBit The ordinal of the most significant bit in the bit field.
1777 Range 0..15.
1778 @param AndData The value to AND with read value from the MMIO register.
1779 @param OrData The value to OR with the result of the AND operation.
1780
1781 @return The value written back to the MMIO register.
1782
1783 **/
1784 UINT16
1785 EFIAPI
1786 MmioBitFieldAndThenOr16 (
1787 IN UINTN Address,
1788 IN UINTN StartBit,
1789 IN UINTN EndBit,
1790 IN UINT16 AndData,
1791 IN UINT16 OrData
1792 );
1793
1794 /**
1795 Reads a 32-bit MMIO register.
1796
1797 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
1798 returned. This function must guarantee that all MMIO read and write
1799 operations are serialized.
1800
1801 If 32-bit MMIO register operations are not supported, then ASSERT().
1802 If Address is not aligned on a 32-bit boundary, then ASSERT().
1803
1804 @param Address The MMIO register to read.
1805
1806 @return The value read.
1807
1808 **/
1809 UINT32
1810 EFIAPI
1811 MmioRead32 (
1812 IN UINTN Address
1813 );
1814
1815 /**
1816 Writes a 32-bit MMIO register.
1817
1818 Writes the 32-bit MMIO register specified by Address with the value specified
1819 by Value and returns Value. This function must guarantee that all MMIO read
1820 and write operations are serialized.
1821
1822 If 32-bit MMIO register operations are not supported, then ASSERT().
1823 If Address is not aligned on a 32-bit boundary, then ASSERT().
1824
1825 @param Address The MMIO register to write.
1826 @param Value The value to write to the MMIO register.
1827
1828 @return Value.
1829
1830 **/
1831 UINT32
1832 EFIAPI
1833 MmioWrite32 (
1834 IN UINTN Address,
1835 IN UINT32 Value
1836 );
1837
1838 /**
1839 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
1840 result back to the 32-bit MMIO register.
1841
1842 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1843 OR between the read result and the value specified by OrData, and
1844 writes the result to the 32-bit MMIO register specified by Address. The value
1845 written to the MMIO register is returned. This function must guarantee that
1846 all MMIO read and write operations are serialized.
1847
1848 If 32-bit MMIO register operations are not supported, then ASSERT().
1849 If Address is not aligned on a 32-bit boundary, then ASSERT().
1850
1851 @param Address The MMIO register to write.
1852 @param OrData The value to OR with the read value from the MMIO register.
1853
1854 @return The value written back to the MMIO register.
1855
1856 **/
1857 UINT32
1858 EFIAPI
1859 MmioOr32 (
1860 IN UINTN Address,
1861 IN UINT32 OrData
1862 );
1863
1864 /**
1865 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1866 back to the 32-bit MMIO register.
1867
1868 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1869 between the read result and the value specified by AndData, and writes the
1870 result to the 32-bit MMIO register specified by Address. The value written to
1871 the MMIO register is returned. This function must guarantee that all MMIO
1872 read and write operations are serialized.
1873
1874 If 32-bit MMIO register operations are not supported, then ASSERT().
1875 If Address is not aligned on a 32-bit boundary, then ASSERT().
1876
1877 @param Address The MMIO register to write.
1878 @param AndData The value to AND with the read value from the MMIO register.
1879
1880 @return The value written back to the MMIO register.
1881
1882 **/
1883 UINT32
1884 EFIAPI
1885 MmioAnd32 (
1886 IN UINTN Address,
1887 IN UINT32 AndData
1888 );
1889
1890 /**
1891 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1892 OR, and writes the result back to the 32-bit MMIO register.
1893
1894 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1895 between the read result and the value specified by AndData, performs a
1896 bitwise OR between the result of the AND operation and the value specified by
1897 OrData, and writes the result to the 32-bit MMIO register specified by
1898 Address. The value written to the MMIO register is returned. This function
1899 must guarantee that all MMIO read and write operations are serialized.
1900
1901 If 32-bit MMIO register operations are not supported, then ASSERT().
1902 If Address is not aligned on a 32-bit boundary, then ASSERT().
1903
1904 @param Address The MMIO register to write.
1905 @param AndData The value to AND with the read value from the MMIO register.
1906 @param OrData The value to OR with the result of the AND operation.
1907
1908 @return The value written back to the MMIO register.
1909
1910 **/
1911 UINT32
1912 EFIAPI
1913 MmioAndThenOr32 (
1914 IN UINTN Address,
1915 IN UINT32 AndData,
1916 IN UINT32 OrData
1917 );
1918
1919 /**
1920 Reads a bit field of a MMIO register.
1921
1922 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1923 the StartBit and the EndBit. The value of the bit field is returned.
1924
1925 If 32-bit MMIO register operations are not supported, then ASSERT().
1926 If Address is not aligned on a 32-bit boundary, then ASSERT().
1927 If StartBit is greater than 31, then ASSERT().
1928 If EndBit is greater than 31, then ASSERT().
1929 If EndBit is less than StartBit, then ASSERT().
1930
1931 @param Address MMIO register to read.
1932 @param StartBit The ordinal of the least significant bit in the bit field.
1933 Range 0..31.
1934 @param EndBit The ordinal of the most significant bit in the bit field.
1935 Range 0..31.
1936
1937 @return The value read.
1938
1939 **/
1940 UINT32
1941 EFIAPI
1942 MmioBitFieldRead32 (
1943 IN UINTN Address,
1944 IN UINTN StartBit,
1945 IN UINTN EndBit
1946 );
1947
1948 /**
1949 Writes a bit field to a MMIO register.
1950
1951 Writes Value to the bit field of the MMIO register. The bit field is
1952 specified by the StartBit and the EndBit. All other bits in the destination
1953 MMIO register are preserved. The new value of the 32-bit register is returned.
1954
1955 If 32-bit MMIO register operations are not supported, then ASSERT().
1956 If Address is not aligned on a 32-bit boundary, then ASSERT().
1957 If StartBit is greater than 31, then ASSERT().
1958 If EndBit is greater than 31, then ASSERT().
1959 If EndBit is less than StartBit, then ASSERT().
1960
1961 @param Address MMIO register to write.
1962 @param StartBit The ordinal of the least significant bit in the bit field.
1963 Range 0..31.
1964 @param EndBit The ordinal of the most significant bit in the bit field.
1965 Range 0..31.
1966 @param Value New value of the bit field.
1967
1968 @return The value written back to the MMIO register.
1969
1970 **/
1971 UINT32
1972 EFIAPI
1973 MmioBitFieldWrite32 (
1974 IN UINTN Address,
1975 IN UINTN StartBit,
1976 IN UINTN EndBit,
1977 IN UINT32 Value
1978 );
1979
1980 /**
1981 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1982 writes the result back to the bit field in the 32-bit MMIO register.
1983
1984 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1985 OR between the read result and the value specified by OrData, and
1986 writes the result to the 32-bit MMIO register specified by Address. The value
1987 written to the MMIO register is returned. This function must guarantee that
1988 all MMIO read and write operations are serialized. Extra left bits in OrData
1989 are stripped.
1990
1991 If 32-bit MMIO register operations are not supported, then ASSERT().
1992 If Address is not aligned on a 32-bit boundary, then ASSERT().
1993 If StartBit is greater than 31, then ASSERT().
1994 If EndBit is greater than 31, then ASSERT().
1995 If EndBit is less than StartBit, then ASSERT().
1996
1997 @param Address MMIO register to write.
1998 @param StartBit The ordinal of the least significant bit in the bit field.
1999 Range 0..31.
2000 @param EndBit The ordinal of the most significant bit in the bit field.
2001 Range 0..31.
2002 @param OrData The value to OR with read value from the MMIO register.
2003
2004 @return The value written back to the MMIO register.
2005
2006 **/
2007 UINT32
2008 EFIAPI
2009 MmioBitFieldOr32 (
2010 IN UINTN Address,
2011 IN UINTN StartBit,
2012 IN UINTN EndBit,
2013 IN UINT32 OrData
2014 );
2015
2016 /**
2017 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
2018 writes the result back to the bit field in the 32-bit MMIO register.
2019
2020 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2021 between the read result and the value specified by AndData, and writes the
2022 result to the 32-bit MMIO register specified by Address. The value written to
2023 the MMIO register is returned. This function must guarantee that all MMIO
2024 read and write operations are serialized. Extra left bits in AndData are
2025 stripped.
2026
2027 If 32-bit MMIO register operations are not supported, then ASSERT().
2028 If Address is not aligned on a 32-bit boundary, then ASSERT().
2029 If StartBit is greater than 31, then ASSERT().
2030 If EndBit is greater than 31, then ASSERT().
2031 If EndBit is less than StartBit, then ASSERT().
2032
2033 @param Address MMIO register to write.
2034 @param StartBit The ordinal of the least significant bit in the bit field.
2035 Range 0..31.
2036 @param EndBit The ordinal of the most significant bit in the bit field.
2037 Range 0..31.
2038 @param AndData The value to AND with read value from the MMIO register.
2039
2040 @return The value written back to the MMIO register.
2041
2042 **/
2043 UINT32
2044 EFIAPI
2045 MmioBitFieldAnd32 (
2046 IN UINTN Address,
2047 IN UINTN StartBit,
2048 IN UINTN EndBit,
2049 IN UINT32 AndData
2050 );
2051
2052 /**
2053 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
2054 by a bitwise OR, and writes the result back to the bit field in the
2055 32-bit MMIO register.
2056
2057 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2058 followed by a bitwise OR between the read result and the value
2059 specified by AndData, and writes the result to the 32-bit MMIO register
2060 specified by Address. The value written to the MMIO register is returned.
2061 This function must guarantee that all MMIO read and write operations are
2062 serialized. Extra left bits in both AndData and OrData are stripped.
2063
2064 If 32-bit MMIO register operations are not supported, then ASSERT().
2065 If Address is not aligned on a 32-bit boundary, then ASSERT().
2066 If StartBit is greater than 31, then ASSERT().
2067 If EndBit is greater than 31, then ASSERT().
2068 If EndBit is less than StartBit, then ASSERT().
2069
2070 @param Address MMIO register to write.
2071 @param StartBit The ordinal of the least significant bit in the bit field.
2072 Range 0..31.
2073 @param EndBit The ordinal of the most significant bit in the bit field.
2074 Range 0..31.
2075 @param AndData The value to AND with read value from the MMIO register.
2076 @param OrData The value to OR with the result of the AND operation.
2077
2078 @return The value written back to the MMIO register.
2079
2080 **/
2081 UINT32
2082 EFIAPI
2083 MmioBitFieldAndThenOr32 (
2084 IN UINTN Address,
2085 IN UINTN StartBit,
2086 IN UINTN EndBit,
2087 IN UINT32 AndData,
2088 IN UINT32 OrData
2089 );
2090
2091 /**
2092 Reads a 64-bit MMIO register.
2093
2094 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
2095 returned. This function must guarantee that all MMIO read and write
2096 operations are serialized.
2097
2098 If 64-bit MMIO register operations are not supported, then ASSERT().
2099 If Address is not aligned on a 64-bit boundary, then ASSERT().
2100
2101 @param Address The MMIO register to read.
2102
2103 @return The value read.
2104
2105 **/
2106 UINT64
2107 EFIAPI
2108 MmioRead64 (
2109 IN UINTN Address
2110 );
2111
2112 /**
2113 Writes a 64-bit MMIO register.
2114
2115 Writes the 64-bit MMIO register specified by Address with the value specified
2116 by Value and returns Value. This function must guarantee that all MMIO read
2117 and write operations are serialized.
2118
2119 If 64-bit MMIO register operations are not supported, then ASSERT().
2120 If Address is not aligned on a 64-bit boundary, then ASSERT().
2121
2122 @param Address The MMIO register to write.
2123 @param Value The value to write to the MMIO register.
2124
2125 **/
2126 UINT64
2127 EFIAPI
2128 MmioWrite64 (
2129 IN UINTN Address,
2130 IN UINT64 Value
2131 );
2132
2133 /**
2134 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
2135 result back to the 64-bit MMIO register.
2136
2137 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2138 OR between the read result and the value specified by OrData, and
2139 writes the result to the 64-bit MMIO register specified by Address. The value
2140 written to the MMIO register is returned. This function must guarantee that
2141 all MMIO read and write operations are serialized.
2142
2143 If 64-bit MMIO register operations are not supported, then ASSERT().
2144 If Address is not aligned on a 64-bit boundary, then ASSERT().
2145
2146 @param Address The MMIO register to write.
2147 @param OrData The value to OR with the read value from the MMIO register.
2148
2149 @return The value written back to the MMIO register.
2150
2151 **/
2152 UINT64
2153 EFIAPI
2154 MmioOr64 (
2155 IN UINTN Address,
2156 IN UINT64 OrData
2157 );
2158
2159 /**
2160 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2161 back to the 64-bit MMIO register.
2162
2163 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2164 between the read result and the value specified by AndData, and writes the
2165 result to the 64-bit MMIO register specified by Address. The value written to
2166 the MMIO register is returned. This function must guarantee that all MMIO
2167 read and write operations are serialized.
2168
2169 If 64-bit MMIO register operations are not supported, then ASSERT().
2170 If Address is not aligned on a 64-bit boundary, then ASSERT().
2171
2172 @param Address The MMIO register to write.
2173 @param AndData The value to AND with the read value from the MMIO register.
2174
2175 @return The value written back to the MMIO register.
2176
2177 **/
2178 UINT64
2179 EFIAPI
2180 MmioAnd64 (
2181 IN UINTN Address,
2182 IN UINT64 AndData
2183 );
2184
2185 /**
2186 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2187 OR, and writes the result back to the 64-bit MMIO register.
2188
2189 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2190 between the read result and the value specified by AndData, performs a
2191 bitwise OR between the result of the AND operation and the value specified by
2192 OrData, and writes the result to the 64-bit MMIO register specified by
2193 Address. The value written to the MMIO register is returned. This function
2194 must guarantee that all MMIO read and write operations are serialized.
2195
2196 If 64-bit MMIO register operations are not supported, then ASSERT().
2197 If Address is not aligned on a 64-bit boundary, then ASSERT().
2198
2199 @param Address The MMIO register to write.
2200 @param AndData The value to AND with the read value from the MMIO register.
2201 @param OrData The value to OR with the result of the AND operation.
2202
2203 @return The value written back to the MMIO register.
2204
2205 **/
2206 UINT64
2207 EFIAPI
2208 MmioAndThenOr64 (
2209 IN UINTN Address,
2210 IN UINT64 AndData,
2211 IN UINT64 OrData
2212 );
2213
2214 /**
2215 Reads a bit field of a MMIO register.
2216
2217 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2218 the StartBit and the EndBit. The value of the bit field is returned.
2219
2220 If 64-bit MMIO register operations are not supported, then ASSERT().
2221 If Address is not aligned on a 64-bit boundary, then ASSERT().
2222 If StartBit is greater than 63, then ASSERT().
2223 If EndBit is greater than 63, then ASSERT().
2224 If EndBit is less than StartBit, then ASSERT().
2225
2226 @param Address MMIO register to read.
2227 @param StartBit The ordinal of the least significant bit in the bit field.
2228 Range 0..63.
2229 @param EndBit The ordinal of the most significant bit in the bit field.
2230 Range 0..63.
2231
2232 @return The value read.
2233
2234 **/
2235 UINT64
2236 EFIAPI
2237 MmioBitFieldRead64 (
2238 IN UINTN Address,
2239 IN UINTN StartBit,
2240 IN UINTN EndBit
2241 );
2242
2243 /**
2244 Writes a bit field to a MMIO register.
2245
2246 Writes Value to the bit field of the MMIO register. The bit field is
2247 specified by the StartBit and the EndBit. All other bits in the destination
2248 MMIO register are preserved. The new value of the 64-bit register is returned.
2249
2250 If 64-bit MMIO register operations are not supported, then ASSERT().
2251 If Address is not aligned on a 64-bit boundary, then ASSERT().
2252 If StartBit is greater than 63, then ASSERT().
2253 If EndBit is greater than 63, then ASSERT().
2254 If EndBit is less than StartBit, then ASSERT().
2255
2256 @param Address MMIO register to write.
2257 @param StartBit The ordinal of the least significant bit in the bit field.
2258 Range 0..63.
2259 @param EndBit The ordinal of the most significant bit in the bit field.
2260 Range 0..63.
2261 @param Value New value of the bit field.
2262
2263 @return The value written back to the MMIO register.
2264
2265 **/
2266 UINT64
2267 EFIAPI
2268 MmioBitFieldWrite64 (
2269 IN UINTN Address,
2270 IN UINTN StartBit,
2271 IN UINTN EndBit,
2272 IN UINT64 Value
2273 );
2274
2275 /**
2276 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2277 writes the result back to the bit field in the 64-bit MMIO register.
2278
2279 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2280 OR between the read result and the value specified by OrData, and
2281 writes the result to the 64-bit MMIO register specified by Address. The value
2282 written to the MMIO register is returned. This function must guarantee that
2283 all MMIO read and write operations are serialized. Extra left bits in OrData
2284 are stripped.
2285
2286 If 64-bit MMIO register operations are not supported, then ASSERT().
2287 If Address is not aligned on a 64-bit boundary, then ASSERT().
2288 If StartBit is greater than 63, then ASSERT().
2289 If EndBit is greater than 63, then ASSERT().
2290 If EndBit is less than StartBit, then ASSERT().
2291
2292 @param Address MMIO register to write.
2293 @param StartBit The ordinal of the least significant bit in the bit field.
2294 Range 0..63.
2295 @param EndBit The ordinal of the most significant bit in the bit field.
2296 Range 0..63.
2297 @param OrData The value to OR with read value from the MMIO register.
2298
2299 @return The value written back to the MMIO register.
2300
2301 **/
2302 UINT64
2303 EFIAPI
2304 MmioBitFieldOr64 (
2305 IN UINTN Address,
2306 IN UINTN StartBit,
2307 IN UINTN EndBit,
2308 IN UINT64 OrData
2309 );
2310
2311 /**
2312 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2313 writes the result back to the bit field in the 64-bit MMIO register.
2314
2315 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2316 between the read result and the value specified by AndData, and writes the
2317 result to the 64-bit MMIO register specified by Address. The value written to
2318 the MMIO register is returned. This function must guarantee that all MMIO
2319 read and write operations are serialized. Extra left bits in AndData are
2320 stripped.
2321
2322 If 64-bit MMIO register operations are not supported, then ASSERT().
2323 If Address is not aligned on a 64-bit boundary, then ASSERT().
2324 If StartBit is greater than 63, then ASSERT().
2325 If EndBit is greater than 63, then ASSERT().
2326 If EndBit is less than StartBit, then ASSERT().
2327
2328 @param Address MMIO register to write.
2329 @param StartBit The ordinal of the least significant bit in the bit field.
2330 Range 0..63.
2331 @param EndBit The ordinal of the most significant bit in the bit field.
2332 Range 0..63.
2333 @param AndData The value to AND with read value from the MMIO register.
2334
2335 @return The value written back to the MMIO register.
2336
2337 **/
2338 UINT64
2339 EFIAPI
2340 MmioBitFieldAnd64 (
2341 IN UINTN Address,
2342 IN UINTN StartBit,
2343 IN UINTN EndBit,
2344 IN UINT64 AndData
2345 );
2346
2347 /**
2348 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2349 by a bitwise OR, and writes the result back to the bit field in the
2350 64-bit MMIO register.
2351
2352 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2353 followed by a bitwise OR between the read result and the value
2354 specified by AndData, and writes the result to the 64-bit MMIO register
2355 specified by Address. The value written to the MMIO register is returned.
2356 This function must guarantee that all MMIO read and write operations are
2357 serialized. Extra left bits in both AndData and OrData are stripped.
2358
2359 If 64-bit MMIO register operations are not supported, then ASSERT().
2360 If Address is not aligned on a 64-bit boundary, then ASSERT().
2361 If StartBit is greater than 63, then ASSERT().
2362 If EndBit is greater than 63, then ASSERT().
2363 If EndBit is less than StartBit, then ASSERT().
2364
2365 @param Address MMIO register to write.
2366 @param StartBit The ordinal of the least significant bit in the bit field.
2367 Range 0..63.
2368 @param EndBit The ordinal of the most significant bit in the bit field.
2369 Range 0..63.
2370 @param AndData The value to AND with read value from the MMIO register.
2371 @param OrData The value to OR with the result of the AND operation.
2372
2373 @return The value written back to the MMIO register.
2374
2375 **/
2376 UINT64
2377 EFIAPI
2378 MmioBitFieldAndThenOr64 (
2379 IN UINTN Address,
2380 IN UINTN StartBit,
2381 IN UINTN EndBit,
2382 IN UINT64 AndData,
2383 IN UINT64 OrData
2384 );
2385
2386 /**
2387 Copy data from MMIO region to system memory by using 8-bit access.
2388
2389 Copy data from MMIO region specified by starting address StartAddress
2390 to system memory specified by Buffer by using 8-bit access. The total
2391 number of byte to be copied is specified by Length. Buffer is returned.
2392
2393 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2394 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
2395
2396
2397 @param StartAddress Starting address for the MMIO region to be copied from.
2398 @param Length The size, in bytes, of Buffer.
2399 @param Buffer Pointer to a system memory buffer receiving the data read.
2400
2401 @return Buffer
2402
2403 **/
2404 UINT8 *
2405 EFIAPI
2406 MmioReadBuffer8 (
2407 IN UINTN StartAddress,
2408 IN UINTN Length,
2409 OUT UINT8 *Buffer
2410 );
2411
2412 /**
2413 Copy data from MMIO region to system memory by using 16-bit access.
2414
2415 Copy data from MMIO region specified by starting address StartAddress
2416 to system memory specified by Buffer by using 16-bit access. The total
2417 number of byte to be copied is specified by Length. Buffer is returned.
2418
2419 If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
2420
2421 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2422 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
2423
2424 If Length is not aligned on a 16-bit boundary, then ASSERT().
2425 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
2426
2427 @param StartAddress Starting address for the MMIO region to be copied from.
2428 @param Length The size, in bytes, of Buffer.
2429 @param Buffer Pointer to a system memory buffer receiving the data read.
2430
2431 @return Buffer
2432
2433 **/
2434 UINT16 *
2435 EFIAPI
2436 MmioReadBuffer16 (
2437 IN UINTN StartAddress,
2438 IN UINTN Length,
2439 OUT UINT16 *Buffer
2440 );
2441
2442 /**
2443 Copy data from MMIO region to system memory by using 32-bit access.
2444
2445 Copy data from MMIO region specified by starting address StartAddress
2446 to system memory specified by Buffer by using 32-bit access. The total
2447 number of byte to be copied is specified by Length. Buffer is returned.
2448
2449 If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
2450
2451 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2452 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
2453
2454 If Length is not aligned on a 32-bit boundary, then ASSERT().
2455 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
2456
2457 @param StartAddress Starting address for the MMIO region to be copied from.
2458 @param Length The size, in bytes, of Buffer.
2459 @param Buffer Pointer to a system memory buffer receiving the data read.
2460
2461 @return Buffer
2462
2463 **/
2464 UINT32 *
2465 EFIAPI
2466 MmioReadBuffer32 (
2467 IN UINTN StartAddress,
2468 IN UINTN Length,
2469 OUT UINT32 *Buffer
2470 );
2471
2472 /**
2473 Copy data from MMIO region to system memory by using 64-bit access.
2474
2475 Copy data from MMIO region specified by starting address StartAddress
2476 to system memory specified by Buffer by using 64-bit access. The total
2477 number of byte to be copied is specified by Length. Buffer is returned.
2478
2479 If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
2480
2481 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2482 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
2483
2484 If Length is not aligned on a 64-bit boundary, then ASSERT().
2485 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
2486
2487 @param StartAddress Starting address for the MMIO region to be copied from.
2488 @param Length The size, in bytes, of Buffer.
2489 @param Buffer Pointer to a system memory buffer receiving the data read.
2490
2491 @return Buffer
2492
2493 **/
2494 UINT64 *
2495 EFIAPI
2496 MmioReadBuffer64 (
2497 IN UINTN StartAddress,
2498 IN UINTN Length,
2499 OUT UINT64 *Buffer
2500 );
2501
2502 /**
2503 Copy data from system memory to MMIO region by using 8-bit access.
2504
2505 Copy data from system memory specified by Buffer to MMIO region specified
2506 by starting address StartAddress by using 8-bit access. The total number
2507 of byte to be copied is specified by Length. Buffer is returned.
2508
2509 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2510 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
2511
2512
2513 @param StartAddress Starting address for the MMIO region to be copied to.
2514 @param Length The size, in bytes, of Buffer.
2515 @param Buffer Pointer to a system memory buffer containing the data to write.
2516
2517 @return Buffer
2518
2519 **/
2520 UINT8 *
2521 EFIAPI
2522 MmioWriteBuffer8 (
2523 IN UINTN StartAddress,
2524 IN UINTN Length,
2525 IN CONST UINT8 *Buffer
2526 );
2527
2528 /**
2529 Copy data from system memory to MMIO region by using 16-bit access.
2530
2531 Copy data from system memory specified by Buffer to MMIO region specified
2532 by starting address StartAddress by using 16-bit access. The total number
2533 of byte to be copied is specified by Length. Buffer is returned.
2534
2535 If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
2536
2537 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2538 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
2539
2540 If Length is not aligned on a 16-bit boundary, then ASSERT().
2541
2542 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
2543
2544 @param StartAddress Starting address for the MMIO region to be copied to.
2545 @param Length The size, in bytes, of Buffer.
2546 @param Buffer Pointer to a system memory buffer containing the data to write.
2547
2548 @return Buffer
2549
2550 **/
2551 UINT16 *
2552 EFIAPI
2553 MmioWriteBuffer16 (
2554 IN UINTN StartAddress,
2555 IN UINTN Length,
2556 IN CONST UINT16 *Buffer
2557 );
2558
2559 /**
2560 Copy data from system memory to MMIO region by using 32-bit access.
2561
2562 Copy data from system memory specified by Buffer to MMIO region specified
2563 by starting address StartAddress by using 32-bit access. The total number
2564 of byte to be copied is specified by Length. Buffer is returned.
2565
2566 If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
2567
2568 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2569 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
2570
2571 If Length is not aligned on a 32-bit boundary, then ASSERT().
2572
2573 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
2574
2575 @param StartAddress Starting address for the MMIO region to be copied to.
2576 @param Length The size, in bytes, of Buffer.
2577 @param Buffer Pointer to a system memory buffer containing the data to write.
2578
2579 @return Buffer
2580
2581 **/
2582 UINT32 *
2583 EFIAPI
2584 MmioWriteBuffer32 (
2585 IN UINTN StartAddress,
2586 IN UINTN Length,
2587 IN CONST UINT32 *Buffer
2588 );
2589
2590 /**
2591 Copy data from system memory to MMIO region by using 64-bit access.
2592
2593 Copy data from system memory specified by Buffer to MMIO region specified
2594 by starting address StartAddress by using 64-bit access. The total number
2595 of byte to be copied is specified by Length. Buffer is returned.
2596
2597 If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
2598
2599 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2600 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
2601
2602 If Length is not aligned on a 64-bit boundary, then ASSERT().
2603
2604 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
2605
2606 @param StartAddress Starting address for the MMIO region to be copied to.
2607 @param Length The size, in bytes, of Buffer.
2608 @param Buffer Pointer to a system memory buffer containing the data to write.
2609
2610 @return Buffer
2611
2612 **/
2613 UINT64 *
2614 EFIAPI
2615 MmioWriteBuffer64 (
2616 IN UINTN StartAddress,
2617 IN UINTN Length,
2618 IN CONST UINT64 *Buffer
2619 );
2620
2621
2622 #endif
2623