Services
Version 1.02 12/12/00 55
3.3 Protocol Handler Services
In the abstract, a protocol consists of a 128-bit guaranteed unique identifier (GUID) and a Protocol
Interface structure. The structure contains the functions and instance data that are used to access a
device. The functions that make up Protocol Handler Services allow applications to install a
protocol on a handle, identify the handles that support a given protocol, determine whether a handle
supports a given protocol, and so forth. See Table 3-7.
Table 3-7. Protocol Interface Functions
Name Type Description
InstallProtocolInterface Boot Installs a protocol interface on a device handle.
UninstallProtocolInterface Boot Removes a protocol interface from a device handle.
ReinstallProtocolInterface Boot Reinstalls a protocol interface on a device handle.
RegisterProtocolNotify Boot Registers an event that is to be signaled whenever an interface is
installed for a specified protocol.
LocateHandle Boot Returns an array of handles that support a specified protocol.
HandleProtocol Boot Queries a handle to determine if it supports a specified protocol.
LocateDevicePath Boot Locates all devices on a device path that support a specified
protocol and returns the handle to the device that is closest to the
path.
As depicted in Figure 3-1, the firmware is responsible for maintaining a data base that shows
which protocols are attached to each device handle. (The figure depicts the data base as a linked
list, but the choice of data structure is implementation-dependent.) The data base is built
dynamically by calling the InstallProtocolInterface()function. Protocols can only be
installed by EFI drivers or the firmware itself. In the figure, a device handle (EFI_HANDLE) refers
to a list of one or more registered protocol interfaces for that handle. The first handle in the system
has four attached protocols, and the second handle has two attached protocols. Each attached
protocol is represented as a GUID / Interface pointer pair. The GUID is the name of the protocol,
and Interface points to a protocol instance. This data structure will typically contain a list of
interface functions, and some amount of instance data.
Access to devices is initiated by calling the HandleProtocol() function, which determines
whether a handle supports a given protocol. If it does, a pointer to the matching Protocol Interface
structure is returned.
When a protocol is added to the system, it may either be added to an existing device handle or it
may be added to create a new device handle. Figure 3-1 shows that protocol handlers are listed for
each device handle and that each protocol handler is logically an EFI driver.