- Timestamp:
- Jun 12, 2017 5:45:29 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.c
r62500 r67351 42 42 43 43 #include "VBoxPkg.h" 44 #include "VBoxVgaFonts.h" 44 45 #include "iprt/asm.h" 45 #include "VBoxVgaFonts.h"46 46 47 47 … … 388 388 /* some initialization */ 389 389 ASMOutU8(0x3c2, 0xc3); 390 ASMOutU8(0x3c4, 0x04); 391 ASMOutU8(0x3c5, 0x02); 392 393 /* 394 * inb(r63, 0x3da); // reset attr F/F 395 * outb(0x3c0, 0); // disable palette 396 * outb(0x3d4, 0x11); outb(0x3d5, 0); // unprotect crtc regs 0 - 7 397 */ 398 r[63] = ASMInU8((UINTN)0x3da); 399 ASMOutU8(0x3c0, 0); 400 ASMOutU16(0x3d4, 0x0011); 401 402 #define BOUTB(count, aport, dport) \ 403 do { \ 404 for (i = 0 ; i < count; ++i) \ 405 { \ 406 ASMOutU8((aport), (UINT8)i);\ 407 ASMOutU8((dport), r[i]); \ 408 } \ 409 } while (0) 410 411 /* 412 * Reset and set sequencer registers 413 * 414 * r0 = 0x01; r1 = 0x00; r2 = 0x03; r3 = 0x00; r4 = 0x02; 415 * boutb(5, 0x3c4, 0x3c5); 416 */ 417 r[0] = 0x01; 418 r[1] = 0x00; 419 r[2] = 0x03; 420 r[3] = 0x00; 421 r[4] = 0x02; 422 BOUTB(5, 0x3c4, 0x3c5); 423 424 /* 425 * set misc out register 426 * 427 * outb(0x3c2, 0x67); 428 * 429 * r0 = 3 430 * boutb(1, 0x3c4, 0x3c5); // enable sequencer 431 */ 432 r[0] = 3; 433 BOUTB(1, 0x3c4, 0x3c5); 434 435 /* set all crtc registers */ 436 r[0] = 0x5f; r[1] = 0x4f; r[2] = 0x50; r[3] = 0x82; 437 r[4] = 0x55; r[5] = 0x81; r[6] = 0xbf; r[7] = 0x1f; 438 r[8] = 0x00; r[9] = 0x4f; r[10]= 0x0d; r[11]= 0x0e; 439 r[12]= 0x00; r[13]= 0x00; r[14]= 0x03; r[15]= 0xc0; 440 r[16]= 0x9c; r[17]= 0x0e; r[18]= 0x8f; r[19]= 0x28; 441 r[20]= 0x1f; r[21]= 0x96; r[22]= 0xb9; r[23]= 0xa3; 442 r[24]= 0xff; 443 BOUTB(25, 0x3d4, 0x3d5); 444 445 /* set all graphics controller registers */ 446 r[0]= 0x00; r[1]= 0x00; r[2]= 0x00; r[3]= 0x00; 447 r[4]= 0x00; r[5]= 0x10; r[6]= 0x0e; r[7]= 0x00; 448 r[8]= 0xff; 449 BOUTB(9, 0x3ce, 0x3cf); 450 451 /* set all attribute registers */ 452 r[63] = ASMInU8(0x3da); // reset flip/flop 453 r[0] = 0x00; r[1] = 0x01; r[2] = 0x02; r[3] = 0x03; 454 r[4] = 0x04; r[5] = 0x05; r[6] = 0x14; r[7] = 0x07; 455 r[8] = 0x38; r[9] = 0x39; r[10]= 0x3a; r[11]= 0x3b; 456 r[12]= 0x3c; r[13]= 0x3d; r[14]= 0x3e; r[15]= 0x3f; 457 r[16]= 0x0c; r[17]= 0x00; r[18]= 0x0f; r[19]= 0x08; 458 r[20]= 0x00; 459 BOUTB(21, 0x3c0, 0x3c0); 460 ASMOutU8(0x3c0, 0x20); // re-enable palette 461 462 /* set all VBox extended registers */ 463 r[0] = 1; 464 BOUTB(1, 0x3c4, 0x3c5); // disable sequencer 465 466 ASMOutU16(0x1ce, 0x04); ASMOutU16(0x1cf, 0); // ENABLE 467 468 r[0] = 3; 469 BOUTB(1, 0x3c4, 0x3c5); // enable sequencer 470 471 /* Load default values into the first 16 entries of the DAC */ 472 { 473 static const UINT8 s_a3bVgaDac[64*3] = 474 { 475 0x00, 0x00, 0x00, 476 0x00, 0x00, 0x2A, 477 0x00, 0x2A, 0x00, 478 0x00, 0x2A, 0x2A, 479 0x2A, 0x00, 0x00, 480 0x2A, 0x00, 0x2A, 481 0x2A, 0x2A, 0x00, 482 0x2A, 0x2A, 0x2A, 483 0x00, 0x00, 0x15, 484 0x00, 0x00, 0x3F, 485 0x00, 0x2A, 0x15, 486 0x00, 0x2A, 0x3F, 487 0x2A, 0x00, 0x15, 488 0x2A, 0x00, 0x3F, 489 0x2A, 0x2A, 0x15, 490 0x2A, 0x2A, 0x3F, 491 0x00, 0x15, 0x00, 492 0x00, 0x15, 0x2A, 493 0x00, 0x3F, 0x00, 494 0x00, 0x3F, 0x2A, 495 0x2A, 0x15, 0x00, 496 0x2A, 0x15, 0x2A, 497 0x2A, 0x3F, 0x00, 498 0x2A, 0x3F, 0x2A, 499 0x00, 0x15, 0x15, 500 0x00, 0x15, 0x3F, 501 0x00, 0x3F, 0x15, 502 0x00, 0x3F, 0x3F, 503 0x2A, 0x15, 0x15, 504 0x2A, 0x15, 0x3F, 505 0x2A, 0x3F, 0x15, 506 0x2A, 0x3F, 0x3F, 507 0x15, 0x00, 0x00, 508 0x15, 0x00, 0x2A, 509 0x15, 0x2A, 0x00, 510 0x15, 0x2A, 0x2A, 511 0x3F, 0x00, 0x00, 512 0x3F, 0x00, 0x2A, 513 0x3F, 0x2A, 0x00, 514 0x3F, 0x2A, 0x2A, 515 0x15, 0x00, 0x15, 516 0x15, 0x00, 0x3F, 517 0x15, 0x2A, 0x15, 518 0x15, 0x2A, 0x3F, 519 0x3F, 0x00, 0x15, 520 0x3F, 0x00, 0x3F, 521 0x3F, 0x2A, 0x15, 522 0x3F, 0x2A, 0x3F, 523 0x15, 0x15, 0x00, 524 0x15, 0x15, 0x2A, 525 0x15, 0x3F, 0x00, 526 0x15, 0x3F, 0x2A, 527 0x3F, 0x15, 0x00, 528 0x3F, 0x15, 0x2A, 529 0x3F, 0x3F, 0x00, 530 0x3F, 0x3F, 0x2A, 531 0x15, 0x15, 0x15, 532 0x15, 0x15, 0x3F, 533 0x15, 0x3F, 0x15, 534 0x15, 0x3F, 0x3F, 535 0x3F, 0x15, 0x15, 536 0x3F, 0x15, 0x3F, 537 0x3F, 0x3F, 0x15, 538 0x3F, 0x3F, 0x3F 539 }; 540 541 for (i = 0; i < 64; ++i) 542 { 543 ASMOutU8(0x3c8, (UINT8)i); 544 ASMOutU8(0x3c9, s_a3bVgaDac[i*3 + 0]); 545 ASMOutU8(0x3c9, s_a3bVgaDac[i*3 + 1]); 546 ASMOutU8(0x3c9, s_a3bVgaDac[i*3 + 2]); 547 } 548 } 549 550 /* Load the appropriate font into the first map */ 551 { 390 ASMOutU16(0x3c4, 0x0204); 391 392 ASMInU8(0x3da); // reset attr F/F 393 ASMOutU8(0x3c0, 0); // disable palette 394 ASMOutU16(0x3d4, 0x0011); // unprotect crtc regs 0 - 7 395 396 #define BOUTB(count, aport, dport) \ 397 do { \ 398 for (i = 0 ; i < (count); ++i) \ 399 if ((dport) == (aport) + 1) \ 400 ASMOutU16((aport), ((UINT16)r[i] << 8) | (UINT8)i); \ 401 else { \ 402 ASMOutU8((aport), (UINT8)i); \ 403 ASMOutU8((dport), r[i]); \ 404 } \ 405 } while (0) 406 407 /* Reset and set sequencer registers */ 408 r[0] = 0x01; 409 r[1] = 0x00; 410 r[2] = 0x03; 411 r[3] = 0x00; 412 r[4] = 0x02; 413 BOUTB(5, 0x3c4, 0x3c5); 414 415 /* set misc out register */ 416 ASMOutU8(0x3c2, 0x67); 417 418 /* enable sequencer */ 419 ASMOutU16(0x3c4, 0x0300); 420 421 /* set all crtc registers */ 422 r[0] = 0x5f; r[1] = 0x4f; r[2] = 0x50; r[3] = 0x82; 423 r[4] = 0x55; r[5] = 0x81; r[6] = 0xbf; r[7] = 0x1f; 424 r[8] = 0x00; r[9] = 0x4f; r[10]= 0x0d; r[11]= 0x0e; 425 r[12]= 0x00; r[13]= 0x00; r[14]= 0x03; r[15]= 0xc0; 426 r[16]= 0x9c; r[17]= 0x0e; r[18]= 0x8f; r[19]= 0x28; 427 r[20]= 0x1f; r[21]= 0x96; r[22]= 0xb9; r[23]= 0xa3; 428 r[24]= 0xff; 429 BOUTB(25, 0x3d4, 0x3d5); 430 431 /* set all graphics controller registers */ 432 r[0]= 0x00; r[1]= 0x00; r[2]= 0x00; r[3]= 0x00; 433 r[4]= 0x00; r[5]= 0x10; r[6]= 0x0e; r[7]= 0x00; 434 r[8]= 0xff; 435 BOUTB(9, 0x3ce, 0x3cf); 436 437 /* set all attribute registers */ 438 ASMInU8(0x3da); // reset attr F/F 439 r[0] = 0x00; r[1] = 0x01; r[2] = 0x02; r[3] = 0x03; 440 r[4] = 0x04; r[5] = 0x05; r[6] = 0x14; r[7] = 0x07; 441 r[8] = 0x38; r[9] = 0x39; r[10]= 0x3a; r[11]= 0x3b; 442 r[12]= 0x3c; r[13]= 0x3d; r[14]= 0x3e; r[15]= 0x3f; 443 r[16]= 0x0c; r[17]= 0x00; r[18]= 0x0f; r[19]= 0x08; 444 r[20]= 0x00; 445 BOUTB(21, 0x3c0, 0x3c0); 446 ASMOutU8(0x3c0, 0x20); // re-enable palette 447 448 /* set all VBox extended registers */ 449 450 /* enable sequencer */ 451 ASMOutU16(0x3c4, 0x0100); 452 453 ASMOutU16(0x1ce, 0x04); ASMOutU16(0x1cf, 0); // ENABLE 454 455 /* enable sequencer */ 456 ASMOutU16(0x3c4, 0x0300); 457 458 /* Load default values into the first 16 entries of the DAC */ 459 { 460 static const UINT8 s_a3bVgaDac[64*3] = 461 { 462 0x00, 0x00, 0x00, 463 0x00, 0x00, 0x2A, 464 0x00, 0x2A, 0x00, 465 0x00, 0x2A, 0x2A, 466 0x2A, 0x00, 0x00, 467 0x2A, 0x00, 0x2A, 468 0x2A, 0x2A, 0x00, 469 0x2A, 0x2A, 0x2A, 470 0x00, 0x00, 0x15, 471 0x00, 0x00, 0x3F, 472 0x00, 0x2A, 0x15, 473 0x00, 0x2A, 0x3F, 474 0x2A, 0x00, 0x15, 475 0x2A, 0x00, 0x3F, 476 0x2A, 0x2A, 0x15, 477 0x2A, 0x2A, 0x3F, 478 0x00, 0x15, 0x00, 479 0x00, 0x15, 0x2A, 480 0x00, 0x3F, 0x00, 481 0x00, 0x3F, 0x2A, 482 0x2A, 0x15, 0x00, 483 0x2A, 0x15, 0x2A, 484 0x2A, 0x3F, 0x00, 485 0x2A, 0x3F, 0x2A, 486 0x00, 0x15, 0x15, 487 0x00, 0x15, 0x3F, 488 0x00, 0x3F, 0x15, 489 0x00, 0x3F, 0x3F, 490 0x2A, 0x15, 0x15, 491 0x2A, 0x15, 0x3F, 492 0x2A, 0x3F, 0x15, 493 0x2A, 0x3F, 0x3F, 494 0x15, 0x00, 0x00, 495 0x15, 0x00, 0x2A, 496 0x15, 0x2A, 0x00, 497 0x15, 0x2A, 0x2A, 498 0x3F, 0x00, 0x00, 499 0x3F, 0x00, 0x2A, 500 0x3F, 0x2A, 0x00, 501 0x3F, 0x2A, 0x2A, 502 0x15, 0x00, 0x15, 503 0x15, 0x00, 0x3F, 504 0x15, 0x2A, 0x15, 505 0x15, 0x2A, 0x3F, 506 0x3F, 0x00, 0x15, 507 0x3F, 0x00, 0x3F, 508 0x3F, 0x2A, 0x15, 509 0x3F, 0x2A, 0x3F, 510 0x15, 0x15, 0x00, 511 0x15, 0x15, 0x2A, 512 0x15, 0x3F, 0x00, 513 0x15, 0x3F, 0x2A, 514 0x3F, 0x15, 0x00, 515 0x3F, 0x15, 0x2A, 516 0x3F, 0x3F, 0x00, 517 0x3F, 0x3F, 0x2A, 518 0x15, 0x15, 0x15, 519 0x15, 0x15, 0x3F, 520 0x15, 0x3F, 0x15, 521 0x15, 0x3F, 0x3F, 522 0x3F, 0x15, 0x15, 523 0x3F, 0x15, 0x3F, 524 0x3F, 0x3F, 0x15, 525 0x3F, 0x3F, 0x3F 526 }; 527 528 for (i = 0; i < 64; ++i) 529 { 530 ASMOutU8(0x3c8, (UINT8)i); 531 ASMOutU8(0x3c9, s_a3bVgaDac[i*3 + 0]); 532 ASMOutU8(0x3c9, s_a3bVgaDac[i*3 + 1]); 533 ASMOutU8(0x3c9, s_a3bVgaDac[i*3 + 2]); 534 } 535 } 536 537 /* Load the appropriate font into the first map */ 538 { 552 539 UINT8 const *pabFont; 553 540 unsigned offBase = 0;
Note:
See TracChangeset
for help on using the changeset viewer.