From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=hGPynIAX; spf=pass (domain: linaro.org, ip: 209.85.221.65, mailfrom: leif.lindholm@linaro.org) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by groups.io with SMTP; Fri, 03 May 2019 05:19:07 -0700 Received: by mail-wr1-f65.google.com with SMTP id k16so7629360wrn.5 for ; Fri, 03 May 2019 05:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NAkIi3Odv4fz6WQFdaCU7bIF5ZiVGZRx1lQnn+yi7J4=; b=hGPynIAXAxYyvCZ7puZeT4Vi7NMkkzidb16SoYyrFbBBJEOMOyLgSYYH/0/79APCYR CYES9OgaGS2Hwqrl6U90sIslZWe8bIaIi6BSNH6Puz0VwcJs/ZKSQ4LLyDTIQf1HcDO4 XA1qKJiYThW8OwwwCgJaOezpb7aEXnIdWFGWTnJWeTHKCEK9P//Pp3xAqKLp0DJMyizt POOYt7jU+GBNLtqrLqp1S6rat2T9+KLHfy12nv39vYMdYUMTjBGt8guxJtVOPmJmz6hy Q9Fbg1DawAk8WoC01yqeyDkjJOo4B36TdCngzbiNg8mOEYEqSfgfuqy2i3UkEh5gDEpP zrlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=NAkIi3Odv4fz6WQFdaCU7bIF5ZiVGZRx1lQnn+yi7J4=; b=tMqrEgzGtNzMSnlrwcpeEsGlaRp04yOhf+53vqsjvz+RfMHndP75z5D1XdahgmI+YH gq8S5PFq5BA+woErng5acwnNsFmeH1NbNcB8GajhmZepxuWOahqv8t4+1k9XyRV7EzNR 5MgEzHX6bA1p1rgx0G+OfX2LHAtHwAZ//nkzx2Z0lnd/H8Rmo0zXOhZ6wBC4fxHEpTmj VWSIjymmqWs9/AP9EnY085GIUXeXpHWpopW7jqwq1y3iKcFqxqkLNE3Jh/C3DXJxOt3c 4Zvde39zUSz01JErfdIuPVtP8Tg0Sv5h7eZCZ/HFFqsf+brRKte/6hBE1sLme1/BOrLE x8DQ== X-Gm-Message-State: APjAAAWaXem5JI+OeUvzKIkFCzjDPfRYKd8+mNN4/YcM4M2HDjuHTwn0 vvcmSC3xv3k6itEBNU+Wo9rYgA== X-Google-Smtp-Source: APXvYqzl/AaK0xU45dEf224seKDxkWwOeBfqRlLHC7rjzyANfr+vsNLdz6HcfdU4knb5lC9yqcePnQ== X-Received: by 2002:adf:b611:: with SMTP id f17mr7052482wre.162.1556885945500; Fri, 03 May 2019 05:19:05 -0700 (PDT) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id w14sm2067050wmi.2.2019.05.03.05.19.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 May 2019 05:19:04 -0700 (PDT) Date: Fri, 3 May 2019 13:19:03 +0100 From: "Leif Lindholm" To: tien.hock.loh@intel.com Cc: devel@edk2.groups.io, thloh85@gmail.com, Ard Biesheuvel Subject: Re: [[PATCH v2] 7/7] EmbeddedPkg: Fix DwEmmc driver bugs Message-ID: <20190503121903.4wvqxfx6xucaliwc@bivouac.eciton.net> References: <1556854023-5486-1-git-send-email-tien.hock.loh@intel.com> <1556854023-5486-8-git-send-email-tien.hock.loh@intel.com> MIME-Version: 1.0 In-Reply-To: <1556854023-5486-8-git-send-email-tien.hock.loh@intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, May 03, 2019 at 11:27:03AM +0800, tien.hock.loh@intel.com wrote: > From: "Tien Hock, Loh" > > Add support for reading data that is less than DWEMMC_BLOCK_SIZE, otherwise > it would read bigger data than requested and cause errors > > Signed-off-by: "Tien Hock, Loh" > Cc: Leif Lindholm > Cc: Ard Biesheuvel > --- > EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c > index c38b5a4..4183ad4 100644 > --- a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c > +++ b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c > @@ -495,7 +495,10 @@ PrepareDmaData ( > > Cnt = (Length + DWEMMC_DMA_BUF_SIZE - 1) / DWEMMC_DMA_BUF_SIZE; > Blks = (Length + DWEMMC_BLOCK_SIZE - 1) / DWEMMC_BLOCK_SIZE; Could we add a BlockSize variable instead?... > - Length = DWEMMC_BLOCK_SIZE * Blks; > + > + if(Length >= DWEMMC_BLOCK_SIZE) { > + Length = DWEMMC_BLOCK_SIZE * Blks; > + } > > for (Idx = 0; Idx < Cnt; Idx++) { > (IdmacDesc + Idx)->Des0 = DWEMMC_IDMAC_DES0_OWN | DWEMMC_IDMAC_DES0_CH | > @@ -533,11 +536,18 @@ StartDma ( > Data |= DWEMMC_CTRL_INT_EN | DWEMMC_CTRL_DMA_EN | DWEMMC_CTRL_IDMAC_EN; > MmioWrite32 (DWEMMC_CTRL, Data); > Data = MmioRead32 (DWEMMC_BMOD); > + Drop unrelated whitespace addition. > Data |= DWEMMC_IDMAC_ENABLE | DWEMMC_IDMAC_FB; > MmioWrite32 (DWEMMC_BMOD, Data); > And do if (Length < DWEMMC_BLOCK_SIZE) { BlockSize = Length; } else { BlockSize = DWEMMC_BLOCK_SIZE; } MmioWrite32 (DWEMMC_BLKSIZ, BlockSize); MmioWrite32 (DWEMMC_BYTCNT, Length); instead? (I have no comments on the patches I have not responded to at this point, but I want to see their proper subject lines before giving a R-b:) / Leif > - MmioWrite32 (DWEMMC_BLKSIZ, DWEMMC_BLOCK_SIZE); > - MmioWrite32 (DWEMMC_BYTCNT, Length); > + if(Length < DWEMMC_BLOCK_SIZE) { > + MmioWrite32 (DWEMMC_BLKSIZ, Length); > + MmioWrite32 (DWEMMC_BYTCNT, Length); > + } > + else { > + MmioWrite32 (DWEMMC_BLKSIZ, DWEMMC_BLOCK_SIZE); > + MmioWrite32 (DWEMMC_BYTCNT, Length); > + } > } > > EFI_STATUS > -- > 2.2.2 >