qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [Bug 597641] [NEW] SD card state change from ident to stby


From: Rudrajit Sengupta
Subject: [Qemu-devel] [Bug 597641] [NEW] SD card state change from ident to stby
Date: Wed, 23 Jun 2010 10:24:44 -0000

Public bug reported:

My environment
host : Linux PC(2.6.29.4)
Target: ARM-CortexA8
I am not running any OS on the target.

Below is my command line:
../src/arm-softmmu/qemu-system-arm  -M FPGA_NOOS -kernel elfImage -nographic 
-sd sd.img

Problem scenario
1. CMD13 issued immediately after identication phase reports SD card state as 
"ident" instead of "stby". 
2. class 0(basic) commands are reported as "ILLEGAL_COMMAND" after the card is 
locked.

Observation
1. In function sd_do_command(), the status of *previous* command is reflected 
only after the call to sd_set_status(sd). The variable "last_status" should 
contain the updated value of sd->card_status in order to correctly indicate 
*last command's* card status. 
2. A "not" condition is missing in the if statement in the function 
sd_do_command(), thereby falsely exiting the function for class0 commands 
issued after card is locked.

Below is the patch file that seems to be taking care of the above two problems.
*** sd-0.12.4.c 2010-06-23 13:56:05.000000000 +0530
--- sd-0.12.4.rudra.c   2010-06-23 14:08:10.000000000 +0530
***************
*** 1265,1278 ****

      sd->card_status &= ~CARD_STATUS_B;
      sd_set_status(sd);

      if (last_status & CARD_IS_LOCKED)
!         if (((last_status & APP_CMD) &&
                                   req->cmd == 41) ||
                          (!(last_status & APP_CMD) &&
                           (sd_cmd_class[req->cmd] == 0 ||
                            sd_cmd_class[req->cmd] == 7 ||
!                           req->cmd == 16 || req->cmd == 55))) {
              sd->card_status |= ILLEGAL_COMMAND;
              fprintf(stderr, "SD: Card is locked\n");
              return 0;
--- 1265,1279 ----

      sd->card_status &= ~CARD_STATUS_B;
      sd_set_status(sd);
+     last_status = sd->card_status;

      if (last_status & CARD_IS_LOCKED)
!         if (!(((last_status & APP_CMD) &&
                                   req->cmd == 41) ||
                          (!(last_status & APP_CMD) &&
                           (sd_cmd_class[req->cmd] == 0 ||
                            sd_cmd_class[req->cmd] == 7 ||
!                           req->cmd == 16 || req->cmd == 55)))) {
              sd->card_status |= ILLEGAL_COMMAND;
              fprintf(stderr, "SD: Card is locked\n");
              return 0;

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
SD card state change from ident to stby
https://bugs.launchpad.net/bugs/597641
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
My environment
host : Linux PC(2.6.29.4)
Target: ARM-CortexA8
I am not running any OS on the target.

Below is my command line:
../src/arm-softmmu/qemu-system-arm  -M FPGA_NOOS -kernel elfImage -nographic 
-sd sd.img

Problem scenario
1. CMD13 issued immediately after identication phase reports SD card state as 
"ident" instead of "stby". 
2. class 0(basic) commands are reported as "ILLEGAL_COMMAND" after the card is 
locked.

Observation
1. In function sd_do_command(), the status of *previous* command is reflected 
only after the call to sd_set_status(sd). The variable "last_status" should 
contain the updated value of sd->card_status in order to correctly indicate 
*last command's* card status. 
2. A "not" condition is missing in the if statement in the function 
sd_do_command(), thereby falsely exiting the function for class0 commands 
issued after card is locked.

Below is the patch file that seems to be taking care of the above two problems.
*** sd-0.12.4.c 2010-06-23 13:56:05.000000000 +0530
--- sd-0.12.4.rudra.c   2010-06-23 14:08:10.000000000 +0530
***************
*** 1265,1278 ****

      sd->card_status &= ~CARD_STATUS_B;
      sd_set_status(sd);

      if (last_status & CARD_IS_LOCKED)
!         if (((last_status & APP_CMD) &&
                                   req->cmd == 41) ||
                          (!(last_status & APP_CMD) &&
                           (sd_cmd_class[req->cmd] == 0 ||
                            sd_cmd_class[req->cmd] == 7 ||
!                           req->cmd == 16 || req->cmd == 55))) {
              sd->card_status |= ILLEGAL_COMMAND;
              fprintf(stderr, "SD: Card is locked\n");
              return 0;
--- 1265,1279 ----

      sd->card_status &= ~CARD_STATUS_B;
      sd_set_status(sd);
+     last_status = sd->card_status;

      if (last_status & CARD_IS_LOCKED)
!         if (!(((last_status & APP_CMD) &&
                                   req->cmd == 41) ||
                          (!(last_status & APP_CMD) &&
                           (sd_cmd_class[req->cmd] == 0 ||
                            sd_cmd_class[req->cmd] == 7 ||
!                           req->cmd == 16 || req->cmd == 55)))) {
              sd->card_status |= ILLEGAL_COMMAND;
              fprintf(stderr, "SD: Card is locked\n");
              return 0;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]