From nobody Mon Nov 25 01:44:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1719505768; cv=none; d=zohomail.com; s=zohoarc; b=MfwJ4jl6qa9PLtruJgiWI70WwJF2cD8wpV5mpHrMEO7e/GWhSeT3P0qJV1Kgk8gcPVnFwd6AlBmaPpQdftCCQ72MwuXsq2ciBMuNllQpcHxi5sRskYQ8V6HGfHqNodep3JVrzAJkOjcfp9pVGqvjIuwFHWUVpogBUXJDZ1D2ly8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719505768; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sU/k2Rks1jINZkUZw0aLSNYbtB22cqllnIk+1At/gmc=; b=dDj9IgjqhcQh1j9/hs3Cu1t2k9RxoFZ2hmTYD3HNB1DBKZj0A1VV0qUU4HvhQx4Uj/KymgA47MAgkz2YlWRrYtrOxos41Ga6Fqno88tSZk5vy3iEn3Jo2Yi4sh/sOfxQ4R86YiNDSpb+ZHrHu08e8dUWPs7bR2X9KEqXwgYouUg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171950576874285.53596088809957; Thu, 27 Jun 2024 09:29:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMrzz-0006vI-00; Thu, 27 Jun 2024 12:29:27 -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 1sMrzx-0006q2-IO for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:29:25 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMrzq-0003aI-4W for qemu-devel@nongnu.org; Thu, 27 Jun 2024 12:29:25 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-52ce01403f6so5520727e87.0 for ; Thu, 27 Jun 2024 09:29:17 -0700 (PDT) Received: from localhost.localdomain (33.red-95-127-46.staticip.rima-tde.net. [95.127.46.33]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3674357c089sm2415473f8f.7.2024.06.27.09.29.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 09:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719505756; x=1720110556; 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=sU/k2Rks1jINZkUZw0aLSNYbtB22cqllnIk+1At/gmc=; b=TqP9ojXbJFcm1yNC/pr4FP1p946PY4m1Y+0dm6be54VvGs9u8DRH3Rtb646ouGkBZC 0nq2k9Ih4/zo2Di3frvKD3Wh07Ej7FGWQziQr3tZ7E2br43uQMhqg3DkucFYWDaQGbiS 2NDPdrZ6MDItKWc4Fx/he1vWKb/w7ycvkkzW33J4zh2QHyihwoAw2VoLLIIMsYs6sOvK DDyWECjZS0CtkR5tzsGJeaQX014PNh2Ke/hLx4E5q6iBnsIfRw01W8iVg1PMNCzEusBj zPyGedHcy5ZgkUb73TAWx0W6wXcJna7xFk/dQh74y7hWe5CkzFB2ZS0iEmJex8TJjgrt 21Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719505756; x=1720110556; 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=sU/k2Rks1jINZkUZw0aLSNYbtB22cqllnIk+1At/gmc=; b=xJkzD9g35yl77afFrrYVQndkyIG85TsFGzWQ+6mGbSa/69lLnJkYNOcuEx7TLmoj4t lfONqZ5FWBmIqxOikGFlSagp3M2eTk47HISxwL3C3U/+8ENd0OU95m6Q/tPCv40PL743 F5a/6Z4za3j7sCa4tvNyBpoA+t7w41usR8ep0btnsRODwYIiudbkndGnC75DdUB/xUIz pd3xjZFlCmh71Mf9kwgCgZGqBvjMvhMVZd+Z/O8Ai/fy+uClgTjM/C+yV5yhLRZzXFbg nFLuNjo+ZKu8QOcu+o8TNx5b002dr/BFPvmv07aoj5g9YfT7QY/b9YHhGfj59s+2zCwt m6PQ== X-Gm-Message-State: AOJu0YzziWd6rMMXJEwWFUwAbiaoNmsNGOeQ5S65pvCEBLEnruhQQHLY UkFGWJIZ96zfOoe1y4ETOe6D7pnG6ewDMq1rxQ1RczPYYe2kO1bsi6O3MpH6hhH1jqs3w3oxrnk qMkU= X-Google-Smtp-Source: AGHT+IHVx04c6zs3uE+wkMDQmBW/+FLRPc3iuxJ3WbDGxnyqNrR5Vx9zRuGSaTsFTsXAzpnK9r3xOQ== X-Received: by 2002:a05:6512:2509:b0:52d:b0a5:cf3c with SMTP id 2adb3069b0e04-52db0a5e327mr5459783e87.40.1719505755838; Thu, 27 Jun 2024 09:29:15 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Francisco Iglesias , Bin Meng , Sai Pavan Boddu , Joel Stanley , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Subject: [PATCH v2 10/11] hw/sd/sdcard: Convert SEND_NUM_WR_BLOCKS to generic_read_byte (ACMD22) Date: Thu, 27 Jun 2024 18:27:28 +0200 Message-ID: <20240627162729.80909-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627162729.80909-1-philmd@linaro.org> References: <20240627162729.80909-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=philmd@linaro.org; helo=mail-lf1-x133.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=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1719505769958100003 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 1c4811f410..8d02cd9a26 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1715,11 +1715,9 @@ static sd_rsp_type_t sd_app_command(SDState *sd, case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ switch (sd->state) { case sd_transfer_state: - stl_be_p(sd->data, sd->blk_written); - sd->state =3D sd_sendingdata_state; - sd->data_start =3D 0; - sd->data_offset =3D 0; - return sd_r1; + return sd_cmd_to_sendingdata(sd, req, 0, + &sd->blk_written, + sizeof(sd->blk_written)); =20 default: break; @@ -2138,6 +2136,7 @@ uint8_t sd_read_byte(SDState *sd) case 13: /* ACMD13: SD_STATUS */ case 17: /* CMD17: READ_SINGLE_BLOCK */ case 19: /* CMD19: SEND_TUNING_BLOCK (SD) */ + case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ case 30: /* CMD30: SEND_WRITE_PROT */ case 56: /* CMD56: GEN_CMD */ sd_generic_read_byte(sd, &ret); @@ -2167,13 +2166,6 @@ uint8_t sd_read_byte(SDState *sd) } break; =20 - case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ - ret =3D sd->data[sd->data_offset ++]; - - if (sd->data_offset >=3D 4) - sd->state =3D sd_transfer_state; - break; - case 51: /* ACMD51: SEND_SCR */ ret =3D sd->scr[sd->data_offset ++]; =20 --=20 2.41.0