From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4003:c0f::241; helo=mail-ot0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-ot0-x241.google.com (mail-ot0-x241.google.com [IPv6:2607:f8b0:4003:c0f::241]) (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 10A8620356273 for ; Tue, 5 Dec 2017 09:12:16 -0800 (PST) Received: by mail-ot0-x241.google.com with SMTP id d27so876716ote.11 for ; Tue, 05 Dec 2017 09:16:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=1aKpWl4Nj57uuocMOltOp05LWxXXGjkWPQFgZzVvuj8=; b=CAtSMSMaYP2LjT2SucQKZeEP7jzQaBLLNSyA4h3q8f1/mqbBc+8CGSeJ4e9NiCNgnV M03oBBth9fMtf9Dp6iU84ubMn+C8DA31kTwWP6fqlDPMajT3+lulsXrsY4Swqy7oKtsj qKh6ucpV7tBL86z/XM5ND8HCldAE0KDXGXOfI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1aKpWl4Nj57uuocMOltOp05LWxXXGjkWPQFgZzVvuj8=; b=UWp8pnJDZlaSIodk+1PpH4p6jgSLmCrACwkrzVuaChFuwR7HnRnSP8P1WtbfdVNtH2 quhJJhRKBFUQYEJmrDfDqzU1H8Bf84xZrHceIDRfjOw2vSwGOrVZwKA6nkDw8qGVJ9Js Pzi4vYDa2Vfqzrrnf5rA/GNnMwTJZcYxJDLNbX1PDVk3nPUKk8UiAc+crgLhVjbNAPBp SqY6xdXNr1lmjoH7oBuwv4qZmyg+FzUyNgdlk87vO03lIKvz9foKkpMgwnnWOe37d3IX m0a2Ws1wcRlsXi4cVkbq/rbTigfZ5rzPktgIJx7Ki9KdaLQiXTPKO6zNHa73g81KLIXg Q/og== X-Gm-Message-State: AJaThX7MECrJQ/0t6pedHRgElJF5/Sdj8c+mGfvY8dbhbpjBCf0b6Abl YoBsVxWzW92jo2cUj+5ALn5BAOFWpaIy3wi6RjIUOA== X-Google-Smtp-Source: AGs4zMbgmKq/+ueR6fBSQYgyqZjwOzgdXZ6tlsCKesvtAEixyDBJIEKkwt7jjqlr3Y+P9YmJp+k2jsksOVfBTSQlhxI= X-Received: by 10.157.85.194 with SMTP id z2mr18480836oti.74.1512494207006; Tue, 05 Dec 2017 09:16:47 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.46.103 with HTTP; Tue, 5 Dec 2017 09:16:46 -0800 (PST) In-Reply-To: References: <20171130101132.18317-1-ard.biesheuvel@linaro.org> <20171130101132.18317-2-ard.biesheuvel@linaro.org> <5697a7e7-4994-1528-0c98-ad03efafb7e0@Intel.com> From: Ard Biesheuvel Date: Tue, 5 Dec 2017 17:16:46 +0000 Message-ID: To: "Wu, Hao A" Cc: "Ni, Ruiyu" , "edk2-devel@lists.01.org" , Leif Lindholm , "Tian, Feng" , "Zeng, Star" Subject: Re: [PATCH v2 1/2] MdeModulePkg: introduce SD/MMC override protocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Dec 2017 17:12:17 -0000 Content-Type: text/plain; charset="UTF-8" On 5 December 2017 at 13:09, Wu, Hao A wrote: >> -----Original Message----- >> From: Ni, Ruiyu >> Sent: Tuesday, December 05, 2017 6:35 PM >> To: Ard Biesheuvel; Wu, Hao A >> Cc: edk2-devel@lists.01.org; Leif Lindholm; Tian, Feng; Zeng, Star >> Subject: Re: [edk2] [PATCH v2 1/2] MdeModulePkg: introduce SD/MMC override >> protocol >> >> On 12/5/2017 6:24 PM, Ard Biesheuvel wrote: >> > On 5 December 2017 at 10:12, Ni, Ruiyu wrote: >> >> Some comments re the detailed interfaces embedded in below. >> >> >> >> On 11/30/2017 6:11 PM, Ard Biesheuvel wrote: >> >>> >> >>> Many ARM based SoCs have integrated SDHCI controllers, and often, >> >>> these implementations deviate in subtle ways from the pertinent >> >>> specifications. On the one hand, these deviations are quite easy >> >>> to work around, but on the other hand, having a collection of SoC >> >>> specific workarounds in the generic driver stack is undesirable. >> >>> >> >>> So let's introduce an optional SD/MMC override protocol that we >> >>> can invoke at the appropriate moments in the device initialization. >> >>> That way, the workaround itself remains platform specific, but we >> >>> can still use the generic driver stack on such platforms. >> >>> >> >>> Contributed-under: TianoCore Contribution Agreement 1.1 >> >>> Signed-off-by: Ard Biesheuvel >> >>> --- >> >>> MdeModulePkg/Include/Protocol/SdMmcOverride.h | 103 >> ++++++++++++++++++++ >> >>> MdeModulePkg/MdeModulePkg.dec | 3 + >> >>> 2 files changed, 106 insertions(+) >> >>> >> >>> diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h >> >>> b/MdeModulePkg/Include/Protocol/SdMmcOverride.h >> >>> new file mode 100644 >> >>> index 000000000000..5a5c393896f4 >> >>> --- /dev/null >> >>> +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h >> >>> @@ -0,0 +1,103 @@ >> >>> +/** @file >> >>> + Protocol to describe overrides required to support non-standard SDHCI >> >>> + implementations >> >>> ... >> >>> + IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, >> >>> + IN EFI_HANDLE ControllerHandle, >> >>> + IN UINT8 Slot, >> >>> + IN OUT UINT64 *SdMmcHcSlotCapability >> >>> + ); >> >> >> >> >> >> Is this API too specific? >> >> Besides SlotCapability, is there any other attributes that may need >> >> override as well? >> >> >> > >> > The capability structure is the root data structure that describes the >> > SD/MMC host controller. Which other data structures did you have in >> > mind? >> > >> >> I do not know either. >> Hao, any comments? > > The service is overriding the 'Capability' field of the private data > structure within the HC driver. It's the value read from the 'CAP' > register of the SD/MMC HC. > > After a glance of the other fields in 'SD_MMC_HC_PRIVATE_DATA', maybe the > 'MaxCurrent' field is another candidate can be overriden. However, I am > not sure about this. > In my experience, trying to cover every imaginable use case upfront usually fails. That is why I used enum based hooks, which are easily expanded later if we need to. If we need to override maxcurrent later on, we can just add it.