Kernel/USB: Add a simple UHCIController::stop()

This stops the controller and waits for it to complete.
This commit is contained in:
Andreas Kling 2020-09-04 21:07:01 +02:00
parent 1254447bd7
commit eb74f62201
Notes: sideshowbarker 2024-07-19 02:55:02 +09:00
2 changed files with 13 additions and 0 deletions

View File

@ -73,6 +73,8 @@ UHCIController::~UHCIController()
void UHCIController::reset()
{
stop();
write_usbcmd(UHCI_USBCMD_HOST_CONTROLLER_RESET);
// FIXME: Timeout
@ -85,6 +87,16 @@ void UHCIController::reset()
klog() << "UHCI: Reset completed!";
}
void UHCIController::stop()
{
write_usbcmd(read_usbcmd() & ~UHCI_USBCMD_RUN);
// FIXME: Timeout
for (;;) {
if (read_usbsts() & UHCI_USBSTS_HOST_CONTROLLER_HALTED)
break;
}
}
void UHCIController::handle_irq(const RegisterState&)
{
}

View File

@ -35,6 +35,7 @@ public:
virtual ~UHCIController() override;
void reset();
void stop();
private:
UHCIController(PCI::Address, PCI::ID);