Examples – Intel Extensible Firmware Interface User Manual
Page 162

Extensible Firmware Interface Specification
5-64
12/01/02
Version 1.10
Examples
//
// Connect All Handles Example
//
The following example recusively connects all controllers in a platform.
//
EFI_STATUS
Status;
EFI_BOOT_SERVICES_TABLE
*gBS;
UINTN
HandleCount;
EFI_HANDLE
*HandleBuffer;
UINTN
HandleIndex;
//
// Retrieve the list of all handles from the handle database
//
Status = gBS->LocateHandleBuffer (
AllHandles,
NULL,
NULL,
&HandleCount,
&HandleBuffer
);
if (!EFI_ERROR (Status)) {
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
Status = gBS->ConnectController (
HandleBuffer[HandleIndex],
NULL,
NULL,
TRUE
);
}
gBS->FreePool(HandleBuffer);
}
//
// Connect Device Path Example
//
The following example walks the device path nodes of a device path, and
//
connects only the drivers required to force a handle with that device path
//
to be present in the handle database.
This algorithms guarantees that
//
only the minimum number of devices and drivers are initialized.
//
EFI_STATUS
Status;
EFI_DEVICE_PATH_PROTOCOL
*DevicePath;
EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath;
EFI_HANDLE
Handle;