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