From ab9943450324a0401ec2e9a0030de6a17347f51b Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 27 Jun 2021 19:15:31 +0200 Subject: [PATCH] sdhci: actually wait for commands to complete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code allowed execution to continue as soon as the "command inhibit" bit was cleared. This is incorrect: we need to wait for a command result (either command complete, or timeout) to be available before continuing. This should fix #17031. Change-Id: I8f3fe60c2e47582b399952b19c05c6ed2161afd7 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4121 Reviewed-by: Jérôme Duval Tested-by: Commit checker robot --- src/add-ons/kernel/busses/mmc/sdhci_pci.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp b/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp index 0b8eb660ca..796a20ae94 100644 --- a/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp +++ b/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp @@ -258,8 +258,7 @@ SdhciBus::ExecuteCommand(uint8_t command, uint32_t argument, uint32_t* response) // Wait for command response to be available ("command complete" interrupt) TRACE("Wait for command complete..."); - while (fRegisters->present_state.CommandInhibit() - && (fCommandResult == 0)) { + while (fCommandResult == 0) { acquire_sem(fSemaphore); TRACE("command complete sem acquired, status: %x\n", fCommandResult); TRACE("real status = %x command line busy: %d\n",