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