From nobody Tue May 21 05:03:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+107112+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107112+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1689887256; cv=none; d=zohomail.com; s=zohoarc; b=b9LgtmMldWYynBJvmKYZ1mm0Owfi7qDL1JT4IdakKaLcZt227XrV/Fj40IDE1zrKD1tPGR7avqFqczQeLgGKNX2CSKSvK9Lbo4sLH3BN6DUV/sb6fNnyuivha9sh08Yfhm1xfNj8tfBVCBnjjr7QLbD+hQk4Wq1uxytFw783BHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689887256; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=FzIUswhZ4QABcqLdd76oX0RKmS8s1fz39ZfbJ+TtKo4=; b=Ka6uIc+AZabi1ac6+Ozjwc1wWEEMSNgjGxh+erkCvXK+Etdmo2TE1+HZQYylVz1p5pMDnq351RW6mqLLnAwTAdJ1OECSMTsqnaulRtgfW+kRSfYMCaDsFwRQykJdrfEL8IG55WiaWTbXvHXN4Ufddq8SThEzSyuWvddWJKQWBA0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107112+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1689887256203266.73035776304926; Thu, 20 Jul 2023 14:07:36 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=rAW0K2Dcl+TStjfdxqx7yV31H7j9iWxbrHAXl57zz1M=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:X-Received:From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1689887255; v=1; b=P/X8LujrGaltXcW2fD4ZoWew32s6yqsTy0tzcooAxTFHLxh30LSWhUuz01ftyqEGFLArS08+ xneevUMXLihp7r2VIzDmJfmPB6cqlJvhO5KrKoqntG+DR6A/VDpuvlq/CDbd6aJwRXewLI0NAWW MhFm6wGKHVr2DA6dZ6eiEEKQ= X-Received: by 127.0.0.2 with SMTP id yhyEYY1788612xm4THAfXPyO; Thu, 20 Jul 2023 14:07:35 -0700 X-Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by mx.groups.io with SMTP id smtpd.web11.1806.1689887255310684088 for ; Thu, 20 Jul 2023 14:07:35 -0700 X-Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1b9c5e07c1bso9250325ad.2 for ; Thu, 20 Jul 2023 14:07:35 -0700 (PDT) X-Gm-Message-State: IiA1i0l9jAFoWAMDYH65yt4Ix1787277AA= X-Google-Smtp-Source: APBJJlGOmbiWHcazIuPLqRPgu2HIZHzQ6UwHI5eTKpE87DbAaXv6SSLjwW/VtErPFP4xYD/PGeMu3Q== X-Received: by 2002:a17:902:ee82:b0:1b8:6a47:705f with SMTP id a2-20020a170902ee8200b001b86a47705fmr121030pld.69.1689887254558; Thu, 20 Jul 2023 14:07:34 -0700 (PDT) X-Received: from MININT-0U7P5GU.redmond.corp.microsoft.com ([2001:4898:80e8:37:e07c:3f9b:2f13:3c64]) by smtp.gmail.com with ESMTPSA id d1-20020a170902aa8100b001b9ecee9f81sm1855943plr.129.2023.07.20.14.07.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 14:07:34 -0700 (PDT) From: "Kun Qin" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu , Mike Turner Subject: [edk2-devel] [PATCH v1 1/4] MdePkg: DelayedDispatch: Correct PPI descriptions Date: Thu, 20 Jul 2023 14:07:25 -0700 Message-ID: <20230720210729.774-2-kuqin12@gmail.com> In-Reply-To: <20230720210729.774-1-kuqin12@gmail.com> References: <20230720210729.774-1-kuqin12@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: 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,kuqin12@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689887256737100002 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4496 PI spec defined the `Register` function input argument `Delay` as output. However, this parameter should be used to define the minmal time delay the callback should fire. Thus it should be an input parameter. This change fixed the argument type. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Co-authored-by: Mike Turner Signed-off-by: Kun Qin --- MdePkg/Include/Ppi/DelayedDispatch.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/MdePkg/Include/Ppi/DelayedDispatch.h b/MdePkg/Include/Ppi/Dela= yedDispatch.h index f9b4fed30fb0..098d57758551 100644 --- a/MdePkg/Include/Ppi/DelayedDispatch.h +++ b/MdePkg/Include/Ppi/DelayedDispatch.h @@ -4,6 +4,7 @@ Provide timed event service in PEI =20 Copyright (c) 2020, American Megatrends International LLC. All rights = reserved. + Copyright (c) Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -15,7 +16,7 @@ /// #define EFI_DELAYED_DISPATCH_PPI_GUID \ { \ - 0x869c711d, 0x649c, 0x44fe, { 0x8b, 0x9e, 0x2c, 0xbb, 0x29, 0x11, 0xc3= , 0xe6} } \ + 0x869c711d, 0x649c, 0x44fe, { 0x8b, 0x9e, 0x2c, 0xbb, 0x29, 0x11, 0xc3= , 0xe6} \ } =20 /** @@ -46,10 +47,10 @@ Register a callback to be called after a minimum delay = has occurred. =20 This service is the single member function of the EFI_DELAYED_DISPATCH_PPI =20 - @param This Pointer to the EFI_DELAYED_DISPATCH_PPI instance - @param Function Function to call back - @param Context Context data - @param Delay Delay interval + @param[in] This Pointer to the EFI_DELAYED_DISPATCH_PPI instan= ce + @param[in] Function Function to call back + @param[in] Context Context data + @param[in] Delay Delay interval =20 @retval EFI_SUCCESS Function successfully loaded @retval EFI_INVALID_PARAMETER One of the Arguments is not supported @@ -61,8 +62,8 @@ EFI_STATUS (EFIAPI *EFI_DELAYED_DISPATCH_REGISTER)( IN EFI_DELAYED_DISPATCH_PPI *This, IN EFI_DELAYED_DISPATCH_FUNCTION Function, - IN UINT64 Context, - OUT UINT32 Delay + IN UINT64 Context, + IN UINT32 Delay ); =20 /// --=20 2.41.0.windows.2 -=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 (#107112): https://edk2.groups.io/g/devel/message/107112 Mute This Topic: https://groups.io/mt/100264776/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- From nobody Tue May 21 05:03:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+107113+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107113+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1689887257; cv=none; d=zohomail.com; s=zohoarc; b=JBhZhIyXwwg8E/FXkDr6kvikGfllcEUcf+Otw/NghWDPrEJqmop6TyLO5FISkDjSBdn8h3bandX0IcZZJ8e3+uq9NWmlhloZqvSR7siSsggzHbKB/zrqiJ4diUxXNsmCXHjAdQmrRI6gWTx0y1tAc+q5kHBxrzLjc2e0pPedrIU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689887257; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=lQOxrUdT65CMRdwaL1vTuWMS5PciL688CNK+ZBk6d6M=; b=M6zf9jfMIFAcdb12Uq7WPqaUHq7rE9IWiI5f0Ivc3VL2lP8t/5+BcJkScM/gKZVH384Hd8WzwmjqUErHwZRAAoYazRtunpdnH41j7ym51E/WXIhRgfZVFOO43QX7xQbXUbxgdf+N06tMll6cd8KSTWNQZo5qHjyd/dy/wKqan2A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107113+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1689887257084960.6425988101785; Thu, 20 Jul 2023 14:07:37 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=WCfyoMkORDAW7xXxIFNwzUKJoVD5t8tmYb7NZgq+Q6o=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:X-Received:From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1689887256; v=1; b=Aqt4V4xmui2PH7YfRjKLHavzG7fy9ecZbyAp868JIALjAEIJjrJCspiULwJ+2vB3qr6BErQv 4pwG9W/WSxFmW+bz1Z3kLr7RITB0FMTbofMSSrmkJJWq0f1MRkmDyV1JRl86r0uq6r1FATKOOuT Gko3q6sakSf0ymbylgBOEMYM= X-Received: by 127.0.0.2 with SMTP id HwryYY1788612xp53wcwP4SX; Thu, 20 Jul 2023 14:07:36 -0700 X-Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mx.groups.io with SMTP id smtpd.web10.1787.1689887256113910598 for ; Thu, 20 Jul 2023 14:07:36 -0700 X-Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-668730696a4so866675b3a.1 for ; Thu, 20 Jul 2023 14:07:36 -0700 (PDT) X-Gm-Message-State: 4aOz1JSua6UNzuMtP9dc7SGax1787277AA= X-Google-Smtp-Source: APBJJlGXkKyJ+bL5TXN7XgmyBaFroK92vkuYW4N4iS78FFYzkvhjDrfPlv3njxskb+XtB7F3Cg243g== X-Received: by 2002:a05:6a20:4f26:b0:115:5ed5:34d3 with SMTP id gi38-20020a056a204f2600b001155ed534d3mr63615pzb.20.1689887255346; Thu, 20 Jul 2023 14:07:35 -0700 (PDT) X-Received: from MININT-0U7P5GU.redmond.corp.microsoft.com ([2001:4898:80e8:37:e07c:3f9b:2f13:3c64]) by smtp.gmail.com with ESMTPSA id d1-20020a170902aa8100b001b9ecee9f81sm1855943plr.129.2023.07.20.14.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 14:07:35 -0700 (PDT) From: "Kun Qin" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu , Mike Turner Subject: [edk2-devel] [PATCH v1 2/4] MdePkg: DelayedDispatch: Added WaitOnEvent interface Date: Thu, 20 Jul 2023 14:07:26 -0700 Message-ID: <20230720210729.774-3-kuqin12@gmail.com> In-Reply-To: <20230720210729.774-1-kuqin12@gmail.com> References: <20230720210729.774-1-kuqin12@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: 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,kuqin12@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689887258747100013 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4496 This change adds a new interface for the delayed dispatch PPI. This new addition allows functional components relying on delayed dispatch callbacks to be managed/dispatched with definitive order. The full defintion has been added into PI spec. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Co-authored-by: Mike Turner Signed-off-by: Kun Qin --- MdePkg/Include/Ppi/DelayedDispatch.h | 24 +++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/MdePkg/Include/Ppi/DelayedDispatch.h b/MdePkg/Include/Ppi/Dela= yedDispatch.h index 098d57758551..253cafd46d28 100644 --- a/MdePkg/Include/Ppi/DelayedDispatch.h +++ b/MdePkg/Include/Ppi/DelayedDispatch.h @@ -50,6 +50,7 @@ This service is the single member function of the EFI_DEL= AYED_DISPATCH_PPI @param[in] This Pointer to the EFI_DELAYED_DISPATCH_PPI instan= ce @param[in] Function Function to call back @param[in] Context Context data + @param[in] UniqueId GUID for this Delayed Dispatch request. @param[in] Delay Delay interval =20 @retval EFI_SUCCESS Function successfully loaded @@ -63,9 +64,29 @@ EFI_STATUS IN EFI_DELAYED_DISPATCH_PPI *This, IN EFI_DELAYED_DISPATCH_FUNCTION Function, IN UINT64 Context, + IN EFI_GUID *UniqueId OPTIONAL, IN UINT32 Delay ); =20 +/** + Wait on a registered Delayed Dispatch unit that has a UniqueId. Continue + to dispatch all registered delayed dispatch entries until *ALL* entries = with + UniqueId have completed. + + @param[in] This The Delayed Dispatch PPI pointer. + @param[in] UniqueId UniqueId of delayed dispatch entry. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER The parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DELAYED_DISPATCH_WAIT_ON_EVENT)( + IN EFI_DELAYED_DISPATCH_PPI *This, + IN EFI_GUID *UniqueId + ); + /// /// This PPI is a pointer to the Delayed Dispatch Service. /// This service will be published by the Pei Foundation. The PEI Foundati= on @@ -73,7 +94,8 @@ EFI_STATUS /// execution. /// struct _EFI_DELAYED_DISPATCH_PPI { - EFI_DELAYED_DISPATCH_REGISTER Register; + EFI_DELAYED_DISPATCH_REGISTER Register; + EFI_DELAYED_DISPATCH_WAIT_ON_EVENT WaitOnEvent; }; =20 extern EFI_GUID gEfiPeiDelayedDispatchPpiGuid; --=20 2.41.0.windows.2 -=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 (#107113): https://edk2.groups.io/g/devel/message/107113 Mute This Topic: https://groups.io/mt/100264777/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- From nobody Tue May 21 05:03:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+107114+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107114+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1689887258; cv=none; d=zohomail.com; s=zohoarc; b=OKnwHsNDSprdrMDs+LNLROjudA7AG/L0AS+do4TOaExSZ3/vuGscBWPlgX0hR9Xs4y6FX139w/sQ3owwygEWDzZe+xMq00W1MotJe568LZK+dAgLBzgNmsINGmCNj4h8BMeU1ef5xrINSjJVbqke91NOwANnxyAtzN2s0ZW6v44= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689887258; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=gK+ERw8fTwFIj3+9KubgCi2kiO0WZLYDiJeuI4BA8lU=; b=I3RUOYNZhe2V7lcTkDrmAyh0m3gd3GSVW7S6YBy1+CoJUloVtKPa5MsEZnmqR/68N+gKthzK/MDj17mvLxmqvct1GRYeeXpcZW/NrfKVYsSb7eBk1vwIwlSVW8X+MpiQWhwYM7ZGZajupYRf+sg+G4bQBZ8EH+8iFBlRYTVEfIY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107114+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1689887258050213.87689739346195; Thu, 20 Jul 2023 14:07:38 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=RPo9FxCChUzPZjSzb2MFSghHuQHZ0tijWlhO0u9ehcQ=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:X-Received:From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1689887257; v=1; b=dI2hLx1bIUq0Rrqf59YYSvZPNtOKvUwiuJDDU4DPOhJxcJznSBpFIU8n4eH3PWhbN7bHpHor z0YJdJSUF6CIQdAqWaEtGxP83ePdoH5dTsJo/est+ICsdFU5O/1d7vbx29SzOfrBFH4knxoAyrA qZrfoH4+gvqmksmEWI9Zxv+w= X-Received: by 127.0.0.2 with SMTP id sm0OYY1788612xsWgYXxbkMd; Thu, 20 Jul 2023 14:07:37 -0700 X-Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mx.groups.io with SMTP id smtpd.web11.1809.1689887257164528710 for ; Thu, 20 Jul 2023 14:07:37 -0700 X-Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1b8baa836a5so9414025ad.1 for ; Thu, 20 Jul 2023 14:07:37 -0700 (PDT) X-Gm-Message-State: 3stJbnlxAowTUcINMRwzG6uLx1787277AA= X-Google-Smtp-Source: APBJJlF3xLOM6wZmq836ByCnmqOeLoUS3EDP1TpWYu0tM4J51U2t/NY4dEK6DqZ8aB6wmljnTl3u8Q== X-Received: by 2002:a17:903:2613:b0:1ad:f138:b2f6 with SMTP id jd19-20020a170903261300b001adf138b2f6mr166626plb.16.1689887256370; Thu, 20 Jul 2023 14:07:36 -0700 (PDT) X-Received: from MININT-0U7P5GU.redmond.corp.microsoft.com ([2001:4898:80e8:37:e07c:3f9b:2f13:3c64]) by smtp.gmail.com with ESMTPSA id d1-20020a170902aa8100b001b9ecee9f81sm1855943plr.129.2023.07.20.14.07.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 14:07:36 -0700 (PDT) From: "Kun Qin" To: devel@edk2.groups.io Cc: Jian J Wang , Dandan Bi , Liming Gao , Debkumar De , Catharine West , Mike Turner Subject: [edk2-devel] [PATCH v1 3/4] MdeModulePkg: PeiMain: Introduce implementation of delayed dispatch Date: Thu, 20 Jul 2023 14:07:27 -0700 Message-ID: <20230720210729.774-4-kuqin12@gmail.com> In-Reply-To: <20230720210729.774-1-kuqin12@gmail.com> References: <20230720210729.774-1-kuqin12@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: 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,kuqin12@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689887259018100015 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4496 This change adds the implementation that fits the needs and description of PI spec defined Delayed Dispatch PPI in Pei Core. The PPI would allow minimal delay for registered callbacks. As well as allowing other functions to wait for GUIDed delayed dispatch callbacks. Cc: Jian J Wang Cc: Dandan Bi Cc: Liming Gao Cc: Debkumar De Cc: Catharine West Co-authored-by: Mike Turner Signed-off-by: Kun Qin --- MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 353 ++++++++++++++++++++ MdeModulePkg/Core/Pei/PeiMain/PeiMain.c | 3 + MdeModulePkg/Core/Pei/PeiMain.h | 76 +++++ MdeModulePkg/Core/Pei/PeiMain.inf | 7 + MdeModulePkg/MdeModulePkg.dec | 15 + 5 files changed, 454 insertions(+) diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/C= ore/Pei/Dispatcher/Dispatcher.c index 5f32ebb560ae..50e59bdbe732 100644 --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c @@ -3,12 +3,339 @@ =20 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
+Copyright (c) Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 #include "PeiMain.h" =20 +/** + DelayedDispatchDispatcher + + ayed Dispach cycle (ie one pass) through each entry, calling functions w= hen their + e has expired. When UniqueId is specified, if there are any of the spec= ified entries + the dispatch queue during dispatch, repeat the DelayedDispatch cycle. + + @param DelayedDispatchTable Pointer to dispatch table + @param OPTIONAL UniqueId used to insure particular time is = met. + + @return BOOLEAN +**/ +BOOLEAN +DelayedDispatchDispatcher ( + IN DELAYED_DISPATCH_TABLE *DelayedDispatchTable, + IN EFI_GUID *UniqueId OPTIONAL + ); + +/** + DelayedDispatch End of PEI callback function. Insure that all of the del= ayed dispatch + entries are complete before exiting PEI. + + @param[in] PeiServices - Pointer to PEI Services Table. + @param[in] NotifyDesc - Pointer to the descriptor for the Notificatio= n event that + caused this function to execute. + @param[in] Ppi - Pointer to the PPI data associated with this = function. + + @retval EFI_STATUS - Always return EFI_SUCCESS +**/ +EFI_STATUS +EFIAPI +PeiDelayedDispatchOnEndOfPei ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, + IN VOID *Ppi + ); + +EFI_DELAYED_DISPATCH_PPI mDelayedDispatchPpi =3D { PeiDelayedDispatchReg= ister, PeiDelayedDispatchWaitOnUniqueId }; +EFI_PEI_PPI_DESCRIPTOR mDelayedDispatchDesc =3D { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPeiDelayedDispatchPpiGuid, + &mDelayedDispatchPpi +}; + +EFI_PEI_NOTIFY_DESCRIPTOR mDelayedDispatchNotifyDesc =3D { + EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINAT= E_LIST, + &gEfiEndOfPeiSignalPpiGuid, + PeiDelayedDispatchOnEndOfPei +}; + +/** + Helper function to look up DELAYED_DISPATCH_TABLE published in HOB. + + @return Pointer to DELAYED_DISPATCH_TABLE from HOB +**/ +DELAYED_DISPATCH_TABLE * +GetDelayedDispatchTable ( + VOID + ) +{ + EFI_HOB_GUID_TYPE *GuidHob; + + GuidHob =3D GetFirstGuidHob (&gEfiDelayedDispatchTableGuid); + if (NULL =3D=3D GuidHob) { + DEBUG ((DEBUG_ERROR, "Delayed Dispatch PPI ERROR - Delayed Dispatch Ho= b not available.\n")); + ASSERT (FALSE); + return NULL; + } + + return (DELAYED_DISPATCH_TABLE *)GET_GUID_HOB_DATA (GuidHob); +} + +/** +Register a callback to be called after a minimum delay has occurred. + +This service is the single member function of the EFI_DELAYED_DISPATCH_PPI + + @param[in] This Pointer to the EFI_DELAYED_DISPATCH_PPI instan= ce + @param[in] Function Function to call back + @param[in] Context Context data + @param[in] UniqueId GUID for this Delayed Dispatch request. + @param[in] Delay Delay interval + + @retval EFI_SUCCESS Function successfully loaded + @retval EFI_INVALID_PARAMETER One of the Arguments is not supported + @retval EFI_OUT_OF_RESOURCES No more entries + +**/ +EFI_STATUS +EFIAPI +PeiDelayedDispatchRegister ( + IN EFI_DELAYED_DISPATCH_PPI *This, + IN EFI_DELAYED_DISPATCH_FUNCTION Function, + IN UINT64 Context, + IN EFI_GUID *UniqueId OPTIONAL, + IN UINT32 Delay + ) +{ + DELAYED_DISPATCH_TABLE *DelayedDispatchTable; + DELAYED_DISPATCH_ENTRY *Entry; + + // Check input parameters + if ((NULL =3D=3D Function) || (Delay > FixedPcdGet32 (PcdDelayedDispatch= MaxDelayUs)) || (NULL =3D=3D This)) { + DEBUG ((DEBUG_ERROR, "%a Invalid parameter\n", __func__)); + return EFI_INVALID_PARAMETER; + } + + // Get delayed dispatch table + DelayedDispatchTable =3D GetDelayedDispatchTable (); + if (NULL =3D=3D DelayedDispatchTable) { + DEBUG ((DEBUG_ERROR, "%a Unable to locate dispatch table\n", __func__)= ); + return EFI_UNSUPPORTED; + } + + // Check for available entry slots + if (DelayedDispatchTable->Count >=3D FixedPcdGet32 (PcdDelayedDispatchMa= xEntries)) { + ASSERT (DelayedDispatchTable->Count < FixedPcdGet32 (PcdDelayedDispatc= hMaxEntries)); + DEBUG ((DEBUG_ERROR, "%a Too many entries requested\n", __func__)); + return EFI_OUT_OF_RESOURCES; + } + + Entry =3D &(DelayedDispatchTable->Entry[DelayedDispatchTab= le->Count]); + Entry->Function =3D Function; + Entry->Context =3D Context; + Entry->DispatchTime =3D GET_TIME_IN_US () + Delay; + if (NULL !=3D UniqueId) { + CopyGuid (&Entry->UniqueId, UniqueId); + } else { + ZeroMem (&Entry->UniqueId, sizeof (EFI_GUID)); + } + + Entry->MicrosecondDelay =3D Delay; + DelayedDispatchTable->Count++; + + DEBUG ((DEBUG_INFO, "%a Adding dispatch Entry\n", __func__)); + DEBUG ((DEBUG_INFO, " Requested Delay =3D %d\n", Delay)); + DEBUG ((DEBUG_INFO, " Trigger Time =3D %d\n", Entry->DispatchTime)); + DEBUG ((DEBUG_INFO, " Context =3D 0x%08lx\n", Entry->Context)); + DEBUG ((DEBUG_INFO, " Function =3D %p\n", Entry->Function)); + DEBUG ((DEBUG_INFO, " GuidHandle =3D %g\n", &(Entry->UniqueId))); + + if (0 =3D=3D Delay) { + // Force early dispatch point + DelayedDispatchDispatcher (DelayedDispatchTable, NULL); + } + + return EFI_SUCCESS; +} + +/** + DelayedDispatchDispatcher + + ayed Dispach cycle (ie one pass) through each entry, calling functions w= hen their + e has expired. When UniqueId is specified, if there are any of the spec= ified entries + the dispatch queue during dispatch, repeat the DelayedDispatch cycle. + + @param DelayedDispatchTable Pointer to dispatch table + @param OPTIONAL UniqueId used to insure particular time is = met. + + @return BOOLEAN +**/ +BOOLEAN +DelayedDispatchDispatcher ( + IN DELAYED_DISPATCH_TABLE *DelayedDispatchTable, + IN EFI_GUID *UniqueId OPTIONAL + ) +{ + BOOLEAN Dispatched; + UINT32 TimeCurrent; + UINT32 MaxDispatchTime; + UINTN Index1; + BOOLEAN UniqueIdPresent; + DELAYED_DISPATCH_ENTRY *Entry; + + Dispatched =3D FALSE; + UniqueIdPresent =3D TRUE; + MaxDispatchTime =3D GET_TIME_IN_US () + FixedPcdGet32 (PcdDelayedDispatc= hCompletionTimeoutUs); + while ((DelayedDispatchTable->Count > 0) && (UniqueIdPresent)) { + UniqueIdPresent =3D FALSE; + DelayedDispatchTable->DispCount++; + + // If dispatching is messed up, clear DelayedDispatchTable and exit. + TimeCurrent =3D GET_TIME_IN_US (); + if (TimeCurrent > MaxDispatchTime) { + DEBUG ((DEBUG_ERROR, "%a - DelayedDispatch Completion timeout!\n", _= _func__)); + ReportStatusCode ((EFI_ERROR_MAJOR | EFI_ERROR_CODE), (EFI_SOFTWARE_= PEI_CORE | EFI_SW_EC_ABORTED)); + ASSERT (FALSE); + DelayedDispatchTable->Count =3D 0; + break; + } + + // Check each entry in the table for possible dispatch + for (Index1 =3D 0; Index1 < DelayedDispatchTable->Count;) { + Entry =3D &(DelayedDispatchTable->Entry[Index1]); + // If UniqueId is present, insure there is an additional check of th= e table. + if (NULL !=3D UniqueId) { + if (CompareGuid (UniqueId, &Entry->UniqueId)) { + UniqueIdPresent =3D TRUE; + } + } + + TimeCurrent =3D GET_TIME_IN_US (); + if (TimeCurrent >=3D Entry->DispatchTime) { + // Time expired, invoked the function + DEBUG (( + DEBUG_ERROR, + "Delayed dispatch entry %d @ %p, Target=3D%d, Act=3D%d Disp=3D%d= \n", + Index1, + Entry->Function, + Entry->DispatchTime, + TimeCurrent, + DelayedDispatchTable->DispCount + )); + Dispatched =3D TRUE; + Entry->MicrosecondDelay =3D 0; + Entry->Function ( + &Entry->Context, + &Entry->MicrosecondDelay + ); + DEBUG ((DEBUG_ERROR, "Delayed dispatch Function returned delay=3D%= d\n", Entry->MicrosecondDelay)); + if (0 =3D=3D Entry->MicrosecondDelay) { + // NewTime =3D 0 =3D delete this entry from the table + DelayedDispatchTable->Count--; + CopyMem (Entry, Entry+1, sizeof (DELAYED_DISPATCH_ENTRY) * (Dela= yedDispatchTable->Count - Index1)); + } else { + if (Entry->MicrosecondDelay > FixedPcdGet32 (PcdDelayedDispatchM= axDelayUs)) { + DEBUG ((DEBUG_ERROR, "%a Illegal new delay %d requested\n", __= func__, Entry->MicrosecondDelay)); + ASSERT (FALSE); + Entry->MicrosecondDelay =3D FixedPcdGet32 (PcdDelayedDispatchM= axDelayUs); + } + + // NewTime !=3D 0 - update the time from us to Dispatch time + Entry->DispatchTime =3D GET_TIME_IN_US () + Entry->MicrosecondD= elay; + Index1++; + } + } else { + Index1++; + } + } + } + + return Dispatched; +} + +/** + Wait on a registered Delayed Dispatch unit that has a UniqueId. Continue + to dispatch all registered delayed dispatch entries until *ALL* entries = with + UniqueId have completed. + + @param[in] This The Delayed Dispatch PPI pointer. + @param[in] UniqueId UniqueId of delayed dispatch entry. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER The parameters are invalid. + +**/ +EFI_STATUS +EFIAPI +PeiDelayedDispatchWaitOnUniqueId ( + IN EFI_DELAYED_DISPATCH_PPI *This, + IN EFI_GUID *UniqueId + ) +{ + PERF_FUNCTION_BEGIN (); + DELAYED_DISPATCH_TABLE *DelayedDispatchTable; + + // Get delayed dispatch table + DelayedDispatchTable =3D GetDelayedDispatchTable (); + if (NULL =3D=3D DelayedDispatchTable) { + PERF_FUNCTION_END (); + return EFI_UNSUPPORTED; + } + + if ((NULL =3D=3D UniqueId) || (IsZeroGuid (UniqueId))) { + ASSERT (FALSE); + PERF_FUNCTION_END (); + return EFI_UNSUPPORTED; + } + + DEBUG ((DEBUG_INFO, "Delayed dispatch on %g. Count=3D%d, DispatchCount= =3D%d\n", UniqueId, DelayedDispatchTable->Count, DelayedDispatchTable->Disp= Count)); + PERF_EVENT_SIGNAL_BEGIN (UniqueId); + DelayedDispatchDispatcher (DelayedDispatchTable, UniqueId); + PERF_EVENT_SIGNAL_END (UniqueId); + + PERF_FUNCTION_END (); + return EFI_SUCCESS; +} + +/** + DelayedDispatch End of PEI callback function. Insure that all of the del= ayed dispatch + entries are complete before exiting PEI. + + @param[in] PeiServices - Pointer to PEI Services Table. + @param[in] NotifyDesc - Pointer to the descriptor for the Notificatio= n event that + caused this function to execute. + @param[in] Ppi - Pointer to the PPI data associated with this = function. + + @retval EFI_STATUS - Always return EFI_SUCCESS +**/ +EFI_STATUS +EFIAPI +PeiDelayedDispatchOnEndOfPei ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, + IN VOID *Ppi + ) +{ + DELAYED_DISPATCH_TABLE *DelayedDispatchTable; + + // Get delayed dispatch table + DelayedDispatchTable =3D GetDelayedDispatchTable (); + if (NULL =3D=3D DelayedDispatchTable) { + return EFI_UNSUPPORTED; + } + + PERF_INMODULE_BEGIN ("PerfDelayedDispatchEndOfPei"); + while (DelayedDispatchTable->Count > 0) { + DelayedDispatchDispatcher (DelayedDispatchTable, NULL); + } + + DEBUG ((DEBUG_ERROR, "%a Count of dispatch cycles is %d\n", __func__, De= layedDispatchTable->DispCount)); + PERF_INMODULE_END ("PerfDelayedDispatchEndOfPei"); + + return EFI_SUCCESS; +} + /** =20 Discover all PEIMs and optional Apriori file in one FV. There is at most= one @@ -1365,12 +1692,31 @@ PeiDispatcher ( EFI_PEI_FILE_HANDLE SaveCurrentFileHandle; EFI_FV_FILE_INFO FvFileInfo; PEI_CORE_FV_HANDLE *CoreFvHandle; + EFI_HOB_GUID_TYPE *GuidHob; + UINT32 TableSize; =20 PeiServices =3D (CONST EFI_PEI_SERVICES **)&Private->Ps; PeimEntryPoint =3D NULL; PeimFileHandle =3D NULL; EntryPoint =3D 0; =20 + if (NULL =3D=3D Private->DelayedDispatchTable) { + GuidHob =3D GetFirstGuidHob (&gEfiDelayedDispatchTableGuid); + if (NULL !=3D GuidHob) { + Private->DelayedDispatchTable =3D (DELAYED_DISPATCH_TABLE *)(GET_GUI= D_HOB_DATA (GuidHob)); + } else { + TableSize =3D sizeof (DELAYED_DISPATCH_TABLE) + = ((FixedPcdGet32 (PcdDelayedDispatchMaxEntries) - 1) * sizeof (DELAYED_DISPA= TCH_ENTRY)); + Private->DelayedDispatchTable =3D BuildGuidHob (&gEfiDelayedDispatch= TableGuid, TableSize); + if (NULL !=3D Private->DelayedDispatchTable) { + ZeroMem (Private->DelayedDispatchTable, TableSize); + Status =3D PeiServicesInstallPpi (&mDelayedDispatchDesc); + ASSERT_EFI_ERROR (Status); + Status =3D PeiServicesNotifyPpi (&mDelayedDispatchNotifyDesc); + ASSERT_EFI_ERROR (Status); + } + } + } + if ((Private->PeiMemoryInstalled) && (PcdGetBool (PcdMigrateTemporaryRamFirmwareVolumes) || (Private->HobList.HandoffInformationTable->BootMode !=3D BOOT_ON_S3= _RESUME) || @@ -1621,6 +1967,13 @@ PeiDispatcher ( } } } + + // Dispatch pending delalyed dispatch requests + if (NULL !=3D Private->DelayedDispatchTable) { + if (DelayedDispatchDispatcher (Private->DelayedDispatchTable, NU= LL)) { + ProcessDispatchNotifyList (Private); + } + } } =20 // diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c b/MdeModulePkg/Core/Pe= i/PeiMain/PeiMain.c index bf1719d7941a..e5643adf7027 100644 --- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c +++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c @@ -277,6 +277,9 @@ PeiCore ( OldCoreData->TempFileHandles =3D (EFI_PEI_FILE_HANDLE *)((UINT8 *)= OldCoreData->TempFileHandles - OldCoreData->HeapOffset); } =20 + // Force relocating the dispatch table + OldCoreData->DelayedDispatchTable =3D NULL; + // // Fixup for PeiService's address // diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMai= n.h index 556beddad533..3b8bbe7f25a1 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.h +++ b/MdeModulePkg/Core/Pei/PeiMain.h @@ -11,6 +11,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 #include #include +#include +#include #include #include #include @@ -41,6 +43,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include @@ -207,6 +210,29 @@ EFI_STATUS =20 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C') =20 +#define GET_TIME_IN_US() ((UINT32)DivU64x32(GetTimeInNanoSecond(GetPerfor= manceCounter ()), 1000)) + +// +// Internal structure for delayed dispatch entries. +// +#pragma pack (push, 1) + +typedef struct { + EFI_GUID UniqueId; + UINT64 Context; + EFI_DELAYED_DISPATCH_FUNCTION Function; + UINT32 DispatchTime; + UINT32 MicrosecondDelay; +} DELAYED_DISPATCH_ENTRY; + +typedef struct { + UINT32 Count; + UINT32 DispCount; + DELAYED_DISPATCH_ENTRY Entry[1]; // Actual size based on PCD PcdD= elayedDispatchMaxEntries; +} DELAYED_DISPATCH_TABLE; + +#pragma pack (pop) + /// /// Pei Core private data structure instance /// @@ -307,6 +333,11 @@ struct _PEI_CORE_INSTANCE { // Those Memory Range will be migrated into physical memory. // HOLE_MEMORY_DATA HoleData[HOLE_MAX_NUMBER]; + + // + // Table of delayed dispatch requests + // + DELAYED_DISPATCH_TABLE *DelayedDispatchTable; }; =20 /// @@ -2038,4 +2069,49 @@ PeiReinitializeFv ( IN PEI_CORE_INSTANCE *PrivateData ); =20 +/** +Register a callback to be called after a minimum delay has occurred. + +This service is the single member function of the EFI_DELAYED_DISPATCH_PPI + + @param[in] This Pointer to the EFI_DELAYED_DISPATCH_PPI instan= ce + @param[in] Function Function to call back + @param[in] Context Context data + @param[in] UniqueId GUID for this Delayed Dispatch request. + @param[in] Delay Delay interval + + @retval EFI_SUCCESS Function successfully loaded + @retval EFI_INVALID_PARAMETER One of the Arguments is not supported + @retval EFI_OUT_OF_RESOURCES No more entries + +**/ +EFI_STATUS +EFIAPI +PeiDelayedDispatchRegister ( + IN EFI_DELAYED_DISPATCH_PPI *This, + IN EFI_DELAYED_DISPATCH_FUNCTION Function, + IN UINT64 Context, + IN EFI_GUID *UniqueId OPTIONAL, + IN UINT32 Delay + ); + +/** + Wait on a registered Delayed Dispatch unit that has a UniqueId. Continue + to dispatch all registered delayed dispatch entries until *ALL* entries = with + UniqueId have completed. + + @param[in] This The Delayed Dispatch PPI pointer. + @param[in] UniqueId UniqueId of delayed dispatch entry. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER The parameters are invalid. + +**/ +EFI_STATUS +EFIAPI +PeiDelayedDispatchWaitOnUniqueId ( + IN EFI_DELAYED_DISPATCH_PPI *This, + IN EFI_GUID *UniqueId + ); + #endif diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf b/MdeModulePkg/Core/Pei/PeiM= ain.inf index 0cf357371a16..73738c939ac7 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.inf +++ b/MdeModulePkg/Core/Pei/PeiMain.inf @@ -66,6 +66,7 @@ [LibraryClasses] PeCoffLib PeiServicesTablePointerLib PcdLib + TimerLib =20 [Guids] gPeiAprioriFileNameGuid ## SOMETIMES_CONSUMES ## File @@ -78,6 +79,7 @@ [Guids] gEfiFirmwareFileSystem3Guid gStatusCodeCallbackGuid gEdkiiMigratedFvInfoGuid ## SOMETIMES_PRODUCES = ## HOB + gEfiDelayedDispatchTableGuid ## SOMETIMES_PRODUCES = ## HOB =20 [Ppis] gEfiPeiStatusCodePpiGuid ## SOMETIMES_CONSUMES # Pe= iReportStatusService is not ready if this PPI doesn't exist @@ -100,6 +102,8 @@ [Ppis] gEfiPeiReset2PpiGuid ## SOMETIMES_CONSUMES gEfiSecHobDataPpiGuid ## SOMETIMES_CONSUMES gEfiPeiCoreFvLocationPpiGuid ## SOMETIMES_CONSUMES + gEfiPeiDelayedDispatchPpiGuid ## SOMETIMES_CONSUMES + gEfiEndOfPeiSignalPpiGuid ## CONSUMES =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeiStackSize = ## CONSUMES @@ -112,6 +116,9 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdShadowPeimOnBoot = ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdInitValueInTempStack = ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMigrateTemporaryRamFirmwareVolumes = ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdDelayedDispatchMaxDelayUs = ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdDelayedDispatchCompletionTimeoutUs = ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdDelayedDispatchMaxEntries = ## CONSUMES =20 # [BootMode] # S3_RESUME ## SOMETIMES_CONSUMES diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 0ff058b0a9da..2f4bd2f2b773 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -418,6 +418,9 @@ [Guids] ## Include/Guid/MigratedFvInfo.h gEdkiiMigratedFvInfoGuid =3D { 0xc1ab12f7, 0x74aa, 0x408d, { 0xa2, 0xf4,= 0xc6, 0xce, 0xfd, 0x17, 0x98, 0x71 } } =20 + ## Delayed Dispatch table GUID + gEfiDelayedDispatchTableGuid =3D { 0x4b733449, 0x8eff, 0x488c, {0x92, 0x= 1a, 0x15, 0x4a, 0xda, 0x25, 0x18, 0x07}} + # # GUID defined in UniversalPayload # @@ -991,6 +994,18 @@ [PcdsFixedAtBuild] # @ValidList 0x80000006 | 0x03058002 gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable|0x03058002|UINT32= |0x30001040 =20 + ## Delayed Dispatch Maximum Delay in us (microseconds) + # Maximum delay for any particular delay request - 5 seconds + gEfiMdeModulePkgTokenSpaceGuid.PcdDelayedDispatchMaxDelayUs|5000000|UINT= 32|0x3000104A + + ## Delayed Dispatch timeout in us (microseconds) + # Maximum delay when waiting for completion (ie EndOfPei) - 10 seconds + gEfiMdeModulePkgTokenSpaceGuid.PcdDelayedDispatchCompletionTimeoutUs|100= 00000|UINT32|0x3000104B + + ## Delayed Dispatch Max Entries + # Maximum number of delayed dispatch entries + gEfiMdeModulePkgTokenSpaceGuid.PcdDelayedDispatchMaxEntries|8|UINT32|0x3= 000104C + ## Mask to control the NULL address detection in code for different phas= es. # If enabled, accessing NULL address in UEFI or SMM code can be caught.=

