public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* NotifyPpi description contradiction
@ 2016-11-06  0:43 valerij zaporogeci
  2016-11-07 15:47 ` Laszlo Ersek
  0 siblings, 1 reply; 3+ messages in thread
From: valerij zaporogeci @ 2016-11-06  0:43 UTC (permalink / raw)
  To: edk2-devel

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 “PEIM Descriptors” 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 descriptor
includes the following:
• A reference to EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI
• A reference to a function within this same PEIM called SampleCallback
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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-07 21:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-06  0:43 NotifyPpi description contradiction valerij zaporogeci
2016-11-07 15:47 ` Laszlo Ersek
2016-11-07 21:04   ` valerij zaporogeci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox