EHCI Driver Problems With VirtualBox
Posted: Wed Feb 29, 2012 7:33 pm
Hello,
My OS has a working EHCI/USB20/MASS STORAGE driver (tested on real hardware). I am trying to get my operating system to work with Virtual Box but the EHCI driver's EHCI Reset doesn't work. The specification says that the controller is supposed to set the bit to zero once the reset is finished with. Yet VirtualBox does not do this.
Here are is my init function and my EHCI reset function:
Thank you in advance.
Hoozim
My OS has a working EHCI/USB20/MASS STORAGE driver (tested on real hardware). I am trying to get my operating system to work with Virtual Box but the EHCI driver's EHCI Reset doesn't work. The specification says that the controller is supposed to set the bit to zero once the reset is finished with. Yet VirtualBox does not do this.
Here are is my init function and my EHCI reset function:
Code: Select all
void EHCI::ConfigureEHCI(dword baseAddressPhysical, byte interrupt)
{
EHCI::Private::BaseAddressPhysical = baseAddressPhysical;
EHCI::Private::Interrupt = interrupt;
dword baseAddress = (dword)VirtualMemory::PCIMemory(baseAddressPhysical, 1);
EHCI::Private::BaseAddress = baseAddress;
EHCI::Private::CapabilityRegisters* capRegs = (EHCI::Private::CapabilityRegisters*)baseAddress;
EHCI::Private::CapRegister = capRegs;
EHCI::Private::NumberOfPorts = capRegs->HCSPARAMS.N_PORTS;
if (capRegs->HCCPARAMS.Addressing64Bit)
{
EHCI::Private::Addressing64Bit = 1;
//return; Virtual Box Uses a 64 Bit EHCI
}
if (capRegs->HCSPARAMS.PortPowerControl)
{
EHCI::Private::PortPowerControl = 1;
}
EHCI::Private::OperationalRegistersBase = EHCI::Private::BaseAddress + capRegs->CAPLENGTH;
EHCI::Private::OperationalRegisters* opRegs = (EHCI::Private::OperationalRegisters*)EHCI::Private::OperationalRegistersBase;
EHCI::Private::OpRegister = (EHCI::Private::OperationalRegisters*)EHCI::Private::OperationalRegistersBase;
EHCI::Private::PORTSCBaseAddress = ((EHCI::Private::OperationalRegistersBase) + 0x44);
IDT::InstallIRQ((dword)&EHCI::Private::EHCIIRQHandler, 0x8, PModeGate | PresentGate, 32 + interrupt);
USB20::ConfigureUSB20();
EHCI::Private::ResetEHCI();
for (int i = 0; i < EHCI::Private::NumberOfPorts; i++)
{
EHCI::Private::PORTSC* port = EHCI::Private::SelectPortSC(i);
if (EHCI::Private::PortPowerControl)
{
port->PortPower = 1;
}
}
}
void EHCI::Private::ResetEHCI()
{
EHCI::Private::OpRegister->USBCMD.RunStop = 0;
while (EHCI::Private::OpRegister->USBSTS.HCHalted == 0)
{
PIT::WaitMilliseconds(30);
}
EHCI::Private::OpRegister->USBCMD.HostControllerReset = 1;
while (EHCI::Private::OpRegister->USBCMD.HostControllerReset == 1)
{
PIT::WaitMilliseconds(20);
}
EHCI::Private::OpRegister->CTRLDSSEGMENT = 0;
EHCI::Private::EnableInterrupts();
EHCI::Private::OpRegister->PERIODICLISTBASE = 0;
EHCI::Private::OpRegister->ASYNCLISTADDR = 0;
EHCI::Private::OpRegister->USBCMD.RunStop = 1;
while (EHCI::Private::OpRegister->USBSTS.HCHalted == 1)
{
PIT::WaitMilliseconds(20);
}
EHCI::Private::OpRegister->CONFIGFLAG.ConfigureFlag = 1;
PIT::WaitMilliseconds(50);
}
Hoozim