# BIT0 - Enable NULL pointer detection for UEFI.
--=20 2.41.0.windows.2 -=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 (#107114): https://edk2.groups.io/g/devel/message/107114 Mute This Topic: https://groups.io/mt/100264778/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- From nobody Tue May 21 05:03:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+107115+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107115+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1689887259; cv=none; d=zohomail.com; s=zohoarc; b=gJjhrftlkXPm/rcaZShcSBDhL0Qk+Y4G5V98Slu9m8Lw3rZD5Q2iRhN5EEUG5A2TQcPnAI/+YjOJWP699h6gB4Irpeuog2/d/yjahRFeRrskOZp/OJXn5KkOccQ5Kzk3FcXZxYqX/z6pCmAWnfczEuVqp3G42hOI7BJrnTPTaCc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689887259; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Py7sHXZ7Ssn+SH9tir19Y3EN6yMEnG0+t60qCqt4wjI=; b=Cr7FS4DEaImliRMzR78trshgWsNLNv7+IdaQIW1bxxlF6dXlZAnt8VkRnytOwPmM3sd6TMZomNXCQMg1/FIwV3R+BYz7rx5gGeGqDWKXtVPixvD3PdHcH1/wB/uer+T+Z/EBZ9lUrMrthUKlirPKYfGN+Fn2DcB7mdPa4pwlqn0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107115+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1689887259392312.0117871245453; Thu, 20 Jul 2023 14:07:39 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=0mwpKk9wbFeCRy5XLgCnItFluc7fk50kCldHv9fJgzw=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:X-Received:From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1689887259; v=1; b=RqGWYDFp4CMElvkluk1DaZWukJLNuG12krwrwVB2bSENmVBwBizY1qg67DbDsgVsjd1WWlh6 2X7Ux7xMG2fVSUM9UT2/ObCxVlTGBGr3xlQXu6ifywofKsJR/N3N6CkyqD5rjVAt3Sj2R7gX9fG 7Tp4POVHf08WL752BzJfuq0Q= X-Received: by 127.0.0.2 with SMTP id 6SDtYY1788612xbYoCtefOGv; Thu, 20 Jul 2023 14:07:39 -0700 X-Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by mx.groups.io with SMTP id smtpd.web10.1789.1689887258418676439 for ; Thu, 20 Jul 2023 14:07:38 -0700 X-Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1b8b2b60731so7660755ad.2 for ; Thu, 20 Jul 2023 14:07:38 -0700 (PDT) X-Gm-Message-State: mP8tSiblS3AYjgRH8lkFkeo5x1787277AA= X-Google-Smtp-Source: APBJJlF8dEEJM0DjqwDPNieZQ4p6UQOvjRqO4pAGykG9KWmdp+txmasMeDfhxTjZPO5h1GB9In2iGA== X-Received: by 2002:a17:902:e5d1:b0:1b8:8b72:fa28 with SMTP id u17-20020a170902e5d100b001b88b72fa28mr123010plf.58.1689887257626; Thu, 20 Jul 2023 14:07:37 -0700 (PDT) X-Received: from MININT-0U7P5GU.redmond.corp.microsoft.com ([2001:4898:80e8:37:e07c:3f9b:2f13:3c64]) by smtp.gmail.com with ESMTPSA id d1-20020a170902aa8100b001b9ecee9f81sm1855943plr.129.2023.07.20.14.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 14:07:37 -0700 (PDT) From: "Kun Qin" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Dandan Bi , Debkumar De , Catharine West , Mike Turner Subject: [edk2-devel] [PATCH v1 4/4] MdeModulePkg: PeiMain: Updated dispatcher for delayed dispatch Date: Thu, 20 Jul 2023 14:07:28 -0700 Message-ID: <20230720210729.774-5-kuqin12@gmail.com> In-Reply-To: <20230720210729.774-1-kuqin12@gmail.com> References: <20230720210729.774-1-kuqin12@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: 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,kuqin12@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689887261110100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4496 This change adds a check for PEI dispatcher to continue dispatching when there are still pending delayed dispatch requests, to be compatible with newly integrated Delayed Dispatcher PPI interface. Cc: Jian J Wang Cc: Liming Gao Cc: Dandan Bi Cc: Debkumar De Cc: Catharine West Co-authored-by: Mike Turner Signed-off-by: Kun Qin --- MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/C= ore/Pei/Dispatcher/Dispatcher.c index 50e59bdbe732..6eb807500e5e 100644 --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c @@ -2000,7 +2000,10 @@ PeiDispatcher ( // pass. If we did not dispatch a PEIM/FV there is no point in trying= again // as it will fail the next time too (nothing has changed). // - } while (Private->PeimNeedingDispatch && Private->PeimDispatchOnThisPass= ); + // Also continue dispatch loop if there are outstanding delay- + // dispatch registrations still running. + } while ((Private->PeimNeedingDispatch && Private->PeimDispatchOnThisPas= s) || + (Private->DelayedDispatchTable->Count > 0)); } =20 /** --=20 2.41.0.windows.2 -=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 (#107115): https://edk2.groups.io/g/devel/message/107115 Mute This Topic: https://groups.io/mt/100264779/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-