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::244; helo=mail-wr0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (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 DFBCC21B02820 for ; Thu, 7 Dec 2017 14:38:58 -0800 (PST) Received: by mail-wr0-x244.google.com with SMTP id l22so9076245wrc.11 for ; Thu, 07 Dec 2017 14:43:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=+Ej2QDZo4ZtKovWXkOwgumavBGePaU3wWvU7DWFe73U=; b=Vniubo9NQIo8C9TNj0xQ4yCLuvDJ2ak+QHtKJs7YvbDwFS5ig5th+XKhcDfzmtWWDz nSXj/40KC6TPqefH3jaJbtxDHgN6B15LWtgdJWXXBUNsv/eYy83bxywnLi+PWrtYZU11 wAmhFcaYeDgGbNJNY5h7p+VphuQZ5s6mRQQ6U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+Ej2QDZo4ZtKovWXkOwgumavBGePaU3wWvU7DWFe73U=; b=CwM9nLlYK6dUbkMWwMUmAHoWYFbC6K0jk+AXZ09qVqnCwU4n5UV7lNui2tXLEohdqY VI9iBGVszC6oOdSN/7GdnQGdFwV1DZDWDZmxawveladyRx9DqeiBzQavl74NuFxVmVGV DmMsOAZiGk/kNZNEDvQuLglenmlbNyqvIrSQNrBCm60Vq2tQOuo6KnSS2z0W3r/5bNwG Y/rp/1RjpXnZ6+6AUs3VjcfvdBBFH4XmKZFb5RpvEXxe3Wht8PNb/pak2X3mMfxXo3j+ nr9siqKO90A9wHbkWXSeUTebaqkfsDNTwVWMhUPqxU5PW4ay0/pouyXpxQcZX+GKuQ3J Yjgw== X-Gm-Message-State: AJaThX45hdeUBM057vOVVLBL374kq+l0dc7dchp5NV1K0aXSdgjTHtlS Jx0dhs7Cs3puaoQWvOdXM2iaxjf7XkE= X-Google-Smtp-Source: AGs4zMbtNHZs2o7X4GkrB8E6p3DHECPu2V+5bivVCZ/eV/F8XrZk0RiTx3MnRgRGpOkhIwfD2WWjBQ== X-Received: by 10.223.141.180 with SMTP id o49mr26349216wrb.35.1512686610514; Thu, 07 Dec 2017 14:43:30 -0800 (PST) Received: from localhost.localdomain ([160.171.158.223]) by smtp.gmail.com with ESMTPSA id g7sm7974314wra.38.2017.12.07.14.43.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Dec 2017 14:43:28 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, michael.d.kinney@intel.com, star.zeng@intel.com, feng.tian@intel.com, ruiyu.ni@intel.com, hao.a.wu@intel.com, Ard Biesheuvel Date: Thu, 7 Dec 2017 22:43:20 +0000 Message-Id: <20171207224322.20362-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [PATCH v4 0/2] quirks handling for SDHCI controllers 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: Thu, 07 Dec 2017 22:38:59 -0000 Many SDHCI implementations exist that are almost spec complicant, and could be driven by the generic SD/MMC host controller driver except for some minimal necessary init time tweaks. Adding such tweaks to the generic driver is undesirable. On the other hand, forking the driver for every platform that has such a SDHCI controller is problematic when it comes to upstreaming and ongoing maintenance (which is arguably the point of upstreaming in the first place). So these patches propose a workaround that is minimally invasive on the EDK2 side, but gives platforms a lot of leeway when it comes to applying SDHCI quirks. Changes since v3: - remove PassThru argument from protocol members: it is unclear whether the protocol is available when the override protocol is invoked, and my example use case does not need it - replace incorrect HandleProtocol with LocateProtocol, given that the override protocol is now a singleton instance - merge notifier calls into SdMmcHcReset() and SdMmcHcInitHost (), this required changing the prototype to take a SD_MMC_HC_PRIVATE_DATA* argument and so the prototypes no longer belong in SdMmcPciHci.h and have been moved to SdMmcPciHcDxe.h - use VOID* type for capability not UINT64* since we don't know its alignment Changes since v2: - use a singleton instance of the SD/MMC protocol rather than one per controller; this is needed to support 'reconnect -r', as pointed out by Ray - use EDKII prefixes for all types defined by the protocol - replace 'hook' with 'notify', and tweak some other identifiers - add missing function comment headers for factored out functions Changes since RFC/v1: - add EFI_SD_MMC_PASS_THRU_PROTOCOL* member to override methods - use UINT64* not VOID* to pass capability structure (which is always 64 bits in size) Ard Biesheuvel (2): MdeModulePkg: introduce SD/MMC override protocol MdeModulePkg/SdMmcPciHcDxe: allow HC capabilities to be overridden MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 35 ++++++- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h | 36 ++++++++ MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.inf | 2 + MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 95 +++++++++++++++++-- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 35 ------- MdeModulePkg/Include/Protocol/SdMmcOverride.h | 97 ++++++++++++++++++++ MdeModulePkg/MdeModulePkg.dec | 3 + 7 files changed, 257 insertions(+), 46 deletions(-) create mode 100644 MdeModulePkg/Include/Protocol/SdMmcOverride.h -- 2.11.0