From nobody Sat May 18 23:55:18 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+109467+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+109467+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1696897143; cv=none; d=zohomail.com; s=zohoarc; b=fxLPobdtzZC7cws8pmQ6T3eTwllVaICtywRkWk63xZ7PlFWdf0Uq+QBaqaGFOiEbKzzlmkGUFSfxBuv439GB+0mZRIHH2Seu1vhw2QoOp4p1W8r733zqoiQnT0HZiuUd3bfN1UEk7WF8Xysae4AK4Psp6eQ16fO/6Dk+6u114Lw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696897143; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=o0gIM/QUeaFXFsUhfWE93lOuf22Z3W9w0xX4IWxL1dI=; b=WwuwIQo4JFzE/wml9How7Lad3pBxJk6+ruCepN4IBQlN9DyVEPDCxAWD1bzyOD+FslLZIRJq9I8WTNuf8s8vr2oIhZK+MTdkYnZzkg/eVpVQq+Pg3CNwL2/NmL1rgB67JV8xeR2nmYseNQJqewwrNFWMbpNfXGupAiCnGTAALGA= 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+109467+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 16968971430711007.382621044044; Mon, 9 Oct 2023 17:19:03 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=Dhi/7NB6XiebW6P25Kq7yM54nxxk7aCDKrQ80NufT6E=; c=relaxed/simple; d=groups.io; h=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=1696897142; v=1; b=J5xgCsHR52yXVY5Ps9AlqBIN1VGAW7HWWV9pZjXYoIRQEVKtfe2PQ2g2eeXq6/WUvipp0/1W w+eyliASlnASEkNeNZjE7xwDPy6AUIyAtesLDIKEX+B1FLDWGWxqegG4DIeCFt+Oy/qtpH4LQk2 0nhgWLcy42VrEdfwnxoPpaMQ= X-Received: by 127.0.0.2 with SMTP id asHOYY1788612xzcSBX33sNy; Mon, 09 Oct 2023 17:19:02 -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.web11.79649.1696897142297258676 for ; Mon, 09 Oct 2023 17:19:02 -0700 X-Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1c60778a3bfso42426605ad.1 for ; Mon, 09 Oct 2023 17:19:02 -0700 (PDT) X-Gm-Message-State: 10Dfrwavq2olGbQ4ZqO5j7six1787277AA= X-Google-Smtp-Source: AGHT+IHDG/wf9C6zKX4UXv5JZMxycV73xGAK9Do5NStbTssgE7i1mpbfHprtDc6ouvomPErxrsJwDw== X-Received: by 2002:a17:903:2645:b0:1c7:3156:ca3d with SMTP id je5-20020a170903264500b001c73156ca3dmr16089384plb.57.1696897141572; Mon, 09 Oct 2023 17:19:01 -0700 (PDT) X-Received: from MININT-0U7P5GU.redmond.corp.microsoft.com ([2001:4898:80e8:3:ad0d:fa50:c6ca:fefc]) by smtp.gmail.com with ESMTPSA id a12-20020a170902ee8c00b001acae9734c0sm10214809pld.266.2023.10.09.17.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 17:19:00 -0700 (PDT) From: "Kun Qin" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu , Mike Turner Subject: [edk2-devel] [PATCH v2 1/4] MdePkg: DelayedDispatch: Correct PPI descriptions Date: Mon, 9 Oct 2023 17:18:52 -0700 Message-ID: <20231010001856.1567-2-kuqin12@gmail.com> In-Reply-To: <20231010001856.1567-1-kuqin12@gmail.com> References: <20231010001856.1567-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: 1696897144232100002 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 --- Notes: v2: - No review, no change. 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.42.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 (#109467): https://edk2.groups.io/g/devel/message/109467 Mute This Topic: https://groups.io/mt/101865808/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 Sat May 18 23:55:18 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+109468+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+109468+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1696897144; cv=none; d=zohomail.com; s=zohoarc; b=DYvItnkcXPqOZQ8Q93/M1bBuV8Ua9Lng1fIPKvdepSjma9jwCey1UacNhJbxMGwsU2GxHut5YuZaoA8CAdRv0REuIS6I3l46FX0E5hwEO5+DEwpg0pqlZLU+SpfW9P9Fhl0tu2ZZmlnTeyx/ix7MP0VaGZmv4N3VP4vAn7jvO64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696897144; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=oHig3YGVY21NSvI2hbOeiZXLqlaRrsBLQZqm9cS+bUA=; b=FwY877d+frF4qyOWT9MX8wzybU3kuI3uzvCSNjc5CrUT/q/VcrH9O+Mcr9F/K1xkCzZpl39ZFb93YggQ0lEow/mg+KEyNKpVfLjXtrWY9wxpSdb1M9+AfwGXhInQg++V+SSNmYsbOvu0crivkwoyD21hj4TVM24Gc2aGAVlSMeU= 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+109468+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 1696897143935897.0844006339642; Mon, 9 Oct 2023 17:19:03 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=/9mqZ2dxtXFgGhYTkc+IBjvOVy8W3VpR2+hOJcSVvGg=; c=relaxed/simple; d=groups.io; h=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=1696897143; v=1; b=OzoJKSzjT84B1k5IbRiPWoajUZbqJINAhP/VnIfJYlu7+rUSqNsF3LGEGAvqr0znL0/tvCKH +Nlrzzt3QGF9zHEADgxMl5GMuU2S/+GrOikLujMJUg1GGGGvUOxQkEIzxuCpJkV+XWSECHnljdM xNE36Q5gUF1YE7rICyc4VvGc= X-Received: by 127.0.0.2 with SMTP id 87gNYY1788612xptEEdg6X6J; Mon, 09 Oct 2023 17:19:03 -0700 X-Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mx.groups.io with SMTP id smtpd.web11.79650.1696897143077884638 for ; Mon, 09 Oct 2023 17:19:03 -0700 X-Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1c5ff5f858dso33816525ad.2 for ; Mon, 09 Oct 2023 17:19:03 -0700 (PDT) X-Gm-Message-State: ey2AaDkAJWIsLuQSnBY8xpCzx1787277AA= X-Google-Smtp-Source: AGHT+IGJY/l3YNuV1uTcrEYxOKpJhGgj788e6PAnDfR5opzKNiyYoJ7+M1lc0m2elq528TcLbppPJg== X-Received: by 2002:a17:902:f68f:b0:1c4:2b87:76f0 with SMTP id l15-20020a170902f68f00b001c42b8776f0mr15579722plg.47.1696897142347; Mon, 09 Oct 2023 17:19:02 -0700 (PDT) X-Received: from MININT-0U7P5GU.redmond.corp.microsoft.com ([2001:4898:80e8:3:ad0d:fa50:c6ca:fefc]) by smtp.gmail.com with ESMTPSA id a12-20020a170902ee8c00b001acae9734c0sm10214809pld.266.2023.10.09.17.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 17:19:01 -0700 (PDT) From: "Kun Qin" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu , Mike Turner Subject: [edk2-devel] [PATCH v2 2/4] MdePkg: DelayedDispatch: Added WaitOnEvent interface Date: Mon, 9 Oct 2023 17:18:53 -0700 Message-ID: <20231010001856.1567-3-kuqin12@gmail.com> In-Reply-To: <20231010001856.1567-1-kuqin12@gmail.com> References: <20231010001856.1567-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: 1696897146228100012 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 --- Notes: v2: - Fixed PI spec version number to v1.8 [Liming] MdePkg/Include/Ppi/DelayedDispatch.h | 26 ++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/MdePkg/Include/Ppi/DelayedDispatch.h b/MdePkg/Include/Ppi/Dela= yedDispatch.h index 098d57758551..0efcfdbfced6 100644 --- a/MdePkg/Include/Ppi/DelayedDispatch.h +++ b/MdePkg/Include/Ppi/DelayedDispatch.h @@ -1,5 +1,5 @@ /** @file - EFI Delayed Dispatch PPI as defined in the PI 1.7 Specification + EFI Delayed Dispatch PPI as defined in the PI 1.8 Specification =20 Provide timed event service in PEI =20 @@ -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.42.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 (#109468): https://edk2.groups.io/g/devel/message/109468 Mute This Topic: https://groups.io/mt/101865809/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 Sat May 18 23:55:18 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+109469+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+109469+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1696897145; cv=none; d=zohomail.com; s=zohoarc; b=OGDNAeNyGlXBTftZckAK+29g50gWOZ/BIZ24Os9JyduoZ+2ekadFn/5ApmEp8JGEt7LdbPY7BRSIUsfaNZ7cBY2i9PvgDDu16LkY593AjV0bcSx8Y7rJQsQDmeFKtferR33xe9lOuqD4bGai1P2xqu/YUw4SL4faT8lfx65otyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696897145; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=A+pKDneG/zRIpUF+P/zmiJThCaKF8LC/Nsvti81vQ+4=; b=Cemh5imu8xwqp8/DlJ2YiURTtiDe+yCvIHkFG2C1nn20lagNyCI8tufXQOV72FpXnO/zDQ6pstjOdzKrkd4jm9qvYdx/0/5okC44m4bxE/hox1cqVGCOpd1hdz8rJ8/tTdfPcuZOUaO/rpznbPM9w6HPqY1kEyBctHF0TBYji30= 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+109469+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 1696897145010553.6728442234496; Mon, 9 Oct 2023 17:19:05 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=OIpyM78GyraaQdI88/lUCoRyMxpxYJX5Patq2sWjEcA=; c=relaxed/simple; d=groups.io; h=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=1696897144; v=1; b=WTuijYdBYAt5SeZVJ9updpvG/izaosadT2loSlvEOcelTwPWk9e8uk7ns1t0S/lQklF8tMof BctnzyjNCuxhvb+a5jVTYZq9VNzQOZQSoZT7RUIHrbZqvMaGVo70dXqGIiZKi/bjfMPYGEzafUF 1sJihdi1XbrJqosw/lbmb6+0= X-Received: by 127.0.0.2 with SMTP id mo2yYY1788612xr1RTabInCa; Mon, 09 Oct 2023 17:19:04 -0700 X-Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mx.groups.io with SMTP id smtpd.web11.79652.1696897144193684514 for ; Mon, 09 Oct 2023 17:19:04 -0700 X-Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1c60cec8041so30497345ad.3 for ; Mon, 09 Oct 2023 17:19:04 -0700 (PDT) X-Gm-Message-State: Um9lPKtLZrNVJ5mIM8ATqkmux1787277AA= X-Google-Smtp-Source: AGHT+IHB+C7jtGF0q6+HA62Oh5YBYRlxjPxNxow4aTURM7hu+jK3oIS3ZtjssuWJ4AR2YWFoj+VHQg== X-Received: by 2002:a17:902:778a:b0:1bd:d14a:7e14 with SMTP id o10-20020a170902778a00b001bdd14a7e14mr12949397pll.65.1696897143371; Mon, 09 Oct 2023 17:19:03 -0700 (PDT) X-Received: from MININT-0U7P5GU.redmond.corp.microsoft.com ([2001:4898:80e8:3:ad0d:fa50:c6ca:fefc]) by smtp.gmail.com with ESMTPSA id a12-20020a170902ee8c00b001acae9734c0sm10214809pld.266.2023.10.09.17.19.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 17:19:02 -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 v2 3/4] MdeModulePkg: PeiMain: Introduce implementation of delayed dispatch Date: Mon, 9 Oct 2023 17:18:54 -0700 Message-ID: <20231010001856.1567-4-kuqin12@gmail.com> In-Reply-To: <20231010001856.1567-1-kuqin12@gmail.com> References: <20231010001856.1567-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: 1696897146280100013 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 --- Notes: v2: - Fixed function documentation [Liming] - Removed GUID declaration internal to PEI core [Liming] - Removed max entry PCD declaration and use macro instead [Liming] - Added "PRODUCED" in inf [Liming] MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 366 ++++++++++++++++++++ MdeModulePkg/Core/Pei/PeiMain/PeiMain.c | 3 + MdeModulePkg/Core/Pei/PeiMain.h | 76 ++++ MdeModulePkg/Core/Pei/PeiMain.inf | 5 + MdeModulePkg/MdeModulePkg.dec | 8 + 5 files changed, 458 insertions(+) diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/C= ore/Pei/Dispatcher/Dispatcher.c index 5f32ebb560ae..f7f4cce84174 100644 --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c @@ -3,14 +3,354 @@ =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 +// +// Maximal number of Delayed Dispatch entries supported +// +#define DELAYED_DISPATCH_MAX_ENTRIES 8 + +// +// Utility global variables +// + +// Delayed Dispatch table GUID +EFI_GUID gEfiDelayedDispatchTableGuid =3D { + 0x4b733449, 0x8eff, 0x488c, { 0x92, 0x1a, 0x15, 0x4a, 0xda, 0x25, 0x18, = 0x07 } +}; + +/** + 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_P= PI + + @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 DELAYED_DISPATCH_MAX_ENTRIES) { + ASSERT (DelayedDispatchTable->Count < DELAYED_DISPATCH_MAX_ENTRIES); + 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 + + Delayed Dispach cycle (ie one pass) through each entry, calling function= s when their + time has expired. When UniqueId is specified, if there are any of the s= pecified entries + in 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. =20 + @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; +} + +/** Discover all PEIMs and optional Apriori file in one FV. There is at most= one Apriori file in one FV. =20 @@ -1365,12 +1705,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) + = ((DELAYED_DISPATCH_MAX_ENTRIES - 1) * sizeof (DELAYED_DISPATCH_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 +1980,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..542b680c099c 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 usage, a= nd cannot exceed DELAYED_DISPATCH_MAX_ENTRIES; +} 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..b2c1e53949de 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 @@ -100,6 +101,8 @@ [Ppis] gEfiPeiReset2PpiGuid ## SOMETIMES_CONSUMES gEfiSecHobDataPpiGuid ## SOMETIMES_CONSUMES gEfiPeiCoreFvLocationPpiGuid ## SOMETIMES_CONSUMES + gEfiPeiDelayedDispatchPpiGuid ## PRODUCES + gEfiEndOfPeiSignalPpiGuid ## CONSUMES =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeiStackSize = ## CONSUMES @@ -112,6 +115,8 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdShadowPeimOnBoot = ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdInitValueInTempStack = ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMigrateTemporaryRamFirmwareVolumes = ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdDelayedDispatchMaxDelayUs = ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdDelayedDispatchCompletionTimeoutUs = ## CONSUMES =20 # [BootMode] # S3_RESUME ## SOMETIMES_CONSUMES diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index dd182c02fdf6..cb49ef50b864 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -994,6 +994,14 @@ [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 + ## 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.42.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 (#109469): https://edk2.groups.io/g/devel/message/109469 Mute This Topic: https://groups.io/mt/101865810/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 Sat May 18 23:55:18 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+109470+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+109470+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1696897145; cv=none; d=zohomail.com; s=zohoarc; b=XcSjKs+xZSDPv1kR1sJbcia6p4a744N6v0lZuBuK3g+I8rugoOSrNdD6fXlc836l6hIfAQeufWlS+08JpTwznCW0YGrQtf7gzeFCVOafs+NpRQwpFHlxvUyEt/AlUgdPRC8dWWFFnC5FBAqTylIsJUT2g4IKJAN2U2eRwWlll0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696897145; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=cqjgTwQ+3iCaUB/ZX5kFhHuksSeHfu63SJle/t9UHME=; b=XpS15CeagFz3dEL+luLjclt+CRh8P1XRzo2hq3RsICWanBSIe6DXLETx9ULAi0RbE+eNxvhsJi8auG3fbN49Vav+e9lw/OaObCIGrCTdeYOF6VpaL/EgC+1CkhOhaoMNZVhRccKNNlu3NxVOuyUwMQD3dmWZdskPYM78/7asO+k= 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+109470+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 1696897145826382.1457713670096; Mon, 9 Oct 2023 17:19:05 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=dh0yYYfRoHCcd5AOo4BIxgRnuS/90IfECLJUzhE4gUM=; c=relaxed/simple; d=groups.io; h=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=1696897145; v=1; b=UZ0w7KF4B4Gl7qOeX64rI9+YJQwfIJPhjxB1mHKYTbz/ED7UVmJpEr27/O5zxy8IC0gERP68 MpWOd8qd7r8TYWCkDjfYT3t9E46ZwE9TMmZaMCrl7c0L3afCN6ymLfL/a/8hOiyJsWyCeWICUVj ZewlwZ6nGaro0T4fjtehxbUw= X-Received: by 127.0.0.2 with SMTP id 2xsFYY1788612xojh2rtkwhx; Mon, 09 Oct 2023 17:19:05 -0700 X-Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mx.groups.io with SMTP id smtpd.web11.79653.1696897144980902798 for ; Mon, 09 Oct 2023 17:19:05 -0700 X-Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-692a885f129so3821109b3a.0 for ; Mon, 09 Oct 2023 17:19:04 -0700 (PDT) X-Gm-Message-State: YyFkPU98bz6BJgiq1VdvPfM1x1787277AA= X-Google-Smtp-Source: AGHT+IFvYc8slC6HYUQ/9vETNksM5Wb17sKYv5t+Xf9wIxNunC9EV2/0p3uq7vaL21nT2rYUmM4G0A== X-Received: by 2002:a05:6a20:3d1e:b0:16b:80d3:7f10 with SMTP id y30-20020a056a203d1e00b0016b80d37f10mr9844398pzi.34.1696897144182; Mon, 09 Oct 2023 17:19:04 -0700 (PDT) X-Received: from MININT-0U7P5GU.redmond.corp.microsoft.com ([2001:4898:80e8:3:ad0d:fa50:c6ca:fefc]) by smtp.gmail.com with ESMTPSA id a12-20020a170902ee8c00b001acae9734c0sm10214809pld.266.2023.10.09.17.19.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 17:19:03 -0700 (PDT) From: "Kun Qin" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Dandan Bi , Debkumar De , Catharine West , John Schock Subject: [edk2-devel] [PATCH v2 4/4] MdeModulePkg: PeiMain: Updated dispatcher for delayed dispatch Date: Mon, 9 Oct 2023 17:18:55 -0700 Message-ID: <20231010001856.1567-5-kuqin12@gmail.com> In-Reply-To: <20231010001856.1567-1-kuqin12@gmail.com> References: <20231010001856.1567-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: 1696897146209100011 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: John Schock Signed-off-by: Kun Qin --- Notes: v2: - Fix up author 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 f7f4cce84174..bec829dc17f3 100644 --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c @@ -2013,7 +2013,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.42.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 (#109470): https://edk2.groups.io/g/devel/message/109470 Mute This Topic: https://groups.io/mt/101865811/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-