From patchwork Thu Feb 22 15:23:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 129281 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2155886edc; Thu, 22 Feb 2018 07:43:02 -0800 (PST) X-Google-Smtp-Source: AH8x224S0URg2qr0m4i2Am6ntPvEx9JVJHbfMl1Tnxj54pEbHphqZwYS/YbO9m9ADqDEoVhnzuJv X-Received: by 10.129.168.10 with SMTP id f10mr1331028ywh.486.1519314182012; Thu, 22 Feb 2018 07:43:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519314182; cv=none; d=google.com; s=arc-20160816; b=B5cwGcFmkApMag8s9a23A7kbCueUB1/Wa6HvxSeIW/anOtt/Dyv2EJhfGuRicLca33 Iosdz9VhZhzAdlTS4+R90tLf1IDBAIlLpthm5Yk6XH75NlxpNN2eAf9NIbhMJD4tdmC0 Ecl55QtpgVA8gIf/uyL9ti4f3keZA5oXLVaP7wR6WBbAIE8GtJ29K8nsH+4qa/Lg6z8n 1Hxsv9w2VyG0nLVb9X5WRruNEEjWdQLOJ83DYL6Fe1jp5CWI3876YzDqNThwR5EtSbAn oDW41cpZ9J7ZJCWhSDEKXyZP/fTudTNjVsJr02CluRtoceubHxY4DKlcMD2WN26Ec2U7 1anw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=aWpVUc24TmwSTeHufT+oCdpiovmjgiytaBkF74HyzFY=; b=NO9WjrWSXIJZGXfkNDLv0E61hllxpAtEgjOi+Tso8jtNkUtW7sFSeaG52wd6wC2ixB 7EBVlBHy5smuTE2xY1ecIqHBNq9ckX3F4Jyc+WI8B31eXV4vEJS31W6KNtuX4DAM2Lbx JRf3ynC9Ei8sBb5gPFVbr20qDzARtMGWXbGqrb75iRnDO8jqKEkJ5sm5ZCfAPsumRAdg rV02KKKxZbLr7lJYuIST+Ot5P9pIS39f/S3tfy+NxOCR1O51fTwJkp9oKv91FQ3ew/mD gIo3XwhIZmpQhJ7k5VbHr/k8VN708rm8qFPG6r0J7ojBc9CJgEVVWiYJ6NR+m8dzVWx0 RvbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t6-v6si49326ybj.774.2018.02.22.07.43.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Feb 2018 07:43:02 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eot1R-0004Yt-Bi for patch@linaro.org; Thu, 22 Feb 2018 10:43:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eosir-00056j-QT for qemu-devel@nongnu.org; Thu, 22 Feb 2018 10:23:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eosir-0001xf-2I for qemu-devel@nongnu.org; Thu, 22 Feb 2018 10:23:49 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:46620) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eosiq-0001wQ-RH for qemu-devel@nongnu.org; Thu, 22 Feb 2018 10:23:48 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1eosip-00027B-TL for qemu-devel@nongnu.org; Thu, 22 Feb 2018 15:23:47 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 22 Feb 2018 15:23:04 +0000 Message-Id: <20180222152307.7499-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180222152307.7499-1-peter.maydell@linaro.org> References: <20180222152307.7499-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 29/32] sdcard: check the card is in correct state for APP CMD (CMD55) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Message-id: 20180215221325.7611-14-f4bug@amsat.org Signed-off-by: Peter Maydell --- hw/sd/sd.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.16.1 diff --git a/hw/sd/sd.c b/hw/sd/sd.c index ff7ace3491..d6dd2b9a15 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1386,6 +1386,14 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, /* Application specific commands (Class 8) */ case 55: /* CMD55: APP_CMD */ + switch (sd->state) { + case sd_ready_state: + case sd_identification_state: + case sd_inactive_state: + return sd_illegal; + default: + break; + } if (!sd->spi) { if (sd->rca != rca) { return sd_r0;