From patchwork Tue Jun 25 06:10:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 807253 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp2199810wrt; Mon, 24 Jun 2024 23:11:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV0mNvJSzkN8xnKFiJ89HIE4QCBZln8HUxWAk+8PADUMXqEk2spGSd6hXqf+xWWhy7ljgcXeJhwUe952+uAUFun X-Google-Smtp-Source: AGHT+IGn/hJ1mAUmwEJeOx8RrvWm5s3C4xw/Et16zuJanJ2yOSPiOj+Ebgog5ZXUvTs8WdW+shGa X-Received: by 2002:a05:620a:4402:b0:795:233c:6985 with SMTP id af79cd13be357-79be6cdbc11mr737128885a.4.1719295865939; Mon, 24 Jun 2024 23:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719295865; cv=none; d=google.com; s=arc-20160816; b=Yhv/OEchd2FW7cMTuDflTXRX6Jw+7FnxtUWGDNqTu03L36702zaGVRSffm+36jwPWV zkCSo9Q/hEpJNOcbPzzMI0nSFncK2HAxlDZFsApdPbX700RlZvM0dkrpcK6770ahYn9O JcdMAQlvIonD4IusWlA4P5FG0Qme3O2EK07DwwLJZnSMtUVDkncEMxAylfUqzZegScEq ujNfDK+INosUPLsYMAi4mU6aSkjtm0LSGTyE15A5eQinv8R5ij1OrmFaoA9tOSIeu0O+ 5u0JRAB1yFhlGgRXKD/FDLw0SZdRJBMHuBnx21CHn5Q1/10pmQBOLzfxZ6g994dLEoh+ FAsg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NaCEUe06tl61OBfIHTaSsFr8m9A3Vd4SzjwSutNDx7I=; fh=/JlK2oR+rOwYm4wA2OuQV1gEZ6kNvrQcYuDHZ182k9M=; b=YqqOGjhZ44CdD4vfEM0o5U8ZOAnXzked9g+3c1S21A/gvW96MB9pvDeu1QAvgfrLDG CkWEDe+aNpZKIZFmn1oMEmpcraOziTxllv/ZG5JaPvzOVTqsJwW0nDRhI8qLqS9Sv1A7 osRuIfSytQ1xtSi/3doyjsZoeQvQwCIOjbtSe/WTpxd2jl+GvNE+h8w2+F8aDhG8BwRA qVgnbjeVwWzQ/dPvODLZKdJWo+MSqnDeQhlAWnP1Z7ikzts4PWcoXxrcFJRPbbrz6+Yj 0YIqUyYLQqv55eQQ6IaVpL8tMF2twKOvyqs8jFq6C79OOMm0k/xCFdhLDobhqTG7VLT7 Tsww==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S2pfJpHV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79bce914669si1003633685a.226.2024.06.24.23.11.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jun 2024 23:11:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S2pfJpHV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sLzOM-0000Xh-VV; Tue, 25 Jun 2024 02:10:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sLzOJ-0000M8-5M for qemu-devel@nongnu.org; Tue, 25 Jun 2024 02:10:55 -0400 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sLzOG-0005dd-VS for qemu-devel@nongnu.org; Tue, 25 Jun 2024 02:10:54 -0400 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-52cdd893e5cso3030702e87.1 for ; Mon, 24 Jun 2024 23:10:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719295849; x=1719900649; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NaCEUe06tl61OBfIHTaSsFr8m9A3Vd4SzjwSutNDx7I=; b=S2pfJpHV+X9pSnPinj3hyf+z9NkMANKrMb1Uo0prf1ww3eE+yg4D0xIOw2JAu0iani Su/2Cap/ITjj8YyVSnpyM3cCqoVHrOOcbCHK+XQG+r6tVCncOG/U8iEOZOvPZpiCMN1a TV25utjgCWrytau9+Sp4Ou1ZLWoYyVJIyQfODxWMXlUeNNuPqtFL1h3pojefvG1RUnE9 RZzDWMSp8+gm0X6ri3ygPIGJin7iLXytt86BnHrFDBXthLdEE9vaAnMW4FjknUFZ5RlD C9PYUSbTNhMfS982xiT2wM2Uen/vCvvjVuaDLNkArpX+sppygQrdGBhMmDDRW0UFm9DJ B7Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719295849; x=1719900649; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NaCEUe06tl61OBfIHTaSsFr8m9A3Vd4SzjwSutNDx7I=; b=mQA55KY2sCqzcxAxvR1qMSMcE8Ci3ZdVbQr7cTlZIsBG6vN9nKhHqXtqUQO5m54ysh BWp8OxA/3JMkwgw2loSuYHoZqdOoe4uZlocHuSVm4eygD+U1QoTjks8ndQebdSUt79zb D6o+bK/0jkVKUlofqM/V71/8mt7bnezsZktQ/f4TcPs15aAYijHIUQCiEFHrf7lRizjn YmRhOx1aD1HRGO4thFXz1J90Xxlskok1cytxXIykLqtL6+UfZkm7E0+kKiv/9Jhv/BSQ QH7tQ2KlTPxNs+Hk/vS3yhKPNz2AAwrctxKnTBhTBFBfOj2g5T3MBZpwbOWhYCABKo9i ml+Q== X-Gm-Message-State: AOJu0YwLWXD+cgnXNnMcBz8mHE+ZTVZjavAV8X+LSO+N4HLokTsjXIyT JYm1VJ6dXw3Q6vrhXSY1+hWNQFyI8xNQ9t5GzxUlSXkPGl1d6zFs3QETmZfz3AdEg06lOLJOsRc i X-Received: by 2002:a05:6512:2254:b0:52c:df55:e11a with SMTP id 2adb3069b0e04-52ce18325f3mr6040195e87.9.1719295849686; Mon, 24 Jun 2024 23:10:49 -0700 (PDT) Received: from m1x-phil.lan (bd137-h02-176-184-46-22.dsl.sta.abo.bbox.fr. [176.184.46.22]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-366388c4282sm11956753f8f.31.2024.06.24.23.10.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 24 Jun 2024 23:10:49 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?C=C3=A9dric_Le_Goater?= , qemu-block@nongnu.org, Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 05/11] hw/sd/sdcard: Convert READ_SINGLE_BLOCK to generic_read_byte (CMD17) Date: Tue, 25 Jun 2024 08:10:09 +0200 Message-ID: <20240625061015.24095-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240625061015.24095-1-philmd@linaro.org> References: <20240625061015.24095-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=philmd@linaro.org; helo=mail-lf1-x12f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 9aaa78a334..6af7b3f034 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1383,11 +1383,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) if (!address_in_range(sd, "READ_SINGLE_BLOCK", addr, sd->blk_len)) { return sd_r1; } - - sd->state = sd_sendingdata_state; - sd->data_start = addr; - sd->data_offset = 0; - return sd_r1; + sd_blk_read(sd, addr, sd->blk_len); + return sd_cmd_to_sendingdata(sd, req, addr, NULL, sd->blk_len); default: break; @@ -2122,6 +2119,7 @@ uint8_t sd_read_byte(SDState *sd) case 6: /* CMD6: SWITCH_FUNCTION */ case 9: /* CMD9: SEND_CSD */ case 10: /* CMD10: SEND_CID */ + case 17: /* CMD17: READ_SINGLE_BLOCK */ sd_generic_read_byte(sd, &ret); break; @@ -2132,16 +2130,6 @@ uint8_t sd_read_byte(SDState *sd) sd->state = sd_transfer_state; break; - case 17: /* CMD17: READ_SINGLE_BLOCK */ - if (sd->data_offset == 0) { - sd_blk_read(sd, sd->data_start, io_len); - } - ret = sd->data[sd->data_offset ++]; - - if (sd->data_offset >= io_len) - sd->state = sd_transfer_state; - break; - case 18: /* CMD18: READ_MULTIPLE_BLOCK */ if (sd->data_offset == 0) { if (!address_in_range(sd, "READ_MULTIPLE_BLOCK",