2 * File to implement LibScanHandleDatabase(), which is used by rEFInd's
3 * driver-loading code (inherited from rEFIt), but which has not been
4 * implemented in GNU-EFI and seems to have been dropped from current
5 * versions of the Tianocore library. This function was taken from a git
6 * site with EFI code. The original file bore the following copyright
9 * Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
10 * This program and the accompanying materials are licensed and made available under
11 * the terms and conditions of the BSD License that accompanies this distribution.
12 * The full text of the license may be found at
13 * http://opensource.org/licenses/bsd-license.php.
15 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #ifdef __MAKEWITH_GNUEFI
22 #include <efi/efilib.h>
24 #include "../include/tiano_includes.h"
28 #ifndef _DRIVER_SUPPORT
29 #define _DRIVER_SUPPORT
31 // Below is from http://git.etherboot.org/?p=mirror/efi/shell/.git;a=commitdiff;h=b1b0c63423cac54dc964c2930e04aebb46a946ec;
32 // Seems to have been replaced by ParseHandleDatabaseByRelationshipWithType(), but the latter isn't working for me....
34 LibScanHandleDatabase (
35 EFI_HANDLE DriverBindingHandle
, OPTIONAL
36 UINT32
*DriverBindingHandleIndex
, OPTIONAL
37 EFI_HANDLE ControllerHandle
, OPTIONAL
38 UINT32
*ControllerHandleIndex
, OPTIONAL
40 EFI_HANDLE
**HandleBuffer
,
45 #define EFI_HANDLE_TYPE_UNKNOWN 0x000
46 #define EFI_HANDLE_TYPE_IMAGE_HANDLE 0x001
47 #define EFI_HANDLE_TYPE_DRIVER_BINDING_HANDLE 0x002
48 #define EFI_HANDLE_TYPE_DEVICE_DRIVER 0x004
49 #define EFI_HANDLE_TYPE_BUS_DRIVER 0x008
50 #define EFI_HANDLE_TYPE_DRIVER_CONFIGURATION_HANDLE 0x010
51 #define EFI_HANDLE_TYPE_DRIVER_DIAGNOSTICS_HANDLE 0x020
52 #define EFI_HANDLE_TYPE_COMPONENT_NAME_HANDLE 0x040
53 #define EFI_HANDLE_TYPE_DEVICE_HANDLE 0x080
54 #define EFI_HANDLE_TYPE_PARENT_HANDLE 0x100
55 #define EFI_HANDLE_TYPE_CONTROLLER_HANDLE 0x200
56 #define EFI_HANDLE_TYPE_CHILD_HANDLE 0x400