Changeset 76900 in vbox for trunk/src/VBox/Devices/EFI
- Timestamp:
- Jan 19, 2019 12:43:26 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128268
- Location:
- trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVga.c
r76553 r76900 312 312 // if (((Pci.Hdr.Command & 0x01) == 0x01)) { 313 313 // 314 // See if this is a VirtualBox VGA PCI controller315 // 316 if ( Pci.Hdr.VendorId == VBOX_VENDOR_ID) {317 if (Pci.Hdr.DeviceId == VBOX_VGA_DEVICE_ID) {314 // See if this is a VirtualBox VGA or VMSVGA II PCI controller 315 // 316 if ( (Pci.Hdr.VendorId == VBOX_VENDOR_ID) && (Pci.Hdr.DeviceId == VBOX_VGA_DEVICE_ID) 317 || (Pci.Hdr.VendorId == VMSVGA_VENDOR_ID) && (Pci.Hdr.DeviceId == VMSVGA_II_DEVICE_ID)) { 318 318 319 319 Status = EFI_SUCCESS; … … 337 337 } 338 338 } 339 }340 339 } 341 340 … … 375 374 EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; 376 375 ACPI_ADR_DEVICE_PATH AcpiDeviceNode; 376 PCI_TYPE00 Pci; 377 377 378 378 PciAttributesSaved = FALSE; … … 408 408 409 409 // 410 // Read the PCI Configuration Header from the PCI Device again to figure out the model. 411 // 412 Status = Private->PciIo->Pci.Read ( 413 Private->PciIo, 414 EfiPciIoWidthUint32, 415 0, 416 sizeof (Pci) / sizeof (UINT32), 417 &Pci 418 ); 419 if (EFI_ERROR (Status)) { 420 DEBUG((DEBUG_INFO, "%a:%d status:%r\n", __FILE__, __LINE__, Status)); 421 goto Error; 422 } 423 424 Private->DeviceType = Pci.Hdr.DeviceId; 425 426 // 410 427 // Save original PCI attributes 411 428 // … … 488 505 489 506 // 490 // Get VRAM size, needed for constructing a correct video mode list 491 // 492 Private->VRAMSize = ASMInU32(VBE_DISPI_IOPORT_DATA); 507 // Now do some model-specific setup. 508 // 509 if (Private->DeviceType == VMSVGA_II_DEVICE_ID) { 510 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *IOPortDesc; 511 512 // VMSVGA 513 Private->BarIndexFB = 1; 514 515 Private->PciIo->GetBarAttributes ( 516 Private->PciIo, 517 0, // BAR 0 is the I/O port space 518 NULL, 519 (VOID**) &IOPortDesc 520 ); 521 Private->IOBase = (UINT16)IOPortDesc->AddrRangeMin; 522 523 // 524 // Query the VRAM size (for proper mode filtering) 525 // 526 ASMOutU32(Private->IOBase + SVGA_INDEX_PORT, SVGA_REG_VRAM_SIZE); 527 Private->VRAMSize = ASMInU32(Private->IOBase + SVGA_VALUE_PORT); 528 529 #if 0 530 // Not used because of buggy emulation(?) which is not fully compatible 531 // with the simple "legacy" VMSVGA II register interface. 532 533 // Enable the device, set initial mode 534 ASMOutU32(Private->IOBase + SVGA_INDEX_PORT, SVGA_REG_WIDTH); 535 ASMOutU32(Private->IOBase + SVGA_VALUE_PORT, 1024); 536 ASMOutU32(Private->IOBase + SVGA_INDEX_PORT, SVGA_REG_HEIGHT); 537 ASMOutU32(Private->IOBase + SVGA_VALUE_PORT, 768); 538 ASMOutU32(Private->IOBase + SVGA_INDEX_PORT, SVGA_REG_BYTES_PER_LINE); 539 ASMOutU32(Private->IOBase + SVGA_VALUE_PORT, 768 * 4); 540 ASMOutU32(Private->IOBase + SVGA_INDEX_PORT, SVGA_REG_BITS_PER_PIXEL); 541 ASMOutU32(Private->IOBase + SVGA_VALUE_PORT, 32); 542 ASMOutU32(Private->IOBase + SVGA_INDEX_PORT, SVGA_REG_CONFIG_DONE); 543 ASMOutU32(Private->IOBase + SVGA_VALUE_PORT, 1); 544 545 ASMOutU32(Private->IOBase + SVGA_INDEX_PORT, SVGA_REG_ENABLE); 546 ASMOutU32(Private->IOBase + SVGA_VALUE_PORT, SVGA_REG_ENABLE_ENABLE); 547 #endif 548 } else { 549 // VBoxVGA / VBoxSVGA 550 Private->BarIndexFB = 0; 551 // 552 // Get VRAM size, needed for constructing a correct video mode list 553 // 554 Private->VRAMSize = ASMInU32(VBE_DISPI_IOPORT_DATA); 555 } 556 493 557 494 558 // … … 896 960 Private->PciIo, 897 961 EfiPciIoWidthFillUint32, 898 0,962 Private->BarIndexFB, 899 963 0, 900 964 Private->ModeData[Private->CurrentMode].HorizontalResolution … … 1043 1107 Private->PciIo->GetBarAttributes ( 1044 1108 Private->PciIo, 1045 0,1109 Private->BarIndexFB, 1046 1110 NULL, 1047 1111 (VOID**) &FrameBufDesc -
trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVga.h
r76553 r76900 79 79 // VirtualBox VGA PCI Configuration Header values 80 80 // 81 #define VBOX_VENDOR_ID 0x80ee 82 #define VBOX_VGA_DEVICE_ID 0xbeef 81 #define VBOX_VENDOR_ID 0x80ee 82 #define VBOX_VGA_DEVICE_ID 0xbeef 83 84 85 // 86 // VMSVGA II PCI Configuration Header values 87 // 88 #define VMSVGA_VENDOR_ID 0x15ad 89 #define VMSVGA_II_DEVICE_ID 0x0405 90 91 // Port offsets relative to BAR 0 92 #define SVGA_INDEX_PORT 0 93 #define SVGA_VALUE_PORT 1 94 95 // SVGA_REG_ENABLE bits 96 #define SVGA_REG_ENABLE_DISABLE 0 97 #define SVGA_REG_ENABLE_ENABLE 1 98 99 // Registers 100 #define SVGA_REG_ENABLE 1 101 #define SVGA_REG_WIDTH 2 102 #define SVGA_REG_HEIGHT 3 103 #define SVGA_REG_MAX_WIDTH 4 104 #define SVGA_REG_MAX_HEIGHT 5 105 #define SVGA_REG_DEPTH 6 106 #define SVGA_REG_BITS_PER_PIXEL 7 107 #define SVGA_REG_BYTES_PER_LINE 12 108 #define SVGA_REG_FB_START 13 109 #define SVGA_REG_FB_OFFSET 14 110 #define SVGA_REG_VRAM_SIZE 15 111 #define SVGA_REG_CONFIG_DONE 20 ///@todo: Why do we need this? 83 112 84 113 // … … 115 144 VBOX_VGA_MODE_DATA *ModeData; 116 145 BOOLEAN HardwareNeedsStarting; 146 UINT8 BarIndexFB; 147 UINT16 DeviceType; 148 UINT16 IOBase; 117 149 UINT32 VRAMSize; 118 150 } VBOX_VGA_PRIVATE_DATA; -
trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaGraphicsOutput.c
r76553 r76900 79 79 Private->PciIo->GetBarAttributes ( 80 80 Private->PciIo, 81 0,81 Private->BarIndexFB, 82 82 NULL, 83 83 (VOID**) &FrameBufDesc … … 317 317 Private->PciIo, 318 318 EfiPciIoWidthUint32, 319 0,319 Private->BarIndexFB, 320 320 ((SrcY * ScreenWidth) + SourceX) * 4, 321 321 Width, … … 335 335 Private->PciIo, 336 336 EfiPciIoWidthUint32, 337 0,337 Private->BarIndexFB, 338 338 ((DstY * ScreenWidth) + DestinationX) * 4, 339 339 Width, … … 355 355 Private->PciIo, 356 356 EfiPciIoWidthUint32, 357 0,357 Private->BarIndexFB, 358 358 ((DstY * ScreenWidth) + DestinationX) * 4, 359 0,359 Private->BarIndexFB, 360 360 ((SrcY * ScreenWidth) + SourceX) * 4, 361 361 Width … … 370 370 Private->PciIo, 371 371 EfiPciIoWidthUint32, 372 0,372 Private->BarIndexFB, 373 373 ((DstY * ScreenWidth) + DestinationX) * 4, 374 0,374 Private->BarIndexFB, 375 375 ((SrcY * ScreenWidth) + SourceX) * 4, 376 376 Width … … 390 390 Private->PciIo, 391 391 EfiPciIoWidthFillUint32, 392 0,392 Private->BarIndexFB, 393 393 DestinationY * ScreenWidth * 4, 394 394 (Width * Height), … … 402 402 Private->PciIo, 403 403 EfiPciIoWidthFillUint32, 404 0,404 Private->BarIndexFB, 405 405 ((DstY * ScreenWidth) + DestinationX) * 4, 406 406 Width, -
trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaUgaDraw.c
r76553 r76900 216 216 Private->PciIo, 217 217 EfiPciIoWidthUint32, 218 0,218 Private->BarIndexFB, 219 219 ((SrcY * ScreenWidth) + SourceX) * 4, 220 220 Width, … … 234 234 Private->PciIo, 235 235 EfiPciIoWidthUint32, 236 0,236 Private->BarIndexFB, 237 237 ((DstY * ScreenWidth) + DestinationX) * 4, 238 238 Width, … … 254 254 Private->PciIo, 255 255 EfiPciIoWidthUint32, 256 0,256 Private->BarIndexFB, 257 257 ((DstY * ScreenWidth) + DestinationX) * 4, 258 0,258 Private->BarIndexFB, 259 259 ((SrcY * ScreenWidth) + SourceX) * 4, 260 260 Width … … 269 269 Private->PciIo, 270 270 EfiPciIoWidthUint32, 271 0,271 Private->BarIndexFB, 272 272 ((DstY * ScreenWidth) + DestinationX) * 4, 273 0,273 Private->BarIndexFB, 274 274 ((SrcY * ScreenWidth) + SourceX) * 4, 275 275 Width … … 289 289 Private->PciIo, 290 290 EfiPciIoWidthFillUint32, 291 0,291 Private->BarIndexFB, 292 292 DestinationY * ScreenWidth * 4, 293 293 (Width * Height), … … 301 301 Private->PciIo, 302 302 EfiPciIoWidthFillUint32, 303 0,303 Private->BarIndexFB, 304 304 ((DstY * ScreenWidth) + DestinationX) * 4, 305 305 Width,
Note:
See TracChangeset
for help on using the changeset viewer.