Message ID | 20240628070216.92609-36-philmd@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp222979wrr; Fri, 28 Jun 2024 00:07:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXS7U+xcr8nqIEZx9RPICkmL9P9b5/41csnGAvyvSH4gmA7pM0xC+6q9s2E62a9lwraPRmkOvIy/15Pzz4u4/5e X-Google-Smtp-Source: AGHT+IEjGqOTb75YmBuHn1xn7eOK+GpLut5RljNQTi+OnvtOXARhOwo3oEC09ybZgD4y79nibPV7 X-Received: by 2002:a05:6830:a52:b0:701:f8e0:9997 with SMTP id 46e09a7af769-701f8e09e28mr1580567a34.16.1719558455442; Fri, 28 Jun 2024 00:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719558455; cv=none; d=google.com; s=arc-20160816; b=G5kJW+4yidAIPGLK4sWBHAPCk7R2Q8FvOXH/YUzRkpaow5QpF/DY6TpepzMR4pdWTN XBW+dxuQ81J213LY5uJIAJ0X/OS6KbU1kOVQqfC+VZRU6rTWlafjCxC9TMJ/hW9fOV9V t+S6R/GWLwijUE/RU78YOvFke2QYoPOU5CI+EGAgiPIP5wSN0B7CIwwx0ui5CsWjykJ2 02ikZ9eTBF1FnmlfxqhjorgWmu15gD07ug1MgPoUiGrLv00DsrR0NUQXhM/ZKn8FVSHI 1K199B3x0Ud5HUEKDPrPzuD5aLplNzybA4OOtwStC9vuoycPBtqRmWWZNCNjh8EZK7gV TqRg== 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:to:from :dkim-signature; bh=lRVCvBojEsyxAg7JZRES3P5o6lr6YCg7S7r2PnPDGt0=; fh=Vqz0ILX7NeXJwCG5xiS+Wtk94IhOmAmLtOfN3kRbil4=; b=yH2ZQmVSc3+gMa8yL66wqPdkBolMA+vd+SEKorYaD6Lh2PAQc93E3QFz0N1HQBrDCU 1s+KxHhYT1kOOOeTZr3+yJjdhjOQAizOUYxWU3j7ERhK0tJ0Va03umSSNNFa7NOFso2M h/kBKxFyWFC6/pfl9tq9g0jPTRWq00tJ4ogjW9DO4eMHk44DuOt3qoyue7vfFJM5TAzQ ISJ06kTMQScEJrWq9JS6cw9vz8yutEYYR06jP6GuO7anCIoXq6bWRnc04WGVIvhs5MdM hIJupsPar3WA53uYTt+ZXm/kttJO3zancQvfbewCCfeGDDsY13JBkxQRl7hBFArgJ0ma grog==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="X9QapbV/"; 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: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79d69260b63si134214485a.14.2024.06.28.00.07.35 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Jun 2024 00:07:35 -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="X9QapbV/"; 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 <qemu-devel-bounces@nongnu.org>) id 1sN5gG-0000Bw-1W; Fri, 28 Jun 2024 03:06:00 -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 <philmd@linaro.org>) id 1sN5gB-0007rZ-RA for qemu-devel@nongnu.org; Fri, 28 Jun 2024 03:05:57 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1sN5g9-0003Cp-6s for qemu-devel@nongnu.org; Fri, 28 Jun 2024 03:05:54 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-366df217347so208912f8f.0 for <qemu-devel@nongnu.org>; Fri, 28 Jun 2024 00:05:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719558350; x=1720163150; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=lRVCvBojEsyxAg7JZRES3P5o6lr6YCg7S7r2PnPDGt0=; b=X9QapbV/e5yFZDq9ITff/b+khrLeetST0d/GdlsCYMaPe+Btu3m7Ppy1mCBdqMLgHd sibK1ZWE87dDGSruNI8jzXosiVKWypZJ1B8QQHUQ+Na13wekQ+3a3Yt42h22Vm/ypFsA FTtLK5yrMiXPc2F0TID3FWKS7x5522L59e+fSFX9E4dBnHRJLiCdW3RGjvEhhHgpjA5B 57mf3dOpCFlZvsbInB5lBecISjBK1S1xPu8Jeqem3j5WGQ67LnjCpEB0uOBbmdSDYjRQ H8QCKA/a0BhbC6AGzzzRmPGQfg+Ak4vptShTWxY1jQZ+q8VE3wWPLmPqOgM8KJYbv2WZ DJ4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719558350; x=1720163150; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lRVCvBojEsyxAg7JZRES3P5o6lr6YCg7S7r2PnPDGt0=; b=Ynn4VlmNsIiY3Sg/H3YMp7e4UGx/kxvVhVt2PFMdacqjcdkF0TS6mWuzoZD21Nq2hU xuMVbmne9sWA5c3DLzAsTkMKFyNhn9W4DmEshWa96IJoZpxRH7cEC0XwcSkjxuYeV3q1 p12nuIz2ZqaFiSXwb/UqINqvBiZuA+C6o52xfoDI2z/lfw9LC3EYMfx/0Cj8Kf0GQmQX 3lbYUl2Rq0wzX3olOh2k6O7lDMcwjtGEjQ/+pXF1TX2YEbO8AJILerSRvFUxgnFhgXSE wfMIQP4BErTElc96/Pkiqs4TlqliHqCFzUFYdEarlhouP+1kxlOhn4c4lbBbjtdO3dcO 9OfQ== X-Gm-Message-State: AOJu0YxLc+dPMkDS9NNAhsrkzrjecPS5ApEUffuvzsiYXmOKPaL7tVsn 668cWORpL2rbZXaZjsiHa4hmScOjT0DW7psFiMo+G3r3s/RuRXEjpyb3mMyXcHC07A1O9TtTQIe rmcY= X-Received: by 2002:adf:f98c:0:b0:360:73b0:e58e with SMTP id ffacd0b85a97d-366e9492ca0mr9116033f8f.26.1719558350581; Fri, 28 Jun 2024 00:05:50 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0cd784sm1348789f8f.7.2024.06.28.00.05.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 28 Jun 2024 00:05:50 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org> To: qemu-devel@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@kaod.org> Subject: [PATCH v42 35/98] hw/sd/sdcard: Convert GEN_CMD to generic_write_byte (CMD56) Date: Fri, 28 Jun 2024 09:01:11 +0200 Message-ID: <20240628070216.92609-36-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240628070216.92609-1-philmd@linaro.org> References: <20240628070216.92609-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
hw/sd/sdcard: Add eMMC support
|
expand
|
On 6/28/24 9:01 AM, Philippe Mathieu-Daudé wrote: > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Cédric Le Goater <clg@redhat.com> Thanks, C. > --- > hw/sd/sd.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/hw/sd/sd.c b/hw/sd/sd.c > index 0cb528b0b2..f9708064d0 100644 > --- a/hw/sd/sd.c > +++ b/hw/sd/sd.c > @@ -1657,14 +1657,12 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) > case 56: /* CMD56: GEN_CMD */ > switch (sd->state) { > case sd_transfer_state: > - sd->data_offset = 0; > if (req.arg & 1) { > return sd_cmd_to_sendingdata(sd, req, 0, > sd->vendor_data, > sizeof(sd->vendor_data)); > } > - sd->state = sd_receivingdata_state; > - return sd_r1; > + return sd_cmd_to_receivingdata(sd, req, 0, sizeof(sd->vendor_data)); > > default: > break; > @@ -2109,9 +2107,8 @@ void sd_write_byte(SDState *sd, uint8_t value) > break; > > case 56: /* CMD56: GEN_CMD */ > - sd->vendor_data[sd->data_offset ++] = value; > - if (sd->data_offset >= sizeof(sd->vendor_data)) { > - sd->state = sd_transfer_state; > + if (sd_generic_write_byte(sd, value)) { > + memcpy(sd->vendor_data, sd->data, sizeof(sd->vendor_data)); > } > break; >
diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 0cb528b0b2..f9708064d0 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1657,14 +1657,12 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) case 56: /* CMD56: GEN_CMD */ switch (sd->state) { case sd_transfer_state: - sd->data_offset = 0; if (req.arg & 1) { return sd_cmd_to_sendingdata(sd, req, 0, sd->vendor_data, sizeof(sd->vendor_data)); } - sd->state = sd_receivingdata_state; - return sd_r1; + return sd_cmd_to_receivingdata(sd, req, 0, sizeof(sd->vendor_data)); default: break; @@ -2109,9 +2107,8 @@ void sd_write_byte(SDState *sd, uint8_t value) break; case 56: /* CMD56: GEN_CMD */ - sd->vendor_data[sd->data_offset ++] = value; - if (sd->data_offset >= sizeof(sd->vendor_data)) { - sd->state = sd_transfer_state; + if (sd_generic_write_byte(sd, value)) { + memcpy(sd->vendor_data, sd->data, sizeof(sd->vendor_data)); } break;
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/sd/sd.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)