1 /*++ 2 3 Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved 4 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 7 The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php. 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 14 15 Module Name: 16 17 INTELGFX.ASL 18 19 Abstract: 20 21 IGD OpRegion/Software ACPI Reference Code for the Baytrail Family. 22 23 --*/ 24 25 // Enable/Disable Output Switching. In WIN2K/WINXP, _DOS = 0 will 26 // get called during initialization to prepare for an ACPI Display 27 // Switch Event. During an ACPI Display Switch, the OS will call 28 // _DOS = 2 immediately after a Notify=0x80 to temporarily disable 29 // all Display Switching. After ACPI Display Switching is complete, 30 // the OS will call _DOS = 0 to re-enable ACPI Display Switching. 31 32 Method(_DOS,1) 33 { 34 // Store Display Switching and LCD brightness BIOS control bit 35 Store(And(Arg0,7),DSEN) 36 } 37 38 // Enumerate the Display Environment. This method will return 39 // valid addresses for all display device encoders present in the 40 // system. The Miniport Driver will reject the addresses for every 41 // encoder that does not have an attached display device. After 42 // enumeration is complete, the OS will call the _DGS methods 43 // during a display switch only for the addresses accepted by the 44 // Miniport Driver. For hot-insertion and removal of display 45 // devices, a re-enumeration notification will be required so the 46 // address of the newly present display device will be accepted by 47 // the Miniport Driver. 48 49 Method(_DOD, 0, Serialized) 50 { 51 Store(0, NDID) 52 If(LNotEqual(DIDL, Zero)) 53 { 54 Store(SDDL(DIDL),DID1) 55 } 56 If(LNotEqual(DDL2, Zero)) 57 { 58 Store(SDDL(DDL2),DID2) 59 } 60 If(LNotEqual(DDL3, Zero)) 61 { 62 Store(SDDL(DDL3),DID3) 63 } 64 If(LNotEqual(DDL4, Zero)) 65 { 66 Store(SDDL(DDL4),DID4) 67 } 68 If(LNotEqual(DDL5, Zero)) 69 { 70 Store(SDDL(DDL5),DID5) 71 } 72 73 // TODO - This level of flexibility is not needed for a true 74 // OEM design. Simply determine the greatest number of 75 // encoders the platform will suppport then remove all 76 // return packages beyond that value. Note that for 77 // current silicon, the maximum number of encoders 78 // possible is 5. 79 80 If(LEqual(NDID,1)) 81 { 82 If (LNOTEqual (ISPD, 0)) 83 { 84 Name(TMP0,Package() {0xFFFFFFFF,0xFFFFFFFF}) 85 Store(Or(0x10000,DID1),Index(TMP0,0)) 86 //Add ISP device to GFX0 87 Store(0x00020F38, Index(TMP0,1)) 88 Return(TMP0) 89 } Else 90 { 91 Name(TMP1,Package() {0xFFFFFFFF}) 92 Store(Or(0x10000,DID1),Index(TMP1,0)) 93 Return(TMP1) 94 } 95 } 96 97 If(LEqual(NDID,2)) 98 { 99 If (LNOTEqual (ISPD, 0)) 100 { 101 Name(TMP2,Package() {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}) 102 Store(Or(0x10000,DID1),Index(TMP2,0)) 103 Store(Or(0x10000,DID2),Index(TMP2,1)) 104 //Add ISP device to GFX0 105 Store(0x00020F38, Index(TMP2,2)) 106 Return(TMP2) 107 } Else 108 { 109 Name(TMP3,Package() {0xFFFFFFFF, 0xFFFFFFFF}) 110 Store(Or(0x10000,DID1),Index(TMP3,0)) 111 Store(Or(0x10000,DID2),Index(TMP3,1)) 112 Return(TMP3) 113 } 114 } 115 116 If(LEqual(NDID,3)) 117 { 118 If (LNOTEqual (ISPD, 0)) 119 { 120 Name(TMP4,Package() {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,0xFFFFFFFF}) 121 Store(Or(0x10000,DID1),Index(TMP4,0)) 122 Store(Or(0x10000,DID2),Index(TMP4,1)) 123 Store(Or(0x10000,DID3),Index(TMP4,2)) 124 //Add ISP device to GFX0 125 Store(0x00020F38, Index(TMP4,3)) 126 Return(TMP4) 127 } Else 128 { 129 Name(TMP5,Package() {0xFFFFFFFF, 0xFFFFFFFF,0xFFFFFFFF}) 130 Store(Or(0x10000,DID1),Index(TMP5,0)) 131 Store(Or(0x10000,DID2),Index(TMP5,1)) 132 Store(Or(0x10000,DID3),Index(TMP5,2)) 133 Return(TMP5) 134 } 135 } 136 137 If(LEqual(NDID,4)) 138 { 139 If (LNOTEqual (ISPD, 0)) 140 { 141 Name(TMP6,Package() {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}) 142 Store(Or(0x10000,DID1),Index(TMP6,0)) 143 Store(Or(0x10000,DID2),Index(TMP6,1)) 144 Store(Or(0x10000,DID3),Index(TMP6,2)) 145 Store(Or(0x10000,DID4),Index(TMP6,3)) 146 //Add ISP device to GFX0 147 Store(0x00020F38, Index(TMP6,4)) 148 Return(TMP6) 149 } Else 150 { 151 Name(TMP7,Package() {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}) 152 Store(Or(0x10000,DID1),Index(TMP7,0)) 153 Store(Or(0x10000,DID2),Index(TMP7,1)) 154 Store(Or(0x10000,DID3),Index(TMP7,2)) 155 Store(Or(0x10000,DID4),Index(TMP7,3)) 156 Return(TMP7) 157 } 158 } 159 160 If(LGreater(NDID,4)) 161 { 162 If (LNOTEqual (ISPD, 0)) 163 { 164 Name(TMP8,Package() {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}) 165 Store(Or(0x10000,DID1),Index(TMP8,0)) 166 Store(Or(0x10000,DID2),Index(TMP8,1)) 167 Store(Or(0x10000,DID3),Index(TMP8,2)) 168 Store(Or(0x10000,DID4),Index(TMP8,3)) 169 Store(Or(0x10000,DID5),Index(TMP8,4)) 170 //Add ISP device to GFX0 171 Store(0x00020F38, Index(TMP8,5)) 172 Return(TMP8) 173 } Else 174 { 175 Name(TMP9,Package() {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}) 176 Store(Or(0x10000,DID1),Index(TMP9,0)) 177 Store(Or(0x10000,DID2),Index(TMP9,1)) 178 Store(Or(0x10000,DID3),Index(TMP9,2)) 179 Store(Or(0x10000,DID4),Index(TMP9,3)) 180 Store(Or(0x10000,DID5),Index(TMP9,4)) 181 Return(TMP9) 182 } 183 } 184 185 // If nothing else, return Unknown LFP. 186 // (Prevents compiler warning.) 187 188 //Add ISP device to GFX0 189 If (LNOTEqual (ISPD, 0)) 190 { 191 Return(Package() {0x00000400, 0x00020F38}) 192 } Else 193 { 194 Return(Package() {0x00000400}) 195 } 196 } 197 198 Device(DD01) 199 { 200 201 // Return Unique ID. 202 203 Method(_ADR,0,Serialized) 204 { 205 If(LEqual(And(0x0F00,DID1),0x400)) 206 { 207 Store(0x1, EDPV) 208 Store(DID1, DIDX) 209 Return(1) 210 } 211 If(LEqual(DID1,0)) 212 { 213 Return(1) 214 } 215 Else 216 { 217 Return(And(0xFFFF,DID1)) 218 } 219 } 220 221 // Return the Current Status. 222 223 Method(_DCS,0) 224 { 225 Return(CDDS(DID1)) 226 } 227 228 // Query Graphics State (active or inactive). 229 230 Method(_DGS,0) 231 { 232 Return(NDDS(DID1)) 233 } 234 235 // Device Set State. 236 237 // _DSS Table: 238 // 239 // BIT31 BIT30 Execution 240 // 0 0 Don't implement. 241 // 0 1 Cache change. Nothing to Implement. 242 // 1 0 Don't Implement. 243 // 1 1 Display Switch Complete. Implement. 244 245 Method(_DSS,1) 246 { 247 If(LEqual(And(Arg0,0xC0000000),0xC0000000)) 248 { 249 250 // State change was performed by the 251 // Video Drivers. Simply update the 252 // New State. 253 254 Store(NSTE,CSTE) 255 } 256 } 257 } 258 259 Device(DD02) 260 { 261 262 // Return Unique ID. 263 264 Method(_ADR,0,Serialized) 265 { 266 If(LEqual(And(0x0F00,DID2),0x400)) 267 { 268 Store(0x2, EDPV) 269 Store(DID2, DIDX) 270 Return(2) 271 } 272 If(LEqual(DID2,0)) 273 { 274 Return(2) 275 } 276 Else 277 { 278 Return(And(0xFFFF,DID2)) 279 } 280 } 281 282 // Return the Current Status. 283 284 Method(_DCS,0) 285 { 286 Return(CDDS(DID2)) 287 } 288 289 // Query Graphics State (active or inactive). 290 291 Method(_DGS,0) 292 { 293 // Return the Next State. 294 Return(NDDS(DID2)) 295 } 296 297 // Device Set State. (See table above.) 298 299 Method(_DSS,1) 300 { 301 If(LEqual(And(Arg0,0xC0000000),0xC0000000)) 302 { 303 304 // State change was performed by the 305 // Video Drivers. Simply update the 306 // New State. 307 308 Store(NSTE,CSTE) 309 } 310 } 311 } 312 313 Device(DD03) 314 { 315 316 // Return Unique ID. 317 318 Method(_ADR,0,Serialized) 319 { 320 If(LEqual(And(0x0F00,DID3),0x400)) 321 { 322 Store(0x3, EDPV) 323 Store(DID3, DIDX) 324 Return(3) 325 } 326 If(LEqual(DID3,0)) 327 { 328 Return(3) 329 } 330 Else 331 { 332 Return(And(0xFFFF,DID3)) 333 } 334 } 335 336 // Return the Current Status. 337 338 Method(_DCS,0) 339 { 340 If(LEqual(DID3,0)) 341 { 342 Return(0x0B) 343 } 344 Else 345 { 346 Return(CDDS(DID3)) 347 } 348 } 349 350 // Query Graphics State (active or inactive). 351 352 Method(_DGS,0) 353 { 354 Return(NDDS(DID3)) 355 } 356 357 // Device Set State. (See table above.) 358 359 Method(_DSS,1) 360 { 361 If(LEqual(And(Arg0,0xC0000000),0xC0000000)) 362 { 363 // State change was performed by the 364 // Video Drivers. Simply update the 365 // New State. 366 367 Store(NSTE,CSTE) 368 } 369 } 370 } 371 372 Device(DD04) 373 { 374 375 // Return Unique ID. 376 377 Method(_ADR,0,Serialized) 378 { 379 If(LEqual(And(0x0F00,DID4),0x400)) 380 { 381 Store(0x4, EDPV) 382 Store(DID4, DIDX) 383 Return(4) 384 } 385 If(LEqual(DID4,0)) 386 { 387 Return(4) 388 } 389 Else 390 { 391 Return(And(0xFFFF,DID4)) 392 } 393 } 394 395 // Return the Current Status. 396 397 Method(_DCS,0) 398 { 399 If(LEqual(DID4,0)) 400 { 401 Return(0x0B) 402 } 403 Else 404 { 405 Return(CDDS(DID4)) 406 } 407 } 408 409 // Query Graphics State (active or inactive). 410 411 Method(_DGS,0) 412 { 413 Return(NDDS(DID4)) 414 } 415 416 // Device Set State. (See table above.) 417 418 Method(_DSS,1) 419 { 420 If(LEqual(And(Arg0,0xC0000000),0xC0000000)) 421 { 422 423 // State change was performed by the 424 // Video Drivers. Simply update the 425 // New State. 426 427 Store(NSTE,CSTE) 428 } 429 } 430 } 431 432 433 Device(DD05) 434 { 435 436 // Return Unique ID. 437 438 Method(_ADR,0,Serialized) 439 { 440 If(LEqual(And(0x0F00,DID5),0x400)) 441 { 442 Store(0x5, EDPV) 443 Store(DID5, DIDX) 444 Return(5) 445 } 446 If(LEqual(DID5,0)) 447 { 448 Return(5) 449 } 450 Else 451 { 452 Return(And(0xFFFF,DID5)) 453 } 454 } 455 456 // Return the Current Status. 457 458 Method(_DCS,0) 459 { 460 If(LEqual(DID5,0)) 461 { 462 Return(0x0B) 463 } 464 Else 465 { 466 Return(CDDS(DID5)) 467 } 468 } 469 470 // Query Graphics State (active or inactive). 471 472 Method(_DGS,0) 473 { 474 Return(NDDS(DID5)) 475 } 476 477 // Device Set State. (See table above.) 478 479 Method(_DSS,1) 480 { 481 If(LEqual(And(Arg0,0xC0000000),0xC0000000)) 482 { 483 // State change was performed by the 484 // Video Drivers. Simply update the 485 // New State. 486 487 Store(NSTE,CSTE) 488 } 489 } 490 } 491 492 493 Device(DD06) 494 { 495 496 // Return Unique ID. 497 498 Method(_ADR,0,Serialized) 499 { 500 If(LEqual(And(0x0F00,DID6),0x400)) 501 { 502 Store(0x6, EDPV) 503 Store(DID6, DIDX) 504 Return(6) 505 } 506 If(LEqual(DID6,0)) 507 { 508 Return(6) 509 } 510 Else 511 { 512 Return(And(0xFFFF,DID6)) 513 } 514 } 515 516 // Return the Current Status. 517 518 Method(_DCS,0) 519 { 520 If(LEqual(DID6,0)) 521 { 522 Return(0x0B) 523 } 524 Else 525 { 526 Return(CDDS(DID6)) 527 } 528 } 529 530 // Query Graphics State (active or inactive). 531 532 Method(_DGS,0) 533 { 534 Return(NDDS(DID6)) 535 } 536 537 // Device Set State. (See table above.) 538 539 Method(_DSS,1) 540 { 541 If(LEqual(And(Arg0,0xC0000000),0xC0000000)) 542 { 543 // State change was performed by the 544 // Video Drivers. Simply update the 545 // New State. 546 547 Store(NSTE,CSTE) 548 } 549 } 550 } 551 552 553 Device(DD07) 554 { 555 556 // Return Unique ID. 557 558 Method(_ADR,0,Serialized) 559 { 560 If(LEqual(And(0x0F00,DID7),0x400)) 561 { 562 Store(0x7, EDPV) 563 Store(DID7, DIDX) 564 Return(7) 565 } 566 If(LEqual(DID7,0)) 567 { 568 Return(7) 569 } 570 Else 571 { 572 Return(And(0xFFFF,DID7)) 573 } 574 } 575 576 // Return the Current Status. 577 578 Method(_DCS,0) 579 { 580 If(LEqual(DID7,0)) 581 { 582 Return(0x0B) 583 } 584 Else 585 { 586 Return(CDDS(DID7)) 587 } 588 } 589 590 // Query Graphics State (active or inactive). 591 592 Method(_DGS,0) 593 { 594 Return(NDDS(DID7)) 595 } 596 597 // Device Set State. (See table above.) 598 599 Method(_DSS,1) 600 { 601 If(LEqual(And(Arg0,0xC0000000),0xC0000000)) 602 { 603 // State change was performed by the 604 // Video Drivers. Simply update the 605 // New State. 606 607 Store(NSTE,CSTE) 608 } 609 } 610 } 611 612 613 Device(DD08) 614 { 615 616 // Return Unique ID. 617 618 Method(_ADR,0,Serialized) 619 { 620 If(LEqual(And(0x0F00,DID8),0x400)) 621 { 622 Store(0x8, EDPV) 623 Store(DID8, DIDX) 624 Return(8) 625 } 626 If(LEqual(DID8,0)) 627 { 628 Return(8) 629 } 630 Else 631 { 632 Return(And(0xFFFF,DID8)) 633 } 634 } 635 636 // Return the Current Status. 637 638 Method(_DCS,0) 639 { 640 If(LEqual(DID8,0)) 641 { 642 Return(0x0B) 643 } 644 Else 645 { 646 Return(CDDS(DID8)) 647 } 648 } 649 650 // Query Graphics State (active or inactive). 651 652 Method(_DGS,0) 653 { 654 Return(NDDS(DID8)) 655 } 656 657 // Device Set State. (See table above.) 658 659 Method(_DSS,1) 660 { 661 If(LEqual(And(Arg0,0xC0000000),0xC0000000)) 662 { 663 // State change was performed by the 664 // Video Drivers. Simply update the 665 // New State. 666 667 Store(NSTE,CSTE) 668 } 669 } 670 } 671 672 //device for eDP 673 Device(DD1F) 674 { 675 // Return Unique ID. 676 677 Method(_ADR,0,Serialized) 678 { 679 If(LEqual(EDPV, 0x0)) 680 { 681 Return(0x1F) 682 } 683 Else 684 { 685 Return(And(0xFFFF,DIDX)) 686 } 687 } 688 689 // Return the Current Status. 690 691 Method(_DCS,0) 692 { 693 If(LEqual(EDPV, 0x0)) 694 { 695 Return(0x00) 696 } 697 Else 698 { 699 Return(CDDS(DIDX)) 700 } 701 } 702 703 // Query Graphics State (active or inactive). 704 705 Method(_DGS,0) 706 { 707 Return(NDDS(DIDX)) 708 } 709 710 // Device Set State. (See table above.) 711 712 Method(_DSS,1) 713 { 714 If(LEqual(And(Arg0,0xC0000000),0xC0000000)) 715 { 716 // State change was performed by the 717 // Video Drivers. Simply update the 718 // New State. 719 Store(NSTE,CSTE) 720 } 721 } 722 // Query List of Brightness Control Levels Supported. 723 724 Method(_BCL,0) 725 { 726 // List of supported brightness levels in the following sequence. 727 728 // Level when machine has full power. 729 // Level when machine is on batteries. 730 // Other supported levels. 731 Return(Package() {80, 50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100}) 732 } 733 734 // Set the Brightness Level. 735 736 Method (_BCM,1) 737 { 738 // Set the requested level if it is between 0 and 100%. 739 740 If(LAnd(LGreaterEqual(Arg0,0),LLessEqual(Arg0,100))) 741 { 742 \_SB.PCI0.GFX0.AINT(1, Arg0) 743 Store(Arg0,BRTL) // Store Brightness Level. 744 } 745 } 746 747 // Brightness Query Current level. 748 749 Method (_BQC,0) 750 { 751 Return(BRTL) 752 } 753 } 754 755 Method(SDDL,1) 756 { 757 Increment(NDID) 758 Store(And(Arg0,0xF0F),Local0) 759 Or(0x80000000,Local0, Local1) 760 If(LEqual(DIDL,Local0)) 761 { 762 Return(Local1) 763 } 764 If(LEqual(DDL2,Local0)) 765 { 766 Return(Local1) 767 } 768 If(LEqual(DDL3,Local0)) 769 { 770 Return(Local1) 771 } 772 If(LEqual(DDL4,Local0)) 773 { 774 Return(Local1) 775 } 776 If(LEqual(DDL5,Local0)) 777 { 778 Return(Local1) 779 } 780 If(LEqual(DDL6,Local0)) 781 { 782 Return(Local1) 783 } 784 If(LEqual(DDL7,Local0)) 785 { 786 Return(Local1) 787 } 788 If(LEqual(DDL8,Local0)) 789 { 790 Return(Local1) 791 } 792 Return(0) 793 } 794 795 Method(CDDS,1) 796 { 797 Store(And(Arg0,0xF0F),Local0) 798 799 If(LEqual(0, Local0)) 800 { 801 Return(0x1D) 802 } 803 If(LEqual(CADL, Local0)) 804 { 805 Return(0x1F) 806 } 807 If(LEqual(CAL2, Local0)) 808 { 809 Return(0x1F) 810 } 811 If(LEqual(CAL3, Local0)) 812 { 813 Return(0x1F) 814 } 815 If(LEqual(CAL4, Local0)) 816 { 817 Return(0x1F) 818 } 819 If(LEqual(CAL5, Local0)) 820 { 821 Return(0x1F) 822 } 823 If(LEqual(CAL6, Local0)) 824 { 825 Return(0x1F) 826 } 827 If(LEqual(CAL7, Local0)) 828 { 829 Return(0x1F) 830 } 831 If(LEqual(CAL8, Local0)) 832 { 833 Return(0x1F) 834 } 835 Return(0x1D) 836 } 837 838 Method(NDDS,1) 839 { 840 Store(And(Arg0,0xF0F),Local0) 841 842 If(LEqual(0, Local0)) 843 { 844 Return(0) 845 } 846 If(LEqual(NADL, Local0)) 847 { 848 Return(1) 849 } 850 If(LEqual(NDL2, Local0)) 851 { 852 Return(1) 853 } 854 If(LEqual(NDL3, Local0)) 855 { 856 Return(1) 857 } 858 If(LEqual(NDL4, Local0)) 859 { 860 Return(1) 861 } 862 If(LEqual(NDL5, Local0)) 863 { 864 Return(1) 865 } 866 If(LEqual(NDL6, Local0)) 867 { 868 Return(1) 869 } 870 If(LEqual(NDL7, Local0)) 871 { 872 Return(1) 873 } 874 If(LEqual(NDL8, Local0)) 875 { 876 Return(1) 877 } 878 Return(0) 879 } 880 881 // 882 // Include IGD OpRegion/Software SCI interrupt handler which is use by 883 // the graphics drivers to request data from system BIOS. 884 // 885 include("IgdOpRn.ASL") 886