From: Marcin Wojtas <mw@semihalf.com>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org,
nadavh@marvell.com, mw@semihalf.com, jsd@semihalf.com,
jaz@semihalf.com, Tomasz Michalec <tm@semihalf.com>
Subject: [platforms: PATCH 1/7] Silicon/SynQuacer/PlatformDxe: Modify initialization of SdMmcOverride
Date: Mon, 3 Sep 2018 06:53:57 +0200 [thread overview]
Message-ID: <1535950443-27106-2-git-send-email-mw@semihalf.com> (raw)
In-Reply-To: <1535950443-27106-1-git-send-email-mw@semihalf.com>
From: Tomasz Michalec <tm@semihalf.com>
This patch changes way the EDKII_SD_MMC_OVERRIDE protocol
sturcture is allocated. Using AllocateZeroPool and then
seting callbacks in the structure allow driver to be immune to
adding new callbacks in SdMmcOveride protocol in future.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
index e0987c9..1ad8b88 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
@@ -59,6 +59,8 @@
STATIC EFI_HANDLE mSdMmcControllerHandle;
+STATIC EDKII_SD_MMC_OVERRIDE *mSdMmcOverride;
+
STATIC EFI_ACPI_DESCRIPTION_HEADER *mSsdt;
STATIC UINTN mSsdtSize;
STATIC VOID *mEventRegistration;
@@ -180,12 +182,6 @@ SynQuacerSdMmcNotifyPhase (
return EFI_SUCCESS;
}
-STATIC EDKII_SD_MMC_OVERRIDE mSdMmcOverride = {
- EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION,
- SynQuacerSdMmcCapability,
- SynQuacerSdMmcNotifyPhase,
-};
-
STATIC
VOID
EFIAPI
@@ -255,10 +251,20 @@ RegisterEmmc (
SYNQUACER_EMMC_BASE, SYNQUACER_EMMC_BASE_SZ);
ASSERT_EFI_ERROR (Status);
+ mSdMmcOverride = AllocateZeroPool (sizeof (EDKII_SD_MMC_OVERRIDE));
+ if (mSdMmcOverride == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mSdMmcOverride->Version = EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION;
+ mSdMmcOverride->Capability = SynQuacerSdMmcCapability;
+ mSdMmcOverride->NotifyPhase = SynQuacerSdMmcNotifyPhase;
+
Handle = NULL;
Status = gBS->InstallProtocolInterface (&Handle,
&gEdkiiSdMmcOverrideProtocolGuid,
- EFI_NATIVE_INTERFACE, (VOID **)&mSdMmcOverride);
+ EFI_NATIVE_INTERFACE, mSdMmcOverride);
ASSERT_EFI_ERROR (Status);
return EFI_SUCCESS;
--
2.7.4
next prev parent reply other threads:[~2018-09-03 4:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-03 4:53 [platforms: PATCH 0/7] Armada7k8k Xenon driver rework Marcin Wojtas
2018-09-03 4:53 ` Marcin Wojtas [this message]
2018-09-06 14:04 ` [platforms: PATCH 1/7] Silicon/SynQuacer/PlatformDxe: Modify initialization of SdMmcOverride Ard Biesheuvel
2018-09-06 14:26 ` Marcin Wojtas
2018-09-06 14:31 ` Ard Biesheuvel
2018-09-06 14:38 ` Marcin Wojtas
2018-09-06 14:45 ` Ard Biesheuvel
2018-09-07 11:29 ` Ard Biesheuvel
2018-09-07 13:30 ` Marcin Wojtas
2018-09-03 4:53 ` [platforms: PATCH 2/7] Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information Marcin Wojtas
2018-09-03 4:53 ` [platforms: PATCH 3/7] SolidRun/Armada80x0McBin: Introduce board description library Marcin Wojtas
2018-09-03 4:54 ` [platforms: PATCH 4/7] Marvell/Armada70x0Db: " Marcin Wojtas
2018-09-03 4:54 ` [platforms: PATCH 5/7] Marvell/Armada80x0Db: " Marcin Wojtas
2018-09-03 4:54 ` [platforms: PATCH 6/7] Marvell/Drivers: MvBoardDesc: Extend information for SdMmc Marcin Wojtas
2018-09-03 4:54 ` [platforms: PATCH 7/7] Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe Marcin Wojtas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1535950443-27106-2-git-send-email-mw@semihalf.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox