From patchwork Wed Sep 21 15:02:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 76700 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp2097045qgf; Wed, 21 Sep 2016 08:02:56 -0700 (PDT) X-Received: by 10.66.1.71 with SMTP id 7mr51133939pak.168.1474470176838; Wed, 21 Sep 2016 08:02:56 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id da13si31407381pac.124.2016.09.21.08.02.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Sep 2016 08:02:56 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4E9741A1EF5; Wed, 21 Sep 2016 08:02:56 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com [IPv6:2607:f8b0:400e:c03::231]) (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 B39B01A1EF5 for ; Wed, 21 Sep 2016 08:02:54 -0700 (PDT) Received: by mail-pa0-x231.google.com with SMTP id wk8so19265312pab.1 for ; Wed, 21 Sep 2016 08:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DvuqdVtDJUtx04dC0PX07Ah0PD3YUAnUoU7V7H17wn8=; b=dnyk5O90XvL/MJldIVkV0Oq+0432s5cxQ15lL3TsX0qNEYhkTltCvdoN/CH8wS/rPV wLpsZtf6nFKfvoyQ9Y/3d1DfCf+S6V1x7HMBpGlEZGIiNJNwvWXvDxm1FAVbK956AmbP KJVBDddmglgIKaW1xSLLV8ZIbrR1/mXaEedWo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DvuqdVtDJUtx04dC0PX07Ah0PD3YUAnUoU7V7H17wn8=; b=CoZCOH/z3KbJz+plJccjUhpbugWx1Tc4YnqEBRXVXOZD75PzfQvSLTwQCRIta1sdmy TgJe/IIOhMFoJV5LMW5v3fzzryqFxgQ+54EEfb9F3igoECxGnrrL5ZQgTW7pBlcWH+Xd F62XZLmOF8TJc2S0VUDW9294z7KTDwHDc8KChCVcpbZ/bU6ztQ1A305GFawJvhIGUO1g Iztcgs87ZCJw/KqjDutLXLgCO75TrsRnEcWL1Qg0fQgejiqzTo6993bj1M94itWzqTGe s5Bl+MTCi2Fq5VH5Bt5+U7ClGGax7CYmCfaAoROIaA8LxTbFWufznu6xBF4Lk6Getnm5 jfKw== X-Gm-Message-State: AE9vXwMz3uAtKroNUMl0Xom4Ing5eYeG689OsUvgYz21cQjEe2SZew/D71spu6KJGKGcoXiu X-Received: by 10.67.1.35 with SMTP id bd3mr66250560pad.16.1474470174397; Wed, 21 Sep 2016 08:02:54 -0700 (PDT) Received: from localhost.localdomain ([104.237.91.137]) by smtp.gmail.com with ESMTPSA id 85sm28914221pfw.92.2016.09.21.08.02.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Sep 2016 08:02:53 -0700 (PDT) From: Haojian Zhuang To: ryan.harkin@linaro.org, edk2-devel@lists.01.org, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org Date: Wed, 21 Sep 2016 23:02:24 +0800 Message-Id: <1474470147-23156-8-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474470147-23156-1-git-send-email-haojian.zhuang@linaro.org> References: <1474470147-23156-1-git-send-email-haojian.zhuang@linaro.org> Subject: [edk2] [PATCH v3 07/10] MmcDxe: Fix uninitialized mediaid for SD X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Haojian Zhuang MIME-Version: 1.0 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(-) -- 2.7.4 _______________________________________________ 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);