From patchwork Fri Feb 26 09:27:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 62978 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp608632lbc; Fri, 26 Feb 2016 01:28:46 -0800 (PST) X-Received: by 10.66.129.130 with SMTP id nw2mr683521pab.80.1456478926587; Fri, 26 Feb 2016 01:28:46 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id aj1si3280635pad.244.2016.02.26.01.28.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Feb 2016 01:28:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DFC201A1E1B; Fri, 26 Feb 2016 01:28:50 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-oi0-x22e.google.com (mail-oi0-x22e.google.com [IPv6:2607:f8b0:4003:c06::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 892681A1E0D for ; Fri, 26 Feb 2016 01:28:49 -0800 (PST) Received: by mail-oi0-x22e.google.com with SMTP id m82so58259200oif.1 for ; Fri, 26 Feb 2016 01:28:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:from:to:cc:subject:date:in-reply-to:references :mime-version; bh=D0GIkQ/NU0TD/g2qTMm05WNhU4zhk/TO4w+ZXMxwFZM=; b=TCTeMBSX+FMi4nG/QHKzAcYJPuCEIRebywoD3k84vZIfGDzygUp7Hlp1qNLjY6idBe hjcmeKtBkichXEd9EYbn11Nf755HuIHJiicnyUspmDe3pGEI3bLkb0UuzRZoGDVkCGzF Ai7J7UQxiyYvJSLAdwIt191bVsFYGslpMBGEQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date:in-reply-to :references:mime-version; bh=D0GIkQ/NU0TD/g2qTMm05WNhU4zhk/TO4w+ZXMxwFZM=; b=TRk6wsO5pwGfR6iqza3vIobZB+crMh0K6v2Yl5QbeTwuCI8p+GyB87qhvY/RepIRRA VZRWZlMlAzSq+KGpBjX9xqT/V8vjMWPA2m5E/pqdakfvAcuFKUxtiNd5TninJAqYloF2 XaAGDkuHG25X7Kb3NhuFuHInx47myk/ssUAuPy6eJriYppnbVKqgZTFwqBGgMGvS2z/h XyZl6aoDQXOil6xj4fy/I7zgsAGYWIRYmZSh78esHxB/W7WoZIEV66WFiHTDHm3PDOs7 oOCzLYfPoMyFMVtLSbZ6XaXKCBdQkX++voYHwXTGO2qHEZBJjUw1PN1qBniIAmQW1Y4A b9Aw== X-Gm-Message-State: AD7BkJK7SGx5RjR0rRd0SNJTgXii5fFGrwpEe1M5BoTDjgBnSZYM9RoMK0r4LeggGpluzFQY X-Received: by 10.202.170.10 with SMTP id t10mr326044oie.60.1456478924053; Fri, 26 Feb 2016 01:28:44 -0800 (PST) Received: from mail.hotmail.com (blu004-wss1s6.hotmail.com. [134.170.2.221]) by smtp.gmail.com with ESMTPSA id i7sm8205548oej.14.2016.02.26.01.28.42 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Feb 2016 01:28:43 -0800 (PST) Received: from BLU437-SMTP102 ([134.170.2.215]) by BLU004-WSS1S6.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Fri, 26 Feb 2016 01:28:42 -0800 X-TMN: [grhgx77SegXVh7sC5D956D+cBg/jc6md] Message-ID: From: Haojian Zhuang To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org Date: Fri, 26 Feb 2016 17:27:54 +0800 X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456478876-23434-1-git-send-email-haojian.zhuang@linaro.org> References: <1456478876-23434-1-git-send-email-haojian.zhuang@linaro.org> X-OriginalArrivalTime: 26 Feb 2016 09:28:39.0985 (UTC) FILETIME=[13BACA10:01D17078] MIME-Version: 1.0 Cc: Haojian Zhuang Subject: [edk2] [PATCH 7/9] MmcDxe: Fix uninitialized mediaid for SD X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" When SD card is used, mediaid is not initialized and used directly. So fix it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Haojian Zhuang --- EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c index a5915e4..f806bfc 100644 --- a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c +++ b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c @@ -57,6 +57,7 @@ typedef enum _EMMC_DEVICE_STATE { } EMMC_DEVICE_STATE; UINT32 mEmmcRcaCount = 0; +UINT32 CurrentMediaId = 0; STATIC EFI_STATUS @@ -231,6 +232,10 @@ EmmcIdentificationMode ( // Set up media Media->BlockSize = EMMC_CARD_SIZE; // 512-byte support is mandatory for eMMC cards Media->MediaId = MmcHostInstance->CardInfo.CIDData.PSN; + if (CurrentMediaId > Media->MediaId) + Media->MediaId = ++CurrentMediaId; + else + CurrentMediaId = Media->MediaId; Media->ReadOnly = MmcHostInstance->CardInfo.CSDData.PERM_WRITE_PROTECT; Media->LogicalBlocksPerPhysicalBlock = 1; Media->IoAlign = 4; @@ -344,7 +349,7 @@ InitializeSdMmcDevice ( MmcHostInstance->BlockIo.Media->BlockSize = BlockSize; MmcHostInstance->BlockIo.Media->ReadOnly = MmcHost->IsReadOnly (MmcHost); MmcHostInstance->BlockIo.Media->MediaPresent = TRUE; - MmcHostInstance->BlockIo.Media->MediaId++; + MmcHostInstance->BlockIo.Media->MediaId = ++CurrentMediaId; CmdArg = MmcHostInstance->CardInfo.RCA << 16; Status = MmcHost->SendCommand (MmcHost, MMC_CMD7, CmdArg);