3.4 Handle database
The handle database is composed of objects called handles and protocols. Handles are a collection of one or more protocols and protocols are data structures named by a GUID. The data structure for a protocol may contain data fields, services, both or none at all.
At reset, the Handle Database is empty. During platform initialization, the system firmware, UEFI conformant drivers and UEFI applications create handles and attach one or more protocols to the handles. Information in the handle database is "global" and accessible by any executable UEFI image.
The handle database is a list of UEFI handles and is the central repository for the objects maintained by UEFI-based firmware. Each UEFI handle identified by a unique handle number is maintained by the system firmware. A handle number provides a database "key" to an entry in the handle database. Each entry in the handle database is a collection of one or more protocols. The types of protocols named by a GUID attach to a UEFI handle and determine the handle type. A UEFI handle may represent components like:
- Executable images such as UEFI drivers and UEFI applications
- Devices such as network controllers and hard drive partitions
- UEFI services which are accessed as drivers such as EFI Decompress and the EBC Interpreter
The following figure shows a portion of the handle database. In addition to the handles and protocols, a list of objects is associated with each protocol. The handle database uses this list to track which agents are consuming which protocols. This information is critical to the operation of UEFI drivers. It is what allows UEFI drivers to be safely loaded, started, stopped and unloaded without resource conflicts.
###### Figure 2-Handle database !(../media/image3.jpg) The figure for Handle types, below, shows the different types of handles that may be present in the handle database and the relationships between the various handle types. The handle-related terms introduced here appear throughout the document. There is only one handle database and all handles reside in it. Services that manage the Handle database do not distinguish handle types. Handles are differentiated by the types of protocols associated with each handle.
The following table describes the types of handles shown above. The UEFI Specification provides detailed information on these types of handles, the protocols they support, and the different driver types. Note that HII handles are considered service handles.