From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=Vr8SxwhM; spf=none, err=SPF record not found (domain: semihalf.com, ip: 209.85.167.65, mailfrom: pdk@semihalf.com) Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by groups.io with SMTP; Mon, 09 Sep 2019 08:53:02 -0700 Received: by mail-lf1-f65.google.com with SMTP id d10so10922292lfi.0 for ; Mon, 09 Sep 2019 08:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7ubyiRM1dsQ9FevB2CN1hZQrBFCsWnchjkb1tU+LUMA=; b=Vr8SxwhMa74o8BRrrUy/kjXNIIJVCdPXuB0CIATBGZkHG6Tqe2dNudzQG2eQHznouz hsoTvhLw2HT4avZgd/QC2gIGR1GUYV3OxQ9ArhliLAvtYoEN+VzUUSLoq48qls3tfeXh BHPcq7B0E1X1UIS9y2WgvpR+JX9eROnvYrnlVOUr7NBxtb1OsDHFlKIzh8qhV3ikGQcD bdp63WHepo6N5bVAfeBBHZyLoKxwBYJ2vyI9IDD5GVX1E4laYPrOWlYTQsN389FSjoJZ MnXlfWFTBzvp6fa9m+jJfVRSIFGOB+odFp7+oDHThMO0J///vLTVN4kaHuasbaIJ8zp8 SbWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7ubyiRM1dsQ9FevB2CN1hZQrBFCsWnchjkb1tU+LUMA=; b=gjW4RbZAOhxu+j19M3vLZzI+BFnqapX1r8KQJgzndl/tvqUnaKcCDVBcUHXe7TiIEH lyQ5sBHmhC+P7yRTgCnFE9821G4vp6EhsC8ZIg3MPcdMNW7jZyfb7raJbPRe+YFmfstv paphM/JSPlAZPHWtip/IteE4+RtRd8tUfQBV1s/pTdTctng/p33Yv6+uUVePksb/8Ghr rX10wEkJHECZ5JZK8YTibNSb6dY3y6gikKmn7ifUBdptakI7wJF69hwgW0uDrrzKYuH9 yvN5MBp51jRhysoqkiJ+rlyrIcvVeep5zFjdgR2+aJue4iVjtucDCgIE/TgBT0QTjH+M OfGg== X-Gm-Message-State: APjAAAUU3m9NyAxTRtwcoQKSjXME5fqZowVM6g4/2CuIRqbwXgC7tzVb U1yMDFSc28hRMPx6DiMytPijv0B8J+YAKA== X-Google-Smtp-Source: APXvYqxWSW5zsrngGfU+Ny8SWHhumJ/u7HllkLpV/C7LNEWuq6SjNwEWk96pX/fPYS8X5dI4aHrd4A== X-Received: by 2002:ac2:4a70:: with SMTP id q16mr16914203lfp.4.1568044380350; Mon, 09 Sep 2019 08:53:00 -0700 (PDT) Return-Path: Received: from pdkmachine.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id d8sm3221238ljj.59.2019.09.09.08.52.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Sep 2019 08:52:59 -0700 (PDT) From: Patryk Duda To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, mw@semihalf.com, jsd@semihalf.com, Patryk Duda Subject: [edk2-platforms: PATCH 1/2] Marvell/Drivers: MvSpiFlashDxe: Fix sector number obtaining Date: Mon, 9 Sep 2019 17:52:11 +0200 Message-Id: <20190909155212.30338-2-pdk@semihalf.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190909155212.30338-1-pdk@semihalf.com> References: <20190909155212.30338-1-pdk@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This commit fixes bug which was causing one sector of bytes to be ommited. It was discovered when bytes to be written was 0 in last block, but total count of bytes was multiplication of sector size. It turned out that in every case one sector of data was missing. This bug can be fixed in various ways, but this solution fixes hypotetical situation in which total bytes count is smaller than sector size. Signed-off-by: Patryk Duda --- Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c b/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c index 02bc281c8b..db12adb764 100755 --- a/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c +++ b/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c @@ -388,7 +388,7 @@ MvSpiFlashUpdateWithProgress ( UINT8 *TmpBuf; SectorSize = Slave->Info->SectorSize; - SectorNum = ByteCount / SectorSize; + SectorNum = (ByteCount / SectorSize) + 1; ToUpdate = SectorSize; TmpBuf = (UINT8 *)AllocateZeroPool (SectorSize); -- 2.21.0