From nobody Mon Feb 9 03:47:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57068+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57068+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1586362319; cv=none; d=zohomail.com; s=zohoarc; b=E9yxO9AR6Ikqf61upivjOYUumKfn/h5fm7it6H6At1zN40H3+TfY9SNgICcGgDGlJ8e6FROehoVVBcF2QaYNlG9LyJgvOXrTLdZshtmrleSTOpJnIGYJ5cv7F7IR4rGmadCQMRrpM/BC/Zk17kUuvBpvLdkyz/3BahAk/BL9BtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586362319; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=G/qwK6MSYeKvKrUKs+DgLJO62azLy4/5ZlB74Cg/adg=; b=eHw222MxUVioOkLC/cwgLXX37TdCt5GEMS4lm2kQP23cGmi0xWc8BswVFlioyKnsdZl5yN0vG4XyD4IUL5HYUKrovqZDcWSkomXrnBf3ySb19Fd8MQGQFtKNd3Tkmt4jvuijVn2RfjoVqo6pP3Peebk6JYBCfdOSRd78H3feDBo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57068+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1586362319167386.3260749086917; Wed, 8 Apr 2020 09:11:59 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Ara1YY1788612xld2AXQ4xJM; Wed, 08 Apr 2020 09:11:58 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.14908.1586362318310276384 for ; Wed, 08 Apr 2020 09:11:58 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CE39530E; Wed, 8 Apr 2020 09:11:57 -0700 (PDT) X-Received: from cam-smtp0.cambridge.arm.com (unknown [10.37.8.121]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 921CC3F52E; Wed, 8 Apr 2020 09:11:56 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif@nuviainc.com, Samer.El-Haj-Mahmoud@arm.com, Ard Biesheuvel Subject: [edk2-devel] [PATCH edk2-platforms 1/2] Silicon/SynQuacer/PlatformDxe: defer device registration until EndOfDxe Date: Wed, 8 Apr 2020 18:11:37 +0200 Message-Id: <20200408161138.18289-2-ard.biesheuvel@arm.com> In-Reply-To: <20200408161138.18289-1-ard.biesheuvel@arm.com> References: <20200408161138.18289-1-ard.biesheuvel@arm.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ard.biesheuvel@arm.com X-Gm-Message-State: DdVuH47vX1GiVtxQnEzwzIYax1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1586362318; bh=r6NKl0YRDXmclEH/fygaR8RcvGezAF4FV3FjYOOOWmA=; h=Cc:Date:From:Reply-To:Subject:To; b=drxPOemwJyp22UzhwkAiDJbzii9cmciDliyCp/jqc1+TnXi20uao1LaQ7RmvafEbLJf ulr/MvuSU6LodKWAdKd2XBgM0OoXAqVw6rku87OElGzJKla7xX45lkxzti7rPR4YvTq7a fTMenR4B4q/VXdg/MOEhD8HlzZDK07KhgBI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" EDK2 carries an interesting quirk which dates back to the EFI 1.02 days, where each protocol that is installed onto a handle during the execution of a DXE driver's entrypoint is connected immediately (in the UEFI driver model sense) after the entry point returns. This means that, depending on the order that these drivers happen to end up being dispatched, we may enter the BDS phase with the device's driver stack fully connected, even if the device in question is not being used to boot the machine. Given the substantial delays that this might incur, let's work around this 'feature' by deferring the registration of the network and eMMC controllers to an EndOfDxe event handler. Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c | 37 +++++= +++++++++------ Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf | 1 + 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c = b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c index b6e2789cb9d2..09200a918009 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c @@ -301,6 +301,28 @@ InstallAcpiTables ( } } =20 +STATIC +VOID +EFIAPI +RegisterDevices ( + EFI_EVENT Event, + VOID *Context + ) +{ + EFI_HANDLE Handle; + EFI_STATUS Status; + + Handle =3D NULL; + Status =3D RegisterDevice (&gNetsecNonDiscoverableDeviceGuid, mNetsecDes= c, + &Handle); + ASSERT_EFI_ERROR (Status); + + if (mHiiSettings->EnableEmmc =3D=3D EMMC_ENABLED) { + Status =3D RegisterEmmc (); + ASSERT_EFI_ERROR (Status); + } +} + EFI_STATUS EFIAPI PlatformDxeEntryPoint ( @@ -315,6 +337,7 @@ PlatformDxeEntryPoint ( EFI_ACPI_DESCRIPTION_HEADER *Ssdt; UINTN SsdtSize; UINTN Index; + EFI_EVENT EndOfDxeEvent; =20 mHiiSettingsVal =3D PcdGet64 (PcdPlatformSettings); mHiiSettings =3D (SYNQUACER_PLATFORM_VARSTORE_DATA *)&mHiiSettingsVal; @@ -344,11 +367,6 @@ PlatformDxeEntryPoint ( } } =20 - Handle =3D NULL; - Status =3D RegisterDevice (&gNetsecNonDiscoverableDeviceGuid, mNetsecDes= c, - &Handle); - ASSERT_EFI_ERROR (Status); - Handle =3D NULL; Status =3D RegisterDevice (&gSynQuacerNonDiscoverableRuntimeI2cMasterGui= d, mI2c0Desc, &Handle); @@ -387,11 +405,6 @@ PlatformDxeEntryPoint ( Status =3D EnableSettingsForm (); ASSERT_EFI_ERROR (Status); =20 - if (mHiiSettings->EnableEmmc =3D=3D EMMC_ENABLED) { - Status =3D RegisterEmmc (); - ASSERT_EFI_ERROR (Status); - } - if (mHiiSettings->AcpiPref =3D=3D ACPIPREF_ACPI) { // // Load the SSDT tables from a raw section in this FFS file. @@ -431,5 +444,9 @@ PlatformDxeEntryPoint ( } } =20 + Status =3D gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_NOTIFY, RegisterDe= vices, + NULL, &gEfiEndOfDxeEventGroupGuid, &EndOfDxeEvent); + ASSERT_EFI_ERROR (Status); + return EFI_SUCCESS; } diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.in= f b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf index 57f2d071c14e..157f914ea85d 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf @@ -57,6 +57,7 @@ [LibraryClasses] [Guids] g96BoardsI2c0MasterGuid gEdkiiPlatformHasAcpiGuid + gEfiEndOfDxeEventGroupGuid gEfiHiiPlatformSetupFormsetGuid gFdtTableGuid gNetsecNonDiscoverableDeviceGuid --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#57068): https://edk2.groups.io/g/devel/message/57068 Mute This Topic: https://groups.io/mt/72877589/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-