From patchwork Thu Dec 7 22:43:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 121105 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp8953348qgn; Thu, 7 Dec 2017 14:43:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMYdtKw5hbUlLMP16FWnLxB13SQ4rGJ3x1elDSOEFr1rZU99YtxrX1c3d95PH2zxiIh6Ul44 X-Received: by 10.84.129.197 with SMTP id b63mr27705445plb.278.1512686615526; Thu, 07 Dec 2017 14:43:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512686615; cv=none; d=google.com; s=arc-20160816; b=hdqGta6BeY8eN9Jurn2QVt8YCDxphy+yFlWP+hJ3NHRrWUO9Y3ROnPKQtYhP2YYltj oy+Cp5ZBlZNKoy03MRbs9n38KhK82lyqGD59UC3j1KW/AwtGOip5fl7XcHaBoKqSGsWU aABE1CaKbgausvSCNga6XnC2k5rfe25wFoGpeX0kKQZDgw8fRqUkxQSsOl5FyPgrke/L G6Qh6B4hAlVRmL94JfgLvttihxbZpYh3xuZIW0FtK992mWFBd3XvaM1EpA3ykOBok+1e hWcjG14EXE2yDHCQlh2QlQ8s6muaST9oNo0TAuriHFk0YV24QP0KpDokDU67RwRTBUnd eSgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=hzKZDwRZ8dzW7H2Za8CUelnO5BVTXl3xyLx+zKjobhQ=; b=QOeDJSTD+I95qXmmNHqs89sRyTEDJsFBsoShDhVmyZ6b6CiuGIkZriKjTuA3Lwz1cW xQVCmn2GvQJhhaQgdlJUEwoM+nWSiNoBJzZeUg7cUwqZV5OADbgz1U2X5ZCYo+0QYorr 0pM2n/nxnkCVlru4ELm3o2xKeH3Hkz4tVqLvgh7Fp8p5YyfhQ0hicTJaVZ1r0FI2hzNd m1bXRywykpINq6ojXMpVQ4gOU6ELd+RcfatU2M7/X46vLu0B4L+xcvQ8pFs3P+HZVkLF GHZmK6aA3B5TZYuNrD0GkiT1XG0ZBgHCMQrjve1Lk8ISQVuj5SidoYk+jmBZLjLtYvYg 4rgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Vniubo9N; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id v35si4415607plg.517.2017.12.07.14.43.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Dec 2017 14:43:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Vniubo9N; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7E6D521B0282A; Thu, 7 Dec 2017 14:39:00 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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-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 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: [edk2] [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: , Cc: ruiyu.ni@intel.com, feng.tian@intel.com, Ard Biesheuvel , hao.a.wu@intel.com, leif.lindholm@linaro.org, michael.d.kinney@intel.com, star.zeng@intel.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Hao Wu Reviewed-by: Star Zeng