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