sdhci: actually wait for commands to complete

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 <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Adrien Destugues
2021-06-28 12:11:54 +00:00
committed by Adrien Destugues
parent 32e0fe7000
commit ab99434503
+1 -2
View File
@@ -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",