From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web12.5376.1642726644033149612 for ; Thu, 20 Jan 2022 16:57:24 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=EvK8UPIU; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: hao.a.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642726644; x=1674262644; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=dZ1VemV5hv/w1dQwqWkQmhWpemuDCeWoSEs4MxejLEw=; b=EvK8UPIUQmJr6P+2rluzs0PQsOaK4CH4RxbyCaCp9YBYMIKfmaKRxTQq nW+0Olo3Y+85FxliTEWAn1PHHy4aVz+EXSOEZ0wQLfDQC8SAXLCKhcBeX b6/1Wx6Y37v6MuXlP0XYkNBugsejTd69thm67SfGlyBt8nPp5p92MlIEW xyGjKIO4Q9baDCaJ/u84tXhmXUMpiU1ye/qqz0ud0erYIDBifbbNJ/l4F n72Pvu1faJ5wd3YXrXUFKN8GJQAgqGELNRg0JdnwcYHHWsK92obZVZGwd VG2cRsY3sfO8bV9UPsTVcEe9E/wRy9Oc4v3/VMGaShxe0YntKaTzDMXFk Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10233"; a="244348057" X-IronPort-AV: E=Sophos;i="5.88,303,1635231600"; d="scan'208";a="244348057" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2022 16:57:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,303,1635231600"; d="scan'208";a="616325788" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by FMSMGA003.fm.intel.com with ESMTP; 20 Jan 2022 16:57:23 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Thu, 20 Jan 2022 16:57:22 -0800 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Thu, 20 Jan 2022 16:57:22 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Thu, 20 Jan 2022 16:57:22 -0800 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.101) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Thu, 20 Jan 2022 16:57:22 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kc6sku8RZzqsswv35KoHdvZwnCMOwil8TXKZcTy6YNdXdCjhrDlzVfWuWMwKwJLRji27aIjcBt4alYMC4/cqUPYKEoNId3FuXHncMAYd+i7axfVzzQrVxU/5WVhhF3oMFGFi2zpxdYsxAU1vmrUhwIQOyL2F2DM4WrfjHfhEz2OS98XRxnsUQCAzPWn576Sv7vVkothciE/PVeUNK1LZmTfJ2mfpFpd1hDxyqpGhsrWAJKqyD6XkoubFbP4lWF97e41m2XnvLu9ZKwqfdRigby7yYB5+7kaf50ub4OgTJSpJLnSEJ76ZDTbe223abLKyExHC26hfXiqxH9oiA7gANg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w7pp6WDXQuqyeObrOJyt6YDFxEn3Vsx7T8lSO28UmN4=; b=e8Ym6txctGmJIS2Uissip1mDvawy2+k+HUIs7VNzC+fN/mj68xt6NOpDH8TI81JBYR8gORLY6HN55+GJi1FA3bJB1IDbls0aj4BF8euC76qug/d8XMDbqbZMCqce6CiGRf4e4T9sVWFqYLaVtICqtMnvHNaJiRb1QC9E/2kFn9GR6BWqDHGpRCFEIZckPviiX5HkkNVxzARE+FMcru6xIcHnomYnGx8IUo+40lDjb3Msm10OBLh+n372Od3IWFWY317edqAPB9X0blt56ydMUPQWiLR9QdLMRWIeSpECka1xdzYlCobTTEoJ/XTXgHIipg9ORUyzHZkW+6JGbN/wDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DM6PR11MB4025.namprd11.prod.outlook.com (2603:10b6:5:197::31) by BYAPR11MB3735.namprd11.prod.outlook.com (2603:10b6:a03:b4::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Fri, 21 Jan 2022 00:57:19 +0000 Received: from DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::b8f1:aa83:cbbf:6964]) by DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::b8f1:aa83:cbbf:6964%6]) with mapi id 15.20.4888.014; Fri, 21 Jan 2022 00:57:19 +0000 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "Rosli, Muhammad Aiman" , "Wang, Jian J" , "Gao, Liming" , "Ni, Ray" Subject: Re: [edk2-devel] [PATCH v3] MdeModulePkg: Enabling OS boot from SD card through UEFI payload Thread-Topic: [edk2-devel] [PATCH v3] MdeModulePkg: Enabling OS boot from SD card through UEFI payload Thread-Index: AQHYDi8VcBfSYhX6ykW3Gjipiw/eQKxspqsA Date: Fri, 21 Jan 2022 00:57:19 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0a54cc6d-f0c4-4639-8129-08d9dc78fa08 x-ms-traffictypediagnostic: BYAPR11MB3735:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4941; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 6OezmX305zvRpK6Azq2wKRT8DCXmvNY2La87NX6UpRFNprS9K5PqTSETKXVtsWBJfsbotY/i418e/ncXDwOpKh+gYKZ76x/t9lNY3LPOMeP1l5XSn2BNHcpKKghtvda/YS+8S9tI0/Dw4Y0pvEAryuiYhNOgr6Khr3k+7HaPer6O4WWjNT/Iw9CXUWYchmVp7GWt5CdnxCc0IECz8/uREPDjkp/yiyNCVMKUd2gKT/RmKvI1nASXvR3DFfwoVFHzyRGEGIOkoVh4jcekxF8ah3ymfTJU487vcziVUYT6KY1mcb3mpx8OmAXky2ul/tY9IQIWugFgSwfR7oPkPLZpw/tY3/dnPWg3erMpOGJIjCb0xyzbsRZUS6bkfUp4zLbPdEvemU0ua/I7rYiNzFMSzAiOcF3U2hEYfic/CbLgVTVoGERXzfJecWG+dTqf4WWq33sAai4UZJndPUL6+N+A+yYFMeLtFP6Z7hkjsyKcMvr2bPB+YZDj524qQeb8ZLo5fe4DN5fhSN7ixnBYj+PmIcupRwE+GXtVcBm1GQ8uDAjRe6JK4KypuXZgl6ANyoe1t+ivBRD33hDf3GW7TnkNq3Ohst6fB+WtZZMr6PVqDEnksSnT6Yqyl+euRmbXBjY2+KquO43QD1it78k2xdX/hY7lyB+aVtn4wy+ArEU94rZCuHq4aNdaMEwTv5TG0Octi8skT/U1J8Hxumv43WojorWTU8Y4LFcryGohKi/hElhWe5ssijS5XqQ9iglrbTBTYp4IlrZj6vqDrStk2NKUtCEzkFt2X0shmoKVB8J5ZGmuT5ZuybCBjlzHZPDIl2ZKAIzxiEUZL76C03uNWRgsAw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4025.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(66446008)(64756008)(71200400001)(66556008)(186003)(76116006)(66946007)(53546011)(6506007)(66476007)(6636002)(7696005)(2906002)(508600001)(966005)(8936002)(110136005)(8676002)(26005)(316002)(55016003)(82960400001)(122000001)(86362001)(38070700005)(33656002)(52536014)(9686003)(5660300002)(38100700002)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?cOPRhl4Qs0NAJZiRpL+YdEuND5L4njrc9avuNo9eMowQ8lbzL5jhA59ESaEW?= =?us-ascii?Q?9Vye6yU/VAnIImsbRG9DAYcTfYRFM7sAriV6ELFYgvrF1PaCTApTQe1XG2Ze?= =?us-ascii?Q?2GGgBqVwun1eeTkhFyofel8qXfOOeqGZaC6BTHnGjHUvrTzDFwHuDt2fmBfj?= =?us-ascii?Q?lFZFVIR3VfclGzRiAO6djH+DQoFKDf1hdPgBWCrCcSSTdO1VSjOBepxAfqKt?= =?us-ascii?Q?+JseI7D5dQKyfBT3rA5+AA2u1+27LnmdP9jCoRWEDRnnZg0bw8r296QQcXrQ?= =?us-ascii?Q?xAgTZGdXXLYteoWAC4hpRsuhpdyrqP1NuhNpyDGO9XkkZnKYYZnlwcNl3BJH?= =?us-ascii?Q?ZeCUs0JZIy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RMe/pUUYiBRIh02/B7/PMb?= =?us-ascii?Q?QkbvozbEq8OiirdcMxdWsNTGDdB6+tYuV6BbPUb+nwkJXt4ZO58HvCoa/LpJ?= =?us-ascii?Q?8ALUPVUjQbKERlkyONwGgGsyOqeUJOf6tnDDSL8U6SuejSumNJK1endMkXIe?= =?us-ascii?Q?qqT1Pc32+wfPMqL/7ht3auMj5OKFeqBgASSVFvkeH6kITFU8wAEcUajx3p/r?= =?us-ascii?Q?jdG05Ad9BMWVhmOu5qppIuR4UU1bmlK3Ti8JRT5jpNeIdWOOEIfMT+YgcjBM?= =?us-ascii?Q?GZlVG5wDBi5Pu6YmQ1ZVT8AV4arQJNy1E6BMtCJf+cSfxDxWSWBelcf4TGUw?= =?us-ascii?Q?tXXUYHUQ0Ui15jCy6AvRNG/BY3tJTkt+Yygj1to+k/J7pNcm36iEDRJjeonm?= =?us-ascii?Q?t/BCsJjrLmozyaQ1DQs64jc=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4025.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a54cc6d-f0c4-4639-8129-08d9dc78fa08 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2022 00:57:19.8058 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: M8ToV/HIZNZcCC6cdBVAERu/K9SYF8cf050URkbe8AyMXWgQKcVV3k/91drGMi9+ijpAiNvB17n4aWFV6sQicg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3735 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable (Add missing maintainers/reviewers) Reviewed-by: Hao A Wu Will wait until early next week for the merging to see if any comment from = other reviewers. Best Regards, Hao Wu > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Aiman > Rosli > Sent: Friday, January 21, 2022 2:53 AM > To: devel@edk2.groups.io > Cc: Rosli, Muhammad Aiman > Subject: [edk2-devel] [PATCH v3] MdeModulePkg: Enabling OS boot from SD > card through UEFI payload >=20 > This changes is by adding 50ms delay during voltage switching from 3.3V t= o > 1.8V, plus adding a goto Voltage33Retry for 3.3V checking and retrying. >=20 > Signed-off-by: Aiman Rosli > --- > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 39 > +++++++++++++++++-- > 1 file changed, 36 insertions(+), 3 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > index 662f9f483c..f5a3607e47 100644 > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > @@ -1213,9 +1213,14 @@ SdCardIdentification ( > UINT32 PresentState; > UINT8 HostCtrl2; > UINTN Retry; > + BOOLEAN ForceVoltage33; > + > + ForceVoltage33 =3D FALSE; >=20 > PciIo =3D Private->PciIo; > PassThru =3D &Private->PassThru; > + > +Voltage33Retry: > // > // 1. Send Cmd0 to the device > // > @@ -1294,6 +1299,13 @@ SdCardIdentification ( > return EFI_UNSUPPORTED; > } >=20 > + // > + // 1.8V had failed in the previous run, forcing a retry with 3.3V > + instead // if (ForceVoltage33 =3D=3D TRUE) { > + S18r =3D FALSE; > + } > + > // > // 5. Repeatly send Acmd41 with supply voltage window to the device. > // Note here we only support the cards complied with SD physical > @@ -1366,9 +1378,30 @@ SdCardIdentification ( >=20 > SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_PRESENT_STATE, TRUE, > sizeof (PresentState), &PresentState); > if (((PresentState >> 20) & 0xF) !=3D 0xF) { > - DEBUG ((DEBUG_ERROR, "SdCardIdentification: SwitchVoltage fails = with > PresentState =3D 0x%x, It should be 0xF\n", PresentState)); > - Status =3D EFI_DEVICE_ERROR; > - goto Error; > + // > + // Delay 50 milliseconds in order for clock to stabilize, retry = reading the > SD_MMC_HC_PRESENT_STATE > + // > + gBS->Stall (50000); > + SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_PRESENT_STATE, TRUE, > sizeof (PresentState), &PresentState); > + if (((PresentState >> 20) & 0xF) !=3D 0xF) { > + DEBUG ((DEBUG_ERROR, "SdCardIdentification: SwitchVoltage fail= s > with PresentState =3D 0x%x, It should be 0xF\n", PresentState)); > + // > + // Reset and reinitialize the slot before the 3.3V retry. > + // > + Status =3D SdMmcHcReset (Private, Slot); > + if (EFI_ERROR (Status)) { > + goto Error; > + } > + > + Status =3D SdMmcHcInitHost (Private, Slot); > + if (EFI_ERROR (Status)) { > + goto Error; > + } > + > + DEBUG ((DEBUG_ERROR, "SdCardIdentification: Switching to 1.8V > failed, forcing a retry with 3.3V instead\n")); > + ForceVoltage33 =3D TRUE; > + goto Voltage33Retry; > + } > } > } >=20 > -- > 2.34.1.windows.1 >=20 >=20 >=20 >=20 >=20