From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (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 72C5F2215BD91 for ; Tue, 30 Jan 2018 03:42:07 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id v31so10804189wrc.11 for ; Tue, 30 Jan 2018 03:47:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jPAJ+mFvdGHUNE6ygfxPEz3+7odEFrqUTqj6oHg3GqQ=; b=NHnwchVUd503vYKR7tg8BrZfyr2FStqADY6jmp47sxTAItCZl2UDuxpi21tLSsm7K6 qEYcJHgKjHM5OazNUt6BW+8/7IDKvlbmTYvmQEY3lV+sEuTD6lE/eiIMnWW8DWyMku6w 8bY/VoyKTF7M43qqjV43slG0wK3PjCYlj0k94= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jPAJ+mFvdGHUNE6ygfxPEz3+7odEFrqUTqj6oHg3GqQ=; b=IiWg76K5vO5fhmKih7/P+I6Dxv8sM8LNibVMXLvU8FIazTLfrd7OX8gKtXeOcYtqQz 5kYLsLu0FU+6Bp+1XDXqboRSzqaG0+MP5HzEtt4LBtCWwT4LG7btQz4/946+DrT+YQyh bDweP57m/cv/422yDpGnkfoYcphZTB5VeyuwM20oJaqA68+3OK0sy/gt2S9EamLlGcBT /S8v76zwkqLm8Qnp9UxGe4Hxjn32zfsKHeukv2UJK3E3NmABBkiAXIN+uVvrEp7yGn0f 9caf0wOC3VU5P//PMnHy7vWo7rOcQDFkhF/Ucmr0vBo7g6qHePg5zmiFLbuMlk7eGJKg g6qw== X-Gm-Message-State: AKwxytcE6p8NiNVmh/JjbcPyoQi5PNX/eoPz8UHvVqaWYjF6piCrDG2j rMslg3y4/gqj80C8WoJMMetcRHyjG4E= X-Google-Smtp-Source: AH8x226arjkdct/sHb2o+wtX30HtUGSlas+3fz1khRi1YX6p+sC6SrzvJSeTy7xEvEKvCrzbQVU3AA== X-Received: by 10.223.144.100 with SMTP id h91mr13546382wrh.147.1517312860645; Tue, 30 Jan 2018 03:47:40 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id y52sm30154526wrb.52.2018.01.30.03.47.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Jan 2018 03:47:39 -0800 (PST) Date: Tue, 30 Jan 2018 11:47:38 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: "edk2-devel@lists.01.org" Message-ID: <20180130114738.7m6e46bx2ug7fa63@bivouac.eciton.net> References: <20180130103240.4669-1-ard.biesheuvel@linaro.org> <20180130110044.ftayhc37kfh6pw27@bivouac.eciton.net> MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH edk2-platforms] Silicon/Socionext/SynQuacer: add configurable eMMC support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 11:42:08 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jan 30, 2018 at 11:14:31AM +0000, Ard Biesheuvel wrote: > On 30 January 2018 at 11:00, Leif Lindholm wrote: > > On Tue, Jan 30, 2018 at 10:32:40AM +0000, Ard Biesheuvel wrote: > >> Implement support for the SynQuacer eMMC controller. This involves an > >> implementation of the SD/MMC override protocol to handle a couple of > >> quirks that would otherwise prevent this IP from being driven by the > >> generic SDHCI driver. > >> > >> Also, add a HII page to the PlatformDxe driver that allows eMMC support > >> to be enabled, and wire it up for both DeveloperBox and EVB. > >> > >> Contributed-under: TianoCore Contribution Agreement 1.1 > >> Signed-off-by: Ard Biesheuvel > >> --- > >> Now that the core support for the SD/MMC override protocol is finally > >> merged, resubmit this again. I dropped Leif's R-b given that I have > >> now added DeveloperBox, as well as a HII option to enable eMMC. > > > > Couple of minor comments/suggestions below and a question. > > > >> Platform/Socionext/DeveloperBox/DeveloperBox.dsc | 8 + > >> Platform/Socionext/DeveloperBox/DeveloperBox.fdf | 7 + > >> Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc | 8 + > >> Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.fdf | 7 + > >> Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi | 1 - > >> Silicon/Socionext/SynQuacer/DeviceTree/SynQuacerEvalBoard.dts | 4 - > >> Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c | 203 ++++++++++++++++++++ > >> Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c | 5 + > >> Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.h | 9 + > >> Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf | 4 + > >> Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni | 6 + > >> Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr | 8 + > >> Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h | 6 +- > >> Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c | 23 ++- > >> Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.inf | 1 + > >> 15 files changed, 287 insertions(+), 13 deletions(-) > >> > > > >> +/** > >> + > >> + Override function for SDHCI capability bits > >> + > >> + @param[in] PassThru A pointer to the > >> + EFI_SD_MMC_PASS_THRU_PROTOCOL instance. > >> + @param[in] ControllerHandle The EFI_HANDLE of the controller. > >> + @param[in] Slot The 0 based slot index. > >> + @param[in,out] SdMmcHcSlotCapability The SDHCI capability structure. > >> + > >> + @retval EFI_SUCCESS The override function completed successfully. > >> + @retval EFI_NOT_FOUND The specified controller or slot does not exist. > >> + @retval EFI_INVALID_PARAMETER SdMmcHcSlotCapability is NULL > >> + > >> +**/ > >> +STATIC > >> +EFI_STATUS > >> +EFIAPI > >> +SynQuacerSdMmcCapability ( > >> + IN EFI_HANDLE ControllerHandle, > >> + IN UINT8 Slot, > >> + IN OUT VOID *SdMmcHcSlotCapability > >> + ) > >> +{ > >> + UINT64 Capability; > >> + > >> + if (ControllerHandle != mSdMmcControllerHandle || Slot != 0) { > > > > This test pattern repeats below, does it suggest a macro? > > > > I don't see how that would clear things up tbh, and the pattern occurs > only twice > > #define IS_OUR_QUIRKY_SDMMC_CONTROLLER(Handle, Slot) \ > ((Handle) == mSdMmcControllerHandle && (Slot) == 0) > > if (!IS_OUR_QUIRKY_SDMMC_CONTROLLER(ControllerHandle, Slot) { > return EFI_SUCCESS; > } > > I can change it if you want, or add a comment if the condition is not > self-explanatory enough. It's just an awful lot of logical operations on a single line. 'ControllerHandle != mSdMmcControllerHandle' is reasonably easy to figure out, but '|| Slot != 0' looks a bit random there. A comment would be sufficient. Another option would be to reduce the number of logical operations by two by doing if (ControllerHandle == mSdMmcControllerHandle && Slot == 0) { and doing the body inside the if-statement. That's a bit uglier in the next function, but I would expect it follows the paradigm of "handle most likely case first"? > >> diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni > >> index b274d12ed2c6..2eca8bbba8c3 100644 > >> --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni > >> +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni > >> @@ -27,3 +27,9 @@ > >> > >> #string STR_PCIE_MAX_SPEED_UNLIMITED #language en-US "Unlimited" > >> #string STR_PCIE_MAX_SPEED_GEN1 #language en-US "Gen1 (2.5 GT/s)" > >> + > >> +#string STR_EMMC_ENABLE_PROMPT #language en-US "Enable on-board eMMC" > >> +#string STR_EMMC_ENABLE_HELP #language en-US "Enable the on-board eMMC for booting and for use by the OS." > >> + > >> +#string STR_EMMC_DISABLED #language en-US "Disabled" > >> +#string STR_EMMC_ENABLED #language en-US "Enabled" > > > > Perhaps a random question, but ... > > Why am I seeing this in cleartext in the patch? Is it really a unicode file? > > Given that we support UTF-8 in .uni files these days, and the fact > that all characters used are in the 7-bit ASCII range, it doesn't > really make a difference, I guess. Fair enough. / Leif