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