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. More...
 

Detailed Description

EFI driver blacklist.

Definition in file efi_blacklist.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ efi_unload_blacklist()

void efi_unload_blacklist ( void  )

Unload any blacklisted drivers.

Definition at line 196 of file efi_blacklist.c.

196  {
198  struct efi_blacklist *blacklist;
199  EFI_HANDLE *drivers;
200  EFI_HANDLE driver;
201  UINTN num_drivers;
202  unsigned int i;
203  EFI_STATUS efirc;
204  int rc;
205 
206  /* Locate all driver binding protocol handles */
207  if ( ( efirc = bs->LocateHandleBuffer (
209  NULL, &num_drivers, &drivers ) ) != 0 ) {
210  rc = -EEFI ( efirc );
211  DBGC ( &efi_blacklists, "EFIBL could not list all drivers: "
212  "%s\n", strerror ( rc ) );
213  return;
214  }
215 
216  /* Unload any blacklisted drivers */
217  for ( i = 0 ; i < num_drivers ; i++ ) {
218  driver = drivers[i];
219  if ( ( rc = efi_blacklist ( driver, &blacklist ) ) != 0 ) {
220  DBGC ( driver, "EFIBL could not determine "
221  "blacklisting for %s: %s\n",
222  efi_handle_name ( driver ), strerror ( rc ) );
223  continue;
224  }
225  if ( ! blacklist )
226  continue;
227  DBGC ( driver, "EFIBL unloading %s (%s)\n",
228  efi_handle_name ( driver ), blacklist->name );
229  if ( ( efirc = bs->UnloadImage ( driver ) ) != 0 ) {
230  DBGC ( driver, "EFIBL could not unload %s: %s\n",
231  efi_handle_name ( driver ), strerror ( rc ) );
232  }
233  }
234 
235  /* Free handle list */
236  bs->FreePool ( drivers );
237 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2000
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:157
#define DBGC(...)
Definition: compiler.h:505
EFI_IMAGE_UNLOAD UnloadImage
Definition: UefiSpec.h:1886
A blacklisted driver.
Definition: efi_blacklist.c:39
static struct efi_blacklist efi_blacklists[]
Blacklisted drivers.
Definition: efi_blacklist.c:90
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:713
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
int(* blacklist)(EFI_DRIVER_BINDING_PROTOCOL *binding, EFI_LOADED_IMAGE_PROTOCOL *loaded, EFI_COMPONENT_NAME_PROTOCOL *wtf)
Check if driver is blacklisted.
Definition: efi_blacklist.c:50
EFI Boot Services Table.
Definition: UefiSpec.h:1836
UINT64 UINTN
Unsigned value of native width.
Definition: ProcessorBind.h:71
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1855
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
Retrieve the set of handles from the handle database that support a specified protocol.
Definition: UefiSpec.h:1448
EFI_SYSTEM_TABLE * efi_systab
EFI_GUID efi_driver_binding_protocol_guid
Driver binding protocol GUID.
Definition: efi_guid.c:148
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
Definition: efi.h:55
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
Definition: UefiSpec.h:1913

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

Referenced by efi_probe().