EFI PEI NOTIFY DESCRIPTOR

From PhoenixWiki

Jump to: navigation, search

The data structure in a given PEIM that tells the PEI Foundation where to invoke the notification service.

Prototype

typedef EFI_PEI_NOTIFY_DESCRIPTOR {
  UINTN                       Flags;
  EFI_GUID                    *Guid;
  EFI_PEIM_NOTIFY_ENTRY_POINT Notify;
} EFI_PEI_NOTIFY_DESCRIPTOR;

Members

Member Description
Flags Details if the type of notification is callback or dispatch.
Guid The address of the EFI_GUID that names the interface.
Notify Address of the notification callback function itself within the PEIM.

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. The use model is complementary to the dependency expression (depex) and is as follows:

  • A PEIM expresses the PPIs that it must have to execute in its depex list.
  • A PEIM expresses any other PEIMs that it needs, perhaps at some later time, in EFI_PEI_NOTIFY_DESCRIPTOR.

The latter data structure includes the GUID of the PPI for which the PEIM publishing the notification would like to be reinvoked. 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:

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.

With respect to the Flags parameter, the difference between callback and dispatch mode is as follows:

  • Callback mode: Invokes all of the agents that are registered for notification immediately after the PPI is installed.
  • Dispatch mode: Calls the agents that are registered for notification only after the PEIM that installs the PPI in question has returned to the PEI Foundation.

The callback mechanism will give a better quality of service, but it has the downside of possibly deepening the use of the stack (i.e., the agent that installed the PPI that engenders the notification is a PEIM itself that has used the stack already). The dispatcher mode, however, is better from a stack usage perspective in that when the PEI Foundation invokes the agents that want notification, the stack has returned to the minimum stack usage of just the PEI Foundation.


Copyright (C) 2008 Phoenix Technologies Ltd. All Rights Reserved.

Personal tools