VirtualBox

Changeset 77336 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 15, 2019 12:56:20 PM (6 years ago)
Author:
vboxsync
Message:

EFI: Tuned the IDE/ATAPI driver for about 10x better throughput.

Location:
trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Bus/Ata/AtaAtapiPassThru
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c

    r58466 r77336  
    196196  switch (Mode) {
    197197    case EfiAtaIdeMode:
     198#ifdef VBOX
     199      // Reading the IDE controller's PCI config space byte by byte is quite expensive.
     200      // It is very unclear why it should be done again and again for every command
     201      // when it was already done in IdeModeInitialization().
     202      // See also ExtScsiPassThruPassThru().
     203#else
    198204      //
    199205      // Reassign IDE mode io port registers' base addresses
     
    204210        return Status;
    205211      }
     212#endif
    206213
    207214      switch (Protocol) {
     
    20272034  switch (Mode) {
    20282035    case EfiAtaIdeMode:
     2036#ifdef VBOX
     2037      // Reading the IDE controller's PCI config space byte by byte is quite expensive.
     2038      // It is very unclear why it should be done again and again for every command
     2039      // when it was already done in IdeModeInitialization().
     2040      // See also AtaPassThruPassThruExecute().
     2041#else
    20292042      //
    20302043      // Reassign IDE mode io port registers' base addresses
     
    20352048        return Status;
    20362049      }
     2050#endif
    20372051
    20382052      Status = AtaPacketCommandExecute (Instance->PciIo, &Instance->IdeRegisters[Port], Port, PortMultiplier, Packet);
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c

    r58459 r77336  
    11461146  IdeWritePortB (PciIo, IdeRegisters->CmdOrStatus, AtaCommand);
    11471147
     1148#ifdef VBOX
     1149  // Stalling is a complete waste of time in a VM. BSY gets set before the status register can be read again.
     1150#else
    11481151  //
    11491152  // Stall at least 400 microseconds.
    11501153  //
    11511154  MicroSecondDelay (400);
     1155#endif
    11521156
    11531157  return EFI_SUCCESS;
     
    18021806    DeviceControl |= ATA_CTLREG_IEN_L;
    18031807    IdeWritePortB (PciIo, IdeRegisters->AltOrDev, DeviceControl);
     1808#ifdef VBOX
     1809    // It is not at all clear what purpose the unconditional 10 millisecond delay might possibly serve.
     1810#else
    18041811    //
    18051812    // Stall for 10 milliseconds.
    18061813    //
    18071814    MicroSecondDelay (10000);
     1815#endif
    18081816
    18091817  }
     
    20792087  for (Count = 0; Count < 6; Count++) {
    20802088    IdeWritePortW (PciIo, IdeRegisters->Data, *((UINT16*)PacketCommand + Count));
     2089#ifdef VBOX
     2090    // Any stalling is completely unnecessary, especially in a VM.
     2091#else
    20812092    //
    20822093    // Stall for 10 microseconds.
    20832094    //
    20842095    MicroSecondDelay (10);
     2096#endif
    20852097  }
    20862098
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette