Skip to content

Commit bfbd442

Browse files
glikelyJens Axboe
authored andcommitted
Fix Xilinx SystemACE driver to handle empty CF slot
The SystemACE driver does not handle an empty CF slot gracefully. An empty CF slot ends up hanging the system. This patch adds a check for the CF state and stops trying to process requests if the slot is empty. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
1 parent 059ea33 commit bfbd442

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎drivers/block/xsysace.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,28 @@ static void ace_fsm_dostate(struct ace_device *ace)
489489
ace->fsm_state, ace->id_req_count);
490490
#endif
491491

492+
/* Verify that there is actually a CF in the slot. If not, then
493+
* bail out back to the idle state and wake up all the waiters */
494+
status = ace_in32(ace, ACE_STATUS);
495+
if ((status & ACE_STATUS_CFDETECT) == 0) {
496+
ace->fsm_state = ACE_FSM_STATE_IDLE;
497+
ace->media_change = 1;
498+
set_capacity(ace->gd, 0);
499+
dev_info(ace->dev, "No CF in slot\n");
500+
501+
/* Drop all pending requests */
502+
while ((req = elv_next_request(ace->queue)) != NULL)
503+
end_request(req, 0);
504+
505+
/* Drop back to IDLE state and notify waiters */
506+
ace->fsm_state = ACE_FSM_STATE_IDLE;
507+
ace->id_result = -EIO;
508+
while (ace->id_req_count) {
509+
complete(&ace->id_completion);
510+
ace->id_req_count--;
511+
}
512+
}
513+
492514
switch (ace->fsm_state) {
493515
case ACE_FSM_STATE_IDLE:
494516
/* See if there is anything to do */

0 commit comments

Comments
 (0)