From patchwork Thu Jun 27 16:27:28 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: 807835 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp891510wrn; Thu, 27 Jun 2024 09:29:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUJrZ9Z5hIRiWqmZme7Bn2NBK5Uec7sY6XrfmHX7YQBn1S11sEDauPZafV9mMuKfR4oO8ddUujgonVzZwMwieV+ X-Google-Smtp-Source: AGHT+IFYLKFbbCl/Xxbh1ceIGMmZbQZbkGmG1sSaOCBIcnB8AfmUjIAajB4vUcqDkQnnZByEVJb+ X-Received: by 2002:a0c:cb8c:0:b0:6b5:7e79:8b8a with SMTP id 6a1803df08f44-6b57e798c11mr51487706d6.50.1719505768261; Thu, 27 Jun 2024 09:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719505768; cv=none; d=google.com; s=arc-20160816; b=ZU2a/qolxFWOsQ/9XnGYzg6ZaLV4XNLGJxfereCnaLmiAoGDyivVWbljpNEVnSDNC+ /8vtVtOEQRPEoY4ZpRbyXpKCw0YdYXG58UBzy+TCJRtXKmNH+yNKwHbPxL3oHSjVJ0OI ptez8Yzkf+pPe0lY8g2KczrYGoTtWwSkACN7X2ii2JSOJzuKNTzzAMpMvBrzjSHQOeiu WV3lzSlLc4k+jvH64w8kebVnALzoWLwBuNGunMUasxNwsAvjTSWcHJvcqm/zyhrKNIVs L1wymKIgNeFw49rtMbd3Bg6c/R/Ph3m+Du/LOWBOMFauoHB2x8ki8LN4VJptBFK6vzBe 3jhQ== 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=sU/k2Rks1jINZkUZw0aLSNYbtB22cqllnIk+1At/gmc=; fh=CQ9QAhiPZZ1APu1JLxgbtxAnzrroUJn9RCDrjAjVXrk=; b=F9gNZfOKcu6q5V+g3G1B7g7iuDHFfReqDowCbj1J3Nr6JYfWjyORckLJXl1vDQa9vz ChIjf+mm5XFmoxO1KsRkb4F1QClm04ddO3h48RRbPOWdXmo1u2rWs7Knw2n/N//Kj/3+ q06p/8MXhscCPIYcMtp0F/fd7PthdLHoiqf0TkbcStts8TuWz4FWPkZB4FpciJfsTSU1 ubCrJB+eiANKkHygOsCHgP0miv/Mxg0/6/+gGX29MQdfIVED6IeqU05dzpv99/YVQHM4 RC/5t6Z55IM8AFkZQS0Gt20REjPJTy8dgz2d+SU8xRVtRVNPWSBUKzjSdi7/Xoc8L1tb D1xA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TqP9ojXb; 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 6a1803df08f44-6b59e3639f4si109416d6.115.2024.06.27.09.29.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 09:29:28 -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=TqP9ojXb; 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 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Francisco Iglesias , Bin Meng , Sai Pavan Boddu , Joel Stanley , =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- 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 = sd_sendingdata_state; - sd->data_start = 0; - sd->data_offset = 0; - return sd_r1; + return sd_cmd_to_sendingdata(sd, req, 0, + &sd->blk_written, + sizeof(sd->blk_written)); 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; - case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ - ret = sd->data[sd->data_offset ++]; - - if (sd->data_offset >= 4) - sd->state = sd_transfer_state; - break; - case 51: /* ACMD51: SEND_SCR */ ret = sd->scr[sd->data_offset ++];