iPXE
Functions
efi_blacklist.h File Reference

EFI driver blacklist. More...

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
void efi_unload_blacklist (void)
 Unload any blacklisted drivers.

Detailed Description

EFI driver blacklist.

Definition in file efi_blacklist.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
void efi_unload_blacklist ( void  )

Unload any blacklisted drivers.

Definition at line 196 of file efi_blacklist.c.

References efi_blacklist::blacklist, EFI_SYSTEM_TABLE::BootServices, ByProtocol, DBGC, EEFI, efi_driver_binding_protocol_guid, efi_handle_name(), efi_systab, EFI_BOOT_SERVICES::FreePool, EFI_BOOT_SERVICES::LocateHandleBuffer, efi_blacklist::name, NULL, rc, strerror(), and EFI_BOOT_SERVICES::UnloadImage.

Referenced by efi_probe().

                                   {
        EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
        struct efi_blacklist *blacklist;
        EFI_HANDLE *drivers;
        EFI_HANDLE driver;
        UINTN num_drivers;
        unsigned int i;
        EFI_STATUS efirc;
        int rc;

        /* Locate all driver binding protocol handles */
        if ( ( efirc = bs->LocateHandleBuffer (
                        ByProtocol, &efi_driver_binding_protocol_guid,
                        NULL, &num_drivers, &drivers ) ) != 0 ) {
                rc = -EEFI ( efirc );
                DBGC ( &efi_blacklists, "EFIBL could not list all drivers: "
                       "%s\n", strerror ( rc ) );
                return;
        }

        /* Unload any blacklisted drivers */
        for ( i = 0 ; i < num_drivers ; i++ ) {
                driver = drivers[i];
                if ( ( rc = efi_blacklist ( driver, &blacklist ) ) != 0 ) {
                        DBGC ( driver, "EFIBL could not determine "
                               "blacklisting for %s: %s\n",
                               efi_handle_name ( driver ), strerror ( rc ) );
                        continue;
                }
                if ( ! blacklist )
                        continue;
                DBGC ( driver, "EFIBL unloading %s (%s)\n",
                       efi_handle_name ( driver ), blacklist->name );
                if ( ( efirc = bs->UnloadImage ( driver ) ) != 0 ) {
                        DBGC ( driver, "EFIBL could not unload %s: %s\n",
                               efi_handle_name ( driver ), strerror ( rc ) );
                }
        }

        /* Free handle list */
        bs->FreePool ( drivers );
}