From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-x22e.google.com (mail-lf0-x22e.google.com [IPv6:2a00:1450:4010:c07::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9BDE081DB1 for ; Sat, 5 Nov 2016 17:43:14 -0700 (PDT) Received: by mail-lf0-x22e.google.com with SMTP id b14so89216074lfg.2 for ; Sat, 05 Nov 2016 17:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=vcPwUrSGkOFvzIPYulKH0/RCjSS2H6G9soADTvDVz74=; b=PTrcIw5TGxBh64ZFNc/ZwUx+yxsiKmVjlsAUYhrqL+YvdMaQsJ0TuNvwE/5MLfluyA 0sQFJ6aWDHsXpKPHFu2IFXdrTIVX8CcSGFUI1MTCqtA4D2Odsja5mmw3qx21+C4p0gKF 7EyDX+kxCh+ItTGQEPDR9XbDYsGzIDdhXK/uoK+h1zGOA7EUcWqsX1wr6TbptCr5utfn T67ABBBaxZvJ1AC2EIlo8HyW77yvIEoTN6EY0aU5vGA+1THYg34Xn3cC5KzBpUTDAiQi 5fBCLNsZuKkbEWMiqaasNGaS3eIEzBt4P4YnX0qimbZStaYw1GwJVx4bwKS11ZJksAMm IKKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=vcPwUrSGkOFvzIPYulKH0/RCjSS2H6G9soADTvDVz74=; b=LEGJLNajrRl/bUooegh3TOraHB9//7YRlGLtrzCos/5VGVC/gMAg53bJwf0zJJ4Vsk FlU0f9XqNovAVwUSIWlQ6du02jr5XnfUZH5S+Wp7/o1i6UGDxZSEBjW28q3kd+HvsxHz 0U3yGdML6E7NFIg5ihPOd3pfVVsvZSFmsqdNZER/lHzwsINMJPvZBXc9lFPEfZJgirHj 5eyzbO9SVYxDzyJUT/RH2Y7BifJezexSyDIt/Nwa23Nsh6ert+6r/T+636rqi+WW2j4D CyoW0HVAXFOD7gqM7Jn68kuTcV5xcVDcBuOw01VOGWm0vr9pQDyKQiyGQBvEABi8bc2s DlGQ== X-Gm-Message-State: ABUngvfD3+llkRp24IfEVy4MUP/iOXi6BLLq6Tx11J/0ntjrwEdecLLuTfyvFuq0KMg5Ip6ZMJlED6ZCG8CtLA== X-Received: by 10.25.193.196 with SMTP id r187mr135368lff.21.1478392994747; Sat, 05 Nov 2016 17:43:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.29.194 with HTTP; Sat, 5 Nov 2016 17:43:13 -0700 (PDT) From: valerij zaporogeci Date: Sun, 6 Nov 2016 02:43:13 +0200 Message-ID: To: edk2-devel Subject: NotifyPpi description contradiction X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2016 00:43:15 -0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi. I have two quotes from Pei spec (Vol1) related to the notification (callback) invocation logic. Tell me, which one tells the truth. They are obviously contradictive. Quote (page 26, description of NotifyPpi service): Description This service enables PEIMs to register a given service to be invoked when another service is installed or reinstalled. This service will fire notifications on PPIs installed prior to this service invocation. This is different behavior than the RegisterProtocolNotify of UEFI2.0, for example EFI_PEI_NOTIFY_DESCRIPTOR is defined in =E2=80=9CPEIM Descriptors=E2=80=9D = on page 113. Quote (page 115-116, EFI_PEI_NOTIFY_DESCRIPTOR description): Description EFI_PEI_NOTIFY_DESCRIPTOR is a data structure that is used by a PEIM that needs to be called back when a PPI is installed or reinstalled. The notification is similar to the RegisterProtocolNotify() function in the UEFI 2.0 Specification. ... Following is an example of the notification use model for EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI. In this example, a PEIM called SamplePeim executes early in the PEI phase before main memory is available. However, SamplePeim also needs to create some large data structure later in the PEI phase. As such, SamplePeim has a NULL depex, but after its entry point is processed, it needs to call NotifyPpi() with a EFI_PEI_NOTIFY_DESCRIPTOR, where the notification descri= ptor includes the following: =E2=80=A2 A reference to EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI =E2=80=A2 A reference to a function within this same PEIM called SampleCall= back When the PEI Foundation finally migrates the system from temporary to permanent memory and installs the EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI, the PEI Foundation assesses if there are any pending notifications on this PPI. After the PEI Foundation discovers the descriptor from SamplePeim, the PEI Foundation invokes SampleCallback. So, when SamplePeim invokes NotifyPpi on EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI, its callback (SampleCallback) will be called if EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI is ALREADY installed at this time, or if EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI will be installed later, AFTER this notification registration for it by NotifyPpi? It's obvious, that the answer is the second variant - when the PPI in question will be installed AFTER the notification registration on it. As it is seen on the quoted example. But then, the first quote, NotifyPpi description, says absolutely opposite and very misleading thing. And yet, in light of the above, NotifyPpi description also lacks explanation how it would behave if a PEIM tries to register a notification for the PPI already installed. What should happen in this case? Should Peim's callback still be called (when if so)? Or should NotifyPpi return an error, or success without any action? I believe, it should register it and call only for the other later installed instances with the same GUID. Is it a right guess? And also, regarding the fact there might be multiple instances of the particular PPI (with the same Guid). Did I understood properly, that with this model, since Peim registers for notification by the GUID, this means that on every instance installation and reinstallation of the PPI with the same GUID, Peim's callback will and should be called? Thank you for possible answer.