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